Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
8ee09625
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看板
提交
8ee09625
编写于
7月 24, 2021
作者:
J
jiajingbin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add multi thread
上级
7b883b26
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
61 addition
and
7 deletion
+61
-7
tests/pytest/insert/schemalessInsert.py
tests/pytest/insert/schemalessInsert.py
+61
-7
未找到文件。
tests/pytest/insert/schemalessInsert.py
浏览文件 @
8ee09625
...
...
@@ -324,6 +324,13 @@ class TDTestCase:
tdSql
.
checkEqual
(
res_field_list_without_ts
,
expect_list
[
1
])
tdSql
.
checkEqual
(
res_type_list
,
expect_list
[
2
])
def
cleanStb
(
self
):
query_sql
=
"show stables"
res_row_list
=
self
.
resHandle
(
query_sql
,
True
)[
0
]
print
(
res_row_list
)
for
stb
in
res_row_list
:
tdSql
.
execute
(
f
'drop table if exists
{
stb
}
'
)
def
initCheckCase
(
self
):
"""
normal tags and cols, one for every elm
...
...
@@ -838,7 +845,7 @@ class TDTestCase:
code
=
self
.
_conn
.
insertLines
(
lines
)
# tdSql.checkEqual(code, 0)
def
genSqlList
(
self
,
count
=
5
):
def
genSqlList
(
self
,
count
=
5
,
stb_name
=
""
,
tb_name
=
""
):
"""
stb --> supertable
tb --> table
...
...
@@ -856,9 +863,9 @@ class TDTestCase:
s_stb_s_tb_m_col_m_tag_list
=
list
()
for
i
in
range
(
count
):
d_stb_d_tb_list
.
append
(
self
.
genFullTypeSql
(
t0
=
"f"
,
c0
=
"f"
))
s_stb_s_tb_list
.
append
(
self
.
genFullTypeSql
(
t7
=
f
'"
{
self
.
getLongName
(
8
,
"letters"
)
}
"'
,
c7
=
f
'
{
self
.
getLongName
(
8
,
"letters"
)
}
"'
))
s_stb_s_tb_a_col_a_tag_list
.
append
(
self
.
genFullTypeSql
(
t7
=
f
'"
{
self
.
getLongName
(
8
,
"letters"
)
}
"'
,
c7
=
f
'
{
self
.
getLongName
(
8
,
"letters"
)
}
"'
,
ct_add_tag
=
True
))
s_stb_s_tb_m_col_m_tag_list
.
append
(
self
.
genFullTypeSql
(
t7
=
f
'"
{
self
.
getLongName
(
8
,
"letters"
)
}
"'
,
c7
=
f
'
{
self
.
getLongName
(
8
,
"letters"
)
}
"'
,
ct_min_tag
=
True
))
s_stb_s_tb_list
.
append
(
self
.
genFullTypeSql
(
stb_name
=
stb_name
,
tb_name
=
tb_name
,
t7
=
f
'"
{
self
.
getLongName
(
8
,
"letters"
)
}
"'
,
c7
=
f
'
{
self
.
getLongName
(
8
,
"letters"
)
}
"'
))
s_stb_s_tb_a_col_a_tag_list
.
append
(
self
.
genFullTypeSql
(
stb_name
=
stb_name
,
tb_name
=
tb_name
,
t7
=
f
'"
{
self
.
getLongName
(
8
,
"letters"
)
}
"'
,
c7
=
f
'
{
self
.
getLongName
(
8
,
"letters"
)
}
"'
,
ct_add_tag
=
True
))
s_stb_s_tb_m_col_m_tag_list
.
append
(
self
.
genFullTypeSql
(
stb_name
=
stb_name
,
tb_name
=
tb_name
,
t7
=
f
'"
{
self
.
getLongName
(
8
,
"letters"
)
}
"'
,
c7
=
f
'
{
self
.
getLongName
(
8
,
"letters"
)
}
"'
,
ct_min_tag
=
True
))
return
d_stb_d_tb_list
,
s_stb_s_tb_list
,
s_stb_s_tb_a_col_a_tag_list
,
s_stb_s_tb_m_col_m_tag_list
def
genMultiThreadSeq
(
self
,
sql_list
):
...
...
@@ -872,21 +879,66 @@ class TDTestCase:
for
t
in
tlist
:
t
.
start
()
for
t
in
tlist
:
t
list
[
t
]
.
join
()
t
.
join
()
def
stbInsertMultiThreadCheckCase
(
self
):
"""
thread input different stb
"""
input_sql
=
self
.
genSqlList
()[
0
]
print
(
input_sql
)
self
.
multiThreadRun
(
self
.
genMultiThreadSeq
(
input_sql
))
tdSql
.
query
(
f
"show tables;"
)
tdSql
.
checkRows
(
5
)
def
sStbStbDdataInsertMultiThreadCheckCase
(
self
):
"""
thread input same stb tb, different data, result keep first data
"""
input_sql
,
stb_name
,
tb_name
=
self
.
genFullTypeSql
(
tb_name
=
self
.
getLongName
(
10
,
"letters"
))
self
.
resCmp
(
input_sql
,
stb_name
)
s_stb_s_tb_list
=
self
.
genSqlList
(
stb_name
=
stb_name
,
tb_name
=
tb_name
)[
1
]
self
.
multiThreadRun
(
self
.
genMultiThreadSeq
(
s_stb_s_tb_list
))
tdSql
.
query
(
f
"show tables;"
)
tdSql
.
checkRows
(
1
)
expected_tb_name
=
self
.
getNoIdTbName
(
stb_name
)[
0
]
tdSql
.
checkEqual
(
tb_name
,
expected_tb_name
)
def
sStbStbDdataAtcInsertMultiThreadCheckCase
(
self
):
"""
thread input same stb tb, different data, add columes and tags, result keep first data
"""
input_sql
,
stb_name
,
tb_name
=
self
.
genFullTypeSql
(
tb_name
=
self
.
getLongName
(
10
,
"letters"
))
self
.
resCmp
(
input_sql
,
stb_name
)
s_stb_s_tb_a_col_a_tag_list
=
self
.
genSqlList
(
stb_name
=
stb_name
,
tb_name
=
tb_name
)[
2
]
print
(
s_stb_s_tb_a_col_a_tag_list
)
self
.
multiThreadRun
(
self
.
genMultiThreadSeq
(
s_stb_s_tb_a_col_a_tag_list
))
tdSql
.
query
(
f
"show tables;"
)
tdSql
.
checkRows
(
1
)
expected_tb_name
=
self
.
getNoIdTbName
(
stb_name
)[
0
]
tdSql
.
checkEqual
(
tb_name
,
expected_tb_name
)
def
sStbStbDdataMtcInsertMultiThreadCheckCase
(
self
):
"""
thread input same stb tb, different data, add columes and tags, result keep first data
"""
self
.
cleanStb
()
input_sql
,
stb_name
,
tb_name
=
self
.
genFullTypeSql
(
tb_name
=
self
.
getLongName
(
10
,
"letters"
))
self
.
resCmp
(
input_sql
,
stb_name
)
s_stb_s_tb_m_col_m_tag_list
=
self
.
genSqlList
(
stb_name
=
stb_name
,
tb_name
=
tb_name
)[
3
]
print
(
s_stb_s_tb_m_col_m_tag_list
)
self
.
multiThreadRun
(
self
.
genMultiThreadSeq
(
s_stb_s_tb_m_col_m_tag_list
))
tdSql
.
query
(
f
"show tables;"
)
tdSql
.
checkRows
(
1
)
expected_tb_name
=
self
.
getNoIdTbName
(
stb_name
)[
0
]
tdSql
.
checkEqual
(
tb_name
,
expected_tb_name
)
def
run
(
self
):
print
(
"running {}"
.
format
(
__file__
))
tdSql
.
execute
(
"drop database if exists test"
)
tdSql
.
execute
(
"create database if not exists test precision 'us'"
)
tdSql
.
execute
(
'use test'
)
# tdSql.execute("create table super_table_cname_check (ts timestamp, pi1 int, pi2 bigint, pf1 float, pf2 double, ps1 binary(10), pi3 smallint, pi4 tinyint, pb1 bool, ps2 nchar(20)) tags (si1 int, si2 bigint, sf1 float, sf2 double, ss1 binary(10), si3 smallint, si4 tinyint, sb1 bool, ss2 nchar(20));")
# tdSql.execute('create table st1 using super_table_cname_check tags (1, 2, 1.1, 2.2, "a", 1, 1, true, "aa");')
# tdSql.execute('insert into st1 values (now, 1, 2, 1.1, 2.2, "a", 1, 1, true, "aa");')
...
...
@@ -931,7 +983,9 @@ class TDTestCase:
# self.batchErrorInsertCheckCase()
self
.
stbInsertMultiThreadCheckCase
()
# self.sStbStbDdataInsertMultiThreadCheckCase()
# self.sStbStbDdataAtcInsertMultiThreadCheckCase()
self
.
sStbStbDdataMtcInsertMultiThreadCheckCase
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录