This is an automated email from the ASF dual-hosted git repository.

edimitrova pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/cassandra.git


The following commit(s) were added to refs/heads/trunk by this push:
     new d1e3c781b5 Add JDK17 startup scripts patch by Ekaterina Dimitrova; 
reviewed by Mick Semb Wever for CASSANDRA-18258
d1e3c781b5 is described below

commit d1e3c781b524308490bcb8af9f3c2f0d0bc2176f
Author: Ekaterina Dimitrova <[email protected]>
AuthorDate: Mon Feb 13 21:17:57 2023 -0500

    Add JDK17 startup scripts
    patch by Ekaterina Dimitrova; reviewed by Mick Semb Wever for 
CASSANDRA-18258
---
 CHANGES.txt                |   2 +-
 bin/cassandra.in.sh        |  12 ++++-
 build.xml                  |  76 +++++++++++++++++++++-----
 conf/cassandra-env.sh      |   2 +-
 conf/jvm17-clients.options |  66 +++++++++++++++++++++++
 conf/jvm17-server.options  | 131 +++++++++++++++++++++++++++++++++++++++++++++
 tools/bin/cassandra.in.sh  |  11 +++-
 7 files changed, 282 insertions(+), 18 deletions(-)

diff --git a/CHANGES.txt b/CHANGES.txt
index 238417174c..b5495844f5 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,6 +1,6 @@
 4.2
  * More accurate skipping of sstables in read path (CASSANDRA-18134)
- * Prepare for JDK17 experimental support (CASSANDRA-18179)
+ * Prepare for JDK17 experimental support (CASSANDRA-18179, CASSANDRA-18258)
  * Remove Scripted UDFs internals; hooks to be added later in CASSANDRA-17281 
(CASSANDRA-18252)
  * Update JNA to 5.13.0 (CASSANDRA-18050)
  * Make virtual tables decide if they implicitly enable ALLOW FILTERING 
