Skip to content

Commit 2ac57d2

Browse files
authored
Fix SnapshotBasedIndexRecoveryIT#testRecoveryIsCancelledAfterDeletingTheIndex (#79306)
Ensure that global checkpoint is populated after indexing documents in indices with replicas. Fixes #79186 Backport of #79269
1 parent bbd045d commit 2ac57d2

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

server/src/internalClusterTest/java/org/elasticsearch/indices/recovery/SnapshotBasedIndexRecoveryIT.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,7 @@ public void testRecoveryIsCancelledAfterDeletingTheIndex() throws Exception {
480480
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0);
481481
}
482482
createIndex(indexName, indexSettings.build());
483+
ensureGreen(indexName);
483484

484485
int numDocs = randomIntBetween(300, 1000);
485486
indexDocs(indexName, numDocs, numDocs);
@@ -777,6 +778,7 @@ public void testSeqNoBasedRecoveryIsUsedAfterPrimaryFailOver() throws Exception
777778
.put("index.routing.allocation.include._name", String.join(",", dataNodes))
778779
.build()
779780
);
781+
ensureGreen(indexName);
780782

781783
int numDocs = randomIntBetween(300, 1000);
782784
indexDocs(indexName, 0, numDocs);
@@ -867,6 +869,8 @@ private void indexDocs(String indexName, int docIdOffset, int docCount) throws E
867869
assertThat(stats, is(notNullValue()));
868870
assertThat(stats.getSeqNoStats(), is(notNullValue()));
869871

872+
assertThat(stats.getSeqNoStats().getMaxSeqNo(), is(greaterThan(-1L)));
873+
assertThat(stats.getSeqNoStats().getGlobalCheckpoint(), is(greaterThan(-1L)));
870874
assertThat(Strings.toString(stats.getSeqNoStats()),
871875
stats.getSeqNoStats().getMaxSeqNo(), equalTo(stats.getSeqNoStats().getGlobalCheckpoint()));
872876
}, 60, TimeUnit.SECONDS);

0 commit comments

Comments
 (0)