reduce garbage creation in calculatePendingRanges

patch by dbrosius reviewed by bwilliams for cassandra-7191
This commit is contained in:
Dave Brosius 2014-05-07 21:17:48 -04:00
parent 21b3a679f0
commit d839350f42
2 changed files with 4 additions and 3 deletions

View File

@ -22,6 +22,7 @@
* fix time conversion to milliseconds in SimpleCondition.await (CASSANDRA-7149) * fix time conversion to milliseconds in SimpleCondition.await (CASSANDRA-7149)
* remove duplicate query for local tokens (CASSANDRA-7182) * remove duplicate query for local tokens (CASSANDRA-7182)
* raise streaming phi convict threshold level (CASSANDRA-7063) * raise streaming phi convict threshold level (CASSANDRA-7063)
* reduce garbage creation in calculatePendingRanges (CASSANDRA-7191)
1.2.16 1.2.16
* Add UNLOGGED, COUNTER options to BATCH documentation (CASSANDRA-6816) * Add UNLOGGED, COUNTER options to BATCH documentation (CASSANDRA-6816)

View File

@ -43,7 +43,6 @@ import java.util.Set;
import java.util.Collection; import java.util.Collection;
import java.util.concurrent.*; import java.util.concurrent.*;
public class PendingRangeCalculatorService extends PendingRangeCalculatorServiceMBean public class PendingRangeCalculatorService extends PendingRangeCalculatorServiceMBean
{ {
public static final PendingRangeCalculatorService instance = new PendingRangeCalculatorService(); public static final PendingRangeCalculatorService instance = new PendingRangeCalculatorService();
@ -157,9 +156,10 @@ public class PendingRangeCalculatorService extends PendingRangeCalculatorService
// For each of the bootstrapping nodes, simply add and remove them one by one to // 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. // allLeftMetadata and check in between what their ranges would be.
for (InetAddress endpoint : bootstrapTokens.inverse().keySet()) Multimap<InetAddress, Token> bootstrapAddresses = bootstrapTokens.inverse();
for (InetAddress endpoint : bootstrapAddresses.keySet())
{ {
Collection<Token> tokens = bootstrapTokens.inverse().get(endpoint); Collection<Token> tokens = bootstrapAddresses.get(endpoint);
allLeftMetadata.updateNormalTokens(tokens, endpoint); allLeftMetadata.updateNormalTokens(tokens, endpoint);
for (Range<Token> range : strategy.getAddressRanges(allLeftMetadata).get(endpoint)) for (Range<Token> range : strategy.getAddressRanges(allLeftMetadata).get(endpoint))