Rename stress to cassandra-stress and include in debian packaging patch by Nick Bailey; reviewed by thepaul for CASSANDRA-4256
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/3558e45a Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/3558e45a Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/3558e45a Branch: refs/heads/trunk Commit: 3558e45ab6758072c84272e185f2755e885798e1 Parents: 500c1c0 Author: Sylvain Lebresne <[email protected]> Authored: Mon May 21 19:26:50 2012 +0200 Committer: Sylvain Lebresne <[email protected]> Committed: Mon May 21 19:28:19 2012 +0200 ---------------------------------------------------------------------- CHANGES.txt | 1 + debian/cassandra.install | 1 + debian/rules | 4 + tools/bin/cassandra-stress | 44 ++++++++ tools/bin/cassandra-stress.bat | 31 ++++++ tools/bin/cassandra-stressd | 84 +++++++++++++++ tools/bin/cassandra.in.sh | 42 +++++++ tools/bin/stress | 48 -------- tools/bin/stress.bat | 31 ------ tools/bin/stressd | 84 --------------- tools/stress/README.txt | 14 ++-- .../src/org/apache/cassandra/stress/Stress.java | 2 +- 12 files changed, 215 insertions(+), 171 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/3558e45a/CHANGES.txt ---------------------------------------------------------------------- diff --git a/CHANGES.txt b/CHANGES.txt index cc378fd..4d178d0 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -53,6 +53,7 @@ * fix missing arrayOffset in FBUtilities.hash (CASSANDRA-4250) * (cql3) Add name of parameters in CqlResultSet (CASSANDRA-4242) * (cql3) Correctly validat order by queries (CASSANDRA-4246) + * rename stress to cassandra-stress for saner packaging (CASSANDRA-4256) Merged from 1.0: * Fix super columns bug where cache is not updated (CASSANDRA-4190) * fix maxTimestamp to include row tombstones (CASSANDRA-4116) http://git-wip-us.apache.org/repos/asf/cassandra/blob/3558e45a/debian/cassandra.install ---------------------------------------------------------------------- diff --git a/debian/cassandra.install b/debian/cassandra.install index 33ef6c4..f706bd9 100644 --- a/debian/cassandra.install +++ b/debian/cassandra.install @@ -12,6 +12,7 @@ bin/sstable2json usr/bin bin/sstablekeys usr/bin bin/sstableloader usr/bin bin/cqlsh usr/bin +tools/bin/cassandra-stress usr/bin lib/*.jar usr/share/cassandra/lib lib/*.zip usr/share/cassandra/lib lib/licenses usr/share/doc/cassandra http://git-wip-us.apache.org/repos/asf/cassandra/blob/3558e45a/debian/rules ---------------------------------------------------------------------- diff --git a/debian/rules b/debian/rules index 97e0274..11b78e7 100755 --- a/debian/rules +++ b/debian/rules @@ -45,6 +45,10 @@ install: build dh_install build/apache-cassandra-thrift-$(VERSION).jar \ usr/share/cassandra + # Copy stress jar + dh_install build/tools/lib/stress.jar \ + usr/share/cassandra + dh_link usr/share/cassandra/apache-cassandra-$(VERSION).jar \ usr/share/cassandra/apache-cassandra.jar http://git-wip-us.apache.org/repos/asf/cassandra/blob/3558e45a/tools/bin/cassandra-stress ---------------------------------------------------------------------- diff --git a/tools/bin/cassandra-stress b/tools/bin/cassandra-stress new file mode 100644 index 0000000..9fe2f88 --- /dev/null +++ b/tools/bin/cassandra-stress @@ -0,0 +1,44 @@ +#!/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 +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +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 \ + `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 +else + JAVA=`which java` +fi + +if [ "x$JAVA" = "x" ]; then + echo "Java executable not found (hint: set JAVA_HOME)" >&2 + exit 1 +fi + +$JAVA -server -cp $CLASSPATH org.apache.cassandra.stress.Stress $@ http://git-wip-us.apache.org/repos/asf/cassandra/blob/3558e45a/tools/bin/cassandra-stress.bat ---------------------------------------------------------------------- diff --git a/tools/bin/cassandra-stress.bat b/tools/bin/cassandra-stress.bat new file mode 100644 index 0000000..78e8dbb --- /dev/null +++ b/tools/bin/cassandra-stress.bat @@ -0,0 +1,31 @@ +@REM Licensed to the Apache Software Foundation (ASF) under one or more +@REM contributor license agreements. See the NOTICE file distributed with +@REM this work for additional information regarding copyright ownership. +@REM The ASF licenses this file to You under the Apache License, Version 2.0 +@REM (the "License"); you may not use this file except in compliance with +@REM the License. You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, software +@REM distributed under the License is distributed on an "AS IS" BASIS, +@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@REM See the License for the specific language governing permissions and +@REM limitations under the License. + +@echo off + +if NOT DEFINED CASSANDRA_HOME set CASSANDRA_HOME=%CD%\..\.. +if NOT DEFINED STRESS_HOME set STRESS_HOME=%CD% + +set CLASSPATH="%STRESS_HOME%\..\lib\*.jar" +for %%i in ("%CASSANDRA_HOME%\lib\*.jar") do call :append "%%i" + set CLASSPATH=%CLASSPATH%;"%%i" +goto start + +:append +set CLASSPATH=%CLASSPATH%;%1 +goto :eof + +:start +"%JAVA_HOME%\bin\java" -cp %CLASSPATH% org.apache.cassandra.stress.Stress %* http://git-wip-us.apache.org/repos/asf/cassandra/blob/3558e45a/tools/bin/cassandra-stressd ---------------------------------------------------------------------- diff --git a/tools/bin/cassandra-stressd b/tools/bin/cassandra-stressd new file mode 100644 index 0000000..8d337e5 --- /dev/null +++ b/tools/bin/cassandra-stressd @@ -0,0 +1,84 @@ +#!/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 +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DESC="Cassandra Stress Test Daemon" + +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 + fi + fi + + for jar in `dirname $0`/../../lib/*.jar; do + CLASSPATH=$CLASSPATH:$jar + done +fi + +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 + +case "$1" in + start) + echo "Starting $DESC: " + $JAVA -server -cp $CLASSPATH org.apache.cassandra.stress.StressServer $@ 1> ./stressd.out.log 2> ./stressd.err.log & + echo $! > ./stressd.pid + echo "done." + ;; + + stop) + PID=`cat ./stressd.pid 2> /dev/null` + + if [ "x$PID" = "x" ]; then + echo "$DESC is not running." + else + kill -9 $PID + rm ./stressd.pid + echo "$DESC is stopped." + fi + ;; + + status) + PID=`cat ./stressd.pid 2> /dev/null` + + if [ "x$PID" = "x" ]; then + echo "$DESC is not running." + else + echo "$DESC is running with pid $PID." + fi + ;; + + *) + echo "Usage: $0 start|stop|status [-h <host>]" + ;; +esac + http://git-wip-us.apache.org/repos/asf/cassandra/blob/3558e45a/tools/bin/cassandra.in.sh ---------------------------------------------------------------------- diff --git a/tools/bin/cassandra.in.sh b/tools/bin/cassandra.in.sh new file mode 100644 index 0000000..aad3257 --- /dev/null +++ b/tools/bin/cassandra.in.sh @@ -0,0 +1,42 @@ +# 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 +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +if [ "x$CASSANDRA_HOME" = "x" ]; then + CASSANDRA_HOME=`dirname $0`/../../ +fi + +# The directory where Cassandra's configs live (required) +if [ "x$CASSANDRA_CONF" = "x" ]; then + CASSANDRA_CONF=$CASSANDRA_HOME/conf +fi + +# 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, +# it's just used here in constructing the classpath. +cassandra_bin=$CASSANDRA_HOME/build/classes/main +cassandra_bin=$cassandra_bin:$CASSANDRA_HOME/build/classes/stress +cassandra_bin=$cassandra_bin:$CASSANDRA_HOME/build/classes/thrift +#cassandra_bin=$cassandra_home/build/cassandra.jar + +# JAVA_HOME can optionally be set here +#JAVA_HOME=/usr/local/jdk6 + +# The java classpath (required) +CLASSPATH=$CASSANDRA_CONF:$cassandra_bin + +for jar in $CASSANDRA_HOME/lib/*.jar; do + CLASSPATH=$CLASSPATH:$jar +done http://git-wip-us.apache.org/repos/asf/cassandra/blob/3558e45a/tools/bin/stress ---------------------------------------------------------------------- diff --git a/tools/bin/stress b/tools/bin/stress deleted file mode 100755 index 8c8d22f..0000000 --- a/tools/bin/stress +++ /dev/null @@ -1,48 +0,0 @@ -#!/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 -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# 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 - fi - fi - - for jar in `dirname $0`/../../lib/*.jar; do - CLASSPATH=$CLASSPATH:$jar - done -fi - -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 - -$JAVA -server -cp $CLASSPATH org.apache.cassandra.stress.Stress $@ http://git-wip-us.apache.org/repos/asf/cassandra/blob/3558e45a/tools/bin/stress.bat ---------------------------------------------------------------------- diff --git a/tools/bin/stress.bat b/tools/bin/stress.bat deleted file mode 100755 index 78e8dbb..0000000 --- a/tools/bin/stress.bat +++ /dev/null @@ -1,31 +0,0 @@ -@REM Licensed to the Apache Software Foundation (ASF) under one or more -@REM contributor license agreements. See the NOTICE file distributed with -@REM this work for additional information regarding copyright ownership. -@REM The ASF licenses this file to You under the Apache License, Version 2.0 -@REM (the "License"); you may not use this file except in compliance with -@REM the License. You may obtain a copy of the License at -@REM -@REM http://www.apache.org/licenses/LICENSE-2.0 -@REM -@REM Unless required by applicable law or agreed to in writing, software -@REM distributed under the License is distributed on an "AS IS" BASIS, -@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@REM See the License for the specific language governing permissions and -@REM limitations under the License. - -@echo off - -if NOT DEFINED CASSANDRA_HOME set CASSANDRA_HOME=%CD%\..\.. -if NOT DEFINED STRESS_HOME set STRESS_HOME=%CD% - -set CLASSPATH="%STRESS_HOME%\..\lib\*.jar" -for %%i in ("%CASSANDRA_HOME%\lib\*.jar") do call :append "%%i" - set CLASSPATH=%CLASSPATH%;"%%i" -goto start - -:append -set CLASSPATH=%CLASSPATH%;%1 -goto :eof - -:start -"%JAVA_HOME%\bin\java" -cp %CLASSPATH% org.apache.cassandra.stress.Stress %* http://git-wip-us.apache.org/repos/asf/cassandra/blob/3558e45a/tools/bin/stressd ---------------------------------------------------------------------- diff --git a/tools/bin/stressd b/tools/bin/stressd deleted file mode 100755 index 400ebb0..0000000 --- a/tools/bin/stressd +++ /dev/null @@ -1,84 +0,0 @@ -#!/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 -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -DESC="Stress Test Daemon" - -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 - fi - fi - - for jar in `dirname $0`/../../lib/*.jar; do - CLASSPATH=$CLASSPATH:$jar - done -fi - -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 - -case "$1" in - start) - echo "Starting $DESC: " - $JAVA -server -cp $CLASSPATH org.apache.cassandra.stress.StressServer $@ 1> ./stressd.out.log 2> ./stressd.err.log & - echo $! > ./stressd.pid - echo "done." - ;; - - stop) - PID=`cat ./stressd.pid 2> /dev/null` - - if [ "x$PID" = "x" ]; then - echo "$DESC is not running." - else - kill -9 $PID - rm ./stressd.pid - echo "$DESC is stopped." - fi - ;; - - status) - PID=`cat ./stressd.pid 2> /dev/null` - - if [ "x$PID" = "x" ]; then - echo "$DESC is not running." - else - echo "$DESC is running with pid $PID." - fi - ;; - - *) - echo "Usage: $0 start|stop|status [-h <host>]" - ;; -esac - http://git-wip-us.apache.org/repos/asf/cassandra/blob/3558e45a/tools/stress/README.txt ---------------------------------------------------------------------- diff --git a/tools/stress/README.txt b/tools/stress/README.txt index 4a43a2d..f39a8d7 100644 --- a/tools/stress/README.txt +++ b/tools/stress/README.txt @@ -1,14 +1,14 @@ -stress +cassandra-stress ====== Description ----------- -stress is a tool for benchmarking and load testing a Cassandra +cassandra-stress is a tool for benchmarking and load testing a Cassandra cluster. It is significantly faster than the older py_stress tool. Setup ----- -Run `ant` from the Cassandra source directory, then stress can be invoke from tools/bin/stress +Run `ant` from the Cassandra source directory, then cassandra-stress can be invoke from tools/bin/cassandra-stress Usage ----- @@ -42,7 +42,7 @@ Important options: when switching partioners.) This option sets the number of rows to slice at a time and defaults to 1000. -r or --random: - Only used for reads. By default, stress.py will perform reads on rows + Only used for reads. By default, cassandra-stress will perform reads on rows with a guassian distribution, which will cause some repeats. Setting this option makes the reads completely random instead. -i or --progress-interval: @@ -53,6 +53,6 @@ Remember that you must perform inserts before performing reads or range slices. Examples -------- - * contrib/stress/bin/stress -d 192.168.1.101 # 1M inserts to given host - * contrib/stress/bin/stress -d 192.168.1.101 -o read # 1M reads - * contrib/stress/bin/stress -d 192.168.1.101,192.168.1.102 -n 10000000 # 10M inserts spread across two nodes + * tools/bin/cassandra-stress -d 192.168.1.101 # 1M inserts to given host + * tools/bin/cassandra-stress -d 192.168.1.101 -o read # 1M reads + * tools/bin/cassandra-stress -d 192.168.1.101,192.168.1.102 -n 10000000 # 10M inserts spread across two nodes http://git-wip-us.apache.org/repos/asf/cassandra/blob/3558e45a/tools/stress/src/org/apache/cassandra/stress/Stress.java ---------------------------------------------------------------------- diff --git a/tools/stress/src/org/apache/cassandra/stress/Stress.java b/tools/stress/src/org/apache/cassandra/stress/Stress.java index b490d69..738a1c0 100644 --- a/tools/stress/src/org/apache/cassandra/stress/Stress.java +++ b/tools/stress/src/org/apache/cassandra/stress/Stress.java @@ -100,7 +100,7 @@ public final class Stress */ public static void printHelpMessage() { - System.out.println("Usage: ./bin/stress [options]\n\nOptions:"); + System.out.println("Usage: ./bin/cassandra-stress [options]\n\nOptions:"); for(Object o : Session.availableOptions.getOptions()) {
