未验证 提交 10541dd2 编写于 作者: S Shengliang Guan 提交者: GitHub

Merge pull request #2788 from taosdata/feature/syncFC

add one more state SYNCING
...@@ -26,6 +26,7 @@ extern "C" { ...@@ -26,6 +26,7 @@ extern "C" {
typedef enum _TAOS_SYNC_ROLE { typedef enum _TAOS_SYNC_ROLE {
TAOS_SYNC_ROLE_OFFLINE, TAOS_SYNC_ROLE_OFFLINE,
TAOS_SYNC_ROLE_UNSYNCED, TAOS_SYNC_ROLE_UNSYNCED,
TAOS_SYNC_ROLE_SYNCING,
TAOS_SYNC_ROLE_SLAVE, TAOS_SYNC_ROLE_SLAVE,
TAOS_SYNC_ROLE_MASTER, TAOS_SYNC_ROLE_MASTER,
} ESyncRole; } ESyncRole;
......
...@@ -190,18 +190,7 @@ void *mnodeGetNextMnode(void *pIter, SMnodeObj **pMnode) { ...@@ -190,18 +190,7 @@ void *mnodeGetNextMnode(void *pIter, SMnodeObj **pMnode) {
} }
char *mnodeGetMnodeRoleStr(int32_t role) { char *mnodeGetMnodeRoleStr(int32_t role) {
switch (role) { return syncRole[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";
}
} }
void mnodeUpdateMnodeEpSet() { void mnodeUpdateMnodeEpSet() {
......
...@@ -71,6 +71,7 @@ static SSyncPeer *syncAddPeer(SSyncNode *pNode, const SNodeInfo *pInfo); ...@@ -71,6 +71,7 @@ static SSyncPeer *syncAddPeer(SSyncNode *pNode, const SNodeInfo *pInfo);
char* syncRole[] = { char* syncRole[] = {
"offline", "offline",
"unsynced", "unsynced",
"syncing",
"slave", "slave",
"master" "master"
}; };
......
...@@ -300,6 +300,8 @@ void *syncRestoreData(void *param) ...@@ -300,6 +300,8 @@ void *syncRestoreData(void *param)
taosBlockSIGPIPE(); taosBlockSIGPIPE();
__sync_fetch_and_add(&tsSyncNum, 1); __sync_fetch_and_add(&tsSyncNum, 1);
(*pNode->notifyRole)(pNode->ahandle, TAOS_SYNC_ROLE_SYNCING);
if (syncOpenRecvBuffer(pNode) < 0) { if (syncOpenRecvBuffer(pNode) < 0) {
sError("%s, failed to allocate recv buffer", pPeer->id); sError("%s, failed to allocate recv buffer", pPeer->id);
} else { } else {
...@@ -307,7 +309,6 @@ void *syncRestoreData(void *param) ...@@ -307,7 +309,6 @@ void *syncRestoreData(void *param)
sInfo("%s, it is synced successfully", pPeer->id); sInfo("%s, it is synced successfully", pPeer->id);
nodeRole = TAOS_SYNC_ROLE_SLAVE; nodeRole = TAOS_SYNC_ROLE_SLAVE;
syncBroadcastStatus(pNode); syncBroadcastStatus(pNode);
(*pNode->notifyRole)(pNode->ahandle, nodeRole);
} else { } else {
sError("%s, failed to restore data, restart connection", pPeer->id); sError("%s, failed to restore data, restart connection", pPeer->id);
nodeRole = TAOS_SYNC_ROLE_UNSYNCED; nodeRole = TAOS_SYNC_ROLE_UNSYNCED;
...@@ -315,6 +316,8 @@ void *syncRestoreData(void *param) ...@@ -315,6 +316,8 @@ void *syncRestoreData(void *param)
} }
} }
(*pNode->notifyRole)(pNode->ahandle, nodeRole);
nodeSStatus = TAOS_SYNC_STATUS_INIT; nodeSStatus = TAOS_SYNC_STATUS_INIT;
tclose(pPeer->syncFd) tclose(pPeer->syncFd)
syncCloseRecvBuffer(pNode); syncCloseRecvBuffer(pNode);
......
...@@ -419,10 +419,7 @@ static void vnodeBuildVloadMsg(SVnodeObj *pVnode, SDMStatusMsg *pStatus) { ...@@ -419,10 +419,7 @@ static void vnodeBuildVloadMsg(SVnodeObj *pVnode, SDMStatusMsg *pStatus) {
if (pVnode->status != TAOS_VN_STATUS_READY) return; if (pVnode->status != TAOS_VN_STATUS_READY) return;
if (pStatus->openVnodes >= TSDB_MAX_VNODES) return; if (pStatus->openVnodes >= TSDB_MAX_VNODES) return;
// still need report status when unsynced if (pVnode->tsdb) {
if (pVnode->syncCfg.replica > 1 && pVnode->role == TAOS_SYNC_ROLE_UNSYNCED) {
} else if (pVnode->tsdb == NULL) {
} else {
tsdbReportStat(pVnode->tsdb, &pointsWritten, &totalStorage, &compStorage); tsdbReportStat(pVnode->tsdb, &pointsWritten, &totalStorage, &compStorage);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册