未验证 提交 78c48908 编写于 作者: S Shengliang Guan 提交者: GitHub

Merge pull request #19509 from taosdata/FIX/TD-21874-main

fix: wait for trans completion in testcase 5dnode3mnodeDrop.py
...@@ -112,7 +112,8 @@ class TDTestCase: ...@@ -112,7 +112,8 @@ class TDTestCase:
dnode_first_port = dnode.cfgDict["firstEp"].split(":")[-1] dnode_first_port = dnode.cfgDict["firstEp"].split(":")[-1]
cmd = f" taos -h {dnode_first_host} -P {dnode_first_port} -s ' create dnode \"{dnode_id} \" ' ;" cmd = f" taos -h {dnode_first_host} -P {dnode_first_port} -s ' create dnode \"{dnode_id} \" ' ;"
tdLog.debug(cmd) tdLog.debug(cmd)
os.system(cmd) if os.system(cmd) != 0:
raise Exception("failed to execute system command. cmd: %s" % cmd)
time.sleep(2) time.sleep(2)
tdLog.info(" create cluster with %d dnode done! " %dnodes_nums) tdLog.info(" create cluster with %d dnode done! " %dnodes_nums)
...@@ -292,6 +293,8 @@ class TDTestCase: ...@@ -292,6 +293,8 @@ class TDTestCase:
tdLog.debug("drop mnode %d successfully"%(i+1)) tdLog.debug("drop mnode %d successfully"%(i+1))
break break
count+=1 count+=1
self.wait_for_transactions(20)
tdLog.debug("create mnode on dnode %d"%(i+1)) tdLog.debug("create mnode on dnode %d"%(i+1))
tdSql.execute("create mnode on dnode %d"%(i+1)) tdSql.execute("create mnode on dnode %d"%(i+1))
count=0 count=0
...@@ -299,12 +302,24 @@ class TDTestCase: ...@@ -299,12 +302,24 @@ class TDTestCase:
time.sleep(1) time.sleep(1)
tdSql.query("select * from information_schema.ins_mnodes;") tdSql.query("select * from information_schema.ins_mnodes;")
if tdSql.checkRows(3): if tdSql.checkRows(3):
tdLog.debug("drop mnode %d successfully"%(i+1)) tdLog.debug("create mnode %d successfully"%(i+1))
break break
count+=1 count+=1
self.wait_for_transactions(20)
dropcount+=1 dropcount+=1
self.check3mnode() self.check3mnode()
def wait_for_transactions(self, timeout):
count=0
while count<timeout:
time.sleep(1)
tdSql.query("show transactions;")
if tdSql.checkRows(0):
tdLog.debug("transactions completed successfully")
break
count+=1
if count >= timeout:
tdLog.debug("transactions not finished before timeout (%d secs)", timeout)
def getConnection(self, dnode): def getConnection(self, dnode):
host = dnode.cfgDict["fqdn"] host = dnode.cfgDict["fqdn"]
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册