Skip to content

Commit 4d55e9e

Browse files
committed
Estimate num history ops should always use translog (#42211)
Currently, we ignore soft-deletes in peer recovery, thus estimateNumberOfHistoryOperations should always use translog. Relates #38904
1 parent b510402 commit 4d55e9e

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

server/src/main/java/org/elasticsearch/index/engine/InternalEngine.java

+2-9
Original file line numberDiff line numberDiff line change
@@ -516,15 +516,8 @@ public Translog.Snapshot readHistoryOperations(String source, MapperService mapp
516516
* Returns the estimated number of history operations whose seq# at least the provided seq# in this engine.
517517
*/
518518
@Override
519-
public int estimateNumberOfHistoryOperations(String source, MapperService mapperService, long startingSeqNo) throws IOException {
520-
if (engineConfig.getIndexSettings().isSoftDeleteEnabled()) {
521-
try (Translog.Snapshot snapshot = newChangesSnapshot(source, mapperService, Math.max(0, startingSeqNo),
522-
Long.MAX_VALUE, false)) {
523-
return snapshot.totalOperations();
524-
}
525-
} else {
526-
return getTranslog().estimateTotalOperationsFromMinSeq(startingSeqNo);
527-
}
519+
public int estimateNumberOfHistoryOperations(String source, MapperService mapperService, long startingSeqNo) {
520+
return getTranslog().estimateTotalOperationsFromMinSeq(startingSeqNo);
528521
}
529522

530523
@Override

0 commit comments

Comments
 (0)