Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
805ed72e
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1185
Star
22015
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看板
提交
805ed72e
编写于
6月 30, 2020
作者:
P
Ping Xiao
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'develop' into metadataQuery
上级
f8cdaa7b
4c7f32f2
变更
15
隐藏空白更改
内联
并排
Showing
15 changed file
with
126 addition
and
50 deletion
+126
-50
src/inc/taosmsg.h
src/inc/taosmsg.h
+1
-1
src/mnode/inc/mnodeDef.h
src/mnode/inc/mnodeDef.h
+1
-1
src/mnode/src/mnodeSdb.c
src/mnode/src/mnodeSdb.c
+1
-0
src/mnode/src/mnodeShow.c
src/mnode/src/mnodeShow.c
+3
-2
src/mnode/src/mnodeTable.c
src/mnode/src/mnodeTable.c
+14
-3
src/mnode/src/mnodeVgroup.c
src/mnode/src/mnodeVgroup.c
+1
-1
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+1
-1
src/tsdb/src/tsdbMemTable.c
src/tsdb/src/tsdbMemTable.c
+1
-1
src/tsdb/src/tsdbMeta.c
src/tsdb/src/tsdbMeta.c
+5
-5
src/util/inc/tref.h
src/util/inc/tref.h
+4
-4
src/util/src/tcache.c
src/util/src/tcache.c
+1
-1
src/util/src/tqueue.c
src/util/src/tqueue.c
+4
-4
src/vnode/src/vnodeWrite.c
src/vnode/src/vnodeWrite.c
+1
-1
tests/pytest/query/queryMetaData.py
tests/pytest/query/queryMetaData.py
+86
-25
tests/script/regressionSuite.sim
tests/script/regressionSuite.sim
+2
-0
未找到文件。
src/inc/taosmsg.h
浏览文件 @
805ed72e
...
...
@@ -618,7 +618,7 @@ typedef struct {
}
SMDVnodeDesc
;
typedef
struct
{
char
db
[
TSDB_DB_NAME_LEN
];
char
db
[
TSDB_
ACCT_LEN
+
TSDB_
DB_NAME_LEN
];
SMDVnodeCfg
cfg
;
SMDVnodeDesc
nodes
[
TSDB_MAX_REPLICA
];
}
SMDCreateVnodeMsg
;
...
...
src/mnode/inc/mnodeDef.h
浏览文件 @
805ed72e
...
...
@@ -132,7 +132,7 @@ typedef struct SVgObj {
int64_t
createdTime
;
int32_t
lbDnodeId
;
int32_t
lbTime
;
char
dbName
[
TSDB_DB_NAME_LEN
];
char
dbName
[
TSDB_
ACCT_LEN
+
TSDB_
DB_NAME_LEN
];
int8_t
inUse
;
int8_t
accessState
;
int8_t
reserved0
[
5
];
...
...
src/mnode/src/mnodeSdb.c
浏览文件 @
805ed72e
...
...
@@ -367,6 +367,7 @@ void sdbCleanUp() {
tsSdbObj
.
status
=
SDB_STATUS_CLOSING
;
sdbCleanupWriteWorker
();
sdbDebug
(
"sdb will be closed, version:%"
PRId64
,
tsSdbObj
.
version
);
if
(
tsSdbObj
.
sync
)
{
syncStop
(
tsSdbObj
.
sync
);
...
...
src/mnode/src/mnodeShow.c
浏览文件 @
805ed72e
...
...
@@ -281,6 +281,7 @@ static int32_t mnodeProcessHeartBeatMsg(SMnodeMsg *pMsg) {
static
int32_t
mnodeProcessConnectMsg
(
SMnodeMsg
*
pMsg
)
{
SCMConnectMsg
*
pConnectMsg
=
pMsg
->
rpcMsg
.
pCont
;
SCMConnectRsp
*
pConnectRsp
=
NULL
;
int32_t
code
=
TSDB_CODE_SUCCESS
;
SRpcConnInfo
connInfo
;
...
...
@@ -309,7 +310,7 @@ static int32_t mnodeProcessConnectMsg(SMnodeMsg *pMsg) {
mnodeDecDbRef
(
pDb
);
}
SCMConnectRsp
*
pConnectRsp
=
rpcMallocCont
(
sizeof
(
SCMConnectRsp
));
pConnectRsp
=
rpcMallocCont
(
sizeof
(
SCMConnectRsp
));
if
(
pConnectRsp
==
NULL
)
{
code
=
TSDB_CODE_MND_OUT_OF_MEMORY
;
goto
connect_over
;
...
...
@@ -332,7 +333,7 @@ static int32_t mnodeProcessConnectMsg(SMnodeMsg *pMsg) {
connect_over:
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
rpcFreeCont
(
pConnectRsp
);
if
(
pConnectRsp
)
rpcFreeCont
(
pConnectRsp
);
mLError
(
"user:%s login from %s, result:%s"
,
connInfo
.
user
,
taosIpStr
(
connInfo
.
clientIp
),
tstrerror
(
code
));
}
else
{
mLInfo
(
"user:%s login from %s, result:%s"
,
connInfo
.
user
,
taosIpStr
(
connInfo
.
clientIp
),
tstrerror
(
code
));
...
...
src/mnode/src/mnodeTable.c
浏览文件 @
805ed72e
...
...
@@ -457,10 +457,9 @@ static int32_t mnodeSuperTableActionUpdate(SSdbOper *pOper) {
free
(
pNew
);
free
(
oldTableId
);
free
(
oldSchema
);
mnodeDecTableRef
(
pTable
);
}
mnodeDecTableRef
(
pTable
);
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -2374,6 +2373,17 @@ static int32_t mnodeRetrieveShowTables(SShowObj *pShow, char *data, int32_t rows
strcat
(
prefix
,
TS_PATH_DELIMITER
);
int32_t
prefixLen
=
strlen
(
prefix
);
char
*
pattern
=
NULL
;
if
(
pShow
->
payloadLen
>
0
)
{
pattern
=
(
char
*
)
malloc
(
pShow
->
payloadLen
+
1
);
if
(
pattern
==
NULL
)
{
terrno
=
TSDB_CODE_QRY_OUT_OF_MEMORY
;
return
0
;
}
memcpy
(
pattern
,
pShow
->
payload
,
pShow
->
payloadLen
);
pattern
[
pShow
->
payloadLen
]
=
0
;
}
while
(
numOfRows
<
rows
)
{
pShow
->
pIter
=
mnodeGetNextChildTable
(
pShow
->
pIter
,
&
pTable
);
if
(
pTable
==
NULL
)
break
;
...
...
@@ -2389,7 +2399,7 @@ static int32_t mnodeRetrieveShowTables(SShowObj *pShow, char *data, int32_t rows
// pattern compare for table name
mnodeExtractTableName
(
pTable
->
info
.
tableId
,
tableName
);
if
(
p
Show
->
payloadLen
>
0
&&
patternMatch
(
pShow
->
payload
,
tableName
,
sizeof
(
tableName
)
-
1
,
&
info
)
!=
TSDB_PATTERN_MATCH
)
{
if
(
p
attern
!=
NULL
&&
patternMatch
(
pattern
,
tableName
,
sizeof
(
tableName
)
-
1
,
&
info
)
!=
TSDB_PATTERN_MATCH
)
{
mnodeDecTableRef
(
pTable
);
continue
;
}
...
...
@@ -2433,6 +2443,7 @@ static int32_t mnodeRetrieveShowTables(SShowObj *pShow, char *data, int32_t rows
mnodeVacuumResult
(
data
,
NUM_OF_COLUMNS
,
numOfRows
,
rows
,
pShow
);
mnodeDecDbRef
(
pDb
);
free
(
pattern
);
return
numOfRows
;
}
...
...
src/mnode/src/mnodeVgroup.c
浏览文件 @
805ed72e
...
...
@@ -358,7 +358,7 @@ int32_t mnodeCreateVgroup(SMnodeMsg *pMsg, SDbObj *pDb) {
if
(
pMsg
==
NULL
)
return
TSDB_CODE_MND_APP_ERROR
;
SVgObj
*
pVgroup
=
(
SVgObj
*
)
calloc
(
1
,
sizeof
(
SVgObj
));
tstrncpy
(
pVgroup
->
dbName
,
pDb
->
name
,
TSDB_DB_NAME_LEN
);
tstrncpy
(
pVgroup
->
dbName
,
pDb
->
name
,
TSDB_
ACCT_LEN
+
TSDB_
DB_NAME_LEN
);
pVgroup
->
numOfVnodes
=
pDb
->
cfg
.
replications
;
pVgroup
->
createdTime
=
taosGetTimestampMs
();
pVgroup
->
accessState
=
TSDB_VN_ALL_ACCCESS
;
...
...
src/query/src/qExecutor.c
浏览文件 @
805ed72e
...
...
@@ -6009,7 +6009,7 @@ void qDestroyQueryInfo(qinfo_t qHandle, void (*fp)(void*), void* param) {
return
;
}
int
16
_t
ref
=
T_REF_DEC
(
pQInfo
);
int
32
_t
ref
=
T_REF_DEC
(
pQInfo
);
qDebug
(
"QInfo:%p dec refCount, value:%d"
,
pQInfo
,
ref
);
if
(
ref
==
0
)
{
...
...
src/tsdb/src/tsdbMemTable.c
浏览文件 @
805ed72e
...
...
@@ -111,7 +111,7 @@ int tsdbInsertRowToMem(STsdbRepo *pRepo, SDataRow row, STable *pTable) {
ASSERT
(
pTableData
->
numOfRows
==
tSkipListGetSize
(
pTableData
->
pData
));
}
tsdb
Debug
(
"vgId:%d a row is inserted to table %s tid %d uid %"
PRIu64
" key %"
PRIu64
,
REPO_ID
(
pRepo
),
tsdb
Trace
(
"vgId:%d a row is inserted to table %s tid %d uid %"
PRIu64
" key %"
PRIu64
,
REPO_ID
(
pRepo
),
TABLE_CHAR_NAME
(
pTable
),
TABLE_TID
(
pTable
),
TABLE_UID
(
pTable
),
key
);
return
0
;
...
...
src/tsdb/src/tsdbMeta.c
浏览文件 @
805ed72e
...
...
@@ -550,13 +550,13 @@ int tsdbUnlockRepoMeta(STsdbRepo *pRepo) {
}
void
tsdbRefTable
(
STable
*
pTable
)
{
int
16
_t
ref
=
T_REF_INC
(
pTable
);
int
32
_t
ref
=
T_REF_INC
(
pTable
);
UNUSED
(
ref
);
// tsdbDebug("ref table %"PRIu64", tid:%d, refCount:%d", TABLE_UID(pTable), TABLE_TID(pTable), ref);
}
void
tsdbUnRefTable
(
STable
*
pTable
)
{
int
16
_t
ref
=
T_REF_DEC
(
pTable
);
int
32
_t
ref
=
T_REF_DEC
(
pTable
);
tsdbDebug
(
"unref table uid:%"
PRIu64
", tid:%d, refCount:%d"
,
TABLE_UID
(
pTable
),
TABLE_TID
(
pTable
),
ref
);
if
(
ref
==
0
)
{
...
...
@@ -596,7 +596,7 @@ static int tsdbRestoreTable(void *pHandle, void *cont, int contLen) {
return
-
1
;
}
tsdb
Debug
(
"vgId:%d table %s tid %d uid %"
PRIu64
" is restored from file"
,
REPO_ID
(
pRepo
),
TABLE_CHAR_NAME
(
pTable
),
tsdb
Trace
(
"vgId:%d table %s tid %d uid %"
PRIu64
" is restored from file"
,
REPO_ID
(
pRepo
),
TABLE_CHAR_NAME
(
pTable
),
TABLE_TID
(
pTable
),
TABLE_UID
(
pTable
));
return
0
;
}
...
...
@@ -797,7 +797,7 @@ static int tsdbAddTableToMeta(STsdbRepo *pRepo, STable *pTable, bool addIdx) {
pTable
->
cqhandle
=
(
*
pRepo
->
appH
.
cqCreateFunc
)(
pRepo
->
appH
.
cqH
,
TABLE_UID
(
pTable
),
TABLE_TID
(
pTable
),
pTable
->
sql
,
tsdbGetTableSchema
(
pTable
));
}
tsdb
Debug
(
"vgId:%d table %s tid %d uid %"
PRIu64
" is added to meta"
,
REPO_ID
(
pRepo
),
TABLE_CHAR_NAME
(
pTable
),
tsdb
Trace
(
"vgId:%d table %s tid %d uid %"
PRIu64
" is added to meta"
,
REPO_ID
(
pRepo
),
TABLE_CHAR_NAME
(
pTable
),
TABLE_TID
(
pTable
),
TABLE_UID
(
pTable
));
return
0
;
...
...
@@ -1252,4 +1252,4 @@ static int tsdbRmTableFromMeta(STsdbRepo *pRepo, STable *pTable) {
}
return
0
;
}
\ No newline at end of file
}
src/util/inc/tref.h
浏览文件 @
805ed72e
...
...
@@ -22,7 +22,7 @@ typedef void (*_ref_fn_t)(const void* pObj);
#define T_REF_DECLARE() \
struct { \
int
16
_t val; \
int
32
_t val; \
} _ref;
#define T_REF_REGISTER_FUNC(s, e) \
...
...
@@ -31,7 +31,7 @@ typedef void (*_ref_fn_t)(const void* pObj);
_ref_fn_t end; \
} _ref_func = {.begin = (s), .end = (e)};
#define T_REF_INC(x) (atomic_add_fetch_
16
(&((x)->_ref.val), 1))
#define T_REF_INC(x) (atomic_add_fetch_
32
(&((x)->_ref.val), 1))
#define T_REF_INC_WITH_CB(x, p) \
do { \
...
...
@@ -41,11 +41,11 @@ typedef void (*_ref_fn_t)(const void* pObj);
} \
} while (0)
#define T_REF_DEC(x) (atomic_sub_fetch_
16
(&((x)->_ref.val), 1))
#define T_REF_DEC(x) (atomic_sub_fetch_
32
(&((x)->_ref.val), 1))
#define T_REF_DEC_WITH_CB(x, p) \
do { \
int32_t v = atomic_sub_fetch_
16
(&((x)->_ref.val), 1); \
int32_t v = atomic_sub_fetch_
32
(&((x)->_ref.val), 1); \
if (v == 0 && (p)->_ref_func.end != NULL) { \
(p)->_ref_func.end((x)); \
} \
...
...
src/util/src/tcache.c
浏览文件 @
805ed72e
...
...
@@ -415,7 +415,7 @@ void taosCacheRelease(SCacheObj *pCacheObj, void **data, bool _remove) {
}
*
data
=
NULL
;
int
16
_t
ref
=
T_REF_DEC
(
pNode
);
int
32
_t
ref
=
T_REF_DEC
(
pNode
);
uDebug
(
"%p data released, refcnt:%d"
,
pNode
,
ref
);
if
(
_remove
)
{
...
...
src/util/src/tqueue.c
浏览文件 @
805ed72e
...
...
@@ -100,7 +100,7 @@ void *taosAllocateQitem(int size) {
void
taosFreeQitem
(
void
*
param
)
{
if
(
param
==
NULL
)
return
;
u
Debug
(
"item:%p is freed"
,
param
);
u
Trace
(
"item:%p is freed"
,
param
);
char
*
temp
=
(
char
*
)
param
;
temp
-=
sizeof
(
STaosQnode
);
free
(
temp
);
...
...
@@ -124,7 +124,7 @@ int taosWriteQitem(taos_queue param, int type, void *item) {
queue
->
numOfItems
++
;
if
(
queue
->
qset
)
atomic_add_fetch_32
(
&
queue
->
qset
->
numOfItems
,
1
);
u
Debug
(
"item:%p is put into queue:%p, type:%d items:%d"
,
item
,
queue
,
type
,
queue
->
numOfItems
);
u
Trace
(
"item:%p is put into queue:%p, type:%d items:%d"
,
item
,
queue
,
type
,
queue
->
numOfItems
);
pthread_mutex_unlock
(
&
queue
->
mutex
);
...
...
@@ -206,7 +206,7 @@ int taosGetQitem(taos_qall param, int *type, void **pitem) {
*
pitem
=
pNode
->
item
;
*
type
=
pNode
->
type
;
num
=
1
;
u
Debug
(
"item:%p is fetched, type:%d"
,
*
pitem
,
*
type
);
u
Trace
(
"item:%p is fetched, type:%d"
,
*
pitem
,
*
type
);
}
return
num
;
...
...
@@ -344,7 +344,7 @@ int taosReadQitemFromQset(taos_qset param, int *type, void **pitem, void **phand
queue
->
numOfItems
--
;
atomic_sub_fetch_32
(
&
qset
->
numOfItems
,
1
);
code
=
1
;
u
Debug
(
"item:%p is read out from queue:%p, type:%d items:%d"
,
*
pitem
,
queue
,
*
type
,
queue
->
numOfItems
);
u
Trace
(
"item:%p is read out from queue:%p, type:%d items:%d"
,
*
pitem
,
queue
,
*
type
,
queue
->
numOfItems
);
}
pthread_mutex_unlock
(
&
queue
->
mutex
);
...
...
src/vnode/src/vnodeWrite.c
浏览文件 @
805ed72e
...
...
@@ -94,7 +94,7 @@ static int32_t vnodeProcessSubmitMsg(SVnodeObj *pVnode, void *pCont, SRspRet *pR
// save insert result into item
v
Debug
(
"vgId:%d, submit msg is processed"
,
pVnode
->
vgId
);
v
Trace
(
"vgId:%d, submit msg is processed"
,
pVnode
->
vgId
);
pRet
->
len
=
sizeof
(
SShellSubmitRspMsg
);
pRet
->
rsp
=
rpcMallocCont
(
pRet
->
len
);
...
...
tests/pytest/query/queryMetaData.py
浏览文件 @
805ed72e
...
...
@@ -13,16 +13,20 @@
import
sys
import
taos
import
threading
import
time
from
datetime
import
datetime
class
QueryMetaData
:
def
__init__
(
self
):
class
MetadataQuery
:
def
initConnection
(
self
):
self
.
tables
=
10000
self
.
records
=
10
self
.
numOfTherads
=
10
self
.
ts
=
1537146000000
self
.
host
=
"127.0.0.1"
self
.
user
=
"root"
self
.
password
=
"taosdata"
self
.
config
=
"/etc/taos"
self
.
config
=
"/etc/taos"
def
connectDB
(
self
):
self
.
conn
=
taos
.
connect
(
...
...
@@ -30,31 +34,88 @@ class QueryMetaData:
self
.
user
,
self
.
password
,
self
.
config
)
self
.
cursor
=
self
.
conn
.
cursor
()
return
self
.
conn
.
cursor
()
def
createStable
(
self
):
print
(
"================= Create stable meters ================="
)
cursor
=
self
.
connectDB
()
cursor
.
execute
(
"drop database if exists test"
)
cursor
.
execute
(
"create database test"
)
cursor
.
execute
(
"use test"
)
cursor
.
execute
(
'''create table if not exists meters (ts timestamp, speed int) tags(
tgcol1 tinyint, tgcol2 smallint, tgcol3 int, tgcol4 bigint, tgcol5 float, tgcol6 double, tgcol7 bool, tgcol8 binary(20), tgcol9 nchar(20),
tgcol10 tinyint, tgcol11 smallint, tgcol12 int, tgcol13 bigint, tgcol14 float, tgcol15 double, tgcol16 bool, tgcol17 binary(20), tgcol18 nchar(20),
tgcol19 tinyint, tgcol20 smallint, tgcol21 int, tgcol22 bigint, tgcol23 float, tgcol24 double, tgcol25 bool, tgcol26 binary(20), tgcol27 nchar(20),
tgcol28 tinyint, tgcol29 smallint, tgcol30 int, tgcol31 bigint, tgcol32 float, tgcol33 double, tgcol34 bool, tgcol35 binary(20), tgcol36 nchar(20),
tgcol37 tinyint, tgcol38 smallint, tgcol39 int, tgcol40 bigint, tgcol41 float, tgcol42 double, tgcol43 bool, tgcol44 binary(20), tgcol45 nchar(20),
tgcol46 tinyint, tgcol47 smallint, tgcol48 int, tgcol49 bigint, tgcol50 float, tgcol51 double, tgcol52 bool, tgcol53 binary(20), tgcol54 nchar(20))'''
)
cursor
.
close
()
self
.
conn
.
close
()
def
queryData
(
self
,
q
):
print
(
"================= query tag data ================="
)
cursor
=
self
.
connectDB
()
cursor
.
execute
(
"use test"
)
def
queryData
(
self
):
print
(
"===============query tag data==============="
)
self
.
cursor
.
execute
(
"use test"
)
startTime
=
datetime
.
now
()
self
.
cursor
.
execute
(
"select areaid from meters"
)
data
=
self
.
cursor
.
fetchall
()
cursor
.
execute
(
q
)
cursor
.
fetchall
()
endTime
=
datetime
.
now
()
print
(
endTime
-
startTime
)
start
=
datetime
.
now
()
self
.
cursor
.
execute
(
"select areaid, loc from meters"
)
data2
=
self
.
cursor
.
fetchall
()
end
=
datetime
.
now
()
print
(
end
-
start
)
print
(
"Query time for the above query is %d seconds"
%
(
endTime
-
startTime
).
seconds
)
def
closeConn
(
self
):
self
.
cursor
.
close
()
cursor
.
close
()
self
.
conn
.
close
()
def
createTablesAndInsertData
(
self
,
threadID
):
cursor
=
self
.
connectDB
()
cursor
.
execute
(
"use test"
)
base
=
threadID
*
self
.
tables
for
i
in
range
(
self
.
tables
):
cursor
.
execute
(
'''create table t%d using meters tags(
%d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d',
%d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d',
%d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d',
%d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d',
%d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d',
%d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d')'''
%
(
base
+
i
+
1
,
(
base
+
i
)
%
100
,
(
base
+
i
)
%
10000
,
(
base
+
i
)
%
1000000
,
(
base
+
i
)
%
100000000
,
(
base
+
i
)
%
100
*
1.1
,
(
base
+
i
)
%
100
*
2.3
,
(
base
+
i
)
%
2
,
(
base
+
i
)
%
100
,
(
base
+
i
)
%
100
,
(
base
+
i
)
%
100
,
(
base
+
i
)
%
10000
,
(
base
+
i
)
%
1000000
,
(
base
+
i
)
%
100000000
,
(
base
+
i
)
%
100
*
1.1
,
(
base
+
i
)
%
100
*
2.3
,
(
base
+
i
)
%
2
,
(
base
+
i
)
%
100
,
(
base
+
i
)
%
100
,
(
base
+
i
)
%
100
,
(
base
+
i
)
%
10000
,
(
base
+
i
)
%
1000000
,
(
base
+
i
)
%
100000000
,
(
base
+
i
)
%
100
*
1.1
,
(
base
+
i
)
%
100
*
2.3
,
(
base
+
i
)
%
2
,
(
base
+
i
)
%
100
,
(
base
+
i
)
%
100
,
(
base
+
i
)
%
100
,
(
base
+
i
)
%
10000
,
(
base
+
i
)
%
1000000
,
(
base
+
i
)
%
100000000
,
(
base
+
i
)
%
100
*
1.1
,
(
base
+
i
)
%
100
*
2.3
,
(
base
+
i
)
%
2
,
(
base
+
i
)
%
100
,
(
base
+
i
)
%
100
,
(
base
+
i
)
%
100
,
(
base
+
i
)
%
10000
,
(
base
+
i
)
%
1000000
,
(
base
+
i
)
%
100000000
,
(
base
+
i
)
%
100
*
1.1
,
(
base
+
i
)
%
100
*
2.3
,
(
base
+
i
)
%
2
,
(
base
+
i
)
%
100
,
(
base
+
i
)
%
100
,
(
base
+
i
)
%
100
,
(
base
+
i
)
%
10000
,
(
base
+
i
)
%
1000000
,
(
base
+
i
)
%
100000000
,
(
base
+
i
)
%
100
*
1.1
,
(
base
+
i
)
%
100
*
2.3
,
(
base
+
i
)
%
2
,
(
base
+
i
)
%
100
,
(
base
+
i
)
%
100
))
for
j
in
range
(
self
.
records
):
cursor
.
execute
(
"insert into t%d values(%d, %d)"
%
(
base
+
i
+
1
,
self
.
ts
+
j
,
j
))
cursor
.
close
()
self
.
conn
.
close
()
if
__name__
==
'__main__'
:
t
=
MetadataQuery
()
t
.
initConnection
()
t
.
createStable
()
print
(
"================= Create %d tables and insert %d records into each table ================="
%
(
t
.
tables
,
t
.
records
))
startTime
=
datetime
.
now
()
for
i
in
range
(
t
.
numOfTherads
):
thread
=
threading
.
Thread
(
target
=
t
.
createTablesAndInsertData
,
args
=
(
i
,))
thread
.
start
()
thread
.
join
()
endTime
=
datetime
.
now
()
diff
=
(
endTime
-
startTime
).
seconds
print
(
"spend %d seconds to create %d tables and insert %d records into each table"
%
(
diff
,
t
.
tables
,
t
.
records
));
# tgcol28, tgcol29, tgcol30, tgcol31, tgcol32, tgcol33, tgcol34, tgcol35, tgcol36,
# tgcol37, tgcol38, tgcol39, tgcol40, tgcol41, tgcol42, tgcol43, tgcol44, tgcol45,
# tgcol46, tgcol47, tgcol48, tgcol49, tgcol50, tgcol51, tgcol52, tgcol53, tgcol54
# tgcol19, tgcol20, tgcol21, tgcol22, tgcol23, tgcol24, tgcol25, tgcol26, tgcol27,
query
=
'''select tgcol1, tgcol2, tgcol3, tgcol4, tgcol5, tgcol6, tgcol7, tgcol8, tgcol9,
tgcol10, tgcol11, tgcol12, tgcol13, tgcol14, tgcol15, tgcol16, tgcol17, tgcol18,
from meters where tgcol1 > 10 AND tgcol1 < 100 and tgcol2 > 100 and tgcol2 < 1000 or tgcol3 > 10000 or tgcol7 = true
or tgcol8 like '%2' and tgcol10 < 10'''
test
=
QueryMetaData
()
test
.
connectDB
()
test
.
queryData
()
test
.
closeConn
()
t
.
queryData
(
query
)
tests/script/regressionSuite.sim
浏览文件 @
805ed72e
...
...
@@ -142,6 +142,8 @@ run general/stable/dnode3.sim
run general/stable/metrics.sim
run general/stable/values.sim
run general/stable/vnode3.sim
run general/stable/refcount.sim
run general/stable/show.sim
run general/table/autocreate.sim
run general/table/basic1.sim
run general/table/basic2.sim
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录