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 A8EBC10674 for ; Tue, 15 Oct 2013 22:43:31 +0000 (UTC) Received: (qmail 51863 invoked by uid 500); 15 Oct 2013 22:43:31 -0000 Delivered-To: apmail-cassandra-commits-archive@cassandra.apache.org Received: (qmail 51668 invoked by uid 500); 15 Oct 2013 22:43:31 -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 51592 invoked by uid 99); 15 Oct 2013 22:43:31 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 15 Oct 2013 22:43:31 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id BF6378B5633; Tue, 15 Oct 2013 22:43:30 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: jbellis@apache.org To: commits@cassandra.apache.org Date: Tue, 15 Oct 2013 22:43:31 -0000 Message-Id: <3a952ae7f1564bbab8b4ba6ae6239882@git.apache.org> In-Reply-To: <19dabc71904e4883b1526215577e4c40@git.apache.org> References: <19dabc71904e4883b1526215577e4c40@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [2/6] git commit: Mark CF clean if a mutation raced the drop and got it marked dirty patch by jbellis; reviewed by Tyler Hobbs for CASSANDRA-5946 Mark CF clean if a mutation raced the drop and got it marked dirty patch by jbellis; reviewed by Tyler Hobbs for CASSANDRA-5946 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/b33b53e8 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/b33b53e8 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/b33b53e8 Branch: refs/heads/cassandra-2.0 Commit: b33b53e8f91011fe07ed39df75d6b5728c6f8cf1 Parents: 8dcdce4 Author: Jonathan Ellis Authored: Tue Oct 15 23:41:01 2013 +0100 Committer: Jonathan Ellis Committed: Tue Oct 15 23:41:37 2013 +0100 ---------------------------------------------------------------------- CHANGES.txt | 2 ++ .../db/commitlog/CommitLogAllocator.java | 34 +++++++++++++------- 2 files changed, 25 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/b33b53e8/CHANGES.txt ---------------------------------------------------------------------- diff --git a/CHANGES.txt b/CHANGES.txt index 2dbadc4..d6ecac1 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,5 +1,7 @@ 1.2.12 * Add ability to list specific KS/CF combinations in nodetool cfstats (CASSANDRA-4191) + * Mark CF clean if a mutation raced the drop and got it marked dirty + 1.2.11 * Limit CQL prepared statement cache by size instead of count (CASSANDRA-6107) http://git-wip-us.apache.org/repos/asf/cassandra/blob/b33b53e8/src/java/org/apache/cassandra/db/commitlog/CommitLogAllocator.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/db/commitlog/CommitLogAllocator.java b/src/java/org/apache/cassandra/db/commitlog/CommitLogAllocator.java index 2855979..d62d7ca 100644 --- a/src/java/org/apache/cassandra/db/commitlog/CommitLogAllocator.java +++ b/src/java/org/apache/cassandra/db/commitlog/CommitLogAllocator.java @@ -39,6 +39,7 @@ import org.apache.cassandra.db.Table; import org.apache.cassandra.io.util.FileUtils; import org.apache.cassandra.net.MessagingService; import org.apache.cassandra.service.StorageService; +import org.apache.cassandra.utils.Pair; import org.apache.cassandra.utils.WrappedRunnable; /** @@ -296,19 +297,30 @@ public class CommitLogAllocator { for (UUID dirtyCFId : oldestSegment.getDirtyCFIDs()) { - String keypace = Schema.instance.getCF(dirtyCFId).left; - final ColumnFamilyStore cfs = Table.open(keypace).getColumnFamilyStore(dirtyCFId); - // flush shouldn't run on the commitlog executor, since it acquires Table.switchLock, - // which may already be held by a thread waiting for the CL executor (via getContext), - // causing deadlock - Runnable runnable = new Runnable() + Pair pair = Schema.instance.getCF(dirtyCFId); + if (pair == null) { - public void run() + // even though we remove the schema entry before a final flush when dropping a CF, + // it's still possible for a writer to race and finish his append after the flush. + logger.debug("Marking clean CF {} that doesn't exist anymore", dirtyCFId); + oldestSegment.markClean(dirtyCFId, oldestSegment.getContext()); + } + else + { + String keypace = pair.left; + final ColumnFamilyStore cfs = Table.open(keypace).getColumnFamilyStore(dirtyCFId); + // flush shouldn't run on the commitlog executor, since it acquires Table.switchLock, + // which may already be held by a thread waiting for the CL executor (via getContext), + // causing deadlock + Runnable runnable = new Runnable() { - cfs.forceFlush(); - } - }; - StorageService.optionalTasks.execute(runnable); + public void run() + { + cfs.forceFlush(); + } + }; + StorageService.optionalTasks.execute(runnable); + } } } }