Merge pull request #25031 from taosdata/fix/TS-4544

fix:[TS-4544]do not get vgroup if subscribe query
This commit is contained in:
dapan1121 2024-03-07 19:19:19 +08:00 committed by GitHub
commit ae6b16d809
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 27 additions and 1 deletions

View File

@ -4547,7 +4547,7 @@ static int32_t translateWhere(STranslateContext* pCxt, SSelectStmt* pSelect) {
if (TSDB_CODE_SUCCESS == code) {
code = getQueryTimeRange(pCxt, pSelect->pWhere, &pSelect->timeRange);
}
if (pSelect->pWhere != NULL) {
if (pSelect->pWhere != NULL && pCxt->pParseCxt->topicQuery == false) {
setTableVgroupsFromEqualTbnameCond(pCxt, pSelect);
}
return code;

View File

@ -359,8 +359,34 @@ class TDTestCase:
finally:
consumer.close()
def consume_ts_4544(self):
tdSql.execute(f'create database if not exists d1')
tdSql.execute(f'use d1')
tdSql.execute(f'create table stt(ts timestamp, i int) tags(t int)')
tdSql.execute(f'insert into tt1 using stt tags(1) values(now, 1) (now+1s, 2)')
tdSql.execute(f'insert into tt2 using stt tags(2) values(now, 1) (now+1s, 2)')
tdSql.execute(f'insert into tt3 using stt tags(3) values(now, 1) (now+1s, 2)')
tdSql.execute(f'insert into tt1 using stt tags(1) values(now+5s, 11) (now+10s, 12)')
tdSql.execute(f'create topic topic_in as select * from stt where tbname in ("tt2")')
consumer_dict = {
"group.id": "g1",
"td.connect.user": "root",
"td.connect.pass": "taosdata",
"auto.offset.reset": "earliest",
}
consumer = Consumer(consumer_dict)
try:
consumer.subscribe(["topic_in"])
except TmqError:
tdLog.exit(f"subscribe error")
consumer.close()
def run(self):
self.consumeTest()
self.consume_ts_4544()
tdSql.prepare()
self.checkWal1VgroupOnlyMeta()