Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
3c2fc48e
T
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1192
Star
22018
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看板
提交
3c2fc48e
编写于
4月 21, 2023
作者:
D
dapan1121
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: support new table_prefix/table_suffix mode
上级
e5d0f2de
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
2477 addition
and
1802 deletion
+2477
-1802
include/common/ttokendef.h
include/common/ttokendef.h
+330
-329
include/util/tdef.h
include/util/tdef.h
+4
-4
include/util/tutil.h
include/util/tutil.h
+13
-5
source/dnode/mnode/impl/src/mndDb.c
source/dnode/mnode/impl/src/mndDb.c
+8
-2
source/libs/command/src/command.c
source/libs/command/src/command.c
+6
-1
source/libs/parser/inc/sql.y
source/libs/parser/inc/sql.y
+2
-2
source/libs/parser/src/parAstCreater.c
source/libs/parser/src/parAstCreater.c
+18
-4
source/libs/parser/src/parTranslater.c
source/libs/parser/src/parTranslater.c
+29
-4
source/libs/parser/src/sql.c
source/libs/parser/src/sql.c
+2067
-1451
未找到文件。
include/common/ttokendef.h
浏览文件 @
3c2fc48e
...
@@ -16,335 +16,336 @@
...
@@ -16,335 +16,336 @@
#ifndef _TD_COMMON_TOKEN_H_
#ifndef _TD_COMMON_TOKEN_H_
#define _TD_COMMON_TOKEN_H_
#define _TD_COMMON_TOKEN_H_
#define TK_OR 1
#define TK_OR 1
#define TK_AND 2
#define TK_AND 2
#define TK_UNION 3
#define TK_UNION 3
#define TK_ALL 4
#define TK_ALL 4
#define TK_MINUS 5
#define TK_MINUS 5
#define TK_EXCEPT 6
#define TK_EXCEPT 6
#define TK_INTERSECT 7
#define TK_INTERSECT 7
#define TK_NK_BITAND 8
#define TK_NK_BITAND 8
#define TK_NK_BITOR 9
#define TK_NK_BITOR 9
#define TK_NK_LSHIFT 10
#define TK_NK_LSHIFT 10
#define TK_NK_RSHIFT 11
#define TK_NK_RSHIFT 11
#define TK_NK_PLUS 12
#define TK_NK_PLUS 12
#define TK_NK_MINUS 13
#define TK_NK_MINUS 13
#define TK_NK_STAR 14
#define TK_NK_STAR 14
#define TK_NK_SLASH 15
#define TK_NK_SLASH 15
#define TK_NK_REM 16
#define TK_NK_REM 16
#define TK_NK_CONCAT 17
#define TK_NK_CONCAT 17
#define TK_CREATE 18
#define TK_CREATE 18
#define TK_ACCOUNT 19
#define TK_ACCOUNT 19
#define TK_NK_ID 20
#define TK_NK_ID 20
#define TK_PASS 21
#define TK_PASS 21
#define TK_NK_STRING 22
#define TK_NK_STRING 22
#define TK_ALTER 23
#define TK_ALTER 23
#define TK_PPS 24
#define TK_PPS 24
#define TK_TSERIES 25
#define TK_TSERIES 25
#define TK_STORAGE 26
#define TK_STORAGE 26
#define TK_STREAMS 27
#define TK_STREAMS 27
#define TK_QTIME 28
#define TK_QTIME 28
#define TK_DBS 29
#define TK_DBS 29
#define TK_USERS 30
#define TK_USERS 30
#define TK_CONNS 31
#define TK_CONNS 31
#define TK_STATE 32
#define TK_STATE 32
#define TK_USER 33
#define TK_USER 33
#define TK_ENABLE 34
#define TK_ENABLE 34
#define TK_NK_INTEGER 35
#define TK_NK_INTEGER 35
#define TK_SYSINFO 36
#define TK_SYSINFO 36
#define TK_DROP 37
#define TK_DROP 37
#define TK_GRANT 38
#define TK_GRANT 38
#define TK_ON 39
#define TK_ON 39
#define TK_TO 40
#define TK_TO 40
#define TK_REVOKE 41
#define TK_REVOKE 41
#define TK_FROM 42
#define TK_FROM 42
#define TK_SUBSCRIBE 43
#define TK_SUBSCRIBE 43
#define TK_NK_COMMA 44
#define TK_NK_COMMA 44
#define TK_READ 45
#define TK_READ 45
#define TK_WRITE 46
#define TK_WRITE 46
#define TK_NK_DOT 47
#define TK_NK_DOT 47
#define TK_WITH 48
#define TK_WITH 48
#define TK_DNODE 49
#define TK_DNODE 49
#define TK_PORT 50
#define TK_PORT 50
#define TK_DNODES 51
#define TK_DNODES 51
#define TK_NK_IPTOKEN 52
#define TK_NK_IPTOKEN 52
#define TK_FORCE 53
#define TK_FORCE 53
#define TK_LOCAL 54
#define TK_LOCAL 54
#define TK_QNODE 55
#define TK_QNODE 55
#define TK_BNODE 56
#define TK_BNODE 56
#define TK_SNODE 57
#define TK_SNODE 57
#define TK_MNODE 58
#define TK_MNODE 58
#define TK_DATABASE 59
#define TK_DATABASE 59
#define TK_USE 60
#define TK_USE 60
#define TK_FLUSH 61
#define TK_FLUSH 61
#define TK_TRIM 62
#define TK_TRIM 62
#define TK_COMPACT 63
#define TK_COMPACT 63
#define TK_IF 64
#define TK_IF 64
#define TK_NOT 65
#define TK_NOT 65
#define TK_EXISTS 66
#define TK_EXISTS 66
#define TK_BUFFER 67
#define TK_BUFFER 67
#define TK_CACHEMODEL 68
#define TK_CACHEMODEL 68
#define TK_CACHESIZE 69
#define TK_CACHESIZE 69
#define TK_COMP 70
#define TK_COMP 70
#define TK_DURATION 71
#define TK_DURATION 71
#define TK_NK_VARIABLE 72
#define TK_NK_VARIABLE 72
#define TK_MAXROWS 73
#define TK_MAXROWS 73
#define TK_MINROWS 74
#define TK_MINROWS 74
#define TK_KEEP 75
#define TK_KEEP 75
#define TK_PAGES 76
#define TK_PAGES 76
#define TK_PAGESIZE 77
#define TK_PAGESIZE 77
#define TK_TSDB_PAGESIZE 78
#define TK_TSDB_PAGESIZE 78
#define TK_PRECISION 79
#define TK_PRECISION 79
#define TK_REPLICA 80
#define TK_REPLICA 80
#define TK_VGROUPS 81
#define TK_VGROUPS 81
#define TK_SINGLE_STABLE 82
#define TK_SINGLE_STABLE 82
#define TK_RETENTIONS 83
#define TK_RETENTIONS 83
#define TK_SCHEMALESS 84
#define TK_SCHEMALESS 84
#define TK_WAL_LEVEL 85
#define TK_WAL_LEVEL 85
#define TK_WAL_FSYNC_PERIOD 86
#define TK_WAL_FSYNC_PERIOD 86
#define TK_WAL_RETENTION_PERIOD 87
#define TK_WAL_RETENTION_PERIOD 87
#define TK_WAL_RETENTION_SIZE 88
#define TK_WAL_RETENTION_SIZE 88
#define TK_WAL_ROLL_PERIOD 89
#define TK_WAL_ROLL_PERIOD 89
#define TK_WAL_SEGMENT_SIZE 90
#define TK_WAL_SEGMENT_SIZE 90
#define TK_STT_TRIGGER 91
#define TK_STT_TRIGGER 91
#define TK_TABLE_PREFIX 92
#define TK_TABLE_PREFIX 92
#define TK_TABLE_SUFFIX 93
#define TK_TABLE_SUFFIX 93
#define TK_NK_COLON 94
#define TK_NK_COLON 94
#define TK_MAX_SPEED 95
#define TK_MAX_SPEED 95
#define TK_START 96
#define TK_START 96
#define TK_TIMESTAMP 97
#define TK_TIMESTAMP 97
#define TK_END 98
#define TK_END 98
#define TK_TABLE 99
#define TK_TABLE 99
#define TK_NK_LP 100
#define TK_NK_LP 100
#define TK_NK_RP 101
#define TK_NK_RP 101
#define TK_STABLE 102
#define TK_STABLE 102
#define TK_ADD 103
#define TK_ADD 103
#define TK_COLUMN 104
#define TK_COLUMN 104
#define TK_MODIFY 105
#define TK_MODIFY 105
#define TK_RENAME 106
#define TK_RENAME 106
#define TK_TAG 107
#define TK_TAG 107
#define TK_SET 108
#define TK_SET 108
#define TK_NK_EQ 109
#define TK_NK_EQ 109
#define TK_USING 110
#define TK_USING 110
#define TK_TAGS 111
#define TK_TAGS 111
#define TK_BOOL 112
#define TK_BOOL 112
#define TK_TINYINT 113
#define TK_TINYINT 113
#define TK_SMALLINT 114
#define TK_SMALLINT 114
#define TK_INT 115
#define TK_INT 115
#define TK_INTEGER 116
#define TK_INTEGER 116
#define TK_BIGINT 117
#define TK_BIGINT 117
#define TK_FLOAT 118
#define TK_FLOAT 118
#define TK_DOUBLE 119
#define TK_DOUBLE 119
#define TK_BINARY 120
#define TK_BINARY 120
#define TK_NCHAR 121
#define TK_NCHAR 121
#define TK_UNSIGNED 122
#define TK_UNSIGNED 122
#define TK_JSON 123
#define TK_JSON 123
#define TK_VARCHAR 124
#define TK_VARCHAR 124
#define TK_MEDIUMBLOB 125
#define TK_MEDIUMBLOB 125
#define TK_BLOB 126
#define TK_BLOB 126
#define TK_VARBINARY 127
#define TK_VARBINARY 127
#define TK_DECIMAL 128
#define TK_DECIMAL 128
#define TK_COMMENT 129
#define TK_COMMENT 129
#define TK_MAX_DELAY 130
#define TK_MAX_DELAY 130
#define TK_WATERMARK 131
#define TK_WATERMARK 131
#define TK_ROLLUP 132
#define TK_ROLLUP 132
#define TK_TTL 133
#define TK_TTL 133
#define TK_SMA 134
#define TK_SMA 134
#define TK_DELETE_MARK 135
#define TK_DELETE_MARK 135
#define TK_FIRST 136
#define TK_FIRST 136
#define TK_LAST 137
#define TK_LAST 137
#define TK_SHOW 138
#define TK_SHOW 138
#define TK_PRIVILEGES 139
#define TK_PRIVILEGES 139
#define TK_DATABASES 140
#define TK_DATABASES 140
#define TK_TABLES 141
#define TK_TABLES 141
#define TK_STABLES 142
#define TK_STABLES 142
#define TK_MNODES 143
#define TK_MNODES 143
#define TK_QNODES 144
#define TK_QNODES 144
#define TK_FUNCTIONS 145
#define TK_FUNCTIONS 145
#define TK_INDEXES 146
#define TK_INDEXES 146
#define TK_ACCOUNTS 147
#define TK_ACCOUNTS 147
#define TK_APPS 148
#define TK_APPS 148
#define TK_CONNECTIONS 149
#define TK_CONNECTIONS 149
#define TK_LICENCES 150
#define TK_LICENCES 150
#define TK_GRANTS 151
#define TK_GRANTS 151
#define TK_QUERIES 152
#define TK_QUERIES 152
#define TK_SCORES 153
#define TK_SCORES 153
#define TK_TOPICS 154
#define TK_TOPICS 154
#define TK_VARIABLES 155
#define TK_VARIABLES 155
#define TK_CLUSTER 156
#define TK_CLUSTER 156
#define TK_BNODES 157
#define TK_BNODES 157
#define TK_SNODES 158
#define TK_SNODES 158
#define TK_TRANSACTIONS 159
#define TK_TRANSACTIONS 159
#define TK_DISTRIBUTED 160
#define TK_DISTRIBUTED 160
#define TK_CONSUMERS 161
#define TK_CONSUMERS 161
#define TK_SUBSCRIPTIONS 162
#define TK_SUBSCRIPTIONS 162
#define TK_VNODES 163
#define TK_VNODES 163
#define TK_ALIVE 164
#define TK_ALIVE 164
#define TK_LIKE 165
#define TK_LIKE 165
#define TK_TBNAME 166
#define TK_TBNAME 166
#define TK_QTAGS 167
#define TK_QTAGS 167
#define TK_AS 168
#define TK_AS 168
#define TK_INDEX 169
#define TK_INDEX 169
#define TK_FUNCTION 170
#define TK_FUNCTION 170
#define TK_INTERVAL 171
#define TK_INTERVAL 171
#define TK_COUNT 172
#define TK_COUNT 172
#define TK_LAST_ROW 173
#define TK_LAST_ROW 173
#define TK_TOPIC 174
#define TK_TOPIC 174
#define TK_META 175
#define TK_META 175
#define TK_CONSUMER 176
#define TK_CONSUMER 176
#define TK_GROUP 177
#define TK_GROUP 177
#define TK_DESC 178
#define TK_DESC 178
#define TK_DESCRIBE 179
#define TK_DESCRIBE 179
#define TK_RESET 180
#define TK_RESET 180
#define TK_QUERY 181
#define TK_QUERY 181
#define TK_CACHE 182
#define TK_CACHE 182
#define TK_EXPLAIN 183
#define TK_EXPLAIN 183
#define TK_ANALYZE 184
#define TK_ANALYZE 184
#define TK_VERBOSE 185
#define TK_VERBOSE 185
#define TK_NK_BOOL 186
#define TK_NK_BOOL 186
#define TK_RATIO 187
#define TK_RATIO 187
#define TK_NK_FLOAT 188
#define TK_NK_FLOAT 188
#define TK_OUTPUTTYPE 189
#define TK_OUTPUTTYPE 189
#define TK_AGGREGATE 190
#define TK_AGGREGATE 190
#define TK_BUFSIZE 191
#define TK_BUFSIZE 191
#define TK_LANGUAGE 192
#define TK_LANGUAGE 192
#define TK_REPLACE 193
#define TK_REPLACE 193
#define TK_STREAM 194
#define TK_STREAM 194
#define TK_INTO 195
#define TK_INTO 195
#define TK_TRIGGER 196
#define TK_TRIGGER 196
#define TK_AT_ONCE 197
#define TK_AT_ONCE 197
#define TK_WINDOW_CLOSE 198
#define TK_WINDOW_CLOSE 198
#define TK_IGNORE 199
#define TK_IGNORE 199
#define TK_EXPIRED 200
#define TK_EXPIRED 200
#define TK_FILL_HISTORY 201
#define TK_FILL_HISTORY 201
#define TK_UPDATE 202
#define TK_UPDATE 202
#define TK_SUBTABLE 203
#define TK_SUBTABLE 203
#define TK_KILL 204
#define TK_KILL 204
#define TK_CONNECTION 205
#define TK_CONNECTION 205
#define TK_TRANSACTION 206
#define TK_TRANSACTION 206
#define TK_BALANCE 207
#define TK_BALANCE 207
#define TK_VGROUP 208
#define TK_VGROUP 208
#define TK_LEADER 209
#define TK_LEADER 209
#define TK_MERGE 210
#define TK_MERGE 210
#define TK_REDISTRIBUTE 211
#define TK_REDISTRIBUTE 211
#define TK_SPLIT 212
#define TK_SPLIT 212
#define TK_DELETE 213
#define TK_DELETE 213
#define TK_INSERT 214
#define TK_INSERT 214
#define TK_NULL 215
#define TK_NULL 215
#define TK_NK_QUESTION 216
#define TK_NK_QUESTION 216
#define TK_NK_ARROW 217
#define TK_NK_ARROW 217
#define TK_ROWTS 218
#define TK_ROWTS 218
#define TK_QSTART 219
#define TK_QSTART 219
#define TK_QEND 220
#define TK_QEND 220
#define TK_QDURATION 221
#define TK_QDURATION 221
#define TK_WSTART 222
#define TK_WSTART 222
#define TK_WEND 223
#define TK_WEND 223
#define TK_WDURATION 224
#define TK_WDURATION 224
#define TK_IROWTS 225
#define TK_IROWTS 225
#define TK_ISFILLED 226
#define TK_ISFILLED 226
#define TK_CAST 227
#define TK_CAST 227
#define TK_NOW 228
#define TK_NOW 228
#define TK_TODAY 229
#define TK_TODAY 229
#define TK_TIMEZONE 230
#define TK_TIMEZONE 230
#define TK_CLIENT_VERSION 231
#define TK_CLIENT_VERSION 231
#define TK_SERVER_VERSION 232
#define TK_SERVER_VERSION 232
#define TK_SERVER_STATUS 233
#define TK_SERVER_STATUS 233
#define TK_CURRENT_USER 234
#define TK_CURRENT_USER 234
#define TK_CASE 235
#define TK_CASE 235
#define TK_WHEN 236
#define TK_WHEN 236
#define TK_THEN 237
#define TK_THEN 237
#define TK_ELSE 238
#define TK_ELSE 238
#define TK_BETWEEN 239
#define TK_BETWEEN 239
#define TK_IS 240
#define TK_IS 240
#define TK_NK_LT 241
#define TK_NK_LT 241
#define TK_NK_GT 242
#define TK_NK_GT 242
#define TK_NK_LE 243
#define TK_NK_LE 243
#define TK_NK_GE 244
#define TK_NK_GE 244
#define TK_NK_NE 245
#define TK_NK_NE 245
#define TK_MATCH 246
#define TK_MATCH 246
#define TK_NMATCH 247
#define TK_NMATCH 247
#define TK_CONTAINS 248
#define TK_CONTAINS 248
#define TK_IN 249
#define TK_IN 249
#define TK_JOIN 250
#define TK_JOIN 250
#define TK_INNER 251
#define TK_INNER 251
#define TK_SELECT 252
#define TK_SELECT 252
#define TK_DISTINCT 253
#define TK_DISTINCT 253
#define TK_WHERE 254
#define TK_WHERE 254
#define TK_PARTITION 255
#define TK_PARTITION 255
#define TK_BY 256
#define TK_BY 256
#define TK_SESSION 257
#define TK_SESSION 257
#define TK_STATE_WINDOW 258
#define TK_STATE_WINDOW 258
#define TK_EVENT_WINDOW 259
#define TK_EVENT_WINDOW 259
#define TK_SLIDING 260
#define TK_SLIDING 260
#define TK_FILL 261
#define TK_FILL 261
#define TK_VALUE 262
#define TK_VALUE 262
#define TK_VALUE_F 263
#define TK_VALUE_F 263
#define TK_NONE 264
#define TK_NONE 264
#define TK_PREV 265
#define TK_PREV 265
#define TK_NULL_F 266
#define TK_NULL_F 266
#define TK_LINEAR 267
#define TK_LINEAR 267
#define TK_NEXT 268
#define TK_NEXT 268
#define TK_HAVING 269
#define TK_HAVING 269
#define TK_RANGE 270
#define TK_RANGE 270
#define TK_EVERY 271
#define TK_EVERY 271
#define TK_ORDER 272
#define TK_ORDER 272
#define TK_SLIMIT 273
#define TK_SLIMIT 273
#define TK_SOFFSET 274
#define TK_SOFFSET 274
#define TK_LIMIT 275
#define TK_LIMIT 275
#define TK_OFFSET 276
#define TK_OFFSET 276
#define TK_ASC 277
#define TK_ASC 277
#define TK_NULLS 278
#define TK_NULLS 278
#define TK_ABORT 279
#define TK_ABORT 279
#define TK_AFTER 280
#define TK_AFTER 280
#define TK_ATTACH 281
#define TK_ATTACH 281
#define TK_BEFORE 282
#define TK_BEFORE 282
#define TK_BEGIN 283
#define TK_BEGIN 283
#define TK_BITAND 284
#define TK_BITAND 284
#define TK_BITNOT 285
#define TK_BITNOT 285
#define TK_BITOR 286
#define TK_BITOR 286
#define TK_BLOCKS 287
#define TK_BLOCKS 287
#define TK_CHANGE 288
#define TK_CHANGE 288
#define TK_COMMA 289
#define TK_COMMA 289
#define TK_CONCAT 290
#define TK_CONCAT 290
#define TK_CONFLICT 291
#define TK_CONFLICT 291
#define TK_COPY 292
#define TK_COPY 292
#define TK_DEFERRED 293
#define TK_DEFERRED 293
#define TK_DELIMITERS 294
#define TK_DELIMITERS 294
#define TK_DETACH 295
#define TK_DETACH 295
#define TK_DIVIDE 296
#define TK_DIVIDE 296
#define TK_DOT 297
#define TK_DOT 297
#define TK_EACH 298
#define TK_EACH 298
#define TK_FAIL 299
#define TK_FAIL 299
#define TK_FILE 300
#define TK_FILE 300
#define TK_FOR 301
#define TK_FOR 301
#define TK_GLOB 302
#define TK_GLOB 302
#define TK_ID 303
#define TK_ID 303
#define TK_IMMEDIATE 304
#define TK_IMMEDIATE 304
#define TK_IMPORT 305
#define TK_IMPORT 305
#define TK_INITIALLY 306
#define TK_INITIALLY 306
#define TK_INSTEAD 307
#define TK_INSTEAD 307
#define TK_ISNULL 308
#define TK_ISNULL 308
#define TK_KEY 309
#define TK_KEY 309
#define TK_MODULES 310
#define TK_MODULES 310
#define TK_NK_BITNOT 311
#define TK_NK_BITNOT 311
#define TK_NK_SEMI 312
#define TK_NK_SEMI 312
#define TK_NOTNULL 313
#define TK_NOTNULL 313
#define TK_OF 314
#define TK_OF 314
#define TK_PLUS 315
#define TK_PLUS 315
#define TK_PRIVILEGE 316
#define TK_PRIVILEGE 316
#define TK_RAISE 317
#define TK_RAISE 317
#define TK_RESTRICT 318
#define TK_RESTRICT 318
#define TK_ROW 319
#define TK_ROW 319
#define TK_SEMI 320
#define TK_SEMI 320
#define TK_STAR 321
#define TK_STAR 321
#define TK_STATEMENT 322
#define TK_STATEMENT 322
#define TK_STRICT 323
#define TK_STRICT 323
#define TK_STRING 324
#define TK_STRING 324
#define TK_TIMES 325
#define TK_TIMES 325
#define TK_VALUES 326
#define TK_VALUES 326
#define TK_VARIABLE 327
#define TK_VARIABLE 327
#define TK_VIEW 328
#define TK_VIEW 328
#define TK_WAL 329
#define TK_WAL 329
#define TK_NK_SPACE 600
#define TK_NK_SPACE 600
#define TK_NK_COMMENT 601
#define TK_NK_COMMENT 601
...
...
include/util/tdef.h
浏览文件 @
3c2fc48e
...
@@ -368,11 +368,11 @@ typedef enum ELogicConditionType {
...
@@ -368,11 +368,11 @@ typedef enum ELogicConditionType {
#define TSDB_MIN_STT_TRIGGER 1
#define TSDB_MIN_STT_TRIGGER 1
#define TSDB_MAX_STT_TRIGGER 16
#define TSDB_MAX_STT_TRIGGER 16
#define TSDB_DEFAULT_SST_TRIGGER 1
#define TSDB_DEFAULT_SST_TRIGGER 1
#define TSDB_MIN_HASH_PREFIX
0
#define TSDB_MIN_HASH_PREFIX
(2 - TSDB_TABLE_NAME_LEN)
#define TSDB_MAX_HASH_PREFIX
128
#define TSDB_MAX_HASH_PREFIX
(TSDB_TABLE_NAME_LEN - 2)
#define TSDB_DEFAULT_HASH_PREFIX 0
#define TSDB_DEFAULT_HASH_PREFIX 0
#define TSDB_MIN_HASH_SUFFIX
0
#define TSDB_MIN_HASH_SUFFIX
(2 - TSDB_TABLE_NAME_LEN)
#define TSDB_MAX_HASH_SUFFIX
128
#define TSDB_MAX_HASH_SUFFIX
(TSDB_TABLE_NAME_LEN - 2)
#define TSDB_DEFAULT_HASH_SUFFIX 0
#define TSDB_DEFAULT_HASH_SUFFIX 0
#define TSDB_DB_MIN_WAL_RETENTION_PERIOD -1
#define TSDB_DB_MIN_WAL_RETENTION_PERIOD -1
...
...
include/util/tutil.h
浏览文件 @
3c2fc48e
...
@@ -81,14 +81,22 @@ static FORCE_INLINE void taosEncryptPass_c(uint8_t *inBuf, size_t len, char *tar
...
@@ -81,14 +81,22 @@ static FORCE_INLINE void taosEncryptPass_c(uint8_t *inBuf, size_t len, char *tar
static
FORCE_INLINE
int32_t
taosGetTbHashVal
(
const
char
*
tbname
,
int32_t
tblen
,
int32_t
method
,
int32_t
prefix
,
static
FORCE_INLINE
int32_t
taosGetTbHashVal
(
const
char
*
tbname
,
int32_t
tblen
,
int32_t
method
,
int32_t
prefix
,
int32_t
suffix
)
{
int32_t
suffix
)
{
if
(
prefix
==
0
&&
suffix
==
0
)
{
if
(
(
prefix
==
0
&&
suffix
==
0
)
||
(
tblen
<=
(
prefix
+
suffix
))
||
(
tblen
<=
-
1
*
(
prefix
+
suffix
))
||
prefix
*
suffix
<
0
)
{
return
MurmurHash3_32
(
tbname
,
tblen
);
return
MurmurHash3_32
(
tbname
,
tblen
);
}
else
if
(
prefix
>
0
||
suffix
>
0
)
{
return
MurmurHash3_32
(
tbname
+
prefix
,
tblen
-
prefix
-
suffix
);
}
else
{
}
else
{
if
(
tblen
<=
(
prefix
+
suffix
))
{
char
tbName
[
TSDB_TABLE_FNAME_LEN
];
return
MurmurHash3_32
(
tbname
,
tblen
);
int32_t
offset
=
0
;
}
else
{
if
(
prefix
<
0
)
{
return
MurmurHash3_32
(
tbname
+
prefix
,
tblen
-
prefix
-
suffix
);
offset
=
-
1
*
prefix
;
strncpy
(
tbName
,
tbname
,
offset
);
}
}
if
(
suffix
<
0
)
{
strncpy
(
tbName
+
offset
,
tbname
+
tblen
+
suffix
,
-
1
*
suffix
);
offset
+=
-
1
*
suffix
;
}
return
MurmurHash3_32
(
tbName
,
offset
);
}
}
}
}
...
...
source/dnode/mnode/impl/src/mndDb.c
浏览文件 @
3c2fc48e
...
@@ -373,6 +373,8 @@ static int32_t mndCheckDbCfg(SMnode *pMnode, SDbCfg *pCfg) {
...
@@ -373,6 +373,8 @@ static int32_t mndCheckDbCfg(SMnode *pMnode, SDbCfg *pCfg) {
if
(
pCfg
->
sstTrigger
<
TSDB_MIN_STT_TRIGGER
||
pCfg
->
sstTrigger
>
TSDB_MAX_STT_TRIGGER
)
return
-
1
;
if
(
pCfg
->
sstTrigger
<
TSDB_MIN_STT_TRIGGER
||
pCfg
->
sstTrigger
>
TSDB_MAX_STT_TRIGGER
)
return
-
1
;
if
(
pCfg
->
hashPrefix
<
TSDB_MIN_HASH_PREFIX
||
pCfg
->
hashPrefix
>
TSDB_MAX_HASH_PREFIX
)
return
-
1
;
if
(
pCfg
->
hashPrefix
<
TSDB_MIN_HASH_PREFIX
||
pCfg
->
hashPrefix
>
TSDB_MAX_HASH_PREFIX
)
return
-
1
;
if
(
pCfg
->
hashSuffix
<
TSDB_MIN_HASH_SUFFIX
||
pCfg
->
hashSuffix
>
TSDB_MAX_HASH_SUFFIX
)
return
-
1
;
if
(
pCfg
->
hashSuffix
<
TSDB_MIN_HASH_SUFFIX
||
pCfg
->
hashSuffix
>
TSDB_MAX_HASH_SUFFIX
)
return
-
1
;
if
((
pCfg
->
hashSuffix
*
pCfg
->
hashPrefix
)
<
0
)
return
-
1
;
if
((
pCfg
->
hashPrefix
+
pCfg
->
hashSuffix
)
>=
(
TSDB_TABLE_NAME_LEN
-
1
))
return
-
1
;
if
(
pCfg
->
tsdbPageSize
<
TSDB_MIN_TSDB_PAGESIZE
||
pCfg
->
tsdbPageSize
>
TSDB_MAX_TSDB_PAGESIZE
)
return
-
1
;
if
(
pCfg
->
tsdbPageSize
<
TSDB_MIN_TSDB_PAGESIZE
||
pCfg
->
tsdbPageSize
>
TSDB_MAX_TSDB_PAGESIZE
)
return
-
1
;
if
(
taosArrayGetSize
(
pCfg
->
pRetensions
)
!=
pCfg
->
numOfRetensions
)
return
-
1
;
if
(
taosArrayGetSize
(
pCfg
->
pRetensions
)
!=
pCfg
->
numOfRetensions
)
return
-
1
;
...
@@ -409,8 +411,6 @@ static void mndSetDefaultDbCfg(SDbCfg *pCfg) {
...
@@ -409,8 +411,6 @@ static void mndSetDefaultDbCfg(SDbCfg *pCfg) {
if
(
pCfg
->
walRollPeriod
<
0
)
pCfg
->
walRollPeriod
=
TSDB_REPS_DEF_DB_WAL_ROLL_PERIOD
;
if
(
pCfg
->
walRollPeriod
<
0
)
pCfg
->
walRollPeriod
=
TSDB_REPS_DEF_DB_WAL_ROLL_PERIOD
;
if
(
pCfg
->
walSegmentSize
<
0
)
pCfg
->
walSegmentSize
=
TSDB_DEFAULT_DB_WAL_SEGMENT_SIZE
;
if
(
pCfg
->
walSegmentSize
<
0
)
pCfg
->
walSegmentSize
=
TSDB_DEFAULT_DB_WAL_SEGMENT_SIZE
;
if
(
pCfg
->
sstTrigger
<=
0
)
pCfg
->
sstTrigger
=
TSDB_DEFAULT_SST_TRIGGER
;
if
(
pCfg
->
sstTrigger
<=
0
)
pCfg
->
sstTrigger
=
TSDB_DEFAULT_SST_TRIGGER
;
if
(
pCfg
->
hashPrefix
<
0
)
pCfg
->
hashPrefix
=
TSDB_DEFAULT_HASH_PREFIX
;
if
(
pCfg
->
hashSuffix
<
0
)
pCfg
->
hashSuffix
=
TSDB_DEFAULT_HASH_SUFFIX
;
if
(
pCfg
->
tsdbPageSize
<=
0
)
pCfg
->
tsdbPageSize
=
TSDB_DEFAULT_TSDB_PAGESIZE
;
if
(
pCfg
->
tsdbPageSize
<=
0
)
pCfg
->
tsdbPageSize
=
TSDB_DEFAULT_TSDB_PAGESIZE
;
}
}
...
@@ -553,6 +553,10 @@ static int32_t mndCreateDb(SMnode *pMnode, SRpcMsg *pReq, SCreateDbReq *pCreate,
...
@@ -553,6 +553,10 @@ static int32_t mndCreateDb(SMnode *pMnode, SRpcMsg *pReq, SCreateDbReq *pCreate,
int32_t
dbLen
=
strlen
(
dbObj
.
name
)
+
1
;
int32_t
dbLen
=
strlen
(
dbObj
.
name
)
+
1
;
mInfo
(
"db:%s, hashPrefix adjust from %d to %d"
,
dbObj
.
name
,
dbObj
.
cfg
.
hashPrefix
,
dbObj
.
cfg
.
hashPrefix
+
dbLen
);
mInfo
(
"db:%s, hashPrefix adjust from %d to %d"
,
dbObj
.
name
,
dbObj
.
cfg
.
hashPrefix
,
dbObj
.
cfg
.
hashPrefix
+
dbLen
);
dbObj
.
cfg
.
hashPrefix
+=
dbLen
;
dbObj
.
cfg
.
hashPrefix
+=
dbLen
;
}
else
if
(
dbObj
.
cfg
.
hashPrefix
<
0
)
{
int32_t
dbLen
=
strlen
(
dbObj
.
name
)
+
1
;
mInfo
(
"db:%s, hashPrefix adjust from %d to %d"
,
dbObj
.
name
,
dbObj
.
cfg
.
hashPrefix
,
dbObj
.
cfg
.
hashPrefix
-
dbLen
);
dbObj
.
cfg
.
hashPrefix
-=
dbLen
;
}
}
SVgObj
*
pVgroups
=
NULL
;
SVgObj
*
pVgroups
=
NULL
;
...
@@ -1788,6 +1792,8 @@ static void mndDumpDbInfoData(SMnode *pMnode, SSDataBlock *pBlock, SDbObj *pDb,
...
@@ -1788,6 +1792,8 @@ static void mndDumpDbInfoData(SMnode *pMnode, SSDataBlock *pBlock, SDbObj *pDb,
int16_t
hashPrefix
=
pDb
->
cfg
.
hashPrefix
;
int16_t
hashPrefix
=
pDb
->
cfg
.
hashPrefix
;
if
(
hashPrefix
>
0
)
{
if
(
hashPrefix
>
0
)
{
hashPrefix
=
pDb
->
cfg
.
hashPrefix
-
strlen
(
pDb
->
name
)
-
1
;
hashPrefix
=
pDb
->
cfg
.
hashPrefix
-
strlen
(
pDb
->
name
)
-
1
;
}
else
if
(
hashPrefix
<
0
)
{
hashPrefix
=
pDb
->
cfg
.
hashPrefix
+
strlen
(
pDb
->
name
)
+
1
;
}
}
colDataSetVal
(
pColInfo
,
rows
,
(
const
char
*
)
&
hashPrefix
,
false
);
colDataSetVal
(
pColInfo
,
rows
,
(
const
char
*
)
&
hashPrefix
,
false
);
...
...
source/libs/command/src/command.c
浏览文件 @
3c2fc48e
...
@@ -278,7 +278,12 @@ static void setCreateDBResultIntoDataBlock(SSDataBlock* pBlock, char* dbName, ch
...
@@ -278,7 +278,12 @@ static void setCreateDBResultIntoDataBlock(SSDataBlock* pBlock, char* dbName, ch
char
*
retentions
=
buildRetension
(
pCfg
->
pRetensions
);
char
*
retentions
=
buildRetension
(
pCfg
->
pRetensions
);
int32_t
dbFNameLen
=
strlen
(
dbFName
);
int32_t
dbFNameLen
=
strlen
(
dbFName
);
int32_t
hashPrefix
=
(
pCfg
->
hashPrefix
>
(
dbFNameLen
+
1
))
?
(
pCfg
->
hashPrefix
-
dbFNameLen
-
1
)
:
0
;
int32_t
hashPrefix
=
0
;
if
(
pCfg
->
hashPrefix
>
0
)
{
hashPrefix
=
pCfg
->
hashPrefix
-
dbFNameLen
-
1
;
}
else
if
(
pCfg
->
hashPrefix
<
0
)
{
hashPrefix
=
pCfg
->
hashPrefix
+
dbFNameLen
+
1
;
}
len
+=
sprintf
(
len
+=
sprintf
(
buf2
+
VARSTR_HEADER_SIZE
,
buf2
+
VARSTR_HEADER_SIZE
,
...
...
source/libs/parser/inc/sql.y
100644 → 100755
浏览文件 @
3c2fc48e
...
@@ -221,8 +221,8 @@ db_options(A) ::= db_options(B) WAL_RETENTION_SIZE NK_MINUS(D) NK_INTEGER(C).
...
@@ -221,8 +221,8 @@ 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_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) WAL_SEGMENT_SIZE NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_WAL_SEGMENT_SIZE, &C); }
db_options(A) ::= db_options(B) STT_TRIGGER NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_STT_TRIGGER, &C); }
db_options(A) ::= db_options(B) STT_TRIGGER NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_STT_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_PREFIX
signed(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); }
db_options(A) ::= db_options(B) TABLE_SUFFIX
signed(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_TABLE_SUFFIX,
C); }
alter_db_options(A) ::= alter_db_option(B). { A = createAlterDatabaseOptions(pCxt); A = setAlterDatabaseOption(pCxt, A, &B); }
alter_db_options(A) ::= alter_db_option(B). { A = createAlterDatabaseOptions(pCxt); A = setAlterDatabaseOption(pCxt, A, &B); }
alter_db_options(A) ::= alter_db_options(B) alter_db_option(C). { A = setAlterDatabaseOption(pCxt, B, &C); }
alter_db_options(A) ::= alter_db_options(B) alter_db_option(C). { A = setAlterDatabaseOption(pCxt, B, &C); }
...
...
source/libs/parser/src/parAstCreater.c
浏览文件 @
3c2fc48e
...
@@ -1024,12 +1024,26 @@ static SNode* setDatabaseOptionImpl(SAstCreateContext* pCxt, SNode* pOptions, ED
...
@@ -1024,12 +1024,26 @@ static SNode* setDatabaseOptionImpl(SAstCreateContext* pCxt, SNode* pOptions, ED
case
DB_OPTION_STT_TRIGGER
:
case
DB_OPTION_STT_TRIGGER
:
pDbOptions
->
sstTrigger
=
taosStr2Int32
(((
SToken
*
)
pVal
)
->
z
,
NULL
,
10
);
pDbOptions
->
sstTrigger
=
taosStr2Int32
(((
SToken
*
)
pVal
)
->
z
,
NULL
,
10
);
break
;
break
;
case
DB_OPTION_TABLE_PREFIX
:
case
DB_OPTION_TABLE_PREFIX
:
{
pDbOptions
->
tablePrefix
=
taosStr2Int32
(((
SToken
*
)
pVal
)
->
z
,
NULL
,
10
);
SValueNode
*
pNode
=
(
SValueNode
*
)
pVal
;
if
(
TSDB_DATA_TYPE_BIGINT
==
pNode
->
node
.
resType
.
type
||
TSDB_DATA_TYPE_UBIGINT
==
pNode
->
node
.
resType
.
type
)
{
pDbOptions
->
tablePrefix
=
taosStr2Int32
(
pNode
->
literal
,
NULL
,
10
);
}
else
{
snprintf
(
pCxt
->
pQueryCxt
->
pMsg
,
pCxt
->
pQueryCxt
->
msgLen
,
"invalid table_prefix data type"
);
pCxt
->
errCode
=
TSDB_CODE_PAR_SYNTAX_ERROR
;
}
break
;
break
;
case
DB_OPTION_TABLE_SUFFIX
:
}
pDbOptions
->
tableSuffix
=
taosStr2Int32
(((
SToken
*
)
pVal
)
->
z
,
NULL
,
10
);
case
DB_OPTION_TABLE_SUFFIX
:{
SValueNode
*
pNode
=
(
SValueNode
*
)
pVal
;
if
(
TSDB_DATA_TYPE_BIGINT
==
pNode
->
node
.
resType
.
type
||
TSDB_DATA_TYPE_UBIGINT
==
pNode
->
node
.
resType
.
type
)
{
pDbOptions
->
tableSuffix
=
taosStr2Int32
(
pNode
->
literal
,
NULL
,
10
);
}
else
{
snprintf
(
pCxt
->
pQueryCxt
->
pMsg
,
pCxt
->
pQueryCxt
->
msgLen
,
"invalid table_suffix data type"
);
pCxt
->
errCode
=
TSDB_CODE_PAR_SYNTAX_ERROR
;
}
break
;
break
;
}
default:
default:
break
;
break
;
}
}
...
...
source/libs/parser/src/parTranslater.c
浏览文件 @
3c2fc48e
...
@@ -4177,6 +4177,34 @@ static int32_t checkDbRetentionsOption(STranslateContext* pCxt, SNodeList* pRete
...
@@ -4177,6 +4177,34 @@ static int32_t checkDbRetentionsOption(STranslateContext* pCxt, SNodeList* pRete
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
static
int32_t
checkDbTbPrefixSuffixOptions
(
STranslateContext
*
pCxt
,
int32_t
tbPrefix
,
int32_t
tbSuffix
)
{
if
(
tbPrefix
<
TSDB_MIN_HASH_PREFIX
||
tbPrefix
>
TSDB_MAX_HASH_PREFIX
)
{
return
generateSyntaxErrMsgExt
(
&
pCxt
->
msgBuf
,
TSDB_CODE_PAR_INVALID_DB_OPTION
,
"Invalid option table_prefix: %d valid range: [%"
PRId64
", %"
PRId64
"]"
,
tbPrefix
,
TSDB_MIN_HASH_PREFIX
,
TSDB_MAX_HASH_PREFIX
);
}
if
(
tbSuffix
<
TSDB_MIN_HASH_SUFFIX
||
tbSuffix
>
TSDB_MAX_HASH_SUFFIX
)
{
return
generateSyntaxErrMsgExt
(
&
pCxt
->
msgBuf
,
TSDB_CODE_PAR_INVALID_DB_OPTION
,
"Invalid option table_suffix: %d valid range: [%"
PRId64
", %"
PRId64
"]"
,
tbSuffix
,
TSDB_MIN_HASH_SUFFIX
,
TSDB_MAX_HASH_SUFFIX
);
}
if
((
tbPrefix
*
tbSuffix
)
<
0
)
{
return
generateSyntaxErrMsgExt
(
&
pCxt
->
msgBuf
,
TSDB_CODE_PAR_INVALID_DB_OPTION
,
"Invalid option table_prefix & table_suffix: mixed usage not allowed"
);
}
if
((
tbPrefix
+
tbSuffix
)
>=
(
TSDB_TABLE_NAME_LEN
-
1
))
{
return
generateSyntaxErrMsgExt
(
&
pCxt
->
msgBuf
,
TSDB_CODE_PAR_INVALID_DB_OPTION
,
"Invalid option table_prefix & table_suffix: exceed max table name length"
);
}
return
TSDB_CODE_SUCCESS
;
}
static
int32_t
checkOptionsDependency
(
STranslateContext
*
pCxt
,
const
char
*
pDbName
,
SDatabaseOptions
*
pOptions
)
{
static
int32_t
checkOptionsDependency
(
STranslateContext
*
pCxt
,
const
char
*
pDbName
,
SDatabaseOptions
*
pOptions
)
{
int32_t
daysPerFile
=
pOptions
->
daysPerFile
;
int32_t
daysPerFile
=
pOptions
->
daysPerFile
;
int64_t
daysToKeep0
=
pOptions
->
keep
[
0
];
int64_t
daysToKeep0
=
pOptions
->
keep
[
0
];
...
@@ -4284,10 +4312,7 @@ static int32_t checkDatabaseOptions(STranslateContext* pCxt, const char* pDbName
...
@@ -4284,10 +4312,7 @@ static int32_t checkDatabaseOptions(STranslateContext* pCxt, const char* pDbName
code
=
checkDbRangeOption
(
pCxt
,
"sstTrigger"
,
pOptions
->
sstTrigger
,
TSDB_MIN_STT_TRIGGER
,
TSDB_MAX_STT_TRIGGER
);
code
=
checkDbRangeOption
(
pCxt
,
"sstTrigger"
,
pOptions
->
sstTrigger
,
TSDB_MIN_STT_TRIGGER
,
TSDB_MAX_STT_TRIGGER
);
}
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
checkDbRangeOption
(
pCxt
,
"tablePrefix"
,
pOptions
->
tablePrefix
,
TSDB_MIN_HASH_PREFIX
,
TSDB_MAX_HASH_PREFIX
);
code
=
checkDbTbPrefixSuffixOptions
(
pCxt
,
pOptions
->
tablePrefix
,
pOptions
->
tableSuffix
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
checkDbRangeOption
(
pCxt
,
"tableSuffix"
,
pOptions
->
tableSuffix
,
TSDB_MIN_HASH_SUFFIX
,
TSDB_MAX_HASH_SUFFIX
);
}
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
checkOptionsDependency
(
pCxt
,
pDbName
,
pOptions
);
code
=
checkOptionsDependency
(
pCxt
,
pDbName
,
pOptions
);
...
...
source/libs/parser/src/sql.c
浏览文件 @
3c2fc48e
因为 它太大了无法显示 source diff 。你可以改为
查看blob
。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录