Add a second refresh to concurrent relocation test

This commit adds a second refresh to the concurrent relocation
test. This is necessary as the first refresh might have brought back a
local checkpoint for a shard that a newly relocated primary became aware
of but did not yet receive a local checkpoint for that shard. When that
local checkpoint arrives on the new primary, the global checkpoint could
advance again and so we need a second replication action to push that
global checkpoint back out to the replica. This is indeed a hack, and it
will eventually be removed.

Closes #24599
This commit is contained in:
Jason Tedor 2017-05-29 11:30:38 -04:00
parent 4d423bf2ba
commit b2abdd1174
1 changed files with 7 additions and 1 deletions

View File

@ -454,7 +454,6 @@ public class RelocationIT extends ESIntegTestCase {
+ "org.elasticsearch.action.search:TRACE,"
+ "org.elasticsearch.cluster.service:TRACE,"
+ "org.elasticsearch.index.seqno:TRACE")
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/24599")
public void testIndexAndRelocateConcurrently() throws ExecutionException, InterruptedException {
int halfNodes = randomIntBetween(1, 3);
Settings[] nodeSettings = Stream.concat(
@ -515,6 +514,13 @@ 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();
/*
* We have to execute a second refresh as in the face of relocations, the relocation target is not aware of the in-sync set and so
* the first refresh would bring back the local checkpoint for any shards added to the in-sync set that the relocation target was
* not tracking.
*/
// TODO: remove this after a primary context is transferred during relocation handoff
client().admin().indices().prepareRefresh("test").get();
}