From 006a3c38045ce840fd8eec6d396d46d0cab710d4 Mon Sep 17 00:00:00 2001 From: menshibin Date: Fri, 12 Jan 2024 14:14:03 +0800 Subject: [PATCH 01/18] add inc Snapshot copy case --- tests/army/community/cluster/incSnapshot.py | 104 ++++++++++++++++++++ tests/army/frame/autogen.py | 61 ++++++------ tests/army/frame/caseBase.py | 14 +-- tests/army/frame/server/cluster.py | 11 ++- tests/army/frame/server/dnodes.py | 5 + tests/army/test.py | 21 ++-- 6 files changed, 165 insertions(+), 51 deletions(-) create mode 100644 tests/army/community/cluster/incSnapshot.py diff --git a/tests/army/community/cluster/incSnapshot.py b/tests/army/community/cluster/incSnapshot.py new file mode 100644 index 0000000000..a91e51cda4 --- /dev/null +++ b/tests/army/community/cluster/incSnapshot.py @@ -0,0 +1,104 @@ +import taos +import sys +import os +import subprocess +import glob +import shutil +import time + +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * +from frame.autogen import * +from frame.server.dnodes import * +from frame.server.cluster import * + + +class TDTestCase(TBase): + + def init(self, conn, logSql, replicaVar=3): + super(TDTestCase, self).init(conn, logSql, replicaVar=3, db="snapshot", checkColName="c1") + self.valgrind = 0 + self.childtable_count = 10 + # tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) # output sql.txt file + + def run(self): + tdSql.prepare() + autoGen = AutoGen() + autoGen.create_db(self.db, 2, 3) + autoGen.create_stable(self.stb, 5, 10, 8, 8) + autoGen.create_child(self.stb, "d", self.childtable_count) + autoGen.insert_data(1) + tdSql.execute(f"flush database {self.db}") + clusterDnodes.stoptaosd(3) + clusterDnodes.stoptaosd(1) + clusterDnodes.starttaosd(3) + time.sleep(5) + clusterDnodes.stoptaosd(2) + clusterDnodes.starttaosd(1) + time.sleep(5) + autoGen.insert_data(10, 1600000000001) + # tdSql.execute(f"flush database {self.db}") + + sql = 'show vnodes;' + while True: + bFinish = True + param_list = tdSql.query(sql, row_tag=True) + for param in param_list: + if param[3] == 'leading' or param[3] == 'following': + bFinish = False + break + if bFinish: + break + self.snapshotAgg() + + clusterDnodes.stopAll() + # for i in range(1, 4): + # path = clusterDnodes.getDnodeDir(i) + # dnodesRootDir = os.path.join(path,"data","vnode", "vnode*") + # dirs = glob.glob(dnodesRootDir) + # for dir in dirs: + # if os.path.isdir(dir): + # tdLog.debug("delete dir: %s " % (dnodesRootDir)) + # self.remove_directory(os.path.join(dir, "wal")) + + clusterDnodes.starttaosd(1) + clusterDnodes.starttaosd(2) + clusterDnodes.starttaosd(3) + + time.sleep(3) + while True: + bFinish = True + param_list = tdSql.query(sql, row_tag=True) + for param in param_list: + if param[3] == 'offline': + tdLog.exit( + "dnode synchronous fail dnode id: %d, vgroup id:%d status offline" % (param[0], param[1])) + if param[3] == 'leading' or param[3] == 'following': + bFinish = False + break + if bFinish: + break + + self.timestamp_step = 1 + self.insert_rows = 11 + self.checkInsertCorrect() + self.checkAggCorrect() + + def remove_directory(self, directory): + try: + shutil.rmtree(directory) + tdLog.debug("delete dir: %s " % (directory)) + except OSError as e: + tdLog.exit("delete fail dir: %s " % (directory)) + + def stop(self): + tdSql.close() + tdLog.success(f"{__file__} successfully executed") + + +tdCases.addLinux(__file__, TDTestCase()) +tdCases.addWindows(__file__, TDTestCase()) diff --git a/tests/army/frame/autogen.py b/tests/army/frame/autogen.py index 9dca96e7b0..a641deaf00 100644 --- a/tests/army/frame/autogen.py +++ b/tests/army/frame/autogen.py @@ -30,7 +30,7 @@ class AutoGen: # _columns_sql def gen_columns_sql(self, pre, cnt, binary_len, nchar_len): - types = [ + types = [ 'timestamp', 'tinyint', 'smallint', @@ -58,33 +58,33 @@ class AutoGen: sqls += "," sqls += sql metas.append(sel) - - return metas, sqls; + + return metas, sqls; # gen tags data def gen_data(self, i, marr): - datas = "" + datas = "" for c in marr: data = "" - if c == 0 : # timestamp + if c == 0: # timestamp data = "%d" % (self.ts + i) - elif c <= 4 : # small - data = "%d"%(i%128) - elif c <= 8 : # int + elif c <= 4: # small + data = "%d" % (i % 128) + elif c <= 8: # int data = f"{i}" - elif c <= 10 : # float - data = "%f"%(i+i/1000) - elif c <= 11 : # bool - data = "%d"%(i%2) - elif c == 12 : # binary + elif c <= 10: # float + data = "%f" % (i + i / 1000) + elif c <= 11: # bool + data = "%d" % (i % 2) + elif c == 12: # binary data = '"' + self.random_string(self.bin_len) + '"' - elif c == 13 : # binary + elif c == 13: # binary data = '"' + self.random_string(self.nch_len) + '"' if datas != "": datas += "," datas += data - + return datas # generate specail wide random string @@ -93,11 +93,11 @@ class AutoGen: return ''.join(random.choice(letters) for i in range(count)) # create db - def create_db(self, dbname, vgroups = 2, replica = 1): - self.dbname = dbname + def create_db(self, dbname, vgroups=2, replica=1): + self.dbname = dbname tdSql.execute(f'create database {dbname} vgroups {vgroups} replica {replica}') tdSql.execute(f'use {dbname}') - + # create table or stable def create_stable(self, stbname, tag_cnt, column_cnt, binary_len, nchar_len): self.bin_len = binary_len @@ -109,7 +109,7 @@ class AutoGen: sql = f"create table {stbname} (ts timestamp, {cols}) tags({tags})" tdSql.execute(sql) - # create child table + # create child table def create_child(self, stbname, prename, cnt): self.child_cnt = cnt self.child_name = prename @@ -120,7 +120,7 @@ class AutoGen: tdLog.info(f"create child tables {cnt} ok") - def insert_data_child(self, child_name, cnt, batch_size, step): + def insert_data_child(self, child_name, cnt, batch_size, step): values = "" print("insert child data") ts = self.ts @@ -130,7 +130,7 @@ class AutoGen: value = self.gen_data(i, self.mcols) ts += step values += f"({ts},{value}) " - if batch_size == 1 or (i > 0 and i % batch_size == 0) : + if batch_size == 1 or (i > 0 and i % batch_size == 0): sql = f"insert into {child_name} values {values}" tdSql.execute(sql) values = "" @@ -138,18 +138,25 @@ class AutoGen: # end batch if values != "": sql = f"insert into {child_name} values {values}" + tdLog.info(f" insert child data SQL{sql}") tdSql.execute(sql) tdLog.info(f" insert data i={i}") values = "" - tdLog.info(f" insert child data {child_name} finished, insert rows={cnt}") + tdLog.info(f" insert child data {child_name} finished, insert rows={cnt} last_ts={ts}") + return ts - # insert data - def insert_data(self, cnt): + # insert data + def insert_data(self, cnt, bContinue=False): + if not bContinue: + self.ts = 1600000000000 + + currTs = 1600000000000 for i in range(self.child_cnt): name = f"{self.child_name}{i}" - self.insert_data_child(name, cnt, self.batch_size, 1) + currTs = self.insert_data_child(name, cnt, self.batch_size, 1) + self.ts = currTs tdLog.info(f" insert data ok, child table={self.child_cnt} insert rows={cnt}") # insert same timestamp to all childs @@ -158,6 +165,4 @@ class AutoGen: name = f"{self.child_name}{i}" self.insert_data_child(name, cnt, self.batch_size, 0) - tdLog.info(f" insert same timestamp ok, child table={self.child_cnt} insert rows={cnt}") - - + tdLog.info(f" insert same timestamp ok, child table={self.child_cnt} insert rows={cnt}") diff --git a/tests/army/frame/caseBase.py b/tests/army/frame/caseBase.py index 8d2c1e6d18..863a117cdd 100644 --- a/tests/army/frame/caseBase.py +++ b/tests/army/frame/caseBase.py @@ -28,7 +28,7 @@ class TBase: # # init - def init(self, conn, logSql, replicaVar=1): + def init(self, conn, logSql, replicaVar=1, db="db", stb="stb", checkColName="ic"): # save param self.replicaVar = int(replicaVar) tdSql.init(conn.cursor(), True) @@ -40,14 +40,14 @@ class TBase: self.mLevelDisk = 0 # test case information - self.db = "db" - self.stb = "stb" + self.db = db + self.stb = stb # sql - self.sqlSum = f"select sum(ic) from {self.stb}" - self.sqlMax = f"select max(ic) from {self.stb}" - self.sqlMin = f"select min(ic) from {self.stb}" - self.sqlAvg = f"select avg(ic) from {self.stb}" + self.sqlSum = f"select sum({checkColName}) from {self.stb}" + self.sqlMax = f"select max({checkColName}) from {self.stb}" + self.sqlMin = f"select min({checkColName}) from {self.stb}" + self.sqlAvg = f"select avg({checkColName}) from {self.stb}" self.sqlFirst = f"select first(ts) from {self.stb}" self.sqlLast = f"select last(ts) from {self.stb}" diff --git a/tests/army/frame/server/cluster.py b/tests/army/frame/server/cluster.py index ade8ac39a2..9be7fe56b1 100644 --- a/tests/army/frame/server/cluster.py +++ b/tests/army/frame/server/cluster.py @@ -13,23 +13,24 @@ from frame.common import * class ClusterDnodes(TDDnodes): """rewrite TDDnodes and make MyDdnodes as TDDnodes child class""" - def __init__(self ,dnodes_lists): - + def __init__(self): super(ClusterDnodes,self).__init__() - self.dnodes = dnodes_lists # dnode must be TDDnode instance self.simDeployed = False self.testCluster = False self.valgrind = 0 self.killValgrind = 1 + def init(self, dnodes_lists, deployPath, masterIp): + self.dnodes = dnodes_lists # dnode must be TDDnode instance + super(ClusterDnodes, self).init(deployPath, masterIp) +clusterDnodes = ClusterDnodes() class ConfigureyCluster: """This will create defined number of dnodes and create a cluster. at the same time, it will return TDDnodes list: dnodes, """ hostname = socket.gethostname() - def __init__(self): - self.dnodes = [] + self.dnodes = [] self.dnodeNums = 5 self.independent = True self.startPort = 6030 diff --git a/tests/army/frame/server/dnodes.py b/tests/army/frame/server/dnodes.py index 0d40b665dd..b58deeb789 100644 --- a/tests/army/frame/server/dnodes.py +++ b/tests/army/frame/server/dnodes.py @@ -899,6 +899,11 @@ class TDDnodes: dnodesRootDir = "%s/sim" % (self.path) return dnodesRootDir + def getDnodeDir(self, index): + self.check(index) + dnodesDir = "%s/sim/dnode%d" % (self.path, index) + return dnodesDir + def getSimCfgPath(self): return self.sim.getCfgDir() diff --git a/tests/army/test.py b/tests/army/test.py index a3e28b772d..37fecea370 100644 --- a/tests/army/test.py +++ b/tests/army/test.py @@ -405,11 +405,11 @@ if __name__ == "__main__": else : tdLog.debug("create an cluster with %s nodes and make %s dnode as independent mnode"%(dnodeNums,mnodeNums)) dnodeslist = cluster.configure_cluster(dnodeNums=dnodeNums, mnodeNums=mnodeNums, independentMnode=independentMnode, level=level, disk=disk) - tdDnodes = ClusterDnodes(dnodeslist) - tdDnodes.init(deployPath, masterIp) - tdDnodes.setTestCluster(testCluster) - tdDnodes.setValgrind(valgrind) - tdDnodes.stopAll() + clusterDnodes.init(dnodeslist, deployPath, masterIp) + clusterDnodes.setTestCluster(testCluster) + clusterDnodes.setValgrind(valgrind) + clusterDnodes.setAsan(asan) + clusterDnodes.stopAll() for dnode in tdDnodes.dnodes: tdDnodes.deploy(dnode.index, updateCfgDict) for dnode in tdDnodes.dnodes: @@ -591,12 +591,11 @@ if __name__ == "__main__": print(independentMnode,"independentMnode valuse") # create dnode list dnodeslist = cluster.configure_cluster(dnodeNums=dnodeNums, mnodeNums=mnodeNums, independentMnode=independentMnode, level=level, disk=disk) - tdDnodes = ClusterDnodes(dnodeslist) - tdDnodes.init(deployPath, masterIp) - tdDnodes.setTestCluster(testCluster) - tdDnodes.setValgrind(valgrind) - tdDnodes.setAsan(asan) - tdDnodes.stopAll() + clusterDnodes.init(dnodeslist, deployPath, masterIp) + clusterDnodes.setTestCluster(testCluster) + clusterDnodes.setValgrind(valgrind) + clusterDnodes.setAsan(asan) + clusterDnodes.stopAll() for dnode in tdDnodes.dnodes: tdDnodes.deploy(dnode.index,updateCfgDict) for dnode in tdDnodes.dnodes: From 2be6098a2e3e7fdd539ccb6e9e029f14f0fd00cb Mon Sep 17 00:00:00 2001 From: menshibin Date: Mon, 15 Jan 2024 14:59:09 +0800 Subject: [PATCH 02/18] add inc Snapshot copy case --- tests/army/community/cluster/incSnapshot.py | 58 ++++++++++----------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/tests/army/community/cluster/incSnapshot.py b/tests/army/community/cluster/incSnapshot.py index a91e51cda4..94013eea70 100644 --- a/tests/army/community/cluster/incSnapshot.py +++ b/tests/army/community/cluster/incSnapshot.py @@ -31,45 +31,45 @@ class TDTestCase(TBase): autoGen.create_db(self.db, 2, 3) autoGen.create_stable(self.stb, 5, 10, 8, 8) autoGen.create_child(self.stb, "d", self.childtable_count) - autoGen.insert_data(1) + autoGen.insert_data(1000) tdSql.execute(f"flush database {self.db}") clusterDnodes.stoptaosd(3) - clusterDnodes.stoptaosd(1) - clusterDnodes.starttaosd(3) - time.sleep(5) - clusterDnodes.stoptaosd(2) - clusterDnodes.starttaosd(1) - time.sleep(5) - autoGen.insert_data(10, 1600000000001) - # tdSql.execute(f"flush database {self.db}") + # clusterDnodes.stoptaosd(1) + # clusterDnodes.starttaosd(3) + # time.sleep(5) + # clusterDnodes.stoptaosd(2) + # clusterDnodes.starttaosd(1) + # time.sleep(5) + autoGen.insert_data(5000, 1600000000001) + tdSql.execute(f"flush database {self.db}") - sql = 'show vnodes;' - while True: - bFinish = True - param_list = tdSql.query(sql, row_tag=True) - for param in param_list: - if param[3] == 'leading' or param[3] == 'following': - bFinish = False - break - if bFinish: - break + # sql = 'show vnodes;' + # while True: + # bFinish = True + # param_list = tdSql.query(sql, row_tag=True) + # for param in param_list: + # if param[3] == 'leading' or param[3] == 'following': + # bFinish = False + # break + # if bFinish: + # break self.snapshotAgg() - + time.sleep(10) clusterDnodes.stopAll() - # for i in range(1, 4): - # path = clusterDnodes.getDnodeDir(i) - # dnodesRootDir = os.path.join(path,"data","vnode", "vnode*") - # dirs = glob.glob(dnodesRootDir) - # for dir in dirs: - # if os.path.isdir(dir): - # tdLog.debug("delete dir: %s " % (dnodesRootDir)) - # self.remove_directory(os.path.join(dir, "wal")) + for i in range(1, 4): + path = clusterDnodes.getDnodeDir(i) + dnodesRootDir = os.path.join(path,"data","vnode", "vnode*") + dirs = glob.glob(dnodesRootDir) + for dir in dirs: + if os.path.isdir(dir): + tdLog.debug("delete dir: %s " % (dnodesRootDir)) + self.remove_directory(os.path.join(dir, "wal")) clusterDnodes.starttaosd(1) clusterDnodes.starttaosd(2) clusterDnodes.starttaosd(3) - time.sleep(3) + time.sleep(10) while True: bFinish = True param_list = tdSql.query(sql, row_tag=True) From 1119d95a4aa9166f9f06bc4a4a3571c5c7cf4c71 Mon Sep 17 00:00:00 2001 From: menshibin Date: Tue, 16 Jan 2024 14:38:53 +0800 Subject: [PATCH 03/18] add inc Snapshot copy case --- tests/army/community/cluster/incSnapshot.py | 2 +- tests/parallel_test/cases.task | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/army/community/cluster/incSnapshot.py b/tests/army/community/cluster/incSnapshot.py index 94013eea70..21f67b45fc 100644 --- a/tests/army/community/cluster/incSnapshot.py +++ b/tests/army/community/cluster/incSnapshot.py @@ -40,7 +40,7 @@ class TDTestCase(TBase): # clusterDnodes.stoptaosd(2) # clusterDnodes.starttaosd(1) # time.sleep(5) - autoGen.insert_data(5000, 1600000000001) + autoGen.insert_data(5000, True) tdSql.execute(f"flush database {self.db}") # sql = 'show vnodes;' diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index 63745f75ab..5e8921768d 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -11,6 +11,7 @@ ,,y,army,./pytest.sh python3 ./test.py -f enterprise/multi-level/mlevel_basic.py -N 3 -L 3 -D 2 ,,y,army,./pytest.sh python3 ./test.py -f enterprise/s3/s3_basic.py -L 3 -D 1 ,,y,army,./pytest.sh python3 ./test.py -f community/cluster/snapshot.py -N 3 -L 3 -D 2 +,,y,army,./pytest.sh python3 ./test.py -f community/cluster/incSnapshot.py -N 3 -L 3 -D 2 ,,n,army,python3 ./test.py -f community/cmdline/fullopt.py From 7db577d664d4ec7d69678210a1f3f178eab511de Mon Sep 17 00:00:00 2001 From: menshibin Date: Tue, 16 Jan 2024 15:28:19 +0800 Subject: [PATCH 04/18] add inc Snapshot copy case --- tests/army/test.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/army/test.py b/tests/army/test.py index 37fecea370..62b3b46a61 100644 --- a/tests/army/test.py +++ b/tests/army/test.py @@ -410,10 +410,10 @@ if __name__ == "__main__": clusterDnodes.setValgrind(valgrind) clusterDnodes.setAsan(asan) clusterDnodes.stopAll() - for dnode in tdDnodes.dnodes: - tdDnodes.deploy(dnode.index, updateCfgDict) - for dnode in tdDnodes.dnodes: - tdDnodes.starttaosd(dnode.index) + for dnode in clusterDnodes.dnodes: + clusterDnodes.deploy(dnode.index, updateCfgDict) + for dnode in clusterDnodes.dnodes: + clusterDnodes.starttaosd(dnode.index) tdCases.logSql(logSql) if restful or websocket: @@ -596,10 +596,10 @@ if __name__ == "__main__": clusterDnodes.setValgrind(valgrind) clusterDnodes.setAsan(asan) clusterDnodes.stopAll() - for dnode in tdDnodes.dnodes: - tdDnodes.deploy(dnode.index,updateCfgDict) - for dnode in tdDnodes.dnodes: - tdDnodes.starttaosd(dnode.index) + for dnode in clusterDnodes.dnodes: + clusterDnodes.deploy(dnode.index,updateCfgDict) + for dnode in clusterDnodes.dnodes: + clusterDnodes.starttaosd(dnode.index) tdCases.logSql(logSql) if restful or websocket: From 24066a7734cabcf4070e61633cba92bed78654cc Mon Sep 17 00:00:00 2001 From: menshibin Date: Tue, 16 Jan 2024 15:35:33 +0800 Subject: [PATCH 05/18] add inc Snapshot copy case --- tests/army/community/cluster/incSnapshot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/army/community/cluster/incSnapshot.py b/tests/army/community/cluster/incSnapshot.py index 21f67b45fc..2095b6008b 100644 --- a/tests/army/community/cluster/incSnapshot.py +++ b/tests/army/community/cluster/incSnapshot.py @@ -68,7 +68,7 @@ class TDTestCase(TBase): clusterDnodes.starttaosd(1) clusterDnodes.starttaosd(2) clusterDnodes.starttaosd(3) - + sql = "show vnodes;" time.sleep(10) while True: bFinish = True From 022965661a7fcd0fa0a04823105b72aef7daeaad Mon Sep 17 00:00:00 2001 From: menshibin Date: Tue, 16 Jan 2024 15:38:34 +0800 Subject: [PATCH 06/18] add inc Snapshot copy case --- tests/army/community/cluster/incSnapshot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/army/community/cluster/incSnapshot.py b/tests/army/community/cluster/incSnapshot.py index 2095b6008b..9f50ea52f1 100644 --- a/tests/army/community/cluster/incSnapshot.py +++ b/tests/army/community/cluster/incSnapshot.py @@ -84,7 +84,7 @@ class TDTestCase(TBase): break self.timestamp_step = 1 - self.insert_rows = 11 + self.insert_rows = 6000 self.checkInsertCorrect() self.checkAggCorrect() From 8edff6e35593ced01718207dea26d7b4c0688470 Mon Sep 17 00:00:00 2001 From: menshibin Date: Tue, 16 Jan 2024 15:51:16 +0800 Subject: [PATCH 07/18] add inc Snapshot copy case --- tests/army/frame/autogen.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/tests/army/frame/autogen.py b/tests/army/frame/autogen.py index 1e041f633d..d38d2e2f19 100644 --- a/tests/army/frame/autogen.py +++ b/tests/army/frame/autogen.py @@ -162,16 +162,23 @@ class AutoGen: tdLog.info(f" insert data i={i}") values = "" - tdLog.info(f" insert child data {child_name} finished, insert rows={cnt}") + tdLog.info(f" insert child data {child_name} finished, insert rows={cnt}") + return ts - # insert data - def insert_data(self, cnt): + def insert_data(self, cnt, bContinue=False): + if not bContinue: + self.ts = 1600000000000 + + currTs = 1600000000000 for i in range(self.child_cnt): name = f"{self.child_name}{i}" - self.insert_data_child(name, cnt, self.batch_size, 1) + currTs = self.insert_data_child(name, cnt, self.batch_size, 1) + self.ts = currTs tdLog.info(f" insert data ok, child table={self.child_cnt} insert rows={cnt}") + # insert same timestamp to all childs + # insert same timestamp to all childs def insert_samets(self, cnt): for i in range(self.child_cnt): From 547b75977e24a658bf52ae5aa02f968ee4e18aa8 Mon Sep 17 00:00:00 2001 From: facetosea <25808407@qq.com> Date: Fri, 19 Jan 2024 17:37:43 +0800 Subject: [PATCH 08/18] fix: timezone error on windows --- source/os/src/osTime.c | 70 ++++++++++++++++++++++++++---------------- 1 file changed, 43 insertions(+), 27 deletions(-) diff --git a/source/os/src/osTime.c b/source/os/src/osTime.c index e506ee603b..9cad1dd6ef 100644 --- a/source/os/src/osTime.c +++ b/source/os/src/osTime.c @@ -37,9 +37,6 @@ // This magic number is the number of 100 nanosecond intervals since January 1, 1601 (UTC) // until 00:00:00 January 1, 1970 static const uint64_t TIMEEPOCH = ((uint64_t)116444736000000000ULL); -// This magic number is the number of 100 nanosecond intervals since January 1, 1601 (UTC) -// until 00:00:00 January 1, 1900 -static const uint64_t TIMEEPOCH1900 = ((uint64_t)116445024000000000ULL); /* * We do not implement alternate representations. However, we always @@ -360,6 +357,7 @@ int32_t taosGetTimeOfDay(struct timeval *tv) { t.QuadPart -= TIMEEPOCH; tv->tv_sec = t.QuadPart / 10000000; tv->tv_usec = (t.QuadPart % 10000000) / 10; + return 0; #else return gettimeofday(tv, NULL); #endif @@ -482,33 +480,51 @@ struct tm *taosLocalTime(const time_t *timep, struct tm *result, char *buf) { sprintf(buf, "NaN"); } return NULL; - } + } else if (*timep < 0) { + SYSTEMTIME ss, s; + FILETIME ff, f; - SYSTEMTIME s; - FILETIME f; - LARGE_INTEGER offset; - struct tm tm1; - time_t tt = 0; - if (localtime_s(&tm1, &tt) != 0) { - if (buf != NULL) { - sprintf(buf, "NaN"); + LARGE_INTEGER offset; + struct tm tm1; + time_t tt = 0; + if (localtime_s(&tm1, &tt) != 0) { + if (buf != NULL) { + sprintf(buf, "NaN"); + } + return NULL; + } + ss.wYear = tm1.tm_year + 1900; + ss.wMonth = tm1.tm_mon + 1; + ss.wDay = tm1.tm_mday; + ss.wHour = tm1.tm_hour; + ss.wMinute = tm1.tm_min; + ss.wSecond = tm1.tm_sec; + ss.wMilliseconds = 0; + SystemTimeToFileTime(&ss, &ff); + offset.QuadPart = ff.dwHighDateTime; + offset.QuadPart <<= 32; + offset.QuadPart |= ff.dwLowDateTime; + offset.QuadPart += *timep * 10000000; + f.dwLowDateTime = offset.QuadPart & 0xffffffff; + f.dwHighDateTime = (offset.QuadPart >> 32) & 0xffffffff; + FileTimeToSystemTime(&f, &s); + result->tm_sec = s.wSecond; + result->tm_min = s.wMinute; + result->tm_hour = s.wHour; + result->tm_mday = s.wDay; + result->tm_mon = s.wMonth - 1; + result->tm_year = s.wYear - 1900; + result->tm_wday = s.wDayOfWeek; + result->tm_yday = 0; + result->tm_isdst = 0; + } else { + if (localtime_s(result, timep) != 0) { + if (buf != NULL) { + sprintf(buf, "NaN"); + } + return NULL; } - return NULL; } - offset.QuadPart = TIMEEPOCH1900; - offset.QuadPart += *timep * 10000000; - f.dwLowDateTime = offset.QuadPart & 0xffffffff; - f.dwHighDateTime = (offset.QuadPart >> 32) & 0xffffffff; - FileTimeToSystemTime(&f, &s); - result->tm_sec = s.wSecond; - result->tm_min = s.wMinute; - result->tm_hour = s.wHour; - result->tm_mday = s.wDay; - result->tm_mon = s.wMonth - 1; - result->tm_year = s.wYear - 1900; - result->tm_wday = s.wDayOfWeek; - result->tm_yday = 0; - result->tm_isdst = 0; #else res = localtime_r(timep, result); if (res == NULL && buf != NULL) { From 1e1951e86d0bebf4f6807b4e00c1e9126a8821f8 Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Fri, 19 Jan 2024 17:51:55 +0800 Subject: [PATCH 09/18] fix: add distributed total information --- tests/army/community/query/query_basic.py | 14 ++++++++++++ tests/army/frame/caseBase.py | 27 +++++++++++++++++++++-- 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/tests/army/community/query/query_basic.py b/tests/army/community/query/query_basic.py index 90916a1c6c..13b37ef253 100644 --- a/tests/army/community/query/query_basic.py +++ b/tests/army/community/query/query_basic.py @@ -76,12 +76,26 @@ class TDTestCase(TBase): sql2 = "select bi from stb where bi is not null order by bi desc limit 10;" self.checkSameResult(sql1, sql2) + # distributed expect values + expects = { + "Block_Rows" : 6*100000, + "Total_Tables" : 6, + "Total_Vgroups" : 3 + } + self.waitTransactionZero() + reals = self.getDistributed(self.stb) + for k in expects.keys(): + v = expects[k] + if int(reals[k]) != v: + tdLog.exit(f"distribute {k} expect: {v} real: {reals[k]}") + # run def run(self): tdLog.debug(f"start to excute {__file__}") # insert data self.insertData() + self.flushDb() # check insert data correct self.checkInsertCorrect() diff --git a/tests/army/frame/caseBase.py b/tests/army/frame/caseBase.py index b1500b69e1..5715867faf 100644 --- a/tests/army/frame/caseBase.py +++ b/tests/army/frame/caseBase.py @@ -229,9 +229,9 @@ class TBase: # # get vgroups - def getVGroup(self, db_name): + def getVGroup(self, dbName): vgidList = [] - sql = f"select vgroup_id from information_schema.ins_vgroups where db_name='{db_name}'" + sql = f"select vgroup_id from information_schema.ins_vgroups where db_name='{dbName}'" res = tdSql.getResult(sql) rows = len(res) for i in range(rows): @@ -239,6 +239,29 @@ class TBase: return vgidList + # get distributed rows + def getDistributed(self, tbName): + sql = f"show table distributed {tbName}" + tdSql.query(sql) + dics = {} + i = 0 + for i in range(tdSql.getRows()): + row = tdSql.getData(i, 0) + #print(row) + row = row.replace('[', '').replace(']', '') + #print(row) + items = row.split(' ') + #print(items) + for item in items: + #print(item) + v = item.split('=') + #print(v) + if len(v) == 2: + dics[v[0]] = v[1] + if i > 5: + break + print(dics) + return dics # From 95975801d52c1e4631b8a39b26285bdea3d148d1 Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Sat, 20 Jan 2024 13:42:42 +0800 Subject: [PATCH 10/18] feat: add check max and ts window correctness --- tests/army/community/query/query_basic.json | 2 +- tests/army/community/query/query_basic.py | 142 +++++++++++++++++++- 2 files changed, 140 insertions(+), 4 deletions(-) diff --git a/tests/army/community/query/query_basic.json b/tests/army/community/query/query_basic.json index c6a3482cd4..d8d47266f9 100644 --- a/tests/army/community/query/query_basic.json +++ b/tests/army/community/query/query_basic.json @@ -32,7 +32,7 @@ "childtable_prefix": "d", "insert_mode": "taosc", "timestamp_step": 30000, - "start_timestamp":"2023-10-01 10:00:00", + "start_timestamp":1700000000000, "columns": [ { "type": "bool", "name": "bc"}, { "type": "float", "name": "fc" }, diff --git a/tests/army/community/query/query_basic.py b/tests/army/community/query/query_basic.py index 13b37ef253..eb332b8c71 100644 --- a/tests/army/community/query/query_basic.py +++ b/tests/army/community/query/query_basic.py @@ -34,23 +34,158 @@ class TDTestCase(TBase): "querySmaOptimize": "1" } + def insertData(self): tdLog.info(f"insert data.") # taosBenchmark run jfile = etool.curFile(__file__, "query_basic.json") - etool.benchMark(json=jfile) + etool.benchMark(json = jfile) tdSql.execute(f"use {self.db}") tdSql.execute("select database();") - # set insert data information + # come from query_basic.json self.childtable_count = 6 self.insert_rows = 100000 self.timestamp_step = 30000 + self.start_timestamp = 1700000000000 + + + def genTime(self, preCnt, cnt): + start = self.start_timestamp + preCnt * self.timestamp_step + end = start + self.timestamp_step * cnt + return (start, end) + + + def doWindowQuery(self): + pre = f"select count(ts) from {self.stb} " + # case1 operator "in" "and" is same + cnt = 6000 + s,e = self.genTime(12000, cnt) + sql1 = f"{pre} where ts between {s} and {e} " + sql2 = f"{pre} where ts >= {s} and ts <={e} " + expectCnt = (cnt + 1) * self.childtable_count + tdSql.checkFirstValue(sql1, expectCnt) + tdSql.checkFirstValue(sql2, expectCnt) + + # case2 no overloap "or" left + cnt1 = 120 + s1, e1 = self.genTime(4000, cnt1) + cnt2 = 3000 + s2, e2 = self.genTime(10000, cnt2) + sql = f"{pre} where (ts >= {s1} and ts < {e1}) or (ts >= {s2} and ts < {e2})" + expectCnt = (cnt1 + cnt2) * self.childtable_count + tdSql.checkFirstValue(sql, expectCnt) + + # case3 overloap "or" right + cnt1 = 300 + s1, e1 = self.genTime(17000, cnt1) + cnt2 = 8000 + s2, e2 = self.genTime(70000, cnt2) + sql = f"{pre} where (ts > {s1} and ts <= {e1}) or (ts > {s2} and ts <= {e2})" + expectCnt = (cnt1 + cnt2) * self.childtable_count + tdSql.checkFirstValue(sql, expectCnt) + + # case4 overloap "or" + cnt1 = 1000 + s1, e1 = self.genTime(9000, cnt1) + cnt2 = 1000 + s2, e2 = self.genTime(9000 + 500 , cnt2) + sql = f"{pre} where (ts > {s1} and ts <= {e1}) or (ts > {s2} and ts <= {e2})" + expectCnt = (cnt1 + 500) * self.childtable_count # expect=1500 + tdSql.checkFirstValue(sql, expectCnt) + + # case5 overloap "or" boundary hollow->solid + cnt1 = 3000 + s1, e1 = self.genTime(45000, cnt1) + cnt2 = 2000 + s2, e2 = self.genTime(45000 + cnt1 , cnt2) + sql = f"{pre} where (ts > {s1} and ts <= {e1}) or (ts > {s2} and ts <= {e2})" + expectCnt = (cnt1+cnt2) * self.childtable_count + tdSql.checkFirstValue(sql, expectCnt) + + # case6 overloap "or" boundary solid->solid + cnt1 = 300 + s1, e1 = self.genTime(55000, cnt1) + cnt2 = 500 + s2, e2 = self.genTime(55000 + cnt1 , cnt2) + sql = f"{pre} where (ts >= {s1} and ts <= {e1}) or (ts >= {s2} and ts <= {e2})" + expectCnt = (cnt1+cnt2+1) * self.childtable_count + tdSql.checkFirstValue(sql, expectCnt) + + # case7 overloap "and" + cnt1 = 1000 + s1, e1 = self.genTime(40000, cnt1) + cnt2 = 1000 + s2, e2 = self.genTime(40000 + 500 , cnt2) + sql = f"{pre} where (ts > {s1} and ts <= {e1}) and (ts > {s2} and ts <= {e2})" + expectCnt = cnt1/2 * self.childtable_count + tdSql.checkFirstValue(sql, expectCnt) + + # case8 overloap "and" boundary hollow->solid solid->hollow + cnt1 = 3000 + s1, e1 = self.genTime(45000, cnt1) + cnt2 = 2000 + s2, e2 = self.genTime(45000 + cnt1 , cnt2) + sql = f"{pre} where (ts > {s1} and ts <= {e1}) and (ts >= {s2} and ts < {e2})" + expectCnt = 1 * self.childtable_count + tdSql.checkFirstValue(sql, expectCnt) + + # case9 no overloap "and" + cnt1 = 6000 + s1, e1 = self.genTime(20000, cnt1) + cnt2 = 300 + s2, e2 = self.genTime(70000, cnt2) + sql = f"{pre} where (ts > {s1} and ts <= {e1}) and (ts >= {s2} and ts <= {e2})" + expectCnt = 0 + tdSql.checkFirstValue(sql, expectCnt) + + # case10 cnt1 contain cnt2 and + cnt1 = 5000 + s1, e1 = self.genTime(25000, cnt1) + cnt2 = 400 + s2, e2 = self.genTime(28000, cnt2) + sql = f"{pre} where (ts > {s1} and ts <= {e1}) and (ts >= {s2} and ts < {e2})" + expectCnt = cnt2 * self.childtable_count + tdSql.checkFirstValue(sql, expectCnt) + + + def queryMax(self, colname): + sql = f"select max({colname}) from {self.stb}" + tdSql.query(sql) + return tdSql.getData(0, 0) + + + def checkMax(self): + # max for tsdbRetrieveDatablockSMA2 coverage + colname = "ui" + max = self.queryMax(colname) + + # insert over max + sql = f"insert into d0(ts, {colname}) values" + for i in range(1, 5): + sql += f" (now + {i}s, {max+i})" + tdSql.execute(sql) + self.flushDb() + + expectMax = max + 4 + for i in range(1, 5): + realMax = self.queryMax(colname) + if realMax != expectMax: + tdLog.exit(f"Max value not expect. expect:{expectMax} real:{realMax}") + sql = f"delete from d0 where ui={expectMax}" + tdSql.execute(sql) + expectMax -= 1 + + self.checkInsertCorrect() def doQuery(self): tdLog.info(f"do query.") - + self.doWindowQuery() + + # max + self.checkMax() + # __group_key sql = f"select count(*),_group_key(uti),uti from {self.stb} partition by uti" tdSql.query(sql) @@ -89,6 +224,7 @@ class TDTestCase(TBase): if int(reals[k]) != v: tdLog.exit(f"distribute {k} expect: {v} real: {reals[k]}") + # run def run(self): tdLog.debug(f"start to excute {__file__}") From e1b0d4a555b383232241a39c83d728886d0ac60d Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Sat, 20 Jan 2024 14:26:34 +0800 Subject: [PATCH 11/18] fix: tweak delete max value --- tests/army/community/query/query_basic.py | 9 ++++++++- tests/army/frame/sql.py | 6 ++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/tests/army/community/query/query_basic.py b/tests/army/community/query/query_basic.py index eb332b8c71..575655c2b1 100644 --- a/tests/army/community/query/query_basic.py +++ b/tests/army/community/query/query_basic.py @@ -172,7 +172,14 @@ class TDTestCase(TBase): realMax = self.queryMax(colname) if realMax != expectMax: tdLog.exit(f"Max value not expect. expect:{expectMax} real:{realMax}") - sql = f"delete from d0 where ui={expectMax}" + + # query ts list + sql = f"select ts from d0 where ui={expectMax}" + tdSql.query(sql) + tss = tdSql.getColData(0) + strts = ",".join(tss) + # delete + sql = f"delete from d0 where ts in ({strts})" tdSql.execute(sql) expectMax -= 1 diff --git a/tests/army/frame/sql.py b/tests/army/frame/sql.py index 8b7538321d..83f1243167 100644 --- a/tests/army/frame/sql.py +++ b/tests/army/frame/sql.py @@ -223,6 +223,12 @@ class TDSql: def getData(self, row, col): self.checkRowCol(row, col) return self.res[row][col] + + def getColData(self, col): + colDatas = [] + for i in range(self.queryRows): + colDatas.append(self.res[i][col]) + return colDatas def getResult(self, sql): self.sql = sql From 684bc221300e35cf352c8fbd9617d0ac9ccea75c Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Sat, 20 Jan 2024 14:26:41 +0800 Subject: [PATCH 12/18] fix: tweak delete max value --- tests/army/community/query/query_basic.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/army/community/query/query_basic.py b/tests/army/community/query/query_basic.py index 575655c2b1..740d14e11b 100644 --- a/tests/army/community/query/query_basic.py +++ b/tests/army/community/query/query_basic.py @@ -177,7 +177,7 @@ class TDTestCase(TBase): sql = f"select ts from d0 where ui={expectMax}" tdSql.query(sql) tss = tdSql.getColData(0) - strts = ",".join(tss) + strts = ",".join(map(str,tss)) # delete sql = f"delete from d0 where ts in ({strts})" tdSql.execute(sql) From 6cd689ea53714bf8035eb32bb66f61badd6c428c Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Sat, 20 Jan 2024 14:43:00 +0800 Subject: [PATCH 13/18] fix: delete max ok --- tests/army/community/query/query_basic.py | 8 ++++---- tests/army/frame/caseBase.py | 12 ++++++++++++ 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/tests/army/community/query/query_basic.py b/tests/army/community/query/query_basic.py index 740d14e11b..211d3e6ec3 100644 --- a/tests/army/community/query/query_basic.py +++ b/tests/army/community/query/query_basic.py @@ -177,10 +177,10 @@ class TDTestCase(TBase): sql = f"select ts from d0 where ui={expectMax}" tdSql.query(sql) tss = tdSql.getColData(0) - strts = ",".join(map(str,tss)) - # delete - sql = f"delete from d0 where ts in ({strts})" - tdSql.execute(sql) + for ts in tss: + # delete + sql = f"delete from d0 where ts = '{ts}'" + tdSql.execute(sql) expectMax -= 1 self.checkInsertCorrect() diff --git a/tests/army/frame/caseBase.py b/tests/army/frame/caseBase.py index 5715867faf..de258e6267 100644 --- a/tests/army/frame/caseBase.py +++ b/tests/army/frame/caseBase.py @@ -292,3 +292,15 @@ class TBase: if len(lists) == 0: tdLog.exit(f"list is empty {tips}") + +# +# str util +# + # covert list to sql format string + def listSql(self, lists, sepa = ","): + strs = "" + for ls in lists: + if strs != "": + strs += sepa + strs += f"'{ls}'" + return strs \ No newline at end of file From 68b2a06a02289bea1d9e4e8f4d93530eac3627a0 Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Sat, 20 Jan 2024 14:52:40 +0800 Subject: [PATCH 14/18] feat: add cquery_basic.json write again --- tests/army/community/query/cquery_basic.json | 61 ++++++++++++++++++++ tests/army/community/query/query_basic.py | 6 +- 2 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 tests/army/community/query/cquery_basic.json diff --git a/tests/army/community/query/cquery_basic.json b/tests/army/community/query/cquery_basic.json new file mode 100644 index 0000000000..5a57d59d93 --- /dev/null +++ b/tests/army/community/query/cquery_basic.json @@ -0,0 +1,61 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "connection_pool_size": 8, + "num_of_records_per_req": 4000, + "prepared_rand": 10000, + "thread_count": 3, + "create_table_thread_count": 1, + "confirm_parameter_prompt": "no", + "databases": [ + { + "dbinfo": { + "name": "db", + "drop": "no", + "vgroups": 3, + "replica": 3, + "duration":"3d", + "wal_retention_period": 1, + "wal_retention_size": 1, + "stt_trigger": 1 + }, + "super_tables": [ + { + "name": "stb", + "child_table_exists": "yes", + "childtable_count": 6, + "insert_rows": 50000, + "childtable_prefix": "d", + "insert_mode": "taosc", + "timestamp_step": 60000, + "start_timestamp":1700000000000, + "columns": [ + { "type": "bool", "name": "bc"}, + { "type": "float", "name": "fc" }, + { "type": "double", "name": "dc"}, + { "type": "tinyint", "name": "ti"}, + { "type": "smallint", "name": "si" }, + { "type": "int", "name": "ic" }, + { "type": "bigint", "name": "bi" }, + { "type": "utinyint", "name": "uti"}, + { "type": "usmallint", "name": "usi"}, + { "type": "uint", "name": "ui" }, + { "type": "ubigint", "name": "ubi"}, + { "type": "binary", "name": "bin", "len": 8}, + { "type": "nchar", "name": "nch", "len": 16} + ], + "tags": [ + {"type": "tinyint", "name": "groupid","max": 10,"min": 1}, + {"name": "location","type": "binary", "len": 16, "values": + ["San Francisco", "Los Angles", "San Diego", "San Jose", "Palo Alto", "Campbell", "Mountain View","Sunnyvale", "Santa Clara", "Cupertino"] + } + ] + } + ] + } + ] +} diff --git a/tests/army/community/query/query_basic.py b/tests/army/community/query/query_basic.py index 211d3e6ec3..912974d8ab 100644 --- a/tests/army/community/query/query_basic.py +++ b/tests/army/community/query/query_basic.py @@ -49,6 +49,11 @@ class TDTestCase(TBase): self.timestamp_step = 30000 self.start_timestamp = 1700000000000 + # write again disorder + self.flushDb() + jfile = etool.curFile(__file__, "cquery_basic.json") + etool.benchMark(json = jfile) + def genTime(self, preCnt, cnt): start = self.start_timestamp + preCnt * self.timestamp_step @@ -238,7 +243,6 @@ class TDTestCase(TBase): # insert data self.insertData() - self.flushDb() # check insert data correct self.checkInsertCorrect() From c2772994e43d7fa08a54c95f6ece2ee5040636e4 Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Sat, 20 Jan 2024 15:00:14 +0800 Subject: [PATCH 15/18] fix: add order by desc coverage --- tests/army/frame/caseBase.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/army/frame/caseBase.py b/tests/army/frame/caseBase.py index de258e6267..f562ea1086 100644 --- a/tests/army/frame/caseBase.py +++ b/tests/army/frame/caseBase.py @@ -136,7 +136,7 @@ class TBase: tdSql.checkAgg(sql, self.childtable_count) # check step - sql = f"select * from (select diff(ts) as dif from {self.stb} partition by tbname) where dif != {self.timestamp_step}" + sql = f"select * from (select diff(ts) as dif from {self.stb} partition by tbname order by ts desc) where dif != {self.timestamp_step}" tdSql.query(sql) tdSql.checkRows(0) From 53b385108c1f0478adc3d18b7536a1980a56091e Mon Sep 17 00:00:00 2001 From: menshibin Date: Sun, 21 Jan 2024 18:38:25 +0800 Subject: [PATCH 16/18] add use db --- tests/army/community/cluster/incSnapshot.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/army/community/cluster/incSnapshot.py b/tests/army/community/cluster/incSnapshot.py index 9f50ea52f1..b1b53e65bd 100644 --- a/tests/army/community/cluster/incSnapshot.py +++ b/tests/army/community/cluster/incSnapshot.py @@ -29,6 +29,7 @@ class TDTestCase(TBase): tdSql.prepare() autoGen = AutoGen() autoGen.create_db(self.db, 2, 3) + tdSql.execute(f"use {self.db}") autoGen.create_stable(self.stb, 5, 10, 8, 8) autoGen.create_child(self.stb, "d", self.childtable_count) autoGen.insert_data(1000) From 091da20ab827e4d1ab4b5733eb7dad6fb24ce8db Mon Sep 17 00:00:00 2001 From: menshibin Date: Sun, 21 Jan 2024 20:40:06 +0800 Subject: [PATCH 17/18] add use db --- tests/army/frame/autogen.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/tests/army/frame/autogen.py b/tests/army/frame/autogen.py index d38d2e2f19..bbcbf9ad9a 100644 --- a/tests/army/frame/autogen.py +++ b/tests/army/frame/autogen.py @@ -163,22 +163,18 @@ class AutoGen: values = "" tdLog.info(f" insert child data {child_name} finished, insert rows={cnt}") - return ts + self.ts = ts def insert_data(self, cnt, bContinue=False): if not bContinue: self.ts = 1600000000000 - currTs = 1600000000000 for i in range(self.child_cnt): name = f"{self.child_name}{i}" - currTs = self.insert_data_child(name, cnt, self.batch_size, 1) + self.insert_data_child(name, cnt, self.batch_size, 1) - self.ts = currTs tdLog.info(f" insert data ok, child table={self.child_cnt} insert rows={cnt}") - # insert same timestamp to all childs - # insert same timestamp to all childs def insert_samets(self, cnt): for i in range(self.child_cnt): From 9a8660dd4e30f49e531b9a73210911911da53ad6 Mon Sep 17 00:00:00 2001 From: menshibin Date: Sun, 21 Jan 2024 20:43:07 +0800 Subject: [PATCH 18/18] modify insert ts contiune --- tests/army/frame/autogen.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/army/frame/autogen.py b/tests/army/frame/autogen.py index bbcbf9ad9a..d1f02e7865 100644 --- a/tests/army/frame/autogen.py +++ b/tests/army/frame/autogen.py @@ -163,16 +163,18 @@ class AutoGen: values = "" tdLog.info(f" insert child data {child_name} finished, insert rows={cnt}") - self.ts = ts + return ts def insert_data(self, cnt, bContinue=False): if not bContinue: self.ts = 1600000000000 + currTs = 1600000000000 for i in range(self.child_cnt): name = f"{self.child_name}{i}" - self.insert_data_child(name, cnt, self.batch_size, 1) + currTs = self.insert_data_child(name, cnt, self.batch_size, 1) + self.ts = currTs tdLog.info(f" insert data ok, child table={self.child_cnt} insert rows={cnt}") # insert same timestamp to all childs