Merge pull request #23200 from taosdata/szhou/main/revert-create-table-sql
Revert "fix: add create table sql to audit log"
This commit is contained in:
commit
17e3b99bed
|
@ -8359,7 +8359,7 @@ typedef struct SVgroupCreateTableBatch {
|
||||||
} SVgroupCreateTableBatch;
|
} SVgroupCreateTableBatch;
|
||||||
|
|
||||||
static int32_t buildNormalTableBatchReq(int32_t acctId, const SCreateTableStmt* pStmt, const SVgroupInfo* pVgroupInfo,
|
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};
|
char dbFName[TSDB_DB_FNAME_LEN] = {0};
|
||||||
SName name = {.type = TSDB_DB_NAME_T, .acctId = acctId};
|
SName name = {.type = TSDB_DB_NAME_T, .acctId = acctId};
|
||||||
strcpy(name.dbname, pStmt->dbName);
|
strcpy(name.dbname, pStmt->dbName);
|
||||||
|
@ -8369,14 +8369,6 @@ static int32_t buildNormalTableBatchReq(int32_t acctId, const SCreateTableStmt*
|
||||||
req.type = TD_NORMAL_TABLE;
|
req.type = TD_NORMAL_TABLE;
|
||||||
req.name = taosStrdup(pStmt->tableName);
|
req.name = taosStrdup(pStmt->tableName);
|
||||||
req.ttl = pStmt->pOptions->ttl;
|
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) {
|
if (pStmt->pOptions->commentNull == false) {
|
||||||
req.comment = taosStrdup(pStmt->pOptions->comment);
|
req.comment = taosStrdup(pStmt->pOptions->comment);
|
||||||
if (NULL == req.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,
|
static int32_t buildCreateTableDataBlock(int32_t acctId, const SCreateTableStmt* pStmt, const SVgroupInfo* pInfo,
|
||||||
SArray** pBufArray, STranslateContext* pCxt) {
|
SArray** pBufArray) {
|
||||||
*pBufArray = taosArrayInit(1, POINTER_BYTES);
|
*pBufArray = taosArrayInit(1, POINTER_BYTES);
|
||||||
if (NULL == *pBufArray) {
|
if (NULL == *pBufArray) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
SVgroupCreateTableBatch tbatch = {0};
|
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) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
code = serializeVgroupCreateTableBatch(&tbatch, *pBufArray);
|
code = serializeVgroupCreateTableBatch(&tbatch, *pBufArray);
|
||||||
}
|
}
|
||||||
|
@ -8515,7 +8507,7 @@ static int32_t rewriteCreateTable(STranslateContext* pCxt, SQuery* pQuery) {
|
||||||
}
|
}
|
||||||
SArray* pBufArray = NULL;
|
SArray* pBufArray = NULL;
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
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) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
code = rewriteToVnodeModifyOpStmt(pQuery, pBufArray);
|
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,
|
static void addCreateTbReqIntoVgroup(int32_t acctId, SHashObj* pVgroupHashmap, SCreateSubTableClause* pStmt,
|
||||||
const STag* pTag, uint64_t suid, const char* sTableNmae, SVgroupInfo* pVgInfo,
|
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};
|
// char dbFName[TSDB_DB_FNAME_LEN] = {0};
|
||||||
// SName name = {.type = TSDB_DB_NAME_T, .acctId = acctId};
|
// SName name = {.type = TSDB_DB_NAME_T, .acctId = acctId};
|
||||||
// strcpy(name.dbname, pStmt->dbName);
|
// strcpy(name.dbname, pStmt->dbName);
|
||||||
|
@ -8539,11 +8531,6 @@ static void addCreateTbReqIntoVgroup(int32_t acctId, SHashObj* pVgroupHashmap, S
|
||||||
req.type = TD_CHILD_TABLE;
|
req.type = TD_CHILD_TABLE;
|
||||||
req.name = taosStrdup(pStmt->tableName);
|
req.name = taosStrdup(pStmt->tableName);
|
||||||
req.ttl = pStmt->pOptions->ttl;
|
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) {
|
if (pStmt->pOptions->commentNull == false) {
|
||||||
req.comment = taosStrdup(pStmt->pOptions->comment);
|
req.comment = taosStrdup(pStmt->pOptions->comment);
|
||||||
req.commentLen = strlen(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) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
addCreateTbReqIntoVgroup(pCxt->pParseCxt->acctId, pVgroupHashmap, pStmt, pTag, pSuperTableMeta->uid,
|
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 {
|
} else {
|
||||||
taosMemoryFree(pTag);
|
taosMemoryFree(pTag);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue