From 499170d3cf48661ea60ab478326e6264d55e9a81 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Mon, 18 May 2020 19:23:42 +0800 Subject: [PATCH] [TD-361] fix bug in show vgroups --- src/mnode/inc/mgmtDef.h | 1 - src/mnode/inc/mgmtVgroup.h | 5 ----- src/mnode/src/mgmtVgroup.c | 15 ++------------ tests/script/unique/big/maxvnodes.sim | 28 ++++++++++----------------- 4 files changed, 12 insertions(+), 37 deletions(-) diff --git a/src/mnode/inc/mgmtDef.h b/src/mnode/inc/mgmtDef.h index 7c1fd6c5ab..f0d694db2a 100644 --- a/src/mnode/inc/mgmtDef.h +++ b/src/mnode/inc/mgmtDef.h @@ -123,7 +123,6 @@ typedef struct SVgObj { int32_t numOfVnodes; int32_t lbDnodeId; int32_t lbTime; - int8_t status; int8_t inUse; int8_t reserved[13]; int8_t updateEnd[1]; diff --git a/src/mnode/inc/mgmtVgroup.h b/src/mnode/inc/mgmtVgroup.h index 7acf7112a4..ce4cfed532 100644 --- a/src/mnode/inc/mgmtVgroup.h +++ b/src/mnode/inc/mgmtVgroup.h @@ -22,11 +22,6 @@ extern "C" { #include "mgmtDef.h" -enum _TSDB_VG_STATUS { - TSDB_VG_STATUS_READY, - TSDB_VG_STATUS_UPDATE -}; - int32_t mgmtInitVgroups(); void mgmtCleanUpVgroups(); SVgObj *mgmtGetVgroup(int32_t vgId); diff --git a/src/mnode/src/mgmtVgroup.c b/src/mnode/src/mgmtVgroup.c index 1416ed5f58..ef5582f395 100644 --- a/src/mnode/src/mgmtVgroup.c +++ b/src/mnode/src/mgmtVgroup.c @@ -371,12 +371,6 @@ int32_t mgmtGetVgroupMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pConn) { pSchema[cols].bytes = htons(pShow->bytes[cols]); cols++; - pShow->bytes[cols] = 9 + VARSTR_HEADER_SIZE; - pSchema[cols].type = TSDB_DATA_TYPE_BINARY; - strcpy(pSchema[cols].name, "vgroup_status"); - pSchema[cols].bytes = htons(pShow->bytes[cols]); - cols++; - int32_t maxReplica = 0; SVgObj *pVgroup = NULL; STableObj *pTable = NULL; @@ -471,11 +465,6 @@ int32_t mgmtRetrieveVgroups(SShowObj *pShow, char *data, int32_t rows, void *pCo *(int32_t *) pWrite = pVgroup->numOfTables; cols++; - pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - char* status = pVgroup->status? "updating" : "ready"; - STR_TO_VARSTR(pWrite, status); - cols++; - for (int32_t i = 0; i < maxReplica; ++i) { pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; *(int16_t *) pWrite = pVgroup->vnodeGid[i].dnodeId; @@ -489,8 +478,8 @@ int32_t mgmtRetrieveVgroups(SShowObj *pShow, char *data, int32_t rows, void *pCo cols++; pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - status = mgmtGetMnodeRoleStr(pVgroup->vnodeGid[i].role); - STR_TO_VARSTR(pWrite, status); + char *role = mgmtGetMnodeRoleStr(pVgroup->vnodeGid[i].role); + STR_TO_VARSTR(pWrite, role); cols++; } else { pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; diff --git a/tests/script/unique/big/maxvnodes.sim b/tests/script/unique/big/maxvnodes.sim index 3015d07b6d..2b56f51e59 100644 --- a/tests/script/unique/big/maxvnodes.sim +++ b/tests/script/unique/big/maxvnodes.sim @@ -1,19 +1,18 @@ system sh/stop_dnodes.sh $totalVnodes = 100 -$minVnodes = 48 -$maxVnodes = 52 +$minVnodes = 50 +$maxVnodes = 50 $maxTables = 4 $totalRows = $totalVnodes * $maxTables system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c walLevel -v 0 -system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v $maxTables +system sh/cfg.sh -n dnode1 -c walLevel -v 2 system sh/cfg.sh -n dnode1 -c numOfTotalVnodes -v $totalVnodes -system sh/cfg.sh -n dnode1 -c maxVnodeConnections -v 100000 -system sh/cfg.sh -n dnode1 -c maxMeterConnections -v 100000 -system sh/cfg.sh -n dnode1 -c maxShellConns -v 100000 -system sh/cfg.sh -n dnode1 -c maxMgmtConnections -v 100000 +system sh/deploy.sh -n dnode2 -i 2 +system sh/cfg.sh -n dnode2 -c walLevel -v 2 +system sh/cfg.sh -n dnode2 -c numOfTotalVnodes -v $totalVnodes + print ========== prepare data system sh/exec_up.sh -n dnode1 -s start @@ -44,16 +43,7 @@ if $data00 != $totalRows then return -1 endi -system sh/deploy.sh -n dnode2 -i 2 -system sh/cfg.sh -n dnode2 -c walLevel -v 0 -system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 100 -system sh/cfg.sh -n dnode2 -c numOfTotalVnodes -v 256 -system sh/cfg.sh -n dnode2 -c maxVnodeConnections -v 100000 -system sh/cfg.sh -n dnode2 -c maxMeterConnections -v 100000 -system sh/cfg.sh -n dnode2 -c maxShellConns -v 100000 -system sh/cfg.sh -n dnode2 -c maxMgmtConnections -v 100000 - -print ========== step2 +print ========== step3 sql create dnode $hostname2 system sh/exec_up.sh -n dnode2 -s start @@ -86,6 +76,8 @@ if $data00 != $totalRows then return -1 endi +return + system sh/exec_up.sh -n dnode1 -s stop -x SIGINT system sh/exec_up.sh -n dnode2 -s stop -x SIGINT system sh/exec_up.sh -n dnode3 -s stop -x SIGINT -- GitLab