From addba6aadccf0abfa468c8a5d4e0fcd19a240e16 Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Tue, 29 Nov 2022 08:56:45 +0800 Subject: [PATCH] enh: insert row format --- include/common/tmsg.h | 1 + source/common/src/tmsg.c | 22 +++++++++++++++------- source/libs/parser/src/parInsertUtil.c | 5 ++++- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/include/common/tmsg.h b/include/common/tmsg.h index cde3315ffb..5bcee58bba 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -3203,6 +3203,7 @@ int32_t tSerializeSMqHbReq(void* buf, int32_t bufLen, SMqHbReq* pReq); int32_t tDeserializeSMqHbReq(void* buf, int32_t bufLen, SMqHbReq* pReq); typedef struct { + bool isColFmt; int64_t suid; int64_t uid; int32_t sver; diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index 233d62b182..76127d727c 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -6834,18 +6834,26 @@ _exit: return code; } +void destroySSubmitTbData(SSubmitTbData *pTbData) { + if (pTbData->isColFmt) { + // todo + } else { + taosArrayDestroyP(pTbData->aRowP, (FDelete)tRowDestroy); + } +} + void tDestroySSubmitTbData(SSubmitTbData *pTbData) { - // todo + if (NULL == pTbData) { + return; + } + destroySSubmitTbData(pTbData); + taosMemoryFree(pTbData); } void tDestroySSubmitReq2(SSubmitReq2 *pReq) { if (NULL == pReq) return; - if (pReq->flag & SUBMIT_REQ_AUTO_CREATE_TABLE) { - taosArrayDestroyEx(pReq->aCreateTbReq, NULL /* todo */); - } - - taosArrayDestroyEx(pReq->aSubmitTbData, NULL /* todo */); - + taosArrayDestroyEx(pReq->aCreateTbReq, (FDelete)tdDestroySVCreateTbReq); + taosArrayDestroyEx(pReq->aSubmitTbData, (FDelete)destroySSubmitTbData); taosMemoryFree(pReq); } diff --git a/source/libs/parser/src/parInsertUtil.c b/source/libs/parser/src/parInsertUtil.c index 19a022bf31..eddf65fe87 100644 --- a/source/libs/parser/src/parInsertUtil.c +++ b/source/libs/parser/src/parInsertUtil.c @@ -1071,6 +1071,7 @@ void insDestroyTableDataCxt(STableDataCxt* pTableCxt) { tdDestroySVCreateTbReq(pTableCxt->pCreateTblReq); taosMemoryFreeClear(pTableCxt->pCreateTblReq); tDestroySSubmitTbData(pTableCxt->pData); + taosMemoryFree(pTableCxt); } void insDestroyVgroupDataCxt(SVgroupDataCxt* pVgCxt) { @@ -1079,6 +1080,7 @@ void insDestroyVgroupDataCxt(SVgroupDataCxt* pVgCxt) { } tDestroySSubmitReq2(pVgCxt->pData); + taosMemoryFree(pVgCxt); } void insDestroyVgroupDataCxtList(SArray* pVgCxtList) { @@ -1134,6 +1136,7 @@ static int32_t fillVgroupDataCxt(STableDataCxt* pTableCxt, SVgroupDataCxt* pVgCx } } taosArrayPush(pVgCxt->pData->aCreateTbReq, pTableCxt->pCreateTblReq); + taosMemoryFreeClear(pTableCxt->pCreateTblReq); } if (NULL == pVgCxt->pData->aSubmitTbData) { @@ -1143,7 +1146,7 @@ static int32_t fillVgroupDataCxt(STableDataCxt* pTableCxt, SVgroupDataCxt* pVgCx } } taosArrayPush(pVgCxt->pData->aSubmitTbData, pTableCxt->pData); - pTableCxt->pData = NULL; + taosMemoryFreeClear(pTableCxt->pData); return TSDB_CODE_SUCCESS; }