cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yu...@apache.org
Subject [03/15] cassandra git commit: Backport CASSANDRA-10679
Date Tue, 22 Mar 2016 21:10:51 GMT
Backport CASSANDRA-10679

patch by yukim; reviewed by Jeremiah Jordan for CASSANDRA-9598


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

Branch: refs/heads/trunk
Commit: 42644c32401f35d2c4830773ef6a2b690bb21993
Parents: 41bb4bc
Author: Jeremiah D Jordan <jeremiah@datastax.com>
Authored: Wed Dec 2 10:48:27 2015 -0600
Committer: Yuki Morishita <yukim@apache.org>
Committed: Tue Mar 22 15:56:06 2016 -0500

----------------------------------------------------------------------
 CHANGES.txt                                     |  1 +
 bin/cassandra-cli                               | 20 ++++++--
 bin/nodetool                                    | 38 ++++++++-------
 bin/sstablekeys                                 | 21 +++++---
 bin/sstableloader                               | 13 +++--
 bin/sstablescrub                                |  7 ++-
 bin/sstableupgrade                              | 24 ++++++----
 .../apache/cassandra/tools/SSTableExport.java   |  1 +
 tools/bin/cassandra-stress                      | 37 +++++++++------
 tools/bin/cassandra-stressd                     | 50 ++++++++++----------
 tools/bin/json2sstable                          | 19 ++++++--
 tools/bin/sstable2json                          | 20 +++++---
 tools/bin/sstableexpiredblockers                | 10 +++-
 tools/bin/sstablelevelreset                     | 36 +++++++++-----
 tools/bin/sstablemetadata                       | 22 ++++++---
 tools/bin/sstableofflinerelevel                 | 10 +++-
 tools/bin/sstablerepairedset                    | 49 ++++++++++++-------
 tools/bin/sstablesplit                          | 29 ++++++++----
 18 files changed, 263 insertions(+), 144 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/42644c32/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 04c9204..5f01114 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 2.1.14
+ * Backport CASSANDRA-10679 (CASSANDRA-9598)
  * Don't do defragmentation if reading from repaired sstables (CASSANDRA-10342)
  * Fix streaming_socket_timeout_in_ms not enforced (CASSANDRA-11286)
  * Avoid dropping message too quickly due to missing unit conversion (CASSANDRA-11302)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/42644c32/bin/cassandra-cli
----------------------------------------------------------------------
diff --git a/bin/cassandra-cli b/bin/cassandra-cli
index a2696da..88c9d2f 100755
--- a/bin/cassandra-cli
+++ b/bin/cassandra-cli
@@ -17,11 +17,11 @@
 # limitations under the License.
 
 if [ "x$CASSANDRA_INCLUDE" = "x" ]; then
-    for include in "`dirname "$0"`/cassandra.in.sh" \
-                   "$HOME/.cassandra.in.sh" \
-                   /usr/share/cassandra/cassandra.in.sh \
+    for include in /usr/share/cassandra/cassandra.in.sh \
                    /usr/local/share/cassandra/cassandra.in.sh \
-                   /opt/cassandra/cassandra.in.sh; do
+                   /opt/cassandra/cassandra.in.sh \
+                   "$HOME/.cassandra.in.sh" \
+                   "`dirname "$0"`/cassandra.in.sh"; do
         if [ -r "$include" ]; then
             . "$include"
             break
@@ -38,14 +38,24 @@ 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
     echo "You must set the CLASSPATH var" >&2
     exit 1
 fi
 
-"$JAVA" -ea -cp "$CLASSPATH" -Xmx256M \
+if [ "x$MAX_HEAP_SIZE" = "x" ]; then
+    MAX_HEAP_SIZE="256M"
+fi
+
+"$JAVA" $JAVA_AGENT -ea -cp "$CLASSPATH" $JVM_OPTS -Xmx$MAX_HEAP_SIZE \
         -Dcassandra.storagedir="$cassandra_storagedir" \
         -Dlogback.configurationFile=logback-tools.xml \
+        $JVM_ARGS \
         org.apache.cassandra.cli.CliMain "$@"
 
 # vi:ai sw=4 ts=4 tw=0 et

http://git-wip-us.apache.org/repos/asf/cassandra/blob/42644c32/bin/nodetool
----------------------------------------------------------------------
diff --git a/bin/nodetool b/bin/nodetool
index d211459..0ea078f 100755
--- a/bin/nodetool
+++ b/bin/nodetool
@@ -1,4 +1,5 @@
 #!/bin/sh
+
 # Licensed to the Apache Software Foundation (ASF) under one
 # or more contributor license agreements.  See the NOTICE file
 # distributed with this work for additional information
@@ -22,11 +23,11 @@ if [ "`basename "$0"`" = 'nodeprobe' ]; then
 fi
 
 if [ "x$CASSANDRA_INCLUDE" = "x" ]; then
