fix:consumer more 10 rows, because wal dumplicated

This commit is contained in:
wangmm0220 2023-09-20 10:58:00 +08:00
parent 75f98762bf
commit 7162fe78d6
1 changed files with 2 additions and 92 deletions

View File

@ -146,8 +146,8 @@ class TDTestCase:
expectRows = 1
resultList = tmqCom.selectConsumeResult(expectRows)
if expectrowcnt != resultList[0]:
tdLog.info("expect consume rows: %d, act consume rows: %d"%(expectRowsList[0], resultList[0]))
if expectrowcnt > resultList[0]:
tdLog.info("expect consume rows: %d, act consume rows: %d"%(expectrowcnt, resultList[0]))
tdLog.exit("%d tmq consume rows error!"%consumerId)
# tmqCom.checkFileContent(consumerId, queryString)
@ -158,100 +158,10 @@ class TDTestCase:
tdLog.printNoPrefix("======== test case 1 end ...... ")
# def tmqCase2(self):
# tdLog.printNoPrefix("======== test case 2: ")
# paraDict = {'dbName': 'dbt',
# 'dropFlag': 1,
# 'event': '',
# 'vgroups': 1,
# 'stbName': 'stb',
# 'colPrefix': 'c',
# 'tagPrefix': 't',
# 'colSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1},{'type': 'TIMESTAMP', 'count':1}],
# 'tagSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1}],
# 'ctbPrefix': 'ctb',
# 'ctbStartIdx': 0,
# 'ctbNum': 10,
# 'rowsPerTbl': 10000,
# 'batchNum': 10,
# 'startTs': 1640966400000, # 2022-01-01 00:00:00.000
# 'pollDelay': 3,
# 'showMsg': 1,
# 'showRow': 1,
# 'snapshot': 1}
#
# paraDict['vgroups'] = self.vgroups
# paraDict['ctbNum'] = self.ctbNum
# paraDict['rowsPerTbl'] = self.rowsPerTbl
#
# topicNameList = ['topic1']
# expectRowsList = []
# tmqCom.initConsumerTable()
#
# tdLog.info("create topics from stb with filter")
# queryString = "select * from %s.%s"%(paraDict['dbName'], paraDict['stbName'])
# # sqlString = "create topic %s as stable %s" %(topicNameList[0], paraDict['stbName'])
# sqlString = "create topic %s as %s" %(topicNameList[0], queryString)
# tdLog.info("create topic sql: %s"%sqlString)
# tdSql.execute(sqlString)
# tdSql.query(queryString)
# expectRowsList.append(tdSql.getRows())
# totalRowsInserted = expectRowsList[0]
#
# # init consume info, and start tmq_sim, then check consume result
# tdLog.info("insert consume info to consume processor")
# consumerId = 1
# expectrowcnt = math.ceil(paraDict["rowsPerTbl"] * paraDict["ctbNum"] / 3)
# topicList = topicNameList[0]
# ifcheckdata = 1
# ifManualCommit = 1
# keyList = 'group.id:cgrp1, enable.auto.commit:true, auto.commit.interval.ms:200, auto.offset.reset:earliest'
# tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit)
#
# tdLog.info("start consume processor 0")
# tmqCom.startTmqSimProcess(pollDelay=paraDict['pollDelay'],dbName=paraDict["dbName"],showMsg=paraDict['showMsg'], showRow=paraDict['showRow'],snapshot=paraDict['snapshot'])
# tdLog.info("wait the consume result")
#
# expectRows = 1
# resultList = tmqCom.selectConsumeResult(expectRows)
#
# if not (expectrowcnt <= resultList[0] and totalRowsInserted >= resultList[0]):
# tdLog.info("act consume rows: %d, expect consume rows between %d and %d"%(resultList[0], expectrowcnt, totalRowsInserted))
# tdLog.exit("%d tmq consume rows error!"%consumerId)
#
# firstConsumeRows = resultList[0]
#
# # reinit consume info, and start tmq_sim, then check consume result
# tmqCom.initConsumerTable()
# consumerId = 2
# expectrowcnt = math.ceil(paraDict["rowsPerTbl"] * paraDict["ctbNum"] * 2/3)
# tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit)
#
# tdLog.info("start consume processor 1")
# tmqCom.startTmqSimProcess(pollDelay=paraDict['pollDelay'],dbName=paraDict["dbName"],showMsg=paraDict['showMsg'], showRow=paraDict['showRow'],snapshot=paraDict['snapshot'])
# tdLog.info("wait the consume result")
#
# expectRows = 1
# resultList = tmqCom.selectConsumeResult(expectRows)
#
# actConsumeTotalRows = firstConsumeRows + resultList[0]
#
# if not (expectrowcnt >= resultList[0] and totalRowsInserted == actConsumeTotalRows):
# tdLog.info("act consume rows, first: %d, second: %d "%(firstConsumeRows, resultList[0]))
# tdLog.info("and sum of two consume rows: %d should be equal to total inserted rows: %d"%(actConsumeTotalRows, totalRowsInserted))
# tdLog.exit("%d tmq consume rows error!"%consumerId)
#
# time.sleep(10)
# for i in range(len(topicNameList)):
# tdSql.query("drop topic %s"%topicNameList[i])
#
# tdLog.printNoPrefix("======== test case 2 end ...... ")
def run(self):
tdSql.prepare()
self.prepareTestEnv()
self.tmqCase1()
# self.tmqCase2()
def stop(self):
tdSql.close()