diff --git a/src/inc/mnode.h b/src/inc/mnode.h index 2071414496e872bdccf3bc5286744698f596f7cc..6f3b2a00468301c05377b60fc244b6427c3098d0 100644 --- a/src/inc/mnode.h +++ b/src/inc/mnode.h @@ -133,9 +133,18 @@ typedef struct _tab_obj { // SSchema schema[]; } STabObj; +typedef struct { + char tableId[TSDB_TABLE_ID_LEN + 1]; + int8_t type; + uint64_t uid; + int32_t sid; + int32_t vgId; + int64_t createdTime; +} STableInfo; typedef struct SSuperTableObj { char tableId[TSDB_TABLE_ID_LEN + 1]; + int8_t type; uint64_t uid; int32_t sid; int32_t vgId; @@ -156,11 +165,12 @@ typedef struct SSuperTableObj { typedef struct { char tableId[TSDB_TABLE_ID_LEN + 1]; - char superTableId[TSDB_TABLE_ID_LEN + 1]; + int8_t type; uint64_t uid; int32_t sid; int32_t vgId; int64_t createdTime; + char superTableId[TSDB_TABLE_ID_LEN + 1]; int8_t reserved[7]; int8_t updateEnd[1]; SSuperTableObj *superTable; @@ -168,6 +178,7 @@ typedef struct { typedef struct { char tableId[TSDB_TABLE_ID_LEN + 1]; + int8_t type; uint64_t uid; int32_t sid; int32_t vgId; @@ -183,6 +194,7 @@ typedef struct { typedef struct { char tableId[TSDB_TABLE_ID_LEN + 1]; + int8_t type; uint64_t uid; int32_t sid; int32_t vgId; @@ -198,7 +210,6 @@ typedef struct { char* schema; } SStreamTableObj; - typedef struct _vg_obj { uint32_t vgId; char dbName[TSDB_DB_NAME_LEN]; @@ -215,7 +226,7 @@ typedef struct _vg_obj { int8_t updateEnd[1]; struct _vg_obj *prev, *next; void * idPool; - void ** meterList; + STableInfo ** tableList; } SVgObj; typedef struct _db_obj { diff --git a/src/mnode/inc/mgmtTable.h b/src/mnode/inc/mgmtTable.h index 53135657351ebd070a5189f955e35de998852a12..1246c463f6a57c141c14b850e2dddae9d65f937d 100644 --- a/src/mnode/inc/mgmtTable.h +++ b/src/mnode/inc/mgmtTable.h @@ -32,8 +32,8 @@ typedef struct { } STableObj; int mgmtInitMeters(); -STableObj mgmtGetTable(char *tableId); -STableObj mgmtGetTableByPos(uint32_t dnodeIp, int32_t vnode, int32_t sid); +STableInfo* mgmtGetTable(char *tableId); +STableInfo* mgmtGetTableByPos(uint32_t dnodeIp, int32_t vnode, int32_t sid); STabObj *mgmtGetTableInfo(char *src, char *tags[]); int mgmtRetrieveMetricMeta(SConnObj *pConn, char **pStart, SSuperTableMetaMsg *pInfo); diff --git a/src/mnode/src/mgmtChildTable.c b/src/mnode/src/mgmtChildTable.c index b6ed7eee9f3314c6d68ac82ceb22229f74832809..daa98aec9ec812711944807aad4ae5b0933448b5 100644 --- a/src/mnode/src/mgmtChildTable.c +++ b/src/mnode/src/mgmtChildTable.c @@ -111,7 +111,7 @@ void *mgmtChildTableActionInsert(void *row, char *str, int size, int *ssize) { pAcct->acctInfo.numOfTimeSeries += (pTable->superTable->numOfColumns - 1); pVgroup->numOfMeters++; pDb->numOfTables++; - pVgroup->meterList[pTable->sid] = pTable; + pVgroup->tableList[pTable->sid] = pTable; if (pVgroup->numOfMeters >= pDb->cfg.maxSessions - 1 && pDb->numOfVgroups > 1) { mgmtMoveVgroupToTail(pDb, pVgroup); @@ -145,7 +145,7 @@ void *mgmtChildTableActionDelete(void *row, char *str, int size, int *ssize) { } pAcct->acctInfo.numOfTimeSeries -= (pTable->superTable->numOfColumns - 1); - pVgroup->meterList[pTable->sid] = NULL; + pVgroup->tableList[pTable->sid] = NULL; pVgroup->numOfMeters--; pDb->numOfTables--; taosFreeId(pVgroup->idPool, pTable->sid); diff --git a/src/mnode/src/mgmtDnodeInt.c b/src/mnode/src/mgmtDnodeInt.c index 0b8cbdbba1a52a31a182c2e7011c35189751e204..6ad5eba38fdc3df64f752e59b7381babf9e017de 100644 --- a/src/mnode/src/mgmtDnodeInt.c +++ b/src/mnode/src/mgmtDnodeInt.c @@ -87,19 +87,19 @@ int32_t mgmtProcessMeterCfgMsg(int8_t *pCont, int32_t contLen, void *pConn) { int32_t vnode = htonl(cfg->vnode); int32_t sid = htonl(cfg->sid); - STableObj table = mgmtGetTableByPos(0, vnode, sid); - if (table.obj == NULL) { + STableInfo *pTable = mgmtGetTableByPos(0, vnode, sid); + if (pTable == NULL) { mgmtSendSimpleRspToDnode(pConn, TSDB_MSG_TYPE_TABLE_CFG_RSP, TSDB_CODE_INVALID_TABLE); return TSDB_CODE_INVALID_TABLE_ID; } int8_t *pCreateTableMsg = NULL; - if (table.type == TSDB_TABLE_TYPE_NORMAL_TABLE) { - pCreateTableMsg = mgmtBuildCreateNormalTableMsg((SNormalTableObj *)table.obj, vnode); - } else if (table.type == TSDB_TABLE_TYPE_CHILD_TABLE) { - pCreateTableMsg = mgmtBuildCreateNormalTableMsg((SNormalTableObj *)table.obj, vnode); - } else if (table.type == TSDB_TABLE_TYPE_STREAM_TABLE) { - pCreateTableMsg = mgmtBuildCreateNormalTableMsg((SNormalTableObj *)table.obj, vnode); + if (pTable->type == TSDB_TABLE_TYPE_NORMAL_TABLE) { + pCreateTableMsg = mgmtBuildCreateNormalTableMsg((SNormalTableObj *)pTable, vnode); + } else if (pTable->type == TSDB_TABLE_TYPE_CHILD_TABLE) { + pCreateTableMsg = mgmtBuildCreateNormalTableMsg((SNormalTableObj *)pTable, vnode); + } else if (pTable->type == TSDB_TABLE_TYPE_STREAM_TABLE) { + pCreateTableMsg = mgmtBuildCreateNormalTableMsg((SNormalTableObj *)pTable, vnode); } else {} if (pCreateTableMsg != NULL) { diff --git a/src/mnode/src/mgmtNormalTable.c b/src/mnode/src/mgmtNormalTable.c index b0a12a9b53d60e4332955f1893860075ae3de635..6e75bb6730e4537ce19e73cc0c67023556e2d247 100644 --- a/src/mnode/src/mgmtNormalTable.c +++ b/src/mnode/src/mgmtNormalTable.c @@ -110,7 +110,7 @@ void *mgmtNormalTableActionInsert(void *row, char *str, int size, int *ssize) { pAcct->acctInfo.numOfTimeSeries += (pTable->numOfColumns - 1); pVgroup->numOfMeters++; pDb->numOfTables++; - pVgroup->meterList[pTable->sid] = pTable; + pVgroup->tableList[pTable->sid] = pTable; if (pVgroup->numOfMeters >= pDb->cfg.maxSessions - 1 && pDb->numOfVgroups > 1) { mgmtMoveVgroupToTail(pDb, pVgroup); @@ -144,7 +144,7 @@ void *mgmtNormalTableActionDelete(void *row, char *str, int size, int *ssize) { } pAcct->acctInfo.numOfTimeSeries -= (pTable->numOfColumns - 1); - pVgroup->meterList[pTable->sid] = NULL; + pVgroup->tableList[pTable->sid] = NULL; pVgroup->numOfMeters--; pDb->numOfTables--; taosFreeId(pVgroup->idPool, pTable->sid); diff --git a/src/mnode/src/mgmtShell.c b/src/mnode/src/mgmtShell.c index 940737dd3f7b91dbb6ca1b90cf74758740537863..7fee8d62ebef854a30649dde186889f5a12a8e17 100644 --- a/src/mnode/src/mgmtShell.c +++ b/src/mnode/src/mgmtShell.c @@ -167,7 +167,7 @@ bool mgmtCheckMeterMetaMsgType(char *pMsg) { SMeterInfoMsg *pInfo = (SMeterInfoMsg *)pMsg; int16_t autoCreate = htons(pInfo->createFlag); - STableObj table = mgmtGetTable(pInfo->meterId); + STableInfo *table = mgmtGetTable(pInfo->meterId); // If table does not exists and autoCreate flag is set, we add the handler into another task queue, namely tranQueue // bool addIntoTranQueue = (pMeterObj == NULL && autoCreate == 1); diff --git a/src/mnode/src/mgmtStreamTable.c b/src/mnode/src/mgmtStreamTable.c index 6fc2fb5e7b2c071f59caeda8cd291d8293845b2f..e4c7a6ecfbaf21ccd878c269a179cac0404e6fe5 100644 --- a/src/mnode/src/mgmtStreamTable.c +++ b/src/mnode/src/mgmtStreamTable.c @@ -115,7 +115,7 @@ void *mgmtStreamTableActionInsert(void *row, char *str, int size, int *ssize) { pAcct->acctInfo.numOfTimeSeries += (pTable->numOfColumns - 1); pVgroup->numOfMeters++; pDb->numOfTables++; - pVgroup->meterList[pTable->sid] = pTable; + pVgroup->tableList[pTable->sid] = pTable; if (pVgroup->numOfMeters >= pDb->cfg.maxSessions - 1 && pDb->numOfVgroups > 1) { mgmtMoveVgroupToTail(pDb, pVgroup); @@ -149,7 +149,7 @@ void *mgmtStreamTableActionDelete(void *row, char *str, int size, int *ssize) { } pAcct->acctInfo.numOfTimeSeries -= (pTable->numOfColumns - 1); - pVgroup->meterList[pTable->sid] = NULL; + pVgroup->tableList[pTable->sid] = NULL; pVgroup->numOfMeters--; pDb->numOfTables--; taosFreeId(pVgroup->idPool, pTable->sid); diff --git a/src/mnode/src/mgmtTable.c b/src/mnode/src/mgmtTable.c index 4b0499911ee844bb19ebd1f323db126f03a619a1..da265590617062dfa93028864f3c1d78d667b5b4 100644 --- a/src/mnode/src/mgmtTable.c +++ b/src/mnode/src/mgmtTable.c @@ -95,44 +95,37 @@ int mgmtInitMeters() { return TSDB_CODE_SUCCESS; } -STableObj mgmtGetTable(char *tableId) { - STableObj table = {.type = TSDB_TABLE_TYPE_MAX, .obj = NULL}; - - table.obj = mgmtGetSuperTable(tableId); - if (table.obj != NULL) { - table.type = TSDB_TABLE_TYPE_SUPER_TABLE; - return table; +STableInfo* mgmtGetTable(char *tableId) { + STableInfo *tableInfo = (STableInfo *) mgmtGetSuperTable(tableId); + if (tableInfo != NULL) { + return tableInfo; } - table.obj = mgmtGetNormalTable(tableId); - if (table.obj != NULL) { - table.type = TSDB_TABLE_TYPE_NORMAL_TABLE; - return table; + tableInfo = (STableInfo *) mgmtGetNormalTable(tableId); + if (tableInfo != NULL) { + return tableInfo; } - table.obj = mgmtGetStreamTable(tableId); - if (table.obj != NULL) { - table.type = TSDB_TABLE_TYPE_STREAM_TABLE; - return table; + tableInfo = (STableInfo *) mgmtGetStreamTable(tableId); + if (tableInfo != NULL) { + return tableInfo; } - table.obj = mgmtGetNormalTable(tableId); - if (table.obj != NULL) { - table.type = TSDB_TABLE_TYPE_CHILD_TABLE; - return table; + tableInfo = (STableInfo *) mgmtGetNormalTable(tableId); + if (tableInfo != NULL) { + return tableInfo; } - return table; + return NULL; } -STableObj mgmtGetTableByPos(uint32_t dnodeIp, int32_t vnode, int32_t sid) { - STableObj table = {0}; - return table; +STableInfo* mgmtGetTableByPos(uint32_t dnodeIp, int32_t vnode, int32_t sid) { + return NULL; } int32_t mgmtCreateTable(SDbObj *pDb, SCreateTableMsg *pCreate) { - STableObj table = mgmtGetTable(pCreate->meterId); - if (table.obj != NULL) { + STableInfo *table = mgmtGetTable(pCreate->meterId); + if (table != NULL) { if (pCreate->igExists) { return TSDB_CODE_SUCCESS; } else { @@ -183,8 +176,8 @@ int32_t mgmtCreateTable(SDbObj *pDb, SCreateTableMsg *pCreate) { } int mgmtDropTable(SDbObj *pDb, char *tableId, int ignore) { - STableObj table = mgmtGetTable(tableId); - if (table.obj == NULL) { + STableInfo *table = mgmtGetTable(tableId); + if (table == NULL) { if (ignore) { return TSDB_CODE_SUCCESS; } else { @@ -197,23 +190,23 @@ int mgmtDropTable(SDbObj *pDb, char *tableId, int ignore) { return TSDB_CODE_MONITOR_DB_FORBIDDEN; } - switch (table.type) { + switch (table->type) { case TSDB_TABLE_TYPE_SUPER_TABLE: - return mgmtDropSuperTable(pDb, table.obj); + return mgmtDropSuperTable(pDb, table); case TSDB_TABLE_TYPE_CHILD_TABLE: - return mgmtDropChildTable(pDb, table.obj); + return mgmtDropChildTable(pDb, table); case TSDB_TABLE_TYPE_STREAM_TABLE: - return mgmtDropStreamTable(pDb, table.obj); + return mgmtDropStreamTable(pDb, table); case TSDB_TABLE_TYPE_NORMAL_TABLE: - return mgmtDropNormalTable(pDb, table.obj); + return mgmtDropNormalTable(pDb, table); default: return TSDB_CODE_INVALID_TABLE; } } int mgmtAlterTable(SDbObj *pDb, SAlterTableMsg *pAlter) { - STableObj table = mgmtGetTable(pAlter->meterId); - if (table.obj == NULL) { + STableInfo *table = mgmtGetTable(pAlter->meterId); + if (table == NULL) { return TSDB_CODE_INVALID_TABLE; } @@ -232,32 +225,32 @@ int mgmtAlterTable(SDbObj *pDb, SAlterTableMsg *pAlter) { // todo add /* mgmtMeterAddTags */ if (pAlter->type == TSDB_ALTER_TABLE_ADD_TAG_COLUMN) { - if (table.type == TSDB_TABLE_TYPE_SUPER_TABLE) { - return mgmtAddSuperTableTag(table.obj, pAlter->schema, 1); + if (table->type == TSDB_TABLE_TYPE_SUPER_TABLE) { + return mgmtAddSuperTableTag(table, pAlter->schema, 1); } } else if (pAlter->type == TSDB_ALTER_TABLE_DROP_TAG_COLUMN) { - if (table.type == TSDB_TABLE_TYPE_SUPER_TABLE) { - return mgmtDropSuperTableTag(table.obj, pAlter->schema[0].name); + if (table->type == TSDB_TABLE_TYPE_SUPER_TABLE) { + return mgmtDropSuperTableTag(table, pAlter->schema[0].name); } } else if (pAlter->type == TSDB_ALTER_TABLE_CHANGE_TAG_COLUMN) { - if (table.type == TSDB_TABLE_TYPE_SUPER_TABLE) { - return mgmtModifySuperTableTagNameByName(table.obj, pAlter->schema[0].name, pAlter->schema[1].name); + if (table->type == TSDB_TABLE_TYPE_SUPER_TABLE) { + return mgmtModifySuperTableTagNameByName(table, pAlter->schema[0].name, pAlter->schema[1].name); } } else if (pAlter->type == TSDB_ALTER_TABLE_UPDATE_TAG_VAL) { - if (table.type == TSDB_TABLE_TYPE_CHILD_TABLE) { - return mgmtModifyChildTableTagValueByName(table.obj, pAlter->schema[0].name, pAlter->tagVal); + if (table->type == TSDB_TABLE_TYPE_CHILD_TABLE) { + return mgmtModifyChildTableTagValueByName(table, pAlter->schema[0].name, pAlter->tagVal); } } else if (pAlter->type == TSDB_ALTER_TABLE_ADD_COLUMN) { - if (table.type == TSDB_TABLE_TYPE_NORMAL_TABLE) { - return mgmtAddNormalTableColumn(table.obj, pAlter->schema, 1); - } else if (table.type == TSDB_TABLE_TYPE_SUPER_TABLE) { - return mgmtAddSuperTableColumn(table.obj, pAlter->schema, 1); + if (table->type == TSDB_TABLE_TYPE_NORMAL_TABLE) { + return mgmtAddNormalTableColumn(table, pAlter->schema, 1); + } else if (table->type == TSDB_TABLE_TYPE_SUPER_TABLE) { + return mgmtAddSuperTableColumn(table, pAlter->schema, 1); } else {} } else if (pAlter->type == TSDB_ALTER_TABLE_DROP_COLUMN) { - if (table.type == TSDB_TABLE_TYPE_NORMAL_TABLE) { - return mgmtDropNormalTableColumnByName(table.obj, pAlter->schema[0].name); - } else if (table.type == TSDB_TABLE_TYPE_SUPER_TABLE) { - return mgmtDropSuperTableColumnByName(table.obj, pAlter->schema[0].name); + if (table->type == TSDB_TABLE_TYPE_NORMAL_TABLE) { + return mgmtDropNormalTableColumnByName(table, pAlter->schema[0].name); + } else if (table->type == TSDB_TABLE_TYPE_SUPER_TABLE) { + return mgmtDropSuperTableColumnByName(table, pAlter->schema[0].name); } else {} } else {} diff --git a/src/mnode/src/mgmtVgroup.c b/src/mnode/src/mgmtVgroup.c index 9b0b78319d7bb5613fc2c86d052ec35b14d0fcf3..03774abe162b8c0aad095837addd01f13a414912 100644 --- a/src/mnode/src/mgmtVgroup.c +++ b/src/mnode/src/mgmtVgroup.c @@ -27,10 +27,8 @@ #include "mgmtTable.h" #include "mgmtVgroup.h" -void * tsVgroupSdb = NULL; -int32_t tsVgUpdateSize; -extern void *tsDbSdb; -extern void *tsUserSdb; +void *tsVgroupSdb = NULL; +int32_t tsVgUpdateSize; void *(*mgmtVgroupActionFp[SDB_MAX_ACTION_TYPES])(void *row, char *str, int32_t size, int32_t *ssize); void *mgmtVgroupActionInsert(void *row, char *str, int32_t size, int32_t *ssize); @@ -38,9 +36,6 @@ void *mgmtVgroupActionDelete(void *row, char *str, int32_t size, int32_t *ssize) void *mgmtVgroupActionUpdate(void *row, char *str, int32_t size, int32_t *ssize); void *mgmtVgroupActionEncode(void *row, char *str, int32_t size, int32_t *ssize); void *mgmtVgroupActionDecode(void *row, char *str, int32_t size, int32_t *ssize); -void *mgmtVgroupActionBeforeBatchUpdate(void *row, char *str, int32_t size, int32_t *ssize); -void *mgmtVgroupActionBatchUpdate(void *row, char *str, int32_t size, int32_t *ssize); -void *mgmtVgroupActionAfterBatchUpdate(void *row, char *str, int32_t size, int32_t *ssize); void *mgmtVgroupActionReset(void *row, char *str, int32_t size, int32_t *ssize); void *mgmtVgroupActionDestroy(void *row, char *str, int32_t size, int32_t *ssize); @@ -85,19 +80,19 @@ int32_t mgmtInitVgroups() { pVgroup->prev = NULL; pVgroup->next = NULL; - int32_t size = sizeof(STabObj *) * pDb->cfg.maxSessions; - pVgroup->meterList = (STabObj **)malloc(size); - if (pVgroup->meterList == NULL) { - mError("failed to malloc(size:%d) for the meterList of vgroups", size); + int32_t size = sizeof(STableInfo *) * pDb->cfg.maxSessions; + pVgroup->tableList = (STableInfo **)malloc(size); + if (pVgroup->tableList == NULL) { + mError("failed to malloc(size:%d) for the tableList of vgroups", size); return -1; } - memset(pVgroup->meterList, 0, size); + memset(pVgroup->tableList, 0, size); pVgroup->idPool = taosInitIdPool(pDb->cfg.maxSessions); if (pVgroup->idPool == NULL) { mError("failed to taosInitIdPool for vgroups"); - free(pVgroup->meterList); + free(pVgroup->tableList); return -1; } @@ -182,7 +177,7 @@ void mgmtProcessVgTimer(void *handle, void *tmrId) { SVgObj *mgmtCreateVgroup(SDbObj *pDb) { SVgObj *pVgroup; - int32_t size; + int32_t size; size = sizeof(SVgObj); pVgroup = (SVgObj *)malloc(size); @@ -212,13 +207,13 @@ SVgObj *mgmtCreateVgroup(SDbObj *pDb) { } int32_t mgmtDropVgroup(SDbObj *pDb, SVgObj *pVgroup) { - STabObj *pTable; + STableInfo *pTable; if (pVgroup->numOfMeters > 0) { for (int32_t i = 0; i < pDb->cfg.maxSessions; ++i) { - if (pVgroup->meterList != NULL) { - pTable = pVgroup->meterList[i]; - if (pTable) mgmtDropTable(pDb, pTable->meterId, 0); + if (pVgroup->tableList != NULL) { + pTable = pVgroup->tableList[i]; + if (pTable) mgmtDropTable(pDb, pTable->tableId, 0); } } } @@ -281,18 +276,18 @@ int32_t mgmtGetVgroupMeta(SMeterMeta *pMeta, SShowObj *pShow, SConnObj *pConn) { pSchema[cols].bytes = htons(pShow->bytes[cols]); cols++; - int32_t maxReplica = 0; - SVgObj *pVgroup = NULL; - STabObj *pTable = NULL; + int32_t maxReplica = 0; + SVgObj *pVgroup = NULL; + STableInfo *pTable = NULL; if (pShow->payloadLen > 0 ) { -// pTable = mgmtGetTable(pShow->payload); -// if (NULL == pTable) { -// return TSDB_CODE_INVALID_TABLE_ID; -// } -// -// pVgroup = mgmtGetVgroup(pTable->gid.vgId); -// if (NULL == pVgroup) return TSDB_CODE_INVALID_TABLE_ID; -// + pTable = mgmtGetTable(pShow->payload); + if (NULL == pTable) { + return TSDB_CODE_INVALID_TABLE_ID; + } + + pVgroup = mgmtGetVgroup(pTable->vgId); + if (NULL == pVgroup) return TSDB_CODE_INVALID_TABLE_ID; + maxReplica = pVgroup->numOfVnodes > maxReplica ? pVgroup->numOfVnodes : maxReplica; } else { SVgObj *pVgroup = pDb->pHead; @@ -348,10 +343,10 @@ int32_t mgmtGetVgroupMeta(SMeterMeta *pMeta, SShowObj *pShow, SConnObj *pConn) { } int32_t mgmtRetrieveVgroups(SShowObj *pShow, char *data, int32_t rows, SConnObj *pConn) { - int32_t numOfRows = 0; + int32_t numOfRows = 0; SVgObj *pVgroup = NULL; char * pWrite; - int32_t cols = 0; + int32_t cols = 0; char ipstr[20]; int32_t maxReplica = 0; @@ -424,9 +419,9 @@ void *mgmtVgroupActionInsert(void *row, char *str, int32_t size, int32_t *ssize) if (pDb == NULL) return NULL; - int32_t tsize = sizeof(STabObj *) * pDb->cfg.maxSessions; - pVgroup->meterList = (STabObj **)malloc(tsize); - memset(pVgroup->meterList, 0, tsize); + int32_t tsize = sizeof(STableInfo *) * pDb->cfg.maxSessions; + pVgroup->tableList = (STableInfo **)malloc(tsize); + memset(pVgroup->tableList, 0, tsize); pVgroup->numOfMeters = 0; pVgroup->idPool = taosInitIdPool(pDb->cfg.maxSessions); mgmtAddVgroupIntoDb(pDb, pVgroup); @@ -441,7 +436,7 @@ void *mgmtVgroupActionDelete(void *row, char *str, int32_t size, int32_t *ssize) if (pDb != NULL) mgmtRemoveVgroupFromDb(pDb, pVgroup); mgmtUnSetDnodeVgid(pVgroup->vnodeGid, pVgroup->numOfVnodes); - tfree(pVgroup->meterList); + tfree(pVgroup->tableList); return NULL; } @@ -456,8 +451,8 @@ void *mgmtVgroupActionUpdate(void *row, char *str, int32_t size, int32_t *ssize) if (pDb->cfg.maxSessions != oldTables) { mPrint("vgroup:%d tables change from %d to %d", pVgroup->vgId, oldTables, pDb->cfg.maxSessions); taosUpdateIdPool(pVgroup->idPool, pDb->cfg.maxSessions); - int32_t size = sizeof(STabObj *) * pDb->cfg.maxSessions; - pVgroup->meterList = (STabObj **)realloc(pVgroup->meterList, size); + int32_t size = sizeof(STableInfo *) * pDb->cfg.maxSessions; + pVgroup->tableList = (STableInfo **)realloc(pVgroup->tableList, size); } } @@ -465,9 +460,10 @@ void *mgmtVgroupActionUpdate(void *row, char *str, int32_t size, int32_t *ssize) return NULL; } + void *mgmtVgroupActionEncode(void *row, char *str, int32_t size, int32_t *ssize) { SVgObj *pVgroup = (SVgObj *)row; - int32_t tsize = pVgroup->updateEnd - (int8_t *)pVgroup; + int32_t tsize = pVgroup->updateEnd - (int8_t *)pVgroup; if (size < tsize) { *ssize = -1; } else { @@ -477,6 +473,7 @@ void *mgmtVgroupActionEncode(void *row, char *str, int32_t size, int32_t *ssize) return NULL; } + void *mgmtVgroupActionDecode(void *row, char *str, int32_t size, int32_t *ssize) { SVgObj *pVgroup = (SVgObj *)malloc(sizeof(SVgObj)); if (pVgroup == NULL) return NULL; @@ -487,24 +484,23 @@ void *mgmtVgroupActionDecode(void *row, char *str, int32_t size, int32_t *ssize) return (void *)pVgroup; } -void *mgmtVgroupActionBeforeBatchUpdate(void *row, char *str, int32_t size, int32_t *ssize) { return NULL; } -void *mgmtVgroupActionBatchUpdate(void *row, char *str, int32_t size, int32_t *ssize) { return NULL; } -void *mgmtVgroupActionAfterBatchUpdate(void *row, char *str, int32_t size, int32_t *ssize) { return NULL; } + void *mgmtVgroupActionReset(void *row, char *str, int32_t size, int32_t *ssize) { SVgObj *pVgroup = (SVgObj *)row; - int32_t tsize = pVgroup->updateEnd - (int8_t *)pVgroup; + int32_t tsize = pVgroup->updateEnd - (int8_t *)pVgroup; memcpy(pVgroup, str, tsize); return NULL; } + void *mgmtVgroupActionDestroy(void *row, char *str, int32_t size, int32_t *ssize) { SVgObj *pVgroup = (SVgObj *)row; if (pVgroup->idPool) { taosIdPoolCleanUp(pVgroup->idPool); pVgroup->idPool = NULL; } - if (pVgroup->meterList) tfree(pVgroup->meterList); + if (pVgroup->tableList) tfree(pVgroup->tableList); tfree(row); return NULL; }