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 EB27017AA9 for ; Thu, 5 Feb 2015 13:41:56 +0000 (UTC) Received: (qmail 40951 invoked by uid 500); 5 Feb 2015 13:41:56 -0000 Delivered-To: apmail-cassandra-commits-archive@cassandra.apache.org Received: (qmail 40908 invoked by uid 500); 5 Feb 2015 13:41:56 -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 40897 invoked by uid 99); 5 Feb 2015 13:41:56 -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; Thu, 05 Feb 2015 13:41:56 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 8EF88E03F7; Thu, 5 Feb 2015 13:41:56 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: aleksey@apache.org To: commits@cassandra.apache.org Message-Id: <6758056e46ee445db96e4ee650cf55be@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: cassandra git commit: Switch references to Refs Date: Thu, 5 Feb 2015 13:41:56 +0000 (UTC) Repository: cassandra Updated Branches: refs/heads/cassandra-2.1 e60089db0 -> 2d5d30114 Switch references to Refs Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/2d5d3011 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/2d5d3011 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/2d5d3011 Branch: refs/heads/cassandra-2.1 Commit: 2d5d30114107bfb6bb7b6f9571264eef6ad4985f Parents: e60089d Author: Aleksey Yeschenko Authored: Thu Feb 5 16:41:47 2015 +0300 Committer: Aleksey Yeschenko Committed: Thu Feb 5 16:41:47 2015 +0300 ---------------------------------------------------------------------- .../org/apache/cassandra/db/SizeEstimatesRecorder.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/2d5d3011/src/java/org/apache/cassandra/db/SizeEstimatesRecorder.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/db/SizeEstimatesRecorder.java b/src/java/org/apache/cassandra/db/SizeEstimatesRecorder.java index b739ba5..b7e5715 100644 --- a/src/java/org/apache/cassandra/db/SizeEstimatesRecorder.java +++ b/src/java/org/apache/cassandra/db/SizeEstimatesRecorder.java @@ -29,6 +29,7 @@ import org.apache.cassandra.service.MigrationListener; import org.apache.cassandra.service.MigrationManager; import org.apache.cassandra.service.StorageService; import org.apache.cassandra.utils.Pair; +import org.apache.cassandra.utils.concurrent.Refs; /** * A very simplistic/crude partition count/size estimator. @@ -71,8 +72,13 @@ public class SizeEstimatesRecorder extends MigrationListener implements Runnable for (Range range : localRanges) { // filter sstables that have partitions in this range. - List sstables = table.viewFilter(range.toRowBounds()).apply(table.getDataTracker().getView()); - SSTableReader.acquireReferences(sstables); + List sstables = null; + Refs refs = null; + while (refs == null) + { + sstables = table.viewFilter(range.toRowBounds()).apply(table.getDataTracker().getView()); + refs = Refs.tryRef(sstables); + } long partitionsCount, meanPartitionSize; try @@ -83,7 +89,7 @@ public class SizeEstimatesRecorder extends MigrationListener implements Runnable } finally { - SSTableReader.releaseReferences(sstables); + refs.release(); } estimates.put(range, Pair.create(partitionsCount, meanPartitionSize));