Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
1366aa7a
T
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1193
Star
22019
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
1366aa7a
编写于
8月 21, 2023
作者:
S
slzhou
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
enhance: compact time range - add test case
上级
258cea30
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
159 addition
and
0 deletion
+159
-0
tests/parallel_test/cases.task
tests/parallel_test/cases.task
+1
-0
tests/pytest/functions/compactVnodes.py
tests/pytest/functions/compactVnodes.py
+158
-0
未找到文件。
tests/parallel_test/cases.task
浏览文件 @
1366aa7a
...
...
@@ -803,6 +803,7 @@
4,,pytest,python3 test.py -f insert/alterTableAndInsert.py
4,,pytest,python3 test.py -f import_merge/importHeadPartOverlap.py
4,,pytest,python3 test.py -f functions/function_stddev_td2555.py
4,,pytest,python3 test.py -f functions/compactVnodes.py
4,,pytest,python3 test.py -f dbmgmt/nanoSecondCheck.py
4,,pytest,python3 bug2265.py
4,,pytest,python3 test.py -f alter/alterTabAddTagWithNULL.py
...
...
tests/pytest/functions/compactVnodes.py
0 → 100644
浏览文件 @
1366aa7a
###################################################################
# Copyright (c) 2016 by TAOS Technologies, Inc.
# All rights reserved.
#
# This file is proprietary and confidential to TAOS Technologies.
# No part of this file may be reproduced, stored, transmitted,
# disclosed or used in any form or by any means other than as
# expressly provided by the written permission from Jianhui Tao
#
###################################################################
# -*- coding: utf-8 -*-
import
sys
import
subprocess
import
random
import
math
import
numpy
as
np
import
inspect
from
util.log
import
*
from
util.cases
import
*
from
util.sql
import
*
from
util.dnodes
import
*
class
TDTestCase
:
def
init
(
self
,
conn
,
logSql
):
tdLog
.
debug
(
f
"start to execute
{
__file__
}
"
)
tdSql
.
init
(
conn
.
cursor
(),
logSql
)
def
getBuildPath
(
self
)
->
str
:
selfPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
if
(
"community"
in
selfPath
):
projPath
=
selfPath
[:
selfPath
.
find
(
"community"
)]
else
:
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
if
(
"taosd"
in
files
):
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
if
(
"packaging"
not
in
rootRealPath
):
buildPath
=
root
[:
len
(
root
)
-
len
(
"/debug/build/bin"
)]
break
return
buildPath
def
getCfgDir
(
self
)
->
str
:
selfPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
if
(
"community"
in
selfPath
):
cfgDir
=
self
.
getBuildPath
()
+
"/community/sim/dnode1/cfg"
else
:
cfgDir
=
self
.
getBuildPath
()
+
"/sim/dnode1/cfg"
return
cfgDir
def
getCfgFile
(
self
)
->
str
:
return
self
.
getCfgDir
()
+
"/taos.cfg"
def
compactVnodes
(
self
):
cfg
=
{
'minRowsPerFileBlock'
:
'10'
,
'maxRowsPerFileBlock'
:
'200'
,
'minRows'
:
'10'
,
'maxRows'
:
'200'
,
'maxVgroupsPerDb'
:
'100'
,
'maxTablesPerVnode'
:
'1200'
,
}
tdSql
.
execute
(
"drop database if exists db"
)
tdSql
.
execute
(
"create database if not exists db keep 3650 blocks 3 minrows 10 maxrows 200"
)
tdSql
.
execute
(
"use db"
)
tdSql
.
execute
(
"create stable db.stb1 (ts timestamp, c1 int) tags(t1 int)"
)
nowtime
=
int
(
round
(
time
.
time
()
*
1000
))
for
i
in
range
(
100
):
tdSql
.
execute
(
f
"create table db.t1
{
i
}
using db.stb1 tags(
{
i
}
)"
)
sql
=
f
"insert into db.t1
{
i
}
values"
for
j
in
range
(
36
):
sql
+=
f
"(
{
nowtime
-
1000
*
i
-
j
}
,
{
i
+
j
}
)"
tdSql
.
execute
(
sql
)
tdSql
.
query
(
"show vgroups"
)
index
=
tdSql
.
getData
(
0
,
0
)
tdSql
.
checkData
(
0
,
6
,
0
)
tdSql
.
execute
(
f
"compact vnodes in(
{
index
}
) start with now-10s end with now+5s"
)
start_time
=
time
.
time
()
while
True
:
tdSql
.
query
(
"show vgroups"
)
if
tdSql
.
getData
(
0
,
6
)
==
0
:
break
else
:
time
.
sleep
(
0.1
)
run_time
=
time
.
time
()
-
start_time
printf
(
f
"it takes $
{
run_time
}
seconds"
)
tdSql
.
query
(
"show vgroups"
)
index
=
tdSql
.
getData
(
0
,
0
)
tdSql
.
checkData
(
0
,
6
,
0
)
tdSql
.
execute
(
f
"compact vnodes in(
{
index
}
) start with now-100s"
)
start_time
=
time
.
time
()
while
True
:
tdSql
.
query
(
"show vgroups"
)
if
tdSql
.
getData
(
0
,
6
)
==
0
:
break
else
:
time
.
sleep
(
0.1
)
run_time
=
time
.
time
()
-
start_time
printf
(
f
"it takes $
{
run_time
}
seconds"
)
tdSql
.
query
(
"show vgroups"
)
index
=
tdSql
.
getData
(
0
,
0
)
tdSql
.
checkData
(
0
,
6
,
0
)
tdSql
.
execute
(
f
"compact vnodes in(
{
index
}
) end with now-10s"
)
start_time
=
time
.
time
()
while
True
:
tdSql
.
query
(
"show vgroups"
)
if
tdSql
.
getData
(
0
,
6
)
==
0
:
break
else
:
time
.
sleep
(
0.1
)
run_time
=
time
.
time
()
-
start_time
printf
(
f
"it takes $
{
run_time
}
seconds"
)
tdSql
.
query
(
"show vgroups"
)
index
=
tdSql
.
getData
(
0
,
0
)
tdSql
.
checkData
(
0
,
6
,
0
)
tdSql
.
execute
(
f
"compact vnodes in(
{
index
}
)"
)
start_time
=
time
.
time
()
while
True
:
tdSql
.
query
(
"show vgroups"
)
if
tdSql
.
getData
(
0
,
6
)
==
0
:
break
else
:
time
.
sleep
(
0.1
)
run_time
=
time
.
time
()
-
start_time
printf
(
f
"it takes $
{
run_time
}
seconds"
)
pass
def
run
(
self
):
self
.
compactVnodes
();
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
f
"
{
__file__
}
successfully executed"
)
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录