-    for include in "`dirname "$0"`/cassandra.in.sh" \
-                   "$HOME/.cassandra.in.sh" \
-                   /usr/share/cassandra/cassandra.in.sh \
+    for include in /usr/share/cassandra/cassandra.in.sh \
                    /usr/local/share/cassandra/cassandra.in.sh \
-                   /opt/cassandra/cassandra.in.sh; do
+                   /opt/cassandra/cassandra.in.sh \
+                   "$HOME/.cassandra.in.sh" \
+                   "`dirname "$0"`/cassandra.in.sh"; do
         if [ -r "$include" ]; then
             . "$include"
             break
@@ -43,6 +44,11 @@ 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
     echo "You must set the CASSANDRA_CONF and CLASSPATH vars" >&2
     exit 1
@@ -50,7 +56,9 @@ fi
 
 # Run cassandra-env.sh to pick up JMX_PORT
 if [ -f "$CASSANDRA_CONF/cassandra-env.sh" ]; then
+    JVM_OPTS_SAVE=$JVM_OPTS
     . "$CASSANDRA_CONF/cassandra-env.sh"
+    JVM_OPTS=$JVM_OPTS_SAVE
 fi
 
 # JMX Port passed via cmd line args (-p 9999 / --port 9999 / --port=9999)
@@ -90,20 +98,14 @@ do
   shift
 done
 
-# Special-case path variables.
-case "`uname`" in
-    CYGWIN*) 
-        CLASSPATH="`cygpath -p -w "$CLASSPATH"`"
-        CASSANDRA_CONF="`cygpath -p -w "$CASSANDRA_CONF"`"
-    ;;
-esac
+if [ "x$MAX_HEAP_SIZE" = "x" ]; then
+    MAX_HEAP_SIZE="128m"
+fi
 
-"$JAVA" $JAVA_AGENT -cp "$CLASSPATH" \
-      -Xmx128m \
-      -Dcassandra.storagedir="$cassandra_storagedir" \
-      -Dlogback.configurationFile=logback-tools.xml \
-      -Dstorage-config="$CASSANDRA_CONF" \
-      $JVM_ARGS \
-      org.apache.cassandra.tools.NodeTool -p $JMX_PORT $ARGS
+"$JAVA" $JAVA_AGENT -ea -cp "$CLASSPATH" $JVM_OPTS -Xmx$MAX_HEAP_SIZE \
+        -Dcassandra.storagedir="$cassandra_storagedir" \
+        -Dlogback.configurationFile=logback-tools.xml \
+        $JVM_ARGS \
+        org.apache.cassandra.tools.NodeTool -p $JMX_PORT $ARGS
 
 # vi:ai sw=4 ts=4 tw=0 et

http://git-wip-us.apache.org/repos/asf/cassandra/blob/42644c32/bin/sstablekeys
----------------------------------------------------------------------
diff --git a/bin/sstablekeys b/bin/sstablekeys
index 77d2e64..55b72d9 100755
--- a/bin/sstablekeys
+++ b/bin/sstablekeys
@@ -17,11 +17,11 @@
 # limitations under the License.
 
 if [ "x$CASSANDRA_INCLUDE" = "x" ]; then
-    for include in "`dirname "$0"`/cassandra.in.sh" \
-                   "$HOME/.cassandra.in.sh" \
-                   /usr/share/cassandra/cassandra.in.sh \
+    for include in /usr/share/cassandra/cassandra.in.sh \
                    /usr/local/share/cassandra/cassandra.in.sh \
-                   /opt/cassandra/cassandra.in.sh; do
+                   /opt/cassandra/cassandra.in.sh \
+                   "$HOME/.cassandra.in.sh" \
+                   "`dirname "$0"`/cassandra.in.sh"; do
         if [ -r "$include" ]; then
             . "$include"
             break
@@ -31,7 +31,6 @@ elif [ -r "$CASSANDRA_INCLUDE" ]; then
     . "$CASSANDRA_INCLUDE"
 fi
 
-
 # Use JAVA_HOME if set, otherwise look for java in PATH
 if [ -x "$JAVA_HOME/bin/java" ]; then
     JAVA="$JAVA_HOME/bin/java"
@@ -39,16 +38,26 @@ 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
     echo "You must set the CLASSPATH var" >&2
     exit 1
 fi
