cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alek...@apache.org
Subject [3/6] cassandra git commit: Use cloned TokenMetadata in size estimates to avoid race against membership check
Date Fri, 12 Feb 2016 17:33:41 GMT
Use cloned TokenMetadata in size estimates to avoid race against membership check

patch by Joel Knighton; reviewed by Branimir Lambov for CASSANDRA-10736


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/1b201e95
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/1b201e95
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/1b201e95

Branch: refs/heads/trunk
Commit: 1b201e959a6f77aeedd2549ed523200021d8c6e6
Parents: d5c83f4
Author: Joel Knighton <joel.knighton@datastax.com>
Authored: Tue Dec 29 14:59:57 2015 -0600
Committer: Aleksey Yeschenko <aleksey@apache.org>
Committed: Fri Feb 12 17:28:18 2016 +0000

----------------------------------------------------------------------
 CHANGES.txt                                                 | 5 ++++-
 src/java/org/apache/cassandra/db/SizeEstimatesRecorder.java | 6 ++++--
 2 files changed, 8 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/1b201e95/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index fa25980..49bc581 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,10 +1,13 @@
 2.2.6
+ * Use cloned TokenMetadata in size estimates to avoid race against membership check
+   (CASSANDRA-10736)
  * Always persist upsampled index summaries (CASSANDRA-10512)
  * (cqlsh) Fix inconsistent auto-complete (CASSANDRA-10733)
  * Make SELECT JSON and toJson() threadsafe (CASSANDRA-11048)
  * Fix SELECT on tuple relations for mixed ASC/DESC clustering order (CASSANDRA-7281)
  * (cqlsh) Support utf-8/cp65001 encoding on Windows (CASSANDRA-11030)
- * Fix paging on DISTINCT queries repeats result when first row in partition changes (CASSANDRA-10010)
+ * Fix paging on DISTINCT queries repeats result when first row in partition changes
+   (CASSANDRA-10010)
 Merged from 2.1:
  * Properly release sstable ref when doing offline scrub (CASSANDRA-10697)
  * Improve nodetool status performance for large cluster (CASSANDRA-7238)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/1b201e95/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 c59db4b..2f14fb1 100644
--- a/src/java/org/apache/cassandra/db/SizeEstimatesRecorder.java
+++ b/src/java/org/apache/cassandra/db/SizeEstimatesRecorder.java
@@ -26,6 +26,7 @@ import org.slf4j.LoggerFactory;
 import org.apache.cassandra.dht.Range;
 import org.apache.cassandra.dht.Token;
 import org.apache.cassandra.io.sstable.format.SSTableReader;
+import org.apache.cassandra.locator.TokenMetadata;
 import org.apache.cassandra.service.MigrationListener;
 import org.apache.cassandra.service.MigrationManager;
 import org.apache.cassandra.service.StorageService;
@@ -56,7 +57,8 @@ public class SizeEstimatesRecorder extends MigrationListener implements
Runnable
 
     public void run()
     {
-        if (!StorageService.instance.getTokenMetadata().isMember(FBUtilities.getBroadcastAddress()))
+        TokenMetadata metadata = StorageService.instance.getTokenMetadata().cloneOnlyTokenMap();
+        if (!metadata.isMember(FBUtilities.getBroadcastAddress()))
         {
             logger.debug("Node is not part of the ring; not recording size estimates");
             return;
@@ -66,7 +68,7 @@ public class SizeEstimatesRecorder extends MigrationListener implements
Runnable
 
         // find primary token ranges for the local node.
         Collection<Token> localTokens = StorageService.instance.getLocalTokens();
-        Collection<Range<Token>> localRanges = StorageService.instance.getTokenMetadata().getPrimaryRangesFor(localTokens);
+        Collection<Range<Token>> localRanges = metadata.getPrimaryRangesFor(localTokens);
 
         for (Keyspace keyspace : Keyspace.nonSystem())
         {


Mime
View raw message