cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alek...@apache.org
Subject [1/2] cassandra git commit: Switch references to Refs
Date Thu, 05 Feb 2015 13:42:16 GMT
Repository: cassandra
Updated Branches:
  refs/heads/trunk 49f1a629d -> 4231b4e2a


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/trunk
Commit: 2d5d30114107bfb6bb7b6f9571264eef6ad4985f
Parents: e60089d
Author: Aleksey Yeschenko <aleksey@apache.org>
Authored: Thu Feb 5 16:41:47 2015 +0300
Committer: Aleksey Yeschenko <aleksey@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));


Mime
View raw message