提交 6c20dfa1 编写于 作者: A Alex Duan

add check data correct case for compact database

上级 acde8586
...@@ -283,14 +283,14 @@ class TDTestCase: ...@@ -283,14 +283,14 @@ class TDTestCase:
# normal table # normal table
# all rows
sql = "select * from @db_name.ta"
self.queryDouble(sql)
# count # count
sql = "select count(*) from @db_name.ta" sql = "select count(*) from @db_name.ta"
self.queryDouble(sql) self.queryDouble(sql)
# all rows
sql = "select * from @db_name.ta"
self.queryDouble(sql)
# sum # sum
sql = "select sum(c1) from @db_name.ta" sql = "select sum(c1) from @db_name.ta"
self.queryDouble(sql) self.queryDouble(sql)
...@@ -316,7 +316,8 @@ class TDTestCase: ...@@ -316,7 +316,8 @@ class TDTestCase:
tdSql.execute(sql) tdSql.execute(sql)
# wait end # wait end
for i in range(100): seconds = 300
for i in range(seconds):
sql ="show transactions;" sql ="show transactions;"
rows = tdSql.query(sql) rows = tdSql.query(sql)
if rows == 0: if rows == 0:
...@@ -325,7 +326,7 @@ class TDTestCase: ...@@ -325,7 +326,7 @@ class TDTestCase:
#tdLog.info(f"i={i} wait split vgroup ...") #tdLog.info(f"i={i} wait split vgroup ...")
time.sleep(1) time.sleep(1)
tdLog.exit("split vgroup transaction is not finished after executing 50s") tdLog.exit(f"split vgroup transaction is not finished after executing {seconds}s")
return False return False
# split error # split error
...@@ -382,6 +383,14 @@ class TDTestCase: ...@@ -382,6 +383,14 @@ class TDTestCase:
self.expectSplitError("topicdb") self.expectSplitError("topicdb")
tdSql.execute("drop topic toa;") tdSql.execute("drop topic toa;")
self.expectSplitOk("topicdb") self.expectSplitOk("topicdb")
# compact and check db2
def compactAndCheck(self):
tdLog.info("compact db2 and check result ...")
# compact
tdSql.execute(f"compact database {self.db2};")
# check result
self.checkResult()
# run # run
def run(self): def run(self):
...@@ -390,12 +399,15 @@ class TDTestCase: ...@@ -390,12 +399,15 @@ class TDTestCase:
for i in range(5): for i in range(5):
# split vgroup on db2 # split vgroup on db2
start = time.time()
self.splitVGroup(self.db2) self.splitVGroup(self.db2)
end = time.time()
self.vgroups2 += 1 self.vgroups2 += 1
# check two db query result same # check two db query result same
self.checkResult() self.checkResult()
tdLog.info(f"split vgroup i={i} passed.") spend = "%.3f"%(end-start)
tdLog.info(f"split vgroup i={i} passed. spend = {spend}s")
# split empty db # split empty db
self.splitEmptyDB() self.splitEmptyDB()
...@@ -403,6 +415,9 @@ class TDTestCase: ...@@ -403,6 +415,9 @@ class TDTestCase:
# check topic and stream forib # check topic and stream forib
self.checkForbid() self.checkForbid()
# compact database
self.compactAndCheck()
# stop # stop
def stop(self): def stop(self):
tdSql.close() tdSql.close()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册