+
+if [ "x$MAX_HEAP_SIZE" = "x" ]; then
+    MAX_HEAP_SIZE="256M"
+fi
+
 if [ $# -eq "0" ]; then
     echo "Usage: `basename "$0"` <sstable>"
     exit 2
 fi
 
-"$JAVA" $JAVA_AGENT -cp "$CLASSPATH" $JVM_OPTS -Dstorage-config="$CASSANDRA_CONF" \
+"$JAVA" $JAVA_AGENT -ea -cp "$CLASSPATH" $JVM_OPTS -Xmx$MAX_HEAP_SIZE \
         -Dcassandra.storagedir="$cassandra_storagedir" \
         -Dlogback.configurationFile=logback-tools.xml \
         org.apache.cassandra.tools.SSTableExport "$@" -e

http://git-wip-us.apache.org/repos/asf/cassandra/blob/42644c32/bin/sstableloader
----------------------------------------------------------------------
diff --git a/bin/sstableloader b/bin/sstableloader
index 67829b8..b6a6d83 100755
--- a/bin/sstableloader
+++ b/bin/sstableloader
@@ -17,11 +17,11 @@
 # limitations under the License.
 
 if [ "x$CASSANDRA_INCLUDE" = "x" ]; then
-    for include in "`dirname "$0"`/cassandra.in.sh" \
-                   "$HOME/.cassandra.in.sh" \
-                   /usr/share/cassandra/cassandra.in.sh \
+    for include in /usr/share/cassandra/cassandra.in.sh \
                    /usr/local/share/cassandra/cassandra.in.sh \
-                   /opt/cassandra/cassandra.in.sh; do
+                   /opt/cassandra/cassandra.in.sh \
+                   "$HOME/.cassandra.in.sh" \
+                   "`dirname "$0"`/cassandra.in.sh"; do
         if [ -r "$include" ]; then
             . "$include"
             break
@@ -38,6 +38,11 @@ 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
     echo "You must set the CLASSPATH var" >&2
     exit 1

http://git-wip-us.apache.org/repos/asf/cassandra/blob/42644c32/bin/sstablescrub
----------------------------------------------------------------------
diff --git a/bin/sstablescrub b/bin/sstablescrub
index ea784ef..58bd21b 100755
--- a/bin/sstablescrub
+++ b/bin/sstablescrub
@@ -20,7 +20,7 @@ if [ "x$CASSANDRA_INCLUDE" = "x" ]; then
     for include in /usr/share/cassandra/cassandra.in.sh \
                    /usr/local/share/cassandra/cassandra.in.sh \
                    /opt/cassandra/cassandra.in.sh \
-                   ~/.cassandra.in.sh \
+                   "$HOME/.cassandra.in.sh" \
                    "`dirname "$0"`/cassandra.in.sh"; do
         if [ -r "$include" ]; then
             . "$include"
@@ -38,6 +38,11 @@ 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
     echo "You must set the CLASSPATH var" >&2
     exit 1

http://git-wip-us.apache.org/repos/asf/cassandra/blob/42644c32/bin/sstableupgrade
----------------------------------------------------------------------
diff --git a/bin/sstableupgrade b/bin/sstableupgrade
index 91fa422..a722cdc 100755
--- a/bin/sstableupgrade
+++ b/bin/sstableupgrade
@@ -20,22 +20,27 @@ if [ "x$CASSANDRA_INCLUDE" = "x" ]; then
     for include in /usr/share/cassandra/cassandra.in.sh \
                    /usr/local/share/cassandra/cassandra.in.sh \
                    /opt/cassandra/cassandra.in.sh \
-                   ~/.cassandra.in.sh \
-                   `dirname $0`/cassandra.in.sh; do
-        if [ -r $include ]; then
-            . $include
+                   "$HOME/.cassandra.in.sh" \
+                   "`dirname "$0"`/cassandra.in.sh"; do
+        if [ -r "$include" ]; then
+            . "$include"
             break
         fi
     done
-elif [ -r $CASSANDRA_INCLUDE ]; then
-    . $CASSANDRA_INCLUDE
+elif [ -r "$CASSANDRA_INCLUDE" ]; then
+    . "$CASSANDRA_INCLUDE"
 fi
 
 # Use JAVA_HOME if set, otherwise look for java in PATH
-if [ -x $JAVA_HOME/bin/java ]; then
-    JAVA=$JAVA_HOME/bin/java
+if [ -x "$JAVA_HOME/bin/java" ]; then
+    JAVA="$JAVA_HOME/bin/java"
 else
-    JAVA=`which java`
+    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
@@ -53,4 +58,3 @@ fi
         org.apache.cassandra.tools.StandaloneUpgrader "$@"
 
 # vi:ai sw=4 ts=4 tw=0 et
-

http://git-wip-us.apache.org/repos/asf/cassandra/blob/42644c32/src/java/org/apache/cassandra/tools/SSTableExport.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/tools/SSTableExport.java b/src/java/org/apache/cassandra/tools/SSTableExport.java
index a90f405..d5c77c1 100644
--- a/src/java/org/apache/cassandra/tools/SSTableExport.java
+++ b/src/java/org/apache/cassandra/tools/SSTableExport.java
@@ -429,6 +429,7 @@ public class SSTableExport
                                              ssTableFileName, descriptor.ksname));
             System.exit(1);
         }
