From cac1ce28adea9fc85afda113115b34e6243d36d2 Mon Sep 17 00:00:00 2001 From: kailixu Date: Thu, 19 Sep 2024 16:47:08 +0800 Subject: [PATCH] enh: support drop table with uid --- source/libs/parser/src/parAstParser.c | 13 +------------ tests/system-test/1-insert/drop.py | 7 +++++++ 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/source/libs/parser/src/parAstParser.c b/source/libs/parser/src/parAstParser.c index b96831d99d..c73cd7f98c 100644 --- a/source/libs/parser/src/parAstParser.c +++ b/source/libs/parser/src/parAstParser.c @@ -377,7 +377,6 @@ static int32_t collectMetaKeyFromCreateSubTableFromFile(SCollectMetaKeyCxt* static int32_t collectMetaKeyFromDropTable(SCollectMetaKeyCxt* pCxt, SDropTableStmt* pStmt) { int32_t code = TSDB_CODE_SUCCESS; SNode* pNode = NULL; - // char tableName[50] = "aa\u00bf\u200bstb0"; FOREACH(pNode, pStmt->pTables) { SDropTableClause* pClause = (SDropTableClause*)pNode; if (pStmt->withOpt) { @@ -409,18 +408,8 @@ static int32_t collectMetaKeyFromDropTable(SCollectMetaKeyCxt* pCxt, SDropTableS } static int32_t collectMetaKeyFromDropStable(SCollectMetaKeyCxt* pCxt, SDropSuperTableStmt* pStmt) { - int32_t code = TSDB_CODE_SUCCESS; if (pStmt->withOpt) { - code = reserveTableUidInCache(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->tableName, pCxt->pMetaCache); -#if 0 - if (TSDB_CODE_SUCCESS == code) { - code = reserveDbVgInfoInCache(pCxt->pParseCxt->acctId, pStmt->dbName, pCxt->pMetaCache); - } - if (TSDB_CODE_SUCCESS == code) { - code = reserveDbCfgInCache(pCxt->pParseCxt->acctId, pStmt->dbName, pCxt->pMetaCache); - } -#endif - return code; + return reserveTableUidInCache(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->tableName, pCxt->pMetaCache); } return reserveUserAuthInCache(pCxt->pParseCxt->acctId, pCxt->pParseCxt->pUser, pStmt->dbName, pStmt->tableName, AUTH_TYPE_WRITE, pCxt->pMetaCache); diff --git a/tests/system-test/1-insert/drop.py b/tests/system-test/1-insert/drop.py index bd5e4cab49..f76c645734 100644 --- a/tests/system-test/1-insert/drop.py +++ b/tests/system-test/1-insert/drop.py @@ -116,6 +116,12 @@ class TDTestCase: tdSql.query(f'select * from {stbname} where {k} = {self.ts}') tdSql.checkRows(self.tbnum) tdSql.execute(f'drop database {self.dbname}') + def drop_table_with_check(self): + stb_names = [ f'stb0', f'aa\u00bf\u200bstb0'] + ctb_names = [ f'ctb0', f'aa\u00bf\u200bctb0'] + ntb_names = [ f'ntb0', f'aa\u00bf\u200bntb0'] + tdSql.execute(f'create database {self.dbname} replica {self.replicaVar} wal_retention_period 3600') + tdSql.execute(f'drop database {self.dbname}') def drop_topic_check(self): tdSql.execute(f'create database {self.dbname} replica {self.replicaVar} wal_retention_period 3600') tdSql.execute(f'use {self.dbname}') @@ -161,6 +167,7 @@ class TDTestCase: def run(self): self.drop_ntb_check() self.drop_stb_ctb_check() + self.drop_table_with_check() self.drop_topic_check() if platform.system().lower() == 'windows': self.drop_stream_check()