Skip to content

Commit 6bfe0a0

Browse files
committed
Merge branch 'main' into rw/removefeatureflag-1
Signed-off-by: Vinay Krishna Pudyodu <[email protected]>
2 parents d46f9a4 + ddb4354 commit 6bfe0a0

File tree

123 files changed

+5300
-623
lines changed

Some content is hidden

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

123 files changed

+5300
-623
lines changed

.github/workflows/gradle-check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
- uses: actions/checkout@v4
2525
- name: Get changed files
2626
id: changed-files-specific
27-
uses: tj-actions/[email protected].4
27+
uses: tj-actions/[email protected].5
2828
with:
2929
files_ignore: |
3030
release-notes/*.md

CHANGELOG.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
3636
- Add update and delete support in pull-based ingestion ([#17822](https://github.com/opensearch-project/OpenSearch/pull/17822))
3737
- Allow maxPollSize and pollTimeout in IngestionSource to be configurable ([#17863](https://github.com/opensearch-project/OpenSearch/pull/17863))
3838
- [Star Tree] [Search] Add query changes to support unsigned-long in star tree ([#17275](https://github.com/opensearch-project/OpenSearch/pull/17275))
39+
- Add `ApproximateMatchAllQuery` that targets match_all queries and approximates sorts ([#17772](https://github.com/opensearch-project/OpenSearch/pull/17772))
40+
- Add TermsQuery support to Search GRPC endpoint ([#17888](https://github.com/opensearch-project/OpenSearch/pull/17888))
41+
- Support sub agg in filter rewrite optimization ([#17447](https://github.com/opensearch-project/OpenSearch/pull/17447)
42+
- Disable scoring of keyword term search by default, fallback logic with new use_similarity:true parameter ([#17889](https://github.com/opensearch-project/OpenSearch/pull/17889))
3943

4044
### Changed
4145
- Migrate BC libs to their FIPS counterparts ([#14912](https://github.com/opensearch-project/OpenSearch/pull/14912))
@@ -46,6 +50,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
4650
- Avoid skewed segment replication lag metric ([#17831](https://github.com/opensearch-project/OpenSearch/pull/17831))
4751
- Increase the default segment counter step size when replica promoting ([#17568](https://github.com/opensearch-project/OpenSearch/pull/17568))
4852
- [WLM] Rename QueryGroup to WorkloadGroup ([#17901](https://github.com/opensearch-project/OpenSearch/pull/17901))
53+
- Relaxes jarHell check for optionally extended plugins([#17893](https://github.com/opensearch-project/OpenSearch/pull/17893)))
4954

5055
### Dependencies
5156
- Bump `com.nimbusds:nimbus-jose-jwt` from 9.41.1 to 10.0.2 ([#17607](https://github.com/opensearch-project/OpenSearch/pull/17607), [#17669](https://github.com/opensearch-project/OpenSearch/pull/17669))
@@ -55,8 +60,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5560
- Bump `dangoslen/dependabot-changelog-helper` from 3 to 4 ([#17498](https://github.com/opensearch-project/OpenSearch/pull/17498))
5661
- Bump `com.google.api:gax` from 2.35.0 to 2.63.1 ([#17465](https://github.com/opensearch-project/OpenSearch/pull/17465))
5762
- Bump `com.azure:azure-storage-blob` from 12.29.1 to 12.30.0 ([#17667](https://github.com/opensearch-project/OpenSearch/pull/17667))
58-
- Bump `tj-actions/changed-files` from 46.0.1 to 46.0.4 ([#17666](https://github.com/opensearch-project/OpenSearch/pull/17666), [#17813](https://github.com/opensearch-project/OpenSearch/pull/17813))
59-
- Bump `com.google.code.gson:gson` from 2.11.0 to 2.12.1 ([#17668](https://github.com/opensearch-project/OpenSearch/pull/17668))
63+
- Bump `tj-actions/changed-files` from 46.0.1 to 46.0.5 ([#17666](https://github.com/opensearch-project/OpenSearch/pull/17666), [#17813](https://github.com/opensearch-project/OpenSearch/pull/17813), [#17920](https://github.com/opensearch-project/OpenSearch/pull/17920))
64+
- Bump `com.google.code.gson:gson` from 2.11.0 to 2.13.0 ([#17668](https://github.com/opensearch-project/OpenSearch/pull/17668), [#17921](https://github.com/opensearch-project/OpenSearch/pull/17921)), [#17926](https://github.com/opensearch-project/OpenSearch/pull/17926))
6065
- Bump `com.github.luben:zstd-jni` from 1.5.5-1 to 1.5.6-1 ([#17674](https://github.com/opensearch-project/OpenSearch/pull/17674))
6166
- Bump `lycheeverse/lychee-action` from 2.3.0 to 2.4.0 ([#17731](https://github.com/opensearch-project/OpenSearch/pull/17731))
6267
- Bump `com.netflix.nebula.ospackage-base` from 11.11.1 to 11.11.2 ([#17734](https://github.com/opensearch-project/OpenSearch/pull/17734))
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
/*
2+
* SPDX-License-Identifier: Apache-2.0
3+
*
4+
* The OpenSearch Contributors require contributions made to
5+
* this file be licensed under the Apache-2.0 license or a
6+
* compatible open source license.
7+
*/
8+
9+
package org.opensearch.gradle.agent;
10+
11+
import org.gradle.api.Plugin;
12+
import org.gradle.api.Project;
13+
import org.gradle.api.artifacts.Configuration;
14+
import org.gradle.api.tasks.Copy;
15+
import org.gradle.api.tasks.TaskProvider;
16+
import org.gradle.api.tasks.testing.Test;
17+
18+
import java.io.File;
19+
import java.util.Objects;
20+
21+
/**
22+
* Gradle plugin to automatically configure the OpenSearch Java agent
23+
* for test tasks in OpenSearch plugin projects.
24+
*/
25+
public class JavaAgent implements Plugin<Project> {
26+
27+
/**
28+
* Plugin implementation that sets up java agent configuration and applies it to test tasks.
29+
*/
30+
@Override
31+
public void apply(Project project) {
32+
Configuration agentConfiguration = project.getConfigurations().findByName("agent");
33+
if (agentConfiguration == null) {
34+
agentConfiguration = project.getConfigurations().create("agent");
35+
}
36+
37+
project.afterEvaluate(p -> {
38+
String opensearchVersion = getOpensearchVersion(p);
39+
p.getDependencies().add("agent", "org.opensearch:opensearch-agent-bootstrap:" + opensearchVersion);
40+
p.getDependencies().add("agent", "org.opensearch:opensearch-agent:" + opensearchVersion);
41+
});
42+
43+
Configuration finalAgentConfiguration = agentConfiguration;
44+
TaskProvider<Copy> prepareJavaAgent = project.getTasks().register("prepareJavaAgent", Copy.class, task -> {
45+
task.from(finalAgentConfiguration);
46+
task.into(new File(project.getBuildDir(), "agent"));
47+
});
48+
49+
project.getTasks().withType(Test.class).configureEach(testTask -> {
50+
testTask.dependsOn(prepareJavaAgent);
51+
52+
final String opensearchVersion = getOpensearchVersion(project);
53+
54+
testTask.doFirst(task -> {
55+
File agentJar = new File(project.getBuildDir(), "agent/opensearch-agent-" + opensearchVersion + ".jar");
56+
57+
testTask.jvmArgs("-javaagent:" + agentJar.getAbsolutePath());
58+
});
59+
});
60+
}
61+
62+
/**
63+
* Gets the OpenSearch version from project properties, with a fallback default.
64+
*
65+
* @param project The Gradle project
66+
* @return The OpenSearch version to use
67+
*/
68+
private String getOpensearchVersion(Project project) {
69+
return Objects.requireNonNull(project.property("opensearch_version")).toString();
70+
}
71+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#
2+
# SPDX-License-Identifier: Apache-2.0
3+
#
4+
# The OpenSearch Contributors require contributions made to
5+
# this file be licensed under the Apache-2.0 license or a
6+
# compatible open source license.
7+
#
8+
9+
implementation-class=org.opensearch.gradle.agent.JavaAgent
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
/*
2+
* SPDX-License-Identifier: Apache-2.0
3+
*
4+
* The OpenSearch Contributors require contributions made to
5+
* this file be licensed under the Apache-2.0 license or a
6+
* compatible open source license.
7+
*/
8+
9+
package org.opensearch.gradle.agent;
10+
11+
import org.opensearch.gradle.test.GradleUnitTestCase;
12+
import org.gradle.api.Project;
13+
import org.gradle.api.artifacts.Configuration;
14+
import org.gradle.api.tasks.Copy;
15+
import org.gradle.testfixtures.ProjectBuilder;
16+
import org.junit.After;
17+
import org.junit.Before;
18+
import org.junit.Test;
19+
import org.junit.rules.TemporaryFolder;
20+
21+
import java.io.File;
22+
import java.io.IOException;
23+
24+
public class JavaAgentTests extends GradleUnitTestCase {
25+
private TemporaryFolder projectDir;
26+
private final String PREPARE_JAVA_AGENT_TASK = "prepareJavaAgent";
27+
28+
@Before
29+
public void setUp() throws IOException {
30+
projectDir = new TemporaryFolder();
31+
projectDir.create();
32+
}
33+
34+
@After
35+
public void tearDown() {
36+
projectDir.delete();
37+
}
38+
39+
/**
40+
* This test is used to verify that adding the 'opensearch.java-agent' to the project
41+
* creates the necessary agent configuration and tasks. This is basically
42+
* a behavioral test of the {@link JavaAgent#apply(Project)} method.
43+
*/
44+
@Test
45+
public void applyJavaAgentPlugin() {
46+
// Create an empty project and apply the JavaAgent plugin
47+
Project project = ProjectBuilder.builder().build();
48+
project.getPluginManager().apply(JavaAgent.class);
49+
50+
// Verify the agent configuration was created
51+
Configuration agentConfig = project.getConfigurations().findByName("agent");
52+
assertNotNull("Agent configuration should be created", agentConfig);
53+
54+
// Verify the prepareJavaAgent task was created and is of the right type
55+
assertNotNull("prepareJavaAgent task should be created", project.getTasks().findByName(PREPARE_JAVA_AGENT_TASK));
56+
assertTrue("prepareJavaAgent task should be of type Copy", project.getTasks().findByName(PREPARE_JAVA_AGENT_TASK) instanceof Copy);
57+
58+
// Verify the destination directory of the Copy task
59+
Copy prepareTask = (Copy) project.getTasks().findByName(PREPARE_JAVA_AGENT_TASK);
60+
assertEquals(
61+
"Destination directory should be build/agent",
62+
new File(project.getBuildDir(), "agent"),
63+
prepareTask.getDestinationDir()
64+
);
65+
}
66+
}

distribution/packages/build.gradle

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,9 @@ Closure commonPackageConfig(String type, boolean jdk, String architecture) {
175175
with jdkFiles(project, 'linux', architecture)
176176
}
177177
}
178+
into('agent') {
179+
with agentFiles()
180+
}
178181
// we need to specify every intermediate directory in these paths so the package managers know they are explicitly
179182
// intended to manage them; otherwise they may be left behind on uninstallation. duplicate calls of the same
180183
// directory are fine

