Repository: cassandra
Updated Branches:
  refs/heads/cassandra-3.0 3079ae60d -> 7a2be8fa4
  refs/heads/trunk 5c5cc540f -> 4254de17f


Don't require HEAP_NEW_SIZE to be set when using G1

patch by Blake Eggleston; reviewed by Paulo Motta for CASSANDRA-11600


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/7a2be8fa
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/7a2be8fa
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/7a2be8fa

Branch: refs/heads/cassandra-3.0
Commit: 7a2be8fa4a539dde2553996d57df02453e213c2f
Parents: 3079ae6
Author: Blake Eggleston <bdeggles...@gmail.com>
Authored: Wed Apr 27 18:25:04 2016 +0100
Committer: Aleksey Yeschenko <alek...@apache.org>
Committed: Wed Apr 27 18:25:04 2016 +0100

----------------------------------------------------------------------
 CHANGES.txt            |  1 +
 conf/cassandra-env.ps1 | 14 +++++------
 conf/cassandra-env.sh  | 58 ++++++++++++++++++++++-----------------------
 3 files changed, 37 insertions(+), 36 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/7a2be8fa/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 6b6bc1f..8877fa9 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)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/7a2be8fa/conf/cassandra-env.ps1
----------------------------------------------------------------------
diff --git a/conf/cassandra-env.ps1 b/conf/cassandra-env.ps1
index a322a4d..794189f 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))

http://git-wip-us.apache.org/repos/asf/cassandra/blob/7a2be8fa/conf/cassandra-env.sh
----------------------------------------------------------------------
diff --git a/conf/cassandra-env.sh b/conf/cassandra-env.sh
index 83fe4c5..0ba0c4e 100644
--- a/conf/cassandra-env.sh
+++ b/conf/cassandra-env.sh
@@ -121,6 +121,31 @@ case "$jvm" in
         ;;
 esac
 
+#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"
+
+# Here we create the arguments that will get passed to the jvm when
+# 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
+DEFINED_XMN=$?
+echo $JVM_OPTS | grep -q Xmx
+DEFINED_XMX=$?
+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
@@ -143,42 +168,17 @@ esac
 #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
+if [ "x$MAX_HEAP_SIZE" = "x" ] && [ "x$HEAP_NEWSIZE" = "x" -o $USING_G1 -eq 0 
]; 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
+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
 
-#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"
-
-# Here we create the arguments that will get passed to the jvm when
-# 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
-DEFINED_XMN=$?
-echo $JVM_OPTS | grep -q Xmx
-DEFINED_XMX=$?
-echo $JVM_OPTS | grep -q Xms
-DEFINED_XMS=$?
-echo $JVM_OPTS | grep -q UseConcMarkSweepGC
-USING_CMS=$?
-
 # 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 -ne 0 ] && [ $DEFINED_XMS -ne 0 ]; then

Reply via email to