提交 2702903e 编写于 作者: S Shengliang Guan

feat: report service status

上级 b66718a4
...@@ -157,10 +157,10 @@ static void dmGetServerStatus(SDnode *pDnode, SServerStatusRsp *pStatus) { ...@@ -157,10 +157,10 @@ static void dmGetServerStatus(SDnode *pDnode, SServerStatusRsp *pStatus) {
pStatus->statusCode = TSDB_SRV_STATUS_EXTING; pStatus->statusCode = TSDB_SRV_STATUS_EXTING;
} else { } else {
SDnodeData *pData = &pDnode->data; SDnodeData *pData = &pDnode->data;
if (pData->isMnode && pData->mndState != TAOS_SYNC_STATE_FOLLOWER && pData->mndState != TAOS_SYNC_STATE_FOLLOWER) { if (pData->isMnode && pData->mndState != TAOS_SYNC_STATE_LEADER && pData->mndState == TAOS_SYNC_STATE_FOLLOWER) {
pStatus->statusCode = TSDB_SRV_STATUS_SERVICE_DEGRADED; pStatus->statusCode = TSDB_SRV_STATUS_SERVICE_DEGRADED;
snprintf(pStatus->details, sizeof(pStatus->details), "mnode sync state is %s", syncStr(pData->mndState)); snprintf(pStatus->details, sizeof(pStatus->details), "mnode sync state is %s", syncStr(pData->mndState));
} else if (pData->unsyncedVgId != 0 && pData->vndState != TAOS_SYNC_STATE_FOLLOWER && } else if (pData->unsyncedVgId != 0 && pData->vndState != TAOS_SYNC_STATE_LEADER &&
pData->vndState != TAOS_SYNC_STATE_FOLLOWER) { pData->vndState != TAOS_SYNC_STATE_FOLLOWER) {
pStatus->statusCode = TSDB_SRV_STATUS_SERVICE_DEGRADED; pStatus->statusCode = TSDB_SRV_STATUS_SERVICE_DEGRADED;
snprintf(pStatus->details, sizeof(pStatus->details), "vnode:%d sync state is %s", pData->unsyncedVgId, snprintf(pStatus->details, sizeof(pStatus->details), "vnode:%d sync state is %s", pData->unsyncedVgId,
......
...@@ -633,7 +633,7 @@ void shellCheckServerStatus() { ...@@ -633,7 +633,7 @@ void shellCheckServerStatus() {
printf("2: service ok\n"); printf("2: service ok\n");
break; break;
case TSDB_SRV_STATUS_SERVICE_DEGRADED: case TSDB_SRV_STATUS_SERVICE_DEGRADED:
printf("3: service degradedk\n"); printf("3: service degraded\n");
break; break;
case TSDB_SRV_STATUS_EXTING: case TSDB_SRV_STATUS_EXTING:
printf("4: exiting\n"); printf("4: exiting\n");
...@@ -642,10 +642,12 @@ void shellCheckServerStatus() { ...@@ -642,10 +642,12 @@ void shellCheckServerStatus() {
if (strlen(details) != 0) { if (strlen(details) != 0) {
printf("%s\n\n", details); printf("%s\n\n", details);
} }
if (code == TSDB_SRV_STATUS_NETWORK_OK) { if (code == TSDB_SRV_STATUS_NETWORK_OK && args.verbose) {
taosMsleep(1000); taosMsleep(1000);
} else {
break;
} }
} while (code == TSDB_SRV_STATUS_NETWORK_OK); } while (1);
exitShell(); exitShell();
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册