+        Keyspace.setInitialized();
         Keyspace keyspace = Keyspace.open(descriptor.ksname);
 
         // Make it works for indexes too - find parent cf if necessary

http://git-wip-us.apache.org/repos/asf/cassandra/blob/42644c32/tools/bin/cassandra-stress
----------------------------------------------------------------------
diff --git a/tools/bin/cassandra-stress b/tools/bin/cassandra-stress
index 14fbd09..1ffb598 100755
--- a/tools/bin/cassandra-stress
+++ b/tools/bin/cassandra-stress
@@ -17,24 +17,25 @@
 # limitations under the License.
 
 if [ "x$CASSANDRA_INCLUDE" = "x" ]; then
-    for include in "`dirname $0`/cassandra.in.sh" \
-                   "$HOME/.cassandra.in.sh" \
-                   /usr/share/cassandra/cassandra.in.sh \
+    for include in /usr/share/cassandra/cassandra.in.sh \
                    /usr/local/share/cassandra/cassandra.in.sh \
-                   /opt/cassandra/cassandra.in.sh; do
-        if [ -r $include ]; then
-            . $include
+                   /opt/cassandra/cassandra.in.sh \
+                   "$HOME/.cassandra.in.sh" \
+                   "`dirname "$0"`/cassandra.in.sh"; do
+        if [ -r "$include" ]; then
+            . "$include"
             break
         fi
     done
-elif [ -r $CASSANDRA_INCLUDE ]; then
-    . $CASSANDRA_INCLUDE
+elif [ -r "$CASSANDRA_INCLUDE" ]; then
+    . "$CASSANDRA_INCLUDE"
 fi
 
-if [ -x $JAVA_HOME/bin/java ]; then
-    JAVA=$JAVA_HOME/bin/java
+# 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`
+    JAVA="`which java`"
 fi
 
 if [ "x$JAVA" = "x" ]; then
@@ -42,6 +43,14 @@ if [ "x$JAVA" = "x" ]; then
     exit 1
 fi
 
-"$JAVA" -server -ea -cp "$CLASSPATH" \
-      -Dcassandra.storagedir="$cassandra_storagedir" \
-      org.apache.cassandra.stress.Stress $@
+if [ -z "$CLASSPATH" ]; then
+    echo "You must set the CLASSPATH var" >&2
+    exit 1
+fi
+
+"$JAVA" -server -ea -cp "$CLASSPATH" $JVM_OPTS \
+        -Dcassandra.storagedir="$cassandra_storagedir" \
+        -Dlogback.configurationFile=logback-tools.xml \
+         org.apache.cassandra.stress.Stress $@
+
+# vi:ai sw=4 ts=4 tw=0 et

http://git-wip-us.apache.org/repos/asf/cassandra/blob/42644c32/tools/bin/cassandra-stressd
----------------------------------------------------------------------
diff --git a/tools/bin/cassandra-stressd b/tools/bin/cassandra-stressd
index 50dedee..229ba0b 100755
--- a/tools/bin/cassandra-stressd
+++ b/tools/bin/cassandra-stressd
@@ -17,31 +17,26 @@
 # limitations under the License.
 
 DESC="Cassandra Stress Test Daemon"
-if [ "x$CASSANDRA_INCLUDE" = "x" ]; then 
-    for include in "`dirname $0`/cassandra.in.sh" \
-                   "$HOME/.cassandra.in.sh" \
-                   /usr/share/cassandra/cassandra.in.sh \
+if [ "x$CASSANDRA_INCLUDE" = "x" ]; then
+    for include in /usr/share/cassandra/cassandra.in.sh \
                    /usr/local/share/cassandra/cassandra.in.sh \
-                   /opt/cassandra/cassandra.in.sh; do
-        if [ -r $include ]; then 
-            . $include
-            break   
-        fi      
-    done    
-elif [ -r $CASSANDRA_INCLUDE ]; then 
-    . $CASSANDRA_INCLUDE
-fi
-
-if [ -x $JAVA_HOME/bin/java ]; then 
-    JAVA=$JAVA_HOME/bin/java
-else
-    JAVA=`which java`
+                   /opt/cassandra/cassandra.in.sh \
+                   "$HOME/.cassandra.in.sh" \
+                   "`dirname "$0"`/cassandra.in.sh"; do
+        if [ -r "$include" ]; then
+            . "$include"
+            break
+        fi
+    done
+elif [ -r "$CASSANDRA_INCLUDE" ]; then
+    . "$CASSANDRA_INCLUDE"
 fi
 
