From 17d0eb138c69a1c9c44256695252b2d2213a2633 Mon Sep 17 00:00:00 2001 From: Mick Semb Wever Date: Sun, 3 Sep 2023 17:13:18 +0200 Subject: [PATCH] Fix rpm installation on jdk17 patch by Mick Semb Wever; reviewed by Brandon Williams for CASSANDRA-18817 --- CHANGES.txt | 21 +++++++++++---------- redhat/cassandra.in.sh | 26 +++++++++----------------- 2 files changed, 20 insertions(+), 27 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index b7880b259a..1977bd1d2b 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,18 +1,15 @@ 5.0-alpha2 +Merged from 4.1: +Merged from 4.0: +Merged from 3.11: +Merged from 3.0: + +5.0-alpha1 + * Fix rpm installations to work with jdk17 (CASSANDRA-18817) * Fix Depends and Build-Depends for Java for Debian packages (CASSANDRA-18809) * Update command line flags --add-exports and --add-opens for JDK17 (CASSANDRA-18439) * Update commons-lang3 to 3.13.0 (CASSANDRA-18789) * Forbid SAI indexes with analysis options on primary key columns (CASSANDRA-18782) -Merged from 4.1: - * Waiting indefinitely on ReceivedMessage response in StreamSession#receive() can cause deadlock (CASSANDRA-18733) - * Allow empty keystore_password in encryption_options (CASSANDRA-18778) -Merged from 4.0: -Merged from 3.11: -Merged from 3.0: - * Refactor validation logic in StorageService.rebuild (CASSANDRA-18803) - * Make alternation of a user type validate the same way as creation of a user type does (CASSANDRA-18585) - -5.0-alpha1 * Expose bootstrap failure state via JMX and nodetool info (CASSANDRA-18749) * Reduce size of per-SSTable index components for SAI (CASSANDRA-18673) * Remove unnecessary Netty dependencies after upgrade to version 4.1.96 (CASSANDRA-18729) @@ -197,12 +194,16 @@ Merged from 3.0: * Add guardrail for ALTER TABLE ADD / DROP / REMOVE column operations (CASSANDRA-17495) * Rename DisableFlag class to EnableFlag on guardrails (CASSANDRA-17544) Merged from 4.1: + * Waiting indefinitely on ReceivedMessage response in StreamSession#receive() can cause deadlock (CASSANDRA-18733) + * Allow empty keystore_password in encryption_options (CASSANDRA-18778) * Skip ColumnFamilyStore#topPartitions initialization when client or tool mode (CASSANDRA-18697) Merged from 4.0: * Partial compaction can resurrect deleted data (CASSANDRA-18507) Merged from 3.11: * Fix NPE when using udfContext in UDF after a restart of a node (CASSANDRA-18739) Merged from 3.0: + * Refactor validation logic in StorageService.rebuild (CASSANDRA-18803) + * Make alternation of a user type validate the same way as creation of a user type does (CASSANDRA-18585) * CQLSH emits a warning when the server version doesn't match (CASSANDRA-18745) * Fix missing speculative retries in tablestats (CASSANDRA-18767) * Fix Requires for Java for RPM package (CASSANDRA-18751) diff --git a/redhat/cassandra.in.sh b/redhat/cassandra.in.sh index 8ec1905ac0..7f5a374514 100644 --- a/redhat/cassandra.in.sh +++ b/redhat/cassandra.in.sh @@ -78,21 +78,13 @@ fi java_ver_output=`"${JAVA:-java}" -version 2>&1` jvmver=`echo "$java_ver_output" | grep '[openjdk|java] version' | awk -F'"' 'NR==1 {print $2}' | cut -d\- -f1` JVM_VERSION=${jvmver%_*} +short=$(echo "${jvmver}" | cut -c1-2) -JAVA_VERSION=11 -if [ "$JVM_VERSION" = "1.8.0" ] ; then - JVM_PATCH_VERSION=${jvmver#*_} - if [ "$JVM_VERSION" \< "1.8" ] || [ "$JVM_VERSION" \> "1.8.2" ] ; then - echo "Cassandra 4.0 requires either Java 8 (update 151 or newer) or Java 11 (or newer). Java $JVM_VERSION is not supported." - exit 1; - fi - if [ "$JVM_PATCH_VERSION" -lt 151 ] ; then - echo "Cassandra 4.0 requires either Java 8 (update 151 or newer) or Java 11 (or newer). Java 8 update $JVM_PATCH_VERSION is not supported." - exit 1; - fi - JAVA_VERSION=8 -elif [ "$JVM_VERSION" \< "11" ] ; then - echo "Cassandra 4.0 requires either Java 8 (update 151 or newer) or Java 11 (or newer)." +JAVA_VERSION=17 +if [ "$short" = "11" ] ; then + JAVA_VERSION=11 +elif [ "$JVM_VERSION" \< "17" ] ; then + echo "Cassandra 5.0 requires Java 11 or Java 17." exit 1; fi @@ -117,10 +109,10 @@ esac # Read user-defined JVM options from jvm-server.options file JVM_OPTS_FILE=$CASSANDRA_CONF/jvm${jvmoptions_variant:--clients}.options -if [ $JAVA_VERSION -ge 11 ] ; then +if [ $JAVA_VERSION -ge 17 ] ; then + JVM_DEP_OPTS_FILE=$CASSANDRA_CONF/jvm17${jvmoptions_variant:--clients}.options +elif [ $JAVA_VERSION -ge 11 ] ; then JVM_DEP_OPTS_FILE=$CASSANDRA_CONF/jvm11${jvmoptions_variant:--clients}.options -else - JVM_DEP_OPTS_FILE=$CASSANDRA_CONF/jvm8${jvmoptions_variant:--clients}.options fi for opt in `grep "^-" $JVM_OPTS_FILE` `grep "^-" $JVM_DEP_OPTS_FILE`