fix: flush database put to write end
This commit is contained in:
parent
dbd8d6891d
commit
528465ae21
|
@ -195,48 +195,55 @@ def findContextValue(context, label):
|
||||||
def writeTemplateInfo(resultFile):
|
def writeTemplateInfo(resultFile):
|
||||||
# create info
|
# create info
|
||||||
context = readFileContext(templateFile)
|
context = readFileContext(templateFile)
|
||||||
|
dbname = findContextValue(context, "name")
|
||||||
vgroups = findContextValue(context, "vgroups")
|
vgroups = findContextValue(context, "vgroups")
|
||||||
childCount = findContextValue(context, "childtable_count")
|
childCount = findContextValue(context, "childtable_count")
|
||||||
insertRows = findContextValue(context, "insert_rows")
|
insertRows = findContextValue(context, "insert_rows")
|
||||||
line = f"vgroups = {vgroups}\nchildtable_count = {childCount}\ninsert_rows = {insertRows}\n\n"
|
line = f"vgroups = {vgroups}\nchildtable_count = {childCount}\ninsert_rows = {insertRows}\n\n"
|
||||||
print(line)
|
print(line)
|
||||||
appendFileContext(resultFile, line)
|
appendFileContext(resultFile, line)
|
||||||
|
return dbname
|
||||||
|
|
||||||
|
|
||||||
def totalCompressRate(algo, resultFile, writeSpeed, querySpeed):
|
def totalCompressRate(algo, resultFile, writeSpeed, querySpeed):
|
||||||
global Number
|
global Number
|
||||||
# flush
|
loop = 30
|
||||||
command = 'taos -s "flush database dbrate;"'
|
|
||||||
rets = exec(command)
|
|
||||||
command = 'taos -s "compact database dbrate;"'
|
|
||||||
rets = exec(command)
|
|
||||||
waitCompactFinish(60)
|
|
||||||
|
|
||||||
# read compress rate
|
|
||||||
command = 'taos -s "show table distributed dbrate.meters\G;"'
|
|
||||||
rets = runRetList(command)
|
|
||||||
print(rets)
|
|
||||||
|
|
||||||
str1 = rets[5]
|
while loop > 0:
|
||||||
arr = str1.split(" ")
|
loop -= 1
|
||||||
|
|
||||||
# Total_Size KB
|
# flush database
|
||||||
str2 = arr[2]
|
command = 'taos -s "flush database dbrate;"'
|
||||||
pos = str2.find("=[")
|
exec(command)
|
||||||
totalSize = int(float(str2[pos+2:])/1024)
|
time.sleep(1)
|
||||||
|
|
||||||
# Compression_Ratio
|
# read compress rate
|
||||||
str2 = arr[6]
|
command = 'taos -s "show table distributed dbrate.meters\G;"'
|
||||||
pos = str2.find("=[")
|
rets = runRetList(command)
|
||||||
rate = str2[pos+2:]
|
print(rets)
|
||||||
print("rate =" + rate)
|
|
||||||
|
|
||||||
# total data file size
|
str1 = rets[5]
|
||||||
#dataSize = getFolderSize(f"{dataDir}/vnode/")
|
arr = str1.split(" ")
|
||||||
#dataSizeMB = int(dataSize/1024/1024)
|
|
||||||
|
|
||||||
# appand to file
|
# Total_Size KB
|
||||||
|
str2 = arr[2]
|
||||||
|
pos = str2.find("=[")
|
||||||
|
totalSize = int(float(str2[pos+2:])/1024)
|
||||||
|
|
||||||
|
# Compression_Ratio
|
||||||
|
str2 = arr[6]
|
||||||
|
pos = str2.find("=[")
|
||||||
|
rate = str2[pos+2:]
|
||||||
|
print("rate =" + rate)
|
||||||
|
if rate != "0.00":
|
||||||
|
break
|
||||||
|
|
||||||
|
# total data file size
|
||||||
|
#dataSize = getFolderSize(f"{dataDir}/vnode/")
|
||||||
|
#dataSizeMB = int(dataSize/1024/1024)
|
||||||
|
|
||||||
|
# appand to file
|
||||||
Number += 1
|
Number += 1
|
||||||
context = "%10s %10s %10s %10s %30s %15s\n"%( Number, algo, str(totalSize)+" MB", rate+"%", writeSpeed + " Records/second", querySpeed)
|
context = "%10s %10s %10s %10s %30s %15s\n"%( Number, algo, str(totalSize)+" MB", rate+"%", writeSpeed + " Records/second", querySpeed)
|
||||||
showLog(context)
|
showLog(context)
|
||||||
|
@ -268,6 +275,10 @@ def testWrite(jsonFile):
|
||||||
|
|
||||||
speed = context[pos: end]
|
speed = context[pos: end]
|
||||||
#print(f"write pos ={pos} end={end} speed={speed}\n output={context} \n")
|
#print(f"write pos ={pos} end={end} speed={speed}\n output={context} \n")
|
||||||
|
|
||||||
|
# flush database
|
||||||
|
command = 'taos -s "flush database dbrate;"'
|
||||||
|
exec(command)
|
||||||
return speed
|
return speed
|
||||||
|
|
||||||
def testQuery():
|
def testQuery():
|
||||||
|
@ -295,7 +306,6 @@ def testQuery():
|
||||||
|
|
||||||
def doTest(algo, resultFile):
|
def doTest(algo, resultFile):
|
||||||
print(f"doTest algo: {algo} \n")
|
print(f"doTest algo: {algo} \n")
|
||||||
#cleanAndStartTaosd()
|
|
||||||
|
|
||||||
# json
|
# json
|
||||||
jsonFile = generateJsonFile(algo)
|
jsonFile = generateJsonFile(algo)
|
||||||
|
|
Loading…
Reference in New Issue