Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
fbc9b240
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
fbc9b240
编写于
3月 22, 2023
作者:
X
Xiaoyu Wang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: add sql command 'balance vgroup leader'
上级
ea35f0ae
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
3018 addition
and
2998 deletion
+3018
-2998
include/common/ttokendef.h
include/common/ttokendef.h
+122
-122
include/libs/nodes/nodes.h
include/libs/nodes/nodes.h
+2
-2
source/libs/parser/inc/sql.y
source/libs/parser/inc/sql.y
+1
-0
source/libs/parser/src/parTokenizer.c
source/libs/parser/src/parTokenizer.c
+1
-1
source/libs/parser/src/sql.c
source/libs/parser/src/sql.c
+2875
-2873
source/libs/parser/test/parAlterToBalanceTest.cpp
source/libs/parser/test/parAlterToBalanceTest.cpp
+17
-0
未找到文件。
include/common/ttokendef.h
浏览文件 @
fbc9b240
...
...
@@ -223,128 +223,128 @@
#define TK_TRANSACTION 205
#define TK_BALANCE 206
#define TK_VGROUP 207
#define TK_
MERGE
208
#define TK_
REDISTRIBUTE
209
#define TK_
SPLIT
210
#define TK_
DELETE
211
#define TK_
INSERT
212
#define TK_
NULL
213
#define TK_N
K_QUESTION
214
#define TK_NK_
ARROW
215
#define TK_
ROWTS
216
#define TK_
QSTART
217
#define TK_Q
END
218
#define TK_Q
DURATION
219
#define TK_
WSTART
220
#define TK_W
END
221
#define TK_W
DURATION
222
#define TK_
IROWTS
223
#define TK_I
SFILLED
224
#define TK_
CAST
225
#define TK_
NOW
226
#define TK_
TODAY
227
#define TK_T
IMEZONE
228
#define TK_
CLIENT_VERSION
229
#define TK_
SERVER
_VERSION 230
#define TK_SERVER_
STATUS
231
#define TK_
CURRENT_USER
232
#define TK_C
ASE
233
#define TK_
WHEN
234
#define TK_
T
HEN 235
#define TK_
ELSE
236
#define TK_
BETWEEN
237
#define TK_
IS
238
#define TK_
NK_LT
239
#define TK_NK_
G
T 240
#define TK_NK_
LE
241
#define TK_NK_
G
E 242
#define TK_NK_
N
E 243
#define TK_
MATCH
244
#define TK_
NMATCH
245
#define TK_
CONTAINS
246
#define TK_
IN
247
#define TK_
JOIN
248
#define TK_
INNER
249
#define TK_
SELECT
250
#define TK_
DISTINCT
251
#define TK_
WHERE
252
#define TK_
PARTITION
253
#define TK_
BY
254
#define TK_
SESSION
255
#define TK_S
TATE_WINDOW
256
#define TK_
EVENT
_WINDOW 257
#define TK_
SLIDING
258
#define TK_
FILL
259
#define TK_
VALUE
260
#define TK_VALUE
_F
261
#define TK_
NONE
262
#define TK_
PREV
263
#define TK_
NULL_F
264
#define TK_
LINEAR
265
#define TK_
NEXT
266
#define TK_
HAVING
267
#define TK_
RANGE
268
#define TK_
EVERY
269
#define TK_
ORDER
270
#define TK_
SLIMIT
271
#define TK_S
OFFSET
272
#define TK_
LIMIT
273
#define TK_
OFFSET
274
#define TK_
ASC
275
#define TK_
NULLS
276
#define TK_
ABORT
277
#define TK_A
FTER
278
#define TK_A
TTACH
279
#define TK_
BEFORE
280
#define TK_BE
GIN
281
#define TK_B
ITAND
282
#define TK_BIT
NOT
283
#define TK_BIT
OR
284
#define TK_B
LOCKS
285
#define TK_
CHANGE
286
#define TK_C
OMMA
287
#define TK_CO
NCAT
288
#define TK_CON
FLICT
289
#define TK_CO
PY
290
#define TK_
DEFERRED
291
#define TK_DE
LIMITERS
292
#define TK_DE
TACH
293
#define TK_D
IVIDE
294
#define TK_D
OT
295
#define TK_
EACH
296
#define TK_
FAIL
297
#define TK_F
ILE
298
#define TK_F
OR
299
#define TK_
GLOB
300
#define TK_
ID
301
#define TK_I
MMEDIATE
302
#define TK_IM
PORT
303
#define TK_I
NITIALLY
304
#define TK_IN
STEAD
305
#define TK_I
SNULL
306
#define TK_
KEY
307
#define TK_
MODULES
308
#define TK_
NK_BITNOT
309
#define TK_NK_
SEMI
310
#define TK_N
OTNULL
311
#define TK_
OF
312
#define TK_
PLUS
313
#define TK_P
RIVILEGE
314
#define TK_
RAISE
315
#define TK_R
EPLACE
316
#define TK_RE
STRICT
317
#define TK_R
OW
318
#define TK_
SEMI
319
#define TK_S
TAR
320
#define TK_STA
TEMENT
321
#define TK_ST
RICT
322
#define TK_STRI
NG
323
#define TK_
TIMES
324
#define TK_
VALUES
325
#define TK_VA
RIABLE
326
#define TK_V
IEW
327
#define TK_
WAL
328
#define TK_
VGROUP_LEADER
329
#define TK_
LEADER
208
#define TK_
MERGE
209
#define TK_
REDISTRIBUTE
210
#define TK_
SPLIT
211
#define TK_
DELETE
212
#define TK_
INSERT
213
#define TK_N
ULL
214
#define TK_NK_
QUESTION
215
#define TK_
NK_ARROW
216
#define TK_
ROWTS
217
#define TK_Q
START
218
#define TK_Q
END
219
#define TK_
QDURATION
220
#define TK_W
START
221
#define TK_W
END
222
#define TK_
WDURATION
223
#define TK_I
ROWTS
224
#define TK_
ISFILLED
225
#define TK_
CAST
226
#define TK_
NOW
227
#define TK_T
ODAY
228
#define TK_
TIMEZONE
229
#define TK_
CLIENT
_VERSION 230
#define TK_SERVER_
VERSION
231
#define TK_
SERVER_STATUS
232
#define TK_C
URRENT_USER
233
#define TK_
CASE
234
#define TK_
W
HEN 235
#define TK_
THEN
236
#define TK_
ELSE
237
#define TK_
BETWEEN
238
#define TK_
IS
239
#define TK_NK_
L
T 240
#define TK_NK_
GT
241
#define TK_NK_
L
E 242
#define TK_NK_
G
E 243
#define TK_
NK_NE
244
#define TK_
MATCH
245
#define TK_
NMATCH
246
#define TK_
CONTAINS
247
#define TK_
IN
248
#define TK_
JOIN
249
#define TK_
INNER
250
#define TK_
SELECT
251
#define TK_
DISTINCT
252
#define TK_
WHERE
253
#define TK_
PARTITION
254
#define TK_
BY
255
#define TK_S
ESSION
256
#define TK_
STATE
_WINDOW 257
#define TK_
EVENT_WINDOW
258
#define TK_
SLIDING
259
#define TK_
FILL
260
#define TK_VALUE
261
#define TK_
VALUE_F
262
#define TK_
NONE
263
#define TK_
PREV
264
#define TK_
NULL_F
265
#define TK_
LINEAR
266
#define TK_
NEXT
267
#define TK_
HAVING
268
#define TK_
RANGE
269
#define TK_
EVERY
270
#define TK_
ORDER
271
#define TK_S
LIMIT
272
#define TK_
SOFFSET
273
#define TK_
LIMIT
274
#define TK_
OFFSET
275
#define TK_
ASC
276
#define TK_
NULLS
277
#define TK_A
BORT
278
#define TK_A
FTER
279
#define TK_
ATTACH
280
#define TK_BE
FORE
281
#define TK_B
EGIN
282
#define TK_BIT
AND
283
#define TK_BIT
NOT
284
#define TK_B
ITOR
285
#define TK_
BLOCKS
286
#define TK_C
HANGE
287
#define TK_CO
MMA
288
#define TK_CON
CAT
289
#define TK_CO
NFLICT
290
#define TK_
COPY
291
#define TK_DE
FERRED
292
#define TK_DE
LIMITERS
293
#define TK_D
ETACH
294
#define TK_D
IVIDE
295
#define TK_
DOT
296
#define TK_
EACH
297
#define TK_F
AIL
298
#define TK_F
ILE
299
#define TK_
FOR
300
#define TK_
GLOB
301
#define TK_I
D
302
#define TK_IM
MEDIATE
303
#define TK_I
MPORT
304
#define TK_IN
ITIALLY
305
#define TK_I
NSTEAD
306
#define TK_
ISNULL
307
#define TK_
KEY
308
#define TK_
MODULES
309
#define TK_NK_
BITNOT
310
#define TK_N
K_SEMI
311
#define TK_
NOTNULL
312
#define TK_
OF
313
#define TK_P
LUS
314
#define TK_
PRIVILEGE
315
#define TK_R
AISE
316
#define TK_RE
PLACE
317
#define TK_R
ESTRICT
318
#define TK_
ROW
319
#define TK_S
EMI
320
#define TK_STA
R
321
#define TK_ST
ATEMENT
322
#define TK_STRI
CT
323
#define TK_
STRING
324
#define TK_
TIMES
325
#define TK_VA
LUES
326
#define TK_V
ARIABLE
327
#define TK_
VIEW
328
#define TK_
WAL
329
#define TK_NK_SPACE 600
#define TK_NK_COMMENT 601
...
...
include/libs/nodes/nodes.h
浏览文件 @
fbc9b240
...
...
@@ -161,7 +161,6 @@ typedef enum ENodeType {
QUERY_NODE_CREATE_STREAM_STMT
,
QUERY_NODE_DROP_STREAM_STMT
,
QUERY_NODE_BALANCE_VGROUP_STMT
,
QUERY_NODE_BALANCE_VGROUP_LEADER_STMT
,
QUERY_NODE_MERGE_VGROUP_STMT
,
QUERY_NODE_REDISTRIBUTE_VGROUP_STMT
,
QUERY_NODE_SPLIT_VGROUP_STMT
,
...
...
@@ -210,7 +209,8 @@ typedef enum ENodeType {
QUERY_NODE_INSERT_STMT
,
QUERY_NODE_QUERY
,
QUERY_NODE_SHOW_DB_ALIVE_STMT
,
QUERY_NODE_SHOW_CLUSTER_ALIVE_STMT
,
QUERY_NODE_SHOW_CLUSTER_ALIVE_STMT
,
QUERY_NODE_BALANCE_VGROUP_LEADER_STMT
,
// logic plan node
QUERY_NODE_LOGIC_PLAN_SCAN
=
1000
,
...
...
source/libs/parser/inc/sql.y
浏览文件 @
fbc9b240
...
...
@@ -597,6 +597,7 @@ cmd ::= KILL TRANSACTION NK_INTEGER(A).
/************************************************ merge/redistribute/ vgroup ******************************************/
cmd ::= BALANCE VGROUP. { pCxt->pRootNode = createBalanceVgroupStmt(pCxt); }
cmd ::= BALANCE VGROUP LEADER. { pCxt->pRootNode = createBalanceVgroupLeaderStmt(pCxt); }
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 ::= SPLIT VGROUP NK_INTEGER(A). { pCxt->pRootNode = createSplitVgroupStmt(pCxt, &A); }
...
...
source/libs/parser/src/parTokenizer.c
浏览文件 @
fbc9b240
...
...
@@ -127,6 +127,7 @@ static SKeyword keywordTable[] = {
{
"LANGUAGE"
,
TK_LANGUAGE
},
{
"LAST"
,
TK_LAST
},
{
"LAST_ROW"
,
TK_LAST_ROW
},
{
"LEADER"
,
TK_LEADER
},
{
"LICENCES"
,
TK_LICENCES
},
{
"LIKE"
,
TK_LIKE
},
{
"LIMIT"
,
TK_LIMIT
},
...
...
@@ -250,7 +251,6 @@ static SKeyword keywordTable[] = {
{
"VERBOSE"
,
TK_VERBOSE
},
{
"VGROUP"
,
TK_VGROUP
},
{
"VGROUPS"
,
TK_VGROUPS
},
{
"VGROUP_LEADER"
,
TK_VGROUP_LEADER
},
{
"VNODES"
,
TK_VNODES
},
{
"WAL_FSYNC_PERIOD"
,
TK_WAL_FSYNC_PERIOD
},
{
"WAL_LEVEL"
,
TK_WAL_LEVEL
},
...
...
source/libs/parser/src/sql.c
浏览文件 @
fbc9b240
因为 它太大了无法显示 source diff 。你可以改为
查看blob
。
source/libs/parser/test/parAlterToBalanceTest.cpp
浏览文件 @
fbc9b240
...
...
@@ -831,4 +831,21 @@ TEST_F(ParserInitialATest, balanceVgroup) {
run
(
"BALANCE VGROUP"
);
}
/*
* BALANCE VGROUP LEADER
*/
TEST_F
(
ParserInitialATest
,
balanceVgroup
)
{
useDb
(
"root"
,
"test"
);
setCheckDdlFunc
([
&
](
const
SQuery
*
pQuery
,
ParserStage
stage
)
{
ASSERT_EQ
(
nodeType
(
pQuery
->
pRoot
),
QUERY_NODE_BALANCE_VGROUP_LEADER_STMT
);
ASSERT_EQ
(
pQuery
->
pCmdMsg
->
msgType
,
TDMT_MND_BALANCE_VGROUP_LEADER
);
SBalanceVgroupReq
req
=
{
0
};
ASSERT_EQ
(
tSerializeSBalanceVgroupLeaderReq
(
pQuery
->
pCmdMsg
->
pMsg
,
pQuery
->
pCmdMsg
->
msgLen
,
&
req
),
TSDB_CODE_SUCCESS
);
});
run
(
"BALANCE VGROUP LEADER"
);
}
}
// namespace ParserTest
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录