From 0b089ac0845db09d8ad51c766d0831257fd97571 Mon Sep 17 00:00:00 2001 From: Jason Tedor Date: Wed, 10 May 2017 18:54:22 -0400 Subject: [PATCH] Refresh at end of concurrent relocate test We have to do something to force the global checkpoint to be synchronized to the replicas or the assertions at the end of the test that they are in sync will trip. Since the last write operation to hit a replica shard will only carry the penultimate global checkpoint (it will advance when the replicas respond with their local checkpoint), and a background sync will not happen until the primary shard falls idle, we force a sync through a refresh action. --- .../java/org/elasticsearch/recovery/RelocationIT.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/core/src/test/java/org/elasticsearch/recovery/RelocationIT.java b/core/src/test/java/org/elasticsearch/recovery/RelocationIT.java index dca450c8a1d..7010034bc4f 100644 --- a/core/src/test/java/org/elasticsearch/recovery/RelocationIT.java +++ b/core/src/test/java/org/elasticsearch/recovery/RelocationIT.java @@ -367,10 +367,11 @@ public class RelocationIT extends ESIntegTestCase { } } - // refresh is a replication action so this forces a global checkpoint sync which is needed as these are asserted on in tear down - client().admin().indices().prepareRefresh("test").get(); - } + + // refresh is a replication action so this forces a global checkpoint sync which is needed as these are asserted on in tear down + client().admin().indices().prepareRefresh("test").get(); + } public void testCancellationCleansTempFiles() throws Exception { @@ -506,6 +507,10 @@ public class RelocationIT extends ESIntegTestCase { assertNoFailures(afterRelocation); assertSearchHits(afterRelocation, ids.toArray(new String[ids.size()])); } + + // refresh is a replication action so this forces a global checkpoint sync which is needed as these are asserted on in tear down + client().admin().indices().prepareRefresh("test").get(); + } class RecoveryCorruption extends MockTransportService.DelegateTransport {