distribution/src/config/jvm.options

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,3 +85,4 @@ ${error.file}
8585
23:-XX:CompileCommand=dontinline,java/lang/invoke/MethodHandle.asTypeUncached
8686

8787
21-:-javaagent:agent/opensearch-agent.jar
88+
21-:--add-opens=java.base/java.nio=org.apache.arrow.memory.core,ALL-UNNAMED

gradle/ide.gradle

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,6 @@ if (System.getProperty('idea.active') == 'true') {
4949
}
5050
}
5151

52-
buildScan {
53-
server = 'https://127.0.0.1'
54-
}
55-
5652
idea {
5753
project {
5854
vcs = 'Git'

gradle/run.gradle

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,17 @@ testClusters {
4343
installedPlugins = Eval.me(installedPlugins)
4444
for (String p : installedPlugins) {
4545
plugin('plugins:'.concat(p))
46+
if (p.equals("arrow-flight-rpc")) {
47+
// Add system properties for Netty configuration
48+
systemProperty 'io.netty.allocator.numDirectArenas', '1'
49+
systemProperty 'io.netty.noUnsafe', 'false'
50+
systemProperty 'io.netty.tryUnsafe', 'true'
51+
systemProperty 'io.netty.tryReflectionSetAccessible', 'true'
52+
}
4653
}
4754
}
4855
}
56+
4957
}
5058

