提交 fbc9b240 编写于 作者: X Xiaoyu Wang

feat: add sql command 'balance vgroup leader'

上级 ea35f0ae
......@@ -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_NK_QUESTION 214
#define TK_NK_ARROW 215
#define TK_ROWTS 216
#define TK_QSTART 217
#define TK_QEND 218
#define TK_QDURATION 219
#define TK_WSTART 220
#define TK_WEND 221
#define TK_WDURATION 222
#define TK_IROWTS 223
#define TK_ISFILLED 224
#define TK_CAST 225
#define TK_NOW 226
#define TK_TODAY 227
#define TK_TIMEZONE 228
#define TK_CLIENT_VERSION 229
#define TK_SERVER_VERSION 230
#define TK_SERVER_STATUS 231
#define TK_CURRENT_USER 232
#define TK_CASE 233
#define TK_WHEN 234
#define TK_THEN 235
#define TK_ELSE 236
#define TK_BETWEEN 237
#define TK_IS 238
#define TK_NK_LT 239
#define TK_NK_GT 240
#define TK_NK_LE 241
#define TK_NK_GE 242
#define TK_NK_NE 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_STATE_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_SOFFSET 272
#define TK_LIMIT 273
#define TK_OFFSET 274
#define TK_ASC 275
#define TK_NULLS 276
#define TK_ABORT 277
#define TK_AFTER 278
#define TK_ATTACH 279
#define TK_BEFORE 280
#define TK_BEGIN 281
#define TK_BITAND 282
#define TK_BITNOT 283
#define TK_BITOR 284
#define TK_BLOCKS 285
#define TK_CHANGE 286
#define TK_COMMA 287
#define TK_CONCAT 288
#define TK_CONFLICT 289
#define TK_COPY 290
#define TK_DEFERRED 291
#define TK_DELIMITERS 292
#define TK_DETACH 293
#define TK_DIVIDE 294
#define TK_DOT 295
#define TK_EACH 296
#define TK_FAIL 297
#define TK_FILE 298
#define TK_FOR 299
#define TK_GLOB 300
#define TK_ID 301
#define TK_IMMEDIATE 302
#define TK_IMPORT 303
#define TK_INITIALLY 304
#define TK_INSTEAD 305
#define TK_ISNULL 306
#define TK_KEY 307
#define TK_MODULES 308
#define TK_NK_BITNOT 309
#define TK_NK_SEMI 310
#define TK_NOTNULL 311
#define TK_OF 312
#define TK_PLUS 313
#define TK_PRIVILEGE 314
#define TK_RAISE 315
#define TK_REPLACE 316
#define TK_RESTRICT 317
#define TK_ROW 318
#define TK_SEMI 319
#define TK_STAR 320
#define TK_STATEMENT 321
#define TK_STRICT 322
#define TK_STRING 323
#define TK_TIMES 324
#define TK_VALUES 325
#define TK_VARIABLE 326
#define TK_VIEW 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_NULL 214
#define TK_NK_QUESTION 215
#define TK_NK_ARROW 216
#define TK_ROWTS 217
#define TK_QSTART 218
#define TK_QEND 219
#define TK_QDURATION 220
#define TK_WSTART 221
#define TK_WEND 222
#define TK_WDURATION 223
#define TK_IROWTS 224
#define TK_ISFILLED 225
#define TK_CAST 226
#define TK_NOW 227
#define TK_TODAY 228
#define TK_TIMEZONE 229
#define TK_CLIENT_VERSION 230
#define TK_SERVER_VERSION 231
#define TK_SERVER_STATUS 232
#define TK_CURRENT_USER 233
#define TK_CASE 234
#define TK_WHEN 235
#define TK_THEN 236
#define TK_ELSE 237
#define TK_BETWEEN 238
#define TK_IS 239
#define TK_NK_LT 240
#define TK_NK_GT 241
#define TK_NK_LE 242
#define TK_NK_GE 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_SESSION 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_SLIMIT 272
#define TK_SOFFSET 273
#define TK_LIMIT 274
#define TK_OFFSET 275
#define TK_ASC 276
#define TK_NULLS 277
#define TK_ABORT 278
#define TK_AFTER 279
#define TK_ATTACH 280
#define TK_BEFORE 281
#define TK_BEGIN 282
#define TK_BITAND 283
#define TK_BITNOT 284
#define TK_BITOR 285
#define TK_BLOCKS 286
#define TK_CHANGE 287
#define TK_COMMA 288
#define TK_CONCAT 289
#define TK_CONFLICT 290
#define TK_COPY 291
#define TK_DEFERRED 292
#define TK_DELIMITERS 293
#define TK_DETACH 294
#define TK_DIVIDE 295
#define TK_DOT 296
#define TK_EACH 297
#define TK_FAIL 298
#define TK_FILE 299
#define TK_FOR 300
#define TK_GLOB 301
#define TK_ID 302
#define TK_IMMEDIATE 303
#define TK_IMPORT 304
#define TK_INITIALLY 305
#define TK_INSTEAD 306
#define TK_ISNULL 307
#define TK_KEY 308
#define TK_MODULES 309
#define TK_NK_BITNOT 310
#define TK_NK_SEMI 311
#define TK_NOTNULL 312
#define TK_OF 313
#define TK_PLUS 314
#define TK_PRIVILEGE 315
#define TK_RAISE 316
#define TK_REPLACE 317
#define TK_RESTRICT 318
#define TK_ROW 319
#define TK_SEMI 320
#define TK_STAR 321
#define TK_STATEMENT 322
#define TK_STRICT 323
#define TK_STRING 324
#define TK_TIMES 325
#define TK_VALUES 326
#define TK_VARIABLE 327
#define TK_VIEW 328
#define TK_WAL 329
#define TK_NK_SPACE 600
#define TK_NK_COMMENT 601
......
......@@ -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,
......@@ -211,6 +210,7 @@ typedef enum ENodeType {
QUERY_NODE_QUERY,
QUERY_NODE_SHOW_DB_ALIVE_STMT,
QUERY_NODE_SHOW_CLUSTER_ALIVE_STMT,
QUERY_NODE_BALANCE_VGROUP_LEADER_STMT,
// logic plan node
QUERY_NODE_LOGIC_PLAN_SCAN = 1000,
......
......@@ -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); }
......
......@@ -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 diff 。你可以改为 查看blob
......@@ -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.
先完成此消息的编辑!
想要评论请 注册