Skip to content

Commit ba4b35f

Browse files
authored
Merge branch 'main' into issue_14377
Signed-off-by: kkewwei <[email protected]>
2 parents 2326e62 + e8b7913 commit ba4b35f

File tree

108 files changed

+4248
-1106
lines changed

Some content is hidden

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

108 files changed

+4248
-1106
lines changed

.github/CODEOWNERS

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
# 3. Use the command palette to run the CODEOWNERS: Show owners of current file command, which will display all code owners for the current file.
1212

1313
# Default ownership for all repo files
14-
* @anasalkouz @andrross @Bukhtawar @CEHENKLE @dblock @dbwiddis @dreamer-89 @gbbafna @kotwanikunal @mch2 @msfroh @nknize @owaiskazi19 @reta @Rishikesh1159 @sachinpkale @saratvemulapalli @shwetathareja @sohami @tlfeng @VachaShah
14+
* @anasalkouz @andrross @Bukhtawar @CEHENKLE @dblock @dbwiddis @gbbafna @kotwanikunal @mch2 @msfroh @nknize @owaiskazi19 @reta @Rishikesh1159 @sachinpkale @saratvemulapalli @shwetathareja @sohami @VachaShah
1515

1616
/modules/transport-netty4/ @peternied
1717

@@ -24,4 +24,4 @@
2424

2525
/.github/ @peternied
2626

