diff --git a/CHANGES.txt b/CHANGES.txt index 6b6bc1f256..8877fa9f06 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,4 +1,5 @@ 3.0.6 + * Don't require HEAP_NEW_SIZE to be set when using G1 (CASSANDRA-11600) * Fix sstabledump not showing cells after tombstone marker (CASSANDRA-11654) * Ignore all LocalStrategy keyspaces for streaming and other related operations (CASSANDRA-11627) diff --git a/conf/cassandra-env.ps1 b/conf/cassandra-env.ps1 index a322a4d2d2..794189f436 100644 --- a/conf/cassandra-env.ps1 +++ b/conf/cassandra-env.ps1 @@ -133,7 +133,7 @@ Function CalculateHeapSizes return } - if (($env:MAX_HEAP_SIZE -and !$env:HEAP_NEWSIZE) -or (!$env:MAX_HEAP_SIZE -and $env:HEAP_NEWSIZE)) + if ((($env:MAX_HEAP_SIZE -and !$env:HEAP_NEWSIZE) -or (!$env:MAX_HEAP_SIZE -and $env:HEAP_NEWSIZE)) -and ($using_cms -eq $true)) { echo "Please set or unset MAX_HEAP_SIZE and HEAP_NEWSIZE in pairs. Aborting startup." exit 1 @@ -327,12 +327,6 @@ Function SetCassandraEnvironment # times. If in doubt, and if you do not particularly want to tweak, go # 100 MB per physical CPU core. - #$env:MAX_HEAP_SIZE="4096M" - #$env:HEAP_NEWSIZE="800M" - CalculateHeapSizes - - ParseJVMInfo - #GC log path has to be defined here since it needs to find CASSANDRA_HOME $env:JVM_OPTS="$env:JVM_OPTS -Xloggc:""$env:CASSANDRA_HOME/logs/gc.log""" @@ -352,6 +346,12 @@ Function SetCassandraEnvironment $defined_xms = $env:JVM_OPTS -like '*Xms*' $using_cms = $env:JVM_OPTS -like '*UseConcMarkSweepGC*' + #$env:MAX_HEAP_SIZE="4096M" + #$env:HEAP_NEWSIZE="800M" + CalculateHeapSizes + + ParseJVMInfo + # We only set -Xms and -Xmx if they were not defined on jvm.options file # If defined, both Xmx and Xms should be defined together. if (($defined_xmx -eq $false) -and ($defined_xms -eq $false)) diff --git a/conf/cassandra-env.sh b/conf/cassandra-env.sh index 83fe4c5443..0ba0c4e22e 100644 --- a/conf/cassandra-env.sh +++ b/conf/cassandra-env.sh @@ -121,41 +121,6 @@ case "$jvm" in ;; esac -# Override these to set the amount of memory to allocate to the JVM at -# start-up. For production use you may wish to adjust this for your -# environment. MAX_HEAP_SIZE is the total amount of memory dedicated -# to the Java heap. HEAP_NEWSIZE refers to the size of the young -# generation. Both MAX_HEAP_SIZE and HEAP_NEWSIZE should be either set -# or not (if you set one, set the other). -# -# The main trade-off for the young generation is that the larger it -# is, the longer GC pause times will be. The shorter it is, the more -# expensive GC will be (usually). -# -# The example HEAP_NEWSIZE assumes a modern 8-core+ machine for decent pause -# times. If in doubt, and if you do not particularly want to tweak, go with -# 100 MB per physical CPU core. - -#MAX_HEAP_SIZE="4G" -#HEAP_NEWSIZE="800M" - -# Set this to control the amount of arenas per-thread in glibc -#export MALLOC_ARENA_MAX=4 - -# only calculate the size if it's not set manually -if [ "x$MAX_HEAP_SIZE" = "x" ] && [ "x$HEAP_NEWSIZE" = "x" ]; then - calculate_heap_sizes -else - if [ "x$MAX_HEAP_SIZE" = "x" ] || [ "x$HEAP_NEWSIZE" = "x" ]; then - echo "please set or unset MAX_HEAP_SIZE and HEAP_NEWSIZE in pairs (see cassandra-env.sh)" - exit 1 - fi -fi - -if [ "x$MALLOC_ARENA_MAX" = "x" ] ; then - export MALLOC_ARENA_MAX=4 -fi - #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" @@ -178,6 +143,41 @@ echo $JVM_OPTS | grep -q Xms DEFINED_XMS=$? echo $JVM_OPTS | grep -q UseConcMarkSweepGC USING_CMS=$? +echo $JVM_OPTS | grep -q UseG1GC +USING_G1=$? + +# Override these to set the amount of memory to allocate to the JVM at +# start-up. For production use you may wish to adjust this for your +# environment. MAX_HEAP_SIZE is the total amount of memory dedicated +# to the Java heap. HEAP_NEWSIZE refers to the size of the young +# generation. Both MAX_HEAP_SIZE and HEAP_NEWSIZE should be either set +# or not (if you set one, set the other). +# +# The main trade-off for the young generation is that the larger it +# is, the longer GC pause times will be. The shorter it is, the more +# expensive GC will be (usually). +# +# The example HEAP_NEWSIZE assumes a modern 8-core+ machine for decent pause +# times. If in doubt, and if you do not particularly want to tweak, go with +# 100 MB per physical CPU core. + +#MAX_HEAP_SIZE="4G" +#HEAP_NEWSIZE="800M" + +# Set this to control the amount of arenas per-thread in glibc +#export MALLOC_ARENA_MAX=4 + +# only calculate the size if it's not set manually +if [ "x$MAX_HEAP_SIZE" = "x" ] && [ "x$HEAP_NEWSIZE" = "x" -o $USING_G1 -eq 0 ]; then + calculate_heap_sizes +elif [ "x$MAX_HEAP_SIZE" = "x" ] || [ "x$HEAP_NEWSIZE" = "x" -a $USING_G1 -ne 0 ]; then + echo "please set or unset MAX_HEAP_SIZE and HEAP_NEWSIZE in pairs when using CMS GC (see cassandra-env.sh)" + exit 1 +fi + +if [ "x$MALLOC_ARENA_MAX" = "x" ] ; then + export MALLOC_ARENA_MAX=4 +fi # We only set -Xms and -Xmx if they were not defined on jvm.options file # If defined, both Xmx and Xms should be defined together.