Repository: cassandra Updated Branches: refs/heads/trunk 8a8d35e6d -> 7f26410a7
Fix Thrift slice deletions, incomplete cell names in updates Patch by Tyler Hobbs; reviewed by Sylvain Lebresne for CASSANDRA-7990 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/071b5f83 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/071b5f83 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/071b5f83 Branch: refs/heads/trunk Commit: 071b5f8321d5e813ad6e98f970b6e491898c591a Parents: 8d20b48 Author: Tyler Hobbs <ty...@datastax.com> Authored: Tue Oct 7 10:33:44 2014 -0500 Committer: Tyler Hobbs <ty...@datastax.com> Committed: Tue Oct 7 10:33:44 2014 -0500 ---------------------------------------------------------------------- CHANGES.txt | 2 ++ .../apache/cassandra/db/composites/AbstractCellNameType.java | 1 + .../cassandra/db/composites/CompoundDenseCellNameType.java | 7 +++---- src/java/org/apache/cassandra/thrift/CassandraServer.java | 4 ++-- 4 files changed, 8 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/071b5f83/CHANGES.txt ---------------------------------------------------------------------- diff --git a/CHANGES.txt b/CHANGES.txt index 6949209..6a87f64 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,4 +1,6 @@ 2.1.1 + * Fix some Thrift slice deletions and updates of COMPACT STORAGE + tables with some clustering columns omitted (CASSANDRA-7990) * Fix filtering for CONTAINS on sets (CASSANDRA-8033) * Properly track added size (CASSANDRA-7239) * Allow compilation in java 8 (CASSANDRA-7208) http://git-wip-us.apache.org/repos/asf/cassandra/blob/071b5f83/src/java/org/apache/cassandra/db/composites/AbstractCellNameType.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/db/composites/AbstractCellNameType.java b/src/java/org/apache/cassandra/db/composites/AbstractCellNameType.java index 7570d2c..e33cc63 100644 --- a/src/java/org/apache/cassandra/db/composites/AbstractCellNameType.java +++ b/src/java/org/apache/cassandra/db/composites/AbstractCellNameType.java @@ -184,6 +184,7 @@ public abstract class AbstractCellNameType extends AbstractCType implements Cell public CellName cellFromByteBuffer(ByteBuffer bytes) { + // we're not guaranteed to get a CellName back from fromByteBuffer(), so it's on the caller to guarantee this return (CellName)fromByteBuffer(bytes); } http://git-wip-us.apache.org/repos/asf/cassandra/blob/071b5f83/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 e3c2831..2e409fb 100644 --- a/src/java/org/apache/cassandra/db/composites/CompoundDenseCellNameType.java +++ b/src/java/org/apache/cassandra/db/composites/CompoundDenseCellNameType.java @@ -54,14 +54,13 @@ public class CompoundDenseCellNameType extends AbstractCompoundCellNameType public CellName create(Composite prefix, ColumnDefinition column) { // We ignore the column because it's just the COMPACT_VALUE name which is not store in the cell name (and it can be null anyway) - assert prefix.size() == fullSize; if (prefix instanceof CellName) return (CellName)prefix; + // as noted below in makeWith(), compound dense cell names don't have to include all components assert prefix instanceof CompoundComposite; CompoundComposite lc = (CompoundComposite)prefix; - assert lc.elements.length == lc.size; - return new CompoundDenseCellName(lc.elements); + return new CompoundDenseCellName(lc.elements, lc.size); } protected Composite makeWith(ByteBuffer[] components, int size, Composite.EOC eoc, boolean isStatic) @@ -69,7 +68,7 @@ public class CompoundDenseCellNameType extends AbstractCompoundCellNameType assert !isStatic; // 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); + CompoundDenseCellName c = new CompoundDenseCellName(components, size); return eoc != Composite.EOC.NONE ? c.withEOC(eoc) : c; } http://git-wip-us.apache.org/repos/asf/cassandra/blob/071b5f83/src/java/org/apache/cassandra/thrift/CassandraServer.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/thrift/CassandraServer.java b/src/java/org/apache/cassandra/thrift/CassandraServer.java index de0b125..a4f25b8 100644 --- a/src/java/org/apache/cassandra/thrift/CassandraServer.java +++ b/src/java/org/apache/cassandra/thrift/CassandraServer.java @@ -933,8 +933,8 @@ public class CassandraServer implements Cassandra.Iface del.timestamp); else mutation.deleteRange(cfm.cfName, - cfm.comparator.cellFromByteBuffer(del.predicate.getSlice_range().start), - cfm.comparator.cellFromByteBuffer(del.predicate.getSlice_range().finish), + cfm.comparator.fromByteBuffer(del.predicate.getSlice_range().start), + cfm.comparator.fromByteBuffer(del.predicate.getSlice_range().finish), del.timestamp); } else