Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
11953701
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
11953701
编写于
6月 02, 2021
作者:
haoranc
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-4290]<test>: modify testcase that compact wal file
上级
3c2681fa
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
53 addition
and
26 deletion
+53
-26
tests/pytest/wal/sdbComp.py
tests/pytest/wal/sdbComp.py
+14
-14
tests/pytest/wal/sdbCompCluster.py
tests/pytest/wal/sdbCompCluster.py
+39
-12
未找到文件。
tests/pytest/wal/sdbComp.py
浏览文件 @
11953701
...
@@ -11,6 +11,7 @@
...
@@ -11,6 +11,7 @@
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
from
distutils.log
import
debug
import
sys
import
sys
import
os
import
os
import
taos
import
taos
...
@@ -18,6 +19,7 @@ from util.log import *
...
@@ -18,6 +19,7 @@ from util.log import *
from
util.cases
import
*
from
util.cases
import
*
from
util.sql
import
*
from
util.sql
import
*
from
util.dnodes
import
*
from
util.dnodes
import
*
import
subprocess
class
TDTestCase
:
class
TDTestCase
:
...
@@ -27,7 +29,7 @@ class TDTestCase:
...
@@ -27,7 +29,7 @@ class TDTestCase:
def
getBuildPath
(
self
):
def
getBuildPath
(
self
):
selfPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
selfPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
if
(
"community"
in
selfPath
):
if
(
"community"
in
selfPath
):
projPath
=
selfPath
[:
selfPath
.
find
(
"community"
)]
projPath
=
selfPath
[:
selfPath
.
find
(
"community"
)]
else
:
else
:
...
@@ -47,11 +49,13 @@ class TDTestCase:
...
@@ -47,11 +49,13 @@ class TDTestCase:
tdLog
.
exit
(
"taosd not found!"
)
tdLog
.
exit
(
"taosd not found!"
)
else
:
else
:
tdLog
.
info
(
"taosd found in %s"
%
buildPath
)
tdLog
.
info
(
"taosd found in %s"
%
buildPath
)
binPath
=
buildPath
+
"/build/bin/"
binPath
=
buildPath
+
"/build/bin/"
testPath
=
buildPath
[:
buildPath
.
find
(
"debug"
)]
#new db and insert data
#new db and insert data
os
.
system
(
"rm -rf
/home/chr/TDengine/sim/dnode1/data/mnode_tmp/"
)
os
.
system
(
"rm -rf
%s/sim/dnode1/data/mnode_tmp/"
%
testPath
)
os
.
system
(
"rm -rf
/home/chr/TDengine/sim/dnode1/data/mnode_bak/"
)
os
.
system
(
"rm -rf
%s/sim/dnode1/data/mnode_bak/"
%
testPath
)
tdSql
.
execute
(
"drop database if exists db2"
)
tdSql
.
execute
(
"drop database if exists db2"
)
os
.
system
(
"%staosdemo -f wal/insertDataDb1.json -y "
%
binPath
)
os
.
system
(
"%staosdemo -f wal/insertDataDb1.json -y "
%
binPath
)
tdSql
.
execute
(
"drop database if exists db1"
)
tdSql
.
execute
(
"drop database if exists db1"
)
...
@@ -73,23 +77,19 @@ class TDTestCase:
...
@@ -73,23 +77,19 @@ class TDTestCase:
tdSql
.
execute
(
"alter table stb2_0 add column col2 binary(4)"
)
tdSql
.
execute
(
"alter table stb2_0 add column col2 binary(4)"
)
tdSql
.
execute
(
"alter table stb2_0 drop column col1"
)
tdSql
.
execute
(
"alter table stb2_0 drop column col1"
)
tdSql
.
execute
(
"insert into stb2_0 values(1614218422000,8638,'R')"
)
tdSql
.
execute
(
"insert into stb2_0 values(1614218422000,8638,'R')"
)
# stop taosd and compact wal file
# stop taosd and compact wal file
os
.
system
(
"ps -ef |grep taosd |grep -v 'grep' |awk '{print $2}'|xargs kill -9"
)
tdDnodes
.
stop
(
1
)
sleep
(
2
)
sleep
(
10
)
# os.system("nohup taosd --compact-mnode-wal -c /home/chr/TDengine/sim/dnode1/cfg/ & ")
os
.
system
(
"nohup %s/taosd --compact-mnode-wal -c %s/sim/dnode1/cfg/ & "
%
(
binPath
,
testPath
)
)
sleep
(
5
)
# os.system("nohup taosd --compact-mnode-wal -c %s/sim/dnode1/cfg/ & " % testPath )
os
.
system
(
"nohup /home/chr/TDengine/debug/build/bin/taosd -c /home/chr/TDengine/sim/dnode1/cfg > /dev/null 2>&1 &"
)
# tdDnodes.start(1)
os
.
system
(
"nohup %s/taosd -c %s/sim/dnode1/cfg > /dev/null 2>&1 &"
%
(
binPath
,
testPath
)
)
sleep
(
4
)
sleep
(
4
)
tdSql
.
execute
(
"reset query cache"
)
tdSql
.
execute
(
"reset query cache"
)
query_pid2
=
int
(
subprocess
.
getstatusoutput
(
'ps aux|grep taosd |grep -v "grep"|awk
\'
{print $2}
\'
'
)[
1
])
query_pid2
=
int
(
subprocess
.
getstatusoutput
(
'ps aux|grep taosd |grep -v "grep"|awk
\'
{print $2}
\'
'
)[
1
])
print
(
query_pid2
)
print
(
query_pid2
)
# use new wal file to start up tasod
# use new wal file to start up tasod
# conn1 = taos.connect(host="chenhaoran02", user="root", password="taosdata", config="/home/chr/TDengine/sim/dnode1/cfg/" )
# cur1 = conn1.cursor()
# tdSql.init(cur1, True)
tdSql
.
execute
(
"use db2"
)
tdSql
.
execute
(
"use db2"
)
tdSql
.
query
(
"select count (tbname) from stb0"
)
tdSql
.
query
(
"select count (tbname) from stb0"
)
tdSql
.
checkData
(
0
,
0
,
1
)
tdSql
.
checkData
(
0
,
0
,
1
)
...
...
tests/pytest/wal/sdbCompCluster.py
浏览文件 @
11953701
...
@@ -23,7 +23,7 @@ import threading
...
@@ -23,7 +23,7 @@ import threading
class
TwoClients
:
class
TwoClients
:
def
initConnection
(
self
):
def
initConnection
(
self
):
self
.
host
=
"chenhaoran0
1
"
self
.
host
=
"chenhaoran0
2
"
self
.
user
=
"root"
self
.
user
=
"root"
self
.
password
=
"taosdata"
self
.
password
=
"taosdata"
self
.
config
=
"/etc/taos/"
self
.
config
=
"/etc/taos/"
...
@@ -61,34 +61,61 @@ class TwoClients:
...
@@ -61,34 +61,61 @@ class TwoClients:
cur1
=
conn1
.
cursor
()
cur1
=
conn1
.
cursor
()
tdSql
.
init
(
cur1
,
True
)
tdSql
.
init
(
cur1
,
True
)
# tdSql.init(cur2, True)
# tdSql.init(cur2, True)
# new db and insert data
os
.
system
(
"rm -rf /var/lib/taos/mnode_bak/"
)
os
.
system
(
"rm -rf /var/lib/taos/mnode_temp/"
)
tdSql
.
execute
(
"drop database if exists db2"
)
os
.
system
(
"%staosdemo -f wal/insertDataDb1.json -y "
%
binPath
)
os
.
system
(
"%staosdemo -f wal/insertDataDb1.json -y "
%
binPath
)
tdSql
.
execute
(
"drop database if exists db1"
)
tdSql
.
execute
(
"drop database if exists db1"
)
os
.
system
(
"%staosdemo -f wal/insertDataDb2.json -y "
%
binPath
)
os
.
system
(
"%staosdemo -f wal/insertDataDb2.json -y "
%
binPath
)
tdSql
.
execute
(
"drop table if exists db2.stb0"
)
tdSql
.
execute
(
"drop table if exists db2.stb0"
)
os
.
system
(
"%staosdemo -f wal/insertDataDb2Newstab.json -y "
%
binPath
)
os
.
system
(
"%staosdemo -f wal/insertDataDb2Newstab.json -y "
%
binPath
)
query_pid1
=
int
(
subprocess
.
getstatusoutput
(
'ps aux|grep taosd |grep -v "grep"|awk
\'
{print $2}
\'
'
)[
1
])
print
(
query_pid1
)
tdSql
.
execute
(
"use db2"
)
tdSql
.
execute
(
"drop table if exists stb1_0"
)
tdSql
.
execute
(
"drop table if exists stb1_1"
)
tdSql
.
execute
(
"insert into stb0_0 values(1614218412000,8637,78.861045,'R','bf3')(1614218422000,8637,98.861045,'R','bf3')"
)
tdSql
.
execute
(
"alter table db2.stb0 add column col4 int"
)
tdSql
.
execute
(
"alter table db2.stb0 add column col4 int"
)
tdSql
.
execute
(
"alter table db2.stb0 drop column col2"
)
tdSql
.
execute
(
"alter table db2.stb0 drop column col2"
)
os
.
system
(
"ps -ef |grep taosd |grep -v 'grep' |awk '{print $2}'|xargs kill -9"
)
tdSql
.
execute
(
"alter table db2.stb0 add tag t3 int"
)
os
.
system
(
"nohup taosd --compact-mnode-wal & "
)
tdSql
.
execute
(
"alter table db2.stb0 drop tag t1"
)
sleep
(
5
)
tdSql
.
execute
(
"create table if not exists stb2_0 (ts timestamp, col0 int, col1 float) "
)
os
.
system
(
"nohup /usr/bin/taosd > /dev/null 2>&1 &"
)
tdSql
.
execute
(
"insert into stb2_0 values(1614218412000,8637,78.861045)"
)
sleep
(
10
)
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')"
)
conn2
=
taos
.
connect
(
host
=
self
.
host
,
user
=
self
.
user
,
password
=
self
.
password
,
config
=
self
.
config
)
conn2
=
taos
.
connect
(
host
=
self
.
host
,
user
=
self
.
user
,
password
=
self
.
password
,
config
=
self
.
config
)
print
(
conn2
)
print
(
conn2
)
cur2
=
conn2
.
cursor
()
cur2
=
conn2
.
cursor
()
tdSql
.
init
(
cur2
,
True
)
tdSql
.
init
(
cur2
,
True
)
# 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 & "
)
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
)
# use new wal file to start up tasod
tdSql
.
execute
(
"use db2"
)
tdSql
.
execute
(
"use db2"
)
tdSql
.
query
(
"select count (tbname) from stb0"
)
tdSql
.
query
(
"select count (tbname) from stb0"
)
tdSql
.
checkData
(
0
,
0
,
1
)
tdSql
.
checkData
(
0
,
0
,
1
)
tdSql
.
query
(
"select count (tbname) from stb1"
)
tdSql
.
query
(
"select count (tbname) from stb1"
)
tdSql
.
checkRows
(
0
)
tdSql
.
query
(
"select count(*) from stb0_0"
)
tdSql
.
checkData
(
0
,
0
,
2
)
tdSql
.
checkData
(
0
,
0
,
2
)
tdSql
.
query
(
"select count(*) from stb00_0"
)
tdSql
.
checkData
(
0
,
0
,
1
)
tdSql
.
query
(
"select count(*) from stb0"
)
tdSql
.
query
(
"select count(*) from stb0"
)
tdSql
.
checkData
(
0
,
0
,
1
)
tdSql
.
checkData
(
0
,
0
,
2
)
tdSql
.
query
(
"select count(*) from stb
1
"
)
tdSql
.
query
(
"select count(*) from stb
2_0
"
)
tdSql
.
checkData
(
0
,
0
,
2
0
)
tdSql
.
checkData
(
0
,
0
,
2
)
clients
=
TwoClients
()
clients
=
TwoClients
()
clients
.
initConnection
()
clients
.
initConnection
()
# clients.getBuildPath()
# clients.getBuildPath()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录