Discovery: Don't include local node to pingMasters list. We might end up electing ourselves without any form of verification.

This commit is contained in:
Martijn van Groningen 2014-07-17 23:49:08 +02:00 committed by Boaz Leskes
parent 5e38e9eb4f
commit c2142c0f6d
1 changed files with 5 additions and 1 deletions

View File

@ -864,9 +864,13 @@ public class ZenDiscovery extends AbstractLifecycleComponent<Discovery> implemen
List<DiscoveryNode> pingMasters = newArrayList(); List<DiscoveryNode> pingMasters = newArrayList();
for (ZenPing.PingResponse pingResponse : pingResponses) { for (ZenPing.PingResponse pingResponse : pingResponses) {
if (pingResponse.master() != null) { if (pingResponse.master() != null) {
// We can't include the local node in pingMasters list, otherwise we may up electing ourselves without
// any check / verifications from other nodes in ZenDiscover#innerJoinCluster()
if (!localNode.equals(pingResponse.master())) {
pingMasters.add(pingResponse.master()); pingMasters.add(pingResponse.master());
} }
} }
}
Set<DiscoveryNode> possibleMasterNodes = Sets.newHashSet(); Set<DiscoveryNode> possibleMasterNodes = Sets.newHashSet();
if (localNode.masterNode()) { if (localNode.masterNode()) {