diff --git a/include/libs/sync/sync.h b/include/libs/sync/sync.h index 1eed353f33150c1ca7790d2ec8d082d8d0ac8eea..2bf678fa487a86aa666f39e25f6c9cef76cb4bba 100644 --- a/include/libs/sync/sync.h +++ b/include/libs/sync/sync.h @@ -146,6 +146,7 @@ int32_t syncGetVgId(int64_t rid); int32_t syncPropose(int64_t rid, const SRpcMsg* pMsg, bool isWeak); bool syncEnvIsStart(); const char* syncStr(ESyncState state); +bool syncIsRestoreFinish(int64_t rid); #ifdef __cplusplus } diff --git a/source/libs/sync/src/syncMain.c b/source/libs/sync/src/syncMain.c index 821ed364e840f268f1c0da76f95536a6b2342676..b5315e33c8839d60c302f30e01be91f8beb6d1f7 100644 --- a/source/libs/sync/src/syncMain.c +++ b/source/libs/sync/src/syncMain.c @@ -157,6 +157,18 @@ ESyncState syncGetMyRole(int64_t rid) { return state; } +bool syncIsRestoreFinish(int64_t rid) { + SSyncNode* pSyncNode = (SSyncNode*)taosAcquireRef(tsNodeRefId, rid); + if (pSyncNode == NULL) { + return false; + } + assert(rid == pSyncNode->rid); + bool b = pSyncNode->restoreFinish; + + taosReleaseRef(tsNodeRefId, pSyncNode->rid); + return b; +} + const char* syncGetMyRoleStr(int64_t rid) { const char* s = syncUtilState2String(syncGetMyRole(rid)); return s;