jmckenzie-dev commented on code in PR #3696: URL: https://github.com/apache/cassandra/pull/3696#discussion_r2733746774
########## conf/jvm21-server.options: ########## @@ -0,0 +1,115 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +########################################################################### +# jvm21-server.options # +# # +# See jvm-server.options. This file is specific for Java 21 and newer. # +########################################################################### + +################# +# GC SETTINGS # +################# + + +### Generational ZGC settings Review Comment: Well, not force I suppose. :) I went ahead and copied in the entirety of this config from the jvm17-server.options commented out. ########## redhat/cassandra.in.sh: ########## @@ -121,46 +121,46 @@ if [ -z $JAVA ] ; then exit 1; fi +# TODO: Factor this out to something we source so we don't have the duplication all over our scripts # Matches variable 'java.supported' in build.xml -java_versions_supported=11,17 +java_versions_supported=(11 17 21) +java_version_string=$(IFS=" "; echo "${java_versions_supported[*]}") # Determine the sort of JVM we'll be running on. -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) - -# Unsupported JDKs below the upper supported version are not allowed -if [ "$short" != "$(echo "$java_versions_supported" | cut -d, -f1)" ] && [ "$JVM_VERSION" \< "$(echo "$java_versions_supported" | cut -d, -f2)" ] ; then - echo "Unsupported Java $JVM_VERSION. Supported are $java_versions_supported" - exit 1; -fi -# Allow execution of supported Java versions, and newer if CASSANDRA_JDK_UNSUPPORTED is set -is_supported_version=$(echo "$java_versions_supported" | tr "," '\n' | grep -F -x "$short") -if [ -z "$is_supported_version" ] ; then - if [ -z "$CASSANDRA_JDK_UNSUPPORTED" ] ; then - echo "Unsupported Java $JVM_VERSION. Supported are $java_versions_supported" - echo "If you would like to test with newer Java versions set CASSANDRA_JDK_UNSUPPORTED to any value (for example, CASSANDRA_JDK_UNSUPPORTED=true). Unset the parameter for default behavior" - exit 1; - else - echo "######################################################################" - echo "Warning! You are using JDK$short. This Cassandra version only supports $java_versions_supported." - echo "######################################################################" - fi +JAVA_VERSION=$(java -version 2>&1 | grep '[openjdk|java] version' | cut -d '"' -f2 | cut -d '.' -f1) + +supported=0 +for version in "${java_versions_supported[@]}"; do + if [ "$version" -eq "$JAVA_VERSION" ]; then + supported=1 + fi +done + +if [[ "$supported" -eq 0 ]]; then + if [ -z "$CASSANDRA_JDK_UNSUPPORTED" ]; then + echo "Unsupported Java $JAVA_VERSION. Supported are $java_version_string" + echo "If you would like to test with newer Java versions set CASSANDRA_JDK_UNSUPPORTED to any value (for example, CASSANDRA_JDK_UNSUPPORTED=true). Unset the parameter for default behavior" + exit 1 + else + echo "######################################################################" + echo "Warning! You are using JDK$JAVA_VERSION. This Cassandra version only supports $java_version_string" + echo "######################################################################" + fi fi -JAVA_VERSION=$short -jvm=`echo "$java_ver_output" | grep -A 1 '[openjdk|java] version' | awk 'NR==2 {print $1}'` +# TODO: Either remove the JVM_VENDOR and JVM_ARCH variables or explain where they're used. Appear vestigial. Review Comment: 👍🏻 -- 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]

