提交 d01ea301 编写于 作者: haoranc's avatar haoranc

[TD-4290]<test>: modify testcase that compact wal file

上级 17077cb9
......@@ -44,6 +44,8 @@ class TDTestCase:
return buildPath
def run(self):
# set path para
buildPath = self.getBuildPath()
if (buildPath == ""):
tdLog.exit("taosd not found!")
......@@ -52,7 +54,8 @@ class TDTestCase:
binPath = buildPath+ "/build/bin/"
testPath = buildPath[:buildPath.find("debug")]
walFilePath = testPath + "/sim/dnode1/data/mnode_bak/wal/"
#new db and insert data
os.system("rm -rf %s/sim/dnode1/data/mnode_tmp/" % testPath)
os.system("rm -rf %s/sim/dnode1/data/mnode_bak/" % testPath)
......@@ -77,20 +80,22 @@ class TDTestCase:
tdSql.execute("alter table stb2_0 add column col2 binary(4)")
tdSql.execute("alter table stb2_0 drop column col1")
tdSql.execute("insert into stb2_0 values(1614218422000,8638,'R')")
# stop taosd and compact wal file
tdDnodes.stop(1)
sleep(10)
os.system("nohup %s/taosd --compact-mnode-wal -c %s/sim/dnode1/cfg/ & " %(binPath,testPath) )
# os.system("nohup taosd --compact-mnode-wal -c %s/sim/dnode1/cfg/ & " % testPath )
sleep(5)
# tdDnodes.start(1)
os.system("nohup %s/taosd -c %s/sim/dnode1/cfg > /dev/null 2>&1 &" %(binPath,testPath) )
sleep(4)
assert os.path.exists(walFilePath) , "%s is not generated, compact didn't take effect " % walFilePath
# use new wal file to start taosd
tdDnodes.start(1)
sleep(5)
tdSql.execute("reset query cache")
query_pid2 = int(subprocess.getstatusoutput('ps aux|grep taosd |grep -v "grep"|awk \'{print $2}\'')[1])
print(query_pid2)
# use new wal file to start up tasod
# verify that the data is correct
tdSql.execute("use db2")
tdSql.query("select count (tbname) from stb0")
tdSql.checkData(0, 0, 1)
......
......@@ -54,8 +54,9 @@ class TwoClients:
else:
tdLog.info("taosd found in %s" % buildPath)
binPath = buildPath+ "/build/bin/"
# query data from cluster'db
walFilePath = "/var/lib/taos/mnode_bak/wal/"
# new taos client
conn1 = taos.connect(host=self.host, user=self.user, password=self.password, config=self.config )
print(conn1)
cur1 = conn1.cursor()
......@@ -95,13 +96,14 @@ class TwoClients:
# stop taosd and compact wal file
os.system("ps -ef |grep taosd |grep -v 'grep' |awk '{print $2}'|xargs kill -9")
sleep(2)
os.system("nohup taosd --compact-mnode-wal -c /etc/taos/taos.cfg & ")
os.system("nohup taosd --compact-mnode-wal -c /etc/taos & ")
sleep(5)
os.system("nohup /usr/bin/taosd > /dev/null 2>&1 &")
sleep(4)
tdSql.execute("reset query cache")
query_pid2 = int(subprocess.getstatusoutput('ps aux|grep taosd |grep -v "grep"|awk \'{print $2}\'')[1])
print(query_pid2)
assert os.path.exists(walFilePath) , "%s is not generated " % walFilePath
# use new wal file to start up tasod
tdSql.execute("use db2")
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册