Author: jbellis
Date: Tue Jul 28 02:45:33 2009
New Revision: 798367

URL: http://svn.apache.org/viewvc?rev=798367&view=rev
Log:
handle incomplete CL entries on recover
patch by jbellis; reviewed by Jun Rao for CASSANDRA-182

Modified:
    incubator/cassandra/trunk/src/java/org/apache/cassandra/db/CommitLog.java

Modified: 
incubator/cassandra/trunk/src/java/org/apache/cassandra/db/CommitLog.java
URL: 
http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/db/CommitLog.java?rev=798367&r1=798366&r2=798367&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/db/CommitLog.java 
(original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/db/CommitLog.java 
Tue Jul 28 02:45:33 2009
@@ -270,8 +270,17 @@
             /* read the logs populate RowMutation and apply */
             while ( !reader.isEOF() )
             {
-                byte[] bytes = new byte[(int)reader.readLong()];
-                reader.readDirect(bytes);
+                byte[] bytes;
+                try
+                {
+                    bytes = new byte[(int)reader.readLong()];
+                    reader.readDirect(bytes);
+                }
+                catch (EOFException e)
+                {
+                    // last CL entry didn't get completely written.  that's ok.
+                    break;
+                }
                 bufIn.reset(bytes, bytes.length);
 
                 /* read the commit log entry */


Reply via email to