Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
ccaf6f8a
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看板
提交
ccaf6f8a
编写于
9月 03, 2022
作者:
X
Xiaoyu Wang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: add database option 'table_prefix' and 'table_suffix'
上级
de09dadc
变更
11
展开全部
隐藏空白更改
内联
并排
Showing
11 changed file
with
3301 addition
and
3259 deletion
+3301
-3259
include/common/ttokendef.h
include/common/ttokendef.h
+220
-218
include/libs/nodes/cmdnodes.h
include/libs/nodes/cmdnodes.h
+2
-0
source/libs/parser/inc/parAst.h
source/libs/parser/inc/parAst.h
+3
-1
source/libs/parser/inc/sql.y
source/libs/parser/inc/sql.y
+2
-0
source/libs/parser/src/parAstCreater.c
source/libs/parser/src/parAstCreater.c
+10
-0
source/libs/parser/src/parTokenizer.c
source/libs/parser/src/parTokenizer.c
+2
-0
source/libs/parser/src/parTranslater.c
source/libs/parser/src/parTranslater.c
+9
-1
source/libs/parser/src/sql.c
source/libs/parser/src/sql.c
+3037
-3033
source/libs/parser/test/mockCatalog.cpp
source/libs/parser/test/mockCatalog.cpp
+1
-1
source/libs/parser/test/parInitialCTest.cpp
source/libs/parser/test/parInitialCTest.cpp
+11
-1
tests/script/tsim/db/basic1.sim
tests/script/tsim/db/basic1.sim
+4
-4
未找到文件。
include/common/ttokendef.h
浏览文件 @
ccaf6f8a
...
...
@@ -103,224 +103,226 @@
#define TK_WAL_ROLL_PERIOD 85
#define TK_WAL_SEGMENT_SIZE 86
#define TK_SST_TRIGGER 87
#define TK_NK_COLON 88
#define TK_TABLE 89
#define TK_NK_LP 90
#define TK_NK_RP 91
#define TK_STABLE 92
#define TK_ADD 93
#define TK_COLUMN 94
#define TK_MODIFY 95
#define TK_RENAME 96
#define TK_TAG 97
#define TK_SET 98
#define TK_NK_EQ 99
#define TK_USING 100
#define TK_TAGS 101
#define TK_COMMENT 102
#define TK_BOOL 103
#define TK_TINYINT 104
#define TK_SMALLINT 105
#define TK_INT 106
#define TK_INTEGER 107
#define TK_BIGINT 108
#define TK_FLOAT 109
#define TK_DOUBLE 110
#define TK_BINARY 111
#define TK_TIMESTAMP 112
#define TK_NCHAR 113
#define TK_UNSIGNED 114
#define TK_JSON 115
#define TK_VARCHAR 116
#define TK_MEDIUMBLOB 117
#define TK_BLOB 118
#define TK_VARBINARY 119
#define TK_DECIMAL 120
#define TK_MAX_DELAY 121
#define TK_WATERMARK 122
#define TK_ROLLUP 123
#define TK_TTL 124
#define TK_SMA 125
#define TK_FIRST 126
#define TK_LAST 127
#define TK_SHOW 128
#define TK_DATABASES 129
#define TK_TABLES 130
#define TK_STABLES 131
#define TK_MNODES 132
#define TK_MODULES 133
#define TK_QNODES 134
#define TK_FUNCTIONS 135
#define TK_INDEXES 136
#define TK_ACCOUNTS 137
#define TK_APPS 138
#define TK_CONNECTIONS 139
#define TK_LICENCES 140
#define TK_GRANTS 141
#define TK_QUERIES 142
#define TK_SCORES 143
#define TK_TOPICS 144
#define TK_VARIABLES 145
#define TK_BNODES 146
#define TK_SNODES 147
#define TK_CLUSTER 148
#define TK_TRANSACTIONS 149
#define TK_DISTRIBUTED 150
#define TK_CONSUMERS 151
#define TK_SUBSCRIPTIONS 152
#define TK_VNODES 153
#define TK_LIKE 154
#define TK_INDEX 155
#define TK_FUNCTION 156
#define TK_INTERVAL 157
#define TK_TOPIC 158
#define TK_AS 159
#define TK_WITH 160
#define TK_META 161
#define TK_CONSUMER 162
#define TK_GROUP 163
#define TK_DESC 164
#define TK_DESCRIBE 165
#define TK_RESET 166
#define TK_QUERY 167
#define TK_CACHE 168
#define TK_EXPLAIN 169
#define TK_ANALYZE 170
#define TK_VERBOSE 171
#define TK_NK_BOOL 172
#define TK_RATIO 173
#define TK_NK_FLOAT 174
#define TK_OUTPUTTYPE 175
#define TK_AGGREGATE 176
#define TK_BUFSIZE 177
#define TK_STREAM 178
#define TK_INTO 179
#define TK_TRIGGER 180
#define TK_AT_ONCE 181
#define TK_WINDOW_CLOSE 182
#define TK_IGNORE 183
#define TK_EXPIRED 184
#define TK_KILL 185
#define TK_CONNECTION 186
#define TK_TRANSACTION 187
#define TK_BALANCE 188
#define TK_VGROUP 189
#define TK_MERGE 190
#define TK_REDISTRIBUTE 191
#define TK_SPLIT 192
#define TK_DELETE 193
#define TK_INSERT 194
#define TK_NULL 195
#define TK_NK_QUESTION 196
#define TK_NK_ARROW 197
#define TK_ROWTS 198
#define TK_TBNAME 199
#define TK_QSTART 200
#define TK_QEND 201
#define TK_QDURATION 202
#define TK_WSTART 203
#define TK_WEND 204
#define TK_WDURATION 205
#define TK_CAST 206
#define TK_NOW 207
#define TK_TODAY 208
#define TK_TIMEZONE 209
#define TK_CLIENT_VERSION 210
#define TK_SERVER_VERSION 211
#define TK_SERVER_STATUS 212
#define TK_CURRENT_USER 213
#define TK_COUNT 214
#define TK_LAST_ROW 215
#define TK_BETWEEN 216
#define TK_IS 217
#define TK_NK_LT 218
#define TK_NK_GT 219
#define TK_NK_LE 220
#define TK_NK_GE 221
#define TK_NK_NE 222
#define TK_MATCH 223
#define TK_NMATCH 224
#define TK_CONTAINS 225
#define TK_IN 226
#define TK_JOIN 227
#define TK_INNER 228
#define TK_SELECT 229
#define TK_DISTINCT 230
#define TK_WHERE 231
#define TK_PARTITION 232
#define TK_BY 233
#define TK_SESSION 234
#define TK_STATE_WINDOW 235
#define TK_SLIDING 236
#define TK_FILL 237
#define TK_VALUE 238
#define TK_NONE 239
#define TK_PREV 240
#define TK_LINEAR 241
#define TK_NEXT 242
#define TK_HAVING 243
#define TK_RANGE 244
#define TK_EVERY 245
#define TK_ORDER 246
#define TK_SLIMIT 247
#define TK_SOFFSET 248
#define TK_LIMIT 249
#define TK_OFFSET 250
#define TK_ASC 251
#define TK_NULLS 252
#define TK_ABORT 253
#define TK_AFTER 254
#define TK_ATTACH 255
#define TK_BEFORE 256
#define TK_BEGIN 257
#define TK_BITAND 258
#define TK_BITNOT 259
#define TK_BITOR 260
#define TK_BLOCKS 261
#define TK_CHANGE 262
#define TK_COMMA 263
#define TK_COMPACT 264
#define TK_CONCAT 265
#define TK_CONFLICT 266
#define TK_COPY 267
#define TK_DEFERRED 268
#define TK_DELIMITERS 269
#define TK_DETACH 270
#define TK_DIVIDE 271
#define TK_DOT 272
#define TK_EACH 273
#define TK_END 274
#define TK_FAIL 275
#define TK_FILE 276
#define TK_FOR 277
#define TK_GLOB 278
#define TK_ID 279
#define TK_IMMEDIATE 280
#define TK_IMPORT 281
#define TK_INITIALLY 282
#define TK_INSTEAD 283
#define TK_ISNULL 284
#define TK_KEY 285
#define TK_NK_BITNOT 286
#define TK_NK_SEMI 287
#define TK_NOTNULL 288
#define TK_OF 289
#define TK_PLUS 290
#define TK_PRIVILEGE 291
#define TK_RAISE 292
#define TK_REPLACE 293
#define TK_RESTRICT 294
#define TK_ROW 295
#define TK_SEMI 296
#define TK_STAR 297
#define TK_STATEMENT 298
#define TK_STRING 299
#define TK_TIMES 300
#define TK_UPDATE 301
#define TK_VALUES 302
#define TK_VARIABLE 303
#define TK_VIEW 304
#define TK_WAL 305
#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_NK_SPACE 300
#define TK_NK_COMMENT 301
...
...
include/libs/nodes/cmdnodes.h
浏览文件 @
ccaf6f8a
...
...
@@ -82,6 +82,8 @@ typedef struct SDatabaseOptions {
bool
walRetentionSizeIsSet
;
bool
walRollPeriodIsSet
;
int32_t
sstTrigger
;
int32_t
tablePrefix
;
int32_t
tableSuffix
;
}
SDatabaseOptions
;
typedef
struct
SCreateDatabaseStmt
{
...
...
source/libs/parser/inc/parAst.h
浏览文件 @
ccaf6f8a
...
...
@@ -60,7 +60,9 @@ typedef enum EDatabaseOptionType {
DB_OPTION_WAL_RETENTION_SIZE
,
DB_OPTION_WAL_ROLL_PERIOD
,
DB_OPTION_WAL_SEGMENT_SIZE
,
DB_OPTION_SST_TRIGGER
DB_OPTION_SST_TRIGGER
,
DB_OPTION_TABLE_PREFIX
,
DB_OPTION_TABLE_SUFFIX
}
EDatabaseOptionType
;
typedef
enum
ETableOptionType
{
...
...
source/libs/parser/inc/sql.y
浏览文件 @
ccaf6f8a
...
...
@@ -208,6 +208,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_SEGMENT_SIZE NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_WAL_SEGMENT_SIZE, &C); }
db_options(A) ::= db_options(B) SST_TRIGGER NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_SST_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); }
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); }
...
...
source/libs/parser/src/parAstCreater.c
浏览文件 @
ccaf6f8a
...
...
@@ -836,6 +836,8 @@ SNode* createDefaultDatabaseOptions(SAstCreateContext* pCxt) {
updateWalOptionsDefault
(
pOptions
);
pOptions
->
walSegmentSize
=
TSDB_DEFAULT_DB_WAL_SEGMENT_SIZE
;
pOptions
->
sstTrigger
=
TSDB_DEFAULT_SST_TRIGGER
;
pOptions
->
tablePrefix
=
TSDB_DEFAULT_HASH_PREFIX
;
pOptions
->
tableSuffix
=
TSDB_DEFAULT_HASH_SUFFIX
;
return
(
SNode
*
)
pOptions
;
}
...
...
@@ -868,6 +870,8 @@ SNode* createAlterDatabaseOptions(SAstCreateContext* pCxt) {
pOptions
->
walRollPeriod
=
-
1
;
pOptions
->
walSegmentSize
=
-
1
;
pOptions
->
sstTrigger
=
-
1
;
pOptions
->
tablePrefix
=
-
1
;
pOptions
->
tableSuffix
=
-
1
;
return
(
SNode
*
)
pOptions
;
}
...
...
@@ -954,6 +958,12 @@ SNode* setDatabaseOption(SAstCreateContext* pCxt, SNode* pOptions, EDatabaseOpti
case
DB_OPTION_SST_TRIGGER
:
pDbOptions
->
sstTrigger
=
taosStr2Int32
(((
SToken
*
)
pVal
)
->
z
,
NULL
,
10
);
break
;
case
DB_OPTION_TABLE_PREFIX
:
pDbOptions
->
tablePrefix
=
taosStr2Int32
(((
SToken
*
)
pVal
)
->
z
,
NULL
,
10
);
break
;
case
DB_OPTION_TABLE_SUFFIX
:
pDbOptions
->
tableSuffix
=
taosStr2Int32
(((
SToken
*
)
pVal
)
->
z
,
NULL
,
10
);
break
;
default:
break
;
}
...
...
source/libs/parser/src/parTokenizer.c
浏览文件 @
ccaf6f8a
...
...
@@ -200,6 +200,8 @@ static SKeyword keywordTable[] = {
{
"SYSINFO"
,
TK_SYSINFO
},
{
"TABLE"
,
TK_TABLE
},
{
"TABLES"
,
TK_TABLES
},
{
"TABLE_PREFIX"
,
TK_TABLE_PREFIX
},
{
"TABLE_SUFFIX"
,
TK_TABLE_SUFFIX
},
{
"TAG"
,
TK_TAG
},
{
"TAGS"
,
TK_TAGS
},
{
"TBNAME"
,
TK_TBNAME
},
...
...
source/libs/parser/src/parTranslater.c
浏览文件 @
ccaf6f8a
...
...
@@ -3483,6 +3483,8 @@ static int32_t buildCreateDbReq(STranslateContext* pCxt, SCreateDatabaseStmt* pS
pReq
->
walRollPeriod
=
pStmt
->
pOptions
->
walRollPeriod
;
pReq
->
walSegmentSize
=
pStmt
->
pOptions
->
walSegmentSize
;
pReq
->
sstTrigger
=
pStmt
->
pOptions
->
sstTrigger
;
pReq
->
hashPrefix
=
pStmt
->
pOptions
->
tablePrefix
;
pReq
->
hashSuffix
=
pStmt
->
pOptions
->
tableSuffix
;
pReq
->
ignoreExist
=
pStmt
->
ignoreExists
;
return
buildCreateDbRetentions
(
pStmt
->
pOptions
->
pRetentions
,
pReq
);
}
...
...
@@ -3770,6 +3772,12 @@ static int32_t checkDatabaseOptions(STranslateContext* pCxt, const char* pDbName
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
checkDbRangeOption
(
pCxt
,
"sstTrigger"
,
pOptions
->
sstTrigger
,
TSDB_MIN_SST_TRIGGER
,
TSDB_MAX_SST_TRIGGER
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
checkDbRangeOption
(
pCxt
,
"tablePrefix"
,
pOptions
->
tablePrefix
,
TSDB_MIN_HASH_PREFIX
,
TSDB_MAX_HASH_PREFIX
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
checkDbRangeOption
(
pCxt
,
"tableSuffix"
,
pOptions
->
tableSuffix
,
TSDB_MIN_HASH_SUFFIX
,
TSDB_MAX_HASH_SUFFIX
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
checkOptionsDependency
(
pCxt
,
pDbName
,
pOptions
);
}
...
...
@@ -5856,7 +5864,7 @@ static int32_t rewriteShowVnodes(STranslateContext* pCxt, SQuery* pQuery) {
if
(
NULL
!=
pShow
->
pDnodeId
)
{
code
=
createOperatorNode
(
OP_TYPE_EQUAL
,
"dnode_id"
,
pShow
->
pDnodeId
,
&
pStmt
->
pWhere
);
}
else
{
code
=
createOperatorNode
(
OP_TYPE_EQUAL
,
"dnode_e
ndpoint
"
,
pShow
->
pDnodeEndpoint
,
&
pStmt
->
pWhere
);
code
=
createOperatorNode
(
OP_TYPE_EQUAL
,
"dnode_e
p
"
,
pShow
->
pDnodeEndpoint
,
&
pStmt
->
pWhere
);
}
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
...
...
source/libs/parser/src/sql.c
浏览文件 @
ccaf6f8a
此差异已折叠。
点击以展开。
source/libs/parser/test/mockCatalog.cpp
浏览文件 @
ccaf6f8a
...
...
@@ -83,7 +83,7 @@ void generateInformationSchema(MockCatalogService* mcs) {
.
done
();
mcs
->
createTableBuilder
(
TSDB_INFORMATION_SCHEMA_DB
,
TSDB_INS_TABLE_VNODES
,
TSDB_SYSTEM_TABLE
,
2
)
.
addColumn
(
"dnode_id"
,
TSDB_DATA_TYPE_INT
)
.
addColumn
(
"dnode_e
ndpoint
"
,
TSDB_DATA_TYPE_BINARY
,
TSDB_EP_LEN
)
.
addColumn
(
"dnode_e
p
"
,
TSDB_DATA_TYPE_BINARY
,
TSDB_EP_LEN
)
.
done
();
}
...
...
source/libs/parser/test/parInitialCTest.cpp
浏览文件 @
ccaf6f8a
...
...
@@ -116,6 +116,8 @@ TEST_F(ParserInitialCTest, createDatabase) {
expect
.
walRollPeriod
=
TSDB_REP_DEF_DB_WAL_ROLL_PERIOD
;
expect
.
walSegmentSize
=
TSDB_DEFAULT_DB_WAL_SEGMENT_SIZE
;
expect
.
sstTrigger
=
TSDB_DEFAULT_SST_TRIGGER
;
expect
.
hashPrefix
=
TSDB_DEFAULT_HASH_PREFIX
;
expect
.
hashSuffix
=
TSDB_DEFAULT_HASH_SUFFIX
;
};
auto
setDbBufferFunc
=
[
&
](
int32_t
buffer
)
{
expect
.
buffer
=
buffer
;
};
...
...
@@ -157,6 +159,8 @@ TEST_F(ParserInitialCTest, createDatabase) {
auto
setDbWalRollPeriod
=
[
&
](
int32_t
walRollPeriod
)
{
expect
.
walRollPeriod
=
walRollPeriod
;
};
auto
setDbWalSegmentSize
=
[
&
](
int32_t
walSegmentSize
)
{
expect
.
walSegmentSize
=
walSegmentSize
;
};
auto
setDbSstTrigger
=
[
&
](
int32_t
sstTrigger
)
{
expect
.
sstTrigger
=
sstTrigger
;
};
auto
setDbHashPrefix
=
[
&
](
int32_t
hashPrefix
)
{
expect
.
hashPrefix
=
hashPrefix
;
};
auto
setDbHashSuffix
=
[
&
](
int32_t
hashSuffix
)
{
expect
.
hashSuffix
=
hashSuffix
;
};
setCheckDdlFunc
([
&
](
const
SQuery
*
pQuery
,
ParserStage
stage
)
{
ASSERT_EQ
(
nodeType
(
pQuery
->
pRoot
),
QUERY_NODE_CREATE_DATABASE_STMT
);
...
...
@@ -188,6 +192,8 @@ TEST_F(ParserInitialCTest, createDatabase) {
ASSERT_EQ
(
req
.
walRollPeriod
,
expect
.
walRollPeriod
);
ASSERT_EQ
(
req
.
walSegmentSize
,
expect
.
walSegmentSize
);
ASSERT_EQ
(
req
.
sstTrigger
,
expect
.
sstTrigger
);
ASSERT_EQ
(
req
.
hashPrefix
,
expect
.
hashPrefix
);
ASSERT_EQ
(
req
.
hashSuffix
,
expect
.
hashSuffix
);
ASSERT_EQ
(
req
.
ignoreExist
,
expect
.
ignoreExist
);
ASSERT_EQ
(
req
.
numOfRetensions
,
expect
.
numOfRetensions
);
if
(
expect
.
numOfRetensions
>
0
)
{
...
...
@@ -236,6 +242,8 @@ TEST_F(ParserInitialCTest, createDatabase) {
setDbWalRollPeriod
(
10
);
setDbWalSegmentSize
(
20
);
setDbSstTrigger
(
16
);
setDbHashPrefix
(
3
);
setDbHashSuffix
(
4
);
run
(
"CREATE DATABASE IF NOT EXISTS wxy_db "
"BUFFER 64 "
"CACHEMODEL 'last_value' "
...
...
@@ -260,7 +268,9 @@ TEST_F(ParserInitialCTest, createDatabase) {
"WAL_RETENTION_SIZE -1 "
"WAL_ROLL_PERIOD 10 "
"WAL_SEGMENT_SIZE 20 "
"SST_TRIGGER 16"
);
"SST_TRIGGER 16 "
"TABLE_PREFIX 3"
"TABLE_SUFFIX 4"
);
clearCreateDbReq
();
setCreateDbReqFunc
(
"wxy_db"
,
1
);
...
...
tests/script/tsim/db/basic1.sim
浏览文件 @
ccaf6f8a
...
...
@@ -133,10 +133,10 @@ if $data(4)[5] != localhost:7100 then
return -1
endi
#
sql show vnodes 'localhost:7100'
#
if $rows != 9 then
#
return -1
#
endi
sql show vnodes 'localhost:7100'
if $rows != 9 then
return -1
endi
print =============== drop database
sql drop database d2
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录