cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r1003742 - in /cassandra/branches/cassandra-0.6: CHANGES.txt src/java/org/apache/cassandra/db/commitlog/CommitLog.java src/java/org/apache/cassandra/db/commitlog/CommitLogHeader.java
Date Sat, 02 Oct 2010 05:04:44 GMT
Author: jbellis
Date: Sat Oct  2 05:04:42 2010
New Revision: 1003742

URL: http://svn.apache.org/viewvc?rev=1003742&view=rev
Log:
remove assertion causing rare (and harmless) error messages in commitlog.  patch by jbellis;
reviewed by mdennis for CASSANDRA-1330

Modified:
    cassandra/branches/cassandra-0.6/CHANGES.txt
    cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/db/commitlog/CommitLog.java
    cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/db/commitlog/CommitLogHeader.java

Modified: cassandra/branches/cassandra-0.6/CHANGES.txt
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.6/CHANGES.txt?rev=1003742&r1=1003741&r2=1003742&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.6/CHANGES.txt (original)
+++ cassandra/branches/cassandra-0.6/CHANGES.txt Sat Oct  2 05:04:42 2010
@@ -37,6 +37,8 @@
  * add memtable, cache information to GCInspector logs (CASSANDRA-1558)
  * enable/disable HintedHandoff via JMX (CASSANDRA-1550)
  * allow nodes to change IPs between restarts (CASSANDRA-1518)
+ * remove assertion causing rare (and harmless) error messages in
+   commitlog (CASSANDRA-1330)
 
 
 0.6.5

Modified: cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/db/commitlog/CommitLog.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/db/commitlog/CommitLog.java?rev=1003742&r1=1003741&r2=1003742&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/db/commitlog/CommitLog.java
(original)
+++ cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/db/commitlog/CommitLog.java
Sat Oct  2 05:04:42 2010
@@ -376,12 +376,6 @@ public class CommitLog
             logger.debug("discard completed log segments for " + context + ", column family
" + id + ". CFIDs are " + Table.TableMetadata.getColumnFamilyIDString());
 
         /*
-         * log replay assumes that we only have to look at entries past the last
-         * flush position, so verify that this flush happens after the last. See CASSANDRA-936
-        */
-        assert context.position >= context.getSegment().getHeader().getPosition(id)
-               : "discard at " + context + " is not after last flush at " + context.getSegment().getHeader().getPosition(id);
-        /*
          * Loop through all the commit log files in the history. Now process
          * all files that are older than the one in the context. For each of
          * these files the header needs to modified by resetting the dirty

Modified: cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/db/commitlog/CommitLogHeader.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/db/commitlog/CommitLogHeader.java?rev=1003742&r1=1003741&r2=1003742&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/db/commitlog/CommitLogHeader.java
(original)
+++ cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/db/commitlog/CommitLogHeader.java
Sat Oct  2 05:04:42 2010
@@ -20,7 +20,6 @@ package org.apache.cassandra.db.commitlo
 
 import java.io.*;
 import java.util.BitSet;
-import java.util.Arrays;
 
 import org.apache.cassandra.db.Table;
 import org.apache.cassandra.io.ICompactSerializer;
@@ -39,7 +38,7 @@ class CommitLogHeader
     static int getLowestPosition(CommitLogHeader clHeader)
     {
         int minPosition = Integer.MAX_VALUE;
-        for ( int position : clHeader.lastFlushedAt)
+        for (int position : clHeader.cfDirtiedAt)
         {
             if ( position < minPosition && position > 0)
             {
@@ -53,12 +52,12 @@ class CommitLogHeader
     }
 
     private BitSet dirty; // columnfamilies with un-flushed data in this CommitLog
-    private int[] lastFlushedAt; // position at which each CF was last flushed
+    private int[] cfDirtiedAt; // position at which each CF was last flushed
     
     CommitLogHeader(int size)
     {
         dirty = new BitSet(size);
-        lastFlushedAt = new int[size];
+        cfDirtiedAt = new int[size];
     }
     
     /*
@@ -66,10 +65,10 @@ class CommitLogHeader
      * also builds an index of position to column family
      * Id.
     */
-    CommitLogHeader(BitSet dirty, int[] lastFlushedAt)
+    CommitLogHeader(BitSet dirty, int[] cfDirtiedAt)
     {
         this.dirty = dirty;
-        this.lastFlushedAt = lastFlushedAt;
+        this.cfDirtiedAt = cfDirtiedAt;
     }
         
     boolean isDirty(int index)
@@ -79,19 +78,19 @@ class CommitLogHeader
     
     int getPosition(int index)
     {
-        return lastFlushedAt[index];
+        return cfDirtiedAt[index];
     }
     
     void turnOn(int index, long position)
     {
         dirty.set(index);
-        lastFlushedAt[index] = (int) position;
+        cfDirtiedAt[index] = (int) position;
     }
 
     void turnOff(int index)
     {
         dirty.set(index, false);
-        lastFlushedAt[index] = 0;
+        cfDirtiedAt[index] = 0;
     }
 
     boolean isSafeToDelete() throws IOException
@@ -119,9 +118,9 @@ class CommitLogHeader
             }
         }
         sb.append("}, flushed={");
-        for (int i = 0; i < lastFlushedAt.length; i++)
+        for (int i = 0; i < cfDirtiedAt.length; i++)
         {
-            sb.append(Table.TableMetadata.getColumnFamilyName(i)).append(": ").append(lastFlushedAt[i]).append(",
");
+            sb.append(Table.TableMetadata.getColumnFamilyName(i)).append(": ").append(cfDirtiedAt[i]).append(",
");
         }
         sb.append("})");
         return sb.toString();
@@ -151,7 +150,7 @@ class CommitLogHeader
 
     public int getColumnFamilyCount()
     {
-        return lastFlushedAt.length;
+        return cfDirtiedAt.length;
     }
 
     static class CommitLogHeaderSerializer implements ICompactSerializer<CommitLogHeader>
@@ -159,8 +158,8 @@ class CommitLogHeader
         public void serialize(CommitLogHeader clHeader, DataOutputStream dos) throws IOException
         {
             BitSetSerializer.serialize(clHeader.dirty, dos);
-            dos.writeInt(clHeader.lastFlushedAt.length);
-            for (int position : clHeader.lastFlushedAt)
+            dos.writeInt(clHeader.cfDirtiedAt.length);
+            for (int position : clHeader.cfDirtiedAt)
             {
                 dos.writeInt(position);
             }



Mime
View raw message