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", "name": "stb",
"child_table_exists": "no", "child_table_exists": "no",
"childtable_count": 2, "childtable_count": 4,
"insert_rows": 1000000, "insert_rows": 1000000,
"childtable_prefix": "d", "childtable_prefix": "d",
"insert_mode": "taosc", "insert_mode": "taosc",
"timestamp_step": 1000, "timestamp_step": 1000,
"start_timestamp":"now-10d", "start_timestamp":"now-12d",
"columns": [ "columns": [
{ "type": "bool", "name": "bc"}, { "type": "bool", "name": "bc"},
{ "type": "float", "name": "fc" }, { "type": "float", "name": "fc" },

View File

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

View File

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

View File

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

View File

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

View File

@ -911,4 +911,10 @@ class TDDnodes:
def getAsan(self): def getAsan(self):
return self.asan 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) tAdapter.stop(force_kill=True)
if dnodeNums == 1 : if dnodeNums == 1 :
tdDnodes.setLevelDisk(level, disk)
tdDnodes.deploy(1,updateCfgDict) tdDnodes.deploy(1,updateCfgDict)
tdDnodes.start(1) tdDnodes.start(1)
tdCases.logSql(logSql) tdCases.logSql(logSql)
@ -542,6 +543,7 @@ if __name__ == "__main__":
if dnodeNums == 1 : if dnodeNums == 1 :
# dnode is one # dnode is one
tdDnodes.setLevelDisk(level, disk)
tdDnodes.deploy(1,updateCfgDict) tdDnodes.deploy(1,updateCfgDict)
tdDnodes.start(1) tdDnodes.start(1)
tdCases.logSql(logSql) tdCases.logSql(logSql)