diff --git a/src/main/java/org/elasticsearch/discovery/zen/ping/unicast/UnicastZenPing.java b/src/main/java/org/elasticsearch/discovery/zen/ping/unicast/UnicastZenPing.java index 4e80669ddfe..3b894515871 100644 --- a/src/main/java/org/elasticsearch/discovery/zen/ping/unicast/UnicastZenPing.java +++ b/src/main/java/org/elasticsearch/discovery/zen/ping/unicast/UnicastZenPing.java @@ -394,7 +394,8 @@ public class UnicastZenPing extends AbstractLifecycleComponent implemen // try and merge the best ping response for it, i.e. if the new one // doesn't have the master node set, and the existing one does, then // the existing one is better, so we keep it - if (pingResponse.master() != null) { + // if both have a master or both have none, we prefer the latest ping + if (existingResponse.master() == null || pingResponse.master() != null) { responses.put(pingResponse.node(), pingResponse); } } diff --git a/src/test/java/org/elasticsearch/indices/IndicesLifecycleListenerTests.java b/src/test/java/org/elasticsearch/indices/IndicesLifecycleListenerTests.java index f3b5eb6f04e..89b1a6bef70 100644 --- a/src/test/java/org/elasticsearch/indices/IndicesLifecycleListenerTests.java +++ b/src/test/java/org/elasticsearch/indices/IndicesLifecycleListenerTests.java @@ -20,7 +20,6 @@ package org.elasticsearch.indices; import com.google.common.base.Predicate; import com.google.common.collect.Maps; -import org.apache.lucene.util.LuceneTestCase; import org.elasticsearch.common.Nullable; import org.elasticsearch.common.Strings; import org.elasticsearch.index.shard.IndexShardState; @@ -45,7 +44,6 @@ import static org.elasticsearch.test.ElasticsearchIntegrationTest.Scope; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked; @ClusterScope(scope = Scope.TEST, numDataNodes = 0) -@LuceneTestCase.AwaitsFix(bugUrl = "fails due to old ping responses confusing master elections, bleskes investigating") public class IndicesLifecycleListenerTests extends ElasticsearchIntegrationTest { @Test