Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resync should not send operations without sequence number #40433

Merged
merged 11 commits into from
Apr 4, 2019
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,8 @@ protected void doRun() throws Exception {
Translog.Operation operation;
while ((operation = snapshot.next()) != null) {
final long seqNo = operation.seqNo();
if (startingSeqNo >= 0 &&
(seqNo == SequenceNumbers.UNASSIGNED_SEQ_NO || seqNo < startingSeqNo)) {
assert seqNo >= 0 : "resync should not send operation with unassigned sequence number [" + operation + "]";
if (seqNo < startingSeqNo) {
totalSkippedOps.incrementAndGet();
continue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -683,14 +683,8 @@ private Snapshot newMultiSnapshot(TranslogSnapshot[] snapshots) throws IOExcepti
}

private Stream<? extends BaseTranslogReader> readersAboveMinSeqNo(long minSeqNo) {
assert readLock.isHeldByCurrentThread() || writeLock.isHeldByCurrentThread() :
"callers of readersAboveMinSeqNo must hold a lock: readLock ["
+ readLock.isHeldByCurrentThread() + "], writeLock [" + readLock.isHeldByCurrentThread() + "]";
return Stream.concat(readers.stream(), Stream.of(current))
.filter(reader -> {
final long maxSeqNo = reader.getCheckpoint().maxSeqNo;
return maxSeqNo == SequenceNumbers.UNASSIGNED_SEQ_NO || maxSeqNo >= minSeqNo;
});
assert readLock.isHeldByCurrentThread();
return Stream.concat(readers.stream(), Stream.of(current)).filter(reader -> reader.getCheckpoint().maxSeqNo >= minSeqNo);
dnhatn marked this conversation as resolved.
Show resolved Hide resolved
}

/**
Expand Down