cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From slebre...@apache.org
Subject git commit: Provide the correct QueryOptions when buildind CAS resultset
Date Mon, 19 May 2014 13:45:37 GMT
Repository: cassandra
Updated Branches:
  refs/heads/cassandra-2.1 518c3cf61 -> 51583ad3d


Provide the correct QueryOptions when buildind CAS resultset


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

Branch: refs/heads/cassandra-2.1
Commit: 51583ad3dc2fab9ba9e667b6ca73d3773642ce05
Parents: 518c3cf
Author: Sylvain Lebresne <sylvain@datastax.com>
Authored: Mon May 19 15:45:20 2014 +0200
Committer: Sylvain Lebresne <sylvain@datastax.com>
Committed: Mon May 19 15:45:30 2014 +0200

----------------------------------------------------------------------
 .../cassandra/cql3/statements/BatchStatement.java     |  2 +-
 .../cql3/statements/ModificationStatement.java        | 14 +++++++-------
 2 files changed, 8 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/51583ad3/src/java/org/apache/cassandra/cql3/statements/BatchStatement.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql3/statements/BatchStatement.java b/src/java/org/apache/cassandra/cql3/statements/BatchStatement.java
index e1266cb..05d37da 100644
--- a/src/java/org/apache/cassandra/cql3/statements/BatchStatement.java
+++ b/src/java/org/apache/cassandra/cql3/statements/BatchStatement.java
@@ -308,7 +308,7 @@ public class BatchStatement implements CQLStatement, MeasurableForPreparedCache
 
         verifyBatchSize(Collections.singleton(updates));
         ColumnFamily result = StorageProxy.cas(ksName, cfName, key, conditions, updates,
options.getSerialConsistency(), options.getConsistency());
-        return new ResultMessage.Rows(ModificationStatement.buildCasResultSet(ksName, key,
cfName, result, columnsWithConditions, true));
+        return new ResultMessage.Rows(ModificationStatement.buildCasResultSet(ksName, key,
cfName, result, columnsWithConditions, true, options.forStatement(0)));
     }
 
     public ResultMessage executeInternal(QueryState queryState) throws RequestValidationException,
RequestExecutionException

http://git-wip-us.apache.org/repos/asf/cassandra/blob/51583ad3/src/java/org/apache/cassandra/cql3/statements/ModificationStatement.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql3/statements/ModificationStatement.java b/src/java/org/apache/cassandra/cql3/statements/ModificationStatement.java
index 03d4264..e1468fb 100644
--- a/src/java/org/apache/cassandra/cql3/statements/ModificationStatement.java
+++ b/src/java/org/apache/cassandra/cql3/statements/ModificationStatement.java
@@ -518,7 +518,7 @@ public abstract class ModificationStatement implements CQLStatement, MeasurableF
                                                updates,
                                                options.getSerialConsistency(),
                                                options.getConsistency());
-        return new ResultMessage.Rows(buildCasResultSet(key, result));
+        return new ResultMessage.Rows(buildCasResultSet(key, result, options));
     }
 
     public void addUpdatesAndConditions(ByteBuffer key, Composite clusteringPrefix, ColumnFamily
updates, CQL3CasConditions conditions, QueryOptions options, long now)
@@ -547,12 +547,12 @@ public abstract class ModificationStatement implements CQLStatement,
MeasurableF
         }
     }
 
-    private ResultSet buildCasResultSet(ByteBuffer key, ColumnFamily cf) throws InvalidRequestException
+    private ResultSet buildCasResultSet(ByteBuffer key, ColumnFamily cf, QueryOptions options)
throws InvalidRequestException
     {
-        return buildCasResultSet(keyspace(), key, columnFamily(), cf, getColumnsWithConditions(),
false);
+        return buildCasResultSet(keyspace(), key, columnFamily(), cf, getColumnsWithConditions(),
false, options);
     }
 
-    public static ResultSet buildCasResultSet(String ksName, ByteBuffer key, String cfName,
ColumnFamily cf, Iterable<ColumnDefinition> columnsWithConditions, boolean isBatch)
+    public static ResultSet buildCasResultSet(String ksName, ByteBuffer key, String cfName,
ColumnFamily cf, Iterable<ColumnDefinition> columnsWithConditions, boolean isBatch,
QueryOptions options)
     throws InvalidRequestException
     {
         boolean success = cf == null;
@@ -562,7 +562,7 @@ public abstract class ModificationStatement implements CQLStatement, MeasurableF
         List<List<ByteBuffer>> rows = Collections.singletonList(Collections.singletonList(BooleanType.instance.decompose(success)));
 
         ResultSet rs = new ResultSet(metadata, rows);
-        return success ? rs : merge(rs, buildCasFailureResultSet(key, cf, columnsWithConditions,
isBatch));
+        return success ? rs : merge(rs, buildCasFailureResultSet(key, cf, columnsWithConditions,
isBatch, options));
     }
 
     private static ResultSet merge(ResultSet left, ResultSet right)
@@ -588,7 +588,7 @@ public abstract class ModificationStatement implements CQLStatement, MeasurableF
         return new ResultSet(new ResultSet.Metadata(specs), rows);
     }
 
-    private static ResultSet buildCasFailureResultSet(ByteBuffer key, ColumnFamily cf, Iterable<ColumnDefinition>
columnsWithConditions, boolean isBatch)
+    private static ResultSet buildCasFailureResultSet(ByteBuffer key, ColumnFamily cf, Iterable<ColumnDefinition>
columnsWithConditions, boolean isBatch, QueryOptions options)
     throws InvalidRequestException
     {
         CFMetaData cfm = cf.metadata();
@@ -616,7 +616,7 @@ public abstract class ModificationStatement implements CQLStatement, MeasurableF
 
         long now = System.currentTimeMillis();
         Selection.ResultSetBuilder builder = selection.resultSetBuilder(now);
-        SelectStatement.forSelection(cfm, selection).processColumnFamily(key, cf, QueryOptions.DEFAULT,
now, builder);
+        SelectStatement.forSelection(cfm, selection).processColumnFamily(key, cf, options,
now, builder);
 
         return builder.build();
     }


Mime
View raw message