-if [ -x $JAVA_HOME/bin/java ]; then
-    JAVA=$JAVA_HOME/bin/java
+# 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`
+    JAVA="`which java`"
 fi
 
 if [ "x$JAVA" = "x" ]; then
@@ -49,12 +44,18 @@ if [ "x$JAVA" = "x" ]; then
     exit 1
 fi
 
+if [ -z "$CLASSPATH" ]; then
+    echo "You must set the CLASSPATH var" >&2
+    exit 1
+fi
+
 case "$1" in
   start)
     echo "Starting $DESC: "
-    "$JAVA" -server -cp "$CLASSPATH" \
-          -Dcassandra.storagedir="$cassandra_storagedir" \
-          org.apache.cassandra.stress.StressServer $@ 1> ./stressd.out.log 2> ./stressd.err.log
&
+    "$JAVA" -server -cp "$CLASSPATH" $JVM_OPTS \
+            -Dcassandra.storagedir="$cassandra_storagedir" \
+            -Dlogback.configurationFile=logback-tools.xml \
+            org.apache.cassandra.stress.StressServer $@ 1> ./stressd.out.log 2> ./stressd.err.log
&
     echo $! > ./stressd.pid
     echo "done."
   ;;
@@ -86,3 +87,4 @@ case "$1" in
   ;;
 esac
 
+# vi:ai sw=4 ts=4 tw=0 et

http://git-wip-us.apache.org/repos/asf/cassandra/blob/42644c32/tools/bin/json2sstable
----------------------------------------------------------------------
diff --git a/tools/bin/json2sstable b/tools/bin/json2sstable
index a0278d4..a58a785 100755
--- a/tools/bin/json2sstable
+++ b/tools/bin/json2sstable
@@ -17,11 +17,11 @@
 # limitations under the License.
 
 if [ "x$CASSANDRA_INCLUDE" = "x" ]; then
-    for include in "`dirname "$0"`/cassandra.in.sh" \
-                   "$HOME/.cassandra.in.sh" \
-                   /usr/share/cassandra/cassandra.in.sh \
+    for include in /usr/share/cassandra/cassandra.in.sh \
                    /usr/local/share/cassandra/cassandra.in.sh \
-                   /opt/cassandra/cassandra.in.sh; do
+                   /opt/cassandra/cassandra.in.sh \
+                   "$HOME/.cassandra.in.sh" \
+                   "`dirname "$0"`/cassandra.in.sh"; do
         if [ -r "$include" ]; then
             . "$include"
             break
@@ -38,12 +38,21 @@ 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
     echo "You must set the CLASSPATH var" >&2
     exit 1
 fi
 
-"$JAVA" $JAVA_AGENT -cp "$CLASSPATH" $JVM_OPTS -Dstorage-config="$CASSANDRA_CONF" \
+if [ "x$MAX_HEAP_SIZE" = "x" ]; then
+    MAX_HEAP_SIZE="256M"
+fi
+
+"$JAVA" $JAVA_AGENT -ea -cp "$CLASSPATH" $JVM_OPTS -Xmx$MAX_HEAP_SIZE \
         -Dcassandra.storagedir="$cassandra_storagedir" \
         -Dlogback.configurationFile=logback-tools.xml \
         org.apache.cassandra.tools.SSTableImport "$@"

http://git-wip-us.apache.org/repos/asf/cassandra/blob/42644c32/tools/bin/sstable2json
----------------------------------------------------------------------
diff --git a/tools/bin/sstable2json b/tools/bin/sstable2json
index 7eeb708..6bbbfc6 100755
--- a/tools/bin/sstable2json
+++ b/tools/bin/sstable2json
@@ -17,11 +17,11 @@
 # limitations under the License.
 
 if [ "x$CASSANDRA_INCLUDE" = "x" ]; then
-    for include in "`dirname "$0"`/cassandra.in.sh" \
-                   "$HOME/.cassandra.in.sh" \
-                   /usr/share/cassandra/cassandra.in.sh \
+    for include in /usr/share/cassandra/cassandra.in.sh \
                    /usr/local/share/cassandra/cassandra.in.sh \
-                   /opt/cassandra/cassandra.in.sh; do
+                   /opt/cassandra/cassandra.in.sh \
+                   "$HOME/.cassandra.in.sh" \
+                   "`dirname "$0"`/cassandra.in.sh"; do
         if [ -r "$include" ]; then
             . "$include"
             break
@@ -31,7 +31,6 @@ elif [ -r "$CASSANDRA_INCLUDE" ]; then
     . "$CASSANDRA_INCLUDE"
 fi
 
-
 # Use JAVA_HOME if set, otherwise look for java in PATH
 if [ -x "$JAVA_HOME/bin/java" ]; then
     JAVA="$JAVA_HOME/bin/java"
@@ -39,12 +38,21 @@ 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
     echo "You must set the CLASSPATH var" >&2
     exit 1
 fi
 
