Updated Branches:
  refs/heads/cassandra-1.2 8dcdce4e9 -> b33b53e8f
  refs/heads/cassandra-2.0 bd45c4c59 -> a1e594bfb
  refs/heads/trunk 0c34fa8e9 -> 3f1465779


Mark CF clean if a mutation raced the drop and got it marked dirty
patch by jbellis; reviewed by Tyler Hobbs for CASSANDRA-5946


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/b33b53e8
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/b33b53e8
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/b33b53e8

Branch: refs/heads/cassandra-1.2
Commit: b33b53e8f91011fe07ed39df75d6b5728c6f8cf1
Parents: 8dcdce4
Author: Jonathan Ellis <jbel...@apache.org>
Authored: Tue Oct 15 23:41:01 2013 +0100
Committer: Jonathan Ellis <jbel...@apache.org>
Committed: Tue Oct 15 23:41:37 2013 +0100

----------------------------------------------------------------------
 CHANGES.txt                                     |  2 ++
 .../db/commitlog/CommitLogAllocator.java        | 34 +++++++++++++-------
 2 files changed, 25 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/b33b53e8/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 2dbadc4..d6ecac1 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,5 +1,7 @@
 1.2.12
  * Add ability to list specific KS/CF combinations in nodetool cfstats 
(CASSANDRA-4191)
+ * Mark CF clean if a mutation raced the drop and got it marked dirty 
+
 
 1.2.11
  * Limit CQL prepared statement cache by size instead of count (CASSANDRA-6107)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/b33b53e8/src/java/org/apache/cassandra/db/commitlog/CommitLogAllocator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/commitlog/CommitLogAllocator.java 
b/src/java/org/apache/cassandra/db/commitlog/CommitLogAllocator.java
index 2855979..d62d7ca 100644
--- a/src/java/org/apache/cassandra/db/commitlog/CommitLogAllocator.java
+++ b/src/java/org/apache/cassandra/db/commitlog/CommitLogAllocator.java
@@ -39,6 +39,7 @@ import org.apache.cassandra.db.Table;
 import org.apache.cassandra.io.util.FileUtils;
 import org.apache.cassandra.net.MessagingService;
 import org.apache.cassandra.service.StorageService;
+import org.apache.cassandra.utils.Pair;
 import org.apache.cassandra.utils.WrappedRunnable;
 
 /**
@@ -296,19 +297,30 @@ public class CommitLogAllocator
         {
             for (UUID dirtyCFId : oldestSegment.getDirtyCFIDs())
             {
-                String keypace = Schema.instance.getCF(dirtyCFId).left;
-                final ColumnFamilyStore cfs = 
Table.open(keypace).getColumnFamilyStore(dirtyCFId);
-                // flush shouldn't run on the commitlog executor, since it 
acquires Table.switchLock,
-                // which may already be held by a thread waiting for the CL 
executor (via getContext),
-                // causing deadlock
-                Runnable runnable = new Runnable()
+                Pair<String,String> pair = Schema.instance.getCF(dirtyCFId);
+                if (pair == null)
                 {
-                    public void run()
+                    // even though we remove the schema entry before a final 
flush when dropping a CF,
+                    // it's still possible for a writer to race and finish his 
append after the flush.
+                    logger.debug("Marking clean CF {} that doesn't exist 
anymore", dirtyCFId);
+                    oldestSegment.markClean(dirtyCFId, 
oldestSegment.getContext());
+                }
+                else
+                {
+                    String keypace = pair.left;
+                    final ColumnFamilyStore cfs = 
Table.open(keypace).getColumnFamilyStore(dirtyCFId);
+                    // flush shouldn't run on the commitlog executor, since it 
acquires Table.switchLock,
+                    // which may already be held by a thread waiting for the 
CL executor (via getContext),
+                    // causing deadlock
+                    Runnable runnable = new Runnable()
                     {
-                        cfs.forceFlush();
-                    }
-                };
-                StorageService.optionalTasks.execute(runnable);
+                        public void run()
+                        {
+                            cfs.forceFlush();
+                        }
+                    };
+                    StorageService.optionalTasks.execute(runnable);
+                }
             }
         }
     }

Reply via email to