Skip to content

Commit f4a9d14

Browse files
dnhatnGurkan Kaymak
authored and
Gurkan Kaymak
committed
Estimate num history ops should always use translog (elastic#42211)
Currently, we ignore soft-deletes in peer recovery, thus estimateNumberOfHistoryOperations should always use translog. Relates elastic#38904
1 parent cd5a8fc commit f4a9d14

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

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -513,15 +513,8 @@ public Translog.Snapshot readHistoryOperations(String source, MapperService mapp
513513
* Returns the estimated number of history operations whose seq# at least the provided seq# in this engine.
514514
*/
515515
@Override
516-
public int estimateNumberOfHistoryOperations(String source, MapperService mapperService, long startingSeqNo) throws IOException {
517-
if (engineConfig.getIndexSettings().isSoftDeleteEnabled()) {
518-
try (Translog.Snapshot snapshot = newChangesSnapshot(source, mapperService, Math.max(0, startingSeqNo),
519-
Long.MAX_VALUE, false)) {
520-
return snapshot.totalOperations();
521-
}
522-
} else {
523-
return getTranslog().estimateTotalOperationsFromMinSeq(startingSeqNo);
524-
}
516+
public int estimateNumberOfHistoryOperations(String source, MapperService mapperService, long startingSeqNo) {
517+
return getTranslog().estimateTotalOperationsFromMinSeq(startingSeqNo);
525518
}
526519

527520
@Override

0 commit comments

Comments
 (0)