Github user jolynch commented on a diff in the pull request:
https://github.com/apache/cassandra/pull/212#discussion_r225734481
--- Diff:
src/java/org/apache/cassandra/net/StartupClusterConnectivityChecker.java ---
@@ -73,56 +80,84 @@ public static StartupClusterConnectivityChecker
create(int targetPercent, int ti
* @return true if the requested percentage of peers are marked ALIVE
in gossip and have their connections opened;
* else false.
*/
- public boolean execute(Set<InetAddressAndPort> peers)
+ public boolean execute(Set<InetAddressAndPort> peers,
Function<InetAddressAndPort, String> getDatacenter)
{
- if (targetPercent == 0 || peers == null)
+ if (peers == null)
return true;
// make a copy of the set, to avoid mucking with the input (in
case it's a sensitive collection)
peers = new HashSet<>(peers);
- peers.remove(FBUtilities.getBroadcastAddressAndPort());
-
- if (peers.isEmpty())
+ InetAddressAndPort localAddress =
FBUtilities.getBroadcastAddressAndPort();
+ if (peers.size() == 1 && peers.contains(localAddress))
return true;
- logger.info("choosing to block until {}% of the {} known peers are
marked alive and connections are established; max time to wait = {} seconds",
- targetPercent, peers.size(),
TimeUnit.NANOSECONDS.toSeconds(timeoutNanos));
+ Set<InetAddressAndPort> myLocalPeers = peers.stream()
+
.collect(Collectors.groupingBy(getDatacenter, toSet()))
+
.getOrDefault(getDatacenter.apply(FBUtilities.getBroadcastAddressAndPort()),
+
Collections.emptySet());
+
+
+ logger.info("choosing to block until no more than {}/{} local and
no more than {}/{} global peers are still DOWN; max time to wait = {} seconds",
--- End diff --
Yea ... I was debating if this should be here or down below 122 where we
remove it. I was thinking that users would want to see their cluster size in
the denominator (e.g. `choosing to block until no more than 1/200` nodes) even
if strictly speaking we just immediately succeed on the local host.
I don't have strong preferences, I'll take the local node out of the count.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]