Author: jbellis
Date: Mon Aug 15 04:09:55 2011
New Revision: 1157708

URL: http://svn.apache.org/viewvc?rev=1157708&view=rev
Log:
re-use CRC32 object on replay
patch by Dave Brosius; reviewed by jbellis for CASSANDRA-3035

Modified:
    
cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/db/commitlog/CommitLog.java

Modified: 
cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/db/commitlog/CommitLog.java
URL: 
http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/db/commitlog/CommitLog.java?rev=1157708&r1=1157707&r2=1157708&view=diff
==============================================================================
--- 
cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/db/commitlog/CommitLog.java
 (original)
+++ 
cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/db/commitlog/CommitLog.java
 Mon Aug 15 04:09:55 2011
@@ -188,6 +188,7 @@ public class CommitLog
         }
         final ReplayPosition globalPosition = 
Ordering.from(ReplayPosition.comparator).min(cfPositions.values());
 
+        Checksum checksum = new CRC32();
         for (final File file : clogs)
         {
             final long segment = 
CommitLogSegment.idFromFilename(file.getName());
@@ -226,7 +227,6 @@ public class CommitLog
                         logger.debug("Reading mutation at " + 
reader.getFilePointer());
 
                     long claimedCRC32;
-                    Checksum checksum = new CRC32();
                     int serializedSize;
                     try
                     {
@@ -239,6 +239,7 @@ public class CommitLog
                         if (serializedSize < 10)
                             break;
                         long claimedSizeChecksum = reader.readLong();
+                        checksum.reset();
                         checksum.update(serializedSize);
                         if (checksum.getValue() != claimedSizeChecksum)
                             break; // entry wasn't synced correctly/fully.  
that's ok.


Reply via email to