Repository: cassandra
Updated Branches:
  refs/heads/trunk d30614428 -> d26bfe9a4


fix stress to not use thrift unless requested


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

Branch: refs/heads/trunk
Commit: d26bfe9a4dd50f1f6f949b4ef114b45640001fbe
Parents: d306144
Author: T Jake Luciani <j...@apache.org>
Authored: Tue Apr 14 15:57:55 2015 -0500
Committer: T Jake Luciani <j...@apache.org>
Committed: Tue May 12 15:37:45 2015 -0400

----------------------------------------------------------------------
 .../apache/cassandra/stress/StressProfile.java  | 28 ++++++++++++++------
 1 file changed, 20 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/d26bfe9a/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 30a842a..272f3c7 100644
--- a/tools/stress/src/org/apache/cassandra/stress/StressProfile.java
+++ b/tools/stress/src/org/apache/cassandra/stress/StressProfile.java
@@ -243,14 +243,21 @@ public class StressProfile implements Serializable
                     try
                     {
                         JavaDriverClient jclient = 
settings.getJavaDriverClient();
-                        ThriftClient tclient = settings.getThriftClient();
+                        ThriftClient tclient = null;
+
+                        if (settings.mode.api != 
ConnectionAPI.JAVA_DRIVER_NATIVE)
+                            tclient = settings.getThriftClient();
+
                         Map<String, PreparedStatement> stmts = new HashMap<>();
                         Map<String, Integer> tids = new HashMap<>();
                         Map<String, SchemaQuery.ArgSelect> args = new 
HashMap<>();
                         for (Map.Entry<String, StressYaml.QueryDef> e : 
queries.entrySet())
                         {
                             stmts.put(e.getKey().toLowerCase(), 
jclient.prepare(e.getValue().cql));
-                            tids.put(e.getKey().toLowerCase(), 
tclient.prepare_cql3_query(e.getValue().cql, Compression.NONE));
+
+                            if (tclient != null)
+                                tids.put(e.getKey().toLowerCase(), 
tclient.prepare_cql3_query(e.getValue().cql, Compression.NONE));
+
                             args.put(e.getKey().toLowerCase(), 
e.getValue().fields == null
                                                                      ? 
SchemaQuery.ArgSelect.MULTIROW
                                                                      : 
SchemaQuery.ArgSelect.valueOf(e.getValue().fields.toUpperCase()));
@@ -373,14 +380,19 @@ public class StressProfile implements Serializable
 
                     JavaDriverClient client = settings.getJavaDriverClient();
                     String query = sb.toString();
-                    try
-                    {
-                        thriftInsertId = 
settings.getThriftClient().prepare_cql3_query(query, Compression.NONE);
-                    }
-                    catch (TException e)
+
+                    if (settings.mode.api != ConnectionAPI.JAVA_DRIVER_NATIVE)
                     {
-                        throw new RuntimeException(e);
+                        try
+                        {
+                            thriftInsertId = 
settings.getThriftClient().prepare_cql3_query(query, Compression.NONE);
+                        }
+                        catch (TException e)
+                        {
+                            throw new RuntimeException(e);
+                        }
                     }
+
                     insertStatement = client.prepare(query);
                 }
             }

Reply via email to