fix: support multi database multi super table insert. case in insertBase.py

This commit is contained in:
Alex Duan 2025-03-07 21:36:38 +08:00
parent 6bfc24d4ae
commit 2c901cd4b2
3 changed files with 15 additions and 14 deletions

View File

@ -448,6 +448,7 @@ class TBase:
dbName = db["dbinfo"]["name"]
stbs = db["super_tables"]
for stb in stbs:
stbName = stb["name"]
child_count = stb["childtable_count"]
insert_rows = stb["insert_rows"]
timestamp_step = stb["timestamp_step"]
@ -455,14 +456,14 @@ class TBase:
# check result
# count
sql = f"select count(*) from {db}.{stb}"
sql = f"select count(*) from {dbName}.{stbName}"
tdSql.checkAgg(sql, child_count * insert_rows)
# diff
sql = f"select * from (select diff(ts) as dif from {db}.{stb} partition by tbname) where dif != {timestamp_step};"
sql = f"select * from (select diff(ts) as dif from {dbName}.{stbName} partition by tbname) where dif != {timestamp_step};"
tdSql.query(sql)
tdSql.checkRows(0)
# show
tdLog.info(f"insert check passed. db:{db} stb:{stb} child_count:{child_count} insert_rows:{insert_rows}\n")
tdLog.info(f"insert check passed. db:{dbName} stb:{stbName} child_count:{child_count} insert_rows:{insert_rows}\n")
# tmq
def tmqBenchJson(self, jsonFile, options="", checkStep=False):

View File

@ -120,7 +120,7 @@ class TDTestCase(TBase):
def checkInsertManyStb(self):
# many stb
self.benchInsert("./tools/benchmark/basic/json/insertManyStb.json", "", True)
self.benchInsert("./tools/benchmark/basic/json/insertManyStb.json")
def run(self):
benchmark = frame.etool.benchMarkFile()

View File

@ -22,10 +22,10 @@
"child_table_exists": "no",
"childtable_count": 2,
"insert_rows": 1000,
"childtable_prefix": "d",
"childtable_prefix": "da",
"insert_mode": "stmt",
"timestamp_step": 15,
"start_timestamp":1700000000000000000,
"start_timestamp":1700000000000000,
"columns": [
{ "type": "double", "name": "dc", "max": 10, "min": 0 },
{ "type": "tinyint", "name": "ti", "max": 100, "min": -100 },
@ -41,11 +41,11 @@
"child_table_exists": "no",
"childtable_count": 3,
"insert_rows": 100,
"childtable_prefix": "d",
"childtable_prefix": "db",
"insert_mode": "stmt",
"timestamp_step": 20,
"interlace_rows": 1,
"start_timestamp":1700000000000000000,
"start_timestamp":1700000000000000,
"columns": [
{ "type": "double", "name": "dc", "max": 10, "min": 0 },
{ "type": "tinyint", "name": "ti", "max": 100, "min": -100 },
@ -61,11 +61,11 @@
"child_table_exists": "no",
"childtable_count": 5,
"insert_rows": 100,
"childtable_prefix": "d",
"childtable_prefix": "dc",
"insert_mode": "stmt2",
"timestamp_step": 20,
"interlace_rows": 1,
"start_timestamp":1700000000000000000,
"start_timestamp":1700000000000000,
"columns": [
{ "type": "double", "name": "dc", "max": 10, "min": 0 },
{ "type": "tinyint", "name": "ti", "max": 100, "min": -100 },
@ -81,11 +81,11 @@
"child_table_exists": "no",
"childtable_count": 2,
"insert_rows": 70,
"childtable_prefix": "d",
"childtable_prefix": "dd",
"insert_mode": "stmt2",
"timestamp_step": 50,
"interlace_rows": 0,
"start_timestamp":1700000000000000000,
"start_timestamp":1700000000000000,
"columns": [
{ "type": "double", "name": "dc", "max": 10, "min": 0 },
{ "type": "tinyint", "name": "ti", "max": 100, "min": -100 },
@ -111,7 +111,7 @@
"child_table_exists": "no",
"childtable_count": 3,
"insert_rows": 120,
"childtable_prefix": "d",
"childtable_prefix": "de",
"insert_mode": "taosc",
"timestamp_step": 15,
"start_timestamp":1700000000000000000,
@ -130,7 +130,7 @@
"child_table_exists": "no",
"childtable_count": 2,
"insert_rows": 200,
"childtable_prefix": "d",
"childtable_prefix": "df",
"insert_mode": "taosc",
"timestamp_step": 2,
"interlace_rows": 4,