cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jasobr...@apache.org
Subject git commit: Update scrub for single-pass compaction format patch by jasobrown; reviewed by slebresne for CASSANDRA-5429
Date Thu, 27 Jun 2013 16:51:17 GMT
Updated Branches:
  refs/heads/trunk 39355875f -> e22de4316


Update scrub for single-pass compaction format
patch by jasobrown; reviewed by slebresne for CASSANDRA-5429


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/e22de431
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/e22de431
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/e22de431

Branch: refs/heads/trunk
Commit: e22de4316e05a6bb4ec5c1621904f55332b7371a
Parents: 3935587
Author: Jason Brown <jasedbrown@gmail.com>
Authored: Wed Jun 26 14:54:10 2013 -0700
Committer: Jason Brown <jasedbrown@gmail.com>
Committed: Thu Jun 27 09:46:51 2013 -0700

----------------------------------------------------------------------
 .../cassandra/db/compaction/Scrubber.java       | 25 ++++++++++++++++----
 1 file changed, 20 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/e22de431/src/java/org/apache/cassandra/db/compaction/Scrubber.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/compaction/Scrubber.java b/src/java/org/apache/cassandra/db/compaction/Scrubber.java
index 5809741..d0503b9 100644
--- a/src/java/org/apache/cassandra/db/compaction/Scrubber.java
+++ b/src/java/org/apache/cassandra/db/compaction/Scrubber.java
@@ -127,8 +127,11 @@ public class Scrubber implements Closeable
                 try
                 {
                     key = sstable.partitioner.decorateKey(ByteBufferUtil.readWithShortLength(dataFile));
-                    dataSize = dataFile.readLong();
-                    outputHandler.debug(String.format("row %s is %s bytes", ByteBufferUtil.bytesToHex(key.key),
dataSize));
+                    if (sstable.descriptor.version.hasRowSizeAndColumnCount)
+                    {
+                        dataSize = dataFile.readLong();
+                        outputHandler.debug(String.format("row %s is %s bytes", ByteBufferUtil.bytesToHex(key.key),
dataSize));
+                    }
                 }
                 catch (Throwable th)
                 {
@@ -155,11 +158,23 @@ public class Scrubber implements Closeable
                 long dataStart = dataFile.getFilePointer();
                 long dataStartFromIndex = currentIndexKey == null
                                         ? -1
-                                        : rowStart + 2 + currentIndexKey.remaining() + 8;
+                                        : rowStart + 2 + currentIndexKey.remaining();
+                if (sstable.descriptor.version.hasRowSizeAndColumnCount)
+                    dataStartFromIndex += 8;
                 long dataSizeFromIndex = nextRowPositionFromIndex - dataStartFromIndex;
+
+                if (!sstable.descriptor.version.hasRowSizeAndColumnCount)
+                {
+                    dataSize = dataSizeFromIndex;
+                    outputHandler.debug(String.format("row %s is %s bytes", ByteBufferUtil.bytesToHex(key.key),
dataSize));
+                }
+                else
+                {
+                    if (currentIndexKey != null)
+                        outputHandler.debug(String.format("Index doublecheck: row %s is %s
bytes", ByteBufferUtil.bytesToHex(currentIndexKey),  dataSizeFromIndex));
+                }
+
                 assert currentIndexKey != null || indexFile.isEOF();
-                if (currentIndexKey != null)
-                    outputHandler.debug(String.format("Index doublecheck: row %s is %s bytes",
ByteBufferUtil.bytesToHex(currentIndexKey),  dataSizeFromIndex));
 
                 writer.mark();
                 try


Mime
View raw message