Skip to content

Commit 64b689a

Browse files
Merge branch 'opensearch-project:main' into issueSA
2 parents 0415f58 + 7dca3ca commit 64b689a

File tree

170 files changed

+3791
-413
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

170 files changed

+3791
-413
lines changed

.github/workflows/auto-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
steps:
1515
- name: GitHub App token
1616
id: github_app_token
17-
uses: tibdex/github-app-token@v1.5.0
17+
uses: tibdex/github-app-token@v2.1.0
1818
with:
1919
app_id: ${{ secrets.APP_ID }}
2020
private_key: ${{ secrets.APP_PRIVATE_KEY }}

.github/workflows/backport.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
steps:
2727
- name: GitHub App token
2828
id: github_app_token
29-
uses: tibdex/github-app-token@v1.5.0
29+
uses: tibdex/github-app-token@v2.1.0
3030
with:
3131
app_id: ${{ secrets.APP_ID }}
3232
private_key: ${{ secrets.APP_PRIVATE_KEY }}

.github/workflows/create-documentation-issue.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
steps:
1515
- name: GitHub App token
1616
id: github_app_token
17-
uses: tibdex/github-app-token@v1.5.0
17+
uses: tibdex/github-app-token@v2.1.0
1818
with:
1919
app_id: ${{ secrets.APP_ID }}
2020
private_key: ${{ secrets.APP_PRIVATE_KEY }}

.github/workflows/dependabot_pr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
steps:
1212
- name: GitHub App token
1313
id: github_app_token
14-
uses: tibdex/github-app-token@v1.5.0
14+
uses: tibdex/github-app-token@v2.1.0
1515
with:
1616
app_id: ${{ secrets.APP_ID }}
1717
private_key: ${{ secrets.APP_PRIVATE_KEY }}

.github/workflows/precommit.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,6 @@ jobs:
2222
- name: Setup docker (missing on MacOS)
2323
if: runner.os == 'macos'
2424
run: |
25-
# Workaround for https://github.com/actions/runner-images/issues/8104
26-
brew remove --ignore-dependencies qemu
27-
curl -o ./qemu.rb https://raw.githubusercontent.com/Homebrew/homebrew-core/f88e30b3a23ef3735580f9b05535ce5a0a03c9e3/Formula/qemu.rb
28-
brew install ./qemu.rb
2925
brew install docker
3026
colima start
3127
sudo ln -sf $HOME/.colima/default/docker.sock /var/run/docker.sock

.github/workflows/stalled.yml

Lines changed: 0 additions & 29 deletions
This file was deleted.

.github/workflows/version.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
steps:
1414
- name: GitHub App token
1515
id: github_app_token
16-
uses: tibdex/github-app-token@v1.5.0
16+
uses: tibdex/github-app-token@v2.1.0
1717
with:
1818
app_id: ${{ secrets.APP_ID }}
1919
private_key: ${{ secrets.APP_PRIVATE_KEY }}

buildSrc/build.gradle

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,15 @@ dependencies {
128128
testFixturesApi "com.carrotsearch.randomizedtesting:randomizedtesting-runner:${props.getProperty('randomizedrunner')}"
129129
testFixturesApi gradleApi()
130130
testFixturesApi gradleTestKit()
131-
testImplementation 'com.github.tomakehurst:wiremock-jre8-standalone:2.35.0'
131+
testImplementation 'org.wiremock:wiremock-standalone:3.1.0'
132132
testImplementation "org.mockito:mockito-core:${props.getProperty('mockito')}"
133133
integTestImplementation('org.spockframework:spock-core:2.3-groovy-3.0') {
134134
exclude module: "groovy"
135135
}
136+
implementation('org.ajoberstar.grgit:grgit-core:5.2.0') {
137+
exclude group: 'org.eclipse.jgit', module: 'org.eclipse.jgit'
138+
}
139+
implementation 'org.eclipse.jgit:org.eclipse.jgit:6.7.0.202309050840-r'
136140
}
137141

