Merge pull request #17566 from taosdata/fix/TS-1937
fix: fix show create table crash issue
This commit is contained in:
commit
067af996ed
|
@ -34,7 +34,7 @@ extern "C" {
|
||||||
|
|
||||||
#define SHOW_CREATE_TB_RESULT_COLS 2
|
#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_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_COLS 2
|
||||||
#define SHOW_LOCAL_VARIABLES_RESULT_FIELD1_LEN (TSDB_CONFIG_OPTION_LEN + VARSTR_HEADER_SIZE)
|
#define SHOW_LOCAL_VARIABLES_RESULT_FIELD1_LEN (TSDB_CONFIG_OPTION_LEN + VARSTR_HEADER_SIZE)
|
||||||
|
|
|
@ -338,7 +338,7 @@ void doDestroyRequest(void *p) {
|
||||||
|
|
||||||
SRequestObj *pRequest = (SRequestObj *)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);
|
tscTrace("begin to destroy request %" PRIx64 " p:%p", reqId, pRequest);
|
||||||
|
|
||||||
taosHashRemove(pRequest->pTscObj->pRequests, &pRequest->self, sizeof(pRequest->self));
|
taosHashRemove(pRequest->pTscObj->pRequests, &pRequest->self, sizeof(pRequest->self));
|
||||||
|
|
|
@ -496,7 +496,12 @@ static int32_t setCreateTBResultIntoDataBlock(SSDataBlock* pBlock, SDbCfgInfo* p
|
||||||
colDataAppend(pCol1, 0, buf1, false);
|
colDataAppend(pCol1, 0, buf1, false);
|
||||||
|
|
||||||
SColumnInfoData* pCol2 = taosArrayGet(pBlock->pDataBlock, 1);
|
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;
|
int32_t len = 0;
|
||||||
|
|
||||||
if (TSDB_SUPER_TABLE == pCfg->tableType) {
|
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 (");
|
len += sprintf(buf2 + VARSTR_HEADER_SIZE + len, ") TAGS (");
|
||||||
code = appendTagValues(buf2, &len, pCfg);
|
code = appendTagValues(buf2, &len, pCfg);
|
||||||
if (code) {
|
if (code) {
|
||||||
|
taosMemoryFree(buf2);
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
len += sprintf(buf2 + VARSTR_HEADER_SIZE + len, ")");
|
len += sprintf(buf2 + VARSTR_HEADER_SIZE + len, ")");
|
||||||
|
@ -527,6 +533,8 @@ static int32_t setCreateTBResultIntoDataBlock(SSDataBlock* pBlock, SDbCfgInfo* p
|
||||||
|
|
||||||
colDataAppend(pCol2, 0, buf2, false);
|
colDataAppend(pCol2, 0, buf2, false);
|
||||||
|
|
||||||
|
taosMemoryFree(buf2);
|
||||||
|
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -190,28 +190,20 @@ int32_t nodesReleaseAllocator(int64_t allocatorId) {
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
SNodeAllocator* pAllocator = taosAcquireRef(g_allocatorReqRefPool, allocatorId);
|
if (NULL == g_pNodeAllocator) {
|
||||||
if (NULL == pAllocator) {
|
|
||||||
return terrno;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t code = taosThreadMutexTryLock(&pAllocator->mutex);
|
|
||||||
if (EBUSY != code) {
|
|
||||||
nodesError("allocator id %" PRIx64
|
nodesError("allocator id %" PRIx64
|
||||||
" release failed: The nodesReleaseAllocator function needs to be called after the nodesAcquireAllocator "
|
" release failed: The nodesReleaseAllocator function needs to be called after the nodesAcquireAllocator "
|
||||||
"function is called!",
|
"function is called!",
|
||||||
allocatorId);
|
allocatorId);
|
||||||
if (0 == code) {
|
|
||||||
taosThreadMutexUnlock(&pAllocator->mutex);
|
|
||||||
}
|
|
||||||
return TSDB_CODE_FAILED;
|
return TSDB_CODE_FAILED;
|
||||||
}
|
}
|
||||||
|
SNodeAllocator* pAllocator = g_pNodeAllocator;
|
||||||
g_pNodeAllocator = NULL;
|
g_pNodeAllocator = NULL;
|
||||||
taosThreadMutexUnlock(&pAllocator->mutex);
|
taosThreadMutexUnlock(&pAllocator->mutex);
|
||||||
return taosReleaseRef(g_allocatorReqRefPool, allocatorId);
|
return taosReleaseRef(g_allocatorReqRefPool, allocatorId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int64_t nodesMakeAllocatorWeakRef(int64_t allocatorId) {
|
int64_t nodesMakeAllocatorWeakRef(int64_t allocatorId) {
|
||||||
if (allocatorId <= 0) {
|
if (allocatorId <= 0) {
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue