fix/TS-5251-add-conflict-check-fix-case

This commit is contained in:
dmchen 2024-11-11 10:41:56 +08:00
parent d9ff557600
commit 659abc1dc4
1 changed files with 15 additions and 15 deletions

View File

@ -60,26 +60,26 @@ class TDTestCase(TBase):
tdSql.execute('use db') tdSql.execute('use db')
event0 = threading.Event() event = threading.Event()
t0 = threading.Thread(target=self.compactDBThread, args=(event0)) t0 = threading.Thread(target=self.compactDBThread, args=('', event))
t0.start() t0.start()
tdLog.debug("threading started!!!!!") tdLog.debug("t0 threading started!!!!!")
event0.wait() event.wait()
tdSql.error('ALTER DATABASE db REPLICA 3;', expectErrInfo="Transaction not completed due to conflict with compact") tdSql.error('ALTER DATABASE db REPLICA 3;', expectErrInfo="Transaction not completed due to conflict with compact")
t0.join() t0.join()
event1 = threading.Event() event1 = threading.Event()
t1 = threading.Thread(target=self.compactDBThread, args=(event1)) t1 = threading.Thread(target=self.compactDBThread, args=('', event1))
t1.start() t1.start()
tdLog.debug("threading started!!!!!") tdLog.debug("t1 threading started!!!!!")
event1.wait() event1.wait()
tdSql.error('REDISTRIBUTE VGROUP 5 DNODE 1;', expectErrInfo="Transaction not completed due to conflict with compact") tdSql.error('REDISTRIBUTE VGROUP 5 DNODE 1;', expectErrInfo="Transaction not completed due to conflict with compact")
t1.join() t1.join()
event2 = threading.Event() event2 = threading.Event()
t2 = threading.Thread(target=self.compactDBThread, args=(event2)) t2 = threading.Thread(target=self.compactDBThread, args=('', event2))
t2.start() t2.start()
tdLog.debug("threading started!!!!!") tdLog.debug("t2 threading started!!!!!")
event2.wait() event2.wait()
rowLen = tdSql.query('show vgroups') rowLen = tdSql.query('show vgroups')
if rowLen > 0: if rowLen > 0:
@ -89,43 +89,43 @@ class TDTestCase(TBase):
t2.join() t2.join()
event3 = threading.Event() event3 = threading.Event()
t3 = threading.Thread(target=self.compactDBThread, args=(event3)) t3 = threading.Thread(target=self.compactDBThread, args=('', event3))
t3.start() t3.start()
tdLog.debug("threading started!!!!!") tdLog.debug("t3 threading started!!!!!")
event3.wait() event3.wait()
tdSql.error('BALANCE VGROUP;', expectErrInfo="Transaction not completed due to conflict with compact") tdSql.error('BALANCE VGROUP;', expectErrInfo="Transaction not completed due to conflict with compact")
t3.join() t3.join()
t4 = threading.Thread(target=self.splitVgroupThread) t4 = threading.Thread(target=self.splitVgroupThread)
t4.start() t4.start()
tdLog.debug("threading started!!!!!") tdLog.debug("t4 threading started!!!!!")
time.sleep(1) time.sleep(1)
tdSql.error('compact database db;', expectErrInfo="Conflict transaction not completed") tdSql.error('compact database db;', expectErrInfo="Conflict transaction not completed")
t4.join() t4.join()
t5 = threading.Thread(target=self.RedistributeVGroups) t5 = threading.Thread(target=self.RedistributeVGroups)
t5.start() t5.start()
tdLog.debug("threading started!!!!!") tdLog.debug("t5 threading started!!!!!")
time.sleep(1) time.sleep(1)
tdSql.error('compact database db;', expectErrInfo="Conflict transaction not completed") tdSql.error('compact database db;', expectErrInfo="Conflict transaction not completed")
t5.join() t5.join()
t6 = threading.Thread(target=self.balanceVGROUPThread) t6 = threading.Thread(target=self.balanceVGROUPThread)
t6.start() t6.start()
tdLog.debug("threading started!!!!!") tdLog.debug("t6 threading started!!!!!")
time.sleep(1) time.sleep(1)
tdSql.error('compact database db;', expectErrInfo="Conflict transaction not completed") tdSql.error('compact database db;', expectErrInfo="Conflict transaction not completed")
t6.join() t6.join()
t7 = threading.Thread(target=self.alterDBThread) t7 = threading.Thread(target=self.alterDBThread)
t7.start() t7.start()
tdLog.debug("threading started!!!!!") tdLog.debug("t7 threading started!!!!!")
time.sleep(1) time.sleep(1)
tdSql.error('compact database db;', expectErrInfo="Conflict transaction not completed") tdSql.error('compact database db;', expectErrInfo="Conflict transaction not completed")
t7.join() t7.join()
def compactDBThread(self, event): def compactDBThread(self, p, event):
tdLog.info("compact db start") tdLog.info("compact db start")
tdSql.execute('compact DATABASE db') tdSql.execute('compact DATABASE db')
event.set() event.set()