Use write lock not read lock for removing sstables from compaction strategies.
Patch by Ariel Weisberg; Reviewed by Marcus Eriksson for CASSANDRA-13422 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/c9751424 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/c9751424 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/c9751424 Branch: refs/heads/trunk Commit: c97514243e8c58bdda0ebf75212a8a217f3d017e Parents: 1a7b1ee Author: Ariel Weisberg <aweisb...@apple.com> Authored: Thu Apr 6 17:53:04 2017 -0400 Committer: Ariel Weisberg <aweisb...@apple.com> Committed: Mon Apr 10 16:45:15 2017 -0700 ---------------------------------------------------------------------- CHANGES.txt | 1 + .../cassandra/db/compaction/CompactionStrategyManager.java | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/c9751424/CHANGES.txt ---------------------------------------------------------------------- diff --git a/CHANGES.txt b/CHANGES.txt index a7b464a..7998e10 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,4 +1,5 @@ 3.11.0 + * Use write lock not read lock for removing sstables from compaction strategies. (CASSANDRA-13422) * Use corePoolSize equal to maxPoolSize in JMXEnabledThreadPoolExecutors (CASSANDRA-13329) * Avoid rebuilding SASI indexes containing no values (CASSANDRA-12962) * Add charset to Analyser input stream (CASSANDRA-13151) http://git-wip-us.apache.org/repos/asf/cassandra/blob/c9751424/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 5679338..df89e53 100644 --- a/src/java/org/apache/cassandra/db/compaction/CompactionStrategyManager.java +++ b/src/java/org/apache/cassandra/db/compaction/CompactionStrategyManager.java @@ -531,14 +531,14 @@ public class CompactionStrategyManager implements INotificationConsumer private void handleDeletingNotification(SSTableReader deleted) { - readLock.lock(); + writeLock.lock(); try { getCompactionStrategyFor(deleted).removeSSTable(deleted); } finally { - readLock.unlock(); + writeLock.unlock(); } }