Skip to content

Commit 6ad9956

Browse files
Merge branch 'main' into feature/unsigned-long-star-tree
Signed-off-by: Shailesh Singh <[email protected]>
2 parents c106bcb + 1628152 commit 6ad9956

File tree

180 files changed

+9675
-1377
lines changed

Some content is hidden

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

180 files changed

+9675
-1377
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,18 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
2121
- [Security Manager Replacement] Add a policy parser for Java agent security policies ([#17753](https://github.com/opensearch-project/OpenSearch/pull/17753))
2222
- [Security Manager Replacement] Implement File Interceptor and add integration tests ([#17760](https://github.com/opensearch-project/OpenSearch/pull/17760))
2323
- [Security Manager Replacement] Enhance Java Agent to intercept Runtime::halt ([#17757](https://github.com/opensearch-project/OpenSearch/pull/17757))
24+
- [Security Manager Replacement] Phase off SecurityManager usage in favor of Java Agent ([#17861](https://github.com/opensearch-project/OpenSearch/pull/17861))
2425
- Support AutoExpand for SearchReplica ([#17741](https://github.com/opensearch-project/OpenSearch/pull/17741))
2526
- Implement fixed interval refresh task scheduling ([#17777](https://github.com/opensearch-project/OpenSearch/pull/17777))
27+
- [Tiered caching] Create a single cache manager for all the disk caches. ([#17513](https://github.com/opensearch-project/OpenSearch/pull/17513))
2628
- Add GRPC DocumentService and Bulk endpoint ([#17727](https://github.com/opensearch-project/OpenSearch/pull/17727))
2729
- Added scale to zero (`search_only` mode) support for OpenSearch reader writer separation ([#17299](https://github.com/opensearch-project/OpenSearch/pull/17299)
2830
- [Star Tree] [Search] Resolving numeric range aggregation with metric aggregation using star-tree ([#17273](https://github.com/opensearch-project/OpenSearch/pull/17273))
2931
- Added Search Only strict routing setting ([#17803](https://github.com/opensearch-project/OpenSearch/pull/17803))
3032
- Disable the index API for ingestion engine ([#17768](https://github.com/opensearch-project/OpenSearch/pull/17768))
33+
- Add SearchService and Search GRPC endpoint ([#17830](https://github.com/opensearch-project/OpenSearch/pull/17830))
34+
- Add update and delete support in pull-based ingestion ([#17822](https://github.com/opensearch-project/OpenSearch/pull/17822))
35+
- Allow maxPollSize and pollTimeout in IngestionSource to be configurable ([#17863](https://github.com/opensearch-project/OpenSearch/pull/17863))
3136
- [Star Tree] [Search] Add query changes to support unsigned-long in star tree ([#17275](https://github.com/opensearch-project/OpenSearch/pull/17275))
3237

3338
### Changed
@@ -36,6 +41,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
3641
- Unwrap singleton DocValues in global ordinal value source of composite histogram aggregation ([#17740](https://github.com/opensearch-project/OpenSearch/pull/17740))
3742
- Unwrap singleton DocValues in date histogram aggregation. ([#17643](https://github.com/opensearch-project/OpenSearch/pull/17643))
3843
- Introduce 512 byte limit to search and ingest pipeline IDs ([#17786](https://github.com/opensearch-project/OpenSearch/pull/17786))
44+
- Avoid skewed segment replication lag metric ([#17831](https://github.com/opensearch-project/OpenSearch/pull/17831))
3945

4046
### Dependencies
4147
- 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))
@@ -63,6 +69,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6369

6470
### Removed
6571
- Remove deprecated `batch_size` parameter from `_bulk` ([#14283](https://github.com/opensearch-project/OpenSearch/issues/14283))
72+
- Remove `FeatureFlags.APPROXIMATE_POINT_RANGE_QUERY_SETTING` since range query approximation is no longer experimental ([#17769](https://github.com/opensearch-project/OpenSearch/pull/17769))
6673

6774
### Fixed
6875
- Fix bytes parameter on `_cat/recovery` ([#17598](https://github.com/opensearch-project/OpenSearch/pull/17598))

build.gradle

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -433,11 +433,12 @@ gradle.projectsEvaluated {
433433

434434
project.tasks.withType(Test) { task ->
435435
if (task != null) {
436-
if (BuildParams.runtimeJavaVersion > JavaVersion.VERSION_17) {
437-
task.jvmArgs += ["-Djava.security.manager=allow"]
438-
}
439-
if (BuildParams.runtimeJavaVersion >= JavaVersion.VERSION_20) {
440-
task.jvmArgs += ["--add-modules=jdk.incubator.vector"]
436+
task.jvmArgs += ["--add-modules=jdk.incubator.vector"]
437+
438+
// Add Java Agent for security sandboxing
439+
if (!(project.path in [':build-tools', ":libs:agent-sm:bootstrap", ":libs:agent-sm:agent"])) {
440+
dependsOn(project(':libs:agent-sm:agent').prepareAgent)
441+
jvmArgs += ["-javaagent:" + project(':libs:agent-sm:agent').jar.archiveFile.get()]
441442
}
442443
}
443444
}

buildSrc/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,12 @@ dependencies {
110110
api 'com.netflix.nebula:gradle-info-plugin:12.1.6'
111111
api 'org.apache.rat:apache-rat:0.15'
112112
api "commons-io:commons-io:${props.getProperty('commonsio')}"
113-
api "net.java.dev.jna:jna:5.14.0"
113+
api "net.java.dev.jna:jna:5.16.0"
114114
api 'com.gradleup.shadow:shadow-gradle-plugin:8.3.5'
115115
api 'org.jdom:jdom2:2.0.6.1'
116116
api "org.jetbrains.kotlin:kotlin-stdlib-jdk8:${props.getProperty('kotlin')}"
117117
api 'de.thetaphi:forbiddenapis:3.8'
118-
api 'com.avast.gradle:gradle-docker-compose-plugin:0.17.6'
118+
api 'com.avast.gradle:gradle-docker-compose-plugin:0.17.12'
119119
api "org.yaml:snakeyaml:${props.getProperty('snakeyaml')}"
120120
api 'org.apache.maven:maven-model:3.9.6'
121121
api 'com.networknt:json-schema-validator:1.2.0'

buildSrc/src/main/java/org/opensearch/gradle/OpenSearchTestBasePlugin.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,6 @@ public void execute(Task t) {
115115
test.jvmArgs("--illegal-access=warn");
116116
}
117117
}
118-
if (test.getJavaVersion().compareTo(JavaVersion.VERSION_17) > 0) {
119-
test.jvmArgs("-Djava.security.manager=allow");
120-
}
121118
}
122119
});
123120
test.getJvmArgumentProviders().add(nonInputProperties);

client/rest-high-level/src/test/resources/org/opensearch/bootstrap/test.policy

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@
88

99
grant {
1010
permission java.net.SocketPermission "*", "connect,resolve";
11+
permission java.net.NetPermission "accessUnixDomainSocket";
1112
};

distribution/archives/build.gradle

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ CopySpec archiveFiles(CopySpec modulesFiles, String distributionType, String pla
3838
into('lib') {
3939
with libFiles()
4040
}
41+
into('agent') {
42+
with agentFiles()
43+
}
4144
into('config') {
4245
dirPermissions {
4346
unix 0750
@@ -226,3 +229,9 @@ subprojects {
226229

227230
group = "org.opensearch.distribution"
228231
}
232+
233+
tasks.each {
234+
if (it.name.startsWith("build")) {
235+
it.dependsOn project(':libs:agent-sm:agent').assemble
236+
}
237+
}

distribution/build.gradle

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,18 @@ configure(subprojects.findAll { ['archives', 'packages'].contains(it.name) }) {
357357
}
358358
}
359359

360+
agentFiles = {
361+
copySpec {
362+
from(project(':libs:agent-sm:agent').prepareAgent) {
363+
include '**/*.jar'
364+
exclude '**/*-javadoc.jar'
365+
exclude '**/*-sources.jar'
366+
// strip the version since jvm.options is using agent without version
367+
rename("opensearch-agent-${project.version}.jar", "opensearch-agent.jar")
368+
}
369+
}
370+
}
371+
360372
modulesFiles = { platform ->
361373
copySpec {
362374
eachFile {

distribution/src/config/jvm.options

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,16 +76,12 @@ ${error.file}
7676
# JDK 9+ GC logging
7777
9-:-Xlog:gc*,gc+age=trace,safepoint:file=${loggc}:utctime,pid,tags:filecount=32,filesize=64m
7878

79-
# Explicitly allow security manager (https://bugs.openjdk.java.net/browse/JDK-8270380)
80-
18-:-Djava.security.manager=allow
81-
8279
# JDK 20+ Incubating Vector Module for SIMD optimizations;
8380
# disabling may reduce performance on vector optimized lucene
8481
20-:--add-modules=jdk.incubator.vector
8582

86-
# HDFS ForkJoinPool.common() support by SecurityManager
87-
-Djava.util.concurrent.ForkJoinPool.common.threadFactory=org.opensearch.secure_sm.SecuredForkJoinWorkerThreadFactory
88-
8983
# See please https://bugs.openjdk.org/browse/JDK-8341127 (openjdk/jdk#21283)
9084
23:-XX:CompileCommand=dontinline,java/lang/invoke/MethodHandle.setAsTypeCache
9185
23:-XX:CompileCommand=dontinline,java/lang/invoke/MethodHandle.asTypeUncached
86+
87+
21-:-javaagent:agent/opensearch-agent.jar

distribution/tools/launchers/src/main/java/org/opensearch/tools/launchers/SystemJvmOptions.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -77,21 +77,11 @@ static List<String> systemJvmOptions() {
7777
// log4j 2
7878
"-Dlog4j.shutdownHookEnabled=false",
7979
"-Dlog4j2.disable.jmx=true",
80-
// security manager
81-
allowSecurityManagerOption(),
8280
javaLocaleProviders()
8381
)
8482
).stream().filter(e -> e.isEmpty() == false).collect(Collectors.toList());
8583
}
8684

87-
private static String allowSecurityManagerOption() {
88-
if (Runtime.version().feature() > 17) {
89-
return "-Djava.security.manager=allow";
90-
} else {
91-
return "";
92-
}
93-
}
94-
9585
private static String maybeShowCodeDetailsInExceptionMessages() {
9686
if (Runtime.version().feature() >= 14) {
9787
return "-XX:+ShowCodeDetailsInExceptionMessages";

gradle/ide.gradle

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,7 @@ if (System.getProperty('idea.active') == 'true') {
8282
runConfigurations {
8383
defaults(JUnit) {
8484
vmParameters = '-ea -Djava.locale.providers=SPI,CLDR'
85-
if (BuildParams.runtimeJavaVersion > JavaVersion.VERSION_17) {
86-
vmParameters += ' -Djava.security.manager=allow'
87-
}
85+
vmParameters += ' -javaagent:' + project(':libs:agent-sm:agent').jar.archiveFile.get()
8886
}
8987
}
9088
copyright {

libs/agent-sm/agent/build.gradle

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ thirdPartyAudit {
6363
)
6464
}
6565

66+
tasks.named('generateMetadataFileForNebulaPublication') {
67+
dependsOn prepareAgent
68+
}
69+
6670
tasks.named('validateNebulaPom') {
6771
dependsOn prepareAgent
6872
}
@@ -75,3 +79,7 @@ tasks.test {
7579
tasks.check {
7680
dependsOn test
7781
}
82+
83+
tasks.named('assemble') {
84+
dependsOn prepareAgent
85+
}

libs/agent-sm/agent/src/main/java/org/opensearch/javaagent/Agent.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ private static AgentBuilder createAgentBuilder(Instrumentation inst) throws Exce
101101
final AgentBuilder agentBuilder = new AgentBuilder.Default(byteBuddy).with(AgentBuilder.InitializationStrategy.NoOp.INSTANCE)
102102
.with(AgentBuilder.RedefinitionStrategy.REDEFINITION)
103103
.with(AgentBuilder.TypeStrategy.Default.REDEFINE)
104-
.ignore(ElementMatchers.none())
104+
.ignore(ElementMatchers.nameContains("$MockitoMock$")) /* ingore all Mockito mocks */
105105
.type(systemType)
106106
.transform(socketTransformer)
107107
.type(pathType.or(fileChannelType))

libs/build.gradle

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,20 +41,21 @@ subprojects {
4141
*/
4242
project.afterEvaluate {
4343
if (!project.path.equals(':libs:agent-sm:agent')) {
44-
configurations.all { Configuration conf ->
45-
dependencies.matching { it instanceof ProjectDependency }.all { ProjectDependency dep ->
46-
Project depProject = project.project(dep.path)
47-
if (depProject != null
48-
&& (false == depProject.path.equals(':libs:opensearch-core') &&
49-
false == depProject.path.equals(':libs:opensearch-common'))
50-
&& depProject.path.startsWith(':libs')) {
51-
throw new InvalidUserDataException("projects in :libs "
52-
+ "may not depend on other projects libs except "
53-
+ ":libs:opensearch-core or :libs:opensearch-common but "
54-
+ "${project.path} depends on ${depProject.path}")
44+
configurations.all { Configuration conf ->
45+
dependencies.matching { it instanceof ProjectDependency }.all { ProjectDependency dep ->
46+
Project depProject = project.project(dep.path)
47+
if (depProject != null
48+
&& (false == depProject.path.equals(':libs:opensearch-core') &&
49+
false == depProject.path.equals(':libs:opensearch-common')&&
50+
false == depProject.path.equals(':libs:agent-sm:agent-policy'))
51+
&& depProject.path.startsWith(':libs')) {
52+
throw new InvalidUserDataException("projects in :libs "
53+
+ "may not depend on other projects libs except "
54+
+ ":libs:opensearch-core, :libs:agent-sm:agent-policy or :libs:opensearch-common but "
55+
+ "${project.path} depends on ${depProject.path}")
56+
}
5557
}
5658
}
57-
}
5859
}
5960
}
6061
}

libs/secure-sm/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ apply plugin: 'opensearch.publish'
3131

3232
dependencies {
3333
// do not add non-test compile dependencies to secure-sm without a good reason to do so
34+
api project(":libs:agent-sm:agent-policy")
3435

3536
testImplementation "com.carrotsearch.randomizedtesting:randomizedtesting-runner:${versions.randomizedrunner}"
3637
testImplementation "junit:junit:${versions.junit}"

0 commit comments

Comments
 (0)