Skip to content

Commit 730bc8c

Browse files
committed
Fix msu assertion in restore shard history test
Since #40249, we always reinitialize max_seq_no_of_updates to max_seq_no when a promoting primary restores history regardless of whether it did rollback previously or not. Closes #40929
1 parent 924b99e commit 730bc8c

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

server/src/test/java/org/elasticsearch/index/shard/IndexShardTests.java

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1090,7 +1090,6 @@ public void testGlobalCheckpointSync() throws IOException {
10901090
closeShards(replicaShard, primaryShard);
10911091
}
10921092

1093-
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/40929")
10941093
public void testRestoreLocalHistoryFromTranslogOnPromotion() throws IOException, InterruptedException {
10951094
final IndexShard indexShard = newStartedShard(false);
10961095
final int operations = 1024 - scaledRandomIntBetween(0, 1024);
@@ -1145,13 +1144,8 @@ public void onFailure(Exception e) {
11451144
assertThat(indexShard.getLocalCheckpoint(), equalTo(maxSeqNo));
11461145
assertThat(indexShard.seqNoStats().getMaxSeqNo(), equalTo(maxSeqNo));
11471146
assertThat(getShardDocUIDs(indexShard), equalTo(docsBeforeRollback));
1148-
if (shouldRollback) {
1149-
// we conservatively roll MSU forward to maxSeqNo during restoreLocalHistory, ideally it should become just
1150-
// currentMaxSeqNoOfUpdates
1151-
assertThat(indexShard.getMaxSeqNoOfUpdatesOrDeletes(), equalTo(maxSeqNo));
1152-
} else {
1153-
assertThat(indexShard.getMaxSeqNoOfUpdatesOrDeletes(), equalTo(Math.max(currentMaxSeqNoOfUpdates, maxSeqNoOfUpdatesOrDeletes)));
1154-
}
1147+
// we conservatively roll MSU forward to maxSeqNo during restoreLocalHistory, ideally it should become just currentMaxSeqNoOfUpdates
1148+
assertThat(indexShard.getMaxSeqNoOfUpdatesOrDeletes(), equalTo(maxSeqNo));
11551149
closeShard(indexShard, false);
11561150
}
11571151

0 commit comments

Comments
 (0)