5159
tasks.register("run", RunTask) {

libs/arrow-spi/build.gradle

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

modules/percolator/src/test/java/org/opensearch/percolator/QueryBuilderStoreTests.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@
3838
import org.apache.lucene.index.IndexWriterConfig;
3939
import org.apache.lucene.index.LeafReaderContext;
4040
import org.apache.lucene.index.NoMergePolicy;
41+
import org.apache.lucene.index.Term;
42+
import org.apache.lucene.search.ConstantScoreQuery;
4143
import org.apache.lucene.search.Query;
4244
import org.apache.lucene.search.TermQuery;
4345
import org.apache.lucene.store.Directory;
@@ -121,9 +123,13 @@ public void testStoringQueryBuilders() throws IOException {
121123
CheckedFunction<Integer, Query, IOException> queries = queryStore.getQueries(leafContext);
122124
assertEquals(queryBuilders.length, leafContext.reader().numDocs());
123125
for (int i = 0; i < queryBuilders.length; i++) {
124-
TermQuery query = (TermQuery) queries.apply(i);
125-
assertEquals(queryBuilders[i].fieldName(), query.getTerm().field());
126-
assertEquals(queryBuilders[i].value(), query.getTerm().text());
126+
Query query = queries.apply(i);
127+
if (query instanceof ConstantScoreQuery constantScoreQuery) {
128+
query = constantScoreQuery.getQuery();
129+
}
130+
Term term = ((TermQuery) query).getTerm();
131+
assertEquals(queryBuilders[i].fieldName(), term.field());
132+
assertEquals(queryBuilders[i].value(), term.text());
127133
}
128134
}
129135
}

0 commit comments

Comments
 (0)