Skip to content

Commit 4a8b696

Browse files
ekaterinadimitrova2djatnieks
authored andcommitted
CNDB-11508: Add config to enable JDK22 test and run (#1503)
1 parent 0498a0a commit 4a8b696

File tree

11 files changed

+331
-21
lines changed

11 files changed

+331
-21
lines changed

bin/cassandra.in.sh

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,11 +122,16 @@ jvmver=`echo "$java_ver_output" | grep '[openjdk|java] version' | awk -F'"' 'NR=
122122
JVM_VERSION=${jvmver%_*}
123123
short=$(echo "${jvmver}" | cut -c1-2)
124124

125-
JAVA_VERSION=17
125+
JAVA_VERSION=22
126126
if [ "$short" = "11" ] ; then
127127
JAVA_VERSION=11
128128
elif [ "$JVM_VERSION" \< "17" ] ; then
129-
echo "DSE DB 5.0 requires Java 11 or Java 17."
129+
echo "DSE DB 5.0 requires Java 11 or higher."
130+
exit 1;
131+
elif [ "$short" = "17" ] ; then
132+
JAVA_VERSION=17
133+
elif [ "$JVM_VERSION" \< "22" ] ; then
134+
echo "DSE DB 5.0 requires Java 11 or higher."
130135
exit 1;
131136
fi
132137

@@ -151,7 +156,9 @@ esac
151156

152157
# Read user-defined JVM options from jvm-server.options file
153158
JVM_OPTS_FILE=$CASSANDRA_CONF/jvm${jvmoptions_variant:--clients}.options
154-
if [ $JAVA_VERSION -ge 17 ] ; then
159+
if [ $JAVA_VERSION -ge 22 ] ; then
160+
JVM_DEP_OPTS_FILE=$CASSANDRA_CONF/jvm22${jvmoptions_variant:--clients}.options
161+
elif [ $JAVA_VERSION -ge 17 ] ; then
155162
JVM_DEP_OPTS_FILE=$CASSANDRA_CONF/jvm17${jvmoptions_variant:--clients}.options
156163
elif [ $JAVA_VERSION -ge 11 ] ; then
157164
JVM_DEP_OPTS_FILE=$CASSANDRA_CONF/jvm11${jvmoptions_variant:--clients}.options

build.xml

Lines changed: 116 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,9 @@
4242
All releases are built with the default JDK.
4343
Builds with non-default JDKs are considered experimental and for development and testing purposes.
4444
When building, javac's source and target flags are set to the jdk used, so lower JDKs are not supported at runtime.
45-
The use of both CASSANDRA_USE_JDK11 and use-jdk11 is deprecated.
4645
-->
4746
<property name="java.default" value="11" />
48-
<property name="java.supported" value="11,17" />
47+
<property name="java.supported" value="11,17,22" />
4948

5049
<!-- directory details -->
5150
<property name="basedir" value="."/>
@@ -315,6 +314,7 @@
315314
<string>--add-opens java.base/java.lang=ALL-UNNAMED</string>
316315
<string>--add-opens java.base/java.util=ALL-UNNAMED</string>
317316
<string>--add-opens java.base/java.nio=ALL-UNNAMED</string>
317+
<string>--add-opens java.base/java.nio.file.attribute=ALL-UNNAMED</string>
318318

319319
<string>--add-opens java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED</string>
320320
</resources>
@@ -323,6 +323,77 @@
323323
<equals arg1="${ant.java.version}" arg2="17"/>
324324
</condition>
325325

326+
<resources id="_jvm22_arg_items">
327+
<string>-XX:+UnlockDiagnosticVMOptions</string>
328+
<string>-Djdk.attach.allowAttachSelf=true</string>
329+
<string>-XX:+UseG1GC</string>
330+
<string>-XX:+ParallelRefProcEnabled</string>
331+
<!-- Below two are used in Cassandra, not in CNDB-->
332+
<!--<string>-XX:MaxTenuringThreshold=1</string>
333+
<string>-XX:G1HeapRegionSize=16m</string>-->
334+
<string>-XX:G1RSetUpdatingPauseTimePercent=5</string>
335+
<string>-XX:MaxGCPauseMillis=100</string>
336+
337+
<!-- Copy-paste for now these options from cndb/docker-entrypoint.sh; we will verify later whether we
338+
want all of them for tests-->
339+
<string>-XX:-RestrictContended</string>
340+
<string>-XX:+UseThreadPriorities</string>
341+
<string>-XX:+DebugNonSafepoints</string>
342+
<string>-XX:+UseStringDeduplication</string>
343+
<string>-XX:StringTableSize=1000003</string>
344+
<string>-XX:+PerfDisableSharedMem</string>
345+
<string>-XX:+AlwaysPreTouch</string>
346+
<string>-XX:+UseTLAB</string>
347+
<string>-XX:+ResizeTLAB</string>
348+
<string>-XX:+UseNUMA</string>
349+
350+
351+
<string>--add-exports java.base/jdk.internal.misc=ALL-UNNAMED</string>
352+
<string>--add-exports java.base/jdk.internal.ref=ALL-UNNAMED</string>
353+
<string>--add-exports java.base/jdk.internal.perf=ALL-UNNAMED</string>
354+
<string>--add-exports java.base/sun.nio.ch=ALL-UNNAMED</string>
355+
<string>--add-exports java.management.rmi/com.sun.jmx.remote.internal.rmi=ALL-UNNAMED</string>
356+
<string>--add-exports java.rmi/sun.rmi.registry=ALL-UNNAMED</string>
357+
<string>--add-exports java.rmi/sun.rmi.server=ALL-UNNAMED</string>
358+
<string>--add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED</string>
359+
<string>--add-exports jdk.naming.dns/com.sun.jndi.dns=java.naming</string>
360+
<string>--add-exports jdk.unsupported/sun.misc=ALL-UNNAMED</string>
361+
362+
<string>--add-opens java.base/java.io=ALL-UNNAMED</string>
363+
<string>--add-opens java.base/java.lang=ALL-UNNAMED</string>
364+
<string>--add-opens java.base/java.lang.module=ALL-UNNAMED</string>
365+
<string>--add-opens java.base/java.lang.ref=ALL-UNNAMED</string>
366+
<string>--add-opens java.base/java.lang.reflect=ALL-UNNAMED</string>
367+
<string>--add-opens java.base/java.math=ALL-UNNAMED</string>
368+
<string>--add-opens java.base/java.net=ALL-UNNAMED</string>
369+
<string>--add-opens java.base/java.nio=ALL-UNNAMED</string>
370+
<string>--add-opens java.base/java.nio.file.spi=ALL-UNNAMED</string>
371+
<string>--add-opens java.base/java.util=ALL-UNNAMED</string>
372+
<string>--add-opens java.base/java.util.concurrent.locks=ALL-UNNAMED</string>
373+
<string>--add-opens java.base/jdk.internal.loader=ALL-UNNAMED</string>
374+
<string>--add-opens java.base/jdk.internal.math=ALL-UNNAMED</string>
375+
<string>--add-opens java.base/jdk.internal.module=ALL-UNNAMED</string>
376+
<string>--add-opens java.base/jdk.internal.ref=ALL-UNNAMED</string>
377+
<string>--add-opens java.base/jdk.internal.reflect=ALL-UNNAMED</string>
378+
<string>--add-opens java.base/jdk.internal.vm=ALL-UNNAMED</string>
379+
<string>--add-opens java.base/sun.nio.ch=ALL-UNNAMED</string>
380+
<string>--add-opens jdk.compiler/com.sun.tools.javac=ALL-UNNAMED</string>
381+
<string>--add-opens jdk.management.jfr/jdk.management.jfr=ALL-UNNAMED</string>
382+
<string>--add-opens jdk.management/com.sun.management.internal=ALL-UNNAMED</string>
383+
<string>--add-opens jdk.naming.dns/com.sun.jndi.dns=ALL-UNNAMED</string>
384+
<!-- required for org.apache.cassandra.Util.getSupportedMTimeGranularity-->
385+
<string>--add-opens java.base/java.nio.file.attribute=ALL-UNNAMED</string>
386+
387+
<!-- below 2 were added to support jamm and fix BatchCommitLogTest -->
388+
<string>--add-opens java.base/java.util.concurrent=ALL-UNNAMED</string>
389+
<string>--add-opens java.base/java.util.concurrent.atomic=ALL-UNNAMED</string>
390+
<string>--add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED</string>
391+
</resources>
392+
<pathconvert property="_jvm22_args_concat" refid="_jvm22_arg_items" pathsep=" "/>
393+
<condition property="java-jvmargs" value="${_jvm22_args_concat}">
394+
<equals arg1="${ant.java.version}" arg2="22"/>
395+
</condition>
396+
326397
<!--
327398
JVM arguments for tests.
328399
@@ -350,6 +421,21 @@
350421
<condition property="_std-test-jvmargs" value="${_jvm17_test_arg_items_concat}">
351422
<equals arg1="${ant.java.version}" arg2="17"/>
352423
</condition>
424+
<resources id="_jvm22_test_arg_items">
425+
<string>-Djava.security.manager=allow</string>
426+
<string>-Dio.netty.tryReflectionSetAccessible=true</string>
427+
<string>-Dnet.bytebuddy.experimental=true</string>
428+
429+
<!-- Enable vector incubator feature (simd support)-->
430+
<string>--add-modules jdk.incubator.vector</string>
431+
</resources>
432+
<pathconvert property="_jvm22_test_arg_items_concat" refid="_jvm22_test_arg_items" pathsep=" "/>
433+
<condition property="_std-test-jvmargs" value="${_jvm11_test_arg_items_concat}">
434+
<equals arg1="${ant.java.version}" arg2="11"/>
435+
</condition>
436+
<condition property="_std-test-jvmargs" value="${_jvm22_test_arg_items_concat}">
437+
<equals arg1="${ant.java.version}" arg2="22"/>
438+
</condition>
353439

354440
<!-- needed to compile org.apache.cassandra.utils.JMXServerUtils -->
355441
<!-- needed to compile org.apache.cassandra.distributed.impl.Instance-->
@@ -531,6 +617,7 @@
531617
<jvmarg value="-Dstorage-config=${test.conf}"/>
532618
<jvmarg value="-Dcassandra.reads.thresholds.coordinator.defensive_checks_enabled=true" /> <!-- enable defensive checks -->
533619
<jvmarg value="-javaagent:${build.dir.lib}/jars/jamm-${jamm.version}.jar" />
620+
534621
<jvmarg value="-ea"/>
535622
<jvmarg line="${java-jvmargs}"/>
536623
</java>
@@ -1216,6 +1303,7 @@
12161303
<jvmarg value="-Dcassandra.use_nix_recursive_delete=${cassandra.use_nix_recursive_delete}"/>
12171304
<jvmarg value="-Dio.netty.allocator.useCacheForAllThreads=true"/>
12181305
<jvmarg value="-Dio.netty.allocator.maxOrder=11"/>
1306+
12191307
<jvmarg line="${java-jvmargs}"/>
12201308
<!-- disable shrinks in quicktheories CASSANDRA-15554 -->
12211309
<jvmarg value="-DQT_SHRINKS=0"/>
@@ -1267,6 +1355,7 @@
12671355
<jvmarg value="-Dcassandra.ring_delay_ms=1000"/>
12681356
<jvmarg value="-Dcassandra.tolerate_sstable_size=true"/>
12691357
<jvmarg value="-Dcassandra.skip_sync=true" />
1358+
12701359
</testmacro>
12711360
<fileset dir="${test.unit.src}" />
12721361
</target>
@@ -1285,6 +1374,7 @@
12851374
<jvmarg value="-Dcassandra.tolerate_sstable_size=true"/>
12861375
<jvmarg value="-Dcassandra.skip_sync=true" />
12871376
<jvmarg value="-Xmx${maxMemory}"/>
1377+
12881378
<jvmarg value="-Dlogback.configurationFile=file://${test.logback.configurationFile}"/>
12891379
</testmacrohelper>
12901380
</sequential>
@@ -1309,6 +1399,7 @@
13091399
<jvmarg value="-Dcassandra.tolerate_sstable_size=true"/>
13101400
<jvmarg value="-Dcassandra.config=file:///${compressed_yaml}"/>
13111401
<jvmarg value="-Dcassandra.skip_sync=true" />
1402+
13121403
<jvmarg value="-Dlogback.configurationFile=file://${test.logback.configurationFile}"/>
13131404
</testmacrohelper>
13141405
</sequential>
@@ -1330,6 +1421,7 @@
13301421
<jvmarg value="-Dcassandra.tolerate_sstable_size=true"/>
13311422
<jvmarg value="-Dcassandra.config=file:///${cdc_yaml}"/>
13321423
<jvmarg value="-Dcassandra.skip_sync=true" />
1424+
13331425
<jvmarg value="-Dlogback.configurationFile=file://${test.logback.configurationFile}"/>
13341426
</testmacrohelper>
13351427
</sequential>
@@ -1375,6 +1467,7 @@
13751467
<jvmarg value="-Dcassandra.config=file:///${scm_none_yaml}"/>
13761468
<jvmarg value="-Dcassandra.test.storage_compatibility_mode=NONE"/>
13771469
<jvmarg value="-Dcassandra.skip_sync=true" />
1470+
13781471
<jvmarg value="-Dlogback.configurationFile=file://${test.logback.configurationFile}"/>
13791472
</testmacrohelper>
13801473
</sequential>
@@ -1392,6 +1485,7 @@
13921485
<jvmarg value="-Dcassandra.tolerate_sstable_size=true"/>
13931486
<jvmarg value="-Dcassandra.config.loader=org.apache.cassandra.OffsetAwareConfigurationLoader"/>
13941487
<jvmarg value="-Dcassandra.skip_sync=true" />
1488+
13951489
<jvmarg value="-Dcassandra.allow_cursor_compaction=false" />
13961490
<jvmarg value="-Dunified_compaction.parallelize_output_shards=false" />
13971491
<jvmarg value="-Dlogback.configurationFile=file://${test.logback.configurationFile}"/>
@@ -1415,6 +1509,7 @@
14151509
<jvmarg value="-Dcassandra.tolerate_sstable_size=true"/>
14161510
<jvmarg value="-Dcassandra.config=file:///${system_keyspaces_directory_yaml}"/>
14171511
<jvmarg value="-Dcassandra.skip_sync=true" />
1512+
14181513
<jvmarg value="-Dlogback.configurationFile=file://${test.logback.configurationFile}"/>
14191514
</testmacrohelper>
14201515
</sequential>
@@ -1431,6 +1526,7 @@
14311526
<jvmarg value="-Dcassandra.tolerate_sstable_size=true"/>
14321527
<jvmarg value="-Dcassandra.sai.latest.version=aa"/>
14331528
<jvmarg value="-Dcassandra.skip_sync=true" />
1529+
14341530
<jvmarg value="-Dlogback.configurationFile=file://${test.logback.configurationFile}"/>
14351531
</testmacrohelper>
14361532
</sequential>
@@ -1446,6 +1542,7 @@
14461542
<jvmarg value="-Dcassandra.ring_delay_ms=1000"/>
14471543
<jvmarg value="-Dcassandra.tolerate_sstable_size=true"/>
14481544
<jvmarg value="-Dcassandra.skip_sync=true" />
1545+
14491546
<jvmarg value="-Dlogback.configurationFile=file://\${test.logback.configurationFile}"/>
14501547
</testmacrohelper>
14511548
</sequential>
@@ -1476,6 +1573,7 @@
14761573
<jvmarg value="-Dcassandra.ring_delay_ms=1000"/>
14771574
<jvmarg value="-Dcassandra.tolerate_sstable_size=true"/>
14781575
<jvmarg value="-Dcassandra.skip_sync=true" />
1576+
14791577
</testmacro>
14801578
</target>
14811579

@@ -1489,6 +1587,7 @@
14891587
<test if="withoutMethods" name="${test.name}" todir="${build.test.output.dir}/" outfile="TEST-${test.name}"/>
14901588
<jvmarg value="-Dcassandra.ring_delay_ms=1000"/>
14911589
<jvmarg value="-Dcassandra.tolerate_sstable_size=true"/>
1590+
14921591
</testmacro>
14931592
</target>
14941593

@@ -1501,6 +1600,7 @@
15011600
<test if="withMethods" name="${test.name}" methods="${test.methods}" todir="${build.test.output.dir}/" outfile="TEST-${test.name}-${test.methods}"/>
15021601
<test if="withoutMethods" name="${test.name}" todir="${build.test.output.dir}/" outfile="TEST-${test.name}"/>
15031602
<jvmarg value="-Dlogback.configurationFile=test/conf/logback-burntest.xml"/>
1603+
15041604
</testmacro>
15051605
</target>
15061606

@@ -1581,25 +1681,29 @@
15811681
<testmacro inputdir="${test.unit.src}"
15821682
timeout="${test.timeout}" filter="**/SerializationsTest.java">
15831683
<jvmarg value="-Dcassandra.test-serialization-writes=True"/>
1684+
15841685
</testmacro>
15851686
</target>
15861687

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

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

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

@@ -1614,13 +1718,15 @@
16141718
timeout="${test.long.timeout}">
16151719
<jvmarg value="-Dcassandra.ring_delay_ms=1000"/>
16161720
<jvmarg value="-Dcassandra.tolerate_sstable_size=true"/>
1721+
16171722
</testmacro>
16181723
</target>
16191724

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

@@ -1639,6 +1745,7 @@
16391745
<jvmarg value="-Dcassandra.memtable_row_overhead_computation_step=100"/>
16401746
<jvmarg value="-Dcassandra.test.use_prepared=${cassandra.test.use_prepared}"/>
16411747
<jvmarg value="-Dcassandra.skip_sync=true" />
1748+
16421749
<classpath>
16431750
<path refid="cassandra.classpath.test" />
16441751
<pathelement location="${test.classes}"/>
@@ -1685,6 +1792,7 @@
16851792
<jvmarg value="-Dcassandra.test.use_prepared=${cassandra.test.use_prepared}"/>
16861793
<jvmarg value="-Dcassandra.memtable_row_overhead_computation_step=100"/>
16871794
<jvmarg value="-Dcassandra.skip_sync=true" />
1795+
16881796
<classpath>
16891797
<path refid="cassandra.classpath.test" />
16901798
<pathelement location="${test.classes}"/>
@@ -1910,6 +2018,7 @@
19102018
<jvmarg value="-Dcassandra.ring_delay_ms=10000"/>
19112019
<jvmarg value="-Dcassandra.tolerate_sstable_size=true"/>
19122020
<jvmarg value="-Dcassandra.skip_sync=true" />
2021+
19132022
</testmacro>
19142023
</target>
19152024

@@ -1947,6 +2056,7 @@
19472056
<jvmarg value="-Dcassandra.tolerate_sstable_size=true"/>
19482057
<jvmarg value="-Dcassandra.skip_sync=true" />
19492058
<jvmarg value="-Xmx8G"/>
2059+
19502060
</testmacro>
19512061
</target>
19522062

@@ -1963,6 +2073,7 @@
19632073
<jvmarg value="-Dcassandra.tolerate_sstable_size=true"/>
19642074
<jvmarg value="-Dcassandra.skip_sync=true" />
19652075
<jvmarg value="-Xmx8G"/>
2076+
19662077
</testmacro>
19672078
</target>
19682079

@@ -2081,10 +2192,10 @@
20812192
</project>]]></echo>
20822193
<antcall target="_maybe_update_idea_to_java11plus"/>
20832194
<echo>
2084-
IDE configuration in .idea/ updated for use with JDK${ant.java.version}.
2195+
IDE configuration in .idea/ updated for use with JDK${ant.java.version}.
20852196

2086-
In IntelliJ verify that the SDK is ${ant.java.version}, and its path is valid.
2087-
This can be verified in 'Project Structure/Project Setting/Project' and 'Project Structure/Platform Setting/SDKs'.
2197+
In IntelliJ verify that the SDK is ${ant.java.version}, and its path is valid.
2198+
This can be verified in 'Project Structure/Project Setting/Project' and 'Project Structure/Platform Setting/SDKs'.
20882199
</echo>
20892200
</target>
20902201

conf/jvm17-server.options

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,15 @@
9696
--add-opens java.base/java.nio=ALL-UNNAMED
9797
--add-opens jdk.compiler/com.sun.tools.javac=ALL-UNNAMED
9898

99+
# required for org.apache.cassandra.Util.getSupportedMTimeGranularity
100+
--add-opens java.base/java.nio.file.attribute=ALL-UNNAMED
101+
99102
### GC logging options -- uncomment to enable
100103

101104
# Java 11 (and newer) GC logging options:
102105
# See description of https://bugs.openjdk.java.net/browse/JDK-8046148 for details about the syntax
103106
# The following is the equivalent to -XX:+PrintGCDetails -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=10M
104-
-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
107+
# -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
105108

106109
# Notes for Java 8 migration:
107110
#

0 commit comments

Comments
 (0)