Discovery: restore preference to latest unicast pings describing the same node

Closes #7702
This commit is contained in:
Boaz Leskes 2014-09-12 11:13:59 +02:00
parent f8d75faaad
commit 1002ff2f15
2 changed files with 2 additions and 3 deletions

View File

@ -394,7 +394,8 @@ public class UnicastZenPing extends AbstractLifecycleComponent<ZenPing> implemen
// try and merge the best ping response for it, i.e. if the new one // 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 // doesn't have the master node set, and the existing one does, then
// the existing one is better, so we keep it // 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); responses.put(pingResponse.node(), pingResponse);
} }
} }

View File

@ -20,7 +20,6 @@ package org.elasticsearch.indices;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import org.apache.lucene.util.LuceneTestCase;
import org.elasticsearch.common.Nullable; import org.elasticsearch.common.Nullable;
import org.elasticsearch.common.Strings; import org.elasticsearch.common.Strings;
import org.elasticsearch.index.shard.IndexShardState; 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; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
@ClusterScope(scope = Scope.TEST, numDataNodes = 0) @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 { public class IndicesLifecycleListenerTests extends ElasticsearchIntegrationTest {
@Test @Test