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.cases import *
|
||||||
from util.dnodes import *
|
from util.dnodes import *
|
||||||
from util.sql import *
|
from util.sql import *
|
||||||
|
from util.common import tdCom
|
||||||
import threading
|
import threading
|
||||||
|
|
||||||
|
|
||||||
|
@ -32,7 +33,8 @@ class TDTestCase:
|
||||||
|
|
||||||
tdLog.debug("start test1")
|
tdLog.debug("start test1")
|
||||||
event = threading.Event()
|
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()
|
t0.start()
|
||||||
tdLog.info("t0 threading started,wait compact db tran finish")
|
tdLog.info("t0 threading started,wait compact db tran finish")
|
||||||
event.wait()
|
event.wait()
|
||||||
|
@ -42,7 +44,8 @@ class TDTestCase:
|
||||||
|
|
||||||
tdLog.debug("start test2")
|
tdLog.debug("start test2")
|
||||||
event1 = threading.Event()
|
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()
|
t1.start()
|
||||||
tdLog.info("t1 threading started,wait compact db tran finish")
|
tdLog.info("t1 threading started,wait compact db tran finish")
|
||||||
event1.wait()
|
event1.wait()
|
||||||
|
@ -52,7 +55,8 @@ class TDTestCase:
|
||||||
|
|
||||||
tdLog.debug("start test3")
|
tdLog.debug("start test3")
|
||||||
event2 = threading.Event()
|
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()
|
t2.start()
|
||||||
tdLog.info("t2 threading started,wait compact db tran finish")
|
tdLog.info("t2 threading started,wait compact db tran finish")
|
||||||
event2.wait()
|
event2.wait()
|
||||||
|
@ -62,7 +66,8 @@ class TDTestCase:
|
||||||
|
|
||||||
tdLog.debug("start test4")
|
tdLog.debug("start test4")
|
||||||
event3 = threading.Event()
|
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()
|
t3.start()
|
||||||
tdLog.info("t3 threading started!!!!!")
|
tdLog.info("t3 threading started!!!!!")
|
||||||
event3.wait()
|
event3.wait()
|
||||||
|
@ -70,7 +75,8 @@ class TDTestCase:
|
||||||
t3.join()
|
t3.join()
|
||||||
|
|
||||||
tdLog.debug("start test5")
|
tdLog.debug("start test5")
|
||||||
t4 = threading.Thread(target=self.splitVgroupThread)
|
newTdSql4=tdCom.newTdSql()
|
||||||
|
t4 = threading.Thread(target=self.splitVgroupThread, args=('', newTdSql4))
|
||||||
t4.start()
|
t4.start()
|
||||||
tdLog.info("t4 threading started!!!!!")
|
tdLog.info("t4 threading started!!!!!")
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
@ -78,7 +84,8 @@ class TDTestCase:
|
||||||
t4.join()
|
t4.join()
|
||||||
|
|
||||||
tdLog.debug("start test6")
|
tdLog.debug("start test6")
|
||||||
t5 = threading.Thread(target=self.RedistributeVGroups)
|
newTdSql5=tdCom.newTdSql()
|
||||||
|
t5 = threading.Thread(target=self.RedistributeVGroups, args=('', newTdSql5))
|
||||||
t5.start()
|
t5.start()
|
||||||
tdLog.info("t5 threading started!!!!!")
|
tdLog.info("t5 threading started!!!!!")
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
@ -86,7 +93,8 @@ class TDTestCase:
|
||||||
t5.join()
|
t5.join()
|
||||||
|
|
||||||
tdLog.debug("start test7")
|
tdLog.debug("start test7")
|
||||||
t6 = threading.Thread(target=self.balanceVGROUPThread)
|
newTdSql6=tdCom.newTdSql()
|
||||||
|
t6 = threading.Thread(target=self.balanceVGROUPThread, args=('', newTdSql6))
|
||||||
t6.start()
|
t6.start()
|
||||||
tdLog.info("t6 threading started!!!!!")
|
tdLog.info("t6 threading started!!!!!")
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
@ -94,7 +102,8 @@ class TDTestCase:
|
||||||
t6.join()
|
t6.join()
|
||||||
|
|
||||||
tdLog.debug("start test8")
|
tdLog.debug("start test8")
|
||||||
t7 = threading.Thread(target=self.alterDBThread)
|
newTdSql7=tdCom.newTdSql()
|
||||||
|
t7 = threading.Thread(target=self.alterDBThread, args=('', newTdSql7))
|
||||||
t7.start()
|
t7.start()
|
||||||
tdLog.info("t7 threading started!!!!!")
|
tdLog.info("t7 threading started!!!!!")
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
@ -102,53 +111,53 @@ class TDTestCase:
|
||||||
t7.join()
|
t7.join()
|
||||||
|
|
||||||
|
|
||||||
def compactDBThread(self, p, event):
|
def compactDBThread(self, p, event, newtdSql):
|
||||||
tdLog.info("compact db start")
|
tdLog.info("compact db start")
|
||||||
tdSql.execute('compact DATABASE db')
|
newtdSql.execute('compact DATABASE db')
|
||||||
event.set()
|
event.set()
|
||||||
if self.waitCompactsZero() is False:
|
if self.waitCompactsZero() is False:
|
||||||
tdLog.info(f"compact not finished")
|
tdLog.info(f"compact not finished")
|
||||||
|
|
||||||
def alterDBThread(self):
|
def alterDBThread(self, p, newtdSql):
|
||||||
tdLog.info("alter db start")
|
tdLog.info("alter db start")
|
||||||
tdSql.execute('ALTER DATABASE db REPLICA 3')
|
newtdSql.execute('ALTER DATABASE db REPLICA 3')
|
||||||
if self.waitTransactionZero() is False:
|
if self.waitTransactionZero() is False:
|
||||||
tdLog.info(f"transaction not finished")
|
tdLog.info(f"transaction not finished")
|
||||||
|
|
||||||
def balanceVGROUPThread(self):
|
def balanceVGROUPThread(self, p, newtdSql):
|
||||||
tdLog.info("balance VGROUP start")
|
tdLog.info("balance VGROUP start")
|
||||||
tdSql.execute('BALANCE VGROUP')
|
newtdSql.execute('BALANCE VGROUP')
|
||||||
if self.waitTransactionZero() is False:
|
if self.waitTransactionZero() is False:
|
||||||
tdLog.info(f"transaction not finished")
|
tdLog.info(f"transaction not finished")
|
||||||
|
|
||||||
def RedistributeVGroups(self):
|
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"
|
||||||
tdSql.execute(sql, show=True)
|
newtdSql.execute(sql, show=True)
|
||||||
if self.waitTransactionZero() is False:
|
if self.waitTransactionZero() 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"
|
||||||
tdSql.execute(sql, show=True)
|
newtdSql.execute(sql, show=True)
|
||||||
if self.waitTransactionZero() is False:
|
if self.waitTransactionZero() 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"
|
||||||
tdSql.execute(sql, show=True)
|
newtdSql.execute(sql, show=True)
|
||||||
if self.waitTransactionZero() is False:
|
if self.waitTransactionZero() 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):
|
def splitVgroupThread(self, p, newtdSql):
|
||||||
rowLen = tdSql.query('show vgroups')
|
rowLen = tdSql.query('show vgroups')
|
||||||
if rowLen > 0:
|
if rowLen > 0:
|
||||||
vgroupId = tdSql.getData(0, 0)
|
vgroupId = tdSql.getData(0, 0)
|
||||||
tdLog.info(f"splitVgroupThread vgroupId:{vgroupId} start")
|
tdLog.info(f"splitVgroupThread vgroupId:{vgroupId} start")
|
||||||
tdSql.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() is False:
|
||||||
|
|
Loading…
Reference in New Issue