Fix ClassCastException on composite dense tables patch by slebresne; reviewed by thobbs for CASSANDRA-7112
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/3aa41fbc Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/3aa41fbc Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/3aa41fbc Branch: refs/heads/trunk Commit: 3aa41fbce807d07e3952cbc78beec7cbc2d743e7 Parents: 7e8efd1 Author: Sylvain Lebresne <[email protected]> Authored: Mon May 5 09:23:27 2014 +0200 Committer: Sylvain Lebresne <[email protected]> Committed: Mon May 5 09:23:27 2014 +0200 ---------------------------------------------------------------------- CHANGES.txt | 1 + .../cassandra/db/composites/CompoundDenseCellNameType.java | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/3aa41fbc/CHANGES.txt ---------------------------------------------------------------------- diff --git a/CHANGES.txt b/CHANGES.txt index ddcb09c..2f55eee 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,6 +1,7 @@ 2.1.0-rc1 * Parallel streaming for sstableloader (CASSANDRA-3668) * Fix bugs in supercolumns handling (CASSANDRA-7138) + * Fix ClassClassException on composite dense tables (CASSANDRA-7112) Merged from 2.0: * Make batchlog replica selection rack-aware (CASSANDRA-6551) * Suggest CTRL-C or semicolon after three blank lines in cqlsh (CASSANDRA-7142) http://git-wip-us.apache.org/repos/asf/cassandra/blob/3aa41fbc/src/java/org/apache/cassandra/db/composites/CompoundDenseCellNameType.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/db/composites/CompoundDenseCellNameType.java b/src/java/org/apache/cassandra/db/composites/CompoundDenseCellNameType.java index 0fd2f4b..e3c2831 100644 --- a/src/java/org/apache/cassandra/db/composites/CompoundDenseCellNameType.java +++ b/src/java/org/apache/cassandra/db/composites/CompoundDenseCellNameType.java @@ -67,10 +67,10 @@ public class CompoundDenseCellNameType extends AbstractCompoundCellNameType protected Composite makeWith(ByteBuffer[] components, int size, Composite.EOC eoc, boolean isStatic) { assert !isStatic; - if (size < fullSize || eoc != Composite.EOC.NONE) - return new CompoundComposite(components, size, false).withEOC(eoc); - - return new CompoundDenseCellName(components, size); + // A composite dense table cell name don't have to have all the component set to qualify as a + // proper CellName (for backward compatibility reasons mostly), so always return a cellName + Composite c = new CompoundDenseCellName(components, size); + return eoc != Composite.EOC.NONE ? c.withEOC(eoc) : c; } protected Composite copyAndMakeWith(ByteBuffer[] components, int size, Composite.EOC eoc, boolean isStatic)
