cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r1152419 - in /cassandra/branches/cassandra-0.8: ./ src/java/org/apache/cassandra/db/compaction/ src/java/org/apache/cassandra/service/
Date Sat, 30 Jul 2011 02:48:18 GMT
Author: jbellis
Date: Sat Jul 30 02:48:17 2011
New Revision: 1152419

URL: http://svn.apache.org/viewvc?rev=1152419&view=rev
Log:
Flush memtables on shutdown when durable writes are disabled
patch by jbellis; reviewed by tjake for CASSANDRA-2958

Modified:
    cassandra/branches/cassandra-0.8/CHANGES.txt
    cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/db/compaction/CompactionIterator.java
    cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/db/compaction/LazilyCompactedRow.java
    cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/service/StorageService.java

Modified: cassandra/branches/cassandra-0.8/CHANGES.txt
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.8/CHANGES.txt?rev=1152419&r1=1152418&r2=1152419&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.8/CHANGES.txt (original)
+++ cassandra/branches/cassandra-0.8/CHANGES.txt Sat Jul 30 02:48:17 2011
@@ -13,6 +13,8 @@
    (CASSANDRA-2953)
  * check column family validity in nodetool repair (CASSANDRA-2933)
  * speedup bytes to hex conversions dramatically (CASSANDRA-2850)
+ * Flush memtables on shutdown when durable writes are disabled 
+   (CASSANDRA-2958)
 
 
 0.8.2

Modified: cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/db/compaction/CompactionIterator.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/db/compaction/CompactionIterator.java?rev=1152419&r1=1152418&r2=1152419&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/db/compaction/CompactionIterator.java
(original)
+++ cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/db/compaction/CompactionIterator.java
Sat Jul 30 02:48:17 2011
@@ -27,7 +27,6 @@ import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
 
-import org.apache.cassandra.service.StorageService;
 import org.apache.commons.collections.iterators.CollatingIterator;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -37,6 +36,7 @@ import org.apache.cassandra.io.sstable.S
 import org.apache.cassandra.io.sstable.SSTableReader;
 import org.apache.cassandra.io.sstable.SSTableScanner;
 import org.apache.cassandra.io.util.FileUtils;
+import org.apache.cassandra.service.StorageService;
 import org.apache.cassandra.utils.FBUtilities;
 import org.apache.cassandra.utils.ReducingIterator;
 

Modified: cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/db/compaction/LazilyCompactedRow.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/db/compaction/LazilyCompactedRow.java?rev=1152419&r1=1152418&r2=1152419&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/db/compaction/LazilyCompactedRow.java
(original)
+++ cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/db/compaction/LazilyCompactedRow.java
Sat Jul 30 02:48:17 2011
@@ -25,17 +25,15 @@ import java.io.DataOutput;
 import java.io.IOError;
 import java.io.IOException;
 import java.security.MessageDigest;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
 
 import com.google.common.base.Predicates;
 import com.google.common.collect.Iterators;
 import org.apache.commons.collections.iterators.CollatingIterator;
 
-import org.apache.cassandra.db.ColumnFamily;
-import org.apache.cassandra.db.ColumnFamilyStore;
-import org.apache.cassandra.db.ColumnIndexer;
-import org.apache.cassandra.db.CounterColumn;
-import org.apache.cassandra.db.IColumn;
+import org.apache.cassandra.db.*;
 import org.apache.cassandra.db.marshal.AbstractType;
 import org.apache.cassandra.io.sstable.SSTableIdentityIterator;
 import org.apache.cassandra.io.util.DataOutputBuffer;

Modified: cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/service/StorageService.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/service/StorageService.java?rev=1152419&r1=1152418&r2=1152419&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/service/StorageService.java
(original)
+++ cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/service/StorageService.java
Sat Jul 30 02:48:17 2011
@@ -44,6 +44,7 @@ import org.apache.cassandra.concurrent.S
 import org.apache.cassandra.config.CFMetaData;
 import org.apache.cassandra.config.ConfigurationException;
 import org.apache.cassandra.config.DatabaseDescriptor;
+import org.apache.cassandra.config.KSMetaData;
 import org.apache.cassandra.db.*;
 import org.apache.cassandra.db.commitlog.CommitLog;
 import org.apache.cassandra.dht.*;
@@ -408,6 +409,18 @@ public class StorageService implements I
                     mutationStage.awaitTermination(1, TimeUnit.SECONDS);
                     CommitLog.instance.shutdownBlocking();
                 }
+
+                List<Future<?>> flushes = new ArrayList<Future<?>>();
+                for (Table table : Table.all())
+                {
+                    KSMetaData ksm = DatabaseDescriptor.getKSMetaData(table.name);
+                    if (!ksm.isDurableWrites())
+                    {
+                        for (ColumnFamilyStore cfs : table.getColumnFamilyStores())
+                            flushes.add(cfs.forceFlush());
+                    }
+                }
+                FBUtilities.waitOnFutures(flushes);
             }
         });
         Runtime.getRuntime().addShutdownHook(drainOnShutdown);



Mime
View raw message