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 2015/07/21 17:28:52 UTC

cassandra git commit: Allow extra schema definitions in cassandra-stress yaml

Repository: cassandra
Updated Branches:
  refs/heads/trunk 6249a3b1e -> 5e89136d1


Allow extra schema definitions in cassandra-stress yaml

Patch by tjake; reviewed by benedict for CASSANDRA-9850


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

Branch: refs/heads/trunk
Commit: 5e89136d100f92384914c281cbe57b25fa1f3cbb
Parents: 6249a3b
Author: T Jake Luciani <ja...@apache.org>
Authored: Mon Jul 20 15:13:39 2015 -0400
Committer: T Jake Luciani <ja...@apache.org>
Committed: Tue Jul 21 11:28:38 2015 -0400

----------------------------------------------------------------------
 CHANGES.txt                                     |  1 +
 .../apache/cassandra/stress/StressProfile.java  | 21 ++++++++++++++++++++
 .../org/apache/cassandra/stress/StressYaml.java |  2 ++
 3 files changed, 24 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/5e89136d/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 1828476..2a3aecd 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 3.0
+ * Allow extra schema definitions in cassandra-stress yaml (CASSANDRA-9850)
  * Metrics should use up to date nomenclature (CASSANDRA-9448)
  * Change CREATE/ALTER TABLE syntax for compression (CASSANDRA-8384)
  * Cleanup crc and adler code for java 8 (CASSANDRA-9650)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/5e89136d/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 e2b9575..82f274e 100644
--- a/tools/stress/src/org/apache/cassandra/stress/StressProfile.java
+++ b/tools/stress/src/org/apache/cassandra/stress/StressProfile.java
@@ -59,6 +59,7 @@ public class StressProfile implements Serializable
 {
     private String keyspaceCql;
     private String tableCql;
+    private List<String> extraSchemaDefinitions;
     private String seedStr;
 
     public String keyspaceName;
@@ -93,6 +94,8 @@ public class StressProfile implements Serializable
         queries = yaml.queries;
         insert = yaml.insert;
 
+        extraSchemaDefinitions = yaml.extra_definitions;
+
         assert keyspaceName != null : "keyspace name is required in yaml file";
         assert tableName != null : "table name is required in yaml file";
         assert queries != null : "queries map is required in yaml file";
@@ -185,6 +188,24 @@ public class StressProfile implements Serializable
             Uninterruptibles.sleepUninterruptibly(settings.node.nodes.size(), TimeUnit.SECONDS);
         }
 
+        if (extraSchemaDefinitions != null)
+        {
+            for (String extraCql : extraSchemaDefinitions)
+            {
+
+                try
+                {
+                    client.execute(extraCql, org.apache.cassandra.db.ConsistencyLevel.ONE);
+                }
+                catch (AlreadyExistsException e)
+                {
+                }
+            }
+
+            System.out.println(String.format("Created extra schema. Sleeping %ss for propagation.", settings.node.nodes.size()));
+            Uninterruptibles.sleepUninterruptibly(settings.node.nodes.size(), TimeUnit.SECONDS);
+        }
+
         maybeLoadSchemaInfo(settings);
     }
 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/5e89136d/tools/stress/src/org/apache/cassandra/stress/StressYaml.java
----------------------------------------------------------------------
diff --git a/tools/stress/src/org/apache/cassandra/stress/StressYaml.java b/tools/stress/src/org/apache/cassandra/stress/StressYaml.java
index b6efc5e..90797b4 100644
--- a/tools/stress/src/org/apache/cassandra/stress/StressYaml.java
+++ b/tools/stress/src/org/apache/cassandra/stress/StressYaml.java
@@ -30,6 +30,8 @@ public class StressYaml
     public String table;
     public String table_definition;
 
+    public List<String> extra_definitions;
+
     public List<Map<String, Object>> columnspec;
     public Map<String, QueryDef> queries;
     public Map<String, String> insert;