Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'cassandra-2.1' into trunk

  • Loading branch information...
commit 1b644140c7adf3c7059af7089ca1c6256dcfbef1 2 parents 30f438f + 15728ad
@pcmanus pcmanus authored
View
1  CHANGES.txt
@@ -10,6 +10,7 @@
* Fix assertion error in ALTER TYPE RENAME (CASSANDRA-6705)
* Scrub should not always clear out repaired status (CASSANDRA-5351)
* Improve handling of range tombstone for wide partitions (CASSANDRA-6446)
+ * Fix ClassCastException for compact table with composites (CASSANDRA-6738)
2.1.0-beta1
* Add flush directory distinct from compaction directories (CASSANDRA-6357)
View
6 src/java/org/apache/cassandra/db/composites/CompoundComposite.java
@@ -50,7 +50,11 @@ public int size()
public ByteBuffer get(int i)
{
- return elements[i];
+ // Note: most consumer should validate that i is within bounds. However, for backward compatibility
+ // reasons, composite dense tables can have names that don't have all their component of the clustering
+ // columns, which may end up here with i > size(). For those calls, it's actually simpler to return null
+ // than to force the caller to special case.
+ return i >= size() ? null : elements[i];
}
@Override
View
5 src/java/org/apache/cassandra/db/composites/CompoundDenseCellName.java
@@ -34,6 +34,11 @@
super(elements, elements.length, false);
}
+ CompoundDenseCellName(ByteBuffer[] elements, int size)
+ {
+ super(elements, size, false);
+ }
+
public int clusteringSize()
{
return size;
View
3  src/java/org/apache/cassandra/db/composites/CompoundDenseCellNameType.java
@@ -69,8 +69,7 @@ protected Composite makeWith(ByteBuffer[] components, int size, Composite.EOC eo
if (size < fullSize || eoc != Composite.EOC.NONE)
return new CompoundComposite(components, size, false).withEOC(eoc);
- assert components.length == size;
- return new CompoundDenseCellName(components);
+ return new CompoundDenseCellName(components, size);
}
protected Composite copyAndMakeWith(ByteBuffer[] components, int size, Composite.EOC eoc, boolean isStatic)
Please sign in to comment.
Something went wrong with that request. Please try again.