-"$JAVA" $JAVA_AGENT -cp "$CLASSPATH" $JVM_OPTS -Dstorage-config="$CASSANDRA_CONF" \
+if [ "x$MAX_HEAP_SIZE" = "x" ]; then
+    MAX_HEAP_SIZE="256M"
+fi
+
+"$JAVA" $JAVA_AGENT -ea -cp "$CLASSPATH" $JVM_OPTS -Xmx$MAX_HEAP_SIZE \
         -Dcassandra.storagedir="$cassandra_storagedir" \
         -Dlogback.configurationFile=logback-tools.xml \
         org.apache.cassandra.tools.SSTableExport "$@"

http://git-wip-us.apache.org/repos/asf/cassandra/blob/42644c32/tools/bin/sstableexpiredblockers
----------------------------------------------------------------------
diff --git a/tools/bin/sstableexpiredblockers b/tools/bin/sstableexpiredblockers
index 0027208..cefdfe3 100755
--- a/tools/bin/sstableexpiredblockers
+++ b/tools/bin/sstableexpiredblockers
@@ -20,7 +20,7 @@ if [ "x$CASSANDRA_INCLUDE" = "x" ]; then
     for include in /usr/share/cassandra/cassandra.in.sh \
                    /usr/local/share/cassandra/cassandra.in.sh \
                    /opt/cassandra/cassandra.in.sh \
-                   ~/.cassandra.in.sh \
+                   "$HOME/.cassandra.in.sh" \
                    "`dirname "$0"`/cassandra.in.sh"; do
         if [ -r "$include" ]; then
             . "$include"
@@ -38,6 +38,11 @@ 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
     echo "You must set the CLASSPATH var" >&2
     exit 1
@@ -47,8 +52,9 @@ if [ "x$MAX_HEAP_SIZE" = "x" ]; then
     MAX_HEAP_SIZE="256M"
 fi
 
-"$JAVA" $JAVA_AGENT -ea -cp "$CLASSPATH" -Xmx$MAX_HEAP_SIZE \
+"$JAVA" $JAVA_AGENT -ea -cp "$CLASSPATH" $JVM_OPTS -Xmx$MAX_HEAP_SIZE \
         -Dcassandra.storagedir="$cassandra_storagedir" \
         -Dlogback.configurationFile=logback-tools.xml \
         org.apache.cassandra.tools.SSTableExpiredBlockers "$@"
 
+# vi:ai sw=4 ts=4 tw=0 et

http://git-wip-us.apache.org/repos/asf/cassandra/blob/42644c32/tools/bin/sstablelevelreset
----------------------------------------------------------------------
diff --git a/tools/bin/sstablelevelreset b/tools/bin/sstablelevelreset
index 1756a21..8191f3d 100755
--- a/tools/bin/sstablelevelreset
+++ b/tools/bin/sstablelevelreset
@@ -17,26 +17,30 @@
 # limitations under the License.
 
 if [ "x$CASSANDRA_INCLUDE" = "x" ]; then
-    for include in "`dirname $0`/cassandra.in.sh" \
-                   "$HOME/.cassandra.in.sh" \
-                   /usr/share/cassandra/cassandra.in.sh \
+    for include in /usr/share/cassandra/cassandra.in.sh \
                    /usr/local/share/cassandra/cassandra.in.sh \
-                   /opt/cassandra/cassandra.in.sh; do
-        if [ -r $include ]; then
-            . $include
+                   /opt/cassandra/cassandra.in.sh \
+                   "$HOME/.cassandra.in.sh" \
+                   "`dirname "$0"`/cassandra.in.sh"; do
+        if [ -r "$include" ]; then
+            . "$include"
             break
         fi
     done
-elif [ -r $CASSANDRA_INCLUDE ]; then
-    . $CASSANDRA_INCLUDE
+elif [ -r "$CASSANDRA_INCLUDE" ]; then
+    . "$CASSANDRA_INCLUDE"
 fi
 
-
 # Use JAVA_HOME if set, otherwise look for java in PATH
-if [ -x $JAVA_HOME/bin/java ]; then
-    JAVA=$JAVA_HOME/bin/java
+if [ -x "$JAVA_HOME/bin/java" ]; then
+    JAVA="$JAVA_HOME/bin/java"
 else
-    JAVA=`which java`
+    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
@@ -44,7 +48,13 @@ if [ -z "$CLASSPATH" ]; then
     exit 1
 fi
 
-"$JAVA" -cp "$CLASSPATH"  -Dstorage-config=$CASSANDRA_CONF \
+if [ "x$MAX_HEAP_SIZE" = "x" ]; then
+    MAX_HEAP_SIZE="256M"
+fi
+
+"$JAVA" $JAVA_AGENT -ea -cp "$CLASSPATH" $JVM_OPTS -Xmx$MAX_HEAP_SIZE \
         -Dcassandra.storagedir="$cassandra_storagedir" \
         -Dlogback.configurationFile=logback-tools.xml \
         org.apache.cassandra.tools.SSTableLevelResetter "$@"
