Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id AC531200D16 for ; Tue, 10 Oct 2017 13:00:24 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id AAC98160BE3; Tue, 10 Oct 2017 11:00:24 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id F0DB41609E5 for ; Tue, 10 Oct 2017 13:00:23 +0200 (CEST) Received: (qmail 88849 invoked by uid 500); 10 Oct 2017 11:00:23 -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 88834 invoked by uid 99); 10 Oct 2017 11:00:23 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 10 Oct 2017 11:00:23 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id D6556F56A3; Tue, 10 Oct 2017 11:00:22 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: marcuse@apache.org To: commits@cassandra.apache.org Date: Tue, 10 Oct 2017 11:00:22 -0000 Message-Id: <08a5fbc4e6fd4d3a85c9bfde9dcfe79c@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [1/3] cassandra git commit: Avoid locks when checking LCS fanout and if we should do read-time defragmentation archived-at: Tue, 10 Oct 2017 11:00:24 -0000 Repository: cassandra Updated Branches: refs/heads/cassandra-3.11 3d09901b4 -> f3cf1c019 refs/heads/trunk 2ecadc88e -> 7ef4ff30c Avoid locks when checking LCS fanout and if we should do read-time defragmentation Patch by marcuse; reviewed by Jeff Jirsa for CASSANDRA-13930 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/f3cf1c01 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/f3cf1c01 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/f3cf1c01 Branch: refs/heads/cassandra-3.11 Commit: f3cf1c019e0298dd04f6a0d7396b5fe4a93e6f9a Parents: 3d09901 Author: Marcus Eriksson Authored: Tue Oct 3 10:27:32 2017 +0200 Committer: Marcus Eriksson Committed: Tue Oct 10 12:49:01 2017 +0200 ---------------------------------------------------------------------- CHANGES.txt | 1 + .../compaction/CompactionStrategyManager.java | 30 +++++--------------- 2 files changed, 8 insertions(+), 23 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/f3cf1c01/CHANGES.txt ---------------------------------------------------------------------- diff --git a/CHANGES.txt b/CHANGES.txt index 879397b..81444d2 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,4 +1,5 @@ 3.11.2 + * Avoid locks when checking LCS fanout and if we should defrag (CASSANDRA-13930) Merged from 3.0: * Mishandling of cells for removed/dropped columns when reading legacy files (CASSANDRA-13939) * Deserialise sstable metadata in nodetool verify (CASSANDRA-13922) http://git-wip-us.apache.org/repos/asf/cassandra/blob/f3cf1c01/src/java/org/apache/cassandra/db/compaction/CompactionStrategyManager.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/db/compaction/CompactionStrategyManager.java b/src/java/org/apache/cassandra/db/compaction/CompactionStrategyManager.java index df89e53..94def2a 100644 --- a/src/java/org/apache/cassandra/db/compaction/CompactionStrategyManager.java +++ b/src/java/org/apache/cassandra/db/compaction/CompactionStrategyManager.java @@ -81,6 +81,8 @@ public class CompactionStrategyManager implements INotificationConsumer */ private volatile CompactionParams schemaCompactionParams; private Directories.DataDirectory[] locations; + private boolean shouldDefragment; + private int fanout; public CompactionStrategyManager(ColumnFamilyStore cfs) { @@ -92,6 +94,7 @@ public class CompactionStrategyManager implements INotificationConsumer params = cfs.metadata.params.compaction; locations = getDirectories().getWriteableLocations(); enabled = params.isEnabled(); + } /** @@ -182,6 +185,8 @@ public class CompactionStrategyManager implements INotificationConsumer } repaired.forEach(AbstractCompactionStrategy::startup); unrepaired.forEach(AbstractCompactionStrategy::startup); + shouldDefragment = repaired.get(0).shouldDefragment(); + fanout = (repaired.get(0) instanceof LeveledCompactionStrategy) ? ((LeveledCompactionStrategy) repaired.get(0)).getLevelFanoutSize() : LeveledCompactionStrategy.DEFAULT_LEVEL_FANOUT_SIZE; } finally { @@ -343,19 +348,7 @@ public class CompactionStrategyManager implements INotificationConsumer public int getLevelFanoutSize() { - readLock.lock(); - try - { - if (repaired.get(0) instanceof LeveledCompactionStrategy) - { - return ((LeveledCompactionStrategy) repaired.get(0)).getLevelFanoutSize(); - } - } - finally - { - readLock.unlock(); - } - return LeveledCompactionStrategy.DEFAULT_LEVEL_FANOUT_SIZE; + return fanout; } public int[] getSSTableCountPerLevel() @@ -403,16 +396,7 @@ public class CompactionStrategyManager implements INotificationConsumer public boolean shouldDefragment() { - readLock.lock(); - try - { - assert repaired.get(0).getClass().equals(unrepaired.get(0).getClass()); - return repaired.get(0).shouldDefragment(); - } - finally - { - readLock.unlock(); - } + return shouldDefragment; } public Directories getDirectories() --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org For additional commands, e-mail: commits-help@cassandra.apache.org