Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
bf4b0fbc
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
未验证
提交
bf4b0fbc
编写于
9月 13, 2022
作者:
S
Shengliang Guan
提交者:
GitHub
9月 13, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #16792 from taosdata/fix/3.0_bugfix_wxy
feat: database option 'tsdb_pagesize'
上级
44835777
6cf578f2
变更
13
展开全部
隐藏空白更改
内联
并排
Showing
13 changed file
with
3377 addition
and
3332 deletion
+3377
-3332
include/common/tmsg.h
include/common/tmsg.h
+1
-0
include/common/ttokendef.h
include/common/ttokendef.h
+235
-234
include/libs/nodes/cmdnodes.h
include/libs/nodes/cmdnodes.h
+1
-0
include/util/tdef.h
include/util/tdef.h
+3
-0
source/common/src/tmsg.c
source/common/src/tmsg.c
+3
-0
source/libs/parser/inc/parAst.h
source/libs/parser/inc/parAst.h
+2
-1
source/libs/parser/inc/sql.y
source/libs/parser/inc/sql.y
+3
-2
source/libs/parser/src/parAstCreater.c
source/libs/parser/src/parAstCreater.c
+6
-1
source/libs/parser/src/parTokenizer.c
source/libs/parser/src/parTokenizer.c
+2
-1
source/libs/parser/src/parTranslater.c
source/libs/parser/src/parTranslater.c
+5
-0
source/libs/parser/src/sql.c
source/libs/parser/src/sql.c
+3105
-3087
source/libs/parser/test/parAlterToBalanceTest.cpp
source/libs/parser/test/parAlterToBalanceTest.cpp
+3
-3
source/libs/parser/test/parInitialCTest.cpp
source/libs/parser/test/parInitialCTest.cpp
+8
-3
未找到文件。
include/common/tmsg.h
浏览文件 @
bf4b0fbc
...
...
@@ -787,6 +787,7 @@ typedef struct {
int32_t
sstTrigger
;
int16_t
hashPrefix
;
int16_t
hashSuffix
;
int32_t
tsdbPageSize
;
}
SCreateDbReq
;
int32_t
tSerializeSCreateDbReq
(
void
*
buf
,
int32_t
bufLen
,
SCreateDbReq
*
pReq
);
...
...
include/common/ttokendef.h
浏览文件 @
bf4b0fbc
...
...
@@ -89,240 +89,241 @@
#define TK_KEEP 71
#define TK_PAGES 72
#define TK_PAGESIZE 73
#define TK_PRECISION 74
#define TK_REPLICA 75
#define TK_STRICT 76
#define TK_VGROUPS 77
#define TK_SINGLE_STABLE 78
#define TK_RETENTIONS 79
#define TK_SCHEMALESS 80
#define TK_WAL_LEVEL 81
#define TK_WAL_FSYNC_PERIOD 82
#define TK_WAL_RETENTION_PERIOD 83
#define TK_WAL_RETENTION_SIZE 84
#define TK_WAL_ROLL_PERIOD 85
#define TK_WAL_SEGMENT_SIZE 86
#define TK_SST_TRIGGER 87
#define TK_TABLE_PREFIX 88
#define TK_TABLE_SUFFIX 89
#define TK_NK_COLON 90
#define TK_TABLE 91
#define TK_NK_LP 92
#define TK_NK_RP 93
#define TK_STABLE 94
#define TK_ADD 95
#define TK_COLUMN 96
#define TK_MODIFY 97
#define TK_RENAME 98
#define TK_TAG 99
#define TK_SET 100
#define TK_NK_EQ 101
#define TK_USING 102
#define TK_TAGS 103
#define TK_COMMENT 104
#define TK_BOOL 105
#define TK_TINYINT 106
#define TK_SMALLINT 107
#define TK_INT 108
#define TK_INTEGER 109
#define TK_BIGINT 110
#define TK_FLOAT 111
#define TK_DOUBLE 112
#define TK_BINARY 113
#define TK_TIMESTAMP 114
#define TK_NCHAR 115
#define TK_UNSIGNED 116
#define TK_JSON 117
#define TK_VARCHAR 118
#define TK_MEDIUMBLOB 119
#define TK_BLOB 120
#define TK_VARBINARY 121
#define TK_DECIMAL 122
#define TK_MAX_DELAY 123
#define TK_WATERMARK 124
#define TK_ROLLUP 125
#define TK_TTL 126
#define TK_SMA 127
#define TK_FIRST 128
#define TK_LAST 129
#define TK_SHOW 130
#define TK_DATABASES 131
#define TK_TABLES 132
#define TK_STABLES 133
#define TK_MNODES 134
#define TK_MODULES 135
#define TK_QNODES 136
#define TK_FUNCTIONS 137
#define TK_INDEXES 138
#define TK_ACCOUNTS 139
#define TK_APPS 140
#define TK_CONNECTIONS 141
#define TK_LICENCES 142
#define TK_GRANTS 143
#define TK_QUERIES 144
#define TK_SCORES 145
#define TK_TOPICS 146
#define TK_VARIABLES 147
#define TK_BNODES 148
#define TK_SNODES 149
#define TK_CLUSTER 150
#define TK_TRANSACTIONS 151
#define TK_DISTRIBUTED 152
#define TK_CONSUMERS 153
#define TK_SUBSCRIPTIONS 154
#define TK_VNODES 155
#define TK_LIKE 156
#define TK_INDEX 157
#define TK_FUNCTION 158
#define TK_INTERVAL 159
#define TK_TOPIC 160
#define TK_AS 161
#define TK_WITH 162
#define TK_META 163
#define TK_CONSUMER 164
#define TK_GROUP 165
#define TK_DESC 166
#define TK_DESCRIBE 167
#define TK_RESET 168
#define TK_QUERY 169
#define TK_CACHE 170
#define TK_EXPLAIN 171
#define TK_ANALYZE 172
#define TK_VERBOSE 173
#define TK_NK_BOOL 174
#define TK_RATIO 175
#define TK_NK_FLOAT 176
#define TK_OUTPUTTYPE 177
#define TK_AGGREGATE 178
#define TK_BUFSIZE 179
#define TK_STREAM 180
#define TK_INTO 181
#define TK_TRIGGER 182
#define TK_AT_ONCE 183
#define TK_WINDOW_CLOSE 184
#define TK_IGNORE 185
#define TK_EXPIRED 186
#define TK_KILL 187
#define TK_CONNECTION 188
#define TK_TRANSACTION 189
#define TK_BALANCE 190
#define TK_VGROUP 191
#define TK_MERGE 192
#define TK_REDISTRIBUTE 193
#define TK_SPLIT 194
#define TK_DELETE 195
#define TK_INSERT 196
#define TK_NULL 197
#define TK_NK_QUESTION 198
#define TK_NK_ARROW 199
#define TK_ROWTS 200
#define TK_TBNAME 201
#define TK_QSTART 202
#define TK_QEND 203
#define TK_QDURATION 204
#define TK_WSTART 205
#define TK_WEND 206
#define TK_WDURATION 207
#define TK_CAST 208
#define TK_NOW 209
#define TK_TODAY 210
#define TK_TIMEZONE 211
#define TK_CLIENT_VERSION 212
#define TK_SERVER_VERSION 213
#define TK_SERVER_STATUS 214
#define TK_CURRENT_USER 215
#define TK_COUNT 216
#define TK_LAST_ROW 217
#define TK_BETWEEN 218
#define TK_IS 219
#define TK_NK_LT 220
#define TK_NK_GT 221
#define TK_NK_LE 222
#define TK_NK_GE 223
#define TK_NK_NE 224
#define TK_MATCH 225
#define TK_NMATCH 226
#define TK_CONTAINS 227
#define TK_IN 228
#define TK_JOIN 229
#define TK_INNER 230
#define TK_SELECT 231
#define TK_DISTINCT 232
#define TK_WHERE 233
#define TK_PARTITION 234
#define TK_BY 235
#define TK_SESSION 236
#define TK_STATE_WINDOW 237
#define TK_SLIDING 238
#define TK_FILL 239
#define TK_VALUE 240
#define TK_NONE 241
#define TK_PREV 242
#define TK_LINEAR 243
#define TK_NEXT 244
#define TK_HAVING 245
#define TK_RANGE 246
#define TK_EVERY 247
#define TK_ORDER 248
#define TK_SLIMIT 249
#define TK_SOFFSET 250
#define TK_LIMIT 251
#define TK_OFFSET 252
#define TK_ASC 253
#define TK_NULLS 254
#define TK_ABORT 255
#define TK_AFTER 256
#define TK_ATTACH 257
#define TK_BEFORE 258
#define TK_BEGIN 259
#define TK_BITAND 260
#define TK_BITNOT 261
#define TK_BITOR 262
#define TK_BLOCKS 263
#define TK_CHANGE 264
#define TK_COMMA 265
#define TK_COMPACT 266
#define TK_CONCAT 267
#define TK_CONFLICT 268
#define TK_COPY 269
#define TK_DEFERRED 270
#define TK_DELIMITERS 271
#define TK_DETACH 272
#define TK_DIVIDE 273
#define TK_DOT 274
#define TK_EACH 275
#define TK_END 276
#define TK_FAIL 277
#define TK_FILE 278
#define TK_FOR 279
#define TK_GLOB 280
#define TK_ID 281
#define TK_IMMEDIATE 282
#define TK_IMPORT 283
#define TK_INITIALLY 284
#define TK_INSTEAD 285
#define TK_ISNULL 286
#define TK_KEY 287
#define TK_NK_BITNOT 288
#define TK_NK_SEMI 289
#define TK_NOTNULL 290
#define TK_OF 291
#define TK_PLUS 292
#define TK_PRIVILEGE 293
#define TK_RAISE 294
#define TK_REPLACE 295
#define TK_RESTRICT 296
#define TK_ROW 297
#define TK_SEMI 298
#define TK_STAR 299
#define TK_STATEMENT 300
#define TK_STRING 301
#define TK_TIMES 302
#define TK_UPDATE 303
#define TK_VALUES 304
#define TK_VARIABLE 305
#define TK_VIEW 306
#define TK_WAL 307
#define TK_TSDB_PAGESIZE 74
#define TK_PRECISION 75
#define TK_REPLICA 76
#define TK_STRICT 77
#define TK_VGROUPS 78
#define TK_SINGLE_STABLE 79
#define TK_RETENTIONS 80
#define TK_SCHEMALESS 81
#define TK_WAL_LEVEL 82
#define TK_WAL_FSYNC_PERIOD 83
#define TK_WAL_RETENTION_PERIOD 84
#define TK_WAL_RETENTION_SIZE 85
#define TK_WAL_ROLL_PERIOD 86
#define TK_WAL_SEGMENT_SIZE 87
#define TK_STT_TRIGGER 88
#define TK_TABLE_PREFIX 89
#define TK_TABLE_SUFFIX 90
#define TK_NK_COLON 91
#define TK_TABLE 92
#define TK_NK_LP 93
#define TK_NK_RP 94
#define TK_STABLE 95
#define TK_ADD 96
#define TK_COLUMN 97
#define TK_MODIFY 98
#define TK_RENAME 99
#define TK_TAG 100
#define TK_SET 101
#define TK_NK_EQ 102
#define TK_USING 103
#define TK_TAGS 104
#define TK_COMMENT 105
#define TK_BOOL 106
#define TK_TINYINT 107
#define TK_SMALLINT 108
#define TK_INT 109
#define TK_INTEGER 110
#define TK_BIGINT 111
#define TK_FLOAT 112
#define TK_DOUBLE 113
#define TK_BINARY 114
#define TK_TIMESTAMP 115
#define TK_NCHAR 116
#define TK_UNSIGNED 117
#define TK_JSON 118
#define TK_VARCHAR 119
#define TK_MEDIUMBLOB 120
#define TK_BLOB 121
#define TK_VARBINARY 122
#define TK_DECIMAL 123
#define TK_MAX_DELAY 124
#define TK_WATERMARK 125
#define TK_ROLLUP 126
#define TK_TTL 127
#define TK_SMA 128
#define TK_FIRST 129
#define TK_LAST 130
#define TK_SHOW 131
#define TK_DATABASES 132
#define TK_TABLES 133
#define TK_STABLES 134
#define TK_MNODES 135
#define TK_MODULES 136
#define TK_QNODES 137
#define TK_FUNCTIONS 138
#define TK_INDEXES 139
#define TK_ACCOUNTS 140
#define TK_APPS 141
#define TK_CONNECTIONS 142
#define TK_LICENCES 143
#define TK_GRANTS 144
#define TK_QUERIES 145
#define TK_SCORES 146
#define TK_TOPICS 147
#define TK_VARIABLES 148
#define TK_BNODES 149
#define TK_SNODES 150
#define TK_CLUSTER 151
#define TK_TRANSACTIONS 152
#define TK_DISTRIBUTED 153
#define TK_CONSUMERS 154
#define TK_SUBSCRIPTIONS 155
#define TK_VNODES 156
#define TK_LIKE 157
#define TK_INDEX 158
#define TK_FUNCTION 159
#define TK_INTERVAL 160
#define TK_TOPIC 161
#define TK_AS 162
#define TK_WITH 163
#define TK_META 164
#define TK_CONSUMER 165
#define TK_GROUP 166
#define TK_DESC 167
#define TK_DESCRIBE 168
#define TK_RESET 169
#define TK_QUERY 170
#define TK_CACHE 171
#define TK_EXPLAIN 172
#define TK_ANALYZE 173
#define TK_VERBOSE 174
#define TK_NK_BOOL 175
#define TK_RATIO 176
#define TK_NK_FLOAT 177
#define TK_OUTPUTTYPE 178
#define TK_AGGREGATE 179
#define TK_BUFSIZE 180
#define TK_STREAM 181
#define TK_INTO 182
#define TK_TRIGGER 183
#define TK_AT_ONCE 184
#define TK_WINDOW_CLOSE 185
#define TK_IGNORE 186
#define TK_EXPIRED 187
#define TK_KILL 188
#define TK_CONNECTION 189
#define TK_TRANSACTION 190
#define TK_BALANCE 191
#define TK_VGROUP 192
#define TK_MERGE 193
#define TK_REDISTRIBUTE 194
#define TK_SPLIT 195
#define TK_DELETE 196
#define TK_INSERT 197
#define TK_NULL 198
#define TK_NK_QUESTION 199
#define TK_NK_ARROW 200
#define TK_ROWTS 201
#define TK_TBNAME 202
#define TK_QSTART 203
#define TK_QEND 204
#define TK_QDURATION 205
#define TK_WSTART 206
#define TK_WEND 207
#define TK_WDURATION 208
#define TK_CAST 209
#define TK_NOW 210
#define TK_TODAY 211
#define TK_TIMEZONE 212
#define TK_CLIENT_VERSION 213
#define TK_SERVER_VERSION 214
#define TK_SERVER_STATUS 215
#define TK_CURRENT_USER 216
#define TK_COUNT 217
#define TK_LAST_ROW 218
#define TK_BETWEEN 219
#define TK_IS 220
#define TK_NK_LT 221
#define TK_NK_GT 222
#define TK_NK_LE 223
#define TK_NK_GE 224
#define TK_NK_NE 225
#define TK_MATCH 226
#define TK_NMATCH 227
#define TK_CONTAINS 228
#define TK_IN 229
#define TK_JOIN 230
#define TK_INNER 231
#define TK_SELECT 232
#define TK_DISTINCT 233
#define TK_WHERE 234
#define TK_PARTITION 235
#define TK_BY 236
#define TK_SESSION 237
#define TK_STATE_WINDOW 238
#define TK_SLIDING 239
#define TK_FILL 240
#define TK_VALUE 241
#define TK_NONE 242
#define TK_PREV 243
#define TK_LINEAR 244
#define TK_NEXT 245
#define TK_HAVING 246
#define TK_RANGE 247
#define TK_EVERY 248
#define TK_ORDER 249
#define TK_SLIMIT 250
#define TK_SOFFSET 251
#define TK_LIMIT 252
#define TK_OFFSET 253
#define TK_ASC 254
#define TK_NULLS 255
#define TK_ABORT 256
#define TK_AFTER 257
#define TK_ATTACH 258
#define TK_BEFORE 259
#define TK_BEGIN 260
#define TK_BITAND 261
#define TK_BITNOT 262
#define TK_BITOR 263
#define TK_BLOCKS 264
#define TK_CHANGE 265
#define TK_COMMA 266
#define TK_COMPACT 267
#define TK_CONCAT 268
#define TK_CONFLICT 269
#define TK_COPY 270
#define TK_DEFERRED 271
#define TK_DELIMITERS 272
#define TK_DETACH 273
#define TK_DIVIDE 274
#define TK_DOT 275
#define TK_EACH 276
#define TK_END 277
#define TK_FAIL 278
#define TK_FILE 279
#define TK_FOR 280
#define TK_GLOB 281
#define TK_ID 282
#define TK_IMMEDIATE 283
#define TK_IMPORT 284
#define TK_INITIALLY 285
#define TK_INSTEAD 286
#define TK_ISNULL 287
#define TK_KEY 288
#define TK_NK_BITNOT 289
#define TK_NK_SEMI 290
#define TK_NOTNULL 291
#define TK_OF 292
#define TK_PLUS 293
#define TK_PRIVILEGE 294
#define TK_RAISE 295
#define TK_REPLACE 296
#define TK_RESTRICT 297
#define TK_ROW 298
#define TK_SEMI 299
#define TK_STAR 300
#define TK_STATEMENT 301
#define TK_STRING 302
#define TK_TIMES 303
#define TK_UPDATE 304
#define TK_VALUES 305
#define TK_VARIABLE 306
#define TK_VIEW 307
#define TK_WAL 308
#define TK_NK_SPACE 300
#define TK_NK_COMMENT 301
...
...
include/libs/nodes/cmdnodes.h
浏览文件 @
bf4b0fbc
...
...
@@ -64,6 +64,7 @@ typedef struct SDatabaseOptions {
int64_t
keep
[
3
];
int32_t
pages
;
int32_t
pagesize
;
int32_t
tsdbPageSize
;
char
precisionStr
[
3
];
int8_t
precision
;
int8_t
replica
;
...
...
include/util/tdef.h
浏览文件 @
bf4b0fbc
...
...
@@ -300,6 +300,9 @@ typedef enum ELogicConditionType {
#define TSDB_DEFAULT_PAGES_PER_VNODE 256
#define TSDB_MIN_PAGESIZE_PER_VNODE 1 // unit KB
#define TSDB_MAX_PAGESIZE_PER_VNODE 16384
#define TSDB_DEFAULT_TSDB_PAGESIZE 4
#define TSDB_MIN_TSDB_PAGESIZE 1 // unit KB
#define TSDB_MAX_TSDB_PAGESIZE 16384
#define TSDB_DEFAULT_PAGESIZE_PER_VNODE 4
#define TSDB_MIN_DAYS_PER_FILE 60 // unit minute
#define TSDB_MAX_DAYS_PER_FILE (3650 * 1440)
...
...
source/common/src/tmsg.c
浏览文件 @
bf4b0fbc
...
...
@@ -2038,6 +2038,7 @@ int32_t tSerializeSCreateDbReq(void *buf, int32_t bufLen, SCreateDbReq *pReq) {
if
(
tEncodeI8
(
&
encoder
,
pRetension
->
freqUnit
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pRetension
->
keepUnit
)
<
0
)
return
-
1
;
}
if
(
tEncodeI32
(
&
encoder
,
pReq
->
tsdbPageSize
)
<
0
)
return
-
1
;
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
...
...
@@ -2098,6 +2099,8 @@ int32_t tDeserializeSCreateDbReq(void *buf, int32_t bufLen, SCreateDbReq *pReq)
}
}
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
tsdbPageSize
)
<
0
)
return
-
1
;
tEndDecode
(
&
decoder
);
tDecoderClear
(
&
decoder
);
...
...
source/libs/parser/inc/parAst.h
浏览文件 @
bf4b0fbc
...
...
@@ -48,6 +48,7 @@ typedef enum EDatabaseOptionType {
DB_OPTION_KEEP
,
DB_OPTION_PAGES
,
DB_OPTION_PAGESIZE
,
DB_OPTION_TSDB_PAGESIZE
,
DB_OPTION_PRECISION
,
DB_OPTION_REPLICA
,
DB_OPTION_STRICT
,
...
...
@@ -60,7 +61,7 @@ typedef enum EDatabaseOptionType {
DB_OPTION_WAL_RETENTION_SIZE
,
DB_OPTION_WAL_ROLL_PERIOD
,
DB_OPTION_WAL_SEGMENT_SIZE
,
DB_OPTION_S
S
T_TRIGGER
,
DB_OPTION_S
T
T_TRIGGER
,
DB_OPTION_TABLE_PREFIX
,
DB_OPTION_TABLE_SUFFIX
}
EDatabaseOptionType
;
...
...
source/libs/parser/inc/sql.y
浏览文件 @
bf4b0fbc
...
...
@@ -184,6 +184,7 @@ db_options(A) ::= db_options(B) KEEP integer_list(C).
db_options(A) ::= db_options(B) KEEP variable_list(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_KEEP, C); }
db_options(A) ::= db_options(B) PAGES NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_PAGES, &C); }
db_options(A) ::= db_options(B) PAGESIZE NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_PAGESIZE, &C); }
db_options(A) ::= db_options(B) TSDB_PAGESIZE NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_TSDB_PAGESIZE, &C); }
db_options(A) ::= db_options(B) PRECISION NK_STRING(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_PRECISION, &C); }
db_options(A) ::= db_options(B) REPLICA NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_REPLICA, &C); }
db_options(A) ::= db_options(B) STRICT NK_STRING(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_STRICT, &C); }
...
...
@@ -207,7 +208,7 @@ db_options(A) ::= db_options(B) WAL_RETENTION_SIZE NK_MINUS(D) NK_INTEGER(C).
}
db_options(A) ::= db_options(B) WAL_ROLL_PERIOD NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_WAL_ROLL_PERIOD, &C); }
db_options(A) ::= db_options(B) WAL_SEGMENT_SIZE NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_WAL_SEGMENT_SIZE, &C); }
db_options(A) ::= db_options(B) S
ST_TRIGGER NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_SS
T_TRIGGER, &C); }
db_options(A) ::= db_options(B) S
TT_TRIGGER NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_ST
T_TRIGGER, &C); }
db_options(A) ::= db_options(B) TABLE_PREFIX NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_TABLE_PREFIX, &C); }
db_options(A) ::= db_options(B) TABLE_SUFFIX NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_TABLE_SUFFIX, &C); }
...
...
@@ -226,7 +227,7 @@ alter_db_option(A) ::= KEEP variable_list(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) ::= WAL_LEVEL NK_INTEGER(B). { A.type = DB_OPTION_WAL; A.val = B; }
alter_db_option(A) ::= S
ST_TRIGGER NK_INTEGER(B). { A.type = DB_OPTION_SS
T_TRIGGER; A.val = B; }
alter_db_option(A) ::= S
TT_TRIGGER NK_INTEGER(B). { A.type = DB_OPTION_ST
T_TRIGGER; A.val = B; }
%type integer_list { SNodeList* }
%destructor integer_list { nodesDestroyList($$); }
...
...
source/libs/parser/src/parAstCreater.c
浏览文件 @
bf4b0fbc
...
...
@@ -826,6 +826,7 @@ SNode* createDefaultDatabaseOptions(SAstCreateContext* pCxt) {
pOptions
->
keep
[
2
]
=
TSDB_DEFAULT_KEEP
;
pOptions
->
pages
=
TSDB_DEFAULT_PAGES_PER_VNODE
;
pOptions
->
pagesize
=
TSDB_DEFAULT_PAGESIZE_PER_VNODE
;
pOptions
->
tsdbPageSize
=
TSDB_DEFAULT_TSDB_PAGESIZE
;
pOptions
->
precision
=
TSDB_DEFAULT_PRECISION
;
pOptions
->
replica
=
TSDB_DEFAULT_DB_REPLICA
;
pOptions
->
strict
=
TSDB_DEFAULT_DB_STRICT
;
...
...
@@ -858,6 +859,7 @@ SNode* createAlterDatabaseOptions(SAstCreateContext* pCxt) {
pOptions
->
keep
[
2
]
=
-
1
;
pOptions
->
pages
=
-
1
;
pOptions
->
pagesize
=
-
1
;
pOptions
->
tsdbPageSize
=
-
1
;
pOptions
->
precision
=
-
1
;
pOptions
->
replica
=
-
1
;
pOptions
->
strict
=
-
1
;
...
...
@@ -918,6 +920,9 @@ SNode* setDatabaseOption(SAstCreateContext* pCxt, SNode* pOptions, EDatabaseOpti
case
DB_OPTION_PAGESIZE
:
pDbOptions
->
pagesize
=
taosStr2Int32
(((
SToken
*
)
pVal
)
->
z
,
NULL
,
10
);
break
;
case
DB_OPTION_TSDB_PAGESIZE
:
pDbOptions
->
tsdbPageSize
=
taosStr2Int32
(((
SToken
*
)
pVal
)
->
z
,
NULL
,
10
);
break
;
case
DB_OPTION_PRECISION
:
COPY_STRING_FORM_STR_TOKEN
(
pDbOptions
->
precisionStr
,
(
SToken
*
)
pVal
);
break
;
...
...
@@ -955,7 +960,7 @@ SNode* setDatabaseOption(SAstCreateContext* pCxt, SNode* pOptions, EDatabaseOpti
case
DB_OPTION_WAL_SEGMENT_SIZE
:
pDbOptions
->
walSegmentSize
=
taosStr2Int32
(((
SToken
*
)
pVal
)
->
z
,
NULL
,
10
);
break
;
case
DB_OPTION_S
S
T_TRIGGER
:
case
DB_OPTION_S
T
T_TRIGGER
:
pDbOptions
->
sstTrigger
=
taosStr2Int32
(((
SToken
*
)
pVal
)
->
z
,
NULL
,
10
);
break
;
case
DB_OPTION_TABLE_PREFIX
:
...
...
source/libs/parser/src/parTokenizer.c
浏览文件 @
bf4b0fbc
...
...
@@ -187,7 +187,7 @@ static SKeyword keywordTable[] = {
{
"SNODES"
,
TK_SNODES
},
{
"SOFFSET"
,
TK_SOFFSET
},
{
"SPLIT"
,
TK_SPLIT
},
{
"S
ST_TRIGGER"
,
TK_SS
T_TRIGGER
},
{
"S
TT_TRIGGER"
,
TK_ST
T_TRIGGER
},
{
"STABLE"
,
TK_STABLE
},
{
"STABLES"
,
TK_STABLES
},
{
"STATE"
,
TK_STATE
},
...
...
@@ -216,6 +216,7 @@ static SKeyword keywordTable[] = {
{
"TRANSACTIONS"
,
TK_TRANSACTIONS
},
{
"TRIGGER"
,
TK_TRIGGER
},
{
"TRIM"
,
TK_TRIM
},
{
"TSDB_PAGESIZE"
,
TK_TSDB_PAGESIZE
},
{
"TSERIES"
,
TK_TSERIES
},
{
"TTL"
,
TK_TTL
},
{
"UNION"
,
TK_UNION
},
...
...
source/libs/parser/src/parTranslater.c
浏览文件 @
bf4b0fbc
...
...
@@ -3485,6 +3485,7 @@ static int32_t buildCreateDbReq(STranslateContext* pCxt, SCreateDatabaseStmt* pS
pReq
->
sstTrigger
=
pStmt
->
pOptions
->
sstTrigger
;
pReq
->
hashPrefix
=
pStmt
->
pOptions
->
tablePrefix
;
pReq
->
hashSuffix
=
pStmt
->
pOptions
->
tableSuffix
;
pReq
->
tsdbPageSize
=
pStmt
->
pOptions
->
tsdbPageSize
;
pReq
->
ignoreExist
=
pStmt
->
ignoreExists
;
return
buildCreateDbRetentions
(
pStmt
->
pOptions
->
pRetentions
,
pReq
);
}
...
...
@@ -3729,6 +3730,10 @@ static int32_t checkDatabaseOptions(STranslateContext* pCxt, const char* pDbName
code
=
checkDbRangeOption
(
pCxt
,
"pagesize"
,
pOptions
->
pagesize
,
TSDB_MIN_PAGESIZE_PER_VNODE
,
TSDB_MAX_PAGESIZE_PER_VNODE
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
checkDbRangeOption
(
pCxt
,
"tsdbPagesize"
,
pOptions
->
tsdbPageSize
,
TSDB_MIN_TSDB_PAGESIZE
,
TSDB_MAX_TSDB_PAGESIZE
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
checkDbPrecisionOption
(
pCxt
,
pOptions
);
}
...
...
source/libs/parser/src/sql.c
浏览文件 @
bf4b0fbc
此差异已折叠。
点击以展开。
source/libs/parser/test/parAlterToBalanceTest.cpp
浏览文件 @
bf4b0fbc
...
...
@@ -162,7 +162,7 @@ TEST_F(ParserInitialATest, alterDatabase) {
setAlterDbWal
(
1
);
setAlterDbCacheModel
(
TSDB_CACHE_MODEL_LAST_ROW
);
setAlterDbSstTrigger
(
16
);
run
(
"ALTER DATABASE test CACHEMODEL 'last_row' CACHESIZE 32 WAL_FSYNC_PERIOD 200 KEEP 10 WAL_LEVEL 1 S
S
T_TRIGGER 16"
);
run
(
"ALTER DATABASE test CACHEMODEL 'last_row' CACHESIZE 32 WAL_FSYNC_PERIOD 200 KEEP 10 WAL_LEVEL 1 S
T
T_TRIGGER 16"
);
clearAlterDbReq
();
initAlterDb
(
"test"
);
...
...
@@ -236,8 +236,8 @@ TEST_F(ParserInitialATest, alterDatabaseSemanticCheck) {
run
(
"ALTER DATABASE test KEEP 1w"
,
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 S
S
T_TRIGGER 0"
,
TSDB_CODE_PAR_INVALID_DB_OPTION
);
run
(
"ALTER DATABASE test S
S
T_TRIGGER 17"
,
TSDB_CODE_PAR_INVALID_DB_OPTION
);
run
(
"ALTER DATABASE test S
T
T_TRIGGER 0"
,
TSDB_CODE_PAR_INVALID_DB_OPTION
);
run
(
"ALTER DATABASE test S
T
T_TRIGGER 17"
,
TSDB_CODE_PAR_INVALID_DB_OPTION
);
// Regardless of the specific sentence
run
(
"ALTER DATABASE db WAL_LEVEL 0 # td-14436"
,
TSDB_CODE_PAR_SYNTAX_ERROR
,
PARSER_STAGE_PARSE
);
}
...
...
source/libs/parser/test/parInitialCTest.cpp
浏览文件 @
bf4b0fbc
...
...
@@ -118,6 +118,7 @@ TEST_F(ParserInitialCTest, createDatabase) {
expect
.
sstTrigger
=
TSDB_DEFAULT_SST_TRIGGER
;
expect
.
hashPrefix
=
TSDB_DEFAULT_HASH_PREFIX
;
expect
.
hashSuffix
=
TSDB_DEFAULT_HASH_SUFFIX
;
expect
.
tsdbPageSize
=
TSDB_DEFAULT_TSDB_PAGESIZE
;
};
auto
setDbBufferFunc
=
[
&
](
int32_t
buffer
)
{
expect
.
buffer
=
buffer
;
};
...
...
@@ -161,6 +162,7 @@ TEST_F(ParserInitialCTest, createDatabase) {
auto
setDbSstTrigger
=
[
&
](
int32_t
sstTrigger
)
{
expect
.
sstTrigger
=
sstTrigger
;
};
auto
setDbHashPrefix
=
[
&
](
int32_t
hashPrefix
)
{
expect
.
hashPrefix
=
hashPrefix
;
};
auto
setDbHashSuffix
=
[
&
](
int32_t
hashSuffix
)
{
expect
.
hashSuffix
=
hashSuffix
;
};
auto
setDbTsdbPageSize
=
[
&
](
int32_t
tsdbPageSize
)
{
expect
.
tsdbPageSize
=
tsdbPageSize
;
};
setCheckDdlFunc
([
&
](
const
SQuery
*
pQuery
,
ParserStage
stage
)
{
ASSERT_EQ
(
nodeType
(
pQuery
->
pRoot
),
QUERY_NODE_CREATE_DATABASE_STMT
);
...
...
@@ -194,6 +196,7 @@ TEST_F(ParserInitialCTest, createDatabase) {
ASSERT_EQ
(
req
.
sstTrigger
,
expect
.
sstTrigger
);
ASSERT_EQ
(
req
.
hashPrefix
,
expect
.
hashPrefix
);
ASSERT_EQ
(
req
.
hashSuffix
,
expect
.
hashSuffix
);
ASSERT_EQ
(
req
.
tsdbPageSize
,
expect
.
tsdbPageSize
);
ASSERT_EQ
(
req
.
ignoreExist
,
expect
.
ignoreExist
);
ASSERT_EQ
(
req
.
numOfRetensions
,
expect
.
numOfRetensions
);
if
(
expect
.
numOfRetensions
>
0
)
{
...
...
@@ -244,6 +247,7 @@ TEST_F(ParserInitialCTest, createDatabase) {
setDbSstTrigger
(
16
);
setDbHashPrefix
(
3
);
setDbHashSuffix
(
4
);
setDbTsdbPageSize
(
32
);
run
(
"CREATE DATABASE IF NOT EXISTS wxy_db "
"BUFFER 64 "
"CACHEMODEL 'last_value' "
...
...
@@ -268,9 +272,10 @@ TEST_F(ParserInitialCTest, createDatabase) {
"WAL_RETENTION_SIZE -1 "
"WAL_ROLL_PERIOD 10 "
"WAL_SEGMENT_SIZE 20 "
"SST_TRIGGER 16 "
"TABLE_PREFIX 3"
"TABLE_SUFFIX 4"
);
"STT_TRIGGER 16 "
"TABLE_PREFIX 3 "
"TABLE_SUFFIX 4 "
"TSDB_PAGESIZE 32"
);
clearCreateDbReq
();
setCreateDbReqFunc
(
"wxy_db"
,
1
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录