Skip to content

Commit

Permalink
use count translog ops
Browse files Browse the repository at this point in the history
  • Loading branch information
dnhatn committed Apr 30, 2019
1 parent baceaad commit 07c3a7c
Showing 1 changed file with 3 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -312,17 +312,9 @@ public void finalizeRecovery(final long globalCheckpoint, ActionListener<Void> l
});
}

private boolean hasUncommittedOperations() {
if (indexShard.translogStats().getUncommittedOperations() == 0) {
return false;
}
// If a file-based occurs, the primary also sends its translog to the replica. If all of those
// translog operations are in the copying commit already, we should not flush (mainly to reserve syncId).
final SequenceNumbers.CommitInfo commitInfo = SequenceNumbers.loadSeqNoInfoFromLuceneCommit(
indexShard.commitStats().getUserData().entrySet());
return commitInfo.maxSeqNo != commitInfo.localCheckpoint
|| commitInfo.maxSeqNo != indexShard.seqNoStats().getMaxSeqNo()
|| commitInfo.maxSeqNo != indexShard.getLastSyncedGlobalCheckpoint();
private boolean hasUncommittedOperations() throws IOException {
long localCheckpointOfCommit = Long.parseLong(indexShard.commitStats().getUserData().get(SequenceNumbers.LOCAL_CHECKPOINT_KEY));
return indexShard.estimateNumberOfHistoryOperations("peer-recovery", localCheckpointOfCommit + 1) > 0;
}

@Override
Expand Down

0 comments on commit 07c3a7c

Please sign in to comment.