Repository: cassandra Updated Branches: refs/heads/trunk e2f35c767 -> f35e9c255
Make read "defrag" async to reclaim memtables patch by benedict; reviewed by jbellis CASSANDRA-8459 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/5c695846 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/5c695846 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/5c695846 Branch: refs/heads/trunk Commit: 5c69584626f9137e8d737087c9518ae5efd3a618 Parents: 745ddd1 Author: Benedict Elliott Smith <[email protected]> Authored: Fri Dec 12 13:16:10 2014 +0000 Committer: Benedict Elliott Smith <[email protected]> Committed: Fri Dec 12 13:16:10 2014 +0000 ---------------------------------------------------------------------- CHANGES.txt | 1 + .../apache/cassandra/db/CollationController.java | 16 +++++++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/5c695846/CHANGES.txt ---------------------------------------------------------------------- diff --git a/CHANGES.txt b/CHANGES.txt index 71a6642..b4cb6fb 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,4 +1,5 @@ 2.1.3 + * Make read "defrag" async to reclaim memtables (CASSANDRA-8459) * Remove tmplink files for offline compactions (CASSANDRA-8321) * Reduce maxHintsInProgress (CASSANDRA-8415) * BTree updates may call provided update function twice (CASSANDRA-8018) http://git-wip-us.apache.org/repos/asf/cassandra/blob/5c695846/src/java/org/apache/cassandra/db/CollationController.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/db/CollationController.java b/src/java/org/apache/cassandra/db/CollationController.java index 1b22e70..4efcd9c 100644 --- a/src/java/org/apache/cassandra/db/CollationController.java +++ b/src/java/org/apache/cassandra/db/CollationController.java @@ -29,6 +29,8 @@ import com.google.common.collect.Iterables; import com.google.common.collect.Iterators; import net.nicoulaj.compilecommand.annotations.Inline; +import org.apache.cassandra.concurrent.Stage; +import org.apache.cassandra.concurrent.StageManager; import org.apache.cassandra.db.columniterator.OnDiskAtomIterator; import org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy; import org.apache.cassandra.db.composites.CellName; @@ -152,10 +154,18 @@ public class CollationController && !cfs.isAutoCompactionDisabled() && cfs.getCompactionStrategy().shouldDefragment()) { + // !!WARNING!! if we stop copying our data to a heap-managed object, + // we will need to track the lifetime of this mutation as well Tracing.trace("Defragmenting requested data"); - Mutation mutation = new Mutation(cfs.keyspace.getName(), filter.key.getKey(), returnCF.cloneMe()); - // skipping commitlog and index updates is fine since we're just de-fragmenting existing data - Keyspace.open(mutation.getKeyspaceName()).apply(mutation, false, false); + final Mutation mutation = new Mutation(cfs.keyspace.getName(), filter.key.getKey(), returnCF.cloneMe()); + StageManager.getStage(Stage.MUTATION).execute(new Runnable() + { + public void run() + { + // skipping commitlog and index updates is fine since we're just de-fragmenting existing data + Keyspace.open(mutation.getKeyspaceName()).apply(mutation, false, false); + } + }); } // Caller is responsible for final removeDeletedCF. This is important for cacheRow to work correctly:
