cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alek...@apache.org
Subject [1/3] cassandra git commit: Fix encoding of cell names for super columns (CASSANDRA-12235 follow-up)
Date Mon, 08 Aug 2016 17:38:46 GMT
Repository: cassandra
Updated Branches:
  refs/heads/cassandra-3.9 55aea2db8 -> ae816cb84
  refs/heads/trunk 938faa216 -> e9132b29a


Fix encoding of cell names for super columns (CASSANDRA-12235 follow-up)

patch by Sylvain Lebresne; reviewed by Aleksey Yeschenko for
CASSANDRA-12335


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

Branch: refs/heads/cassandra-3.9
Commit: ae816cb84f24de410a5e4b0b2e73507eca37f655
Parents: 55aea2d
Author: Sylvain Lebresne <sylvain@datastax.com>
Authored: Fri Aug 5 09:36:09 2016 +0200
Committer: Aleksey Yeschenko <aleksey@apache.org>
Committed: Mon Aug 8 18:36:59 2016 +0100

----------------------------------------------------------------------
 .../org/apache/cassandra/db/LegacyLayout.java   | 23 ++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/ae816cb8/src/java/org/apache/cassandra/db/LegacyLayout.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/LegacyLayout.java b/src/java/org/apache/cassandra/db/LegacyLayout.java
index b5190ad..9e7e9b6 100644
--- a/src/java/org/apache/cassandra/db/LegacyLayout.java
+++ b/src/java/org/apache/cassandra/db/LegacyLayout.java
@@ -264,6 +264,8 @@ public abstract class LegacyLayout
         // We use comparator.size() rather than clustering.size() because of static clusterings
         int clusteringSize = metadata.comparator.size();
         int size = clusteringSize + (metadata.isDense() ? 0 : 1) + (collectionElement ==
null ? 0 : 1);
+        if (metadata.isSuper())
+            size = clusteringSize + 1;
         ByteBuffer[] values = new ByteBuffer[size];
         for (int i = 0; i < clusteringSize; i++)
         {
@@ -282,10 +284,23 @@ public abstract class LegacyLayout
             values[i] = v;
         }
 
-        if (!metadata.isDense())
-            values[clusteringSize] = columnName;
-        if (collectionElement != null)
-            values[clusteringSize + 1] = collectionElement;
+        if (metadata.isSuper())
+        {
+            // We need to set the "column" (in thrift terms) name, i.e. the value corresponding
to the subcomparator.
+            // What it is depends if this a cell for a declared "static" column or a "dynamic"
column part of the
+            // super-column internal map.
+            assert columnName != null; // This should never be null for supercolumns, see
decodeForSuperColumn() above
+            values[clusteringSize] = columnName.equals(CompactTables.SUPER_COLUMN_MAP_COLUMN)
+                                   ? collectionElement
+                                   : columnName;
+        }
+        else
+        {
+            if (!metadata.isDense())
+                values[clusteringSize] = columnName;
+            if (collectionElement != null)
+                values[clusteringSize + 1] = collectionElement;
+        }
 
         return CompositeType.build(isStatic, values);
     }


Mime
View raw message