Skip to content

Commit

Permalink
Estimate num history ops should always use translog (#42211)
Browse files Browse the repository at this point in the history
Currently, we ignore soft-deletes in peer recovery, thus
estimateNumberOfHistoryOperations should always use translog.

Relates #38904
  • Loading branch information
dnhatn authored May 21, 2019
1 parent bb2ec18 commit c1aef4b
Showing 1 changed file with 2 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -513,15 +513,8 @@ public Translog.Snapshot readHistoryOperations(String source, MapperService mapp
* Returns the estimated number of history operations whose seq# at least the provided seq# in this engine.
*/
@Override
public int estimateNumberOfHistoryOperations(String source, MapperService mapperService, long startingSeqNo) throws IOException {
if (engineConfig.getIndexSettings().isSoftDeleteEnabled()) {
try (Translog.Snapshot snapshot = newChangesSnapshot(source, mapperService, Math.max(0, startingSeqNo),
Long.MAX_VALUE, false)) {
return snapshot.totalOperations();
}
} else {
return getTranslog().estimateTotalOperationsFromMinSeq(startingSeqNo);
}
public int estimateNumberOfHistoryOperations(String source, MapperService mapperService, long startingSeqNo) {
return getTranslog().estimateTotalOperationsFromMinSeq(startingSeqNo);
}

@Override
Expand Down

0 comments on commit c1aef4b

Please sign in to comment.