fix: add compactDb flushDb

This commit is contained in:
root 2023-12-25 21:20:59 +08:00
parent 5f0b0b4338
commit 9071ff3973
7 changed files with 27 additions and 17 deletions

View File

@ -24,12 +24,12 @@
{
"name": "stb",
"child_table_exists": "no",
"childtable_count": 2,
"childtable_count": 4,
"insert_rows": 1000000,
"childtable_prefix": "d",
"insert_mode": "taosc",
"timestamp_step": 1000,
"start_timestamp":"now-10d",
"start_timestamp":"now-12d",
"columns": [
{ "type": "bool", "name": "bc"},
{ "type": "float", "name": "fc" },

View File

@ -36,23 +36,15 @@ class TDTestCase(TBase):
tdSql.execute(f"use {self.db}")
# set insert data information
self.childtable_count = 2
self.childtable_count = 4
self.insert_rows = 1000000
self.timestamp_step = 1000
def doAction(self):
tdLog.info(f"trim database.")
tdLog.info(f"do action.")
self.flushDb()
self.trimDb()
def saveData(self):
tdLog.info(f"check correct.")
def checkSaveCorrent(self):
tdLog.info(f"check correct.")
def checkCorrect(self):
tdLog.info(f"check correct.")
self.compactDb()
# run
def run(self):
@ -73,6 +65,9 @@ class TDTestCase(TBase):
# check save agg result correct
self.checkAggCorrect()
# check insert correct again
self.checkInsertCorrect()
tdLog.success(f"{__file__} successfully executed")

View File

@ -69,6 +69,8 @@ class TBase:
def compactDb(self):
tdSql.execute(f"compact database {self.db}")
def flushDb(self):
tdSql.execute(f"flush database {self.db}")
#
# check db correct

View File

@ -19,10 +19,11 @@ import sys
import os
import time
import datetime
import platform
# if windows platform return True
def isWin():
return sys.platform.lower() == 'windows'
return platform.system().lower() == 'windows'
# wait util execute file finished
def exe(file):

View File

@ -21,6 +21,7 @@ import time
import datetime
import frame.epath
import frame.eos
from frame.log import *
# run taosBenchmark with command or json file mode
def runBenchmark(command = "", json = "") :
@ -35,7 +36,10 @@ def runBenchmark(command = "", json = "") :
if json != "":
cmd = f"{bmFile} -f {json}"
print(cmd)
frame.eos.exe(cmd)
status = frame.eos.exe(cmd)
if status !=0:
tdLog.exit(f"run failed {cmd} status={status}")
# get current directory file name
def curFile(fullPath, filename):

View File

@ -911,4 +911,10 @@ class TDDnodes:
def getAsan(self):
return self.asan
tdDnodes = TDDnodes()
def setLevelDisk(self, level, disk):
for i in range(len(self.dnodes)):
self.dnodes[i].level = int(level)
self.dnodes[i].disk = int(disk)
tdDnodes = TDDnodes()

View File

@ -373,6 +373,7 @@ if __name__ == "__main__":
tAdapter.stop(force_kill=True)
if dnodeNums == 1 :
tdDnodes.setLevelDisk(level, disk)
tdDnodes.deploy(1,updateCfgDict)
tdDnodes.start(1)
tdCases.logSql(logSql)
@ -542,6 +543,7 @@ if __name__ == "__main__":
if dnodeNums == 1 :
# dnode is one
tdDnodes.setLevelDisk(level, disk)
tdDnodes.deploy(1,updateCfgDict)
tdDnodes.start(1)
tdCases.logSql(logSql)