Skip to content

Commit

Permalink
CNDB-11508: Add config to enable JDK22 test and run (#1503)
Browse files Browse the repository at this point in the history
  • Loading branch information
ekaterinadimitrova2 authored and djatnieks committed Jan 15, 2025
1 parent 86a11a4 commit 59740b7
Show file tree
Hide file tree
Showing 11 changed files with 331 additions and 21 deletions.
13 changes: 10 additions & 3 deletions bin/cassandra.in.sh
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,16 @@ jvmver=`echo "$java_ver_output" | grep '[openjdk|java] version' | awk -F'"' 'NR=
JVM_VERSION=${jvmver%_*}
short=$(echo "${jvmver}" | cut -c1-2)

JAVA_VERSION=17
JAVA_VERSION=22
if [ "$short" = "11" ] ; then
JAVA_VERSION=11
elif [ "$JVM_VERSION" \< "17" ] ; then
echo "DSE DB 5.0 requires Java 11 or Java 17."
echo "DSE DB 5.0 requires Java 11 or higher."
exit 1;
elif [ "$short" = "17" ] ; then
JAVA_VERSION=17
elif [ "$JVM_VERSION" \< "22" ] ; then
echo "DSE DB 5.0 requires Java 11 or higher."
exit 1;
fi

Expand All @@ -151,7 +156,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 17 ] ; then
if [ $JAVA_VERSION -ge 22 ] ; then
JVM_DEP_OPTS_FILE=$CASSANDRA_CONF/jvm22${jvmoptions_variant:--clients}.options
elif [ $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
Expand Down
121 changes: 116 additions & 5 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,9 @@
All releases are built with the default JDK.
Builds with non-default JDKs are considered experimental and for development and testing purposes.
When building, javac's source and target flags are set to the jdk used, so lower JDKs are not supported at runtime.
The use of both CASSANDRA_USE_JDK11 and use-jdk11 is deprecated.
-->
<property name="java.default" value="11" />
<property name="java.supported" value="11,17" />
<property name="java.supported" value="11,17,22" />

<!-- directory details -->
<property name="basedir" value="."/>
Expand Down Expand Up @@ -313,6 +312,7 @@
<string>--add-opens java.base/java.lang=ALL-UNNAMED</string>
<string>--add-opens java.base/java.util=ALL-UNNAMED</string>
<string>--add-opens java.base/java.nio=ALL-UNNAMED</string>
<string>--add-opens java.base/java.nio.file.attribute=ALL-UNNAMED</string>

<string>--add-opens java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED</string>
</resources>
Expand All @@ -321,6 +321,77 @@
<equals arg1="${ant.java.version}" arg2="17"/>
</condition>

<resources id="_jvm22_arg_items">
<string>-XX:+UnlockDiagnosticVMOptions</string>
<string>-Djdk.attach.allowAttachSelf=true</string>
<string>-XX:+UseG1GC</string>
<string>-XX:+ParallelRefProcEnabled</string>
<!-- Below two are used in Cassandra, not in CNDB-->
<!--<string>-XX:MaxTenuringThreshold=1</string>
<string>-XX:G1HeapRegionSize=16m</string>-->
<string>-XX:G1RSetUpdatingPauseTimePercent=5</string>
<string>-XX:MaxGCPauseMillis=100</string>

<!-- Copy-paste for now these options from cndb/docker-entrypoint.sh; we will verify later whether we
want all of them for tests-->
<string>-XX:-RestrictContended</string>
<string>-XX:+UseThreadPriorities</string>
<string>-XX:+DebugNonSafepoints</string>
<string>-XX:+UseStringDeduplication</string>
<string>-XX:StringTableSize=1000003</string>
<string>-XX:+PerfDisableSharedMem</string>
<string>-XX:+AlwaysPreTouch</string>
<string>-XX:+UseTLAB</string>
<string>-XX:+ResizeTLAB</string>
<string>-XX:+UseNUMA</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/jdk.internal.perf=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 jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED</string>
<string>--add-exports jdk.naming.dns/com.sun.jndi.dns=java.naming</string>
<string>--add-exports jdk.unsupported/sun.misc=ALL-UNNAMED</string>

<string>--add-opens java.base/java.io=ALL-UNNAMED</string>
<string>--add-opens java.base/java.lang=ALL-UNNAMED</string>
<string>--add-opens java.base/java.lang.module=ALL-UNNAMED</string>
<string>--add-opens java.base/java.lang.ref=ALL-UNNAMED</string>
<string>--add-opens java.base/java.lang.reflect=ALL-UNNAMED</string>
<string>--add-opens java.base/java.math=ALL-UNNAMED</string>
<string>--add-opens java.base/java.net=ALL-UNNAMED</string>
<string>--add-opens java.base/java.nio=ALL-UNNAMED</string>
<string>--add-opens java.base/java.nio.file.spi=ALL-UNNAMED</string>
<string>--add-opens java.base/java.util=ALL-UNNAMED</string>
<string>--add-opens java.base/java.util.concurrent.locks=ALL-UNNAMED</string>
<string>--add-opens java.base/jdk.internal.loader=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.ref=ALL-UNNAMED</string>
<string>--add-opens java.base/jdk.internal.reflect=ALL-UNNAMED</string>
<string>--add-opens java.base/jdk.internal.vm=ALL-UNNAMED</string>
<string>--add-opens java.base/sun.nio.ch=ALL-UNNAMED</string>
<string>--add-opens jdk.compiler/com.sun.tools.javac=ALL-UNNAMED</string>
<string>--add-opens jdk.management.jfr/jdk.management.jfr=ALL-UNNAMED</string>
<string>--add-opens jdk.management/com.sun.management.internal=ALL-UNNAMED</string>
<string>--add-opens jdk.naming.dns/com.sun.jndi.dns=ALL-UNNAMED</string>
<!-- required for org.apache.cassandra.Util.getSupportedMTimeGranularity-->
<string>--add-opens java.base/java.nio.file.attribute=ALL-UNNAMED</string>

<!-- below 2 were added to support jamm and fix BatchCommitLogTest -->
<string>--add-opens java.base/java.util.concurrent=ALL-UNNAMED</string>
<string>--add-opens java.base/java.util.concurrent.atomic=ALL-UNNAMED</string>
<string>--add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED</string>
</resources>
<pathconvert property="_jvm22_args_concat" refid="_jvm22_arg_items" pathsep=" "/>
<condition property="java-jvmargs" value="${_jvm22_args_concat}">
<equals arg1="${ant.java.version}" arg2="22"/>
</condition>

<!--
JVM arguments for tests.
Expand Down Expand Up @@ -348,6 +419,21 @@
<condition property="_std-test-jvmargs" value="${_jvm17_test_arg_items_concat}">
<equals arg1="${ant.java.version}" arg2="17"/>
</condition>
<resources id="_jvm22_test_arg_items">
<string>-Djava.security.manager=allow</string>
<string>-Dio.netty.tryReflectionSetAccessible=true</string>
<string>-Dnet.bytebuddy.experimental=true</string>

<!-- Enable vector incubator feature (simd support)-->
<string>--add-modules jdk.incubator.vector</string>
</resources>
<pathconvert property="_jvm22_test_arg_items_concat" refid="_jvm22_test_arg_items" pathsep=" "/>
<condition property="_std-test-jvmargs" value="${_jvm11_test_arg_items_concat}">
<equals arg1="${ant.java.version}" arg2="11"/>
</condition>
<condition property="_std-test-jvmargs" value="${_jvm22_test_arg_items_concat}">
<equals arg1="${ant.java.version}" arg2="22"/>
</condition>

<!-- needed to compile org.apache.cassandra.utils.JMXServerUtils -->
<!-- needed to compile org.apache.cassandra.distributed.impl.Instance-->
Expand Down Expand Up @@ -529,6 +615,7 @@
<jvmarg value="-Dstorage-config=${test.conf}"/>
<jvmarg value="-Dcassandra.reads.thresholds.coordinator.defensive_checks_enabled=true" /> <!-- enable defensive checks -->
<jvmarg value="-javaagent:${build.dir.lib}/jars/jamm-${jamm.version}.jar" />

<jvmarg value="-ea"/>
<jvmarg line="${java-jvmargs}"/>
</java>
Expand Down Expand Up @@ -1212,6 +1299,7 @@
<jvmarg value="-Dcassandra.use_nix_recursive_delete=${cassandra.use_nix_recursive_delete}"/>
<jvmarg value="-Dio.netty.allocator.useCacheForAllThreads=true"/>
<jvmarg value="-Dio.netty.allocator.maxOrder=11"/>

<jvmarg line="${java-jvmargs}"/>
<!-- disable shrinks in quicktheories CASSANDRA-15554 -->
<jvmarg value="-DQT_SHRINKS=0"/>
Expand Down Expand Up @@ -1263,6 +1351,7 @@
<jvmarg value="-Dcassandra.ring_delay_ms=1000"/>
<jvmarg value="-Dcassandra.tolerate_sstable_size=true"/>
<jvmarg value="-Dcassandra.skip_sync=true" />

</testmacro>
<fileset dir="${test.unit.src}" />
</target>
Expand All @@ -1281,6 +1370,7 @@
<jvmarg value="-Dcassandra.tolerate_sstable_size=true"/>
<jvmarg value="-Dcassandra.skip_sync=true" />
<jvmarg value="-Xmx${maxMemory}"/>

<jvmarg value="-Dlogback.configurationFile=file://${test.logback.configurationFile}"/>
</testmacrohelper>
</sequential>
Expand All @@ -1305,6 +1395,7 @@
<jvmarg value="-Dcassandra.tolerate_sstable_size=true"/>
<jvmarg value="-Dcassandra.config=file:///${compressed_yaml}"/>
<jvmarg value="-Dcassandra.skip_sync=true" />

<jvmarg value="-Dlogback.configurationFile=file://${test.logback.configurationFile}"/>
</testmacrohelper>
</sequential>
Expand All @@ -1326,6 +1417,7 @@
<jvmarg value="-Dcassandra.tolerate_sstable_size=true"/>
<jvmarg value="-Dcassandra.config=file:///${cdc_yaml}"/>
<jvmarg value="-Dcassandra.skip_sync=true" />

<jvmarg value="-Dlogback.configurationFile=file://${test.logback.configurationFile}"/>
</testmacrohelper>
</sequential>
Expand Down Expand Up @@ -1371,6 +1463,7 @@
<jvmarg value="-Dcassandra.config=file:///${scm_none_yaml}"/>
<jvmarg value="-Dcassandra.test.storage_compatibility_mode=NONE"/>
<jvmarg value="-Dcassandra.skip_sync=true" />

<jvmarg value="-Dlogback.configurationFile=file://${test.logback.configurationFile}"/>
</testmacrohelper>
</sequential>
Expand All @@ -1388,6 +1481,7 @@
<jvmarg value="-Dcassandra.tolerate_sstable_size=true"/>
<jvmarg value="-Dcassandra.config.loader=org.apache.cassandra.OffsetAwareConfigurationLoader"/>
<jvmarg value="-Dcassandra.skip_sync=true" />

<jvmarg value="-Dcassandra.allow_cursor_compaction=false" />
<jvmarg value="-Dunified_compaction.parallelize_output_shards=false" />
<jvmarg value="-Dlogback.configurationFile=file://${test.logback.configurationFile}"/>
Expand All @@ -1411,6 +1505,7 @@
<jvmarg value="-Dcassandra.tolerate_sstable_size=true"/>
<jvmarg value="-Dcassandra.config=file:///${system_keyspaces_directory_yaml}"/>
<jvmarg value="-Dcassandra.skip_sync=true" />

<jvmarg value="-Dlogback.configurationFile=file://${test.logback.configurationFile}"/>
</testmacrohelper>
</sequential>
Expand All @@ -1427,6 +1522,7 @@
<jvmarg value="-Dcassandra.tolerate_sstable_size=true"/>
<jvmarg value="-Dcassandra.sai.latest.version=aa"/>
<jvmarg value="-Dcassandra.skip_sync=true" />

<jvmarg value="-Dlogback.configurationFile=file://${test.logback.configurationFile}"/>
</testmacrohelper>
</sequential>
Expand All @@ -1442,6 +1538,7 @@
<jvmarg value="-Dcassandra.ring_delay_ms=1000"/>
<jvmarg value="-Dcassandra.tolerate_sstable_size=true"/>
<jvmarg value="-Dcassandra.skip_sync=true" />

<jvmarg value="-Dlogback.configurationFile=file://\${test.logback.configurationFile}"/>
</testmacrohelper>
</sequential>
Expand Down Expand Up @@ -1472,6 +1569,7 @@
<jvmarg value="-Dcassandra.ring_delay_ms=1000"/>
<jvmarg value="-Dcassandra.tolerate_sstable_size=true"/>
<jvmarg value="-Dcassandra.skip_sync=true" />

</testmacro>
</target>

Expand All @@ -1485,6 +1583,7 @@
<test if="withoutMethods" name="${test.name}" todir="${build.test.dir}/output/" outfile="TEST-${test.name}"/>
<jvmarg value="-Dcassandra.ring_delay_ms=1000"/>
<jvmarg value="-Dcassandra.tolerate_sstable_size=true"/>

</testmacro>
</target>

Expand All @@ -1497,6 +1596,7 @@
<test if="withMethods" name="${test.name}" methods="${test.methods}" todir="${build.test.dir}/output/" outfile="TEST-${test.name}-${test.methods}"/>
<test if="withoutMethods" name="${test.name}" todir="${build.test.dir}/output/" outfile="TEST-${test.name}"/>
<jvmarg value="-Dlogback.configurationFile=test/conf/logback-burntest.xml"/>

</testmacro>
</target>

Expand Down Expand Up @@ -1577,25 +1677,29 @@
<testmacro inputdir="${test.unit.src}"
timeout="${test.timeout}" filter="**/SerializationsTest.java">
<jvmarg value="-Dcassandra.test-serialization-writes=True"/>

</testmacro>
</target>

<target name="msg-ser-test" depends="maybe-build-test" description="Tests message serializations">
<testmacro inputdir="${test.unit.src}" timeout="${test.timeout}"
filter="**/SerializationsTest.java"/>

</target>

<target name="msg-ser-test-7" depends="maybe-build-test" description="Generates message serializations">
<testmacro inputdir="${test.unit.src}"
timeout="${test.timeout}" filter="**/SerializationsTest.java">
<jvmarg value="-Dcassandra.version=0.7"/>

</testmacro>
</target>

<target name="msg-ser-test-10" depends="maybe-build-test" description="Tests message serializations on 1.0 messages">
<testmacro inputdir="${test.unit.src}"
timeout="${test.timeout}" filter="**/SerializationsTest.java">
<jvmarg value="-Dcassandra.version=1.0"/>

</testmacro>
</target>

Expand All @@ -1610,13 +1714,15 @@
timeout="${test.long.timeout}">
<jvmarg value="-Dcassandra.ring_delay_ms=1000"/>
<jvmarg value="-Dcassandra.tolerate_sstable_size=true"/>

</testmacro>
</target>

<target name="test-memory" depends="maybe-build-test" description="Execute functional tests">
<testmacro inputdir="${test.memory.src}"
timeout="${test.memory.timeout}">
<jvmarg value="-javaagent:${build.dir}/test/lib/jars/java-allocation-instrumenter-${allocation-instrumenter.version}.jar"/>

</testmacro>
</target>

Expand All @@ -1635,6 +1741,7 @@
<jvmarg value="-Dcassandra.memtable_row_overhead_computation_step=100"/>
<jvmarg value="-Dcassandra.test.use_prepared=${cassandra.test.use_prepared}"/>
<jvmarg value="-Dcassandra.skip_sync=true" />

<classpath>
<path refid="cassandra.classpath.test" />
<pathelement location="${test.classes}"/>
Expand Down Expand Up @@ -1681,6 +1788,7 @@
<jvmarg value="-Dcassandra.test.use_prepared=${cassandra.test.use_prepared}"/>
<jvmarg value="-Dcassandra.memtable_row_overhead_computation_step=100"/>
<jvmarg value="-Dcassandra.skip_sync=true" />

<classpath>
<path refid="cassandra.classpath.test" />
<pathelement location="${test.classes}"/>
Expand Down Expand Up @@ -1915,6 +2023,7 @@
<jvmarg value="-Dcassandra.ring_delay_ms=10000"/>
<jvmarg value="-Dcassandra.tolerate_sstable_size=true"/>
<jvmarg value="-Dcassandra.skip_sync=true" />

</testmacro>
</target>

Expand Down Expand Up @@ -1952,6 +2061,7 @@
<jvmarg value="-Dcassandra.tolerate_sstable_size=true"/>
<jvmarg value="-Dcassandra.skip_sync=true" />
<jvmarg value="-Xmx8G"/>

</testmacro>
</target>

Expand All @@ -1968,6 +2078,7 @@
<jvmarg value="-Dcassandra.tolerate_sstable_size=true"/>
<jvmarg value="-Dcassandra.skip_sync=true" />
<jvmarg value="-Xmx8G"/>

</testmacro>
</target>

Expand Down Expand Up @@ -2086,10 +2197,10 @@
</project>]]></echo>
<antcall target="_maybe_update_idea_to_java11plus"/>
<echo>
IDE configuration in .idea/ updated for use with JDK${ant.java.version}.
IDE configuration in .idea/ updated for use with JDK${ant.java.version}.

In IntelliJ verify that the SDK is ${ant.java.version}, and its path is valid.
This can be verified in 'Project Structure/Project Setting/Project' and 'Project Structure/Platform Setting/SDKs'.
In IntelliJ verify that the SDK is ${ant.java.version}, and its path is valid.
This can be verified in 'Project Structure/Project Setting/Project' and 'Project Structure/Platform Setting/SDKs'.
</echo>
</target>

Expand Down
5 changes: 4 additions & 1 deletion conf/jvm17-server.options
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,15 @@
--add-opens java.base/java.nio=ALL-UNNAMED
--add-opens jdk.compiler/com.sun.tools.javac=ALL-UNNAMED

# required for org.apache.cassandra.Util.getSupportedMTimeGranularity
--add-opens java.base/java.nio.file.attribute=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*=debug,age*=debug,safepoint=info,promotion*=debug:file=/var/log/cassandra/gc.log:time,uptime,pid,tid,level:filecount=10,filesize=10485760
# -Xlog:gc=info,heap*=debug,age*=debug,safepoint=info,promotion*=debug:file=/var/log/cassandra/gc.log:time,uptime,pid,tid,level:filecount=10,filesize=10485760

# Notes for Java 8 migration:
#
Expand Down
Loading

0 comments on commit 59740b7

Please sign in to comment.