Skip to content

Commit 3cdb2ac

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 0bac74c commit 3cdb2ac

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
@@ -1092,7 +1092,6 @@ public void testGlobalCheckpointSync() throws IOException {
10921092
closeShards(replicaShard, primaryShard);
10931093
}
10941094

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

0 commit comments

Comments
 (0)