cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r1069207 - in /cassandra/branches/cassandra-0.7: CHANGES.txt contrib/stress/src/org/apache/cassandra/contrib/stress/Session.java
Date Thu, 10 Feb 2011 02:54:23 GMT
Author: jbellis
Date: Thu Feb 10 02:54:23 2011
New Revision: 1069207

URL: http://svn.apache.org/viewvc?rev=1069207&view=rev
Log:
add -D option to Stress.java to specify list of nodes in a file
patch by mdennis; reviewed by jbellis for CASSANDRA-2149

Modified:
    cassandra/branches/cassandra-0.7/CHANGES.txt
    cassandra/branches/cassandra-0.7/contrib/stress/src/org/apache/cassandra/contrib/stress/Session.java

Modified: cassandra/branches/cassandra-0.7/CHANGES.txt
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/CHANGES.txt?rev=1069207&r1=1069206&r2=1069207&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7/CHANGES.txt (original)
+++ cassandra/branches/cassandra-0.7/CHANGES.txt Thu Feb 10 02:54:23 2011
@@ -55,6 +55,11 @@
  * page through large rows when exporting to JSON (CASSANDRA-2041)
  * add flush_largest_memtables_at and reduce_cache_sizes_at options
    (CASSANDRA-2142)
+ * add cli 'describe cluster' command (CASSANDRA-2127)
+ * add cli support for setting username/password at 'connect' command 
+   (CASSANDRA-2111)
+ * add -D option to Stress.java to allow reading hosts from a file 
+   (CASSANDRA-2149)
  * bound hints CF throughput between 32M and 256M (CASSANDRA-2148)
 
 

Modified: cassandra/branches/cassandra-0.7/contrib/stress/src/org/apache/cassandra/contrib/stress/Session.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/contrib/stress/src/org/apache/cassandra/contrib/stress/Session.java?rev=1069207&r1=1069206&r2=1069207&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7/contrib/stress/src/org/apache/cassandra/contrib/stress/Session.java
(original)
+++ cassandra/branches/cassandra-0.7/contrib/stress/src/org/apache/cassandra/contrib/stress/Session.java
Thu Feb 10 02:54:23 2011
@@ -17,23 +17,23 @@
  */
 package org.apache.cassandra.contrib.stress;
 
+import java.io.*;
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicIntegerArray;
+import java.util.concurrent.atomic.AtomicLongArray;
+
+import org.apache.commons.cli.*;
+
 import org.apache.cassandra.db.ColumnFamilyType;
 import org.apache.cassandra.thrift.*;
-import org.apache.commons.cli.*;
 import org.apache.thrift.protocol.TBinaryProtocol;
 import org.apache.thrift.transport.TFramedTransport;
 import org.apache.thrift.transport.TSocket;
 import org.apache.thrift.transport.TTransport;
 
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.PrintStream;
-import java.nio.ByteBuffer;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.concurrent.atomic.AtomicIntegerArray;
-import java.util.concurrent.atomic.AtomicLongArray;
-
 public class Session
 {
     // command line options
@@ -53,6 +53,7 @@ public class Session
         availableOptions.addOption("S",  "column-size",          true,   "Size of column
values in bytes, default:34");
         availableOptions.addOption("C",  "cardinality",          true,   "Number of unique
values stored in columns, default:50");
         availableOptions.addOption("d",  "nodes",                true,   "Host nodes (comma
separated), default:locahost");
+        availableOptions.addOption("D",  "nodesfile",            true,   "File containing
host nodes (one per line)");
         availableOptions.addOption("s",  "stdev",                true,   "Standard Deviation
Factor, default:0.1");
         availableOptions.addOption("r",  "random",               false,  "Use random key
generator (STDEV will have no effect), default:false");
         availableOptions.addOption("f",  "file",                 true,   "Write output to
given file");
@@ -130,6 +131,27 @@ public class Session
             if (cmd.hasOption("d"))
                 nodes = cmd.getOptionValue("d").split(",");
 
+            if (cmd.hasOption("D"))
+            {
+                try
+                {
+                    String node = null;
+                    List<String> tmpNodes = new ArrayList<String>();
+                    BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(cmd.getOptionValue("D"))));
+                    while ((node = in.readLine()) != null)
+                    {
+                        if (node.length() > 0)
+                            tmpNodes.add(node);
+                    }
+                    nodes = tmpNodes.toArray(new String[tmpNodes.size()]);
+                    in.close();
+                }
+                catch(IOException ioe)
+                {
+                    throw new RuntimeException(ioe);
+                }
+            }
+
             if (cmd.hasOption("s"))
                 STDev = Float.parseFloat(cmd.getOptionValue("s"));
 



Mime
View raw message