cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gdusba...@apache.org
Subject svn commit: r1025543 - in /cassandra/trunk/src/java/org/apache/cassandra/db: ColumnFamilyStore.java CompactionManager.java Table.java
Date Wed, 20 Oct 2010 12:59:05 GMT
Author: gdusbabek
Date: Wed Oct 20 12:59:05 2010
New Revision: 1025543

URL: http://svn.apache.org/viewvc?rev=1025543&view=rev
Log:
fix drop race with flush. patch by gdusbabek, reviewed by jbellis. CASSANDRA-1631

Modified:
    cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
    cassandra/trunk/src/java/org/apache/cassandra/db/CompactionManager.java
    cassandra/trunk/src/java/org/apache/cassandra/db/Table.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=1025543&r1=1025542&r2=1025543&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStore.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStore.java Wed Oct 20 12:59:05
2010
@@ -569,6 +569,9 @@ public class ColumnFamilyStore implement
         {
             if (oldMemtable.isFrozen())
                 return null;
+            
+            if (DatabaseDescriptor.getCFMetaData(metadata.cfId) == null)
+                return null; // column family was dropped. no point in flushing.
 
             assert memtable == oldMemtable;
             memtable.freeze();

Modified: cassandra/trunk/src/java/org/apache/cassandra/db/CompactionManager.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/CompactionManager.java?rev=1025543&r1=1025542&r2=1025543&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/CompactionManager.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/CompactionManager.java Wed Oct 20 12:59:05
2010
@@ -507,7 +507,15 @@ public class CompactionManager implement
             {
                 for (ColumnFamilyStore cfs : stores)
                 {
-                    cfs.table.dropCf(cfs.metadata.cfId);
+                    Table.flusherLock.writeLock().lock();
+                    try
+                    {
+                        cfs.table.dropCf(cfs.metadata.cfId);
+                    }
+                    finally
+                    {
+                        Table.flusherLock.writeLock().unlock();
+                    }
                 }
                 return null;
             }

Modified: cassandra/trunk/src/java/org/apache/cassandra/db/Table.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/Table.java?rev=1025543&r1=1025542&r2=1025543&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/Table.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/Table.java Wed Oct 20 12:59:05 2010
@@ -58,7 +58,7 @@ public class Table
 
     /**
      * accesses to CFS.memtable should acquire this for thread safety.
-     * only Table.maybeSwitchMemtable should aquire the writeLock; see that method for the
full explanation.
+     * Table.maybeSwitchMemtable should aquire the writeLock; see that method for the full
explanation.
      */
     static final ReentrantReadWriteLock flusherLock = new ReentrantReadWriteLock(true);
 



Mime
View raw message