(CASSANDRA-18238)
diff --git a/bin/cassandra.in.sh b/bin/cassandra.in.sh
index dcbd12d014..dfbb95955e 100644
--- a/bin/cassandra.in.sh
+++ b/bin/cassandra.in.sh
@@ -114,8 +114,9 @@ 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
+JAVA_VERSION=17
 if [ "$JVM_VERSION" = "1.8.0" ]  ; then
     JVM_PATCH_VERSION=${jvmver#*_}
     if [ "$JVM_VERSION" \< "1.8" ] || [ "$JVM_VERSION" \> "1.8.2" ] ; then
@@ -130,6 +131,11 @@ if [ "$JVM_VERSION" = "1.8.0" ]  ; then
 elif [ "$JVM_VERSION" \< "11" ] ; then
     echo "Cassandra 4.0 requires either Java 8 (update 151 or newer) or Java 
11 (or newer)."
     exit 1;
+elif [ "$short" = "11" ]  ; then
+     JAVA_VERSION=11
+elif [ "$JVM_VERSION" \< "17" ] ; then
+    echo "Cassandra 5.0 requires Java 11 or Java 17."
+    exit 1;
 fi
 
 jvm=`echo "$java_ver_output" | grep -A 1 '[openjdk|java] version' | awk 'NR==2 
{print $1}'`
@@ -153,7 +159,9 @@ 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
diff --git a/build.xml b/build.xml
index 76f5397d39..1cee3d0d62 100644
--- a/build.xml
+++ b/build.xml
@@ -216,9 +216,51 @@
     </resources>
     <pathconvert property="_jvm_args_concat" refid="_jvm11_arg_items" 
pathsep=" "/>
     <condition property="java11-jvmargs" value="${_jvm_args_concat}" else="">
-        <not>
-            <equals arg1="${ant.java.version}" arg2="1.8"/>
-        </not>
+        <equals arg1="${ant.java.version}" arg2="11"/>
+    </condition>
+
+    <resources id="_jvm17_arg_items">
+        <string>-Djdk.attach.allowAttachSelf=true</string>
+        <string>-XX:+UseG1GC</string>
+        <string>-XX:+ParallelRefProcEnabled</string>
+        <string>-XX:MaxTenuringThreshold=1</string>
+        <string>-XX:G1HeapRegionSize=16m</string>
+
+        <string>--add-exports java.base/jdk.internal.misc=ALL-UNNAMED</string>
+        <string>--add-exports java.base/jdk.internal.ref=ALL-UNNAMED</string>
+        <string>--add-exports java.base/sun.nio.ch=ALL-UNNAMED</string>
+        <string>--add-exports 
java.management.rmi/com.sun.jmx.remote.internal.rmi=ALL-UNNAMED</string>
+        <string>--add-exports java.rmi/sun.rmi.registry=ALL-UNNAMED</string>
+        <string>--add-exports java.rmi/sun.rmi.server=ALL-UNNAMED</string>
+        <string>--add-exports java.sql/java.sql=ALL-UNNAMED</string>
+        <string>--add-exports java.base/java.lang.ref=ALL-UNNAMED</string>
+        <string>--add-exports jdk.unsupported/sun.misc=ALL-UNNAMED</string>
+        <string>--add-exports 
jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED</string>
+
+        <string>--add-opens java.base/java.lang.module=ALL-UNNAMED</string>
+        <string>--add-opens java.base/java.net=ALL-UNNAMED</string>
+        <string>--add-opens java.base/jdk.internal.loader=ALL-UNNAMED</string>
+        <string>--add-opens java.base/jdk.internal.ref=ALL-UNNAMED</string>
+        <string>--add-opens java.base/jdk.internal.reflect=ALL-UNNAMED</string>
+        <string>--add-opens java.base/jdk.internal.math=ALL-UNNAMED</string>
+        <string>--add-opens java.base/jdk.internal.module=ALL-UNNAMED</string>
+        <string>--add-opens 
java.base/jdk.internal.util.jar=ALL-UNNAMED</string>
+        <string>--add-opens 
jdk.management/com.sun.management.internal=ALL-UNNAMED</string>
+        <string>--add-opens 
jdk.management/com.sun.management.internal=ALL-UNNAMED</string>
+
+        <string>--add-opens java.base/sun.nio.ch=ALL-UNNAMED</string>
+        <string>--add-opens java.base/java.io=ALL-UNNAMED</string>
+        <string>--add-opens java.base/java.nio=ALL-UNNAMED</string>
+        <string>--add-opens java.base/java.util.concurrent=ALL-UNNAMED</string>
+        <string>--add-opens java.base/java.util=ALL-UNNAMED</string>
+        <string>--add-opens 
java.base/java.util.concurrent.atomic=ALL-UNNAMED</string>
+        <string>--add-opens java.base/java.lang=ALL-UNNAMED</string>
+        <string>--add-opens java.base/java.math=ALL-UNNAMED</string>
+        <string>--add-opens java.base/java.lang.reflect=ALL-UNNAMED</string>
+    </resources>
+    <pathconvert property="_jvm_args_concat2" refid="_jvm17_arg_items" 
pathsep=" "/>
+    <condition property="java17-jvmargs" value="${_jvm_args_concat2}" else="">
+        <equals arg1="${ant.java.version}" arg2="17"/>
     </condition>
 
     <!--
@@ -233,6 +275,7 @@
       In java 11 we also need to set a system property to enable netty to use 
Unsafe direct byte
       buffer construction (see CASSANDRA-16493)
     -->
+    <!-- Leaving  _jvm8_test_arg_items for now as we are not dropping Java 8 
yet but it will be useless after CASSANDRA-18258-->
     <resources id="_jvm8_test_arg_items">
       <!-- TODO see CASSANDRA-16212 - we seem to OOM non stop now after 
CASSANDRA-16212, so to have clean CI while this gets looked into, disabling 
limiting metaspace
         <string>-XX:MaxMetaspaceExpansion=64M</string>
@@ -246,19 +289,24 @@
         <string>-Dio.netty.tryReflectionSetAccessible=true</string>
     </resources>
     <pathconvert property="_jvm11_test_arg_items_concat" 
refid="_jvm11_test_arg_items" pathsep=" "/>
-    <condition property="_std-test-jvmargs" 
value="${_jvm11_test_arg_items_concat}" else="${_jvm8_test_arg_items_concat}">
-        <not>
-            <equals arg1="${ant.java.version}" arg2="1.8"/>
-        </not>
+    <resources id="_jvm17_test_arg_items">
+        <string>-Dio.netty.tryReflectionSetAccessible=true</string>
+    </resources>
+    <pathconvert property="_jvm17_test_arg_items_concat" 
refid="_jvm17_test_arg_items" pathsep=" "/>
+    <condition property="_std-test-jvmargs11" 
value="${_jvm11_test_arg_items_concat}" else=" ">
+            <equals arg1="${ant.java.version}" arg2="11"/>
+    </condition>
+    <condition property="_std-test-jvmargs17" 
value="${_jvm17_test_arg_items_concat}" else=" ">
+        <equals arg1="${ant.java.version}" arg2="17"/>
     </condition>
 
     <!-- needed to compile org.apache.cassandra.utils.JMXServerUtils -->
-    <condition property="jdk11-javac-exports" value="--add-exports 
java.rmi/sun.rmi.registry=ALL-UNNAMED" else="">
+    <condition property="jdk11plus-javac-exports" value="--add-exports 
java.rmi/sun.rmi.registry=ALL-UNNAMED" else="">
         <not>
             <equals arg1="${ant.java.version}" arg2="1.8"/>
         </not>
     </condition>
-    <condition property="jdk11-javadoc-exports" value="${jdk11-javac-exports} 
--frames" else="">
+    <condition property="jdk11plus-javadoc-exports" 
value="${jdk11plus-javac-exports} --frames" else="">
         <not>
             <equals arg1="${ant.java.version}" arg2="1.8"/>
         </not>
@@ -292,7 +340,7 @@
         windowtitle="${ant.project.name} API" 
classpathref="cassandra.classpath"
         bottom="Copyright &amp;copy; 2009- The Apache Software Foundation"
         useexternalfile="yes" encoding="UTF-8" failonerror="false"
-        maxmemory="256m" additionalparam="${jdk11-javadoc-exports}">
+        maxmemory="256m" additionalparam="${jdk11plus-javadoc-exports}">
         <filesets/>
       </javadoc>
       <fail message="javadoc failed">
@@ -431,6 +479,7 @@
         <jvmarg value="-javaagent:${build.lib}/jamm-${jamm.version}.jar" />
         <jvmarg value="-ea"/>
         <jvmarg line="${java11-jvmargs}"/>
+        <jvmarg line="${java17-jvmargs}"/>
       </java>
     </target>
 
@@ -451,7 +500,7 @@
             <src path="${build.src.java}"/>
             <src path="${build.src.gen-java}"/>
             <compilerarg value="-XDignore.symbol.file"/>
-            <compilerarg line="${jdk11-javac-exports}"/>
+            <compilerarg line="${jdk11plus-javac-exports}"/>
             <classpath>
                 <path refid="cassandra.classpath"/>
             </classpath>
@@ -1088,9 +1137,11 @@
         <jvmarg 
value="-Dcassandra.test.messagingService.nonGracefulShutdown=${cassandra.test.messagingService.nonGracefulShutdown}"/>
         <jvmarg 
value="-Dcassandra.use_nix_recursive_delete=${cassandra.use_nix_recursive_delete}"/>
         <jvmarg line="${java11-jvmargs}"/>
+        <jvmarg line="${java17-jvmargs}"/>
         <!-- disable shrinks in quicktheories CASSANDRA-15554 -->
         <jvmarg value="-DQT_SHRINKS=0"/>
-        <jvmarg line="${_std-test-jvmargs}" />
+        <jvmarg line="${_std-test-jvmargs11}" />
+        <jvmarg line="${_std-test-jvmargs17}" />
         <jvmarg line="${test.jvm.args}" />
         <optjvmargs/>
         <!-- Uncomment to debug unittest, attach debugger to port 1416 -->
@@ -1752,6 +1803,7 @@
     <option name="ADDITIONAL_OPTIONS_STRING" value="--add-exports 
java.rmi/sun.rmi.registry=ALL-UNNAMED" />
   </component>
 </project>]]></echo>