+
+# vi:ai sw=4 ts=4 tw=0 et

http://git-wip-us.apache.org/repos/asf/cassandra/blob/42644c32/tools/bin/sstablemetadata
----------------------------------------------------------------------
diff --git a/tools/bin/sstablemetadata b/tools/bin/sstablemetadata
index c5ff832..5316869 100755
--- a/tools/bin/sstablemetadata
+++ b/tools/bin/sstablemetadata
@@ -17,11 +17,11 @@
 # limitations under the License.
 
 if [ "x$CASSANDRA_INCLUDE" = "x" ]; then
-    for include in "`dirname "$0"`/cassandra.in.sh" \
-                   "$HOME/.cassandra.in.sh" \
-                   /usr/share/cassandra/cassandra.in.sh \
+    for include in /usr/share/cassandra/cassandra.in.sh \
                    /usr/local/share/cassandra/cassandra.in.sh \
-                   /opt/cassandra/cassandra.in.sh; do
+                   /opt/cassandra/cassandra.in.sh \
+                   "$HOME/.cassandra.in.sh" \
+                   "`dirname "$0"`/cassandra.in.sh"; do
         if [ -r "$include" ]; then
             . "$include"
             break
@@ -31,7 +31,6 @@ elif [ -r "$CASSANDRA_INCLUDE" ]; then
     . "$CASSANDRA_INCLUDE"
 fi
 
-
 # Use JAVA_HOME if set, otherwise look for java in PATH
 if [ -x "$JAVA_HOME/bin/java" ]; then
     JAVA="$JAVA_HOME/bin/java"
@@ -39,12 +38,23 @@ 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
     echo "You must set the CLASSPATH var" >&2
     exit 1
 fi
 
-"$JAVA" -cp "$CLASSPATH" \
+if [ "x$MAX_HEAP_SIZE" = "x" ]; then
+    MAX_HEAP_SIZE="256M"
+fi
+
+"$JAVA" $JAVA_AGENT -ea -cp "$CLASSPATH" $JVM_OPTS -Xmx$MAX_HEAP_SIZE \
         -Dcassandra.storagedir="$cassandra_storagedir" \
         -Dlogback.configurationFile=logback-tools.xml \
         org.apache.cassandra.tools.SSTableMetadataViewer "$@"
+
+# vi:ai sw=4 ts=4 tw=0 et

http://git-wip-us.apache.org/repos/asf/cassandra/blob/42644c32/tools/bin/sstableofflinerelevel
----------------------------------------------------------------------
diff --git a/tools/bin/sstableofflinerelevel b/tools/bin/sstableofflinerelevel
index bfe28a0..a4ba6cb 100755
--- a/tools/bin/sstableofflinerelevel
+++ b/tools/bin/sstableofflinerelevel
@@ -20,7 +20,7 @@ if [ "x$CASSANDRA_INCLUDE" = "x" ]; then
     for include in /usr/share/cassandra/cassandra.in.sh \
                    /usr/local/share/cassandra/cassandra.in.sh \
                    /opt/cassandra/cassandra.in.sh \
-                   ~/.cassandra.in.sh \
+                   "$HOME/.cassandra.in.sh" \
                    "`dirname "$0"`/cassandra.in.sh"; do
         if [ -r "$include" ]; then
             . "$include"
@@ -38,6 +38,11 @@ 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
     echo "You must set the CLASSPATH var" >&2
     exit 1
@@ -47,8 +52,9 @@ if [ "x$MAX_HEAP_SIZE" = "x" ]; then
     MAX_HEAP_SIZE="256M"
 fi
 
-"$JAVA" $JAVA_AGENT -ea -cp "$CLASSPATH" -Xmx$MAX_HEAP_SIZE \
+"$JAVA" $JAVA_AGENT -ea -cp "$CLASSPATH" $JVM_OPTS -Xmx$MAX_HEAP_SIZE \
         -Dcassandra.storagedir="$cassandra_storagedir" \
         -Dlogback.configurationFile=logback-tools.xml \
         org.apache.cassandra.tools.SSTableOfflineRelevel "$@"
 
+# vi:ai sw=4 ts=4 tw=0 et

