aweisberg commented on a change in pull request #283: CASSANDRA-14459: DynamicEndpointSnitch
should never prefer latent replicas
URL: https://github.com/apache/cassandra/pull/283#discussion_r267994728
##########
File path: src/java/org/apache/cassandra/net/StartupClusterConnectivityChecker.java
##########
@@ -173,34 +173,52 @@ public boolean execute(Set<InetAddressAndPort> peers, Function<InetAddressAndPor
TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - startNanos), numDown);
}
+ // Send out a second round of ping messages which give the LatencySubscribers (e.g.
the dsnitch) a latency
+ // landscape of the cluster that does not include handshake latency (See CASSANDRA-14459)
+ sendPingMessages(peers, LatencyMeasurementType.PROBE, msg -> null);
+
return succeeded;
}
/**
- * Sends a "connection warmup" message to each peer in the collection, on every {@link
ConnectionType}
- * used for internode messaging (that is not gossip).
+ * Sends ping messages to open up the initial handshakes with nodes and appropriately
decrements the
+ * passed CountDownLatches as we receive responses.
*/
private void sendPingMessages(Set<InetAddressAndPort> peers, Map<String, CountDownLatch>
dcToRemainingPeers,
AckMap acks, Function<InetAddressAndPort, String>
getDatacenter)
+ {
+ Function<MessageIn, Void> handleAck = msg -> {
+ if (acks.incrementAndCheck(msg.from))
+ {
+ String datacenter = getDatacenter.apply(msg.from);
+ // We have to check because we might only have the local DC in the map
+ if (dcToRemainingPeers.containsKey(datacenter))
+ dcToRemainingPeers.get(datacenter).countDown();
+ }
+ return null;
+ };
+ sendPingMessages(peers, LatencyMeasurementType.IGNORE, handleAck);
+ }
+
+ /**
+ * Sends a "connection warmup" message to each peer in the collection, on every {@link
ConnectionType}
+ * used for internode messaging (that is not gossip).
+ */
+ private void sendPingMessages(Set<InetAddressAndPort> peers, LatencyMeasurementType
latencyMeasurementTypeForSnitch,
+ Function<MessageIn, Void> response)
Review comment:
Consumer is better for this. No need to use Void.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org
|