Return-Path: X-Original-To: apmail-cassandra-commits-archive@www.apache.org Delivered-To: apmail-cassandra-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 36B9AF16C for ; Fri, 12 Dec 2014 13:17:57 +0000 (UTC) Received: (qmail 94793 invoked by uid 500); 12 Dec 2014 13:17:57 -0000 Delivered-To: apmail-cassandra-commits-archive@cassandra.apache.org Received: (qmail 94755 invoked by uid 500); 12 Dec 2014 13:17:57 -0000 Mailing-List: contact commits-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cassandra.apache.org Delivered-To: mailing list commits@cassandra.apache.org Received: (qmail 94743 invoked by uid 99); 12 Dec 2014 13:17:56 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 12 Dec 2014 13:17:56 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 9B03AA29181; Fri, 12 Dec 2014 13:17:56 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: benedict@apache.org To: commits@cassandra.apache.org Message-Id: <2339fcda95d94505885a95ef6aec41c6@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: cassandra git commit: Make read "defrag" async to reclaim memtables Date: Fri, 12 Dec 2014 13:17:56 +0000 (UTC) Repository: cassandra Updated Branches: refs/heads/cassandra-2.1 745ddd1c2 -> 5c6958462 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/cassandra-2.1 Commit: 5c69584626f9137e8d737087c9518ae5efd3a618 Parents: 745ddd1 Author: Benedict Elliott Smith Authored: Fri Dec 12 13:16:10 2014 +0000 Committer: Benedict Elliott Smith 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: