You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by ja...@apache.org on 2014/09/15 18:22:25 UTC

[1/2] git commit: Better error checking of stress profile

Repository: cassandra
Updated Branches:
  refs/heads/trunk 969967cf9 -> 7b5164f39


Better error checking of stress profile

patch by tjake; reviewed by belliottsmith for CASSANDRA-7716


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

Branch: refs/heads/trunk
Commit: b3573f3d3bc8ab18ee82534625868dae12f7234c
Parents: 6bff5a3
Author: Jake Luciani <ja...@apache.org>
Authored: Mon Sep 15 12:20:43 2014 -0400
Committer: Jake Luciani <ja...@apache.org>
Committed: Mon Sep 15 12:20:43 2014 -0400

----------------------------------------------------------------------
 CHANGES.txt                                     |  1 +
 .../apache/cassandra/stress/StressProfile.java  | 29 ++++++++++++++++----
 .../settings/OptionRatioDistribution.java       |  2 +-
 3 files changed, 26 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/b3573f3d/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 4c0dbf9..8fe4253 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 2.1.1
+ * Add better error checking of new stress profile (CASSANDRA-7716)
  * Use ThreadLocalRandom and remove FBUtilities.threadLocalRandom (CASSANDRA-7934)
  * Prevent operator mistakes due to simultaneous bootstrap (CASSANDRA-7069)
  * cassandra-stress supports whitelist mode for node config (CASSANDRA-7658)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/b3573f3d/tools/stress/src/org/apache/cassandra/stress/StressProfile.java
----------------------------------------------------------------------
diff --git a/tools/stress/src/org/apache/cassandra/stress/StressProfile.java b/tools/stress/src/org/apache/cassandra/stress/StressProfile.java
index bd873e8..b0a149c 100644
--- a/tools/stress/src/org/apache/cassandra/stress/StressProfile.java
+++ b/tools/stress/src/org/apache/cassandra/stress/StressProfile.java
@@ -31,6 +31,7 @@ import org.apache.cassandra.cql3.QueryProcessor;
 import org.apache.cassandra.cql3.statements.CreateKeyspaceStatement;
 import org.apache.cassandra.exceptions.RequestValidationException;
 
+import org.apache.cassandra.exceptions.SyntaxException;
 import org.apache.cassandra.stress.generate.Distribution;
 import org.apache.cassandra.stress.generate.DistributionFactory;
 import org.apache.cassandra.stress.generate.PartitionGenerator;
@@ -124,8 +125,15 @@ public class StressProfile implements Serializable
 
         if (keyspaceCql != null && keyspaceCql.length() > 0)
         {
-            String name = ((CreateKeyspaceStatement) QueryProcessor.parseStatement(keyspaceCql)).keyspace();
-            assert name.equalsIgnoreCase(keyspaceName) : "Name in keyspace_definition doesn't match keyspace property: '" + name + "' != '" + keyspaceName + "'";
+            try
+            {
+                String name = ((CreateKeyspaceStatement) QueryProcessor.parseStatement(keyspaceCql)).keyspace();
+                assert name.equalsIgnoreCase(keyspaceName) : "Name in keyspace_definition doesn't match keyspace property: '" + name + "' != '" + keyspaceName + "'";
+            }
+            catch (SyntaxException e)
+            {
+                throw new IllegalArgumentException("There was a problem parsing the keyspace cql: " + e.getMessage());
+            }
         }
         else
         {
@@ -134,8 +142,15 @@ public class StressProfile implements Serializable
 
         if (tableCql != null && tableCql.length() > 0)
         {
-            String name = CFMetaData.compile(tableCql, keyspaceName).cfName;
-            assert name.equalsIgnoreCase(tableName) : "Name in table_definition doesn't match table property: '" + name + "' != '" + tableName + "'";
+            try
+            {
+                String name = CFMetaData.compile(tableCql, keyspaceName).cfName;
+                assert name.equalsIgnoreCase(tableName) : "Name in table_definition doesn't match table property: '" + name + "' != '" + tableName + "'";
+            }
+            catch (RuntimeException e)
+            {
+                throw new IllegalArgumentException("There was a problem parsing the table cql: " + e.getCause().getMessage());
+            }
         }
         else
         {
@@ -217,6 +232,9 @@ public class StressProfile implements Serializable
                                                .getKeyspace(keyspaceName)
                                                .getTable(tableName);
 
+                if (metadata == null)
+                    throw new RuntimeException("Unable to find table " + keyspaceName + "." + tableName);
+
                 //Fill in missing column configs
                 for (ColumnMetadata col : metadata.getColumns())
                 {
@@ -391,9 +409,10 @@ public class StressProfile implements Serializable
     private static <E> E select(E first, String key, String defValue, Map<String, String> map, Function<String, E> builder)
     {
         String val = map.remove(key);
+
         if (first != null)
             return first;
-        if (val != null)
+        if (val != null && val.trim().length() > 0)
             return builder.apply(val);
         return builder.apply(defValue);
     }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/b3573f3d/tools/stress/src/org/apache/cassandra/stress/settings/OptionRatioDistribution.java
----------------------------------------------------------------------
diff --git a/tools/stress/src/org/apache/cassandra/stress/settings/OptionRatioDistribution.java b/tools/stress/src/org/apache/cassandra/stress/settings/OptionRatioDistribution.java
index aacb616..756536f 100644
--- a/tools/stress/src/org/apache/cassandra/stress/settings/OptionRatioDistribution.java
+++ b/tools/stress/src/org/apache/cassandra/stress/settings/OptionRatioDistribution.java
@@ -90,7 +90,7 @@ public class OptionRatioDistribution extends Option
     {
         OptionRatioDistribution opt = new OptionRatioDistribution("", "", "", true);
         if (!opt.accept(spec))
-            throw new IllegalArgumentException();
+            throw new IllegalArgumentException("Invalid ratio definition: "+spec);
         return opt.get();
     }
 


[2/2] git commit: Merge branch 'cassandra-2.1' into trunk

Posted by ja...@apache.org.
Merge branch 'cassandra-2.1' into trunk


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

Branch: refs/heads/trunk
Commit: 7b5164f39845d2329b06f1348157d233adeb7453
Parents: 969967c b3573f3
Author: Jake Luciani <ja...@apache.org>
Authored: Mon Sep 15 12:22:09 2014 -0400
Committer: Jake Luciani <ja...@apache.org>
Committed: Mon Sep 15 12:22:09 2014 -0400

----------------------------------------------------------------------
 CHANGES.txt                                     |  1 +
 .../apache/cassandra/stress/StressProfile.java  | 29 ++++++++++++++++----
 .../settings/OptionRatioDistribution.java       |  2 +-
 3 files changed, 26 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/7b5164f3/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index b6e9165,8fe4253..9a43511
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -1,26 -1,5 +1,27 @@@
 +3.0
 + * Remove YamlFileNetworkTopologySnitch (CASSANDRA-7917)
 + * Support Java source code for user-defined functions (CASSANDRA-7562)
 + * Require arg types to disambiguate UDF drops (CASSANDRA-7812)
 + * Do anticompaction in groups (CASSANDRA-6851)
 + * Verify that UDF class methods are static (CASSANDRA-7781)
 + * Support pure user-defined functions (CASSANDRA-7395, 7740)
 + * Permit configurable timestamps with cassandra-stress (CASSANDRA-7416)
 + * Move sstable RandomAccessReader to nio2, which allows using the
 +   FILE_SHARE_DELETE flag on Windows (CASSANDRA-4050)
 + * Remove CQL2 (CASSANDRA-5918)
 + * Add Thrift get_multi_slice call (CASSANDRA-6757)
 + * Optimize fetching multiple cells by name (CASSANDRA-6933)
 + * Allow compilation in java 8 (CASSANDRA-7028)
 + * Make incremental repair default (CASSANDRA-7250)
 + * Enable code coverage thru JaCoCo (CASSANDRA-7226)
 + * Switch external naming of 'column families' to 'tables' (CASSANDRA-4369) 
 + * Shorten SSTable path (CASSANDRA-6962)
 + * Use unsafe mutations for most unit tests (CASSANDRA-6969)
 + * Fix race condition during calculation of pending ranges (CASSANDRA-7390)
 +
 +
  2.1.1
+  * Add better error checking of new stress profile (CASSANDRA-7716)
   * Use ThreadLocalRandom and remove FBUtilities.threadLocalRandom (CASSANDRA-7934)
   * Prevent operator mistakes due to simultaneous bootstrap (CASSANDRA-7069)
   * cassandra-stress supports whitelist mode for node config (CASSANDRA-7658)