未验证 提交 86b09819 编写于 作者: sangshuduo's avatar sangshuduo 提交者: GitHub

[TD-13052]<feature>: taosdump prepare for 3.0 (#11125)

* [TD-13052]<feature>: taosdump prepare for 3.0

for 2.4

* update taos-tools

for 2.4

* add -y -g in tests/pytest/tools/taosdumpTestNanoSupport.py
上级 b5033b4c
Subproject commit 8145dd1713ab9e7652ea621ca7e6895fd0b21d65
Subproject commit 33cdfe4f90a209f105c1b6091439798a9cde1e93
......@@ -35,7 +35,7 @@ class TDTestCase:
else:
return True
def getBuildPath(self):
def getPath(self, tool="taosdump"):
selfPath = os.path.dirname(os.path.realpath(__file__))
if ("community" in selfPath):
......@@ -43,13 +43,14 @@ class TDTestCase:
else:
projPath = selfPath[:selfPath.find("tests")]
paths = []
for root, dirs, files in os.walk(projPath):
if ("taosdump" in files):
if ((tool) in files):
rootRealPath = os.path.dirname(os.path.realpath(root))
if ("packaging" not in rootRealPath):
buildPath = root[:len(root) - len("/build/bin")]
paths.append(os.path.join(root, tool))
break
return buildPath
return paths[0]
def run(self):
if not os.path.exists("./taosdumptest/tmp1"):
......@@ -78,16 +79,15 @@ class TDTestCase:
sql += "(%d, %d, 'nchar%d')" % (currts + i, i % 100, i % 100)
tdSql.execute(sql)
buildPath = self.getBuildPath()
if (buildPath == ""):
binPath = self.getPath()
if (binPath == ""):
tdLog.exit("taosdump not found!")
else:
tdLog.info("taosdump found in %s" % buildPath)
binPath = buildPath + "/build/bin/"
tdLog.info("taosdump found: %s" % binPath)
os.system("%staosdump --databases db -o ./taosdumptest/tmp1" % binPath)
os.system("%s -y --databases db -o ./taosdumptest/tmp1" % binPath)
os.system(
"%staosdump --databases db1 -o ./taosdumptest/tmp2" %
"%s -y --databases db1 -o ./taosdumptest/tmp2" %
binPath)
tdSql.execute("drop database db")
......@@ -95,8 +95,8 @@ class TDTestCase:
tdSql.query("show databases")
tdSql.checkRows(0)
os.system("%staosdump -i ./taosdumptest/tmp1" % binPath)
os.system("%staosdump -i ./taosdumptest/tmp2" % binPath)
os.system("%s -i ./taosdumptest/tmp1" % binPath)
os.system("%s -i ./taosdumptest/tmp2" % binPath)
tdSql.execute("use db")
tdSql.query("show databases")
......@@ -168,9 +168,10 @@ class TDTestCase:
tdSql.query("show stables")
tdSql.checkRows(2)
os.system(
"%staosdump --databases db12312313231231321312312312_323 -o ./taosdumptest/tmp1" % binPath)
"%s -y --databases db12312313231231321312312312_323 -o ./taosdumptest/tmp1" %
binPath)
tdSql.execute("drop database db12312313231231321312312312_323")
os.system("%staosdump -i ./taosdumptest/tmp1" % binPath)
os.system("%s -i ./taosdumptest/tmp1" % binPath)
tdSql.execute("use db12312313231231321312312312_323")
tdSql.query("show stables")
tdSql.checkRows(2)
......
......@@ -35,7 +35,7 @@ class TDTestCase:
else:
return True
def getBuildPath(self):
def getPath(self, tool="taosdump"):
selfPath = os.path.dirname(os.path.realpath(__file__))
if ("community" in selfPath):
......@@ -43,13 +43,14 @@ class TDTestCase:
else:
projPath = selfPath[:selfPath.find("tests")]
paths = []
for root, dirs, files in os.walk(projPath):
if ("taosd" in files):
if ((tool) in files):
rootRealPath = os.path.dirname(os.path.realpath(root))
if ("packaging" not in rootRealPath):
buildPath = root[:len(root) - len("/build/bin")]
paths.append(os.path.join(root, tool))
break
return buildPath
return paths[0]
def createdb(self, precision="ns"):
tb_nums = self.numberOfTables
......@@ -118,12 +119,11 @@ class TDTestCase:
if not os.path.exists("./taosdumptest/dumptmp3"):
os.makedirs("./taosdumptest/dumptmp3")
buildPath = self.getBuildPath()
if (buildPath == ""):
binPath = self.getPath("taosdump")
if (binPath == ""):
tdLog.exit("taosdump not found!")
else:
tdLog.info("taosdump found in %s" % buildPath)
binPath = buildPath + "/build/bin/"
tdLog.info("taosdump found: %s" % binPath)
# create nano second database
......@@ -132,31 +132,31 @@ class TDTestCase:
# dump all data
os.system(
"%staosdump --databases timedb1 -o ./taosdumptest/dumptmp1" %
"%s -y -g --databases timedb1 -o ./taosdumptest/dumptmp1" %
binPath)
# dump part data with -S -E
os.system(
'%staosdump --databases timedb1 -S 1625068810000000000 -E 1625068860000000000 -o ./taosdumptest/dumptmp2 ' %
'%s -y -g --databases timedb1 -S 1625068810000000000 -E 1625068860000000000 -o ./taosdumptest/dumptmp2 ' %
binPath)
os.system(
'%staosdump --databases timedb1 -S 1625068810000000000 -o ./taosdumptest/dumptmp3 ' %
'%s -y -g --databases timedb1 -S 1625068810000000000 -o ./taosdumptest/dumptmp3 ' %
binPath)
tdSql.execute("drop database timedb1")
os.system("%staosdump -i ./taosdumptest/dumptmp2" % binPath)
os.system("%s -i ./taosdumptest/dumptmp2" % binPath)
# dump data and check for taosdump
tdSql.query("select count(*) from timedb1.st")
tdSql.checkData(0, 0, 510)
tdSql.execute("drop database timedb1")
os.system("%staosdump -i ./taosdumptest/dumptmp3" % binPath)
os.system("%s -i ./taosdumptest/dumptmp3" % binPath)
# dump data and check for taosdump
tdSql.query("select count(*) from timedb1.st")
tdSql.checkData(0, 0, 900)
tdSql.execute("drop database timedb1")
os.system("%staosdump -i ./taosdumptest/dumptmp1" % binPath)
os.system("%s -i ./taosdumptest/dumptmp1" % binPath)
# dump data and check for taosdump
tdSql.query("select count(*) from timedb1.st")
tdSql.checkData(0, 0, 1000)
......@@ -164,7 +164,7 @@ class TDTestCase:
# check data
origin_res = tdSql.getResult("select * from timedb1.st")
tdSql.execute("drop database timedb1")
os.system("%staosdump -i ./taosdumptest/dumptmp1" % binPath)
os.system("%s -i ./taosdumptest/dumptmp1" % binPath)
# dump data and check for taosdump
dump_res = tdSql.getResult("select * from timedb1.st")
if origin_res == dump_res:
......@@ -178,7 +178,6 @@ class TDTestCase:
os.system("rm -rf ./taosdumptest/")
tdSql.execute("drop database if exists timedb1")
if not os.path.exists("./taosdumptest/tmp1"):
os.makedirs("./taosdumptest/dumptmp1")
else:
......@@ -190,44 +189,43 @@ class TDTestCase:
if not os.path.exists("./taosdumptest/dumptmp3"):
os.makedirs("./taosdumptest/dumptmp3")
buildPath = self.getBuildPath()
if (buildPath == ""):
binPath = self.getPath()
if (binPath == ""):
tdLog.exit("taosdump not found!")
else:
tdLog.info("taosdump found in %s" % buildPath)
binPath = buildPath + "/build/bin/"
tdLog.info("taosdump found: %s" % binPath)
self.createdb(precision="us")
os.system(
"%staosdump --databases timedb1 -o ./taosdumptest/dumptmp1" %
"%s -y -g --databases timedb1 -o ./taosdumptest/dumptmp1" %
binPath)
os.system(
'%staosdump --databases timedb1 -S 1625068810000000 -E 1625068860000000 -o ./taosdumptest/dumptmp2 ' %
'%s -y -g --databases timedb1 -S 1625068810000000 -E 1625068860000000 -o ./taosdumptest/dumptmp2 ' %
binPath)
os.system(
'%staosdump --databases timedb1 -S 1625068810000000 -o ./taosdumptest/dumptmp3 ' %
'%s -y -g --databases timedb1 -S 1625068810000000 -o ./taosdumptest/dumptmp3 ' %
binPath)
os.system("%staosdump -i ./taosdumptest/dumptmp1" % binPath)
os.system("%staosdump -i ./taosdumptest/dumptmp2" % binPath)
os.system("%staosdump -i ./taosdumptest/dumptmp3" % binPath)
os.system("%s -i ./taosdumptest/dumptmp1" % binPath)
os.system("%s -i ./taosdumptest/dumptmp2" % binPath)
os.system("%s -i ./taosdumptest/dumptmp3" % binPath)
tdSql.execute("drop database timedb1")
os.system("%staosdump -i ./taosdumptest/dumptmp2" % binPath)
os.system("%s -i ./taosdumptest/dumptmp2" % binPath)
# dump data and check for taosdump
tdSql.query("select count(*) from timedb1.st")
tdSql.checkData(0, 0, 510)
tdSql.execute("drop database timedb1")
os.system("%staosdump -i ./taosdumptest/dumptmp3" % binPath)
os.system("%s -i ./taosdumptest/dumptmp3" % binPath)
# dump data and check for taosdump
tdSql.query("select count(*) from timedb1.st")
tdSql.checkData(0, 0, 900)
tdSql.execute("drop database timedb1")
os.system("%staosdump -i ./taosdumptest/dumptmp1" % binPath)
os.system("%s -i ./taosdumptest/dumptmp1" % binPath)
# dump data and check for taosdump
tdSql.query("select count(*) from timedb1.st")
tdSql.checkData(0, 0, 1000)
......@@ -235,7 +233,7 @@ class TDTestCase:
# check data
origin_res = tdSql.getResult("select * from timedb1.st")
tdSql.execute("drop database timedb1")
os.system("%staosdump -i ./taosdumptest/dumptmp1" % binPath)
os.system("%s -i ./taosdumptest/dumptmp1" % binPath)
# dump data and check for taosdump
dump_res = tdSql.getResult("select * from timedb1.st")
if origin_res == dump_res:
......@@ -260,44 +258,43 @@ class TDTestCase:
if not os.path.exists("./taosdumptest/dumptmp3"):
os.makedirs("./taosdumptest/dumptmp3")
buildPath = self.getBuildPath()
if (buildPath == ""):
binPath = self.getPath()
if (binPath == ""):
tdLog.exit("taosdump not found!")
else:
tdLog.info("taosdump found in %s" % buildPath)
binPath = buildPath + "/build/bin/"
tdLog.info("taosdump found: %s" % binPath)
self.createdb(precision="ms")
os.system(
"%staosdump --databases timedb1 -o ./taosdumptest/dumptmp1" %
"%s -y -g --databases timedb1 -o ./taosdumptest/dumptmp1" %
binPath)
os.system(
'%staosdump --databases timedb1 -S 1625068810000 -E 1625068860000 -o ./taosdumptest/dumptmp2 ' %
'%s -y -g --databases timedb1 -S 1625068810000 -E 1625068860000 -o ./taosdumptest/dumptmp2 ' %
binPath)
os.system(
'%staosdump --databases timedb1 -S 1625068810000 -o ./taosdumptest/dumptmp3 ' %
'%s -y -g --databases timedb1 -S 1625068810000 -o ./taosdumptest/dumptmp3 ' %
binPath)
os.system("%staosdump -i ./taosdumptest/dumptmp1" % binPath)
os.system("%staosdump -i ./taosdumptest/dumptmp2" % binPath)
os.system("%staosdump -i ./taosdumptest/dumptmp3" % binPath)
os.system("%s -i ./taosdumptest/dumptmp1" % binPath)
os.system("%s -i ./taosdumptest/dumptmp2" % binPath)
os.system("%s -i ./taosdumptest/dumptmp3" % binPath)
tdSql.execute("drop database timedb1")
os.system("%staosdump -i ./taosdumptest/dumptmp2" % binPath)
os.system("%s -i ./taosdumptest/dumptmp2" % binPath)
# dump data and check for taosdump
tdSql.query("select count(*) from timedb1.st")
tdSql.checkData(0, 0, 510)
tdSql.execute("drop database timedb1")
os.system("%staosdump -i ./taosdumptest/dumptmp3" % binPath)
os.system("%s -i ./taosdumptest/dumptmp3" % binPath)
# dump data and check for taosdump
tdSql.query("select count(*) from timedb1.st")
tdSql.checkData(0, 0, 900)
tdSql.execute("drop database timedb1")
os.system("%staosdump -i ./taosdumptest/dumptmp1" % binPath)
os.system("%s -i ./taosdumptest/dumptmp1" % binPath)
# dump data and check for taosdump
tdSql.query("select count(*) from timedb1.st")
tdSql.checkData(0, 0, 1000)
......@@ -305,11 +302,12 @@ class TDTestCase:
# check data
origin_res = tdSql.getResult("select * from timedb1.st")
tdSql.execute("drop database timedb1")
os.system("%staosdump -i ./taosdumptest/dumptmp1" % binPath)
os.system("%s -i ./taosdumptest/dumptmp1" % binPath)
# dump data and check for taosdump
dump_res = tdSql.getResult("select * from timedb1.st")
if origin_res == dump_res:
tdLog.info("test million second : dump check data pass for all data!")
tdLog.info(
"test million second : dump check data pass for all data!")
else:
tdLog.info(
"test million second : dump check data failed for all data!")
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册