You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by db...@apache.org on 2015/05/26 06:57:29 UTC

cassandra git commit: remove unnecessary sanity checks as dataSize and dataSizeFromIndex are always the same

Repository: cassandra
Updated Branches:
  refs/heads/cassandra-2.2 587b654ed -> d85bf4a02


remove unnecessary sanity checks as dataSize and dataSizeFromIndex are always the same


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

Branch: refs/heads/cassandra-2.2
Commit: d85bf4a02ea5e36ada901d2c60f9da029975e341
Parents: 587b654
Author: Dave Brosius <db...@mebigfatguy.com>
Authored: Tue May 26 00:57:04 2015 -0400
Committer: Dave Brosius <db...@mebigfatguy.com>
Committed: Tue May 26 00:57:04 2015 -0400

----------------------------------------------------------------------
 .../org/apache/cassandra/db/compaction/Scrubber.java    | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/d85bf4a0/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 809a409..3941c48 100644
--- a/src/java/org/apache/cassandra/db/compaction/Scrubber.java
+++ b/src/java/org/apache/cassandra/db/compaction/Scrubber.java
@@ -173,10 +173,9 @@ public class Scrubber implements Closeable
                     dataSizeFromIndex = nextRowPositionFromIndex - dataStartFromIndex;
                 }
 
-                long dataSize = dataSizeFromIndex;
                 // avoid an NPE if key is null
                 String keyName = key == null ? "(unreadable key)" : ByteBufferUtil.bytesToHex(key.getKey());
-                outputHandler.debug(String.format("row %s is %s bytes", keyName, dataSize));
+                outputHandler.debug(String.format("row %s is %s bytes", keyName, dataSizeFromIndex));
 
                 assert currentIndexKey != null || indexFile.isEOF();
 
@@ -191,15 +190,12 @@ public class Scrubber implements Closeable
                                 ByteBufferUtil.bytesToHex(key.getKey()), ByteBufferUtil.bytesToHex(currentIndexKey))));
                     }
 
-                    if (dataSize > dataFile.length())
-                        throw new IOError(new IOException("Impossible row size " + dataSize));
+                    if (dataSizeFromIndex > dataFile.length())
+                        throw new IOError(new IOException("Impossible row size " + dataSizeFromIndex));
 
                     if (dataStart != dataStartFromIndex)
                         outputHandler.warn(String.format("Data file row position %d differs from index file row position %d", dataStart, dataStartFromIndex));
 
-                    if (dataSize != dataSizeFromIndex)
-                        outputHandler.warn(String.format("Data file row size %d different from index file row size %d", dataSize, dataSizeFromIndex));
-
                     SSTableIdentityIterator atoms = new SSTableIdentityIterator(sstable, dataFile, key, checkData);
 
                     if (prevKey != null && prevKey.compareTo(key) > 0)
@@ -222,7 +218,7 @@ public class Scrubber implements Closeable
                     outputHandler.warn("Error reading row (stacktrace follows):", th);
 
                     if (currentIndexKey != null
-                        && (key == null || !key.getKey().equals(currentIndexKey) || dataStart != dataStartFromIndex || dataSize != dataSizeFromIndex))
+                        && (key == null || !key.getKey().equals(currentIndexKey) || dataStart != dataStartFromIndex))
                     {
                         outputHandler.output(String.format("Retrying from row index; data is %s bytes starting at %s",
                                                   dataSizeFromIndex, dataStartFromIndex));