From 2bc5652d9cf0fdb68861eda04815b163ca70e80a Mon Sep 17 00:00:00 2001 From: Rishikesh1159 Date: Mon, 25 Jul 2022 21:39:58 +0000 Subject: [PATCH] Adding Default Implementation for getLatestSegmentInfos() in Engine.java and adressing comments from previous PR Signed-off-by: Rishikesh1159 --- .../java/org/opensearch/index/engine/Engine.java | 5 ++++- .../index/engine/NRTReplicationEngine.java | 15 +-------------- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/server/src/main/java/org/opensearch/index/engine/Engine.java b/server/src/main/java/org/opensearch/index/engine/Engine.java index 9d940b84e621f..4b5fbd4ef84a6 100644 --- a/server/src/main/java/org/opensearch/index/engine/Engine.java +++ b/server/src/main/java/org/opensearch/index/engine/Engine.java @@ -173,7 +173,10 @@ public final EngineConfig config() { * Return the latest active SegmentInfos from the engine. * @return {@link SegmentInfos} */ - protected abstract SegmentInfos getLatestSegmentInfos(); + protected SegmentInfos getLatestSegmentInfos() { + // Default Implementation. + return null; + }; public MergeStats getMergeStats() { return new MergeStats(); diff --git a/server/src/main/java/org/opensearch/index/engine/NRTReplicationEngine.java b/server/src/main/java/org/opensearch/index/engine/NRTReplicationEngine.java index a5bd3122d52dd..14608ddc14c34 100644 --- a/server/src/main/java/org/opensearch/index/engine/NRTReplicationEngine.java +++ b/server/src/main/java/org/opensearch/index/engine/NRTReplicationEngine.java @@ -222,20 +222,7 @@ public Translog.Snapshot newChangesSnapshot( @Override public Translog.Snapshot newChangesSnapshotFromTranslogFile(String source, long fromSeqNo, long toSeqNo, boolean requiredFullRange) throws IOException { - return new Translog.Snapshot() { - @Override - public int totalOperations() { - return 0; - } - - @Override - public Translog.Operation next() { - return null; - } - - @Override - public void close() {} - }; + return getTranslog().newSnapshot(fromSeqNo, toSeqNo, requiredFullRange); } @Override