cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r1071149 - in /cassandra/branches/cassandra-0.7: CHANGES.txt src/java/org/apache/cassandra/io/sstable/CacheWriter.java
Date Wed, 16 Feb 2011 05:57:58 GMT
Author: jbellis
Date: Wed Feb 16 05:57:58 2011
New Revision: 1071149

URL: http://svn.apache.org/viewvc?rev=1071149&view=rev
Log:
don't save empty caches
patch by mdennis; reviewed by jbellis for CASSANDRA-2172

Modified:
    cassandra/branches/cassandra-0.7/CHANGES.txt
    cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/io/sstable/CacheWriter.java

Modified: cassandra/branches/cassandra-0.7/CHANGES.txt
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/CHANGES.txt?rev=1071149&r1=1071148&r2=1071149&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7/CHANGES.txt (original)
+++ cassandra/branches/cassandra-0.7/CHANGES.txt Wed Feb 16 05:57:58 2011
@@ -2,6 +2,7 @@
  * Keep endpoint state until aVeryLongTime (CASSANDRA-2115)
  * lower-latency read repair (CASSANDRA-2069)
  * add hinted_handoff_throttle_delay_in_ms option (CASSANDRA-2161)
+ * don't save empty caches (CASSANDRA-2172)
 
 
 0.7.2

Modified: cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/io/sstable/CacheWriter.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/io/sstable/CacheWriter.java?rev=1071149&r1=1071148&r2=1071149&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/io/sstable/CacheWriter.java
(original)
+++ cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/io/sstable/CacheWriter.java
Wed Feb 16 05:57:58 2011
@@ -64,6 +64,14 @@ public class CacheWriter<K, V> implement
     public void saveCache() throws IOException
     {
         long start = System.currentTimeMillis();
+
+        if (keys.size() == 0 || estimatedTotalBytes == 0)
+        {
+            logger.debug("Deleting {} (cache is empty)");
+            path.delete();
+            return;
+        }
+
         logger.debug("Saving {}", path);
         File tmpFile = File.createTempFile(path.getName(), null, path.getParentFile());
 



Mime
View raw message