From 3072afbacb62433dba0ae32d6d7ebc3981e295a6 Mon Sep 17 00:00:00 2001 From: Minghao Li Date: Wed, 2 Nov 2022 15:25:26 +0800 Subject: [PATCH] refactor(sync): add pre snapshot --- include/libs/sync/sync.h | 1 + include/libs/sync/syncTools.h | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/include/libs/sync/sync.h b/include/libs/sync/sync.h index 1a94dcf426..e8a50cb1f7 100644 --- a/include/libs/sync/sync.h +++ b/include/libs/sync/sync.h @@ -39,6 +39,7 @@ extern bool gRaftDetailLog; #define SYNC_ADD_QUORUM_COUNT 3 #define SYNC_MNODE_LOG_RETENTION 10000 #define SYNC_VNODE_LOG_RETENTION 100 +#define SNAPSHOT_MAX_CLOCK_SKEW_MS 1000 * 10 #define SYNC_APPEND_ENTRIES_TIMEOUT_MS 10000 diff --git a/include/libs/sync/syncTools.h b/include/libs/sync/syncTools.h index 24f1196bed..5bddf6a800 100644 --- a/include/libs/sync/syncTools.h +++ b/include/libs/sync/syncTools.h @@ -617,7 +617,7 @@ typedef struct SyncSnapshotSend { SyncTerm lastTerm; // snapshot.lastTerm SyncIndex lastConfigIndex; // snapshot.lastConfigIndex SSyncCfg lastConfig; - SyncTerm privateTerm; + int64_t startTime; int32_t seq; uint32_t dataLen; char data[]; @@ -652,9 +652,10 @@ typedef struct SyncSnapshotRsp { SyncTerm term; SyncIndex lastIndex; SyncTerm lastTerm; - SyncTerm privateTerm; + int64_t startTime; int32_t ack; int32_t code; + SyncIndex snapBeginIndex; // when ack = SYNC_SNAPSHOT_SEQ_BEGIN, it's valid } SyncSnapshotRsp; SyncSnapshotRsp* syncSnapshotRspBuild(int32_t vgId);