Return-Path: X-Original-To: apmail-cassandra-commits-archive@www.apache.org Delivered-To: apmail-cassandra-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 118EC18ABE for ; Tue, 12 Jan 2016 13:19:04 +0000 (UTC) Received: (qmail 22111 invoked by uid 500); 12 Jan 2016 13:19:03 -0000 Delivered-To: apmail-cassandra-commits-archive@cassandra.apache.org Received: (qmail 22020 invoked by uid 500); 12 Jan 2016 13:19:03 -0000 Mailing-List: contact commits-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cassandra.apache.org Delivered-To: mailing list commits@cassandra.apache.org Received: (qmail 21245 invoked by uid 99); 12 Jan 2016 13:19:03 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 12 Jan 2016 13:19:03 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id D3C6CE027D; Tue, 12 Jan 2016 13:19:02 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: slebresne@apache.org To: commits@cassandra.apache.org Date: Tue, 12 Jan 2016 13:19:04 -0000 Message-Id: <49b3ef07827e41289e82598e675db3d0@git.apache.org> In-Reply-To: <22ca9086ac8e4829837a873f6f814c96@git.apache.org> References: <22ca9086ac8e4829837a873f6f814c96@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [3/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/trunk Commit: f4037f9b3b20071e66298d4a7d228c1e46bb5206 Parents: 6fdcaef Author: Sylvain Lebresne Authored: Fri Jan 8 14:41:00 2016 +0100 Committer: Sylvain Lebresne 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) 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++; }