diff --git a/include/libs/nodes/cmdnodes.h b/include/libs/nodes/cmdnodes.h index 0752512951..ae550e0c08 100644 --- a/include/libs/nodes/cmdnodes.h +++ b/include/libs/nodes/cmdnodes.h @@ -34,7 +34,7 @@ extern "C" { #define SHOW_CREATE_TB_RESULT_COLS 2 #define SHOW_CREATE_TB_RESULT_FIELD1_LEN (TSDB_TABLE_NAME_LEN + VARSTR_HEADER_SIZE) -#define SHOW_CREATE_TB_RESULT_FIELD2_LEN (TSDB_MAX_BINARY_LEN + VARSTR_HEADER_SIZE) +#define SHOW_CREATE_TB_RESULT_FIELD2_LEN (TSDB_MAX_ALLOWED_SQL_LEN * 3) #define SHOW_LOCAL_VARIABLES_RESULT_COLS 2 #define SHOW_LOCAL_VARIABLES_RESULT_FIELD1_LEN (TSDB_CONFIG_OPTION_LEN + VARSTR_HEADER_SIZE) diff --git a/source/client/src/clientEnv.c b/source/client/src/clientEnv.c index b3c5565cfb..be0e6d50dc 100644 --- a/source/client/src/clientEnv.c +++ b/source/client/src/clientEnv.c @@ -338,7 +338,7 @@ void doDestroyRequest(void *p) { SRequestObj *pRequest = (SRequestObj *)p; - int64_t reqId = pRequest->self; + uint64_t reqId = pRequest->requestId; tscTrace("begin to destroy request %" PRIx64 " p:%p", reqId, pRequest); taosHashRemove(pRequest->pTscObj->pRequests, &pRequest->self, sizeof(pRequest->self)); diff --git a/source/libs/command/src/command.c b/source/libs/command/src/command.c index 095d2b093d..5ac5e0596f 100644 --- a/source/libs/command/src/command.c +++ b/source/libs/command/src/command.c @@ -496,7 +496,12 @@ static int32_t setCreateTBResultIntoDataBlock(SSDataBlock* pBlock, SDbCfgInfo* p colDataAppend(pCol1, 0, buf1, false); SColumnInfoData* pCol2 = taosArrayGet(pBlock->pDataBlock, 1); - char buf2[SHOW_CREATE_TB_RESULT_FIELD2_LEN] = {0}; + char* buf2 = taosMemoryMalloc(SHOW_CREATE_TB_RESULT_FIELD2_LEN); + if (NULL == buf2) { + terrno = TSDB_CODE_TSC_OUT_OF_MEMORY; + return terrno; + } + int32_t len = 0; if (TSDB_SUPER_TABLE == pCfg->tableType) { @@ -512,6 +517,7 @@ static int32_t setCreateTBResultIntoDataBlock(SSDataBlock* pBlock, SDbCfgInfo* p len += sprintf(buf2 + VARSTR_HEADER_SIZE + len, ") TAGS ("); code = appendTagValues(buf2, &len, pCfg); if (code) { + taosMemoryFree(buf2); return code; } len += sprintf(buf2 + VARSTR_HEADER_SIZE + len, ")"); @@ -527,6 +533,8 @@ static int32_t setCreateTBResultIntoDataBlock(SSDataBlock* pBlock, SDbCfgInfo* p colDataAppend(pCol2, 0, buf2, false); + taosMemoryFree(buf2); + return TSDB_CODE_SUCCESS; } diff --git a/source/libs/nodes/src/nodesUtilFuncs.c b/source/libs/nodes/src/nodesUtilFuncs.c index e647438800..aec4d0148a 100644 --- a/source/libs/nodes/src/nodesUtilFuncs.c +++ b/source/libs/nodes/src/nodesUtilFuncs.c @@ -190,28 +190,20 @@ int32_t nodesReleaseAllocator(int64_t allocatorId) { return TSDB_CODE_SUCCESS; } - SNodeAllocator* pAllocator = taosAcquireRef(g_allocatorReqRefPool, allocatorId); - if (NULL == pAllocator) { - return terrno; - } - - int32_t code = taosThreadMutexTryLock(&pAllocator->mutex); - if (EBUSY != code) { + if (NULL == g_pNodeAllocator) { nodesError("allocator id %" PRIx64 " release failed: The nodesReleaseAllocator function needs to be called after the nodesAcquireAllocator " "function is called!", allocatorId); - if (0 == code) { - taosThreadMutexUnlock(&pAllocator->mutex); - } return TSDB_CODE_FAILED; } - + SNodeAllocator* pAllocator = g_pNodeAllocator; g_pNodeAllocator = NULL; taosThreadMutexUnlock(&pAllocator->mutex); return taosReleaseRef(g_allocatorReqRefPool, allocatorId); } + int64_t nodesMakeAllocatorWeakRef(int64_t allocatorId) { if (allocatorId <= 0) { return 0;