diff --git a/CHANGELOG.md b/CHANGELOG.md index 93f21e2d8462f..4691c6b1a627e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,6 +42,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), - Bump `com.diffplug.spotless` from 6.17.0 to 6.18.0 - Bump `io.opencensus:opencensus-api` from 0.18.0 to 0.31.1 ([#7291](https://github.com/opensearch-project/OpenSearch/pull/7291)) - Add `com.github.luben:zstd-jni` version 1.5.5-3 ([#2996](https://github.com/opensearch-project/OpenSearch/pull/2996)) +- OpenJDK Update (April 2023 Patch releases) ([#7344](https://github.com/opensearch-project/OpenSearch/pull/7344) ### Changed - [CCR] Add getHistoryOperationsFromTranslog method to fetch the history snapshot from translogs ([#3948](https://github.com/opensearch-project/OpenSearch/pull/3948)) diff --git a/buildSrc/src/main/java/org/opensearch/gradle/JdkDownloadPlugin.java b/buildSrc/src/main/java/org/opensearch/gradle/JdkDownloadPlugin.java index f638f1931cf62..c359e3a497049 100644 --- a/buildSrc/src/main/java/org/opensearch/gradle/JdkDownloadPlugin.java +++ b/buildSrc/src/main/java/org/opensearch/gradle/JdkDownloadPlugin.java @@ -129,13 +129,9 @@ private void setupRepository(Project project, Jdk jdk) { // To distinguish between those, the GA releases have only major version component (fe 17+32), // the updates always have minor/patch components (fe 17.0.1+12), checking for the presence of // version separator '.' should be enough. - artifactPattern = "jdk-" - + jdk.getBaseVersion() - + "+" - + jdk.getBuild() - + "/OpenJDK" - + jdk.getMajor() - + (jdk.getBaseVersion().contains(".") ? "U" : "") + artifactPattern = "jdk-" + jdk.getBaseVersion() + "+" + jdk.getBuild() + "/OpenJDK" + jdk.getMajor() + // JDK-20 does use 'U' suffix all the time, no matter it is update or GA release + + (jdk.getBaseVersion().contains(".") || jdk.getBaseVersion().matches("^2\\d+$") ? "U" : "") + "-jdk_[classifier]_[module]_hotspot_" + jdk.getBaseVersion() + "_" diff --git a/buildSrc/src/main/java/org/opensearch/gradle/VersionProperties.java b/buildSrc/src/main/java/org/opensearch/gradle/VersionProperties.java index 2b50e59de04d3..7c942358e12c3 100644 --- a/buildSrc/src/main/java/org/opensearch/gradle/VersionProperties.java +++ b/buildSrc/src/main/java/org/opensearch/gradle/VersionProperties.java @@ -31,6 +31,8 @@ package org.opensearch.gradle; +import org.apache.commons.lang3.StringUtils; + import java.io.IOException; import java.io.InputStream; import java.util.HashMap; @@ -54,7 +56,7 @@ public static String getLucene() { return lucene; } - public static String getBundledJdk(final String platform) { + public static String getBundledJdk(final String platform, final String arch) { switch (platform) { case "darwin": // fall trough case "mac": @@ -62,7 +64,7 @@ public static String getBundledJdk(final String platform) { case "freebsd": return bundledJdkFreeBSD; case "linux": - return bundledJdkLinux; + return getBundledJdkLinux(arch); case "windows": return bundledJdkWindows; default: @@ -70,6 +72,10 @@ public static String getBundledJdk(final String platform) { } } + public static String getBundledJdk(final String platform) { + return getBundledJdk(platform, null); + } + public static String getBundledJdkVendor() { return bundledJdkVendor; } @@ -84,6 +90,10 @@ public static Map getVersions() { private static final String bundledJdkFreeBSD; private static final String bundledJdkLinux; private static final String bundledJdkWindows; + private static final String bundledJdkLinux_arm64; + private static final String bundledJdkLinux_x64; + private static final String bundledJdkLinux_s390x; + private static final String bundledJdkLinux_ppc64le; private static final String bundledJdkVendor; private static final Map versions = new HashMap(); @@ -98,6 +108,12 @@ public static Map getVersions() { bundledJdkLinux = props.getProperty("bundled_jdk_linux", bundledJdk); bundledJdkWindows = props.getProperty("bundled_jdk_windows", bundledJdk); + // Bundled JDKs per architecture (linux platform) + bundledJdkLinux_arm64 = props.getProperty("bundled_jdk_linux_arm64", bundledJdkLinux); + bundledJdkLinux_x64 = props.getProperty("bundled_jdk_linux_x64", bundledJdkLinux); + bundledJdkLinux_s390x = props.getProperty("bundled_jdk_linux_s390x", bundledJdkLinux); + bundledJdkLinux_ppc64le = props.getProperty("bundled_jdk_linux_ppc64le", bundledJdkLinux); + for (String property : props.stringPropertyNames()) { versions.put(property, props.getProperty(property)); } @@ -119,4 +135,24 @@ private static Properties getVersionProperties() { public static boolean isOpenSearchSnapshot() { return opensearch.endsWith("-SNAPSHOT"); } + + private static String getBundledJdkLinux(String arch) { + if (StringUtils.isBlank(arch)) { + return bundledJdkLinux; + } + + switch (arch) { + case "aarch64": + case "arm64": + return bundledJdkLinux_arm64; + case "x64": + return bundledJdkLinux_x64; + case "s390x": + return bundledJdkLinux_s390x; + case "ppc64le": + return bundledJdkLinux_ppc64le; + default: + throw new IllegalArgumentException("unknown platform [" + arch + "] for 'linux' platform"); + } + } } diff --git a/buildSrc/src/main/java/org/opensearch/gradle/test/DistroTestPlugin.java b/buildSrc/src/main/java/org/opensearch/gradle/test/DistroTestPlugin.java index 57bb524bcf607..7e0dc72cb9108 100644 --- a/buildSrc/src/main/java/org/opensearch/gradle/test/DistroTestPlugin.java +++ b/buildSrc/src/main/java/org/opensearch/gradle/test/DistroTestPlugin.java @@ -75,9 +75,9 @@ import java.util.stream.Stream; public class DistroTestPlugin implements Plugin { - private static final String SYSTEM_JDK_VERSION = "11.0.18+10"; + private static final String SYSTEM_JDK_VERSION = "11.0.19+7"; private static final String SYSTEM_JDK_VENDOR = "adoptium"; - private static final String GRADLE_JDK_VERSION = "17.0.6+10"; + private static final String GRADLE_JDK_VERSION = "17.0.7+7"; private static final String GRADLE_JDK_VENDOR = "adoptium"; // all distributions used by distro tests. this is temporary until tests are per distribution diff --git a/buildSrc/version.properties b/buildSrc/version.properties index 5130f138c9132..04623432cc5f6 100644 --- a/buildSrc/version.properties +++ b/buildSrc/version.properties @@ -2,8 +2,9 @@ opensearch = 3.0.0 lucene = 9.7.0-snapshot-4d1ed9e bundled_jdk_vendor = adoptium -bundled_jdk = 19.0.2+7 - +bundled_jdk = 20.0.1+9 +# See please https://github.com/adoptium/temurin-build/issues/3371 +bundled_jdk_linux_ppc64le = 20+36 # optional dependencies spatial4j = 0.7 diff --git a/distribution/build.gradle b/distribution/build.gradle index 631813aadd615..2378ed833ead7 100644 --- a/distribution/build.gradle +++ b/distribution/build.gradle @@ -283,7 +283,7 @@ configure(subprojects.findAll { ['archives', 'packages'].contains(it.name) }) { (platform == 'linux' || platform == 'darwin' ? ['x64', 'aarch64', 's390x', 'ppc64le'] : ['x64']).each { architecture -> "bundled_${platform}_${architecture}" { it.platform = platform - it.version = VersionProperties.getBundledJdk(platform) + it.version = VersionProperties.getBundledJdk(platform, architecture) it.vendor = VersionProperties.bundledJdkVendor it.architecture = architecture } diff --git a/gradle/runtime-jdk-provision.gradle b/gradle/runtime-jdk-provision.gradle index cb4bb834f89c9..6bff164633c25 100644 --- a/gradle/runtime-jdk-provision.gradle +++ b/gradle/runtime-jdk-provision.gradle @@ -32,7 +32,7 @@ if (BuildParams.getIsRuntimeJavaHomeSet()) { jdks { provisioned_runtime { vendor = VersionProperties.bundledJdkVendor - version = VersionProperties.getBundledJdk(OS.current().name().toLowerCase()) + version = VersionProperties.getBundledJdk(OS.current().name().toLowerCase(), Architecture.current().name().toLowerCase()) platform = OS.current().name().toLowerCase() architecture = Architecture.current().name().toLowerCase() } diff --git a/server/src/internalClusterTest/java/org/opensearch/discovery/ClusterManagerDisruptionIT.java b/server/src/internalClusterTest/java/org/opensearch/discovery/ClusterManagerDisruptionIT.java index 2803fa262a216..7a7cdb5885054 100644 --- a/server/src/internalClusterTest/java/org/opensearch/discovery/ClusterManagerDisruptionIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/discovery/ClusterManagerDisruptionIT.java @@ -57,7 +57,9 @@ import static org.opensearch.test.hamcrest.OpenSearchAssertions.assertAcked; import static org.hamcrest.Matchers.equalTo; +import static org.hamcrest.Matchers.lessThan; import static org.hamcrest.Matchers.not; +import static org.junit.Assume.assumeThat; /** * Tests relating to the loss of the cluster-manager. @@ -70,6 +72,7 @@ public class ClusterManagerDisruptionIT extends AbstractDisruptionTestCase { */ public void testClusterManagerNodeGCs() throws Exception { List nodes = startCluster(3); + assumeThat("Thread::resume / Thread::suspend are not supported anymore", Runtime.version(), lessThan(Runtime.Version.parse("20"))); String oldClusterManagerNode = internalCluster().getClusterManagerName(); // a very long GC, but it's OK as we remove the disruption when it has had an effect @@ -81,6 +84,7 @@ public void testClusterManagerNodeGCs() throws Exception { 30000, 60000 ); + internalCluster().setDisruptionScheme(clusterManagerNodeDisruption); clusterManagerNodeDisruption.startDisrupting(); diff --git a/server/src/internalClusterTest/java/org/opensearch/discovery/StableClusterManagerDisruptionIT.java b/server/src/internalClusterTest/java/org/opensearch/discovery/StableClusterManagerDisruptionIT.java index c12718704e194..f6f2b2dbfd096 100644 --- a/server/src/internalClusterTest/java/org/opensearch/discovery/StableClusterManagerDisruptionIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/discovery/StableClusterManagerDisruptionIT.java @@ -71,6 +71,8 @@ import static java.util.Collections.singleton; import static org.hamcrest.Matchers.equalTo; +import static org.hamcrest.Matchers.lessThan; +import static org.junit.Assume.assumeThat; /** * Tests relating to the loss of the cluster-manager, but which work with the default fault detection settings which are rather lenient and will @@ -195,6 +197,8 @@ private void testFollowerCheckerAfterClusterManagerReelection(NetworkLinkDisrupt * following another elected cluster-manager node. These nodes should reject this cluster state and prevent them from following the stale cluster-manager. */ public void testStaleClusterManagerNotHijackingMajority() throws Exception { + assumeThat("Thread::resume / Thread::suspend are not supported anymore", Runtime.version(), lessThan(Runtime.Version.parse("20"))); + final List nodes = internalCluster().startNodes( 3, Settings.builder() diff --git a/server/src/main/java/org/opensearch/common/util/concurrent/BaseFuture.java b/server/src/main/java/org/opensearch/common/util/concurrent/BaseFuture.java index 47fc4fc33bd74..a423e5572d981 100644 --- a/server/src/main/java/org/opensearch/common/util/concurrent/BaseFuture.java +++ b/server/src/main/java/org/opensearch/common/util/concurrent/BaseFuture.java @@ -74,7 +74,7 @@ public abstract class BaseFuture implements Future { * * @throws InterruptedException if the current thread was interrupted before * or during the call (optional but recommended). - * @throws CancellationException {@inheritDoc} + * @throws CancellationException if the computation was cancelled */ @Override public V get(long timeout, TimeUnit unit) throws InterruptedException, TimeoutException, ExecutionException { @@ -96,7 +96,7 @@ public V get(long timeout, TimeUnit unit) throws InterruptedException, TimeoutEx * * @throws InterruptedException if the current thread was interrupted before * or during the call (optional but recommended). - * @throws CancellationException {@inheritDoc} + * @throws CancellationException if the computation was cancelled */ @Override public V get() throws InterruptedException, ExecutionException { diff --git a/test/framework/src/test/java/org/opensearch/test/disruption/LongGCDisruptionTests.java b/test/framework/src/test/java/org/opensearch/test/disruption/LongGCDisruptionTests.java index f545577ec5cc4..384297c9033af 100644 --- a/test/framework/src/test/java/org/opensearch/test/disruption/LongGCDisruptionTests.java +++ b/test/framework/src/test/java/org/opensearch/test/disruption/LongGCDisruptionTests.java @@ -45,9 +45,11 @@ import java.util.concurrent.locks.ReentrantLock; import java.util.regex.Pattern; +import static org.junit.Assume.assumeThat; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.greaterThan; +import static org.hamcrest.Matchers.lessThan; public class LongGCDisruptionTests extends OpenSearchTestCase { @@ -65,6 +67,8 @@ public void executeLocked(Runnable r) { } public void testBlockingTimeout() throws Exception { + assumeThat("Thread::resume / Thread::suspend are not supported anymore", Runtime.version(), lessThan(Runtime.Version.parse("20"))); + final String nodeName = "test_node"; LongGCDisruption disruption = new LongGCDisruption(random(), nodeName) { @Override @@ -125,6 +129,8 @@ protected long getSuspendingTimeoutInMillis() { * but does keep retrying until all threads can be safely paused */ public void testNotBlockingUnsafeStackTraces() throws Exception { + assumeThat("Thread::resume / Thread::suspend are not supported anymore", Runtime.version(), lessThan(Runtime.Version.parse("20"))); + final String nodeName = "test_node"; LongGCDisruption disruption = new LongGCDisruption(random(), nodeName) { @Override @@ -179,6 +185,8 @@ protected Pattern[] getUnsafeClasses() { } public void testBlockDetection() throws Exception { + assumeThat("Thread::resume / Thread::suspend are not supported anymore", Runtime.version(), lessThan(Runtime.Version.parse("20"))); + final String disruptedNodeName = "disrupted_node"; final String blockedNodeName = "blocked_node"; CountDownLatch waitForBlockDetectionResult = new CountDownLatch(1);