fix/TS-5251-add-conflict-check-fix-case
This commit is contained in:
parent
b98cf8df37
commit
5cf233893a
|
@ -14,6 +14,7 @@ from util.log import *
|
|||
from util.cases import *
|
||||
from util.dnodes import *
|
||||
from util.sql import *
|
||||
from util.common import tdCom
|
||||
import threading
|
||||
|
||||
|
||||
|
@ -32,7 +33,8 @@ class TDTestCase:
|
|||
|
||||
tdLog.debug("start test1")
|
||||
event = threading.Event()
|
||||
t0 = threading.Thread(target=self.compactDBThread, args=('', event))
|
||||
newTdSql=tdCom.newTdSql()
|
||||
t0 = threading.Thread(target=self.compactDBThread, args=('', event, newTdSql))
|
||||
t0.start()
|
||||
tdLog.info("t0 threading started,wait compact db tran finish")
|
||||
event.wait()
|
||||
|
@ -42,7 +44,8 @@ class TDTestCase:
|
|||
|
||||
tdLog.debug("start test2")
|
||||
event1 = threading.Event()
|
||||
t1 = threading.Thread(target=self.compactDBThread, args=('', event1))
|
||||
newTdSql1=tdCom.newTdSql()
|
||||
t1 = threading.Thread(target=self.compactDBThread, args=('', event1, newTdSql1))
|
||||
t1.start()
|
||||
tdLog.info("t1 threading started,wait compact db tran finish")
|
||||
event1.wait()
|
||||
|
@ -52,7 +55,8 @@ class TDTestCase:
|
|||
|
||||
tdLog.debug("start test3")
|
||||
event2 = threading.Event()
|
||||
t2 = threading.Thread(target=self.compactDBThread, args=('', event2))
|
||||
newTdSql2=tdCom.newTdSql()
|
||||
t2 = threading.Thread(target=self.compactDBThread, args=('', event2, newTdSql2))
|
||||
t2.start()
|
||||
tdLog.info("t2 threading started,wait compact db tran finish")
|
||||
event2.wait()
|
||||
|
@ -62,7 +66,8 @@ class TDTestCase:
|
|||
|
||||
tdLog.debug("start test4")
|
||||
event3 = threading.Event()
|
||||
t3 = threading.Thread(target=self.compactDBThread, args=('', event3))
|
||||
newTdSql3=tdCom.newTdSql()
|
||||
t3 = threading.Thread(target=self.compactDBThread, args=('', event3, newTdSql3))
|
||||
t3.start()
|
||||
tdLog.info("t3 threading started!!!!!")
|
||||
event3.wait()
|
||||
|
@ -70,7 +75,8 @@ class TDTestCase:
|
|||
t3.join()
|
||||
|
||||
tdLog.debug("start test5")
|
||||
t4 = threading.Thread(target=self.splitVgroupThread)
|
||||
newTdSql4=tdCom.newTdSql()
|
||||
t4 = threading.Thread(target=self.splitVgroupThread, args=('', newTdSql4))
|
||||
t4.start()
|
||||
tdLog.info("t4 threading started!!!!!")
|
||||
time.sleep(1)
|
||||
|
@ -78,7 +84,8 @@ class TDTestCase:
|
|||
t4.join()
|
||||
|
||||
tdLog.debug("start test6")
|
||||
t5 = threading.Thread(target=self.RedistributeVGroups)
|
||||
newTdSql5=tdCom.newTdSql()
|
||||
t5 = threading.Thread(target=self.RedistributeVGroups, args=('', newTdSql5))
|
||||
t5.start()
|
||||
tdLog.info("t5 threading started!!!!!")
|
||||
time.sleep(1)
|
||||
|
@ -86,7 +93,8 @@ class TDTestCase:
|
|||
t5.join()
|
||||
|
||||
tdLog.debug("start test7")
|
||||
t6 = threading.Thread(target=self.balanceVGROUPThread)
|
||||
newTdSql6=tdCom.newTdSql()
|
||||
t6 = threading.Thread(target=self.balanceVGROUPThread, args=('', newTdSql6))
|
||||
t6.start()
|
||||
tdLog.info("t6 threading started!!!!!")
|
||||
time.sleep(1)
|
||||
|
@ -94,7 +102,8 @@ class TDTestCase:
|
|||
t6.join()
|
||||
|
||||
tdLog.debug("start test8")
|
||||
t7 = threading.Thread(target=self.alterDBThread)
|
||||
newTdSql7=tdCom.newTdSql()
|
||||
t7 = threading.Thread(target=self.alterDBThread, args=('', newTdSql7))
|
||||
t7.start()
|
||||
tdLog.info("t7 threading started!!!!!")
|
||||
time.sleep(1)
|
||||
|
@ -102,53 +111,53 @@ class TDTestCase:
|
|||
t7.join()
|
||||
|
||||
|
||||
def compactDBThread(self, p, event):
|
||||
def compactDBThread(self, p, event, newtdSql):
|
||||
tdLog.info("compact db start")
|
||||
tdSql.execute('compact DATABASE db')
|
||||
newtdSql.execute('compact DATABASE db')
|
||||
event.set()
|
||||
if self.waitCompactsZero() is False:
|
||||
tdLog.info(f"compact not finished")
|
||||
|
||||
def alterDBThread(self):
|
||||
def alterDBThread(self, p, newtdSql):
|
||||
tdLog.info("alter db start")
|
||||
tdSql.execute('ALTER DATABASE db REPLICA 3')
|
||||
newtdSql.execute('ALTER DATABASE db REPLICA 3')
|
||||
if self.waitTransactionZero() is False:
|
||||
tdLog.info(f"transaction not finished")
|
||||
|
||||
def balanceVGROUPThread(self):
|
||||
def balanceVGROUPThread(self, p, newtdSql):
|
||||
tdLog.info("balance VGROUP start")
|
||||
tdSql.execute('BALANCE VGROUP')
|
||||
newtdSql.execute('BALANCE VGROUP')
|
||||
if self.waitTransactionZero() is False:
|
||||
tdLog.info(f"transaction not finished")
|
||||
|
||||
def RedistributeVGroups(self):
|
||||
def RedistributeVGroups(self, p, newtdSql):
|
||||
tdLog.info("REDISTRIBUTE VGROUP start")
|
||||
sql = f"REDISTRIBUTE VGROUP 5 DNODE 1"
|
||||
tdSql.execute(sql, show=True)
|
||||
newtdSql.execute(sql, show=True)
|
||||
if self.waitTransactionZero() is False:
|
||||
tdLog.exit(f"{sql} transaction not finished")
|
||||
return False
|
||||
|
||||
sql = f"REDISTRIBUTE VGROUP 4 DNODE 1"
|
||||
tdSql.execute(sql, show=True)
|
||||
newtdSql.execute(sql, show=True)
|
||||
if self.waitTransactionZero() is False:
|
||||
tdLog.exit(f"{sql} transaction not finished")
|
||||
return False
|
||||
|
||||
sql = f"REDISTRIBUTE VGROUP 3 DNODE 1"
|
||||
tdSql.execute(sql, show=True)
|
||||
newtdSql.execute(sql, show=True)
|
||||
if self.waitTransactionZero() is False:
|
||||
tdLog.exit(f"{sql} transaction not finished")
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
def splitVgroupThread(self):
|
||||
def splitVgroupThread(self, p, newtdSql):
|
||||
rowLen = tdSql.query('show vgroups')
|
||||
if rowLen > 0:
|
||||
vgroupId = tdSql.getData(0, 0)
|
||||
tdLog.info(f"splitVgroupThread vgroupId:{vgroupId} start")
|
||||
tdSql.execute(f"split vgroup {vgroupId}")
|
||||
newtdSql.execute(f"split vgroup {vgroupId}")
|
||||
else:
|
||||
tdLog.exit("get vgroupId fail!")
|
||||
if self.waitTransactionZero() is False:
|
||||
|
|
Loading…
Reference in New Issue