fix/TS-5251-add-conflict-check-add-case
This commit is contained in:
parent
8c1fdc92ed
commit
3598b3b917
|
@ -949,8 +949,10 @@ int32_t mndTransCheckConflictWithCompact(SMnode *pMnode, STrans *pTrans) {
|
|||
pIter = sdbFetch(pMnode->pSdb, SDB_COMPACT, pIter, (void **)&pCompact);
|
||||
if (pIter == NULL) break;
|
||||
|
||||
if (pTrans->conflict == TRN_CONFLICT_GLOBAL || pTrans->conflict == TRN_CONFLICT_DB ||
|
||||
pTrans->conflict == TRN_CONFLICT_DB_INSIDE) {
|
||||
if (pTrans->conflict == TRN_CONFLICT_GLOBAL) {
|
||||
thisConflict = true;
|
||||
}
|
||||
if (pTrans->conflict == TRN_CONFLICT_DB || pTrans->conflict == TRN_CONFLICT_DB_INSIDE) {
|
||||
if (strcasecmp(pTrans->dbname, pCompact->dbname) == 0) thisConflict = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -58,40 +58,72 @@ class TDTestCase(TBase):
|
|||
|
||||
self.insertData('splitVgroupByLearner.json')
|
||||
|
||||
'''
|
||||
t1 = threading.Thread(target=self.alterDBThread)
|
||||
tdSql.execute('use db')
|
||||
|
||||
t0 = threading.Thread(target=self.compactDBThread)
|
||||
t0.start()
|
||||
tdLog.debug("threading started!!!!!")
|
||||
tdSql.error('ALTER DATABASE db REPLICA 3;', expectErrInfo="Transaction not completed due to conflict with compact")
|
||||
t0.join()
|
||||
|
||||
t1 = threading.Thread(target=self.compactDBThread)
|
||||
t1.start()
|
||||
tdLog.debug("threading started!!!!!")
|
||||
time.sleep(3)
|
||||
tdSql.error('compact database db;', expectErrInfo="Conflict transaction not completed")
|
||||
|
||||
time.sleep(1)
|
||||
tdSql.error('REDISTRIBUTE VGROUP 5 DNODE 1;', expectErrInfo="Transaction not completed due to conflict with compact")
|
||||
t1.join()
|
||||
|
||||
|
||||
t2 = threading.Thread(target=self.splitVgroupThread)
|
||||
t2 = threading.Thread(target=self.compactDBThread)
|
||||
t2.start()
|
||||
tdLog.debug("threading started!!!!!")
|
||||
time.sleep(2)
|
||||
tdSql.error('compact database db;', expectErrInfo="Conflict transaction not completed")
|
||||
|
||||
rowLen = tdSql.query('show vgroups')
|
||||
if rowLen > 0:
|
||||
vgroupId = tdSql.getData(0, 0)
|
||||
tdLog.debug(f"splitVgroupThread vgroupId:{vgroupId}")
|
||||
tdSql.error('REDISTRIBUTE VGROUP 5 DNODE 1;', expectErrInfo="Transaction not completed due to conflict with compact")
|
||||
t2.join()
|
||||
'''
|
||||
t3 = threading.Thread(target=self.RedistributeVGroups)
|
||||
|
||||
t3 = threading.Thread(target=self.compactDBThread)
|
||||
t3.start()
|
||||
tdLog.debug("threading started!!!!!")
|
||||
#time.sleep(2)
|
||||
tdSql.error('compact database db;', expectErrInfo="Conflict transaction not completed")
|
||||
|
||||
time.sleep(1)
|
||||
tdSql.error('BALANCE VGROUP;', expectErrInfo="Transaction not completed due to conflict with compact")
|
||||
t3.join()
|
||||
|
||||
t4 = threading.Thread(target=self.balanceVGROUPThread)
|
||||
t4 = threading.Thread(target=self.splitVgroupThread)
|
||||
t4.start()
|
||||
tdLog.debug("threading started!!!!!")
|
||||
#time.sleep(2)
|
||||
time.sleep(1)
|
||||
tdSql.error('compact database db;', expectErrInfo="Conflict transaction not completed")
|
||||
|
||||
t4.join()
|
||||
|
||||
t5 = threading.Thread(target=self.RedistributeVGroups)
|
||||
t5.start()
|
||||
tdLog.debug("threading started!!!!!")
|
||||
time.sleep(1)
|
||||
tdSql.error('compact database db;', expectErrInfo="Conflict transaction not completed")
|
||||
t5.join()
|
||||
|
||||
t6 = threading.Thread(target=self.balanceVGROUPThread)
|
||||
t6.start()
|
||||
tdLog.debug("threading started!!!!!")
|
||||
time.sleep(1)
|
||||
tdSql.error('compact database db;', expectErrInfo="Conflict transaction not completed")
|
||||
t6.join()
|
||||
|
||||
t7 = threading.Thread(target=self.alterDBThread)
|
||||
t7.start()
|
||||
tdLog.debug("threading started!!!!!")
|
||||
time.sleep(1)
|
||||
tdSql.error('compact database db;', expectErrInfo="Conflict transaction not completed")
|
||||
t7.join()
|
||||
|
||||
|
||||
def compactDBThread(self):
|
||||
tdLog.info("compact db start")
|
||||
tdSql.execute('compact DATABASE db')
|
||||
if self.waitCompactsZero() is False:
|
||||
tdLog.info(f"compact not finished")
|
||||
|
||||
def alterDBThread(self):
|
||||
tdLog.info("alter db start")
|
||||
|
@ -127,7 +159,6 @@ class TDTestCase(TBase):
|
|||
return True
|
||||
|
||||
def splitVgroupThread(self):
|
||||
tdSql.execute('use db')
|
||||
rowLen = tdSql.query('show vgroups')
|
||||
if rowLen > 0:
|
||||
vgroupId = tdSql.getData(0, 0)
|
||||
|
|
Loading…
Reference in New Issue