From 00b0f2cdbc9556453cd6be15c3246a5875dd930b Mon Sep 17 00:00:00 2001 From: Sachin Kale Date: Thu, 5 Sep 2024 08:48:55 +0530 Subject: [PATCH] Fix StoreRecovery Signed-off-by: Sachin Kale --- .../main/java/org/opensearch/index/shard/StoreRecovery.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/server/src/main/java/org/opensearch/index/shard/StoreRecovery.java b/server/src/main/java/org/opensearch/index/shard/StoreRecovery.java index 6933e4e161dd1..494fe0dbef803 100644 --- a/server/src/main/java/org/opensearch/index/shard/StoreRecovery.java +++ b/server/src/main/java/org/opensearch/index/shard/StoreRecovery.java @@ -57,6 +57,7 @@ import org.opensearch.core.index.shard.ShardId; import org.opensearch.index.engine.Engine; import org.opensearch.index.engine.EngineException; +import org.opensearch.index.engine.InternalEngine; import org.opensearch.index.mapper.MapperService; import org.opensearch.index.remote.RemoteStorePathStrategy; import org.opensearch.index.remote.RemoteStoreUtils; @@ -525,8 +526,8 @@ void recoverShallowSnapshotV2( indexShard.postRecovery("post recovery from remote_store"); SegmentInfos committedSegmentInfos = indexShard.store().readLastCommittedSegmentsInfo(); try { - indexShard.getEngine() - .translogManager() + assert indexShard.getEngine() instanceof InternalEngine; + ((InternalEngine) indexShard.getEngine()).translogManager() .setMinSeqNoToKeep(Long.parseLong(committedSegmentInfos.getUserData().get(SequenceNumbers.MAX_SEQ_NO)) + 1); } catch (IllegalArgumentException e) { logger.warn("MinSeqNoToKeep is already past the maxSeqNo from commited segment infos");