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

feat: 'alter database pages' and 'alter database buffer'

上级 d3c4b338
...@@ -217,13 +217,13 @@ alter_db_options(A) ::= alter_db_options(B) alter_db_option(C). ...@@ -217,13 +217,13 @@ alter_db_options(A) ::= alter_db_options(B) alter_db_option(C).
%type alter_db_option { SAlterOption } %type alter_db_option { SAlterOption }
%destructor alter_db_option { } %destructor alter_db_option { }
//alter_db_option(A) ::= BUFFER NK_INTEGER(B). { A.type = DB_OPTION_BUFFER; A.val = B; } alter_db_option(A) ::= BUFFER NK_INTEGER(B). { A.type = DB_OPTION_BUFFER; A.val = B; }
alter_db_option(A) ::= CACHEMODEL NK_STRING(B). { A.type = DB_OPTION_CACHEMODEL; A.val = B; } alter_db_option(A) ::= CACHEMODEL NK_STRING(B). { A.type = DB_OPTION_CACHEMODEL; A.val = B; }
alter_db_option(A) ::= CACHESIZE NK_INTEGER(B). { A.type = DB_OPTION_CACHESIZE; A.val = B; } alter_db_option(A) ::= CACHESIZE NK_INTEGER(B). { A.type = DB_OPTION_CACHESIZE; A.val = B; }
alter_db_option(A) ::= WAL_FSYNC_PERIOD NK_INTEGER(B). { A.type = DB_OPTION_FSYNC; A.val = B; } alter_db_option(A) ::= WAL_FSYNC_PERIOD NK_INTEGER(B). { A.type = DB_OPTION_FSYNC; A.val = B; }
alter_db_option(A) ::= KEEP integer_list(B). { A.type = DB_OPTION_KEEP; A.pList = B; } alter_db_option(A) ::= KEEP integer_list(B). { A.type = DB_OPTION_KEEP; A.pList = B; }
alter_db_option(A) ::= KEEP variable_list(B). { A.type = DB_OPTION_KEEP; A.pList = B; } alter_db_option(A) ::= KEEP variable_list(B). { A.type = DB_OPTION_KEEP; A.pList = B; }
//alter_db_option(A) ::= PAGES NK_INTEGER(B). { A.type = DB_OPTION_PAGES; A.val = B; } alter_db_option(A) ::= PAGES NK_INTEGER(B). { A.type = DB_OPTION_PAGES; A.val = B; }
//alter_db_option(A) ::= REPLICA NK_INTEGER(B). { A.type = DB_OPTION_REPLICA; A.val = B; } //alter_db_option(A) ::= REPLICA NK_INTEGER(B). { A.type = DB_OPTION_REPLICA; A.val = B; }
//alter_db_option(A) ::= STRICT NK_STRING(B). { A.type = DB_OPTION_STRICT; A.val = B; } //alter_db_option(A) ::= STRICT NK_STRING(B). { A.type = DB_OPTION_STRICT; A.val = B; }
alter_db_option(A) ::= WAL_LEVEL NK_INTEGER(B). { A.type = DB_OPTION_WAL; A.val = B; } alter_db_option(A) ::= WAL_LEVEL NK_INTEGER(B). { A.type = DB_OPTION_WAL; A.val = B; }
......
因为 它太大了无法显示 source diff 。你可以改为 查看blob
...@@ -79,12 +79,12 @@ TEST_F(ParserInitialATest, alterDnode) { ...@@ -79,12 +79,12 @@ TEST_F(ParserInitialATest, alterDnode) {
* alter_database_option ... * alter_database_option ...
* *
* alter_database_option: { * alter_database_option: {
* BUFFER int_value -- todo: range [3, 16384], default 96, unit MB * BUFFER int_value -- range [3, 16384], default 96, unit MB
* | CACHEMODEL {'none' | 'last_row' | 'last_value' | 'both'} -- default 'none' * | CACHEMODEL {'none' | 'last_row' | 'last_value' | 'both'} -- default 'none'
* | CACHESIZE int_value -- range [1, 65536], default 1, unit MB * | CACHESIZE int_value -- range [1, 65536], default 1, unit MB
* | WAL_FSYNC_PERIOD int_value -- rang [0, 180000], default 3000, unit ms * | WAL_FSYNC_PERIOD int_value -- rang [0, 180000], default 3000, unit ms
* | KEEP {int_value | duration_value} -- rang [1, 365000], default 3650, unit day * | KEEP {int_value | duration_value} -- rang [1, 365000], default 3650, unit day
* | PAGES int_value -- todo: rang [64, +oo), default 256, unit page * | PAGES int_value -- rang [64, 16384], default 256, unit page
* | REPLICA int_value -- todo: enum 1, 3, default 1, unit replica * | REPLICA int_value -- todo: enum 1, 3, default 1, unit replica
* | STRICT {'off' | 'on'} -- todo: default 'off' * | STRICT {'off' | 'on'} -- todo: default 'off'
* | WAL_LEVEL int_value -- enum 1, 2, default 1 * | WAL_LEVEL int_value -- enum 1, 2, default 1
...@@ -162,7 +162,19 @@ TEST_F(ParserInitialATest, alterDatabase) { ...@@ -162,7 +162,19 @@ TEST_F(ParserInitialATest, alterDatabase) {
setAlterDbWal(1); setAlterDbWal(1);
setAlterDbCacheModel(TSDB_CACHE_MODEL_LAST_ROW); setAlterDbCacheModel(TSDB_CACHE_MODEL_LAST_ROW);
setAlterDbSstTrigger(16); setAlterDbSstTrigger(16);
run("ALTER DATABASE test CACHEMODEL 'last_row' CACHESIZE 32 WAL_FSYNC_PERIOD 200 KEEP 10 WAL_LEVEL 1 STT_TRIGGER 16"); setAlterDbBuffer(16);
setAlterDbPages(128);
run("ALTER DATABASE test BUFFER 16 CACHEMODEL 'last_row' CACHESIZE 32 WAL_FSYNC_PERIOD 200 KEEP 10 PAGES 128 "
"WAL_LEVEL 1 STT_TRIGGER 16");
clearAlterDbReq();
initAlterDb("test");
setAlterDbBuffer(3);
run("ALTER DATABASE test BUFFER 3");
setAlterDbBuffer(64);
run("ALTER DATABASE test BUFFER 64");
setAlterDbBuffer(16384);
run("ALTER DATABASE test BUFFER 16384");
clearAlterDbReq(); clearAlterDbReq();
initAlterDb("test"); initAlterDb("test");
...@@ -213,6 +225,15 @@ TEST_F(ParserInitialATest, alterDatabase) { ...@@ -213,6 +225,15 @@ TEST_F(ParserInitialATest, alterDatabase) {
run("ALTER DATABASE test KEEP 14400m,2400h,1500d"); run("ALTER DATABASE test KEEP 14400m,2400h,1500d");
clearAlterDbReq(); clearAlterDbReq();
initAlterDb("test");
setAlterDbPages(64);
run("ALTER DATABASE test PAGES 64");
setAlterDbPages(1024);
run("ALTER DATABASE test PAGES 1024");
setAlterDbPages(16384);
run("ALTER DATABASE test PAGES 16384");
clearAlterDbReq();
initAlterDb("test"); initAlterDb("test");
setAlterDbWal(1); setAlterDbWal(1);
run("ALTER DATABASE test WAL_LEVEL 1"); run("ALTER DATABASE test WAL_LEVEL 1");
...@@ -224,6 +245,8 @@ TEST_F(ParserInitialATest, alterDatabase) { ...@@ -224,6 +245,8 @@ TEST_F(ParserInitialATest, alterDatabase) {
TEST_F(ParserInitialATest, alterDatabaseSemanticCheck) { TEST_F(ParserInitialATest, alterDatabaseSemanticCheck) {
useDb("root", "test"); useDb("root", "test");
run("ALTER DATABASE test BUFFER 2", TSDB_CODE_PAR_INVALID_DB_OPTION);
run("ALTER DATABASE test BUFFER 16385", TSDB_CODE_PAR_INVALID_DB_OPTION);
run("ALTER DATABASE test CACHEMODEL 'other'", TSDB_CODE_PAR_INVALID_DB_OPTION); run("ALTER DATABASE test CACHEMODEL 'other'", TSDB_CODE_PAR_INVALID_DB_OPTION);
run("ALTER DATABASE test CACHESIZE 0", TSDB_CODE_PAR_INVALID_DB_OPTION); run("ALTER DATABASE test CACHESIZE 0", TSDB_CODE_PAR_INVALID_DB_OPTION);
run("ALTER DATABASE test CACHESIZE 65537", TSDB_CODE_PAR_INVALID_DB_OPTION); run("ALTER DATABASE test CACHESIZE 65537", TSDB_CODE_PAR_INVALID_DB_OPTION);
...@@ -234,6 +257,7 @@ TEST_F(ParserInitialATest, alterDatabaseSemanticCheck) { ...@@ -234,6 +257,7 @@ TEST_F(ParserInitialATest, alterDatabaseSemanticCheck) {
run("ALTER DATABASE test KEEP 365001", TSDB_CODE_PAR_INVALID_DB_OPTION); run("ALTER DATABASE test KEEP 365001", TSDB_CODE_PAR_INVALID_DB_OPTION);
run("ALTER DATABASE test KEEP 1000000000s", TSDB_CODE_PAR_INVALID_DB_OPTION); run("ALTER DATABASE test KEEP 1000000000s", TSDB_CODE_PAR_INVALID_DB_OPTION);
run("ALTER DATABASE test KEEP 1w", TSDB_CODE_PAR_INVALID_DB_OPTION); run("ALTER DATABASE test KEEP 1w", TSDB_CODE_PAR_INVALID_DB_OPTION);
run("ALTER DATABASE test PAGES 63", TSDB_CODE_PAR_INVALID_DB_OPTION);
run("ALTER DATABASE test WAL_LEVEL 0", TSDB_CODE_PAR_INVALID_DB_OPTION); run("ALTER DATABASE test WAL_LEVEL 0", TSDB_CODE_PAR_INVALID_DB_OPTION);
run("ALTER DATABASE test WAL_LEVEL 3", TSDB_CODE_PAR_INVALID_DB_OPTION); run("ALTER DATABASE test WAL_LEVEL 3", TSDB_CODE_PAR_INVALID_DB_OPTION);
run("ALTER DATABASE test STT_TRIGGER 0", TSDB_CODE_PAR_INVALID_DB_OPTION); run("ALTER DATABASE test STT_TRIGGER 0", TSDB_CODE_PAR_INVALID_DB_OPTION);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册