Skip to content

Commit 73f116a

Browse files
author
Kamal Nayan
committed
Fixing warm index recovery tests
Signed-off-by: Kamal Nayan <askkamal@amazon.com>
1 parent 827673c commit 73f116a

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

server/src/main/java/org/opensearch/index/shard/IndexShard.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2403,7 +2403,7 @@ public boolean isRemoteSegmentStoreInSync() {
24032403
Collection<String> localSegmentInfosFiles = segmentInfosGatedCloseable.get().files(true);
24042404
Set<String> localFiles = new HashSet<>(localSegmentInfosFiles);
24052405
// verifying that all files except excluded files are uploaded to the remote
2406-
localFiles.removeIf(file -> RemoteStoreRefreshListener.isFileExcluded(file, true));
2406+
localFiles.removeIf(file -> RemoteStoreRefreshListener.isFileExcluded(file, isRefreshSegmentUploadDecouplingEnabled()));
24072407
if (uploadFiles.containsAll(localFiles)) {
24082408
return true;
24092409
}

server/src/main/java/org/opensearch/index/shard/StoreRecovery.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -702,7 +702,13 @@ private void internalRecoverFromStore(IndexShard indexShard) throws IndexShardRe
702702
try {
703703
store.failIfCorrupted();
704704
try {
705-
si = readSegmentInfosFromStore(store, indexShard);
705+
// As a part of refresh segment upload decoupling now segmentN file is not uploaded to remote so we are now creating it
706+
// using remote segment metadata.
707+
if (indexShard.isRefreshSegmentUploadDecouplingEnabled() && indexShard.indexSettings.isWarmIndex() == true) {
708+
si = readSegmentInfosFromRemoteStore(store, indexShard);
709+
} else {
710+
si = store.readLastCommittedSegmentsInfo();
711+
}
706712
} catch (Exception e) {
707713
String files = "_unknown_";
708714
try {
@@ -1006,7 +1012,7 @@ private void restore(
10061012

10071013
private void bootstrapForSnapshot(final IndexShard indexShard, final Store store) throws IOException {
10081014
store.bootstrapNewHistory();
1009-
final SegmentInfos segmentInfos = readSegmentInfosFromStore(store);
1015+
final SegmentInfos segmentInfos = store.readLastCommittedSegmentsInfo();
10101016
final long localCheckpoint = Long.parseLong(segmentInfos.userData.get(SequenceNumbers.LOCAL_CHECKPOINT_KEY));
10111017
String translogUUID = segmentInfos.getUserData().get(Translog.TRANSLOG_UUID_KEY);
10121018
Translog.createEmptyTranslog(
@@ -1021,7 +1027,7 @@ private void bootstrapForSnapshot(final IndexShard indexShard, final Store store
10211027

10221028
private void bootstrap(final IndexShard indexShard, final Store store) throws IOException {
10231029
store.bootstrapNewHistory();
1024-
final SegmentInfos segmentInfos = readSegmentInfosFromStore(store);
1030+
final SegmentInfos segmentInfos = store.readLastCommittedSegmentsInfo();
10251031
final long localCheckpoint = Long.parseLong(segmentInfos.userData.get(SequenceNumbers.LOCAL_CHECKPOINT_KEY));
10261032

10271033
final String translogUUID = Translog.createEmptyTranslog(

0 commit comments

Comments
 (0)