Add support for skip read validation flag for cassandra-stress

patch by Noam Hasson; reviewed by jasobrown for CASSANDRA-13772


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

Branch: refs/heads/trunk
Commit: 6b7d73a49695c0ceb78bc7a003ace606a806c13a
Parents: 8d98a99
Author: Noam Hasson <n...@scylladb.com>
Authored: Thu Aug 17 11:53:45 2017 +0300
Committer: Jason Brown <jasedbr...@gmail.com>
Committed: Thu Aug 24 10:50:20 2017 -0700

----------------------------------------------------------------------
 .../stress/operations/predefined/CqlOperation.java       | 11 +++++++----
 .../apache/cassandra/stress/settings/SettingsErrors.java |  6 ++++--
 2 files changed, 11 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/6b7d73a4/tools/stress/src/org/apache/cassandra/stress/operations/predefined/CqlOperation.java
----------------------------------------------------------------------
diff --git 
a/tools/stress/src/org/apache/cassandra/stress/operations/predefined/CqlOperation.java
 
b/tools/stress/src/org/apache/cassandra/stress/operations/predefined/CqlOperation.java
index 647ba87..807bb49 100644
--- 
a/tools/stress/src/org/apache/cassandra/stress/operations/predefined/CqlOperation.java
+++ 
b/tools/stress/src/org/apache/cassandra/stress/operations/predefined/CqlOperation.java
@@ -196,11 +196,14 @@ public abstract class CqlOperation<V> extends 
PredefinedOperation
 
         public boolean validate(ByteBuffer[][] result)
         {
-            if (result.length != expect.size())
-                return false;
-            for (int i = 0 ; i < result.length ; i++)
-                if (expect.get(i) != null && 
!expect.get(i).equals(Arrays.asList(result[i])))
+            if (!settings.errors.skipReadValidation)
+            {
+                if (result.length != expect.size())
                     return false;
+                for (int i = 0; i < result.length; i++)
+                    if (expect.get(i) != null && 
!expect.get(i).equals(Arrays.asList(result[i])))
+                        return false;
+            }
             return true;
         }
     }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/6b7d73a4/tools/stress/src/org/apache/cassandra/stress/settings/SettingsErrors.java
----------------------------------------------------------------------
diff --git 
a/tools/stress/src/org/apache/cassandra/stress/settings/SettingsErrors.java 
b/tools/stress/src/org/apache/cassandra/stress/settings/SettingsErrors.java
index aae4dd9..41a3dbd 100644
--- a/tools/stress/src/org/apache/cassandra/stress/settings/SettingsErrors.java
+++ b/tools/stress/src/org/apache/cassandra/stress/settings/SettingsErrors.java
@@ -33,11 +33,13 @@ public class SettingsErrors implements Serializable
 
     public final boolean ignore;
     public final int tries;
+    public final boolean skipReadValidation;
 
     public SettingsErrors(Options options)
     {
         ignore = options.ignore.setByUser();
         this.tries = Math.max(1, Integer.parseInt(options.retries.value()) + 
1);
+        skipReadValidation = options.skipReadValidation.setByUser();
     }
 
     // Option Declarations
@@ -46,11 +48,11 @@ public class SettingsErrors implements Serializable
     {
         final OptionSimple retries = new OptionSimple("retries=", "[0-9]+", 
"9", "Number of tries to perform for each operation before failing", false);
         final OptionSimple ignore = new OptionSimple("ignore", "", null, "Do 
not fail on errors", false);
-
+        final OptionSimple skipReadValidation = new 
OptionSimple("skip-read-validation", "", null, "Skip read validation and 
message output", false);
         @Override
         public List<? extends Option> options()
         {
-            return Arrays.asList(retries, ignore);
+            return Arrays.asList(retries, ignore, skipReadValidation);
         }
     }
 


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

Reply via email to