27-
/MAINTAINERS.md @anasalkouz @andrross @Bukhtawar @CEHENKLE @dblock @dbwiddis @dreamer-89 @gbbafna @jed326 @kotwanikunal @mch2 @msfroh @nknize @owaiskazi19 @peternied @reta @Rishikesh1159 @sachinpkale @saratvemulapalli @shwetathareja @sohami @tlfeng @VachaShah
27+
/MAINTAINERS.md @anasalkouz @andrross @Bukhtawar @CEHENKLE @dblock @dbwiddis @gbbafna @jed326 @kotwanikunal @mch2 @msfroh @nknize @owaiskazi19 @peternied @reta @Rishikesh1159 @sachinpkale @saratvemulapalli @shwetathareja @sohami @VachaShah

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
77
### Added
88
- Add fingerprint ingest processor ([#13724](https://github.com/opensearch-project/OpenSearch/pull/13724))
99
- [Remote Store] Rate limiter for remote store low priority uploads ([#14374](https://github.com/opensearch-project/OpenSearch/pull/14374/))
10+
- Apply the date histogram rewrite optimization to range aggregation ([#13865](https://github.com/opensearch-project/OpenSearch/pull/13865))
11+
- [Writable Warm] Add composite directory implementation and integrate it with FileCache ([12782](https://github.com/opensearch-project/OpenSearch/pull/12782))
1012

1113
### Dependencies
1214
- Bump `org.gradle.test-retry` from 1.5.8 to 1.5.9 ([#13442](https://github.com/opensearch-project/OpenSearch/pull/13442))
@@ -19,9 +21,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
1921
- Bump `com.nimbusds:nimbus-jose-jwt` from 9.37.3 to 9.40 ([#14398](https://github.com/opensearch-project/OpenSearch/pull/14398))
2022
- Bump `org.apache.commons:commons-configuration2` from 2.10.1 to 2.11.0 ([#14399](https://github.com/opensearch-project/OpenSearch/pull/14399))
2123
- Bump `com.gradle.develocity` from 3.17.4 to 3.17.5 ([#14397](https://github.com/opensearch-project/OpenSearch/pull/14397))
24+
- Bump `opentelemetry` from 1.36.0 to 1.39.0 ([#14457](https://github.com/opensearch-project/OpenSearch/pull/14457))
2225

2326
### Changed
27+
- unsignedLongRangeQuery now returns MatchNoDocsQuery if the lower bounds are greater than the upper bounds ([#14416](https://github.com/opensearch-project/OpenSearch/pull/14416))
2428
- Updated the `indices.query.bool.max_clause_count` setting from being static to dynamically updateable ([#13568](https://github.com/opensearch-project/OpenSearch/pull/13568))
29+
- Make the class CommunityIdProcessor final ([#14448](https://github.com/opensearch-project/OpenSearch/pull/14448))
2530

2631
### Deprecated
2732

@@ -30,6 +35,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
3035
### Fixed
3136
- Fix handling of Short and Byte data types in ScriptProcessor ingest pipeline ([#14379](https://github.com/opensearch-project/OpenSearch/issues/14379))
3237
- Switch to iterative version of WKT format parser ([#14086](https://github.com/opensearch-project/OpenSearch/pull/14086))
38+
- Fix the computed max shards of cluster to avoid int overflow ([#14155](https://github.com/opensearch-project/OpenSearch/pull/14155))
39+
- Fixed rest-high-level client searchTemplate & mtermVectors endpoints to have a leading slash ([#14465](https://github.com/opensearch-project/OpenSearch/pull/14465))
3340
- Fix FuzzyQuery in keyword field will use IndexOrDocValuesQuery when both of index and doc_value are true ([#14378](https://github.com/opensearch-project/OpenSearch/pull/14378))
3441

3542
### Security

MAINTAINERS.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,18 @@ This document contains a list of maintainers in this repo. See [opensearch-proje
2626
| Sarat Vemulapalli | [saratvemulapalli](https://github.com/saratvemulapalli) | Amazon |
2727
| Shweta Thareja | [shwetathareja](https://github.com/shwetathareja) | Amazon |
2828
| Sorabh Hamirwasia | [sohami](https://github.com/sohami) | Amazon |
29-
| Suraj Singh | [dreamer-89](https://github.com/dreamer-89) | Amazon |
30-
| Tianli Feng | [tlfeng](https://github.com/tlfeng) | Amazon |
3129
| Vacha Shah | [VachaShah](https://github.com/VachaShah) | Amazon |
3230

3331
## Emeritus
3432

35-
| Maintainer | GitHub ID | Affiliation |
36-
| --------------------- | ----------------------------------------- | ----------- |
37-
| Megha Sai Kavikondala | [meghasaik](https://github.com/meghasaik) | Amazon |
38-
| Xue Zhou | [xuezhou25](https://github.com/xuezhou25) | Amazon |
39-
| Kartik Ganesh | [kartg](https://github.com/kartg) | Amazon |
40-
| Abbas Hussain | [abbashus](https://github.com/abbashus) | Meta |
41-
| Himanshu Setia | [setiah](https://github.com/setiah) | Amazon |
42-
| Ryan Bogan | [ryanbogan](https://github.com/ryanbogan) | Amazon |
43-
| Rabi Panda | [adnapibar](https://github.com/adnapibar) | Independent |
33+
| Maintainer | GitHub ID | Affiliation |
34+
| ---------------------- |-------------------------------------------- | ----------- |
35+
| Megha Sai Kavikondala | [meghasaik](https://github.com/meghasaik) | Amazon |
36+
| Xue Zhou | [xuezhou25](https://github.com/xuezhou25) | Amazon |
37+
| Kartik Ganesh | [kartg](https://github.com/kartg) | Amazon |
38+
| Abbas Hussain | [abbashus](https://github.com/abbashus) | Meta |
39+
| Himanshu Setia | [setiah](https://github.com/setiah) | Amazon |
40+
| Ryan Bogan | [ryanbogan](https://github.com/ryanbogan) | Amazon |
41+
| Rabi Panda | [adnapibar](https://github.com/adnapibar) | Independent |
42+
| Tianli Feng | [tlfeng](https://github.com/tlfeng) | Amazon |
43+
| Suraj Singh | [dreamer-89](https://github.com/dreamer-89) | Amazon |

TESTING.md

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ OpenSearch uses [jUnit](https://junit.org/junit5/) for testing, it also uses ran
3333
- [Bad practices](#bad-practices)
3434
- [Use randomized-testing for coverage](#use-randomized-testing-for-coverage)
3535
- [Abuse randomization in multi-threaded tests](#abuse-randomization-in-multi-threaded-tests)
36+
- [Use `Thread.sleep`](#use-threadsleep)
37+
- [Expect a specific segment topology](#expect-a-specific-segment-topology)
38+
- [Leave environment in an unstable state after test](#leave-environment-in-an-unstable-state-after-test)
3639
- [Test coverage analysis](#test-coverage-analysis)
3740
- [Building with extra plugins](#building-with-extra-plugins)
3841
- [Environment misc](#environment-misc)
@@ -455,7 +458,7 @@ Unit tests are the preferred way to test some functionality: most of the time th
455458

456459
The reason why `OpenSearchSingleNodeTestCase` exists is that all our components used to be very hard to set up in isolation, which had led us to having a number of integration tests but close to no unit tests. `OpenSearchSingleNodeTestCase` is a workaround for this issue which provides an easy way to spin up a node and get access to components that are hard to instantiate like `IndicesService`. Whenever practical, you should prefer unit tests.
457460

458-
Finally, if the the functionality under test needs to be run in a cluster, there are two test classes to consider:
461+
Finally, if the functionality under test needs to be run in a cluster, there are two test classes to consider:
459462
* `OpenSearchRestTestCase` will connect to an external cluster. This is a good option if the tests cases don't rely on a specific configuration of the test cluster. A test cluster is set up as part of the Gradle task running integration tests, and test cases using this class can connect to it. The configuration of the cluster is provided in the Gradle files.
460463
* `OpenSearchIntegTestCase` will create a local cluster as part of each test case. The configuration of the cluster is controlled by the test class. This is a good option if different tests cases depend on different cluster configurations, as it would be impractical (and limit parallelization) to keep re-configuring (and re-starting) the external cluster for each test case. A good example of when this class might come in handy is for testing security features, where different cluster configurations are needed to fully test each one.
461464

@@ -477,6 +480,27 @@ However, it should not be used for coverage. For instance if you are testing a p
477480

478481
Multi-threaded tests are often not reproducible due to the fact that there is no guarantee on the order in which operations occur across threads. Adding randomization to the mix usually makes things worse and should be done with care.
479482

483+
### Use `Thread.sleep`
484+
485+
`Thread.sleep()` is almost always a bad idea because it is very difficult to know that you've waited long enough. Using primitives like `waitUntil` or `assertBusy`, which use Thread.sleep internally, is okay to wait for a specific condition. However, it is almost always better to instrument your code with concurrency primitives like a `CountDownLatch` that will allow you to deterministically wait for a specific condition, without waiting longer than necessary that will happen with a polling approach used by `assertBusy`.
486+
487+
Example:
488+
- [PrimaryShardAllocatorIT](https://github.com/opensearch-project/OpenSearch/blob/7ffcd6500e0bd5956cef5c289ee66d9f99d533fc/server/src/internalClusterTest/java/org/opensearch/gateway/ReplicaShardAllocatorIT.java#L208-L235): This test is using two latches: one to wait for a recovery to start and one to block that recovery so that it can deterministically test things that happen during a recovery.
489+
490+
### Expect a specific segment topology
491+
492+
By design, OpenSearch integration tests will vary how the merge policy works because in almost all scenarios you should not depend on a specific segment topology (in the real world your code will see a huge diversity of indexing workloads with OpenSearch merging things in the background all the time!). If you do in fact need to care about the segment topology (e.g. for testing statistics that might vary slightly depending on number of segments), then you must take care to ensure that segment topology is deterministic by doing things like disabling background refreshes, force merging after indexing data, etc.
493+
494+
Example:
495+
- [SegmentReplicationResizeRequestIT](https://github.com/opensearch-project/OpenSearch/blob/f715ee1a485e550802accc1c2e3d8101208d4f0b/server/src/internalClusterTest/java/org/opensearch/indices/replication/SegmentReplicationResizeRequestIT.java#L102-L109): This test disables refreshes to prevent interfering with the segment replication behavior under test.
496+
497+
### Leave environment in an unstable state after test
498+
499+
The default test case will ensure that no open file handles or running threads are left after tear down. You must ensure that all resources are cleaned up at the end of each test case, or else the cleanup may end up racing with the tear down logic in the base test class in a way that is very difficult to reproduce.
500+
501+
Example:
502+
- [AwarenessAttributeDecommissionIT](https://github.com/opensearch-project/OpenSearch/blob/main/server/src/internalClusterTest/java/org/opensearch/cluster/coordination/AwarenessAttributeDecommissionIT.java#L951): Recommissions any decommissioned nodes at the end of the test to ensure the after-test checks succeed.
503+
480504
# Test coverage analysis
481505

482506
The code coverage report can be generated through Gradle with [JaCoCo plugin](https://docs.gradle.org/current/userguide/jacoco_plugin.html).

buildSrc/version.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,5 +74,5 @@ jzlib = 1.1.3
7474
resteasy = 6.2.4.Final
7575

7676
# opentelemetry dependencies
77-
opentelemetry = 1.36.0
78-
opentelemetrysemconv = 1.23.1-alpha
77+
opentelemetry = 1.39.0
78+
opentelemetrysemconv = 1.25.0-alpha

client/rest-high-level/src/main/java/org/opensearch/client/RequestConverters.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,7 @@ static Request searchTemplate(SearchTemplateRequest searchTemplateRequest) throw
540540
Request request;
541541

542542
if (searchTemplateRequest.isSimulate()) {
543-
request = new Request(HttpGet.METHOD_NAME, "_render/template");
543+
request = new Request(HttpGet.METHOD_NAME, "/_render/template");
544544
} else {
545545
SearchRequest searchRequest = searchTemplateRequest.getRequest();
546546
String endpoint = endpoint(searchRequest.indices(), "_search/template");
@@ -803,8 +803,7 @@ static Request termVectors(TermVectorsRequest tvrequest) throws IOException {
803803
}
804804

805805
static Request mtermVectors(MultiTermVectorsRequest mtvrequest) throws IOException {
806-
String endpoint = "_mtermvectors";
807-
Request request = new Request(HttpGet.METHOD_NAME, endpoint);
806+
Request request = new Request(HttpGet.METHOD_NAME, "/_mtermvectors");
808807
request.setEntity(createEntity(mtvrequest, REQUEST_BODY_CONTENT_TYPE));
809808
return request;
810809
}

client/rest-high-level/src/test/java/org/opensearch/client/IndicesClientIT.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -701,7 +701,7 @@ public void testOpenExistingIndex() throws IOException {
701701
closeIndex(index);
702702
ResponseException exception = expectThrows(
703703
ResponseException.class,
704-
() -> client().performRequest(new Request(HttpGet.METHOD_NAME, index + "/_search"))
704+
() -> client().performRequest(new Request(HttpGet.METHOD_NAME, "/" + index + "/_search"))
705705
);
706706
assertThat(exception.getResponse().getStatusLine().getStatusCode(), equalTo(RestStatus.BAD_REQUEST.getStatus()));
707707
assertThat(exception.getMessage().contains(index), equalTo(true));
@@ -714,7 +714,7 @@ public void testOpenExistingIndex() throws IOException {
714714
);
715715
assertTrue(openIndexResponse.isAcknowledged());
716716

717-
Response response = client().performRequest(new Request(HttpGet.METHOD_NAME, index + "/_search"));
717+
Response response = client().performRequest(new Request(HttpGet.METHOD_NAME, "/" + index + "/_search"));
718718
assertThat(response.getStatusLine().getStatusCode(), equalTo(RestStatus.OK.getStatus()));
719719
}
720720

@@ -771,7 +771,7 @@ public void testCloseExistingIndex() throws IOException {
771771

772772
ResponseException exception = expectThrows(
773773
ResponseException.class,
774-
() -> client().performRequest(new Request(HttpGet.METHOD_NAME, indexResult.getIndex() + "/_search"))
774+
() -> client().performRequest(new Request(HttpGet.METHOD_NAME, "/" + indexResult.getIndex() + "/_search"))
775775
);
776776
assertThat(exception.getResponse().getStatusLine().getStatusCode(), equalTo(RestStatus.BAD_REQUEST.getStatus()));
777777
assertThat(exception.getMessage().contains(indexResult.getIndex()), equalTo(true));
@@ -1270,7 +1270,7 @@ public void testGetAliasesNonExistentIndexOrAlias() throws IOException {
12701270
assertThat(getAliasesResponse.getException(), nullValue());
12711271
}
12721272
createIndex(index, Settings.EMPTY);
1273-
client().performRequest(new Request(HttpPut.METHOD_NAME, index + "/_alias/" + alias));
1273+
client().performRequest(new Request(HttpPut.METHOD_NAME, "/" + index + "/_alias/" + alias));
12741274
{
12751275
GetAliasesRequest getAliasesRequest = new GetAliasesRequest().indices(index, "non_existent_index");
12761276
GetAliasesResponse getAliasesResponse = execute(

client/rest-high-level/src/test/java/org/opensearch/client/RankEvalIT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ public void testRankEvalRequest() throws IOException {
121121
}
122122

123123
// now try this when test2 is closed
124-
client().performRequest(new Request("POST", "index2/_close"));
124+
client().performRequest(new Request("POST", "/index2/_close"));
125125
rankEvalRequest.indicesOptions(IndicesOptions.fromParameters(null, "true", null, "false", SearchRequest.DEFAULT_INDICES_OPTIONS));
126126
response = execute(rankEvalRequest, highLevelClient()::rankEval, highLevelClient()::rankEvalAsync);
127127
}

client/rest-high-level/src/test/java/org/opensearch/client/RequestConvertersTests.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1399,7 +1399,7 @@ public void testRenderSearchTemplate() throws Exception {
13991399

14001400
// Verify that the resulting REST request looks as expected.
14011401
Request request = RequestConverters.searchTemplate(searchTemplateRequest);
1402-
String endpoint = "_render/template";
1402+
String endpoint = "/_render/template";
14031403

14041404
assertEquals(HttpGet.METHOD_NAME, request.getMethod());
14051405
assertEquals(endpoint, request.getEndpoint());
@@ -1565,7 +1565,7 @@ public void testMultiTermVectors() throws IOException {
15651565

15661566
Request request = RequestConverters.mtermVectors(mtvRequest);
15671567
assertEquals(HttpGet.METHOD_NAME, request.getMethod());
1568-
assertEquals("_mtermvectors", request.getEndpoint());
1568+
assertEquals("/_mtermvectors", request.getEndpoint());
15691569
assertToXContentBody(mtvRequest, request.getEntity());
15701570
}
15711571

@@ -1585,7 +1585,7 @@ public void testMultiTermVectorsWithType() throws IOException {
15851585

15861586
Request request = RequestConverters.mtermVectors(mtvRequest);
15871587
assertEquals(HttpGet.METHOD_NAME, request.getMethod());
1588-
assertEquals("_mtermvectors", request.getEndpoint());
1588+
assertEquals("/_mtermvectors", request.getEndpoint());
15891589
assertToXContentBody(mtvRequest, request.getEntity());
15901590
}
15911591

client/rest-high-level/src/test/java/org/opensearch/client/SearchIT.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -727,7 +727,7 @@ public void testSearchWithSuggest() throws IOException {
727727
}
728728

729729
public void testSearchWithWeirdScriptFields() throws Exception {
730-
Request doc = new Request("PUT", "test/_doc/1");
730+
Request doc = new Request("PUT", "/test/_doc/1");
731731
doc.setJsonEntity("{\"field\":\"value\"}");
732732
client().performRequest(doc);
733733
client().performRequest(new Request("POST", "/test/_refresh"));
@@ -774,7 +774,7 @@ public void testSearchWithWeirdScriptFields() throws Exception {
774774
public void testSearchWithDerivedFields() throws Exception {
775775
// Just testing DerivedField definition from SearchSourceBuilder derivedField()
776776
// We are not testing the full functionality here
777-
Request doc = new Request("PUT", "test/_doc/1");
777+
Request doc = new Request("PUT", "/test/_doc/1");
778778
doc.setJsonEntity("{\"field\":\"value\"}");
779779
client().performRequest(doc);
780780
client().performRequest(new Request("POST", "/test/_refresh"));

client/rest-high-level/src/test/java/org/opensearch/client/documentation/SearchDocumentationIT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -998,7 +998,7 @@ public void onFailure(Exception e) {
998998

999999
protected void registerQueryScript(RestClient restClient) throws IOException {
10001000
// tag::register-script
1001-
Request scriptRequest = new Request("POST", "_scripts/title_search");
1001+
Request scriptRequest = new Request("POST", "/_scripts/title_search");
10021002
scriptRequest.setJsonEntity(
10031003
"{" +
10041004
" \"script\": {" +

client/rest-high-level/src/test/java/org/opensearch/client/documentation/SnapshotClientDocumentationIT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -827,7 +827,7 @@ private void createTestIndex() throws IOException {
827827
}
828828

829829
private void createTestSnapshots() throws IOException {
830-
Request createSnapshot = new Request("put", String.format(Locale.ROOT, "_snapshot/%s/%s", repositoryName, snapshotName));
830+
Request createSnapshot = new Request("put", String.format(Locale.ROOT, "/_snapshot/%s/%s", repositoryName, snapshotName));
831831
createSnapshot.addParameter("wait_for_completion", "true");
832832
createSnapshot.setJsonEntity("{\"indices\":\"" + indexName + "\"}");
833833
Response response = highLevelClient().getLowLevelClient().performRequest(createSnapshot);

modules/ingest-common/src/main/java/org/opensearch/ingest/common/CommunityIdProcessor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
* Processor that generating community id flow hash for the network flow tuples, the algorithm is defined in
3030
* <a href="https://github.com/corelight/community-id-spec">Community ID Flow Hashing</a>.
3131
*/
32-
public class CommunityIdProcessor extends AbstractProcessor {
32+
public final class CommunityIdProcessor extends AbstractProcessor {
3333
public static final String TYPE = "community_id";
3434
// the version of the community id flow hashing algorithm
3535
private static final String COMMUNITY_ID_HASH_VERSION = "1";

0 commit comments

Comments
 (0)