fix: taosd crash issue

This commit is contained in:
dapan1121 2023-08-15 08:51:23 +08:00
parent 6a78053b51
commit 31b0bcd716
5 changed files with 2753 additions and 2750 deletions

View File

@ -278,84 +278,85 @@
#define TK_SELECT 260 #define TK_SELECT 260
#define TK_NO_BATCH_SCAN 261 #define TK_NO_BATCH_SCAN 261
#define TK_BATCH_SCAN 262 #define TK_BATCH_SCAN 262
#define TK_DISTINCT 263 #define TK_NK_HINT_BEGIN 263
#define TK_WHERE 264 #define TK_NK_HINT_END 264
#define TK_PARTITION 265 #define TK_DISTINCT 265
#define TK_BY 266 #define TK_WHERE 266
#define TK_SESSION 267 #define TK_PARTITION 267
#define TK_STATE_WINDOW 268 #define TK_BY 268
#define TK_EVENT_WINDOW 269 #define TK_SESSION 269
#define TK_SLIDING 270 #define TK_STATE_WINDOW 270
#define TK_FILL 271 #define TK_EVENT_WINDOW 271
#define TK_VALUE 272 #define TK_SLIDING 272
#define TK_VALUE_F 273 #define TK_FILL 273
#define TK_NONE 274 #define TK_VALUE 274
#define TK_PREV 275 #define TK_VALUE_F 275
#define TK_NULL_F 276 #define TK_NONE 276
#define TK_LINEAR 277 #define TK_PREV 277
#define TK_NEXT 278 #define TK_NULL_F 278
#define TK_HAVING 279 #define TK_LINEAR 279
#define TK_RANGE 280 #define TK_NEXT 280
#define TK_EVERY 281 #define TK_HAVING 281
#define TK_ORDER 282 #define TK_RANGE 282
#define TK_SLIMIT 283 #define TK_EVERY 283
#define TK_SOFFSET 284 #define TK_ORDER 284
#define TK_LIMIT 285 #define TK_SLIMIT 285
#define TK_OFFSET 286 #define TK_SOFFSET 286
#define TK_ASC 287 #define TK_LIMIT 287
#define TK_NULLS 288 #define TK_OFFSET 288
#define TK_ABORT 289 #define TK_ASC 289
#define TK_AFTER 290 #define TK_NULLS 290
#define TK_ATTACH 291 #define TK_ABORT 291
#define TK_BEFORE 292 #define TK_AFTER 292
#define TK_BEGIN 293 #define TK_ATTACH 293
#define TK_BITAND 294 #define TK_BEFORE 294
#define TK_BITNOT 295 #define TK_BEGIN 295
#define TK_BITOR 296 #define TK_BITAND 296
#define TK_BLOCKS 297 #define TK_BITNOT 297
#define TK_CHANGE 298 #define TK_BITOR 298
#define TK_COMMA 299 #define TK_BLOCKS 299
#define TK_CONCAT 300 #define TK_CHANGE 300
#define TK_CONFLICT 301 #define TK_COMMA 301
#define TK_COPY 302 #define TK_CONCAT 302
#define TK_DEFERRED 303 #define TK_CONFLICT 303
#define TK_DELIMITERS 304 #define TK_COPY 304
#define TK_DETACH 305 #define TK_DEFERRED 305
#define TK_DIVIDE 306 #define TK_DELIMITERS 306
#define TK_DOT 307 #define TK_DETACH 307
#define TK_EACH 308 #define TK_DIVIDE 308
#define TK_FAIL 309 #define TK_DOT 309
#define TK_FILE 310 #define TK_EACH 310
#define TK_FOR 311 #define TK_FAIL 311
#define TK_GLOB 312 #define TK_FILE 312
#define TK_ID 313 #define TK_FOR 313
#define TK_IMMEDIATE 314 #define TK_GLOB 314
#define TK_IMPORT 315 #define TK_ID 315
#define TK_INITIALLY 316 #define TK_IMMEDIATE 316
#define TK_INSTEAD 317 #define TK_IMPORT 317
#define TK_ISNULL 318 #define TK_INITIALLY 318
#define TK_KEY 319 #define TK_INSTEAD 319
#define TK_MODULES 320 #define TK_ISNULL 320
#define TK_NK_BITNOT 321 #define TK_KEY 321
#define TK_NK_SEMI 322 #define TK_MODULES 322
#define TK_NOTNULL 323 #define TK_NK_BITNOT 323
#define TK_OF 324 #define TK_NK_SEMI 324
#define TK_PLUS 325 #define TK_NOTNULL 325
#define TK_PRIVILEGE 326 #define TK_OF 326
#define TK_RAISE 327 #define TK_PLUS 327
#define TK_RESTRICT 328 #define TK_PRIVILEGE 328
#define TK_ROW 329 #define TK_RAISE 329
#define TK_SEMI 330 #define TK_RESTRICT 330
#define TK_STAR 331 #define TK_ROW 331
#define TK_STATEMENT 332 #define TK_SEMI 332
#define TK_STRICT 333 #define TK_STAR 333
#define TK_STRING 334 #define TK_STATEMENT 334
#define TK_TIMES 335 #define TK_STRICT 335
#define TK_VALUES 336 #define TK_STRING 336
#define TK_VARIABLE 337 #define TK_TIMES 337
#define TK_VIEW 338 #define TK_VALUES 338
#define TK_WAL 339 #define TK_VARIABLE 339
#define TK_VIEW 340
#define TK_WAL 341
#define TK_NK_SPACE 600 #define TK_NK_SPACE 600
@ -364,7 +365,6 @@
#define TK_NK_HEX 603 // hex number 0x123 #define TK_NK_HEX 603 // hex number 0x123
#define TK_NK_OCT 604 // oct number #define TK_NK_OCT 604 // oct number
#define TK_NK_BIN 605 // bin format data 0b111 #define TK_NK_BIN 605 // bin format data 0b111
#define TK_NK_HINT 606
#define TK_NK_NIL 65535 #define TK_NK_NIL 65535

