Revert "fix: add create table sql to audit log"

This reverts commit 658de2a04e.
This commit is contained in:
shenglian zhou 2023-10-10 11:12:53 +08:00
parent d581e9b28d
commit 6c30c4faab
1 changed files with 6 additions and 19 deletions

View File

@ -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);
}