Skip to content

Commit 9d5c6b5

Browse files
authored
Merge branch 'main' into max-merge-at-once
Signed-off-by: Varun Bansal <[email protected]>
2 parents fb43f2f + 80cb033 commit 9d5c6b5

File tree

370 files changed

+12640
-5260
lines changed

Some content is hidden

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

370 files changed

+12640
-5260
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: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
1616
- Add FilterFieldType for developers who want to wrap MappedFieldType ([#17627](https://github.com/opensearch-project/OpenSearch/pull/17627))
1717
- [Rule Based Auto-tagging] Add in-memory rule processing service ([#17365](https://github.com/opensearch-project/OpenSearch/pull/17365))
1818
- [Security Manager Replacement] Create initial Java Agent to intercept Socket::connect calls ([#17724](https://github.com/opensearch-project/OpenSearch/pull/17724))
19+
- Faster `terms_query` with already sorted terms ([#17714](https://github.com/opensearch-project/OpenSearch/pull/17714))
1920
- Add ingestion management APIs for pause, resume and get ingestion state ([#17631](https://github.com/opensearch-project/OpenSearch/pull/17631))
2021
- [Security Manager Replacement] Enhance Java Agent to intercept System::exit ([#17746](https://github.com/opensearch-project/OpenSearch/pull/17746))
2122
- [Security Manager Replacement] Add a policy parser for Java agent security policies ([#17753](https://github.com/opensearch-project/OpenSearch/pull/17753))
@@ -24,6 +25,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
2425
- [Security Manager Replacement] Phase off SecurityManager usage in favor of Java Agent ([#17861](https://github.com/opensearch-project/OpenSearch/pull/17861))
2526
- Support AutoExpand for SearchReplica ([#17741](https://github.com/opensearch-project/OpenSearch/pull/17741))
2627
- Introduce new dynamic cluster setting to tune maxMergeAtOnce at cluster level ([#17774](https://github.com/opensearch-project/OpenSearch/pull/17774))
28+
- Add TLS enabled SecureNetty4GrpcServerTransport ([#17796](https://github.com/opensearch-project/OpenSearch/pull/17796))
2729
- Implement fixed interval refresh task scheduling ([#17777](https://github.com/opensearch-project/OpenSearch/pull/17777))
2830
- [Tiered caching] Create a single cache manager for all the disk caches. ([#17513](https://github.com/opensearch-project/OpenSearch/pull/17513))
2931
- Add GRPC DocumentService and Bulk endpoint ([#17727](https://github.com/opensearch-project/OpenSearch/pull/17727))
@@ -34,6 +36,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
3436
- Add SearchService and Search GRPC endpoint ([#17830](https://github.com/opensearch-project/OpenSearch/pull/17830))
3537
- Add update and delete support in pull-based ingestion ([#17822](https://github.com/opensearch-project/OpenSearch/pull/17822))
3638
- Allow maxPollSize and pollTimeout in IngestionSource to be configurable ([#17863](https://github.com/opensearch-project/OpenSearch/pull/17863))
39+
- [Star Tree] [Search] Add query changes to support unsigned-long in star tree ([#17275](https://github.com/opensearch-project/OpenSearch/pull/17275))
40+
- Add `ApproximateMatchAllQuery` that targets match_all queries and approximates sorts ([#17772](https://github.com/opensearch-project/OpenSearch/pull/17772))
41+
- Add TermsQuery support to Search GRPC endpoint ([#17888](https://github.com/opensearch-project/OpenSearch/pull/17888))
42+
- Support sub agg in filter rewrite optimization ([#17447](https://github.com/opensearch-project/OpenSearch/pull/17447)
43+
- 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))
44+
- Add versioning support in pull-based ingestion ([#17918](https://github.com/opensearch-project/OpenSearch/pull/17918))
45+
- Introducing MergedSegmentWarmerFactory to support the extension of IndexWriter.IndexReaderWarmer ([#17881](https://github.com/opensearch-project/OpenSearch/pull/17881))
3746

3847
### Changed
3948
- Migrate BC libs to their FIPS counterparts ([#14912](https://github.com/opensearch-project/OpenSearch/pull/14912))
@@ -43,6 +52,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
4352
- Increase the default maxMergesAtOnce to 30 ([#17774](https://github.com/opensearch-project/OpenSearch/pull/17774))
4453
- Introduce 512 byte limit to search and ingest pipeline IDs ([#17786](https://github.com/opensearch-project/OpenSearch/pull/17786))
4554
- Avoid skewed segment replication lag metric ([#17831](https://github.com/opensearch-project/OpenSearch/pull/17831))
55+
- Increase the default segment counter step size when replica promoting ([#17568](https://github.com/opensearch-project/OpenSearch/pull/17568))
56+
- [WLM] Rename QueryGroup to WorkloadGroup ([#17901](https://github.com/opensearch-project/OpenSearch/pull/17901))
57+
- Relaxes jarHell check for optionally extended plugins([#17893](https://github.com/opensearch-project/OpenSearch/pull/17893)))
58+
- Add cluster setting for retry timeout of publish checkpoint tx action ([#17749](https://github.com/opensearch-project/OpenSearch/pull/17749))
4659

4760
### Dependencies
4861
- 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))
@@ -52,8 +65,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5265
- Bump `dangoslen/dependabot-changelog-helper` from 3 to 4 ([#17498](https://github.com/opensearch-project/OpenSearch/pull/17498))
5366
- Bump `com.google.api:gax` from 2.35.0 to 2.63.1 ([#17465](https://github.com/opensearch-project/OpenSearch/pull/17465))
5467
- Bump `com.azure:azure-storage-blob` from 12.29.1 to 12.30.0 ([#17667](https://github.com/opensearch-project/OpenSearch/pull/17667))
55-
- 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))
56-
- Bump `com.google.code.gson:gson` from 2.11.0 to 2.12.1 ([#17668](https://github.com/opensearch-project/OpenSearch/pull/17668))
68+
- 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))
69+
- 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))
5770
- 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))
5871
- Bump `lycheeverse/lychee-action` from 2.3.0 to 2.4.0 ([#17731](https://github.com/opensearch-project/OpenSearch/pull/17731))
5972
- Bump `com.netflix.nebula.ospackage-base` from 11.11.1 to 11.11.2 ([#17734](https://github.com/opensearch-project/OpenSearch/pull/17734))
@@ -63,6 +76,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6376
- Bump `reactor_netty` from 1.1.26 to 1.2.3 ([#17322](https://github.com/opensearch-project/OpenSearch/pull/17322), [#17377](https://github.com/opensearch-project/OpenSearch/pull/17377))
6477
- Bump `com.google.api.grpc:proto-google-iam-v1` from 1.33.0 to 1.49.1 ([#17811](https://github.com/opensearch-project/OpenSearch/pull/17811))
6578
- Bump `com.azure:azure-core` from 1.54.1 to 1.55.3 ([#17810](https://github.com/opensearch-project/OpenSearch/pull/17810))
79+
- Bump `org.apache.poi` version from 5.2.5 to 5.4.1 in /plugins/ingest-attachment ([#17887](https://github.com/opensearch-project/OpenSearch/pull/17887))
80+
- Bump `org.opensearch:protobufs` from 0.2.0 to 0.3.0 ([#17888](https://github.com/opensearch-project/OpenSearch/pull/17888))
6681

6782
### Changed
6883

@@ -75,6 +90,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
7590
### Fixed
7691
- Fix bytes parameter on `_cat/recovery` ([#17598](https://github.com/opensearch-project/OpenSearch/pull/17598))
7792
- Fix slow performance of FeatureFlag checks ([#17611](https://github.com/opensearch-project/OpenSearch/pull/17611))
93+
- Fix shard recovery in pull-based ingestion to avoid skipping messages ([#17868](https://github.com/opensearch-project/OpenSearch/pull/17868)))
7894

7995
### Security
8096

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: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,14 @@ if (System.getProperty('idea.active') == 'true') {
8181
}
8282
runConfigurations {
8383
defaults(JUnit) {
84-
vmParameters = '-ea -Djava.locale.providers=SPI,CLDR'
85-
vmParameters += ' -javaagent:' + project(':libs:agent-sm:agent').jar.archiveFile.get()
84+
project(':libs:agent-sm:agent').afterEvaluate { agentProject ->
85+
vmParameters = '-ea -Djava.locale.providers=SPI,CLDR'
86+
def jarName = "${agentProject.base.archivesName.get()}-${project.version}.jar"
87+
vmParameters += ' -javaagent:' + agentProject.layout.buildDirectory
88+
.dir('distributions')
89+
.map { it.file(jarName) }
90+
.get()
91+
}
8692
}
8793
}
8894
copyright {

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/agent-sm/agent-policy/src/main/java/org/opensearch/secure_sm/policy/PolicyFile.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ public class PolicyFile extends java.security.Policy {
4949
"org.bouncycastle.crypto.CryptoServicesPermission",
5050
"org.opensearch.script.ClassPermission",
5151
"javax.security.auth.AuthPermission",
52-
"javax.security.auth.kerberos.ServicePermission"
52+
"javax.security.auth.kerberos.ServicePermission",
53+
"com.sun.tools.attach.AttachPermission"
5354
);
5455

5556
private final PolicyInfo policyInfo;

0 commit comments

Comments
 (0)