138142
configurations.all {

buildSrc/version.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
opensearch = 3.0.0
2-
lucene = 9.8.0-snapshot-4373c3b
2+
lucene = 9.8.0-snapshot-95cdd2e
33

44
bundled_jdk_vendor = adoptium
55
bundled_jdk = 20.0.2+9

libs/common/src/main/java/org/opensearch/common/collect/Iterators.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,15 @@
4141
* @opensearch.internal
4242
*/
4343
public class Iterators {
44+
45+
/**
46+
* Concat iterators
47+
*
48+
* @param iterators the iterators to concat
49+
* @param <T> the type of iterator
50+
* @return a new {@link ConcatenatedIterator}
51+
* @throws NullPointerException if iterators is null
52+
*/
4453
public static <T> Iterator<T> concat(Iterator<? extends T>... iterators) {
4554
if (iterators == null) {
4655
throw new NullPointerException("iterators");
@@ -71,6 +80,11 @@ static class ConcatenatedIterator<T> implements Iterator<T> {
7180
this.iterators = iterators;
7281
}
7382

83+
/**
84+
* Returns {@code true} if the iteration has more elements. (In other words, returns {@code true} if {@link #next} would return an
85+
* element rather than throwing an exception.)
86+
* @return {@code true} if the iteration has more elements
87+
*/
7488
@Override
7589
public boolean hasNext() {
7690
boolean hasNext = false;
@@ -81,6 +95,11 @@ public boolean hasNext() {
8195
return hasNext;
8296
}
8397

98+
/**
99+
* Returns the next element in the iteration.
100+
* @return the next element in the iteration
101+
* @throws NoSuchElementException if the iteration has no more elements
102+
*/
84103
@Override
85104
public T next() {
86105
if (!hasNext()) {

libs/compress/src/main/java/org/opensearch/compress/ZstdCompressor.java

Lines changed: 47 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,13 @@
3030
* @opensearch.experimental - class methods might change
3131
*/
3232
public class ZstdCompressor implements Compressor {
33-
// An arbitrary header that we use to identify compressed streams
34-
// It needs to be different from other compressors and to not be specific
35-
// enough so that no stream starting with these bytes could be detected as
36-
// a XContent
33+
34+
/**
35+
* An arbitrary header that we use to identify compressed streams
36+
* It needs to be different from other compressors and to not be specific
37+
* enough so that no stream starting with these bytes could be detected as
38+
* a XContent
39+
* */
3740
private static final byte[] HEADER = new byte[] { 'Z', 'S', 'T', 'D', '\0' };
3841

3942
/**
@@ -44,10 +47,20 @@ public class ZstdCompressor implements Compressor {
4447
@PublicApi(since = "2.10.0")
4548
public static final String NAME = "ZSTD";
4649

50+
/**
51+
* The compression level for {@link ZstdOutputStreamNoFinalizer}
52+
*/
4753
private static final int LEVEL = 3;
4854

55+
/** The buffer size for {@link BufferedInputStream} and {@link BufferedOutputStream}
56+
*/
4957
private static final int BUFFER_SIZE = 4096;
5058

59+
/**
60+
* Compares the given bytes with the {@link ZstdCompressor#HEADER} of a compressed stream
61+
* @param bytes the bytes to compare to ({@link ZstdCompressor#HEADER})
62+
* @return true if the bytes are the {@link ZstdCompressor#HEADER}, false otherwise
63+
*/
5164
@Override
5265
public boolean isCompressed(BytesReference bytes) {
5366
if (bytes.length() < HEADER.length) {
@@ -61,11 +74,22 @@ public boolean isCompressed(BytesReference bytes) {
6174
return true;
6275
}
6376

77+
/**
78+
* Returns the length of the {@link ZstdCompressor#HEADER}
79+
* @return the {@link ZstdCompressor#HEADER} length
80+
*/
6481
@Override
6582
public int headerLength() {
6683
return HEADER.length;
6784
}
6885

86+
/**
87+
* Returns a new {@link ZstdInputStreamNoFinalizer} from the given compressed {@link InputStream}
88+
* @param in the compressed {@link InputStream}
89+
* @return a new {@link ZstdInputStreamNoFinalizer} from the given compressed {@link InputStream}
90+
* @throws IOException if an I/O error occurs
91+
* @throws IllegalArgumentException if the input stream is not compressed with ZSTD
92+
*/
6993
@Override
7094
public InputStream threadLocalInputStream(InputStream in) throws IOException {
7195
final byte[] header = in.readNBytes(HEADER.length);
@@ -75,17 +99,36 @@ public InputStream threadLocalInputStream(InputStream in) throws IOException {
7599
return new ZstdInputStreamNoFinalizer(new BufferedInputStream(in, BUFFER_SIZE), RecyclingBufferPool.INSTANCE);
76100
}
77101

102+
/**
103+
* Returns a new {@link ZstdOutputStreamNoFinalizer} from the given {@link OutputStream}
104+
* @param out the {@link OutputStream}
105+
* @return a new {@link ZstdOutputStreamNoFinalizer} from the given {@link OutputStream}
106+
* @throws IOException if an I/O error occurs
107+
*/
78108
@Override
79109
public OutputStream threadLocalOutputStream(OutputStream out) throws IOException {
80110
out.write(HEADER);
81111
return new ZstdOutputStreamNoFinalizer(new BufferedOutputStream(out, BUFFER_SIZE), RecyclingBufferPool.INSTANCE, LEVEL);
82112
}
83113

114+
/**
115+
* Always throws an {@link UnsupportedOperationException} as ZSTD compression is supported only for snapshotting
116+
* @param bytesReference a reference to the bytes to uncompress
117+
* @return always throws an exception
118+
* @throws UnsupportedOperationException if the method is called
119+
* @throws IOException is never thrown
120+
*/
84121
@Override
85122
public BytesReference uncompress(BytesReference bytesReference) throws IOException {
86123
throw new UnsupportedOperationException("ZSTD compression is supported only for snapshotting");
87124
}
88125

126+
/**
127+
* Always throws an {@link UnsupportedOperationException} as ZSTD compression is supported only for snapshotting
128+
* @param bytesReference a reference to the bytes to compress
129+
* @return always throws an exception
130+
* @throws UnsupportedOperationException if the method is called
131+
*/
89132
@Override
90133
public BytesReference compress(BytesReference bytesReference) throws IOException {
91134
throw new UnsupportedOperationException("ZSTD compression is supported only for snapshotting");

libs/core/licenses/lucene-core-9.8.0-snapshot-4373c3b.jar.sha1

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
d2f7fbc5b2c49ca777a169d579f41082a9a57cc7

libs/core/src/main/java/org/opensearch/core/common/breaker/CircuitBreaker.java

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,17 +71,23 @@ public interface CircuitBreaker {
7171

7272
/**
7373
* The type of breaker
74-
*
74+
* can be {@link #MEMORY}, {@link #PARENT}, or {@link #NOOP}
7575
* @opensearch.internal
7676
*/
7777
enum Type {
78-
// A regular or ChildMemoryCircuitBreaker
78+
/** A regular or ChildMemoryCircuitBreaker */
7979
MEMORY,
80-
// A special parent-type for the hierarchy breaker service
80+
/** A special parent-type for the hierarchy breaker service */
8181
PARENT,
82-
// A breaker where every action is a noop, it never breaks
82+
/** A breaker where every action is a noop, it never breaks */
8383
NOOP;
8484

85+
/**
86+
* Converts string (case-insensitive) to breaker {@link Type}
87+
* @param value "noop", "parent", or "memory" (case-insensitive)
88+
* @return the breaker {@link Type}
89+
* @throws IllegalArgumentException if value is not "noop", "parent", or "memory"
90+
*/
8591
public static Type parseValue(String value) {
8692
switch (value.toLowerCase(Locale.ROOT)) {
8793
case "noop":
@@ -98,13 +104,13 @@ public static Type parseValue(String value) {
98104

99105
/**
100106
* The breaker durability
101-
*
107+
* can be {@link #TRANSIENT} or {@link #PERMANENT}
102108
* @opensearch.internal
103109
*/
104110
enum Durability {
105-
// The condition that tripped the circuit breaker fixes itself eventually.
111+
/** The condition that tripped the circuit breaker fixes itself eventually. */
106112
TRANSIENT,
107-
// The condition that tripped the circuit breaker requires manual intervention.
113+
/** The condition that tripped the circuit breaker requires manual intervention. */
108114
PERMANENT
109115
}
110116

@@ -120,11 +126,14 @@ enum Durability {
120126
* @param bytes number of bytes to add
121127
* @param label string label describing the bytes being added
122128
* @return the number of "used" bytes for the circuit breaker
129+
* @throws CircuitBreakingException if the breaker tripped
123130
*/
124131
double addEstimateBytesAndMaybeBreak(long bytes, String label) throws CircuitBreakingException;
125132

126133
/**
127134
* Adjust the circuit breaker without tripping
135+
* @param bytes number of bytes to add
136+
* @return the number of "used" bytes for the circuit breaker
128137
*/
129138
long addWithoutBreaking(long bytes);
130139

@@ -154,7 +163,10 @@ enum Durability {
154163
String getName();
155164

156165
/**
157-
* @return whether a tripped circuit breaker will reset itself (transient) or requires manual intervention (permanent).
166+
* Returns the {@link Durability} of this breaker
167+
* @return whether a tripped circuit breaker will
168+
* reset itself ({@link Durability#TRANSIENT})
169+
* or requires manual intervention ({@link Durability#PERMANENT}).
158170
*/
159171
Durability getDurability();
160172

libs/core/src/main/java/org/opensearch/core/common/breaker/CircuitBreakingException.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,11 @@
4646
*/
4747
public class CircuitBreakingException extends OpenSearchException {
4848

49+
/** The number of bytes wanted */
4950
private final long bytesWanted;
51+
/** The circuit breaker limit */
5052
private final long byteLimit;
53+
/** The {@link CircuitBreaker.Durability} of the circuit breaker */
5154
private final CircuitBreaker.Durability durability;
5255

5356
public CircuitBreakingException(StreamInput in) throws IOException {
@@ -88,6 +91,7 @@ public CircuitBreaker.Durability getDurability() {
8891
return durability;
8992
}
9093

94+
/** Always returns {@link RestStatus#TOO_MANY_REQUESTS} */
9195
@Override
9296
public RestStatus status() {
9397
return RestStatus.TOO_MANY_REQUESTS;

0 commit comments

Comments
 (0)