Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
d3eaaab3
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
提交
d3eaaab3
编写于
5月 15, 2020
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'develop' into feature/2.0tsdb
上级
f617394f
ea099d2d
变更
26
展开全部
隐藏空白更改
内联
并排
Showing
26 changed file
with
1803 addition
and
202 deletion
+1803
-202
src/plugins/monitor/src/monitorMain.c
src/plugins/monitor/src/monitorMain.c
+5
-0
src/util/inc/tskiplist.h
src/util/inc/tskiplist.h
+5
-6
src/util/src/tskiplist.c
src/util/src/tskiplist.c
+139
-111
src/util/tests/skiplistTest.cpp
src/util/tests/skiplistTest.cpp
+39
-18
tests/pytest/dbmgmt/__init__.py
tests/pytest/dbmgmt/__init__.py
+0
-0
tests/pytest/dbmgmt/createTableAndDropDnodes.py
tests/pytest/dbmgmt/createTableAndDropDnodes.py
+151
-0
tests/pytest/dbmgmt/createTableAndKillDnodes.py
tests/pytest/dbmgmt/createTableAndKillDnodes.py
+172
-0
tests/pytest/dbmgmt/database-name-boundary.py
tests/pytest/dbmgmt/database-name-boundary.py
+70
-0
tests/pytest/dbmgmt/dropDB_memory_test.py
tests/pytest/dbmgmt/dropDB_memory_test.py
+67
-0
tests/pytest/fulltest.sh
tests/pytest/fulltest.sh
+8
-1
tests/pytest/insert/binary-boundary.py
tests/pytest/insert/binary-boundary.py
+148
-0
tests/pytest/insert/nchar-boundary.py
tests/pytest/insert/nchar-boundary.py
+65
-0
tests/pytest/insert/nchar-unicode.py
tests/pytest/insert/nchar-unicode.py
+660
-0
tests/pytest/query/query.py
tests/pytest/query/query.py
+1
-1
tests/pytest/stable/insert.py
tests/pytest/stable/insert.py
+1
-1
tests/pytest/table/tablename-boundary.py
tests/pytest/table/tablename-boundary.py
+46
-0
tests/pytest/tag_lite/create-tags-boundary.py
tests/pytest/tag_lite/create-tags-boundary.py
+66
-0
tests/pytest/tag_lite/datatype-without-alter.py
tests/pytest/tag_lite/datatype-without-alter.py
+98
-0
tests/pytest/test.py
tests/pytest/test.py
+0
-2
tests/pytest/util/dnodes.py
tests/pytest/util/dnodes.py
+4
-3
tests/script/jenkins/basic.txt
tests/script/jenkins/basic.txt
+6
-6
tests/script/unique/cluster/balance1.sim
tests/script/unique/cluster/balance1.sim
+4
-4
tests/script/unique/cluster/balance2.sim
tests/script/unique/cluster/balance2.sim
+6
-6
tests/script/unique/cluster/balance3.sim
tests/script/unique/cluster/balance3.sim
+4
-4
tests/script/unique/cluster/cache.sim
tests/script/unique/cluster/cache.sim
+14
-15
tests/script/unique/db/replica_add13.sim
tests/script/unique/db/replica_add13.sim
+24
-24
未找到文件。
src/plugins/monitor/src/monitorMain.c
浏览文件 @
d3eaaab3
...
...
@@ -109,6 +109,11 @@ static void monitorStartSystemRetry() {
}
static
void
monitorInitConn
(
void
*
para
,
void
*
unused
)
{
if
(
dnodeGetDnodeId
()
<=
0
)
{
monitorStartSystemRetry
();
return
;
}
monitorPrint
(
"starting to initialize monitor service .."
);
tsMonitorConn
.
state
=
MONITOR_STATE_INITIALIZING
;
...
...
src/util/inc/tskiplist.h
浏览文件 @
d3eaaab3
...
...
@@ -174,7 +174,7 @@ void tSkipListNewNodeInfo(SSkipList *pSkipList, int32_t *level, int32_t *headSiz
SSkipListNode
*
tSkipListPut
(
SSkipList
*
pSkipList
,
SSkipListNode
*
pNode
);
/**
* get
only *one* node of which key is equalled to pKey, even there are more than one nodes are of the same k
ey
* get
*all* nodes which key are equivalent to pK
ey
*
* @param pSkipList
* @param pKey
...
...
@@ -234,14 +234,13 @@ SSkipListNode *tSkipListIterGet(SSkipListIterator *iter);
void
*
tSkipListDestroyIter
(
SSkipListIterator
*
iter
);
/*
* remove
only one node
of the pKey value.
* If more than one node has the same value, a
ny one
will be removed
* remove
nodes
of the pKey value.
* If more than one node has the same value, a
ll
will be removed
*
* @Return
* true: one node has been removed
* false: no node has been removed
* the count of removed nodes
*/
bool
tSkipListRemove
(
SSkipList
*
pSkipList
,
SSkipListKey
key
);
uint32_t
tSkipListRemove
(
SSkipList
*
pSkipList
,
SSkipListKey
key
);
/*
* remove the specified node in parameters
...
...
src/util/src/tskiplist.c
浏览文件 @
d3eaaab3
...
...
@@ -74,7 +74,47 @@ static void tSkipListDoInsert(SSkipList *pSkipList, SSkipListNode **forward, SSk
static
SSkipListNode
*
tSkipListPushBack
(
SSkipList
*
pSkipList
,
SSkipListNode
*
pNode
);
static
SSkipListNode
*
tSkipListPushFront
(
SSkipList
*
pSkipList
,
SSkipListNode
*
pNode
);
static
SSkipListIterator
*
doCreateSkipListIterator
(
SSkipList
*
pSkipList
,
int32_t
order
);
static
SSkipListNode
*
tSkipListDoGet
(
SSkipList
*
pSkipList
,
SSkipListKey
key
);
// when order is TSDB_ORDER_ASC, return the last node with key less than val
// when order is TSDB_ORDER_DESC, return the first node with key large than val
static
SSkipListNode
*
getPriorNode
(
SSkipList
*
pSkipList
,
const
char
*
val
,
int32_t
order
)
{
__compar_fn_t
comparFn
=
pSkipList
->
comparFn
;
SSkipListNode
*
pNode
=
NULL
;
if
(
order
==
TSDB_ORDER_ASC
)
{
pNode
=
pSkipList
->
pHead
;
for
(
int32_t
i
=
pSkipList
->
level
-
1
;
i
>=
0
;
--
i
)
{
SSkipListNode
*
p
=
SL_GET_FORWARD_POINTER
(
pNode
,
i
);
while
(
p
!=
pSkipList
->
pTail
)
{
char
*
key
=
SL_GET_NODE_KEY
(
pSkipList
,
p
);
if
(
comparFn
(
key
,
val
)
<
0
)
{
pNode
=
p
;
p
=
SL_GET_FORWARD_POINTER
(
p
,
i
);
}
else
{
break
;
}
}
}
}
else
{
pNode
=
pSkipList
->
pTail
;
for
(
int32_t
i
=
pSkipList
->
level
-
1
;
i
>=
0
;
--
i
)
{
SSkipListNode
*
p
=
SL_GET_BACKWARD_POINTER
(
pNode
,
i
);
while
(
p
!=
pSkipList
->
pHead
)
{
char
*
key
=
SL_GET_NODE_KEY
(
pSkipList
,
p
);
if
(
comparFn
(
key
,
val
)
>
0
)
{
pNode
=
p
;
p
=
SL_GET_BACKWARD_POINTER
(
p
,
i
);
}
else
{
break
;
}
}
}
}
return
pNode
;
}
static
bool
initForwardBackwardPtr
(
SSkipList
*
pSkipList
)
{
uint32_t
maxLevel
=
pSkipList
->
maxLevel
;
...
...
@@ -110,7 +150,11 @@ SSkipList *tSkipListCreate(uint8_t maxLevel, uint8_t keyType, uint8_t keyLen, ui
maxLevel
=
MAX_SKIP_LIST_LEVEL
;
}
pSkipList
->
keyInfo
=
(
SSkipListKeyInfo
){.
type
=
keyType
,
.
len
=
keyLen
,
.
dupKey
=
dupKey
,
.
freeNode
=
freeNode
};
pSkipList
->
keyInfo
.
type
=
keyType
;
pSkipList
->
keyInfo
.
len
=
keyLen
;
pSkipList
->
keyInfo
.
dupKey
=
dupKey
;
pSkipList
->
keyInfo
.
freeNode
=
freeNode
;
pSkipList
->
keyFn
=
fn
;
pSkipList
->
comparFn
=
getKeyComparFunc
(
keyType
);
pSkipList
->
maxLevel
=
maxLevel
;
...
...
@@ -240,13 +284,37 @@ SSkipListNode *tSkipListPut(SSkipList *pSkipList, SSkipListNode *pNode) {
return
pNode
;
}
SArray
*
tSkipListGet
(
SSkipList
*
pSkipList
,
SSkipListKey
key
)
{
SArray
*
sa
=
taosArrayInit
(
1
,
POINTER_BYTES
);
SSkipListNode
*
pNode
=
tSkipListDoGet
(
pSkipList
,
key
);
taosArrayPush
(
sa
,
&
pNode
);
if
(
pSkipList
->
lock
)
{
pthread_rwlock_wrlock
(
pSkipList
->
lock
);
}
SSkipListNode
*
pNode
=
getPriorNode
(
pSkipList
,
key
,
TSDB_ORDER_ASC
);
while
(
1
)
{
SSkipListNode
*
p
=
SL_GET_FORWARD_POINTER
(
pNode
,
0
);
if
(
p
==
pSkipList
->
pTail
)
{
break
;
}
if
(
pSkipList
->
comparFn
(
key
,
SL_GET_NODE_KEY
(
pSkipList
,
p
))
!=
0
)
{
break
;
}
taosArrayPush
(
sa
,
&
p
);
pNode
=
p
;
}
if
(
pSkipList
->
lock
)
{
pthread_rwlock_unlock
(
pSkipList
->
lock
);
}
return
sa
;
}
size_t
tSkipListGetSize
(
const
SSkipList
*
pSkipList
)
{
if
(
pSkipList
==
NULL
)
{
return
0
;
...
...
@@ -375,14 +443,52 @@ size_t tSkipListGetSize(const SSkipList* pSkipList) {
// return true;
//}
bool
tSkipListRemove
(
SSkipList
*
pSkipList
,
SSkipListKey
key
)
{
SSkipListNode
*
pNode
=
tSkipListDoGet
(
pSkipList
,
key
)
;
if
(
pNode
!=
NULL
)
{
tSkipListRemoveNode
(
pSkipList
,
pNode
);
return
true
;
uint32_t
tSkipListRemove
(
SSkipList
*
pSkipList
,
SSkipListKey
key
)
{
uint32_t
count
=
0
;
if
(
pSkipList
->
lock
)
{
pthread_rwlock_wrlock
(
pSkipList
->
lock
)
;
}
return
false
;
SSkipListNode
*
pNode
=
getPriorNode
(
pSkipList
,
key
,
TSDB_ORDER_ASC
);
while
(
1
)
{
SSkipListNode
*
p
=
SL_GET_FORWARD_POINTER
(
pNode
,
0
);
if
(
p
==
pSkipList
->
pTail
)
{
break
;
}
if
(
pSkipList
->
comparFn
(
key
,
SL_GET_NODE_KEY
(
pSkipList
,
p
))
!=
0
)
{
break
;
}
for
(
int32_t
j
=
p
->
level
-
1
;
j
>=
0
;
--
j
)
{
SSkipListNode
*
prev
=
SL_GET_BACKWARD_POINTER
(
p
,
j
);
SSkipListNode
*
next
=
SL_GET_FORWARD_POINTER
(
p
,
j
);
SL_GET_FORWARD_POINTER
(
prev
,
j
)
=
next
;
SL_GET_BACKWARD_POINTER
(
next
,
j
)
=
prev
;
}
if
(
pSkipList
->
keyInfo
.
freeNode
)
{
tfree
(
p
);
}
++
count
;
}
// compress the minimum level of skip list
while
(
pSkipList
->
level
>
0
)
{
if
(
SL_GET_FORWARD_POINTER
(
pSkipList
->
pHead
,
pSkipList
->
level
-
1
)
!=
NULL
)
{
break
;
}
pSkipList
->
level
--
;
}
pSkipList
->
size
-=
count
;
if
(
pSkipList
->
lock
)
{
pthread_rwlock_unlock
(
pSkipList
->
lock
);
}
return
count
;
}
void
tSkipListRemoveNode
(
SSkipList
*
pSkipList
,
SSkipListNode
*
pNode
)
{
...
...
@@ -425,54 +531,25 @@ SSkipListIterator* tSkipListCreateIter(SSkipList *pSkipList) {
}
SSkipListIterator
*
tSkipListCreateIterFromVal
(
SSkipList
*
pSkipList
,
const
char
*
val
,
int32_t
type
,
int32_t
order
)
{
if
(
pSkipList
==
NULL
)
{
return
NULL
;
}
assert
(
order
==
TSDB_ORDER_ASC
||
order
==
TSDB_ORDER_DESC
);
assert
(
pSkipList
!=
NULL
);
SSkipListIterator
*
iter
=
doCreateSkipListIterator
(
pSkipList
,
order
);
if
(
val
==
NULL
)
{
return
doCreateSkipListIterator
(
pSkipList
,
order
);
}
else
{
SSkipListNode
*
forward
[
MAX_SKIP_LIST_LEVEL
]
=
{
0
};
int32_t
ret
=
-
1
;
__compar_fn_t
filterComparFn
=
getKeyComparFunc
(
pSkipList
->
keyInfo
.
type
);
SSkipListNode
*
pNode
=
pSkipList
->
pHead
;
for
(
int32_t
i
=
pSkipList
->
level
-
1
;
i
>=
0
;
--
i
)
{
SSkipListNode
*
p
=
SL_GET_FORWARD_POINTER
(
pNode
,
i
);
while
(
p
!=
pSkipList
->
pTail
)
{
char
*
key
=
SL_GET_NODE_KEY
(
pSkipList
,
p
);
if
((
ret
=
filterComparFn
(
key
,
val
))
<
0
)
{
pNode
=
p
;
p
=
SL_GET_FORWARD_POINTER
(
p
,
i
);
}
else
{
break
;
}
}
forward
[
i
]
=
pNode
;
}
SSkipListIterator
*
iter
=
doCreateSkipListIterator
(
pSkipList
,
order
);
// set the initial position
if
(
order
==
TSDB_ORDER_ASC
)
{
iter
->
cur
=
forward
[
0
];
// greater equals than the value
}
else
{
iter
->
cur
=
SL_GET_FORWARD_POINTER
(
forward
[
0
],
0
);
if
(
ret
==
0
)
{
assert
(
iter
->
cur
!=
pSkipList
->
pTail
);
iter
->
cur
=
SL_GET_FORWARD_POINTER
(
iter
->
cur
,
0
);
}
}
return
iter
;
}
if
(
pSkipList
->
lock
)
{
pthread_rwlock_rdlock
(
pSkipList
->
lock
);
}
iter
->
cur
=
getPriorNode
(
pSkipList
,
val
,
order
);
if
(
pSkipList
->
lock
)
{
pthread_rwlock_unlock
(
pSkipList
->
lock
);
}
return
iter
;
}
bool
tSkipListIterNext
(
SSkipListIterator
*
iter
)
{
...
...
@@ -487,17 +564,9 @@ bool tSkipListIterNext(SSkipListIterator *iter) {
}
if
(
iter
->
order
==
TSDB_ORDER_ASC
)
{
// ascending order iterate
if
(
iter
->
cur
==
NULL
)
{
iter
->
cur
=
SL_GET_FORWARD_POINTER
(
pSkipList
->
pHead
,
0
);
}
else
{
iter
->
cur
=
SL_GET_FORWARD_POINTER
(
iter
->
cur
,
0
);
}
iter
->
cur
=
SL_GET_FORWARD_POINTER
(
iter
->
cur
,
0
);
}
else
{
// descending order iterate
if
(
iter
->
cur
==
NULL
)
{
iter
->
cur
=
SL_GET_BACKWARD_POINTER
(
pSkipList
->
pTail
,
0
);
}
else
{
iter
->
cur
=
SL_GET_BACKWARD_POINTER
(
iter
->
cur
,
0
);
}
iter
->
cur
=
SL_GET_BACKWARD_POINTER
(
iter
->
cur
,
0
);
}
if
(
pSkipList
->
lock
)
{
...
...
@@ -638,57 +707,16 @@ SSkipListNode* tSkipListPushBack(SSkipList *pSkipList, SSkipListNode *pNode) {
return
pNode
;
}
SSkipListNode
*
tSkipListDoGet
(
SSkipList
*
pSkipList
,
SSkipListKey
skey
)
{
SSkipListNode
*
pNode
=
pSkipList
->
pHead
;
SSkipListNode
*
pRes
=
NULL
;
if
(
pSkipList
->
lock
)
{
pthread_rwlock_rdlock
(
pSkipList
->
lock
);
}
#if SKIP_LIST_RECORD_PERFORMANCE
pSkipList
->
state
.
queryCount
++
;
#endif
__compar_fn_t
cmparFn
=
getComparFunc
(
pSkipList
->
keyInfo
.
type
,
0
);
int32_t
ret
=
-
1
;
for
(
int32_t
i
=
pSkipList
->
level
-
1
;
i
>=
0
;
--
i
)
{
SSkipListNode
*
p
=
SL_GET_FORWARD_POINTER
(
pNode
,
i
);
while
(
p
!=
pSkipList
->
pTail
)
{
char
*
key
=
SL_GET_NODE_KEY
(
pSkipList
,
p
);
if
((
ret
=
cmparFn
(
key
,
skey
))
<
0
)
{
pNode
=
p
;
p
=
SL_GET_FORWARD_POINTER
(
p
,
i
);
}
else
{
break
;
}
}
// find the qualified key
if
(
ret
==
0
)
{
pRes
=
SL_GET_FORWARD_POINTER
(
pNode
,
i
);
break
;
// skip list does not allowed duplicated key, abort further retrieve data
// if (!pSkipList->keyInfo.dupKey) {
// break;
// }
}
}
if
(
pSkipList
->
lock
)
{
pthread_rwlock_unlock
(
pSkipList
->
lock
);
}
return
pRes
;
}
SSkipListIterator
*
doCreateSkipListIterator
(
SSkipList
*
pSkipList
,
int32_t
order
)
{
SSkipListIterator
*
iter
=
calloc
(
1
,
sizeof
(
SSkipListIterator
));
iter
->
pSkipList
=
pSkipList
;
iter
->
order
=
order
;
if
(
order
==
TSDB_ORDER_ASC
)
{
iter
->
cur
=
pSkipList
->
pHead
;
}
else
{
iter
->
cur
=
pSkipList
->
pTail
;
}
return
iter
;
}
\ No newline at end of file
src/util/tests/skiplistTest.cpp
浏览文件 @
d3eaaab3
...
...
@@ -281,34 +281,55 @@ void skiplistPerformanceTest() {
// todo not support duplicated key yet
void
duplicatedKeyTest
()
{
#if 0
SSkipListKey key;
key.nType = TSDB_DATA_TYPE_INT;
SSkipListNode **pNodes = NULL;
SSkipList
*
pSkipList
=
tSkipListCreate
(
MAX_SKIP_LIST_LEVEL
,
TSDB_DATA_TYPE_INT
,
sizeof
(
int
),
true
,
false
,
true
,
getkey
);
SSkipList *pSkipList = tSkipListCreate(MAX_SKIP_LIST_LEVEL, TSDB_DATA_TYPE_INT, sizeof(int));
for (int32_t i = 0; i < 10000; ++i) {
for
(
int32_t
i
=
0
;
i
<
200
;
++
i
)
{
for
(
int32_t
j
=
0
;
j
<
5
;
++
j
)
{
key.i64Key = i;
tSkipListPut(pSkipList, "", &key, 1);
int32_t
level
,
size
;
tSkipListNewNodeInfo
(
pSkipList
,
&
level
,
&
size
);
SSkipListNode
*
d
=
(
SSkipListNode
*
)
calloc
(
1
,
size
+
sizeof
(
int32_t
));
d
->
level
=
level
;
int32_t
*
key
=
(
int32_t
*
)
SL_GET_NODE_KEY
(
pSkipList
,
d
);
key
[
0
]
=
i
;
tSkipListPut
(
pSkipList
,
d
);
}
}
tSkipListPrint(pSkipList, 1);
for
(
int32_t
i
=
0
;
i
<
100
;
++
i
)
{
key.i64Key = rand() % 1000;
int32_t size = tSkipListGets(pSkipList, &key, &pNodes);
assert(size == 5);
SSkipListKey
key
;
SArray
*
nodes
=
tSkipListGet
(
pSkipList
,
(
char
*
)(
&
i
));
assert
(
taosArrayGetSize
(
nodes
)
==
5
);
taosArrayDestroy
(
nodes
);
}
tfree(pNodes);
int32_t
key
=
101
;
uint32_t
num
=
tSkipListRemove
(
pSkipList
,
(
char
*
)(
&
key
));
assert
(
num
==
5
);
SArray
*
nodes
=
tSkipListGet
(
pSkipList
,
(
char
*
)(
&
key
));
assert
(
taosArrayGetSize
(
nodes
)
==
0
);
taosArrayDestroy
(
nodes
);
key
=
102
;
SSkipListIterator
*
iter
=
tSkipListCreateIterFromVal
(
pSkipList
,
(
char
*
)(
&
key
),
TSDB_DATA_TYPE_INT
,
TSDB_ORDER_ASC
);
for
(
int
i
=
0
;
i
<
6
;
i
++
)
{
assert
(
tSkipListIterNext
(
iter
)
==
true
);
SSkipListNode
*
node
=
tSkipListIterGet
(
iter
);
int32_t
*
val
=
(
int32_t
*
)
SL_GET_NODE_KEY
(
pSkipList
,
node
);
assert
((
i
<
5
)
==
((
*
val
)
==
key
));
}
tSkipListDestroyIter
(
iter
);
iter
=
tSkipListCreateIterFromVal
(
pSkipList
,
(
char
*
)(
&
key
),
TSDB_DATA_TYPE_INT
,
TSDB_ORDER_DESC
);
for
(
int
i
=
0
;
i
<
6
;
i
++
)
{
assert
(
tSkipListIterNext
(
iter
)
==
true
);
SSkipListNode
*
node
=
tSkipListIterGet
(
iter
);
int32_t
*
val
=
(
int32_t
*
)
SL_GET_NODE_KEY
(
pSkipList
,
node
);
assert
((
i
<
5
)
==
((
*
val
)
==
key
));
}
tSkipListDestroyIter
(
iter
);
tSkipListDestroy
(
pSkipList
);
#endif
}
}
// namespace
...
...
tests/pytest/dbmgmt/__init__.py
0 → 100644
浏览文件 @
d3eaaab3
tests/pytest/dbmgmt/createTableAndDropDnodes.py
0 → 100644
浏览文件 @
d3eaaab3
# -*- coding: utf-8 -*-
import
sys
import
taos
import
threading
import
traceback
import
random
import
datetime
from
util.log
import
*
from
util.cases
import
*
from
util.sql
import
*
from
util.dnodes
import
*
class
TDTestCase
:
def
init
(
self
):
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdLog
.
info
(
"prepare cluster"
)
tdDnodes
.
stopAll
()
tdDnodes
.
deploy
(
1
)
tdDnodes
.
start
(
1
)
self
.
conn
=
taos
.
connect
(
config
=
tdDnodes
.
getSimCfgPath
())
tdSql
.
init
(
self
.
conn
.
cursor
())
tdSql
.
execute
(
'reset query cache'
)
tdSql
.
execute
(
'create dnode 192.168.0.2'
)
tdDnodes
.
deploy
(
2
)
tdDnodes
.
start
(
2
)
tdSql
.
execute
(
'create dnode 192.168.0.3'
)
tdDnodes
.
deploy
(
3
)
tdDnodes
.
start
(
3
)
time
.
sleep
(
3
)
self
.
db
=
"db"
self
.
stb
=
"stb"
self
.
tbPrefix
=
"tb"
self
.
tbNum
=
100000
self
.
count
=
0
# self.conn = taos.connect(config=tdDnodes.getSimCfgPath())
self
.
threadNum
=
1
# threadLock = threading.Lock()
# global counter for number of tables created by all threads
self
.
global_counter
=
0
tdSql
.
init
(
self
.
conn
.
cursor
())
def
_createTable
(
self
,
threadId
):
print
(
"Thread%d : createTable"
%
(
threadId
))
conn
=
taos
.
connect
(
config
=
tdDnodes
.
getSimCfgPath
())
cursor
=
conn
.
cursor
()
i
=
0
try
:
sql
=
"use %s"
%
(
self
.
db
)
cursor
.
execute
(
sql
)
while
i
<
self
.
tbNum
:
if
(
i
%
self
.
threadNum
==
threadId
):
cursor
.
execute
(
"create table tb%d using %s tags(%d)"
%
(
i
+
1
,
self
.
stb
,
i
+
1
))
with
threading
.
Lock
():
self
.
global_counter
+=
1
i
+=
1
except
Exception
as
e
:
tdLog
.
info
(
"Failure when creating table tb%d, exception: %s"
%
(
i
+
1
,
str
(
e
)))
finally
:
cursor
.
close
()
conn
.
close
()
def
_interfereDnodes
(
self
,
threadId
,
dnodeId
):
conn
=
taos
.
connect
(
config
=
tdDnodes
.
getSimCfgPath
())
cursor
=
conn
.
cursor
()
# interfere dnode while creating table
print
(
"Thread%d to interfere dnode%d"
%
(
threadId
,
dnodeId
))
while
self
.
global_counter
<
self
.
tbNum
*
0.05
:
time
.
sleep
(
0.2
)
cursor
.
execute
(
"drop dnode 192.168.0.%d"
%
(
dnodeId
))
while
self
.
global_counter
<
self
.
tbNum
*
0.15
:
time
.
sleep
(
0.2
)
cursor
.
execute
(
"create dnode 192.168.0.%d"
%
(
dnodeId
))
while
self
.
global_counter
<
self
.
tbNum
*
0.35
:
time
.
sleep
(
0.2
)
cursor
.
execute
(
"drop dnode 192.168.0.%d"
%
(
dnodeId
))
while
self
.
global_counter
<
self
.
tbNum
*
0.45
:
time
.
sleep
(
0.2
)
cursor
.
execute
(
"create dnode 192.168.0.%d"
%
(
dnodeId
))
while
self
.
global_counter
<
self
.
tbNum
*
0.65
:
time
.
sleep
(
0.2
)
cursor
.
execute
(
"drop dnode 192.168.0.%d"
%
(
dnodeId
))
while
self
.
global_counter
<
self
.
tbNum
*
0.85
:
time
.
sleep
(
0.2
)
cursor
.
execute
(
"create dnode 192.168.0.%d"
%
(
dnodeId
))
def
run
(
self
):
tdLog
.
info
(
"================= creating database with replica 2"
)
threadId
=
0
threads
=
[]
try
:
tdSql
.
execute
(
"drop database if exists %s"
%
(
self
.
db
))
tdSql
.
execute
(
"create database %s replica 2 cache 2048 ablocks 2.0 tblocks 10 tables 2000"
%
(
self
.
db
))
tdLog
.
sleep
(
3
)
tdSql
.
execute
(
"use %s"
%
(
self
.
db
))
tdSql
.
execute
(
"create table %s (ts timestamp, c1 bigint, stime timestamp) tags(tg1 bigint)"
%
(
self
.
stb
))
tdLog
.
info
(
"Start to create tables"
)
while
threadId
<
self
.
threadNum
:
tdLog
.
info
(
"Thread-%d starts to create tables"
%
(
threadId
))
cThread
=
threading
.
Thread
(
target
=
self
.
_createTable
,
name
=
"thread-%d"
%
(
threadId
),
args
=
(
threadId
,
))
cThread
.
start
()
threads
.
append
(
cThread
)
threadId
+=
1
except
Exception
as
e
:
tdLog
.
info
(
"Failed to create tb%d, exception: %s"
%
(
i
,
str
(
e
)))
# tdDnodes.stopAll()
finally
:
time
.
sleep
(
1
)
threading
.
Thread
(
target
=
self
.
_interfereDnodes
,
name
=
"thread-interfereDnode%d"
%
(
3
),
args
=
(
1
,
3
,
)).
start
()
for
t
in
range
(
len
(
threads
)):
tdLog
.
info
(
"Join threads"
)
# threads[t].start()
threads
[
t
].
join
()
tdSql
.
query
(
"show stables"
)
tdSql
.
checkData
(
0
,
4
,
self
.
tbNum
)
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdCases
.
addCluster
(
__file__
,
TDTestCase
())
tests/pytest/dbmgmt/createTableAndKillDnodes.py
0 → 100644
浏览文件 @
d3eaaab3
# -*- coding: utf-8 -*-
import
sys
import
taos
import
threading
import
traceback
import
random
import
datetime
from
util.log
import
*
from
util.cases
import
*
from
util.sql
import
*
from
util.dnodes
import
*
class
TDTestCase
:
def
init
(
self
):
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdLog
.
info
(
"prepare cluster"
)
tdDnodes
.
stopAll
()
tdDnodes
.
deploy
(
1
)
tdDnodes
.
start
(
1
)
self
.
conn
=
taos
.
connect
(
config
=
tdDnodes
.
getSimCfgPath
())
tdSql
.
init
(
self
.
conn
.
cursor
())
tdSql
.
execute
(
'reset query cache'
)
tdSql
.
execute
(
'create dnode 192.168.0.2'
)
tdDnodes
.
deploy
(
2
)
tdDnodes
.
start
(
2
)
tdSql
.
execute
(
'create dnode 192.168.0.3'
)
tdDnodes
.
deploy
(
3
)
tdDnodes
.
start
(
3
)
time
.
sleep
(
3
)
self
.
db
=
"db"
self
.
stb
=
"stb"
self
.
tbPrefix
=
"tb"
self
.
tbNum
=
100000
self
.
count
=
0
# self.conn = taos.connect(config=tdDnodes.getSimCfgPath())
self
.
threadNum
=
1
# threadLock = threading.Lock()
# global counter for number of tables created by all threads
self
.
global_counter
=
0
tdSql
.
init
(
self
.
conn
.
cursor
())
def
_createTable
(
self
,
threadId
):
print
(
"Thread%d : createTable"
%
(
threadId
))
conn
=
taos
.
connect
(
config
=
tdDnodes
.
getSimCfgPath
())
cursor
=
conn
.
cursor
()
i
=
0
try
:
sql
=
"use %s"
%
(
self
.
db
)
cursor
.
execute
(
sql
)
while
i
<
self
.
tbNum
:
if
(
i
%
self
.
threadNum
==
threadId
):
cursor
.
execute
(
"create table tb%d using %s tags(%d)"
%
(
i
+
1
,
self
.
stb
,
i
+
1
))
with
threading
.
Lock
():
self
.
global_counter
+=
1
time
.
sleep
(
0.01
)
i
+=
1
except
Exception
as
e
:
tdLog
.
info
(
"Failure when creating table tb%d, exception: %s"
%
(
i
+
1
,
str
(
e
)))
finally
:
cursor
.
close
()
conn
.
close
()
def
_interfereDnodes
(
self
,
threadId
,
dnodeId
):
# interfere dnode while creating table
print
(
"Thread%d to interfere dnode%d"
%
(
threadId
,
dnodeId
))
percent
=
0.05
loop
=
int
(
1
/
(
2
*
percent
))
for
t
in
range
(
1
,
loop
):
while
self
.
global_counter
<
self
.
tbNum
*
(
t
*
percent
):
time
.
sleep
(
0.2
)
tdDnodes
.
forcestop
(
dnodeId
)
while
self
.
global_counter
<
self
.
tbNum
*
((
t
+
1
)
*
percent
):
time
.
sleep
(
0.2
)
tdDnodes
.
start
(
dnodeId
)
# while self.global_counter < self.tbNum * 0.05:
# time.sleep(0.2)
# tdDnodes.forcestop(dnodeId)
# while self.global_counter < self.tbNum * 0.10:
# time.sleep(0.2)
# tdDnodes.start(dnodeId)
# while self.global_counter < self.tbNum * 0.15:
# time.sleep(0.2)
# tdDnodes.forcestop(dnodeId)
# while self.global_counter < self.tbNum * 0.20:
# time.sleep(0.2)
# tdDnodes.start(dnodeId)
# while self.global_counter < self.tbNum * 0.25:
# time.sleep(0.2)
# tdDnodes.forcestop(dnodeId)
# while self.global_counter < self.tbNum * 0.30:
# time.sleep(0.2)
# tdDnodes.start(dnodeId)
# while self.global_counter < self.tbNum * 0.35:
# time.sleep(0.2)
# tdDnodes.forcestop(dnodeId)
# while self.global_counter < self.tbNum * 0.40:
# time.sleep(0.2)
# tdDnodes.start(dnodeId)
# while self.global_counter < self.tbNum * 0.45:
# time.sleep(0.2)
# tdDnodes.forcestop(dnodeId)
# while self.global_counter < self.tbNum * 0.50:
# time.sleep(0.2)
# tdDnodes.start(dnodeId)
def
run
(
self
):
tdLog
.
info
(
"================= creating database with replica 2"
)
threadId
=
0
threads
=
[]
try
:
tdSql
.
execute
(
"drop database if exists %s"
%
(
self
.
db
))
tdSql
.
execute
(
"create database %s replica 2 cache 1024 ablocks 2.0 tblocks 4 tables 1000"
%
(
self
.
db
))
tdLog
.
sleep
(
3
)
tdSql
.
execute
(
"use %s"
%
(
self
.
db
))
tdSql
.
execute
(
"create table %s (ts timestamp, c1 bigint, stime timestamp) tags(tg1 bigint)"
%
(
self
.
stb
))
tdLog
.
info
(
"Start to create tables"
)
while
threadId
<
self
.
threadNum
:
tdLog
.
info
(
"Thread-%d starts to create tables"
%
(
threadId
))
cThread
=
threading
.
Thread
(
target
=
self
.
_createTable
,
name
=
"thread-%d"
%
(
threadId
),
args
=
(
threadId
,
))
cThread
.
start
()
threads
.
append
(
cThread
)
threadId
+=
1
except
Exception
as
e
:
tdLog
.
info
(
"Failed to create tb%d, exception: %s"
%
(
i
,
str
(
e
)))
# tdDnodes.stopAll()
finally
:
time
.
sleep
(
1
)
threading
.
Thread
(
target
=
self
.
_interfereDnodes
,
name
=
"thread-interfereDnode%d"
%
(
3
),
args
=
(
1
,
3
,
)).
start
()
for
t
in
range
(
len
(
threads
)):
tdLog
.
info
(
"Join threads"
)
# threads[t].start()
threads
[
t
].
join
()
tdSql
.
query
(
"show stables"
)
tdSql
.
checkData
(
0
,
4
,
self
.
tbNum
)
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdCases
.
addCluster
(
__file__
,
TDTestCase
())
tests/pytest/dbmgmt/database-name-boundary.py
0 → 100644
浏览文件 @
d3eaaab3
###################################################################
# 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
datetime
import
string
import
random
import
subprocess
from
util.log
import
*
from
util.cases
import
*
from
util.sql
import
*
class
TDTestCase
:
def
init
(
self
,
conn
):
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdSql
.
init
(
conn
.
cursor
())
def
run
(
self
):
chars
=
string
.
ascii_uppercase
+
string
.
ascii_lowercase
getDbNameLen
=
"grep -w '#define TSDB_DB_NAME_LEN' ../../src/inc/taosdef.h|awk '{print $3}'"
dbNameMaxLen
=
int
(
subprocess
.
check_output
(
getDbNameLen
,
shell
=
True
))
tdLog
.
notice
(
"DB name max length is %d"
%
dbNameMaxLen
)
tdLog
.
info
(
"=============== step1"
)
db_name
=
''
.
join
(
random
.
choices
(
chars
,
k
=
(
dbNameMaxLen
+
1
)))
tdLog
.
info
(
'db_name length %d'
%
len
(
db_name
))
tdLog
.
info
(
'create database %s'
%
db_name
)
tdSql
.
error
(
'create database %s'
%
db_name
)
tdLog
.
info
(
"=============== step2"
)
db_name
=
''
.
join
(
random
.
choices
(
chars
,
k
=
dbNameMaxLen
))
tdLog
.
info
(
'db_name length %d'
%
len
(
db_name
))
tdLog
.
info
(
'create database %s'
%
db_name
)
tdSql
.
execute
(
'create database %s'
%
db_name
)
tdSql
.
query
(
'show databases'
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkData
(
0
,
0
,
db_name
.
lower
())
tdLog
.
info
(
"=============== step3"
)
db_name
=
''
.
join
(
random
.
choices
(
chars
,
k
=
(
dbNameMaxLen
-
1
)))
tdLog
.
info
(
'db_name length %d'
%
len
(
db_name
))
tdLog
.
info
(
'create database %s'
%
db_name
)
tdSql
.
execute
(
'create database %s'
%
db_name
)
tdSql
.
query
(
'show databases'
)
tdSql
.
checkRows
(
2
)
tdSql
.
checkData
(
0
,
0
,
db_name
.
lower
())
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
tests/pytest/dbmgmt/dropDB_memory_test.py
0 → 100644
浏览文件 @
d3eaaab3
###################################################################
# 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
taos
from
util.log
import
*
from
util.cases
import
*
from
util.sql
import
*
class
TDTestCase
:
def
init
(
self
,
conn
):
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdSql
.
init
(
conn
.
cursor
())
def
run
(
self
):
tdSql
.
prepare
()
tbNum
=
10000
insertRows
=
1
db
=
"db"
loop
=
2
tdSql
.
execute
(
"drop database if exists %s"
%
(
db
))
tdSql
.
execute
(
"reset query cache"
)
tdLog
.
sleep
(
1
)
for
k
in
range
(
1
,
loop
+
1
):
tdLog
.
info
(
"===========Loop%d starts============"
%
(
k
))
tdSql
.
execute
(
"create database %s cache 163840 ablocks 40 maxtables 5000 wal 0"
%
(
db
))
tdSql
.
execute
(
"use %s"
%
(
db
))
tdSql
.
execute
(
"create table stb (ts timestamp, c1 int) tags(t1 bigint, t2 double)"
)
for
j
in
range
(
1
,
tbNum
):
tdSql
.
execute
(
"create table tb%d using stb tags(%d, %d)"
%
(
j
,
j
,
j
))
for
j
in
range
(
1
,
tbNum
):
for
i
in
range
(
0
,
insertRows
):
tdSql
.
execute
(
"insert into tb%d values (now + %dm, %d)"
%
(
j
,
i
,
i
))
tdSql
.
query
(
"select * from tb%d"
%
(
j
))
tdSql
.
checkRows
(
insertRows
)
tdLog
.
info
(
"insert %d rows into tb%d"
%
(
insertRows
,
j
))
# tdSql.sleep(3)
tdSql
.
execute
(
"drop database %s"
%
(
db
))
tdLog
.
sleep
(
2
)
tdLog
.
info
(
"===========Loop%d completed!============="
%
(
k
))
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
#tdCases.addWindows(__file__, TDTestCase())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
tests/pytest/fulltest.sh
浏览文件 @
d3eaaab3
...
...
@@ -10,10 +10,17 @@ python3 ./test.py $1 -f insert/tinyint.py
python3 ./test.py
$1
-f
insert/date.py
python3 ./test.py
$1
-f
insert/binary.py
python3 ./test.py
$1
-f
insert/nchar.py
python3 ./test.py
$1
-f
insert/nchar-boundary.py
python3 ./test.py
$1
-f
insert/nchar-unicode.py
python3 ./test.py
$1
-f
table/column_name.py
python3 ./test.py
$1
-f
table/column_num.py
python3 ./test.py
$1
-f
table/db_table.py
python3 ./test.py
$1
-f
table/tablename-boundary.py
python3 ./test.py
$1
-f
tag_lite/create-tags-boundary.py
python3 ./test.py
$1
-f
dbmgmt/database-name-boundary.py
python3 ./test.py
$1
-f
import_merge/importBlock1HO.py
python3 ./test.py
$1
-f
import_merge/importBlock1HPO.py
...
...
@@ -87,4 +94,4 @@ python3 ./test.py $1 -f user/user_create.py
python3 ./test.py
$1
-f
user/pass_len.py
# table
#python3 ./test.py $1 -f table/del_stable.py
\ No newline at end of file
#python3 ./test.py $1 -f table/del_stable.py
tests/pytest/insert/binary-boundary.py
0 → 100644
浏览文件 @
d3eaaab3
# -*- coding: utf-8 -*-
import
sys
from
util.log
import
*
from
util.cases
import
*
from
util.sql
import
*
class
TDTestCase
:
def
init
(
self
,
conn
):
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdSql
.
init
(
conn
.
cursor
())
def
run
(
self
):
tdSql
.
prepare
()
tdLog
.
info
(
'=============== step1'
)
tdLog
.
info
(
'create table tb (ts timestamp, speed binary(4089))'
)
tdSql
.
error
(
'create table tb (ts timestamp, speed binary(4089))'
)
tdLog
.
info
(
'create table tb (ts timestamp, speed binary(4088))'
)
tdSql
.
error
(
'create table tb (ts timestamp, speed binary(4088))'
)
tdLog
.
info
(
'create table tb (ts timestamp, speed binary(4084))'
)
tdSql
.
execute
(
'create table tb (ts timestamp, speed binary(4084))'
)
tdLog
.
info
(
"insert into tb values (now, ) -x step1"
)
tdSql
.
error
(
"insert into tb values (now, )"
)
with
open
(
"../../README.md"
,
"r"
)
as
inputFile
:
data
=
inputFile
.
read
(
4084
).
replace
(
"
\n
"
,
" "
).
replace
(
"
\\
"
,
" "
).
replace
(
"
\'
"
,
" "
).
replace
(
"
\"
"
,
" "
).
replace
(
"["
,
" "
).
replace
(
"]"
,
" "
).
replace
(
"!"
,
" "
)
tdLog
.
info
(
"insert %d length data: %s"
%
(
len
(
data
),
data
))
tdLog
.
info
(
"insert into tb values (now+2a, data)"
)
tdSql
.
execute
(
"insert into tb values (now+2a, '%s')"
%
data
)
tdLog
.
info
(
'select speed from tb order by ts desc'
)
tdSql
.
query
(
'select speed from tb order by ts desc'
)
tdLog
.
info
(
'tdSql.checkRow(1)'
)
tdSql
.
checkRows
(
1
)
tdLog
.
info
(
'==> $data01'
)
tdLog
.
info
(
"tdSql.checkData(0, 1, '%s')"
%
data
)
tdSql
.
checkData
(
0
,
1
,
data
)
tdLog
.
info
(
'create table tb2 (ts timestamp, speed binary(2040), temp binary(2044))'
)
tdSql
.
execute
(
'create table tb2 (ts timestamp, speed binary(2040), temp binary(2044))'
)
speed
=
inputFile
.
read
(
2044
).
replace
(
"
\n
"
,
" "
).
replace
(
"
\\
"
,
" "
).
replace
(
"
\'
"
,
" "
).
replace
(
"
\"
"
,
" "
).
replace
(
"["
,
" "
).
replace
(
"]"
,
" "
).
replace
(
"!"
,
" "
)
temp
=
inputFile
.
read
(
2040
).
replace
(
"
\n
"
,
" "
).
replace
(
"
\\
"
,
" "
).
replace
(
"
\'
"
,
" "
).
replace
(
"
\"
"
,
" "
).
replace
(
"["
,
" "
).
replace
(
"]"
,
" "
).
replace
(
"!"
,
" "
)
tdLog
.
info
(
"insert into tb values (now+3a, speed, temp)"
)
tdSql
.
error
(
"insert into tb values (now+3a, '%s', '%s')"
%
(
speed
,
temp
))
speed
=
inputFile
.
read
(
2040
).
replace
(
"
\n
"
,
" "
).
replace
(
"
\\
"
,
" "
).
replace
(
"
\'
"
,
" "
).
replace
(
"
\"
"
,
" "
).
replace
(
"["
,
" "
).
replace
(
"]"
,
" "
).
replace
(
"!"
,
" "
)
temp
=
inputFile
.
read
(
2044
).
replace
(
"
\n
"
,
" "
).
replace
(
"
\\
"
,
" "
).
replace
(
"
\'
"
,
" "
).
replace
(
"
\"
"
,
" "
).
replace
(
"["
,
" "
).
replace
(
"]"
,
" "
).
replace
(
"!"
,
" "
)
tdLog
.
info
(
"insert into tb values (now+4a, speed, temp)"
)
tdSql
.
error
(
"insert into tb values (now+4a, '%s', '%s')"
%
(
speed
,
temp
))
tdLog
.
info
(
'tdSql.checkRow(2)'
)
tdSql
.
checkRows
(
2
)
tdLog
.
info
(
'==> $data11'
)
tdLog
.
info
(
"tdSql.checkData(1, 1, '%s')"
%
speed
)
tdSql
.
checkData
(
1
,
1
,
speed
)
tdLog
.
info
(
'==> $data12'
)
tdLog
.
info
(
"tdSql.checkData(1, 2, '%s')"
%
temp
)
tdSql
.
checkData
(
1
,
1
,
temp
)
inputFile
.
close
()
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
tests/pytest/insert/nchar-boundary.py
0 → 100644
浏览文件 @
d3eaaab3
###################################################################
# 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
from
util.log
import
*
from
util.cases
import
*
from
util.sql
import
*
class
TDTestCase
:
def
init
(
self
,
conn
):
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdSql
.
init
(
conn
.
cursor
())
def
run
(
self
):
tdSql
.
prepare
()
tdSql
.
error
(
'create table tb (ts timestamp, col nchar(1022))'
)
tdSql
.
execute
(
'create table tb (ts timestamp, col nchar(1021))'
)
tdSql
.
execute
(
"insert into tb values (now, 'taosdata')"
)
tdSql
.
query
(
"select * from tb"
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkData
(
0
,
1
,
'taosdata'
)
with
open
(
"../../README.md"
,
"r"
)
as
inputFile
:
data
=
inputFile
.
read
(
1021
).
replace
(
"
\n
"
,
" "
).
replace
(
"
\\
"
,
" "
).
replace
(
"
\'
"
,
" "
).
replace
(
"
\"
"
,
" "
).
replace
(
"["
,
" "
).
replace
(
"]"
,
" "
).
replace
(
"!"
,
" "
)
tdLog
.
info
(
"insert %d length data: %s"
%
(
len
(
data
),
data
))
tdSql
.
execute
(
"insert into tb values (now, '%s')"
%
data
)
tdSql
.
query
(
"select * from tb"
)
tdSql
.
checkRows
(
2
)
tdSql
.
checkData
(
1
,
1
,
data
)
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
tests/pytest/insert/nchar-unicode.py
0 → 100644
浏览文件 @
d3eaaab3
此差异已折叠。
点击以展开。
tests/pytest/query/query.py
浏览文件 @
d3eaaab3
...
...
@@ -37,7 +37,7 @@ class TDTestCase:
print
(
"==============step2"
)
tdSql
.
execute
(
"""INSERT INTO dev_001(ts, tagtype) VALUES('2020-05-13 10:00:00.000', 1),
"""INSERT INTO dev_001(ts, tagtype) VALUES('2020-05-13 10:00:00.000', 1),
('2020-05-13 10:00:00.001', 1)
dev_002 VALUES('2020-05-13 10:00:00.001', 1)"""
)
...
...
tests/pytest/stable/insert.py
浏览文件 @
d3eaaab3
...
...
@@ -37,7 +37,7 @@ class TDTestCase:
print
(
"==============step2"
)
tdSql
.
execute
(
"""INSERT INTO dev_001(ts, tagtype) VALUES('2020-05-13 10:00:00.000', 1),
"""INSERT INTO dev_001(ts, tagtype) VALUES('2020-05-13 10:00:00.000', 1),
('2020-05-13 10:00:00.001', 1)
dev_002 VALUES('2020-05-13 10:00:00.001', 1)"""
)
...
...
tests/pytest/table/tablename-boundary.py
0 → 100644
浏览文件 @
d3eaaab3
# -*- coding: utf-8 -*-
import
sys
import
string
import
random
import
subprocess
from
util.log
import
*
from
util.cases
import
*
from
util.sql
import
*
class
TDTestCase
:
def
init
(
self
,
conn
):
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdSql
.
init
(
conn
.
cursor
())
def
run
(
self
):
tdSql
.
prepare
()
getTableNameLen
=
"grep -w '#define TSDB_TABLE_NAME_LEN' ../../src/inc/taosdef.h|awk '{print $3}'"
tableNameMaxLen
=
int
(
subprocess
.
check_output
(
getTableNameLen
,
shell
=
True
))
tdLog
.
notice
(
"table name max length is %d"
%
tableNameMaxLen
)
chars
=
string
.
ascii_uppercase
+
string
.
ascii_lowercase
tb_name
=
''
.
join
(
random
.
choices
(
chars
,
k
=
tableNameMaxLen
))
tdLog
.
info
(
'tb_name length %d'
%
len
(
tb_name
))
tdLog
.
info
(
'create table %s (ts timestamp, value int)'
%
tb_name
)
tdSql
.
error
(
'create table %s (ts timestamp, speed binary(4089))'
%
tb_name
)
tb_name
=
''
.
join
(
random
.
choices
(
chars
,
k
=
191
))
tdLog
.
info
(
'tb_name length %d'
%
len
(
tb_name
))
tdLog
.
info
(
'create table %s (ts timestamp, value int)'
%
tb_name
)
tdSql
.
execute
(
'create table %s (ts timestamp, speed binary(4089))'
%
tb_name
)
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
tests/pytest/tag_lite/create-tags-boundary.py
0 → 100644
浏览文件 @
d3eaaab3
###################################################################
# 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
from
util.log
import
*
from
util.cases
import
*
from
util.sql
import
*
class
TDTestCase
:
def
init
(
self
,
conn
):
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdSql
.
init
(
conn
.
cursor
())
def
run
(
self
):
tdSql
.
prepare
()
getMaxTagNum
=
"grep -w TSDB_MAX_TAGS ../../src/inc/taosdef.h|awk '{print $3}'"
boundary
=
int
(
subprocess
.
check_output
(
getMaxTagNum
,
shell
=
True
))
tdLog
.
notice
(
"get max tags number is %d"
%
boundary
)
for
x
in
range
(
0
,
boundary
):
stb_name
=
"stb%d"
%
x
tagSeq
=
"tag0 int"
for
y
in
range
(
1
,
x
+
1
):
tagSeq
=
tagSeq
+
", tag%d int"
%
y
tdLog
.
info
(
"create table %s (ts timestamp, value int) tags (%s)"
%
(
stb_name
,
tagSeq
))
tdSql
.
execute
(
"create table %s (ts timestamp, value int) tags (%s)"
%
(
stb_name
,
tagSeq
))
tdSql
.
query
(
"show stables"
)
tdSql
.
checkRows
(
boundary
)
stb_name
=
"stb%d"
%
(
boundary
+
1
)
tagSeq
=
tagSeq
+
", tag%d int"
%
(
boundary
)
tdLog
.
info
(
"create table %s (ts timestamp, value int) tags (%s)"
%
(
stb_name
,
tagSeq
))
tdSql
.
error
(
"create table %s (ts timestamp, value int) tags (%s)"
%
(
stb_name
,
tagSeq
))
tdSql
.
query
(
"show stables"
)
tdSql
.
checkRows
(
boundary
)
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
tests/pytest/tag_lite/datatype-without-alter.py
0 → 100644
浏览文件 @
d3eaaab3
###################################################################
# 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
taos
from
util.log
import
*
from
util.cases
import
*
from
util.sql
import
*
from
util.dnodes
import
*
class
TDTestCase
:
def
init
(
self
,
conn
):
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdSql
.
init
(
conn
.
cursor
())
def
run
(
self
):
self
.
ntables
=
10
self
.
rowsPerTable
=
10
self
.
startTime
=
1520000010000
tdDnodes
.
stop
(
1
)
tdDnodes
.
deploy
(
1
)
tdDnodes
.
start
(
1
)
tdLog
.
info
(
"================= step0"
)
tdSql
.
execute
(
'reset query cache'
)
tdLog
.
info
(
"drop database db if exits"
)
tdSql
.
execute
(
'drop database if exists db'
)
tdLog
.
info
(
"================= step1"
)
tdSql
.
execute
(
'create database db maxtables 4'
)
tdLog
.
sleep
(
5
)
tdSql
.
execute
(
'use db'
)
tdLog
.
info
(
"================= step1"
)
tdLog
.
info
(
"create 1 super table"
)
tdSql
.
execute
(
'create table stb (ts timestamp, i int)
\
tags (tin int, tfl float, tbg bigint, tdo double, tbi binary(10), tbl bool)'
)
tdLog
.
info
(
"================= step2"
)
tdLog
.
info
(
"create %d tables"
%
self
.
ntables
)
for
tid
in
range
(
1
,
self
.
ntables
+
1
):
tdSql
.
execute
(
'create table tb%d using stb tags(%d,%f,%ld,%f,
\'
%s
\'
,%d)'
%
(
tid
,
tid
%
3
,
1.2
*
tid
,
self
.
startTime
+
tid
,
1.22
*
tid
,
't'
+
str
(
tid
),
tid
%
2
))
tdLog
.
sleep
(
5
)
tdLog
.
info
(
"================= step3"
)
tdLog
.
info
(
"insert %d data in to each %d tables"
%
(
self
.
rowsPerTable
,
self
.
ntables
))
for
rid
in
range
(
1
,
self
.
rowsPerTable
+
1
):
sqlcmd
=
[
'insert into'
]
for
tid
in
range
(
1
,
self
.
ntables
+
1
):
sqlcmd
.
append
(
'tb%d values(%ld,%d)'
%
(
tid
,
self
.
startTime
+
rid
,
rid
))
tdSql
.
execute
(
" "
.
join
(
sqlcmd
))
tdSql
.
query
(
'select count(*) from stb'
)
tdSql
.
checkData
(
0
,
0
,
self
.
rowsPerTable
*
self
.
ntables
)
tdLog
.
info
(
"================= step6"
)
tdLog
.
info
(
"group and filter by tag1 int"
)
tdSql
.
query
(
'select max(i) from stb where tbl=0 group by tin'
)
tdSql
.
checkRows
(
3
)
tdSql
.
execute
(
'reset query cache'
)
tdSql
.
query
(
'select max(i) from stb where tbl=true group by tin'
)
tdSql
.
checkData
(
2
,
0
,
self
.
rowsPerTable
)
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
tests/pytest/test.py
浏览文件 @
d3eaaab3
...
...
@@ -70,8 +70,6 @@ if __name__ == "__main__":
toBeKilled
=
"valgrind.bin"
killCmd
=
"ps -ef|grep -w %s| grep -v grep | awk '{print $2}' | xargs kill -HUP "
%
toBeKilled
# os.system(killCmd)
# time.sleep(1)
psCmd
=
"ps -ef|grep -w %s| grep -v grep | awk '{print $2}'"
%
toBeKilled
processID
=
subprocess
.
check_output
(
psCmd
,
shell
=
True
)
...
...
tests/pytest/util/dnodes.py
浏览文件 @
d3eaaab3
...
...
@@ -103,7 +103,8 @@ class TDDnode:
self
.
logDir
=
"%s/pysim/dnode%d/log"
%
(
self
.
path
,
self
.
index
)
self
.
dataDir
=
"%s/pysim/dnode%d/data"
%
(
self
.
path
,
self
.
index
)
self
.
cfgDir
=
"%s/pysim/dnode%d/cfg"
%
(
self
.
path
,
self
.
index
)
self
.
cfgPath
=
"%s/pysim/dnode%d/cfg/taos.cfg"
%
(
self
.
path
,
self
.
index
)
self
.
cfgPath
=
"%s/pysim/dnode%d/cfg/taos.cfg"
%
(
self
.
path
,
self
.
index
)
cmd
=
"rm -rf "
+
self
.
dataDir
if
os
.
system
(
cmd
)
!=
0
:
...
...
@@ -188,7 +189,7 @@ class TDDnode:
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
if
(
"community"
not
in
rootRealPath
):
binPath
=
os
.
path
.
join
(
root
,
"taosd"
)
break
;
break
else
:
projPath
=
selfPath
+
"/../../../"
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
...
...
@@ -196,7 +197,7 @@ class TDDnode:
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
if
(
"packaging"
not
in
rootRealPath
):
binPath
=
os
.
path
.
join
(
root
,
"taosd"
)
break
;
break
if
(
binPath
==
""
):
tdLog
.
exit
(
"taosd not found!s"
)
...
...
tests/script/jenkins/basic.txt
浏览文件 @
d3eaaab3
...
...
@@ -241,14 +241,14 @@ cd ../../../debug; make
./test.sh -u -f unique/account/user_create.sim
./test.sh -u -f unique/account/user_len.sim
#./test.sh -u -f unique/big/balance.sim
#
slguan
./test.sh -u -f unique/big/maxvnodes.sim
#
liao wait
./test.sh -u -f unique/big/balance.sim
#
liao wait
./test.sh -u -f unique/big/maxvnodes.sim
./test.sh -u -f unique/big/tcp.sim
#jeff
./test.sh -u -f unique/cluster/balance1.sim
#jeff
./test.sh -u -f unique/cluster/balance2.sim
#jeff
./test.sh -u -f unique/cluster/balance3.sim
#
./test.sh -u -f unique/cluster/cache.sim
./test.sh -u -f unique/cluster/balance1.sim
./test.sh -u -f unique/cluster/balance2.sim
./test.sh -u -f unique/cluster/balance3.sim
./test.sh -u -f unique/cluster/cache.sim
./test.sh -u -f unique/column/replica3.sim
...
...
tests/script/unique/cluster/balance1.sim
浏览文件 @
d3eaaab3
...
...
@@ -77,7 +77,7 @@ print dnode2 $dnode2Vnodes
if $dnode1Vnodes != 2 then
return -1
endi
if $dnode2Vnodes !=
NULL
then
if $dnode2Vnodes !=
null
then
return -1
endi
...
...
@@ -146,7 +146,7 @@ print dnode2 $dnode2Vnodes
if $dnode1Vnodes != 3 then
goto show4
endi
if $dnode2Vnodes !=
NULL
then
if $dnode2Vnodes !=
null
then
goto show4
endi
...
...
@@ -229,7 +229,7 @@ print dnode3 $dnode3Vnodes
if $dnode1Vnodes != 3 then
goto show8
endi
if $dnode3Vnodes !=
NULL
then
if $dnode3Vnodes !=
null
then
goto show8
endi
...
...
@@ -245,7 +245,7 @@ if $dnode1Role != master then
return -1
endi
if $dnode3Role !=
NULL
then
if $dnode3Role !=
null
then
return -1
endi
...
...
tests/script/unique/cluster/balance2.sim
浏览文件 @
d3eaaab3
...
...
@@ -131,7 +131,7 @@ print dnode3 $dnode3Vnodes
if $dnode1Vnodes != 3 then
goto show2
endi
if $dnode2Vnodes !=
NULL
then
if $dnode2Vnodes !=
null
then
goto show2
endi
if $dnode3Vnodes != 3 then
...
...
@@ -194,7 +194,7 @@ print dnode4 ==> $dnode4Role
if $dnode1Role != master then
return -1
endi
if $dnode2Role !=
NULL
then
if $dnode2Role !=
null
then
return -1
endi
if $dnode3Role != slave then
...
...
@@ -231,7 +231,7 @@ endi
if $dnode4Vnodes != 3 then
goto show4
endi
if $dnode3Vnodes !=
NULL
then
if $dnode3Vnodes !=
null
then
goto show4
endi
...
...
@@ -248,10 +248,10 @@ print dnode4 ==> $dnode4Role
if $dnode1Role != master then
return -1
endi
if $dnode2Role !=
NULL
then
if $dnode2Role !=
null
then
return -1
endi
if $dnode3Role !=
NULL
then
if $dnode3Role !=
null
then
return -1
endi
...
...
@@ -339,7 +339,7 @@ print dnode4 $dnode4Vnodes
$dnode5Vnodes = $data2_5
print dnode5 $dnode5Vnodes
if $dnode1Vnodes !=
NULL
then
if $dnode1Vnodes !=
null
then
goto show6
endi
if $dnode4Vnodes != 3 then
...
...
tests/script/unique/cluster/balance3.sim
浏览文件 @
d3eaaab3
...
...
@@ -110,7 +110,7 @@ endi
if $dnode3Vnodes != 3 then
goto show1
endi
if $dnode4Vnodes !=
NULL
then
if $dnode4Vnodes !=
null
then
goto show1
endi
...
...
@@ -166,7 +166,7 @@ print dnode4 $dnode4Vnodes
if $dnode1Vnodes != 3 then
goto show3
endi
if $dnode2Vnodes !=
NULL
then
if $dnode2Vnodes !=
null
then
goto show3
endi
if $dnode3Vnodes != 3 then
...
...
@@ -232,7 +232,7 @@ endi
if $dnode5Vnodes != 3 then
goto show5
endi
if $dnode3Vnodes !=
NULL
then
if $dnode3Vnodes !=
null
then
goto show5
endi
if $dnode4Vnodes != 3 then
...
...
@@ -298,7 +298,7 @@ endi
if $dnode6Vnodes != 3 then
goto show7
endi
if $dnode4Vnodes !=
NULL
then
if $dnode4Vnodes !=
null
then
goto show7
endi
...
...
tests/script/unique/cluster/cache.sim
浏览文件 @
d3eaaab3
...
...
@@ -4,26 +4,18 @@ system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/deploy.sh -n dnode2 -i 2
system sh/cfg.sh -n dnode1 -c walLevel -v 0
system sh/cfg.sh -n dnode2 -c walLevel -v 0
system sh/cfg.sh -n dnode1 -c walLevel
-v 0
system sh/cfg.sh -n dnode2 -c walLevel
-v 0
system sh/cfg.sh -n dnode1 -c httpMaxThreads -v 2
system sh/cfg.sh -n dnode2 -c httpMaxThreads -v 2
system sh/cfg.sh -n dnode1 -c monitor -v 1
system sh/cfg.sh -n dnode2 -c http -v 1
system sh/cfg.sh -n dnode1 -c monitor -v 2
system sh/cfg.sh -n dnode2 -c http -v 1
system sh/cfg.sh -n dnode1 -c enableHttp -v 1
system sh/cfg.sh -n dnode2 -c monitor -v 1
system sh/cfg.sh -n dnode1 -c monitorInterval -v 1
system sh/cfg.sh -n dnode2 -c monitorInterval -v 1
system sh/cfg.sh -n dnode1 -c maxVnodeConnections -v 30000
system sh/cfg.sh -n dnode2 -c maxVnodeConnections -v 30000
system sh/cfg.sh -n dnode1 -c maxMgmtConnections -v 30000
system sh/cfg.sh -n dnode2 -c maxMgmtConnections -v 30000
system sh/cfg.sh -n dnode1 -c maxMeterConnections -v 30000
system sh/cfg.sh -n dnode2 -c maxMeterConnections -v 30000
system sh/cfg.sh -n dnode1 -c maxShellConns -v 30000
system sh/cfg.sh -n dnode2 -c maxShellConns -v 30000
system sh/exec.sh -n dnode1 -s start
sleep 3000
sql connect
...
...
@@ -45,13 +37,20 @@ sleep 3000
system sh/exec.sh -n dnode2 -s start
sql create dnode $hostname2
sleep 20000
sql select * from log.dn_192_168_0_1
sleep 10000
sql show log.tables;
if $rows != 5 then
return -1
endi
sql select * from log.dn1
print ===>rows $rows
print $data00 $data01 $data02
print $data10 $data11 $data12
print $data20 $data21 $data22
if $rows <
2
0 then
if $rows <
1
0 then
return -1
endi
...
...
tests/script/unique/db/replica_add13.sim
浏览文件 @
d3eaaab3
...
...
@@ -47,10 +47,10 @@ sql create table d2.t2 (ts timestamp, i int)
sql create table d3.t3 (ts timestamp, i int)
sql create table d4.t4 (ts timestamp, i int)
sql insert into d1.t1 values(
now
, 1)
sql insert into d2.t2 values(
now
, 1)
sql insert into d3.t3 values(
now
, 1)
sql insert into d4.t4 values(
now
, 1)
sql insert into d1.t1 values(
1589529000011
, 1)
sql insert into d2.t2 values(
1589529000021
, 1)
sql insert into d3.t3 values(
1589529000031
, 1)
sql insert into d4.t4 values(
1589529000041
, 1)
sql select * from d1.t1
if $rows != 1 then
...
...
@@ -111,10 +111,10 @@ if $data2_3 != 4 then
endi
print ======== step4
sql insert into d1.t1 values(
now
, 2)
sql insert into d2.t2 values(
now
, 2)
sql insert into d3.t3 values(
now
, 2)
sql insert into d4.t4 values(
now
, 2)
sql insert into d1.t1 values(
1589529000012
, 2)
sql insert into d2.t2 values(
1589529000022
, 2)
sql insert into d3.t3 values(
1589529000032
, 2)
sql insert into d4.t4 values(
1589529000042
, 2)
sql select * from d1.t1
if $rows != 2 then
...
...
@@ -142,10 +142,10 @@ sleep 1000
system sh/exec_up.sh -n dnode2 -s stop -x SIGINT
sleep 5000
sql insert into d1.t1 values(
now
, 3)
sql insert into d2.t2 values(
now
, 3)
sql insert into d3.t3 values(
now
, 3)
sql insert into d4.t4 values(
now
, 3)
sql insert into d1.t1 values(
1589529000013
, 3)
sql insert into d2.t2 values(
1589529000023
, 3)
sql insert into d3.t3 values(
1589529000033
, 3)
sql insert into d4.t4 values(
1589529000043
, 3)
sql select * from d1.t1
if $rows != 3 then
...
...
@@ -173,10 +173,10 @@ sleep 5000
system sh/exec_up.sh -n dnode3 -s stop -x SIGINT
sleep 3000
sql insert into d1.t1 values(
now
, 4)
sql insert into d2.t2 values(
now
, 4)
sql insert into d3.t3 values(
now
, 4)
sql insert into d4.t4 values(
now
, 4)
sql insert into d1.t1 values(
1589529000014
, 4)
sql insert into d2.t2 values(
1589529000024
, 4)
sql insert into d3.t3 values(
1589529000034
, 4)
sql insert into d4.t4 values(
1589529000044
, 4)
sql select * from d1.t1
print select * from d1.t1 $rows
...
...
@@ -208,10 +208,10 @@ sleep 5000
system sh/exec_up.sh -n dnode4 -s stop -x SIGINT
sleep 3000
sql insert into d1.t1 values(
now
, 5)
sql insert into d2.t2 values(
now
, 5)
sql insert into d3.t3 values(
now
, 5)
sql insert into d4.t4 values(
now
, 5)
sql insert into d1.t1 values(
1589529000015
, 5)
sql insert into d2.t2 values(
1589529000025
, 5)
sql insert into d3.t3 values(
1589529000035
, 5)
sql insert into d4.t4 values(
1589529000045
, 5)
sql select * from d1.t1
if $rows != 5 then
...
...
@@ -239,10 +239,10 @@ sleep 5000
system sh/exec_up.sh -n dnode2 -s stop -x SIGINT
sleep 3000
sql insert into d1.t1 values(
now
, 6)
sql insert into d2.t2 values(
now
, 6)
sql insert into d3.t3 values(
now
, 6)
sql insert into d4.t4 values(
now
, 6)
sql insert into d1.t1 values(
1589529000016
, 6)
sql insert into d2.t2 values(
1589529000026
, 6)
sql insert into d3.t3 values(
1589529000036
, 6)
sql insert into d4.t4 values(
1589529000046
, 6)
sql select * from d1.t1
if $rows != 6 then
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录