提交 f1391553 编写于 作者: A Alex Duan

feat(mnode): support show cluster status

上级 1ddbe3ca
...@@ -800,6 +800,11 @@ static int32_t mnodeGetStatusMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *p ...@@ -800,6 +800,11 @@ static int32_t mnodeGetStatusMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *p
strcpy(pSchema[0].name, "status"); strcpy(pSchema[0].name, "status");
pSchema[0].bytes = htons(pShow->bytes[0]); pSchema[0].bytes = htons(pShow->bytes[0]);
pMeta->numOfColumns = htons(1);
pShow->numOfColumns = 1;
pShow->rowSize = sizeof(int32_t);
pShow->offset[0] = 0;
return 0; return 0;
} }
...@@ -807,6 +812,7 @@ static int32_t mnodeRetrieveStatus(SShowObj *pShow, char *data, int32_t rows, vo ...@@ -807,6 +812,7 @@ static int32_t mnodeRetrieveStatus(SShowObj *pShow, char *data, int32_t rows, vo
SVgObj *pVgroup = NULL; SVgObj *pVgroup = NULL;
int32_t nAvailble = 0; int32_t nAvailble = 0;
int32_t nUnAvailble = 0; int32_t nUnAvailble = 0;
int32_t numOfRows = 0;
// get status // get status
while (numOfRows < rows) { while (numOfRows < rows) {
...@@ -828,7 +834,7 @@ static int32_t mnodeRetrieveStatus(SShowObj *pShow, char *data, int32_t rows, vo ...@@ -828,7 +834,7 @@ static int32_t mnodeRetrieveStatus(SShowObj *pShow, char *data, int32_t rows, vo
// check master // check master
bool master = false; bool master = false;
for (int32_t i = 0; i < pShow->maxReplica; ++i) { for (int32_t i = 0; i < pVgroup->numOfVnodes; ++i) {
if (pVgroup->vnodeGid[i].role == TAOS_SYNC_ROLE_MASTER) { if (pVgroup->vnodeGid[i].role == TAOS_SYNC_ROLE_MASTER) {
master = true; master = true;
break; break;
......
...@@ -72,7 +72,7 @@ SSchema* tscGetColumnSchemaById(STableMeta* pTableMeta, int16_t colId) { ...@@ -72,7 +72,7 @@ SSchema* tscGetColumnSchemaById(STableMeta* pTableMeta, int16_t colId) {
} }
STableMeta* tscCreateTableMetaFromMsg(STableMetaMsg* pTableMetaMsg) { STableMeta* tscCreateTableMetaFromMsg(STableMetaMsg* pTableMetaMsg) {
assert(pTableMetaMsg != NULL && pTableMetaMsg->numOfColumns >= 2); //assert(pTableMetaMsg != NULL && pTableMetaMsg->numOfColumns >= 2);
int32_t schemaSize = (pTableMetaMsg->numOfColumns + pTableMetaMsg->numOfTags) * sizeof(SSchema); int32_t schemaSize = (pTableMetaMsg->numOfColumns + pTableMetaMsg->numOfTags) * sizeof(SSchema);
STableMeta* pTableMeta = calloc(1, sizeof(STableMeta) + schemaSize); STableMeta* pTableMeta = calloc(1, sizeof(STableMeta) + schemaSize);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册