You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by al...@apache.org on 2015/02/05 14:41:56 UTC

cassandra git commit: Switch references to Refs

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 <al...@apache.org>
Authored: Thu Feb 5 16:41:47 2015 +0300
Committer: Aleksey Yeschenko <al...@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));