Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
41c76d66
T
TDengine
项目概览
taosdata
/
TDengine
12 个月 前同步成功
通知
1180
Star
22014
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
41c76d66
编写于
11月 11, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
差异文件
Merge branch '3.0' into fix/TD-20052
上级
8a051c00
87255f71
变更
36
展开全部
隐藏空白更改
内联
并排
Showing
36 changed file
with
2921 addition
and
2607 deletion
+2921
-2607
include/common/tglobal.h
include/common/tglobal.h
+3
-0
include/common/ttokendef.h
include/common/ttokendef.h
+55
-55
include/libs/nodes/cmdnodes.h
include/libs/nodes/cmdnodes.h
+7
-0
include/libs/nodes/querynodes.h
include/libs/nodes/querynodes.h
+1
-0
include/libs/transport/trpc.h
include/libs/transport/trpc.h
+8
-6
include/util/tdef.h
include/util/tdef.h
+1
-1
source/client/src/clientEnv.c
source/client/src/clientEnv.c
+2
-0
source/client/src/clientImpl.c
source/client/src/clientImpl.c
+2
-0
source/common/src/tglobal.c
source/common/src/tglobal.c
+15
-1
source/dnode/mgmt/node_mgmt/src/dmTransport.c
source/dnode/mgmt/node_mgmt/src/dmTransport.c
+2
-0
source/dnode/vnode/src/tsdb/tsdbCommit.c
source/dnode/vnode/src/tsdb/tsdbCommit.c
+4
-0
source/dnode/vnode/src/tsdb/tsdbUtil.c
source/dnode/vnode/src/tsdb/tsdbUtil.c
+2
-2
source/dnode/vnode/src/tsdb/tsdbWrite.c
source/dnode/vnode/src/tsdb/tsdbWrite.c
+10
-1
source/libs/executor/src/timewindowoperator.c
source/libs/executor/src/timewindowoperator.c
+48
-21
source/libs/nodes/src/nodesUtilFuncs.c
source/libs/nodes/src/nodesUtilFuncs.c
+10
-3
source/libs/parser/inc/parAst.h
source/libs/parser/inc/parAst.h
+1
-0
source/libs/parser/inc/sql.y
source/libs/parser/inc/sql.y
+13
-1
source/libs/parser/src/parAstCreater.c
source/libs/parser/src/parAstCreater.c
+15
-0
source/libs/parser/src/parAstParser.c
source/libs/parser/src/parAstParser.c
+2
-2
source/libs/parser/src/parTranslater.c
source/libs/parser/src/parTranslater.c
+16
-8
source/libs/parser/src/sql.c
source/libs/parser/src/sql.c
+2461
-2464
source/libs/parser/test/parShowToUse.cpp
source/libs/parser/test/parShowToUse.cpp
+10
-0
source/libs/planner/src/planLogicCreater.c
source/libs/planner/src/planLogicCreater.c
+6
-2
source/libs/stream/src/streamMeta.c
source/libs/stream/src/streamMeta.c
+1
-3
source/libs/transport/inc/transComm.h
source/libs/transport/inc/transComm.h
+5
-5
source/libs/transport/inc/transportInt.h
source/libs/transport/inc/transportInt.h
+4
-2
source/libs/transport/src/trans.c
source/libs/transport/src/trans.c
+2
-0
source/libs/transport/src/transCli.c
source/libs/transport/src/transCli.c
+4
-3
tests/parallel_test/cases.task
tests/parallel_test/cases.task
+2
-2
tests/parallel_test/container_build.sh
tests/parallel_test/container_build.sh
+2
-2
tests/script/sh/checkAsan.sh
tests/script/sh/checkAsan.sh
+39
-0
tests/script/sh/exec.sh
tests/script/sh/exec.sh
+2
-2
tests/script/test.sh
tests/script/test.sh
+7
-2
tests/script/tsim/db/commit.sim
tests/script/tsim/db/commit.sim
+2
-2
tests/script/tsim/table/date.sim
tests/script/tsim/table/date.sim
+151
-15
tests/system-test/0-others/taosdShell.py
tests/system-test/0-others/taosdShell.py
+6
-2
未找到文件。
include/common/tglobal.h
浏览文件 @
41c76d66
...
...
@@ -135,6 +135,9 @@ extern int32_t tsTtlPushInterval;
extern
int32_t
tsGrantHBInterval
;
extern
int32_t
tsUptimeInterval
;
extern
int32_t
tsRpcRetryLimit
;
extern
int32_t
tsRpcRetryInterval
;
//#define NEEDTO_COMPRESSS_MSG(size) (tsCompressMsgSize != -1 && (size) > tsCompressMsgSize)
int32_t
taosCreateLog
(
const
char
*
logname
,
int32_t
logFileNum
,
const
char
*
cfgDir
,
const
char
**
envCmd
,
...
...
include/common/ttokendef.h
浏览文件 @
41c76d66
...
...
@@ -174,61 +174,61 @@
#define TK_SUBSCRIPTIONS 156
#define TK_VNODES 157
#define TK_LIKE 158
#define TK_
INDEX
159
#define TK_
FUNCTION
160
#define TK_
INTERVAL
161
#define TK_
TOPIC
162
#define TK_
AS
163
#define TK_
WITH
164
#define TK_
META
165
#define TK_
CONSUMER
166
#define TK_
GROUP
167
#define TK_
DESC
168
#define TK_
DESCRIBE
169
#define TK_
RESET
170
#define TK_
QUERY
171
#define TK_
CACHE
172
#define TK_
EXPLAIN
173
#define TK_
ANALYZE
174
#define TK_
VERBOSE
175
#define TK_
NK_BOOL
176
#define TK_
RATIO
177
#define TK_NK_
FLOAT
178
#define TK_
OUTPUTTYPE
179
#define TK_
AGGREGATE
180
#define TK_
BUFSIZE
181
#define TK_
STREAM
182
#define TK_
INTO
183
#define TK_
TRIGGER
184
#define TK_
AT_ONCE
185
#define TK_
WINDOW_CLOSE
186
#define TK_
IGNORE
187
#define TK_
EXPIRED
188
#define TK_
FILL_HISTORY
189
#define TK_
SUBTABLE
190
#define TK_
KILL
191
#define TK_
CONNECTION
192
#define TK_
TRANSACTION
193
#define TK_
BALANCE
194
#define TK_
VGROUP
195
#define TK_
MERGE
196
#define TK_
REDISTRIBUTE
197
#define TK_
SPLIT
198
#define TK_
DELETE
199
#define TK_
INSERT
200
#define TK_
NULL
201
#define TK_
NK_QUESTION
202
#define TK_N
K_ARROW
203
#define TK_
ROWTS
204
#define TK_
TBNAME
205
#define TK_
QSTART
206
#define TK_Q
END
207
#define TK_Q
DURATION
208
#define TK_
WSTART
209
#define TK_W
END
210
#define TK_W
DURATION
211
#define TK_
IROWTS
212
#define TK_
QTAGS
213
#define TK_
TBNAME
159
#define TK_
QTAGS
160
#define TK_
AS
161
#define TK_
INDEX
162
#define TK_
FUNCTION
163
#define TK_
INTERVAL
164
#define TK_
TOPIC
165
#define TK_
WITH
166
#define TK_
META
167
#define TK_
CONSUMER
168
#define TK_
GROUP
169
#define TK_
DESC
170
#define TK_
DESCRIBE
171
#define TK_
RESET
172
#define TK_
QUERY
173
#define TK_
CACHE
174
#define TK_
EXPLAIN
175
#define TK_
ANALYZE
176
#define TK_
VERBOSE
177
#define TK_NK_
BOOL
178
#define TK_
RATIO
179
#define TK_
NK_FLOAT
180
#define TK_
OUTPUTTYPE
181
#define TK_
AGGREGATE
182
#define TK_
BUFSIZE
183
#define TK_
STREAM
184
#define TK_
INTO
185
#define TK_
TRIGGER
186
#define TK_
AT_ONCE
187
#define TK_
WINDOW_CLOSE
188
#define TK_
IGNORE
189
#define TK_
EXPIRED
190
#define TK_
FILL_HISTORY
191
#define TK_
SUBTABLE
192
#define TK_
KILL
193
#define TK_
CONNECTION
194
#define TK_
TRANSACTION
195
#define TK_
BALANCE
196
#define TK_
VGROUP
197
#define TK_
MERGE
198
#define TK_
REDISTRIBUTE
199
#define TK_
SPLIT
200
#define TK_
DELETE
201
#define TK_
INSERT
202
#define TK_N
ULL
203
#define TK_
NK_QUESTION
204
#define TK_
NK_ARROW
205
#define TK_
ROWTS
206
#define TK_Q
START
207
#define TK_Q
END
208
#define TK_
QDURATION
209
#define TK_W
START
210
#define TK_W
END
211
#define TK_
WDURATION
212
#define TK_
IROWTS
213
#define TK_CAST 214
#define TK_NOW 215
#define TK_TODAY 216
...
...
include/libs/nodes/cmdnodes.h
浏览文件 @
41c76d66
...
...
@@ -284,6 +284,13 @@ typedef struct SShowVnodesStmt {
SNode
*
pDnodeEndpoint
;
}
SShowVnodesStmt
;
typedef
struct
SShowTableTagsStmt
{
ENodeType
type
;
SNode
*
pDbName
;
// SValueNode
SNode
*
pTbName
;
// SValueNode
SNodeList
*
pTags
;
}
SShowTableTagsStmt
;
typedef
enum
EIndexType
{
INDEX_TYPE_SMA
=
1
,
INDEX_TYPE_FULLTEXT
}
EIndexType
;
typedef
struct
SIndexOptions
{
...
...
include/libs/nodes/querynodes.h
浏览文件 @
41c76d66
...
...
@@ -297,6 +297,7 @@ typedef struct SSelectStmt {
bool
hasStateKey
;
bool
onlyHasKeepOrderFunc
;
bool
groupSort
;
bool
tagScan
;
}
SSelectStmt
;
typedef
enum
ESetOperatorType
{
SET_OP_TYPE_UNION_ALL
=
1
,
SET_OP_TYPE_UNION
}
ESetOperatorType
;
...
...
include/libs/transport/trpc.h
浏览文件 @
41c76d66
...
...
@@ -76,12 +76,14 @@ typedef void (*RpcDfp)(void *ahandle);
typedef
struct
SRpcInit
{
char
localFqdn
[
TSDB_FQDN_LEN
];
uint16_t
localPort
;
// local port
char
*
label
;
// for debug purpose
int32_t
numOfThreads
;
// number of threads to handle connections
int32_t
sessions
;
// number of sessions allowed
int8_t
connType
;
// TAOS_CONN_UDP, TAOS_CONN_TCPC, TAOS_CONN_TCPS
int32_t
idleTime
;
// milliseconds, 0 means idle timer is disabled
uint16_t
localPort
;
// local port
char
*
label
;
// for debug purpose
int32_t
numOfThreads
;
// number of threads to handle connections
int32_t
sessions
;
// number of sessions allowed
int8_t
connType
;
// TAOS_CONN_UDP, TAOS_CONN_TCPC, TAOS_CONN_TCPS
int32_t
idleTime
;
// milliseconds, 0 means idle timer is disabled
int32_t
retryLimit
;
// retry limit
int32_t
retryInterval
;
// retry interval ms
int32_t
compressSize
;
// -1: no compress, 0 : all data compressed, size: compress data if larger than size
int8_t
encryption
;
// encrypt or not
...
...
include/util/tdef.h
浏览文件 @
41c76d66
...
...
@@ -26,7 +26,7 @@ extern "C" {
#define TSKEY int64_t
#define TSKEY_MIN INT64_MIN
#define TSKEY_MAX
(INT64_MAX - 1)
#define TSKEY_MAX
INT64_MAX
#define TSKEY_INITIAL_VAL TSKEY_MIN
#define TD_VER_MAX UINT64_MAX // TODO: use the real max version from query handle
...
...
source/client/src/clientEnv.c
浏览文件 @
41c76d66
...
...
@@ -146,6 +146,8 @@ void *openTransporter(const char *user, const char *auth, int32_t numOfThread) {
rpcInit
.
idleTime
=
tsShellActivityTimer
*
1000
;
rpcInit
.
compressSize
=
tsCompressMsgSize
;
rpcInit
.
dfp
=
destroyAhandle
;
rpcInit
.
retryLimit
=
tsRpcRetryLimit
;
rpcInit
.
retryInterval
=
tsRpcRetryInterval
;
void
*
pDnodeConn
=
rpcOpen
(
&
rpcInit
);
if
(
pDnodeConn
==
NULL
)
{
...
...
source/client/src/clientImpl.c
浏览文件 @
41c76d66
...
...
@@ -1971,6 +1971,8 @@ TSDB_SERVER_STATUS taos_check_server_status(const char* fqdn, int port, char* de
rpcInit
.
idleTime
=
tsShellActivityTimer
*
1000
;
rpcInit
.
compressSize
=
tsCompressMsgSize
;
rpcInit
.
user
=
"_dnd"
;
rpcInit
.
retryLimit
=
tsRpcRetryLimit
;
rpcInit
.
retryInterval
=
tsRpcRetryInterval
;
clientRpc
=
rpcOpen
(
&
rpcInit
);
if
(
clientRpc
==
NULL
)
{
...
...
source/common/src/tglobal.c
浏览文件 @
41c76d66
...
...
@@ -163,10 +163,12 @@ int32_t tsMqRebalanceInterval = 2;
int32_t
tsTtlUnit
=
86400
;
int32_t
tsTtlPushInterval
=
86400
;
int32_t
tsGrantHBInterval
=
60
;
int32_t
tsUptimeInterval
=
300
;
// seconds
int32_t
tsUptimeInterval
=
300
;
// seconds
char
tsUdfdResFuncs
[
512
]
=
""
;
// udfd resident funcs that teardown when udfd exits
char
tsUdfdLdLibPath
[
512
]
=
""
;
int32_t
tsRpcRetryLimit
=
100
;
int32_t
tsRpcRetryInterval
=
15
;
#ifndef _STORAGE
int32_t
taosSetTfsCfg
(
SConfig
*
pCfg
)
{
SConfigItem
*
pItem
=
cfgGetItem
(
pCfg
,
"dataDir"
);
...
...
@@ -297,6 +299,8 @@ static int32_t taosAddClientCfg(SConfig *pCfg) {
if
(
cfgAddString
(
pCfg
,
"smlTagName"
,
tsSmlTagName
,
1
)
!=
0
)
return
-
1
;
if
(
cfgAddBool
(
pCfg
,
"smlDataFormat"
,
tsSmlDataFormat
,
1
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"maxMemUsedByInsert"
,
tsMaxMemUsedByInsert
,
1
,
INT32_MAX
,
true
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"rpcRetryLimit"
,
tsRpcRetryLimit
,
1
,
100000
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"rpcRetryInterval"
,
tsRpcRetryInterval
,
1
,
100000
,
0
)
!=
0
)
return
-
1
;
tsNumOfTaskQueueThreads
=
tsNumOfCores
/
2
;
tsNumOfTaskQueueThreads
=
TMAX
(
tsNumOfTaskQueueThreads
,
4
);
...
...
@@ -422,6 +426,10 @@ static int32_t taosAddServerCfg(SConfig *pCfg) {
if
(
cfgAddBool
(
pCfg
,
"udf"
,
tsStartUdfd
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddString
(
pCfg
,
"udfdResFuncs"
,
tsUdfdResFuncs
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddString
(
pCfg
,
"udfdLdLibPath"
,
tsUdfdLdLibPath
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"rpcRetryLimit"
,
tsRpcRetryLimit
,
1
,
100000
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"rpcRetryInterval"
,
tsRpcRetryInterval
,
1
,
100000
,
0
)
!=
0
)
return
-
1
;
GRANT_CFG_ADD
;
return
0
;
}
...
...
@@ -634,6 +642,9 @@ static int32_t taosSetClientCfg(SConfig *pCfg) {
tsQueryNodeChunkSize
=
cfgGetItem
(
pCfg
,
"queryNodeChunkSize"
)
->
i32
;
tsQueryUseNodeAllocator
=
cfgGetItem
(
pCfg
,
"queryUseNodeAllocator"
)
->
bval
;
tsKeepColumnName
=
cfgGetItem
(
pCfg
,
"keepColumnName"
)
->
bval
;
tsRpcRetryLimit
=
cfgGetItem
(
pCfg
,
"rpcRetryLimit"
)
->
i32
;
tsRpcRetryInterval
=
cfgGetItem
(
pCfg
,
"rpcRetryInterval"
)
->
i32
;
return
0
;
}
...
...
@@ -708,6 +719,9 @@ static int32_t taosSetServerCfg(SConfig *pCfg) {
if
(
tsQueryBufferSize
>=
0
)
{
tsQueryBufferSizeBytes
=
tsQueryBufferSize
*
1048576UL
;
}
tsRpcRetryLimit
=
cfgGetItem
(
pCfg
,
"rpcRetryLimit"
)
->
i32
;
tsRpcRetryInterval
=
cfgGetItem
(
pCfg
,
"rpcRetryInterval"
)
->
i32
;
GRANT_CFG_GET
;
return
0
;
}
...
...
source/dnode/mgmt/node_mgmt/src/dmTransport.c
浏览文件 @
41c76d66
...
...
@@ -258,6 +258,8 @@ int32_t dmInitClient(SDnode *pDnode) {
rpcInit
.
parent
=
pDnode
;
rpcInit
.
rfp
=
rpcRfp
;
rpcInit
.
compressSize
=
tsCompressMsgSize
;
rpcInit
.
retryLimit
=
tsRpcRetryLimit
;
rpcInit
.
retryInterval
=
tsRpcRetryInterval
;
pTrans
->
clientRpc
=
rpcOpen
(
&
rpcInit
);
if
(
pTrans
->
clientRpc
==
NULL
)
{
...
...
source/dnode/vnode/src/tsdb/tsdbCommit.c
浏览文件 @
41c76d66
...
...
@@ -495,6 +495,10 @@ static int32_t tsdbCommitFileDataStart(SCommitter *pCommitter) {
pCommitter
->
commitFid
=
tsdbKeyFid
(
pCommitter
->
nextKey
,
pCommitter
->
minutes
,
pCommitter
->
precision
);
tsdbFidKeyRange
(
pCommitter
->
commitFid
,
pCommitter
->
minutes
,
pCommitter
->
precision
,
&
pCommitter
->
minKey
,
&
pCommitter
->
maxKey
);
#if 0
ASSERT(pCommitter->minKey <= pCommitter->nextKey && pCommitter->maxKey >= pCommitter->nextKey);
#endif
pCommitter
->
nextKey
=
TSKEY_MAX
;
// Reader
...
...
source/dnode/vnode/src/tsdb/tsdbUtil.c
浏览文件 @
41c76d66
...
...
@@ -505,8 +505,8 @@ int32_t tsdbKeyFid(TSKEY key, int32_t minutes, int8_t precision) {
}
void
tsdbFidKeyRange
(
int32_t
fid
,
int32_t
minutes
,
int8_t
precision
,
TSKEY
*
minKey
,
TSKEY
*
maxKey
)
{
*
minKey
=
fid
*
minutes
*
tsTickPerMin
[
precision
]
;
*
maxKey
=
*
minKey
+
minutes
*
tsTickPerMin
[
precision
]
-
1
;
*
minKey
=
tsTickPerMin
[
precision
]
*
fid
*
minutes
;
*
maxKey
=
*
minKey
+
tsTickPerMin
[
precision
]
*
minutes
-
1
;
}
int32_t
tsdbFidLevel
(
int32_t
fid
,
STsdbKeepCfg
*
pKeepCfg
,
int64_t
now
)
{
...
...
source/dnode/vnode/src/tsdb/tsdbWrite.c
浏览文件 @
41c76d66
...
...
@@ -15,6 +15,15 @@
#include "tsdb.h"
/**
* @brief max key by precision
* approximately calculation:
* ms: 3600*1000*8765*1000 // 1970 + 1000 years
* us: 3600*1000000*8765*1000 // 1970 + 1000 years
* ns: 3600*1000000000*8765*292 // 1970 + 292 years
*/
static
int64_t
tsMaxKeyByPrecision
[]
=
{
31556995200000L
,
31556995200000000L
,
9214646400000000000L
};
// static int tsdbScanAndConvertSubmitMsg(STsdb *pTsdb, SSubmitReq *pMsg);
int
tsdbInsertData
(
STsdb
*
pTsdb
,
int64_t
version
,
SSubmitReq
*
pMsg
,
SSubmitRsp
*
pRsp
)
{
...
...
@@ -97,7 +106,7 @@ int tsdbScanAndConvertSubmitMsg(STsdb *pTsdb, SSubmitReq *pMsg) {
STsdbKeepCfg
*
pCfg
=
&
pTsdb
->
keepCfg
;
TSKEY
now
=
taosGetTimestamp
(
pCfg
->
precision
);
TSKEY
minKey
=
now
-
tsTickPerMin
[
pCfg
->
precision
]
*
pCfg
->
keep2
;
TSKEY
maxKey
=
now
+
tsTickPerMin
[
pCfg
->
precision
]
*
pCfg
->
days
;
TSKEY
maxKey
=
tsMaxKeyByPrecision
[
pCfg
->
precision
]
;
terrno
=
TSDB_CODE_SUCCESS
;
// pMsg->length = htonl(pMsg->length);
...
...
source/libs/executor/src/timewindowoperator.c
浏览文件 @
41c76d66
...
...
@@ -1776,7 +1776,8 @@ SOperatorInfo* createIntervalOperatorInfo(SOperatorInfo* downstream, SIntervalPh
}
initResultRowInfo
(
&
pInfo
->
binfo
.
resultRowInfo
);
setOperatorInfo
(
pOperator
,
"TimeIntervalAggOperator"
,
QUERY_NODE_PHYSICAL_PLAN_HASH_INTERVAL
,
true
,
OP_NOT_OPENED
,
pInfo
,
pTaskInfo
);
setOperatorInfo
(
pOperator
,
"TimeIntervalAggOperator"
,
QUERY_NODE_PHYSICAL_PLAN_HASH_INTERVAL
,
true
,
OP_NOT_OPENED
,
pInfo
,
pTaskInfo
);
pOperator
->
fpSet
=
createOperatorFpSet
(
doOpenIntervalAgg
,
doBuildIntervalResult
,
NULL
,
destroyIntervalOperatorInfo
,
NULL
);
...
...
@@ -2551,9 +2552,9 @@ SOperatorInfo* createTimeSliceOperatorInfo(SOperatorInfo* downstream, SPhysiNode
pScanInfo
->
cond
.
twindows
=
pInfo
->
win
;
pScanInfo
->
cond
.
type
=
TIMEWINDOW_RANGE_EXTERNAL
;
setOperatorInfo
(
pOperator
,
"TimeSliceOperator"
,
QUERY_NODE_PHYSICAL_PLAN_INTERP_FUNC
,
false
,
OP_NOT_OPENED
,
pInfo
,
pTaskInfo
);
pOperator
->
fpSet
=
createOperatorFpSet
(
operatorDummyOpenFn
,
doTimeslice
,
NULL
,
destroyTimeSliceOperatorInfo
,
NULL
);
setOperatorInfo
(
pOperator
,
"TimeSliceOperator"
,
QUERY_NODE_PHYSICAL_PLAN_INTERP_FUNC
,
false
,
OP_NOT_OPENED
,
pInfo
,
pTaskInfo
);
pOperator
->
fpSet
=
createOperatorFpSet
(
operatorDummyOpenFn
,
doTimeslice
,
NULL
,
destroyTimeSliceOperatorInfo
,
NULL
);
blockDataEnsureCapacity
(
pInfo
->
pRes
,
pOperator
->
resultInfo
.
capacity
);
...
...
@@ -2622,7 +2623,8 @@ SOperatorInfo* createStatewindowOperatorInfo(SOperatorInfo* downstream, SStateWi
pInfo
->
tsSlotId
=
tsSlotId
;
setOperatorInfo
(
pOperator
,
"StateWindowOperator"
,
QUERY_NODE_PHYSICAL_PLAN_MERGE_STATE
,
true
,
OP_NOT_OPENED
,
pInfo
,
pTaskInfo
);
setOperatorInfo
(
pOperator
,
"StateWindowOperator"
,
QUERY_NODE_PHYSICAL_PLAN_MERGE_STATE
,
true
,
OP_NOT_OPENED
,
pInfo
,
pTaskInfo
);
pOperator
->
fpSet
=
createOperatorFpSet
(
openStateWindowAggOptr
,
doStateWindowAgg
,
NULL
,
destroyStateWindowOperatorInfo
,
NULL
);
...
...
@@ -2694,7 +2696,8 @@ SOperatorInfo* createSessionAggOperatorInfo(SOperatorInfo* downstream, SSessionW
goto
_error
;
}
setOperatorInfo
(
pOperator
,
"SessionWindowAggOperator"
,
QUERY_NODE_PHYSICAL_PLAN_MERGE_SESSION
,
true
,
OP_NOT_OPENED
,
pInfo
,
pTaskInfo
);
setOperatorInfo
(
pOperator
,
"SessionWindowAggOperator"
,
QUERY_NODE_PHYSICAL_PLAN_MERGE_SESSION
,
true
,
OP_NOT_OPENED
,
pInfo
,
pTaskInfo
);
pOperator
->
fpSet
=
createOperatorFpSet
(
operatorDummyOpenFn
,
doSessionWindowAgg
,
NULL
,
destroySWindowOperatorInfo
,
NULL
);
pOperator
->
pTaskInfo
=
pTaskInfo
;
...
...
@@ -3822,7 +3825,7 @@ static int32_t copyUpdateResult(SSHashObj* pStUpdated, SArray* pUpdated) {
return
TSDB_CODE_SUCCESS
;
}
void
doBuildDeleteDataBlock
(
SSHashObj
*
pStDeleted
,
SSDataBlock
*
pBlock
,
void
**
Ite
)
{
void
doBuildDeleteDataBlock
(
S
OperatorInfo
*
pOp
,
S
SHashObj
*
pStDeleted
,
SSDataBlock
*
pBlock
,
void
**
Ite
)
{
blockDataCleanup
(
pBlock
);
int32_t
size
=
tSimpleHashGetSize
(
pStDeleted
);
if
(
size
==
0
)
{
...
...
@@ -3848,6 +3851,26 @@ void doBuildDeleteDataBlock(SSHashObj* pStDeleted, SSDataBlock* pBlock, void** I
colDataAppendNULL
(
pCalStCol
,
pBlock
->
info
.
rows
);
SColumnInfoData
*
pCalEdCol
=
taosArrayGet
(
pBlock
->
pDataBlock
,
CALCULATE_END_TS_COLUMN_INDEX
);
colDataAppendNULL
(
pCalEdCol
,
pBlock
->
info
.
rows
);
SHashObj
*
pGroupIdTbNameMap
=
NULL
;
if
(
pOp
->
operatorType
==
QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_SESSION
||
pOp
->
operatorType
==
QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_SESSION
)
{
SStreamSessionAggOperatorInfo
*
pInfo
=
pOp
->
info
;
pGroupIdTbNameMap
=
pInfo
->
pGroupIdTbNameMap
;
}
else
if
(
pOp
->
operatorType
==
QUERY_NODE_PHYSICAL_PLAN_STREAM_STATE
)
{
SStreamStateAggOperatorInfo
*
pInfo
=
pOp
->
info
;
pGroupIdTbNameMap
=
pInfo
->
pGroupIdTbNameMap
;
}
char
*
tbname
=
taosHashGet
(
pGroupIdTbNameMap
,
&
res
->
groupId
,
sizeof
(
int64_t
));
SColumnInfoData
*
pTableCol
=
taosArrayGet
(
pBlock
->
pDataBlock
,
TABLE_NAME_COLUMN_INDEX
);
if
(
tbname
==
NULL
)
{
colDataAppendNULL
(
pTableCol
,
pBlock
->
info
.
rows
);
}
else
{
char
parTbName
[
VARSTR_HEADER_SIZE
+
TSDB_TABLE_NAME_LEN
];
STR_WITH_MAXSIZE_TO_VARSTR
(
parTbName
,
tbname
,
sizeof
(
parTbName
));
colDataAppend
(
pTableCol
,
pBlock
->
info
.
rows
,
(
const
char
*
)
parTbName
,
false
);
}
pBlock
->
info
.
rows
+=
1
;
}
if
((
*
Ite
)
==
NULL
)
{
...
...
@@ -3994,7 +4017,7 @@ static SSDataBlock* doStreamSessionAgg(SOperatorInfo* pOperator) {
if
(
pOperator
->
status
==
OP_EXEC_DONE
)
{
return
NULL
;
}
else
if
(
pOperator
->
status
==
OP_RES_TO_RETURN
)
{
doBuildDeleteDataBlock
(
pInfo
->
pStDeleted
,
pInfo
->
pDelRes
,
&
pInfo
->
pDelIterator
);
doBuildDeleteDataBlock
(
p
Operator
,
p
Info
->
pStDeleted
,
pInfo
->
pDelRes
,
&
pInfo
->
pDelIterator
);
if
(
pInfo
->
pDelRes
->
info
.
rows
>
0
)
{
printDataBlock
(
pInfo
->
pDelRes
,
IS_FINAL_OP
(
pInfo
)
?
"final session"
:
"single session"
);
return
pInfo
->
pDelRes
;
...
...
@@ -4099,7 +4122,7 @@ static SSDataBlock* doStreamSessionAgg(SOperatorInfo* pOperator) {
taosMemoryFree(pBuf);
#endif
doBuildDeleteDataBlock
(
pInfo
->
pStDeleted
,
pInfo
->
pDelRes
,
&
pInfo
->
pDelIterator
);
doBuildDeleteDataBlock
(
p
Operator
,
p
Info
->
pStDeleted
,
pInfo
->
pDelRes
,
&
pInfo
->
pDelIterator
);
if
(
pInfo
->
pDelRes
->
info
.
rows
>
0
)
{
printDataBlock
(
pInfo
->
pDelRes
,
IS_FINAL_OP
(
pInfo
)
?
"final session"
:
"single session"
);
return
pInfo
->
pDelRes
;
...
...
@@ -4223,7 +4246,7 @@ static SSDataBlock* doStreamSessionSemiAgg(SOperatorInfo* pOperator) {
return
pBInfo
->
pRes
;
}
doBuildDeleteDataBlock
(
pInfo
->
pStDeleted
,
pInfo
->
pDelRes
,
&
pInfo
->
pDelIterator
);
doBuildDeleteDataBlock
(
p
Operator
,
p
Info
->
pStDeleted
,
pInfo
->
pDelRes
,
&
pInfo
->
pDelIterator
);
if
(
pInfo
->
pDelRes
->
info
.
rows
>
0
)
{
printDataBlock
(
pInfo
->
pDelRes
,
"semi session delete"
);
return
pInfo
->
pDelRes
;
...
...
@@ -4303,7 +4326,7 @@ static SSDataBlock* doStreamSessionSemiAgg(SOperatorInfo* pOperator) {
return
pBInfo
->
pRes
;
}
doBuildDeleteDataBlock
(
pInfo
->
pStDeleted
,
pInfo
->
pDelRes
,
&
pInfo
->
pDelIterator
);
doBuildDeleteDataBlock
(
p
Operator
,
p
Info
->
pStDeleted
,
pInfo
->
pDelRes
,
&
pInfo
->
pDelIterator
);
if
(
pInfo
->
pDelRes
->
info
.
rows
>
0
)
{
printDataBlock
(
pInfo
->
pDelRes
,
"semi session delete"
);
return
pInfo
->
pDelRes
;
...
...
@@ -4327,7 +4350,7 @@ SOperatorInfo* createStreamFinalSessionAggOperatorInfo(SOperatorInfo* downstream
SStreamSessionAggOperatorInfo
*
pInfo
=
pOperator
->
info
;
pInfo
->
isFinal
=
(
pPhyNode
->
type
==
QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_SESSION
);
char
*
name
=
(
pInfo
->
isFinal
)
?
"StreamSessionFinalAggOperator"
:
"StreamSessionSemiAggOperator"
;
char
*
name
=
(
pInfo
->
isFinal
)
?
"StreamSessionFinalAggOperator"
:
"StreamSessionSemiAggOperator"
;
if
(
pPhyNode
->
type
!=
QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_SESSION
)
{
pInfo
->
pUpdateRes
=
createSpecialDataBlock
(
STREAM_CLEAR
);
...
...
@@ -4336,7 +4359,7 @@ SOperatorInfo* createStreamFinalSessionAggOperatorInfo(SOperatorInfo* downstream
destroyStreamSessionAggOperatorInfo
,
NULL
);
}
setOperatorInfo
(
pOperator
,
name
,
pPhyNode
->
type
,
false
,
OP_NOT_OPENED
,
pInfo
,
pTaskInfo
);
setOperatorInfo
(
pOperator
,
name
,
pPhyNode
->
type
,
false
,
OP_NOT_OPENED
,
pInfo
,
pTaskInfo
);
pInfo
->
pGroupIdTbNameMap
=
taosHashInit
(
1024
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_UBIGINT
),
false
,
HASH_NO_LOCK
);
...
...
@@ -4555,7 +4578,7 @@ static SSDataBlock* doStreamStateAgg(SOperatorInfo* pOperator) {
SOptrBasicInfo
*
pBInfo
=
&
pInfo
->
binfo
;
int64_t
maxTs
=
INT64_MIN
;
if
(
pOperator
->
status
==
OP_RES_TO_RETURN
)
{
doBuildDeleteDataBlock
(
pInfo
->
pSeDeleted
,
pInfo
->
pDelRes
,
&
pInfo
->
pDelIterator
);
doBuildDeleteDataBlock
(
p
Operator
,
p
Info
->
pSeDeleted
,
pInfo
->
pDelRes
,
&
pInfo
->
pDelIterator
);
if
(
pInfo
->
pDelRes
->
info
.
rows
>
0
)
{
printDataBlock
(
pInfo
->
pDelRes
,
"single state delete"
);
return
pInfo
->
pDelRes
;
...
...
@@ -4622,7 +4645,7 @@ static SSDataBlock* doStreamStateAgg(SOperatorInfo* pOperator) {
initGroupResInfoFromArrayList
(
&
pInfo
->
groupResInfo
,
pUpdated
);
blockDataEnsureCapacity
(
pInfo
->
binfo
.
pRes
,
pOperator
->
resultInfo
.
capacity
);
doBuildDeleteDataBlock
(
pInfo
->
pSeDeleted
,
pInfo
->
pDelRes
,
&
pInfo
->
pDelIterator
);
doBuildDeleteDataBlock
(
p
Operator
,
p
Info
->
pSeDeleted
,
pInfo
->
pDelRes
,
&
pInfo
->
pDelIterator
);
if
(
pInfo
->
pDelRes
->
info
.
rows
>
0
)
{
printDataBlock
(
pInfo
->
pDelRes
,
"single state delete"
);
return
pInfo
->
pDelRes
;
...
...
@@ -4698,7 +4721,8 @@ SOperatorInfo* createStreamStateAggOperatorInfo(SOperatorInfo* downstream, SPhys
pInfo
->
pGroupIdTbNameMap
=
taosHashInit
(
1024
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_UBIGINT
),
false
,
HASH_NO_LOCK
);
setOperatorInfo
(
pOperator
,
"StreamStateAggOperator"
,
QUERY_NODE_PHYSICAL_PLAN_STREAM_STATE
,
true
,
OP_NOT_OPENED
,
pInfo
,
pTaskInfo
);
setOperatorInfo
(
pOperator
,
"StreamStateAggOperator"
,
QUERY_NODE_PHYSICAL_PLAN_STREAM_STATE
,
true
,
OP_NOT_OPENED
,
pInfo
,
pTaskInfo
);
pOperator
->
fpSet
=
createOperatorFpSet
(
operatorDummyOpenFn
,
doStreamStateAgg
,
NULL
,
destroyStreamStateOperatorInfo
,
NULL
);
initDownStream
(
downstream
,
&
pInfo
->
streamAggSup
,
pInfo
->
twAggSup
.
waterMark
,
pOperator
->
operatorType
,
...
...
@@ -4973,7 +4997,8 @@ SOperatorInfo* createMergeAlignedIntervalOperatorInfo(SOperatorInfo* downstream,
initResultRowInfo
(
&
iaInfo
->
binfo
.
resultRowInfo
);
blockDataEnsureCapacity
(
iaInfo
->
binfo
.
pRes
,
pOperator
->
resultInfo
.
capacity
);
setOperatorInfo
(
pOperator
,
"TimeMergeAlignedIntervalAggOperator"
,
QUERY_NODE_PHYSICAL_PLAN_MERGE_ALIGNED_INTERVAL
,
false
,
OP_NOT_OPENED
,
miaInfo
,
pTaskInfo
);
setOperatorInfo
(
pOperator
,
"TimeMergeAlignedIntervalAggOperator"
,
QUERY_NODE_PHYSICAL_PLAN_MERGE_ALIGNED_INTERVAL
,
false
,
OP_NOT_OPENED
,
miaInfo
,
pTaskInfo
);
pOperator
->
fpSet
=
createOperatorFpSet
(
operatorDummyOpenFn
,
mergeAlignedIntervalAgg
,
NULL
,
destroyMAIOperatorInfo
,
NULL
);
...
...
@@ -5279,7 +5304,8 @@ SOperatorInfo* createMergeIntervalOperatorInfo(SOperatorInfo* downstream, SMerge
}
initResultRowInfo
(
&
pIntervalInfo
->
binfo
.
resultRowInfo
);
setOperatorInfo
(
pOperator
,
"TimeMergeIntervalAggOperator"
,
QUERY_NODE_PHYSICAL_PLAN_MERGE_INTERVAL
,
false
,
OP_NOT_OPENED
,
pMergeIntervalInfo
,
pTaskInfo
);
setOperatorInfo
(
pOperator
,
"TimeMergeIntervalAggOperator"
,
QUERY_NODE_PHYSICAL_PLAN_MERGE_INTERVAL
,
false
,
OP_NOT_OPENED
,
pMergeIntervalInfo
,
pTaskInfo
);
pOperator
->
fpSet
=
createOperatorFpSet
(
operatorDummyOpenFn
,
doMergeIntervalAgg
,
NULL
,
destroyMergeIntervalOperatorInfo
,
NULL
);
...
...
@@ -5509,9 +5535,10 @@ SOperatorInfo* createStreamIntervalOperatorInfo(SOperatorInfo* downstream, SPhys
pInfo
->
pGroupIdTbNameMap
=
taosHashInit
(
1024
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_UBIGINT
),
false
,
HASH_NO_LOCK
);
setOperatorInfo
(
pOperator
,
"StreamIntervalOperator"
,
QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERVAL
,
true
,
OP_NOT_OPENED
,
pInfo
,
pTaskInfo
);
pOperator
->
fpSet
=
createOperatorFpSet
(
operatorDummyOpenFn
,
doStreamIntervalAgg
,
NULL
,
destroyStreamFinalIntervalOperatorInfo
,
NULL
);
setOperatorInfo
(
pOperator
,
"StreamIntervalOperator"
,
QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERVAL
,
true
,
OP_NOT_OPENED
,
pInfo
,
pTaskInfo
);
pOperator
->
fpSet
=
createOperatorFpSet
(
operatorDummyOpenFn
,
doStreamIntervalAgg
,
NULL
,
destroyStreamFinalIntervalOperatorInfo
,
NULL
);
initIntervalDownStream
(
downstream
,
pPhyNode
->
type
,
&
pInfo
->
aggSup
,
&
pInfo
->
interval
,
&
pInfo
->
twAggSup
);
code
=
appendDownstream
(
pOperator
,
&
downstream
,
1
);
...
...
source/libs/nodes/src/nodesUtilFuncs.c
浏览文件 @
41c76d66
...
...
@@ -424,8 +424,9 @@ SNode* nodesMakeNode(ENodeType type) {
case
QUERY_NODE_SHOW_TRANSACTIONS_STMT
:
case
QUERY_NODE_SHOW_SUBSCRIPTIONS_STMT
:
case
QUERY_NODE_SHOW_TAGS_STMT
:
case
QUERY_NODE_SHOW_TABLE_TAGS_STMT
:
return
makeNode
(
type
,
sizeof
(
SShowStmt
));
case
QUERY_NODE_SHOW_TABLE_TAGS_STMT
:
return
makeNode
(
type
,
sizeof
(
SShowTableTagsStmt
));
case
QUERY_NODE_SHOW_DNODE_VARIABLES_STMT
:
return
makeNode
(
type
,
sizeof
(
SShowDnodeVariablesStmt
));
case
QUERY_NODE_SHOW_CREATE_DATABASE_STMT
:
...
...
@@ -942,13 +943,19 @@ void nodesDestroyNode(SNode* pNode) {
case
QUERY_NODE_SHOW_LOCAL_VARIABLES_STMT
:
case
QUERY_NODE_SHOW_TRANSACTIONS_STMT
:
case
QUERY_NODE_SHOW_SUBSCRIPTIONS_STMT
:
case
QUERY_NODE_SHOW_TAGS_STMT
:
case
QUERY_NODE_SHOW_TABLE_TAGS_STMT
:
{
case
QUERY_NODE_SHOW_TAGS_STMT
:
{
SShowStmt
*
pStmt
=
(
SShowStmt
*
)
pNode
;
nodesDestroyNode
(
pStmt
->
pDbName
);
nodesDestroyNode
(
pStmt
->
pTbName
);
break
;
}
case
QUERY_NODE_SHOW_TABLE_TAGS_STMT
:
{
SShowTableTagsStmt
*
pStmt
=
(
SShowTableTagsStmt
*
)
pNode
;
nodesDestroyNode
(
pStmt
->
pDbName
);
nodesDestroyNode
(
pStmt
->
pTbName
);
nodesDestroyList
(
pStmt
->
pTags
);
break
;
}
case
QUERY_NODE_SHOW_DNODE_VARIABLES_STMT
:
nodesDestroyNode
(((
SShowDnodeVariablesStmt
*
)
pNode
)
->
pDnodeId
);
nodesDestroyNode
(((
SShowDnodeVariablesStmt
*
)
pNode
)
->
pLikePattern
);
...
...
source/libs/parser/inc/parAst.h
浏览文件 @
41c76d66
...
...
@@ -178,6 +178,7 @@ SNode* createShowCreateTableStmt(SAstCreateContext* pCxt, ENodeType type, SNode*
SNode
*
createShowTableDistributedStmt
(
SAstCreateContext
*
pCxt
,
SNode
*
pRealTable
);
SNode
*
createShowDnodeVariablesStmt
(
SAstCreateContext
*
pCxt
,
SNode
*
pDnodeId
,
SNode
*
pLikePattern
);
SNode
*
createShowVnodesStmt
(
SAstCreateContext
*
pCxt
,
SNode
*
pDnodeId
,
SNode
*
pDnodeEndpoint
);
SNode
*
createShowTableTagsStmt
(
SAstCreateContext
*
pCxt
,
SNode
*
pTbName
,
SNode
*
pDbName
,
SNodeList
*
pTags
);
SNode
*
createCreateUserStmt
(
SAstCreateContext
*
pCxt
,
SToken
*
pUserName
,
const
SToken
*
pPassword
,
int8_t
sysinfo
);
SNode
*
createAlterUserStmt
(
SAstCreateContext
*
pCxt
,
SToken
*
pUserName
,
int8_t
alterType
,
const
SToken
*
pVal
);
SNode
*
createDropUserStmt
(
SAstCreateContext
*
pCxt
,
SToken
*
pUserName
);
...
...
source/libs/parser/inc/sql.y
浏览文件 @
41c76d66
...
...
@@ -426,7 +426,7 @@ cmd ::= SHOW TABLE DISTRIBUTED full_table_name(A).
cmd ::= SHOW CONSUMERS. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONSUMERS_STMT); }
cmd ::= SHOW SUBSCRIPTIONS. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SUBSCRIPTIONS_STMT); }
cmd ::= SHOW TAGS FROM table_name_cond(A) from_db_opt(B). { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, B, A, OP_TYPE_EQUAL); }
cmd ::= SHOW TABLE TAGS
FROM table_name_cond(A) from_db_opt(B). { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TABLE_TAGS_STMT, B, A, OP_TYPE_EQUAL
); }
cmd ::= SHOW TABLE TAGS
tag_list_opt(C) FROM table_name_cond(A) from_db_opt(B). { pCxt->pRootNode = createShowTableTagsStmt(pCxt, A, B, C
); }
cmd ::= SHOW VNODES NK_INTEGER(A). { pCxt->pRootNode = createShowVnodesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &A), NULL); }
cmd ::= SHOW VNODES NK_STRING(A). { pCxt->pRootNode = createShowVnodesStmt(pCxt, NULL, createValueNode(pCxt, TSDB_DATA_TYPE_VARCHAR, &A)); }
...
...
@@ -441,6 +441,18 @@ table_name_cond(A) ::= table_name(B).
from_db_opt(A) ::= . { A = createDefaultDatabaseCondValue(pCxt); }
from_db_opt(A) ::= FROM db_name(B). { A = createIdentifierValueNode(pCxt, &B); }
%type tag_list_opt { SNodeList* }
%destructor tag_list_opt { nodesDestroyList($$); }
tag_list_opt(A) ::= . { A = NULL; }
tag_list_opt(A) ::= tag_item(B). { A = createNodeList(pCxt, B); }
tag_list_opt(A) ::= tag_list_opt(B) NK_COMMA tag_item(C). { A = addNodeToList(pCxt, B, C); }
tag_item(A) ::= TBNAME(B). { A = setProjectionAlias(pCxt, createFunctionNode(pCxt, &B, NULL), &B); }
tag_item(A) ::= QTAGS(B). { A = createFunctionNode(pCxt, &B, NULL); }
tag_item(A) ::= column_name(B). { A = createColumnNode(pCxt, NULL, &B); }
tag_item(A) ::= column_name(B) column_alias(C). { A = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &B), &C); }
tag_item(A) ::= column_name(B) AS column_alias(C). { A = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &B), &C); }
/************************************************ create index ********************************************************/
cmd ::= CREATE SMA INDEX not_exists_opt(D)
full_table_name(A) ON full_table_name(B) index_options(C). { pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, D, A, B, NULL, C); }
...
...
source/libs/parser/src/parAstCreater.c
浏览文件 @
41c76d66
...
...
@@ -1390,6 +1390,21 @@ SNode* createShowVnodesStmt(SAstCreateContext* pCxt, SNode* pDnodeId, SNode* pDn
return
(
SNode
*
)
pStmt
;
}
SNode
*
createShowTableTagsStmt
(
SAstCreateContext
*
pCxt
,
SNode
*
pTbName
,
SNode
*
pDbName
,
SNodeList
*
pTags
)
{
CHECK_PARSER_STATUS
(
pCxt
);
if
(
NULL
==
pDbName
)
{
snprintf
(
pCxt
->
pQueryCxt
->
pMsg
,
pCxt
->
pQueryCxt
->
msgLen
,
"database not specified"
);
pCxt
->
errCode
=
TSDB_CODE_PAR_SYNTAX_ERROR
;
return
NULL
;
}
SShowTableTagsStmt
*
pStmt
=
(
SShowTableTagsStmt
*
)
nodesMakeNode
(
QUERY_NODE_SHOW_TABLE_TAGS_STMT
);
CHECK_OUT_OF_MEM
(
pStmt
);
pStmt
->
pDbName
=
pDbName
;
pStmt
->
pTbName
=
pTbName
;
pStmt
->
pTags
=
pTags
;
return
(
SNode
*
)
pStmt
;
}
SNode
*
createCreateUserStmt
(
SAstCreateContext
*
pCxt
,
SToken
*
pUserName
,
const
SToken
*
pPassword
,
int8_t
sysinfo
)
{
CHECK_PARSER_STATUS
(
pCxt
);
char
password
[
TSDB_USET_PASSWORD_LEN
]
=
{
0
};
...
...
source/libs/parser/src/parAstParser.c
浏览文件 @
41c76d66
...
...
@@ -440,7 +440,7 @@ static int32_t collectMetaKeyFromShowTags(SCollectMetaKeyCxt* pCxt, SShowStmt* p
return
code
;
}
static
int32_t
collectMetaKeyFromShowStableTags
(
SCollectMetaKeyCxt
*
pCxt
,
SShowStmt
*
pStmt
)
{
static
int32_t
collectMetaKeyFromShowStableTags
(
SCollectMetaKeyCxt
*
pCxt
,
SShow
TableTags
Stmt
*
pStmt
)
{
return
collectMetaKeyFromRealTableImpl
(
pCxt
,
((
SValueNode
*
)
pStmt
->
pDbName
)
->
literal
,
((
SValueNode
*
)
pStmt
->
pTbName
)
->
literal
,
AUTH_TYPE_READ
);
}
...
...
@@ -627,7 +627,7 @@ static int32_t collectMetaKeyFromQuery(SCollectMetaKeyCxt* pCxt, SNode* pStmt) {
case
QUERY_NODE_SHOW_TAGS_STMT
:
return
collectMetaKeyFromShowTags
(
pCxt
,
(
SShowStmt
*
)
pStmt
);
case
QUERY_NODE_SHOW_TABLE_TAGS_STMT
:
return
collectMetaKeyFromShowStableTags
(
pCxt
,
(
SShowStmt
*
)
pStmt
);
return
collectMetaKeyFromShowStableTags
(
pCxt
,
(
SShow
TableTags
Stmt
*
)
pStmt
);
case
QUERY_NODE_SHOW_USERS_STMT
:
return
collectMetaKeyFromShowUsers
(
pCxt
,
(
SShowStmt
*
)
pStmt
);
case
QUERY_NODE_SHOW_LICENCES_STMT
:
...
...
source/libs/parser/src/parTranslater.c
浏览文件 @
41c76d66
...
...
@@ -6288,21 +6288,29 @@ static SNode* createTagsFunction() {
return
(
SNode
*
)
pFunc
;
}
static
int32_t
createShowTableTagsProjections
(
SNodeList
**
pProjections
,
SNodeList
**
pTags
)
{
if
(
NULL
!=
*
pTags
)
{
TSWAP
(
*
pProjections
,
*
pTags
);
return
TSDB_CODE_SUCCESS
;
}
int32_t
code
=
nodesListMakeStrictAppend
(
pProjections
,
createTbnameFunction
());
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
nodesListStrictAppend
(
*
pProjections
,
createTagsFunction
());
}
return
code
;
}
static
int32_t
rewriteShowStableTags
(
STranslateContext
*
pCxt
,
SQuery
*
pQuery
)
{
const
char
*
cols
[]
=
{
"tbname"
,
"_tags"
};
SShowStmt
*
pShow
=
(
SShowStmt
*
)
pQuery
->
pRoot
;
SSelectStmt
*
pSelect
=
NULL
;
SShowTableTagsStmt
*
pShow
=
(
SShowTableTagsStmt
*
)
pQuery
->
pRoot
;
SSelectStmt
*
pSelect
=
NULL
;
int32_t
code
=
createSimpleSelectStmt
(((
SValueNode
*
)
pShow
->
pDbName
)
->
literal
,
((
SValueNode
*
)
pShow
->
pTbName
)
->
literal
,
-
1
,
NULL
,
&
pSelect
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
nodesListMakeStrictAppend
(
&
pSelect
->
pProjectionList
,
createTbnameFunction
());
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
nodesListMakeStrictAppend
(
&
pSelect
->
pProjectionList
,
createTagsFunction
());
code
=
createShowTableTagsProjections
(
&
pSelect
->
pProjectionList
,
&
pShow
->
pTags
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
pSelect
->
isDistinct
=
true
;
pQuery
->
showRewrite
=
true
;
pSelect
->
tagScan
=
true
;
nodesDestroyNode
(
pQuery
->
pRoot
);
pQuery
->
pRoot
=
(
SNode
*
)
pSelect
;
}
else
{
...
...
source/libs/parser/src/sql.c
浏览文件 @
41c76d66
此差异已折叠。
点击以展开。
source/libs/parser/test/parShowToUse.cpp
浏览文件 @
41c76d66
...
...
@@ -192,6 +192,16 @@ TEST_F(ParserShowToUseTest, showTableDistributed) {
run
(
"SHOW TABLE DISTRIBUTED st1"
);
}
TEST_F
(
ParserShowToUseTest
,
showTableTags
)
{
useDb
(
"root"
,
"test"
);
run
(
"SHOW TABLE TAGS FROM st1"
);
run
(
"SHOW TABLE TAGS tag1, tag2 FROM st1"
);
run
(
"SHOW TABLE TAGS TBNAME, _TAGS, tag3 FROM st1"
);
}
TEST_F
(
ParserShowToUseTest
,
showTags
)
{
useDb
(
"root"
,
"test"
);
...
...
source/libs/planner/src/planLogicCreater.c
浏览文件 @
41c76d66
...
...
@@ -189,7 +189,7 @@ static int32_t createSelectRootLogicNode(SLogicPlanContext* pCxt, SSelectStmt* p
}
static
EScanType
getScanType
(
SLogicPlanContext
*
pCxt
,
SNodeList
*
pScanPseudoCols
,
SNodeList
*
pScanCols
,
int8_t
tableType
)
{
int8_t
tableType
,
bool
tagScan
)
{
if
(
pCxt
->
pPlanCxt
->
topicQuery
||
pCxt
->
pPlanCxt
->
streamQuery
)
{
return
SCAN_TYPE_STREAM
;
}
...
...
@@ -198,6 +198,10 @@ static EScanType getScanType(SLogicPlanContext* pCxt, SNodeList* pScanPseudoCols
return
SCAN_TYPE_SYSTEM_TABLE
;
}
if
(
tagScan
)
{
return
SCAN_TYPE_TAG
;
}
if
(
NULL
==
pScanCols
)
{
return
NULL
==
pScanPseudoCols
?
SCAN_TYPE_TABLE
...
...
@@ -310,7 +314,7 @@ static int32_t createScanLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect
code
=
rewriteExprsForSelect
(
pScan
->
pScanPseudoCols
,
pSelect
,
SQL_CLAUSE_FROM
);
}
pScan
->
scanType
=
getScanType
(
pCxt
,
pScan
->
pScanPseudoCols
,
pScan
->
pScanCols
,
pScan
->
tableType
);
pScan
->
scanType
=
getScanType
(
pCxt
,
pScan
->
pScanPseudoCols
,
pScan
->
pScanCols
,
pScan
->
tableType
,
pSelect
->
tagScan
);
if
(
NULL
!=
pScan
->
pScanCols
)
{
pScan
->
hasNormalCols
=
true
;
...
...
source/libs/stream/src/streamMeta.c
浏览文件 @
41c76d66
...
...
@@ -187,11 +187,9 @@ int32_t streamMetaRemoveTask(SStreamMeta* pMeta, int32_t taskId) {
while
(
1
)
{
int8_t
schedStatus
=
atomic_val_compare_exchange_8
(
&
pTask
->
schedStatus
,
TASK_SCHED_STATUS__INACTIVE
,
TASK_SCHED_STATUS__DROPPING
);
if
(
schedStatus
==
TASK_SCHED_STATUS__IN
ACTIVE
)
{
if
(
schedStatus
!=
TASK_SCHED_STATUS__
ACTIVE
)
{
tFreeSStreamTask
(
pTask
);
break
;
}
else
if
(
schedStatus
==
TASK_SCHED_STATUS__DROPPING
)
{
break
;
}
taosMsleep
(
10
);
}
...
...
source/libs/transport/inc/transComm.h
浏览文件 @
41c76d66
...
...
@@ -94,11 +94,11 @@ typedef void* queue[2];
/* Return the structure holding the given element. */
#define QUEUE_DATA(e, type, field) ((type*)((void*)((char*)(e)-offsetof(type, field))))
#define TRANS_RETRY_COUNT_LIMIT 100 // retry count limit
#define TRANS_RETRY_INTERVAL 15 // retry interval (ms)
#define TRANS_CONN_TIMEOUT
3 // connect timeout (s)
#define TRANS_READ_TIMEOUT
3000 // read timeout (ms)
#define TRANS_PACKET_LIMIT
1024 * 1024 * 512
//
#define TRANS_RETRY_COUNT_LIMIT 100 // retry count limit
//
#define TRANS_RETRY_INTERVAL 15 // retry interval (ms)
#define TRANS_CONN_TIMEOUT 3 // connect timeout (s)
#define TRANS_READ_TIMEOUT 3000 // read timeout (ms)
#define TRANS_PACKET_LIMIT 1024 * 1024 * 512
#define TRANS_MAGIC_NUM 0x5f375a86
...
...
source/libs/transport/inc/transportInt.h
浏览文件 @
41c76d66
...
...
@@ -47,8 +47,10 @@ typedef struct {
char
label
[
TSDB_LABEL_LEN
];
char
user
[
TSDB_UNI_LEN
];
// meter ID
int32_t
compressSize
;
// -1: no compress, 0 : all data compressed, size: compress data if larger than size
int8_t
encryption
;
// encrypt or not
int32_t
compressSize
;
// -1: no compress, 0 : all data compressed, size: compress data if larger than size
int8_t
encryption
;
// encrypt or not
int32_t
retryLimit
;
// retry limit
int32_t
retryInterval
;
// retry interval ms
void
(
*
cfp
)(
void
*
parent
,
SRpcMsg
*
,
SEpSet
*
);
bool
(
*
retry
)(
int32_t
code
,
tmsg_t
msgType
);
...
...
source/libs/transport/src/trans.c
浏览文件 @
41c76d66
...
...
@@ -48,6 +48,8 @@ void* rpcOpen(const SRpcInit* pInit) {
pRpc
->
compressSize
=
pInit
->
compressSize
;
pRpc
->
encryption
=
pInit
->
encryption
;
pRpc
->
retryLimit
=
pInit
->
retryLimit
;
pRpc
->
retryInterval
=
pInit
->
retryInterval
;
// register callback handle
pRpc
->
cfp
=
pInit
->
cfp
;
...
...
source/libs/transport/src/transCli.c
浏览文件 @
41c76d66
...
...
@@ -1288,6 +1288,7 @@ static void doCloseIdleConn(void* param) {
}
static
void
cliSchedMsgToNextNode
(
SCliMsg
*
pMsg
,
SCliThrd
*
pThrd
)
{
STrans
*
pTransInst
=
pThrd
->
pTransInst
;
STransConnCtx
*
pCtx
=
pMsg
->
ctx
;
STraceId
*
trace
=
&
pMsg
->
msg
.
info
.
traceId
;
...
...
@@ -1299,7 +1300,7 @@ static void cliSchedMsgToNextNode(SCliMsg* pMsg, SCliThrd* pThrd) {
STaskArg
*
arg
=
taosMemoryMalloc
(
sizeof
(
STaskArg
));
arg
->
param1
=
pMsg
;
arg
->
param2
=
pThrd
;
transDQSched
(
pThrd
->
delayQueue
,
doDelayTask
,
arg
,
TRANS_RETRY_INTERVAL
);
transDQSched
(
pThrd
->
delayQueue
,
doDelayTask
,
arg
,
pTransInst
->
retryInterval
);
}
FORCE_INLINE
void
cliCompareAndSwap
(
int8_t
*
val
,
int8_t
exp
,
int8_t
newVal
)
{
...
...
@@ -1351,7 +1352,7 @@ int cliAppCb(SCliConn* pConn, STransMsg* pResp, SCliMsg* pMsg) {
pMsg
->
sent
=
0
;
pCtx
->
retryCnt
+=
1
;
if
(
code
==
TSDB_CODE_RPC_NETWORK_UNAVAIL
||
code
==
TSDB_CODE_RPC_BROKEN_LINK
)
{
cliCompareAndSwap
(
&
pCtx
->
retryLimit
,
TRANS_RETRY_COUNT_LIMIT
,
EPSET_GET_SIZE
(
&
pCtx
->
epSet
)
*
3
);
cliCompareAndSwap
(
&
pCtx
->
retryLimit
,
pTransInst
->
retryLimit
,
EPSET_GET_SIZE
(
&
pCtx
->
epSet
)
*
3
);
if
(
pCtx
->
retryCnt
<
pCtx
->
retryLimit
)
{
transUnrefCliHandle
(
pConn
);
EPSET_FORWARD_INUSE
(
&
pCtx
->
epSet
);
...
...
@@ -1360,7 +1361,7 @@ int cliAppCb(SCliConn* pConn, STransMsg* pResp, SCliMsg* pMsg) {
return
-
1
;
}
}
else
{
cliCompareAndSwap
(
&
pCtx
->
retryLimit
,
TRANS_RETRY_COUNT_LIMIT
,
TRANS_RETRY_COUNT_LIMIT
);
cliCompareAndSwap
(
&
pCtx
->
retryLimit
,
pTransInst
->
retryLimit
,
pTransInst
->
retryLimit
);
if
(
pCtx
->
retryCnt
<
pCtx
->
retryLimit
)
{
if
(
pResp
->
contLen
==
0
)
{
EPSET_FORWARD_INUSE
(
&
pCtx
->
epSet
);
...
...
tests/parallel_test/cases.task
浏览文件 @
41c76d66
...
...
@@ -6,8 +6,8 @@
,,y,unit-test,bash test.sh
#tsim test
,,
y
,script,./test.sh -f tsim/user/basic.sim
,,
y
,script,./test.sh -f tsim/user/password.sim
,,,script,./test.sh -f tsim/user/basic.sim
,,,script,./test.sh -f tsim/user/password.sim
,,,script,./test.sh -f tsim/user/privilege_db.sim
,,,script,./test.sh -f tsim/user/privilege_sysinfo.sim
,,,script,./test.sh -f tsim/db/alter_option.sim
...
...
tests/parallel_test/container_build.sh
浏览文件 @
41c76d66
...
...
@@ -54,7 +54,7 @@ fi
date
docker run
\
-v
$REP_MOUNT_PARAM
\
--rm
--ulimit
core
=
-1
taos_test:v1.0 sh
-c
"cd
$REP_DIR
;rm -rf debug;mkdir -p debug;cd debug;cmake .. -DBUILD_HTTP=false -DBUILD_TOOLS=true -DBUILD_TEST=true -DWEBSOCKET=true;make -j
$THREAD_COUNT
"
--rm
--ulimit
core
=
-1
taos_test:v1.0 sh
-c
"cd
$REP_DIR
;rm -rf debug;mkdir -p debug;cd debug;cmake .. -DBUILD_HTTP=false -DBUILD_TOOLS=true -DBUILD_TEST=true -DWEBSOCKET=true;make -j
$THREAD_COUNT
|| exit 1
"
if
[[
-d
${
WORKDIR
}
/debugNoSan
]]
;
then
echo
"delete
${
WORKDIR
}
/debugNoSan"
...
...
@@ -69,7 +69,7 @@ mv ${REP_REAL_PATH}/debug ${WORKDIR}/debugNoSan
date
docker run
\
-v
$REP_MOUNT_PARAM
\
--rm
--ulimit
core
=
-1
taos_test:v1.0 sh
-c
"cd
$REP_DIR
;rm -rf debug;mkdir -p debug;cd debug;cmake .. -DBUILD_HTTP=false -DBUILD_TOOLS=true -DBUILD_TEST=true -DWEBSOCKET=true -DSANITIZER=true;make -j
$THREAD_COUNT
"
--rm
--ulimit
core
=
-1
taos_test:v1.0 sh
-c
"cd
$REP_DIR
;rm -rf debug;mkdir -p debug;cd debug;cmake .. -DBUILD_HTTP=false -DBUILD_TOOLS=true -DBUILD_TEST=true -DWEBSOCKET=true -DSANITIZER=true;make -j
$THREAD_COUNT
|| exit 1
"
mv
${
REP_REAL_PATH
}
/debug
${
WORKDIR
}
/debugSan
...
...
tests/script/sh/checkAsan.sh
0 → 100755
浏览文件 @
41c76d66
#!/bin/bash
set
+e
#set -x
SCRIPT_DIR
=
`
dirname
$0
`
cd
$SCRIPT_DIR
/../
SCRIPT_DIR
=
`
pwd
`
IN_TDINTERNAL
=
"community"
if
[[
"
$SCRIPT_DIR
"
==
*
"
$IN_TDINTERNAL
"
*
]]
;
then
cd
../../..
else
cd
../../
fi
TAOS_DIR
=
`
pwd
`
LOG_DIR
=
$TAOS_DIR
/sim/tsim/asan
error_num
=
`
cat
${
LOG_DIR
}
/tsim.asan |
grep
"ERROR"
|
wc
-l
`
memory_leak
=
`
cat
${
LOG_DIR
}
/tsim.asan |
grep
"Direct leak"
|
wc
-l
`
indirect_leak
=
`
cat
${
LOG_DIR
}
/tsim.asan |
grep
"Indirect leak"
|
wc
-l
`
runtime_error
=
`
cat
${
LOG_DIR
}
/tsim.asan |
grep
"runtime error"
|
wc
-l
`
echo
-e
"
\0
33[44;32;1m"
asan error_num:
$error_num
"
\0
33[0m"
echo
-e
"
\0
33[44;32;1m"
asan memory_leak:
$memory_leak
"
\0
33[0m"
echo
-e
"
\0
33[44;32;1m"
asan indirect_leak:
$indirect_leak
"
\0
33[0m"
echo
-e
"
\0
33[44;32;1m"
asan runtime error:
$runtime_error
"
\0
33[0m"
let
"errors=
$error_num
+
$memory_leak
+
$indirect_leak
+
$runtime_error
"
if
[
$errors
-eq
0
]
;
then
echo
-e
"
\0
33[44;32;1m"
no asan errors
"
\0
33[0m"
exit
0
else
echo
-e
"
\0
33[44;31;1m"
asan total errors:
$errors
"
\0
33[0m"
cat
${
LOG_DIR
}
/tsim.asan
exit
1
fi
\ No newline at end of file
tests/script/sh/exec.sh
浏览文件 @
41c76d66
...
...
@@ -80,7 +80,7 @@ LOG_DIR=$NODE_DIR/log
DATA_DIR
=
$NODE_DIR
/data
MGMT_DIR
=
$NODE_DIR
/data/mgmt
TSDB_DIR
=
$NODE_DIR
/data/tsdb
ASAN_DIR
=
$SIM_DIR
/tsim/asan
TAOS_CFG
=
$NODE_DIR
/cfg/taos.cfg
echo
------------
$EXEC_OPTON
$NODE_NAME
...
...
@@ -105,7 +105,7 @@ if [ "$EXEC_OPTON" = "start" ]; then
nohup
valgrind
--log-file
=
${
LOG_DIR
}
/valgrind-taosd-
${
NODE_NAME
}
-
${
TT
}
.log
--tool
=
memcheck
--leak-check
=
full
--show-reachable
=
no
--track-origins
=
yes
--show-leak-kinds
=
all
--num-callers
=
20
-v
-v
--workaround-gcc296-bugs
=
yes
$EXE_DIR
/taosd
-c
$CFG_DIR
>
/dev/null 2>&1 &
else
echo
"nohup
$EXE_DIR
/taosd -c
$CFG_DIR
> /dev/null 2>&1 &"
nohup
$EXE_DIR
/taosd
-c
$CFG_DIR
>
/dev/null 2>
&1
&
nohup
$EXE_DIR
/taosd
-c
$CFG_DIR
>
/dev/null 2>
$ASAN_DIR
/
$NODE_NAME
.asan
&
fi
else
...
...
tests/script/test.sh
浏览文件 @
41c76d66
...
...
@@ -74,6 +74,7 @@ PRG_DIR=$SIM_DIR/tsim
CFG_DIR
=
$PRG_DIR
/cfg
LOG_DIR
=
$PRG_DIR
/log
DATA_DIR
=
$PRG_DIR
/data
ASAN_DIR
=
$PRG_DIR
/asan
chmod
-R
777
$PRG_DIR
echo
"------------------------------------------------------------------------"
...
...
@@ -82,14 +83,17 @@ echo "BUILD_DIR: $BUILD_DIR"
echo
"SIM_DIR :
$SIM_DIR
"
echo
"CODE_DIR :
$CODE_DIR
"
echo
"CFG_DIR :
$CFG_DIR
"
echo
"ASAN_DIR :
$ASAN_DIR
"
rm
-rf
$SIM_DIR
/
*
rm
-rf
$LOG_DIR
rm
-rf
$CFG_DIR
rm
-rf
$ASAN_DIR
mkdir
-p
$PRG_DIR
mkdir
-p
$LOG_DIR
mkdir
-p
$CFG_DIR
mkdir
-p
$ASAN_DIR
TAOS_CFG
=
$PRG_DIR
/cfg/taos.cfg
touch
-f
$TAOS_CFG
...
...
@@ -132,8 +136,9 @@ if [ -n "$FILE_NAME" ]; then
echo
"ExcuteCmd:"
$PROGRAM
-c
$CFG_DIR
-f
$FILE_NAME
-v
$PROGRAM
-c
$CFG_DIR
-f
$FILE_NAME
-v
else
echo
"ExcuteCmd:"
$PROGRAM
-c
$CFG_DIR
-f
$FILE_NAME
$PROGRAM
-c
$CFG_DIR
-f
$FILE_NAME
echo
"ExcuteCmd:"
$PROGRAM
-c
$CFG_DIR
-f
$FILE_NAME
$PROGRAM
-c
$CFG_DIR
-f
$FILE_NAME
2>
$ASAN_DIR
/tsim.asan
$CODE_DIR
/sh/checkAsan.sh
fi
else
echo
"ExcuteCmd:"
$PROGRAM
-c
$CFG_DIR
-f
basicSuite.sim
...
...
tests/script/tsim/db/commit.sim
浏览文件 @
41c76d66
...
...
@@ -89,8 +89,8 @@ if $data01 != 40 then
endi
print ======== step4 import new data
sql_error import into tb values (now + 30d , 30 )
sql_error import into tb values (now + 31d , 31 )
#
sql_error import into tb values (now + 30d , 30 )
#
sql_error import into tb values (now + 31d , 31 )
sql select * from tb order by ts desc
print ===> rows $rows
...
...
tests/script/tsim/table/date.sim
浏览文件 @
41c76d66
...
...
@@ -9,7 +9,7 @@ $tbPrefix = lm_da_tb
$db = $dbPrefix . $i
$tb = $tbPrefix . $i
print =============== step1
print =============== step1
ms db
sql create database $db
sql use $db
...
...
@@ -23,7 +23,7 @@ if $data00 != @17-01-01 08:00:00.001@ then
return -1
endi
print =============== step2
print =============== step2
ms db
sql_error insert into $tb values ('2017-08-28 00:23:46.429+ 1a', 2)
sql_error insert into $tb values ('2017-08-28 00:23:46cd .429', 2)
sql select ts from $tb
...
...
@@ -31,7 +31,7 @@ if $rows != 1 then
return -1
endi
print =============== step3
print =============== step3
ms db
sql_error insert into $tb values ('1970-01-01 08:00:00.000', 3)
sql_error insert into $tb values ('1970-01-01 08:00:00.000', 3)
sql select ts from $tb
...
...
@@ -39,39 +39,48 @@ if $rows != 1 then
return -1
endi
print =============== step4
print =============== step4
ms db
sql insert into $tb values(now, 4);
sql insert into $tb values(now+1a, 5);
sql insert into $tb values(now+1s, 6);
sql insert into $tb values(now+1m, 7);
sql insert into $tb values(now+1h, 8);
sql insert into $tb values(now+1d, 9);
sql
_error
insert into $tb values(now+3w, 10);
sql
_error insert into $tb values(now+1n
, 11);
sql
_error insert into $tb values(now+1y
, 12);
sql insert into $tb values(now+3w, 10);
sql
insert into $tb values(31556995200000
, 11);
sql
insert into $tb values('2970-01-01 00:00:00.000'
, 12);
print =============== step5
sql_error insert into $tb values ('9999-12-31 213:59:59.999', 13)
sql_error insert into $tb values(now+1n, 20);
sql_error insert into $tb values(now+1y, 21);
sql_error insert into $tb values(31556995200001, 22);
sql_error insert into $tb values('2970-01-02 00:00:00.000', 23);
sql_error insert into $tb values(9223372036854775807, 24);
sql_error insert into $tb values(9223372036854775808, 25);
sql_error insert into $tb values(92233720368547758088, 26);
print =============== step5 ms db
sql_error insert into $tb values ('9999-12-31 213:59:59.999', 27)
sql select ts from $tb
print $rows
if $rows !=
7
then
if $rows !=
10
then
return -1
endi
print =============== step6
sql_error insert into $tb values ('9999-12-99 23:59:59.999',
13
)
print =============== step6
ms db
sql_error insert into $tb values ('9999-12-99 23:59:59.999',
28
)
sql select ts from $tb
if $rows !=
7
then
if $rows !=
10
then
return -1
endi
print =============== step7
print =============== step7
ms db
$i = 1
$tb = $tbPrefix . $i
sql create table $tb (ts timestamp, ts2 timestamp)
print =============== step8
print =============== step8
ms db
sql insert into $tb values (now, now)
sql select * from $tb
if $rows != 1 then
...
...
@@ -84,4 +93,131 @@ if $rows != 2 then
return -1
endi
print =============== step20 us db
sql create database $db precision 'us' keep 365000d;
sql create table $tb (ts timestamp, speed int)
sql insert into $tb values ('2017-01-01 08:00:00.001', 1)
sql select ts from $tb
if $rows != 1 then
return -1
endi
if $data00 != @17-01-01 08:00:00.001000@ then
print data00 = $data00
return -1
endi
print =============== step21 us db
sql_error insert into $tb values ('2017-08-28 00:23:46.429+ 1a', 2)
sql_error insert into $tb values ('2017-08-28 00:23:46cd .429', 2)
sql select ts from $tb
if $rows != 1 then
return -1
endi
print =============== step22 us db
sql_error insert into $tb values ('970-01-01 08:00:00.000', 3)
sql_error insert into $tb values ('970-01-01 08:00:00.000', 3)
sql select ts from $tb
if $rows != 1 then
return -1
endi
print =============== step23 us db
sql insert into $tb values(now, 4);
sql insert into $tb values(now+1a, 5);
sql insert into $tb values(now+1s, 6);
sql insert into $tb values(now+1m, 7);
sql insert into $tb values(now+1h, 8);
sql insert into $tb values(now+1d, 9);
sql insert into $tb values(now+3w, 10);
sql insert into $tb values(31556995200000000, 11);
sql insert into $tb values('2970-01-01 00:00:00.000000', 12);
sql_error insert into $tb values(now+1n, 20);
sql_error insert into $tb values(now+1y, 21);
sql_error insert into $tb values(31556995200000001, 22);
sql_error insert into $tb values('2970-01-02 00:00:00.000000', 23);
sql_error insert into $tb values(9223372036854775807, 24);
sql_error insert into $tb values(9223372036854775808, 25);
sql_error insert into $tb values(92233720368547758088, 26);
sql_error insert into $tb values ('9999-12-31 213:59:59.999', 27)
print =============== step24 us db
sql select ts from $tb
print $rows
if $rows != 10 then
return -1
endi
sql drop database $db
sql select * from information_schema.ins_databases
if $rows != 2 then
return -1
endi
print =============== step30 ns db
sql create database $db precision 'ns' keep 36500d;
sql create table $tb (ts timestamp, speed int)
sql insert into $tb values ('2017-01-01 08:00:00.001', 1)
sql select ts from $tb
if $rows != 1 then
return -1
endi
if $data00 != @17-01-01 08:00:00.001000000@ then
print data00 = $data00
return -1
endi
print =============== step31 ns db
sql_error insert into $tb values ('2017-08-28 00:23:46.429+ 1a', 2)
sql_error insert into $tb values ('2017-08-28 00:23:46cd .429', 2)
sql select ts from $tb
if $rows != 1 then
return -1
endi
print =============== step32 ns db
#sql_error insert into $tb values ('970-01-01 08:00:00.000000000', 3)
#sql_error insert into $tb values ('970-01-01 08:00:00.000000000', 3)
sql select ts from $tb
if $rows != 1 then
return -1
endi
print =============== step33 ns db
sql insert into $tb values(now, 4);
sql insert into $tb values(now+1a, 5);
sql insert into $tb values(now+1s, 6);
sql insert into $tb values(now+1m, 7);
sql insert into $tb values(now+1h, 8);
sql insert into $tb values(now+1d, 9);
sql insert into $tb values(now+3w, 10);
sql insert into $tb values(9214646400000000000, 11);
sql insert into $tb values('2262-01-01 00:00:00.000000000', 12);
sql_error insert into $tb values(now+1n, 20);
sql_error insert into $tb values(now+1y, 21);
sql_error insert into $tb values(9214646400000000001, 22);
sql_error insert into $tb values('2262-01-02 00:00:00.000000000', 23);
sql_error insert into $tb values(9223372036854775807, 24);
sql_error insert into $tb values(9223372036854775808, 25);
sql_error insert into $tb values(92233720368547758088, 26);
sql_error insert into $tb values ('9999-12-31 213:59:59.999', 27)
print =============== step34 ns db
sql select ts from $tb
print $rows
if $rows != 10 then
return -1
endi
sql drop database $db
sql select * from information_schema.ins_databases
if $rows != 2 then
return -1
endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT
\ No newline at end of file
tests/system-test/0-others/taosdShell.py
浏览文件 @
41c76d66
...
...
@@ -2,6 +2,7 @@
import
taos
import
sys
import
time
from
datetime
import
datetime
import
socket
import
os
import
platform
...
...
@@ -100,8 +101,11 @@ class TDTestCase:
processName
=
"taosd"
taosdCmd
=
taosdCmdRun
+
startAction
tdLog
.
printNoPrefix
(
"%s"
%
taosdCmd
)
os
.
system
(
f
"nohup
{
taosdCmd
}
& "
)
logTime
=
datetime
.
now
().
strftime
(
'%Y%m%d_%H%M%S_%f'
)
os
.
system
(
f
"nohup
{
taosdCmd
}
>
{
logTime
}
.log 2>&1 & "
)
self
.
checkAndstopPro
(
processName
,
startAction
)
os
.
system
(
f
"rm -rf
{
logTime
}
.log"
)
def
taosdCommandExe
(
self
,
startAction
,
taosdCmdRun
):
taosdCmd
=
taosdCmdRun
+
startAction
...
...
@@ -207,7 +211,7 @@ class TDTestCase:
os
.
system
(
" mkdir -p taosdCaseTmp "
)
os
.
system
(
"echo
\'
TAOS_QUERY_POLICY=3
\'
> taosdCaseTmp/.env "
)
self
.
taosdCommandStop
(
startAction
,
taosdCmdRun
)
os
.
system
(
" rm -rf taosdCaseTmp
/.env
"
)
os
.
system
(
" rm -rf taosdCaseTmp "
)
startAction
=
" -V"
tdLog
.
printNoPrefix
(
"================================ parameter: %s"
%
startAction
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录