Merge pull request #2788 from taosdata/feature/syncFC
add one more state SYNCING
This commit is contained in:
commit
10541dd2d0
|
@ -26,6 +26,7 @@ extern "C" {
|
|||
typedef enum _TAOS_SYNC_ROLE {
|
||||
TAOS_SYNC_ROLE_OFFLINE,
|
||||
TAOS_SYNC_ROLE_UNSYNCED,
|
||||
TAOS_SYNC_ROLE_SYNCING,
|
||||
TAOS_SYNC_ROLE_SLAVE,
|
||||
TAOS_SYNC_ROLE_MASTER,
|
||||
} ESyncRole;
|
||||
|
|
|
@ -190,18 +190,7 @@ void *mnodeGetNextMnode(void *pIter, SMnodeObj **pMnode) {
|
|||
}
|
||||
|
||||
char *mnodeGetMnodeRoleStr(int32_t role) {
|
||||
switch (role) {
|
||||
case TAOS_SYNC_ROLE_OFFLINE:
|
||||
return "offline";
|
||||
case TAOS_SYNC_ROLE_UNSYNCED:
|
||||
return "unsynced";
|
||||
case TAOS_SYNC_ROLE_SLAVE:
|
||||
return "slave";
|
||||
case TAOS_SYNC_ROLE_MASTER:
|
||||
return "master";
|
||||
default:
|
||||
return "undefined";
|
||||
}
|
||||
return syncRole[role];
|
||||
}
|
||||
|
||||
void mnodeUpdateMnodeEpSet() {
|
||||
|
|
|
@ -71,6 +71,7 @@ static SSyncPeer *syncAddPeer(SSyncNode *pNode, const SNodeInfo *pInfo);
|
|||
char* syncRole[] = {
|
||||
"offline",
|
||||
"unsynced",
|
||||
"syncing",
|
||||
"slave",
|
||||
"master"
|
||||
};
|
||||
|
|
|
@ -300,6 +300,8 @@ void *syncRestoreData(void *param)
|
|||
taosBlockSIGPIPE();
|
||||
__sync_fetch_and_add(&tsSyncNum, 1);
|
||||
|
||||
(*pNode->notifyRole)(pNode->ahandle, TAOS_SYNC_ROLE_SYNCING);
|
||||
|
||||
if (syncOpenRecvBuffer(pNode) < 0) {
|
||||
sError("%s, failed to allocate recv buffer", pPeer->id);
|
||||
} else {
|
||||
|
@ -307,7 +309,6 @@ void *syncRestoreData(void *param)
|
|||
sInfo("%s, it is synced successfully", pPeer->id);
|
||||
nodeRole = TAOS_SYNC_ROLE_SLAVE;
|
||||
syncBroadcastStatus(pNode);
|
||||
(*pNode->notifyRole)(pNode->ahandle, nodeRole);
|
||||
} else {
|
||||
sError("%s, failed to restore data, restart connection", pPeer->id);
|
||||
nodeRole = TAOS_SYNC_ROLE_UNSYNCED;
|
||||
|
@ -315,6 +316,8 @@ void *syncRestoreData(void *param)
|
|||
}
|
||||
}
|
||||
|
||||
(*pNode->notifyRole)(pNode->ahandle, nodeRole);
|
||||
|
||||
nodeSStatus = TAOS_SYNC_STATUS_INIT;
|
||||
tclose(pPeer->syncFd)
|
||||
syncCloseRecvBuffer(pNode);
|
||||
|
|
|
@ -419,10 +419,7 @@ static void vnodeBuildVloadMsg(SVnodeObj *pVnode, SDMStatusMsg *pStatus) {
|
|||
if (pVnode->status != TAOS_VN_STATUS_READY) return;
|
||||
if (pStatus->openVnodes >= TSDB_MAX_VNODES) return;
|
||||
|
||||
// still need report status when unsynced
|
||||
if (pVnode->syncCfg.replica > 1 && pVnode->role == TAOS_SYNC_ROLE_UNSYNCED) {
|
||||
} else if (pVnode->tsdb == NULL) {
|
||||
} else {
|
||||
if (pVnode->tsdb) {
|
||||
tsdbReportStat(pVnode->tsdb, &pointsWritten, &totalStorage, &compStorage);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue