Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
2bf16fbf
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
2bf16fbf
编写于
6月 07, 2022
作者:
X
Xiaoyu Wang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: vgroup manage command
上级
6dc64627
变更
11
展开全部
隐藏空白更改
内联
并排
Showing
11 changed file
with
2495 addition
and
2307 deletion
+2495
-2307
include/common/ttokendef.h
include/common/ttokendef.h
+61
-62
include/util/taoserror.h
include/util/taoserror.h
+1
-0
source/libs/nodes/src/nodesUtilFuncs.c
source/libs/nodes/src/nodesUtilFuncs.c
+5
-0
source/libs/parser/inc/sql.y
source/libs/parser/inc/sql.y
+1
-1
source/libs/parser/src/parTokenizer.c
source/libs/parser/src/parTokenizer.c
+4
-0
source/libs/parser/src/parTranslater.c
source/libs/parser/src/parTranslater.c
+35
-2
source/libs/parser/src/parUtil.c
source/libs/parser/src/parUtil.c
+2
-0
source/libs/parser/src/sql.c
source/libs/parser/src/sql.c
+2233
-2236
source/libs/parser/test/parExplainToSyncdbTest.cpp
source/libs/parser/test/parExplainToSyncdbTest.cpp
+57
-3
source/libs/parser/test/parInitialATest.cpp
source/libs/parser/test/parInitialATest.cpp
+13
-0
source/util/src/terror.c
source/util/src/terror.c
+83
-3
未找到文件。
include/common/ttokendef.h
浏览文件 @
2bf16fbf
...
@@ -192,68 +192,67 @@
...
@@ -192,68 +192,67 @@
#define TK_VGROUP 174
#define TK_VGROUP 174
#define TK_MERGE 175
#define TK_MERGE 175
#define TK_REDISTRIBUTE 176
#define TK_REDISTRIBUTE 176
#define TK_SPLIT 177
#define TK_SYNCDB 177
#define TK_SYNCDB 178
#define TK_DELETE 178
#define TK_DELETE 179
#define TK_NULL 179
#define TK_NULL 180
#define TK_NK_QUESTION 180
#define TK_NK_QUESTION 181
#define TK_NK_ARROW 181
#define TK_NK_ARROW 182
#define TK_ROWTS 182
#define TK_ROWTS 183
#define TK_TBNAME 183
#define TK_TBNAME 184
#define TK_QSTARTTS 184
#define TK_QSTARTTS 185
#define TK_QENDTS 185
#define TK_QENDTS 186
#define TK_WSTARTTS 186
#define TK_WSTARTTS 187
#define TK_WENDTS 187
#define TK_WENDTS 188
#define TK_WDURATION 188
#define TK_WDURATION 189
#define TK_CAST 189
#define TK_CAST 190
#define TK_NOW 190
#define TK_NOW 191
#define TK_TODAY 191
#define TK_TODAY 192
#define TK_TIMEZONE 192
#define TK_TIMEZONE 193
#define TK_COUNT 193
#define TK_COUNT 194
#define TK_FIRST 194
#define TK_FIRST 195
#define TK_LAST 195
#define TK_LAST 196
#define TK_LAST_ROW 196
#define TK_LAST_ROW 197
#define TK_BETWEEN 197
#define TK_BETWEEN 198
#define TK_IS 198
#define TK_IS 199
#define TK_NK_LT 199
#define TK_NK_LT 200
#define TK_NK_GT 200
#define TK_NK_GT 201
#define TK_NK_LE 201
#define TK_NK_LE 202
#define TK_NK_GE 202
#define TK_NK_GE 203
#define TK_NK_NE 203
#define TK_NK_NE 204
#define TK_MATCH 204
#define TK_MATCH 205
#define TK_NMATCH 205
#define TK_NMATCH 206
#define TK_CONTAINS 206
#define TK_CONTAINS 207
#define TK_JOIN 207
#define TK_JOIN 208
#define TK_INNER 208
#define TK_INNER 209
#define TK_SELECT 209
#define TK_SELECT 210
#define TK_DISTINCT 210
#define TK_DISTINCT 211
#define TK_WHERE 211
#define TK_WHERE 212
#define TK_PARTITION 212
#define TK_PARTITION 213
#define TK_BY 213
#define TK_BY 214
#define TK_SESSION 214
#define TK_SESSION 215
#define TK_STATE_WINDOW 215
#define TK_STATE_WINDOW 216
#define TK_SLIDING 216
#define TK_SLIDING 217
#define TK_FILL 217
#define TK_FILL 218
#define TK_VALUE 218
#define TK_VALUE 219
#define TK_NONE 219
#define TK_NONE 220
#define TK_PREV 220
#define TK_PREV 221
#define TK_LINEAR 221
#define TK_LINEAR 222
#define TK_NEXT 222
#define TK_NEXT 223
#define TK_HAVING 223
#define TK_HAVING 224
#define TK_ORDER 224
#define TK_ORDER 225
#define TK_SLIMIT 225
#define TK_SLIMIT 226
#define TK_SOFFSET 226
#define TK_SOFFSET 227
#define TK_LIMIT 227
#define TK_LIMIT 228
#define TK_OFFSET 228
#define TK_OFFSET 229
#define TK_ASC 229
#define TK_ASC 230
#define TK_NULLS 230
#define TK_NULLS 231
#define TK_ID 231
#define TK_ID 232
#define TK_NK_BITNOT 232
#define TK_NK_BITNOT 233
#define TK_INSERT 233
#define TK_INSERT 234
#define TK_VALUES 234
#define TK_VALUES 235
#define TK_IMPORT 235
#define TK_IMPORT 236
#define TK_NK_SEMI 236
#define TK_NK_SEMI 237
#define TK_FILE 237
#define TK_FILE 238
#define TK_NK_SPACE 300
#define TK_NK_SPACE 300
#define TK_NK_COMMENT 301
#define TK_NK_COMMENT 301
...
...
include/util/taoserror.h
浏览文件 @
2bf16fbf
...
@@ -653,6 +653,7 @@ int32_t* taosGetErrno();
...
@@ -653,6 +653,7 @@ int32_t* taosGetErrno();
#define TSDB_CODE_PAR_VALUE_TOO_LONG TAOS_DEF_ERROR_CODE(0, 0x2653)
#define TSDB_CODE_PAR_VALUE_TOO_LONG TAOS_DEF_ERROR_CODE(0, 0x2653)
#define TSDB_CODE_PAR_INTERNAL_ERROR TAOS_DEF_ERROR_CODE(0, 0x2654)
#define TSDB_CODE_PAR_INTERNAL_ERROR TAOS_DEF_ERROR_CODE(0, 0x2654)
#define TSDB_CODE_PAR_INVALID_DELETE_WHERE TAOS_DEF_ERROR_CODE(0, 0x2655)
#define TSDB_CODE_PAR_INVALID_DELETE_WHERE TAOS_DEF_ERROR_CODE(0, 0x2655)
#define TSDB_CODE_PAR_INVALID_REDISTRIBUTE_VG TAOS_DEF_ERROR_CODE(0, 0x2656)
//planner
//planner
#define TSDB_CODE_PLAN_INTERNAL_ERROR TAOS_DEF_ERROR_CODE(0, 0x2700)
#define TSDB_CODE_PLAN_INTERNAL_ERROR TAOS_DEF_ERROR_CODE(0, 0x2700)
...
...
source/libs/nodes/src/nodesUtilFuncs.c
浏览文件 @
2bf16fbf
...
@@ -164,9 +164,14 @@ SNodeptr nodesMakeNode(ENodeType type) {
...
@@ -164,9 +164,14 @@ SNodeptr nodesMakeNode(ENodeType type) {
return
makeNode
(
type
,
sizeof
(
SCreateStreamStmt
));
return
makeNode
(
type
,
sizeof
(
SCreateStreamStmt
));
case
QUERY_NODE_DROP_STREAM_STMT
:
case
QUERY_NODE_DROP_STREAM_STMT
:
return
makeNode
(
type
,
sizeof
(
SDropStreamStmt
));
return
makeNode
(
type
,
sizeof
(
SDropStreamStmt
));
case
QUERY_NODE_BALANCE_VGROUP_STMT
:
return
makeNode
(
type
,
sizeof
(
SBalanceVgroupStmt
));
case
QUERY_NODE_MERGE_VGROUP_STMT
:
case
QUERY_NODE_MERGE_VGROUP_STMT
:
return
makeNode
(
type
,
sizeof
(
SMergeVgroupStmt
));
case
QUERY_NODE_REDISTRIBUTE_VGROUP_STMT
:
case
QUERY_NODE_REDISTRIBUTE_VGROUP_STMT
:
return
makeNode
(
type
,
sizeof
(
SRedistributeVgroupStmt
));
case
QUERY_NODE_SPLIT_VGROUP_STMT
:
case
QUERY_NODE_SPLIT_VGROUP_STMT
:
return
makeNode
(
type
,
sizeof
(
SSplitVgroupStmt
));
case
QUERY_NODE_SYNCDB_STMT
:
case
QUERY_NODE_SYNCDB_STMT
:
break
;
break
;
case
QUERY_NODE_GRANT_STMT
:
case
QUERY_NODE_GRANT_STMT
:
...
...
source/libs/parser/inc/sql.y
浏览文件 @
2bf16fbf
...
@@ -472,7 +472,7 @@ cmd ::= KILL TRANSACTION NK_INTEGER(A).
...
@@ -472,7 +472,7 @@ cmd ::= KILL TRANSACTION NK_INTEGER(A).
cmd ::= BALANCE VGROUP. { pCxt->pRootNode = createBalanceVgroupStmt(pCxt); }
cmd ::= BALANCE VGROUP. { pCxt->pRootNode = createBalanceVgroupStmt(pCxt); }
cmd ::= MERGE VGROUP NK_INTEGER(A) NK_INTEGER(B). { pCxt->pRootNode = createMergeVgroupStmt(pCxt, &A, &B); }
cmd ::= MERGE VGROUP NK_INTEGER(A) NK_INTEGER(B). { pCxt->pRootNode = createMergeVgroupStmt(pCxt, &A, &B); }
cmd ::= REDISTRIBUTE VGROUP NK_INTEGER(A) dnode_list(B). { pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &A, B); }
cmd ::= REDISTRIBUTE VGROUP NK_INTEGER(A) dnode_list(B). { pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &A, B); }
cmd ::= SPLIT VGROUP NK_INTEGER(A). { pCxt->pRootNode = createSplitVgroupStmt(pCxt, &A); }
//
cmd ::= SPLIT VGROUP NK_INTEGER(A). { pCxt->pRootNode = createSplitVgroupStmt(pCxt, &A); }
%type dnode_list { SNodeList* }
%type dnode_list { SNodeList* }
%destructor dnode_list { nodesDestroyList($$); }
%destructor dnode_list { nodesDestroyList($$); }
...
...
source/libs/parser/src/parTokenizer.c
浏览文件 @
2bf16fbf
...
@@ -117,6 +117,7 @@ static SKeyword keywordTable[] = {
...
@@ -117,6 +117,7 @@ static SKeyword keywordTable[] = {
{
"LOCAL"
,
TK_LOCAL
},
{
"LOCAL"
,
TK_LOCAL
},
{
"MATCH"
,
TK_MATCH
},
{
"MATCH"
,
TK_MATCH
},
{
"MAXROWS"
,
TK_MAXROWS
},
{
"MAXROWS"
,
TK_MAXROWS
},
{
"MERGE"
,
TK_MERGE
},
{
"MINROWS"
,
TK_MINROWS
},
{
"MINROWS"
,
TK_MINROWS
},
{
"MINUS"
,
TK_MINUS
},
{
"MINUS"
,
TK_MINUS
},
{
"MNODE"
,
TK_MNODE
},
{
"MNODE"
,
TK_MNODE
},
...
@@ -152,6 +153,7 @@ static SKeyword keywordTable[] = {
...
@@ -152,6 +153,7 @@ static SKeyword keywordTable[] = {
{
"QUERY"
,
TK_QUERY
},
{
"QUERY"
,
TK_QUERY
},
{
"RATIO"
,
TK_RATIO
},
{
"RATIO"
,
TK_RATIO
},
{
"READ"
,
TK_READ
},
{
"READ"
,
TK_READ
},
{
"REDISTRIBUTE"
,
TK_REDISTRIBUTE
},
{
"RENAME"
,
TK_RENAME
},
{
"RENAME"
,
TK_RENAME
},
{
"REPLICA"
,
TK_REPLICA
},
{
"REPLICA"
,
TK_REPLICA
},
{
"RESET"
,
TK_RESET
},
{
"RESET"
,
TK_RESET
},
...
@@ -172,6 +174,7 @@ static SKeyword keywordTable[] = {
...
@@ -172,6 +174,7 @@ static SKeyword keywordTable[] = {
{
"SNODE"
,
TK_SNODE
},
{
"SNODE"
,
TK_SNODE
},
{
"SNODES"
,
TK_SNODES
},
{
"SNODES"
,
TK_SNODES
},
{
"SOFFSET"
,
TK_SOFFSET
},
{
"SOFFSET"
,
TK_SOFFSET
},
// {"SPLIT", TK_SPLIT},
{
"STABLE"
,
TK_STABLE
},
{
"STABLE"
,
TK_STABLE
},
{
"STABLES"
,
TK_STABLES
},
{
"STABLES"
,
TK_STABLES
},
{
"STATE"
,
TK_STATE
},
{
"STATE"
,
TK_STATE
},
...
@@ -209,6 +212,7 @@ static SKeyword keywordTable[] = {
...
@@ -209,6 +212,7 @@ static SKeyword keywordTable[] = {
{
"VARCHAR"
,
TK_VARCHAR
},
{
"VARCHAR"
,
TK_VARCHAR
},
{
"VARIABLES"
,
TK_VARIABLES
},
{
"VARIABLES"
,
TK_VARIABLES
},
{
"VERBOSE"
,
TK_VERBOSE
},
{
"VERBOSE"
,
TK_VERBOSE
},
{
"VGROUP"
,
TK_VGROUP
},
{
"VGROUPS"
,
TK_VGROUPS
},
{
"VGROUPS"
,
TK_VGROUPS
},
{
"VNODES"
,
TK_VNODES
},
{
"VNODES"
,
TK_VNODES
},
{
"WAL"
,
TK_WAL
},
{
"WAL"
,
TK_WAL
},
...
...
source/libs/parser/src/parTranslater.c
浏览文件 @
2bf16fbf
...
@@ -3621,10 +3621,43 @@ static int32_t translateMergeVgroup(STranslateContext* pCxt, SMergeVgroupStmt* p
...
@@ -3621,10 +3621,43 @@ static int32_t translateMergeVgroup(STranslateContext* pCxt, SMergeVgroupStmt* p
return
buildCmdMsg
(
pCxt
,
TDMT_MND_MERGE_VGROUP
,
(
FSerializeFunc
)
tSerializeSMergeVgroupReq
,
&
req
);
return
buildCmdMsg
(
pCxt
,
TDMT_MND_MERGE_VGROUP
,
(
FSerializeFunc
)
tSerializeSMergeVgroupReq
,
&
req
);
}
}
static
int32_t
checkDnodeIds
(
STranslateContext
*
pCxt
,
SRedistributeVgroupStmt
*
pStmt
)
{
int32_t
numOfDnodes
=
LIST_LENGTH
(
pStmt
->
pDnodes
);
if
(
numOfDnodes
>
3
||
numOfDnodes
<
1
)
{
return
generateSyntaxErrMsg
(
&
pCxt
->
msgBuf
,
TSDB_CODE_PAR_INVALID_REDISTRIBUTE_VG
);
}
SNode
*
pNode
=
NULL
;
FOREACH
(
pNode
,
pStmt
->
pDnodes
)
{
SValueNode
*
pVal
=
(
SValueNode
*
)
pNode
;
if
(
DEAL_RES_ERROR
==
translateValue
(
pCxt
,
pVal
))
{
return
pCxt
->
errCode
;
}
}
pStmt
->
dnodeId1
=
getBigintFromValueNode
((
SValueNode
*
)
nodesListGetNode
(
pStmt
->
pDnodes
,
0
));
pStmt
->
dnodeId2
=
-
1
;
pStmt
->
dnodeId3
=
-
1
;
if
(
numOfDnodes
>
1
)
{
pStmt
->
dnodeId2
=
getBigintFromValueNode
((
SValueNode
*
)
nodesListGetNode
(
pStmt
->
pDnodes
,
1
));
}
if
(
numOfDnodes
>
2
)
{
pStmt
->
dnodeId3
=
getBigintFromValueNode
((
SValueNode
*
)
nodesListGetNode
(
pStmt
->
pDnodes
,
2
));
}
return
TSDB_CODE_SUCCESS
;
}
static
int32_t
translateRedistributeVgroup
(
STranslateContext
*
pCxt
,
SRedistributeVgroupStmt
*
pStmt
)
{
static
int32_t
translateRedistributeVgroup
(
STranslateContext
*
pCxt
,
SRedistributeVgroupStmt
*
pStmt
)
{
SRedistributeVgroupReq
req
=
{.
vgId
=
pStmt
->
vgId
};
SRedistributeVgroupReq
req
=
{.
vgId
=
pStmt
->
vgId
};
// todo
int32_t
code
=
checkDnodeIds
(
pCxt
,
pStmt
);
return
buildCmdMsg
(
pCxt
,
TDMT_MND_MERGE_VGROUP
,
(
FSerializeFunc
)
tSerializeSRedistributeVgroupReq
,
&
req
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
req
.
dnodeId1
=
pStmt
->
dnodeId1
;
req
.
dnodeId2
=
pStmt
->
dnodeId2
;
req
.
dnodeId3
=
pStmt
->
dnodeId3
;
code
=
buildCmdMsg
(
pCxt
,
TDMT_MND_REDISTRIBUTE_VGROUP
,
(
FSerializeFunc
)
tSerializeSRedistributeVgroupReq
,
&
req
);
}
return
code
;
}
}
static
int32_t
translateQuery
(
STranslateContext
*
pCxt
,
SNode
*
pNode
)
{
static
int32_t
translateQuery
(
STranslateContext
*
pCxt
,
SNode
*
pNode
)
{
...
...
source/libs/parser/src/parUtil.c
浏览文件 @
2bf16fbf
...
@@ -180,6 +180,8 @@ static char* getSyntaxErrFormat(int32_t errCode) {
...
@@ -180,6 +180,8 @@ static char* getSyntaxErrFormat(int32_t errCode) {
return
"Value too long for column/tag: %s"
;
return
"Value too long for column/tag: %s"
;
case
TSDB_CODE_PAR_INVALID_DELETE_WHERE
:
case
TSDB_CODE_PAR_INVALID_DELETE_WHERE
:
return
"The DELETE statement must have a definite time window range"
;
return
"The DELETE statement must have a definite time window range"
;
case
TSDB_CODE_PAR_INVALID_REDISTRIBUTE_VG
:
return
"The REDISTRIBUTE VGROUP statement only support 1 to 3 dnodes"
;
case
TSDB_CODE_OUT_OF_MEMORY
:
case
TSDB_CODE_OUT_OF_MEMORY
:
return
"Out of memory"
;
return
"Out of memory"
;
default:
default:
...
...
source/libs/parser/src/sql.c
浏览文件 @
2bf16fbf
此差异已折叠。
点击以展开。
source/libs/parser/test/parExplainToSyncdbTest.cpp
浏览文件 @
2bf16fbf
...
@@ -19,7 +19,7 @@ using namespace std;
...
@@ -19,7 +19,7 @@ using namespace std;
namespace
ParserTest
{
namespace
ParserTest
{
class
ParserExplainToSyncdbTest
:
public
Parser
TestBase
{};
class
ParserExplainToSyncdbTest
:
public
Parser
DdlTest
{};
TEST_F
(
ParserExplainToSyncdbTest
,
explain
)
{
TEST_F
(
ParserExplainToSyncdbTest
,
explain
)
{
useDb
(
"root"
,
"test"
);
useDb
(
"root"
,
"test"
);
...
@@ -43,8 +43,62 @@ TEST_F(ParserExplainToSyncdbTest, grant) {
...
@@ -43,8 +43,62 @@ TEST_F(ParserExplainToSyncdbTest, grant) {
// todo kill connection
// todo kill connection
// todo kill query
// todo kill query
// todo kill stream
// todo kill stream
// todo merge vgroup
// todo redistribute vgroup
TEST_F
(
ParserExplainToSyncdbTest
,
mergeVgroup
)
{
useDb
(
"root"
,
"test"
);
SMergeVgroupReq
expect
=
{
0
};
auto
setMergeVgroupReqFunc
=
[
&
](
int32_t
vgId1
,
int32_t
vgId2
)
{
expect
.
vgId1
=
vgId1
;
expect
.
vgId2
=
vgId2
;
};
setCheckDdlFunc
([
&
](
const
SQuery
*
pQuery
,
ParserStage
stage
)
{
ASSERT_EQ
(
nodeType
(
pQuery
->
pRoot
),
QUERY_NODE_MERGE_VGROUP_STMT
);
ASSERT_EQ
(
pQuery
->
pCmdMsg
->
msgType
,
TDMT_MND_MERGE_VGROUP
);
SMergeVgroupReq
req
=
{
0
};
ASSERT_EQ
(
tDeserializeSMergeVgroupReq
(
pQuery
->
pCmdMsg
->
pMsg
,
pQuery
->
pCmdMsg
->
msgLen
,
&
req
),
TSDB_CODE_SUCCESS
);
ASSERT_EQ
(
req
.
vgId1
,
expect
.
vgId1
);
ASSERT_EQ
(
req
.
vgId2
,
expect
.
vgId2
);
});
setMergeVgroupReqFunc
(
1
,
2
);
run
(
"MERGE VGROUP 1 2"
);
}
TEST_F
(
ParserExplainToSyncdbTest
,
redistributeVgroup
)
{
useDb
(
"root"
,
"test"
);
SRedistributeVgroupReq
expect
=
{
0
};
auto
setRedistributeVgroupReqFunc
=
[
&
](
int32_t
vgId
,
int32_t
dnodeId1
,
int32_t
dnodeId2
=
-
1
,
int32_t
dnodeId3
=
-
1
)
{
expect
.
vgId
=
vgId
;
expect
.
dnodeId1
=
dnodeId1
;
expect
.
dnodeId2
=
dnodeId2
;
expect
.
dnodeId3
=
dnodeId3
;
};
setCheckDdlFunc
([
&
](
const
SQuery
*
pQuery
,
ParserStage
stage
)
{
ASSERT_EQ
(
nodeType
(
pQuery
->
pRoot
),
QUERY_NODE_REDISTRIBUTE_VGROUP_STMT
);
ASSERT_EQ
(
pQuery
->
pCmdMsg
->
msgType
,
TDMT_MND_REDISTRIBUTE_VGROUP
);
SRedistributeVgroupReq
req
=
{
0
};
ASSERT_EQ
(
tDeserializeSRedistributeVgroupReq
(
pQuery
->
pCmdMsg
->
pMsg
,
pQuery
->
pCmdMsg
->
msgLen
,
&
req
),
TSDB_CODE_SUCCESS
);
ASSERT_EQ
(
req
.
vgId
,
expect
.
vgId
);
ASSERT_EQ
(
req
.
dnodeId1
,
expect
.
dnodeId1
);
ASSERT_EQ
(
req
.
dnodeId2
,
expect
.
dnodeId2
);
ASSERT_EQ
(
req
.
dnodeId3
,
expect
.
dnodeId3
);
});
setRedistributeVgroupReqFunc
(
3
,
1
);
run
(
"REDISTRIBUTE VGROUP 3 DNODE 1"
);
setRedistributeVgroupReqFunc
(
5
,
10
,
20
,
30
);
run
(
"REDISTRIBUTE VGROUP 5 DNODE 10 DNODE 20 DNODE 30"
);
}
// todo reset query cache
// todo reset query cache
TEST_F
(
ParserExplainToSyncdbTest
,
revoke
)
{
TEST_F
(
ParserExplainToSyncdbTest
,
revoke
)
{
...
...
source/libs/parser/test/parInitialATest.cpp
浏览文件 @
2bf16fbf
...
@@ -305,6 +305,19 @@ TEST_F(ParserInitialATest, alterUser) {
...
@@ -305,6 +305,19 @@ TEST_F(ParserInitialATest, alterUser) {
run
(
"ALTER user wxy privilege 'write'"
);
run
(
"ALTER user wxy privilege 'write'"
);
}
}
TEST_F
(
ParserInitialATest
,
balanceVgroup
)
{
useDb
(
"root"
,
"test"
);
setCheckDdlFunc
([
&
](
const
SQuery
*
pQuery
,
ParserStage
stage
)
{
ASSERT_EQ
(
nodeType
(
pQuery
->
pRoot
),
QUERY_NODE_BALANCE_VGROUP_STMT
);
ASSERT_EQ
(
pQuery
->
pCmdMsg
->
msgType
,
TDMT_MND_BALANCE_VGROUP
);
SBalanceVgroupReq
req
=
{
0
};
ASSERT_EQ
(
tDeserializeSBalanceVgroupReq
(
pQuery
->
pCmdMsg
->
pMsg
,
pQuery
->
pCmdMsg
->
msgLen
,
&
req
),
TSDB_CODE_SUCCESS
);
});
run
(
"BALANCE VGROUP"
);
}
TEST_F
(
ParserInitialATest
,
bug001
)
{
TEST_F
(
ParserInitialATest
,
bug001
)
{
useDb
(
"root"
,
"test"
);
useDb
(
"root"
,
"test"
);
...
...
source/util/src/terror.c
浏览文件 @
2bf16fbf
...
@@ -451,9 +451,89 @@ TAOS_DEFINE_ERROR(TSDB_CODE_SCH_TIMEOUT_ERROR, "Task timeout")
...
@@ -451,9 +451,89 @@ TAOS_DEFINE_ERROR(TSDB_CODE_SCH_TIMEOUT_ERROR, "Task timeout")
TAOS_DEFINE_ERROR
(
TSDB_CODE_QW_MSG_ERROR
,
"Invalid msg order"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_QW_MSG_ERROR
,
"Invalid msg order"
)
// parser
// parser
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_TABLE_NOT_EXIST
,
"Table does not exist"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_PERMISSION_DENIED
,
"Permission denied"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_PERMISSION_DENIED
,
"Permission denied"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_INTERNAL_ERROR
,
"Parser internal error"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_INTERNAL_ERROR
,
"Parser internal error"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_SYNTAX_ERROR
,
"syntax error near"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_INCOMPLETE_SQL
,
"Incomplete SQL statement"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_INVALID_COLUMN
,
"Invalid column name"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_TABLE_NOT_EXIST
,
"Table does not exist"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_AMBIGUOUS_COLUMN
,
"Column ambiguously defined"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_WRONG_VALUE_TYPE
,
"Invalid value type"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_ILLEGAL_USE_AGG_FUNCTION
,
"There mustn't be aggregation"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_WRONG_NUMBER_OF_SELECT
,
"ORDER BY item must be the number of a SELECT-list expression"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_GROUPBY_LACK_EXPRESSION
,
"Not a GROUP BY expression"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_NOT_SELECTED_EXPRESSION
,
"Not SELECTed expression"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_NOT_SINGLE_GROUP
,
"Not a single-group group function"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_TAGS_NOT_MATCHED
,
"Tags number not matched"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_INVALID_TAG_NAME
,
"Invalid tag name"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_NAME_OR_PASSWD_TOO_LONG
,
"Name or password too long"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_PASSWD_EMPTY
,
"Password can not be empty"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_INVALID_PORT
,
"Port should be an integer that is less than 65535 and greater than 0"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_INVALID_ENDPOINT
,
"Endpoint should be in the format of 'fqdn:port'"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_EXPRIE_STATEMENT
,
"This statement is no longer supported"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_INTER_VALUE_TOO_SMALL
,
"Interval too small"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_DB_NOT_SPECIFIED
,
"Database not specified"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_INVALID_IDENTIFIER_NAME
,
"Invalid identifier name"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_CORRESPONDING_STABLE_ERR
,
"Corresponding super table not in this db"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_INVALID_RANGE_OPTION
,
"Invalid option"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_INVALID_STR_OPTION
,
"Invalid option"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_INVALID_ENUM_OPTION
,
"Invalid option"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_INVALID_KEEP_NUM
,
"Invalid number of keep options"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_INVALID_KEEP_ORDER
,
"Invalid keep value, should be keep0 <= keep1 <= keep2"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_INVALID_KEEP_VALUE
,
"Invalid option keep"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_INVALID_COMMENT_OPTION
,
"Invalid option comment"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_INVALID_F_RANGE_OPTION
,
"Invalid option"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_INVALID_ROLLUP_OPTION
,
"Invalid option rollup: only one function is allowed"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_INVALID_RETENTIONS_OPTION
,
"Invalid option retentions"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_GROUPBY_WINDOW_COEXIST
,
"GROUP BY and WINDOW-clause can't be used together"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_INVALID_OPTION_UNIT
,
"Invalid option unit: only m, h, d allowed"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_INVALID_KEEP_UNIT
,
"Invalid option keep unit: only m, h, d allowed"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_AGG_FUNC_NESTING
,
"Aggregate functions do not support nesting"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_INVALID_STATE_WIN_TYPE
,
"Only support STATE_WINDOW on integer/bool/varchar column"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_INVALID_STATE_WIN_COL
,
"Not support STATE_WINDOW on tag column"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_INVALID_STATE_WIN_TABLE
,
"STATE_WINDOW not support for super table query"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_INTER_SESSION_GAP
,
"SESSION gap should be fixed time window, and greater than 0"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_INTER_SESSION_COL
,
"Only support SESSION on primary timestamp column"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_INTER_OFFSET_NEGATIVE
,
"Interval offset cannot be negative"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_INTER_OFFSET_UNIT
,
"Cannot use 'year' as offset when interval is 'month'"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_INTER_OFFSET_TOO_BIG
,
"Interval offset should be shorter than interval"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_INTER_SLIDING_UNIT
,
"Does not support sliding when interval is natural month/year"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_INTER_SLIDING_TOO_BIG
,
"sliding value no larger than the interval value"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_INTER_SLIDING_TOO_SMALL
,
"sliding value can not less than 1% of interval value"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_ONLY_ONE_JSON_TAG
,
"Only one tag if there is a json tag"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_INCORRECT_NUM_OF_COL
,
"Query block has incorrect number of result columns"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_INCORRECT_TIMESTAMP_VAL
,
"Incorrect TIMESTAMP value"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_INVALID_DAYS_VALUE
,
"Invalid days value, should be keep2 >= keep1 >= keep0 >= days"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_OFFSET_LESS_ZERO
,
"soffset/offset can not be less than 0"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_SLIMIT_LEAK_PARTITION_BY
,
"slimit/soffset only available for PARTITION BY query"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_INVALID_TOPIC_QUERY
,
"Invalid topic query"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_INVALID_DROP_STABLE
,
"Cannot drop super table in batch"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_INVALID_FILL_TIME_RANGE
,
"Start(end) time of query range required or time range too large"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_DUPLICATED_COLUMN
,
"Duplicated column names"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_INVALID_TAGS_LENGTH
,
"Tags length exceeds max length"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_INVALID_ROW_LENGTH
,
"Row length exceeds max length"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_INVALID_COLUMNS_NUM
,
"Illegal number of columns"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_TOO_MANY_COLUMNS
,
"Too many columns"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_INVALID_FIRST_COLUMN
,
"First column must be timestamp"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_INVALID_VAR_COLUMN_LEN
,
"Invalid binary/nchar column length"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_INVALID_TAGS_NUM
,
"Invalid number of tag columns"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_INVALID_INTERNAL_PK
,
"Invalid _c0 or _rowts expression"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_INVALID_TIMELINE_FUNC
,
"Invalid timeline function"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_INVALID_PASSWD
,
"Invalid password"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_INVALID_ALTER_TABLE
,
"Invalid alter table statement"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_CANNOT_DROP_PRIMARY_KEY
,
"Primary timestamp column cannot be dropped"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_INVALID_MODIFY_COL
,
"Only binary/nchar column length could be modified"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_INVALID_TBNAME
,
"Invalid tbname pseudo column"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_INVALID_FUNCTION_NAME
,
"Invalid function name"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_COMMENT_TOO_LONG
,
"Comment too long"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_NOT_ALLOWED_FUNC
,
"Some functions are allowed only in the SELECT list of a query. "
"And, cannot be mixed with other non scalar functions or columns."
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_NOT_ALLOWED_WIN_QUERY
,
"Window query not supported, since the result of subquery not include valid timestamp column"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_INVALID_DROP_COL
,
"No columns can be dropped"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_INVALID_COL_JSON
,
"Only tag can be json type"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_VALUE_TOO_LONG
,
"Value too long for column/tag"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_INVALID_DELETE_WHERE
,
"The DELETE statement must have a definite time window range"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_INVALID_REDISTRIBUTE_VG
,
"The REDISTRIBUTE VGROUP statement only support 1 to 3 dnodes"
)
//planner
//planner
TAOS_DEFINE_ERROR
(
TSDB_CODE_PLAN_INTERNAL_ERROR
,
"Planner internal error"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PLAN_INTERNAL_ERROR
,
"Planner internal error"
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录