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 committed May 21, 2019
1 parent b510402 commit 4d55e9e
Showing 1 changed file with 2 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -516,15 +516,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 4d55e9e

Please sign in to comment.