cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brandonwilli...@apache.org
Subject [3/6] git commit: Remove synchronization in long-running PCRS Patch by Oleg Kibirev, reviewed by brandonwilliams for CASSANDRA-5456
Date Fri, 12 Apr 2013 17:13:08 GMT
Remove synchronization in long-running PCRS
Patch by Oleg Kibirev, reviewed by brandonwilliams for CASSANDRA-5456


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

Branch: refs/heads/trunk
Commit: d2eadba2a6fe174aa94309deb487ff6391674847
Parents: feae9ef
Author: Brandon Williams <brandonwilliams@apache.org>
Authored: Fri Apr 12 12:11:30 2013 -0500
Committer: Brandon Williams <brandonwilliams@apache.org>
Committed: Fri Apr 12 12:11:30 2013 -0500

----------------------------------------------------------------------
 .../service/PendingRangeCalculatorService.java     |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/d2eadba2/src/java/org/apache/cassandra/service/PendingRangeCalculatorService.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/service/PendingRangeCalculatorService.java b/src/java/org/apache/cassandra/service/PendingRangeCalculatorService.java
index d06f2d8..541888a 100644
--- a/src/java/org/apache/cassandra/service/PendingRangeCalculatorService.java
+++ b/src/java/org/apache/cassandra/service/PendingRangeCalculatorService.java
@@ -38,6 +38,7 @@ import java.net.InetAddress;
 import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
+import java.util.LinkedHashMap;
 import java.util.concurrent.*;
 
 
@@ -153,8 +154,10 @@ public class PendingRangeCalculatorService extends PendingRangeCalculatorService
 
         // For each of the bootstrapping nodes, simply add and remove them one by one to
         // allLeftMetadata and check in between what their ranges would be.
-        synchronized (bootstrapTokens)
-        {
+	synchronized(bootstrapTokens) {
+	    bootstrapTokens = new LinkedHashMap<Token, InetAddress>(bootstrapTokens);
+	}
+
             for (Map.Entry<Token, InetAddress> entry : bootstrapTokens.entrySet())
             {
                 InetAddress endpoint = entry.getValue();
@@ -164,7 +167,6 @@ public class PendingRangeCalculatorService extends PendingRangeCalculatorService
                     pendingRanges.put(range, endpoint);
                 allLeftMetadata.removeEndpoint(endpoint);
             }
-        }
 
         // At this stage pendingRanges has been updated according to leaving and bootstrapping
nodes.
         // We can now finish the calculation by checking moving nodes.


Mime
View raw message