You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pr@cassandra.apache.org by "michaelsembwever (via GitHub)" <gi...@apache.org> on 2023/11/07 08:27:17 UTC

Re: [PR] Fix for CASSANDRA-18688: Limit Java runtime in 5.0 to JDK17 in scripts; add a flag to opt out of that [cassandra]

michaelsembwever commented on code in PR #2563:
URL: https://github.com/apache/cassandra/pull/2563#discussion_r1384542307


##########
bin/cassandra.in.sh:
##########
@@ -122,13 +122,22 @@ jvmver=`echo "$java_ver_output" | grep '[openjdk|java] version' | awk -F'"' 'NR=
 JVM_VERSION=${jvmver%_*}
 short=$(echo "${jvmver}" | cut -c1-2)
 
-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
+# Allow execution if a supported Java version is used or CASSANDRA_USE_ALL_JDK argument is set
+java_versions_supported=11,17
+supported_version=$(echo "$java_versions_supported" | tr "," '\n' | grep -F -x "$short")
+
+if [ "x$CASSANDRA_USE_ALL_JDK" != "xtrue" ] && [ "x$supported_version" = "x" ] ; then
+    echo "Cassandra 5.0 requires Java 11, Java 17 (or newer LTS)."

Review Comment:
   Both debian and redhat packages require jdk11 or jdk17 dependencies.
   
   But it's easy to get around package deps, so enforcing it here still applies 👍 



##########
bin/cassandra.in.sh:
##########
@@ -122,13 +122,22 @@ jvmver=`echo "$java_ver_output" | grep '[openjdk|java] version' | awk -F'"' 'NR=
 JVM_VERSION=${jvmver%_*}
 short=$(echo "${jvmver}" | cut -c1-2)
 
-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
+# Allow execution if a supported Java version is used or CASSANDRA_USE_ALL_JDK argument is set
+java_versions_supported=11,17
+supported_version=$(echo "$java_versions_supported" | tr "," '\n' | grep -F -x "$short")
+
+if [ "x$CASSANDRA_USE_ALL_JDK" != "xtrue" ] && [ "x$supported_version" = "x" ] ; then
+    echo "Cassandra 5.0 requires Java 11, Java 17 (or newer LTS)."

Review Comment:
   Both debian and redhat packages require jdk11 or jdk17 dependencies.
   
   But it's easy to get around package deps, so enforcing it here still applies 👍 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org