diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index a81ad19e4fb5f753919297d9be3396ab058568fa..3dbd5d36bd86f8788b9363ff5af10b84decc2c08 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -1297,10 +1297,6 @@ SSqlExpr* doAddProjectCol(SQueryInfo* pQueryInfo, int32_t outputIndex, int32_t c pSchema->bytes, functionId == TSDB_FUNC_TAGPRJ); } -void addRequiredTagColumn(STableMetaInfo* pTableMetaInfo, SColumnIndex* index) { - -} - static void addProjectQueryCol(SQueryInfo* pQueryInfo, int32_t startPos, SColumnIndex* pIndex, tSQLExprItem* pItem) { SSqlExpr* pExpr = doAddProjectCol(pQueryInfo, startPos, pIndex->columnIndex, pIndex->tableIndex); diff --git a/src/client/src/tscServer.c b/src/client/src/tscServer.c index 8efe89d28ab497ea7a442b412845d9b54172dce6..f72f53c2b17f9bd5994c90951fd1b18df0dd3b54 100644 --- a/src/client/src/tscServer.c +++ b/src/client/src/tscServer.c @@ -544,8 +544,7 @@ int tscBuildSubmitMsg(SSqlObj *pSql, SSqlInfo *pInfo) { } /* - * for meter query, simply return the size <= 1k - * for metric query, estimate size according to meter tags + * for table query, simply return the size <= 1k */ static int32_t tscEstimateQueryMsgSize(SSqlCmd *pCmd, int32_t clauseIndex) { const static int32_t MIN_QUERY_MSG_PKT_SIZE = TSDB_MAX_BYTES_PER_ROW * 5; @@ -556,15 +555,7 @@ static int32_t tscEstimateQueryMsgSize(SSqlCmd *pCmd, int32_t clauseIndex) { size_t numOfExprs = tscSqlExprNumOfExprs(pQueryInfo); int32_t exprSize = sizeof(SSqlFuncMsg) * numOfExprs; - STableMetaInfo *pTableMetaInfo = tscGetMetaInfo(pQueryInfo, 0); - - // meter query without tags values - if (!UTIL_TABLE_IS_SUPERTABLE(pTableMetaInfo)) { - return MIN_QUERY_MSG_PKT_SIZE + minMsgSize() + sizeof(SQueryTableMsg) + srcColListSize + exprSize; - } - - int32_t size = 4096; - return size; + return MIN_QUERY_MSG_PKT_SIZE + minMsgSize() + sizeof(SQueryTableMsg) + srcColListSize + exprSize + 4096; } static char *doSerializeTableInfo(SQueryTableMsg* pQueryMsg, SSqlObj *pSql, char *pMsg) { diff --git a/src/client/src/tscUtil.c b/src/client/src/tscUtil.c index c25e91a669689f225eeadae96cc65596d3616cef..bea61f12c4fe477231f620c5dedca976048aeedd 100644 --- a/src/client/src/tscUtil.c +++ b/src/client/src/tscUtil.c @@ -1701,6 +1701,12 @@ void tscClearTableMetaInfo(STableMetaInfo* pTableMetaInfo, bool removeFromCache) tfree(pTableMetaInfo->vgroupList); if (pTableMetaInfo->tagColList != NULL) { + size_t numOfTags = taosArrayGetSize(pTableMetaInfo->tagColList); + for(int32_t i = 0; i < numOfTags; ++i) { // todo do NOT use the allocated object + SColumn* pCol = taosArrayGetP(pTableMetaInfo->tagColList, i); + tfree(pCol); + } + taosArrayDestroy(pTableMetaInfo->tagColList); pTableMetaInfo->tagColList = NULL; } diff --git a/src/inc/taosmsg.h b/src/inc/taosmsg.h index 8dac73606d336ca376c0b5f70521285fb7d78344..9d16299380407f27c3368f848c2b91ad7232157a 100644 --- a/src/inc/taosmsg.h +++ b/src/inc/taosmsg.h @@ -626,7 +626,6 @@ typedef struct { typedef struct STableMetaMsg { int32_t contLen; char tableId[TSDB_TABLE_ID_LEN + 1]; // table id - char stableId[TSDB_TABLE_ID_LEN + 1]; // stable name if it is created according to super table uint8_t numOfTags; uint8_t precision; uint8_t tableType; diff --git a/src/mnode/src/mgmtTable.c b/src/mnode/src/mgmtTable.c index bfe357cf7c74069e5cb41f569f9129d3d26c1376..3e11bd5f1403f90653e2aa81ca7535cc8cd17027 100644 --- a/src/mnode/src/mgmtTable.c +++ b/src/mnode/src/mgmtTable.c @@ -1206,8 +1206,10 @@ void mgmtDropAllSuperTables(SDbObj *pDropDb) { static int32_t mgmtSetSchemaFromSuperTable(SSchema *pSchema, SSuperTableObj *pTable) { int32_t numOfCols = pTable->numOfColumns + pTable->numOfTags; + assert(numOfCols <= TSDB_MAX_COLUMNS); + for (int32_t i = 0; i < numOfCols; ++i) { - strncpy(pSchema->name, pTable->schema[i].name, TSDB_TABLE_ID_LEN); + strncpy(pSchema->name, pTable->schema[i].name, TSDB_COL_NAME_LEN); pSchema->type = pTable->schema[i].type; pSchema->bytes = htons(pTable->schema[i].bytes); pSchema->colId = htons(pTable->schema[i].colId); @@ -1679,7 +1681,6 @@ static int32_t mgmtDoGetChildTableMeta(SQueuedMsg *pMsg, STableMetaMsg *pMeta) { pMeta->numOfTags = (int8_t)pTable->superTable->numOfTags; pMeta->numOfColumns = htons((int16_t)pTable->superTable->numOfColumns); pMeta->contLen = sizeof(STableMetaMsg) + mgmtSetSchemaFromSuperTable(pMeta->schema, pTable->superTable); - strncpy(pMeta->stableId, pTable->superTable->info.tableId, tListLen(pMeta->stableId)); } else { pMeta->sversion = htons(pTable->sversion); pMeta->numOfTags = 0;