You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by sa...@apache.org on 2017/05/10 10:35:38 UTC
[3/6] cassandra git commit: Avoid reading static row twice from
legacy sstables
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 <sa...@beobal.com>
Authored: Thu May 4 06:03:42 2017 -0700
Committer: Sam Tunnicliffe <sa...@beobal.com>
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