Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
660fd872
T
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1192
Star
22018
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看板
提交
660fd872
编写于
8月 02, 2022
作者:
C
Cary Xu
浏览文件
操作
浏览文件
下载
差异文件
Merge branch '3.0' into feature/TD-11274-3.0
上级
39dcfb5b
517b03a6
变更
37
隐藏空白更改
内联
并排
Showing
37 changed file
with
271 addition
and
195 deletion
+271
-195
include/common/systable.h
include/common/systable.h
+30
-30
include/common/tmsg.h
include/common/tmsg.h
+1
-0
include/libs/qcom/query.h
include/libs/qcom/query.h
+1
-0
source/client/inc/clientInt.h
source/client/inc/clientInt.h
+3
-1
source/client/src/clientEnv.c
source/client/src/clientEnv.c
+12
-0
source/client/src/clientImpl.c
source/client/src/clientImpl.c
+37
-3
source/client/src/clientMain.c
source/client/src/clientMain.c
+17
-0
source/client/src/clientSml.c
source/client/src/clientSml.c
+1
-0
source/common/src/systable.c
source/common/src/systable.c
+9
-9
source/dnode/mnode/impl/src/mndShow.c
source/dnode/mnode/impl/src/mndShow.c
+8
-8
source/dnode/mnode/impl/test/db/db.cpp
source/dnode/mnode/impl/test/db/db.cpp
+7
-7
source/dnode/mnode/impl/test/func/func.cpp
source/dnode/mnode/impl/test/func/func.cpp
+5
-5
source/dnode/mnode/impl/test/profile/profile.cpp
source/dnode/mnode/impl/test/profile/profile.cpp
+2
-2
source/dnode/mnode/impl/test/show/show.cpp
source/dnode/mnode/impl/test/show/show.cpp
+2
-2
source/dnode/mnode/impl/test/sma/sma.cpp
source/dnode/mnode/impl/test/sma/sma.cpp
+2
-2
source/dnode/mnode/impl/test/stb/stb.cpp
source/dnode/mnode/impl/test/stb/stb.cpp
+11
-11
source/dnode/mnode/impl/test/user/user.cpp
source/dnode/mnode/impl/test/user/user.cpp
+12
-12
source/libs/executor/src/scanoperator.c
source/libs/executor/src/scanoperator.c
+11
-11
source/libs/parser/src/parAstParser.c
source/libs/parser/src/parAstParser.c
+7
-7
source/libs/parser/src/parInsert.c
source/libs/parser/src/parInsert.c
+3
-0
source/libs/parser/src/parTranslater.c
source/libs/parser/src/parTranslater.c
+14
-14
source/libs/parser/test/mockCatalog.cpp
source/libs/parser/test/mockCatalog.cpp
+7
-7
source/libs/parser/test/parSelectTest.cpp
source/libs/parser/test/parSelectTest.cpp
+1
-1
source/libs/planner/src/planPhysiCreater.c
source/libs/planner/src/planPhysiCreater.c
+3
-3
source/libs/planner/test/planSysTbTest.cpp
source/libs/planner/test/planSysTbTest.cpp
+1
-1
source/libs/scheduler/src/schJob.c
source/libs/scheduler/src/schJob.c
+1
-0
source/libs/scheduler/src/schRemote.c
source/libs/scheduler/src/schRemote.c
+1
-0
tests/script/jenkins/basic.txt
tests/script/jenkins/basic.txt
+4
-4
tests/script/tsim/query/explain.sim
tests/script/tsim/query/explain.sim
+5
-5
tests/script/tsim/show/basic.sim
tests/script/tsim/show/basic.sim
+26
-26
tests/script/tsim/table/delete_writing.sim
tests/script/tsim/table/delete_writing.sim
+0
-4
tests/script/tsim/table/smallint.sim
tests/script/tsim/table/smallint.sim
+0
-1
tests/script/tsim/tmq/basic2Of2ConsOverlap.sim
tests/script/tsim/tmq/basic2Of2ConsOverlap.sim
+2
-2
tests/script/tsim/tmq/snapshot1.sim
tests/script/tsim/tmq/snapshot1.sim
+2
-2
tests/script/tsim/valgrind/basic3.sim
tests/script/tsim/valgrind/basic3.sim
+8
-5
tests/script/tsim/valgrind/checkError1.sim
tests/script/tsim/valgrind/checkError1.sim
+7
-7
tests/script/tsim/valgrind/checkError6.sim
tests/script/tsim/valgrind/checkError6.sim
+8
-3
未找到文件。
include/common/systable.h
浏览文件 @
660fd872
...
...
@@ -23,38 +23,38 @@ extern "C" {
#define TDENGINE_SYSTABLE_H
#define TSDB_INFORMATION_SCHEMA_DB "information_schema"
#define TSDB_INS_TABLE_DNODES "dnodes"
#define TSDB_INS_TABLE_MNODES "mnodes"
#define TSDB_INS_TABLE_MODULES "modules"
#define TSDB_INS_TABLE_QNODES "qnodes"
#define TSDB_INS_TABLE_BNODES "bnodes"
#define TSDB_INS_TABLE_SNODES "snodes"
#define TSDB_INS_TABLE_CLUSTER "cluster"
#define TSDB_INS_TABLE_
USER_DATABASES "user
_databases"
#define TSDB_INS_TABLE_
USER_FUNCTIONS "user
_functions"
#define TSDB_INS_TABLE_
USER_INDEXES "user
_indexes"
#define TSDB_INS_TABLE_
USER_STABLES "user
_stables"
#define TSDB_INS_TABLE_
USER_TABLES "user
_tables"
#define TSDB_INS_TABLE_
USER_TAGS "user
_tags"
#define TSDB_INS_TABLE_
USER_TABLE_DISTRIBUTED "user
_table_distributed"
#define TSDB_INS_TABLE_USER
_USERS "user
_users"
#define TSDB_INS_TABLE_LICENCES "grants"
#define TSDB_INS_TABLE_VGROUPS "vgroups"
#define TSDB_INS_TABLE_VNODES "vnodes"
#define TSDB_INS_TABLE_CONFIGS "configs"
#define TSDB_INS_TABLE_DNODE_VARIABLES "dnode_variables"
#define TSDB_INS_TABLE_DNODES "
ins_
dnodes"
#define TSDB_INS_TABLE_MNODES "
ins_
mnodes"
#define TSDB_INS_TABLE_MODULES "
ins_
modules"
#define TSDB_INS_TABLE_QNODES "
ins_
qnodes"
#define TSDB_INS_TABLE_BNODES "
ins_
bnodes"
#define TSDB_INS_TABLE_SNODES "
ins_
snodes"
#define TSDB_INS_TABLE_CLUSTER "
ins_
cluster"
#define TSDB_INS_TABLE_
DATABASES "ins
_databases"
#define TSDB_INS_TABLE_
FUNCTIONS "ins
_functions"
#define TSDB_INS_TABLE_
INDEXES "ins
_indexes"
#define TSDB_INS_TABLE_
STABLES "ins
_stables"
#define TSDB_INS_TABLE_
TABLES "ins
_tables"
#define TSDB_INS_TABLE_
TAGS "ins
_tags"
#define TSDB_INS_TABLE_
TABLE_DISTRIBUTED "ins
_table_distributed"
#define TSDB_INS_TABLE_USER
S "ins
_users"
#define TSDB_INS_TABLE_LICENCES "
ins_
grants"
#define TSDB_INS_TABLE_VGROUPS "
ins_
vgroups"
#define TSDB_INS_TABLE_VNODES "
ins_
vnodes"
#define TSDB_INS_TABLE_CONFIGS "
ins_
configs"
#define TSDB_INS_TABLE_DNODE_VARIABLES "
ins_
dnode_variables"
#define TSDB_PERFORMANCE_SCHEMA_DB "performance_schema"
#define TSDB_PERFS_TABLE_SMAS "smas"
#define TSDB_PERFS_TABLE_CONNECTIONS "connections"
#define TSDB_PERFS_TABLE_QUERIES "queries"
#define TSDB_PERFS_TABLE_TOPICS "topics"
#define TSDB_PERFS_TABLE_CONSUMERS "consumers"
#define TSDB_PERFS_TABLE_SUBSCRIPTIONS "subscriptions"
#define TSDB_PERFS_TABLE_OFFSETS "offsets"
#define TSDB_PERFS_TABLE_TRANS "trans"
#define TSDB_PERFS_TABLE_STREAMS "streams"
#define TSDB_PERFS_TABLE_APPS "apps"
#define TSDB_PERFS_TABLE_SMAS "
perf_
smas"
#define TSDB_PERFS_TABLE_CONNECTIONS "
perf_
connections"
#define TSDB_PERFS_TABLE_QUERIES "
perf_
queries"
#define TSDB_PERFS_TABLE_TOPICS "
perf_
topics"
#define TSDB_PERFS_TABLE_CONSUMERS "
perf_
consumers"
#define TSDB_PERFS_TABLE_SUBSCRIPTIONS "
perf_
subscriptions"
#define TSDB_PERFS_TABLE_OFFSETS "
perf_
offsets"
#define TSDB_PERFS_TABLE_TRANS "
perf_
trans"
#define TSDB_PERFS_TABLE_STREAMS "
perf_
streams"
#define TSDB_PERFS_TABLE_APPS "
perf_
apps"
typedef
struct
SSysDbTableSchema
{
const
char
*
name
;
...
...
include/common/tmsg.h
浏览文件 @
660fd872
...
...
@@ -2223,6 +2223,7 @@ typedef struct SAppClusterSummary {
uint64_t
insertBytes
;
// submit to tsdb since launched.
uint64_t
fetchBytes
;
uint64_t
numOfQueryReq
;
uint64_t
queryElapsedTime
;
uint64_t
numOfSlowQueries
;
uint64_t
totalRequests
;
...
...
include/libs/qcom/query.h
浏览文件 @
660fd872
...
...
@@ -71,6 +71,7 @@ typedef struct SIndexMeta {
typedef
struct
SExecResult
{
int32_t
code
;
uint64_t
numOfRows
;
uint64_t
numOfBytes
;
int32_t
msgType
;
void
*
res
;
}
SExecResult
;
...
...
source/client/inc/clientInt.h
浏览文件 @
660fd872
...
...
@@ -225,10 +225,12 @@ typedef struct SRequestObj {
SArray
*
targetTableList
;
SQueryExecMetric
metric
;
SRequestSendRecvBody
body
;
int32_t
stmtType
;
bool
syncQuery
;
// todo refactor: async query object
bool
stableQuery
;
// todo refactor
bool
validateOnly
;
// todo refactor
bool
killed
;
bool
inRetry
;
uint32_t
prevCode
;
// previous error code: todo refactor, add update flag for catalog
uint32_t
retry
;
}
SRequestObj
;
...
...
@@ -326,7 +328,7 @@ void processMsgFromServer(void* parent, SRpcMsg* pMsg, SEpSet* pEpSet);
STscObj
*
taos_connect_internal
(
const
char
*
ip
,
const
char
*
user
,
const
char
*
pass
,
const
char
*
auth
,
const
char
*
db
,
uint16_t
port
,
int
connType
);
SRequestObj
*
launchQuery
(
uint64_t
connId
,
const
char
*
sql
,
int
sqlLen
,
bool
validateOnly
);
SRequestObj
*
launchQuery
(
uint64_t
connId
,
const
char
*
sql
,
int
sqlLen
,
bool
validateOnly
,
bool
inRetry
);
int32_t
parseSql
(
SRequestObj
*
pRequest
,
bool
topicQuery
,
SQuery
**
pQuery
,
SStmtCallback
*
pStmtCb
);
...
...
source/client/src/clientEnv.c
浏览文件 @
660fd872
...
...
@@ -60,6 +60,7 @@ static int32_t registerRequest(SRequestObj *pRequest, STscObj *pTscObj) {
}
static
void
deregisterRequest
(
SRequestObj
*
pRequest
)
{
const
static
int64_t
SLOW_QUERY_INTERVAL
=
3000000L
;
// todo configurable
assert
(
pRequest
!=
NULL
);
STscObj
*
pTscObj
=
pRequest
->
pTscObj
;
...
...
@@ -72,6 +73,17 @@ static void deregisterRequest(SRequestObj *pRequest) {
tscDebug
(
"0x%"
PRIx64
" free Request from connObj: 0x%"
PRIx64
", reqId:0x%"
PRIx64
" elapsed:%"
PRIu64
" ms, current:%d, app current:%d"
,
pRequest
->
self
,
pTscObj
->
id
,
pRequest
->
requestId
,
duration
/
1000
,
num
,
currentInst
);
if
(
QUERY_NODE_VNODE_MODIF_STMT
==
pRequest
->
stmtType
)
{
atomic_add_fetch_64
((
int64_t
*
)
&
pActivity
->
insertElapsedTime
,
duration
);
}
else
if
(
QUERY_NODE_SELECT_STMT
==
pRequest
->
stmtType
)
{
atomic_add_fetch_64
((
int64_t
*
)
&
pActivity
->
queryElapsedTime
,
duration
);
}
if
(
duration
>=
SLOW_QUERY_INTERVAL
)
{
atomic_add_fetch_64
((
int64_t
*
)
&
pActivity
->
numOfSlowQueries
,
1
);
}
releaseTscObj
(
pTscObj
->
id
);
}
...
...
source/client/src/clientImpl.c
浏览文件 @
660fd872
...
...
@@ -688,7 +688,12 @@ int32_t scheduleQuery(SRequestObj* pRequest, SQueryPlan* pDag, SArray* pNodeList
if
(
TDMT_VND_SUBMIT
==
pRequest
->
type
||
TDMT_VND_DELETE
==
pRequest
->
type
||
TDMT_VND_CREATE_TABLE
==
pRequest
->
type
)
{
pRequest
->
body
.
resInfo
.
numOfRows
=
res
.
numOfRows
;
if
(
TDMT_VND_SUBMIT
==
pRequest
->
type
)
{
STscObj
*
pTscObj
=
pRequest
->
pTscObj
;
SAppClusterSummary
*
pActivity
=
&
pTscObj
->
pAppInfo
->
summary
;
atomic_add_fetch_64
((
int64_t
*
)
&
pActivity
->
numOfInsertRows
,
res
.
numOfRows
);
}
schedulerFreeJob
(
&
pRequest
->
body
.
queryJob
,
0
);
}
...
...
@@ -795,6 +800,8 @@ int32_t handleQueryExecRsp(SRequestObj* pRequest) {
break
;
}
case
TDMT_VND_SUBMIT
:
{
atomic_add_fetch_64
((
int64_t
*
)
&
pAppInfo
->
summary
.
insertBytes
,
pRes
->
numOfBytes
);
code
=
handleSubmitExecRes
(
pRequest
,
pRes
->
res
,
pCatalog
,
&
epset
);
break
;
}
...
...
@@ -824,6 +831,11 @@ void schedulerExecCb(SExecResult* pResult, void* param, int32_t code) {
TDMT_VND_CREATE_TABLE
==
pRequest
->
type
)
{
if
(
pResult
)
{
pRequest
->
body
.
resInfo
.
numOfRows
=
pResult
->
numOfRows
;
if
(
TDMT_VND_SUBMIT
==
pRequest
->
type
)
{
STscObj
*
pTscObj
=
pRequest
->
pTscObj
;
SAppClusterSummary
*
pActivity
=
&
pTscObj
->
pAppInfo
->
summary
;
atomic_add_fetch_64
((
int64_t
*
)
&
pActivity
->
numOfInsertRows
,
pResult
->
numOfRows
);
}
}
schedulerFreeJob
(
&
pRequest
->
body
.
queryJob
,
0
);
...
...
@@ -862,6 +874,20 @@ void schedulerExecCb(SExecResult* pResult, void* param, int32_t code) {
SRequestObj
*
launchQueryImpl
(
SRequestObj
*
pRequest
,
SQuery
*
pQuery
,
bool
keepQuery
,
void
**
res
)
{
int32_t
code
=
0
;
if
(
pQuery
->
pRoot
)
{
pRequest
->
stmtType
=
pQuery
->
pRoot
->
type
;
}
if
(
pQuery
->
pRoot
&&
!
pRequest
->
inRetry
)
{
STscObj
*
pTscObj
=
pRequest
->
pTscObj
;
SAppClusterSummary
*
pActivity
=
&
pTscObj
->
pAppInfo
->
summary
;
if
(
QUERY_NODE_VNODE_MODIF_STMT
==
pQuery
->
pRoot
->
type
)
{
atomic_add_fetch_64
((
int64_t
*
)
&
pActivity
->
numOfInsertsReq
,
1
);
}
else
if
(
QUERY_NODE_SELECT_STMT
==
pQuery
->
pRoot
->
type
)
{
atomic_add_fetch_64
((
int64_t
*
)
&
pActivity
->
numOfQueryReq
,
1
);
}
}
switch
(
pQuery
->
execMode
)
{
case
QUERY_EXEC_MODE_LOCAL
:
if
(
!
pRequest
->
validateOnly
)
{
...
...
@@ -915,7 +941,7 @@ SRequestObj* launchQueryImpl(SRequestObj* pRequest, SQuery* pQuery, bool keepQue
return
pRequest
;
}
SRequestObj
*
launchQuery
(
uint64_t
connId
,
const
char
*
sql
,
int
sqlLen
,
bool
validateOnly
)
{
SRequestObj
*
launchQuery
(
uint64_t
connId
,
const
char
*
sql
,
int
sqlLen
,
bool
validateOnly
,
bool
inRetry
)
{
SRequestObj
*
pRequest
=
NULL
;
SQuery
*
pQuery
=
NULL
;
...
...
@@ -931,6 +957,7 @@ SRequestObj* launchQuery(uint64_t connId, const char* sql, int sqlLen, bool vali
return
pRequest
;
}
pRequest
->
inRetry
=
inRetry
;
pRequest
->
stableQuery
=
pQuery
->
stableQuery
;
return
launchQueryImpl
(
pRequest
,
pQuery
,
false
,
NULL
);
...
...
@@ -1079,10 +1106,11 @@ SRequestObj* execQuery(uint64_t connId, const char* sql, int sqlLen, bool valida
SRequestObj
*
pRequest
=
NULL
;
int32_t
retryNum
=
0
;
int32_t
code
=
0
;
bool
inRetry
=
false
;
do
{
destroyRequest
(
pRequest
);
pRequest
=
launchQuery
(
connId
,
sql
,
sqlLen
,
validateOnly
);
pRequest
=
launchQuery
(
connId
,
sql
,
sqlLen
,
validateOnly
,
inRetry
);
if
(
pRequest
==
NULL
||
TSDB_CODE_SUCCESS
==
pRequest
->
code
||
!
NEED_CLIENT_HANDLE_ERROR
(
pRequest
->
code
))
{
break
;
}
...
...
@@ -1092,6 +1120,8 @@ SRequestObj* execQuery(uint64_t connId, const char* sql, int sqlLen, bool valida
pRequest
->
code
=
code
;
break
;
}
inRetry
=
true
;
}
while
(
retryNum
++
<
REQUEST_TOTAL_EXEC_TIMES
);
if
(
NEED_CLIENT_RM_TBLMETA_REQ
(
pRequest
->
type
))
{
...
...
@@ -1437,6 +1467,10 @@ void* doFetchRows(SRequestObj* pRequest, bool setupOneRowPtr, bool convertUcs4)
tscDebug
(
"0x%"
PRIx64
" fetch results, numOfRows:%d total Rows:%"
PRId64
", complete:%d, reqId:0x%"
PRIx64
,
pRequest
->
self
,
pResInfo
->
numOfRows
,
pResInfo
->
totalRows
,
pResInfo
->
completed
,
pRequest
->
requestId
);
STscObj
*
pTscObj
=
pRequest
->
pTscObj
;
SAppClusterSummary
*
pActivity
=
&
pTscObj
->
pAppInfo
->
summary
;
atomic_add_fetch_64
((
int64_t
*
)
&
pActivity
->
fetchBytes
,
pRequest
->
body
.
resInfo
.
payloadLen
);
if
(
pResultInfo
->
numOfRows
==
0
)
{
return
NULL
;
}
...
...
source/client/src/clientMain.c
浏览文件 @
660fd872
...
...
@@ -679,6 +679,9 @@ void retrieveMetaCallback(SMetaData *pResultMeta, void *param, int32_t code) {
if
(
code
==
TSDB_CODE_SUCCESS
)
{
code
=
qAnalyseSqlSemantic
(
pWrapper
->
pCtx
,
&
pWrapper
->
catalogReq
,
pResultMeta
,
pQuery
);
pRequest
->
stableQuery
=
pQuery
->
stableQuery
;
if
(
pQuery
->
pRoot
)
{
pRequest
->
stmtType
=
pQuery
->
pRoot
->
type
;
}
}
if
(
code
==
TSDB_CODE_SUCCESS
)
{
...
...
@@ -778,6 +781,16 @@ void doAsyncQuery(SRequestObj *pRequest, bool updateMetaForce) {
goto
_error
;
}
if
(
!
updateMetaForce
)
{
STscObj
*
pTscObj
=
pRequest
->
pTscObj
;
SAppClusterSummary
*
pActivity
=
&
pTscObj
->
pAppInfo
->
summary
;
if
(
NULL
==
pQuery
->
pRoot
)
{
atomic_add_fetch_64
((
int64_t
*
)
&
pActivity
->
numOfInsertsReq
,
1
);
}
else
if
(
QUERY_NODE_SELECT_STMT
==
pQuery
->
pRoot
->
type
)
{
atomic_add_fetch_64
((
int64_t
*
)
&
pActivity
->
numOfQueryReq
,
1
);
}
}
SqlParseWrapper
*
pWrapper
=
taosMemoryCalloc
(
1
,
sizeof
(
SqlParseWrapper
));
if
(
pWrapper
==
NULL
)
{
code
=
TSDB_CODE_OUT_OF_MEMORY
;
...
...
@@ -841,6 +854,10 @@ static void fetchCallback(void *pResult, void *param, int32_t code) {
tscDebug
(
"0x%"
PRIx64
" fetch results, numOfRows:%d total Rows:%"
PRId64
", complete:%d, reqId:0x%"
PRIx64
,
pRequest
->
self
,
pResultInfo
->
numOfRows
,
pResultInfo
->
totalRows
,
pResultInfo
->
completed
,
pRequest
->
requestId
);
STscObj
*
pTscObj
=
pRequest
->
pTscObj
;
SAppClusterSummary
*
pActivity
=
&
pTscObj
->
pAppInfo
->
summary
;
atomic_add_fetch_64
((
int64_t
*
)
&
pActivity
->
fetchBytes
,
pRequest
->
body
.
resInfo
.
payloadLen
);
}
pRequest
->
body
.
fetchFp
(
pRequest
->
body
.
param
,
pRequest
,
pResultInfo
->
numOfRows
);
...
...
source/client/src/clientSml.c
浏览文件 @
660fd872
...
...
@@ -421,6 +421,7 @@ static int32_t smlSendMetaMsg(SSmlHandle *info, SName *pName, SSmlSTableMeta *s
tSerializeSMCreateStbReq
(
pCmdMsg
.
pMsg
,
pCmdMsg
.
msgLen
,
&
pReq
);
SQuery
pQuery
;
memset
(
&
pQuery
,
0
,
sizeof
(
pQuery
));
pQuery
.
execMode
=
QUERY_EXEC_MODE_RPC
;
pQuery
.
pCmdMsg
=
&
pCmdMsg
;
pQuery
.
msgType
=
pQuery
.
pCmdMsg
->
msgType
;
...
...
source/common/src/systable.c
浏览文件 @
660fd872
...
...
@@ -246,14 +246,14 @@ static const SSysTableMeta infosMeta[] = {
// {TSDB_INS_TABLE_SNODES, snodesSchema, tListLen(snodesSchema)},
// {TSDB_INS_TABLE_BNODES, bnodesSchema, tListLen(bnodesSchema)},
{
TSDB_INS_TABLE_CLUSTER
,
clusterSchema
,
tListLen
(
clusterSchema
)},
{
TSDB_INS_TABLE_
USER_
DATABASES
,
userDBSchema
,
tListLen
(
userDBSchema
)},
{
TSDB_INS_TABLE_
USER_
FUNCTIONS
,
userFuncSchema
,
tListLen
(
userFuncSchema
)},
{
TSDB_INS_TABLE_
USER_
INDEXES
,
userIdxSchema
,
tListLen
(
userIdxSchema
)},
{
TSDB_INS_TABLE_
USER_
STABLES
,
userStbsSchema
,
tListLen
(
userStbsSchema
)},
{
TSDB_INS_TABLE_
USER_
TABLES
,
userTblsSchema
,
tListLen
(
userTblsSchema
)},
{
TSDB_INS_TABLE_
USER_
TAGS
,
userTagsSchema
,
tListLen
(
userTagsSchema
)},
// {TSDB_INS_TABLE_
USER_
TABLE_DISTRIBUTED, userTblDistSchema, tListLen(userTblDistSchema)},
{
TSDB_INS_TABLE_USER
_USER
S
,
userUsersSchema
,
tListLen
(
userUsersSchema
)},
{
TSDB_INS_TABLE_DATABASES
,
userDBSchema
,
tListLen
(
userDBSchema
)},
{
TSDB_INS_TABLE_FUNCTIONS
,
userFuncSchema
,
tListLen
(
userFuncSchema
)},
{
TSDB_INS_TABLE_INDEXES
,
userIdxSchema
,
tListLen
(
userIdxSchema
)},
{
TSDB_INS_TABLE_STABLES
,
userStbsSchema
,
tListLen
(
userStbsSchema
)},
{
TSDB_INS_TABLE_TABLES
,
userTblsSchema
,
tListLen
(
userTblsSchema
)},
{
TSDB_INS_TABLE_TAGS
,
userTagsSchema
,
tListLen
(
userTagsSchema
)},
// {TSDB_INS_TABLE_TABLE_DISTRIBUTED, userTblDistSchema, tListLen(userTblDistSchema)},
{
TSDB_INS_TABLE_USERS
,
userUsersSchema
,
tListLen
(
userUsersSchema
)},
{
TSDB_INS_TABLE_LICENCES
,
grantsSchema
,
tListLen
(
grantsSchema
)},
{
TSDB_INS_TABLE_VGROUPS
,
vgroupsSchema
,
tListLen
(
vgroupsSchema
)},
{
TSDB_INS_TABLE_CONFIGS
,
configSchema
,
tListLen
(
configSchema
)},
...
...
@@ -335,7 +335,7 @@ static const SSysDbTableSchema appSchema[] = {
{.
name
=
"insert_bytes"
,
.
bytes
=
8
,
.
type
=
TSDB_DATA_TYPE_UBIGINT
},
{.
name
=
"fetch_bytes"
,
.
bytes
=
8
,
.
type
=
TSDB_DATA_TYPE_UBIGINT
},
{.
name
=
"query_time"
,
.
bytes
=
8
,
.
type
=
TSDB_DATA_TYPE_UBIGINT
},
{.
name
=
"s
h
ow_query"
,
.
bytes
=
8
,
.
type
=
TSDB_DATA_TYPE_UBIGINT
},
{.
name
=
"s
l
ow_query"
,
.
bytes
=
8
,
.
type
=
TSDB_DATA_TYPE_UBIGINT
},
{.
name
=
"total_req"
,
.
bytes
=
8
,
.
type
=
TSDB_DATA_TYPE_UBIGINT
},
{.
name
=
"current_req"
,
.
bytes
=
8
,
.
type
=
TSDB_DATA_TYPE_UBIGINT
},
{.
name
=
"last_access"
,
.
bytes
=
8
,
.
type
=
TSDB_DATA_TYPE_TIMESTAMP
},
...
...
source/dnode/mnode/impl/src/mndShow.c
浏览文件 @
660fd872
...
...
@@ -66,21 +66,21 @@ static int32_t convertToRetrieveType(char *name, int32_t len) {
type
=
TSDB_MGMT_TABLE_SNODE
;
}
else
if
(
strncasecmp
(
name
,
TSDB_INS_TABLE_CLUSTER
,
len
)
==
0
)
{
type
=
TSDB_MGMT_TABLE_CLUSTER
;
}
else
if
(
strncasecmp
(
name
,
TSDB_INS_TABLE_
USER_
DATABASES
,
len
)
==
0
)
{
}
else
if
(
strncasecmp
(
name
,
TSDB_INS_TABLE_DATABASES
,
len
)
==
0
)
{
type
=
TSDB_MGMT_TABLE_DB
;
}
else
if
(
strncasecmp
(
name
,
TSDB_INS_TABLE_
USER_
FUNCTIONS
,
len
)
==
0
)
{
}
else
if
(
strncasecmp
(
name
,
TSDB_INS_TABLE_FUNCTIONS
,
len
)
==
0
)
{
type
=
TSDB_MGMT_TABLE_FUNC
;
}
else
if
(
strncasecmp
(
name
,
TSDB_INS_TABLE_
USER_
INDEXES
,
len
)
==
0
)
{
}
else
if
(
strncasecmp
(
name
,
TSDB_INS_TABLE_INDEXES
,
len
)
==
0
)
{
type
=
TSDB_MGMT_TABLE_INDEX
;
}
else
if
(
strncasecmp
(
name
,
TSDB_INS_TABLE_
USER_
STABLES
,
len
)
==
0
)
{
}
else
if
(
strncasecmp
(
name
,
TSDB_INS_TABLE_STABLES
,
len
)
==
0
)
{
type
=
TSDB_MGMT_TABLE_STB
;
}
else
if
(
strncasecmp
(
name
,
TSDB_INS_TABLE_
USER_
TABLES
,
len
)
==
0
)
{
}
else
if
(
strncasecmp
(
name
,
TSDB_INS_TABLE_TABLES
,
len
)
==
0
)
{
type
=
TSDB_MGMT_TABLE_TABLE
;
}
else
if
(
strncasecmp
(
name
,
TSDB_INS_TABLE_
USER_
TAGS
,
len
)
==
0
)
{
}
else
if
(
strncasecmp
(
name
,
TSDB_INS_TABLE_TAGS
,
len
)
==
0
)
{
type
=
TSDB_MGMT_TABLE_TAG
;
}
else
if
(
strncasecmp
(
name
,
TSDB_INS_TABLE_
USER_
TABLE_DISTRIBUTED
,
len
)
==
0
)
{
}
else
if
(
strncasecmp
(
name
,
TSDB_INS_TABLE_TABLE_DISTRIBUTED
,
len
)
==
0
)
{
// type = TSDB_MGMT_TABLE_DIST;
}
else
if
(
strncasecmp
(
name
,
TSDB_INS_TABLE_USER
_USER
S
,
len
)
==
0
)
{
}
else
if
(
strncasecmp
(
name
,
TSDB_INS_TABLE_USERS
,
len
)
==
0
)
{
type
=
TSDB_MGMT_TABLE_USER
;
}
else
if
(
strncasecmp
(
name
,
TSDB_INS_TABLE_LICENCES
,
len
)
==
0
)
{
type
=
TSDB_MGMT_TABLE_GRANTS
;
...
...
source/dnode/mnode/impl/test/db/db.cpp
浏览文件 @
660fd872
...
...
@@ -26,7 +26,7 @@ class MndTestDb : public ::testing::Test {
Testbase
MndTestDb
::
test
;
TEST_F
(
MndTestDb
,
01
_ShowDb
)
{
test
.
SendShowReq
(
TSDB_MGMT_TABLE_DB
,
"
user
_databases"
,
""
);
test
.
SendShowReq
(
TSDB_MGMT_TABLE_DB
,
"
ins
_databases"
,
""
);
EXPECT_EQ
(
test
.
GetShowRows
(),
2
);
}
...
...
@@ -64,10 +64,10 @@ TEST_F(MndTestDb, 02_Create_Alter_Drop_Db) {
ASSERT_EQ
(
pRsp
->
code
,
0
);
}
test
.
SendShowReq
(
TSDB_MGMT_TABLE_DB
,
"
user
_databases"
,
""
);
test
.
SendShowReq
(
TSDB_MGMT_TABLE_DB
,
"
ins
_databases"
,
""
);
EXPECT_EQ
(
test
.
GetShowRows
(),
3
);
test
.
SendShowReq
(
TSDB_MGMT_TABLE_VGROUP
,
"vgroups"
,
"1.d1"
);
test
.
SendShowReq
(
TSDB_MGMT_TABLE_VGROUP
,
"
ins_
vgroups"
,
"1.d1"
);
EXPECT_EQ
(
test
.
GetShowRows
(),
2
);
{
...
...
@@ -96,13 +96,13 @@ TEST_F(MndTestDb, 02_Create_Alter_Drop_Db) {
ASSERT_EQ
(
pRsp
->
code
,
TSDB_CODE_OPS_NOT_SUPPORT
);
}
test
.
SendShowReq
(
TSDB_MGMT_TABLE_DB
,
"
user
_databases"
,
""
);
test
.
SendShowReq
(
TSDB_MGMT_TABLE_DB
,
"
ins
_databases"
,
""
);
EXPECT_EQ
(
test
.
GetShowRows
(),
3
);
// restart
test
.
Restart
();
test
.
SendShowReq
(
TSDB_MGMT_TABLE_DB
,
"
user
_databases"
,
""
);
test
.
SendShowReq
(
TSDB_MGMT_TABLE_DB
,
"
ins
_databases"
,
""
);
EXPECT_EQ
(
test
.
GetShowRows
(),
3
);
{
...
...
@@ -122,7 +122,7 @@ TEST_F(MndTestDb, 02_Create_Alter_Drop_Db) {
EXPECT_STREQ
(
dropdbRsp
.
db
,
"1.d1"
);
}
test
.
SendShowReq
(
TSDB_MGMT_TABLE_DB
,
"
user
_databases"
,
""
);
test
.
SendShowReq
(
TSDB_MGMT_TABLE_DB
,
"
ins
_databases"
,
""
);
EXPECT_EQ
(
test
.
GetShowRows
(),
2
);
}
...
...
@@ -160,7 +160,7 @@ TEST_F(MndTestDb, 03_Create_Use_Restart_Use_Db) {
ASSERT_EQ
(
pRsp
->
code
,
0
);
}
test
.
SendShowReq
(
TSDB_MGMT_TABLE_DB
,
"
user
_databases"
,
""
);
test
.
SendShowReq
(
TSDB_MGMT_TABLE_DB
,
"
ins
_databases"
,
""
);
EXPECT_EQ
(
test
.
GetShowRows
(),
3
);
uint64_t
d2_uid
=
0
;
...
...
source/dnode/mnode/impl/test/func/func.cpp
浏览文件 @
660fd872
...
...
@@ -46,7 +46,7 @@ void MndTestFunc::SetBufSize(SCreateFuncReq* pReq, int32_t size) {
}
TEST_F
(
MndTestFunc
,
01
_Show_Func
)
{
test
.
SendShowReq
(
TSDB_MGMT_TABLE_FUNC
,
"
user
_functions"
,
""
);
test
.
SendShowReq
(
TSDB_MGMT_TABLE_FUNC
,
"
ins
_functions"
,
""
);
EXPECT_EQ
(
test
.
GetShowRows
(),
0
);
}
...
...
@@ -159,7 +159,7 @@ TEST_F(MndTestFunc, 02_Create_Func) {
}
}
test
.
SendShowReq
(
TSDB_MGMT_TABLE_FUNC
,
"
user
_functions"
,
""
);
test
.
SendShowReq
(
TSDB_MGMT_TABLE_FUNC
,
"
ins
_functions"
,
""
);
EXPECT_EQ
(
test
.
GetShowRows
(),
1
);
}
...
...
@@ -270,7 +270,7 @@ TEST_F(MndTestFunc, 03_Retrieve_Func) {
ASSERT_NE
(
pRsp
,
nullptr
);
ASSERT_EQ
(
pRsp
->
code
,
0
);
test
.
SendShowReq
(
TSDB_MGMT_TABLE_FUNC
,
"
user
_functions"
,
""
);
test
.
SendShowReq
(
TSDB_MGMT_TABLE_FUNC
,
"
ins
_functions"
,
""
);
EXPECT_EQ
(
test
.
GetShowRows
(),
2
);
}
...
...
@@ -435,13 +435,13 @@ TEST_F(MndTestFunc, 04_Drop_Func) {
ASSERT_EQ
(
pRsp
->
code
,
0
);
}
test
.
SendShowReq
(
TSDB_MGMT_TABLE_FUNC
,
"
user
_functions"
,
""
);
test
.
SendShowReq
(
TSDB_MGMT_TABLE_FUNC
,
"
ins
_functions"
,
""
);
EXPECT_EQ
(
test
.
GetShowRows
(),
1
);
// restart
test
.
Restart
();
test
.
SendShowReq
(
TSDB_MGMT_TABLE_FUNC
,
"
user
_functions"
,
""
);
test
.
SendShowReq
(
TSDB_MGMT_TABLE_FUNC
,
"
ins
_functions"
,
""
);
EXPECT_EQ
(
test
.
GetShowRows
(),
1
);
}
...
...
source/dnode/mnode/impl/test/profile/profile.cpp
浏览文件 @
660fd872
...
...
@@ -87,7 +87,7 @@ TEST_F(MndTestProfile, 02_ConnectMsg_InvalidDB) {
}
TEST_F
(
MndTestProfile
,
03
_ConnectMsg_Show
)
{
test
.
SendShowReq
(
TSDB_MGMT_TABLE_CONNS
,
"connections"
,
""
);
test
.
SendShowReq
(
TSDB_MGMT_TABLE_CONNS
,
"
perf_
connections"
,
""
);
EXPECT_EQ
(
test
.
GetShowRows
(),
1
);
}
...
...
@@ -307,6 +307,6 @@ TEST_F(MndTestProfile, 08_KillQueryMsg_InvalidConn) {
}
TEST_F
(
MndTestProfile
,
09
_KillQueryMsg
)
{
test
.
SendShowReq
(
TSDB_MGMT_TABLE_QUERIES
,
"queries"
,
""
);
test
.
SendShowReq
(
TSDB_MGMT_TABLE_QUERIES
,
"
perf_
queries"
,
""
);
EXPECT_EQ
(
test
.
GetShowRows
(),
0
);
}
source/dnode/mnode/impl/test/show/show.cpp
浏览文件 @
660fd872
...
...
@@ -73,11 +73,11 @@ TEST_F(MndTestShow, 03_ShowMsg_Conn) {
ASSERT_NE
(
pRsp
,
nullptr
);
ASSERT_EQ
(
pRsp
->
code
,
0
);
test
.
SendShowReq
(
TSDB_MGMT_TABLE_CONNS
,
"connections"
,
""
);
test
.
SendShowReq
(
TSDB_MGMT_TABLE_CONNS
,
"
perf_
connections"
,
""
);
// EXPECT_EQ(test.GetShowRows(), 1);
}
TEST_F
(
MndTestShow
,
04
_ShowMsg_Cluster
)
{
test
.
SendShowReq
(
TSDB_MGMT_TABLE_CLUSTER
,
"cluster"
,
""
);
test
.
SendShowReq
(
TSDB_MGMT_TABLE_CLUSTER
,
"
ins_
cluster"
,
""
);
EXPECT_EQ
(
test
.
GetShowRows
(),
1
);
}
source/dnode/mnode/impl/test/sma/sma.cpp
浏览文件 @
660fd872
...
...
@@ -259,7 +259,7 @@ TEST_F(MndTestSma, 02_Create_Show_Meta_Drop_Restart_BSma) {
pReq
=
BuildCreateBSmaStbReq
(
stbname
,
&
contLen
);
pRsp
=
test
.
SendReq
(
TDMT_MND_CREATE_STB
,
pReq
,
contLen
);
ASSERT_EQ
(
pRsp
->
code
,
0
);
test
.
SendShowReq
(
TSDB_MGMT_TABLE_STB
,
"
user
_stables"
,
dbname
);
test
.
SendShowReq
(
TSDB_MGMT_TABLE_STB
,
"
ins
_stables"
,
dbname
);
EXPECT_EQ
(
test
.
GetShowRows
(),
1
);
}
...
...
@@ -275,7 +275,7 @@ TEST_F(MndTestSma, 02_Create_Show_Meta_Drop_Restart_BSma) {
pReq
=
BuildDropStbReq
(
stbname
,
&
contLen
);
pRsp
=
test
.
SendReq
(
TDMT_MND_DROP_STB
,
pReq
,
contLen
);
ASSERT_EQ
(
pRsp
->
code
,
0
);
test
.
SendShowReq
(
TSDB_MGMT_TABLE_STB
,
"
user
_stables"
,
dbname
);
test
.
SendShowReq
(
TSDB_MGMT_TABLE_STB
,
"
ins
_stables"
,
dbname
);
EXPECT_EQ
(
test
.
GetShowRows
(),
0
);
}
...
...
source/dnode/mnode/impl/test/stb/stb.cpp
浏览文件 @
660fd872
...
...
@@ -313,7 +313,7 @@ TEST_F(MndTestStb, 01_Create_Show_Meta_Drop_Restart_Stb) {
}
{
test
.
SendShowReq
(
TSDB_MGMT_TABLE_STB
,
"
user
_stables"
,
dbname
);
test
.
SendShowReq
(
TSDB_MGMT_TABLE_STB
,
"
ins
_stables"
,
dbname
);
EXPECT_EQ
(
test
.
GetShowRows
(),
1
);
}
...
...
@@ -394,7 +394,7 @@ TEST_F(MndTestStb, 01_Create_Show_Meta_Drop_Restart_Stb) {
test
.
Restart
();
{
test
.
SendShowReq
(
TSDB_MGMT_TABLE_STB
,
"
user
_stables"
,
dbname
);
test
.
SendShowReq
(
TSDB_MGMT_TABLE_STB
,
"
ins
_stables"
,
dbname
);
EXPECT_EQ
(
test
.
GetShowRows
(),
1
);
}
...
...
@@ -412,7 +412,7 @@ TEST_F(MndTestStb, 01_Create_Show_Meta_Drop_Restart_Stb) {
}
{
test
.
SendShowReq
(
TSDB_MGMT_TABLE_STB
,
"
user
_stables"
,
dbname
);
test
.
SendShowReq
(
TSDB_MGMT_TABLE_STB
,
"
ins
_stables"
,
dbname
);
EXPECT_EQ
(
test
.
GetShowRows
(),
0
);
}
...
...
@@ -474,7 +474,7 @@ TEST_F(MndTestStb, 02_Alter_Stb_AddTag) {
ASSERT_NE
(
pRsp
,
nullptr
);
ASSERT_EQ
(
pRsp
->
code
,
0
);
test
.
SendShowReq
(
TSDB_MGMT_TABLE_STB
,
"
user
_stables"
,
dbname
);
test
.
SendShowReq
(
TSDB_MGMT_TABLE_STB
,
"
ins
_stables"
,
dbname
);
}
{
...
...
@@ -514,7 +514,7 @@ TEST_F(MndTestStb, 03_Alter_Stb_DropTag) {
ASSERT_NE
(
pRsp
,
nullptr
);
ASSERT_EQ
(
pRsp
->
code
,
0
);
test
.
SendShowReq
(
TSDB_MGMT_TABLE_STB
,
"
user
_stables"
,
dbname
);
test
.
SendShowReq
(
TSDB_MGMT_TABLE_STB
,
"
ins
_stables"
,
dbname
);
EXPECT_EQ
(
test
.
GetShowRows
(),
1
);
}
...
...
@@ -578,7 +578,7 @@ TEST_F(MndTestStb, 04_Alter_Stb_AlterTagName) {
ASSERT_NE
(
pRsp
,
nullptr
);
ASSERT_EQ
(
pRsp
->
code
,
0
);
test
.
SendShowReq
(
TSDB_MGMT_TABLE_STB
,
"
user
_stables"
,
dbname
);
test
.
SendShowReq
(
TSDB_MGMT_TABLE_STB
,
"
ins
_stables"
,
dbname
);
EXPECT_EQ
(
test
.
GetShowRows
(),
1
);
}
...
...
@@ -630,7 +630,7 @@ TEST_F(MndTestStb, 05_Alter_Stb_AlterTagBytes) {
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_ALTER_STB
,
pReq
,
contLen
);
ASSERT_EQ
(
pRsp
->
code
,
0
);
test
.
SendShowReq
(
TSDB_MGMT_TABLE_STB
,
"
user
_stables"
,
dbname
);
test
.
SendShowReq
(
TSDB_MGMT_TABLE_STB
,
"
ins
_stables"
,
dbname
);
EXPECT_EQ
(
test
.
GetShowRows
(),
1
);
}
...
...
@@ -691,7 +691,7 @@ TEST_F(MndTestStb, 06_Alter_Stb_AddColumn) {
ASSERT_NE
(
pRsp
,
nullptr
);
ASSERT_EQ
(
pRsp
->
code
,
0
);
test
.
SendShowReq
(
TSDB_MGMT_TABLE_STB
,
"
user
_stables"
,
dbname
);
test
.
SendShowReq
(
TSDB_MGMT_TABLE_STB
,
"
ins
_stables"
,
dbname
);
EXPECT_EQ
(
test
.
GetShowRows
(),
1
);
}
...
...
@@ -751,7 +751,7 @@ TEST_F(MndTestStb, 07_Alter_Stb_DropColumn) {
ASSERT_NE
(
pRsp
,
nullptr
);
ASSERT_EQ
(
pRsp
->
code
,
0
);
test
.
SendShowReq
(
TSDB_MGMT_TABLE_STB
,
"
user
_stables"
,
dbname
);
test
.
SendShowReq
(
TSDB_MGMT_TABLE_STB
,
"
ins
_stables"
,
dbname
);
EXPECT_EQ
(
test
.
GetShowRows
(),
1
);
}
...
...
@@ -809,7 +809,7 @@ TEST_F(MndTestStb, 08_Alter_Stb_AlterTagBytes) {
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_ALTER_STB
,
pReq
,
contLen
);
ASSERT_EQ
(
pRsp
->
code
,
0
);
test
.
SendShowReq
(
TSDB_MGMT_TABLE_STB
,
"
user
_stables"
,
dbname
);
test
.
SendShowReq
(
TSDB_MGMT_TABLE_STB
,
"
ins
_stables"
,
dbname
);
EXPECT_EQ
(
test
.
GetShowRows
(),
1
);
}
...
...
@@ -818,7 +818,7 @@ TEST_F(MndTestStb, 08_Alter_Stb_AlterTagBytes) {
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_ALTER_STB
,
pReq
,
contLen
);
ASSERT_EQ
(
pRsp
->
code
,
TSDB_CODE_MND_COLUMN_NOT_EXIST
);
test
.
SendShowReq
(
TSDB_MGMT_TABLE_STB
,
"
user
_stables"
,
dbname
);
test
.
SendShowReq
(
TSDB_MGMT_TABLE_STB
,
"
ins
_stables"
,
dbname
);
EXPECT_EQ
(
test
.
GetShowRows
(),
1
);
}
...
...
source/dnode/mnode/impl/test/user/user.cpp
浏览文件 @
660fd872
...
...
@@ -26,7 +26,7 @@ class MndTestUser : public ::testing::Test {
Testbase
MndTestUser
::
test
;
TEST_F
(
MndTestUser
,
01
_Show_User
)
{
test
.
SendShowReq
(
TSDB_MGMT_TABLE_USER
,
"
user
_users"
,
""
);
test
.
SendShowReq
(
TSDB_MGMT_TABLE_USER
,
"
ins
_users"
,
""
);
EXPECT_EQ
(
test
.
GetShowRows
(),
1
);
}
...
...
@@ -94,7 +94,7 @@ TEST_F(MndTestUser, 02_Create_User) {
ASSERT_NE
(
pRsp
,
nullptr
);
ASSERT_EQ
(
pRsp
->
code
,
0
);
test
.
SendShowReq
(
TSDB_MGMT_TABLE_USER
,
"
user
_users"
,
""
);
test
.
SendShowReq
(
TSDB_MGMT_TABLE_USER
,
"
ins
_users"
,
""
);
EXPECT_EQ
(
test
.
GetShowRows
(),
2
);
}
...
...
@@ -110,7 +110,7 @@ TEST_F(MndTestUser, 02_Create_User) {
ASSERT_NE
(
pRsp
,
nullptr
);
ASSERT_EQ
(
pRsp
->
code
,
0
);
test
.
SendShowReq
(
TSDB_MGMT_TABLE_USER
,
"
user
_users"
,
""
);
test
.
SendShowReq
(
TSDB_MGMT_TABLE_USER
,
"
ins
_users"
,
""
);
EXPECT_EQ
(
test
.
GetShowRows
(),
1
);
}
...
...
@@ -130,7 +130,7 @@ TEST_F(MndTestUser, 02_Create_User) {
ASSERT_NE
(
pRsp
,
nullptr
);
ASSERT_EQ
(
pRsp
->
code
,
0
);
test
.
SendShowReq
(
TSDB_MGMT_TABLE_USER
,
"
user
_users"
,
""
);
test
.
SendShowReq
(
TSDB_MGMT_TABLE_USER
,
"
ins
_users"
,
""
);
EXPECT_EQ
(
test
.
GetShowRows
(),
2
);
}
...
...
@@ -146,7 +146,7 @@ TEST_F(MndTestUser, 02_Create_User) {
ASSERT_NE
(
pRsp
,
nullptr
);
ASSERT_EQ
(
pRsp
->
code
,
0
);
test
.
SendShowReq
(
TSDB_MGMT_TABLE_USER
,
"
user
_users"
,
""
);
test
.
SendShowReq
(
TSDB_MGMT_TABLE_USER
,
"
ins
_users"
,
""
);
EXPECT_EQ
(
test
.
GetShowRows
(),
1
);
}
}
...
...
@@ -168,7 +168,7 @@ TEST_F(MndTestUser, 03_Alter_User) {
ASSERT_NE
(
pRsp
,
nullptr
);
ASSERT_EQ
(
pRsp
->
code
,
0
);
test
.
SendShowReq
(
TSDB_MGMT_TABLE_USER
,
"
user
_users"
,
""
);
test
.
SendShowReq
(
TSDB_MGMT_TABLE_USER
,
"
ins
_users"
,
""
);
EXPECT_EQ
(
test
.
GetShowRows
(),
2
);
}
...
...
@@ -414,7 +414,7 @@ TEST_F(MndTestUser, 03_Alter_User) {
ASSERT_NE
(
pRsp
,
nullptr
);
ASSERT_EQ
(
pRsp
->
code
,
0
);
test
.
SendShowReq
(
TSDB_MGMT_TABLE_USER
,
"
user
_users"
,
""
);
test
.
SendShowReq
(
TSDB_MGMT_TABLE_USER
,
"
ins
_users"
,
""
);
EXPECT_EQ
(
test
.
GetShowRows
(),
1
);
}
}
...
...
@@ -475,7 +475,7 @@ TEST_F(MndTestUser, 05_Drop_User) {
ASSERT_EQ
(
pRsp
->
code
,
0
);
}
test
.
SendShowReq
(
TSDB_MGMT_TABLE_USER
,
"
user
_users"
,
""
);
test
.
SendShowReq
(
TSDB_MGMT_TABLE_USER
,
"
ins
_users"
,
""
);
EXPECT_EQ
(
test
.
GetShowRows
(),
1
);
}
...
...
@@ -512,7 +512,7 @@ TEST_F(MndTestUser, 06_Create_Drop_Alter_User) {
ASSERT_EQ
(
pRsp
->
code
,
0
);
}
test
.
SendShowReq
(
TSDB_MGMT_TABLE_USER
,
"
user
_users"
,
""
);
test
.
SendShowReq
(
TSDB_MGMT_TABLE_USER
,
"
ins
_users"
,
""
);
EXPECT_EQ
(
test
.
GetShowRows
(),
3
);
{
...
...
@@ -530,7 +530,7 @@ TEST_F(MndTestUser, 06_Create_Drop_Alter_User) {
ASSERT_EQ
(
pRsp
->
code
,
0
);
}
test
.
SendShowReq
(
TSDB_MGMT_TABLE_USER
,
"
user
_users"
,
""
);
test
.
SendShowReq
(
TSDB_MGMT_TABLE_USER
,
"
ins
_users"
,
""
);
EXPECT_EQ
(
test
.
GetShowRows
(),
3
);
{
SDropUserReq
dropReq
=
{
0
};
...
...
@@ -545,13 +545,13 @@ TEST_F(MndTestUser, 06_Create_Drop_Alter_User) {
ASSERT_EQ
(
pRsp
->
code
,
0
);
}
test
.
SendShowReq
(
TSDB_MGMT_TABLE_USER
,
"
user
_users"
,
""
);
test
.
SendShowReq
(
TSDB_MGMT_TABLE_USER
,
"
ins
_users"
,
""
);
EXPECT_EQ
(
test
.
GetShowRows
(),
2
);
// restart
test
.
Restart
();
taosMsleep
(
1000
);
test
.
SendShowReq
(
TSDB_MGMT_TABLE_USER
,
"
user
_users"
,
""
);
test
.
SendShowReq
(
TSDB_MGMT_TABLE_USER
,
"
ins
_users"
,
""
);
EXPECT_EQ
(
test
.
GetShowRows
(),
2
);
}
source/libs/executor/src/scanoperator.c
浏览文件 @
660fd872
...
...
@@ -1639,8 +1639,8 @@ static void destroySysScanOperator(void* param, int32_t numOfOutput) {
blockDataDestroy
(
pInfo
->
pRes
);
const
char
*
name
=
tNameGetTableName
(
&
pInfo
->
name
);
if
(
strncasecmp
(
name
,
TSDB_INS_TABLE_
USER_
TABLES
,
TSDB_TABLE_FNAME_LEN
)
==
0
||
strncasecmp
(
name
,
TSDB_INS_TABLE_
USER_
TAGS
,
TSDB_TABLE_FNAME_LEN
)
==
0
||
pInfo
->
pCur
!=
NULL
)
{
if
(
strncasecmp
(
name
,
TSDB_INS_TABLE_TABLES
,
TSDB_TABLE_FNAME_LEN
)
==
0
||
strncasecmp
(
name
,
TSDB_INS_TABLE_TAGS
,
TSDB_TABLE_FNAME_LEN
)
==
0
||
pInfo
->
pCur
!=
NULL
)
{
metaCloseTbCursor
(
pInfo
->
pCur
);
pInfo
->
pCur
=
NULL
;
}
...
...
@@ -1652,7 +1652,7 @@ static void destroySysScanOperator(void* param, int32_t numOfOutput) {
}
static
int32_t
getSysTableDbNameColId
(
const
char
*
pTable
)
{
// if (0 == strcmp(TSDB_INS_TABLE_
USER_
INDEXES, pTable)) {
// if (0 == strcmp(TSDB_INS_TABLE_INDEXES, pTable)) {
// return 1;
// }
return
TSDB_INS_USER_STABLES_DBNAME_COLID
;
...
...
@@ -1868,7 +1868,7 @@ static SSDataBlock* sysTableScanUserTags(SOperatorInfo* pOperator) {
tNameGetDbName
(
&
sn
,
varDataVal
(
dbname
));
varDataSetLen
(
dbname
,
strlen
(
varDataVal
(
dbname
)));
SSDataBlock
*
p
=
buildInfoSchemaTableMetaBlock
(
TSDB_INS_TABLE_
USER_
TAGS
);
SSDataBlock
*
p
=
buildInfoSchemaTableMetaBlock
(
TSDB_INS_TABLE_TAGS
);
blockDataEnsureCapacity
(
p
,
pOperator
->
resultInfo
.
capacity
);
int32_t
ret
=
0
;
...
...
@@ -2039,7 +2039,7 @@ static SSDataBlock* sysTableScanUserTables(SOperatorInfo* pOperator) {
tNameGetDbName
(
&
sn
,
varDataVal
(
dbname
));
varDataSetLen
(
dbname
,
strlen
(
varDataVal
(
dbname
)));
SSDataBlock
*
p
=
buildInfoSchemaTableMetaBlock
(
TSDB_INS_TABLE_
USER_
TABLES
);
SSDataBlock
*
p
=
buildInfoSchemaTableMetaBlock
(
TSDB_INS_TABLE_TABLES
);
blockDataEnsureCapacity
(
p
,
pOperator
->
resultInfo
.
capacity
);
char
n
[
TSDB_TABLE_NAME_LEN
+
VARSTR_HEADER_SIZE
]
=
{
0
};
...
...
@@ -2206,11 +2206,11 @@ static SSDataBlock* doSysTableScan(SOperatorInfo* pOperator) {
sprintf
(
pInfo
->
req
.
db
,
"%d.%s"
,
pInfo
->
accountId
,
dbName
);
}
if
(
strncasecmp
(
name
,
TSDB_INS_TABLE_
USER_
TABLES
,
TSDB_TABLE_FNAME_LEN
)
==
0
)
{
if
(
strncasecmp
(
name
,
TSDB_INS_TABLE_TABLES
,
TSDB_TABLE_FNAME_LEN
)
==
0
)
{
return
sysTableScanUserTables
(
pOperator
);
}
else
if
(
strncasecmp
(
name
,
TSDB_INS_TABLE_
USER_
TAGS
,
TSDB_TABLE_FNAME_LEN
)
==
0
)
{
}
else
if
(
strncasecmp
(
name
,
TSDB_INS_TABLE_TAGS
,
TSDB_TABLE_FNAME_LEN
)
==
0
)
{
return
sysTableScanUserTags
(
pOperator
);
}
else
if
(
strncasecmp
(
name
,
TSDB_INS_TABLE_
USER_
STABLES
,
TSDB_TABLE_FNAME_LEN
)
==
0
&&
}
else
if
(
strncasecmp
(
name
,
TSDB_INS_TABLE_STABLES
,
TSDB_TABLE_FNAME_LEN
)
==
0
&&
IS_SYS_DBNAME
(
pInfo
->
req
.
db
))
{
return
sysTableScanUserSTables
(
pOperator
);
}
else
{
// load the meta from mnode of the given epset
...
...
@@ -2286,7 +2286,7 @@ static SSDataBlock* doSysTableScan(SOperatorInfo* pOperator) {
}
int32_t
buildSysDbTableInfo
(
const
SSysTableScanInfo
*
pInfo
,
int32_t
capacity
)
{
SSDataBlock
*
p
=
buildInfoSchemaTableMetaBlock
(
TSDB_INS_TABLE_
USER_
TABLES
);
SSDataBlock
*
p
=
buildInfoSchemaTableMetaBlock
(
TSDB_INS_TABLE_TABLES
);
blockDataEnsureCapacity
(
p
,
capacity
);
size_t
size
=
0
;
...
...
@@ -2375,8 +2375,8 @@ SOperatorInfo* createSysTableScanOperatorInfo(void* readHandle, SSystemTableScan
tNameAssign
(
&
pInfo
->
name
,
&
pScanNode
->
tableName
);
const
char
*
name
=
tNameGetTableName
(
&
pInfo
->
name
);
if
(
strncasecmp
(
name
,
TSDB_INS_TABLE_
USER_
TABLES
,
TSDB_TABLE_FNAME_LEN
)
==
0
||
strncasecmp
(
name
,
TSDB_INS_TABLE_
USER_
TAGS
,
TSDB_TABLE_FNAME_LEN
)
==
0
)
{
if
(
strncasecmp
(
name
,
TSDB_INS_TABLE_TABLES
,
TSDB_TABLE_FNAME_LEN
)
==
0
||
strncasecmp
(
name
,
TSDB_INS_TABLE_TAGS
,
TSDB_TABLE_FNAME_LEN
)
==
0
)
{
pInfo
->
readHandle
=
*
(
SReadHandle
*
)
readHandle
;
blockDataEnsureCapacity
(
pInfo
->
pRes
,
pOperator
->
resultInfo
.
capacity
);
}
else
{
...
...
source/libs/parser/src/parAstParser.c
浏览文件 @
660fd872
...
...
@@ -341,22 +341,22 @@ static int32_t collectMetaKeyFromShowBnodes(SCollectMetaKeyCxt* pCxt, SShowStmt*
}
static
int32_t
collectMetaKeyFromShowDatabases
(
SCollectMetaKeyCxt
*
pCxt
,
SShowStmt
*
pStmt
)
{
return
reserveTableMetaInCache
(
pCxt
->
pParseCxt
->
acctId
,
TSDB_INFORMATION_SCHEMA_DB
,
TSDB_INS_TABLE_
USER_
DATABASES
,
return
reserveTableMetaInCache
(
pCxt
->
pParseCxt
->
acctId
,
TSDB_INFORMATION_SCHEMA_DB
,
TSDB_INS_TABLE_DATABASES
,
pCxt
->
pMetaCache
);
}
static
int32_t
collectMetaKeyFromShowFunctions
(
SCollectMetaKeyCxt
*
pCxt
,
SShowStmt
*
pStmt
)
{
return
reserveTableMetaInCache
(
pCxt
->
pParseCxt
->
acctId
,
TSDB_INFORMATION_SCHEMA_DB
,
TSDB_INS_TABLE_
USER_
FUNCTIONS
,
return
reserveTableMetaInCache
(
pCxt
->
pParseCxt
->
acctId
,
TSDB_INFORMATION_SCHEMA_DB
,
TSDB_INS_TABLE_FUNCTIONS
,
pCxt
->
pMetaCache
);
}
static
int32_t
collectMetaKeyFromShowIndexes
(
SCollectMetaKeyCxt
*
pCxt
,
SShowStmt
*
pStmt
)
{
return
reserveTableMetaInCache
(
pCxt
->
pParseCxt
->
acctId
,
TSDB_INFORMATION_SCHEMA_DB
,
TSDB_INS_TABLE_
USER_
INDEXES
,
return
reserveTableMetaInCache
(
pCxt
->
pParseCxt
->
acctId
,
TSDB_INFORMATION_SCHEMA_DB
,
TSDB_INS_TABLE_INDEXES
,
pCxt
->
pMetaCache
);
}
static
int32_t
collectMetaKeyFromShowStables
(
SCollectMetaKeyCxt
*
pCxt
,
SShowStmt
*
pStmt
)
{
return
reserveTableMetaInCache
(
pCxt
->
pParseCxt
->
acctId
,
TSDB_INFORMATION_SCHEMA_DB
,
TSDB_INS_TABLE_
USER_
STABLES
,
return
reserveTableMetaInCache
(
pCxt
->
pParseCxt
->
acctId
,
TSDB_INFORMATION_SCHEMA_DB
,
TSDB_INS_TABLE_STABLES
,
pCxt
->
pMetaCache
);
}
...
...
@@ -367,7 +367,7 @@ static int32_t collectMetaKeyFromShowStreams(SCollectMetaKeyCxt* pCxt, SShowStmt
static
int32_t
collectMetaKeyFromShowTables
(
SCollectMetaKeyCxt
*
pCxt
,
SShowStmt
*
pStmt
)
{
int32_t
code
=
reserveTableMetaInCache
(
pCxt
->
pParseCxt
->
acctId
,
TSDB_INFORMATION_SCHEMA_DB
,
TSDB_INS_TABLE_
USER_
TABLES
,
pCxt
->
pMetaCache
);
TSDB_INS_TABLE_TABLES
,
pCxt
->
pMetaCache
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
NULL
!=
pStmt
->
pDbName
)
{
code
=
reserveDbVgInfoInCache
(
pCxt
->
pParseCxt
->
acctId
,
((
SValueNode
*
)
pStmt
->
pDbName
)
->
literal
,
pCxt
->
pMetaCache
);
...
...
@@ -379,7 +379,7 @@ static int32_t collectMetaKeyFromShowTables(SCollectMetaKeyCxt* pCxt, SShowStmt*
}
static
int32_t
collectMetaKeyFromShowTags
(
SCollectMetaKeyCxt
*
pCxt
,
SShowStmt
*
pStmt
)
{
int32_t
code
=
reserveTableMetaInCache
(
pCxt
->
pParseCxt
->
acctId
,
TSDB_INFORMATION_SCHEMA_DB
,
TSDB_INS_TABLE_
USER_
TAGS
,
int32_t
code
=
reserveTableMetaInCache
(
pCxt
->
pParseCxt
->
acctId
,
TSDB_INFORMATION_SCHEMA_DB
,
TSDB_INS_TABLE_TAGS
,
pCxt
->
pMetaCache
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
NULL
!=
pStmt
->
pDbName
)
{
...
...
@@ -392,7 +392,7 @@ static int32_t collectMetaKeyFromShowTags(SCollectMetaKeyCxt* pCxt, SShowStmt* p
}
static
int32_t
collectMetaKeyFromShowUsers
(
SCollectMetaKeyCxt
*
pCxt
,
SShowStmt
*
pStmt
)
{
return
reserveTableMetaInCache
(
pCxt
->
pParseCxt
->
acctId
,
TSDB_INFORMATION_SCHEMA_DB
,
TSDB_INS_TABLE_USER
_USER
S
,
return
reserveTableMetaInCache
(
pCxt
->
pParseCxt
->
acctId
,
TSDB_INFORMATION_SCHEMA_DB
,
TSDB_INS_TABLE_USERS
,
pCxt
->
pMetaCache
);
}
...
...
source/libs/parser/src/parInsert.c
浏览文件 @
660fd872
...
...
@@ -21,6 +21,7 @@
#include "tglobal.h"
#include "ttime.h"
#include "ttypes.h"
#include "query.h"
#define NEXT_TOKEN(pSql, sToken) \
do { \
...
...
@@ -1488,6 +1489,8 @@ static int32_t parseInsertBody(SInsertParseContext* pCxt) {
return
buildSyntaxErrMsg
(
&
pCxt
->
msg
,
"keyword VALUES or FILE is expected"
,
sToken
.
z
);
}
qDebug
(
"0x%"
PRIx64
" insert input rows: %d"
,
pCxt
->
pComCxt
->
requestId
,
pCxt
->
totalNum
);
if
(
TSDB_QUERY_HAS_TYPE
(
pCxt
->
pOutput
->
insertType
,
TSDB_QUERY_TYPE_STMT_INSERT
))
{
SParsedDataColInfo
*
tags
=
taosMemoryMalloc
(
sizeof
(
pCxt
->
tags
));
if
(
NULL
==
tags
)
{
...
...
source/libs/parser/src/parTranslater.c
浏览文件 @
660fd872
...
...
@@ -1750,9 +1750,9 @@ static int32_t dnodeToVgroupsInfo(SArray* pDnodes, SVgroupsInfo** pVgsInfo) {
}
static
bool
sysTableFromVnode
(
const
char
*
pTable
)
{
return
(
0
==
strcmp
(
pTable
,
TSDB_INS_TABLE_
USER_
TABLES
))
||
(
0
==
strcmp
(
pTable
,
TSDB_INS_TABLE_
USER_
TABLE_DISTRIBUTED
)
||
(
0
==
strcmp
(
pTable
,
TSDB_INS_TABLE_
USER_
TAGS
)));
return
(
0
==
strcmp
(
pTable
,
TSDB_INS_TABLE_TABLES
))
||
(
0
==
strcmp
(
pTable
,
TSDB_INS_TABLE_TABLE_DISTRIBUTED
)
||
(
0
==
strcmp
(
pTable
,
TSDB_INS_TABLE_TAGS
)));
}
static
bool
sysTableFromDnode
(
const
char
*
pTable
)
{
return
0
==
strcmp
(
pTable
,
TSDB_INS_TABLE_DNODE_VARIABLES
);
}
...
...
@@ -1768,7 +1768,7 @@ static int32_t setVnodeSysTableVgroupList(STranslateContext* pCxt, SName* pName,
code
=
getDBVgInfoImpl
(
pCxt
,
pName
,
&
vgroupList
);
}
if
(
TSDB_CODE_SUCCESS
==
code
&&
0
==
strcmp
(
pRealTable
->
table
.
tableName
,
TSDB_INS_TABLE_
USER_
TABLES
))
{
if
(
TSDB_CODE_SUCCESS
==
code
&&
0
==
strcmp
(
pRealTable
->
table
.
tableName
,
TSDB_INS_TABLE_TABLES
))
{
code
=
addMnodeToVgroupList
(
&
pCxt
->
pParseCxt
->
mgmtEpSet
,
&
vgroupList
);
}
...
...
@@ -1856,9 +1856,9 @@ static bool joinTableIsSingleTable(SJoinTableNode* pJoinTable) {
static
bool
isSingleTable
(
SRealTableNode
*
pRealTable
)
{
int8_t
tableType
=
pRealTable
->
pMeta
->
tableType
;
if
(
TSDB_SYSTEM_TABLE
==
tableType
)
{
return
0
!=
strcmp
(
pRealTable
->
table
.
tableName
,
TSDB_INS_TABLE_
USER_
TABLES
)
&&
0
!=
strcmp
(
pRealTable
->
table
.
tableName
,
TSDB_INS_TABLE_
USER_
TABLE_DISTRIBUTED
)
&&
0
!=
strcmp
(
pRealTable
->
table
.
tableName
,
TSDB_INS_TABLE_
USER_
TAGS
);
return
0
!=
strcmp
(
pRealTable
->
table
.
tableName
,
TSDB_INS_TABLE_TABLES
)
&&
0
!=
strcmp
(
pRealTable
->
table
.
tableName
,
TSDB_INS_TABLE_TABLE_DISTRIBUTED
)
&&
0
!=
strcmp
(
pRealTable
->
table
.
tableName
,
TSDB_INS_TABLE_TAGS
);
}
return
(
TSDB_CHILD_TABLE
==
tableType
||
TSDB_NORMAL_TABLE
==
tableType
);
}
...
...
@@ -5244,15 +5244,15 @@ static const char* getSysDbName(ENodeType type) {
static
const
char
*
getSysTableName
(
ENodeType
type
)
{
switch
(
type
)
{
case
QUERY_NODE_SHOW_DATABASES_STMT
:
return
TSDB_INS_TABLE_
USER_
DATABASES
;
return
TSDB_INS_TABLE_DATABASES
;
case
QUERY_NODE_SHOW_TABLES_STMT
:
return
TSDB_INS_TABLE_
USER_
TABLES
;
return
TSDB_INS_TABLE_TABLES
;
case
QUERY_NODE_SHOW_TAGS_STMT
:
return
TSDB_INS_TABLE_
USER_
TAGS
;
return
TSDB_INS_TABLE_TAGS
;
case
QUERY_NODE_SHOW_STABLES_STMT
:
return
TSDB_INS_TABLE_
USER_
STABLES
;
return
TSDB_INS_TABLE_STABLES
;
case
QUERY_NODE_SHOW_USERS_STMT
:
return
TSDB_INS_TABLE_USER
_USER
S
;
return
TSDB_INS_TABLE_USERS
;
case
QUERY_NODE_SHOW_DNODES_STMT
:
return
TSDB_INS_TABLE_DNODES
;
case
QUERY_NODE_SHOW_VGROUPS_STMT
:
...
...
@@ -5264,9 +5264,9 @@ static const char* getSysTableName(ENodeType type) {
case
QUERY_NODE_SHOW_QNODES_STMT
:
return
TSDB_INS_TABLE_QNODES
;
case
QUERY_NODE_SHOW_FUNCTIONS_STMT
:
return
TSDB_INS_TABLE_
USER_
FUNCTIONS
;
return
TSDB_INS_TABLE_FUNCTIONS
;
case
QUERY_NODE_SHOW_INDEXES_STMT
:
return
TSDB_INS_TABLE_
USER_
INDEXES
;
return
TSDB_INS_TABLE_INDEXES
;
case
QUERY_NODE_SHOW_STREAMS_STMT
:
return
TSDB_PERFS_TABLE_STREAMS
;
case
QUERY_NODE_SHOW_BNODES_STMT
:
...
...
source/libs/parser/test/mockCatalog.cpp
浏览文件 @
660fd872
...
...
@@ -58,46 +58,46 @@ void generateInformationSchema(MockCatalogService* mcs) {
}
{
ITableBuilder
&
builder
=
mcs
->
createTableBuilder
(
TSDB_INFORMATION_SCHEMA_DB
,
TSDB_INS_TABLE_
USER_
DATABASES
,
TSDB_SYSTEM_TABLE
,
1
)
mcs
->
createTableBuilder
(
TSDB_INFORMATION_SCHEMA_DB
,
TSDB_INS_TABLE_DATABASES
,
TSDB_SYSTEM_TABLE
,
1
)
.
addColumn
(
"name"
,
TSDB_DATA_TYPE_BINARY
,
TSDB_DB_NAME_LEN
);
builder
.
done
();
}
{
ITableBuilder
&
builder
=
mcs
->
createTableBuilder
(
TSDB_INFORMATION_SCHEMA_DB
,
TSDB_INS_TABLE_
USER_
FUNCTIONS
,
TSDB_SYSTEM_TABLE
,
1
)
mcs
->
createTableBuilder
(
TSDB_INFORMATION_SCHEMA_DB
,
TSDB_INS_TABLE_FUNCTIONS
,
TSDB_SYSTEM_TABLE
,
1
)
.
addColumn
(
"name"
,
TSDB_DATA_TYPE_BINARY
,
TSDB_FUNC_NAME_LEN
);
builder
.
done
();
}
{
ITableBuilder
&
builder
=
mcs
->
createTableBuilder
(
TSDB_INFORMATION_SCHEMA_DB
,
TSDB_INS_TABLE_
USER_
INDEXES
,
TSDB_SYSTEM_TABLE
,
2
)
mcs
->
createTableBuilder
(
TSDB_INFORMATION_SCHEMA_DB
,
TSDB_INS_TABLE_INDEXES
,
TSDB_SYSTEM_TABLE
,
2
)
.
addColumn
(
"db_name"
,
TSDB_DATA_TYPE_BINARY
,
TSDB_DB_NAME_LEN
)
.
addColumn
(
"table_name"
,
TSDB_DATA_TYPE_BINARY
,
TSDB_TABLE_NAME_LEN
);
builder
.
done
();
}
{
ITableBuilder
&
builder
=
mcs
->
createTableBuilder
(
TSDB_INFORMATION_SCHEMA_DB
,
TSDB_INS_TABLE_
USER_
STABLES
,
TSDB_SYSTEM_TABLE
,
2
)
mcs
->
createTableBuilder
(
TSDB_INFORMATION_SCHEMA_DB
,
TSDB_INS_TABLE_STABLES
,
TSDB_SYSTEM_TABLE
,
2
)
.
addColumn
(
"db_name"
,
TSDB_DATA_TYPE_BINARY
,
TSDB_DB_NAME_LEN
)
.
addColumn
(
"stable_name"
,
TSDB_DATA_TYPE_BINARY
,
TSDB_TABLE_NAME_LEN
);
builder
.
done
();
}
{
ITableBuilder
&
builder
=
mcs
->
createTableBuilder
(
TSDB_INFORMATION_SCHEMA_DB
,
TSDB_INS_TABLE_
USER_
TABLES
,
TSDB_SYSTEM_TABLE
,
2
)
mcs
->
createTableBuilder
(
TSDB_INFORMATION_SCHEMA_DB
,
TSDB_INS_TABLE_TABLES
,
TSDB_SYSTEM_TABLE
,
2
)
.
addColumn
(
"db_name"
,
TSDB_DATA_TYPE_BINARY
,
TSDB_DB_NAME_LEN
)
.
addColumn
(
"table_name"
,
TSDB_DATA_TYPE_BINARY
,
TSDB_TABLE_NAME_LEN
);
builder
.
done
();
}
{
ITableBuilder
&
builder
=
mcs
->
createTableBuilder
(
TSDB_INFORMATION_SCHEMA_DB
,
TSDB_INS_TABLE_
USER_
TABLE_DISTRIBUTED
,
TSDB_SYSTEM_TABLE
,
1
)
mcs
->
createTableBuilder
(
TSDB_INFORMATION_SCHEMA_DB
,
TSDB_INS_TABLE_TABLE_DISTRIBUTED
,
TSDB_SYSTEM_TABLE
,
1
)
.
addColumn
(
"db_name"
,
TSDB_DATA_TYPE_BINARY
,
TSDB_DB_NAME_LEN
);
builder
.
done
();
}
{
ITableBuilder
&
builder
=
mcs
->
createTableBuilder
(
TSDB_INFORMATION_SCHEMA_DB
,
TSDB_INS_TABLE_USER
_USER
S
,
TSDB_SYSTEM_TABLE
,
1
)
mcs
->
createTableBuilder
(
TSDB_INFORMATION_SCHEMA_DB
,
TSDB_INS_TABLE_USERS
,
TSDB_SYSTEM_TABLE
,
1
)
.
addColumn
(
"user_name"
,
TSDB_DATA_TYPE_BINARY
,
TSDB_USER_LEN
);
builder
.
done
();
}
...
...
source/libs/parser/test/parSelectTest.cpp
浏览文件 @
660fd872
...
...
@@ -426,7 +426,7 @@ TEST_F(ParserSelectTest, setOperatorSemanticCheck) {
TEST_F
(
ParserSelectTest
,
informationSchema
)
{
useDb
(
"root"
,
"test"
);
run
(
"SELECT * FROM information_schema.
user
_databases WHERE name = 'information_schema'"
);
run
(
"SELECT * FROM information_schema.
ins
_databases WHERE name = 'information_schema'"
);
}
TEST_F
(
ParserSelectTest
,
withoutFrom
)
{
...
...
source/libs/planner/src/planPhysiCreater.c
浏览文件 @
660fd872
...
...
@@ -568,9 +568,9 @@ static int32_t createSystemTableScanPhysiNode(SPhysiPlanContext* pCxt, SSubplan*
pScan
->
showRewrite
=
pScanLogicNode
->
showRewrite
;
pScan
->
accountId
=
pCxt
->
pPlanCxt
->
acctId
;
if
(
0
==
strcmp
(
pScanLogicNode
->
tableName
.
tname
,
TSDB_INS_TABLE_
USER_
TABLES
)
||
0
==
strcmp
(
pScanLogicNode
->
tableName
.
tname
,
TSDB_INS_TABLE_
USER_
TABLE_DISTRIBUTED
)
||
0
==
strcmp
(
pScanLogicNode
->
tableName
.
tname
,
TSDB_INS_TABLE_
USER_
TAGS
))
{
if
(
0
==
strcmp
(
pScanLogicNode
->
tableName
.
tname
,
TSDB_INS_TABLE_TABLES
)
||
0
==
strcmp
(
pScanLogicNode
->
tableName
.
tname
,
TSDB_INS_TABLE_TABLE_DISTRIBUTED
)
||
0
==
strcmp
(
pScanLogicNode
->
tableName
.
tname
,
TSDB_INS_TABLE_TAGS
))
{
vgroupInfoToNodeAddr
(
pScanLogicNode
->
pVgroupList
->
vgroups
,
&
pSubplan
->
execNode
);
}
else
{
pSubplan
->
execNode
.
nodeId
=
MNODE_HANDLE
;
...
...
source/libs/planner/test/planSysTbTest.cpp
浏览文件 @
660fd872
...
...
@@ -30,5 +30,5 @@ TEST_F(PlanSysTableTest, show) {
TEST_F
(
PlanSysTableTest
,
informationSchema
)
{
useDb
(
"root"
,
"information_schema"
);
run
(
"SELECT * FROM information_schema.
user
_databases WHERE name = 'information_schema'"
);
run
(
"SELECT * FROM information_schema.
ins
_databases WHERE name = 'information_schema'"
);
}
source/libs/scheduler/src/schJob.c
浏览文件 @
660fd872
...
...
@@ -380,6 +380,7 @@ int32_t schDumpJobExecRes(SSchJob* pJob, SExecResult* pRes) {
pRes
->
numOfRows
=
pJob
->
resNumOfRows
;
pRes
->
res
=
pJob
->
execRes
.
res
;
pRes
->
msgType
=
pJob
->
execRes
.
msgType
;
pRes
->
numOfBytes
=
pJob
->
execRes
.
numOfBytes
;
pJob
->
execRes
.
res
=
NULL
;
SCH_JOB_DLOG
(
"execRes dumped, code: %s"
,
tstrerror
(
pRes
->
code
));
...
...
source/libs/scheduler/src/schRemote.c
浏览文件 @
660fd872
...
...
@@ -213,6 +213,7 @@ int32_t schHandleResponseMsg(SSchJob *pJob, SSchTask *pTask, int32_t execId, SDa
pJob
->
execRes
.
res
=
rsp
;
pJob
->
execRes
.
msgType
=
TDMT_VND_SUBMIT
;
}
pJob
->
execRes
.
numOfBytes
+=
pTask
->
msgLen
;
SCH_UNLOCK
(
SCH_WRITE
,
&
pJob
->
resLock
);
}
...
...
tests/script/jenkins/basic.txt
浏览文件 @
660fd872
...
...
@@ -183,7 +183,7 @@
# ---- qnode
./test.sh -f tsim/qnode/basic1.sim
# ---- snode
# ---- snode
----
# unsupport ./test.sh -f tsim/snode/basic1.sim
# ---- bnode
...
...
@@ -199,7 +199,7 @@
# ---- show ----
./test.sh -f tsim/show/basic.sim
# ---- table
# ---- table
----
./test.sh -f tsim/table/autocreate.sim
./test.sh -f tsim/table/basic1.sim
./test.sh -f tsim/table/basic2.sim
...
...
@@ -248,7 +248,7 @@
./test.sh -f tsim/stream/ignoreExpiredData.sim
./test.sh -f tsim/stream/sliding.sim
# ---- transaction
# ---- transaction
----
./test.sh -f tsim/trans/lossdata1.sim
./test.sh -f tsim/trans/create_db.sim
...
...
@@ -307,7 +307,7 @@
./test.sh -f tsim/sma/rsmaCreateInsertQuery.sim
./test.sh -f tsim/sma/rsmaPersistenceRecovery.sim
# --- valgrind
# --- valgrind
----
./test.sh -f tsim/valgrind/checkError1.sim
./test.sh -f tsim/valgrind/checkError2.sim
./test.sh -f tsim/valgrind/checkError3.sim
...
...
tests/script/tsim/query/explain.sim
浏览文件 @
660fd872
...
...
@@ -35,7 +35,7 @@ sql explain select * from st1 where -2;
sql explain select ts from tb1;
sql explain select * from st1;
sql explain select * from st1 order by ts;
sql explain select * from information_schema.
user
_stables;
sql explain select * from information_schema.
ins
_stables;
sql explain select count(*),sum(f1) from tb1;
sql explain select count(*),sum(f1) from st1;
sql explain select count(*),sum(f1) from st1 group by f1;
...
...
@@ -46,7 +46,7 @@ sql explain verbose true select * from st1 where -2;
sql explain verbose true select ts from tb1 where f1 > 0;
sql explain verbose true select * from st1 where f1 > 0 and ts > '2020-10-31 00:00:00' and ts < '2021-10-31 00:00:00';
sql explain verbose true select count(*) from st1 partition by tbname slimit 1 soffset 2 limit 2 offset 1;
sql explain verbose true select * from information_schema.
user
_stables where db_name='db2';
sql explain verbose true select * from information_schema.
ins
_stables where db_name='db2';
print ======== step4
sql explain analyze select ts from st1 where -2;
...
...
@@ -54,7 +54,7 @@ sql explain analyze select ts from tb1;
sql explain analyze select ts from st1;
sql explain analyze select ts from st1;
sql explain analyze select ts from st1 order by ts;
sql explain analyze select * from information_schema.
user
_stables;
sql explain analyze select * from information_schema.
ins
_stables;
sql explain analyze select count(*),sum(f1) from tb1;
sql explain analyze select count(*),sum(f1) from st1;
sql explain analyze select count(*),sum(f1) from st1 group by f1;
...
...
@@ -65,14 +65,14 @@ sql explain analyze verbose true select ts from tb1;
sql explain analyze verbose true select ts from st1;
sql explain analyze verbose true select ts from st1;
sql explain analyze verbose true select ts from st1 order by ts;
sql explain analyze verbose true select * from information_schema.
user
_stables;
sql explain analyze verbose true select * from information_schema.
ins
_stables;
sql explain analyze verbose true select count(*),sum(f1) from tb1;
sql explain analyze verbose true select count(*),sum(f1) from st1;
sql explain analyze verbose true select count(*),sum(f1) from st1 group by f1;
#sql explain analyze verbose true select count(f1) from tb1 interval(10s, 2s) sliding(3s) fill(prev);
sql explain analyze verbose true select ts from tb1 where f1 > 0;
sql explain analyze verbose true select f1 from st1 where f1 > 0 and ts > '2020-10-31 00:00:00' and ts < '2021-10-31 00:00:00';
sql explain analyze verbose true select * from information_schema.
user
_stables where db_name='db2';
sql explain analyze verbose true select * from information_schema.
ins
_stables where db_name='db2';
sql explain analyze verbose true select * from (select min(f1),count(*) a from st1 where f1 > 0) where a < 0;
#not pass case
...
...
tests/script/tsim/show/basic.sim
浏览文件 @
660fd872
...
...
@@ -77,37 +77,37 @@ if $rows != 3 then
endi
print =============== run select * from information_schema.xxxx
sql select * from information_schema.
`dnodes`
sql select * from information_schema.
ins_dnodes
if $rows != 2 then
return -1
endi
sql select * from information_schema.
`mnodes`
sql select * from information_schema.
ins_mnodes
if $rows != 1 then
return -1
endi
#sql select * from information_schema.
`modules`
#sql select * from information_schema.
`qnodes`
sql select * from information_schema.
user
_databases
#sql select * from information_schema.
ins_modules
#sql select * from information_schema.
ins_qnodes
sql select * from information_schema.
ins
_databases
if $rows != 3 then
return -1
endi
#sql select * from information_schema.
user
_functions
#sql select * from information_schema.
user
_indexes
sql select * from information_schema.
user
_stables
#sql select * from information_schema.
ins
_functions
#sql select * from information_schema.
ins
_indexes
sql select * from information_schema.
ins
_stables
if $rows != 1 then
return -1
endi
#sql select * from information_schema.
`streams`
sql select * from information_schema.
user
_tables
#sql select * from information_schema.
ins_streams
sql select * from information_schema.
ins
_tables
if $rows <= 0 then
return -1
endi
#sql select * from information_schema.
user
_table_distributed
sql select * from information_schema.
user
_users
#sql select * from information_schema.
ins
_table_distributed
sql select * from information_schema.
ins
_users
if $rows != 1 then
return -1
endi
sql select * from information_schema.
`vgroups`
sql select * from information_schema.
ins_vgroups
if $rows != 3 then
return -1
endi
...
...
@@ -175,37 +175,37 @@ if $rows != 3 then
endi
print =============== run select * from information_schema.xxxx
sql select * from information_schema.
`dnodes`
sql select * from information_schema.
ins_dnodes
if $rows != 2 then
return -1
endi
sql select * from information_schema.
`mnodes`
sql select * from information_schema.
ins_mnodes
if $rows != 1 then
return -1
endi
#sql select * from information_schema.
`modules`
#sql select * from information_schema.
`qnodes`
sql select * from information_schema.
user
_databases
#sql select * from information_schema.
ins_modules
#sql select * from information_schema.
ins_qnodes
sql select * from information_schema.
ins
_databases
if $rows != 3 then
return -1
endi
#sql select * from information_schema.
user
_functions
#sql select * from information_schema.
user
_indexes
sql select * from information_schema.
user
_stables
#sql select * from information_schema.
ins
_functions
#sql select * from information_schema.
ins
_indexes
sql select * from information_schema.
ins
_stables
if $rows != 1 then
return -1
endi
#sql select * from performance_schema.
`streams`
sql select * from information_schema.
user
_tables
#sql select * from performance_schema.
perf_streams
sql select * from information_schema.
ins
_tables
if $rows <= 0 then
return -1
endi
#sql select * from information_schema.
user
_table_distributed
sql select * from information_schema.
user
_users
#sql select * from information_schema.
ins
_table_distributed
sql select * from information_schema.
ins
_users
if $rows != 1 then
return -1
endi
sql select * from information_schema.
`vgroups`
sql select * from information_schema.
ins_vgroups
if $rows != 3 then
return -1
endi
...
...
tests/script/tsim/table/delete_writing.sim
浏览文件 @
660fd872
...
...
@@ -3,10 +3,6 @@ system sh/deploy.sh -n dnode1 -i 1
system sh/exec.sh -n dnode1 -s start
sql connect
print ========= start dnodes
system sh/exec.sh -n dnode1 -s start
sql connect
sql create database db
sql create table db.tb (ts timestamp, i int)
sql insert into db.tb values(now, 1)
...
...
tests/script/tsim/table/smallint.sim
浏览文件 @
660fd872
...
...
@@ -90,7 +90,6 @@ endi
if $data01 != 2 then
return -1
endi
return
sql drop database $db
sql show databases
if $rows != 2 then
...
...
tests/script/tsim/tmq/basic2Of2ConsOverlap.sim
浏览文件 @
660fd872
...
...
@@ -342,12 +342,12 @@ endi
return -1
check_ok_3:
sql select * from performance_schema.
`consumers`
sql select * from performance_schema.
perf_consumers
if $rows != 0 then
return -1
endi
#sql select * from performance_schema.
`subscriptions`
#sql select * from performance_schema.
perf_subscriptions
#if $rows != 0 then
# return -1
#endi
...
...
tests/script/tsim/tmq/snapshot1.sim
浏览文件 @
660fd872
...
...
@@ -294,12 +294,12 @@ endi
return -1
check_ok_3:
sql select * from performance_schema.
`consumers`
sql select * from performance_schema.
perf_consumers
if $rows != 0 then
return -1
endi
#sql select * from performance_schema.
`subscriptions`
#sql select * from performance_schema.
perf_subscriptions
#if $rows != 0 then
# return -1
#endi
...
...
tests/script/tsim/valgrind/basic3.sim
浏览文件 @
660fd872
...
...
@@ -29,7 +29,7 @@ $rowNum = 10
print =============== step2: prepare data
sql create database db vgroups 2
sql use db
sql create table if not exists stb (ts timestamp, tbcol int, tbcol2 float, tbcol3 double) tags (tgcol int unsigned)
sql create table if not exists stb (ts timestamp, tbcol int, tbcol2 float, tbcol3 double
, tbcol4 binary(30), tbcol5 binary(30)
) tags (tgcol int unsigned)
$i = 0
while $i < $tbNum
...
...
@@ -39,19 +39,22 @@ while $i < $tbNum
while $x < $rowNum
$cc = $x * 60000
$ms = 1601481600000 + $cc
sql insert into $tb values ($ms , $x , $x , $x )
sql insert into $tb values ($ms , $x , $x , $x
, "abcd1234=-+*" , "123456 0"
)
$x = $x + 1
endw
$cc = $x * 60000
$ms = 1601481600000 + $cc
sql insert into $tb values ($ms , NULL , NULL , NULL , NULL , NULL )
$i = $i + 1
endw
print =============== step3: tb
sql select
count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from tb1 where ts <= 1601481840000 and ts >= 1601481800000 partition by tgcol interval(1m) fill(value, 0)
sql select
tbcol5 - tbcol3 from tb1
print =============== step4: stb
sql select
count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from stb where ts <= 1601481840000 and ts >= 1601481800000 partition by tgcol interval(1m) fill(value, 0)
sql select
tbcol5 - tbcol3 from stb
_OVER:
system sh/exec.sh -n dnode1 -s stop -x SIGINT
print =============== check
$null=
...
...
tests/script/tsim/valgrind/checkError1.sim
浏览文件 @
660fd872
...
...
@@ -84,37 +84,37 @@ if $rows != 1 then
endi
print =============== run select * from information_schema.xxxx
sql select * from information_schema.
`dnodes`
sql select * from information_schema.
ins_dnodes
if $rows != 2 then
return -1
endi
sql select * from information_schema.
`mnodes`
sql select * from information_schema.
ins_mnodes
if $rows != 1 then
return -1
endi
sql select * from information_schema.
user
_databases
sql select * from information_schema.
ins
_databases
if $rows != 3 then
return -1
endi
sql select * from information_schema.
user
_stables
sql select * from information_schema.
ins
_stables
if $rows != 1 then
return -1
endi
sql select * from information_schema.
user
_tables
sql select * from information_schema.
ins
_tables
if $rows <= 0 then
return -1
endi
sql select * from information_schema.
user
_users
sql select * from information_schema.
ins
_users
if $rows != 1 then
return -1
endi
sql select * from information_schema.
`vgroups`
sql select * from information_schema.
ins_vgroups
if $rows != 3 then
return -1
endi
...
...
tests/script/tsim/valgrind/checkError6.sim
浏览文件 @
660fd872
...
...
@@ -77,6 +77,8 @@ sql select length("abcd1234"), char_length("abcd1234=-+*") from tb1
sql select tbcol4, length(tbcol4), lower(tbcol4), upper(tbcol4), ltrim(tbcol4), rtrim(tbcol4), concat(tbcol4, tbcol5), concat_ws('_', tbcol4, tbcol5), substr(tbcol4, 1, 4) from tb1
sql select * from tb1 where tbcol not in (1,2,3,null);
sql select * from tb1 where tbcol + 3 <> null;
sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from tb1 where ts <= 1601481840000 and ts >= 1601481800000 partition by tgcol interval(1m) fill(value, 0)
#sql select tbcol5 - tbcol3 from tb1
print =============== step4: stb
sql select avg(tbcol) as c from stb
...
...
@@ -105,17 +107,20 @@ sql select tbcol4, length(tbcol4), lower(tbcol4), upper(tbcol4), ltrim(tbcol4),
sql select * from stb where tbcol not in (1,2,3,null);
sql select * from stb where tbcol + 3 <> null;
sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from stb where tbcol = 1 and tbcol2 = 1 and tbcol3 = 1 partition by tgcol interval(1d)
sql select _wstart, count(*) from tb1 session(ts, 1m)
sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from stb where ts <= 1601481840000 and ts >= 1601481800000 partition by tgcol interval(1m) fill(value, 0)
#sql select tbcol5 - tbcol3 from stb
print =============== step5: explain
sql explain analyze select ts from stb where -2;
sql explain analyze select ts from tb1;
sql explain analyze select ts from stb order by ts;
sql explain analyze select * from information_schema.
user
_stables;
sql explain analyze select * from information_schema.
ins
_stables;
sql explain analyze select count(*),sum(tbcol) from tb1;
sql explain analyze select count(*),sum(tbcol) from stb;
sql explain analyze select count(*),sum(tbcol) from stb group by tbcol;
sql explain analyze select * from information_schema.
user
_stables;
sql explain analyze verbose true select * from information_schema.
user
_stables where db_name='db2';
sql explain analyze select * from information_schema.
ins
_stables;
sql explain analyze verbose true select * from information_schema.
ins
_stables where db_name='db2';
sql explain analyze verbose true select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from stb where ts <= 1601481840000 and ts >= 1601481800000 partition by tgcol interval(1m) fill(value, 0)
sql explain select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from stb where ts <= 1601481840000 and ts >= 1601481800000 partition by tgcol interval(1m) fill(value, 0)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录