fix/TS-5251-add-conflict-check-fix-case
This commit is contained in:
parent
5cf233893a
commit
84cfce3e99
|
@ -115,59 +115,60 @@ class TDTestCase:
|
||||||
tdLog.info("compact db start")
|
tdLog.info("compact db start")
|
||||||
newtdSql.execute('compact DATABASE db')
|
newtdSql.execute('compact DATABASE db')
|
||||||
event.set()
|
event.set()
|
||||||
if self.waitCompactsZero() is False:
|
if self.waitCompactsZero(atdSql=newtdSql) is False:
|
||||||
tdLog.info(f"compact not finished")
|
tdLog.info(f"compact not finished")
|
||||||
|
|
||||||
def alterDBThread(self, p, newtdSql):
|
def alterDBThread(self, p, newtdSql):
|
||||||
tdLog.info("alter db start")
|
tdLog.info("alter db start")
|
||||||
newtdSql.execute('ALTER DATABASE db REPLICA 3')
|
newtdSql.execute('ALTER DATABASE db REPLICA 3')
|
||||||
if self.waitTransactionZero() is False:
|
if self.waitTransactionZero(atdSql=newtdSql) is False:
|
||||||
tdLog.info(f"transaction not finished")
|
tdLog.info(f"transaction not finished")
|
||||||
|
|
||||||
def balanceVGROUPThread(self, p, newtdSql):
|
def balanceVGROUPThread(self, p, newtdSql):
|
||||||
tdLog.info("balance VGROUP start")
|
tdLog.info("balance VGROUP start")
|
||||||
newtdSql.execute('BALANCE VGROUP')
|
newtdSql.execute('BALANCE VGROUP')
|
||||||
if self.waitTransactionZero() is False:
|
if self.waitTransactionZero(atdSql=newtdSql) is False:
|
||||||
tdLog.info(f"transaction not finished")
|
tdLog.info(f"transaction not finished")
|
||||||
|
|
||||||
def RedistributeVGroups(self, p, newtdSql):
|
def RedistributeVGroups(self, p, newtdSql):
|
||||||
tdLog.info("REDISTRIBUTE VGROUP start")
|
tdLog.info("REDISTRIBUTE VGROUP start")
|
||||||
sql = f"REDISTRIBUTE VGROUP 5 DNODE 1"
|
sql = f"REDISTRIBUTE VGROUP 5 DNODE 1"
|
||||||
newtdSql.execute(sql, show=True)
|
newtdSql.execute(sql, show=True)
|
||||||
if self.waitTransactionZero() is False:
|
if self.waitTransactionZero(atdSql=newtdSql) is False:
|
||||||
tdLog.exit(f"{sql} transaction not finished")
|
tdLog.exit(f"{sql} transaction not finished")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
sql = f"REDISTRIBUTE VGROUP 4 DNODE 1"
|
sql = f"REDISTRIBUTE VGROUP 4 DNODE 1"
|
||||||
newtdSql.execute(sql, show=True)
|
newtdSql.execute(sql, show=True)
|
||||||
if self.waitTransactionZero() is False:
|
if self.waitTransactionZero(atdSql=newtdSql) is False:
|
||||||
tdLog.exit(f"{sql} transaction not finished")
|
tdLog.exit(f"{sql} transaction not finished")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
sql = f"REDISTRIBUTE VGROUP 3 DNODE 1"
|
sql = f"REDISTRIBUTE VGROUP 3 DNODE 1"
|
||||||
newtdSql.execute(sql, show=True)
|
newtdSql.execute(sql, show=True)
|
||||||
if self.waitTransactionZero() is False:
|
if self.waitTransactionZero(atdSql=newtdSql) is False:
|
||||||
tdLog.exit(f"{sql} transaction not finished")
|
tdLog.exit(f"{sql} transaction not finished")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def splitVgroupThread(self, p, newtdSql):
|
def splitVgroupThread(self, p, newtdSql):
|
||||||
rowLen = tdSql.query('show vgroups')
|
newtdSql.execute(f"use db;")
|
||||||
|
rowLen = newtdSql.query('show vgroups')
|
||||||
if rowLen > 0:
|
if rowLen > 0:
|
||||||
vgroupId = tdSql.getData(0, 0)
|
vgroupId = newtdSql.getData(0, 0)
|
||||||
tdLog.info(f"splitVgroupThread vgroupId:{vgroupId} start")
|
tdLog.info(f"splitVgroupThread vgroupId:{vgroupId} start")
|
||||||
newtdSql.execute(f"split vgroup {vgroupId}")
|
newtdSql.execute(f"split vgroup {vgroupId}")
|
||||||
else:
|
else:
|
||||||
tdLog.exit("get vgroupId fail!")
|
tdLog.exit("get vgroupId fail!")
|
||||||
if self.waitTransactionZero() is False:
|
if self.waitTransactionZero(atdSql=newtdSql) is False:
|
||||||
tdLog.info(f"transaction not finished")
|
tdLog.info(f"transaction not finished")
|
||||||
|
|
||||||
def waitTransactionZero(self, seconds = 300, interval = 1):
|
def waitTransactionZero(self, atdSql, seconds = 300, interval = 1):
|
||||||
# wait end
|
# wait end
|
||||||
for i in range(seconds):
|
for i in range(seconds):
|
||||||
sql ="show transactions;"
|
sql ="show transactions;"
|
||||||
rows = tdSql.query(sql)
|
rows = atdSql.query(sql)
|
||||||
if rows == 0:
|
if rows == 0:
|
||||||
tdLog.info("transaction count became zero.")
|
tdLog.info("transaction count became zero.")
|
||||||
return True
|
return True
|
||||||
|
@ -175,11 +176,11 @@ class TDTestCase:
|
||||||
time.sleep(interval)
|
time.sleep(interval)
|
||||||
|
|
||||||
return False
|
return False
|
||||||
def waitCompactsZero(self, seconds = 300, interval = 1):
|
def waitCompactsZero(self, atdSql, seconds = 300, interval = 1):
|
||||||
# wait end
|
# wait end
|
||||||
for i in range(seconds):
|
for i in range(seconds):
|
||||||
sql ="show compacts;"
|
sql ="show compacts;"
|
||||||
rows = tdSql.query(sql)
|
rows = atdSql.query(sql)
|
||||||
if rows == 0:
|
if rows == 0:
|
||||||
tdLog.info("compacts count became zero.")
|
tdLog.info("compacts count became zero.")
|
||||||
return True
|
return True
|
||||||
|
|
Loading…
Reference in New Issue