cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r1092435 - /cassandra/branches/cassandra-0.8/tools/stress/src/org/apache/cassandra/stress/Session.java
Date Thu, 14 Apr 2011 18:37:31 GMT
Author: jbellis
Date: Thu Apr 14 18:37:31 2011
New Revision: 1092435

URL: http://svn.apache.org/viewvc?rev=1092435&view=rev
Log:
add default r_f option when using SimpleStrategy

Modified:
    cassandra/branches/cassandra-0.8/tools/stress/src/org/apache/cassandra/stress/Session.java

Modified: cassandra/branches/cassandra-0.8/tools/stress/src/org/apache/cassandra/stress/Session.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.8/tools/stress/src/org/apache/cassandra/stress/Session.java?rev=1092435&r1=1092434&r2=1092435&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.8/tools/stress/src/org/apache/cassandra/stress/Session.java
(original)
+++ cassandra/branches/cassandra-0.8/tools/stress/src/org/apache/cassandra/stress/Session.java
Thu Apr 14 18:37:31 2011
@@ -229,9 +229,6 @@ public class Session
             if (cmd.hasOption("g"))
                 keysPerCall = Integer.parseInt(cmd.getOptionValue("g"));
 
-            if (cmd.hasOption("l"))
-                replicationStrategyOptions.put("replication_factor", String.valueOf(Integer.parseInt(cmd.getOptionValue("l"))));
-
             if (cmd.hasOption("e"))
                 consistencyLevel = ConsistencyLevel.valueOf(cmd.getOptionValue("e").toUpperCase());
 
@@ -241,6 +238,11 @@ public class Session
             if (cmd.hasOption("R"))
                 replicationStrategy = cmd.getOptionValue("R");
 
+            if (cmd.hasOption("l"))
+                replicationStrategyOptions.put("replication_factor", String.valueOf(Integer.parseInt(cmd.getOptionValue("l"))));
+            else if (replicationStrategy.endsWith("SimpleStrategy"))
+                replicationStrategyOptions.put("replication_factor", "1");
+
             if (cmd.hasOption("O"))
             {
                 String[] pairs = StringUtils.split(cmd.getOptionValue("O"), ',');
@@ -421,19 +423,18 @@ public class Session
 
         keyspace.setCf_defs(new ArrayList<CfDef>(Arrays.asList(standardCfDef, superCfDef,
counterCfDef, counterSuperCfDef)));
 
-
         Cassandra.Client client = getClient(false);
 
         try
         {
             client.system_add_keyspace(keyspace);
             out.println(String.format("Created keyspaces. Sleeping %ss for propagation.",
nodes.length));
-
             Thread.sleep(nodes.length * 1000); // seconds
         }
         catch (InvalidRequestException e)
         {
-            out.println(e.getWhy());
+            out.println("Unable to create stress keyspace: " + e.getWhy());
+            System.exit(1);
         }
         catch (Exception e)
         {



Mime
View raw message