fix: a problem of parser async
This commit is contained in:
parent
4fc0b26b92
commit
ed87c39ff1
|
@ -199,6 +199,22 @@ static int32_t collectMetaKeyFromCreateMultiTable(SCollectMetaKeyCxt* pCxt, SCre
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int32_t collectMetaKeyFromDropTable(SCollectMetaKeyCxt* pCxt, SDropTableStmt* pStmt) {
|
||||||
|
int32_t code = TSDB_CODE_SUCCESS;
|
||||||
|
SNode* pNode = NULL;
|
||||||
|
FOREACH(pNode, pStmt->pTables) {
|
||||||
|
SDropTableClause* pClause = (SDropTableClause*)pNode;
|
||||||
|
code = reserveTableMetaInCache(pCxt->pParseCxt->acctId, pClause->dbName, pClause->tableName, pCxt->pMetaCache);
|
||||||
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
|
code = reserveTableVgroupInCache(pCxt->pParseCxt->acctId, pClause->dbName, pClause->tableName, pCxt->pMetaCache);
|
||||||
|
}
|
||||||
|
if (TSDB_CODE_SUCCESS != code) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
static int32_t collectMetaKeyFromAlterTable(SCollectMetaKeyCxt* pCxt, SAlterTableStmt* pStmt) {
|
static int32_t collectMetaKeyFromAlterTable(SCollectMetaKeyCxt* pCxt, SAlterTableStmt* pStmt) {
|
||||||
int32_t code = reserveTableMetaInCache(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->tableName, pCxt->pMetaCache);
|
int32_t code = reserveTableMetaInCache(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->tableName, pCxt->pMetaCache);
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
|
@ -341,6 +357,8 @@ static int32_t collectMetaKeyFromQuery(SCollectMetaKeyCxt* pCxt, SNode* pStmt) {
|
||||||
return collectMetaKeyFromCreateTable(pCxt, (SCreateTableStmt*)pStmt);
|
return collectMetaKeyFromCreateTable(pCxt, (SCreateTableStmt*)pStmt);
|
||||||
case QUERY_NODE_CREATE_MULTI_TABLE_STMT:
|
case QUERY_NODE_CREATE_MULTI_TABLE_STMT:
|
||||||
return collectMetaKeyFromCreateMultiTable(pCxt, (SCreateMultiTableStmt*)pStmt);
|
return collectMetaKeyFromCreateMultiTable(pCxt, (SCreateMultiTableStmt*)pStmt);
|
||||||
|
case QUERY_NODE_DROP_TABLE_STMT:
|
||||||
|
return collectMetaKeyFromDropTable(pCxt, (SDropTableStmt*)pStmt);
|
||||||
case QUERY_NODE_ALTER_TABLE_STMT:
|
case QUERY_NODE_ALTER_TABLE_STMT:
|
||||||
return collectMetaKeyFromAlterTable(pCxt, (SAlterTableStmt*)pStmt);
|
return collectMetaKeyFromAlterTable(pCxt, (SAlterTableStmt*)pStmt);
|
||||||
case QUERY_NODE_USE_DATABASE_STMT:
|
case QUERY_NODE_USE_DATABASE_STMT:
|
||||||
|
|
|
@ -24,7 +24,7 @@ class ParserInitialDTest : public ParserDdlTest {};
|
||||||
// todo delete
|
// todo delete
|
||||||
// todo desc
|
// todo desc
|
||||||
// todo describe
|
// todo describe
|
||||||
// todo drop account
|
// todo DROP account
|
||||||
|
|
||||||
TEST_F(ParserInitialDTest, dropBnode) {
|
TEST_F(ParserInitialDTest, dropBnode) {
|
||||||
useDb("root", "test");
|
useDb("root", "test");
|
||||||
|
@ -62,51 +62,61 @@ TEST_F(ParserInitialDTest, dropCGroup) {
|
||||||
run("DROP CONSUMER GROUP IF EXISTS cg1 ON tp1");
|
run("DROP CONSUMER GROUP IF EXISTS cg1 ON tp1");
|
||||||
}
|
}
|
||||||
|
|
||||||
// todo drop database
|
// todo DROP database
|
||||||
// todo drop dnode
|
// todo DROP dnode
|
||||||
// todo drop function
|
// todo DROP function
|
||||||
|
|
||||||
TEST_F(ParserInitialDTest, dropIndex) {
|
TEST_F(ParserInitialDTest, dropIndex) {
|
||||||
useDb("root", "test");
|
useDb("root", "test");
|
||||||
|
|
||||||
run("drop index index1 on t1");
|
run("DROP index index1 on t1");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ParserInitialDTest, dropMnode) {
|
TEST_F(ParserInitialDTest, dropMnode) {
|
||||||
useDb("root", "test");
|
useDb("root", "test");
|
||||||
|
|
||||||
run("drop mnode on dnode 1");
|
run("DROP mnode on dnode 1");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ParserInitialDTest, dropQnode) {
|
TEST_F(ParserInitialDTest, dropQnode) {
|
||||||
useDb("root", "test");
|
useDb("root", "test");
|
||||||
|
|
||||||
run("drop qnode on dnode 1");
|
run("DROP qnode on dnode 1");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ParserInitialDTest, dropSnode) {
|
TEST_F(ParserInitialDTest, dropSnode) {
|
||||||
useDb("root", "test");
|
useDb("root", "test");
|
||||||
|
|
||||||
run("drop snode on dnode 1");
|
run("DROP snode on dnode 1");
|
||||||
}
|
}
|
||||||
|
|
||||||
// todo drop stable
|
TEST_F(ParserInitialDTest, dropSTable) {
|
||||||
// todo drop stream
|
useDb("root", "test");
|
||||||
// todo drop table
|
|
||||||
|
run("DROP STABLE st1");
|
||||||
|
}
|
||||||
|
|
||||||
|
// todo DROP stream
|
||||||
|
|
||||||
|
TEST_F(ParserInitialDTest, dropTable) {
|
||||||
|
useDb("root", "test");
|
||||||
|
|
||||||
|
run("DROP TABLE t1");
|
||||||
|
}
|
||||||
|
|
||||||
TEST_F(ParserInitialDTest, dropTopic) {
|
TEST_F(ParserInitialDTest, dropTopic) {
|
||||||
useDb("root", "test");
|
useDb("root", "test");
|
||||||
|
|
||||||
run("drop topic tp1");
|
run("DROP topic tp1");
|
||||||
|
|
||||||
run("drop topic if exists tp1");
|
run("DROP topic if exists tp1");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ParserInitialDTest, dropUser) {
|
TEST_F(ParserInitialDTest, dropUser) {
|
||||||
login("root");
|
login("root");
|
||||||
useDb("root", "test");
|
useDb("root", "test");
|
||||||
|
|
||||||
run("drop user wxy");
|
run("DROP user wxy");
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace ParserTest
|
} // namespace ParserTest
|
||||||
|
|
Loading…
Reference in New Issue