mirror of https://github.com/apache/cassandra
Make C* compile and run on Java 11 and Java 8
patch by Robert Stupp; reviewed by Jason Brown for CASSANDRA-9608
This commit is contained in:
parent
176d4bac22
commit
6ba2fb9395
|
|
@ -65,9 +65,9 @@ env_vars: &env_vars
|
||||||
#<<: *high_capacity_env_vars
|
#<<: *high_capacity_env_vars
|
||||||
workflows:
|
workflows:
|
||||||
version: 2
|
version: 2
|
||||||
build_and_run_tests: *default_jobs
|
#build_and_run_tests: *default_jobs
|
||||||
#build_and_run_tests: *with_dtest_jobs_only
|
#build_and_run_tests: *with_dtest_jobs_only
|
||||||
#build_and_run_tests: *with_dtest_jobs
|
build_and_run_tests: *with_dtest_jobs
|
||||||
docker_image: &docker_image kjellman/cassandra-test:0.4.3
|
docker_image: &docker_image kjellman/cassandra-test:0.4.3
|
||||||
version: 2
|
version: 2
|
||||||
jobs:
|
jobs:
|
||||||
|
|
|
||||||
|
|
@ -76,3 +76,5 @@ lib/jsr223/scala/*.jar
|
||||||
# Generated files from the documentation
|
# Generated files from the documentation
|
||||||
doc/source/configuration/cassandra_config_file.rst
|
doc/source/configuration/cassandra_config_file.rst
|
||||||
doc/source/tools/nodetool
|
doc/source/tools/nodetool
|
||||||
|
|
||||||
|
audit
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
4.0
|
4.0
|
||||||
|
* Add experimental support for Java 11 (CASSANDRA-9608)
|
||||||
* Make PeriodicCommitLogService.blockWhenSyncLagsNanos configurable (CASSANDRA-14580)
|
* Make PeriodicCommitLogService.blockWhenSyncLagsNanos configurable (CASSANDRA-14580)
|
||||||
* Improve logging in MessageInHandler's constructor (CASSANDRA-14576)
|
* Improve logging in MessageInHandler's constructor (CASSANDRA-14576)
|
||||||
* Set broadcast address in internode messaging handshake (CASSANDRA-14579)
|
* Set broadcast address in internode messaging handshake (CASSANDRA-14579)
|
||||||
|
|
|
||||||
5
NEWS.txt
5
NEWS.txt
|
|
@ -38,6 +38,11 @@ using the provided 'sstableupgrade' tool.
|
||||||
|
|
||||||
New features
|
New features
|
||||||
------------
|
------------
|
||||||
|
- *Experimental* support for Java 11 has been added. JVM options that differ between or are
|
||||||
|
specific for Java 8 and 11 have been moved from jvm.options into jvm8.options and jvm11.options.
|
||||||
|
IMPORTANT: Running C* on Java 11 is *experimental* and do it at your own risk.
|
||||||
|
Compilation recommendations: configure Java 11 SDK via JAVA_HOME and Java 8 SDK via JAVA8_HOME.
|
||||||
|
Release builds require Java 11 + Java 8. Development builds can use Java 8 without 11.
|
||||||
- LCS now respects the max_threshold parameter when compacting - this was hard coded to 32
|
- LCS now respects the max_threshold parameter when compacting - this was hard coded to 32
|
||||||
before, but now it is possible to do bigger compactions when compacting from L0 to L1.
|
before, but now it is possible to do bigger compactions when compacting from L0 to L1.
|
||||||
This also applies to STCS-compactions in L0 - if there are more than 32 sstables in L0
|
This also applies to STCS-compactions in L0 - if there are more than 32 sstables in L0
|
||||||
|
|
|
||||||
|
|
@ -66,6 +66,9 @@
|
||||||
# POSIX sh and Solaris sh. This means, in particular, no $(( )) and no $( ).
|
# POSIX sh and Solaris sh. This means, in particular, no $(( )) and no $( ).
|
||||||
|
|
||||||
# If an include wasn't specified in the environment, then search for one...
|
# If an include wasn't specified in the environment, then search for one...
|
||||||
|
|
||||||
|
jvmoptions_variant="-server"
|
||||||
|
|
||||||
if [ "x$CASSANDRA_INCLUDE" = "x" ]; then
|
if [ "x$CASSANDRA_INCLUDE" = "x" ]; then
|
||||||
# Locations (in order) to use when searching for an include file.
|
# Locations (in order) to use when searching for an include file.
|
||||||
for include in "`dirname "$0"`/cassandra.in.sh" \
|
for include in "`dirname "$0"`/cassandra.in.sh" \
|
||||||
|
|
@ -83,27 +86,6 @@ elif [ -r "$CASSANDRA_INCLUDE" ]; then
|
||||||
. "$CASSANDRA_INCLUDE"
|
. "$CASSANDRA_INCLUDE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Use JAVA_HOME if set, otherwise look for java in PATH
|
|
||||||
if [ -n "$JAVA_HOME" ]; then
|
|
||||||
# Why we can't have nice things: Solaris combines x86 and x86_64
|
|
||||||
# installations in the same tree, using an unconventional path for the
|
|
||||||
# 64bit JVM. Since we prefer 64bit, search the alternate path first,
|
|
||||||
# (see https://issues.apache.org/jira/browse/CASSANDRA-4638).
|
|
||||||
for java in "$JAVA_HOME"/bin/amd64/java "$JAVA_HOME"/bin/java; do
|
|
||||||
if [ -x "$java" ]; then
|
|
||||||
JAVA="$java"
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
else
|
|
||||||
JAVA=java
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z $JAVA ] ; then
|
|
||||||
echo Unable to find java executable. Check JAVA_HOME and PATH environment variables. >&2
|
|
||||||
exit 1;
|
|
||||||
fi
|
|
||||||
|
|
||||||
# If numactl is available, use it. For Cassandra, the priority is to
|
# If numactl is available, use it. For Cassandra, the priority is to
|
||||||
# avoid disk I/O. Even for the purpose of CPU efficiency, we don't
|
# avoid disk I/O. Even for the purpose of CPU efficiency, we don't
|
||||||
# really have CPU<->data affinity anyway. Also, empirically test that numactl
|
# really have CPU<->data affinity anyway. Also, empirically test that numactl
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ if NOT DEFINED JAVA_HOME goto :err
|
||||||
REM -----------------------------------------------------------------------------
|
REM -----------------------------------------------------------------------------
|
||||||
REM JVM Opts we'll use in legacy run or installation
|
REM JVM Opts we'll use in legacy run or installation
|
||||||
set JAVA_OPTS=-ea^
|
set JAVA_OPTS=-ea^
|
||||||
-javaagent:"%CASSANDRA_HOME%\lib\jamm-0.3.0.jar"^
|
-javaagent:"%CASSANDRA_HOME%\lib\jamm-0.3.2"^
|
||||||
-Xms2G^
|
-Xms2G^
|
||||||
-Xmx2G^
|
-Xmx2G^
|
||||||
-XX:+HeapDumpOnOutOfMemoryError^
|
-XX:+HeapDumpOnOutOfMemoryError^
|
||||||
|
|
|
||||||
|
|
@ -23,11 +23,18 @@ if [ "x$CASSANDRA_CONF" = "x" ]; then
|
||||||
CASSANDRA_CONF="$CASSANDRA_HOME/conf"
|
CASSANDRA_CONF="$CASSANDRA_HOME/conf"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# The java classpath (required)
|
||||||
|
CLASSPATH="$CASSANDRA_CONF"
|
||||||
|
|
||||||
# This can be the path to a jar file, or a directory containing the
|
# This can be the path to a jar file, or a directory containing the
|
||||||
# compiled classes. NOTE: This isn't needed by the startup script,
|
# compiled classes. NOTE: This isn't needed by the startup script,
|
||||||
# it's just used here in constructing the classpath.
|
# it's just used here in constructing the classpath.
|
||||||
cassandra_bin="$CASSANDRA_HOME/build/classes/main"
|
if [ -d $CASSANDRA_HOME/build ] ; then
|
||||||
#cassandra_bin="$CASSANDRA_HOME/build/cassandra.jar"
|
#cassandra_bin="$CASSANDRA_HOME/build/classes/main"
|
||||||
|
cassandra_bin=`ls -1 $CASSANDRA_HOME/build/apache-cassandra*.jar`
|
||||||
|
|
||||||
|
CLASSPATH="$CLASSPATH:$cassandra_bin"
|
||||||
|
fi
|
||||||
|
|
||||||
# the default location for commitlogs, sstables, and saved caches
|
# the default location for commitlogs, sstables, and saved caches
|
||||||
# if not set in cassandra.yaml
|
# if not set in cassandra.yaml
|
||||||
|
|
@ -36,9 +43,6 @@ cassandra_storagedir="$CASSANDRA_HOME/data"
|
||||||
# JAVA_HOME can optionally be set here
|
# JAVA_HOME can optionally be set here
|
||||||
#JAVA_HOME=/usr/local/jdk6
|
#JAVA_HOME=/usr/local/jdk6
|
||||||
|
|
||||||
# The java classpath (required)
|
|
||||||
CLASSPATH="$CASSANDRA_CONF:$cassandra_bin"
|
|
||||||
|
|
||||||
for jar in "$CASSANDRA_HOME"/lib/*.jar; do
|
for jar in "$CASSANDRA_HOME"/lib/*.jar; do
|
||||||
CLASSPATH="$CLASSPATH:$jar"
|
CLASSPATH="$CLASSPATH:$jar"
|
||||||
done
|
done
|
||||||
|
|
@ -65,11 +69,87 @@ if [ -f "$CASSANDRA_HOME"/lib/jsr223/scala/scala-compiler.jar ] ; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# set JVM javaagent opts to avoid warnings/errors
|
# set JVM javaagent opts to avoid warnings/errors
|
||||||
if [ "$JVM_VENDOR" != "OpenJDK" -o "$JVM_VERSION" \> "1.6.0" ] \
|
JAVA_AGENT="$JAVA_AGENT -javaagent:$CASSANDRA_HOME/lib/jamm-0.3.2.jar"
|
||||||
|| [ "$JVM_VERSION" = "1.6.0" -a "$JVM_PATCH_VERSION" -ge 23 ]
|
|
||||||
then
|
|
||||||
JAVA_AGENT="$JAVA_AGENT -javaagent:$CASSANDRA_HOME/lib/jamm-0.3.0.jar"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Added sigar-bin to the java.library.path CASSANDRA-7838
|
# Added sigar-bin to the java.library.path CASSANDRA-7838
|
||||||
JAVA_OPTS="$JAVA_OPTS:-Djava.library.path=$CASSANDRA_HOME/lib/sigar-bin"
|
JAVA_OPTS="$JAVA_OPTS:-Djava.library.path=$CASSANDRA_HOME/lib/sigar-bin"
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Java executable and per-Java version JVM settings
|
||||||
|
#
|
||||||
|
|
||||||
|
# Use JAVA_HOME if set, otherwise look for java in PATH
|
||||||
|
if [ -n "$JAVA_HOME" ]; then
|
||||||
|
# Why we can't have nice things: Solaris combines x86 and x86_64
|
||||||
|
# installations in the same tree, using an unconventional path for the
|
||||||
|
# 64bit JVM. Since we prefer 64bit, search the alternate path first,
|
||||||
|
# (see https://issues.apache.org/jira/browse/CASSANDRA-4638).
|
||||||
|
for java in "$JAVA_HOME"/bin/amd64/java "$JAVA_HOME"/bin/java; do
|
||||||
|
if [ -x "$java" ]; then
|
||||||
|
JAVA="$java"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
else
|
||||||
|
JAVA=java
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z $JAVA ] ; then
|
||||||
|
echo Unable to find java executable. Check JAVA_HOME and PATH environment variables. >&2
|
||||||
|
exit 1;
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 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%_*}
|
||||||
|
|
||||||
|
JAVA_VERSION=11
|
||||||
|
if [ "$JVM_VERSION" = "1.8.0" ] ; then
|
||||||
|
JVM_PATCH_VERSION=${jvmver#*_}
|
||||||
|
if [ "$JVM_VERSION" \< "1.8" ] || [ "$JVM_VERSION" \> "1.8.2" ] ; then
|
||||||
|
echo "Cassandra 4.0 requires either Java 8 (update 151 or newer) or Java 11 (or newer). Java $JVM_VERSION is not supported."
|
||||||
|
exit 1;
|
||||||
|
fi
|
||||||
|
if [ "$JVM_PATCH_VERSION" -lt 151 ] ; then
|
||||||
|
echo "Cassandra 4.0 requires either Java 8 (update 151 or newer) or Java 11 (or newer). Java 8 update $JVM_PATCH_VERSION is not supported."
|
||||||
|
exit 1;
|
||||||
|
fi
|
||||||
|
JAVA_VERSION=8
|
||||||
|
elif [ "$JVM_VERSION" \< "11" ] ; then
|
||||||
|
echo "Cassandra 4.0 requires either Java 8 (update 151 or newer) or Java 11 (or newer)."
|
||||||
|
exit 1;
|
||||||
|
fi
|
||||||
|
|
||||||
|
jvm=`echo "$java_ver_output" | grep -A 1 '[openjdk|java] version' | awk 'NR==2 {print $1}'`
|
||||||
|
case "$jvm" in
|
||||||
|
OpenJDK)
|
||||||
|
JVM_VENDOR=OpenJDK
|
||||||
|
# this will be "64-Bit" or "32-Bit"
|
||||||
|
JVM_ARCH=`echo "$java_ver_output" | awk 'NR==3 {print $2}'`
|
||||||
|
;;
|
||||||
|
"Java(TM)")
|
||||||
|
JVM_VENDOR=Oracle
|
||||||
|
# this will be "64-Bit" or "32-Bit"
|
||||||
|
JVM_ARCH=`echo "$java_ver_output" | awk 'NR==3 {print $3}'`
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
# Help fill in other JVM values
|
||||||
|
JVM_VENDOR=other
|
||||||
|
JVM_ARCH=unknown
|
||||||
|
;;
|
||||||
|
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
|
||||||
|
JVM_DEP_OPTS_FILE=$CASSANDRA_CONF/jvm11${jvmoptions_variant:--clients}.options
|
||||||
|
else
|
||||||
|
JVM_DEP_OPTS_FILE=$CASSANDRA_CONF/jvm8${jvmoptions_variant:--clients}.options
|
||||||
|
fi
|
||||||
|
|
||||||
|
for opt in `grep "^-" $JVM_OPTS_FILE` `grep "^-" $JVM_DEP_OPTS_FILE`
|
||||||
|
do
|
||||||
|
JVM_OPTS="$JVM_OPTS $opt"
|
||||||
|
done
|
||||||
|
|
|
||||||
|
|
@ -32,18 +32,6 @@ elif [ -r "$CASSANDRA_INCLUDE" ]; then
|
||||||
. "$CASSANDRA_INCLUDE"
|
. "$CASSANDRA_INCLUDE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Use JAVA_HOME if set, otherwise look for java in PATH
|
|
||||||
if [ -n "$JAVA_HOME" ]; then
|
|
||||||
JAVA="$JAVA_HOME/bin/java"
|
|
||||||
else
|
|
||||||
JAVA=java
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$CASSANDRA_CONF" -o -z "$CLASSPATH" ]; then
|
|
||||||
echo "You must set the CASSANDRA_CONF and CLASSPATH vars" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -f "$CASSANDRA_CONF/cassandra-env.sh" ]; then
|
if [ -f "$CASSANDRA_CONF/cassandra-env.sh" ]; then
|
||||||
. "$CASSANDRA_CONF/cassandra-env.sh"
|
. "$CASSANDRA_CONF/cassandra-env.sh"
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
12
bin/fqltool
12
bin/fqltool
|
|
@ -32,18 +32,6 @@ elif [ -r "$CASSANDRA_INCLUDE" ]; then
|
||||||
. "$CASSANDRA_INCLUDE"
|
. "$CASSANDRA_INCLUDE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Use JAVA_HOME if set, otherwise look for java in PATH
|
|
||||||
if [ -x "$JAVA_HOME/bin/java" ]; then
|
|
||||||
JAVA="$JAVA_HOME/bin/java"
|
|
||||||
else
|
|
||||||
JAVA="`which java`"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "x$JAVA" = "x" ]; then
|
|
||||||
echo "Java executable not found (hint: set JAVA_HOME)" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$CASSANDRA_CONF" -o -z "$CLASSPATH" ]; then
|
if [ -z "$CASSANDRA_CONF" -o -z "$CLASSPATH" ]; then
|
||||||
echo "You must set the CASSANDRA_CONF and CLASSPATH vars" >&2
|
echo "You must set the CASSANDRA_CONF and CLASSPATH vars" >&2
|
||||||
exit 1
|
exit 1
|
||||||
|
|
|
||||||
14
bin/nodetool
14
bin/nodetool
|
|
@ -38,18 +38,6 @@ elif [ -r "$CASSANDRA_INCLUDE" ]; then
|
||||||
. "$CASSANDRA_INCLUDE"
|
. "$CASSANDRA_INCLUDE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Use JAVA_HOME if set, otherwise look for java in PATH
|
|
||||||
if [ -x "$JAVA_HOME/bin/java" ]; then
|
|
||||||
JAVA="$JAVA_HOME/bin/java"
|
|
||||||
else
|
|
||||||
JAVA="`which java`"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "x$JAVA" = "x" ]; then
|
|
||||||
echo "Java executable not found (hint: set JAVA_HOME)" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$CASSANDRA_CONF" -o -z "$CLASSPATH" ]; then
|
if [ -z "$CASSANDRA_CONF" -o -z "$CLASSPATH" ]; then
|
||||||
echo "You must set the CASSANDRA_CONF and CLASSPATH vars" >&2
|
echo "You must set the CASSANDRA_CONF and CLASSPATH vars" >&2
|
||||||
exit 1
|
exit 1
|
||||||
|
|
@ -61,7 +49,7 @@ if [ -f "$CASSANDRA_CONF/cassandra-env.sh" ]; then
|
||||||
MAX_HEAP_SIZE_SAVE=$MAX_HEAP_SIZE
|
MAX_HEAP_SIZE_SAVE=$MAX_HEAP_SIZE
|
||||||
. "$CASSANDRA_CONF/cassandra-env.sh"
|
. "$CASSANDRA_CONF/cassandra-env.sh"
|
||||||
MAX_HEAP_SIZE=$MAX_HEAP_SIZE_SAVE
|
MAX_HEAP_SIZE=$MAX_HEAP_SIZE_SAVE
|
||||||
JVM_OPTS=$JVM_OPTS_SAVE
|
JVM_OPTS="$JVM_OPTS_SAVE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# JMX Port passed via cmd line args (-p 9999 / --port 9999 / --port=9999)
|
# JMX Port passed via cmd line args (-p 9999 / --port 9999 / --port=9999)
|
||||||
|
|
|
||||||
|
|
@ -32,18 +32,6 @@ elif [ -r "$CASSANDRA_INCLUDE" ]; then
|
||||||
. "$CASSANDRA_INCLUDE"
|
. "$CASSANDRA_INCLUDE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Use JAVA_HOME if set, otherwise look for java in PATH
|
|
||||||
if [ -x "$JAVA_HOME/bin/java" ]; then
|
|
||||||
JAVA="$JAVA_HOME/bin/java"
|
|
||||||
else
|
|
||||||
JAVA="`which java`"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "x$JAVA" = "x" ]; then
|
|
||||||
echo "Java executable not found (hint: set JAVA_HOME)" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$CLASSPATH" ]; then
|
if [ -z "$CLASSPATH" ]; then
|
||||||
echo "You must set the CLASSPATH var" >&2
|
echo "You must set the CLASSPATH var" >&2
|
||||||
exit 1
|
exit 1
|
||||||
|
|
|
||||||
|
|
@ -32,18 +32,6 @@ elif [ -r "$CASSANDRA_INCLUDE" ]; then
|
||||||
. "$CASSANDRA_INCLUDE"
|
. "$CASSANDRA_INCLUDE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Use JAVA_HOME if set, otherwise look for java in PATH
|
|
||||||
if [ -x "$JAVA_HOME/bin/java" ]; then
|
|
||||||
JAVA="$JAVA_HOME/bin/java"
|
|
||||||
else
|
|
||||||
JAVA="`which java`"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "x$JAVA" = "x" ]; then
|
|
||||||
echo "Java executable not found (hint: set JAVA_HOME)" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$CLASSPATH" ]; then
|
if [ -z "$CLASSPATH" ]; then
|
||||||
echo "You must set the CLASSPATH var" >&2
|
echo "You must set the CLASSPATH var" >&2
|
||||||
exit 1
|
exit 1
|
||||||
|
|
|
||||||
|
|
@ -32,18 +32,6 @@ elif [ -r "$CASSANDRA_INCLUDE" ]; then
|
||||||
. "$CASSANDRA_INCLUDE"
|
. "$CASSANDRA_INCLUDE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Use JAVA_HOME if set, otherwise look for java in PATH
|
|
||||||
if [ -x "$JAVA_HOME/bin/java" ]; then
|
|
||||||
JAVA="$JAVA_HOME/bin/java"
|
|
||||||
else
|
|
||||||
JAVA="`which java`"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "x$JAVA" = "x" ]; then
|
|
||||||
echo "Java executable not found (hint: set JAVA_HOME)" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$CLASSPATH" ]; then
|
if [ -z "$CLASSPATH" ]; then
|
||||||
echo "You must set the CLASSPATH var" >&2
|
echo "You must set the CLASSPATH var" >&2
|
||||||
exit 1
|
exit 1
|
||||||
|
|
|
||||||
|
|
@ -32,18 +32,6 @@ elif [ -r "$CASSANDRA_INCLUDE" ]; then
|
||||||
. "$CASSANDRA_INCLUDE"
|
. "$CASSANDRA_INCLUDE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Use JAVA_HOME if set, otherwise look for java in PATH
|
|
||||||
if [ -x "$JAVA_HOME/bin/java" ]; then
|
|
||||||
JAVA="$JAVA_HOME/bin/java"
|
|
||||||
else
|
|
||||||
JAVA="`which java`"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "x$JAVA" = "x" ]; then
|
|
||||||
echo "Java executable not found (hint: set JAVA_HOME)" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$CLASSPATH" ]; then
|
if [ -z "$CLASSPATH" ]; then
|
||||||
echo "You must set the CLASSPATH var" >&2
|
echo "You must set the CLASSPATH var" >&2
|
||||||
exit 1
|
exit 1
|
||||||
|
|
|
||||||
|
|
@ -32,18 +32,6 @@ elif [ -r "$CASSANDRA_INCLUDE" ]; then
|
||||||
. "$CASSANDRA_INCLUDE"
|
. "$CASSANDRA_INCLUDE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Use JAVA_HOME if set, otherwise look for java in PATH
|
|
||||||
if [ -x "$JAVA_HOME/bin/java" ]; then
|
|
||||||
JAVA="$JAVA_HOME/bin/java"
|
|
||||||
else
|
|
||||||
JAVA="`which java`"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "x$JAVA" = "x" ]; then
|
|
||||||
echo "Java executable not found (hint: set JAVA_HOME)" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$CLASSPATH" ]; then
|
if [ -z "$CLASSPATH" ]; then
|
||||||
echo "You must set the CLASSPATH var" >&2
|
echo "You must set the CLASSPATH var" >&2
|
||||||
exit 1
|
exit 1
|
||||||
|
|
|
||||||
236
build.xml
236
build.xml
|
|
@ -35,7 +35,8 @@
|
||||||
<property name="build.src" value="${basedir}/src"/>
|
<property name="build.src" value="${basedir}/src"/>
|
||||||
<property name="build.src.java" value="${basedir}/src/java"/>
|
<property name="build.src.java" value="${basedir}/src/java"/>
|
||||||
<property name="build.src.antlr" value="${basedir}/src/antlr"/>
|
<property name="build.src.antlr" value="${basedir}/src/antlr"/>
|
||||||
<property name="build.src.jdkoverride" value="${basedir}/src/jdkoverride" />
|
<property name="build.src.java8" value="${basedir}/src/java8"/>
|
||||||
|
<property name="build.src.java11" value="${basedir}/src/java11"/>
|
||||||
<property name="build.src.resources" value="${basedir}/src/resources"/>
|
<property name="build.src.resources" value="${basedir}/src/resources"/>
|
||||||
<property name="build.src.gen-java" value="${basedir}/src/gen-java"/>
|
<property name="build.src.gen-java" value="${basedir}/src/gen-java"/>
|
||||||
<property name="build.lib" value="${basedir}/lib"/>
|
<property name="build.lib" value="${basedir}/lib"/>
|
||||||
|
|
@ -66,8 +67,14 @@
|
||||||
|
|
||||||
<property name="doc.dir" value="${basedir}/doc"/>
|
<property name="doc.dir" value="${basedir}/doc"/>
|
||||||
|
|
||||||
<property name="source.version" value="1.8"/>
|
<!--
|
||||||
<property name="target.version" value="1.8"/>
|
We specify '8' instead of '1.8' in source.version to indicate that that this build requires Java 11 _and_ Java 8.
|
||||||
|
Builds that only run against Java 8, _have to_ specify '1.8' for source version. This makes it possible to let
|
||||||
|
CI scripts distinguish between "pure Java 8" releases and "hybrid" releases.
|
||||||
|
-->
|
||||||
|
<property name="source.version" value="8"/>
|
||||||
|
<property name="target.version" value="8"/>
|
||||||
|
<property name="release.version" value="10"/>
|
||||||
|
|
||||||
<condition property="version" value="${base.version}">
|
<condition property="version" value="${base.version}">
|
||||||
<isset property="release"/>
|
<isset property="release"/>
|
||||||
|
|
@ -110,16 +117,18 @@
|
||||||
<property name="jacoco.finalexecfile" value="${jacoco.export.dir}/jacoco.exec" />
|
<property name="jacoco.finalexecfile" value="${jacoco.export.dir}/jacoco.exec" />
|
||||||
<property name="jacoco.version" value="0.7.5.201505241946"/>
|
<property name="jacoco.version" value="0.7.5.201505241946"/>
|
||||||
|
|
||||||
<property name="byteman.version" value="3.0.3"/>
|
<property name="byteman.version" value="4.0.2"/>
|
||||||
|
<property name="jamm.version" value="0.3.2"/>
|
||||||
|
<property name="ecj.version" value="4.6.1"/>
|
||||||
|
<property name="ohc.version" value="0.5.1"/>
|
||||||
|
<property name="asm.version" value="6.2"/>
|
||||||
|
|
||||||
<property name="ecj.version" value="4.4.2"/>
|
<!-- https://mvnrepository.com/artifact/net.openhft/chronicle-bom/1.16.23 -->
|
||||||
|
<property name="chronicle-queue.version" value="4.16.3" />
|
||||||
<!-- https://mvnrepository.com/artifact/net.openhft/chronicle-bom/1.15.6 -->
|
<property name="chronicle-core.version" value="1.16.3-SNAPSHOT" />
|
||||||
<property name="chronicle-queue.version" value="4.6.55" />
|
<property name="chronicle-bytes.version" value="1.16.3" />
|
||||||
<property name="chronicle-core.version" value="1.9.21" />
|
<property name="chronicle-wire.version" value="1.16.1" />
|
||||||
<property name="chronicle-bytes.version" value="1.10.1" />
|
<property name="chronicle-threads.version" value="1.16.0" />
|
||||||
<property name="chronicle-wire.version" value="1.10.1" />
|
|
||||||
<property name="chronicle-threads.version" value="1.9.1" />
|
|
||||||
|
|
||||||
<condition property="maven-ant-tasks.jar.exists">
|
<condition property="maven-ant-tasks.jar.exists">
|
||||||
<available file="${build.dir}/maven-ant-tasks-${maven-ant-tasks.version}.jar" />
|
<available file="${build.dir}/maven-ant-tasks-${maven-ant-tasks.version}.jar" />
|
||||||
|
|
@ -151,6 +160,24 @@
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Build instructions for release builds / builds that support both Java 8 and 11:
|
||||||
|
- requires JDK 11 in JAVA_HOME
|
||||||
|
- requires JDK 8 in JAVA8_HOME
|
||||||
|
|
||||||
|
Build instructions for development buils that only support Java 8:
|
||||||
|
- requires JDK 8 in JAVA_HOME
|
||||||
|
-->
|
||||||
|
<condition property="java.version.8">
|
||||||
|
<equals arg1="${ant.java.version}" arg2="1.8"/>
|
||||||
|
</condition>
|
||||||
|
<condition property="java11-jvmargs" value="-Djdk.attach.allowAttachSelf=true --add-exports java.sql/java.sql=ALL-UNNAMED --add-exports java.base/jdk.internal.misc=ALL-UNNAMED --add-opens java.base/jdk.internal.module=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-opens jdk.management/com.sun.management.internal=ALL-UNNAMED">
|
||||||
|
<not>
|
||||||
|
<equals arg1="${ant.java.version}" arg2="1.8"/>
|
||||||
|
</not>
|
||||||
|
</condition>
|
||||||
|
<property name="java11-jvmargs" value=""/>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
Add all the dependencies.
|
Add all the dependencies.
|
||||||
-->
|
-->
|
||||||
|
|
@ -168,6 +195,19 @@
|
||||||
<exclude name="**/ant-*.jar"/>
|
<exclude name="**/ant-*.jar"/>
|
||||||
</fileset>
|
</fileset>
|
||||||
</path>
|
</path>
|
||||||
|
<path id="cassandra.classpath.test">
|
||||||
|
<file file="${build.dir}/${final.name}.jar"/> <!-- we need the jar for tests and benchmarks (multi-version jar) -->
|
||||||
|
<fileset dir="${build.lib}">
|
||||||
|
<include name="**/*.jar" />
|
||||||
|
<exclude name="**/*-sources.jar"/>
|
||||||
|
<exclude name="**/ant-*.jar"/>
|
||||||
|
</fileset>
|
||||||
|
<fileset dir="${build.dir.lib}">
|
||||||
|
<include name="**/*.jar" />
|
||||||
|
<exclude name="**/*-sources.jar"/>
|
||||||
|
<exclude name="**/ant-*.jar"/>
|
||||||
|
</fileset>
|
||||||
|
</path>
|
||||||
|
|
||||||
<macrodef name="create-javadoc">
|
<macrodef name="create-javadoc">
|
||||||
<attribute name="destdir"/>
|
<attribute name="destdir"/>
|
||||||
|
|
@ -189,7 +229,7 @@
|
||||||
<target name="init">
|
<target name="init">
|
||||||
<fail unless="is.source.artifact"
|
<fail unless="is.source.artifact"
|
||||||
message="Not a source artifact, stopping here." />
|
message="Not a source artifact, stopping here." />
|
||||||
<mkdir dir="${build.classes.main}"/>
|
<mkdir dir="${build.classes.main}/META-INF/versions/11"/>
|
||||||
<mkdir dir="${test.lib}"/>
|
<mkdir dir="${test.lib}"/>
|
||||||
<mkdir dir="${test.classes}"/>
|
<mkdir dir="${test.classes}"/>
|
||||||
<mkdir dir="${stress.test.classes}"/>
|
<mkdir dir="${stress.test.classes}"/>
|
||||||
|
|
@ -390,7 +430,7 @@
|
||||||
<dependency groupId="com.fasterxml.jackson.core" artifactId="jackson-annotations" version="2.9.5"/>
|
<dependency groupId="com.fasterxml.jackson.core" artifactId="jackson-annotations" version="2.9.5"/>
|
||||||
<dependency groupId="com.googlecode.json-simple" artifactId="json-simple" version="1.1"/>
|
<dependency groupId="com.googlecode.json-simple" artifactId="json-simple" version="1.1"/>
|
||||||
<dependency groupId="com.boundary" artifactId="high-scale-lib" version="1.0.6"/>
|
<dependency groupId="com.boundary" artifactId="high-scale-lib" version="1.0.6"/>
|
||||||
<dependency groupId="com.github.jbellis" artifactId="jamm" version="0.3.0"/>
|
<dependency groupId="com.github.jbellis" artifactId="jamm" version="${jamm.version}"/>
|
||||||
|
|
||||||
<dependency groupId="org.yaml" artifactId="snakeyaml" version="1.11"/>
|
<dependency groupId="org.yaml" artifactId="snakeyaml" version="1.11"/>
|
||||||
<dependency groupId="junit" artifactId="junit" version="4.12" />
|
<dependency groupId="junit" artifactId="junit" version="4.12" />
|
||||||
|
|
@ -398,15 +438,15 @@
|
||||||
<exclusion groupId="commons-lang" artifactId="commons-lang"/>
|
<exclusion groupId="commons-lang" artifactId="commons-lang"/>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency groupId="org.apache.hadoop" artifactId="hadoop-core" version="1.0.3">
|
<dependency groupId="org.apache.hadoop" artifactId="hadoop-core" version="1.0.3">
|
||||||
<exclusion groupId="org.mortbay.jetty" artifactId="servlet-api"/>
|
<exclusion groupId="org.mortbay.jetty" artifactId="servlet-api"/>
|
||||||
<exclusion groupId="commons-logging" artifactId="commons-logging"/>
|
<exclusion groupId="commons-logging" artifactId="commons-logging"/>
|
||||||
<exclusion groupId="org.eclipse.jdt" artifactId="core"/>
|
<exclusion groupId="org.eclipse.jdt" artifactId="core"/>
|
||||||
<exclusion groupId="ant" artifactId="ant"/>
|
<exclusion groupId="ant" artifactId="ant"/>
|
||||||
<exclusion groupId="junit" artifactId="junit"/>
|
<exclusion groupId="junit" artifactId="junit"/>
|
||||||
<exclusion groupId="org.slf4j" artifactId="slf4j-api"/>
|
<exclusion groupId="org.slf4j" artifactId="slf4j-api"/>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency groupId="org.apache.hadoop" artifactId="hadoop-minicluster" version="1.0.3">
|
<dependency groupId="org.apache.hadoop" artifactId="hadoop-minicluster" version="1.0.3">
|
||||||
<exclusion groupId="asm" artifactId="asm"/> <!-- this is the outdated version 3.1 -->
|
<exclusion groupId="asm" artifactId="asm"/> <!-- this is the outdated version 3.1 -->
|
||||||
<exclusion groupId="org.slf4j" artifactId="slf4j-api"/>
|
<exclusion groupId="org.slf4j" artifactId="slf4j-api"/>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency groupId="net.java.dev.jna" artifactId="jna" version="4.2.2"/>
|
<dependency groupId="net.java.dev.jna" artifactId="jna" version="4.2.2"/>
|
||||||
|
|
@ -419,7 +459,6 @@
|
||||||
<dependency groupId="org.jboss.byteman" artifactId="byteman-submit" version="${byteman.version}"/>
|
<dependency groupId="org.jboss.byteman" artifactId="byteman-submit" version="${byteman.version}"/>
|
||||||
<dependency groupId="org.jboss.byteman" artifactId="byteman-bmunit" version="${byteman.version}"/>
|
<dependency groupId="org.jboss.byteman" artifactId="byteman-bmunit" version="${byteman.version}"/>
|
||||||
|
|
||||||
|
|
||||||
<dependency groupId="org.openjdk.jmh" artifactId="jmh-core" version="1.21"/>
|
<dependency groupId="org.openjdk.jmh" artifactId="jmh-core" version="1.21"/>
|
||||||
<dependency groupId="org.openjdk.jmh" artifactId="jmh-generator-annprocess" version="1.21"/>
|
<dependency groupId="org.openjdk.jmh" artifactId="jmh-generator-annprocess" version="1.21"/>
|
||||||
|
|
||||||
|
|
@ -446,14 +485,14 @@
|
||||||
<exclusion groupId="org.slf4j" artifactId="slf4j-api"/>
|
<exclusion groupId="org.slf4j" artifactId="slf4j-api"/>
|
||||||
</dependency>
|
</dependency>
|
||||||
-->
|
-->
|
||||||
<dependency groupId="org.eclipse.jdt.core.compiler" artifactId="ecj" version="4.4.2" />
|
<dependency groupId="org.eclipse.jdt.core.compiler" artifactId="ecj" version="${ecj.version}" />
|
||||||
<dependency groupId="org.caffinitas.ohc" artifactId="ohc-core" version="0.4.4">
|
<dependency groupId="org.caffinitas.ohc" artifactId="ohc-core" version="${ohc.version}">
|
||||||
<exclusion groupId="org.slf4j" artifactId="slf4j-api"/>
|
<exclusion groupId="org.slf4j" artifactId="slf4j-api"/>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency groupId="org.caffinitas.ohc" artifactId="ohc-core-j8" version="0.4.4" />
|
<dependency groupId="org.caffinitas.ohc" artifactId="ohc-core-j8" version="${ohc.version}" />
|
||||||
<dependency groupId="net.ju-n.compile-command-annotations" artifactId="compile-command-annotations" version="1.2.0" />
|
<dependency groupId="net.ju-n.compile-command-annotations" artifactId="compile-command-annotations" version="1.2.0" />
|
||||||
<dependency groupId="org.fusesource" artifactId="sigar" version="1.6.4">
|
<dependency groupId="org.fusesource" artifactId="sigar" version="1.6.4">
|
||||||
<exclusion groupId="log4j" artifactId="log4j"/>
|
<exclusion groupId="log4j" artifactId="log4j"/>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency groupId="joda-time" artifactId="joda-time" version="2.4" />
|
<dependency groupId="joda-time" artifactId="joda-time" version="2.4" />
|
||||||
<dependency groupId="com.carrotsearch" artifactId="hppc" version="0.5.4" />
|
<dependency groupId="com.carrotsearch" artifactId="hppc" version="0.5.4" />
|
||||||
|
|
@ -462,7 +501,9 @@
|
||||||
<dependency groupId="com.googlecode.concurrent-trees" artifactId="concurrent-trees" version="2.4.0" />
|
<dependency groupId="com.googlecode.concurrent-trees" artifactId="concurrent-trees" version="2.4.0" />
|
||||||
<dependency groupId="com.github.ben-manes.caffeine" artifactId="caffeine" version="2.3.5" />
|
<dependency groupId="com.github.ben-manes.caffeine" artifactId="caffeine" version="2.3.5" />
|
||||||
<dependency groupId="org.jctools" artifactId="jctools-core" version="1.2.1"/>
|
<dependency groupId="org.jctools" artifactId="jctools-core" version="1.2.1"/>
|
||||||
<dependency groupId="org.ow2.asm" artifactId="asm" version="5.0.4" />
|
<dependency groupId="org.ow2.asm" artifactId="asm" version="${asm.version}" />
|
||||||
|
<dependency groupId="org.ow2.asm" artifactId="asm-tree" version="${asm.version}" />
|
||||||
|
<dependency groupId="org.ow2.asm" artifactId="asm-commons" version="${asm.version}" />
|
||||||
</dependencyManagement>
|
</dependencyManagement>
|
||||||
<developer id="adelapena" name="Andres de la Peña"/>
|
<developer id="adelapena" name="Andres de la Peña"/>
|
||||||
<developer id="alakshman" name="Avinash Lakshman"/>
|
<developer id="alakshman" name="Avinash Lakshman"/>
|
||||||
|
|
@ -521,8 +562,8 @@
|
||||||
<dependency groupId="org.psjava" artifactId="psjava" version="0.1.19" />
|
<dependency groupId="org.psjava" artifactId="psjava" version="0.1.19" />
|
||||||
<dependency groupId="org.apache.rat" artifactId="apache-rat"/>
|
<dependency groupId="org.apache.rat" artifactId="apache-rat"/>
|
||||||
<dependency groupId="org.apache.hadoop" artifactId="hadoop-core"/>
|
<dependency groupId="org.apache.hadoop" artifactId="hadoop-core"/>
|
||||||
<dependency groupId="org.apache.hadoop" artifactId="hadoop-minicluster"/>
|
<dependency groupId="org.apache.hadoop" artifactId="hadoop-minicluster"/>
|
||||||
<dependency groupId="com.google.code.findbugs" artifactId="jsr305"/>
|
<dependency groupId="com.google.code.findbugs" artifactId="jsr305"/>
|
||||||
<dependency groupId="org.antlr" artifactId="antlr"/>
|
<dependency groupId="org.antlr" artifactId="antlr"/>
|
||||||
<!-- UPDATE AND UNCOMMENT ON THE DRIVER RELEASE, BEFORE 4.0 RELEASE
|
<!-- UPDATE AND UNCOMMENT ON THE DRIVER RELEASE, BEFORE 4.0 RELEASE
|
||||||
<dependency groupId="com.datastax.cassandra" artifactId="cassandra-driver-core" classifier="shaded"/>
|
<dependency groupId="com.datastax.cassandra" artifactId="cassandra-driver-core" classifier="shaded"/>
|
||||||
|
|
@ -533,7 +574,7 @@
|
||||||
<dependency groupId="org.openjdk.jmh" artifactId="jmh-core"/>
|
<dependency groupId="org.openjdk.jmh" artifactId="jmh-core"/>
|
||||||
<dependency groupId="org.openjdk.jmh" artifactId="jmh-generator-annprocess"/>
|
<dependency groupId="org.openjdk.jmh" artifactId="jmh-generator-annprocess"/>
|
||||||
<dependency groupId="net.ju-n.compile-command-annotations" artifactId="compile-command-annotations"/>
|
<dependency groupId="net.ju-n.compile-command-annotations" artifactId="compile-command-annotations"/>
|
||||||
<dependency groupId="org.apache.ant" artifactId="ant-junit" version="1.9.4" />
|
<dependency groupId="org.apache.ant" artifactId="ant-junit" version="1.9.7" />
|
||||||
</artifact:pom>
|
</artifact:pom>
|
||||||
<!-- this build-deps-pom-sources "artifact" is the same as build-deps-pom but only with those
|
<!-- this build-deps-pom-sources "artifact" is the same as build-deps-pom but only with those
|
||||||
artifacts that have "-source.jar" files -->
|
artifacts that have "-source.jar" files -->
|
||||||
|
|
@ -552,7 +593,7 @@
|
||||||
<dependency groupId="org.openjdk.jmh" artifactId="jmh-core"/>
|
<dependency groupId="org.openjdk.jmh" artifactId="jmh-core"/>
|
||||||
<dependency groupId="org.openjdk.jmh" artifactId="jmh-generator-annprocess"/>
|
<dependency groupId="org.openjdk.jmh" artifactId="jmh-generator-annprocess"/>
|
||||||
<dependency groupId="net.ju-n.compile-command-annotations" artifactId="compile-command-annotations"/>
|
<dependency groupId="net.ju-n.compile-command-annotations" artifactId="compile-command-annotations"/>
|
||||||
<dependency groupId="org.apache.ant" artifactId="ant-junit" version="1.9.4" />
|
<dependency groupId="org.apache.ant" artifactId="ant-junit" version="1.9.7" />
|
||||||
</artifact:pom>
|
</artifact:pom>
|
||||||
|
|
||||||
<artifact:pom id="coverage-deps-pom"
|
<artifact:pom id="coverage-deps-pom"
|
||||||
|
|
@ -703,6 +744,14 @@
|
||||||
</patternset>
|
</patternset>
|
||||||
<mapper type="flatten"/>
|
<mapper type="flatten"/>
|
||||||
</unzip>
|
</unzip>
|
||||||
|
|
||||||
|
<!-- Need to delete some dependencies from build/lib/jars as non-matching versions may get in there
|
||||||
|
due to transitive dependencies -->
|
||||||
|
<delete>
|
||||||
|
<fileset dir="${build.dir.lib}/jars">
|
||||||
|
<include name="asm-*" />
|
||||||
|
</fileset>
|
||||||
|
</delete>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="maven-ant-tasks-retrieve-test" depends="maven-ant-tasks-init">
|
<target name="maven-ant-tasks-retrieve-test" depends="maven-ant-tasks-init">
|
||||||
|
|
@ -737,16 +786,17 @@
|
||||||
</propertyfile>
|
</propertyfile>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="test-run" depends="build"
|
<target name="test-run" depends="jar"
|
||||||
description="Run in test mode. Not for production use!">
|
description="Run in test mode. Not for production use!">
|
||||||
<java classname="org.apache.cassandra.service.CassandraDaemon" fork="true">
|
<java classname="org.apache.cassandra.service.CassandraDaemon" fork="true">
|
||||||
<classpath>
|
<classpath>
|
||||||
<path refid="cassandra.classpath"/>
|
<path refid="cassandra.classpath.test"/>
|
||||||
<pathelement location="${test.conf}"/>
|
<pathelement location="${test.conf}"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
<jvmarg value="-Dstorage-config=${test.conf}"/>
|
<jvmarg value="-Dstorage-config=${test.conf}"/>
|
||||||
<jvmarg value="-javaagent:${basedir}/lib/jamm-0.3.0.jar" />
|
<jvmarg value="-javaagent:${basedir}/lib/jamm-${jamm.version}.jar" />
|
||||||
<jvmarg value="-ea"/>
|
<jvmarg value="-ea"/>
|
||||||
|
<jvmarg line="${java11-jvmargs}"/>
|
||||||
</java>
|
</java>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
|
|
@ -757,25 +807,63 @@
|
||||||
depends="maven-ant-tasks-retrieve-build,build-project" description="Compile Cassandra classes"/>
|
depends="maven-ant-tasks-retrieve-build,build-project" description="Compile Cassandra classes"/>
|
||||||
<target name="codecoverage" depends="jacoco-run,jacoco-report" description="Create code coverage report"/>
|
<target name="codecoverage" depends="jacoco-run,jacoco-report" description="Create code coverage report"/>
|
||||||
|
|
||||||
|
<target name="_build_java8_only" if="java.version.8">
|
||||||
|
<echo message="Compiling only for Java 8 ..."/>
|
||||||
|
<javac fork="true"
|
||||||
|
debug="true" debuglevel="${debuglevel}" encoding="utf-8"
|
||||||
|
destdir="${build.classes.main}" includeantruntime="false" source="8" target="8"
|
||||||
|
memorymaximumsize="512M">
|
||||||
|
<src path="${build.src.java}"/>
|
||||||
|
<src path="${build.src.java8}"/>
|
||||||
|
<src path="${build.src.gen-java}"/>
|
||||||
|
<compilerarg value="-XDignore.symbol.file"/>
|
||||||
|
<classpath>
|
||||||
|
<path refid="cassandra.classpath"/>
|
||||||
|
</classpath>
|
||||||
|
</javac>
|
||||||
|
</target>
|
||||||
|
<target name="_build_multi_java" unless="java.version.8">
|
||||||
|
<!-- Note: we cannot use javac's 'release' option, as that does not allow accessing sun.misc.Unsafe nor
|
||||||
|
Nashorn's ClassFilter class as any javac modules option is invalid for relase 8. -->
|
||||||
|
<echo message="Compiling for Java 8 (using ${env.JAVA8_HOME}/bin/javac) ..."/>
|
||||||
|
<javac fork="true"
|
||||||
|
debug="true" debuglevel="${debuglevel}" encoding="utf-8"
|
||||||
|
destdir="${build.classes.main}" includeantruntime="false" source="8" target="8"
|
||||||
|
executable="${env.JAVA8_HOME}/bin/javac"
|
||||||
|
memorymaximumsize="512M">
|
||||||
|
<src path="${build.src.java}"/>
|
||||||
|
<src path="${build.src.java8}"/>
|
||||||
|
<src path="${build.src.gen-java}"/>
|
||||||
|
<compilerarg value="-XDignore.symbol.file"/>
|
||||||
|
<classpath>
|
||||||
|
<path refid="cassandra.classpath"/>
|
||||||
|
</classpath>
|
||||||
|
</javac>
|
||||||
|
<echo message="Compiling for current java version ..."/>
|
||||||
|
<javac fork="true"
|
||||||
|
debug="true" debuglevel="${debuglevel}" encoding="utf-8"
|
||||||
|
destdir="${build.classes.main}/META-INF/versions/11" includeantruntime="false"
|
||||||
|
memorymaximumsize="512M">
|
||||||
|
<src path="${build.src.java11}"/>
|
||||||
|
<compilerarg value="--release"/>
|
||||||
|
<compilerarg value="${release.version}"/>
|
||||||
|
<compilerarg value="-XDignore.symbol.file"/>
|
||||||
|
<classpath>
|
||||||
|
<path refid="cassandra.classpath"/>
|
||||||
|
</classpath>
|
||||||
|
</javac>
|
||||||
|
</target>
|
||||||
<target depends="init,gen-cql3-grammar,generate-cql-html,generate-jflex-java"
|
<target depends="init,gen-cql3-grammar,generate-cql-html,generate-jflex-java"
|
||||||
name="build-project">
|
name="build-project">
|
||||||
<echo message="${ant.project.name}: ${ant.file}"/>
|
<echo message="${ant.project.name}: ${ant.file}"/>
|
||||||
<!-- Order matters! -->
|
<!-- Order matters! -->
|
||||||
<javac fork="true"
|
<antcall target="_build_java8_only"/>
|
||||||
debug="true" debuglevel="${debuglevel}" encoding="utf-8"
|
<antcall target="_build_multi_java"/>
|
||||||
destdir="${build.classes.main}" includeantruntime="false" source="${source.version}" target="${target.version}"
|
|
||||||
memorymaximumsize="512M">
|
|
||||||
<src path="${build.src.java}"/>
|
|
||||||
<src path="${build.src.gen-java}"/>
|
|
||||||
<compilerarg value="-XDignore.symbol.file"/>
|
|
||||||
<compilerarg value="-Xbootclasspath/p:${build.src.jdkoverride}"/>
|
|
||||||
<classpath refid="cassandra.classpath"/>
|
|
||||||
</javac>
|
|
||||||
<antcall target="createVersionPropFile"/>
|
<antcall target="createVersionPropFile"/>
|
||||||
<copy todir="${build.classes.main}">
|
<copy todir="${build.classes.main}">
|
||||||
<fileset dir="${build.src.resources}" />
|
<fileset dir="${build.src.resources}" />
|
||||||
</copy>
|
</copy>
|
||||||
<copy todir="${basedir}/conf" file="${build.classes.main}/META-INF/hotspot_compiler"/>
|
<copy todir="${basedir}/conf" file="${build.classes.main}/META-INF/hotspot_compiler"/>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<!-- Stress build file -->
|
<!-- Stress build file -->
|
||||||
|
|
@ -790,10 +878,8 @@
|
||||||
|
|
||||||
<target name="stress-build-test" depends="stress-build" description="Compile stress tests">
|
<target name="stress-build-test" depends="stress-build" description="Compile stress tests">
|
||||||
<javac debug="true" debuglevel="${debuglevel}" destdir="${stress.test.classes}"
|
<javac debug="true" debuglevel="${debuglevel}" destdir="${stress.test.classes}"
|
||||||
includeantruntime="false"
|
source="${source.version}" target="${target.version}"
|
||||||
source="${source.version}"
|
includeantruntime="false" encoding="utf-8">
|
||||||
target="${target.version}"
|
|
||||||
encoding="utf-8">
|
|
||||||
<classpath>
|
<classpath>
|
||||||
<path refid="cassandra.classpath"/>
|
<path refid="cassandra.classpath"/>
|
||||||
<pathelement location="${stress.build.classes}" />
|
<pathelement location="${stress.build.classes}" />
|
||||||
|
|
@ -804,7 +890,9 @@
|
||||||
|
|
||||||
<target name="stress-build" depends="build" description="build stress tool">
|
<target name="stress-build" depends="build" description="build stress tool">
|
||||||
<mkdir dir="${stress.build.classes}" />
|
<mkdir dir="${stress.build.classes}" />
|
||||||
<javac compiler="modern" debug="true" debuglevel="${debuglevel}" encoding="utf-8" destdir="${stress.build.classes}" includeantruntime="true" source="${source.version}" target="${target.version}">
|
<javac compiler="modern" debug="true" debuglevel="${debuglevel}"
|
||||||
|
source="${source.version}" target="${target.version}"
|
||||||
|
encoding="utf-8" destdir="${stress.build.classes}" includeantruntime="true">
|
||||||
<src path="${stress.build.src}" />
|
<src path="${stress.build.src}" />
|
||||||
<classpath>
|
<classpath>
|
||||||
<path refid="cassandra.classes" />
|
<path refid="cassandra.classes" />
|
||||||
|
|
@ -838,8 +926,8 @@
|
||||||
<!--
|
<!--
|
||||||
The jar target makes cassandra.jar output.
|
The jar target makes cassandra.jar output.
|
||||||
-->
|
-->
|
||||||
<target name="jar"
|
<target name="_main-jar"
|
||||||
depends="build, build-test, stress-build, write-poms"
|
depends="build"
|
||||||
description="Assemble Cassandra JAR files">
|
description="Assemble Cassandra JAR files">
|
||||||
<mkdir dir="${build.classes.main}/META-INF" />
|
<mkdir dir="${build.classes.main}/META-INF" />
|
||||||
<copy file="LICENSE.txt"
|
<copy file="LICENSE.txt"
|
||||||
|
|
@ -853,15 +941,17 @@
|
||||||
</fileset>
|
</fileset>
|
||||||
<manifest>
|
<manifest>
|
||||||
<!-- <section name="org/apache/cassandra/infrastructure"> -->
|
<!-- <section name="org/apache/cassandra/infrastructure"> -->
|
||||||
|
<attribute name="Multi-Release" value="true"/>
|
||||||
<attribute name="Implementation-Title" value="Cassandra"/>
|
<attribute name="Implementation-Title" value="Cassandra"/>
|
||||||
<attribute name="Implementation-Version" value="${version}"/>
|
<attribute name="Implementation-Version" value="${version}"/>
|
||||||
<attribute name="Implementation-Vendor" value="Apache"/>
|
<attribute name="Implementation-Vendor" value="Apache"/>
|
||||||
<attribute name="Premain-Class"
|
|
||||||
value="org.apache.cassandra.infrastructure.continuations.CAgent"/>
|
|
||||||
<!-- </section> -->
|
<!-- </section> -->
|
||||||
</manifest>
|
</manifest>
|
||||||
</jar>
|
</jar>
|
||||||
|
</target>
|
||||||
|
<target name="jar"
|
||||||
|
depends="_main-jar, build-test, stress-build, write-poms"
|
||||||
|
description="Assemble Cassandra JAR files">
|
||||||
<!-- Stress jar -->
|
<!-- Stress jar -->
|
||||||
<manifest file="${stress.manifest}">
|
<manifest file="${stress.manifest}">
|
||||||
<attribute name="Built-By" value="Pavel Yaskevich"/>
|
<attribute name="Built-By" value="Pavel Yaskevich"/>
|
||||||
|
|
@ -884,6 +974,9 @@
|
||||||
<fileset dir="${build.src.java}" defaultexcludes="yes">
|
<fileset dir="${build.src.java}" defaultexcludes="yes">
|
||||||
<include name="org/apache/**/*.java"/>
|
<include name="org/apache/**/*.java"/>
|
||||||
</fileset>
|
</fileset>
|
||||||
|
<fileset dir="${build.src.java11}" defaultexcludes="yes">
|
||||||
|
<include name="org/apache/**/*.java"/>
|
||||||
|
</fileset>
|
||||||
<fileset dir="${build.src.gen-java}" defaultexcludes="yes">
|
<fileset dir="${build.src.gen-java}" defaultexcludes="yes">
|
||||||
<include name="org/apache/**/*.java"/>
|
<include name="org/apache/**/*.java"/>
|
||||||
</fileset>
|
</fileset>
|
||||||
|
|
@ -905,6 +998,9 @@
|
||||||
<fileset dir="${build.src.java}" defaultexcludes="yes">
|
<fileset dir="${build.src.java}" defaultexcludes="yes">
|
||||||
<include name="org/apache/**/*.java"/>
|
<include name="org/apache/**/*.java"/>
|
||||||
</fileset>
|
</fileset>
|
||||||
|
<fileset dir="${build.src.java11}" defaultexcludes="yes">
|
||||||
|
<include name="org/apache/**/*.java"/>
|
||||||
|
</fileset>
|
||||||
<fileset dir="${build.src.gen-java}" defaultexcludes="yes">
|
<fileset dir="${build.src.gen-java}" defaultexcludes="yes">
|
||||||
<include name="org/apache/**/*.java"/>
|
<include name="org/apache/**/*.java"/>
|
||||||
</fileset>
|
</fileset>
|
||||||
|
|
@ -913,6 +1009,7 @@
|
||||||
|
|
||||||
<!-- creates release tarballs -->
|
<!-- creates release tarballs -->
|
||||||
<target name="artifacts" depends="jar,javadoc,gen-doc"
|
<target name="artifacts" depends="jar,javadoc,gen-doc"
|
||||||
|
unless="java.version.8"
|
||||||
description="Create Cassandra release artifacts">
|
description="Create Cassandra release artifacts">
|
||||||
<mkdir dir="${dist.dir}"/>
|
<mkdir dir="${dist.dir}"/>
|
||||||
<!-- fix the control linefeed so that builds on windows works on linux -->
|
<!-- fix the control linefeed so that builds on windows works on linux -->
|
||||||
|
|
@ -1058,7 +1155,7 @@
|
||||||
</rat:report>
|
</rat:report>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="build-jmh" depends="build-test" description="Create JMH uber jar">
|
<target name="build-jmh" depends="build-test, jar" description="Create JMH uber jar">
|
||||||
<jar jarfile="${build.test.dir}/deps.jar">
|
<jar jarfile="${build.test.dir}/deps.jar">
|
||||||
<zipgroupfileset dir="${build.dir.lib}/jars">
|
<zipgroupfileset dir="${build.dir.lib}/jars">
|
||||||
<include name="*jmh*.jar"/>
|
<include name="*jmh*.jar"/>
|
||||||
|
|
@ -1081,7 +1178,7 @@
|
||||||
<!-- use https://github.com/krummas/jstackjunit to get thread dumps when unit tests time out -->
|
<!-- use https://github.com/krummas/jstackjunit to get thread dumps when unit tests time out -->
|
||||||
<taskdef name="junit" classname="org.krummas.junit.JStackJUnitTask" classpath="lib/jstackjunit-0.0.1.jar"/>
|
<taskdef name="junit" classname="org.krummas.junit.JStackJUnitTask" classpath="lib/jstackjunit-0.0.1.jar"/>
|
||||||
|
|
||||||
<target name="build-test" depends="build" description="Compile test classes">
|
<target name="build-test" depends="_main-jar, stress-build, write-poms" description="Compile test classes">
|
||||||
<javac
|
<javac
|
||||||
compiler="modern"
|
compiler="modern"
|
||||||
debug="true"
|
debug="true"
|
||||||
|
|
@ -1139,7 +1236,7 @@
|
||||||
<jvmarg value="-Dstorage-config=${test.conf}"/>
|
<jvmarg value="-Dstorage-config=${test.conf}"/>
|
||||||
<jvmarg value="-Djava.awt.headless=true"/>
|
<jvmarg value="-Djava.awt.headless=true"/>
|
||||||
<!-- Cassandra 3.0+ needs <jvmarg line="... ${additionalagent}" /> here! (not value=) -->
|
<!-- Cassandra 3.0+ needs <jvmarg line="... ${additionalagent}" /> here! (not value=) -->
|
||||||
<jvmarg line="-javaagent:${basedir}/lib/jamm-0.3.0.jar ${additionalagent}" />
|
<jvmarg line="-javaagent:${basedir}/lib/jamm-${jamm.version}.jar ${additionalagent}" />
|
||||||
<jvmarg value="-ea"/>
|
<jvmarg value="-ea"/>
|
||||||
<jvmarg value="-Dcassandra.debugrefcount=true"/>
|
<jvmarg value="-Dcassandra.debugrefcount=true"/>
|
||||||
<jvmarg value="-Xss256k"/>
|
<jvmarg value="-Xss256k"/>
|
||||||
|
|
@ -1151,6 +1248,7 @@
|
||||||
<jvmarg value="-Djava.security.egd=file:/dev/urandom" />
|
<jvmarg value="-Djava.security.egd=file:/dev/urandom" />
|
||||||
<jvmarg value="-Dcassandra.testtag=@{testtag}"/>
|
<jvmarg value="-Dcassandra.testtag=@{testtag}"/>
|
||||||
<jvmarg value="-Dcassandra.keepBriefBrief=${cassandra.keepBriefBrief}" />
|
<jvmarg value="-Dcassandra.keepBriefBrief=${cassandra.keepBriefBrief}" />
|
||||||
|
<jvmarg line="${java11-jvmargs}"/>
|
||||||
<optjvmargs/>
|
<optjvmargs/>
|
||||||
<!-- Uncomment to debug unittest, attach debugger to port 1416 -->
|
<!-- Uncomment to debug unittest, attach debugger to port 1416 -->
|
||||||
<!--
|
<!--
|
||||||
|
|
@ -1159,7 +1257,7 @@
|
||||||
<classpath>
|
<classpath>
|
||||||
<pathelement path="${java.class.path}"/>
|
<pathelement path="${java.class.path}"/>
|
||||||
<pathelement location="${stress.build.classes}"/>
|
<pathelement location="${stress.build.classes}"/>
|
||||||
<path refid="cassandra.classpath" />
|
<path refid="cassandra.classpath.test" />
|
||||||
<pathelement location="${test.classes}"/>
|
<pathelement location="${test.classes}"/>
|
||||||
<pathelement location="${stress.test.classes}"/>
|
<pathelement location="${stress.test.classes}"/>
|
||||||
<pathelement location="${test.conf}"/>
|
<pathelement location="${test.conf}"/>
|
||||||
|
|
@ -1189,7 +1287,7 @@
|
||||||
</sequential>
|
</sequential>
|
||||||
</macrodef>
|
</macrodef>
|
||||||
|
|
||||||
<target name="testold" depends="build-test" description="Execute unit tests">
|
<target name="testold" depends="build-test" description="Execute unit tests">
|
||||||
<testmacro inputdir="${test.unit.src}" timeout="${test.timeout}">
|
<testmacro inputdir="${test.unit.src}" timeout="${test.timeout}">
|
||||||
<jvmarg value="-Dlegacy-sstable-root=${test.data}/legacy-sstables"/>
|
<jvmarg value="-Dlegacy-sstable-root=${test.data}/legacy-sstables"/>
|
||||||
<jvmarg value="-Dinvalid-legacy-sstable-root=${test.data}/invalid-legacy-sstables"/>
|
<jvmarg value="-Dinvalid-legacy-sstable-root=${test.data}/invalid-legacy-sstables"/>
|
||||||
|
|
@ -1294,7 +1392,7 @@
|
||||||
</testmacro>
|
</testmacro>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="test-compression" depends="build-test,stress-build" description="Execute unit tests with sstable compression enabled">
|
<target name="test-compression" depends="build-test, stress-build" description="Execute unit tests with sstable compression enabled">
|
||||||
<property name="compressed_yaml" value="${build.test.dir}/cassandra.compressed.yaml"/>
|
<property name="compressed_yaml" value="${build.test.dir}/cassandra.compressed.yaml"/>
|
||||||
<concat destfile="${compressed_yaml}">
|
<concat destfile="${compressed_yaml}">
|
||||||
<fileset file="${test.conf}/cassandra.yaml"/>
|
<fileset file="${test.conf}/cassandra.yaml"/>
|
||||||
|
|
@ -1369,14 +1467,14 @@
|
||||||
<formatter type="brief" usefile="false"/>
|
<formatter type="brief" usefile="false"/>
|
||||||
<jvmarg value="-Dstorage-config=${test.conf}"/>
|
<jvmarg value="-Dstorage-config=${test.conf}"/>
|
||||||
<jvmarg value="-Djava.awt.headless=true"/>
|
<jvmarg value="-Djava.awt.headless=true"/>
|
||||||
<jvmarg value="-javaagent:${basedir}/lib/jamm-0.3.0.jar" />
|
<jvmarg value="-javaagent:${basedir}/lib/jamm-${jamm.version}.jar" />
|
||||||
<jvmarg value="-ea"/>
|
<jvmarg value="-ea"/>
|
||||||
<jvmarg value="-Xss256k"/>
|
<jvmarg value="-Xss256k"/>
|
||||||
<jvmarg value="-Dcassandra.memtable_row_overhead_computation_step=100"/>
|
<jvmarg value="-Dcassandra.memtable_row_overhead_computation_step=100"/>
|
||||||
<jvmarg value="-Dcassandra.test.use_prepared=${cassandra.test.use_prepared}"/>
|
<jvmarg value="-Dcassandra.test.use_prepared=${cassandra.test.use_prepared}"/>
|
||||||
<jvmarg value="-Dcassandra.skip_sync=true" />
|
<jvmarg value="-Dcassandra.skip_sync=true" />
|
||||||
<classpath>
|
<classpath>
|
||||||
<path refid="cassandra.classpath" />
|
<path refid="cassandra.classpath.test" />
|
||||||
<pathelement location="${test.classes}"/>
|
<pathelement location="${test.classes}"/>
|
||||||
<pathelement location="${test.conf}"/>
|
<pathelement location="${test.conf}"/>
|
||||||
<fileset dir="${test.lib}">
|
<fileset dir="${test.lib}">
|
||||||
|
|
@ -1411,14 +1509,14 @@
|
||||||
<formatter type="brief" usefile="false"/>
|
<formatter type="brief" usefile="false"/>
|
||||||
<jvmarg value="-Dstorage-config=${test.conf}"/>
|
<jvmarg value="-Dstorage-config=${test.conf}"/>
|
||||||
<jvmarg value="-Djava.awt.headless=true"/>
|
<jvmarg value="-Djava.awt.headless=true"/>
|
||||||
<jvmarg value="-javaagent:${basedir}/lib/jamm-0.3.0.jar" />
|
<jvmarg value="-javaagent:${basedir}/lib/jamm-${jamm.version}.jar" />
|
||||||
<jvmarg value="-ea"/>
|
<jvmarg value="-ea"/>
|
||||||
<jvmarg value="-Xss256k"/>
|
<jvmarg value="-Xss256k"/>
|
||||||
<jvmarg value="-Dcassandra.test.use_prepared=${cassandra.test.use_prepared}"/>
|
<jvmarg value="-Dcassandra.test.use_prepared=${cassandra.test.use_prepared}"/>
|
||||||
<jvmarg value="-Dcassandra.memtable_row_overhead_computation_step=100"/>
|
<jvmarg value="-Dcassandra.memtable_row_overhead_computation_step=100"/>
|
||||||
<jvmarg value="-Dcassandra.skip_sync=true" />
|
<jvmarg value="-Dcassandra.skip_sync=true" />
|
||||||
<classpath>
|
<classpath>
|
||||||
<path refid="cassandra.classpath" />
|
<path refid="cassandra.classpath.test" />
|
||||||
<pathelement location="${test.classes}"/>
|
<pathelement location="${test.classes}"/>
|
||||||
<pathelement location="${test.conf}"/>
|
<pathelement location="${test.conf}"/>
|
||||||
<fileset dir="${test.lib}">
|
<fileset dir="${test.lib}">
|
||||||
|
|
@ -1665,7 +1763,7 @@
|
||||||
<echo message="Mem size : ${mem.size}"/>
|
<echo message="Mem size : ${mem.size}"/>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="test" depends="build-test,get-cores,get-mem,stress-build" description="Parallel Test Runner">
|
<target name="test" depends="build-test,get-cores,get-mem" description="Parallel Test Runner">
|
||||||
<path id="all-test-classes-path">
|
<path id="all-test-classes-path">
|
||||||
<fileset dir="${test.unit.src}" includes="**/${test.name}.java" />
|
<fileset dir="${test.unit.src}" includes="**/${test.name}.java" />
|
||||||
</path>
|
</path>
|
||||||
|
|
@ -1684,13 +1782,13 @@
|
||||||
<testparallel testdelegate="testlist"/>
|
<testparallel testdelegate="testlist"/>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<!-- run microbenchmarks suite -->
|
<!-- run microbenchmarks suite -->
|
||||||
<target name="microbench" depends="build-jmh">
|
<target name="microbench" depends="build-jmh">
|
||||||
<java classname="org.openjdk.jmh.Main"
|
<java classname="org.openjdk.jmh.Main"
|
||||||
fork="true"
|
fork="true"
|
||||||
failonerror="true">
|
failonerror="true">
|
||||||
<classpath>
|
<classpath>
|
||||||
<path refid="cassandra.classpath" />
|
<path refid="cassandra.classpath.test" />
|
||||||
<pathelement location="${test.classes}"/>
|
<pathelement location="${test.classes}"/>
|
||||||
<pathelement location="${test.conf}"/>
|
<pathelement location="${test.conf}"/>
|
||||||
<fileset dir="${test.lib}">
|
<fileset dir="${test.lib}">
|
||||||
|
|
@ -1708,6 +1806,7 @@
|
||||||
<copy todir=".idea">
|
<copy todir=".idea">
|
||||||
<fileset dir="ide/idea"/>
|
<fileset dir="ide/idea"/>
|
||||||
</copy>
|
</copy>
|
||||||
|
<replace file=".idea/workspace.xml" token="trunk" value="${eclipse.project.name}"/>
|
||||||
<copy tofile="${eclipse.project.name}.iml" file="ide/idea-iml-file.xml"/>
|
<copy tofile="${eclipse.project.name}.iml" file="ide/idea-iml-file.xml"/>
|
||||||
<echo file=".idea/.name">Apache Cassandra ${eclipse.project.name}</echo>
|
<echo file=".idea/.name">Apache Cassandra ${eclipse.project.name}</echo>
|
||||||
<echo file=".idea/modules.xml"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
|
<echo file=".idea/modules.xml"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
@ -1808,7 +1907,8 @@
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
|
|
||||||
<target name="eclipse-warnings" depends="build" description="Run eclipse compiler code analysis">
|
<!-- ECJ 4.6.1 in standalone mode does not work with JPMS, so we skip this target for Java 11 -->
|
||||||
|
<target name="eclipse-warnings" depends="build" description="Run eclipse compiler code analysis" if="java.version.8">
|
||||||
<property name="ecj.log.dir" value="${build.dir}/ecj" />
|
<property name="ecj.log.dir" value="${build.dir}/ecj" />
|
||||||
<property name="ecj.warnings.file" value="${ecj.log.dir}/eclipse_compiler_checks.txt"/>
|
<property name="ecj.warnings.file" value="${ecj.log.dir}/eclipse_compiler_checks.txt"/>
|
||||||
<mkdir dir="${ecj.log.dir}" />
|
<mkdir dir="${ecj.log.dir}" />
|
||||||
|
|
|
||||||
|
|
@ -380,11 +380,7 @@ Function SetCassandraEnvironment
|
||||||
$env:JVM_OPTS = "$env:JVM_OPTS -XX:CompileCommandFile=""$env:CASSANDRA_CONF\hotspot_compiler"""
|
$env:JVM_OPTS = "$env:JVM_OPTS -XX:CompileCommandFile=""$env:CASSANDRA_CONF\hotspot_compiler"""
|
||||||
|
|
||||||
# add the jamm javaagent
|
# add the jamm javaagent
|
||||||
if (($env:JVM_VENDOR -ne "OpenJDK") -or ($env:JVM_VERSION.CompareTo("1.6.0") -eq 1) -or
|
$env:JVM_OPTS = "$env:JVM_OPTS -javaagent:""$env:CASSANDRA_HOME\lib\jamm-0.3.2.jar"""
|
||||||
(($env:JVM_VERSION -eq "1.6.0") -and ($env:JVM_PATCH_VERSION.CompareTo("22") -eq 1)))
|
|
||||||
{
|
|
||||||
$env:JVM_OPTS = "$env:JVM_OPTS -javaagent:""$env:CASSANDRA_HOME\lib\jamm-0.3.0.jar"""
|
|
||||||
}
|
|
||||||
|
|
||||||
# set jvm HeapDumpPath with CASSANDRA_HEAPDUMP_DIR
|
# set jvm HeapDumpPath with CASSANDRA_HEAPDUMP_DIR
|
||||||
if ($env:CASSANDRA_HEAPDUMP_DIR)
|
if ($env:CASSANDRA_HEAPDUMP_DIR)
|
||||||
|
|
@ -403,9 +399,10 @@ Function SetCassandraEnvironment
|
||||||
# print an heap histogram on OutOfMemoryError
|
# print an heap histogram on OutOfMemoryError
|
||||||
# $env:JVM_OPTS="$env:JVM_OPTS -Dcassandra.printHeapHistogramOnOutOfMemoryError=true"
|
# $env:JVM_OPTS="$env:JVM_OPTS -Dcassandra.printHeapHistogramOnOutOfMemoryError=true"
|
||||||
|
|
||||||
if ($env:JVM_VERSION.CompareTo("1.8.0") -eq -1 -or [convert]::ToInt32($env:JVM_PATCH_VERSION) -lt 40)
|
$env:JAVA_VERSION=11
|
||||||
|
if ($env:JVM_VERSION.CompareTo("1.8.0") -eq -1 -or [convert]::ToInt32($env:JVM_PATCH_VERSION) -lt 151)
|
||||||
{
|
{
|
||||||
echo "Cassandra 3.0 and later require Java 8u40 or later."
|
echo "Cassandra 4.0 requires either Java 8 (update 151 or newer) or Java 11 (or newer). Java $env:JVM_VERSION is not supported."
|
||||||
exit
|
exit
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -86,55 +86,27 @@ calculate_heap_sizes()
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# 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%_*}
|
|
||||||
JVM_PATCH_VERSION=${jvmver#*_}
|
|
||||||
|
|
||||||
if [ "$JVM_VERSION" \< "1.8" ] ; then
|
|
||||||
echo "Cassandra 3.0 and later require Java 8u40 or later."
|
|
||||||
exit 1;
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$JVM_VERSION" \< "1.8" ] && [ "$JVM_PATCH_VERSION" -lt 40 ] ; then
|
|
||||||
echo "Cassandra 3.0 and later require Java 8u40 or later."
|
|
||||||
exit 1;
|
|
||||||
fi
|
|
||||||
|
|
||||||
jvm=`echo "$java_ver_output" | grep -A 1 '[openjdk|java] version' | awk 'NR==2 {print $1}'`
|
|
||||||
case "$jvm" in
|
|
||||||
OpenJDK)
|
|
||||||
JVM_VENDOR=OpenJDK
|
|
||||||
# this will be "64-Bit" or "32-Bit"
|
|
||||||
JVM_ARCH=`echo "$java_ver_output" | awk 'NR==3 {print $2}'`
|
|
||||||
;;
|
|
||||||
"Java(TM)")
|
|
||||||
JVM_VENDOR=Oracle
|
|
||||||
# this will be "64-Bit" or "32-Bit"
|
|
||||||
JVM_ARCH=`echo "$java_ver_output" | awk 'NR==3 {print $3}'`
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
# Help fill in other JVM values
|
|
||||||
JVM_VENDOR=other
|
|
||||||
JVM_ARCH=unknown
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
#GC log path has to be defined here because it needs to access CASSANDRA_HOME
|
#GC log path has to be defined here because it needs to access CASSANDRA_HOME
|
||||||
JVM_OPTS="$JVM_OPTS -Xloggc:${CASSANDRA_HOME}/logs/gc.log"
|
if [ $JAVA_VERSION -ge 11 ] ; 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 -q "^-[X]log:gc"
|
||||||
|
if [ "$?" = "1" ] ; then # [X] to prevent ccm from replacing this line
|
||||||
|
# only add -Xlog:gc if it's not mentioned in jvm-server.options file
|
||||||
|
mkdir -p ${CASSANDRA_HOME}/logs
|
||||||
|
JVM_OPTS="$JVM_OPTS -Xlog:gc=info,heap*=trace,age*=debug,safepoint=info,promotion*=trace:file=${CASSANDRA_HOME}/logs/gc.log:time,uptime,pid,tid,level:filecount=10,filesize=10485760"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
# Java 8
|
||||||
|
echo "$JVM_OPTS" | grep -q "^-[X]loggc"
|
||||||
|
if [ "$?" = "1" ] ; then # [X] to prevent ccm from replacing this line
|
||||||
|
# only add -Xlog:gc if it's not mentioned in jvm-server.options file
|
||||||
|
mkdir -p ${CASSANDRA_HOME}/logs
|
||||||
|
JVM_OPTS="$JVM_OPTS -Xloggc:${CASSANDRA_HOME}/logs/gc.log"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# Here we create the arguments that will get passed to the jvm when
|
# Check what parameters were defined on jvm-server.options file to avoid conflicts
|
||||||
# starting cassandra.
|
|
||||||
|
|
||||||
# Read user-defined JVM options from jvm.options file
|
|
||||||
JVM_OPTS_FILE=$CASSANDRA_CONF/jvm.options
|
|
||||||
for opt in `grep "^-" $JVM_OPTS_FILE`
|
|
||||||
do
|
|
||||||
JVM_OPTS="$JVM_OPTS $opt"
|
|
||||||
done
|
|
||||||
|
|
||||||
# Check what parameters were defined on jvm.options file to avoid conflicts
|
|
||||||
echo $JVM_OPTS | grep -q Xmn
|
echo $JVM_OPTS | grep -q Xmn
|
||||||
DEFINED_XMN=$?
|
DEFINED_XMN=$?
|
||||||
echo $JVM_OPTS | grep -q Xmx
|
echo $JVM_OPTS | grep -q Xmx
|
||||||
|
|
@ -179,21 +151,21 @@ if [ "x$MALLOC_ARENA_MAX" = "x" ] ; then
|
||||||
export MALLOC_ARENA_MAX=4
|
export MALLOC_ARENA_MAX=4
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# We only set -Xms and -Xmx if they were not defined on jvm.options file
|
# We only set -Xms and -Xmx if they were not defined on jvm-server.options file
|
||||||
# If defined, both Xmx and Xms should be defined together.
|
# If defined, both Xmx and Xms should be defined together.
|
||||||
if [ $DEFINED_XMX -ne 0 ] && [ $DEFINED_XMS -ne 0 ]; then
|
if [ $DEFINED_XMX -ne 0 ] && [ $DEFINED_XMS -ne 0 ]; then
|
||||||
JVM_OPTS="$JVM_OPTS -Xms${MAX_HEAP_SIZE}"
|
JVM_OPTS="$JVM_OPTS -Xms${MAX_HEAP_SIZE}"
|
||||||
JVM_OPTS="$JVM_OPTS -Xmx${MAX_HEAP_SIZE}"
|
JVM_OPTS="$JVM_OPTS -Xmx${MAX_HEAP_SIZE}"
|
||||||
elif [ $DEFINED_XMX -ne 0 ] || [ $DEFINED_XMS -ne 0 ]; then
|
elif [ $DEFINED_XMX -ne 0 ] || [ $DEFINED_XMS -ne 0 ]; then
|
||||||
echo "Please set or unset -Xmx and -Xms flags in pairs on jvm.options file."
|
echo "Please set or unset -Xmx and -Xms flags in pairs on jvm-server.options file."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# We only set -Xmn flag if it was not defined in jvm.options file
|
# We only set -Xmn flag if it was not defined in jvm-server.options file
|
||||||
# and if the CMS GC is being used
|
# and if the CMS GC is being used
|
||||||
# If defined, both Xmn and Xmx should be defined together.
|
# If defined, both Xmn and Xmx should be defined together.
|
||||||
if [ $DEFINED_XMN -eq 0 ] && [ $DEFINED_XMX -ne 0 ]; then
|
if [ $DEFINED_XMN -eq 0 ] && [ $DEFINED_XMX -ne 0 ]; then
|
||||||
echo "Please set or unset -Xmx and -Xmn flags in pairs on jvm.options file."
|
echo "Please set or unset -Xmx and -Xmn flags in pairs on jvm-server.options file."
|
||||||
exit 1
|
exit 1
|
||||||
elif [ $DEFINED_XMN -ne 0 ] && [ $USING_CMS -eq 0 ]; then
|
elif [ $DEFINED_XMN -ne 0 ] && [ $USING_CMS -eq 0 ]; then
|
||||||
JVM_OPTS="$JVM_OPTS -Xmn${HEAP_NEWSIZE}"
|
JVM_OPTS="$JVM_OPTS -Xmn${HEAP_NEWSIZE}"
|
||||||
|
|
@ -207,7 +179,7 @@ fi
|
||||||
JVM_OPTS="$JVM_OPTS -XX:CompileCommandFile=$CASSANDRA_CONF/hotspot_compiler"
|
JVM_OPTS="$JVM_OPTS -XX:CompileCommandFile=$CASSANDRA_CONF/hotspot_compiler"
|
||||||
|
|
||||||
# add the jamm javaagent
|
# add the jamm javaagent
|
||||||
JVM_OPTS="$JVM_OPTS -javaagent:$CASSANDRA_HOME/lib/jamm-0.3.0.jar"
|
JVM_OPTS="$JVM_OPTS -javaagent:$CASSANDRA_HOME/lib/jamm-0.3.2.jar"
|
||||||
|
|
||||||
# set jvm HeapDumpPath with CASSANDRA_HEAPDUMP_DIR
|
# set jvm HeapDumpPath with CASSANDRA_HEAPDUMP_DIR
|
||||||
if [ "x$CASSANDRA_HEAPDUMP_DIR" != "x" ]; then
|
if [ "x$CASSANDRA_HEAPDUMP_DIR" != "x" ]; then
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
###########################################################################
|
||||||
|
# jvm-clients.options #
|
||||||
|
# #
|
||||||
|
# See jvm8-clients.options and jvm11-clients.options for Java version #
|
||||||
|
# specific options. #
|
||||||
|
###########################################################################
|
||||||
|
|
||||||
|
# intentionally left empty
|
||||||
|
|
||||||
|
# The newline in the end of file is intentional
|
||||||
|
|
@ -1,11 +1,14 @@
|
||||||
###########################################################################
|
###########################################################################
|
||||||
# jvm.options #
|
# jvm-server.options #
|
||||||
# #
|
# #
|
||||||
# - all flags defined here will be used by cassandra to startup the JVM #
|
# - all flags defined here will be used by cassandra to startup the JVM #
|
||||||
# - one flag should be specified per line #
|
# - one flag should be specified per line #
|
||||||
# - lines that do not start with '-' will be ignored #
|
# - lines that do not start with '-' will be ignored #
|
||||||
# - only static flags are accepted (no variables or parameters) #
|
# - only static flags are accepted (no variables or parameters) #
|
||||||
# - dynamic flags will be appended to these on cassandra-env #
|
# - dynamic flags will be appended to these on cassandra-env #
|
||||||
|
# #
|
||||||
|
# See jvm8-server.options and jvm11-server.options for Java version #
|
||||||
|
# specific options. #
|
||||||
###########################################################################
|
###########################################################################
|
||||||
|
|
||||||
######################
|
######################
|
||||||
|
|
@ -94,11 +97,6 @@
|
||||||
# a lower priority to avoid interfering with client workload
|
# a lower priority to avoid interfering with client workload
|
||||||
-XX:+UseThreadPriorities
|
-XX:+UseThreadPriorities
|
||||||
|
|
||||||
# allows lowering thread priority without being root on linux - probably
|
|
||||||
# not necessary on Windows but doesn't harm anything.
|
|
||||||
# see http://tech.stolsvik.com/2010/01/linux-java-thread-priorities-workaround.html
|
|
||||||
-XX:ThreadPriorityPolicy=42
|
|
||||||
|
|
||||||
# Enable heap-dump if there's an OOM
|
# Enable heap-dump if there's an OOM
|
||||||
-XX:+HeapDumpOnOutOfMemoryError
|
-XX:+HeapDumpOnOutOfMemoryError
|
||||||
|
|
||||||
|
|
@ -191,64 +189,3 @@
|
||||||
# * CAP_NOWARN: same as previous, except that the client warning will not be emitted.
|
# * CAP_NOWARN: same as previous, except that the client warning will not be emitted.
|
||||||
#
|
#
|
||||||
#-Dcassandra.expiration_date_overflow_policy=REJECT
|
#-Dcassandra.expiration_date_overflow_policy=REJECT
|
||||||
|
|
||||||
#################
|
|
||||||
# GC SETTINGS #
|
|
||||||
#################
|
|
||||||
|
|
||||||
### CMS Settings
|
|
||||||
|
|
||||||
-XX:+UseParNewGC
|
|
||||||
-XX:+UseConcMarkSweepGC
|
|
||||||
-XX:+CMSParallelRemarkEnabled
|
|
||||||
-XX:SurvivorRatio=8
|
|
||||||
-XX:MaxTenuringThreshold=1
|
|
||||||
-XX:CMSInitiatingOccupancyFraction=75
|
|
||||||
-XX:+UseCMSInitiatingOccupancyOnly
|
|
||||||
-XX:CMSWaitDuration=10000
|
|
||||||
-XX:+CMSParallelInitialMarkEnabled
|
|
||||||
-XX:+CMSEdenChunksRecordAlways
|
|
||||||
# some JVMs will fill up their heap when accessed via JMX, see CASSANDRA-6541
|
|
||||||
-XX:+CMSClassUnloadingEnabled
|
|
||||||
|
|
||||||
### G1 Settings (experimental, comment previous section and uncomment section below to enable)
|
|
||||||
|
|
||||||
## Use the Hotspot garbage-first collector.
|
|
||||||
#-XX:+UseG1GC
|
|
||||||
#
|
|
||||||
## 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=500
|
|
||||||
|
|
||||||
## 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
|
|
||||||
|
|
||||||
### GC logging options -- uncomment to enable
|
|
||||||
|
|
||||||
-XX:+PrintGCDetails
|
|
||||||
-XX:+PrintGCDateStamps
|
|
||||||
-XX:+PrintHeapAtGC
|
|
||||||
-XX:+PrintTenuringDistribution
|
|
||||||
-XX:+PrintGCApplicationStoppedTime
|
|
||||||
-XX:+PrintPromotionFailure
|
|
||||||
#-XX:PrintFLSStatistics=1
|
|
||||||
#-Xloggc:/var/log/cassandra/gc.log
|
|
||||||
-XX:+UseGCLogFileRotation
|
|
||||||
-XX:NumberOfGCLogFiles=10
|
|
||||||
-XX:GCLogFileSize=10M
|
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
###########################################################################
|
||||||
|
# jvm11-clients.options #
|
||||||
|
# #
|
||||||
|
# See jvm-clients.options. This file is specific for Java 11 and newer. #
|
||||||
|
###########################################################################
|
||||||
|
|
||||||
|
###################
|
||||||
|
# JPMS SETTINGS #
|
||||||
|
###################
|
||||||
|
|
||||||
|
-Djdk.attach.allowAttachSelf=true
|
||||||
|
--add-exports java.base/jdk.internal.misc=ALL-UNNAMED
|
||||||
|
--add-opens java.base/jdk.internal.module=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-opens jdk.management/com.sun.management.internal=ALL-UNNAMED
|
||||||
|
|
||||||
|
# The newline in the end of file is intentional
|
||||||
|
|
@ -0,0 +1,89 @@
|
||||||
|
###########################################################################
|
||||||
|
# jvm11-server.options #
|
||||||
|
# #
|
||||||
|
# See jvm-server.options. This file is specific for Java 11 and newer. #
|
||||||
|
###########################################################################
|
||||||
|
|
||||||
|
#################
|
||||||
|
# GC SETTINGS #
|
||||||
|
#################
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### CMS Settings
|
||||||
|
#-XX:+UseParNewGC
|
||||||
|
#-XX:+UseConcMarkSweepGC
|
||||||
|
#-XX:+CMSParallelRemarkEnabled
|
||||||
|
#-XX:SurvivorRatio=8
|
||||||
|
#-XX:MaxTenuringThreshold=1
|
||||||
|
#-XX:CMSInitiatingOccupancyFraction=75
|
||||||
|
#-XX:+UseCMSInitiatingOccupancyOnly
|
||||||
|
#-XX:CMSWaitDuration=10000
|
||||||
|
#-XX:+CMSParallelInitialMarkEnabled
|
||||||
|
#-XX:+CMSEdenChunksRecordAlways
|
||||||
|
## some JVMs will fill up their heap when accessed via JMX, see CASSANDRA-6541
|
||||||
|
#-XX:+CMSClassUnloadingEnabled
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### G1 Settings
|
||||||
|
## Use the Hotspot garbage-first collector.
|
||||||
|
-XX:+UseG1GC
|
||||||
|
-XX:+ParallelRefProcEnabled
|
||||||
|
|
||||||
|
#
|
||||||
|
## 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=500
|
||||||
|
|
||||||
|
## 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-opens java.base/jdk.internal.module=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-opens jdk.management/com.sun.management.internal=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'
|
||||||
|
|
||||||
|
# The newline in the end of file is intentional
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
###########################################################################
|
||||||
|
# jvm8-clients.options #
|
||||||
|
# #
|
||||||
|
# See jvm-clients.options. This file is specific for Java 8 and newer. #
|
||||||
|
###########################################################################
|
||||||
|
|
||||||
|
# intentionally left empty
|
||||||
|
|
||||||
|
# The newline in the end of file is intentional
|
||||||
|
|
@ -0,0 +1,76 @@
|
||||||
|
###########################################################################
|
||||||
|
# jvm8-server.options #
|
||||||
|
# #
|
||||||
|
# See jvm-server.options. This file is specific for Java 8 and newer. #
|
||||||
|
###########################################################################
|
||||||
|
|
||||||
|
########################
|
||||||
|
# GENERAL JVM SETTINGS #
|
||||||
|
########################
|
||||||
|
|
||||||
|
# allows lowering thread priority without being root on linux - probably
|
||||||
|
# not necessary on Windows but doesn't harm anything.
|
||||||
|
# see http://tech.stolsvik.com/2010/01/linux-java-thread-priorities-workaround.html
|
||||||
|
-XX:ThreadPriorityPolicy=42
|
||||||
|
|
||||||
|
#################
|
||||||
|
# GC SETTINGS #
|
||||||
|
#################
|
||||||
|
|
||||||
|
### CMS Settings
|
||||||
|
#-XX:+UseParNewGC
|
||||||
|
#-XX:+UseConcMarkSweepGC
|
||||||
|
#-XX:+CMSParallelRemarkEnabled
|
||||||
|
#-XX:SurvivorRatio=8
|
||||||
|
#-XX:MaxTenuringThreshold=1
|
||||||
|
#-XX:CMSInitiatingOccupancyFraction=75
|
||||||
|
#-XX:+UseCMSInitiatingOccupancyOnly
|
||||||
|
#-XX:CMSWaitDuration=10000
|
||||||
|
#-XX:+CMSParallelInitialMarkEnabled
|
||||||
|
#-XX:+CMSEdenChunksRecordAlways
|
||||||
|
## some JVMs will fill up their heap when accessed via JMX, see CASSANDRA-6541
|
||||||
|
#-XX:+CMSClassUnloadingEnabled
|
||||||
|
|
||||||
|
### G1 Settings
|
||||||
|
## Use the Hotspot garbage-first collector.
|
||||||
|
-XX:+UseG1GC
|
||||||
|
-XX:+ParallelRefProcEnabled
|
||||||
|
|
||||||
|
#
|
||||||
|
## 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=500
|
||||||
|
|
||||||
|
## 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
|
||||||
|
|
||||||
|
### GC logging options -- uncomment to enable
|
||||||
|
|
||||||
|
-XX:+PrintGCDetails
|
||||||
|
-XX:+PrintGCDateStamps
|
||||||
|
-XX:+PrintHeapAtGC
|
||||||
|
-XX:+PrintTenuringDistribution
|
||||||
|
-XX:+PrintGCApplicationStoppedTime
|
||||||
|
-XX:+PrintPromotionFailure
|
||||||
|
#-XX:PrintFLSStatistics=1
|
||||||
|
#-Xloggc:/var/log/cassandra/gc.log
|
||||||
|
-XX:+UseGCLogFileRotation
|
||||||
|
-XX:NumberOfGCLogFiles=10
|
||||||
|
-XX:GCLogFileSize=10M
|
||||||
|
|
||||||
|
# The newline in the end of file is intentional
|
||||||
|
|
@ -27,8 +27,84 @@ CLASSPATH="$CLASSPATH:$EXTRA_CLASSPATH"
|
||||||
|
|
||||||
|
|
||||||
# set JVM javaagent opts to avoid warnings/errors
|
# set JVM javaagent opts to avoid warnings/errors
|
||||||
if [ "$JVM_VENDOR" != "OpenJDK" -o "$JVM_VERSION" \> "1.6.0" ] \
|
JAVA_AGENT="$JAVA_AGENT -javaagent:$CASSANDRA_HOME/lib/jamm-0.3.2.jar"
|
||||||
|| [ "$JVM_VERSION" = "1.6.0" -a "$JVM_PATCH_VERSION" -ge 23 ]
|
|
||||||
then
|
|
||||||
JAVA_AGENT="$JAVA_AGENT -javaagent:$CASSANDRA_HOME/lib/jamm-0.3.0.jar"
|
#
|
||||||
|
# Java executable and per-Java version JVM settings
|
||||||
|
#
|
||||||
|
|
||||||
|
# Use JAVA_HOME if set, otherwise look for java in PATH
|
||||||
|
if [ -n "$JAVA_HOME" ]; then
|
||||||
|
# Why we can't have nice things: Solaris combines x86 and x86_64
|
||||||
|
# installations in the same tree, using an unconventional path for the
|
||||||
|
# 64bit JVM. Since we prefer 64bit, search the alternate path first,
|
||||||
|
# (see https://issues.apache.org/jira/browse/CASSANDRA-4638).
|
||||||
|
for java in "$JAVA_HOME"/bin/amd64/java "$JAVA_HOME"/bin/java; do
|
||||||
|
if [ -x "$java" ]; then
|
||||||
|
JAVA="$java"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
else
|
||||||
|
JAVA=java
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -z $JAVA ] ; then
|
||||||
|
echo Unable to find java executable. Check JAVA_HOME and PATH environment variables. >&2
|
||||||
|
exit 1;
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 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%_*}
|
||||||
|
|
||||||
|
JAVA_VERSION=11
|
||||||
|
if [ "$JVM_VERSION" = "1.8.0" ] ; then
|
||||||
|
JVM_PATCH_VERSION=${jvmver#*_}
|
||||||
|
if [ "$JVM_VERSION" \< "1.8" ] || [ "$JVM_VERSION" \> "1.8.2" ] ; then
|
||||||
|
echo "Cassandra 4.0 requires either Java 8 (update 151 or newer) or Java 11 (or newer). Java $JVM_VERSION is not supported."
|
||||||
|
exit 1;
|
||||||
|
fi
|
||||||
|
if [ "$JVM_PATCH_VERSION" -lt 151 ] ; then
|
||||||
|
echo "Cassandra 4.0 requires either Java 8 (update 151 or newer) or Java 11 (or newer). Java 8 update $JVM_PATCH_VERSION is not supported."
|
||||||
|
exit 1;
|
||||||
|
fi
|
||||||
|
JAVA_VERSION=8
|
||||||
|
elif [ "$JVM_VERSION" \< "11" ] ; then
|
||||||
|
echo "Cassandra 4.0 requires either Java 8 (update 151 or newer) or Java 11 (or newer)."
|
||||||
|
exit 1;
|
||||||
|
fi
|
||||||
|
|
||||||
|
jvm=`echo "$java_ver_output" | grep -A 1 '[openjdk|java] version' | awk 'NR==2 {print $1}'`
|
||||||
|
case "$jvm" in
|
||||||
|
OpenJDK)
|
||||||
|
JVM_VENDOR=OpenJDK
|
||||||
|
# this will be "64-Bit" or "32-Bit"
|
||||||
|
JVM_ARCH=`echo "$java_ver_output" | awk 'NR==3 {print $2}'`
|
||||||
|
;;
|
||||||
|
"Java(TM)")
|
||||||
|
JVM_VENDOR=Oracle
|
||||||
|
# this will be "64-Bit" or "32-Bit"
|
||||||
|
JVM_ARCH=`echo "$java_ver_output" | awk 'NR==3 {print $3}'`
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
# Help fill in other JVM values
|
||||||
|
JVM_VENDOR=other
|
||||||
|
JVM_ARCH=unknown
|
||||||
|
;;
|
||||||
|
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
|
||||||
|
JVM_DEP_OPTS_FILE=$CASSANDRA_CONF/jvm11${jvmoptions_variant:--clients}.options
|
||||||
|
else
|
||||||
|
JVM_DEP_OPTS_FILE=$CASSANDRA_CONF/jvm8${jvmoptions_variant:--clients}.options
|
||||||
|
fi
|
||||||
|
|
||||||
|
for opt in `grep "^-" $JVM_OPTS_FILE` `grep "^-" $JVM_DEP_OPTS_FILE`
|
||||||
|
do
|
||||||
|
JVM_OPTS="$JVM_OPTS $opt"
|
||||||
|
done
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ conf/commitlog_archiving.properties etc/cassandra
|
||||||
conf/cassandra-topology.properties etc/cassandra
|
conf/cassandra-topology.properties etc/cassandra
|
||||||
conf/logback.xml etc/cassandra
|
conf/logback.xml etc/cassandra
|
||||||
conf/logback-tools.xml etc/cassandra
|
conf/logback-tools.xml etc/cassandra
|
||||||
conf/jvm.options etc/cassandra
|
conf/jvm*.options etc/cassandra
|
||||||
conf/hotspot_compiler etc/cassandra
|
conf/hotspot_compiler etc/cassandra
|
||||||
conf/triggers/* etc/cassandra/triggers
|
conf/triggers/* etc/cassandra/triggers
|
||||||
debian/cassandra.in.sh usr/share/cassandra
|
debian/cassandra.in.sh usr/share/cassandra
|
||||||
|
|
|
||||||
|
|
@ -18,13 +18,14 @@
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<module type="JAVA_MODULE" version="4">
|
<module type="JAVA_MODULE" version="4">
|
||||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8" inherit-compiler-output="false">
|
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_10" inherit-compiler-output="false">
|
||||||
<output url="file://$MODULE_DIR$/.idea/out/main" />
|
<output url="file://$MODULE_DIR$/.idea/out/main" />
|
||||||
<output-test url="file://$MODULE_DIR$/.idea/out/test" />
|
<output-test url="file://$MODULE_DIR$/.idea/out/test" />
|
||||||
<exclude-output />
|
<exclude-output />
|
||||||
<content url="file://$MODULE_DIR$">
|
<content url="file://$MODULE_DIR$">
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/java" isTestSource="false" />
|
<sourceFolder url="file://$MODULE_DIR$/src/java" isTestSource="false" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/gen-java" isTestSource="false" />
|
<sourceFolder url="file://$MODULE_DIR$/src/java11" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src/gen-java" isTestSource="false" generated="true" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/resources" type="java-resource" />
|
<sourceFolder url="file://$MODULE_DIR$/src/resources" type="java-resource" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/tools/stress/src" isTestSource="false" />
|
<sourceFolder url="file://$MODULE_DIR$/tools/stress/src" isTestSource="false" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/tools/stress/test/unit" isTestSource="true" />
|
<sourceFolder url="file://$MODULE_DIR$/tools/stress/test/unit" isTestSource="true" />
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="false" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK" />
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_10" default="false" project-jdk-name="11" project-jdk-type="JavaSDK" />
|
||||||
</project>
|
</project>
|
||||||
|
|
@ -143,7 +143,7 @@
|
||||||
<configuration default="true" type="Application" factoryName="Application">
|
<configuration default="true" type="Application" factoryName="Application">
|
||||||
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
|
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
|
||||||
<option name="MAIN_CLASS_NAME" value="" />
|
<option name="MAIN_CLASS_NAME" value="" />
|
||||||
<option name="VM_PARAMETERS" value="-Dcassandra.config=file://$PROJECT_DIR$/conf/cassandra.yaml -Dcassandra.storagedir=$PROJECT_DIR$/data -Dlogback.configurationFile=file://$PROJECT_DIR$/conf/logback.xml -Dcassandra.logdir=$PROJECT_DIR$/data/logs -Djava.library.path=$PROJECT_DIR$/lib/sigar-bin -ea" />
|
<option name="VM_PARAMETERS" value="-Dcassandra.config=file://$PROJECT_DIR$/conf/cassandra.yaml -Dcassandra.storagedir=$PROJECT_DIR$/data -Dlogback.configurationFile=file://$PROJECT_DIR$/conf/logback.xml -Dcassandra.logdir=$PROJECT_DIR$/data/logs -Djava.library.path=$PROJECT_DIR$/lib/sigar-bin -ea --add-exports java.base/jdk.internal.misc=ALL-UNNAMED --add-opens java.base/jdk.internal.module=ALL-UNNAMED --add-exports java.base/jdk.internal.ref=ALL-UNNAMED --add-opens java.base/sun.nio.ch=ALL-UNNAMED --add-opens java.base/java.nio=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.util.concurrent=ALL-UNNAMED --add-exports java.management/com.sun.jmx.remote.internal=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-opens jdk.management/com.sun.management.internal=ALL-UNNAMED --add-exports jdk.scripting.nashorn/jdk.nashorn.internal.objects=ALL-UNNAMED --add-exports jdk.scripting.nashorn/jdk.nashorn.internal.runtime=ALL-UNNAMED --add-exports jdk.scripting.nashorn/jdk.nashorn.internal.runtime.options=ALL-UNNAMED" />
|
||||||
<option name="PROGRAM_PARAMETERS" value="" />
|
<option name="PROGRAM_PARAMETERS" value="" />
|
||||||
<option name="WORKING_DIRECTORY" value="" />
|
<option name="WORKING_DIRECTORY" value="" />
|
||||||
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
|
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
|
||||||
|
|
@ -167,7 +167,7 @@
|
||||||
<option name="MAIN_CLASS_NAME" value="" />
|
<option name="MAIN_CLASS_NAME" value="" />
|
||||||
<option name="METHOD_NAME" value="" />
|
<option name="METHOD_NAME" value="" />
|
||||||
<option name="TEST_OBJECT" value="class" />
|
<option name="TEST_OBJECT" value="class" />
|
||||||
<option name="VM_PARAMETERS" value="-Dcassandra.config=file://$PROJECT_DIR$/test/conf/cassandra.yaml -Dlogback.configurationFile=file://$PROJECT_DIR$/test/conf/logback-test.xml -Dcassandra.logdir=$PROJECT_DIR$/build/test/logs -Djava.library.path=$PROJECT_DIR$/lib/sigar-bin -Dlegacy-sstable-root=$PROJECT_DIR$/test/data/legacy-sstables -Dinvalid-legacy-sstable-root=$PROJECT_DIR$/test/data/invalid-legacy-sstables -Dcassandra.ring_delay_ms=1000 -Dcassandra.skip_sync=true -ea" />
|
<option name="VM_PARAMETERS" value="-Dcassandra.config=file://$PROJECT_DIR$/test/conf/cassandra.yaml -Dlogback.configurationFile=file://$PROJECT_DIR$/test/conf/logback-test.xml -Dcassandra.logdir=$PROJECT_DIR$/build/test/logs -Djava.library.path=$PROJECT_DIR$/lib/sigar-bin -Dlegacy-sstable-root=$PROJECT_DIR$/test/data/legacy-sstables -Dinvalid-legacy-sstable-root=$PROJECT_DIR$/test/data/invalid-legacy-sstables -Dcassandra.ring_delay_ms=1000 -Dcassandra.skip_sync=true -ea --add-exports java.base/jdk.internal.misc=ALL-UNNAMED --add-opens java.base/jdk.internal.module=ALL-UNNAMED --add-exports java.base/jdk.internal.ref=ALL-UNNAMED --add-opens java.base/sun.nio.ch=ALL-UNNAMED --add-opens java.base/java.nio=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.util.concurrent=ALL-UNNAMED --add-exports java.management/com.sun.jmx.remote.internal=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-opens jdk.management/com.sun.management.internal=ALL-UNNAMED --add-exports jdk.scripting.nashorn/jdk.nashorn.internal.objects=ALL-UNNAMED --add-exports jdk.scripting.nashorn/jdk.nashorn.internal.runtime=ALL-UNNAMED --add-exports jdk.scripting.nashorn/jdk.nashorn.internal.runtime.options=ALL-UNNAMED" />
|
||||||
<option name="PARAMETERS" value="" />
|
<option name="PARAMETERS" value="" />
|
||||||
<option name="WORKING_DIRECTORY" value="" />
|
<option name="WORKING_DIRECTORY" value="" />
|
||||||
<option name="ENV_VARIABLES" />
|
<option name="ENV_VARIABLES" />
|
||||||
|
|
@ -185,7 +185,7 @@
|
||||||
<configuration default="false" name="Cassandra" type="Application" factoryName="Application">
|
<configuration default="false" name="Cassandra" type="Application" factoryName="Application">
|
||||||
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
|
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
|
||||||
<option name="MAIN_CLASS_NAME" value="org.apache.cassandra.service.CassandraDaemon" />
|
<option name="MAIN_CLASS_NAME" value="org.apache.cassandra.service.CassandraDaemon" />
|
||||||
<option name="VM_PARAMETERS" value="-Dcassandra-foreground=yes -Dcassandra.config=file://$PROJECT_DIR$/conf/cassandra.yaml -Dcassandra.storagedir=$PROJECT_DIR$/data -Dlogback.configurationFile=file://$PROJECT_DIR$/conf/logback.xml -Dcassandra.logdir=$PROJECT_DIR$/data/logs -Djava.library.path=$PROJECT_DIR$/lib/sigar-bin -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=7199 -Dcom.sun.management.jmxremote.local.only=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -ea -Xmx1G" />
|
<option name="VM_PARAMETERS" value="-Dcassandra-foreground=yes -Dcassandra.config=file://$PROJECT_DIR$/conf/cassandra.yaml -Dcassandra.storagedir=$PROJECT_DIR$/data -Dlogback.configurationFile=file://$PROJECT_DIR$/conf/logback.xml -Dcassandra.logdir=$PROJECT_DIR$/data/logs -Djava.library.path=$PROJECT_DIR$/lib/sigar-bin -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=7199 -Dcom.sun.management.jmxremote.local.only=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -ea -Xmx1G --add-exports java.base/jdk.internal.misc=ALL-UNNAMED --add-opens java.base/jdk.internal.module=ALL-UNNAMED --add-exports java.base/jdk.internal.ref=ALL-UNNAMED --add-opens java.base/sun.nio.ch=ALL-UNNAMED --add-opens java.base/java.nio=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.util.concurrent=ALL-UNNAMED --add-exports java.management/com.sun.jmx.remote.internal=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-opens jdk.management/com.sun.management.internal=ALL-UNNAMED --add-exports jdk.scripting.nashorn/jdk.nashorn.internal.objects=ALL-UNNAMED --add-exports jdk.scripting.nashorn/jdk.nashorn.internal.runtime=ALL-UNNAMED --add-exports jdk.scripting.nashorn/jdk.nashorn.internal.runtime.options=ALL-UNNAMED" />
|
||||||
<option name="PROGRAM_PARAMETERS" value="" />
|
<option name="PROGRAM_PARAMETERS" value="" />
|
||||||
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
|
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
|
||||||
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
|
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
|
||||||
|
|
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -23,8 +23,84 @@ CLASSPATH="$CLASSPATH:$EXTRA_CLASSPATH"
|
||||||
|
|
||||||
|
|
||||||
# set JVM javaagent opts to avoid warnings/errors
|
# set JVM javaagent opts to avoid warnings/errors
|
||||||
if [ "$JVM_VENDOR" != "OpenJDK" -o "$JVM_VERSION" \> "1.6.0" ] \
|
JAVA_AGENT="$JAVA_AGENT -javaagent:$CASSANDRA_HOME/lib/jamm-0.3.2.jar"
|
||||||
|| [ "$JVM_VERSION" = "1.6.0" -a "$JVM_PATCH_VERSION" -ge 23 ]
|
|
||||||
then
|
|
||||||
JAVA_AGENT="$JAVA_AGENT -javaagent:$CASSANDRA_HOME/lib/jamm-0.3.0.jar"
|
#
|
||||||
|
# Java executable and per-Java version JVM settings
|
||||||
|
#
|
||||||
|
|
||||||
|
# Use JAVA_HOME if set, otherwise look for java in PATH
|
||||||
|
if [ -n "$JAVA_HOME" ]; then
|
||||||
|
# Why we can't have nice things: Solaris combines x86 and x86_64
|
||||||
|
# installations in the same tree, using an unconventional path for the
|
||||||
|
# 64bit JVM. Since we prefer 64bit, search the alternate path first,
|
||||||
|
# (see https://issues.apache.org/jira/browse/CASSANDRA-4638).
|
||||||
|
for java in "$JAVA_HOME"/bin/amd64/java "$JAVA_HOME"/bin/java; do
|
||||||
|
if [ -x "$java" ]; then
|
||||||
|
JAVA="$java"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
else
|
||||||
|
JAVA=java
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -z $JAVA ] ; then
|
||||||
|
echo Unable to find java executable. Check JAVA_HOME and PATH environment variables. >&2
|
||||||
|
exit 1;
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 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%_*}
|
||||||
|
|
||||||
|
JAVA_VERSION=11
|
||||||
|
if [ "$JVM_VERSION" = "1.8.0" ] ; then
|
||||||
|
JVM_PATCH_VERSION=${jvmver#*_}
|
||||||
|
if [ "$JVM_VERSION" \< "1.8" ] || [ "$JVM_VERSION" \> "1.8.2" ] ; then
|
||||||
|
echo "Cassandra 4.0 requires either Java 8 (update 151 or newer) or Java 11 (or newer). Java $JVM_VERSION is not supported."
|
||||||
|
exit 1;
|
||||||
|
fi
|
||||||
|
if [ "$JVM_PATCH_VERSION" -lt 151 ] ; then
|
||||||
|
echo "Cassandra 4.0 requires either Java 8 (update 151 or newer) or Java 11 (or newer). Java 8 update $JVM_PATCH_VERSION is not supported."
|
||||||
|
exit 1;
|
||||||
|
fi
|
||||||
|
JAVA_VERSION=8
|
||||||
|
elif [ "$JVM_VERSION" \< "11" ] ; then
|
||||||
|
echo "Cassandra 4.0 requires either Java 8 (update 151 or newer) or Java 11 (or newer)."
|
||||||
|
exit 1;
|
||||||
|
fi
|
||||||
|
|
||||||
|
jvm=`echo "$java_ver_output" | grep -A 1 '[openjdk|java] version' | awk 'NR==2 {print $1}'`
|
||||||
|
case "$jvm" in
|
||||||
|
OpenJDK)
|
||||||
|
JVM_VENDOR=OpenJDK
|
||||||
|
# this will be "64-Bit" or "32-Bit"
|
||||||
|
JVM_ARCH=`echo "$java_ver_output" | awk 'NR==3 {print $2}'`
|
||||||
|
;;
|
||||||
|
"Java(TM)")
|
||||||
|
JVM_VENDOR=Oracle
|
||||||
|
# this will be "64-Bit" or "32-Bit"
|
||||||
|
JVM_ARCH=`echo "$java_ver_output" | awk 'NR==3 {print $3}'`
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
# Help fill in other JVM values
|
||||||
|
JVM_VENDOR=other
|
||||||
|
JVM_ARCH=unknown
|
||||||
|
;;
|
||||||
|
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
|
||||||
|
JVM_DEP_OPTS_FILE=$CASSANDRA_CONF/jvm11${jvmoptions_variant:--clients}.options
|
||||||
|
else
|
||||||
|
JVM_DEP_OPTS_FILE=$CASSANDRA_CONF/jvm8${jvmoptions_variant:--clients}.options
|
||||||
|
fi
|
||||||
|
|
||||||
|
for opt in `grep "^-" $JVM_OPTS_FILE` `grep "^-" $JVM_DEP_OPTS_FILE`
|
||||||
|
do
|
||||||
|
JVM_OPTS="$JVM_OPTS $opt"
|
||||||
|
done
|
||||||
|
|
|
||||||
|
|
@ -76,6 +76,7 @@ public class SerializingCache<K, V> implements ICache<K, V>
|
||||||
}, serializer);
|
}, serializer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("resource")
|
||||||
private V deserialize(RefCountedMemory mem)
|
private V deserialize(RefCountedMemory mem)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
@ -89,6 +90,7 @@ public class SerializingCache<K, V> implements ICache<K, V>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("resource")
|
||||||
private RefCountedMemory serialize(V value)
|
private RefCountedMemory serialize(V value)
|
||||||
{
|
{
|
||||||
long serializedSize = serializer.serializedSize(value);
|
long serializedSize = serializer.serializedSize(value);
|
||||||
|
|
|
||||||
|
|
@ -73,6 +73,12 @@ import static org.apache.cassandra.io.util.FileUtils.ONE_GB;
|
||||||
|
|
||||||
public class DatabaseDescriptor
|
public class DatabaseDescriptor
|
||||||
{
|
{
|
||||||
|
static
|
||||||
|
{
|
||||||
|
// This static block covers most usages
|
||||||
|
FBUtilities.preventIllegalAccessWarnings();
|
||||||
|
}
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(DatabaseDescriptor.class);
|
private static final Logger logger = LoggerFactory.getLogger(DatabaseDescriptor.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,7 @@ public final class JavaBasedUDFunction extends UDFunction
|
||||||
|
|
||||||
private static final Pattern JAVA_LANG_PREFIX = Pattern.compile("\\bjava\\.lang\\.");
|
private static final Pattern JAVA_LANG_PREFIX = Pattern.compile("\\bjava\\.lang\\.");
|
||||||
|
|
||||||
static final Logger logger = LoggerFactory.getLogger(JavaBasedUDFunction.class);
|
private static final Logger logger = LoggerFactory.getLogger(JavaBasedUDFunction.class);
|
||||||
|
|
||||||
private static final AtomicInteger classSequence = new AtomicInteger();
|
private static final AtomicInteger classSequence = new AtomicInteger();
|
||||||
|
|
||||||
|
|
@ -257,10 +257,10 @@ public final class JavaBasedUDFunction extends UDFunction
|
||||||
EcjCompilationUnit compilationUnit = new EcjCompilationUnit(javaSource, targetClassName);
|
EcjCompilationUnit compilationUnit = new EcjCompilationUnit(javaSource, targetClassName);
|
||||||
|
|
||||||
Compiler compiler = new Compiler(compilationUnit,
|
Compiler compiler = new Compiler(compilationUnit,
|
||||||
errorHandlingPolicy,
|
errorHandlingPolicy,
|
||||||
compilerOptions,
|
compilerOptions,
|
||||||
compilationUnit,
|
compilationUnit,
|
||||||
problemFactory);
|
problemFactory);
|
||||||
compiler.compile(new ICompilationUnit[]{ compilationUnit });
|
compiler.compile(new ICompilationUnit[]{ compilationUnit });
|
||||||
|
|
||||||
if (compilationUnit.problemList != null && !compilationUnit.problemList.isEmpty())
|
if (compilationUnit.problemList != null && !compilationUnit.problemList.isEmpty())
|
||||||
|
|
@ -582,6 +582,7 @@ public final class JavaBasedUDFunction extends UDFunction
|
||||||
return findType(result.toString());
|
return findType(result.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("resource")
|
||||||
private NameEnvironmentAnswer findType(String className)
|
private NameEnvironmentAnswer findType(String className)
|
||||||
{
|
{
|
||||||
if (className.equals(this.className))
|
if (className.equals(this.className))
|
||||||
|
|
|
||||||
|
|
@ -73,6 +73,14 @@ final class ScriptBasedUDFunction extends UDFunction
|
||||||
"jdk.internal.org.objectweb.asm.commons",
|
"jdk.internal.org.objectweb.asm.commons",
|
||||||
"jdk.nashorn.internal.runtime",
|
"jdk.nashorn.internal.runtime",
|
||||||
"jdk.nashorn.internal.runtime.linker",
|
"jdk.nashorn.internal.runtime.linker",
|
||||||
|
// Nashorn / Java 11
|
||||||
|
"java.lang.ref",
|
||||||
|
"java.io",
|
||||||
|
"java.util.function",
|
||||||
|
"jdk.dynalink.linker",
|
||||||
|
"jdk.internal.org.objectweb.asm",
|
||||||
|
"jdk.internal.reflect",
|
||||||
|
"jdk.nashorn.internal.scripts",
|
||||||
// following required by Java Driver
|
// following required by Java Driver
|
||||||
"java.math",
|
"java.math",
|
||||||
"java.nio",
|
"java.nio",
|
||||||
|
|
|
||||||
|
|
@ -77,10 +77,6 @@ public class Memtable implements Comparable<Memtable>
|
||||||
case heap_buffers:
|
case heap_buffers:
|
||||||
return new SlabPool(heapLimit, 0, DatabaseDescriptor.getMemtableCleanupThreshold(), new ColumnFamilyStore.FlushLargestColumnFamily());
|
return new SlabPool(heapLimit, 0, DatabaseDescriptor.getMemtableCleanupThreshold(), new ColumnFamilyStore.FlushLargestColumnFamily());
|
||||||
case offheap_buffers:
|
case offheap_buffers:
|
||||||
if (!FileUtils.isCleanerAvailable)
|
|
||||||
{
|
|
||||||
throw new IllegalStateException("Could not free direct byte buffer: offheap_buffers is not a safe memtable_allocation_type without this ability, please adjust your config. This feature is only guaranteed to work on an Oracle JVM. Refusing to start.");
|
|
||||||
}
|
|
||||||
return new SlabPool(heapLimit, offHeapLimit, DatabaseDescriptor.getMemtableCleanupThreshold(), new ColumnFamilyStore.FlushLargestColumnFamily());
|
return new SlabPool(heapLimit, offHeapLimit, DatabaseDescriptor.getMemtableCleanupThreshold(), new ColumnFamilyStore.FlushLargestColumnFamily());
|
||||||
case offheap_objects:
|
case offheap_objects:
|
||||||
return new NativePool(heapLimit, offHeapLimit, DatabaseDescriptor.getMemtableCleanupThreshold(), new ColumnFamilyStore.FlushLargestColumnFamily());
|
return new NativePool(heapLimit, offHeapLimit, DatabaseDescriptor.getMemtableCleanupThreshold(), new ColumnFamilyStore.FlushLargestColumnFamily());
|
||||||
|
|
|
||||||
|
|
@ -344,6 +344,7 @@ public class RangeTombstoneList implements Iterable<RangeTombstone>, IMeasurable
|
||||||
return iterator(false);
|
return iterator(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("resource")
|
||||||
public Iterator<RangeTombstone> iterator(boolean reversed)
|
public Iterator<RangeTombstone> iterator(boolean reversed)
|
||||||
{
|
{
|
||||||
return reversed
|
return reversed
|
||||||
|
|
|
||||||
|
|
@ -214,6 +214,7 @@ public abstract class ReadCommand extends AbstractReadQuery
|
||||||
|
|
||||||
protected abstract int oldestUnrepairedTombstone();
|
protected abstract int oldestUnrepairedTombstone();
|
||||||
|
|
||||||
|
@SuppressWarnings("resource")
|
||||||
public ReadResponse createResponse(UnfilteredPartitionIterator iterator)
|
public ReadResponse createResponse(UnfilteredPartitionIterator iterator)
|
||||||
{
|
{
|
||||||
// validate that the sequence of RT markers is correct: open is followed by close, deletion times for both
|
// validate that the sequence of RT markers is correct: open is followed by close, deletion times for both
|
||||||
|
|
|
||||||
|
|
@ -388,6 +388,7 @@ public class SinglePartitionReadCommand extends ReadCommand implements SinglePar
|
||||||
* If the partition is is not cached, we figure out what filter is "biggest", read
|
* If the partition is is not cached, we figure out what filter is "biggest", read
|
||||||
* that from disk, then filter the result and either cache that or return it.
|
* that from disk, then filter the result and either cache that or return it.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("resource")
|
||||||
private UnfilteredRowIterator getThroughCache(ColumnFamilyStore cfs, ReadExecutionController executionController)
|
private UnfilteredRowIterator getThroughCache(ColumnFamilyStore cfs, ReadExecutionController executionController)
|
||||||
{
|
{
|
||||||
assert !cfs.isIndex(); // CASSANDRA-5732
|
assert !cfs.isIndex(); // CASSANDRA-5732
|
||||||
|
|
@ -710,6 +711,7 @@ public class SinglePartitionReadCommand extends ReadCommand implements SinglePar
|
||||||
* Note that we cannot use the Transformations framework because they greedily get the static row, which
|
* Note that we cannot use the Transformations framework because they greedily get the static row, which
|
||||||
* would cause all iterators to be initialized and hence all sstables to be accessed.
|
* would cause all iterators to be initialized and hence all sstables to be accessed.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("resource")
|
||||||
private UnfilteredRowIterator withSSTablesIterated(List<UnfilteredRowIterator> iterators,
|
private UnfilteredRowIterator withSSTablesIterated(List<UnfilteredRowIterator> iterators,
|
||||||
TableMetrics metrics,
|
TableMetrics metrics,
|
||||||
SSTableReadMetricsCollector metricsCollector)
|
SSTableReadMetricsCollector metricsCollector)
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,7 @@ public abstract class VirtualTableReadQuery extends AbstractReadQuery
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("resource")
|
||||||
public UnfilteredPartitionIterator executeLocally(ReadExecutionController executionController)
|
public UnfilteredPartitionIterator executeLocally(ReadExecutionController executionController)
|
||||||
{
|
{
|
||||||
UnfilteredPartitionIterator resultIterator = queryVirtualTable();
|
UnfilteredPartitionIterator resultIterator = queryVirtualTable();
|
||||||
|
|
|
||||||
|
|
@ -102,8 +102,7 @@ public class MemoryMappedSegment extends CommitLogSegment
|
||||||
@Override
|
@Override
|
||||||
protected void internalClose()
|
protected void internalClose()
|
||||||
{
|
{
|
||||||
if (FileUtils.isCleanerAvailable)
|
FileUtils.clean(buffer);
|
||||||
FileUtils.clean(buffer);
|
|
||||||
super.internalClose();
|
super.internalClose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -355,6 +355,7 @@ public class Scrubber implements Closeable
|
||||||
* Only wrap with {@link FixNegativeLocalDeletionTimeIterator} if {@link #reinsertOverflowedTTLRows} option
|
* Only wrap with {@link FixNegativeLocalDeletionTimeIterator} if {@link #reinsertOverflowedTTLRows} option
|
||||||
* is specified
|
* is specified
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("resource")
|
||||||
private UnfilteredRowIterator getIterator(DecoratedKey key)
|
private UnfilteredRowIterator getIterator(DecoratedKey key)
|
||||||
{
|
{
|
||||||
RowMergingSSTableIterator rowMergingIterator = new RowMergingSSTableIterator(SSTableIdentityIterator.create(sstable, dataFile, key));
|
RowMergingSSTableIterator rowMergingIterator = new RowMergingSSTableIterator(SSTableIdentityIterator.create(sstable, dataFile, key));
|
||||||
|
|
|
||||||
|
|
@ -279,6 +279,8 @@ public abstract class RowFilter implements Iterable<RowFilter.Expression>
|
||||||
class IsSatisfiedFilter extends Transformation<UnfilteredRowIterator>
|
class IsSatisfiedFilter extends Transformation<UnfilteredRowIterator>
|
||||||
{
|
{
|
||||||
DecoratedKey pk;
|
DecoratedKey pk;
|
||||||
|
|
||||||
|
@SuppressWarnings("resource")
|
||||||
public UnfilteredRowIterator applyToPartition(UnfilteredRowIterator partition)
|
public UnfilteredRowIterator applyToPartition(UnfilteredRowIterator partition)
|
||||||
{
|
{
|
||||||
pk = partition.partitionKey();
|
pk = partition.partitionKey();
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,6 @@ import org.apache.cassandra.utils.ObjectSizes;
|
||||||
import org.apache.cassandra.utils.SearchIterator;
|
import org.apache.cassandra.utils.SearchIterator;
|
||||||
import org.apache.cassandra.utils.btree.BTree;
|
import org.apache.cassandra.utils.btree.BTree;
|
||||||
import org.apache.cassandra.utils.btree.UpdateFunction;
|
import org.apache.cassandra.utils.btree.UpdateFunction;
|
||||||
import org.apache.cassandra.utils.concurrent.Locks;
|
|
||||||
import org.apache.cassandra.utils.concurrent.OpOrder;
|
import org.apache.cassandra.utils.concurrent.OpOrder;
|
||||||
import org.apache.cassandra.utils.memory.HeapAllocator;
|
import org.apache.cassandra.utils.memory.HeapAllocator;
|
||||||
import org.apache.cassandra.utils.memory.MemtableAllocator;
|
import org.apache.cassandra.utils.memory.MemtableAllocator;
|
||||||
|
|
@ -49,7 +48,7 @@ import org.apache.cassandra.utils.memory.MemtableAllocator;
|
||||||
* other thread can see the state where only parts but not all rows have
|
* other thread can see the state where only parts but not all rows have
|
||||||
* been added.
|
* been added.
|
||||||
*/
|
*/
|
||||||
public class AtomicBTreePartition extends AbstractBTreePartition
|
public final class AtomicBTreePartition extends AtomicBTreePartitionBase
|
||||||
{
|
{
|
||||||
public static final long EMPTY_SIZE = ObjectSizes.measure(new AtomicBTreePartition(null,
|
public static final long EMPTY_SIZE = ObjectSizes.measure(new AtomicBTreePartition(null,
|
||||||
DatabaseDescriptor.getPartitioner().decorateKey(ByteBuffer.allocate(1)),
|
DatabaseDescriptor.getPartitioner().decorateKey(ByteBuffer.allocate(1)),
|
||||||
|
|
@ -125,7 +124,7 @@ public class AtomicBTreePartition extends AbstractBTreePartition
|
||||||
{
|
{
|
||||||
if (usePessimisticLocking())
|
if (usePessimisticLocking())
|
||||||
{
|
{
|
||||||
Locks.monitorEnterUnsafe(this);
|
acquireLock();
|
||||||
monitorOwned = true;
|
monitorOwned = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -179,7 +178,7 @@ public class AtomicBTreePartition extends AbstractBTreePartition
|
||||||
}
|
}
|
||||||
if (shouldLock)
|
if (shouldLock)
|
||||||
{
|
{
|
||||||
Locks.monitorEnterUnsafe(this);
|
acquireLock();
|
||||||
monitorOwned = true;
|
monitorOwned = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -189,7 +188,7 @@ public class AtomicBTreePartition extends AbstractBTreePartition
|
||||||
{
|
{
|
||||||
indexer.commit();
|
indexer.commit();
|
||||||
if (monitorOwned)
|
if (monitorOwned)
|
||||||
Locks.monitorExitUnsafe(this);
|
releaseLock();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -178,6 +178,7 @@ public class PartitionUpdate extends AbstractBTreePartition
|
||||||
* Warning: this method does not close the provided iterator, it is up to
|
* Warning: this method does not close the provided iterator, it is up to
|
||||||
* the caller to close it.
|
* the caller to close it.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("resource")
|
||||||
public static PartitionUpdate fromIterator(UnfilteredRowIterator iterator, ColumnFilter filter)
|
public static PartitionUpdate fromIterator(UnfilteredRowIterator iterator, ColumnFilter filter)
|
||||||
{
|
{
|
||||||
iterator = UnfilteredRowIterators.withOnlyQueriedData(iterator, filter);
|
iterator = UnfilteredRowIterators.withOnlyQueriedData(iterator, filter);
|
||||||
|
|
@ -197,6 +198,7 @@ public class PartitionUpdate extends AbstractBTreePartition
|
||||||
* Warning: this method does not close the provided iterator, it is up to
|
* Warning: this method does not close the provided iterator, it is up to
|
||||||
* the caller to close it.
|
* the caller to close it.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("resource")
|
||||||
public static PartitionUpdate fromIterator(RowIterator iterator, ColumnFilter filter)
|
public static PartitionUpdate fromIterator(RowIterator iterator, ColumnFilter filter)
|
||||||
{
|
{
|
||||||
iterator = RowIterators.withOnlyQueriedData(iterator, filter);
|
iterator = RowIterators.withOnlyQueriedData(iterator, filter);
|
||||||
|
|
@ -218,6 +220,7 @@ public class PartitionUpdate extends AbstractBTreePartition
|
||||||
*
|
*
|
||||||
* @return the deserialized update or {@code null} if {@code bytes == null}.
|
* @return the deserialized update or {@code null} if {@code bytes == null}.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("resource")
|
||||||
public static PartitionUpdate fromBytes(ByteBuffer bytes, int version)
|
public static PartitionUpdate fromBytes(ByteBuffer bytes, int version)
|
||||||
{
|
{
|
||||||
if (bytes == null)
|
if (bytes == null)
|
||||||
|
|
|
||||||
|
|
@ -61,6 +61,7 @@ public abstract class PurgeFunction extends Transformation<UnfilteredRowIterator
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("resource")
|
||||||
protected UnfilteredRowIterator applyToPartition(UnfilteredRowIterator partition)
|
protected UnfilteredRowIterator applyToPartition(UnfilteredRowIterator partition)
|
||||||
{
|
{
|
||||||
onNewPartition(partition.partitionKey());
|
onNewPartition(partition.partitionKey());
|
||||||
|
|
|
||||||
|
|
@ -111,6 +111,7 @@ public abstract class UnfilteredPartitionIterators
|
||||||
return FilteredPartitions.filter(iterator, nowInSec);
|
return FilteredPartitions.filter(iterator, nowInSec);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("resource")
|
||||||
public static UnfilteredPartitionIterator merge(final List<? extends UnfilteredPartitionIterator> iterators, final int nowInSec, final MergeListener listener)
|
public static UnfilteredPartitionIterator merge(final List<? extends UnfilteredPartitionIterator> iterators, final int nowInSec, final MergeListener listener)
|
||||||
{
|
{
|
||||||
assert listener != null;
|
assert listener != null;
|
||||||
|
|
@ -135,6 +136,7 @@ public abstract class UnfilteredPartitionIterators
|
||||||
toMerge.set(idx, current);
|
toMerge.set(idx, current);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("resource")
|
||||||
protected UnfilteredRowIterator getReduced()
|
protected UnfilteredRowIterator getReduced()
|
||||||
{
|
{
|
||||||
UnfilteredRowIterators.MergeListener rowListener = listener.getRowMergeListener(partitionKey, toMerge);
|
UnfilteredRowIterators.MergeListener rowListener = listener.getRowMergeListener(partitionKey, toMerge);
|
||||||
|
|
@ -190,6 +192,7 @@ public abstract class UnfilteredPartitionIterators
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("resource")
|
||||||
public static UnfilteredPartitionIterator mergeLazily(final List<? extends UnfilteredPartitionIterator> iterators, final int nowInSec)
|
public static UnfilteredPartitionIterator mergeLazily(final List<? extends UnfilteredPartitionIterator> iterators, final int nowInSec)
|
||||||
{
|
{
|
||||||
assert !iterators.isEmpty();
|
assert !iterators.isEmpty();
|
||||||
|
|
|
||||||
|
|
@ -645,6 +645,7 @@ public interface Row extends Unfiltered, Collection<ColumnData>
|
||||||
lastRowSet = i;
|
lastRowSet = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("resource")
|
||||||
public Row merge(DeletionTime activeDeletion)
|
public Row merge(DeletionTime activeDeletion)
|
||||||
{
|
{
|
||||||
// If for this clustering we have only one row version and have no activeDeletion (i.e. nothing to filter out),
|
// If for this clustering we have only one row version and have no activeDeletion (i.e. nothing to filter out),
|
||||||
|
|
@ -756,6 +757,7 @@ public interface Row extends Unfiltered, Collection<ColumnData>
|
||||||
return AbstractTypeVersionComparator.INSTANCE.compare(column.type, dataColumn.type) < 0;
|
return AbstractTypeVersionComparator.INSTANCE.compare(column.type, dataColumn.type) < 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("resource")
|
||||||
protected ColumnData getReduced()
|
protected ColumnData getReduced()
|
||||||
{
|
{
|
||||||
if (column.isSimple())
|
if (column.isSimple())
|
||||||
|
|
|
||||||
|
|
@ -131,6 +131,7 @@ public abstract class Rows
|
||||||
* @param merged the result of merging {@code inputs}.
|
* @param merged the result of merging {@code inputs}.
|
||||||
* @param inputs the inputs whose merge yielded {@code merged}.
|
* @param inputs the inputs whose merge yielded {@code merged}.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("resource")
|
||||||
public static void diff(RowDiffListener diffListener, Row merged, Row...inputs)
|
public static void diff(RowDiffListener diffListener, Row merged, Row...inputs)
|
||||||
{
|
{
|
||||||
Clustering clustering = merged.clustering();
|
Clustering clustering = merged.clustering();
|
||||||
|
|
|
||||||
|
|
@ -77,6 +77,7 @@ implements BasePartitionIterator<R>
|
||||||
return fail;
|
return fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("resource")
|
||||||
public final boolean hasNext()
|
public final boolean hasNext()
|
||||||
{
|
{
|
||||||
BaseRowIterator<?> next = null;
|
BaseRowIterator<?> next = null;
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@ public final class Filter extends Transformation
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("resource")
|
||||||
protected RowIterator applyToPartition(BaseRowIterator iterator)
|
protected RowIterator applyToPartition(BaseRowIterator iterator)
|
||||||
{
|
{
|
||||||
return iterator instanceof UnfilteredRows
|
return iterator instanceof UnfilteredRows
|
||||||
|
|
|
||||||
|
|
@ -50,12 +50,14 @@ public final class FilteredPartitions extends BasePartitions<RowIterator, BasePa
|
||||||
/**
|
/**
|
||||||
* Filter any RangeTombstoneMarker from the iterator's iterators, transforming it into a PartitionIterator.
|
* Filter any RangeTombstoneMarker from the iterator's iterators, transforming it into a PartitionIterator.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("resource")
|
||||||
public static FilteredPartitions filter(UnfilteredPartitionIterator iterator, int nowInSecs)
|
public static FilteredPartitions filter(UnfilteredPartitionIterator iterator, int nowInSecs)
|
||||||
{
|
{
|
||||||
FilteredPartitions filtered = filter(iterator, new Filter(nowInSecs, iterator.metadata().enforceStrictLiveness()));
|
FilteredPartitions filtered = filter(iterator, new Filter(nowInSecs, iterator.metadata().enforceStrictLiveness()));
|
||||||
return (FilteredPartitions) Transformation.apply(filtered, new EmptyPartitionsDiscarder());
|
return (FilteredPartitions) Transformation.apply(filtered, new EmptyPartitionsDiscarder());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("resource")
|
||||||
public static FilteredPartitions filter(UnfilteredPartitionIterator iterator, Filter filter)
|
public static FilteredPartitions filter(UnfilteredPartitionIterator iterator, Filter filter)
|
||||||
{
|
{
|
||||||
return iterator instanceof UnfilteredPartitions
|
return iterator instanceof UnfilteredPartitions
|
||||||
|
|
|
||||||
|
|
@ -86,6 +86,7 @@ public class ViewBuilderTask extends CompactionInfo.Holder implements Callable<L
|
||||||
this.keysBuilt = keysBuilt;
|
this.keysBuilt = keysBuilt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("resource")
|
||||||
private void buildKey(DecoratedKey key)
|
private void buildKey(DecoratedKey key)
|
||||||
{
|
{
|
||||||
ReadQuery selectQuery = view.getReadQuery();
|
ReadQuery selectQuery = view.getReadQuery();
|
||||||
|
|
|
||||||
|
|
@ -72,6 +72,7 @@ public abstract class AbstractVirtualTable implements VirtualTable
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("resource")
|
||||||
public final UnfilteredPartitionIterator select(DecoratedKey partitionKey, ClusteringIndexFilter clusteringIndexFilter, ColumnFilter columnFilter)
|
public final UnfilteredPartitionIterator select(DecoratedKey partitionKey, ClusteringIndexFilter clusteringIndexFilter, ColumnFilter columnFilter)
|
||||||
{
|
{
|
||||||
Partition partition = data(partitionKey).getPartition(partitionKey);
|
Partition partition = data(partitionKey).getPartition(partitionKey);
|
||||||
|
|
|
||||||
|
|
@ -156,6 +156,7 @@ public interface Index
|
||||||
*/
|
*/
|
||||||
public static class CollatedViewIndexBuildingSupport implements IndexBuildingSupport
|
public static class CollatedViewIndexBuildingSupport implements IndexBuildingSupport
|
||||||
{
|
{
|
||||||
|
@SuppressWarnings("resource")
|
||||||
public SecondaryIndexBuilder getIndexBuildTask(ColumnFamilyStore cfs, Set<Index> indexes, Collection<SSTableReader> sstables)
|
public SecondaryIndexBuilder getIndexBuildTask(ColumnFamilyStore cfs, Set<Index> indexes, Collection<SSTableReader> sstables)
|
||||||
{
|
{
|
||||||
return new CollatedViewIndexBuilder(cfs, indexes, new ReducingKeyIterator(sstables));
|
return new CollatedViewIndexBuilder(cfs, indexes, new ReducingKeyIterator(sstables));
|
||||||
|
|
|
||||||
|
|
@ -686,6 +686,7 @@ public abstract class CassandraIndex implements Index
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("resource")
|
||||||
private void buildBlocking()
|
private void buildBlocking()
|
||||||
{
|
{
|
||||||
baseCfs.forceBlockingFlush();
|
baseCfs.forceBlockingFlush();
|
||||||
|
|
|
||||||
|
|
@ -208,6 +208,7 @@ public class CompositesSearcher extends CassandraIndexSearcher
|
||||||
}
|
}
|
||||||
|
|
||||||
// We assume all rows in dataIter belong to the same partition.
|
// We assume all rows in dataIter belong to the same partition.
|
||||||
|
@SuppressWarnings("resource")
|
||||||
private UnfilteredRowIterator filterStaleEntries(UnfilteredRowIterator dataIter,
|
private UnfilteredRowIterator filterStaleEntries(UnfilteredRowIterator dataIter,
|
||||||
final ByteBuffer indexValue,
|
final ByteBuffer indexValue,
|
||||||
final List<IndexEntry> entries,
|
final List<IndexEntry> entries,
|
||||||
|
|
|
||||||
|
|
@ -217,9 +217,6 @@ public class MappedBuffer implements Closeable
|
||||||
|
|
||||||
public void close()
|
public void close()
|
||||||
{
|
{
|
||||||
if (!FileUtils.isCleanerAvailable)
|
|
||||||
return;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Try forcing the unmapping of pages using undocumented unsafe sun APIs.
|
* Try forcing the unmapping of pages using undocumented unsafe sun APIs.
|
||||||
* If this fails (non Sun JVM), we'll have to wait for the GC to finalize the mapping.
|
* If this fails (non Sun JVM), we'll have to wait for the GC to finalize the mapping.
|
||||||
|
|
|
||||||
|
|
@ -69,6 +69,7 @@ public class BigTableReader extends SSTableReader
|
||||||
return iterator(null, key, rie, slices, selectedColumns, reversed);
|
return iterator(null, key, rie, slices, selectedColumns, reversed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("resource")
|
||||||
public UnfilteredRowIterator iterator(FileDataInput file, DecoratedKey key, RowIndexEntry indexEntry, Slices slices, ColumnFilter selectedColumns, boolean reversed)
|
public UnfilteredRowIterator iterator(FileDataInput file, DecoratedKey key, RowIndexEntry indexEntry, Slices slices, ColumnFilter selectedColumns, boolean reversed)
|
||||||
{
|
{
|
||||||
if (indexEntry == null)
|
if (indexEntry == null)
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,9 @@
|
||||||
package org.apache.cassandra.io.util;
|
package org.apache.cassandra.io.util;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
|
import java.lang.invoke.MethodHandle;
|
||||||
|
import java.lang.invoke.MethodHandles;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
import java.nio.channels.Channels;
|
import java.nio.channels.Channels;
|
||||||
import java.nio.channels.FileChannel;
|
import java.nio.channels.FileChannel;
|
||||||
|
|
@ -34,13 +37,13 @@ import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.concurrent.atomic.AtomicLong;
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import org.apache.cassandra.utils.SyncUtil;
|
import org.apache.cassandra.utils.SyncUtil;
|
||||||
import sun.nio.ch.DirectBuffer;
|
|
||||||
|
|
||||||
import org.apache.cassandra.concurrent.ScheduledExecutors;
|
import org.apache.cassandra.concurrent.ScheduledExecutors;
|
||||||
import org.apache.cassandra.io.FSError;
|
import org.apache.cassandra.io.FSError;
|
||||||
|
|
@ -49,6 +52,7 @@ import org.apache.cassandra.io.FSReadError;
|
||||||
import org.apache.cassandra.io.FSWriteError;
|
import org.apache.cassandra.io.FSWriteError;
|
||||||
import org.apache.cassandra.io.sstable.CorruptSSTableException;
|
import org.apache.cassandra.io.sstable.CorruptSSTableException;
|
||||||
import org.apache.cassandra.utils.JVMStabilityInspector;
|
import org.apache.cassandra.utils.JVMStabilityInspector;
|
||||||
|
import org.apache.cassandra.utils.memory.MemoryUtil;
|
||||||
|
|
||||||
import static org.apache.cassandra.utils.Throwables.maybeFail;
|
import static org.apache.cassandra.utils.Throwables.maybeFail;
|
||||||
import static org.apache.cassandra.utils.Throwables.merge;
|
import static org.apache.cassandra.utils.Throwables.merge;
|
||||||
|
|
@ -64,24 +68,31 @@ public final class FileUtils
|
||||||
public static final long ONE_TB = 1024 * ONE_GB;
|
public static final long ONE_TB = 1024 * ONE_GB;
|
||||||
|
|
||||||
private static final DecimalFormat df = new DecimalFormat("#.##");
|
private static final DecimalFormat df = new DecimalFormat("#.##");
|
||||||
public static final boolean isCleanerAvailable;
|
|
||||||
private static final AtomicReference<Optional<FSErrorHandler>> fsErrorHandler = new AtomicReference<>(Optional.empty());
|
private static final AtomicReference<Optional<FSErrorHandler>> fsErrorHandler = new AtomicReference<>(Optional.empty());
|
||||||
|
|
||||||
|
private static Class clsDirectBuffer;
|
||||||
|
private static MethodHandle mhDirectBufferCleaner;
|
||||||
|
private static MethodHandle mhCleanerClean;
|
||||||
|
|
||||||
static
|
static
|
||||||
{
|
{
|
||||||
boolean canClean = false;
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
clsDirectBuffer = Class.forName("sun.nio.ch.DirectBuffer");
|
||||||
|
Method mDirectBufferCleaner = clsDirectBuffer.getMethod("cleaner");
|
||||||
|
mhDirectBufferCleaner = MethodHandles.lookup().unreflect(mDirectBufferCleaner);
|
||||||
|
Method mCleanerClean = mDirectBufferCleaner.getReturnType().getMethod("clean");
|
||||||
|
mhCleanerClean = MethodHandles.lookup().unreflect(mCleanerClean);
|
||||||
|
|
||||||
ByteBuffer buf = ByteBuffer.allocateDirect(1);
|
ByteBuffer buf = ByteBuffer.allocateDirect(1);
|
||||||
((DirectBuffer) buf).cleaner().clean();
|
clean(buf);
|
||||||
canClean = true;
|
|
||||||
}
|
}
|
||||||
catch (Throwable t)
|
catch (Throwable t)
|
||||||
{
|
{
|
||||||
|
logger.error("FATAL: Cannot initialize optimized memory deallocator. Some data, both in-memory and on-disk, may live longer due to garbage collection.");
|
||||||
JVMStabilityInspector.inspectThrowable(t);
|
JVMStabilityInspector.inspectThrowable(t);
|
||||||
logger.info("Cannot initialize un-mmaper. (Are you using a non-Oracle JVM?) Compacted data files will not be removed promptly. Consider using an Oracle JVM or using standard disk access mode");
|
throw new RuntimeException(t);
|
||||||
}
|
}
|
||||||
isCleanerAvailable = canClean;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void createHardLink(String from, String to)
|
public static void createHardLink(String from, String to)
|
||||||
|
|
@ -106,11 +117,44 @@ public final class FileUtils
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static final File tempDir = new File(System.getProperty("java.io.tmpdir"));
|
||||||
|
private static final AtomicLong tempFileNum = new AtomicLong();
|
||||||
|
|
||||||
|
public static File getTempDir()
|
||||||
|
{
|
||||||
|
return tempDir;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pretty much like {@link File#createTempFile(String, String, File)}, but with
|
||||||
|
* the guarantee that the "random" part of the generated file name between
|
||||||
|
* {@code prefix} and {@code suffix} is a positive, increasing {@code long} value.
|
||||||
|
*/
|
||||||
public static File createTempFile(String prefix, String suffix, File directory)
|
public static File createTempFile(String prefix, String suffix, File directory)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return File.createTempFile(prefix, suffix, directory);
|
// Do not use java.io.File.createTempFile(), because some tests rely on the
|
||||||
|
// behavior that the "random" part in the temp file name is a positive 'long'.
|
||||||
|
// However, at least since Java 9 the code to generate the "random" part
|
||||||
|
// uses an _unsigned_ random long generated like this:
|
||||||
|
// Long.toUnsignedString(new java.util.Random.nextLong())
|
||||||
|
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
// The contract of File.createTempFile() says, that it must not return
|
||||||
|
// the same file name again. We do that here in a very simple way,
|
||||||
|
// that probably doesn't cover all edge cases. Just rely on system
|
||||||
|
// wall clock and return strictly increasing values from that.
|
||||||
|
long num = tempFileNum.getAndIncrement();
|
||||||
|
|
||||||
|
// We have a positive long here, which is safe to use for example
|
||||||
|
// for CommitLogTest.
|
||||||
|
String fileName = prefix + Long.toString(num) + suffix;
|
||||||
|
File candidate = new File(directory, fileName);
|
||||||
|
if (candidate.createNewFile())
|
||||||
|
return candidate;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
{
|
{
|
||||||
|
|
@ -120,12 +164,12 @@ public final class FileUtils
|
||||||
|
|
||||||
public static File createTempFile(String prefix, String suffix)
|
public static File createTempFile(String prefix, String suffix)
|
||||||
{
|
{
|
||||||
return createTempFile(prefix, suffix, new File(System.getProperty("java.io.tmpdir")));
|
return createTempFile(prefix, suffix, tempDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static File createDeletableTempFile(String prefix, String suffix)
|
public static File createDeletableTempFile(String prefix, String suffix)
|
||||||
{
|
{
|
||||||
File f = createTempFile(prefix, suffix, new File(System.getProperty("java.io.tmpdir")));
|
File f = createTempFile(prefix, suffix, getTempDir());
|
||||||
f.deleteOnExit();
|
f.deleteOnExit();
|
||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
|
|
@ -350,13 +394,29 @@ public final class FileUtils
|
||||||
|
|
||||||
public static void clean(ByteBuffer buffer)
|
public static void clean(ByteBuffer buffer)
|
||||||
{
|
{
|
||||||
if (buffer == null)
|
if (buffer == null || !buffer.isDirect())
|
||||||
return;
|
return;
|
||||||
if (isCleanerAvailable && buffer.isDirect())
|
|
||||||
|
// TODO Once we can get rid of Java 8, it's simpler to call sun.misc.Unsafe.invokeCleaner(ByteBuffer),
|
||||||
|
// but need to take care of the attachment handling (i.e. whether 'buf' is a duplicate or slice) - that
|
||||||
|
// is different in sun.misc.Unsafe.invokeCleaner and this implementation.
|
||||||
|
|
||||||
|
try
|
||||||
{
|
{
|
||||||
DirectBuffer db = (DirectBuffer) buffer;
|
Object cleaner = mhDirectBufferCleaner.bindTo(buffer).invoke();
|
||||||
if (db.cleaner() != null)
|
if (cleaner != null)
|
||||||
db.cleaner().clean();
|
{
|
||||||
|
// ((DirectBuffer) buf).cleaner().clean();
|
||||||
|
mhCleanerClean.bindTo(cleaner).invoke();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (RuntimeException e)
|
||||||
|
{
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
catch (Throwable e)
|
||||||
|
{
|
||||||
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,6 @@ import org.apache.cassandra.utils.FastByteOperations;
|
||||||
import org.apache.cassandra.utils.concurrent.Ref;
|
import org.apache.cassandra.utils.concurrent.Ref;
|
||||||
import org.apache.cassandra.utils.memory.MemoryUtil;
|
import org.apache.cassandra.utils.memory.MemoryUtil;
|
||||||
import sun.misc.Unsafe;
|
import sun.misc.Unsafe;
|
||||||
import sun.nio.ch.DirectBuffer;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An off-heap region of memory that must be manually free'd when no longer needed.
|
* An off-heap region of memory that must be manually free'd when no longer needed.
|
||||||
|
|
@ -213,9 +212,9 @@ public class Memory implements AutoCloseable
|
||||||
{
|
{
|
||||||
setBytes(memoryOffset, buffer.array(), buffer.arrayOffset() + buffer.position(), buffer.remaining());
|
setBytes(memoryOffset, buffer.array(), buffer.arrayOffset() + buffer.position(), buffer.remaining());
|
||||||
}
|
}
|
||||||
else if (buffer instanceof DirectBuffer)
|
else if (buffer.isDirect())
|
||||||
{
|
{
|
||||||
unsafe.copyMemory(((DirectBuffer) buffer).address() + buffer.position(), peer + memoryOffset, buffer.remaining());
|
unsafe.copyMemory(MemoryUtil.getAddress(buffer) + buffer.position(), peer + memoryOffset, buffer.remaining());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
throw new IllegalStateException();
|
throw new IllegalStateException();
|
||||||
|
|
|
||||||
|
|
@ -325,14 +325,6 @@ public class MmappedRegions extends SharedCloseableImpl
|
||||||
{
|
{
|
||||||
accumulate = channel.close(accumulate);
|
accumulate = channel.close(accumulate);
|
||||||
|
|
||||||
/*
|
|
||||||
* Try forcing the unmapping of segments using undocumented unsafe sun APIs.
|
|
||||||
* If this fails (non Sun JVM), we'll have to wait for the GC to finalize the mapping.
|
|
||||||
* If this works and a thread tries to access any segment, hell will unleash on earth.
|
|
||||||
*/
|
|
||||||
if (!FileUtils.isCleanerAvailable)
|
|
||||||
return accumulate;
|
|
||||||
|
|
||||||
return perform(accumulate, channel.filePath(), Throwables.FileOpType.READ,
|
return perform(accumulate, channel.filePath(), Throwables.FileOpType.READ,
|
||||||
of(buffers)
|
of(buffers)
|
||||||
.map((buffer) ->
|
.map((buffer) ->
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@
|
||||||
|
|
||||||
package org.apache.cassandra.security;
|
package org.apache.cassandra.security;
|
||||||
|
|
||||||
|
import java.lang.reflect.ReflectPermission;
|
||||||
import java.security.AccessControlException;
|
import java.security.AccessControlException;
|
||||||
import java.security.AllPermission;
|
import java.security.AllPermission;
|
||||||
import java.security.CodeSource;
|
import java.security.CodeSource;
|
||||||
|
|
@ -66,6 +67,12 @@ public final class ThreadAwareSecurityManager extends SecurityManager
|
||||||
private static final RuntimePermission MODIFY_THREAD_PERMISSION = new RuntimePermission("modifyThread");
|
private static final RuntimePermission MODIFY_THREAD_PERMISSION = new RuntimePermission("modifyThread");
|
||||||
private static final RuntimePermission MODIFY_THREADGROUP_PERMISSION = new RuntimePermission("modifyThreadGroup");
|
private static final RuntimePermission MODIFY_THREADGROUP_PERMISSION = new RuntimePermission("modifyThreadGroup");
|
||||||
|
|
||||||
|
// Nashorn / Java 11
|
||||||
|
private static final RuntimePermission NASHORN_GLOBAL_PERMISSION = new RuntimePermission("nashorn.createGlobal");
|
||||||
|
private static final ReflectPermission SUPPRESS_ACCESS_CHECKS_PERMISSION = new ReflectPermission("suppressAccessChecks");
|
||||||
|
private static final RuntimePermission DYNALINK_LOOKUP_PERMISSION = new RuntimePermission("dynalink.getLookup");
|
||||||
|
private static final RuntimePermission GET_CLASSLOADER_PERMISSION = new RuntimePermission("getClassLoader");
|
||||||
|
|
||||||
private static volatile boolean installed;
|
private static volatile boolean installed;
|
||||||
|
|
||||||
public static void install()
|
public static void install()
|
||||||
|
|
@ -189,6 +196,16 @@ public final class ThreadAwareSecurityManager extends SecurityManager
|
||||||
if (CHECK_MEMBER_ACCESS_PERMISSION.equals(perm))
|
if (CHECK_MEMBER_ACCESS_PERMISSION.equals(perm))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// Nashorn / Java 11
|
||||||
|
if (NASHORN_GLOBAL_PERMISSION.equals(perm))
|
||||||
|
return;
|
||||||
|
if (SUPPRESS_ACCESS_CHECKS_PERMISSION.equals(perm))
|
||||||
|
return;
|
||||||
|
if (DYNALINK_LOOKUP_PERMISSION.equals(perm))
|
||||||
|
return;
|
||||||
|
if (GET_CLASSLOADER_PERMISSION.equals(perm))
|
||||||
|
return;
|
||||||
|
|
||||||
super.checkPermission(perm);
|
super.checkPermission(perm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -208,7 +225,5 @@ public final class ThreadAwareSecurityManager extends SecurityManager
|
||||||
RuntimePermission perm = new RuntimePermission("accessClassInPackage." + pkg);
|
RuntimePermission perm = new RuntimePermission("accessClassInPackage." + pkg);
|
||||||
throw new AccessControlException("access denied: " + perm, perm);
|
throw new AccessControlException("access denied: " + perm, perm);
|
||||||
}
|
}
|
||||||
|
|
||||||
super.checkPackageAccess(pkg);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -58,6 +58,7 @@ public class DataResolver extends ResponseResolver
|
||||||
return !responses.isEmpty();
|
return !responses.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("resource")
|
||||||
public PartitionIterator resolve()
|
public PartitionIterator resolve()
|
||||||
{
|
{
|
||||||
// We could get more responses while this method runs, which is ok (we're happy to ignore any response not here
|
// We could get more responses while this method runs, which is ok (we're happy to ignore any response not here
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,7 @@ import org.apache.cassandra.locator.InetAddressAndPort;
|
||||||
*/
|
*/
|
||||||
public class ShortReadProtection
|
public class ShortReadProtection
|
||||||
{
|
{
|
||||||
|
@SuppressWarnings("resource")
|
||||||
public static UnfilteredPartitionIterator extend(InetAddressAndPort source, UnfilteredPartitionIterator partitions,
|
public static UnfilteredPartitionIterator extend(InetAddressAndPort source, UnfilteredPartitionIterator partitions,
|
||||||
ReadCommand command, DataLimits.Counter mergedResultCounter,
|
ReadCommand command, DataLimits.Counter mergedResultCounter,
|
||||||
long queryStartNanoTime, boolean enforceStrictLiveness)
|
long queryStartNanoTime, boolean enforceStrictLiveness)
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,11 @@ import static org.apache.commons.lang3.StringUtils.*;
|
||||||
|
|
||||||
public class NodeTool
|
public class NodeTool
|
||||||
{
|
{
|
||||||
|
static
|
||||||
|
{
|
||||||
|
FBUtilities.preventIllegalAccessWarnings();
|
||||||
|
}
|
||||||
|
|
||||||
private static final String HISTORYFILE = "nodetool.history";
|
private static final String HISTORYFILE = "nodetool.history";
|
||||||
|
|
||||||
public static void main(String... args)
|
public static void main(String... args)
|
||||||
|
|
|
||||||
|
|
@ -56,6 +56,10 @@ import org.apache.cassandra.utils.FBUtilities;
|
||||||
*/
|
*/
|
||||||
public class SSTableExport
|
public class SSTableExport
|
||||||
{
|
{
|
||||||
|
static
|
||||||
|
{
|
||||||
|
FBUtilities.preventIllegalAccessWarnings();
|
||||||
|
}
|
||||||
|
|
||||||
private static final String KEY_OPTION = "k";
|
private static final String KEY_OPTION = "k";
|
||||||
private static final String DEBUG_OUTPUT_OPTION = "d";
|
private static final String DEBUG_OUTPUT_OPTION = "d";
|
||||||
|
|
@ -102,6 +106,7 @@ public class SSTableExport
|
||||||
* @throws ConfigurationException
|
* @throws ConfigurationException
|
||||||
* on configuration failure (wrong params given)
|
* on configuration failure (wrong params given)
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("resource")
|
||||||
public static void main(String[] args) throws ConfigurationException
|
public static void main(String[] args) throws ConfigurationException
|
||||||
{
|
{
|
||||||
CommandLineParser parser = new PosixParser();
|
CommandLineParser parser = new PosixParser();
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,8 @@ import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import com.google.common.io.Files;
|
import com.google.common.io.Files;
|
||||||
|
|
||||||
|
import org.apache.cassandra.io.util.FileUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Custom class loader will load the classes from the class path, CCL will load
|
* Custom class loader will load the classes from the class path, CCL will load
|
||||||
* the classes from the the URL first, if it cannot find the required class it
|
* the classes from the the URL first, if it cannot find the required class it
|
||||||
|
|
@ -76,7 +78,7 @@ public class CustomClassLoader extends URLClassLoader
|
||||||
};
|
};
|
||||||
for (File inputJar : dir.listFiles(filter))
|
for (File inputJar : dir.listFiles(filter))
|
||||||
{
|
{
|
||||||
File lib = new File(System.getProperty("java.io.tmpdir"), "lib");
|
File lib = new File(FileUtils.getTempDir(), "lib");
|
||||||
if (!lib.exists())
|
if (!lib.exists())
|
||||||
{
|
{
|
||||||
lib.mkdir();
|
lib.mkdir();
|
||||||
|
|
@ -84,7 +86,7 @@ public class CustomClassLoader extends URLClassLoader
|
||||||
}
|
}
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
File out = File.createTempFile("cassandra-", ".jar", lib);
|
File out = FileUtils.createTempFile("cassandra-", ".jar", lib);
|
||||||
out.deleteOnExit();
|
out.deleteOnExit();
|
||||||
logger.info("Loading new jar {}", inputJar.getAbsolutePath());
|
logger.info("Loading new jar {}", inputJar.getAbsolutePath());
|
||||||
Files.copy(inputJar, out);
|
Files.copy(inputJar, out);
|
||||||
|
|
|
||||||
|
|
@ -144,7 +144,7 @@ public class CoalescingStrategies
|
||||||
ScheduledExecutors.scheduledFastTasks.scheduleWithFixedDelay(() -> shouldLogAverage = true, 5, 5, TimeUnit.SECONDS);
|
ScheduledExecutors.scheduledFastTasks.scheduleWithFixedDelay(() -> shouldLogAverage = true, 5, 5, TimeUnit.SECONDS);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
File outFile = File.createTempFile("coalescing_" + this.displayName + "_", ".log", new File(DEBUG_COALESCING_PATH));
|
File outFile = FileUtils.createTempFile("coalescing_" + this.displayName + "_", ".log", new File(DEBUG_COALESCING_PATH));
|
||||||
rasTemp = new RandomAccessFile(outFile, "rw");
|
rasTemp = new RandomAccessFile(outFile, "rw");
|
||||||
logBufferTemp = ras.getChannel().map(MapMode.READ_WRITE, 0, Integer.MAX_VALUE);
|
logBufferTemp = ras.getChannel().map(MapMode.READ_WRITE, 0, Integer.MAX_VALUE);
|
||||||
logBufferTemp.putLong(0);
|
logBufferTemp.putLong(0);
|
||||||
|
|
|
||||||
|
|
@ -952,4 +952,28 @@ public class FBUtilities
|
||||||
broadcastInetAddressAndPort = null;
|
broadcastInetAddressAndPort = null;
|
||||||
broadcastNativeAddress = null;
|
broadcastNativeAddress = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hack to prevent the ugly "illegal access" warnings in Java 11+ like the following.
|
||||||
|
*/
|
||||||
|
public static void preventIllegalAccessWarnings()
|
||||||
|
{
|
||||||
|
// Example "annoying" trace:
|
||||||
|
// WARNING: An illegal reflective access operation has occurred
|
||||||
|
// WARNING: Illegal reflective access by io.netty.util.internal.ReflectionUtil (file:...)
|
||||||
|
// WARNING: Please consider reporting this to the maintainers of io.netty.util.internal.ReflectionUtil
|
||||||
|
// WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
|
||||||
|
// WARNING: All illegal access operations will be denied in a future release
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Class<?> c = Class.forName("jdk.internal.module.IllegalAccessLogger");
|
||||||
|
Field f = c.getDeclaredField("logger");
|
||||||
|
f.setAccessible(true);
|
||||||
|
f.set(null, null);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,10 @@
|
||||||
package org.apache.cassandra.utils;
|
package org.apache.cassandra.utils;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.lang.invoke.MethodHandle;
|
||||||
|
import java.lang.invoke.MethodHandles;
|
||||||
import java.lang.management.ManagementFactory;
|
import java.lang.management.ManagementFactory;
|
||||||
|
import java.lang.reflect.Constructor;
|
||||||
import java.lang.reflect.InvocationHandler;
|
import java.lang.reflect.InvocationHandler;
|
||||||
import java.lang.reflect.Proxy;
|
import java.lang.reflect.Proxy;
|
||||||
import java.net.Inet6Address;
|
import java.net.Inet6Address;
|
||||||
|
|
@ -44,7 +47,6 @@ import org.apache.commons.lang3.StringUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import com.sun.jmx.remote.security.JMXPluggableAuthenticator;
|
|
||||||
import org.apache.cassandra.auth.jmx.AuthenticationProxy;
|
import org.apache.cassandra.auth.jmx.AuthenticationProxy;
|
||||||
|
|
||||||
public class JMXServerUtils
|
public class JMXServerUtils
|
||||||
|
|
@ -261,6 +263,21 @@ public class JMXServerUtils
|
||||||
|
|
||||||
private static class JMXPluggableAuthenticatorWrapper implements JMXAuthenticator
|
private static class JMXPluggableAuthenticatorWrapper implements JMXAuthenticator
|
||||||
{
|
{
|
||||||
|
private static final MethodHandle ctorHandle;
|
||||||
|
static
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Class c = Class.forName("com.sun.jmx.remote.security.JMXPluggableAuthenticator");
|
||||||
|
Constructor ctor = c.getDeclaredConstructor(Map.class);
|
||||||
|
ctorHandle = MethodHandles.lookup().unreflectConstructor(ctor);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
final Map<?, ?> env;
|
final Map<?, ?> env;
|
||||||
private JMXPluggableAuthenticatorWrapper(Map<?, ?> env)
|
private JMXPluggableAuthenticatorWrapper(Map<?, ?> env)
|
||||||
{
|
{
|
||||||
|
|
@ -269,8 +286,15 @@ public class JMXServerUtils
|
||||||
|
|
||||||
public Subject authenticate(Object credentials)
|
public Subject authenticate(Object credentials)
|
||||||
{
|
{
|
||||||
JMXPluggableAuthenticator authenticator = new JMXPluggableAuthenticator(env);
|
try
|
||||||
return authenticator.authenticate(credentials);
|
{
|
||||||
|
JMXAuthenticator authenticator = (JMXAuthenticator) ctorHandle.invoke(env);
|
||||||
|
return authenticator.authenticate(credentials);
|
||||||
|
}
|
||||||
|
catch (Throwable e)
|
||||||
|
{
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,7 @@ public abstract class MergeIterator<In,Out> extends AbstractIterator<Out> implem
|
||||||
this.reducer = reducer;
|
this.reducer = reducer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("resource")
|
||||||
public static <In, Out> MergeIterator<In, Out> get(List<? extends Iterator<In>> sources,
|
public static <In, Out> MergeIterator<In, Out> get(List<? extends Iterator<In>> sources,
|
||||||
Comparator<? super In> comparator,
|
Comparator<? super In> comparator,
|
||||||
Reducer<In, Out> reducer)
|
Reducer<In, Out> reducer)
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue