Skip to content

Commit

Permalink
OpenJDK Update (April 2023 Patch releases) (opensearch-project#7344)
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 Jun 1, 2023
1 parent 57c4a80 commit ecd0879
Show file tree
Hide file tree
Showing 11 changed files with 67 additions and 17 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
+ "_"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -54,22 +56,26 @@ 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":
return bundledJdkDarwin;
case "freebsd":
return bundledJdkFreeBSD;
case "linux":
return bundledJdkLinux;
return getBundledJdkLinux(arch);
case "windows":
return bundledJdkWindows;
default:
throw new IllegalArgumentException("unknown platform [" + platform + "]");
}
}

public static String getBundledJdk(final String platform) {
return getBundledJdk(platform, null);
}

public static String getBundledJdkVendor() {
return bundledJdkVendor;
}
Expand All @@ -84,6 +90,10 @@ public static Map<String, String> 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<String, String> versions = new HashMap<String, String>();

Expand All @@ -98,6 +108,12 @@ public static Map<String, String> 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));
}
Expand All @@ -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");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@
import java.util.stream.Stream;

public class DistroTestPlugin implements Plugin<Project> {
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
Expand Down
5 changes: 3 additions & 2 deletions buildSrc/version.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion distribution/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion gradle/runtime-jdk-provision.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -70,6 +72,7 @@ public class ClusterManagerDisruptionIT extends AbstractDisruptionTestCase {
*/
public void testClusterManagerNodeGCs() throws Exception {
List<String> 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
Expand All @@ -81,6 +84,7 @@ public void testClusterManagerNodeGCs() throws Exception {
30000,
60000
);

internalCluster().setDisruptionScheme(clusterManagerNodeDisruption);
clusterManagerNodeDisruption.startDisrupting();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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<String> nodes = internalCluster().startNodes(
3,
Settings.builder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public abstract class BaseFuture<V> implements Future<V> {
*
* @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 {
Expand All @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit ecd0879

Please sign in to comment.