Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
ae4354c2
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看板
提交
ae4354c2
编写于
10月 31, 2022
作者:
X
Xiaoyu Wang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
enh: add sql command 'drop dnode id force'
上级
bfb92713
变更
11
展开全部
隐藏空白更改
内联
并排
Showing
11 changed file
with
3843 addition
and
3700 deletion
+3843
-3700
include/common/tmsg.h
include/common/tmsg.h
+1
-0
include/common/ttokendef.h
include/common/ttokendef.h
+274
-273
include/libs/nodes/cmdnodes.h
include/libs/nodes/cmdnodes.h
+1
-0
source/common/src/tmsg.c
source/common/src/tmsg.c
+2
-0
source/libs/parser/inc/parAst.h
source/libs/parser/inc/parAst.h
+1
-1
source/libs/parser/inc/sql.y
source/libs/parser/inc/sql.y
+7
-2
source/libs/parser/src/parAstCreater.c
source/libs/parser/src/parAstCreater.c
+2
-1
source/libs/parser/src/parTokenizer.c
source/libs/parser/src/parTokenizer.c
+1
-0
source/libs/parser/src/parTranslater.c
source/libs/parser/src/parTranslater.c
+1
-0
source/libs/parser/src/sql.c
source/libs/parser/src/sql.c
+3538
-3420
source/libs/parser/test/parInitialDTest.cpp
source/libs/parser/test/parInitialDTest.cpp
+15
-3
未找到文件。
include/common/tmsg.h
浏览文件 @
ae4354c2
...
@@ -1478,6 +1478,7 @@ typedef struct {
...
@@ -1478,6 +1478,7 @@ typedef struct {
int32_t
dnodeId
;
int32_t
dnodeId
;
char
fqdn
[
TSDB_FQDN_LEN
];
char
fqdn
[
TSDB_FQDN_LEN
];
int32_t
port
;
int32_t
port
;
int8_t
force
;
}
SDropDnodeReq
;
}
SDropDnodeReq
;
int32_t
tSerializeSDropDnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SDropDnodeReq
*
pReq
);
int32_t
tSerializeSDropDnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SDropDnodeReq
*
pReq
);
...
...
include/common/ttokendef.h
浏览文件 @
ae4354c2
...
@@ -66,280 +66,281 @@
...
@@ -66,280 +66,281 @@
#define TK_PORT 48
#define TK_PORT 48
#define TK_DNODES 49
#define TK_DNODES 49
#define TK_NK_IPTOKEN 50
#define TK_NK_IPTOKEN 50
#define TK_LOCAL 51
#define TK_FORCE 51
#define TK_QNODE 52
#define TK_LOCAL 52
#define TK_BNODE 53
#define TK_QNODE 53
#define TK_SNODE 54
#define TK_BNODE 54
#define TK_MNODE 55
#define TK_SNODE 55
#define TK_DATABASE 56
#define TK_MNODE 56
#define TK_USE 57
#define TK_DATABASE 57
#define TK_FLUSH 58
#define TK_USE 58
#define TK_TRIM 59
#define TK_FLUSH 59
#define TK_IF 60
#define TK_TRIM 60
#define TK_NOT 61
#define TK_IF 61
#define TK_EXISTS 62
#define TK_NOT 62
#define TK_BUFFER 63
#define TK_EXISTS 63
#define TK_CACHEMODEL 64
#define TK_BUFFER 64
#define TK_CACHESIZE 65
#define TK_CACHEMODEL 65
#define TK_COMP 66
#define TK_CACHESIZE 66
#define TK_DURATION 67
#define TK_COMP 67
#define TK_NK_VARIABLE 68
#define TK_DURATION 68
#define TK_MAXROWS 69
#define TK_NK_VARIABLE 69
#define TK_MINROWS 70
#define TK_MAXROWS 70
#define TK_KEEP 71
#define TK_MINROWS 71
#define TK_PAGES 72
#define TK_KEEP 72
#define TK_PAGESIZE 73
#define TK_PAGES 73
#define TK_TSDB_PAGESIZE 74
#define TK_PAGESIZE 74
#define TK_PRECISION 75
#define TK_TSDB_PAGESIZE 75
#define TK_REPLICA 76
#define TK_PRECISION 76
#define TK_STRICT 77
#define TK_REPLICA 77
#define TK_VGROUPS 78
#define TK_STRICT 78
#define TK_SINGLE_STABLE 79
#define TK_VGROUPS 79
#define TK_RETENTIONS 80
#define TK_SINGLE_STABLE 80
#define TK_SCHEMALESS 81
#define TK_RETENTIONS 81
#define TK_WAL_LEVEL 82
#define TK_SCHEMALESS 82
#define TK_WAL_FSYNC_PERIOD 83
#define TK_WAL_LEVEL 83
#define TK_WAL_RETENTION_PERIOD 84
#define TK_WAL_FSYNC_PERIOD 84
#define TK_WAL_RETENTION_SIZE 85
#define TK_WAL_RETENTION_PERIOD 85
#define TK_WAL_ROLL_PERIOD 86
#define TK_WAL_RETENTION_SIZE 86
#define TK_WAL_SEGMENT_SIZE 87
#define TK_WAL_ROLL_PERIOD 87
#define TK_STT_TRIGGER 88
#define TK_WAL_SEGMENT_SIZE 88
#define TK_TABLE_PREFIX 89
#define TK_STT_TRIGGER 89
#define TK_TABLE_SUFFIX 90
#define TK_TABLE_PREFIX 90
#define TK_NK_COLON 91
#define TK_TABLE_SUFFIX 91
#define TK_MAX_SPEED 92
#define TK_NK_COLON 92
#define TK_TABLE 93
#define TK_MAX_SPEED 93
#define TK_NK_LP 94
#define TK_TABLE 94
#define TK_NK_RP 95
#define TK_NK_LP 95
#define TK_STABLE 96
#define TK_NK_RP 96
#define TK_ADD 97
#define TK_STABLE 97
#define TK_COLUMN 98
#define TK_ADD 98
#define TK_MODIFY 99
#define TK_COLUMN 99
#define TK_RENAME 100
#define TK_MODIFY 100
#define TK_TAG 101
#define TK_RENAME 101
#define TK_SET 102
#define TK_TAG 102
#define TK_NK_EQ 103
#define TK_SET 103
#define TK_USING 104
#define TK_NK_EQ 104
#define TK_TAGS 105
#define TK_USING 105
#define TK_COMMENT 106
#define TK_TAGS 106
#define TK_BOOL 107
#define TK_COMMENT 107
#define TK_TINYINT 108
#define TK_BOOL 108
#define TK_SMALLINT 109
#define TK_TINYINT 109
#define TK_INT 110
#define TK_SMALLINT 110
#define TK_INTEGER 111
#define TK_INT 111
#define TK_BIGINT 112
#define TK_INTEGER 112
#define TK_FLOAT 113
#define TK_BIGINT 113
#define TK_DOUBLE 114
#define TK_FLOAT 114
#define TK_BINARY 115
#define TK_DOUBLE 115
#define TK_TIMESTAMP 116
#define TK_BINARY 116
#define TK_NCHAR 117
#define TK_TIMESTAMP 117
#define TK_UNSIGNED 118
#define TK_NCHAR 118
#define TK_JSON 119
#define TK_UNSIGNED 119
#define TK_VARCHAR 120
#define TK_JSON 120
#define TK_MEDIUMBLOB 121
#define TK_VARCHAR 121
#define TK_BLOB 122
#define TK_MEDIUMBLOB 122
#define TK_VARBINARY 123
#define TK_BLOB 123
#define TK_DECIMAL 124
#define TK_VARBINARY 124
#define TK_MAX_DELAY 125
#define TK_DECIMAL 125
#define TK_WATERMARK 126
#define TK_MAX_DELAY 126
#define TK_ROLLUP 127
#define TK_WATERMARK 127
#define TK_TTL 128
#define TK_ROLLUP 128
#define TK_SMA 129
#define TK_TTL 129
#define TK_FIRST 130
#define TK_SMA 130
#define TK_LAST 131
#define TK_FIRST 131
#define TK_SHOW 132
#define TK_LAST 132
#define TK_DATABASES 133
#define TK_SHOW 133
#define TK_TABLES 134
#define TK_DATABASES 134
#define TK_STABLES 135
#define TK_TABLES 135
#define TK_MNODES 136
#define TK_STABLES 136
#define TK_QNODES 137
#define TK_MNODES 137
#define TK_FUNCTIONS 138
#define TK_QNODES 138
#define TK_INDEXES 139
#define TK_FUNCTIONS 139
#define TK_ACCOUNTS 140
#define TK_INDEXES 140
#define TK_APPS 141
#define TK_ACCOUNTS 141
#define TK_CONNECTIONS 142
#define TK_APPS 142
#define TK_LICENCES 143
#define TK_CONNECTIONS 143
#define TK_GRANTS 144
#define TK_LICENCES 144
#define TK_QUERIES 145
#define TK_GRANTS 145
#define TK_SCORES 146
#define TK_QUERIES 146
#define TK_TOPICS 147
#define TK_SCORES 147
#define TK_VARIABLES 148
#define TK_TOPICS 148
#define TK_CLUSTER 149
#define TK_VARIABLES 149
#define TK_BNODES 150
#define TK_CLUSTER 150
#define TK_SNODES 151
#define TK_BNODES 151
#define TK_TRANSACTIONS 152
#define TK_SNODES 152
#define TK_DISTRIBUTED 153
#define TK_TRANSACTIONS 153
#define TK_CONSUMERS 154
#define TK_DISTRIBUTED 154
#define TK_SUBSCRIPTIONS 155
#define TK_CONSUMERS 155
#define TK_VNODES 156
#define TK_SUBSCRIPTIONS 156
#define TK_LIKE 157
#define TK_VNODES 157
#define TK_INDEX 158
#define TK_LIKE 158
#define TK_FUNCTION 159
#define TK_INDEX 159
#define TK_INTERVAL 160
#define TK_FUNCTION 160
#define TK_TOPIC 161
#define TK_INTERVAL 161
#define TK_AS 162
#define TK_TOPIC 162
#define TK_WITH 163
#define TK_AS 163
#define TK_META 164
#define TK_WITH 164
#define TK_CONSUMER 165
#define TK_META 165
#define TK_GROUP 166
#define TK_CONSUMER 166
#define TK_DESC 167
#define TK_GROUP 167
#define TK_DESCRIBE 168
#define TK_DESC 168
#define TK_RESET 169
#define TK_DESCRIBE 169
#define TK_QUERY 170
#define TK_RESET 170
#define TK_CACHE 171
#define TK_QUERY 171
#define TK_EXPLAIN 172
#define TK_CACHE 172
#define TK_ANALYZE 173
#define TK_EXPLAIN 173
#define TK_VERBOSE 174
#define TK_ANALYZE 174
#define TK_NK_BOOL 175
#define TK_VERBOSE 175
#define TK_RATIO 176
#define TK_NK_BOOL 176
#define TK_NK_FLOAT 177
#define TK_RATIO 177
#define TK_OUTPUTTYPE 178
#define TK_NK_FLOAT 178
#define TK_AGGREGATE 179
#define TK_OUTPUTTYPE 179
#define TK_BUFSIZE 180
#define TK_AGGREGATE 180
#define TK_STREAM 181
#define TK_BUFSIZE 181
#define TK_INTO 182
#define TK_STREAM 182
#define TK_TRIGGER 183
#define TK_INTO 183
#define TK_AT_ONCE 184
#define TK_TRIGGER 184
#define TK_WINDOW_CLOSE 185
#define TK_AT_ONCE 185
#define TK_IGNORE 186
#define TK_WINDOW_CLOSE 186
#define TK_EXPIRED 187
#define TK_IGNORE 187
#define TK_FILL_HISTORY 188
#define TK_EXPIRED 188
#define TK_SUBTABLE 189
#define TK_FILL_HISTORY 189
#define TK_KILL 190
#define TK_SUBTABLE 190
#define TK_CONNECTION 191
#define TK_KILL 191
#define TK_TRANSACTION 192
#define TK_CONNECTION 192
#define TK_BALANCE 193
#define TK_TRANSACTION 193
#define TK_VGROUP 194
#define TK_BALANCE 194
#define TK_MERGE 195
#define TK_VGROUP 195
#define TK_REDISTRIBUTE 196
#define TK_MERGE 196
#define TK_SPLIT 197
#define TK_REDISTRIBUTE 197
#define TK_DELETE 198
#define TK_SPLIT 198
#define TK_INSERT 199
#define TK_DELETE 199
#define TK_NULL 200
#define TK_INSERT 200
#define TK_NK_QUESTION 201
#define TK_NULL 201
#define TK_NK_ARROW 202
#define TK_NK_QUESTION 202
#define TK_ROWTS 203
#define TK_NK_ARROW 203
#define TK_TBNAME 204
#define TK_ROWTS 204
#define TK_QSTART 205
#define TK_TBNAME 205
#define TK_QEND 206
#define TK_QSTART 206
#define TK_QDURATION 207
#define TK_QEND 207
#define TK_WSTART 208
#define TK_QDURATION 208
#define TK_WEND 209
#define TK_WSTART 209
#define TK_WDURATION 210
#define TK_WEND 210
#define TK_IROWTS 211
#define TK_WDURATION 211
#define TK_QTAGS 212
#define TK_IROWTS 212
#define TK_CAST 213
#define TK_QTAGS 213
#define TK_NOW 214
#define TK_CAST 214
#define TK_TODAY 215
#define TK_NOW 215
#define TK_TIMEZONE 216
#define TK_TODAY 216
#define TK_CLIENT_VERSION 217
#define TK_TIMEZONE 217
#define TK_SERVER_VERSION 218
#define TK_CLIENT_VERSION 218
#define TK_SERVER_STATUS 219
#define TK_SERVER_VERSION 219
#define TK_CURRENT_USER 220
#define TK_SERVER_STATUS 220
#define TK_COUNT 221
#define TK_CURRENT_USER 221
#define TK_LAST_ROW 222
#define TK_COUNT 222
#define TK_CASE 223
#define TK_LAST_ROW 223
#define TK_END 224
#define TK_CASE 224
#define TK_WHEN 225
#define TK_END 225
#define TK_THEN 226
#define TK_WHEN 226
#define TK_ELSE 227
#define TK_THEN 227
#define TK_BETWEEN 228
#define TK_ELSE 228
#define TK_IS 229
#define TK_BETWEEN 229
#define TK_NK_LT 230
#define TK_IS 230
#define TK_NK_GT 231
#define TK_NK_LT 231
#define TK_NK_LE 232
#define TK_NK_GT 232
#define TK_NK_GE 233
#define TK_NK_LE 233
#define TK_NK_NE 234
#define TK_NK_GE 234
#define TK_MATCH 235
#define TK_NK_NE 235
#define TK_NMATCH 236
#define TK_MATCH 236
#define TK_CONTAINS 237
#define TK_NMATCH 237
#define TK_IN 238
#define TK_CONTAINS 238
#define TK_JOIN 239
#define TK_IN 239
#define TK_INNER 240
#define TK_JOIN 240
#define TK_SELECT 241
#define TK_INNER 241
#define TK_DISTINCT 242
#define TK_SELECT 242
#define TK_WHERE 243
#define TK_DISTINCT 243
#define TK_PARTITION 244
#define TK_WHERE 244
#define TK_BY 245
#define TK_PARTITION 245
#define TK_SESSION 246
#define TK_BY 246
#define TK_STATE_WINDOW 247
#define TK_SESSION 247
#define TK_SLIDING 248
#define TK_STATE_WINDOW 248
#define TK_FILL 249
#define TK_SLIDING 249
#define TK_VALUE 250
#define TK_FILL 250
#define TK_NONE 251
#define TK_VALUE 251
#define TK_PREV 252
#define TK_NONE 252
#define TK_LINEAR 253
#define TK_PREV 253
#define TK_NEXT 254
#define TK_LINEAR 254
#define TK_HAVING 255
#define TK_NEXT 255
#define TK_RANGE 256
#define TK_HAVING 256
#define TK_EVERY 257
#define TK_RANGE 257
#define TK_ORDER 258
#define TK_EVERY 258
#define TK_SLIMIT 259
#define TK_ORDER 259
#define TK_SOFFSET 260
#define TK_SLIMIT 260
#define TK_LIMIT 261
#define TK_SOFFSET 261
#define TK_OFFSET 262
#define TK_LIMIT 262
#define TK_ASC 263
#define TK_OFFSET 263
#define TK_NULLS 264
#define TK_ASC 264
#define TK_ABORT 265
#define TK_NULLS 265
#define TK_AFTER 266
#define TK_ABORT 266
#define TK_ATTACH 267
#define TK_AFTER 267
#define TK_BEFORE 268
#define TK_ATTACH 268
#define TK_BEGIN 269
#define TK_BEFORE 269
#define TK_BITAND 270
#define TK_BEGIN 270
#define TK_BITNOT 271
#define TK_BITAND 271
#define TK_BITOR 272
#define TK_BITNOT 272
#define TK_BLOCKS 273
#define TK_BITOR 273
#define TK_CHANGE 274
#define TK_BLOCKS 274
#define TK_COMMA 275
#define TK_CHANGE 275
#define TK_COMPACT 276
#define TK_COMMA 276
#define TK_CONCAT 277
#define TK_COMPACT 277
#define TK_CONFLICT 278
#define TK_CONCAT 278
#define TK_COPY 279
#define TK_CONFLICT 279
#define TK_DEFERRED 280
#define TK_COPY 280
#define TK_DELIMITERS 281
#define TK_DEFERRED 281
#define TK_DETACH 282
#define TK_DELIMITERS 282
#define TK_DIVIDE 283
#define TK_DETACH 283
#define TK_DOT 284
#define TK_DIVIDE 284
#define TK_EACH 285
#define TK_DOT 285
#define TK_FAIL 286
#define TK_EACH 286
#define TK_FILE 287
#define TK_FAIL 287
#define TK_FOR 288
#define TK_FILE 288
#define TK_GLOB 289
#define TK_FOR 289
#define TK_ID 290
#define TK_GLOB 290
#define TK_IMMEDIATE 291
#define TK_ID 291
#define TK_IMPORT 292
#define TK_IMMEDIATE 292
#define TK_INITIALLY 293
#define TK_IMPORT 293
#define TK_INSTEAD 294
#define TK_INITIALLY 294
#define TK_ISNULL 295
#define TK_INSTEAD 295
#define TK_KEY 296
#define TK_ISNULL 296
#define TK_MODULES 297
#define TK_KEY 297
#define TK_NK_BITNOT 298
#define TK_MODULES 298
#define TK_NK_SEMI 299
#define TK_NK_BITNOT 299
#define TK_NOTNULL 300
#define TK_NK_SEMI 300
#define TK_OF 301
#define TK_NOTNULL 301
#define TK_PLUS 302
#define TK_OF 302
#define TK_PRIVILEGE 303
#define TK_PLUS 303
#define TK_RAISE 304
#define TK_PRIVILEGE 304
#define TK_REPLACE 305
#define TK_RAISE 305
#define TK_RESTRICT 306
#define TK_REPLACE 306
#define TK_ROW 307
#define TK_RESTRICT 307
#define TK_SEMI 308
#define TK_ROW 308
#define TK_STAR 309
#define TK_SEMI 309
#define TK_STATEMENT 310
#define TK_STAR 310
#define TK_STRING 311
#define TK_STATEMENT 311
#define TK_TIMES 312
#define TK_STRING 312
#define TK_UPDATE 313
#define TK_TIMES 313
#define TK_VALUES 314
#define TK_UPDATE 314
#define TK_VARIABLE 315
#define TK_VALUES 315
#define TK_VIEW 316
#define TK_VARIABLE 316
#define TK_WAL 317
#define TK_VIEW 317
#define TK_WAL 318
#define TK_NK_SPACE
3
00
#define TK_NK_SPACE
6
00
#define TK_NK_COMMENT
3
01
#define TK_NK_COMMENT
6
01
#define TK_NK_ILLEGAL
3
02
#define TK_NK_ILLEGAL
6
02
#define TK_NK_HEX
3
03 // hex number 0x123
#define TK_NK_HEX
6
03 // hex number 0x123
#define TK_NK_OCT
3
04 // oct number
#define TK_NK_OCT
6
04 // oct number
#define TK_NK_BIN
3
05 // bin format data 0b111
#define TK_NK_BIN
6
05 // bin format data 0b111
#define TK_NK_NIL 65535
#define TK_NK_NIL 65535
...
...
include/libs/nodes/cmdnodes.h
浏览文件 @
ae4354c2
...
@@ -235,6 +235,7 @@ typedef struct SDropDnodeStmt {
...
@@ -235,6 +235,7 @@ typedef struct SDropDnodeStmt {
int32_t
dnodeId
;
int32_t
dnodeId
;
char
fqdn
[
TSDB_FQDN_LEN
];
char
fqdn
[
TSDB_FQDN_LEN
];
int32_t
port
;
int32_t
port
;
bool
force
;
}
SDropDnodeStmt
;
}
SDropDnodeStmt
;
typedef
struct
SAlterDnodeStmt
{
typedef
struct
SAlterDnodeStmt
{
...
...
source/common/src/tmsg.c
浏览文件 @
ae4354c2
...
@@ -1485,6 +1485,7 @@ int32_t tSerializeSDropDnodeReq(void *buf, int32_t bufLen, SDropDnodeReq *pReq)
...
@@ -1485,6 +1485,7 @@ int32_t tSerializeSDropDnodeReq(void *buf, int32_t bufLen, SDropDnodeReq *pReq)
if
(
tEncodeI32
(
&
encoder
,
pReq
->
dnodeId
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
dnodeId
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pReq
->
fqdn
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pReq
->
fqdn
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
port
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
port
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pReq
->
force
)
<
0
)
return
-
1
;
tEndEncode
(
&
encoder
);
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
int32_t
tlen
=
encoder
.
pos
;
...
@@ -1500,6 +1501,7 @@ int32_t tDeserializeSDropDnodeReq(void *buf, int32_t bufLen, SDropDnodeReq *pReq
...
@@ -1500,6 +1501,7 @@ int32_t tDeserializeSDropDnodeReq(void *buf, int32_t bufLen, SDropDnodeReq *pReq
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
dnodeId
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
dnodeId
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
fqdn
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
fqdn
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
port
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
port
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
force
)
<
0
)
return
-
1
;
tEndDecode
(
&
decoder
);
tEndDecode
(
&
decoder
);
tDecoderClear
(
&
decoder
);
tDecoderClear
(
&
decoder
);
...
...
source/libs/parser/inc/parAst.h
浏览文件 @
ae4354c2
...
@@ -182,7 +182,7 @@ SNode* createCreateUserStmt(SAstCreateContext* pCxt, SToken* pUserName, const ST
...
@@ -182,7 +182,7 @@ SNode* createCreateUserStmt(SAstCreateContext* pCxt, SToken* pUserName, const ST
SNode
*
createAlterUserStmt
(
SAstCreateContext
*
pCxt
,
SToken
*
pUserName
,
int8_t
alterType
,
const
SToken
*
pVal
);
SNode
*
createAlterUserStmt
(
SAstCreateContext
*
pCxt
,
SToken
*
pUserName
,
int8_t
alterType
,
const
SToken
*
pVal
);
SNode
*
createDropUserStmt
(
SAstCreateContext
*
pCxt
,
SToken
*
pUserName
);
SNode
*
createDropUserStmt
(
SAstCreateContext
*
pCxt
,
SToken
*
pUserName
);
SNode
*
createCreateDnodeStmt
(
SAstCreateContext
*
pCxt
,
const
SToken
*
pFqdn
,
const
SToken
*
pPort
);
SNode
*
createCreateDnodeStmt
(
SAstCreateContext
*
pCxt
,
const
SToken
*
pFqdn
,
const
SToken
*
pPort
);
SNode
*
createDropDnodeStmt
(
SAstCreateContext
*
pCxt
,
const
SToken
*
pDnode
);
SNode
*
createDropDnodeStmt
(
SAstCreateContext
*
pCxt
,
const
SToken
*
pDnode
,
bool
force
);
SNode
*
createAlterDnodeStmt
(
SAstCreateContext
*
pCxt
,
const
SToken
*
pDnode
,
const
SToken
*
pConfig
,
const
SToken
*
pValue
);
SNode
*
createAlterDnodeStmt
(
SAstCreateContext
*
pCxt
,
const
SToken
*
pDnode
,
const
SToken
*
pConfig
,
const
SToken
*
pValue
);
SNode
*
createCreateIndexStmt
(
SAstCreateContext
*
pCxt
,
EIndexType
type
,
bool
ignoreExists
,
SNode
*
pIndexName
,
SNode
*
createCreateIndexStmt
(
SAstCreateContext
*
pCxt
,
EIndexType
type
,
bool
ignoreExists
,
SNode
*
pIndexName
,
SNode
*
pRealTable
,
SNodeList
*
pCols
,
SNode
*
pOptions
);
SNode
*
pRealTable
,
SNodeList
*
pCols
,
SNode
*
pOptions
);
...
...
source/libs/parser/inc/sql.y
浏览文件 @
ae4354c2
...
@@ -120,8 +120,8 @@ priv_level(A) ::= db_name(B) NK_DOT NK_STAR.
...
@@ -120,8 +120,8 @@ priv_level(A) ::= db_name(B) NK_DOT NK_STAR.
/************************************************ create/drop/alter dnode *********************************************/
/************************************************ create/drop/alter dnode *********************************************/
cmd ::= CREATE DNODE dnode_endpoint(A). { pCxt->pRootNode = createCreateDnodeStmt(pCxt, &A, NULL); }
cmd ::= CREATE DNODE dnode_endpoint(A). { pCxt->pRootNode = createCreateDnodeStmt(pCxt, &A, NULL); }
cmd ::= CREATE DNODE dnode_endpoint(A) PORT NK_INTEGER(B). { pCxt->pRootNode = createCreateDnodeStmt(pCxt, &A, &B); }
cmd ::= CREATE DNODE dnode_endpoint(A) PORT NK_INTEGER(B). { pCxt->pRootNode = createCreateDnodeStmt(pCxt, &A, &B); }
cmd ::= DROP DNODE NK_INTEGER(A)
. { pCxt->pRootNode = createDropDnodeStmt(pCxt, &A
); }
cmd ::= DROP DNODE NK_INTEGER(A)
force_opt(B). { pCxt->pRootNode = createDropDnodeStmt(pCxt, &A, B
); }
cmd ::= DROP DNODE dnode_endpoint(A)
. { pCxt->pRootNode = createDropDnodeStmt(pCxt, &A
); }
cmd ::= DROP DNODE dnode_endpoint(A)
force_opt(B). { pCxt->pRootNode = createDropDnodeStmt(pCxt, &A, B
); }
cmd ::= ALTER DNODE NK_INTEGER(A) NK_STRING(B). { pCxt->pRootNode = createAlterDnodeStmt(pCxt, &A, &B, NULL); }
cmd ::= ALTER DNODE NK_INTEGER(A) NK_STRING(B). { pCxt->pRootNode = createAlterDnodeStmt(pCxt, &A, &B, NULL); }
cmd ::= ALTER DNODE NK_INTEGER(A) NK_STRING(B) NK_STRING(C). { pCxt->pRootNode = createAlterDnodeStmt(pCxt, &A, &B, &C); }
cmd ::= ALTER DNODE NK_INTEGER(A) NK_STRING(B) NK_STRING(C). { pCxt->pRootNode = createAlterDnodeStmt(pCxt, &A, &B, &C); }
cmd ::= ALTER ALL DNODES NK_STRING(A). { pCxt->pRootNode = createAlterDnodeStmt(pCxt, NULL, &A, NULL); }
cmd ::= ALTER ALL DNODES NK_STRING(A). { pCxt->pRootNode = createAlterDnodeStmt(pCxt, NULL, &A, NULL); }
...
@@ -133,6 +133,11 @@ dnode_endpoint(A) ::= NK_STRING(B).
...
@@ -133,6 +133,11 @@ dnode_endpoint(A) ::= NK_STRING(B).
dnode_endpoint(A) ::= NK_ID(B). { A = B; }
dnode_endpoint(A) ::= NK_ID(B). { A = B; }
dnode_endpoint(A) ::= NK_IPTOKEN(B). { A = B; }
dnode_endpoint(A) ::= NK_IPTOKEN(B). { A = B; }
%type force_opt { bool }
%destructor force_opt { }
force_opt(A) ::= . { A = false; }
force_opt(A) ::= FORCE. { A = true; }
/************************************************ alter local *********************************************************/
/************************************************ alter local *********************************************************/
cmd ::= ALTER LOCAL NK_STRING(A). { pCxt->pRootNode = createAlterLocalStmt(pCxt, &A, NULL); }
cmd ::= ALTER LOCAL NK_STRING(A). { pCxt->pRootNode = createAlterLocalStmt(pCxt, &A, NULL); }
cmd ::= ALTER LOCAL NK_STRING(A) NK_STRING(B). { pCxt->pRootNode = createAlterLocalStmt(pCxt, &A, &B); }
cmd ::= ALTER LOCAL NK_STRING(A) NK_STRING(B). { pCxt->pRootNode = createAlterLocalStmt(pCxt, &A, &B); }
...
...
source/libs/parser/src/parAstCreater.c
浏览文件 @
ae4354c2
...
@@ -1457,7 +1457,7 @@ SNode* createCreateDnodeStmt(SAstCreateContext* pCxt, const SToken* pFqdn, const
...
@@ -1457,7 +1457,7 @@ SNode* createCreateDnodeStmt(SAstCreateContext* pCxt, const SToken* pFqdn, const
return
(
SNode
*
)
pStmt
;
return
(
SNode
*
)
pStmt
;
}
}
SNode
*
createDropDnodeStmt
(
SAstCreateContext
*
pCxt
,
const
SToken
*
pDnode
)
{
SNode
*
createDropDnodeStmt
(
SAstCreateContext
*
pCxt
,
const
SToken
*
pDnode
,
bool
force
)
{
CHECK_PARSER_STATUS
(
pCxt
);
CHECK_PARSER_STATUS
(
pCxt
);
SDropDnodeStmt
*
pStmt
=
(
SDropDnodeStmt
*
)
nodesMakeNode
(
QUERY_NODE_DROP_DNODE_STMT
);
SDropDnodeStmt
*
pStmt
=
(
SDropDnodeStmt
*
)
nodesMakeNode
(
QUERY_NODE_DROP_DNODE_STMT
);
CHECK_OUT_OF_MEM
(
pStmt
);
CHECK_OUT_OF_MEM
(
pStmt
);
...
@@ -1469,6 +1469,7 @@ SNode* createDropDnodeStmt(SAstCreateContext* pCxt, const SToken* pDnode) {
...
@@ -1469,6 +1469,7 @@ SNode* createDropDnodeStmt(SAstCreateContext* pCxt, const SToken* pDnode) {
return
NULL
;
return
NULL
;
}
}
}
}
pStmt
->
force
=
force
;
return
(
SNode
*
)
pStmt
;
return
(
SNode
*
)
pStmt
;
}
}
...
...
source/libs/parser/src/parTokenizer.c
浏览文件 @
ae4354c2
...
@@ -97,6 +97,7 @@ static SKeyword keywordTable[] = {
...
@@ -97,6 +97,7 @@ static SKeyword keywordTable[] = {
{
"FLOAT"
,
TK_FLOAT
},
{
"FLOAT"
,
TK_FLOAT
},
{
"FLUSH"
,
TK_FLUSH
},
{
"FLUSH"
,
TK_FLUSH
},
{
"FROM"
,
TK_FROM
},
{
"FROM"
,
TK_FROM
},
{
"FORCE"
,
TK_FORCE
},
{
"FUNCTION"
,
TK_FUNCTION
},
{
"FUNCTION"
,
TK_FUNCTION
},
{
"FUNCTIONS"
,
TK_FUNCTIONS
},
{
"FUNCTIONS"
,
TK_FUNCTIONS
},
{
"GRANT"
,
TK_GRANT
},
{
"GRANT"
,
TK_GRANT
},
...
...
source/libs/parser/src/parTranslater.c
浏览文件 @
ae4354c2
...
@@ -4995,6 +4995,7 @@ static int32_t translateDropDnode(STranslateContext* pCxt, SDropDnodeStmt* pStmt
...
@@ -4995,6 +4995,7 @@ static int32_t translateDropDnode(STranslateContext* pCxt, SDropDnodeStmt* pStmt
dropReq
.
dnodeId
=
pStmt
->
dnodeId
;
dropReq
.
dnodeId
=
pStmt
->
dnodeId
;
strcpy
(
dropReq
.
fqdn
,
pStmt
->
fqdn
);
strcpy
(
dropReq
.
fqdn
,
pStmt
->
fqdn
);
dropReq
.
port
=
pStmt
->
port
;
dropReq
.
port
=
pStmt
->
port
;
dropReq
.
force
=
pStmt
->
force
;
return
buildCmdMsg
(
pCxt
,
TDMT_MND_DROP_DNODE
,
(
FSerializeFunc
)
tSerializeSDropDnodeReq
,
&
dropReq
);
return
buildCmdMsg
(
pCxt
,
TDMT_MND_DROP_DNODE
,
(
FSerializeFunc
)
tSerializeSDropDnodeReq
,
&
dropReq
);
}
}
...
...
source/libs/parser/src/sql.c
浏览文件 @
ae4354c2
此差异已折叠。
点击以展开。
source/libs/parser/test/parInitialDTest.cpp
浏览文件 @
ae4354c2
...
@@ -87,7 +87,6 @@ TEST_F(ParserInitialDTest, dropConsumerGroup) {
...
@@ -87,7 +87,6 @@ TEST_F(ParserInitialDTest, dropConsumerGroup) {
// todo DROP database
// todo DROP database
// todo DROP dnode
TEST_F
(
ParserInitialDTest
,
dropDnode
)
{
TEST_F
(
ParserInitialDTest
,
dropDnode
)
{
useDb
(
"root"
,
"test"
);
useDb
(
"root"
,
"test"
);
...
@@ -95,11 +94,15 @@ TEST_F(ParserInitialDTest, dropDnode) {
...
@@ -95,11 +94,15 @@ TEST_F(ParserInitialDTest, dropDnode) {
auto
clearDropDnodeReq
=
[
&
]()
{
memset
(
&
expect
,
0
,
sizeof
(
SDropDnodeReq
));
};
auto
clearDropDnodeReq
=
[
&
]()
{
memset
(
&
expect
,
0
,
sizeof
(
SDropDnodeReq
));
};
auto
setDropDnodeReqById
=
[
&
](
int32_t
dnodeId
)
{
expect
.
dnodeId
=
dnodeId
;
};
auto
setDropDnodeReqById
=
[
&
](
int32_t
dnodeId
,
bool
force
=
false
)
{
expect
.
dnodeId
=
dnodeId
;
expect
.
force
=
force
;
};
auto
setDropDnodeReqByEndpoint
=
[
&
](
const
char
*
pFqdn
,
int32_t
port
)
{
auto
setDropDnodeReqByEndpoint
=
[
&
](
const
char
*
pFqdn
,
int32_t
port
,
bool
force
=
false
)
{
strcpy
(
expect
.
fqdn
,
pFqdn
);
strcpy
(
expect
.
fqdn
,
pFqdn
);
expect
.
port
=
port
;
expect
.
port
=
port
;
expect
.
force
=
force
;
};
};
setCheckDdlFunc
([
&
](
const
SQuery
*
pQuery
,
ParserStage
stage
)
{
setCheckDdlFunc
([
&
](
const
SQuery
*
pQuery
,
ParserStage
stage
)
{
...
@@ -110,15 +113,24 @@ TEST_F(ParserInitialDTest, dropDnode) {
...
@@ -110,15 +113,24 @@ TEST_F(ParserInitialDTest, dropDnode) {
ASSERT_EQ
(
req
.
dnodeId
,
expect
.
dnodeId
);
ASSERT_EQ
(
req
.
dnodeId
,
expect
.
dnodeId
);
ASSERT_EQ
(
std
::
string
(
req
.
fqdn
),
std
::
string
(
expect
.
fqdn
));
ASSERT_EQ
(
std
::
string
(
req
.
fqdn
),
std
::
string
(
expect
.
fqdn
));
ASSERT_EQ
(
req
.
port
,
expect
.
port
);
ASSERT_EQ
(
req
.
port
,
expect
.
port
);
ASSERT_EQ
(
req
.
force
,
expect
.
force
);
});
});
setDropDnodeReqById
(
1
);
setDropDnodeReqById
(
1
);
run
(
"DROP DNODE 1"
);
run
(
"DROP DNODE 1"
);
clearDropDnodeReq
();
clearDropDnodeReq
();
setDropDnodeReqById
(
2
,
true
);
run
(
"DROP DNODE 2 FORCE"
);
clearDropDnodeReq
();
setDropDnodeReqByEndpoint
(
"host1"
,
7030
);
setDropDnodeReqByEndpoint
(
"host1"
,
7030
);
run
(
"DROP DNODE 'host1:7030'"
);
run
(
"DROP DNODE 'host1:7030'"
);
clearDropDnodeReq
();
clearDropDnodeReq
();
setDropDnodeReqByEndpoint
(
"host2"
,
8030
,
true
);
run
(
"DROP DNODE 'host2:8030' FORCE"
);
clearDropDnodeReq
();
}
}
// todo DROP function
// todo DROP function
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录