提交 872222eb 编写于 作者: wmmhello's avatar wmmhello

fix:[TD-25222] error in drop topic if topic num is too long

上级 2822245a
...@@ -358,7 +358,7 @@ typedef struct SRestoreComponentNodeStmt { ...@@ -358,7 +358,7 @@ typedef struct SRestoreComponentNodeStmt {
typedef struct SCreateTopicStmt { typedef struct SCreateTopicStmt {
ENodeType type; ENodeType type;
char topicName[TSDB_TABLE_NAME_LEN]; char topicName[TSDB_TOPIC_NAME_LEN];
char subDbName[TSDB_DB_NAME_LEN]; char subDbName[TSDB_DB_NAME_LEN];
char subSTbName[TSDB_TABLE_NAME_LEN]; char subSTbName[TSDB_TABLE_NAME_LEN];
bool ignoreExists; bool ignoreExists;
...@@ -369,13 +369,13 @@ typedef struct SCreateTopicStmt { ...@@ -369,13 +369,13 @@ typedef struct SCreateTopicStmt {
typedef struct SDropTopicStmt { typedef struct SDropTopicStmt {
ENodeType type; ENodeType type;
char topicName[TSDB_TABLE_NAME_LEN]; char topicName[TSDB_TOPIC_NAME_LEN];
bool ignoreNotExists; bool ignoreNotExists;
} SDropTopicStmt; } SDropTopicStmt;
typedef struct SDropCGroupStmt { typedef struct SDropCGroupStmt {
ENodeType type; ENodeType type;
char topicName[TSDB_TABLE_NAME_LEN]; char topicName[TSDB_TOPIC_NAME_LEN];
char cgroup[TSDB_CGROUP_LEN]; char cgroup[TSDB_CGROUP_LEN];
bool ignoreNotExists; bool ignoreNotExists;
} SDropCGroupStmt; } SDropCGroupStmt;
......
...@@ -6135,9 +6135,7 @@ static int32_t translateCreateTopic(STranslateContext* pCxt, SCreateTopicStmt* p ...@@ -6135,9 +6135,7 @@ static int32_t translateCreateTopic(STranslateContext* pCxt, SCreateTopicStmt* p
static int32_t translateDropTopic(STranslateContext* pCxt, SDropTopicStmt* pStmt) { static int32_t translateDropTopic(STranslateContext* pCxt, SDropTopicStmt* pStmt) {
SMDropTopicReq dropReq = {0}; SMDropTopicReq dropReq = {0};
SName name; snprintf(dropReq.name, sizeof(dropReq.name), "%d.%s", pCxt->pParseCxt->acctId, pStmt->topicName);
tNameSetDbName(&name, pCxt->pParseCxt->acctId, pStmt->topicName, strlen(pStmt->topicName));
tNameGetFullDbName(&name, dropReq.name);
dropReq.igNotExists = pStmt->ignoreNotExists; dropReq.igNotExists = pStmt->ignoreNotExists;
return buildCmdMsg(pCxt, TDMT_MND_TMQ_DROP_TOPIC, (FSerializeFunc)tSerializeSMDropTopicReq, &dropReq); return buildCmdMsg(pCxt, TDMT_MND_TMQ_DROP_TOPIC, (FSerializeFunc)tSerializeSMDropTopicReq, &dropReq);
......
...@@ -129,6 +129,12 @@ class TDTestCase: ...@@ -129,6 +129,12 @@ class TDTestCase:
tdSql.query(f'select * from information_schema.ins_topics where topic_name = "{topic_name}"') tdSql.query(f'select * from information_schema.ins_topics where topic_name = "{topic_name}"')
tdSql.checkEqual(tdSql.queryResult[0][3],f'create topic {topic_name} as select c0 from {self.dbname}.{stbname}') tdSql.checkEqual(tdSql.queryResult[0][3],f'create topic {topic_name} as select c0 from {self.dbname}.{stbname}')
tdSql.execute(f'drop topic {topic_name}') tdSql.execute(f'drop topic {topic_name}')
#TD-25222
long_topic_name="hhhhjjhhhhqwertyuiasdfghjklzxcvbnmhhhhjjhhhhqwertyuiasdfghjklzxcvbnmhhhhjjhhhhqwertyuiasdfghjklzxcvbnm"
tdSql.execute(f'create topic {long_topic_name} as select * from {self.dbname}.{stbname}')
tdSql.execute(f'drop topic {long_topic_name}')
tdSql.execute(f'drop database {self.dbname}') tdSql.execute(f'drop database {self.dbname}')
def drop_stream_check(self): def drop_stream_check(self):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册