Skip to content

Commit

Permalink
wait for shard to be allocated before executing a resume follow api
Browse files Browse the repository at this point in the history
  • Loading branch information
martijnvg committed Feb 18, 2019
1 parent a5e04ac commit d5b38dd
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,9 @@ public void testBiDirectionalIndexFollowing() throws Exception {
index(leaderClient(), "leader_index5", 128);
break;
case ALL:
ensureGreen(followerClient(), "follower_index5");
resumeIndexFollowing(followerClient(), "follower_index5");
ensureGreen(leaderClient(), "follower_index6");
resumeIndexFollowing(leaderClient(), "follower_index6");

assertTotalHitCount("follower_index5", 896, followerClient());
Expand Down Expand Up @@ -374,4 +376,13 @@ private static void resumeIndexFollowing(RestClient client, String followerIndex
assertOK(client.performRequest(new Request("POST", "/" + followerIndex + "/_ccr/resume_follow")));
}

private static void ensureGreen(RestClient client, String index) throws IOException {
Request request = new Request("GET", "/_cluster/health/" + index);
request.addParameter("wait_for_status", "green");
request.addParameter("wait_for_no_relocating_shards", "true");
request.addParameter("timeout", "70s");
request.addParameter("level", "shards");
client.performRequest(request);
}

}

0 comments on commit d5b38dd

Please sign in to comment.