Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -358,11 +358,7 @@ public void testCannotShrinkLeaderIndex() throws Exception {
changePolicyRequest.setEntity(changePolicyEntity);
assertOK(leaderClient.performRequest(changePolicyRequest));

index(leaderClient, indexName, "1");
assertDocumentExists(leaderClient, indexName, "1");

assertBusy(() -> {
assertDocumentExists(client(), indexName, "1");
// Sanity check that following_index setting has been set, so that we can verify later that this setting has been unset:
assertThat(getIndexSetting(client(), indexName, "index.xpack.ccr.following_index"), equalTo("true"));

Expand All @@ -371,6 +367,20 @@ public void testCannotShrinkLeaderIndex() throws Exception {
assertILMPolicy(client(), indexName, policyName, "hot", "unfollow", "wait-for-indexing-complete");
});

// Index a bunch of documents and wait for them to be replicated
for (int i = 0; i < 50; i++) {
index(leaderClient, indexName, Integer.toString(i));
}
assertBusy(() -> {
for (int i = 0; i < 50; i++) {
assertDocumentExists(client(), indexName, Integer.toString(i));
}
});

// Then make sure both leader and follower are still both waiting
assertILMPolicy(leaderClient, indexName, policyName, "warm", "shrink", "wait-for-shard-history-leases");
assertILMPolicy(client(), indexName, policyName, "hot", "unfollow", "wait-for-indexing-complete");

// Manually set this to kick the process
updateIndexSettings(leaderClient, indexName, Settings.builder()
.put("index.lifecycle.indexing_complete", true)
Expand Down