cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject [1/6] cassandra git commit: Fix deserialization of read commands in mixed clusters
Date Tue, 02 Feb 2016 14:49:49 GMT
Repository: cassandra
Updated Branches:
  refs/heads/cassandra-3.0 b087b4c7d -> b21df5b70
  refs/heads/cassandra-3.3 e96fae3ca -> f70c35385
  refs/heads/trunk 27d88ee33 -> 0a83e6aa8


Fix deserialization of read commands in mixed clusters

Patch by Sam Tunnicliffe; reviewed by Sylvain Lebresne for
CASSANDRA-11087


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

Branch: refs/heads/cassandra-3.0
Commit: b21df5b70a22ed8bef61dd34d77d71bdfe475922
Parents: b087b4c
Author: Sam Tunnicliffe <sam@beobal.com>
Authored: Thu Jan 28 17:23:23 2016 +0000
Committer: Sam Tunnicliffe <sam@beobal.com>
Committed: Tue Feb 2 14:33:12 2016 +0000

----------------------------------------------------------------------
 CHANGES.txt                                       |  1 +
 src/java/org/apache/cassandra/db/ReadCommand.java | 17 ++++++++++++++++-
 2 files changed, 17 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/b21df5b7/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 47d2dc1..dcbce5b 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 3.0.3
+ * Fix deserialization of legacy read commands (CASSANDRA-11087)
  * Fix incorrect computation of deletion time in sstable metadata (CASSANDRA-11102)
  * Avoid memory leak when collecting sstable metadata (CASSANDRA-11026)
  * Mutations do not block for completion under view lock contention (CASSANDRA-10779)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/b21df5b7/src/java/org/apache/cassandra/db/ReadCommand.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/ReadCommand.java b/src/java/org/apache/cassandra/db/ReadCommand.java
index f21d100..97c3d07 100644
--- a/src/java/org/apache/cassandra/db/ReadCommand.java
+++ b/src/java/org/apache/cassandra/db/ReadCommand.java
@@ -1308,8 +1308,23 @@ public abstract class ReadCommand implements ReadQuery
                                     "Fill name in filter (hex): " + ByteBufferUtil.bytesToHex(buffer),
metadata.cfId);
                 }
 
-                if (!cellName.clustering.equals(Clustering.STATIC_CLUSTERING))
+                // If we're querying for a static column, we may also need to read it
+                // as if it were a thrift dynamic column (because the column metadata,
+                // which makes it a static column in 3.0+, may have been added *after*
+                // some values were written). Note that all cql queries on non-compact
+                // tables used slice & not name filters prior to 3.0 so this path is
+                // not taken for non-compact tables. It is theoretically possible to
+                // get here via thrift, hence the check on metadata.isStaticCompactTable.
+                // See CASSANDRA-11087.
+                if (metadata.isStaticCompactTable() && cellName.clustering.equals(Clustering.STATIC_CLUSTERING))
+                {
+                    clusterings.add(new Clustering(cellName.column.name.bytes));
+                    selectionBuilder.add(metadata.compactValueColumn());
+                }
+                else
+                {
                     clusterings.add(cellName.clustering);
+                }
 
                 selectionBuilder.add(cellName.column);
             }


Mime
View raw message