View File

@ -1009,7 +1009,7 @@ join_type(A) ::= INNER.
/************************************************ query_specification *************************************************/ /************************************************ query_specification *************************************************/
query_specification(A) ::= query_specification(A) ::=
SELECT hint_opt_list(M) set_quantifier_opt(B) select_list(C) from_clause_opt(D) SELECT hint_list(M) set_quantifier_opt(B) select_list(C) from_clause_opt(D)
where_clause_opt(E) partition_by_clause_opt(F) range_opt(J) every_opt(K) where_clause_opt(E) partition_by_clause_opt(F) range_opt(J) every_opt(K)
fill_opt(L) twindow_clause_opt(G) group_by_clause_opt(H) having_clause_opt(I). { fill_opt(L) twindow_clause_opt(G) group_by_clause_opt(H) having_clause_opt(I). {
A = createSelectStmt(pCxt, B, C, D, M); A = createSelectStmt(pCxt, B, C, D, M);
@ -1023,15 +1023,10 @@ query_specification(A) ::=
A = addFillClause(pCxt, A, L); A = addFillClause(pCxt, A, L);
} }
%type hint_list { SNodeList* }
hint_opt(A) ::= NO_BATCH_SCAN NK_LP NK_RP. { A = createHintNode(pCxt, HINT_NO_BATCH_SCAN, NULL); } %destructor hint_list { nodesDestroyList($$); }
hint_opt(A) ::= BATCH_SCAN NK_LP NK_RP. { A = createHintNode(pCxt, HINT_BATCH_SCAN, NULL); } hint_list(A) ::= . { createHintNodeList(pCxt, NULL); }
hint_list(A) ::= NK_HINT(B). { createHintNodeList(pCxt, &B); }
%type hint_opt_list { SNodeList* }
%destructor hint_opt_list { nodesDestroyList($$); }
hint_opt_list(A) ::= . { A = NULL; }
hint_opt_list(A) ::= hint_opt(B). { A = createNodeList(pCxt, B); }
hint_opt_list(A) ::= hint_opt_list(B) hint_opt(C). { A = addNodeToList(pCxt, B, C); }
%type set_quantifier_opt { bool } %type set_quantifier_opt { bool }
%destructor set_quantifier_opt { } %destructor set_quantifier_opt { }

View File

@ -392,6 +392,10 @@ uint32_t tGetToken(const char* z, uint32_t* tokenId) {
return 1; return 1;
} }
case '*': { case '*': {
if (z[1] == '/') {
*tokenId = TK_NK_HINT_END;
return 2;
}
*tokenId = TK_NK_STAR; *tokenId = TK_NK_STAR;
return 1; return 1;
} }
@ -402,12 +406,13 @@ uint32_t tGetToken(const char* z, uint32_t* tokenId) {
} }
bool isHint = false; bool isHint = false;
if (z[2] == '+') { if (z[2] == '+') {
isHint = TK_NK_HINT; *tokenId = TK_NK_HINT_BEGIN;
return 3;
} }
for (i = 3; z[i] && (z[i] != '/' || z[i - 1] != '*'); i++) { for (i = 3; z[i] && (z[i] != '/' || z[i - 1] != '*'); i++) {
} }
if (z[i]) i++; if (z[i]) i++;
*tokenId = isHint ? TK_NK_HINT : TK_NK_COMMENT; *tokenId = TK_NK_COMMENT;
return i; return i;
} }
case '%': { case '%': {

File diff suppressed because it is too large Load Diff

View File

@ -1015,10 +1015,9 @@ _return:
if (code) { if (code) {
if (ctx) { if (ctx) {
QW_UPDATE_RSP_CODE(ctx, code); QW_UPDATE_RSP_CODE(ctx, code);
}
qwUpdateTaskStatus(QW_FPARAMS(), JOB_TASK_STATUS_FAIL, ctx->dynamicTask); qwUpdateTaskStatus(QW_FPARAMS(), JOB_TASK_STATUS_FAIL, ctx->dynamicTask);
} }
}
if (locked) { if (locked) {
QW_UNLOCK(QW_WRITE, &ctx->lock); QW_UNLOCK(QW_WRITE, &ctx->lock);