http://git-wip-us.apache.org/repos/asf/cassandra/blob/42644c32/tools/bin/sstablerepairedset
----------------------------------------------------------------------
diff --git a/tools/bin/sstablerepairedset b/tools/bin/sstablerepairedset
index 1aa30a3..efb8a70 100755
--- a/tools/bin/sstablerepairedset
+++ b/tools/bin/sstablerepairedset
@@ -16,32 +16,45 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-if [ "x$CLASSPATH" = "x" ]; then
-    
-    # execute from the build dir.
-    if [ -d `dirname $0`/../../build/classes ]; then
-        for directory in `dirname $0`/../../build/classes/*; do
-            CLASSPATH=$CLASSPATH:$directory
-        done
-    else
-        if [ -f `dirname $0`/../lib/stress.jar ]; then
-            CLASSPATH=`dirname $0`/../lib/stress.jar
+if [ "x$CASSANDRA_INCLUDE" = "x" ]; then
+    for include in /usr/share/cassandra/cassandra.in.sh \
+                   /usr/local/share/cassandra/cassandra.in.sh \
+                   /opt/cassandra/cassandra.in.sh \
+                   "$HOME/.cassandra.in.sh" \
+                   "`dirname "$0"`/cassandra.in.sh"; do
+        if [ -r "$include" ]; then
+            . "$include"
+            break
         fi
-    fi
-
-    for jar in `dirname $0`/../../lib/*.jar; do
-        CLASSPATH=$CLASSPATH:$jar
     done
+elif [ -r "$CASSANDRA_INCLUDE" ]; then
+    . "$CASSANDRA_INCLUDE"
 fi
 
 # Use JAVA_HOME if set, otherwise look for java in PATH
-if [ -x $JAVA_HOME/bin/java ]; then
-    JAVA=$JAVA_HOME/bin/java
+if [ -x "$JAVA_HOME/bin/java" ]; then
+    JAVA="$JAVA_HOME/bin/java"
 else
-    JAVA=`which java`
+    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
+    echo "You must set the CLASSPATH var" >&2
+    exit 1
+fi
+
+if [ "x$MAX_HEAP_SIZE" = "x" ]; then
+    MAX_HEAP_SIZE="256M"
 fi
 
-$JAVA -cp $CLASSPATH \
+"$JAVA" $JAVA_AGENT -ea -cp "$CLASSPATH" $JVM_OPTS -Xmx$MAX_HEAP_SIZE \
         -Dcassandra.storagedir="$cassandra_storagedir" \
         -Dlogback.configurationFile=logback-tools.xml \
         org.apache.cassandra.tools.SSTableRepairedAtSetter "$@"
+
+# vi:ai sw=4 ts=4 tw=0 et

http://git-wip-us.apache.org/repos/asf/cassandra/blob/42644c32/tools/bin/sstablesplit
----------------------------------------------------------------------
diff --git a/tools/bin/sstablesplit b/tools/bin/sstablesplit
index 51da481..90d91ce 100755
--- a/tools/bin/sstablesplit
+++ b/tools/bin/sstablesplit
@@ -20,22 +20,27 @@ if [ "x$CASSANDRA_INCLUDE" = "x" ]; then
     for include in /usr/share/cassandra/cassandra.in.sh \
                    /usr/local/share/cassandra/cassandra.in.sh \
                    /opt/cassandra/cassandra.in.sh \
-                   ~/.cassandra.in.sh \
-                   `dirname $0`/cassandra.in.sh; do
-        if [ -r $include ]; then
-            . $include
+                   "$HOME/.cassandra.in.sh" \
+                   "`dirname "$0"`/cassandra.in.sh"; do
+        if [ -r "$include" ]; then
+            . "$include"
             break
         fi
     done
-elif [ -r $CASSANDRA_INCLUDE ]; then
-    . $CASSANDRA_INCLUDE
+elif [ -r "$CASSANDRA_INCLUDE" ]; then
+    . "$CASSANDRA_INCLUDE"
 fi
 
 # Use JAVA_HOME if set, otherwise look for java in PATH
-if [ -x $JAVA_HOME/bin/java ]; then
-    JAVA=$JAVA_HOME/bin/java
+if [ -x "$JAVA_HOME/bin/java" ]; then
+    JAVA="$JAVA_HOME/bin/java"
 else
-    JAVA=`which java`
+    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
@@ -43,7 +48,11 @@ if [ -z "$CLASSPATH" ]; then
     exit 1
 fi
 
-"$JAVA" $JAVA_AGENT -ea -cp "$CLASSPATH" $JVM_OPTS -Xmx256M \
+if [ "x$MAX_HEAP_SIZE" = "x" ]; then
+    MAX_HEAP_SIZE="256M"
+fi
+
+"$JAVA" $JAVA_AGENT -ea -cp "$CLASSPATH" $JVM_OPTS -Xmx$MAX_HEAP_SIZE \
         -Dcassandra.storagedir="$cassandra_storagedir" \
         -Dlogback.configurationFile=logback-tools.xml \
         org.apache.cassandra.tools.StandaloneSplitter "$@"


Mime
View raw message