-
Notifications
You must be signed in to change notification settings - Fork 323
Closed
Description
- Question:
- Open batch push, upgrade from 0.2.2 to 0.2.6 version
- Operate the slave node, master node, slave node in sequence, and the last slave node will not be able to synchronize
- Reason
-
0.2.2 return to master is
endIndex
, and count of response is 0, so the watermark of slave will be less 1 than real value.updatePeerWaterMark(x.getTerm(), peerId, x.getIndex() + x.getCount() - 1); -
when last slave upgrade, follow code may will be run
doCheckBatchAppendResponse(); -
But in
doCheckBatchAppendResponse
, peerWaterMark is less 1 than real. sopeerWaterMark + 1
will be endIndex and it is not stored inbatchPendingMap
. Sopair
will always be null and pusher will always execute the check logic.
private void doCheckBatchAppendResponse() throws Exception {
long peerWaterMark = getPeerWaterMark(term, peerId);
Pair pair = batchPendingMap.get(peerWaterMark + 1);
if (pair != null && System.currentTimeMillis() - (long) pair.getKey() > dLedgerConfig.getMaxPushTimeOutMs()) {
long firstIndex = peerWaterMark + 1;
long lastIndex = firstIndex + (int) pair.getValue() - 1;
logger.warn("[Push-{}]Retry to push entry from {} to {}", peerId, firstIndex, lastIndex);
batchAppendEntryRequest.clear();
for (long i = firstIndex; i <= lastIndex; i++) {
DLedgerEntry entry = dLedgerStore.get(i);
batchAppendEntryRequest.addEntry(entry);
}
sendBatchAppendEntryRequest();
}
}
Metadata
Metadata
Assignees
Labels
No labels