cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From slebre...@apache.org
Subject svn commit: r1209397 - in /cassandra/branches/cassandra-1.0: CHANGES.txt src/java/org/apache/cassandra/db/ColumnFamilyStore.java
Date Fri, 02 Dec 2011 10:48:41 GMT
Author: slebresne
Date: Fri Dec  2 10:48:40 2011
New Revision: 1209397

URL: http://svn.apache.org/viewvc?rev=1209397&view=rev
Log:
fix race between cf flush and its 2ndary indexes flush
patch by slebresne; reviewed by jbellis for CASSANDRA-3547

Modified:
    cassandra/branches/cassandra-1.0/CHANGES.txt
    cassandra/branches/cassandra-1.0/src/java/org/apache/cassandra/db/ColumnFamilyStore.java

Modified: cassandra/branches/cassandra-1.0/CHANGES.txt
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-1.0/CHANGES.txt?rev=1209397&r1=1209396&r2=1209397&view=diff
==============================================================================
--- cassandra/branches/cassandra-1.0/CHANGES.txt (original)
+++ cassandra/branches/cassandra-1.0/CHANGES.txt Fri Dec  2 10:48:40 2011
@@ -6,6 +6,7 @@
  * (CQL) INSERT/UPDATE/DELETE/TRUNCATE commands should allow CF names to
    be qualified by keyspace (CASSANDRA-3419)
  * always remove endpoints from delevery queue in HH (CASSANDRA-3546)
+ * fix race between cf flush and its 2ndary indexes flush (CASSANDRA-3547)
 
 
 1.0.5

Modified: cassandra/branches/cassandra-1.0/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-1.0/src/java/org/apache/cassandra/db/ColumnFamilyStore.java?rev=1209397&r1=1209396&r2=1209397&view=diff
==============================================================================
--- cassandra/branches/cassandra-1.0/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
(original)
+++ cassandra/branches/cassandra-1.0/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
Fri Dec  2 10:48:40 2011
@@ -669,7 +669,6 @@ public class ColumnFamilyStore implement
             }
 
             assert getMemtableThreadSafe() == oldMemtable;
-            oldMemtable.freeze();
             final ReplayPosition ctx = writeCommitLog ? CommitLog.instance.getContext() :
ReplayPosition.NONE;
             logger.debug("flush position is {}", ctx);
 
@@ -678,8 +677,13 @@ public class ColumnFamilyStore implement
             // don't assume that this.memtable is dirty; forceFlush can bring us here during
index build even if it is not
             for (ColumnFamilyStore cfs : concatWithIndexes())
             {
-                if (!cfs.getMemtableThreadSafe().isClean())
+                Memtable mt = cfs.getMemtableThreadSafe();
+                if (!mt.isClean() && !mt.isFrozen())
+                {
+                    // We need to freeze indexes too because they can be concurrently flushed
too (#3547)
+                    mt.freeze();
                     icc.add(cfs);
+                }
             }
             final CountDownLatch latch = new CountDownLatch(icc.size());
             for (ColumnFamilyStore cfs : icc)
@@ -689,11 +693,6 @@ public class ColumnFamilyStore implement
                 memtable.flushAndSignal(latch, flushWriter, ctx);
             }
 
-            // we marked our memtable as frozen as part of the concurrency control,
-            // so even if there was nothing to flush we need to switch it out
-            if (!icc.contains(this))
-                data.renewMemtable();
-
             if (memtableSwitchCount == Integer.MAX_VALUE)
                 memtableSwitchCount = 0;
             memtableSwitchCount++;



Mime
View raw message