Elffuss BraidHub

kikocis/java-driver public

JAVA-1030: Log token to replica map computation times.

Patch submitted by Sean Usher.
Changeset8b203d17759afa62e3972fdb3658c914eaad82d0fabd32b7634819f49caf257b
Authorolim7t <omichallat+github@gmail.com> · 2016-01-14 15:50 +01:00
Committerolim7t <omichallat+github@gmail.com> · 2016-01-14 15:50 +01:00
Parentsfb3eea0b45a2

Browse the files at this changeset

2 files changed

modified changelog/README.md +1 −0
@@ -8,6 +8,7 @@
88 - [bug] JAVA-937: TypeCodec static initializers not always correctly executed.
99 - [improvement] JAVA-989: Include keyspace name when invalid replication found when generating token map.
1010 - [improvement] JAVA-664: Reduce heap consumption for TokenMap.
11+- [improvement] JAVA-1030: Log token to replica map computation times.
1112
1213 Merged from 2.0 branch:
1314
modified driver-core/src/main/java/com/datastax/driver/core/ReplicationStategy.java +11 −1
@@ -118,7 +118,12 @@
118118 }
119119
120120 @Override
121- Map<Token, Set<Host>> computeTokenToReplicaMap(String keyspaceName, Map<Token, Host> tokenToPrimary, List<Token> ring) {
121+ Map<Token, Set<Host>> computeTokenToReplicaMap(String keyspaceName, Map<Token, Host> tokenToPrimary, List<Token> ring) {
122+
123+ logger.debug("Computing token to replica map for keyspace: {}.", keyspaceName);
124+
125+ // Track how long it takes to compute the token to replica map
126+ long startTime = System.currentTimeMillis();
122127
123128 // This is essentially a copy of org.apache.cassandra.locator.NetworkTopologyStrategy
124129 Map<String, Set<String>> racks = getRacksInDcs(tokenToPrimary.values());
@@ -201,6 +206,11 @@
201206
202207 replicaMap.put(ring.get(i), ImmutableSet.copyOf(replicas));
203208 }
209+
210+ long duration = System.currentTimeMillis() - startTime;
211+ logger.debug("Token to replica map computation for keyspace {} completed in {} milliseconds",
212+ keyspaceName, duration);
213+
204214 return replicaMap;
205215 }
206216