cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From slebre...@apache.org
Subject svn commit: r1175725 - in /cassandra/branches/cassandra-1.0.0: CHANGES.txt src/java/org/apache/cassandra/db/commitlog/CommitLog.java
Date Mon, 26 Sep 2011 09:03:20 GMT
Author: slebresne
Date: Mon Sep 26 09:03:19 2011
New Revision: 1175725

URL: http://svn.apache.org/viewvc?rev=1175725&view=rev
Log:
Fix deadlock in commit log during flush
patch by jbellis; reviewed by slebresne for CASSANDRA-3253

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

Modified: cassandra/branches/cassandra-1.0.0/CHANGES.txt
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-1.0.0/CHANGES.txt?rev=1175725&r1=1175724&r2=1175725&view=diff
==============================================================================
--- cassandra/branches/cassandra-1.0.0/CHANGES.txt (original)
+++ cassandra/branches/cassandra-1.0.0/CHANGES.txt Mon Sep 26 09:03:19 2011
@@ -18,6 +18,7 @@
  * Don't allow any cache loading exceptions to halt startup (CASSANDRA-3218)
  * Fix sstableloader --ignores option (CASSANDRA-3247)
  * File descriptor limit increased in packaging (CASSANDRA-3206)
+ * Fix deadlock in commit log during flush (CASSANDRA-3253)
 
 
 1.0.0-beta1

Modified: cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/db/commitlog/CommitLog.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/db/commitlog/CommitLog.java?rev=1175725&r1=1175724&r2=1175725&view=diff
==============================================================================
--- cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/db/commitlog/CommitLog.java
(original)
+++ cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/db/commitlog/CommitLog.java
Mon Sep 26 09:03:19 2011
@@ -43,6 +43,7 @@ import org.apache.cassandra.concurrent.S
 import org.apache.cassandra.config.Config;
 import org.apache.cassandra.config.DatabaseDescriptor;
 import org.apache.cassandra.io.util.FastByteArrayInputStream;
+import org.apache.cassandra.service.StorageService;
 import org.apache.cassandra.utils.ByteBufferUtil;
 import org.apache.cassandra.utils.FBUtilities;
 import org.apache.cassandra.utils.WrappedRunnable;
@@ -570,7 +571,18 @@ public class CommitLog implements Commit
             for (Integer dirtyCFId : oldestSegment.cfLastWrite.keySet())
             {
                 String keypace = Schema.instance.getCF(dirtyCFId).left;
-                Table.open(keypace).getColumnFamilyStore(dirtyCFId).forceFlush();
+                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()
+                {
+                    public void run()
+                    {
+                        cfs.forceFlush();
+                    }
+                };
+                StorageService.optionalTasks.execute(runnable);
             }
         }
     }



Mime
View raw message