ekaterinadimitrova2 commented on code in PR #2563:
URL: https://github.com/apache/cassandra/pull/2563#discussion_r1335953267
##########
redhat/cassandra.in.sh:
##########
@@ -80,13 +80,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" != "x" ] && [ "x$supported_version" = "x" ] ;
then
+ echo "Cassandra 5.0 requires Java 11, Java 17."
+ echo "If you would like to test with other Java versions > 17, set
\$CASSANDRA_USE_ALL_JDK=true"
+ exit 1;
+fi
+JAVA_VERSION=$short
Review Comment:
Something has shifted, as I can now start Cassandra with JDK20 and JDK21
without using the new variable. @shyla226, can you, please, check?
Also, in my understanding, @michaelsembwever was asking for a warning even
if we use the variable - just a print message: "You are using JDKx. Cassandra
is currently tested with 11 and 17 by the community. Use version x at your own
risk" or something like that. I am on a new computer, and there is no jdk arm64
for macos, no non-LTS between 11 and 17. I hope someone else could test that.
##########
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" != "x" ] && [ "x$supported_version" = "x" ] ;
then
Review Comment:
```suggestion
if [ -z "$CASSANDRA_USE_ALL_JDK" ] && [ -z "$supported_version" ] ; then
```
My testing shows that something like that should fix your startup problem.
Tested with JDK11 and 17 - C* starts; JDK20 and 21 prints correctly the below
message.
So for the suggested warning, we need to add a print when the
CASSANDRA_USE_ALL_JDK is set.
##########
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:
@michaelsembwever, @smiklosovic, please correct me if I am wrong, but I
think after
https://github.com/apache/cassandra/commit/e76b63d08146a3918b8315b9f0a11a04dca66da7,
we allow only 11 and 17 with Debian packages?
Also, regarding testing, I think we need to build the artifacts and then try
to run cassandra?
##########
bin/cassandra.in.sh:
##########
@@ -125,9 +125,6 @@ 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;
Review Comment:
I believe we agreed not to allow any versions between 11 and 17 at all on
the ticket so I am resolving this conversation.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]