You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by al...@apache.org on 2013/08/24 01:16:56 UTC
git commit: Fix periodic memtable flushing behavior with clean
memtables
Updated Branches:
refs/heads/cassandra-2.0.0 af9c7074f -> b0280cb92
Fix periodic memtable flushing behavior with clean memtables
patch by Aleksey Yeschenko; reviewed by Jonathan Ellis for
CASSANDRA-5931
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/b0280cb9
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/b0280cb9
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/b0280cb9
Branch: refs/heads/cassandra-2.0.0
Commit: b0280cb92d6d0ee5e89d54d2277ba846172de61e
Parents: af9c707
Author: Aleksey Yeschenko <al...@apache.org>
Authored: Sat Aug 24 02:15:32 2013 +0300
Committer: Aleksey Yeschenko <al...@apache.org>
Committed: Sat Aug 24 02:16:29 2013 +0300
----------------------------------------------------------------------
CHANGES.txt | 1 +
.../apache/cassandra/db/ColumnFamilyStore.java | 22 ++++++++++++++------
2 files changed, 17 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/b0280cb9/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 16c6e58..b68e442 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,5 +1,6 @@
2.0.0
* Fix thrift validation when inserting into CQL3 tables (CASSANDRA-5138)
+ * Fix periodic memtable flushing behavior with clean memtables (CASSANDRA-5931)
Merged from 1.2:
* Fix getBloomFilterDiskSpaceUsed for AlwaysPresentFilter (CASSANDRA-5900)
* Don't announce schema version until we've loaded the changes locally
http://git-wip-us.apache.org/repos/asf/cassandra/blob/b0280cb9/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/ColumnFamilyStore.java b/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
index b6e2f3c..f3acf4d 100644
--- a/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
+++ b/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
@@ -166,11 +166,12 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean
{
if (getMemtableThreadSafe().isExpired())
{
- Future<?> future = forceFlush();
// if memtable is already expired but didn't flush because it's empty,
// then schedule another flush.
- if (future == null)
+ if (isClean())
scheduleFlush();
+ else
+ forceFlush(); // scheduleFlush() will be called by the constructor of the new memtable.
}
}
};
@@ -777,15 +778,24 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean
}
}
- public Future<?> forceFlush()
+ private boolean isClean()
{
// during index build, 2ary index memtables can be dirty even if parent is not. if so,
// we want flushLargestMemtables to flush the 2ary index ones too.
- boolean clean = true;
for (ColumnFamilyStore cfs : concatWithIndexes())
- clean &= cfs.getMemtableThreadSafe().isClean();
+ if (!cfs.getMemtableThreadSafe().isClean())
+ return false;
+
+ return true;
+ }
- if (clean)
+ /**
+ * @return a future, with a guarantee that any data inserted prior to the forceFlush() call is fully flushed
+ * by the time future.get() returns. Never returns null.
+ */
+ public Future<?> forceFlush()
+ {
+ if (isClean())
{
// We could have a memtable for this column family that is being
// flushed. Make sure the future returned wait for that so callers can