Skip to content

Commit

Permalink
Support JDK-23 (build time and runtime) (#16257)
Browse files Browse the repository at this point in the history
Signed-off-by: Andriy Redko <andriy.redko@aiven.io>
  • Loading branch information
reta authored Oct 10, 2024
1 parent 942765e commit 1e7f6df
Show file tree
Hide file tree
Showing 14 changed files with 25 additions and 26 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/precommit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
java: [ 11, 17, 21 ]
java: [ 11, 17, 21, 23 ]
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
steps:
- uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ dependencies {
api 'com.github.johnrengelman:shadow:8.1.1'
api 'org.jdom:jdom2:2.0.6.1'
api "org.jetbrains.kotlin:kotlin-stdlib-jdk8:${props.getProperty('kotlin')}"
api 'de.thetaphi:forbiddenapis:3.6'
api 'de.thetaphi:forbiddenapis:3.8'
api 'com.avast.gradle:gradle-docker-compose-plugin:0.17.6'
api "org.yaml:snakeyaml:${props.getProperty('snakeyaml')}"
api 'org.apache.maven:maven-model:3.9.6'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public class ThirdPartyAuditPrecommitPlugin extends PrecommitPlugin {
public TaskProvider<? extends Task> createTask(Project project) {
project.getPlugins().apply(CompileOnlyResolvePlugin.class);
project.getConfigurations().create("forbiddenApisCliJar");
project.getDependencies().add("forbiddenApisCliJar", "de.thetaphi:forbiddenapis:3.5.1");
project.getDependencies().add("forbiddenApisCliJar", "de.thetaphi:forbiddenapis:3.8");

Configuration jdkJarHellConfig = project.getConfigurations().create(JDK_JAR_HELL_CONFIG_NAME);
if (BuildParams.isInternal() && project.getPath().equals(":libs:opensearch-core") == false) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@
import java.util.stream.Stream;

public class DistroTestPlugin implements Plugin<Project> {
private static final String SYSTEM_JDK_VERSION = "21.0.4+7";
private static final String SYSTEM_JDK_VERSION = "23+37";
private static final String SYSTEM_JDK_VENDOR = "adoptium";
private static final String GRADLE_JDK_VERSION = "21.0.4+7";
private static final String GRADLE_JDK_VERSION = "23+37";
private static final String GRADLE_JDK_VENDOR = "adoptium";

// all distributions used by distro tests. this is temporary until tests are per distribution
Expand Down
6 changes: 3 additions & 3 deletions buildSrc/version.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ opensearch = 3.0.0
lucene = 9.12.0

bundled_jdk_vendor = adoptium
bundled_jdk = 21.0.4+7
bundled_jdk = 23+37

# optional dependencies
spatial4j = 0.7
Expand Down Expand Up @@ -60,9 +60,9 @@ bouncycastle=1.78
randomizedrunner = 2.7.1
junit = 4.13.2
hamcrest = 2.1
mockito = 5.12.0
mockito = 5.14.1
objenesis = 3.2
bytebuddy = 1.14.9
bytebuddy = 1.15.4

# benchmark dependencies
jmh = 1.35
Expand Down
2 changes: 1 addition & 1 deletion gradle/code-coverage.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ repositories {

allprojects {
plugins.withId('jacoco') {
jacoco.toolVersion = '0.8.10'
jacoco.toolVersion = '0.8.12'
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ public GrokCaptureExtracter forBoolean(Function<Consumer<Boolean>, GrokCaptureEx
/**
* Build an extract that has access to the "native" type of the extracter
* match. This means that patterns like {@code %{NUMBER:bytes:float}} has
* access to an actual {@link float}. Extracters returned from this method
* should be stateless stateless and can be reused. Pathological implementations
* access to an actual float. Extracters returned from this method
* should be stateless and can be reused. Pathological implementations
* of the {@code map} parameter could violate this, but the caller should
* take care to stay sane.
* <p>
Expand Down Expand Up @@ -144,27 +144,27 @@ public interface NativeExtracterMap<T> {
T forString(Function<Consumer<String>, GrokCaptureExtracter> buildExtracter);

/**
* Called when the native type is an {@link int}.
* Called when the native type is an int.
*/
T forInt(Function<IntConsumer, GrokCaptureExtracter> buildExtracter);

/**
* Called when the native type is an {@link long}.
* Called when the native type is an long.
*/
T forLong(Function<LongConsumer, GrokCaptureExtracter> buildExtracter);

/**
* Called when the native type is an {@link float}.
* Called when the native type is an float.
*/
T forFloat(Function<FloatConsumer, GrokCaptureExtracter> buildExtracter);

/**
* Called when the native type is an {@link double}.
* Called when the native type is an double.
*/
T forDouble(Function<DoubleConsumer, GrokCaptureExtracter> buildExtracter);

/**
* Called when the native type is an {@link boolean}.
* Called when the native type is an boolean.
*/
T forBoolean(Function<Consumer<Boolean>, GrokCaptureExtracter> buildExtracter);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ protected List<TransportAddress> buildDynamicHosts(Settings nodeSettings, int no
exchange.getResponseHeaders().set("Content-Type", "text/xml; charset=UTF-8");
exchange.sendResponseHeaders(HttpStatus.SC_OK, responseBody.length);
exchange.getResponseBody().write(responseBody);
exchange.getResponseBody().flush();
return;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ public void testEC2DiscoveryRetriesOnRateLimiting() throws IOException {
exchange.getResponseHeaders().set("Content-Type", "text/xml; charset=UTF-8");
exchange.sendResponseHeaders(HttpStatus.SC_OK, responseBody.length);
exchange.getResponseBody().write(responseBody);
exchange.getResponseBody().flush();
return;
}
}
Expand Down
4 changes: 4 additions & 0 deletions plugins/repository-hdfs/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,10 @@ for (String fixtureName : ['hdfsFixture', 'haHdfsFixture', 'secureHdfsFixture',
}
final List<String> miniHDFSArgs = []

if (BuildParams.runtimeJavaVersion >= JavaVersion.VERSION_23) {
miniHDFSArgs.add('-Djava.security.manager=allow')
}

// If it's a secure fixture, then depend on Kerberos Fixture and principals + add the krb5conf to the JVM options
if (fixtureName.equals('secureHdfsFixture') || fixtureName.equals('secureHaHdfsFixture')) {
miniHDFSArgs.add("-Djava.security.krb5.conf=${project(':test:fixtures:krb5kdc-fixture').ext.krb5Conf("hdfs")}");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,6 @@ public void setMaxExpansions(int maxExpansions) {

/**
* Sets the phrase slop for this query.
*
* @see org.apache.lucene.search.PhraseQuery.Builder#getSlop()
*/
public int getSlop() {
return slop;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,9 +227,6 @@ public void setOccur(BooleanClause.Occur occur) {
this.occur = occur;
}

/**
* @deprecated See {@link MatchQueryBuilder#setCommonTermsCutoff(Float)} for more details
*/
@Deprecated
public void setCommonTermsCutoff(Float cutoff) {
this.commonTermsCutoff = cutoff;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public interface SegmentReplicationSource {
/**
* Get Metadata for a ReplicationCheckpoint.
*
* @param replicationId {@link long} - ID of the replication event.
* @param replicationId long - ID of the replication event.
* @param checkpoint {@link ReplicationCheckpoint} Checkpoint to fetch metadata for.
* @param listener {@link ActionListener} listener that completes with a {@link CheckpointInfoResponse}.
*/
Expand All @@ -41,7 +41,7 @@ public interface SegmentReplicationSource {
/**
* Fetch the requested segment files. Passes a listener that completes when files are stored locally.
*
* @param replicationId {@link long} - ID of the replication event.
* @param replicationId long - ID of the replication event.
* @param checkpoint {@link ReplicationCheckpoint} Checkpoint to fetch metadata for.
* @param filesToFetch {@link List} List of files to fetch.
* @param indexShard {@link IndexShard} Reference to the IndexShard.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -404,8 +404,6 @@ protected void sendIncompleteContent(HttpExchange exchange, byte[] bytes) throws
if (bytesToSend > 0) {
exchange.getResponseBody().write(bytes, rangeStart, bytesToSend);
}
if (randomBoolean()) {
exchange.getResponseBody().flush();
}
exchange.getResponseBody().flush();
}
}

0 comments on commit 1e7f6df

Please sign in to comment.