cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r833498 - in /incubator/cassandra/trunk/src/java/org/apache/cassandra: db/BinaryMemtable.java db/ColumnFamilyStore.java db/Memtable.java io/SSTableTracker.java
Date Fri, 06 Nov 2009 17:56:35 GMT
Author: jbellis
Date: Fri Nov  6 17:56:35 2009
New Revision: 833498

URL: http://svn.apache.org/viewvc?rev=833498&view=rev
Log:
avoid flushing empty binarymemtable
patch by jbellis; reviewed by goffinet for CASSANDRA-532

Modified:
    incubator/cassandra/trunk/src/java/org/apache/cassandra/db/BinaryMemtable.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/db/Memtable.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/io/SSTableTracker.java

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/db/BinaryMemtable.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/db/BinaryMemtable.java?rev=833498&r1=833497&r2=833498&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/db/BinaryMemtable.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/db/BinaryMemtable.java Fri Nov
 6 17:56:35 2009
@@ -116,6 +116,11 @@
         }
     }
 
+    public boolean isClean()
+    {
+        return columnFamilies_.isEmpty();
+    }
+
     private void resolve(String key, byte[] buffer)
     {
         columnFamilies_.put(partitioner_.decorateKey(key), buffer);

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStore.java?rev=833498&r1=833497&r2=833498&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStore.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStore.java Fri
Nov  6 17:56:35 2009
@@ -443,6 +443,9 @@
 
     public void forceFlushBinary()
     {
+        if (memtable_.isClean())
+            return;
+
         submitFlush(binaryMemtable_.get());
     }
 

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/db/Memtable.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/db/Memtable.java?rev=833498&r1=833497&r2=833498&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/db/Memtable.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/db/Memtable.java Fri Nov  6 17:56:35
2009
@@ -42,7 +42,6 @@
 	private static final Logger logger_ = Logger.getLogger( Memtable.class );
 
     private boolean isFrozen_;
-    private volatile boolean isDirty_;
     private volatile boolean isFlushed_; // for tests, in particular forceBlockingFlush asserts
this
 
     private final int threshold_ = DatabaseDescriptor.getMemtableSize()*1024*1024; // not
static since we might want to change at runtime
@@ -141,7 +140,6 @@
     void put(String key, ColumnFamily columnFamily)
     {
         assert !isFrozen_; // not 100% foolproof but hell, it's an assert
-        isDirty_ = true;
         resolve(key, columnFamily);
     }
 
@@ -244,9 +242,7 @@
 
     public boolean isClean()
     {
-        // executor taskcount is inadequate for our needs here -- it can return zero under
certain
-        // race conditions even though a task has been processed.
-        return !isDirty_;
+        return columnFamilies_.isEmpty();
     }
 
     /**

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/io/SSTableTracker.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/io/SSTableTracker.java?rev=833498&r1=833497&r2=833498&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/io/SSTableTracker.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/io/SSTableTracker.java Fri Nov
 6 17:56:35 2009
@@ -17,6 +17,8 @@
 
     public synchronized void add(SSTableReader sstable)
     {
+        assert sstable != null;
+        assert sstable.getIndexPositions() != null;
         Set<SSTableReader> sstablesNew = new HashSet<SSTableReader>(sstables);
         sstablesNew.add(sstable);
         sstables = Collections.unmodifiableSet(sstablesNew);



Mime
View raw message