cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From marc...@apache.org
Subject cassandra git commit: Add CL.SERIAL CL.LOCAL_SERIAL for cassandra-stress
Date Tue, 03 Oct 2017 06:13:30 GMT
Repository: cassandra
Updated Branches:
  refs/heads/trunk 48562536f -> d97d95ff1


Add CL.SERIAL CL.LOCAL_SERIAL for cassandra-stress

patch by Jay Zhuang; reviewed by marcuse for CASSANDRA-13925


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

Branch: refs/heads/trunk
Commit: d97d95ff13cf5749d37ecf7604a08947eccba2b3
Parents: 4856253
Author: Jay Zhuang <jay.zhuang@yahoo.com>
Authored: Mon Oct 2 14:13:05 2017 -0700
Committer: Marcus Eriksson <marcuse@apache.org>
Committed: Tue Oct 3 08:11:49 2017 +0200

----------------------------------------------------------------------
 CHANGES.txt                                      |  1 +
 .../operations/userdefined/SchemaInsert.java     |  5 ++++-
 .../operations/userdefined/SchemaStatement.java  |  7 ++++++-
 .../userdefined/ValidatingSchemaQuery.java       |  7 ++++++-
 .../stress/settings/SettingsCommand.java         |  2 +-
 .../cassandra/stress/util/JavaDriverClient.java  | 19 +++++++++++++++++--
 6 files changed, 35 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/d97d95ff/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 1304f34..2498270 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 4.0
+ * Add SERIAL and LOCAL_SERIAL support for cassandra-stress (CASSANDRA-13925)
  * LCS needlessly checks for L0 STCS candidates multiple times (CASSANDRA-12961)
  * Correctly close netty channels when a stream session ends (CASSANDRA-13905)
  * Update lz4 to 1.4.0 (CASSANDRA-13741)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/d97d95ff/tools/stress/src/org/apache/cassandra/stress/operations/userdefined/SchemaInsert.java
----------------------------------------------------------------------
diff --git a/tools/stress/src/org/apache/cassandra/stress/operations/userdefined/SchemaInsert.java
b/tools/stress/src/org/apache/cassandra/stress/operations/userdefined/SchemaInsert.java
index 4e82492..4cfea82 100644
--- a/tools/stress/src/org/apache/cassandra/stress/operations/userdefined/SchemaInsert.java
+++ b/tools/stress/src/org/apache/cassandra/stress/operations/userdefined/SchemaInsert.java
@@ -97,7 +97,10 @@ public class SchemaInsert extends SchemaStatement
                 else
                 {
                     BatchStatement batch = new BatchStatement(batchType);
-                    batch.setConsistencyLevel(JavaDriverClient.from(cl));
+                    if (cl.isSerialConsistency())
+                        batch.setSerialConsistencyLevel(JavaDriverClient.from(cl));
+                    else
+                        batch.setConsistencyLevel(JavaDriverClient.from(cl));
                     batch.addAll(substmts);
                     stmt = batch;
                 }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/d97d95ff/tools/stress/src/org/apache/cassandra/stress/operations/userdefined/SchemaStatement.java
----------------------------------------------------------------------
diff --git a/tools/stress/src/org/apache/cassandra/stress/operations/userdefined/SchemaStatement.java
b/tools/stress/src/org/apache/cassandra/stress/operations/userdefined/SchemaStatement.java
index 94df2c2..6bd3fd5 100644
--- a/tools/stress/src/org/apache/cassandra/stress/operations/userdefined/SchemaStatement.java
+++ b/tools/stress/src/org/apache/cassandra/stress/operations/userdefined/SchemaStatement.java
@@ -58,7 +58,12 @@ public abstract class SchemaStatement extends PartitionOperation
             argumentIndex[i++] = spec.partitionGenerator.indexOf(name);
 
         if (statement != null)
-            statement.setConsistencyLevel(JavaDriverClient.from(cl));
+        {
+            if (cl.isSerialConsistency())
+                statement.setSerialConsistencyLevel(JavaDriverClient.from(cl));
+            else
+                statement.setConsistencyLevel(JavaDriverClient.from(cl));
+        }
     }
 
     BoundStatement bindRow(Row row)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/d97d95ff/tools/stress/src/org/apache/cassandra/stress/operations/userdefined/ValidatingSchemaQuery.java
