Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id A6500200C80 for ; Wed, 10 May 2017 12:35:39 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id A2443160BB4; Wed, 10 May 2017 10:35:39 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id F0E1A160BC6 for ; Wed, 10 May 2017 12:35:38 +0200 (CEST) Received: (qmail 44832 invoked by uid 500); 10 May 2017 10:35:37 -0000 Mailing-List: contact commits-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list commits@cassandra.apache.org Received: (qmail 44366 invoked by uid 99); 10 May 2017 10:35:36 -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; Wed, 10 May 2017 10:35:36 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 66DB3E01BC; Wed, 10 May 2017 10:35:36 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: samt@apache.org To: commits@cassandra.apache.org Date: Wed, 10 May 2017 10:35:38 -0000 Message-Id: <0811f81e41534b949fa9c11f72591c6e@git.apache.org> In-Reply-To: <11a7c6f451fe44c9a50ae12a3cb9c015@git.apache.org> References: <11a7c6f451fe44c9a50ae12a3cb9c015@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [3/6] cassandra git commit: Avoid reading static row twice from legacy sstables archived-at: Wed, 10 May 2017 10:35:39 -0000 Avoid reading static row twice from legacy sstables Patch by Sam Tunnicliffe; reviewed by Jeff Jirsa for CASSANDRA-13236 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/415d06b1 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/415d06b1 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/415d06b1 Branch: refs/heads/trunk Commit: 415d06b1da7062c48e735c1c20ded031fa0349d2 Parents: 0f118a9 Author: Sam Tunnicliffe Authored: Thu May 4 06:03:42 2017 -0700 Committer: Sam Tunnicliffe Committed: Wed May 10 10:03:51 2017 +0100 ---------------------------------------------------------------------- CHANGES.txt | 1 + .../db/columniterator/AbstractSSTableIterator.java | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/415d06b1/CHANGES.txt ---------------------------------------------------------------------- diff --git a/CHANGES.txt b/CHANGES.txt index 17a11ab..2ef5863 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,4 +1,5 @@ 3.0.14 + * Avoid reading static row twice from old format sstables (CASSANDRA-13236) * Fix NPE in StorageService.excise() (CASSANDRA-13163) * Expire OutboundTcpConnection messages by a single Thread (CASSANDRA-13265) * Fail repair if insufficient responses received (CASSANDRA-13397) http://git-wip-us.apache.org/repos/asf/cassandra/blob/415d06b1/src/java/org/apache/cassandra/db/columniterator/AbstractSSTableIterator.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/db/columniterator/AbstractSSTableIterator.java b/src/java/org/apache/cassandra/db/columniterator/AbstractSSTableIterator.java index d57e6bc..c61b6aa 100644 --- a/src/java/org/apache/cassandra/db/columniterator/AbstractSSTableIterator.java +++ b/src/java/org/apache/cassandra/db/columniterator/AbstractSSTableIterator.java @@ -29,6 +29,7 @@ import org.apache.cassandra.db.rows.*; import org.apache.cassandra.io.sstable.format.SSTableReader; import org.apache.cassandra.io.sstable.CorruptSSTableException; import org.apache.cassandra.io.sstable.IndexHelper; +import org.apache.cassandra.io.sstable.format.Version; import org.apache.cassandra.io.util.FileDataInput; import org.apache.cassandra.io.util.DataPosition; import org.apache.cassandra.utils.ByteBufferUtil; @@ -285,6 +286,7 @@ abstract class AbstractSSTableIterator implements SliceableUnfilteredRowIterator { private final boolean shouldCloseFile; public FileDataInput file; + public final Version version; protected UnfilteredDeserializer deserializer; @@ -295,6 +297,7 @@ abstract class AbstractSSTableIterator implements SliceableUnfilteredRowIterator { this.file = file; this.shouldCloseFile = shouldCloseFile; + this.version = sstable.descriptor.version; if (file != null) createDeserializer(); @@ -430,6 +433,19 @@ abstract class AbstractSSTableIterator implements SliceableUnfilteredRowIterator currentIndexIdx = blockIdx; reader.openMarker = blockIdx > 0 ? indexes.get(blockIdx - 1).endOpenMarker : null; mark = reader.file.mark(); + + // If we're reading an old format file and we move to the first block in the index (i.e. the + // head of the partition), we skip the static row as it's already been read when we first opened + // the iterator. If we don't do this and a static row is present, we'll re-read it but treat it + // as a regular row, causing deserialization to blow up later as that row's flags will be invalid + // see CASSANDRA-12088 & CASSANDRA-13236 + if (!reader.version.storeRows() + && blockIdx == 0 + && reader.deserializer.hasNext() + && reader.deserializer.nextIsStatic()) + { + reader.deserializer.skipNext(); + } } private long columnOffset(int i) --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org For additional commands, e-mail: commits-help@cassandra.apache.org