From 5a23adb198e77ae997fe3a48623937299831c8f4 Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Sun, 22 Oct 2023 16:51:42 +0800 Subject: [PATCH] feat: add about vgroups command --- tools/shell/src/shellAuto.c | 56 +++++++++++++++++++++++-------------- 1 file changed, 35 insertions(+), 21 deletions(-) diff --git a/tools/shell/src/shellAuto.c b/tools/shell/src/shellAuto.c index 60d6388faa..f6742e789b 100644 --- a/tools/shell/src/shellAuto.c +++ b/tools/shell/src/shellAuto.c @@ -83,6 +83,11 @@ SWords shellCommands[] = { {"alter local \"asynclog\" \"1\";", 0, 0, NULL}, {"alter topic", 0, 0, NULL}, {"alter user ;", 0, 0, NULL}, +#ifdef TD_ENTERPRISE + {"balance vgroup;", 0, 0, NULL}, + {"balance vgroup leader ", 0, 0, NULL}, +#endif + // 20 {"create table using tags(", 0, 0, NULL}, {"create database " @@ -127,9 +132,12 @@ SWords shellCommands[] = { {"kill query ", 0, 0, NULL}, {"kill transaction ", 0, 0, NULL}, #ifdef TD_ENTERPRISE - {"merge vgroup ", 0, 0, NULL}, + {"merge vgroup ", 0, 0, NULL}, #endif {"pause stream ;", 0, 0, NULL}, +#ifdef TD_ENTERPRISE + {"redistribute vgroup dnode ;", 0, 0, NULL}, +#endif {"resume stream ;", 0, 0, NULL}, {"reset query cache;", 0, 0, NULL}, {"restore dnode ;", 0, 0, NULL}, @@ -187,7 +195,7 @@ SWords shellCommands[] = { {"show consumers;", 0, 0, NULL}, {"show grants;", 0, 0, NULL}, #ifdef TD_ENTERPRISE - {"split vgroup ", 0, 0, NULL}, + {"split vgroup ", 0, 0, NULL}, #endif {"insert into values(", 0, 0, NULL}, {"insert into using tags(", 0, 0, NULL}, @@ -268,7 +276,9 @@ char* db_options[] = {"keep ", "wal_retention_size ", "wal_segment_size "}; -char* alter_db_options[] = {"cachemodel ", "replica ", "keep ", "cachesize ", "wal_fsync_period ", "wal_level "}; +char* alter_db_options[] = {"cachemodel ", "replica ", "keep ", "stt_trigger ", + "wal_retention_period ", "wal_retention_size ", "cachesize ", + "wal_fsync_period ", "buffer ", "pages " ,"wal_level "}; char* data_types[] = {"timestamp", "int", "int unsigned", "varchar(16)", @@ -312,26 +322,27 @@ bool waitAutoFill = false; #define WT_VAR_TOPIC 5 #define WT_VAR_STREAM 6 #define WT_VAR_UDFNAME 7 +#define WT_VAR_VGROUPID 8 -#define WT_FROM_DB_MAX 7 // max get content from db +#define WT_FROM_DB_MAX 8 // max get content from db #define WT_FROM_DB_CNT (WT_FROM_DB_MAX + 1) -#define WT_VAR_ALLTABLE 8 -#define WT_VAR_FUNC 9 -#define WT_VAR_KEYWORD 10 -#define WT_VAR_TBACTION 11 -#define WT_VAR_DBOPTION 12 -#define WT_VAR_ALTER_DBOPTION 13 -#define WT_VAR_DATATYPE 14 -#define WT_VAR_KEYTAGS 15 -#define WT_VAR_ANYWORD 16 -#define WT_VAR_TBOPTION 17 -#define WT_VAR_USERACTION 18 -#define WT_VAR_KEYSELECT 19 -#define WT_VAR_SYSTABLE 20 -#define WT_VAR_LANGUAGE 21 +#define WT_VAR_ALLTABLE 9 +#define WT_VAR_FUNC 10 +#define WT_VAR_KEYWORD 11 +#define WT_VAR_TBACTION 12 +#define WT_VAR_DBOPTION 13 +#define WT_VAR_ALTER_DBOPTION 14 +#define WT_VAR_DATATYPE 15 +#define WT_VAR_KEYTAGS 16 +#define WT_VAR_ANYWORD 17 +#define WT_VAR_TBOPTION 18 +#define WT_VAR_USERACTION 19 +#define WT_VAR_KEYSELECT 10 +#define WT_VAR_SYSTABLE 21 +#define WT_VAR_LANGUAGE 22 -#define WT_VAR_CNT 22 +#define WT_VAR_CNT 23 #define WT_TEXT 0xFF @@ -345,11 +356,11 @@ TdThread* threads[WT_FROM_DB_CNT]; // obtain var name with sql from server char varTypes[WT_VAR_CNT][64] = { "", "", "", "", "", "", "", - "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""}; char varSqls[WT_FROM_DB_CNT][64] = {"show databases;", "show stables;", "show tables;", "show dnodes;", - "show users;", "show topics;", "show streams;", "show functions;"}; + "show users;", "show topics;", "show streams;", "show functions;", "show vgroups;"}; // var words current cursor, if user press any one key except tab, cursorVar can be reset to -1 int cursorVar = -1; @@ -520,7 +531,10 @@ void showHelp() { printf( "\n\n\ ----- special commands on enterpise version ----- \n\ + balance vgroup; \n\ + balance vgroup leader \n\ compact database ; \n\ + redistribute vgroup dnode ;\n\ split vgroup ;"); #endif