cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r1079513 - /cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
Date Tue, 08 Mar 2011 20:14:20 GMT
Author: jbellis
Date: Tue Mar  8 20:14:20 2011
New Revision: 1079513

URL: http://svn.apache.org/viewvc?rev=1079513&view=rev
Log:
refactor to avoid double negative

Modified:
    cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStore.java

Modified: cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStore.java?rev=1079513&r1=1079512&r2=1079513&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStore.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStore.java Tue Mar  8 20:14:20
2011
@@ -1303,16 +1303,20 @@ public class ColumnFamilyStore implement
             IColumnIterator iter;
 
             int sstablesToIterate = 0;
-            if (!reverseReadWriteOrder())
+            if (reverseReadWriteOrder())
             {
-                //XXX: race condition: may allow double reconcile; but never misses an MT
+                // XXX: race condition: may miss an MT, but no double counts
 
-                /* add the current memtable */
-                iter = filter.getMemtableColumnIterator(getMemtableThreadSafe(), getComparator());
-                if (iter != null)
+                /* add the SSTables on disk */
+                for (SSTableReader sstable : ssTables)
                 {
-                    returnCF.delete(iter.getColumnFamily());
-                    iterators.add(iter);
+                    iter = filter.getSSTableColumnIterator(sstable);
+                    if (iter.getColumnFamily() != null)
+                    {
+                        returnCF.delete(iter.getColumnFamily());
+                        iterators.add(iter);
+                        sstablesToIterate++;
+                    }
                 }
 
                 /* add the memtables being flushed */
@@ -1325,33 +1329,25 @@ public class ColumnFamilyStore implement
                         iterators.add(iter);
                     }
                 }
-                
-                /* add the SSTables on disk */
-                for (SSTableReader sstable : ssTables)
+
+                /* add the current memtable */
+                iter = filter.getMemtableColumnIterator(getMemtableThreadSafe(), getComparator());
+                if (iter != null)
                 {
-                    iter = filter.getSSTableColumnIterator(sstable);
-                    if (iter.getColumnFamily() != null)
-                    {
-                        returnCF.delete(iter.getColumnFamily());
-                        iterators.add(iter);
-                        sstablesToIterate++;
-                    }
+                    returnCF.delete(iter.getColumnFamily());
+                    iterators.add(iter);
                 }
             }
             else
             {
-                //XXX: race condition: may miss an MT, but no double counts
+                // XXX: race condition: may allow double reconcile; but never misses an MT
 
-                /* add the SSTables on disk */
-                for (SSTableReader sstable : ssTables)
+                /* add the current memtable */
+                iter = filter.getMemtableColumnIterator(getMemtableThreadSafe(), getComparator());
+                if (iter != null)
                 {
-                    iter = filter.getSSTableColumnIterator(sstable);
-                    if (iter.getColumnFamily() != null)
-                    {
-                        returnCF.delete(iter.getColumnFamily());
-                        iterators.add(iter);
-                        sstablesToIterate++;
-                    }
+                    returnCF.delete(iter.getColumnFamily());
+                    iterators.add(iter);
                 }
 
                 /* add the memtables being flushed */
@@ -1365,12 +1361,16 @@ public class ColumnFamilyStore implement
                     }
                 }
 
-                /* add the current memtable */
-                iter = filter.getMemtableColumnIterator(getMemtableThreadSafe(), getComparator());
-                if (iter != null)
+                /* add the SSTables on disk */
+                for (SSTableReader sstable : ssTables)
                 {
-                    returnCF.delete(iter.getColumnFamily());
-                    iterators.add(iter);
+                    iter = filter.getSSTableColumnIterator(sstable);
+                    if (iter.getColumnFamily() != null)
+                    {
+                        returnCF.delete(iter.getColumnFamily());
+                        iterators.add(iter);
+                        sstablesToIterate++;
+                    }
                 }
             }
             recentSSTablesPerRead.add(sstablesToIterate);



Mime
View raw message