cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From slebre...@apache.org
Subject [1/2] git commit: Fix CAS conditions for COMPACT STORAGE tables
Date Fri, 07 Mar 2014 12:20:14 GMT
Repository: cassandra
Updated Branches:
  refs/heads/cassandra-2.0 edd6636e0 -> 656edc529


Fix CAS conditions for COMPACT STORAGE tables

patch by slebresne; reviewed by iamaleksey for CASSANDRA-6813


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

Branch: refs/heads/cassandra-2.0
Commit: f3be42fc1a81b01dca2aa2de331083810d8b35e5
Parents: edd6636
Author: Sylvain Lebresne <sylvain@datastax.com>
Authored: Fri Mar 7 12:13:15 2014 +0100
Committer: Sylvain Lebresne <sylvain@datastax.com>
Committed: Fri Mar 7 12:13:15 2014 +0100

----------------------------------------------------------------------
 CHANGES.txt                                                   | 1 +
 src/java/org/apache/cassandra/cql3/ColumnCondition.java       | 7 ++++++-
 .../apache/cassandra/cql3/statements/CQL3CasConditions.java   | 3 ++-
 3 files changed, 9 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/f3be42fc/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 42c78af..920f073 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -36,6 +36,7 @@
  * FBUtilities.singleton() should use the CF comparator (CASSANDRA-6778)
  * Fix CQLSStableWriter.addRow(Map<String, Object>) (CASSANDRA-6526)
  * Fix HSHA server introducing corrupt data (CASSANDRA-6285)
+ * Fix CAS conditions for COMPACT STORAGE tables (CASSANDRA-6813)
 Merged from 1.2:
  * Add CMSClassUnloadingEnabled JVM option (CASSANDRA-6541)
  * Catch memtable flush exceptions during shutdown (CASSANDRA-6735)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/f3be42fc/src/java/org/apache/cassandra/cql3/ColumnCondition.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql3/ColumnCondition.java b/src/java/org/apache/cassandra/cql3/ColumnCondition.java
index 797dba6..ce44c3b 100644
--- a/src/java/org/apache/cassandra/cql3/ColumnCondition.java
+++ b/src/java/org/apache/cassandra/cql3/ColumnCondition.java
@@ -92,7 +92,12 @@ public class ColumnCondition
         if (column.type instanceof CollectionType)
             return collectionAppliesTo((CollectionType)column.type, rowPrefix, current, now);
 
-        Column c = current.getColumn(copyOrUpdatePrefix(current.metadata(), rowPrefix).add(column.name.key).build());
+        ColumnNameBuilder prefix = copyOrUpdatePrefix(current.metadata(), rowPrefix);
+        ByteBuffer columnName = column.kind == CFDefinition.Name.Kind.VALUE_ALIAS
+                              ? prefix.build()
+                              : prefix.add(column.name.key).build();
+
+        Column c = current.getColumn(columnName);
         ByteBuffer v = value.bindAndGet(variables);
         return v == null
              ? c == null || !c.isLive(now)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/f3be42fc/src/java/org/apache/cassandra/cql3/statements/CQL3CasConditions.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql3/statements/CQL3CasConditions.java b/src/java/org/apache/cassandra/cql3/statements/CQL3CasConditions.java
index 668f98f..ee004bc 100644
--- a/src/java/org/apache/cassandra/cql3/statements/CQL3CasConditions.java
+++ b/src/java/org/apache/cassandra/cql3/statements/CQL3CasConditions.java
@@ -82,7 +82,8 @@ public class CQL3CasConditions implements CASConditions
         for (Map.Entry<ByteBuffer, RowCondition> entry : conditions.entrySet())
             slices[i++] = new ColumnSlice(entry.getKey(), entry.getValue().rowPrefix.buildAsEndOfRange());
 
-        return new SliceQueryFilter(slices, false, slices.length, cfm.clusteringKeyColumns().size());
+        int toGroup = cfm.getCfDef().isCompact ? -1 : cfm.clusteringKeyColumns().size();
+        return new SliceQueryFilter(slices, false, slices.length, toGroup);
     }
 
     public boolean appliesTo(ColumnFamily current) throws InvalidRequestException


Mime
View raw message