You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by sl...@apache.org on 2016/01/12 14:19:03 UTC
[2/6] cassandra git commit: Support multiple addComplexDeletion()
call in BTreeRow.Builder
Support multiple addComplexDeletion() call in BTreeRow.Builder
patch by slebresne; reviewed by benedict for CASSANDRA-10743
When reading legacy sstable who has an index block stopping in the
middle of a collection range tombstone, this end up calling
BTreeRow.Builder.addComplexDeletion() twice for the same column, so
we need to handle this.
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/f4037f9b
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/f4037f9b
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/f4037f9b
Branch: refs/heads/cassandra-3.3
Commit: f4037f9b3b20071e66298d4a7d228c1e46bb5206
Parents: 6fdcaef
Author: Sylvain Lebresne <sy...@datastax.com>
Authored: Fri Jan 8 14:41:00 2016 +0100
Committer: Sylvain Lebresne <sy...@datastax.com>
Committed: Tue Jan 12 14:15:41 2016 +0100
----------------------------------------------------------------------
CHANGES.txt | 2 ++
src/java/org/apache/cassandra/db/rows/BTreeRow.java | 15 +++++++++++----
2 files changed, 13 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/f4037f9b/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 36a6e43..da5ed26 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,6 @@
3.0.3
+ * Fix UnsupportedOperationException when reading old sstable with range
+ tombstone (CASSANDRA-10743)
* MV should use the maximum timestamp of the primary key (CASSANDRA-10910)
* Fix potential assertion error during compaction (CASSANDRA-10944)
* Fix counting of received sstables in streaming (CASSANDRA-10949)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/f4037f9b/src/java/org/apache/cassandra/db/rows/BTreeRow.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/rows/BTreeRow.java b/src/java/org/apache/cassandra/db/rows/BTreeRow.java
index 4bd11da..e8667e0 100644
--- a/src/java/org/apache/cassandra/db/rows/BTreeRow.java
+++ b/src/java/org/apache/cassandra/db/rows/BTreeRow.java
@@ -549,12 +549,19 @@ public class BTreeRow extends AbstractRow
// TODO: relax this in the case our outer provider is sorted (want to delay until remaining changes are
// bedded in, as less important; galloping makes it pretty cheap anyway)
Arrays.sort(cells, lb, ub, (Comparator<Object>) column.cellComparator());
- cell = (Cell) cells[lb];
DeletionTime deletion = DeletionTime.LIVE;
- if (cell instanceof ComplexColumnDeletion)
+ // Deal with complex deletion (for which we've use "fake" ComplexColumnDeletion cells that we need to remove).
+ // Note that in almost all cases we'll at most one of those fake cell, but the contract of {{Row.Builder.addComplexDeletion}}
+ // does not forbid it being called twice (especially in the unsorted case) and this can actually happen when reading
+ // legacy sstables (see #10743).
+ while (lb < ub)
{
- // TODO: do we need to be robust to multiple of these being provided?
- deletion = new DeletionTime(cell.timestamp(), cell.localDeletionTime());
+ cell = (Cell) cells[lb];
+ if (!(cell instanceof ComplexColumnDeletion))
+ break;
+
+ if (cell.timestamp() > deletion.markedForDeleteAt())
+ deletion = new DeletionTime(cell.timestamp(), cell.localDeletionTime());
lb++;
}