From 6c30c4faab844a57006ad17d2e79beb0483f5213 Mon Sep 17 00:00:00 2001 From: shenglian zhou Date: Tue, 10 Oct 2023 11:12:53 +0800 Subject: [PATCH] Revert "fix: add create table sql to audit log" This reverts commit 658de2a04e94364e924da79604d1680bf8451234. --- source/libs/parser/src/parTranslater.c | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 02dff01e0e..bc1ecc224c 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -8359,7 +8359,7 @@ typedef struct SVgroupCreateTableBatch { } SVgroupCreateTableBatch; static int32_t buildNormalTableBatchReq(int32_t acctId, const SCreateTableStmt* pStmt, const SVgroupInfo* pVgroupInfo, - SVgroupCreateTableBatch* pBatch, STranslateContext* pCxt) { + SVgroupCreateTableBatch* pBatch) { char dbFName[TSDB_DB_FNAME_LEN] = {0}; SName name = {.type = TSDB_DB_NAME_T, .acctId = acctId}; strcpy(name.dbname, pStmt->dbName); @@ -8369,14 +8369,6 @@ static int32_t buildNormalTableBatchReq(int32_t acctId, const SCreateTableStmt* req.type = TD_NORMAL_TABLE; req.name = taosStrdup(pStmt->tableName); req.ttl = pStmt->pOptions->ttl; - req.sqlLen = pCxt->pParseCxt->sqlLen; - if (req.sqlLen > 0) { - req.sql = taosMemoryMalloc(pCxt->pParseCxt->sqlLen); - if (NULL == req.sql) { - return TSDB_CODE_OUT_OF_MEMORY; - } - memcpy(req.sql, pCxt->pParseCxt->pSql, req.sqlLen); - } if (pStmt->pOptions->commentNull == false) { req.comment = taosStrdup(pStmt->pOptions->comment); if (NULL == req.comment) { @@ -8481,14 +8473,14 @@ static void destroyCreateTbReqArray(SArray* pArray) { } static int32_t buildCreateTableDataBlock(int32_t acctId, const SCreateTableStmt* pStmt, const SVgroupInfo* pInfo, - SArray** pBufArray, STranslateContext* pCxt) { + SArray** pBufArray) { *pBufArray = taosArrayInit(1, POINTER_BYTES); if (NULL == *pBufArray) { return TSDB_CODE_OUT_OF_MEMORY; } SVgroupCreateTableBatch tbatch = {0}; - int32_t code = buildNormalTableBatchReq(acctId, pStmt, pInfo, &tbatch, pCxt); + int32_t code = buildNormalTableBatchReq(acctId, pStmt, pInfo, &tbatch); if (TSDB_CODE_SUCCESS == code) { code = serializeVgroupCreateTableBatch(&tbatch, *pBufArray); } @@ -8515,7 +8507,7 @@ static int32_t rewriteCreateTable(STranslateContext* pCxt, SQuery* pQuery) { } SArray* pBufArray = NULL; if (TSDB_CODE_SUCCESS == code) { - code = buildCreateTableDataBlock(pCxt->pParseCxt->acctId, pStmt, &info, &pBufArray, pCxt); + code = buildCreateTableDataBlock(pCxt->pParseCxt->acctId, pStmt, &info, &pBufArray); } if (TSDB_CODE_SUCCESS == code) { code = rewriteToVnodeModifyOpStmt(pQuery, pBufArray); @@ -8529,7 +8521,7 @@ static int32_t rewriteCreateTable(STranslateContext* pCxt, SQuery* pQuery) { static void addCreateTbReqIntoVgroup(int32_t acctId, SHashObj* pVgroupHashmap, SCreateSubTableClause* pStmt, const STag* pTag, uint64_t suid, const char* sTableNmae, SVgroupInfo* pVgInfo, - SArray* tagName, uint8_t tagNum, STranslateContext* pCxt) { + SArray* tagName, uint8_t tagNum) { // char dbFName[TSDB_DB_FNAME_LEN] = {0}; // SName name = {.type = TSDB_DB_NAME_T, .acctId = acctId}; // strcpy(name.dbname, pStmt->dbName); @@ -8539,11 +8531,6 @@ static void addCreateTbReqIntoVgroup(int32_t acctId, SHashObj* pVgroupHashmap, S req.type = TD_CHILD_TABLE; req.name = taosStrdup(pStmt->tableName); req.ttl = pStmt->pOptions->ttl; - req.sqlLen = pCxt->pParseCxt->sqlLen; - if (req.sqlLen > 0) { - req.sql = taosMemoryMalloc(pCxt->pParseCxt->sqlLen); - memcpy(req.sql, pCxt->pParseCxt->pSql, req.sqlLen); - } if (pStmt->pOptions->commentNull == false) { req.comment = taosStrdup(pStmt->pOptions->comment); req.commentLen = strlen(pStmt->pOptions->comment); @@ -8820,7 +8807,7 @@ static int32_t rewriteCreateSubTable(STranslateContext* pCxt, SCreateSubTableCla } if (TSDB_CODE_SUCCESS == code) { addCreateTbReqIntoVgroup(pCxt->pParseCxt->acctId, pVgroupHashmap, pStmt, pTag, pSuperTableMeta->uid, - pStmt->useTableName, &info, tagName, pSuperTableMeta->tableInfo.numOfTags, pCxt); + pStmt->useTableName, &info, tagName, pSuperTableMeta->tableInfo.numOfTags); } else { taosMemoryFree(pTag); }