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 <alek...@apache.org> Authored: Thu Feb 5 16:41:47 2015 +0300 Committer: Aleksey Yeschenko <alek...@apache.org> 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<Token> range : localRanges) { // filter sstables that have partitions in this range. - List<SSTableReader> sstables = table.viewFilter(range.toRowBounds()).apply(table.getDataTracker().getView()); - SSTableReader.acquireReferences(sstables); + List<SSTableReader> sstables = null; + Refs<SSTableReader> 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));