From 93993d07960f3d0e299c9c5a49c8dfca3fdd4ddf Mon Sep 17 00:00:00 2001 From: Kaili Xu Date: Thu, 10 Jun 2021 18:51:10 +0800 Subject: [PATCH] [TD-4666]: support max column num to 4096 --- src/client/inc/tsclient.h | 1 + src/client/src/tscSQLParser.c | 11 ++++++++--- src/client/src/tscServer.c | 14 ++++++++------ src/client/src/tscUtil.c | 1 + src/inc/taosdef.h | 4 ++-- tests/examples/lua/luaconnector.so | Bin 0 -> 26736 bytes 6 files changed, 20 insertions(+), 11 deletions(-) create mode 100755 tests/examples/lua/luaconnector.so diff --git a/src/client/inc/tsclient.h b/src/client/inc/tsclient.h index ec4bf52527..014bcc0bca 100644 --- a/src/client/inc/tsclient.h +++ b/src/client/inc/tsclient.h @@ -242,6 +242,7 @@ typedef struct SSqlObj { void * pStream; void * pSubscription; char * sqlstr; + void * pBuf; // tableMeta buffer char parseRetry; char retry; char maxRetry; diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index 298bd8dacc..4b6b6d585d 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -7502,8 +7502,13 @@ int32_t loadAllTableMeta(SSqlObj* pSql, struct SSqlInfo* pInfo) { uint32_t maxSize = tscGetTableMetaMaxSize(); char name[TSDB_TABLE_FNAME_LEN] = {0}; - char buf[80 * 1024] = {0}; - assert(maxSize < 80 * 1024); + // char buf[80 * 1024] = {0}; + assert(maxSize < 80 * TSDB_MAX_COLUMNS); + if (!pSql->pBuf) { + if (NULL == (pSql->pBuf = calloc(1, 80 * TSDB_MAX_COLUMNS))) { + return TSDB_CODE_TSC_OUT_OF_MEMORY; + } + } pTableMeta = calloc(1, maxSize); plist = taosArrayInit(4, POINTER_BYTES); @@ -7520,7 +7525,7 @@ int32_t loadAllTableMeta(SSqlObj* pSql, struct SSqlInfo* pInfo) { if (pTableMeta->id.uid > 0) { if (pTableMeta->tableType == TSDB_CHILD_TABLE) { - code = tscCreateTableMetaFromSTableMeta(pTableMeta, name, buf); + code = tscCreateTableMetaFromSTableMeta(pTableMeta, name, pSql->pBuf); // create the child table meta from super table failed, try load it from mnode if (code != TSDB_CODE_SUCCESS) { diff --git a/src/client/src/tscServer.c b/src/client/src/tscServer.c index b4c7a64fd0..dbc53c5429 100644 --- a/src/client/src/tscServer.c +++ b/src/client/src/tscServer.c @@ -2509,22 +2509,25 @@ int32_t tscGetTableMetaImpl(SSqlObj* pSql, STableMetaInfo *pTableMetaInfo, bool taosHashGetClone(tscTableMetaInfo, name, len, NULL, pTableMetaInfo->pTableMeta, -1); // TODO resize the tableMeta - char buf[80*1024] = {0}; - assert(size < 80*1024); + // char buf[80 * TSDB_MAX_COLUMNS] = {0}; + assert(size < 80 * TSDB_MAX_COLUMNS); + if (!pSql->pBuf) { + if (NULL == (pSql->pBuf = calloc(1, 80 * TSDB_MAX_COLUMNS))) { + return TSDB_CODE_TSC_OUT_OF_MEMORY; + } + } STableMeta* pMeta = pTableMetaInfo->pTableMeta; if (pMeta->id.uid > 0) { // in case of child table, here only get the if (pMeta->tableType == TSDB_CHILD_TABLE) { - int32_t code = tscCreateTableMetaFromSTableMeta(pTableMetaInfo->pTableMeta, name, buf); + int32_t code = tscCreateTableMetaFromSTableMeta(pTableMetaInfo->pTableMeta, name, pSql->pBuf); if (code != TSDB_CODE_SUCCESS) { return getTableMetaFromMnode(pSql, pTableMetaInfo, autocreate); } } - return TSDB_CODE_SUCCESS; } - return getTableMetaFromMnode(pSql, pTableMetaInfo, autocreate); } @@ -2585,7 +2588,6 @@ int tscGetSTableVgroupInfo(SSqlObj *pSql, SQueryInfo* pQueryInfo) { if (allVgroupInfoRetrieved(pQueryInfo)) { return TSDB_CODE_SUCCESS; } - SSqlObj *pNew = calloc(1, sizeof(SSqlObj)); pNew->pTscObj = pSql->pTscObj; pNew->signature = pNew; diff --git a/src/client/src/tscUtil.c b/src/client/src/tscUtil.c index c17cd21c42..0b9867971a 100644 --- a/src/client/src/tscUtil.c +++ b/src/client/src/tscUtil.c @@ -1402,6 +1402,7 @@ void tscFreeSqlObj(SSqlObj* pSql) { pSql->signature = NULL; pSql->fp = NULL; tfree(pSql->sqlstr); + tfree(pSql->pBuf); tfree(pSql->pSubs); pSql->subState.numOfSub = 0; diff --git a/src/inc/taosdef.h b/src/inc/taosdef.h index e6eec73681..7c552a0da0 100644 --- a/src/inc/taosdef.h +++ b/src/inc/taosdef.h @@ -178,7 +178,7 @@ do { \ // this is the length of its string representation, including the terminator zero #define TSDB_ACCT_ID_LEN 11 -#define TSDB_MAX_COLUMNS 1024 +#define TSDB_MAX_COLUMNS 4096 #define TSDB_MIN_COLUMNS 2 //PRIMARY COLUMN(timestamp) + other columns #define TSDB_NODE_NAME_LEN 64 @@ -193,7 +193,7 @@ do { \ #define TSDB_APPNAME_LEN TSDB_UNI_LEN -#define TSDB_MAX_BYTES_PER_ROW 16384 +#define TSDB_MAX_BYTES_PER_ROW 65536 #define TSDB_MAX_TAGS_LEN 16384 #define TSDB_MAX_TAGS 128 #define TSDB_MAX_TAG_CONDITIONS 1024 diff --git a/tests/examples/lua/luaconnector.so b/tests/examples/lua/luaconnector.so new file mode 100755 index 0000000000000000000000000000000000000000..08bf6a6156aebe053132545193cd111fb436bc4b GIT binary patch literal 26736 zcmeHQdw5*Mb)U6t5cnY(EMg3X#lZm#EaG7vHU`ON&AM1%z)Bn*U9F^*wPB?d`>16; z9F#Z?Y&HU?1mdJ$h(if=`hEEjd4Qpfk%MiC7N}@}&m_=_w}eeB1WpCPsJ}BaXLjz@ zy-vUOpFVc@*5{tzoO9;PxpU{hHMONrj$7IZsCWISFEwv|ng|-xa>Yt>WNI53@Ss77n&}F+Ucc6J z(^It`Q+D_Ix3kUvmGM?-z0O)?*iDmqJf=L}wa}xu{AZgEr?^g!=XV}9>v=QP;g#_u z8?V(meHlob5UOx(ByBEN*FMFknWQFIrxxW0(!8V z%SBLPU_~`Po4&W<&0UW!TzK%Vv2Mb=+AjeflArBk z=T0A-dND;r{P*(n zC?EV|p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