----------------------------------------------------------------------
diff --git a/tools/stress/src/org/apache/cassandra/stress/operations/userdefined/ValidatingSchemaQuery.java
b/tools/stress/src/org/apache/cassandra/stress/operations/userdefined/ValidatingSchemaQuery.java
index e7d7d56..6d93f4c 100644
--- a/tools/stress/src/org/apache/cassandra/stress/operations/userdefined/ValidatingSchemaQuery.java
+++ b/tools/stress/src/org/apache/cassandra/stress/operations/userdefined/ValidatingSchemaQuery.java
@@ -60,7 +60,12 @@ public class ValidatingSchemaQuery extends PartitionOperation
             argumentIndex[i++] = spec.partitionGenerator.indexOf(definition.getName());
 
         for (ValidatingStatement statement : statements)
-            statement.statement.setConsistencyLevel(JavaDriverClient.from(cl));
+        {
+            if (cl.isSerialConsistency())
+                statement.statement.setSerialConsistencyLevel(JavaDriverClient.from(cl));
+            else
+                statement.statement.setConsistencyLevel(JavaDriverClient.from(cl));
+        }
         this.clusteringComponents = clusteringComponents;
     }
 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/d97d95ff/tools/stress/src/org/apache/cassandra/stress/settings/SettingsCommand.java
----------------------------------------------------------------------
diff --git a/tools/stress/src/org/apache/cassandra/stress/settings/SettingsCommand.java b/tools/stress/src/org/apache/cassandra/stress/settings/SettingsCommand.java
index 0442e1c..314774a 100644
--- a/tools/stress/src/org/apache/cassandra/stress/settings/SettingsCommand.java
+++ b/tools/stress/src/org/apache/cassandra/stress/settings/SettingsCommand.java
@@ -123,7 +123,7 @@ public abstract class SettingsCommand implements Serializable
     {
         final OptionSimple noWarmup = new OptionSimple("no-warmup", "", null, "Do not warmup
the process", false);
         final OptionSimple truncate = new OptionSimple("truncate=", "never|once|always",
"never", "Truncate the table: never, before performing any work, or before each iteration",
false);
-        final OptionSimple consistencyLevel = new OptionSimple("cl=", "ONE|QUORUM|LOCAL_QUORUM|EACH_QUORUM|ALL|ANY|TWO|THREE|LOCAL_ONE",
"LOCAL_ONE", "Consistency level to use", false);
+        final OptionSimple consistencyLevel = new OptionSimple("cl=", "ONE|QUORUM|LOCAL_QUORUM|EACH_QUORUM|ALL|ANY|TWO|THREE|LOCAL_ONE|SERIAL|LOCAL_SERIAL",
"LOCAL_ONE", "Consistency level to use", false);
     }
 
     static class Count extends Options

http://git-wip-us.apache.org/repos/asf/cassandra/blob/d97d95ff/tools/stress/src/org/apache/cassandra/stress/util/JavaDriverClient.java
----------------------------------------------------------------------
diff --git a/tools/stress/src/org/apache/cassandra/stress/util/JavaDriverClient.java b/tools/stress/src/org/apache/cassandra/stress/util/JavaDriverClient.java
index 3a7c513..d404653 100644
--- a/tools/stress/src/org/apache/cassandra/stress/util/JavaDriverClient.java
+++ b/tools/stress/src/org/apache/cassandra/stress/util/JavaDriverClient.java
@@ -185,13 +185,24 @@ public class JavaDriverClient
     public ResultSet execute(String query, org.apache.cassandra.db.ConsistencyLevel consistency)
     {
         SimpleStatement stmt = new SimpleStatement(query);
-        stmt.setConsistencyLevel(from(consistency));
+
+        if (consistency.isSerialConsistency())
+            stmt.setSerialConsistencyLevel(from(consistency));
+        else
+            stmt.setConsistencyLevel(from(consistency));
         return getSession().execute(stmt);
     }
 
     public ResultSet executePrepared(PreparedStatement stmt, List<Object> queryParams,
org.apache.cassandra.db.ConsistencyLevel consistency)
     {
-        stmt.setConsistencyLevel(from(consistency));
+        if (consistency.isSerialConsistency())
+        {
+            stmt.setSerialConsistencyLevel(from(consistency));
+        }
+        else
+        {
+            stmt.setConsistencyLevel(from(consistency));
+        }
         BoundStatement bstmt = stmt.bind((Object[]) queryParams.toArray(new Object[queryParams.size()]));
         return getSession().execute(bstmt);
     }
@@ -225,6 +236,10 @@ public class JavaDriverClient
                 return com.datastax.driver.core.ConsistencyLevel.EACH_QUORUM;
             case LOCAL_ONE:
                 return com.datastax.driver.core.ConsistencyLevel.LOCAL_ONE;
+            case SERIAL:
+                return com.datastax.driver.core.ConsistencyLevel.SERIAL;
+            case LOCAL_SERIAL:
+                return com.datastax.driver.core.ConsistencyLevel.LOCAL_SERIAL;
         }
         throw new AssertionError();
     }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org


Mime
View raw message