+      <echo>"IDE configuration updated for use with JDK11"</echo>
   </target>
 
   <!-- Generate IDEA project description files -->
diff --git a/conf/cassandra-env.sh b/conf/cassandra-env.sh
index 2e3c8c9d8b..25ba5052d3 100644
--- a/conf/cassandra-env.sh
+++ b/conf/cassandra-env.sh
@@ -92,7 +92,7 @@ if [ "x$CASSANDRA_LOG_DIR" = "x" ] ; then
 fi
 
 #GC log path has to be defined here because it needs to access CASSANDRA_HOME
-if [ $JAVA_VERSION -ge 11 ] ; then
+if [ $JAVA_VERSION -ge 11 ] || [ $JAVA_VERSION -ge 17 ] ; then
     # See description of https://bugs.openjdk.java.net/browse/JDK-8046148 for 
details about the syntax
     # The following is the equivalent to -XX:+PrintGCDetails 
-XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=10M
     echo "$JVM_OPTS" | grep -qe "-[X]log:gc"
diff --git a/conf/jvm17-clients.options b/conf/jvm17-clients.options
new file mode 100644
index 0000000000..5a98aec5a4
--- /dev/null
+++ b/conf/jvm17-clients.options
@@ -0,0 +1,66 @@
+#
+# 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.
+#
+
+###########################################################################
+#                         jvm17-clients.options                           #
+#                                                                         #
+# See jvm-clients.options. This file is specific for Java 17 and newer.   #
+###########################################################################
+
+###################
+#  JPMS SETTINGS  #
+###################
+
+-Djdk.attach.allowAttachSelf=true
+--add-exports java.base/jdk.internal.misc=ALL-UNNAMED
+--add-exports java.base/jdk.internal.ref=ALL-UNNAMED
+--add-exports java.base/sun.nio.ch=ALL-UNNAMED
+--add-exports java.management.rmi/com.sun.jmx.remote.internal.rmi=ALL-UNNAMED
+--add-exports java.rmi/sun.rmi.registry=ALL-UNNAMED
+--add-exports java.rmi/sun.rmi.server=ALL-UNNAMED
+--add-exports java.sql/java.sql=ALL-UNNAMED
+--add-exports jdk.unsupported/sun.misc=ALL-UNNAMED
+--add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED
+
+
+--add-opens java.base/java.lang.module=ALL-UNNAMED
+--add-opens java.base/jdk.internal.loader=ALL-UNNAMED
+--add-opens java.base/jdk.internal.ref=ALL-UNNAMED
+--add-opens java.base/jdk.internal.reflect=ALL-UNNAMED
+--add-opens java.base/jdk.internal.math=ALL-UNNAMED
+--add-opens java.base/jdk.internal.module=ALL-UNNAMED
+--add-opens java.base/jdk.internal.util.jar=ALL-UNNAMED
+--add-opens jdk.management/com.sun.management.internal=ALL-UNNAMED
+--add-opens java.base/sun.nio.ch=ALL-UNNAMED
+# to be addressed in CASSANDRA-17850
+--add-opens java.base/sun.nio.ch=ALL-UNNAMED
+--add-opens java.base/java.io=ALL-UNNAMED
+--add-opens java.base/java.nio=ALL-UNNAMED
+# to be addressed during jamm maintenance
+--add-opens java.base/java.util.concurrent=ALL-UNNAMED
+--add-opens java.base/java.util=ALL-UNNAMED
+--add-opens java.base/java.util.concurrent.atomic=ALL-UNNAMED
+# jamm and the in-jvm tests...
+--add-opens java.base/java.lang=ALL-UNNAMED
+# jamm
+--add-opens java.base/java.math=ALL-UNNAMED
+--add-opens jdk.compiler/com.sun.tools.javac=ALL-UNNAMED
+--add-opens java.base/java.lang=ALL-UNNAMED
+--add-opens java.base/java.lang.reflect=ALL-UNNAMED
+
+# The newline in the end of file is intentional
diff --git a/conf/jvm17-server.options b/conf/jvm17-server.options
new file mode 100644
index 0000000000..03a0cd8752
--- /dev/null
+++ b/conf/jvm17-server.options
@@ -0,0 +1,131 @@
+#
+# 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.
+#
+
+###########################################################################
+#                         jvm17-server.options                            #
+#                                                                         #
+# See jvm-server.options. This file is specific for Java 17 and newer.    #
+###########################################################################
+
+#################
+#  GC SETTINGS  #
+#################
+
+
+
+### G1 Settings
+## Use the Hotspot garbage-first collector.
+-XX:+UseG1GC
+-XX:+ParallelRefProcEnabled
+-XX:MaxTenuringThreshold=1
+-XX:G1HeapRegionSize=16m
+
+#
+## Have the JVM do less remembered set work during STW, instead
+## preferring concurrent GC. Reduces p99.9 latency.
+-XX:G1RSetUpdatingPauseTimePercent=5
+#
+## Main G1GC tunable: lowering the pause target will lower throughput and vise 
versa.
+## 200ms is the JVM default and lowest viable setting
+## 1000ms increases throughput. Keep it smaller than the timeouts in 
cassandra.yaml.
+-XX:MaxGCPauseMillis=300
+
+## Optional G1 Settings
+# Save CPU time on large (>= 16GB) heaps by delaying region scanning
+# until the heap is 70% full. The default in Hotspot 8u40 is 40%.
+-XX:InitiatingHeapOccupancyPercent=70
+
+# For systems with > 8 cores, the default ParallelGCThreads is 5/8 the number 
of logical cores.
+# Otherwise equal to the number of cores when 8 or less.
+# Machines with > 10 cores should try setting these to <= full cores.
+#-XX:ParallelGCThreads=16
+# By default, ConcGCThreads is 1/4 of ParallelGCThreads.
+# Setting both to the same value can reduce STW durations.
+#-XX:ConcGCThreads=16
+
+
+### JPMS
+
+-Djdk.attach.allowAttachSelf=true
+--add-exports java.base/jdk.internal.misc=ALL-UNNAMED
+--add-exports java.base/jdk.internal.ref=ALL-UNNAMED
+# https://chronicle.software/chronicle-support-java-17/
+--add-exports java.base/sun.nio.ch=ALL-UNNAMED
+--add-exports java.management.rmi/com.sun.jmx.remote.internal.rmi=ALL-UNNAMED
+--add-exports java.rmi/sun.rmi.registry=ALL-UNNAMED
+--add-exports java.rmi/sun.rmi.server=ALL-UNNAMED
+--add-exports java.sql/java.sql=ALL-UNNAMED
+
+#chronicle, AuditLog https://chronicle.software/chronicle-support-java-17/
+--add-exports java.base/java.lang.ref=ALL-UNNAMED
+--add-exports jdk.unsupported/sun.misc=ALL-UNNAMED
+--add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED
+
+--add-opens java.base/java.lang.module=ALL-UNNAMED
+--add-opens java.base/jdk.internal.loader=ALL-UNNAMED
+--add-opens java.base/jdk.internal.ref=ALL-UNNAMED
+--add-opens java.base/jdk.internal.reflect=ALL-UNNAMED
+--add-opens java.base/jdk.internal.math=ALL-UNNAMED
+--add-opens java.base/jdk.internal.module=ALL-UNNAMED
+--add-opens java.base/jdk.internal.util.jar=ALL-UNNAMED
+--add-opens jdk.management/com.sun.management.internal=ALL-UNNAMED
+
+#to be addressed in CASSANDRA-17850
+--add-opens java.base/sun.nio.ch=ALL-UNNAMED
+# https://chronicle.software/chronicle-support-java-17/
+--add-opens java.base/java.io=ALL-UNNAMED
+--add-opens java.base/java.nio=ALL-UNNAMED
+#to be addressed during jamm maintenance
+--add-opens java.base/java.util.concurrent=ALL-UNNAMED
+--add-opens java.base/java.util=ALL-UNNAMED
+--add-opens java.base/java.util.concurrent.atomic=ALL-UNNAMED
+# https://chronicle.software/chronicle-support-java-17/ explains also 
--add-opens java.base/java.util=ALL-UNNAMED, further to jamm
+# many cqlsh tests fail if we do not open the below one - jamm and at 
org.apache.cassandra.net.Verb.getModifiersField(Verb.java:388)
+# in-jvm tests
+--add-opens java.base/java.lang=ALL-UNNAMED
+#jamm
+--add-opens java.base/java.math=ALL-UNNAMED
+#in-jvm tests? plus # https://chronicle.software/chronicle-support-java-17/
+--add-opens java.base/java.lang.reflect=ALL-UNNAMED
+
+### GC logging options -- uncomment to enable
+
+# Java 11 (and newer) GC logging options:
+# See description of https://bugs.openjdk.java.net/browse/JDK-8046148 for 
details about the syntax
+# The following is the equivalent to -XX:+PrintGCDetails 
-XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=10M
+#-Xlog:gc=info,heap*=trace,age*=debug,safepoint=info,promotion*=trace:file=/var/log/cassandra/gc.log:time,uptime,pid,tid,level:filecount=10,filesize=10485760
+
+# Notes for Java 8 migration:
+#
+# -XX:+PrintGCDetails                   maps to -Xlog:gc*:... - i.e. add a '*' 
after "gc"
+# -XX:+PrintGCDateStamps                maps to decorator 'time'
+#
+# -XX:+PrintHeapAtGC                    maps to 'heap' with level 'trace'
+# -XX:+PrintTenuringDistribution        maps to 'age' with level 'debug'
+# -XX:+PrintGCApplicationStoppedTime    maps to 'safepoint' with level 'info'
+# -XX:+PrintPromotionFailure            maps to 'promotion' with level 'trace'
+# -XX:PrintFLSStatistics=1              maps to 'freelist' with level 'trace'
+
+### Netty Options
+
+# On Java >= 9 Netty requires the io.netty.tryReflectionSetAccessible system 
property to be set to true to enable
+# creation of direct buffers using Unsafe. Without it, this falls back to 
ByteBuffer.allocateDirect which has
+# inferior performance and risks exceeding MaxDirectMemory
+-Dio.netty.tryReflectionSetAccessible=true
+
+# The newline in the end of file is intentional
diff --git a/tools/bin/cassandra.in.sh b/tools/bin/cassandra.in.sh
index e1d1fe3f05..864b87ea55 100644
--- a/tools/bin/cassandra.in.sh
+++ b/tools/bin/cassandra.in.sh
@@ -80,8 +80,9 @@ 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
+JAVA_VERSION=17
 if [ "$JVM_VERSION" = "1.8.0" ]  ; then
     JVM_PATCH_VERSION=${jvmver#*_}
     if [ "$JVM_VERSION" \< "1.8" ] || [ "$JVM_VERSION" \> "1.8.2" ] ; then
@@ -96,6 +97,10 @@ if [ "$JVM_VERSION" = "1.8.0" ]  ; then
 elif [ "$JVM_VERSION" \< "11" ] ; then
     echo "Cassandra 4.0 requires either Java 8 (update 151 or newer) or Java 
11 (or newer)."
     exit 1;
+elif [ "$short" = "11" ] ; then
+     JAVA_VERSION=11
+elif [ "$JVM_VERSION" \< "17" ] ; then
+    echo "Cassandra 5.0 requires Java 11 or Java 17(or newer)."
 fi
 
 jvm=`echo "$java_ver_output" | grep -A 1 '[openjdk|java] version' | awk 'NR==2 
{print $1}'`
@@ -119,7 +124,9 @@ 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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to