refactor(sync): add syncIsReady
This commit is contained in:
parent
9a9200d28b
commit
2f81a41f98
|
@ -182,6 +182,7 @@ void syncStart(int64_t rid);
|
|||
void syncStop(int64_t rid);
|
||||
int32_t syncSetStandby(int64_t rid);
|
||||
ESyncState syncGetMyRole(int64_t rid);
|
||||
bool syncIsReady(int64_t rid);
|
||||
const char* syncGetMyRoleStr(int64_t rid);
|
||||
SyncTerm syncGetMyTerm(int64_t rid);
|
||||
void syncGetEpSet(int64_t rid, SEpSet* pEpSet);
|
||||
|
|
|
@ -381,6 +381,17 @@ ESyncState syncGetMyRole(int64_t rid) {
|
|||
return state;
|
||||
}
|
||||
|
||||
bool syncIsReady(int64_t rid) {
|
||||
SSyncNode* pSyncNode = (SSyncNode*)taosAcquireRef(tsNodeRefId, rid);
|
||||
if (pSyncNode == NULL) {
|
||||
return false;
|
||||
}
|
||||
assert(rid == pSyncNode->rid);
|
||||
bool b = (pSyncNode->state == TAOS_SYNC_STATE_LEADER) && pSyncNode->restoreFinish;
|
||||
taosReleaseRef(tsNodeRefId, pSyncNode->rid);
|
||||
return b;
|
||||
}
|
||||
|
||||
bool syncIsRestoreFinish(int64_t rid) {
|
||||
SSyncNode* pSyncNode = (SSyncNode*)taosAcquireRef(tsNodeRefId, rid);
|
||||
if (pSyncNode == NULL) {
|
||||
|
|
Loading…
Reference in New Issue