diff --git a/src/common/inc/tglobal.h b/src/common/inc/tglobal.h index 947fed60e45b6645d0b362154211e03169976dc9..4b8347ead02b8aca7b681b15adb93154c668956d 100644 --- a/src/common/inc/tglobal.h +++ b/src/common/inc/tglobal.h @@ -107,6 +107,9 @@ extern int32_t tsQuorum; extern int8_t tsUpdate; extern int8_t tsCacheLastRow; +//tsdb +extern bool tsdbForceKeepFile; + // balance extern int8_t tsEnableBalance; extern int8_t tsAlternativeRole; diff --git a/src/common/src/tglobal.c b/src/common/src/tglobal.c index 44b3e87e7d8d6546d2c5c12a879963a9f1d438e1..b7930dd43e4aab7e3b21ce503c953663566917e7 100644 --- a/src/common/src/tglobal.c +++ b/src/common/src/tglobal.c @@ -151,6 +151,11 @@ int32_t tsMinTablePerVnode = TSDB_TABLES_STEP; int32_t tsMaxTablePerVnode = TSDB_DEFAULT_TABLES; int32_t tsTableIncStepPerVnode = TSDB_TABLES_STEP; +// tsdb config + +// For backward compatibility +bool tsdbForceKeepFile = false; + // balance int8_t tsEnableBalance = 1; int8_t tsAlternativeRole = 0; diff --git a/src/mnode/inc/mnodeDef.h b/src/mnode/inc/mnodeDef.h index 5521267841f06d139ef8b4ac7a0c8883774e667f..5acc8dd85eb7fe8cd3f4b17f47e06161e39a6dc4 100644 --- a/src/mnode/inc/mnodeDef.h +++ b/src/mnode/inc/mnodeDef.h @@ -274,6 +274,7 @@ typedef struct { int32_t rowSize; int32_t numOfRows; void * pIter; + void * pVgIter; void ** ppShow; int16_t offset[TSDB_MAX_COLUMNS]; int32_t bytes[TSDB_MAX_COLUMNS]; diff --git a/src/mnode/src/mnodeDnode.c b/src/mnode/src/mnodeDnode.c index 335f9af5284549db650bae88568f8e093db20ac9..7dd199cca4248e5467017e1b6247f3b534c45711 100644 --- a/src/mnode/src/mnodeDnode.c +++ b/src/mnode/src/mnodeDnode.c @@ -196,14 +196,20 @@ int32_t mnodeInitDnodes() { mnodeAddWriteMsgHandle(TSDB_MSG_TYPE_CM_CREATE_DNODE, mnodeProcessCreateDnodeMsg); mnodeAddWriteMsgHandle(TSDB_MSG_TYPE_CM_DROP_DNODE, mnodeProcessDropDnodeMsg); mnodeAddWriteMsgHandle(TSDB_MSG_TYPE_CM_CONFIG_DNODE, mnodeProcessCfgDnodeMsg); + mnodeAddPeerRspHandle(TSDB_MSG_TYPE_MD_CONFIG_DNODE_RSP, mnodeProcessCfgDnodeMsgRsp); mnodeAddPeerMsgHandle(TSDB_MSG_TYPE_DM_STATUS, mnodeProcessDnodeStatusMsg); + mnodeAddShowMetaHandle(TSDB_MGMT_TABLE_MODULE, mnodeGetModuleMeta); mnodeAddShowRetrieveHandle(TSDB_MGMT_TABLE_MODULE, mnodeRetrieveModules); + mnodeAddShowMetaHandle(TSDB_MGMT_TABLE_VARIABLES, mnodeGetConfigMeta); mnodeAddShowRetrieveHandle(TSDB_MGMT_TABLE_VARIABLES, mnodeRetrieveConfigs); + mnodeAddShowMetaHandle(TSDB_MGMT_TABLE_VNODES, mnodeGetVnodeMeta); mnodeAddShowRetrieveHandle(TSDB_MGMT_TABLE_VNODES, mnodeRetrieveVnodes); + mnodeAddShowFreeIterHandle(TSDB_MGMT_TABLE_VNODES, mnodeCancelGetNextVgroup); + mnodeAddShowMetaHandle(TSDB_MGMT_TABLE_DNODE, mnodeGetDnodeMeta); mnodeAddShowRetrieveHandle(TSDB_MGMT_TABLE_DNODE, mnodeRetrieveDnodes); mnodeAddShowFreeIterHandle(TSDB_MGMT_TABLE_DNODE, mnodeCancelGetNextDnode); @@ -1232,13 +1238,12 @@ static int32_t mnodeRetrieveVnodes(SShowObj *pShow, char *data, int32_t rows, vo pDnode = (SDnodeObj *)(pShow->pIter); if (pDnode != NULL) { - void *pIter = NULL; SVgObj *pVgroup; while (1) { - pIter = mnodeGetNextVgroup(pIter, &pVgroup); + pShow->pVgIter = mnodeGetNextVgroup(pShow->pVgIter, &pVgroup); if (pVgroup == NULL) break; - for (int32_t i = 0; i < pVgroup->numOfVnodes; ++i) { + for (int32_t i = 0; i < pVgroup->numOfVnodes && numOfRows < rows; ++i) { SVnodeGid *pVgid = &pVgroup->vnodeGid[i]; if (pVgid->pDnode == pDnode) { cols = 0; @@ -1250,10 +1255,13 @@ static int32_t mnodeRetrieveVnodes(SShowObj *pShow, char *data, int32_t rows, vo pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; STR_TO_VARSTR(pWrite, syncRole[pVgid->role]); cols++; - numOfRows++; + } } + if (numOfRows >= rows) { + break; + } mnodeDecVgroupRef(pVgroup); } diff --git a/src/mnode/src/mnodeShow.c b/src/mnode/src/mnodeShow.c index 570f5c344b624eea1f23fd13f11bfc6e230c61d5..bbfdb52e058c9e8c4ce3d3fe9d06715e9c0483aa 100644 --- a/src/mnode/src/mnodeShow.c +++ b/src/mnode/src/mnodeShow.c @@ -422,8 +422,13 @@ static void* mnodePutShowObj(SShowObj *pShow) { static void mnodeFreeShowObj(void *data) { SShowObj *pShow = *(SShowObj **)data; - if (tsMnodeShowFreeIterFp[pShow->type] != NULL && pShow->pIter != NULL) { - (*tsMnodeShowFreeIterFp[pShow->type])(pShow->pIter); + if (tsMnodeShowFreeIterFp[pShow->type] != NULL) { + if (pShow->pVgIter != NULL) { + // only used in 'show vnodes "ep"' + (*tsMnodeShowFreeIterFp[pShow->type])(pShow->pVgIter); + } else { + if (pShow->pIter != NULL) (*tsMnodeShowFreeIterFp[pShow->type])(pShow->pIter); + } } mDebug("%p, show is destroyed, data:%p index:%d", pShow, data, pShow->index); diff --git a/src/tsdb/src/tsdbFS.c b/src/tsdb/src/tsdbFS.c index 68450301d8f0c8536327e593d87030920f27ff49..63f89c1957e82d3a4fda0ae958fe968d920e9b7a 100644 --- a/src/tsdb/src/tsdbFS.c +++ b/src/tsdb/src/tsdbFS.c @@ -37,8 +37,6 @@ static void tsdbScanAndTryFixDFilesHeader(STsdbRepo *pRepo, int32_t *nExpired); static int tsdbProcessExpiredFS(STsdbRepo *pRepo); static int tsdbCreateMeta(STsdbRepo *pRepo); -// For backward compatibility -bool tsdbForceKeepFile = false; // ================== CURRENT file header info static int tsdbEncodeFSHeader(void **buf, SFSHeader *pHeader) { int tlen = 0; @@ -1354,4 +1352,4 @@ static void tsdbScanAndTryFixDFilesHeader(STsdbRepo *pRepo, int32_t *nExpired) { tsdbCloseDFileSet(&fset); } -} \ No newline at end of file +} diff --git a/src/util/inc/tconfig.h b/src/util/inc/tconfig.h index f146ec0b8b675527b41dfb2267946193e5e5fe89..d03ce6e0f1f34478951a84b2ab18020f5cbec92b 100644 --- a/src/util/inc/tconfig.h +++ b/src/util/inc/tconfig.h @@ -81,7 +81,6 @@ typedef struct { extern SGlobalCfg tsGlobalConfig[]; extern int32_t tsGlobalConfigNum; extern char * tsCfgStatusStr[]; -extern bool tsdbForceKeepFile; void taosReadGlobalLogCfg(); bool taosReadGlobalCfg();