enh: terminate snap replication on timeout
This commit is contained in:
parent
4e3a8b893d
commit
7d9d1c6877
|
@ -46,6 +46,7 @@ extern "C" {
|
|||
#define SYNC_HEARTBEAT_SLOW_MS 1500
|
||||
#define SYNC_HEARTBEAT_REPLY_SLOW_MS 1500
|
||||
#define SYNC_SNAP_RESEND_MS 1000 * 60
|
||||
#define SYNC_SNAP_TIMEOUT_MS 1000 * 180
|
||||
|
||||
#define SYNC_VND_COMMIT_MIN_MS 3000
|
||||
|
||||
|
|
|
@ -78,11 +78,9 @@ static int32_t syncNodeTimerRoutine(SSyncNode* ths) {
|
|||
SSyncSnapshotSender* pSender = syncNodeGetSnapshotSender(ths, &(ths->peersId[i]));
|
||||
if (pSender != NULL) {
|
||||
if (ths->isStart && ths->state == TAOS_SYNC_STATE_LEADER && pSender->start &&
|
||||
timeNow - pSender->lastSendTime > SYNC_SNAP_RESEND_MS) {
|
||||
snapshotReSend(pSender);
|
||||
} else {
|
||||
sTrace("vgId:%d, do not resend: nstart%d, now:%" PRId64 ", lstsend:%" PRId64 ", diff:%" PRId64, ths->vgId,
|
||||
ths->isStart, timeNow, pSender->lastSendTime, timeNow - pSender->lastSendTime);
|
||||
timeNow - pSender->lastSendTime > SYNC_SNAP_TIMEOUT_MS) {
|
||||
sSError(pSender, "snapshot timeout, terminate. lastSendTime:%d", pSender->lastSendTime);
|
||||
snapshotSenderStop(pSender, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue