From b551b8e1e6ac37698b78e4ee65a658bd446e7f05 Mon Sep 17 00:00:00 2001 From: Joel Knighton Date: Thu, 31 Dec 2015 10:27:25 -0600 Subject: [PATCH 1/3] Add check if existing fat client entry in gossip has same broadcast address in checkForEndpointCollision to enable quicker bootstrap retries. patch by jkni; reviewed by Stefania for CASSANDRA-10844 --- src/java/org/apache/cassandra/service/StorageService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/java/org/apache/cassandra/service/StorageService.java b/src/java/org/apache/cassandra/service/StorageService.java index 0698d11592..6e38b92b66 100644 --- a/src/java/org/apache/cassandra/service/StorageService.java +++ b/src/java/org/apache/cassandra/service/StorageService.java @@ -550,7 +550,7 @@ public class StorageService extends NotificationBroadcasterSupport implements IE for (Map.Entry entry : Gossiper.instance.getEndpointStates()) { - if (entry.getValue().getApplicationState(ApplicationState.STATUS) == null) + if (entry.getKey().equals(FBUtilities.getBroadcastAddress()) || entry.getValue().getApplicationState(ApplicationState.STATUS) == null) continue; String[] pieces = entry.getValue().getApplicationState(ApplicationState.STATUS).value.split(VersionedValue.DELIMITER_STR, -1); assert (pieces.length > 0); From c04bf2a9bb8bc48bcdf49455478836e6fd1f217d Mon Sep 17 00:00:00 2001 From: Ariel Weisberg Date: Tue, 29 Dec 2015 14:32:18 -0500 Subject: [PATCH 2/3] Enable GC logging by default patch by Chris Lohfink; reviewed by aweisberg for CASSANDRA-10140 --- CHANGES.txt | 1 + NEWS.txt | 2 ++ conf/cassandra-env.ps1 | 27 +++++++++--------- conf/cassandra-env.sh | 28 +++++++++---------- debian/patches/002cassandra_logdir_fix.dpatch | 18 ++++++++++-- 5 files changed, 45 insertions(+), 31 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 648200bbca..d5bb7a8453 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,4 +1,5 @@ 2.2.5 + * Enable GC logging by default * Optimize pending range computation (CASSANDRA-9258) * Skip commit log and saved cache directories in SSTable version startup check (CASSANDRA-10902) * drop/alter user should be case sensitive (CASSANDRA-10817) diff --git a/NEWS.txt b/NEWS.txt index 3876c43060..57e321e83b 100644 --- a/NEWS.txt +++ b/NEWS.txt @@ -33,6 +33,8 @@ Operations "rack1". To override this behaviour use -Dcassandra.ignore_rack=true and/or -Dcassandra.ignore_dc=true. - Reloading the configuration file of GossipingPropertyFileSnitch has been disabled. + - GC logging is now enabled by default (but you can disable it if you want by + commenting the relevant lines of the cassandra-env file). New features ------------ diff --git a/conf/cassandra-env.ps1 b/conf/cassandra-env.ps1 index 970896407f..aff0d9e1b0 100644 --- a/conf/cassandra-env.ps1 +++ b/conf/cassandra-env.ps1 @@ -416,24 +416,23 @@ Function SetCassandraEnvironment $env:JVM_OPTS="$env:JVM_OPTS -XX:+CMSParallelInitialMarkEnabled -XX:+CMSEdenChunksRecordAlways" } - # GC logging options -- uncomment to enable - # $env:JVM_OPTS="$env:JVM_OPTS -XX:+PrintGCDetails" - # $env:JVM_OPTS="$env:JVM_OPTS -XX:+PrintGCDateStamps" - # $env:JVM_OPTS="$env:JVM_OPTS -XX:+PrintHeapAtGC" - # $env:JVM_OPTS="$env:JVM_OPTS -XX:+PrintTenuringDistribution" - # $env:JVM_OPTS="$env:JVM_OPTS -XX:+PrintGCApplicationStoppedTime" - # $env:JVM_OPTS="$env:JVM_OPTS -XX:+PrintPromotionFailure" + # GC logging options + $env:JVM_OPTS="$env:JVM_OPTS -XX:+PrintGCDetails" + $env:JVM_OPTS="$env:JVM_OPTS -XX:+PrintGCDateStamps" + $env:JVM_OPTS="$env:JVM_OPTS -XX:+PrintHeapAtGC" + $env:JVM_OPTS="$env:JVM_OPTS -XX:+PrintTenuringDistribution" + $env:JVM_OPTS="$env:JVM_OPTS -XX:+PrintGCApplicationStoppedTime" + $env:JVM_OPTS="$env:JVM_OPTS -XX:+PrintPromotionFailure" # $env:JVM_OPTS="$env:JVM_OPTS -XX:PrintFLSStatistics=1" + + $env:JVM_OPTS="$env:JVM_OPTS -Xloggc:$env:CASSANDRA_HOME/logs/gc.log" + $env:JVM_OPTS="$env:JVM_OPTS -XX:+UseGCLogFileRotation" + $env:JVM_OPTS="$env:JVM_OPTS -XX:NumberOfGCLogFiles=10" + $env:JVM_OPTS="$env:JVM_OPTS -XX:GCLogFileSize=10M" + # if using version before JDK 6u34 or 7u2 use this instead of log rotation # $currentDate = (Get-Date).ToString('yyyy.MM.dd') # $env:JVM_OPTS="$env:JVM_OPTS -Xloggc:$env:CASSANDRA_HOME/logs/gc-$currentDate.log" - # If you are using JDK 6u34 7u2 or later you can enable GC log rotation - # don't stick the date in the log name if rotation is on. - # $env:JVM_OPTS="$env:JVM_OPTS -Xloggc:$env:CASSANDRA_HOME/logs/gc.log" - # $env:JVM_OPTS="$env:JVM_OPTS -XX:+UseGCLogFileRotation" - # $env:JVM_OPTS="$env:JVM_OPTS -XX:NumberOfGCLogFiles=10" - # $env:JVM_OPTS="$env:JVM_OPTS -XX:GCLogFileSize=10M" - # Configure the following for JEMallocAllocator and if jemalloc is not available in the system # library path. # set LD_LIBRARY_PATH=/lib/ diff --git a/conf/cassandra-env.sh b/conf/cassandra-env.sh index e82198b3c0..ea1a73634c 100644 --- a/conf/cassandra-env.sh +++ b/conf/cassandra-env.sh @@ -232,21 +232,21 @@ if [ "$JVM_ARCH" = "64-Bit" ] ; then JVM_OPTS="$JVM_OPTS -XX:+UseCondCardMark" fi -# GC logging options -- uncomment to enable -# JVM_OPTS="$JVM_OPTS -XX:+PrintGCDetails" -# JVM_OPTS="$JVM_OPTS -XX:+PrintGCDateStamps" -# JVM_OPTS="$JVM_OPTS -XX:+PrintHeapAtGC" -# JVM_OPTS="$JVM_OPTS -XX:+PrintTenuringDistribution" -# JVM_OPTS="$JVM_OPTS -XX:+PrintGCApplicationStoppedTime" -# JVM_OPTS="$JVM_OPTS -XX:+PrintPromotionFailure" -# JVM_OPTS="$JVM_OPTS -XX:PrintFLSStatistics=1" +# GC logging options +JVM_OPTS="$JVM_OPTS -XX:+PrintGCDetails" +JVM_OPTS="$JVM_OPTS -XX:+PrintGCDateStamps" +JVM_OPTS="$JVM_OPTS -XX:+PrintHeapAtGC" +JVM_OPTS="$JVM_OPTS -XX:+PrintTenuringDistribution" +JVM_OPTS="$JVM_OPTS -XX:+PrintGCApplicationStoppedTime" +JVM_OPTS="$JVM_OPTS -XX:+PrintPromotionFailure" +#JVM_OPTS="$JVM_OPTS -XX:PrintFLSStatistics=1" + +JVM_OPTS="$JVM_OPTS -Xloggc:${CASSANDRA_HOME}/logs/gc.log" +JVM_OPTS="$JVM_OPTS -XX:+UseGCLogFileRotation" +JVM_OPTS="$JVM_OPTS -XX:NumberOfGCLogFiles=10" +JVM_OPTS="$JVM_OPTS -XX:GCLogFileSize=10M" +# if using version before JDK 6u34 or 7u2 use this instead of log rotation # JVM_OPTS="$JVM_OPTS -Xloggc:/var/log/cassandra/gc-`date +%s`.log" -# If you are using JDK 6u34 7u2 or later you can enable GC log rotation -# don't stick the date in the log name if rotation is on. -# JVM_OPTS="$JVM_OPTS -Xloggc:/var/log/cassandra/gc.log" -# JVM_OPTS="$JVM_OPTS -XX:+UseGCLogFileRotation" -# JVM_OPTS="$JVM_OPTS -XX:NumberOfGCLogFiles=10" -# JVM_OPTS="$JVM_OPTS -XX:GCLogFileSize=10M" # uncomment to have Cassandra JVM listen for remote debuggers/profilers on port 1414 # JVM_OPTS="$JVM_OPTS -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=1414" diff --git a/debian/patches/002cassandra_logdir_fix.dpatch b/debian/patches/002cassandra_logdir_fix.dpatch index 8836eb46ff..cca337cca6 100644 --- a/debian/patches/002cassandra_logdir_fix.dpatch +++ b/debian/patches/002cassandra_logdir_fix.dpatch @@ -6,9 +6,9 @@ @DPATCH@ diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' cassandra~/bin/cassandra cassandra/bin/cassandra ---- cassandra~/bin/cassandra 2014-09-15 19:42:28.000000000 -0500 -+++ cassandra/bin/cassandra 2014-09-15 21:15:15.627505503 -0500 -@@ -134,7 +134,7 @@ +--- cassandra~/bin/cassandra 2015-10-27 14:15:10.718076265 -0500 ++++ cassandra/bin/cassandra 2015-10-27 14:23:10.000000000 -0500 +@@ -139,7 +139,7 @@ props="$3" class="$4" cassandra_parms="-Dlogback.configurationFile=logback.xml" @@ -17,3 +17,15 @@ diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' cassandra_parms="$cassandra_parms -Dcassandra.storagedir=$cassandra_storagedir" if [ "x$pidpath" != "x" ]; then +diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' cassandra~/conf/cassandra-env.sh cassandra/conf/cassandra-env.sh +--- cassandra~/conf/cassandra-env.sh 2015-10-27 14:20:22.990840135 -0500 ++++ cassandra/conf/cassandra-env.sh 2015-10-27 14:24:03.210202234 -0500 +@@ -288,7 +288,7 @@ + JVM_OPTS="$JVM_OPTS -XX:+PrintPromotionFailure" + #JVM_OPTS="$JVM_OPTS -XX:PrintFLSStatistics=1" + +-JVM_OPTS="$JVM_OPTS -Xloggc:${CASSANDRA_HOME}/logs/gc.log" ++JVM_OPTS="$JVM_OPTS -Xloggc:/var/log/cassandra/gc.log" + JVM_OPTS="$JVM_OPTS -XX:+UseGCLogFileRotation" + JVM_OPTS="$JVM_OPTS -XX:NumberOfGCLogFiles=10" + JVM_OPTS="$JVM_OPTS -XX:GCLogFileSize=10M" From 3e45fa1ab521bd50eb247f58daa2bfa76c6ab4e5 Mon Sep 17 00:00:00 2001 From: Ariel Weisberg Date: Tue, 29 Dec 2015 14:33:26 -0500 Subject: [PATCH 3/3] Enable GC logging by default (3.0 version) patch by Chris Lohfink; reviewed by aweisberg for CASSANDRA-10140 --- CHANGES.txt | 1 + NEWS.txt | 2 ++ conf/cassandra-env.ps1 | 3 +++ conf/cassandra-env.sh | 5 ++++- conf/jvm.options | 18 +++++++++--------- debian/patches/002cassandra_logdir_fix.dpatch | 18 +++++++++++++++--- 6 files changed, 34 insertions(+), 13 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 4b5610e6c5..103ae05ba5 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -11,6 +11,7 @@ * (Hadoop) Close Clusters and Sessions in Hadoop Input/Output classes (CASSANDRA-10837) * Fix sstableloader not working with upper case keyspace name (CASSANDRA-10806) Merged from 2.2: + * Enable GC logging by default (CASSANDRA-10140) * Optimize pending range computation (CASSANDRA-9258) * Skip commit log and saved cache directories in SSTable version startup check (CASSANDRA-10902) * drop/alter user should be case sensitive (CASSANDRA-10817) diff --git a/NEWS.txt b/NEWS.txt index 8a03e14717..26a83a90fc 100644 --- a/NEWS.txt +++ b/NEWS.txt @@ -32,6 +32,8 @@ Upgrading - Custom index implementation should be aware that the method Indexer::indexes() has been removed as its contract was misleading and all custom implementation should have almost surely returned true inconditionally for that method. + - GC logging is now enabled by default (you can disable it in the jvm.options + file if you prefer). 3.0 diff --git a/conf/cassandra-env.ps1 b/conf/cassandra-env.ps1 index a38429e1f5..5eefb04873 100644 --- a/conf/cassandra-env.ps1 +++ b/conf/cassandra-env.ps1 @@ -333,6 +333,9 @@ Function SetCassandraEnvironment 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" + # Read user-defined JVM options from jvm.options file $content = Get-Content "$env:CASSANDRA_CONF\jvm.options" for ($i = 0; $i -lt $content.Count; $i++) diff --git a/conf/cassandra-env.sh b/conf/cassandra-env.sh index ef164e8347..f32280384e 100644 --- a/conf/cassandra-env.sh +++ b/conf/cassandra-env.sh @@ -33,7 +33,7 @@ calculate_heap_sizes() Darwin) system_memory_in_bytes=`sysctl hw.memsize | awk '{print $2}'` system_memory_in_mb=`expr $system_memory_in_bytes / 1024 / 1024` - system_cpu_cores=`sysctl hw.ncpu | awk '{print $2}'` + ;; *) # assume reasonable defaults for e.g. a modern desktop or @@ -156,6 +156,9 @@ 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. diff --git a/conf/jvm.options b/conf/jvm.options index c5d3d95ed1..a7b3bd87f3 100644 --- a/conf/jvm.options +++ b/conf/jvm.options @@ -95,14 +95,14 @@ ### GC logging options -- uncomment to enable -#-XX:+PrintGCDetails -#-XX:+PrintGCDateStamps -#-XX:+PrintHeapAtGC -#-XX:+PrintTenuringDistribution -#-XX:+PrintGCApplicationStoppedTime -#-XX:+PrintPromotionFailure +-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 +-XX:+UseGCLogFileRotation +-XX:NumberOfGCLogFiles=10 +-XX:GCLogFileSize=10M diff --git a/debian/patches/002cassandra_logdir_fix.dpatch b/debian/patches/002cassandra_logdir_fix.dpatch index 8836eb46ff..87387b9c67 100644 --- a/debian/patches/002cassandra_logdir_fix.dpatch +++ b/debian/patches/002cassandra_logdir_fix.dpatch @@ -6,9 +6,9 @@ @DPATCH@ diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' cassandra~/bin/cassandra cassandra/bin/cassandra ---- cassandra~/bin/cassandra 2014-09-15 19:42:28.000000000 -0500 -+++ cassandra/bin/cassandra 2014-09-15 21:15:15.627505503 -0500 -@@ -134,7 +134,7 @@ +--- cassandra~/bin/cassandra 2015-10-27 14:35:22.000000000 -0500 ++++ cassandra/bin/cassandra 2015-10-27 14:41:38.000000000 -0500 +@@ -139,7 +139,7 @@ props="$3" class="$4" cassandra_parms="-Dlogback.configurationFile=logback.xml" @@ -17,3 +17,15 @@ diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' cassandra_parms="$cassandra_parms -Dcassandra.storagedir=$cassandra_storagedir" if [ "x$pidpath" != "x" ]; then +diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' cassandra~/conf/cassandra-env.sh cassandra/conf/cassandra-env.sh +--- cassandra~/conf/cassandra-env.sh 2015-10-27 14:40:39.000000000 -0500 ++++ cassandra/conf/cassandra-env.sh 2015-10-27 14:42:40.647449856 -0500 +@@ -204,7 +204,7 @@ + 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" ++JVM_OPTS="$JVM_OPTS -Xloggc:/var/log/cassandra/gc.log" + + # Here we create the arguments that will get passed to the jvm when + # starting cassandra.