Fix 'Wrong class type' assertion error in CounterColumn patch by slebresne; reviewed by jbellis for CASSANDRA-4976
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/d0292ef4 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/d0292ef4 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/d0292ef4 Branch: refs/heads/cassandra-1.2 Commit: d0292ef45ad215e3980fc92fe0ef1e9cf5604fa8 Parents: e128ab0 Author: Sylvain Lebresne <[email protected]> Authored: Fri Nov 23 10:01:39 2012 +0100 Committer: Sylvain Lebresne <[email protected]> Committed: Fri Nov 23 10:01:39 2012 +0100 ---------------------------------------------------------------------- CHANGES.txt | 1 + .../org/apache/cassandra/db/CounterColumn.java | 12 ++++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/d0292ef4/CHANGES.txt ---------------------------------------------------------------------- diff --git a/CHANGES.txt b/CHANGES.txt index b32b3b6..7c653d0 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -21,6 +21,7 @@ * Fix duplicate SSTable reference when stream session failed (CASSANDRA-3306) * Allow static CF definition with compact storage (CASSANDRA-4910) * Fix endless loop/compaction of schema_* CFs due to broken timestamps (CASSANDRA-4880) + * Fix 'wrong class type' assertion in CounterColumn (CASSANDRA-4976) 1.1.6 http://git-wip-us.apache.org/repos/asf/cassandra/blob/d0292ef4/src/java/org/apache/cassandra/db/CounterColumn.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/db/CounterColumn.java b/src/java/org/apache/cassandra/db/CounterColumn.java index b6e3909..67771a4 100644 --- a/src/java/org/apache/cassandra/db/CounterColumn.java +++ b/src/java/org/apache/cassandra/db/CounterColumn.java @@ -107,10 +107,18 @@ public class CounterColumn extends Column @Override public IColumn diff(IColumn column) { - assert column instanceof CounterColumn : "Wrong class type."; + assert (column instanceof CounterColumn) || (column instanceof DeletedColumn) : "Wrong class type: " + column.getClass(); if (timestamp() < column.timestamp()) return column; + + // Note that if at that point, column can't be a tombstone. Indeed, + // column is the result of merging us with other nodes results, and + // merging a CounterColumn with a tombstone never return a tombstone + // unless that tombstone timestamp is greater that the CounterColumn + // one. + assert !(column instanceof DeletedColumn) : "Wrong class type: " + column.getClass(); + if (timestampOfLastDelete() < ((CounterColumn)column).timestampOfLastDelete()) return column; ContextRelationship rel = contextManager.diff(column.value(), value()); @@ -148,7 +156,7 @@ public class CounterColumn extends Column @Override public IColumn reconcile(IColumn column, Allocator allocator) { - assert (column instanceof CounterColumn) || (column instanceof DeletedColumn) : "Wrong class type."; + assert (column instanceof CounterColumn) || (column instanceof DeletedColumn) : "Wrong class type: " + column.getClass(); if (column.isMarkedForDelete()) // live + tombstone: track last tombstone {
