From a5b1ba1b9353e3afbabef973912f6607ea4b4dca Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Wed, 6 May 2020 23:45:48 +0800 Subject: [PATCH 01/23] fix compile error for Ubuntu 20.04 [TD-210] --- src/client/src/tscLocal.c | 6 ++++-- src/client/src/tscSQLParser.c | 4 ++-- src/kit/taosdemo/taosdemo.c | 2 +- src/mnode/src/mgmtDb.c | 6 ++++-- src/mnode/src/mgmtDnode.c | 2 +- src/mnode/src/mgmtUser.c | 11 +++++++---- src/mnode/src/mgmtVgroup.c | 5 +++-- src/os/linux/CMakeLists.txt | 2 ++ src/os/linux/inc/os.h | 8 +------- src/os/linux/inc/tsysctl.h | 30 ++++++++++++++++++++++++++++++ src/os/linux/src/linuxSysPara.c | 1 + tests/tsim/src/simExe.c | 7 ++++--- 12 files changed, 60 insertions(+), 24 deletions(-) create mode 100644 src/os/linux/inc/tsysctl.h diff --git a/src/client/src/tscLocal.c b/src/client/src/tscLocal.c index 600ef88344..5ae226a577 100644 --- a/src/client/src/tscLocal.c +++ b/src/client/src/tscLocal.c @@ -156,7 +156,8 @@ static int32_t tscSetValueToResObj(SSqlObj *pSql, int32_t rowLen) { pField = tscFieldInfoGetField(&pQueryInfo->fieldsInfo, 3); if (i >= tscGetNumOfColumns(pMeta) && tscGetNumOfTags(pMeta) != 0) { char* output = pRes->data + tscFieldInfoGetOffset(pQueryInfo, 3) * totalNumOfRows + pField->bytes * i; - STR_WITH_SIZE_TO_VARSTR(output, "TAG", 3); + const char *src = "TAG"; + STR_WITH_SIZE_TO_VARSTR(output, src, strlen(src)); } } @@ -191,7 +192,8 @@ static int32_t tscSetValueToResObj(SSqlObj *pSql, int32_t rowLen) { // tag value pField = tscFieldInfoGetField(&pQueryInfo->fieldsInfo, 3); char *target = pRes->data + tscFieldInfoGetOffset(pQueryInfo, 3) * totalNumOfRows + pField->bytes * i; - STR_WITH_SIZE_TO_VARSTR(target, "TAG", 3); + const char *src = "TAG"; + STR_WITH_SIZE_TO_VARSTR(target, src, strlen(src)); pTagValue += pSchema[i].bytes; } diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index 12032725c3..b33220fb81 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -2222,14 +2222,14 @@ int32_t setKillInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) { char* portStr = strtok(NULL, &delim); if (!validateIpAddress(ipStr, strlen(ipStr))) { - memset(pCmd->payload, 0, tListLen(pCmd->payload)); + memset(pCmd->payload, 0, strlen(pCmd->payload)); return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg1); } uint16_t port = (uint16_t)strtol(portStr, NULL, 10); if (port <= 0 || port > 65535) { - memset(pCmd->payload, 0, tListLen(pCmd->payload)); + memset(pCmd->payload, 0, strlen(pCmd->payload)); return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg2); } diff --git a/src/kit/taosdemo/taosdemo.c b/src/kit/taosdemo/taosdemo.c index 937c8d177d..33b76cea2d 100644 --- a/src/kit/taosdemo/taosdemo.c +++ b/src/kit/taosdemo/taosdemo.c @@ -634,7 +634,7 @@ void *readMetric(void *sarg) { fprintf(fp, "Querying On %d records:\n", totalData); for (int j = 0; j < n; j++) { - char condition[BUFFER_SIZE] = "\0"; + char condition[BUFFER_SIZE - 30] = "\0"; char tempS[BUFFER_SIZE] = "\0"; int m = 10 < num_of_tables ? 10 : num_of_tables; diff --git a/src/mnode/src/mgmtDb.c b/src/mnode/src/mgmtDb.c index 9eb8b8dce1..4fd3df1775 100644 --- a/src/mnode/src/mgmtDb.c +++ b/src/mnode/src/mgmtDb.c @@ -677,9 +677,11 @@ static int32_t mgmtRetrieveDbs(SShowObj *pShow, char *data, int32_t rows, void * pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; if (pDb->status == TSDB_DB_STATUS_READY) { - STR_WITH_SIZE_TO_VARSTR(pWrite, "ready", 5); + const char *src = "ready"; + STR_WITH_SIZE_TO_VARSTR(pWrite, src, strlen(src)); } else { - STR_WITH_SIZE_TO_VARSTR(pWrite, "dropping", 8); + const char *src = "dropping"; + STR_WITH_SIZE_TO_VARSTR(pWrite, src, strlen(src)); } cols++; diff --git a/src/mnode/src/mgmtDnode.c b/src/mnode/src/mgmtDnode.c index bb98e1c3e6..9bb48b7e95 100644 --- a/src/mnode/src/mgmtDnode.c +++ b/src/mnode/src/mgmtDnode.c @@ -225,7 +225,7 @@ void mgmtProcessCfgDnodeMsg(SQueuedMsg *pMsg) { if (pCmCfgDnode->ep[0] == 0) { strcpy(pCmCfgDnode->ep, tsLocalEp); } else { - strcpy(pCmCfgDnode->ep, pCmCfgDnode->ep); + // TODO temporary disabled for compiling: strcpy(pCmCfgDnode->ep, pCmCfgDnode->ep); } if (strcmp(pMsg->pUser->user, "root") != 0) { diff --git a/src/mnode/src/mgmtUser.c b/src/mnode/src/mgmtUser.c index b4dd58cb3b..1dd572ed9d 100644 --- a/src/mnode/src/mgmtUser.c +++ b/src/mnode/src/mgmtUser.c @@ -309,11 +309,14 @@ static int32_t mgmtRetrieveUsers(SShowObj *pShow, char *data, int32_t rows, void pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; if (pUser->superAuth) { - STR_WITH_SIZE_TO_VARSTR(pWrite, "super", 5); + const char *src = "super"; + STR_WITH_SIZE_TO_VARSTR(pWrite, src, strlen(src)); } else if (pUser->writeAuth) { - STR_WITH_SIZE_TO_VARSTR(pWrite, "writable", 8); + const char *src = "writable"; + STR_WITH_SIZE_TO_VARSTR(pWrite, src, strlen(src)); } else { - STR_WITH_SIZE_TO_VARSTR(pWrite, "readable", 8); + const char *src = "readable"; + STR_WITH_SIZE_TO_VARSTR(pWrite, src, strlen(src)); } cols++; @@ -525,4 +528,4 @@ void mgmtDropAllUsers(SAcctObj *pAcct) { } mTrace("acct:%s, all users:%d is dropped from sdb", pAcct->user, numOfUsers); -} \ No newline at end of file +} diff --git a/src/mnode/src/mgmtVgroup.c b/src/mnode/src/mgmtVgroup.c index f83268e760..e6fad58b71 100644 --- a/src/mnode/src/mgmtVgroup.c +++ b/src/mnode/src/mgmtVgroup.c @@ -495,11 +495,12 @@ int32_t mgmtRetrieveVgroups(SShowObj *pShow, char *data, int32_t rows, void *pCo cols++; } else { pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - STR_WITH_SIZE_TO_VARSTR(pWrite, "NULL", 4); + const char *src = "NULL"; + STR_WITH_SIZE_TO_VARSTR(pWrite, src, strlen(src)); cols++; pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - STR_WITH_SIZE_TO_VARSTR(pWrite, "NULL", 4); + STR_WITH_SIZE_TO_VARSTR(pWrite, src, strlen(src)); cols++; } } diff --git a/src/os/linux/CMakeLists.txt b/src/os/linux/CMakeLists.txt index 83d717f905..7be4a13f25 100644 --- a/src/os/linux/CMakeLists.txt +++ b/src/os/linux/CMakeLists.txt @@ -12,3 +12,5 @@ IF ((TD_LINUX_64) OR (TD_LINUX_32 AND TD_ARM)) ADD_LIBRARY(os ${SRC}) TARGET_LINK_LIBRARIES(os m rt) ENDIF () + +SET_SOURCE_FILES_PROPERTIES(src/linuxSysPara.c PROPERTIES COMPILE_FLAGS -w) diff --git a/src/os/linux/inc/os.h b/src/os/linux/inc/os.h index 27a8363050..cab899753d 100644 --- a/src/os/linux/inc/os.h +++ b/src/os/linux/inc/os.h @@ -23,13 +23,6 @@ extern "C" { #include #include -#ifndef _ALPINE - #include - #include -#else - #include -#endif - #include #include #include @@ -82,6 +75,7 @@ extern "C" { #include #include #include +#include #define taosCloseSocket(x) \ { \ diff --git a/src/os/linux/inc/tsysctl.h b/src/os/linux/inc/tsysctl.h new file mode 100644 index 0000000000..559d5653ee --- /dev/null +++ b/src/os/linux/inc/tsysctl.h @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2019 TAOS Data, Inc. + * + * This program is free software: you can use, redistribute, and/or modify + * it under the terms of the GNU Affero General Public License, version 3 + * or later ("AGPL"), as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +#ifndef TDENGINE_TSYSCTL_H +#define TDENGINE_TSYSCTL_H + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ALPINE + #include + #include +#else + #include +#endif + +#endif diff --git a/src/os/linux/src/linuxSysPara.c b/src/os/linux/src/linuxSysPara.c index f43ed44a4b..55d1e198e1 100644 --- a/src/os/linux/src/linuxSysPara.c +++ b/src/os/linux/src/linuxSysPara.c @@ -15,6 +15,7 @@ #define _DEFAULT_SOURCE #include "os.h" +#include "tsysctl.h" #include "tconfig.h" #include "tglobal.h" #include "tulog.h" diff --git a/tests/tsim/src/simExe.c b/tests/tsim/src/simExe.c index d0d798343a..a93d1bb262 100644 --- a/tests/tsim/src/simExe.c +++ b/tests/tsim/src/simExe.c @@ -119,7 +119,7 @@ char *simGetVariable(SScript *script, char *varName, int varLen) { int simExecuteExpression(SScript *script, char *exp) { char *op1, *op2, *var1, *var2, *var3, *rest; int op1Len, op2Len, var1Len, var2Len, var3Len, val0, val1; - char t0[512], t1[512], t2[512], t3[512]; + char t0[512], t1[512], t2[512], t3[1024]; int result; rest = paGetToken(exp, &var1, &var1Len); @@ -310,14 +310,15 @@ void simStoreSystemContentResult(SScript *script, char *filename) { bool simExecuteSystemContentCmd(SScript *script, char *option) { char buf[4096] = {0}; + char buf1[4096 + 512] = {0}; char filename[400] = {0}; sprintf(filename, "%s/%s.tmp", tsScriptDir, script->fileName); sprintf(buf, "cd %s; ", tsScriptDir); simVisuallizeOption(script, option, buf + strlen(buf)); - sprintf(buf, "%s > %s 2>/dev/null", buf, filename); + sprintf(buf1, "%s > %s 2>/dev/null", buf, filename); - sprintf(script->system_exit_code, "%d", system(buf)); + sprintf(script->system_exit_code, "%d", system(buf1)); simStoreSystemContentResult(script, filename); script->linePos++; From 6383fc6fdfa0cd827477966200b9dbe626c78894 Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Sat, 9 May 2020 01:09:04 +0800 Subject: [PATCH 02/23] add more cases to smoketest.sh --- tests/pytest/fulltest.sh | 1 + tests/pytest/smoketest.sh | 126 +++++++++++++++++++++++++++++++++++--- 2 files changed, 117 insertions(+), 10 deletions(-) diff --git a/tests/pytest/fulltest.sh b/tests/pytest/fulltest.sh index cff6db2028..249245c762 100755 --- a/tests/pytest/fulltest.sh +++ b/tests/pytest/fulltest.sh @@ -9,6 +9,7 @@ python3 ./test.py $1 -f insert/smallint.py python3 ./test.py $1 -f insert/tinyint.py python3 ./test.py $1 -f insert/date.py python3 ./test.py $1 -f insert/binary.py +python3 ./test.py $1 -f insert/nchar.py python3 ./test.py $1 -f table/column_name.py python3 ./test.py $1 -f table/column_num.py diff --git a/tests/pytest/smoketest.sh b/tests/pytest/smoketest.sh index af597fb6c5..37af5f3f42 100755 --- a/tests/pytest/smoketest.sh +++ b/tests/pytest/smoketest.sh @@ -23,6 +23,15 @@ sleep 1 python3 ./test.py $1 -f insert/tinyint.py python3 ./test.py -s $1 sleep 1 +python3 ./test.py $1 -f insert/binary.py +python3 ./test.py -s $1 +sleep 1 +python3 ./test.py $1 -f insert/date.py +python3 ./test.py -s $1 +sleep 1 +python3 ./test.py $1 -f insert/nchar.py +python3 ./test.py -s $1 +sleep 1 python3 ./test.py $1 -f table/column_name.py python3 ./test.py -s $1 @@ -34,33 +43,130 @@ python3 ./test.py $1 -f table/db_table.py python3 ./test.py -s $1 sleep 1 -python3 ./test.py $1 -f import_merge/importDataLastTO.py +python3 ./test.py $1 -f import_merge/importDataLastTO.py python3 ./test.py -s $1 sleep 1 -python3 ./test.py $1 -f import_merge/importDataLastT.py +python3 ./test.py $1 -f import_merge/importDataLastT.py python3 ./test.py -s $1 sleep 1 -python3 ./test.py $1 -f import_merge/importDataTO.py +python3 ./test.py $1 -f import_merge/importDataTO.py python3 ./test.py -s $1 sleep 1 -python3 ./test.py $1 -f import_merge/importDataT.py +python3 ./test.py $1 -f import_merge/importDataT.py python3 ./test.py -s $1 sleep 1 -python3 ./test.py $1 -f import_merge/importHeadOverlap.py +python3 ./test.py $1 -f import_merge/importHeadOverlap.py python3 ./test.py -s $1 sleep 1 -python3 ./test.py $1 -f import_merge/importHeadPartOverlap.py +python3 ./test.py $1 -f import_merge/importHeadPartOverlap.py python3 ./test.py -s $1 sleep 1 -python3 ./test.py $1 -f import_merge/importHORestart.py +python3 ./test.py $1 -f import_merge/importHORestart.py python3 ./test.py -s $1 sleep 1 -python3 ./test.py $1 -f import_merge/importHPORestart.py +python3 ./test.py $1 -f import_merge/importHPORestart.py python3 ./test.py -s $1 sleep 1 -python3 ./test.py $1 -f import_merge/importHRestart.py +python3 ./test.py $1 -f import_merge/importHRestart.py python3 ./test.py -s $1 sleep 1 -python3 ./test.py $1 -f import_merge/importLastSub.py +python3 ./test.py $1 -f import_merge/importLastSub.py +python3 ./test.py -s $1 +sleep 1 + +python3 ./test.py $1 -f import_merge/importBlock1HO.py +python3 ./test.py -s $1 +sleep 1 +python3 ./test.py $1 -f import_merge/importBlock1HPO.py +python3 ./test.py -s $1 +sleep 1 +python3 ./test.py $1 -f import_merge/importBlock1H.py +python3 ./test.py -s $1 +sleep 1 +python3 ./test.py $1 -f import_merge/importBlock1S.py +python3 ./test.py -s $1 +sleep 1 +python3 ./test.py $1 -f import_merge/importBlock1Sub.py +python3 ./test.py -s $1 +sleep 1 +python3 ./test.py $1 -f import_merge/importBlock1TO.py +python3 ./test.py -s $1 +sleep 1 +python3 ./test.py $1 -f import_merge/importBlock1TPO.py +python3 ./test.py -s $1 +sleep 1 +python3 ./test.py $1 -f import_merge/importBlock1T.py +python3 ./test.py -s $1 +sleep 1 +python3 ./test.py $1 -f import_merge/importBlock2HO.py +python3 ./test.py -s $1 +sleep 1 +python3 ./test.py $1 -f import_merge/importBlock2HPO.py +python3 ./test.py -s $1 +sleep 1 +python3 ./test.py $1 -f import_merge/importBlock2H.py +python3 ./test.py -s $1 +sleep 1 +python3 ./test.py $1 -f import_merge/importBlock2S.py +python3 ./test.py -s $1 +sleep 1 +python3 ./test.py $1 -f import_merge/importBlock2Sub.py +python3 ./test.py -s $1 +sleep 1 +python3 ./test.py $1 -f import_merge/importBlock2TO.py +python3 ./test.py -s $1 +sleep 1 +python3 ./test.py $1 -f import_merge/importBlock2TPO.py +python3 ./test.py -s $1 +sleep 1 +python3 ./test.py $1 -f import_merge/importBlock2T.py +python3 ./test.py -s $1 +sleep 1 +python3 ./test.py $1 -f import_merge/importBlockbetween.py +python3 ./test.py -s $1 +sleep 1 +python3 ./test.py $1 -f import_merge/importCacheFileSub.py +python3 ./test.py -s $1 +sleep 1 +python3 ./test.py $1 -f import_merge/importCacheFileTO.py +python3 ./test.py -s $1 +sleep 1 +python3 ./test.py $1 -f import_merge/importCacheFileT.py +python3 ./test.py -s $1 +sleep 1 +python3 ./test.py $1 -f import_merge/importDataLastSub.py +python3 ./test.py -s $1 +sleep 1 +python3 ./test.py $1 -f import_merge/importHead.py +python3 ./test.py -s $1 +sleep 1 +python3 ./test.py $1 -f import_merge/importLastTO.py +python3 ./test.py -s $1 +sleep 1 +python3 ./test.py $1 -f import_merge/importLastT.py +python3 ./test.py -s $1 +sleep 1 +python3 ./test.py $1 -f import_merge/importSpan.py +python3 ./test.py -s $1 +sleep 1 +python3 ./test.py $1 -f import_merge/importSRestart.py +python3 ./test.py -s $1 +sleep 1 +python3 ./test.py $1 -f import_merge/importSubRestart.py +python3 ./test.py -s $1 +sleep 1 +python3 ./test.py $1 -f import_merge/importTailOverlap.py +python3 ./test.py -s $1 +sleep 1 +python3 ./test.py $1 -f import_merge/importTail.py +python3 ./test.py -s $1 +sleep 1 +python3 ./test.py $1 -f import_merge/importTORestart.py +python3 ./test.py -s $1 +sleep 1 +python3 ./test.py $1 -f import_merge/importTPORestart.py +python3 ./test.py -s $1 +sleep 1 +python3 ./test.py $1 -f import_merge/importTRestart.py python3 ./test.py -s $1 sleep 1 From 118144968ae3dabcb23d335f87d87e92fcc0c011 Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Sat, 9 May 2020 01:13:56 +0800 Subject: [PATCH 03/23] add insert/nchar.py --- tests/pytest/insert/nchar.py | 44 ++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 tests/pytest/insert/nchar.py diff --git a/tests/pytest/insert/nchar.py b/tests/pytest/insert/nchar.py new file mode 100644 index 0000000000..d61a44844d --- /dev/null +++ b/tests/pytest/insert/nchar.py @@ -0,0 +1,44 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +import sys +from util.log import * +from util.cases import * +from util.sql import * + + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + tdSql.prepare() + + tdSql.execute('create table tb (ts timestamp, col nchar(10))') + tdSql.execute("insert into tb values (now, 'taosdata')") + tdSql.query("select * from tb") + tdSql.checkRows(1) + tdSql.checkData(0, 1, 'taosdata') + tdSql.execute("insert into tb values (now, '涛思数据')") + tdSql.query("select * from tb") + tdSql.checkRows(2) + tdSql.checkData(1, 1, '涛思数据') + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) From 1445c34196d5c04d0bdd035e42073659a54700eb Mon Sep 17 00:00:00 2001 From: liu0x54 Date: Sat, 9 May 2020 02:05:25 +0000 Subject: [PATCH 04/23] [TD-228] fix rest API to support binary interface change --- src/plugins/http/src/restJson.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/http/src/restJson.c b/src/plugins/http/src/restJson.c index 9277d7d045..2d9c31935c 100644 --- a/src/plugins/http/src/restJson.c +++ b/src/plugins/http/src/restJson.c @@ -94,6 +94,7 @@ bool restBuildSqlJson(HttpContext *pContext, HttpSqlCmd *cmd, TAOS_RES *result, for (int k = 0; k < numOfRows; ++k) { TAOS_ROW row = taos_fetch_row(result); + int32_t* length = taos_fetch_lengths(result); // data row array begin httpJsonItemToken(jsonBuf); @@ -129,7 +130,7 @@ bool restBuildSqlJson(HttpContext *pContext, HttpSqlCmd *cmd, TAOS_RES *result, break; case TSDB_DATA_TYPE_BINARY: case TSDB_DATA_TYPE_NCHAR: - httpJsonStringForTransMean(jsonBuf, row[i], fields[i].bytes); + httpJsonStringForTransMean(jsonBuf, row[i], length[i]); break; case TSDB_DATA_TYPE_TIMESTAMP: if (timestampFormat == REST_TIMESTAMP_FMT_LOCAL_STRING) { From 75029e98899472b0bb67b90be2edcd2b91f8a339 Mon Sep 17 00:00:00 2001 From: hjxilinx Date: Sat, 9 May 2020 10:32:27 +0800 Subject: [PATCH 05/23] [td-225] 1. fix bugs for first/last query in super table; 2. add STableIdTag info function --- cmake/platform.inc | 2 +- src/client/src/tscFunctionImpl.c | 7 +- src/client/src/tscSQLParser.c | 65 +- src/client/src/tscSubquery.c | 68 +- src/inc/ttokendef.h | 27 +- src/query/inc/sql.y | 2 +- src/query/inc/tsqlfunction.h | 14 - src/query/src/qtokenizer.c | 1 + src/query/src/queryExecutor.c | 184 ++-- src/query/src/sql.c | 1348 +++++++++++++++--------------- 10 files changed, 902 insertions(+), 816 deletions(-) diff --git a/cmake/platform.inc b/cmake/platform.inc index 2e0e2d6af0..1772a83fb2 100755 --- a/cmake/platform.inc +++ b/cmake/platform.inc @@ -62,7 +62,7 @@ IF (${CMAKE_SYSTEM_NAME} MATCHES "Linux") IF (${CMAKE_SIZEOF_VOID_P} MATCHES 8) SET(TD_LINUX_64 TRUE) SET(TD_OS_DIR ${TD_COMMUNITY_DIR}/src/os/linux) - ADD_DEFINITIONS(-D_M_X64) + ADD_DEFINITIONS(-D_M_X64 -D_DEBUG_VIEW) MESSAGE(STATUS "The current platform is Linux 64-bit") ELSEIF (${CMAKE_SIZEOF_VOID_P} MATCHES 4) IF (TD_ARM) diff --git a/src/client/src/tscFunctionImpl.c b/src/client/src/tscFunctionImpl.c index 28bfaf916b..c1944e96c9 100644 --- a/src/client/src/tscFunctionImpl.c +++ b/src/client/src/tscFunctionImpl.c @@ -168,9 +168,10 @@ int32_t getResultDataInfo(int32_t dataType, int32_t dataBytes, int32_t functionI return TSDB_CODE_SUCCESS; } + // (uid, tid) + VGID + TAGSIZE + VARSTR_HEADER_SIZE if (functionId == TSDB_FUNC_TID_TAG) { // todo use struct *type = TSDB_DATA_TYPE_BINARY; - *bytes = dataBytes + sizeof(int64_t) + sizeof(int32_t) + sizeof(int32_t); // (uid, tid) + VGID + TAGSIZE + *bytes = dataBytes + sizeof(int64_t) + sizeof(int32_t) + sizeof(int32_t) + VARSTR_HEADER_SIZE; *interBytes = *bytes; return TSDB_CODE_SUCCESS; } @@ -5285,10 +5286,10 @@ SQLAggFuncElem aAggs[] = {{ }, { // 34 - "tid_tag", // return table id and the corresponding tags for join match + "tid_tag", // return table id and the corresponding tags for join match and subscribe TSDB_FUNC_TID_TAG, TSDB_FUNC_TID_TAG, - TSDB_FUNCSTATE_MO, + TSDB_FUNCSTATE_MO | TSDB_FUNCSTATE_STABLE, function_setup, noop1, noop2, diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index 0b32dffff6..cd5dd6355a 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -1123,7 +1123,7 @@ int32_t parseSelectClause(SSqlCmd* pCmd, int32_t clauseIndex, tSQLExprList* pSel if (addProjectionExprAndResultField(pQueryInfo, pItem) != TSDB_CODE_SUCCESS) { return TSDB_CODE_INVALID_SQL; } - } else if (pItem->pNode->nSQLOptr >= TK_COUNT && pItem->pNode->nSQLOptr <= TK_AVG_IRATE) { + } else if (pItem->pNode->nSQLOptr >= TK_COUNT && pItem->pNode->nSQLOptr <= TK_TBID) { // sql function in selection clause, append sql function info in pSqlCmd structure sequentially if (addExprAndResultField(pQueryInfo, outputIndex, pItem, true) != TSDB_CODE_SUCCESS) { return TSDB_CODE_INVALID_SQL; @@ -1468,7 +1468,8 @@ static int32_t setExprInfoForFunctions(SQueryInfo* pQueryInfo, SSchema* pSchema, int32_t addExprAndResultField(SQueryInfo* pQueryInfo, int32_t colIndex, tSQLExprItem* pItem, bool finalResult) { STableMetaInfo* pTableMetaInfo = NULL; - int32_t optr = pItem->pNode->nSQLOptr; + + int32_t optr = pItem->pNode->nSQLOptr; const char* msg1 = "not support column types"; const char* msg2 = "invalid parameters"; @@ -1476,7 +1477,8 @@ int32_t addExprAndResultField(SQueryInfo* pQueryInfo, int32_t colIndex, tSQLExpr const char* msg4 = "invalid table name"; const char* msg5 = "parameter is out of range [0, 100]"; const char* msg6 = "function applied to tags not allowed"; - + const char* msg7 = "normal table can not apply this function"; + switch (optr) { case TK_COUNT: { if (pItem->pNode->pParam != NULL && pItem->pNode->pParam->nExpr != 1) { @@ -1858,13 +1860,68 @@ int32_t addExprAndResultField(SQueryInfo* pQueryInfo, int32_t colIndex, tSQLExpr } } + return TSDB_CODE_SUCCESS; + }; + + case TK_TBID: { + pTableMetaInfo = tscGetMetaInfo(pQueryInfo, 0); + if (UTIL_TABLE_IS_NOMRAL_TABLE(pTableMetaInfo)) { + return invalidSqlErrMsg(pQueryInfo->msg, msg7); + } + + // no parameters or more than one parameter for function + if (pItem->pNode->pParam == NULL || pItem->pNode->pParam->nExpr != 1) { + return invalidSqlErrMsg(pQueryInfo->msg, msg2); + } + + tSQLExpr* pParam = pItem->pNode->pParam->a[0].pNode; + + SColumnIndex index = COLUMN_INDEX_INITIALIZER; + if (getColumnIndexByName(&pParam->colInfo, pQueryInfo, &index) != TSDB_CODE_SUCCESS) { + return invalidSqlErrMsg(pQueryInfo->msg, msg3); + } + + pTableMetaInfo = tscGetMetaInfo(pQueryInfo, index.tableIndex); + SSchema* pSchema = tscGetTableTagSchema(pTableMetaInfo->pTableMeta); + + // functions can not be applied to normal columns + int32_t numOfCols = tscGetNumOfColumns(pTableMetaInfo->pTableMeta); + if (index.columnIndex < numOfCols) { + return invalidSqlErrMsg(pQueryInfo->msg, msg6); + } + + index.columnIndex -= numOfCols; + + // 2. valid the column type + int16_t colType = pSchema[index.columnIndex].type; + if (colType == TSDB_DATA_TYPE_BOOL || colType >= TSDB_DATA_TYPE_BINARY) { + return invalidSqlErrMsg(pQueryInfo->msg, msg1); + } + + tscColumnListInsert(pTableMetaInfo->tagColList, &index); + SSchema* pTagSchema = tscGetTableTagSchema(pTableMetaInfo->pTableMeta); + SSchema s = pTagSchema[index.columnIndex]; + + int16_t bytes = 0; + int16_t type = 0; + int16_t inter = 0; + + int32_t ret = getResultDataInfo(s.type, s.bytes, TSDB_FUNC_TID_TAG, 0, &type, &bytes, &inter, 0, 0); + assert(ret == TSDB_CODE_SUCCESS); + + s.type = type; + s.bytes = bytes; + + TSDB_QUERY_SET_TYPE(pQueryInfo->type, TSDB_QUERY_TYPE_TAG_FILTER_QUERY); + tscAddSpecialColumnForSelect(pQueryInfo, 0, TSDB_FUNC_TID_TAG, &index, &s, TSDB_COL_TAG); + return TSDB_CODE_SUCCESS; } + default: return TSDB_CODE_INVALID_SQL; } - } // todo refactor diff --git a/src/client/src/tscSubquery.c b/src/client/src/tscSubquery.c index be4d13bd97..5c5b725ea2 100644 --- a/src/client/src/tscSubquery.c +++ b/src/client/src/tscSubquery.c @@ -412,10 +412,6 @@ static void updateQueryTimeRange(SQueryInfo* pQueryInfo, int64_t st, int64_t et) static void tSIntersectionAndLaunchSecQuery(SJoinSupporter* pSupporter, SSqlObj* pSql) { SSqlObj* pParentSql = pSupporter->pObj; -// SSqlCmd* pCmd = &pSql->cmd; -// SSqlRes* pRes = &pSql->res; - -// SQueryInfo *pQueryInfo = tscGetQueryInfoDetail(pCmd, pCmd->clauseIndex); SQueryInfo* pParentQueryInfo = tscGetQueryInfoDetail(&pParentSql->cmd, pParentSql->cmd.clauseIndex); // if (tscNonOrderedProjectionQueryOnSTable(pParentQueryInfo, 0)) { @@ -602,21 +598,6 @@ static void joinRetrieveCallback(void* param, TAOS_RES* tres, int numOfRows) { SQueryInfo *pQueryInfo = tscGetQueryInfoDetail(pCmd, pCmd->clauseIndex); -// if (pSupporter->pState->code != TSDB_CODE_SUCCESS) { -// tscError("%p abort query due to other subquery failure. code:%d, global code:%s", pSql, numOfRows, -// tstrerror(pSupporter->pState->code)); -// -// quitAllSubquery(pParentSql, pSupporter); -// return; -// } -// -// if (numOfRows < 0) { -// tscError("%p sub query failed, code:%s, index:%d", pSql, tstrerror(numOfRows), pSupporter->subqueryIndex); -// pSupporter->pState->code = numOfRows; -// quitAllSubquery(pParentSql, pSupporter); -// return; -// } - // response of tag retrieve if (TSDB_QUERY_HAS_TYPE(pQueryInfo->type, TSDB_QUERY_TYPE_TAG_FILTER_QUERY)) { if (numOfRows == 0 || pSql->res.completed) { @@ -1051,6 +1032,55 @@ void tscJoinQueryCallback(void* param, TAOS_RES* tres, int code) { ///////////////////////////////////////////////////////////////////////////////////////// static void tscRetrieveDataRes(void *param, TAOS_RES *tres, int code); +//static void ddx(TAOS* taos) { +// +// SSqlCmd* pCmd = &pSql->cmd; +// +// tscPartiallyFreeSqlObj(pSql); +//// tscTrace("continue parse sql: %s", pSql->cmd.curSql); +// +// SQueryInfo* pQueryInfo = NULL; +// int32_t code = tscGetQueryInfoDetailSafely(pCmd, pCmd->clauseIndex, &pQueryInfo); +// assert(code == TSDB_CODE_SUCCESS); +// +// STableMetaInfo* pTableMetaInfo = tscGetMetaInfo(pQueryInfo, 0); +// +// if (UTIL_TABLE_IS_SUPERTABLE(pTableMetaInfo)) { // return the tableId & tag +// SSchema s = {0}; +// SColumnIndex index = {0}; +// +// size_t numOfTags = taosArrayGetSize(pTableMetaInfo->tagColList); +// for (int32_t i = 0; i < numOfTags; ++i) { +// SColumn* c = taosArrayGetP(pTableMetaInfo->tagColList, i); +// index = (SColumnIndex){.tableIndex = 0, .columnIndex = c->colIndex.columnIndex}; +// +// SSchema* pTagSchema = tscGetTableTagSchema(pTableMetaInfo->pTableMeta); +// s = pTagSchema[c->colIndex.columnIndex]; +// +// int16_t bytes = 0; +// int16_t type = 0; +// int16_t inter = 0; +// +// getResultDataInfo(s.type, s.bytes, TSDB_FUNC_TID_TAG, 0, &type, &bytes, &inter, 0, 0); +// +// s.type = type; +// s.bytes = bytes; +//// pSupporter->tagSize = s.bytes; +// } +// +// // set get tags query type +// TSDB_QUERY_SET_TYPE(pQueryInfo->type, TSDB_QUERY_TYPE_TAG_FILTER_QUERY); +// +// tscAddSpecialColumnForSelect(pQueryInfo, 0, TSDB_FUNC_TID_TAG, &index, &s, TSDB_COL_TAG); +// size_t numOfCols = taosArrayGetSize(pQueryInfo->colList); +// +// tscTrace( "%p vgroupIndex:%d, type:%d, tid_tag query to retrieve (tableId, tags), " +// "exprInfo:%d, colList:%d, fieldsInfo:%d, name:%s", +// pSql, pTableMetaInfo->vgroupIndex, pQueryInfo->type, tscSqlExprNumOfExprs(pQueryInfo), +// numOfCols, pQueryInfo->fieldsInfo.numOfOutput, pQueryInfo->pTableMetaInfo[0]->name); +// } +//} + static SSqlObj *tscCreateSqlObjForSubquery(SSqlObj *pSql, SRetrieveSupport *trsupport, SSqlObj *prevSqlObj); // todo merge with callback diff --git a/src/inc/ttokendef.h b/src/inc/ttokendef.h index fa5f75f95b..effaafc4e7 100644 --- a/src/inc/ttokendef.h +++ b/src/inc/ttokendef.h @@ -206,19 +206,20 @@ #define TK_SUM_IRATE 188 #define TK_AVG_RATE 189 #define TK_AVG_IRATE 190 -#define TK_SEMI 191 -#define TK_NONE 192 -#define TK_PREV 193 -#define TK_LINEAR 194 -#define TK_IMPORT 195 -#define TK_METRIC 196 -#define TK_TBNAME 197 -#define TK_JOIN 198 -#define TK_METRICS 199 -#define TK_STABLE 200 -#define TK_INSERT 201 -#define TK_INTO 202 -#define TK_VALUES 203 +#define TK_TBID 191 +#define TK_SEMI 192 +#define TK_NONE 193 +#define TK_PREV 194 +#define TK_LINEAR 195 +#define TK_IMPORT 196 +#define TK_METRIC 197 +#define TK_TBNAME 198 +#define TK_JOIN 199 +#define TK_METRICS 200 +#define TK_STABLE 201 +#define TK_INSERT 202 +#define TK_INTO 203 +#define TK_VALUES 204 #endif diff --git a/src/query/inc/sql.y b/src/query/inc/sql.y index 0a32947921..dd104ba2d2 100644 --- a/src/query/inc/sql.y +++ b/src/query/inc/sql.y @@ -655,5 +655,5 @@ cmd ::= KILL QUERY IPTOKEN(X) COLON(Z) INTEGER(Y) COLON(K) INTEGER(F). {X DELIMITERS DESC DETACH EACH END EXPLAIN FAIL FOR GLOB IGNORE IMMEDIATE INITIALLY INSTEAD LIKE MATCH KEY OF OFFSET RAISE REPLACE RESTRICT ROW STATEMENT TRIGGER VIEW ALL COUNT SUM AVG MIN MAX FIRST LAST TOP BOTTOM STDDEV PERCENTILE APERCENTILE LEASTSQUARES HISTOGRAM DIFF - SPREAD TWA INTERP LAST_ROW RATE IRATE SUM_RATE SUM_IRATE AVG_RATE AVG_IRATE NOW IPTOKEN SEMI NONE PREV LINEAR IMPORT + SPREAD TWA INTERP LAST_ROW RATE IRATE SUM_RATE SUM_IRATE AVG_RATE AVG_IRATE TBID NOW IPTOKEN SEMI NONE PREV LINEAR IMPORT METRIC TBNAME JOIN METRICS STABLE NULL INSERT INTO VALUES. diff --git a/src/query/inc/tsqlfunction.h b/src/query/inc/tsqlfunction.h index c409d4300c..a92f401323 100644 --- a/src/query/inc/tsqlfunction.h +++ b/src/query/inc/tsqlfunction.h @@ -245,21 +245,8 @@ enum { BLK_DATA_ALL_NEEDED = 0x3, }; -#define IS_FILE_BLOCK(x) (((x)&BLK_FILE_BLOCK) != 0) - -#define SET_FILE_BLOCK_FLAG(x) \ - do { \ - (x) &= (~BLK_CACHE_BLOCK); \ - (x) |= BLK_FILE_BLOCK; \ - } while (0); - -#define SET_CACHE_BLOCK_FLAG(x) ((x) = BLK_CACHE_BLOCK | BLK_BLOCK_LOADED); - #define SET_DATA_BLOCK_NOT_LOADED(x) ((x) &= (~BLK_BLOCK_LOADED)); -#define SET_DATA_BLOCK_LOADED(x) ((x) |= BLK_BLOCK_LOADED); -#define IS_DATA_BLOCK_LOADED(x) (((x)&BLK_BLOCK_LOADED) != 0) - typedef struct STwaInfo { TSKEY lastKey; int8_t hasResult; // flag to denote has value @@ -291,7 +278,6 @@ bool top_bot_datablock_filter(SQLFunctionCtx *pCtx, int32_t functionId, char *mi bool stableQueryFunctChanged(int32_t funcId); - void resetResultInfo(SResultInfo *pResInfo); void initResultInfo(SResultInfo *pResInfo); void setResultInfoBuf(SResultInfo *pResInfo, int32_t size, bool superTable); diff --git a/src/query/src/qtokenizer.c b/src/query/src/qtokenizer.c index 22cffafdaa..fc8e712530 100644 --- a/src/query/src/qtokenizer.c +++ b/src/query/src/qtokenizer.c @@ -225,6 +225,7 @@ static SKeyword keywordTable[] = { {"TBNAME", TK_TBNAME}, {"JOIN", TK_JOIN}, {"METRICS", TK_METRICS}, + {"TBID", TK_TBID}, {"STABLE", TK_STABLE}, {"FILE", TK_FILE}, {"VNODES", TK_VNODES}, diff --git a/src/query/src/queryExecutor.c b/src/query/src/queryExecutor.c index b84df58383..0ffc665e55 100644 --- a/src/query/src/queryExecutor.c +++ b/src/query/src/queryExecutor.c @@ -39,10 +39,10 @@ #define TSDB_COL_IS_TAG(f) (((f)&TSDB_COL_TAG) != 0) #define QUERY_IS_ASC_QUERY(q) (GET_FORWARD_DIRECTION_FACTOR((q)->order.order) == QUERY_ASC_FORWARD_STEP) -#define IS_MASTER_SCAN(runtime) (((runtime)->scanFlag & 1u) == MASTER_SCAN) -#define IS_SUPPLEMENT_SCAN(runtime) ((runtime)->scanFlag == SUPPLEMENTARY_SCAN) -#define SET_SUPPLEMENT_SCAN_FLAG(runtime) ((runtime)->scanFlag = SUPPLEMENTARY_SCAN) -#define SET_MASTER_SCAN_FLAG(runtime) ((runtime)->scanFlag = MASTER_SCAN) +#define IS_MASTER_SCAN(runtime) ((runtime)->scanFlag == MASTER_SCAN) +#define IS_REVERSE_SCAN(runtime) ((runtime)->scanFlag == SUPPLEMENTARY_SCAN) +#define SET_MASTER_SCAN_FLAG(runtime) ((runtime)->scanFlag = MASTER_SCAN) +#define SET_REVERSE_SCAN_FLAG(runtime) ((runtime)->scanFlag = SUPPLEMENTARY_SCAN) #define GET_QINFO_ADDR(x) ((void *)((char *)(x)-offsetof(SQInfo, runtimeEnv))) @@ -1101,7 +1101,7 @@ static bool functionNeedToExecute(SQueryRuntimeEnv *pRuntimeEnv, SQLFunctionCtx } // in the supplementary scan, only the following functions need to be executed - if (IS_SUPPLEMENT_SCAN(pRuntimeEnv) && + if (IS_REVERSE_SCAN(pRuntimeEnv) && !(functionId == TSDB_FUNC_LAST_DST || functionId == TSDB_FUNC_FIRST_DST || functionId == TSDB_FUNC_FIRST || functionId == TSDB_FUNC_LAST || functionId == TSDB_FUNC_TAG || functionId == TSDB_FUNC_TS)) { return false; @@ -2450,8 +2450,7 @@ static int64_t doScanAllDataBlocks(SQueryRuntimeEnv *pRuntimeEnv) { qTrace("QInfo:%p query start, qrange:%" PRId64 "-%" PRId64 ", lastkey:%" PRId64 ", order:%d", GET_QINFO_ADDR(pRuntimeEnv), pQuery->window.skey, pQuery->window.ekey, pQuery->lastKey, pQuery->order.order); - TsdbQueryHandleT pQueryHandle = - pRuntimeEnv->scanFlag == MASTER_SCAN ? pRuntimeEnv->pQueryHandle : pRuntimeEnv->pSecQueryHandle; + TsdbQueryHandleT pQueryHandle = IS_MASTER_SCAN(pRuntimeEnv)? pRuntimeEnv->pQueryHandle : pRuntimeEnv->pSecQueryHandle; while (tsdbNextDataBlock(pQueryHandle)) { if (isQueryKilled(GET_QINFO_ADDR(pRuntimeEnv))) { return 0; @@ -2835,11 +2834,12 @@ void copyResToQueryResultBuf(SQInfo *pQInfo, SQuery *pQuery) { return; // failed to save data in the disk } - // set current query completed - // if (pQInfo->numOfGroupResultPages == 0 && pQInfo->groupIndex == pQInfo->pSidSet->numOfSubSet) { - // pQInfo->tableIndex = pQInfo->pSidSet->numOfTables; - // return; - // } + // check if all results has been sent to client + int32_t numOfGroup = taosArrayGetSize(pQInfo->groupInfo.pGroupList); + if (pQInfo->numOfGroupResultPages == 0 && pQInfo->groupIndex == numOfGroup) { + pQInfo->tableIndex = pQInfo->groupInfo.numOfTables; // set query completed + return; + } } SQueryRuntimeEnv * pRuntimeEnv = &pQInfo->runtimeEnv; @@ -3087,7 +3087,31 @@ void setTableDataInfo(STableQueryInfo *pTableQueryInfo, int32_t tableIndex, int3 pTableQueryInfo->tableIndex = tableIndex; } -static void doDisableFunctsForSupplementaryScan(SQuery *pQuery, SWindowResInfo *pWindowResInfo, int32_t order) { +static void updateTableQueryInfoForReverseScan(SQuery *pQuery, STableQueryInfo *pTableQueryInfo) { + if (pTableQueryInfo == NULL) { + return; + } + + // order has change already! + int32_t step = GET_FORWARD_DIRECTION_FACTOR(pQuery->order.order); + if (!QUERY_IS_ASC_QUERY(pQuery)) { + assert(pTableQueryInfo->win.ekey >= pTableQueryInfo->lastKey + step); + } else { + assert(pTableQueryInfo->win.ekey <= pTableQueryInfo->lastKey + step); + } + + pTableQueryInfo->win.ekey = pTableQueryInfo->lastKey + step; + + SWAP(pTableQueryInfo->win.skey, pTableQueryInfo->win.ekey, TSKEY); + pTableQueryInfo->lastKey = pTableQueryInfo->win.skey; + + SWITCH_ORDER(pTableQueryInfo->cur.order); + pTableQueryInfo->cur.vgroupIndex = -1; +} + +static void disableFuncInReverseScanImpl(SQInfo* pQInfo, SWindowResInfo *pWindowResInfo, int32_t order) { + SQuery* pQuery = pQInfo->runtimeEnv.pQuery; + for (int32_t i = 0; i < pWindowResInfo->size; ++i) { SWindowStatus *pStatus = getTimeWindowResStatus(pWindowResInfo, i); if (!pStatus->closed) { @@ -3108,18 +3132,32 @@ static void doDisableFunctsForSupplementaryScan(SQuery *pQuery, SWindowResInfo * } } } + + int32_t numOfGroups = taosArrayGetSize(pQInfo->groupInfo.pGroupList); + + for(int32_t i = 0; i < numOfGroups; ++i) { + SArray *group = taosArrayGetP(pQInfo->groupInfo.pGroupList, i); + qTrace("QInfo:%p no result in group %d, continue", pQInfo, pQInfo->groupIndex - 1); + + size_t t = taosArrayGetSize(group); + for (int32_t j = 0; j < t; ++j) { + SGroupItem *item = taosArrayGet(group, j); + updateTableQueryInfoForReverseScan(pQuery, item->info); + } + } } -void disableFuncInReverseScan(SQueryRuntimeEnv *pRuntimeEnv) { +void disableFuncInReverseScan(SQInfo *pQInfo) { + SQueryRuntimeEnv* pRuntimeEnv = &pQInfo->runtimeEnv; SQuery *pQuery = pRuntimeEnv->pQuery; int32_t order = pQuery->order.order; // group by normal columns and interval query on normal table SWindowResInfo *pWindowResInfo = &pRuntimeEnv->windowResInfo; if (isGroupbyNormalCol(pQuery->pGroupbyExpr) || isIntervalQuery(pQuery)) { - doDisableFunctsForSupplementaryScan(pQuery, pWindowResInfo, order); + disableFuncInReverseScanImpl(pQInfo, pWindowResInfo, order); } else { // for simple result of table query, - for (int32_t j = 0; j < pQuery->numOfOutput; ++j) { + for (int32_t j = 0; j < pQuery->numOfOutput; ++j) { // todo refactor int32_t functId = pQuery->pSelectExpr[j].base.functionId; SQLFunctionCtx *pCtx = &pRuntimeEnv->pCtx[j]; @@ -3134,34 +3172,10 @@ void disableFuncInReverseScan(SQueryRuntimeEnv *pRuntimeEnv) { } } -void disableFuncForReverseScan(SQInfo *pQInfo, int32_t order) { - SQueryRuntimeEnv *pRuntimeEnv = &pQInfo->runtimeEnv; - SQuery * pQuery = pRuntimeEnv->pQuery; - - for (int32_t i = 0; i < pQuery->numOfOutput; ++i) { - pRuntimeEnv->pCtx[i].order = (pRuntimeEnv->pCtx[i].order) ^ 1u; - } - - if (isIntervalQuery(pQuery)) { - // for (int32_t i = 0; i < pQInfo->groupInfo.numOfTables; ++i) { - // STableQueryInfo *pTableQueryInfo = pQInfo->pTableQueryInfo[i].pTableQInfo; - // SWindowResInfo * pWindowResInfo = &pTableQueryInfo->windowResInfo; - // - // doDisableFunctsForSupplementaryScan(pQuery, pWindowResInfo, order); - // } - } else { - SWindowResInfo *pWindowResInfo = &pRuntimeEnv->windowResInfo; - doDisableFunctsForSupplementaryScan(pQuery, pWindowResInfo, order); - } - - pQuery->order.order = (pQuery->order.order) ^ 1u; -} - void switchCtxOrder(SQueryRuntimeEnv *pRuntimeEnv) { SQuery *pQuery = pRuntimeEnv->pQuery; for (int32_t i = 0; i < pQuery->numOfOutput; ++i) { - SWITCH_ORDER(pRuntimeEnv->pCtx[i] - .order); // = (pRuntimeEnv->pCtx[i].order == TSDB_ORDER_ASC)? TSDB_ORDER_DESC:TSDB_ORDER_ASC; + SWITCH_ORDER(pRuntimeEnv->pCtx[i] .order); } } @@ -3358,7 +3372,7 @@ static void setEnvBeforeReverseScan(SQueryRuntimeEnv *pRuntimeEnv, SQueryStatusI SWAP(pQuery->window.skey, pQuery->window.ekey, TSKEY); SWITCH_ORDER(pQuery->order.order); - SET_SUPPLEMENT_SCAN_FLAG(pRuntimeEnv); + SET_REVERSE_SCAN_FLAG(pRuntimeEnv); STsdbQueryCond cond = { .twindow = pQuery->window, @@ -3376,7 +3390,7 @@ static void setEnvBeforeReverseScan(SQueryRuntimeEnv *pRuntimeEnv, SQueryStatusI setQueryStatus(pQuery, QUERY_NOT_COMPLETED); switchCtxOrder(pRuntimeEnv); - disableFuncInReverseScan(pRuntimeEnv); + disableFuncInReverseScan(pQInfo); } static void clearEnvAfterReverseScan(SQueryRuntimeEnv *pRuntimeEnv, SQueryStatusInfo *pStatus) { @@ -3533,28 +3547,6 @@ void destroyTableQueryInfo(STableQueryInfo *pTableQueryInfo, int32_t numOfCols) free(pTableQueryInfo); } -void changeMeterQueryInfoForSuppleQuery(SQuery *pQuery, STableQueryInfo *pTableQueryInfo) { - if (pTableQueryInfo == NULL) { - return; - } - - // order has change already! - int32_t step = GET_FORWARD_DIRECTION_FACTOR(pQuery->order.order); - if (!QUERY_IS_ASC_QUERY(pQuery)) { - assert(pTableQueryInfo->win.ekey >= pTableQueryInfo->lastKey + step); - } else { - assert(pTableQueryInfo->win.ekey <= pTableQueryInfo->lastKey + step); - } - - pTableQueryInfo->win.ekey = pTableQueryInfo->lastKey + step; - - SWAP(pTableQueryInfo->win.skey, pTableQueryInfo->win.ekey, TSKEY); - pTableQueryInfo->lastKey = pTableQueryInfo->win.skey; - - pTableQueryInfo->cur.order = pTableQueryInfo->cur.order ^ 1u; - pTableQueryInfo->cur.vgroupIndex = -1; -} - void restoreIntervalQueryRange(SQueryRuntimeEnv *pRuntimeEnv, STableQueryInfo *pTableQueryInfo) { SQuery *pQuery = pRuntimeEnv->pQuery; @@ -3943,9 +3935,16 @@ static void doCopyQueryResultToMsg(SQInfo *pQInfo, int32_t numOfRows, char *data data += bytes * numOfRows; } + // all data returned, set query over if (Q_STATUS_EQUAL(pQuery->status, QUERY_COMPLETED)) { - setQueryStatus(pQuery, QUERY_OVER); + if (pQInfo->runtimeEnv.stableQuery && isIntervalQuery(pQuery)) { + if (pQInfo->tableIndex >= pQInfo->groupInfo.numOfTables) { + setQueryStatus(pQuery, QUERY_OVER); + } + } else { + setQueryStatus(pQuery, QUERY_OVER); + } } } @@ -4368,7 +4367,8 @@ static int64_t queryOnDataBlocks(SQInfo *pQInfo) { int64_t st = taosGetTimestampMs(); - TsdbQueryHandleT *pQueryHandle = pRuntimeEnv->pQueryHandle; + TsdbQueryHandleT pQueryHandle = IS_MASTER_SCAN(pRuntimeEnv)? pRuntimeEnv->pQueryHandle : pRuntimeEnv->pSecQueryHandle; + while (tsdbNextDataBlock(pQueryHandle)) { if (isQueryKilled(pQInfo)) { break; @@ -4400,7 +4400,7 @@ static int64_t queryOnDataBlocks(SQInfo *pQInfo) { } } - assert(pTableQueryInfo != NULL && pTableQueryInfo != NULL); + assert(pTableQueryInfo != NULL); restoreIntervalQueryRange(pRuntimeEnv, pTableQueryInfo); SDataStatis *pStatis = NULL; @@ -4759,28 +4759,35 @@ static void createTableQueryInfo(SQInfo *pQInfo) { } } -static void prepareQueryInfoForReverseScan(SQInfo *pQInfo) { - // SQuery *pQuery = pQInfo->runtimeEnv.pQuery; - - // for (int32_t i = 0; i < pQInfo->groupInfo.numOfTables; ++i) { - // STableQueryInfo *pTableQueryInfo = pQInfo->pTableQueryInfo[i].pTableQInfo; - // changeMeterQueryInfoForSuppleQuery(pQuery, pTableQueryInfo); - // } -} - static void doSaveContext(SQInfo *pQInfo) { SQueryRuntimeEnv *pRuntimeEnv = &pQInfo->runtimeEnv; SQuery * pQuery = pRuntimeEnv->pQuery; - SET_SUPPLEMENT_SCAN_FLAG(pRuntimeEnv); - disableFuncForReverseScan(pQInfo, pQuery->order.order); - - if (pRuntimeEnv->pTSBuf != NULL) { - pRuntimeEnv->pTSBuf->cur.order = pRuntimeEnv->pTSBuf->cur.order ^ 1u; - } - + SET_REVERSE_SCAN_FLAG(pRuntimeEnv); SWAP(pQuery->window.skey, pQuery->window.ekey, TSKEY); - prepareQueryInfoForReverseScan(pQInfo); + SWITCH_ORDER(pQuery->order.order); + + if (pRuntimeEnv->pTSBuf != NULL) { + pRuntimeEnv->pTSBuf->cur.order = pQuery->order.order; + } + + STsdbQueryCond cond = { + .twindow = pQuery->window, + .order = pQuery->order.order, + .colList = pQuery->colList, + .numOfCols = pQuery->numOfCols, + }; + + // clean unused handle + if (pRuntimeEnv->pSecQueryHandle != NULL) { + tsdbCleanupQueryHandle(pRuntimeEnv->pSecQueryHandle); + } + + pRuntimeEnv->pSecQueryHandle = tsdbQueryTables(pQInfo->tsdb, &cond, &pQInfo->tableIdGroupInfo); + + setQueryStatus(pQuery, QUERY_NOT_COMPLETED); + switchCtxOrder(pRuntimeEnv); + disableFuncInReverseScan(pQInfo); } static void doRestoreContext(SQInfo *pQInfo) { @@ -4835,8 +4842,6 @@ static void multiTableQueryProcess(SQInfo *pQInfo) { copyFromWindowResToSData(pQInfo, pRuntimeEnv->windowResInfo.pResult); } - pQuery->rec.rows += pQuery->rec.rows; - if (pQuery->rec.rows == 0) { // vnodePrintQueryStatistics(pSupporter); } @@ -6287,7 +6292,10 @@ static void buildTagQueryResult(SQInfo* pQInfo) { SGroupItem* item = taosArrayGet(pa, i); char* output = pQuery->sdata[0]->data + i * rsize; - *(int64_t*) output = item->id.uid; // memory align problem + varDataSetLen(output, rsize - VARSTR_HEADER_SIZE); + + output = varDataVal(output); + *(int64_t*) output = item->id.uid; // memory align problem, todo serialize output += sizeof(item->id.uid); *(int32_t*) output = item->id.tid; diff --git a/src/query/src/sql.c b/src/query/src/sql.c index 19bc05887c..d079e5a24e 100644 --- a/src/query/src/sql.c +++ b/src/query/src/sql.c @@ -97,26 +97,26 @@ #endif /************* Begin control #defines *****************************************/ #define YYCODETYPE unsigned short int -#define YYNOCODE 269 +#define YYNOCODE 270 #define YYACTIONTYPE unsigned short int #define ParseTOKENTYPE SSQLToken typedef union { int yyinit; ParseTOKENTYPE yy0; - tSQLExpr* yy2; - tSQLExprList* yy10; - TAOS_FIELD yy47; - SCreateAcctSQL yy63; - SSubclauseInfo* yy145; - int yy196; - SLimitVal yy230; - int64_t yy373; - SQuerySQL* yy392; - tVariant yy442; - tVariantList* yy456; - SCreateDBInfo yy478; - SCreateTableSQL* yy494; - tFieldList* yy503; + int yy150; + SQuerySQL* yy190; + SCreateAcctSQL yy219; + tSQLExprList* yy260; + SSubclauseInfo* yy263; + int64_t yy279; + SLimitVal yy284; + tVariantList* yy322; + TAOS_FIELD yy325; + tFieldList* yy369; + SCreateDBInfo yy374; + SCreateTableSQL* yy408; + tSQLExpr* yy500; + tVariant yy518; } YYMINORTYPE; #ifndef YYSTACKDEPTH #define YYSTACKDEPTH 100 @@ -128,7 +128,7 @@ typedef union { #define YYFALLBACK 1 #define YYNSTATE 247 #define YYNRULE 220 -#define YYNTOKEN 204 +#define YYNTOKEN 205 #define YY_MAX_SHIFT 246 #define YY_MIN_SHIFTREDUCE 403 #define YY_MAX_SHIFTREDUCE 622 @@ -222,121 +222,121 @@ static const YYACTIONTYPE yy_action[] = { /* 150 */ 26, 739, 169, 34, 33, 220, 219, 32, 31, 30, /* 160 */ 16, 239, 214, 238, 213, 212, 211, 237, 210, 236, /* 170 */ 235, 209, 720, 828, 709, 710, 711, 712, 713, 714, - /* 180 */ 715, 716, 717, 718, 719, 162, 591, 225, 234, 582, - /* 190 */ 165, 585, 240, 588, 76, 162, 591, 98, 827, 582, - /* 200 */ 234, 585, 60, 588, 26, 162, 591, 12, 742, 582, - /* 210 */ 742, 585, 151, 588, 27, 21, 740, 159, 160, 34, - /* 220 */ 33, 202, 531, 32, 31, 30, 148, 159, 160, 190, - /* 230 */ 536, 539, 88, 87, 142, 18, 674, 159, 160, 126, - /* 240 */ 147, 177, 152, 39, 37, 40, 38, 226, 185, 739, - /* 250 */ 182, 34, 33, 559, 560, 32, 31, 30, 523, 666, - /* 260 */ 17, 520, 126, 521, 842, 522, 550, 26, 16, 239, - /* 270 */ 46, 238, 243, 242, 95, 237, 551, 236, 235, 608, - /* 280 */ 14, 42, 584, 13, 587, 140, 583, 187, 586, 170, - /* 290 */ 171, 42, 590, 50, 150, 47, 74, 78, 83, 86, - /* 300 */ 77, 42, 590, 580, 592, 507, 80, 589, 13, 161, - /* 310 */ 51, 527, 590, 528, 48, 513, 525, 589, 526, 46, - /* 320 */ 141, 116, 117, 68, 64, 67, 741, 589, 130, 128, - /* 330 */ 91, 90, 89, 223, 222, 143, 512, 207, 144, 581, - /* 340 */ 22, 22, 73, 72, 85, 84, 145, 3, 10, 9, - /* 350 */ 146, 137, 798, 133, 138, 136, 797, 163, 755, 524, - /* 360 */ 733, 794, 763, 793, 164, 224, 100, 780, 779, 114, - /* 370 */ 115, 26, 676, 208, 112, 131, 189, 24, 217, 673, - /* 380 */ 218, 841, 70, 840, 838, 118, 93, 694, 25, 52, - /* 390 */ 23, 546, 192, 132, 196, 663, 79, 661, 81, 752, - /* 400 */ 82, 104, 49, 659, 658, 172, 127, 656, 655, 654, - /* 410 */ 653, 652, 44, 644, 199, 129, 650, 648, 646, 201, - /* 420 */ 767, 197, 768, 781, 195, 193, 28, 216, 75, 227, - /* 430 */ 228, 229, 230, 231, 205, 232, 53, 233, 241, 622, - /* 440 */ 149, 173, 62, 65, 174, 175, 657, 176, 621, 179, - /* 450 */ 178, 180, 651, 121, 92, 120, 695, 119, 94, 123, - /* 460 */ 122, 124, 125, 1, 2, 737, 181, 620, 105, 108, - /* 470 */ 106, 109, 107, 110, 111, 183, 184, 613, 186, 190, - /* 480 */ 533, 55, 547, 101, 156, 57, 552, 19, 194, 102, - /* 490 */ 5, 6, 593, 4, 15, 20, 7, 204, 63, 206, - /* 500 */ 484, 481, 479, 478, 477, 475, 448, 215, 66, 45, - /* 510 */ 509, 22, 508, 506, 54, 69, 469, 467, 459, 465, - /* 520 */ 461, 463, 457, 71, 455, 483, 482, 480, 476, 474, - /* 530 */ 46, 446, 419, 417, 626, 625, 625, 625, 625, 96, - /* 540 */ 625, 625, 625, 625, 625, 625, 97, + /* 180 */ 715, 716, 717, 718, 719, 162, 591, 234, 76, 582, + /* 190 */ 165, 585, 240, 588, 234, 162, 591, 98, 827, 582, + /* 200 */ 225, 585, 60, 588, 26, 162, 591, 12, 742, 582, + /* 210 */ 742, 585, 674, 588, 27, 126, 21, 159, 160, 34, + /* 220 */ 33, 202, 842, 32, 31, 30, 148, 159, 160, 740, + /* 230 */ 536, 539, 88, 87, 142, 18, 666, 159, 160, 126, + /* 240 */ 147, 559, 560, 39, 37, 40, 38, 50, 226, 550, + /* 250 */ 739, 34, 33, 46, 507, 32, 31, 30, 523, 531, + /* 260 */ 17, 520, 151, 521, 51, 522, 190, 26, 16, 239, + /* 270 */ 152, 238, 243, 242, 95, 237, 551, 236, 235, 177, + /* 280 */ 14, 42, 223, 222, 580, 741, 185, 187, 182, 170, + /* 290 */ 171, 42, 590, 584, 150, 587, 74, 78, 83, 86, + /* 300 */ 77, 42, 590, 161, 608, 592, 80, 589, 13, 13, + /* 310 */ 140, 583, 590, 586, 513, 47, 141, 589, 46, 798, + /* 320 */ 581, 116, 117, 68, 64, 67, 143, 589, 130, 128, + /* 330 */ 91, 90, 89, 512, 48, 207, 527, 22, 528, 22, + /* 340 */ 144, 3, 73, 72, 10, 9, 145, 525, 146, 526, + /* 350 */ 85, 84, 137, 797, 133, 138, 136, 163, 794, 524, + /* 360 */ 793, 164, 763, 733, 224, 100, 755, 780, 779, 114, + /* 370 */ 26, 115, 112, 676, 208, 131, 24, 217, 673, 218, + /* 380 */ 841, 70, 840, 838, 118, 694, 25, 93, 23, 132, + /* 390 */ 663, 79, 189, 546, 661, 192, 81, 82, 659, 658, + /* 400 */ 172, 127, 656, 196, 655, 654, 653, 652, 644, 129, + /* 410 */ 650, 648, 646, 52, 752, 767, 49, 44, 768, 781, + /* 420 */ 201, 199, 197, 195, 193, 28, 216, 75, 227, 228, + /* 430 */ 229, 230, 205, 232, 231, 53, 233, 241, 622, 149, + /* 440 */ 173, 62, 65, 174, 176, 175, 621, 178, 179, 180, + /* 450 */ 181, 657, 121, 120, 695, 125, 119, 122, 123, 92, + /* 460 */ 124, 651, 1, 106, 104, 737, 94, 105, 620, 109, + /* 470 */ 107, 108, 110, 111, 2, 184, 613, 183, 186, 190, + /* 480 */ 533, 55, 547, 156, 101, 57, 552, 194, 102, 5, + /* 490 */ 6, 63, 484, 593, 4, 19, 20, 15, 204, 7, + /* 500 */ 206, 481, 479, 478, 477, 475, 448, 215, 66, 45, + /* 510 */ 22, 509, 508, 69, 506, 54, 469, 467, 459, 465, + /* 520 */ 461, 463, 457, 455, 71, 483, 482, 480, 476, 474, + /* 530 */ 46, 446, 419, 417, 626, 625, 625, 625, 625, 625, + /* 540 */ 96, 625, 625, 625, 625, 625, 97, }; static const YYCODETYPE yy_lookahead[] = { - /* 0 */ 224, 1, 226, 257, 228, 257, 205, 206, 232, 9, - /* 10 */ 234, 235, 208, 13, 14, 208, 16, 17, 207, 208, - /* 20 */ 257, 21, 257, 1, 24, 25, 26, 27, 28, 266, - /* 30 */ 267, 9, 267, 33, 34, 257, 257, 37, 38, 39, - /* 40 */ 13, 14, 241, 16, 17, 266, 267, 240, 21, 242, - /* 50 */ 208, 24, 25, 26, 27, 28, 255, 208, 208, 208, - /* 60 */ 33, 34, 258, 225, 37, 38, 39, 45, 46, 47, + /* 0 */ 225, 1, 227, 258, 229, 258, 206, 207, 233, 9, + /* 10 */ 235, 236, 209, 13, 14, 209, 16, 17, 208, 209, + /* 20 */ 258, 21, 258, 1, 24, 25, 26, 27, 28, 267, + /* 30 */ 268, 9, 268, 33, 34, 258, 258, 37, 38, 39, + /* 40 */ 13, 14, 242, 16, 17, 267, 268, 241, 21, 243, + /* 50 */ 209, 24, 25, 26, 27, 28, 256, 209, 209, 209, + /* 60 */ 33, 34, 259, 226, 37, 38, 39, 45, 46, 47, /* 70 */ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, - /* 80 */ 1, 243, 13, 14, 208, 16, 17, 208, 9, 63, - /* 90 */ 21, 242, 208, 24, 25, 26, 27, 28, 37, 38, - /* 100 */ 39, 101, 33, 34, 241, 263, 37, 38, 39, 14, - /* 110 */ 259, 16, 17, 263, 257, 265, 21, 208, 255, 24, - /* 120 */ 25, 26, 27, 28, 240, 98, 242, 97, 33, 34, - /* 130 */ 100, 101, 37, 38, 39, 212, 16, 17, 215, 263, - /* 140 */ 261, 21, 263, 97, 24, 25, 26, 27, 28, 240, - /* 150 */ 104, 242, 126, 33, 34, 129, 130, 37, 38, 39, + /* 80 */ 1, 244, 13, 14, 209, 16, 17, 209, 9, 63, + /* 90 */ 21, 243, 209, 24, 25, 26, 27, 28, 37, 38, + /* 100 */ 39, 101, 33, 34, 242, 264, 37, 38, 39, 14, + /* 110 */ 260, 16, 17, 264, 258, 266, 21, 209, 256, 24, + /* 120 */ 25, 26, 27, 28, 241, 98, 243, 97, 33, 34, + /* 130 */ 100, 101, 37, 38, 39, 213, 16, 17, 216, 264, + /* 140 */ 262, 21, 264, 97, 24, 25, 26, 27, 28, 241, + /* 150 */ 104, 243, 126, 33, 34, 129, 130, 37, 38, 39, /* 160 */ 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, - /* 170 */ 95, 96, 224, 257, 226, 227, 228, 229, 230, 231, - /* 180 */ 232, 233, 234, 235, 236, 1, 2, 208, 78, 5, - /* 190 */ 225, 7, 225, 9, 72, 1, 2, 97, 257, 5, - /* 200 */ 78, 7, 244, 9, 104, 1, 2, 44, 243, 5, - /* 210 */ 243, 7, 257, 9, 256, 208, 237, 33, 34, 33, - /* 220 */ 34, 37, 98, 37, 38, 39, 63, 33, 34, 105, - /* 230 */ 102, 37, 69, 70, 71, 107, 212, 33, 34, 215, - /* 240 */ 77, 125, 257, 25, 26, 27, 28, 240, 132, 242, - /* 250 */ 134, 33, 34, 114, 115, 37, 38, 39, 2, 212, - /* 260 */ 97, 5, 215, 7, 243, 9, 98, 104, 85, 86, - /* 270 */ 102, 88, 60, 61, 62, 92, 98, 94, 95, 98, - /* 280 */ 102, 97, 5, 102, 7, 257, 5, 124, 7, 33, - /* 290 */ 34, 97, 108, 102, 131, 102, 64, 65, 66, 67, - /* 300 */ 68, 97, 108, 1, 98, 5, 74, 123, 102, 59, - /* 310 */ 119, 5, 108, 7, 121, 98, 5, 123, 7, 102, - /* 320 */ 257, 64, 65, 66, 67, 68, 243, 123, 64, 65, - /* 330 */ 66, 67, 68, 33, 34, 257, 98, 98, 257, 37, - /* 340 */ 102, 102, 127, 128, 72, 73, 257, 97, 127, 128, - /* 350 */ 257, 257, 238, 257, 257, 257, 238, 238, 241, 103, - /* 360 */ 239, 238, 208, 238, 238, 238, 208, 264, 264, 208, - /* 370 */ 208, 104, 208, 208, 245, 208, 241, 208, 208, 208, - /* 380 */ 208, 208, 208, 208, 208, 208, 59, 208, 208, 118, - /* 390 */ 208, 108, 260, 208, 260, 208, 208, 208, 208, 254, - /* 400 */ 208, 253, 120, 208, 208, 208, 208, 208, 208, 208, - /* 410 */ 208, 208, 117, 208, 116, 208, 208, 208, 208, 112, - /* 420 */ 209, 111, 209, 209, 110, 109, 122, 75, 84, 83, - /* 430 */ 49, 80, 82, 53, 209, 81, 209, 79, 75, 5, - /* 440 */ 209, 133, 213, 213, 5, 133, 209, 58, 5, 5, - /* 450 */ 133, 133, 209, 217, 210, 221, 223, 222, 210, 218, - /* 460 */ 220, 219, 216, 214, 211, 241, 58, 5, 252, 249, - /* 470 */ 251, 248, 250, 247, 246, 133, 58, 87, 125, 105, - /* 480 */ 98, 106, 98, 97, 1, 102, 98, 102, 97, 97, - /* 490 */ 113, 113, 98, 97, 97, 102, 97, 99, 72, 99, - /* 500 */ 9, 5, 5, 5, 5, 5, 76, 15, 72, 16, - /* 510 */ 5, 102, 5, 98, 97, 128, 5, 5, 5, 5, - /* 520 */ 5, 5, 5, 128, 5, 5, 5, 5, 5, 5, - /* 530 */ 102, 76, 59, 58, 0, 268, 268, 268, 268, 21, - /* 540 */ 268, 268, 268, 268, 268, 268, 21, 268, 268, 268, - /* 550 */ 268, 268, 268, 268, 268, 268, 268, 268, 268, 268, - /* 560 */ 268, 268, 268, 268, 268, 268, 268, 268, 268, 268, - /* 570 */ 268, 268, 268, 268, 268, 268, 268, 268, 268, 268, - /* 580 */ 268, 268, 268, 268, 268, 268, 268, 268, 268, 268, - /* 590 */ 268, 268, 268, 268, 268, 268, 268, 268, 268, 268, - /* 600 */ 268, 268, 268, 268, 268, 268, 268, 268, 268, 268, - /* 610 */ 268, 268, 268, 268, 268, 268, 268, 268, 268, 268, - /* 620 */ 268, 268, 268, 268, 268, 268, 268, 268, 268, 268, - /* 630 */ 268, 268, 268, 268, 268, 268, 268, 268, 268, 268, - /* 640 */ 268, 268, 268, 268, 268, 268, 268, 268, 268, 268, - /* 650 */ 268, 268, 268, 268, 268, 268, 268, 268, 268, 268, - /* 660 */ 268, 268, 268, 268, 268, 268, 268, 268, 268, 268, - /* 670 */ 268, 268, 268, 268, 268, 268, 268, 268, 268, 268, - /* 680 */ 268, 268, 268, 268, 268, 268, 268, 268, 268, 268, - /* 690 */ 268, 268, 268, 268, 268, 268, 268, 268, 268, 268, - /* 700 */ 268, 268, 268, 268, 268, 268, 268, 268, 268, 268, - /* 710 */ 268, 268, 268, 268, 268, 268, 268, 268, 268, 268, - /* 720 */ 268, 268, 268, 268, 268, 268, 268, 268, 268, 268, - /* 730 */ 268, 268, 268, 268, 268, 268, 268, 268, 268, 268, - /* 740 */ 268, 268, 268, 268, 268, 268, 268, 268, 268, 268, - /* 750 */ 268, + /* 170 */ 95, 96, 225, 258, 227, 228, 229, 230, 231, 232, + /* 180 */ 233, 234, 235, 236, 237, 1, 2, 78, 72, 5, + /* 190 */ 226, 7, 226, 9, 78, 1, 2, 97, 258, 5, + /* 200 */ 209, 7, 245, 9, 104, 1, 2, 44, 244, 5, + /* 210 */ 244, 7, 213, 9, 257, 216, 209, 33, 34, 33, + /* 220 */ 34, 37, 244, 37, 38, 39, 63, 33, 34, 238, + /* 230 */ 102, 37, 69, 70, 71, 107, 213, 33, 34, 216, + /* 240 */ 77, 114, 115, 25, 26, 27, 28, 102, 241, 98, + /* 250 */ 243, 33, 34, 102, 5, 37, 38, 39, 2, 98, + /* 260 */ 97, 5, 258, 7, 119, 9, 105, 104, 85, 86, + /* 270 */ 258, 88, 60, 61, 62, 92, 98, 94, 95, 125, + /* 280 */ 102, 97, 33, 34, 1, 244, 132, 124, 134, 33, + /* 290 */ 34, 97, 108, 5, 131, 7, 64, 65, 66, 67, + /* 300 */ 68, 97, 108, 59, 98, 98, 74, 123, 102, 102, + /* 310 */ 258, 5, 108, 7, 98, 102, 258, 123, 102, 239, + /* 320 */ 37, 64, 65, 66, 67, 68, 258, 123, 64, 65, + /* 330 */ 66, 67, 68, 98, 121, 98, 5, 102, 7, 102, + /* 340 */ 258, 97, 127, 128, 127, 128, 258, 5, 258, 7, + /* 350 */ 72, 73, 258, 239, 258, 258, 258, 239, 239, 103, + /* 360 */ 239, 239, 209, 240, 239, 209, 242, 265, 265, 209, + /* 370 */ 104, 209, 246, 209, 209, 209, 209, 209, 209, 209, + /* 380 */ 209, 209, 209, 209, 209, 209, 209, 59, 209, 209, + /* 390 */ 209, 209, 242, 108, 209, 261, 209, 209, 209, 209, + /* 400 */ 209, 209, 209, 261, 209, 209, 209, 209, 209, 209, + /* 410 */ 209, 209, 209, 118, 255, 210, 120, 117, 210, 210, + /* 420 */ 112, 116, 111, 110, 109, 122, 75, 84, 83, 49, + /* 430 */ 80, 82, 210, 81, 53, 210, 79, 75, 5, 210, + /* 440 */ 133, 214, 214, 5, 58, 133, 5, 133, 5, 133, + /* 450 */ 58, 210, 218, 222, 224, 217, 223, 221, 219, 211, + /* 460 */ 220, 210, 215, 252, 254, 242, 211, 253, 5, 249, + /* 470 */ 251, 250, 248, 247, 212, 58, 87, 133, 125, 105, + /* 480 */ 98, 106, 98, 1, 97, 102, 98, 97, 97, 113, + /* 490 */ 113, 72, 9, 98, 97, 102, 102, 97, 99, 97, + /* 500 */ 99, 5, 5, 5, 5, 5, 76, 15, 72, 16, + /* 510 */ 102, 5, 5, 128, 98, 97, 5, 5, 5, 5, + /* 520 */ 5, 5, 5, 5, 128, 5, 5, 5, 5, 5, + /* 530 */ 102, 76, 59, 58, 0, 269, 269, 269, 269, 269, + /* 540 */ 21, 269, 269, 269, 269, 269, 21, 269, 269, 269, + /* 550 */ 269, 269, 269, 269, 269, 269, 269, 269, 269, 269, + /* 560 */ 269, 269, 269, 269, 269, 269, 269, 269, 269, 269, + /* 570 */ 269, 269, 269, 269, 269, 269, 269, 269, 269, 269, + /* 580 */ 269, 269, 269, 269, 269, 269, 269, 269, 269, 269, + /* 590 */ 269, 269, 269, 269, 269, 269, 269, 269, 269, 269, + /* 600 */ 269, 269, 269, 269, 269, 269, 269, 269, 269, 269, + /* 610 */ 269, 269, 269, 269, 269, 269, 269, 269, 269, 269, + /* 620 */ 269, 269, 269, 269, 269, 269, 269, 269, 269, 269, + /* 630 */ 269, 269, 269, 269, 269, 269, 269, 269, 269, 269, + /* 640 */ 269, 269, 269, 269, 269, 269, 269, 269, 269, 269, + /* 650 */ 269, 269, 269, 269, 269, 269, 269, 269, 269, 269, + /* 660 */ 269, 269, 269, 269, 269, 269, 269, 269, 269, 269, + /* 670 */ 269, 269, 269, 269, 269, 269, 269, 269, 269, 269, + /* 680 */ 269, 269, 269, 269, 269, 269, 269, 269, 269, 269, + /* 690 */ 269, 269, 269, 269, 269, 269, 269, 269, 269, 269, + /* 700 */ 269, 269, 269, 269, 269, 269, 269, 269, 269, 269, + /* 710 */ 269, 269, 269, 269, 269, 269, 269, 269, 269, 269, + /* 720 */ 269, 269, 269, 269, 269, 269, 269, 269, 269, 269, + /* 730 */ 269, 269, 269, 269, 269, 269, 269, 269, 269, 269, + /* 740 */ 269, 269, 269, 269, 269, 269, 269, 269, 269, 269, + /* 750 */ 269, 269, }; #define YY_SHIFT_COUNT (246) #define YY_SHIFT_MIN (0) @@ -344,48 +344,48 @@ static const YYCODETYPE yy_lookahead[] = { static const unsigned short int yy_shift_ofst[] = { /* 0 */ 163, 75, 183, 184, 204, 79, 79, 79, 79, 79, /* 10 */ 79, 0, 22, 204, 256, 256, 256, 46, 79, 79, - /* 20 */ 79, 79, 79, 122, 110, 110, 547, 194, 204, 204, + /* 20 */ 79, 79, 79, 116, 109, 109, 547, 194, 204, 204, /* 30 */ 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, - /* 40 */ 204, 204, 204, 204, 204, 256, 256, 300, 300, 300, - /* 50 */ 300, 300, 300, 30, 300, 100, 79, 79, 139, 139, + /* 40 */ 204, 204, 204, 204, 204, 256, 256, 249, 249, 249, + /* 50 */ 249, 249, 249, 30, 249, 100, 79, 79, 127, 127, /* 60 */ 128, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* 70 */ 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* 80 */ 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, - /* 90 */ 79, 79, 79, 79, 79, 79, 79, 79, 267, 327, - /* 100 */ 327, 283, 283, 327, 271, 282, 295, 307, 298, 310, - /* 110 */ 314, 316, 304, 267, 327, 327, 352, 352, 327, 344, - /* 120 */ 346, 381, 351, 350, 380, 354, 358, 327, 363, 327, - /* 130 */ 363, 547, 547, 27, 69, 69, 69, 95, 120, 218, + /* 90 */ 79, 79, 79, 79, 79, 79, 79, 79, 266, 328, + /* 100 */ 328, 285, 285, 328, 295, 296, 300, 308, 305, 311, + /* 110 */ 313, 315, 303, 266, 328, 328, 351, 351, 328, 343, + /* 120 */ 345, 380, 350, 349, 381, 352, 357, 328, 362, 328, + /* 130 */ 362, 547, 547, 27, 69, 69, 69, 95, 120, 218, /* 140 */ 218, 218, 232, 186, 186, 186, 186, 257, 264, 26, - /* 150 */ 116, 61, 61, 212, 124, 168, 178, 181, 206, 277, - /* 160 */ 281, 302, 250, 193, 191, 217, 238, 239, 215, 221, - /* 170 */ 306, 311, 272, 434, 308, 439, 312, 389, 443, 317, - /* 180 */ 444, 318, 408, 462, 342, 418, 390, 353, 374, 382, - /* 190 */ 375, 383, 384, 386, 483, 391, 388, 392, 385, 377, - /* 200 */ 393, 378, 394, 396, 397, 398, 399, 400, 426, 491, - /* 210 */ 496, 497, 498, 499, 500, 430, 492, 436, 493, 387, - /* 220 */ 395, 409, 505, 507, 415, 417, 409, 511, 512, 513, - /* 230 */ 514, 515, 516, 517, 519, 520, 521, 522, 523, 524, - /* 240 */ 428, 455, 518, 525, 473, 475, 534, + /* 150 */ 154, 61, 61, 212, 161, 151, 178, 206, 207, 288, + /* 160 */ 306, 283, 244, 213, 145, 216, 235, 237, 215, 217, + /* 170 */ 331, 342, 278, 433, 307, 438, 312, 386, 441, 314, + /* 180 */ 443, 316, 392, 463, 344, 417, 389, 353, 374, 382, + /* 190 */ 375, 383, 384, 387, 482, 390, 388, 391, 393, 376, + /* 200 */ 394, 377, 395, 397, 400, 399, 402, 401, 419, 483, + /* 210 */ 496, 497, 498, 499, 500, 430, 492, 436, 493, 385, + /* 220 */ 396, 408, 506, 507, 416, 418, 408, 511, 512, 513, + /* 230 */ 514, 515, 516, 517, 518, 520, 521, 522, 523, 524, + /* 240 */ 428, 455, 519, 525, 473, 475, 534, }; #define YY_REDUCE_COUNT (132) -#define YY_REDUCE_MIN (-254) -#define YY_REDUCE_MAX (253) +#define YY_REDUCE_MIN (-255) +#define YY_REDUCE_MAX (262) static const short yy_reduce_ofst[] = { - /* 0 */ -199, -52, -224, -237, -221, -150, -121, -193, -116, -91, - /* 10 */ 7, -196, -189, -235, -162, -35, -33, -137, -149, -158, - /* 20 */ -124, -21, -151, -77, 24, 47, -42, -254, -252, -222, - /* 30 */ -143, -84, -59, -45, -15, 28, 63, 78, 81, 89, - /* 40 */ 93, 94, 96, 97, 98, 21, 83, 114, 118, 119, - /* 50 */ 123, 125, 126, 121, 127, 117, 154, 158, 103, 104, - /* 60 */ 129, 161, 162, 164, 165, 167, 169, 170, 171, 172, - /* 70 */ 173, 174, 175, 176, 177, 179, 180, 182, 185, 187, - /* 80 */ 188, 189, 190, 192, 195, 196, 197, 198, 199, 200, - /* 90 */ 201, 202, 203, 205, 207, 208, 209, 210, 135, 211, - /* 100 */ 213, 132, 134, 214, 145, 148, 216, 219, 222, 220, - /* 110 */ 223, 226, 228, 224, 225, 227, 229, 230, 231, 233, - /* 120 */ 235, 234, 236, 240, 241, 242, 246, 237, 244, 243, - /* 130 */ 248, 249, 253, + /* 0 */ -200, -53, -225, -238, -222, -151, -122, -194, -117, -92, + /* 10 */ 7, -197, -190, -236, -163, -36, -34, -138, -150, -159, + /* 20 */ -125, -9, -152, -78, -1, 23, -43, -255, -253, -223, + /* 30 */ -144, -85, -60, 4, 12, 52, 58, 68, 82, 88, + /* 40 */ 90, 94, 96, 97, 98, -22, 41, 80, 114, 118, + /* 50 */ 119, 121, 122, 123, 125, 124, 153, 156, 102, 103, + /* 60 */ 126, 160, 162, 164, 165, 166, 167, 168, 169, 170, + /* 70 */ 171, 172, 173, 174, 175, 176, 177, 179, 180, 181, + /* 80 */ 182, 185, 187, 188, 189, 190, 191, 192, 193, 195, + /* 90 */ 196, 197, 198, 199, 200, 201, 202, 203, 150, 205, + /* 100 */ 208, 134, 142, 209, 159, 210, 214, 211, 219, 221, + /* 110 */ 220, 224, 226, 223, 222, 225, 227, 228, 229, 230, + /* 120 */ 233, 231, 234, 236, 239, 240, 238, 241, 248, 251, + /* 130 */ 255, 247, 262, }; static const YYACTIONTYPE yy_default[] = { /* 0 */ 623, 675, 664, 835, 835, 623, 623, 623, 623, 623, @@ -623,6 +623,7 @@ static const YYCODETYPE yyFallback[] = { 1, /* SUM_IRATE => ID */ 1, /* AVG_RATE => ID */ 1, /* AVG_IRATE => ID */ + 1, /* TBID => ID */ 1, /* SEMI => ID */ 1, /* NONE => ID */ 1, /* PREV => ID */ @@ -913,83 +914,84 @@ static const char *const yyTokenName[] = { /* 188 */ "SUM_IRATE", /* 189 */ "AVG_RATE", /* 190 */ "AVG_IRATE", - /* 191 */ "SEMI", - /* 192 */ "NONE", - /* 193 */ "PREV", - /* 194 */ "LINEAR", - /* 195 */ "IMPORT", - /* 196 */ "METRIC", - /* 197 */ "TBNAME", - /* 198 */ "JOIN", - /* 199 */ "METRICS", - /* 200 */ "STABLE", - /* 201 */ "INSERT", - /* 202 */ "INTO", - /* 203 */ "VALUES", - /* 204 */ "error", - /* 205 */ "program", - /* 206 */ "cmd", - /* 207 */ "dbPrefix", - /* 208 */ "ids", - /* 209 */ "cpxName", - /* 210 */ "ifexists", - /* 211 */ "alter_db_optr", - /* 212 */ "acct_optr", - /* 213 */ "ifnotexists", - /* 214 */ "db_optr", - /* 215 */ "pps", - /* 216 */ "tseries", - /* 217 */ "dbs", - /* 218 */ "streams", - /* 219 */ "storage", - /* 220 */ "qtime", - /* 221 */ "users", - /* 222 */ "conns", - /* 223 */ "state", - /* 224 */ "keep", - /* 225 */ "tagitemlist", - /* 226 */ "tables", - /* 227 */ "cache", - /* 228 */ "replica", - /* 229 */ "days", - /* 230 */ "minrows", - /* 231 */ "maxrows", - /* 232 */ "blocks", - /* 233 */ "ctime", - /* 234 */ "wal", - /* 235 */ "comp", - /* 236 */ "prec", - /* 237 */ "typename", - /* 238 */ "signed", - /* 239 */ "create_table_args", - /* 240 */ "columnlist", - /* 241 */ "select", - /* 242 */ "column", - /* 243 */ "tagitem", - /* 244 */ "selcollist", - /* 245 */ "from", - /* 246 */ "where_opt", - /* 247 */ "interval_opt", - /* 248 */ "fill_opt", - /* 249 */ "sliding_opt", - /* 250 */ "groupby_opt", - /* 251 */ "orderby_opt", - /* 252 */ "having_opt", - /* 253 */ "slimit_opt", - /* 254 */ "limit_opt", - /* 255 */ "union", - /* 256 */ "sclp", - /* 257 */ "expr", - /* 258 */ "as", - /* 259 */ "tablelist", - /* 260 */ "tmvar", - /* 261 */ "sortlist", - /* 262 */ "sortitem", - /* 263 */ "item", - /* 264 */ "sortorder", - /* 265 */ "grouplist", - /* 266 */ "exprlist", - /* 267 */ "expritem", + /* 191 */ "TBID", + /* 192 */ "SEMI", + /* 193 */ "NONE", + /* 194 */ "PREV", + /* 195 */ "LINEAR", + /* 196 */ "IMPORT", + /* 197 */ "METRIC", + /* 198 */ "TBNAME", + /* 199 */ "JOIN", + /* 200 */ "METRICS", + /* 201 */ "STABLE", + /* 202 */ "INSERT", + /* 203 */ "INTO", + /* 204 */ "VALUES", + /* 205 */ "error", + /* 206 */ "program", + /* 207 */ "cmd", + /* 208 */ "dbPrefix", + /* 209 */ "ids", + /* 210 */ "cpxName", + /* 211 */ "ifexists", + /* 212 */ "alter_db_optr", + /* 213 */ "acct_optr", + /* 214 */ "ifnotexists", + /* 215 */ "db_optr", + /* 216 */ "pps", + /* 217 */ "tseries", + /* 218 */ "dbs", + /* 219 */ "streams", + /* 220 */ "storage", + /* 221 */ "qtime", + /* 222 */ "users", + /* 223 */ "conns", + /* 224 */ "state", + /* 225 */ "keep", + /* 226 */ "tagitemlist", + /* 227 */ "tables", + /* 228 */ "cache", + /* 229 */ "replica", + /* 230 */ "days", + /* 231 */ "minrows", + /* 232 */ "maxrows", + /* 233 */ "blocks", + /* 234 */ "ctime", + /* 235 */ "wal", + /* 236 */ "comp", + /* 237 */ "prec", + /* 238 */ "typename", + /* 239 */ "signed", + /* 240 */ "create_table_args", + /* 241 */ "columnlist", + /* 242 */ "select", + /* 243 */ "column", + /* 244 */ "tagitem", + /* 245 */ "selcollist", + /* 246 */ "from", + /* 247 */ "where_opt", + /* 248 */ "interval_opt", + /* 249 */ "fill_opt", + /* 250 */ "sliding_opt", + /* 251 */ "groupby_opt", + /* 252 */ "orderby_opt", + /* 253 */ "having_opt", + /* 254 */ "slimit_opt", + /* 255 */ "limit_opt", + /* 256 */ "union", + /* 257 */ "sclp", + /* 258 */ "expr", + /* 259 */ "as", + /* 260 */ "tablelist", + /* 261 */ "tmvar", + /* 262 */ "sortlist", + /* 263 */ "sortitem", + /* 264 */ "item", + /* 265 */ "sortorder", + /* 266 */ "grouplist", + /* 267 */ "exprlist", + /* 268 */ "expritem", }; #endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */ @@ -1337,50 +1339,50 @@ static void yy_destructor( ** inside the C code. */ /********* Begin destructor definitions ***************************************/ - case 224: /* keep */ - case 225: /* tagitemlist */ - case 248: /* fill_opt */ - case 250: /* groupby_opt */ - case 251: /* orderby_opt */ - case 261: /* sortlist */ - case 265: /* grouplist */ + case 225: /* keep */ + case 226: /* tagitemlist */ + case 249: /* fill_opt */ + case 251: /* groupby_opt */ + case 252: /* orderby_opt */ + case 262: /* sortlist */ + case 266: /* grouplist */ { -tVariantListDestroy((yypminor->yy456)); +tVariantListDestroy((yypminor->yy322)); } break; - case 240: /* columnlist */ + case 241: /* columnlist */ { -tFieldListDestroy((yypminor->yy503)); +tFieldListDestroy((yypminor->yy369)); } break; - case 241: /* select */ + case 242: /* select */ { -doDestroyQuerySql((yypminor->yy392)); +doDestroyQuerySql((yypminor->yy190)); } break; - case 244: /* selcollist */ - case 256: /* sclp */ - case 266: /* exprlist */ + case 245: /* selcollist */ + case 257: /* sclp */ + case 267: /* exprlist */ { -tSQLExprListDestroy((yypminor->yy10)); +tSQLExprListDestroy((yypminor->yy260)); } break; - case 246: /* where_opt */ - case 252: /* having_opt */ - case 257: /* expr */ - case 267: /* expritem */ + case 247: /* where_opt */ + case 253: /* having_opt */ + case 258: /* expr */ + case 268: /* expritem */ { -tSQLExprDestroy((yypminor->yy2)); +tSQLExprDestroy((yypminor->yy500)); } break; - case 255: /* union */ + case 256: /* union */ { -destroyAllSelectClause((yypminor->yy145)); +destroyAllSelectClause((yypminor->yy263)); } break; - case 262: /* sortitem */ + case 263: /* sortitem */ { -tVariantDestroy(&(yypminor->yy442)); +tVariantDestroy(&(yypminor->yy518)); } break; /********* End destructor definitions *****************************************/ @@ -1674,226 +1676,226 @@ static const struct { YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */ signed char nrhs; /* Negative of the number of RHS symbols in the rule */ } yyRuleInfo[] = { - { 205, -1 }, /* (0) program ::= cmd */ - { 206, -2 }, /* (1) cmd ::= SHOW DATABASES */ - { 206, -2 }, /* (2) cmd ::= SHOW MNODES */ - { 206, -2 }, /* (3) cmd ::= SHOW DNODES */ - { 206, -2 }, /* (4) cmd ::= SHOW ACCOUNTS */ - { 206, -2 }, /* (5) cmd ::= SHOW USERS */ - { 206, -2 }, /* (6) cmd ::= SHOW MODULES */ - { 206, -2 }, /* (7) cmd ::= SHOW QUERIES */ - { 206, -2 }, /* (8) cmd ::= SHOW CONNECTIONS */ - { 206, -2 }, /* (9) cmd ::= SHOW STREAMS */ - { 206, -2 }, /* (10) cmd ::= SHOW CONFIGS */ - { 206, -2 }, /* (11) cmd ::= SHOW SCORES */ - { 206, -2 }, /* (12) cmd ::= SHOW GRANTS */ - { 206, -2 }, /* (13) cmd ::= SHOW VNODES */ - { 206, -3 }, /* (14) cmd ::= SHOW VNODES IPTOKEN */ - { 207, 0 }, /* (15) dbPrefix ::= */ - { 207, -2 }, /* (16) dbPrefix ::= ids DOT */ - { 209, 0 }, /* (17) cpxName ::= */ - { 209, -2 }, /* (18) cpxName ::= DOT ids */ - { 206, -3 }, /* (19) cmd ::= SHOW dbPrefix TABLES */ - { 206, -5 }, /* (20) cmd ::= SHOW dbPrefix TABLES LIKE ids */ - { 206, -3 }, /* (21) cmd ::= SHOW dbPrefix STABLES */ - { 206, -5 }, /* (22) cmd ::= SHOW dbPrefix STABLES LIKE ids */ - { 206, -3 }, /* (23) cmd ::= SHOW dbPrefix VGROUPS */ - { 206, -4 }, /* (24) cmd ::= SHOW dbPrefix VGROUPS ids */ - { 206, -5 }, /* (25) cmd ::= DROP TABLE ifexists ids cpxName */ - { 206, -4 }, /* (26) cmd ::= DROP DATABASE ifexists ids */ - { 206, -3 }, /* (27) cmd ::= DROP DNODE ids */ - { 206, -3 }, /* (28) cmd ::= DROP USER ids */ - { 206, -3 }, /* (29) cmd ::= DROP ACCOUNT ids */ - { 206, -2 }, /* (30) cmd ::= USE ids */ - { 206, -3 }, /* (31) cmd ::= DESCRIBE ids cpxName */ - { 206, -5 }, /* (32) cmd ::= ALTER USER ids PASS ids */ - { 206, -5 }, /* (33) cmd ::= ALTER USER ids PRIVILEGE ids */ - { 206, -4 }, /* (34) cmd ::= ALTER DNODE ids ids */ - { 206, -5 }, /* (35) cmd ::= ALTER DNODE ids ids ids */ - { 206, -3 }, /* (36) cmd ::= ALTER LOCAL ids */ - { 206, -4 }, /* (37) cmd ::= ALTER LOCAL ids ids */ - { 206, -4 }, /* (38) cmd ::= ALTER DATABASE ids alter_db_optr */ - { 206, -4 }, /* (39) cmd ::= ALTER ACCOUNT ids acct_optr */ - { 206, -6 }, /* (40) cmd ::= ALTER ACCOUNT ids PASS ids acct_optr */ - { 208, -1 }, /* (41) ids ::= ID */ - { 208, -1 }, /* (42) ids ::= STRING */ - { 210, -2 }, /* (43) ifexists ::= IF EXISTS */ - { 210, 0 }, /* (44) ifexists ::= */ - { 213, -3 }, /* (45) ifnotexists ::= IF NOT EXISTS */ - { 213, 0 }, /* (46) ifnotexists ::= */ - { 206, -3 }, /* (47) cmd ::= CREATE DNODE ids */ - { 206, -6 }, /* (48) cmd ::= CREATE ACCOUNT ids PASS ids acct_optr */ - { 206, -5 }, /* (49) cmd ::= CREATE DATABASE ifnotexists ids db_optr */ - { 206, -5 }, /* (50) cmd ::= CREATE USER ids PASS ids */ - { 215, 0 }, /* (51) pps ::= */ - { 215, -2 }, /* (52) pps ::= PPS INTEGER */ - { 216, 0 }, /* (53) tseries ::= */ - { 216, -2 }, /* (54) tseries ::= TSERIES INTEGER */ - { 217, 0 }, /* (55) dbs ::= */ - { 217, -2 }, /* (56) dbs ::= DBS INTEGER */ - { 218, 0 }, /* (57) streams ::= */ - { 218, -2 }, /* (58) streams ::= STREAMS INTEGER */ - { 219, 0 }, /* (59) storage ::= */ - { 219, -2 }, /* (60) storage ::= STORAGE INTEGER */ - { 220, 0 }, /* (61) qtime ::= */ - { 220, -2 }, /* (62) qtime ::= QTIME INTEGER */ - { 221, 0 }, /* (63) users ::= */ - { 221, -2 }, /* (64) users ::= USERS INTEGER */ - { 222, 0 }, /* (65) conns ::= */ - { 222, -2 }, /* (66) conns ::= CONNS INTEGER */ - { 223, 0 }, /* (67) state ::= */ - { 223, -2 }, /* (68) state ::= STATE ids */ - { 212, -9 }, /* (69) acct_optr ::= pps tseries storage streams qtime dbs users conns state */ - { 224, -2 }, /* (70) keep ::= KEEP tagitemlist */ - { 226, -2 }, /* (71) tables ::= MAXTABLES INTEGER */ - { 227, -2 }, /* (72) cache ::= CACHE INTEGER */ - { 228, -2 }, /* (73) replica ::= REPLICA INTEGER */ - { 229, -2 }, /* (74) days ::= DAYS INTEGER */ - { 230, -2 }, /* (75) minrows ::= MINROWS INTEGER */ - { 231, -2 }, /* (76) maxrows ::= MAXROWS INTEGER */ - { 232, -2 }, /* (77) blocks ::= BLOCKS INTEGER */ - { 233, -2 }, /* (78) ctime ::= CTIME INTEGER */ - { 234, -2 }, /* (79) wal ::= WAL INTEGER */ - { 235, -2 }, /* (80) comp ::= COMP INTEGER */ - { 236, -2 }, /* (81) prec ::= PRECISION STRING */ - { 214, 0 }, /* (82) db_optr ::= */ - { 214, -2 }, /* (83) db_optr ::= db_optr tables */ - { 214, -2 }, /* (84) db_optr ::= db_optr cache */ - { 214, -2 }, /* (85) db_optr ::= db_optr replica */ - { 214, -2 }, /* (86) db_optr ::= db_optr days */ - { 214, -2 }, /* (87) db_optr ::= db_optr minrows */ - { 214, -2 }, /* (88) db_optr ::= db_optr maxrows */ - { 214, -2 }, /* (89) db_optr ::= db_optr blocks */ - { 214, -2 }, /* (90) db_optr ::= db_optr ctime */ - { 214, -2 }, /* (91) db_optr ::= db_optr wal */ - { 214, -2 }, /* (92) db_optr ::= db_optr comp */ - { 214, -2 }, /* (93) db_optr ::= db_optr prec */ - { 214, -2 }, /* (94) db_optr ::= db_optr keep */ - { 211, 0 }, /* (95) alter_db_optr ::= */ - { 211, -2 }, /* (96) alter_db_optr ::= alter_db_optr replica */ - { 211, -2 }, /* (97) alter_db_optr ::= alter_db_optr tables */ - { 211, -2 }, /* (98) alter_db_optr ::= alter_db_optr keep */ - { 211, -2 }, /* (99) alter_db_optr ::= alter_db_optr blocks */ - { 211, -2 }, /* (100) alter_db_optr ::= alter_db_optr comp */ - { 211, -2 }, /* (101) alter_db_optr ::= alter_db_optr wal */ - { 237, -1 }, /* (102) typename ::= ids */ - { 237, -4 }, /* (103) typename ::= ids LP signed RP */ - { 238, -1 }, /* (104) signed ::= INTEGER */ - { 238, -2 }, /* (105) signed ::= PLUS INTEGER */ - { 238, -2 }, /* (106) signed ::= MINUS INTEGER */ - { 206, -6 }, /* (107) cmd ::= CREATE TABLE ifnotexists ids cpxName create_table_args */ - { 239, -3 }, /* (108) create_table_args ::= LP columnlist RP */ - { 239, -7 }, /* (109) create_table_args ::= LP columnlist RP TAGS LP columnlist RP */ - { 239, -7 }, /* (110) create_table_args ::= USING ids cpxName TAGS LP tagitemlist RP */ - { 239, -2 }, /* (111) create_table_args ::= AS select */ - { 240, -3 }, /* (112) columnlist ::= columnlist COMMA column */ - { 240, -1 }, /* (113) columnlist ::= column */ - { 242, -2 }, /* (114) column ::= ids typename */ - { 225, -3 }, /* (115) tagitemlist ::= tagitemlist COMMA tagitem */ - { 225, -1 }, /* (116) tagitemlist ::= tagitem */ - { 243, -1 }, /* (117) tagitem ::= INTEGER */ - { 243, -1 }, /* (118) tagitem ::= FLOAT */ - { 243, -1 }, /* (119) tagitem ::= STRING */ - { 243, -1 }, /* (120) tagitem ::= BOOL */ - { 243, -1 }, /* (121) tagitem ::= NULL */ - { 243, -2 }, /* (122) tagitem ::= MINUS INTEGER */ - { 243, -2 }, /* (123) tagitem ::= MINUS FLOAT */ - { 243, -2 }, /* (124) tagitem ::= PLUS INTEGER */ - { 243, -2 }, /* (125) tagitem ::= PLUS FLOAT */ - { 241, -12 }, /* (126) select ::= SELECT selcollist from where_opt interval_opt fill_opt sliding_opt groupby_opt orderby_opt having_opt slimit_opt limit_opt */ - { 255, -1 }, /* (127) union ::= select */ - { 255, -3 }, /* (128) union ::= LP union RP */ - { 255, -4 }, /* (129) union ::= union UNION ALL select */ - { 255, -6 }, /* (130) union ::= union UNION ALL LP select RP */ - { 206, -1 }, /* (131) cmd ::= union */ - { 241, -2 }, /* (132) select ::= SELECT selcollist */ - { 256, -2 }, /* (133) sclp ::= selcollist COMMA */ - { 256, 0 }, /* (134) sclp ::= */ - { 244, -3 }, /* (135) selcollist ::= sclp expr as */ - { 244, -2 }, /* (136) selcollist ::= sclp STAR */ - { 258, -2 }, /* (137) as ::= AS ids */ - { 258, -1 }, /* (138) as ::= ids */ - { 258, 0 }, /* (139) as ::= */ - { 245, -2 }, /* (140) from ::= FROM tablelist */ - { 259, -2 }, /* (141) tablelist ::= ids cpxName */ - { 259, -4 }, /* (142) tablelist ::= tablelist COMMA ids cpxName */ - { 260, -1 }, /* (143) tmvar ::= VARIABLE */ - { 247, -4 }, /* (144) interval_opt ::= INTERVAL LP tmvar RP */ - { 247, 0 }, /* (145) interval_opt ::= */ - { 248, 0 }, /* (146) fill_opt ::= */ - { 248, -6 }, /* (147) fill_opt ::= FILL LP ID COMMA tagitemlist RP */ - { 248, -4 }, /* (148) fill_opt ::= FILL LP ID RP */ - { 249, -4 }, /* (149) sliding_opt ::= SLIDING LP tmvar RP */ - { 249, 0 }, /* (150) sliding_opt ::= */ - { 251, 0 }, /* (151) orderby_opt ::= */ - { 251, -3 }, /* (152) orderby_opt ::= ORDER BY sortlist */ - { 261, -4 }, /* (153) sortlist ::= sortlist COMMA item sortorder */ - { 261, -2 }, /* (154) sortlist ::= item sortorder */ - { 263, -2 }, /* (155) item ::= ids cpxName */ - { 264, -1 }, /* (156) sortorder ::= ASC */ - { 264, -1 }, /* (157) sortorder ::= DESC */ - { 264, 0 }, /* (158) sortorder ::= */ - { 250, 0 }, /* (159) groupby_opt ::= */ - { 250, -3 }, /* (160) groupby_opt ::= GROUP BY grouplist */ - { 265, -3 }, /* (161) grouplist ::= grouplist COMMA item */ - { 265, -1 }, /* (162) grouplist ::= item */ - { 252, 0 }, /* (163) having_opt ::= */ - { 252, -2 }, /* (164) having_opt ::= HAVING expr */ - { 254, 0 }, /* (165) limit_opt ::= */ - { 254, -2 }, /* (166) limit_opt ::= LIMIT signed */ - { 254, -4 }, /* (167) limit_opt ::= LIMIT signed OFFSET signed */ - { 254, -4 }, /* (168) limit_opt ::= LIMIT signed COMMA signed */ - { 253, 0 }, /* (169) slimit_opt ::= */ - { 253, -2 }, /* (170) slimit_opt ::= SLIMIT signed */ - { 253, -4 }, /* (171) slimit_opt ::= SLIMIT signed SOFFSET signed */ - { 253, -4 }, /* (172) slimit_opt ::= SLIMIT signed COMMA signed */ - { 246, 0 }, /* (173) where_opt ::= */ - { 246, -2 }, /* (174) where_opt ::= WHERE expr */ - { 257, -3 }, /* (175) expr ::= LP expr RP */ - { 257, -1 }, /* (176) expr ::= ID */ - { 257, -3 }, /* (177) expr ::= ID DOT ID */ - { 257, -3 }, /* (178) expr ::= ID DOT STAR */ - { 257, -1 }, /* (179) expr ::= INTEGER */ - { 257, -2 }, /* (180) expr ::= MINUS INTEGER */ - { 257, -2 }, /* (181) expr ::= PLUS INTEGER */ - { 257, -1 }, /* (182) expr ::= FLOAT */ - { 257, -2 }, /* (183) expr ::= MINUS FLOAT */ - { 257, -2 }, /* (184) expr ::= PLUS FLOAT */ - { 257, -1 }, /* (185) expr ::= STRING */ - { 257, -1 }, /* (186) expr ::= NOW */ - { 257, -1 }, /* (187) expr ::= VARIABLE */ - { 257, -1 }, /* (188) expr ::= BOOL */ - { 257, -4 }, /* (189) expr ::= ID LP exprlist RP */ - { 257, -4 }, /* (190) expr ::= ID LP STAR RP */ - { 257, -3 }, /* (191) expr ::= expr AND expr */ - { 257, -3 }, /* (192) expr ::= expr OR expr */ - { 257, -3 }, /* (193) expr ::= expr LT expr */ - { 257, -3 }, /* (194) expr ::= expr GT expr */ - { 257, -3 }, /* (195) expr ::= expr LE expr */ - { 257, -3 }, /* (196) expr ::= expr GE expr */ - { 257, -3 }, /* (197) expr ::= expr NE expr */ - { 257, -3 }, /* (198) expr ::= expr EQ expr */ - { 257, -3 }, /* (199) expr ::= expr PLUS expr */ - { 257, -3 }, /* (200) expr ::= expr MINUS expr */ - { 257, -3 }, /* (201) expr ::= expr STAR expr */ - { 257, -3 }, /* (202) expr ::= expr SLASH expr */ - { 257, -3 }, /* (203) expr ::= expr REM expr */ - { 257, -3 }, /* (204) expr ::= expr LIKE expr */ - { 257, -5 }, /* (205) expr ::= expr IN LP exprlist RP */ - { 266, -3 }, /* (206) exprlist ::= exprlist COMMA expritem */ - { 266, -1 }, /* (207) exprlist ::= expritem */ - { 267, -1 }, /* (208) expritem ::= expr */ - { 267, 0 }, /* (209) expritem ::= */ - { 206, -3 }, /* (210) cmd ::= RESET QUERY CACHE */ - { 206, -7 }, /* (211) cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */ - { 206, -7 }, /* (212) cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */ - { 206, -7 }, /* (213) cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ - { 206, -7 }, /* (214) cmd ::= ALTER TABLE ids cpxName DROP TAG ids */ - { 206, -8 }, /* (215) cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */ - { 206, -9 }, /* (216) cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */ - { 206, -5 }, /* (217) cmd ::= KILL CONNECTION IPTOKEN COLON INTEGER */ - { 206, -7 }, /* (218) cmd ::= KILL STREAM IPTOKEN COLON INTEGER COLON INTEGER */ - { 206, -7 }, /* (219) cmd ::= KILL QUERY IPTOKEN COLON INTEGER COLON INTEGER */ + { 206, -1 }, /* (0) program ::= cmd */ + { 207, -2 }, /* (1) cmd ::= SHOW DATABASES */ + { 207, -2 }, /* (2) cmd ::= SHOW MNODES */ + { 207, -2 }, /* (3) cmd ::= SHOW DNODES */ + { 207, -2 }, /* (4) cmd ::= SHOW ACCOUNTS */ + { 207, -2 }, /* (5) cmd ::= SHOW USERS */ + { 207, -2 }, /* (6) cmd ::= SHOW MODULES */ + { 207, -2 }, /* (7) cmd ::= SHOW QUERIES */ + { 207, -2 }, /* (8) cmd ::= SHOW CONNECTIONS */ + { 207, -2 }, /* (9) cmd ::= SHOW STREAMS */ + { 207, -2 }, /* (10) cmd ::= SHOW CONFIGS */ + { 207, -2 }, /* (11) cmd ::= SHOW SCORES */ + { 207, -2 }, /* (12) cmd ::= SHOW GRANTS */ + { 207, -2 }, /* (13) cmd ::= SHOW VNODES */ + { 207, -3 }, /* (14) cmd ::= SHOW VNODES IPTOKEN */ + { 208, 0 }, /* (15) dbPrefix ::= */ + { 208, -2 }, /* (16) dbPrefix ::= ids DOT */ + { 210, 0 }, /* (17) cpxName ::= */ + { 210, -2 }, /* (18) cpxName ::= DOT ids */ + { 207, -3 }, /* (19) cmd ::= SHOW dbPrefix TABLES */ + { 207, -5 }, /* (20) cmd ::= SHOW dbPrefix TABLES LIKE ids */ + { 207, -3 }, /* (21) cmd ::= SHOW dbPrefix STABLES */ + { 207, -5 }, /* (22) cmd ::= SHOW dbPrefix STABLES LIKE ids */ + { 207, -3 }, /* (23) cmd ::= SHOW dbPrefix VGROUPS */ + { 207, -4 }, /* (24) cmd ::= SHOW dbPrefix VGROUPS ids */ + { 207, -5 }, /* (25) cmd ::= DROP TABLE ifexists ids cpxName */ + { 207, -4 }, /* (26) cmd ::= DROP DATABASE ifexists ids */ + { 207, -3 }, /* (27) cmd ::= DROP DNODE ids */ + { 207, -3 }, /* (28) cmd ::= DROP USER ids */ + { 207, -3 }, /* (29) cmd ::= DROP ACCOUNT ids */ + { 207, -2 }, /* (30) cmd ::= USE ids */ + { 207, -3 }, /* (31) cmd ::= DESCRIBE ids cpxName */ + { 207, -5 }, /* (32) cmd ::= ALTER USER ids PASS ids */ + { 207, -5 }, /* (33) cmd ::= ALTER USER ids PRIVILEGE ids */ + { 207, -4 }, /* (34) cmd ::= ALTER DNODE ids ids */ + { 207, -5 }, /* (35) cmd ::= ALTER DNODE ids ids ids */ + { 207, -3 }, /* (36) cmd ::= ALTER LOCAL ids */ + { 207, -4 }, /* (37) cmd ::= ALTER LOCAL ids ids */ + { 207, -4 }, /* (38) cmd ::= ALTER DATABASE ids alter_db_optr */ + { 207, -4 }, /* (39) cmd ::= ALTER ACCOUNT ids acct_optr */ + { 207, -6 }, /* (40) cmd ::= ALTER ACCOUNT ids PASS ids acct_optr */ + { 209, -1 }, /* (41) ids ::= ID */ + { 209, -1 }, /* (42) ids ::= STRING */ + { 211, -2 }, /* (43) ifexists ::= IF EXISTS */ + { 211, 0 }, /* (44) ifexists ::= */ + { 214, -3 }, /* (45) ifnotexists ::= IF NOT EXISTS */ + { 214, 0 }, /* (46) ifnotexists ::= */ + { 207, -3 }, /* (47) cmd ::= CREATE DNODE ids */ + { 207, -6 }, /* (48) cmd ::= CREATE ACCOUNT ids PASS ids acct_optr */ + { 207, -5 }, /* (49) cmd ::= CREATE DATABASE ifnotexists ids db_optr */ + { 207, -5 }, /* (50) cmd ::= CREATE USER ids PASS ids */ + { 216, 0 }, /* (51) pps ::= */ + { 216, -2 }, /* (52) pps ::= PPS INTEGER */ + { 217, 0 }, /* (53) tseries ::= */ + { 217, -2 }, /* (54) tseries ::= TSERIES INTEGER */ + { 218, 0 }, /* (55) dbs ::= */ + { 218, -2 }, /* (56) dbs ::= DBS INTEGER */ + { 219, 0 }, /* (57) streams ::= */ + { 219, -2 }, /* (58) streams ::= STREAMS INTEGER */ + { 220, 0 }, /* (59) storage ::= */ + { 220, -2 }, /* (60) storage ::= STORAGE INTEGER */ + { 221, 0 }, /* (61) qtime ::= */ + { 221, -2 }, /* (62) qtime ::= QTIME INTEGER */ + { 222, 0 }, /* (63) users ::= */ + { 222, -2 }, /* (64) users ::= USERS INTEGER */ + { 223, 0 }, /* (65) conns ::= */ + { 223, -2 }, /* (66) conns ::= CONNS INTEGER */ + { 224, 0 }, /* (67) state ::= */ + { 224, -2 }, /* (68) state ::= STATE ids */ + { 213, -9 }, /* (69) acct_optr ::= pps tseries storage streams qtime dbs users conns state */ + { 225, -2 }, /* (70) keep ::= KEEP tagitemlist */ + { 227, -2 }, /* (71) tables ::= MAXTABLES INTEGER */ + { 228, -2 }, /* (72) cache ::= CACHE INTEGER */ + { 229, -2 }, /* (73) replica ::= REPLICA INTEGER */ + { 230, -2 }, /* (74) days ::= DAYS INTEGER */ + { 231, -2 }, /* (75) minrows ::= MINROWS INTEGER */ + { 232, -2 }, /* (76) maxrows ::= MAXROWS INTEGER */ + { 233, -2 }, /* (77) blocks ::= BLOCKS INTEGER */ + { 234, -2 }, /* (78) ctime ::= CTIME INTEGER */ + { 235, -2 }, /* (79) wal ::= WAL INTEGER */ + { 236, -2 }, /* (80) comp ::= COMP INTEGER */ + { 237, -2 }, /* (81) prec ::= PRECISION STRING */ + { 215, 0 }, /* (82) db_optr ::= */ + { 215, -2 }, /* (83) db_optr ::= db_optr tables */ + { 215, -2 }, /* (84) db_optr ::= db_optr cache */ + { 215, -2 }, /* (85) db_optr ::= db_optr replica */ + { 215, -2 }, /* (86) db_optr ::= db_optr days */ + { 215, -2 }, /* (87) db_optr ::= db_optr minrows */ + { 215, -2 }, /* (88) db_optr ::= db_optr maxrows */ + { 215, -2 }, /* (89) db_optr ::= db_optr blocks */ + { 215, -2 }, /* (90) db_optr ::= db_optr ctime */ + { 215, -2 }, /* (91) db_optr ::= db_optr wal */ + { 215, -2 }, /* (92) db_optr ::= db_optr comp */ + { 215, -2 }, /* (93) db_optr ::= db_optr prec */ + { 215, -2 }, /* (94) db_optr ::= db_optr keep */ + { 212, 0 }, /* (95) alter_db_optr ::= */ + { 212, -2 }, /* (96) alter_db_optr ::= alter_db_optr replica */ + { 212, -2 }, /* (97) alter_db_optr ::= alter_db_optr tables */ + { 212, -2 }, /* (98) alter_db_optr ::= alter_db_optr keep */ + { 212, -2 }, /* (99) alter_db_optr ::= alter_db_optr blocks */ + { 212, -2 }, /* (100) alter_db_optr ::= alter_db_optr comp */ + { 212, -2 }, /* (101) alter_db_optr ::= alter_db_optr wal */ + { 238, -1 }, /* (102) typename ::= ids */ + { 238, -4 }, /* (103) typename ::= ids LP signed RP */ + { 239, -1 }, /* (104) signed ::= INTEGER */ + { 239, -2 }, /* (105) signed ::= PLUS INTEGER */ + { 239, -2 }, /* (106) signed ::= MINUS INTEGER */ + { 207, -6 }, /* (107) cmd ::= CREATE TABLE ifnotexists ids cpxName create_table_args */ + { 240, -3 }, /* (108) create_table_args ::= LP columnlist RP */ + { 240, -7 }, /* (109) create_table_args ::= LP columnlist RP TAGS LP columnlist RP */ + { 240, -7 }, /* (110) create_table_args ::= USING ids cpxName TAGS LP tagitemlist RP */ + { 240, -2 }, /* (111) create_table_args ::= AS select */ + { 241, -3 }, /* (112) columnlist ::= columnlist COMMA column */ + { 241, -1 }, /* (113) columnlist ::= column */ + { 243, -2 }, /* (114) column ::= ids typename */ + { 226, -3 }, /* (115) tagitemlist ::= tagitemlist COMMA tagitem */ + { 226, -1 }, /* (116) tagitemlist ::= tagitem */ + { 244, -1 }, /* (117) tagitem ::= INTEGER */ + { 244, -1 }, /* (118) tagitem ::= FLOAT */ + { 244, -1 }, /* (119) tagitem ::= STRING */ + { 244, -1 }, /* (120) tagitem ::= BOOL */ + { 244, -1 }, /* (121) tagitem ::= NULL */ + { 244, -2 }, /* (122) tagitem ::= MINUS INTEGER */ + { 244, -2 }, /* (123) tagitem ::= MINUS FLOAT */ + { 244, -2 }, /* (124) tagitem ::= PLUS INTEGER */ + { 244, -2 }, /* (125) tagitem ::= PLUS FLOAT */ + { 242, -12 }, /* (126) select ::= SELECT selcollist from where_opt interval_opt fill_opt sliding_opt groupby_opt orderby_opt having_opt slimit_opt limit_opt */ + { 256, -1 }, /* (127) union ::= select */ + { 256, -3 }, /* (128) union ::= LP union RP */ + { 256, -4 }, /* (129) union ::= union UNION ALL select */ + { 256, -6 }, /* (130) union ::= union UNION ALL LP select RP */ + { 207, -1 }, /* (131) cmd ::= union */ + { 242, -2 }, /* (132) select ::= SELECT selcollist */ + { 257, -2 }, /* (133) sclp ::= selcollist COMMA */ + { 257, 0 }, /* (134) sclp ::= */ + { 245, -3 }, /* (135) selcollist ::= sclp expr as */ + { 245, -2 }, /* (136) selcollist ::= sclp STAR */ + { 259, -2 }, /* (137) as ::= AS ids */ + { 259, -1 }, /* (138) as ::= ids */ + { 259, 0 }, /* (139) as ::= */ + { 246, -2 }, /* (140) from ::= FROM tablelist */ + { 260, -2 }, /* (141) tablelist ::= ids cpxName */ + { 260, -4 }, /* (142) tablelist ::= tablelist COMMA ids cpxName */ + { 261, -1 }, /* (143) tmvar ::= VARIABLE */ + { 248, -4 }, /* (144) interval_opt ::= INTERVAL LP tmvar RP */ + { 248, 0 }, /* (145) interval_opt ::= */ + { 249, 0 }, /* (146) fill_opt ::= */ + { 249, -6 }, /* (147) fill_opt ::= FILL LP ID COMMA tagitemlist RP */ + { 249, -4 }, /* (148) fill_opt ::= FILL LP ID RP */ + { 250, -4 }, /* (149) sliding_opt ::= SLIDING LP tmvar RP */ + { 250, 0 }, /* (150) sliding_opt ::= */ + { 252, 0 }, /* (151) orderby_opt ::= */ + { 252, -3 }, /* (152) orderby_opt ::= ORDER BY sortlist */ + { 262, -4 }, /* (153) sortlist ::= sortlist COMMA item sortorder */ + { 262, -2 }, /* (154) sortlist ::= item sortorder */ + { 264, -2 }, /* (155) item ::= ids cpxName */ + { 265, -1 }, /* (156) sortorder ::= ASC */ + { 265, -1 }, /* (157) sortorder ::= DESC */ + { 265, 0 }, /* (158) sortorder ::= */ + { 251, 0 }, /* (159) groupby_opt ::= */ + { 251, -3 }, /* (160) groupby_opt ::= GROUP BY grouplist */ + { 266, -3 }, /* (161) grouplist ::= grouplist COMMA item */ + { 266, -1 }, /* (162) grouplist ::= item */ + { 253, 0 }, /* (163) having_opt ::= */ + { 253, -2 }, /* (164) having_opt ::= HAVING expr */ + { 255, 0 }, /* (165) limit_opt ::= */ + { 255, -2 }, /* (166) limit_opt ::= LIMIT signed */ + { 255, -4 }, /* (167) limit_opt ::= LIMIT signed OFFSET signed */ + { 255, -4 }, /* (168) limit_opt ::= LIMIT signed COMMA signed */ + { 254, 0 }, /* (169) slimit_opt ::= */ + { 254, -2 }, /* (170) slimit_opt ::= SLIMIT signed */ + { 254, -4 }, /* (171) slimit_opt ::= SLIMIT signed SOFFSET signed */ + { 254, -4 }, /* (172) slimit_opt ::= SLIMIT signed COMMA signed */ + { 247, 0 }, /* (173) where_opt ::= */ + { 247, -2 }, /* (174) where_opt ::= WHERE expr */ + { 258, -3 }, /* (175) expr ::= LP expr RP */ + { 258, -1 }, /* (176) expr ::= ID */ + { 258, -3 }, /* (177) expr ::= ID DOT ID */ + { 258, -3 }, /* (178) expr ::= ID DOT STAR */ + { 258, -1 }, /* (179) expr ::= INTEGER */ + { 258, -2 }, /* (180) expr ::= MINUS INTEGER */ + { 258, -2 }, /* (181) expr ::= PLUS INTEGER */ + { 258, -1 }, /* (182) expr ::= FLOAT */ + { 258, -2 }, /* (183) expr ::= MINUS FLOAT */ + { 258, -2 }, /* (184) expr ::= PLUS FLOAT */ + { 258, -1 }, /* (185) expr ::= STRING */ + { 258, -1 }, /* (186) expr ::= NOW */ + { 258, -1 }, /* (187) expr ::= VARIABLE */ + { 258, -1 }, /* (188) expr ::= BOOL */ + { 258, -4 }, /* (189) expr ::= ID LP exprlist RP */ + { 258, -4 }, /* (190) expr ::= ID LP STAR RP */ + { 258, -3 }, /* (191) expr ::= expr AND expr */ + { 258, -3 }, /* (192) expr ::= expr OR expr */ + { 258, -3 }, /* (193) expr ::= expr LT expr */ + { 258, -3 }, /* (194) expr ::= expr GT expr */ + { 258, -3 }, /* (195) expr ::= expr LE expr */ + { 258, -3 }, /* (196) expr ::= expr GE expr */ + { 258, -3 }, /* (197) expr ::= expr NE expr */ + { 258, -3 }, /* (198) expr ::= expr EQ expr */ + { 258, -3 }, /* (199) expr ::= expr PLUS expr */ + { 258, -3 }, /* (200) expr ::= expr MINUS expr */ + { 258, -3 }, /* (201) expr ::= expr STAR expr */ + { 258, -3 }, /* (202) expr ::= expr SLASH expr */ + { 258, -3 }, /* (203) expr ::= expr REM expr */ + { 258, -3 }, /* (204) expr ::= expr LIKE expr */ + { 258, -5 }, /* (205) expr ::= expr IN LP exprlist RP */ + { 267, -3 }, /* (206) exprlist ::= exprlist COMMA expritem */ + { 267, -1 }, /* (207) exprlist ::= expritem */ + { 268, -1 }, /* (208) expritem ::= expr */ + { 268, 0 }, /* (209) expritem ::= */ + { 207, -3 }, /* (210) cmd ::= RESET QUERY CACHE */ + { 207, -7 }, /* (211) cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */ + { 207, -7 }, /* (212) cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */ + { 207, -7 }, /* (213) cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ + { 207, -7 }, /* (214) cmd ::= ALTER TABLE ids cpxName DROP TAG ids */ + { 207, -8 }, /* (215) cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */ + { 207, -9 }, /* (216) cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */ + { 207, -5 }, /* (217) cmd ::= KILL CONNECTION IPTOKEN COLON INTEGER */ + { 207, -7 }, /* (218) cmd ::= KILL STREAM IPTOKEN COLON INTEGER COLON INTEGER */ + { 207, -7 }, /* (219) cmd ::= KILL QUERY IPTOKEN COLON INTEGER COLON INTEGER */ }; static void yy_accept(yyParser*); /* Forward Declaration */ @@ -2113,13 +2115,13 @@ static void yy_reduce( { setDCLSQLElems(pInfo, TSDB_SQL_CFG_LOCAL, 2, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } break; case 38: /* cmd ::= ALTER DATABASE ids alter_db_optr */ -{ SSQLToken t = {0}; setCreateDBSQL(pInfo, TSDB_SQL_ALTER_DB, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy478, &t);} +{ SSQLToken t = {0}; setCreateDBSQL(pInfo, TSDB_SQL_ALTER_DB, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy374, &t);} break; case 39: /* cmd ::= ALTER ACCOUNT ids acct_optr */ -{ setCreateAcctSQL(pInfo, TSDB_SQL_ALTER_ACCT, &yymsp[-1].minor.yy0, NULL, &yymsp[0].minor.yy63);} +{ setCreateAcctSQL(pInfo, TSDB_SQL_ALTER_ACCT, &yymsp[-1].minor.yy0, NULL, &yymsp[0].minor.yy219);} break; case 40: /* cmd ::= ALTER ACCOUNT ids PASS ids acct_optr */ -{ setCreateAcctSQL(pInfo, TSDB_SQL_ALTER_ACCT, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy63);} +{ setCreateAcctSQL(pInfo, TSDB_SQL_ALTER_ACCT, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy219);} break; case 41: /* ids ::= ID */ case 42: /* ids ::= STRING */ yytestcase(yyruleno==42); @@ -2140,10 +2142,10 @@ static void yy_reduce( { setDCLSQLElems(pInfo, TSDB_SQL_CREATE_DNODE, 1, &yymsp[0].minor.yy0);} break; case 48: /* cmd ::= CREATE ACCOUNT ids PASS ids acct_optr */ -{ setCreateAcctSQL(pInfo, TSDB_SQL_CREATE_ACCT, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy63);} +{ setCreateAcctSQL(pInfo, TSDB_SQL_CREATE_ACCT, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy219);} break; case 49: /* cmd ::= CREATE DATABASE ifnotexists ids db_optr */ -{ setCreateDBSQL(pInfo, TSDB_SQL_CREATE_DB, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy478, &yymsp[-2].minor.yy0);} +{ setCreateDBSQL(pInfo, TSDB_SQL_CREATE_DB, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy374, &yymsp[-2].minor.yy0);} break; case 50: /* cmd ::= CREATE USER ids PASS ids */ { setCreateUserSQL(pInfo, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0);} @@ -2172,20 +2174,20 @@ static void yy_reduce( break; case 69: /* acct_optr ::= pps tseries storage streams qtime dbs users conns state */ { - yylhsminor.yy63.maxUsers = (yymsp[-2].minor.yy0.n>0)?atoi(yymsp[-2].minor.yy0.z):-1; - yylhsminor.yy63.maxDbs = (yymsp[-3].minor.yy0.n>0)?atoi(yymsp[-3].minor.yy0.z):-1; - yylhsminor.yy63.maxTimeSeries = (yymsp[-7].minor.yy0.n>0)?atoi(yymsp[-7].minor.yy0.z):-1; - yylhsminor.yy63.maxStreams = (yymsp[-5].minor.yy0.n>0)?atoi(yymsp[-5].minor.yy0.z):-1; - yylhsminor.yy63.maxPointsPerSecond = (yymsp[-8].minor.yy0.n>0)?atoi(yymsp[-8].minor.yy0.z):-1; - yylhsminor.yy63.maxStorage = (yymsp[-6].minor.yy0.n>0)?strtoll(yymsp[-6].minor.yy0.z, NULL, 10):-1; - yylhsminor.yy63.maxQueryTime = (yymsp[-4].minor.yy0.n>0)?strtoll(yymsp[-4].minor.yy0.z, NULL, 10):-1; - yylhsminor.yy63.maxConnections = (yymsp[-1].minor.yy0.n>0)?atoi(yymsp[-1].minor.yy0.z):-1; - yylhsminor.yy63.stat = yymsp[0].minor.yy0; + yylhsminor.yy219.maxUsers = (yymsp[-2].minor.yy0.n>0)?atoi(yymsp[-2].minor.yy0.z):-1; + yylhsminor.yy219.maxDbs = (yymsp[-3].minor.yy0.n>0)?atoi(yymsp[-3].minor.yy0.z):-1; + yylhsminor.yy219.maxTimeSeries = (yymsp[-7].minor.yy0.n>0)?atoi(yymsp[-7].minor.yy0.z):-1; + yylhsminor.yy219.maxStreams = (yymsp[-5].minor.yy0.n>0)?atoi(yymsp[-5].minor.yy0.z):-1; + yylhsminor.yy219.maxPointsPerSecond = (yymsp[-8].minor.yy0.n>0)?atoi(yymsp[-8].minor.yy0.z):-1; + yylhsminor.yy219.maxStorage = (yymsp[-6].minor.yy0.n>0)?strtoll(yymsp[-6].minor.yy0.z, NULL, 10):-1; + yylhsminor.yy219.maxQueryTime = (yymsp[-4].minor.yy0.n>0)?strtoll(yymsp[-4].minor.yy0.z, NULL, 10):-1; + yylhsminor.yy219.maxConnections = (yymsp[-1].minor.yy0.n>0)?atoi(yymsp[-1].minor.yy0.z):-1; + yylhsminor.yy219.stat = yymsp[0].minor.yy0; } - yymsp[-8].minor.yy63 = yylhsminor.yy63; + yymsp[-8].minor.yy219 = yylhsminor.yy219; break; case 70: /* keep ::= KEEP tagitemlist */ -{ yymsp[-1].minor.yy456 = yymsp[0].minor.yy456; } +{ yymsp[-1].minor.yy322 = yymsp[0].minor.yy322; } break; case 71: /* tables ::= MAXTABLES INTEGER */ case 72: /* cache ::= CACHE INTEGER */ yytestcase(yyruleno==72); @@ -2201,85 +2203,85 @@ static void yy_reduce( { yymsp[-1].minor.yy0 = yymsp[0].minor.yy0; } break; case 82: /* db_optr ::= */ -{setDefaultCreateDbOption(&yymsp[1].minor.yy478);} +{setDefaultCreateDbOption(&yymsp[1].minor.yy374);} break; case 83: /* db_optr ::= db_optr tables */ case 97: /* alter_db_optr ::= alter_db_optr tables */ yytestcase(yyruleno==97); -{ yylhsminor.yy478 = yymsp[-1].minor.yy478; yylhsminor.yy478.maxTablesPerVnode = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy478 = yylhsminor.yy478; +{ yylhsminor.yy374 = yymsp[-1].minor.yy374; yylhsminor.yy374.maxTablesPerVnode = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy374 = yylhsminor.yy374; break; case 84: /* db_optr ::= db_optr cache */ -{ yylhsminor.yy478 = yymsp[-1].minor.yy478; yylhsminor.yy478.cacheBlockSize = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy478 = yylhsminor.yy478; +{ yylhsminor.yy374 = yymsp[-1].minor.yy374; yylhsminor.yy374.cacheBlockSize = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy374 = yylhsminor.yy374; break; case 85: /* db_optr ::= db_optr replica */ case 96: /* alter_db_optr ::= alter_db_optr replica */ yytestcase(yyruleno==96); -{ yylhsminor.yy478 = yymsp[-1].minor.yy478; yylhsminor.yy478.replica = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy478 = yylhsminor.yy478; +{ yylhsminor.yy374 = yymsp[-1].minor.yy374; yylhsminor.yy374.replica = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy374 = yylhsminor.yy374; break; case 86: /* db_optr ::= db_optr days */ -{ yylhsminor.yy478 = yymsp[-1].minor.yy478; yylhsminor.yy478.daysPerFile = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy478 = yylhsminor.yy478; +{ yylhsminor.yy374 = yymsp[-1].minor.yy374; yylhsminor.yy374.daysPerFile = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy374 = yylhsminor.yy374; break; case 87: /* db_optr ::= db_optr minrows */ -{ yylhsminor.yy478 = yymsp[-1].minor.yy478; yylhsminor.yy478.minRowsPerBlock = strtod(yymsp[0].minor.yy0.z, NULL); } - yymsp[-1].minor.yy478 = yylhsminor.yy478; +{ yylhsminor.yy374 = yymsp[-1].minor.yy374; yylhsminor.yy374.minRowsPerBlock = strtod(yymsp[0].minor.yy0.z, NULL); } + yymsp[-1].minor.yy374 = yylhsminor.yy374; break; case 88: /* db_optr ::= db_optr maxrows */ -{ yylhsminor.yy478 = yymsp[-1].minor.yy478; yylhsminor.yy478.maxRowsPerBlock = strtod(yymsp[0].minor.yy0.z, NULL); } - yymsp[-1].minor.yy478 = yylhsminor.yy478; +{ yylhsminor.yy374 = yymsp[-1].minor.yy374; yylhsminor.yy374.maxRowsPerBlock = strtod(yymsp[0].minor.yy0.z, NULL); } + yymsp[-1].minor.yy374 = yylhsminor.yy374; break; case 89: /* db_optr ::= db_optr blocks */ case 99: /* alter_db_optr ::= alter_db_optr blocks */ yytestcase(yyruleno==99); -{ yylhsminor.yy478 = yymsp[-1].minor.yy478; yylhsminor.yy478.numOfBlocks = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy478 = yylhsminor.yy478; +{ yylhsminor.yy374 = yymsp[-1].minor.yy374; yylhsminor.yy374.numOfBlocks = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy374 = yylhsminor.yy374; break; case 90: /* db_optr ::= db_optr ctime */ -{ yylhsminor.yy478 = yymsp[-1].minor.yy478; yylhsminor.yy478.commitTime = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy478 = yylhsminor.yy478; +{ yylhsminor.yy374 = yymsp[-1].minor.yy374; yylhsminor.yy374.commitTime = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy374 = yylhsminor.yy374; break; case 91: /* db_optr ::= db_optr wal */ case 101: /* alter_db_optr ::= alter_db_optr wal */ yytestcase(yyruleno==101); -{ yylhsminor.yy478 = yymsp[-1].minor.yy478; yylhsminor.yy478.walLevel = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy478 = yylhsminor.yy478; +{ yylhsminor.yy374 = yymsp[-1].minor.yy374; yylhsminor.yy374.walLevel = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy374 = yylhsminor.yy374; break; case 92: /* db_optr ::= db_optr comp */ case 100: /* alter_db_optr ::= alter_db_optr comp */ yytestcase(yyruleno==100); -{ yylhsminor.yy478 = yymsp[-1].minor.yy478; yylhsminor.yy478.compressionLevel = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy478 = yylhsminor.yy478; +{ yylhsminor.yy374 = yymsp[-1].minor.yy374; yylhsminor.yy374.compressionLevel = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy374 = yylhsminor.yy374; break; case 93: /* db_optr ::= db_optr prec */ -{ yylhsminor.yy478 = yymsp[-1].minor.yy478; yylhsminor.yy478.precision = yymsp[0].minor.yy0; } - yymsp[-1].minor.yy478 = yylhsminor.yy478; +{ yylhsminor.yy374 = yymsp[-1].minor.yy374; yylhsminor.yy374.precision = yymsp[0].minor.yy0; } + yymsp[-1].minor.yy374 = yylhsminor.yy374; break; case 94: /* db_optr ::= db_optr keep */ case 98: /* alter_db_optr ::= alter_db_optr keep */ yytestcase(yyruleno==98); -{ yylhsminor.yy478 = yymsp[-1].minor.yy478; yylhsminor.yy478.keep = yymsp[0].minor.yy456; } - yymsp[-1].minor.yy478 = yylhsminor.yy478; +{ yylhsminor.yy374 = yymsp[-1].minor.yy374; yylhsminor.yy374.keep = yymsp[0].minor.yy322; } + yymsp[-1].minor.yy374 = yylhsminor.yy374; break; case 95: /* alter_db_optr ::= */ -{ setDefaultCreateDbOption(&yymsp[1].minor.yy478);} +{ setDefaultCreateDbOption(&yymsp[1].minor.yy374);} break; case 102: /* typename ::= ids */ -{ tSQLSetColumnType (&yylhsminor.yy47, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy47 = yylhsminor.yy47; +{ tSQLSetColumnType (&yylhsminor.yy325, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy325 = yylhsminor.yy325; break; case 103: /* typename ::= ids LP signed RP */ { - yymsp[-3].minor.yy0.type = -yymsp[-1].minor.yy373; // negative value of name length - tSQLSetColumnType(&yylhsminor.yy47, &yymsp[-3].minor.yy0); + yymsp[-3].minor.yy0.type = -yymsp[-1].minor.yy279; // negative value of name length + tSQLSetColumnType(&yylhsminor.yy325, &yymsp[-3].minor.yy0); } - yymsp[-3].minor.yy47 = yylhsminor.yy47; + yymsp[-3].minor.yy325 = yylhsminor.yy325; break; case 104: /* signed ::= INTEGER */ -{ yylhsminor.yy373 = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[0].minor.yy373 = yylhsminor.yy373; +{ yylhsminor.yy279 = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[0].minor.yy279 = yylhsminor.yy279; break; case 105: /* signed ::= PLUS INTEGER */ -{ yymsp[-1].minor.yy373 = strtol(yymsp[0].minor.yy0.z, NULL, 10); } +{ yymsp[-1].minor.yy279 = strtol(yymsp[0].minor.yy0.z, NULL, 10); } break; case 106: /* signed ::= MINUS INTEGER */ -{ yymsp[-1].minor.yy373 = -strtol(yymsp[0].minor.yy0.z, NULL, 10);} +{ yymsp[-1].minor.yy279 = -strtol(yymsp[0].minor.yy0.z, NULL, 10);} break; case 107: /* cmd ::= CREATE TABLE ifnotexists ids cpxName create_table_args */ { @@ -2289,61 +2291,61 @@ static void yy_reduce( break; case 108: /* create_table_args ::= LP columnlist RP */ { - yymsp[-2].minor.yy494 = tSetCreateSQLElems(yymsp[-1].minor.yy503, NULL, NULL, NULL, NULL, TSQL_CREATE_TABLE); - setSQLInfo(pInfo, yymsp[-2].minor.yy494, NULL, TSDB_SQL_CREATE_TABLE); + yymsp[-2].minor.yy408 = tSetCreateSQLElems(yymsp[-1].minor.yy369, NULL, NULL, NULL, NULL, TSQL_CREATE_TABLE); + setSQLInfo(pInfo, yymsp[-2].minor.yy408, NULL, TSDB_SQL_CREATE_TABLE); } break; case 109: /* create_table_args ::= LP columnlist RP TAGS LP columnlist RP */ { - yymsp[-6].minor.yy494 = tSetCreateSQLElems(yymsp[-5].minor.yy503, yymsp[-1].minor.yy503, NULL, NULL, NULL, TSQL_CREATE_STABLE); - setSQLInfo(pInfo, yymsp[-6].minor.yy494, NULL, TSDB_SQL_CREATE_TABLE); + yymsp[-6].minor.yy408 = tSetCreateSQLElems(yymsp[-5].minor.yy369, yymsp[-1].minor.yy369, NULL, NULL, NULL, TSQL_CREATE_STABLE); + setSQLInfo(pInfo, yymsp[-6].minor.yy408, NULL, TSDB_SQL_CREATE_TABLE); } break; case 110: /* create_table_args ::= USING ids cpxName TAGS LP tagitemlist RP */ { yymsp[-5].minor.yy0.n += yymsp[-4].minor.yy0.n; - yymsp[-6].minor.yy494 = tSetCreateSQLElems(NULL, NULL, &yymsp[-5].minor.yy0, yymsp[-1].minor.yy456, NULL, TSQL_CREATE_TABLE_FROM_STABLE); - setSQLInfo(pInfo, yymsp[-6].minor.yy494, NULL, TSDB_SQL_CREATE_TABLE); + yymsp[-6].minor.yy408 = tSetCreateSQLElems(NULL, NULL, &yymsp[-5].minor.yy0, yymsp[-1].minor.yy322, NULL, TSQL_CREATE_TABLE_FROM_STABLE); + setSQLInfo(pInfo, yymsp[-6].minor.yy408, NULL, TSDB_SQL_CREATE_TABLE); } break; case 111: /* create_table_args ::= AS select */ { - yymsp[-1].minor.yy494 = tSetCreateSQLElems(NULL, NULL, NULL, NULL, yymsp[0].minor.yy392, TSQL_CREATE_STREAM); - setSQLInfo(pInfo, yymsp[-1].minor.yy494, NULL, TSDB_SQL_CREATE_TABLE); + yymsp[-1].minor.yy408 = tSetCreateSQLElems(NULL, NULL, NULL, NULL, yymsp[0].minor.yy190, TSQL_CREATE_STREAM); + setSQLInfo(pInfo, yymsp[-1].minor.yy408, NULL, TSDB_SQL_CREATE_TABLE); } break; case 112: /* columnlist ::= columnlist COMMA column */ -{yylhsminor.yy503 = tFieldListAppend(yymsp[-2].minor.yy503, &yymsp[0].minor.yy47); } - yymsp[-2].minor.yy503 = yylhsminor.yy503; +{yylhsminor.yy369 = tFieldListAppend(yymsp[-2].minor.yy369, &yymsp[0].minor.yy325); } + yymsp[-2].minor.yy369 = yylhsminor.yy369; break; case 113: /* columnlist ::= column */ -{yylhsminor.yy503 = tFieldListAppend(NULL, &yymsp[0].minor.yy47);} - yymsp[0].minor.yy503 = yylhsminor.yy503; +{yylhsminor.yy369 = tFieldListAppend(NULL, &yymsp[0].minor.yy325);} + yymsp[0].minor.yy369 = yylhsminor.yy369; break; case 114: /* column ::= ids typename */ { - tSQLSetColumnInfo(&yylhsminor.yy47, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy47); + tSQLSetColumnInfo(&yylhsminor.yy325, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy325); } - yymsp[-1].minor.yy47 = yylhsminor.yy47; + yymsp[-1].minor.yy325 = yylhsminor.yy325; break; case 115: /* tagitemlist ::= tagitemlist COMMA tagitem */ -{ yylhsminor.yy456 = tVariantListAppend(yymsp[-2].minor.yy456, &yymsp[0].minor.yy442, -1); } - yymsp[-2].minor.yy456 = yylhsminor.yy456; +{ yylhsminor.yy322 = tVariantListAppend(yymsp[-2].minor.yy322, &yymsp[0].minor.yy518, -1); } + yymsp[-2].minor.yy322 = yylhsminor.yy322; break; case 116: /* tagitemlist ::= tagitem */ -{ yylhsminor.yy456 = tVariantListAppend(NULL, &yymsp[0].minor.yy442, -1); } - yymsp[0].minor.yy456 = yylhsminor.yy456; +{ yylhsminor.yy322 = tVariantListAppend(NULL, &yymsp[0].minor.yy518, -1); } + yymsp[0].minor.yy322 = yylhsminor.yy322; break; case 117: /* tagitem ::= INTEGER */ case 118: /* tagitem ::= FLOAT */ yytestcase(yyruleno==118); case 119: /* tagitem ::= STRING */ yytestcase(yyruleno==119); case 120: /* tagitem ::= BOOL */ yytestcase(yyruleno==120); -{toTSDBType(yymsp[0].minor.yy0.type); tVariantCreate(&yylhsminor.yy442, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy442 = yylhsminor.yy442; +{toTSDBType(yymsp[0].minor.yy0.type); tVariantCreate(&yylhsminor.yy518, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy518 = yylhsminor.yy518; break; case 121: /* tagitem ::= NULL */ -{ yymsp[0].minor.yy0.type = 0; tVariantCreate(&yylhsminor.yy442, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy442 = yylhsminor.yy442; +{ yymsp[0].minor.yy0.type = 0; tVariantCreate(&yylhsminor.yy518, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy518 = yylhsminor.yy518; break; case 122: /* tagitem ::= MINUS INTEGER */ case 123: /* tagitem ::= MINUS FLOAT */ yytestcase(yyruleno==123); @@ -2353,59 +2355,59 @@ static void yy_reduce( yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = yymsp[0].minor.yy0.type; toTSDBType(yymsp[-1].minor.yy0.type); - tVariantCreate(&yylhsminor.yy442, &yymsp[-1].minor.yy0); + tVariantCreate(&yylhsminor.yy518, &yymsp[-1].minor.yy0); } - yymsp[-1].minor.yy442 = yylhsminor.yy442; + yymsp[-1].minor.yy518 = yylhsminor.yy518; break; case 126: /* select ::= SELECT selcollist from where_opt interval_opt fill_opt sliding_opt groupby_opt orderby_opt having_opt slimit_opt limit_opt */ { - yylhsminor.yy392 = tSetQuerySQLElems(&yymsp[-11].minor.yy0, yymsp[-10].minor.yy10, yymsp[-9].minor.yy456, yymsp[-8].minor.yy2, yymsp[-4].minor.yy456, yymsp[-3].minor.yy456, &yymsp[-7].minor.yy0, &yymsp[-5].minor.yy0, yymsp[-6].minor.yy456, &yymsp[0].minor.yy230, &yymsp[-1].minor.yy230); + yylhsminor.yy190 = tSetQuerySQLElems(&yymsp[-11].minor.yy0, yymsp[-10].minor.yy260, yymsp[-9].minor.yy322, yymsp[-8].minor.yy500, yymsp[-4].minor.yy322, yymsp[-3].minor.yy322, &yymsp[-7].minor.yy0, &yymsp[-5].minor.yy0, yymsp[-6].minor.yy322, &yymsp[0].minor.yy284, &yymsp[-1].minor.yy284); } - yymsp[-11].minor.yy392 = yylhsminor.yy392; + yymsp[-11].minor.yy190 = yylhsminor.yy190; break; case 127: /* union ::= select */ -{ yylhsminor.yy145 = setSubclause(NULL, yymsp[0].minor.yy392); } - yymsp[0].minor.yy145 = yylhsminor.yy145; +{ yylhsminor.yy263 = setSubclause(NULL, yymsp[0].minor.yy190); } + yymsp[0].minor.yy263 = yylhsminor.yy263; break; case 128: /* union ::= LP union RP */ -{ yymsp[-2].minor.yy145 = yymsp[-1].minor.yy145; } +{ yymsp[-2].minor.yy263 = yymsp[-1].minor.yy263; } break; case 129: /* union ::= union UNION ALL select */ -{ yylhsminor.yy145 = appendSelectClause(yymsp[-3].minor.yy145, yymsp[0].minor.yy392); } - yymsp[-3].minor.yy145 = yylhsminor.yy145; +{ yylhsminor.yy263 = appendSelectClause(yymsp[-3].minor.yy263, yymsp[0].minor.yy190); } + yymsp[-3].minor.yy263 = yylhsminor.yy263; break; case 130: /* union ::= union UNION ALL LP select RP */ -{ yylhsminor.yy145 = appendSelectClause(yymsp[-5].minor.yy145, yymsp[-1].minor.yy392); } - yymsp[-5].minor.yy145 = yylhsminor.yy145; +{ yylhsminor.yy263 = appendSelectClause(yymsp[-5].minor.yy263, yymsp[-1].minor.yy190); } + yymsp[-5].minor.yy263 = yylhsminor.yy263; break; case 131: /* cmd ::= union */ -{ setSQLInfo(pInfo, yymsp[0].minor.yy145, NULL, TSDB_SQL_SELECT); } +{ setSQLInfo(pInfo, yymsp[0].minor.yy263, NULL, TSDB_SQL_SELECT); } break; case 132: /* select ::= SELECT selcollist */ { - yylhsminor.yy392 = tSetQuerySQLElems(&yymsp[-1].minor.yy0, yymsp[0].minor.yy10, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + yylhsminor.yy190 = tSetQuerySQLElems(&yymsp[-1].minor.yy0, yymsp[0].minor.yy260, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); } - yymsp[-1].minor.yy392 = yylhsminor.yy392; + yymsp[-1].minor.yy190 = yylhsminor.yy190; break; case 133: /* sclp ::= selcollist COMMA */ -{yylhsminor.yy10 = yymsp[-1].minor.yy10;} - yymsp[-1].minor.yy10 = yylhsminor.yy10; +{yylhsminor.yy260 = yymsp[-1].minor.yy260;} + yymsp[-1].minor.yy260 = yylhsminor.yy260; break; case 134: /* sclp ::= */ -{yymsp[1].minor.yy10 = 0;} +{yymsp[1].minor.yy260 = 0;} break; case 135: /* selcollist ::= sclp expr as */ { - yylhsminor.yy10 = tSQLExprListAppend(yymsp[-2].minor.yy10, yymsp[-1].minor.yy2, yymsp[0].minor.yy0.n?&yymsp[0].minor.yy0:0); + yylhsminor.yy260 = tSQLExprListAppend(yymsp[-2].minor.yy260, yymsp[-1].minor.yy500, yymsp[0].minor.yy0.n?&yymsp[0].minor.yy0:0); } - yymsp[-2].minor.yy10 = yylhsminor.yy10; + yymsp[-2].minor.yy260 = yylhsminor.yy260; break; case 136: /* selcollist ::= sclp STAR */ { tSQLExpr *pNode = tSQLExprIdValueCreate(NULL, TK_ALL); - yylhsminor.yy10 = tSQLExprListAppend(yymsp[-1].minor.yy10, pNode, 0); + yylhsminor.yy260 = tSQLExprListAppend(yymsp[-1].minor.yy260, pNode, 0); } - yymsp[-1].minor.yy10 = yylhsminor.yy10; + yymsp[-1].minor.yy260 = yylhsminor.yy260; break; case 137: /* as ::= AS ids */ { yymsp[-1].minor.yy0 = yymsp[0].minor.yy0; } @@ -2418,15 +2420,15 @@ static void yy_reduce( { yymsp[1].minor.yy0.n = 0; } break; case 140: /* from ::= FROM tablelist */ -{yymsp[-1].minor.yy456 = yymsp[0].minor.yy456;} +{yymsp[-1].minor.yy322 = yymsp[0].minor.yy322;} break; case 141: /* tablelist ::= ids cpxName */ -{ toTSDBType(yymsp[-1].minor.yy0.type); yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yylhsminor.yy456 = tVariantListAppendToken(NULL, &yymsp[-1].minor.yy0, -1);} - yymsp[-1].minor.yy456 = yylhsminor.yy456; +{ toTSDBType(yymsp[-1].minor.yy0.type); yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yylhsminor.yy322 = tVariantListAppendToken(NULL, &yymsp[-1].minor.yy0, -1);} + yymsp[-1].minor.yy322 = yylhsminor.yy322; break; case 142: /* tablelist ::= tablelist COMMA ids cpxName */ -{ toTSDBType(yymsp[-1].minor.yy0.type); yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yylhsminor.yy456 = tVariantListAppendToken(yymsp[-3].minor.yy456, &yymsp[-1].minor.yy0, -1); } - yymsp[-3].minor.yy456 = yylhsminor.yy456; +{ toTSDBType(yymsp[-1].minor.yy0.type); yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yylhsminor.yy322 = tVariantListAppendToken(yymsp[-3].minor.yy322, &yymsp[-1].minor.yy0, -1); } + yymsp[-3].minor.yy322 = yylhsminor.yy322; break; case 143: /* tmvar ::= VARIABLE */ {yylhsminor.yy0 = yymsp[0].minor.yy0;} @@ -2441,7 +2443,7 @@ static void yy_reduce( {yymsp[1].minor.yy0.n = 0; yymsp[1].minor.yy0.z = NULL; yymsp[1].minor.yy0.type = 0; } break; case 146: /* fill_opt ::= */ -{yymsp[1].minor.yy456 = 0; } +{yymsp[1].minor.yy322 = 0; } break; case 147: /* fill_opt ::= FILL LP ID COMMA tagitemlist RP */ { @@ -2449,223 +2451,223 @@ static void yy_reduce( toTSDBType(yymsp[-3].minor.yy0.type); tVariantCreate(&A, &yymsp[-3].minor.yy0); - tVariantListInsert(yymsp[-1].minor.yy456, &A, -1, 0); - yymsp[-5].minor.yy456 = yymsp[-1].minor.yy456; + tVariantListInsert(yymsp[-1].minor.yy322, &A, -1, 0); + yymsp[-5].minor.yy322 = yymsp[-1].minor.yy322; } break; case 148: /* fill_opt ::= FILL LP ID RP */ { toTSDBType(yymsp[-1].minor.yy0.type); - yymsp[-3].minor.yy456 = tVariantListAppendToken(NULL, &yymsp[-1].minor.yy0, -1); + yymsp[-3].minor.yy322 = tVariantListAppendToken(NULL, &yymsp[-1].minor.yy0, -1); } break; case 151: /* orderby_opt ::= */ case 159: /* groupby_opt ::= */ yytestcase(yyruleno==159); -{yymsp[1].minor.yy456 = 0;} +{yymsp[1].minor.yy322 = 0;} break; case 152: /* orderby_opt ::= ORDER BY sortlist */ case 160: /* groupby_opt ::= GROUP BY grouplist */ yytestcase(yyruleno==160); -{yymsp[-2].minor.yy456 = yymsp[0].minor.yy456;} +{yymsp[-2].minor.yy322 = yymsp[0].minor.yy322;} break; case 153: /* sortlist ::= sortlist COMMA item sortorder */ { - yylhsminor.yy456 = tVariantListAppend(yymsp[-3].minor.yy456, &yymsp[-1].minor.yy442, yymsp[0].minor.yy196); + yylhsminor.yy322 = tVariantListAppend(yymsp[-3].minor.yy322, &yymsp[-1].minor.yy518, yymsp[0].minor.yy150); } - yymsp[-3].minor.yy456 = yylhsminor.yy456; + yymsp[-3].minor.yy322 = yylhsminor.yy322; break; case 154: /* sortlist ::= item sortorder */ { - yylhsminor.yy456 = tVariantListAppend(NULL, &yymsp[-1].minor.yy442, yymsp[0].minor.yy196); + yylhsminor.yy322 = tVariantListAppend(NULL, &yymsp[-1].minor.yy518, yymsp[0].minor.yy150); } - yymsp[-1].minor.yy456 = yylhsminor.yy456; + yymsp[-1].minor.yy322 = yylhsminor.yy322; break; case 155: /* item ::= ids cpxName */ { toTSDBType(yymsp[-1].minor.yy0.type); yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; - tVariantCreate(&yylhsminor.yy442, &yymsp[-1].minor.yy0); + tVariantCreate(&yylhsminor.yy518, &yymsp[-1].minor.yy0); } - yymsp[-1].minor.yy442 = yylhsminor.yy442; + yymsp[-1].minor.yy518 = yylhsminor.yy518; break; case 156: /* sortorder ::= ASC */ -{yymsp[0].minor.yy196 = TSDB_ORDER_ASC; } +{yymsp[0].minor.yy150 = TSDB_ORDER_ASC; } break; case 157: /* sortorder ::= DESC */ -{yymsp[0].minor.yy196 = TSDB_ORDER_DESC;} +{yymsp[0].minor.yy150 = TSDB_ORDER_DESC;} break; case 158: /* sortorder ::= */ -{yymsp[1].minor.yy196 = TSDB_ORDER_ASC;} +{yymsp[1].minor.yy150 = TSDB_ORDER_ASC;} break; case 161: /* grouplist ::= grouplist COMMA item */ { - yylhsminor.yy456 = tVariantListAppend(yymsp[-2].minor.yy456, &yymsp[0].minor.yy442, -1); + yylhsminor.yy322 = tVariantListAppend(yymsp[-2].minor.yy322, &yymsp[0].minor.yy518, -1); } - yymsp[-2].minor.yy456 = yylhsminor.yy456; + yymsp[-2].minor.yy322 = yylhsminor.yy322; break; case 162: /* grouplist ::= item */ { - yylhsminor.yy456 = tVariantListAppend(NULL, &yymsp[0].minor.yy442, -1); + yylhsminor.yy322 = tVariantListAppend(NULL, &yymsp[0].minor.yy518, -1); } - yymsp[0].minor.yy456 = yylhsminor.yy456; + yymsp[0].minor.yy322 = yylhsminor.yy322; break; case 163: /* having_opt ::= */ case 173: /* where_opt ::= */ yytestcase(yyruleno==173); case 209: /* expritem ::= */ yytestcase(yyruleno==209); -{yymsp[1].minor.yy2 = 0;} +{yymsp[1].minor.yy500 = 0;} break; case 164: /* having_opt ::= HAVING expr */ case 174: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==174); -{yymsp[-1].minor.yy2 = yymsp[0].minor.yy2;} +{yymsp[-1].minor.yy500 = yymsp[0].minor.yy500;} break; case 165: /* limit_opt ::= */ case 169: /* slimit_opt ::= */ yytestcase(yyruleno==169); -{yymsp[1].minor.yy230.limit = -1; yymsp[1].minor.yy230.offset = 0;} +{yymsp[1].minor.yy284.limit = -1; yymsp[1].minor.yy284.offset = 0;} break; case 166: /* limit_opt ::= LIMIT signed */ case 170: /* slimit_opt ::= SLIMIT signed */ yytestcase(yyruleno==170); -{yymsp[-1].minor.yy230.limit = yymsp[0].minor.yy373; yymsp[-1].minor.yy230.offset = 0;} +{yymsp[-1].minor.yy284.limit = yymsp[0].minor.yy279; yymsp[-1].minor.yy284.offset = 0;} break; case 167: /* limit_opt ::= LIMIT signed OFFSET signed */ case 171: /* slimit_opt ::= SLIMIT signed SOFFSET signed */ yytestcase(yyruleno==171); -{yymsp[-3].minor.yy230.limit = yymsp[-2].minor.yy373; yymsp[-3].minor.yy230.offset = yymsp[0].minor.yy373;} +{yymsp[-3].minor.yy284.limit = yymsp[-2].minor.yy279; yymsp[-3].minor.yy284.offset = yymsp[0].minor.yy279;} break; case 168: /* limit_opt ::= LIMIT signed COMMA signed */ case 172: /* slimit_opt ::= SLIMIT signed COMMA signed */ yytestcase(yyruleno==172); -{yymsp[-3].minor.yy230.limit = yymsp[0].minor.yy373; yymsp[-3].minor.yy230.offset = yymsp[-2].minor.yy373;} +{yymsp[-3].minor.yy284.limit = yymsp[0].minor.yy279; yymsp[-3].minor.yy284.offset = yymsp[-2].minor.yy279;} break; case 175: /* expr ::= LP expr RP */ -{yymsp[-2].minor.yy2 = yymsp[-1].minor.yy2; } +{yymsp[-2].minor.yy500 = yymsp[-1].minor.yy500; } break; case 176: /* expr ::= ID */ -{yylhsminor.yy2 = tSQLExprIdValueCreate(&yymsp[0].minor.yy0, TK_ID);} - yymsp[0].minor.yy2 = yylhsminor.yy2; +{yylhsminor.yy500 = tSQLExprIdValueCreate(&yymsp[0].minor.yy0, TK_ID);} + yymsp[0].minor.yy500 = yylhsminor.yy500; break; case 177: /* expr ::= ID DOT ID */ -{yymsp[-2].minor.yy0.n += (1+yymsp[0].minor.yy0.n); yylhsminor.yy2 = tSQLExprIdValueCreate(&yymsp[-2].minor.yy0, TK_ID);} - yymsp[-2].minor.yy2 = yylhsminor.yy2; +{yymsp[-2].minor.yy0.n += (1+yymsp[0].minor.yy0.n); yylhsminor.yy500 = tSQLExprIdValueCreate(&yymsp[-2].minor.yy0, TK_ID);} + yymsp[-2].minor.yy500 = yylhsminor.yy500; break; case 178: /* expr ::= ID DOT STAR */ -{yymsp[-2].minor.yy0.n += (1+yymsp[0].minor.yy0.n); yylhsminor.yy2 = tSQLExprIdValueCreate(&yymsp[-2].minor.yy0, TK_ALL);} - yymsp[-2].minor.yy2 = yylhsminor.yy2; +{yymsp[-2].minor.yy0.n += (1+yymsp[0].minor.yy0.n); yylhsminor.yy500 = tSQLExprIdValueCreate(&yymsp[-2].minor.yy0, TK_ALL);} + yymsp[-2].minor.yy500 = yylhsminor.yy500; break; case 179: /* expr ::= INTEGER */ -{yylhsminor.yy2 = tSQLExprIdValueCreate(&yymsp[0].minor.yy0, TK_INTEGER);} - yymsp[0].minor.yy2 = yylhsminor.yy2; +{yylhsminor.yy500 = tSQLExprIdValueCreate(&yymsp[0].minor.yy0, TK_INTEGER);} + yymsp[0].minor.yy500 = yylhsminor.yy500; break; case 180: /* expr ::= MINUS INTEGER */ case 181: /* expr ::= PLUS INTEGER */ yytestcase(yyruleno==181); -{yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_INTEGER; yylhsminor.yy2 = tSQLExprIdValueCreate(&yymsp[-1].minor.yy0, TK_INTEGER);} - yymsp[-1].minor.yy2 = yylhsminor.yy2; +{yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_INTEGER; yylhsminor.yy500 = tSQLExprIdValueCreate(&yymsp[-1].minor.yy0, TK_INTEGER);} + yymsp[-1].minor.yy500 = yylhsminor.yy500; break; case 182: /* expr ::= FLOAT */ -{yylhsminor.yy2 = tSQLExprIdValueCreate(&yymsp[0].minor.yy0, TK_FLOAT);} - yymsp[0].minor.yy2 = yylhsminor.yy2; +{yylhsminor.yy500 = tSQLExprIdValueCreate(&yymsp[0].minor.yy0, TK_FLOAT);} + yymsp[0].minor.yy500 = yylhsminor.yy500; break; case 183: /* expr ::= MINUS FLOAT */ case 184: /* expr ::= PLUS FLOAT */ yytestcase(yyruleno==184); -{yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_FLOAT; yylhsminor.yy2 = tSQLExprIdValueCreate(&yymsp[-1].minor.yy0, TK_FLOAT);} - yymsp[-1].minor.yy2 = yylhsminor.yy2; +{yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_FLOAT; yylhsminor.yy500 = tSQLExprIdValueCreate(&yymsp[-1].minor.yy0, TK_FLOAT);} + yymsp[-1].minor.yy500 = yylhsminor.yy500; break; case 185: /* expr ::= STRING */ -{yylhsminor.yy2 = tSQLExprIdValueCreate(&yymsp[0].minor.yy0, TK_STRING);} - yymsp[0].minor.yy2 = yylhsminor.yy2; +{yylhsminor.yy500 = tSQLExprIdValueCreate(&yymsp[0].minor.yy0, TK_STRING);} + yymsp[0].minor.yy500 = yylhsminor.yy500; break; case 186: /* expr ::= NOW */ -{yylhsminor.yy2 = tSQLExprIdValueCreate(&yymsp[0].minor.yy0, TK_NOW); } - yymsp[0].minor.yy2 = yylhsminor.yy2; +{yylhsminor.yy500 = tSQLExprIdValueCreate(&yymsp[0].minor.yy0, TK_NOW); } + yymsp[0].minor.yy500 = yylhsminor.yy500; break; case 187: /* expr ::= VARIABLE */ -{yylhsminor.yy2 = tSQLExprIdValueCreate(&yymsp[0].minor.yy0, TK_VARIABLE);} - yymsp[0].minor.yy2 = yylhsminor.yy2; +{yylhsminor.yy500 = tSQLExprIdValueCreate(&yymsp[0].minor.yy0, TK_VARIABLE);} + yymsp[0].minor.yy500 = yylhsminor.yy500; break; case 188: /* expr ::= BOOL */ -{yylhsminor.yy2 = tSQLExprIdValueCreate(&yymsp[0].minor.yy0, TK_BOOL);} - yymsp[0].minor.yy2 = yylhsminor.yy2; +{yylhsminor.yy500 = tSQLExprIdValueCreate(&yymsp[0].minor.yy0, TK_BOOL);} + yymsp[0].minor.yy500 = yylhsminor.yy500; break; case 189: /* expr ::= ID LP exprlist RP */ { - yylhsminor.yy2 = tSQLExprCreateFunction(yymsp[-1].minor.yy10, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type); + yylhsminor.yy500 = tSQLExprCreateFunction(yymsp[-1].minor.yy260, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type); } - yymsp[-3].minor.yy2 = yylhsminor.yy2; + yymsp[-3].minor.yy500 = yylhsminor.yy500; break; case 190: /* expr ::= ID LP STAR RP */ { - yylhsminor.yy2 = tSQLExprCreateFunction(NULL, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type); + yylhsminor.yy500 = tSQLExprCreateFunction(NULL, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type); } - yymsp[-3].minor.yy2 = yylhsminor.yy2; + yymsp[-3].minor.yy500 = yylhsminor.yy500; break; case 191: /* expr ::= expr AND expr */ -{yylhsminor.yy2 = tSQLExprCreate(yymsp[-2].minor.yy2, yymsp[0].minor.yy2, TK_AND);} - yymsp[-2].minor.yy2 = yylhsminor.yy2; +{yylhsminor.yy500 = tSQLExprCreate(yymsp[-2].minor.yy500, yymsp[0].minor.yy500, TK_AND);} + yymsp[-2].minor.yy500 = yylhsminor.yy500; break; case 192: /* expr ::= expr OR expr */ -{yylhsminor.yy2 = tSQLExprCreate(yymsp[-2].minor.yy2, yymsp[0].minor.yy2, TK_OR); } - yymsp[-2].minor.yy2 = yylhsminor.yy2; +{yylhsminor.yy500 = tSQLExprCreate(yymsp[-2].minor.yy500, yymsp[0].minor.yy500, TK_OR); } + yymsp[-2].minor.yy500 = yylhsminor.yy500; break; case 193: /* expr ::= expr LT expr */ -{yylhsminor.yy2 = tSQLExprCreate(yymsp[-2].minor.yy2, yymsp[0].minor.yy2, TK_LT);} - yymsp[-2].minor.yy2 = yylhsminor.yy2; +{yylhsminor.yy500 = tSQLExprCreate(yymsp[-2].minor.yy500, yymsp[0].minor.yy500, TK_LT);} + yymsp[-2].minor.yy500 = yylhsminor.yy500; break; case 194: /* expr ::= expr GT expr */ -{yylhsminor.yy2 = tSQLExprCreate(yymsp[-2].minor.yy2, yymsp[0].minor.yy2, TK_GT);} - yymsp[-2].minor.yy2 = yylhsminor.yy2; +{yylhsminor.yy500 = tSQLExprCreate(yymsp[-2].minor.yy500, yymsp[0].minor.yy500, TK_GT);} + yymsp[-2].minor.yy500 = yylhsminor.yy500; break; case 195: /* expr ::= expr LE expr */ -{yylhsminor.yy2 = tSQLExprCreate(yymsp[-2].minor.yy2, yymsp[0].minor.yy2, TK_LE);} - yymsp[-2].minor.yy2 = yylhsminor.yy2; +{yylhsminor.yy500 = tSQLExprCreate(yymsp[-2].minor.yy500, yymsp[0].minor.yy500, TK_LE);} + yymsp[-2].minor.yy500 = yylhsminor.yy500; break; case 196: /* expr ::= expr GE expr */ -{yylhsminor.yy2 = tSQLExprCreate(yymsp[-2].minor.yy2, yymsp[0].minor.yy2, TK_GE);} - yymsp[-2].minor.yy2 = yylhsminor.yy2; +{yylhsminor.yy500 = tSQLExprCreate(yymsp[-2].minor.yy500, yymsp[0].minor.yy500, TK_GE);} + yymsp[-2].minor.yy500 = yylhsminor.yy500; break; case 197: /* expr ::= expr NE expr */ -{yylhsminor.yy2 = tSQLExprCreate(yymsp[-2].minor.yy2, yymsp[0].minor.yy2, TK_NE);} - yymsp[-2].minor.yy2 = yylhsminor.yy2; +{yylhsminor.yy500 = tSQLExprCreate(yymsp[-2].minor.yy500, yymsp[0].minor.yy500, TK_NE);} + yymsp[-2].minor.yy500 = yylhsminor.yy500; break; case 198: /* expr ::= expr EQ expr */ -{yylhsminor.yy2 = tSQLExprCreate(yymsp[-2].minor.yy2, yymsp[0].minor.yy2, TK_EQ);} - yymsp[-2].minor.yy2 = yylhsminor.yy2; +{yylhsminor.yy500 = tSQLExprCreate(yymsp[-2].minor.yy500, yymsp[0].minor.yy500, TK_EQ);} + yymsp[-2].minor.yy500 = yylhsminor.yy500; break; case 199: /* expr ::= expr PLUS expr */ -{yylhsminor.yy2 = tSQLExprCreate(yymsp[-2].minor.yy2, yymsp[0].minor.yy2, TK_PLUS); } - yymsp[-2].minor.yy2 = yylhsminor.yy2; +{yylhsminor.yy500 = tSQLExprCreate(yymsp[-2].minor.yy500, yymsp[0].minor.yy500, TK_PLUS); } + yymsp[-2].minor.yy500 = yylhsminor.yy500; break; case 200: /* expr ::= expr MINUS expr */ -{yylhsminor.yy2 = tSQLExprCreate(yymsp[-2].minor.yy2, yymsp[0].minor.yy2, TK_MINUS); } - yymsp[-2].minor.yy2 = yylhsminor.yy2; +{yylhsminor.yy500 = tSQLExprCreate(yymsp[-2].minor.yy500, yymsp[0].minor.yy500, TK_MINUS); } + yymsp[-2].minor.yy500 = yylhsminor.yy500; break; case 201: /* expr ::= expr STAR expr */ -{yylhsminor.yy2 = tSQLExprCreate(yymsp[-2].minor.yy2, yymsp[0].minor.yy2, TK_STAR); } - yymsp[-2].minor.yy2 = yylhsminor.yy2; +{yylhsminor.yy500 = tSQLExprCreate(yymsp[-2].minor.yy500, yymsp[0].minor.yy500, TK_STAR); } + yymsp[-2].minor.yy500 = yylhsminor.yy500; break; case 202: /* expr ::= expr SLASH expr */ -{yylhsminor.yy2 = tSQLExprCreate(yymsp[-2].minor.yy2, yymsp[0].minor.yy2, TK_DIVIDE);} - yymsp[-2].minor.yy2 = yylhsminor.yy2; +{yylhsminor.yy500 = tSQLExprCreate(yymsp[-2].minor.yy500, yymsp[0].minor.yy500, TK_DIVIDE);} + yymsp[-2].minor.yy500 = yylhsminor.yy500; break; case 203: /* expr ::= expr REM expr */ -{yylhsminor.yy2 = tSQLExprCreate(yymsp[-2].minor.yy2, yymsp[0].minor.yy2, TK_REM); } - yymsp[-2].minor.yy2 = yylhsminor.yy2; +{yylhsminor.yy500 = tSQLExprCreate(yymsp[-2].minor.yy500, yymsp[0].minor.yy500, TK_REM); } + yymsp[-2].minor.yy500 = yylhsminor.yy500; break; case 204: /* expr ::= expr LIKE expr */ -{yylhsminor.yy2 = tSQLExprCreate(yymsp[-2].minor.yy2, yymsp[0].minor.yy2, TK_LIKE); } - yymsp[-2].minor.yy2 = yylhsminor.yy2; +{yylhsminor.yy500 = tSQLExprCreate(yymsp[-2].minor.yy500, yymsp[0].minor.yy500, TK_LIKE); } + yymsp[-2].minor.yy500 = yylhsminor.yy500; break; case 205: /* expr ::= expr IN LP exprlist RP */ -{yylhsminor.yy2 = tSQLExprCreate(yymsp[-4].minor.yy2, (tSQLExpr*)yymsp[-1].minor.yy10, TK_IN); } - yymsp[-4].minor.yy2 = yylhsminor.yy2; +{yylhsminor.yy500 = tSQLExprCreate(yymsp[-4].minor.yy500, (tSQLExpr*)yymsp[-1].minor.yy260, TK_IN); } + yymsp[-4].minor.yy500 = yylhsminor.yy500; break; case 206: /* exprlist ::= exprlist COMMA expritem */ -{yylhsminor.yy10 = tSQLExprListAppend(yymsp[-2].minor.yy10,yymsp[0].minor.yy2,0);} - yymsp[-2].minor.yy10 = yylhsminor.yy10; +{yylhsminor.yy260 = tSQLExprListAppend(yymsp[-2].minor.yy260,yymsp[0].minor.yy500,0);} + yymsp[-2].minor.yy260 = yylhsminor.yy260; break; case 207: /* exprlist ::= expritem */ -{yylhsminor.yy10 = tSQLExprListAppend(0,yymsp[0].minor.yy2,0);} - yymsp[0].minor.yy10 = yylhsminor.yy10; +{yylhsminor.yy260 = tSQLExprListAppend(0,yymsp[0].minor.yy500,0);} + yymsp[0].minor.yy260 = yylhsminor.yy260; break; case 208: /* expritem ::= expr */ -{yylhsminor.yy2 = yymsp[0].minor.yy2;} - yymsp[0].minor.yy2 = yylhsminor.yy2; +{yylhsminor.yy500 = yymsp[0].minor.yy500;} + yymsp[0].minor.yy500 = yylhsminor.yy500; break; case 210: /* cmd ::= RESET QUERY CACHE */ { setDCLSQLElems(pInfo, TSDB_SQL_RESET_CACHE, 0);} @@ -2673,7 +2675,7 @@ static void yy_reduce( case 211: /* cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; - SAlterTableSQL* pAlterTable = tAlterTableSQLElems(&yymsp[-4].minor.yy0, yymsp[0].minor.yy503, NULL, TSDB_ALTER_TABLE_ADD_COLUMN); + SAlterTableSQL* pAlterTable = tAlterTableSQLElems(&yymsp[-4].minor.yy0, yymsp[0].minor.yy369, NULL, TSDB_ALTER_TABLE_ADD_COLUMN); setSQLInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; @@ -2691,7 +2693,7 @@ static void yy_reduce( case 213: /* cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; - SAlterTableSQL* pAlterTable = tAlterTableSQLElems(&yymsp[-4].minor.yy0, yymsp[0].minor.yy503, NULL, TSDB_ALTER_TABLE_ADD_TAG_COLUMN); + SAlterTableSQL* pAlterTable = tAlterTableSQLElems(&yymsp[-4].minor.yy0, yymsp[0].minor.yy369, NULL, TSDB_ALTER_TABLE_ADD_TAG_COLUMN); setSQLInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; @@ -2726,7 +2728,7 @@ static void yy_reduce( toTSDBType(yymsp[-2].minor.yy0.type); tVariantList* A = tVariantListAppendToken(NULL, &yymsp[-2].minor.yy0, -1); - A = tVariantListAppend(A, &yymsp[0].minor.yy442, -1); + A = tVariantListAppend(A, &yymsp[0].minor.yy518, -1); SAlterTableSQL* pAlterTable = tAlterTableSQLElems(&yymsp[-6].minor.yy0, NULL, A, TSDB_ALTER_TABLE_UPDATE_TAG_VAL); setSQLInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); From b58ac0e7d0fcd0fdd61b28a12fa7fc6b57aee88d Mon Sep 17 00:00:00 2001 From: hjxilinx Date: Sat, 9 May 2020 10:34:03 +0800 Subject: [PATCH 06/23] [td-225] remove macro define --- cmake/platform.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/platform.inc b/cmake/platform.inc index 1772a83fb2..2e0e2d6af0 100755 --- a/cmake/platform.inc +++ b/cmake/platform.inc @@ -62,7 +62,7 @@ IF (${CMAKE_SYSTEM_NAME} MATCHES "Linux") IF (${CMAKE_SIZEOF_VOID_P} MATCHES 8) SET(TD_LINUX_64 TRUE) SET(TD_OS_DIR ${TD_COMMUNITY_DIR}/src/os/linux) - ADD_DEFINITIONS(-D_M_X64 -D_DEBUG_VIEW) + ADD_DEFINITIONS(-D_M_X64) MESSAGE(STATUS "The current platform is Linux 64-bit") ELSEIF (${CMAKE_SIZEOF_VOID_P} MATCHES 4) IF (TD_ARM) From b175e7cdf2c320cfa7c9def5972df767cf089cae Mon Sep 17 00:00:00 2001 From: slguan Date: Sat, 9 May 2020 11:20:19 +0800 Subject: [PATCH 07/23] rname dnode table name in log database --- src/plugins/monitor/src/monitorMain.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/plugins/monitor/src/monitorMain.c b/src/plugins/monitor/src/monitorMain.c index 35787d1dfe..76b322d01b 100644 --- a/src/plugins/monitor/src/monitorMain.c +++ b/src/plugins/monitor/src/monitorMain.c @@ -160,11 +160,11 @@ static void dnodeBuildMonitorSql(char *sql, int32_t cmd) { ", band_speed float" ", io_read float, io_write float" ", req_http int, req_select int, req_insert int" - ") tags (ipaddr binary(%d))", + ") tags (dnodeid int, fqdn binary(%d))", tsMonitorDbName, TSDB_FQDN_LEN + 1); } else if (cmd == MONITOR_CMD_CREATE_TB_DN) { - snprintf(sql, SQL_LENGTH, "create table if not exists %s.dn_%s using %s.dn tags('%s')", tsMonitorDbName, - tsMonitorConn.ep, tsMonitorDbName, tsLocalEp); + snprintf(sql, SQL_LENGTH, "create table if not exists %s.dn%d using %s.dn tags(%d, '%s')", tsMonitorDbName, + dnodeGetDnodeId(), tsMonitorDbName, dnodeGetDnodeId(), tsLocalEp); } else if (cmd == MONITOR_CMD_CREATE_MT_ACCT) { snprintf(sql, SQL_LENGTH, "create table if not exists %s.acct(ts timestamp " @@ -347,7 +347,7 @@ static void monitorSaveSystemInfo() { int64_t ts = taosGetTimestampUs(); char * sql = tsMonitorConn.sql; - int32_t pos = snprintf(sql, SQL_LENGTH, "insert into %s.dn_%s values(%" PRId64, tsMonitorDbName, tsMonitorConn.ep, ts); + int32_t pos = snprintf(sql, SQL_LENGTH, "insert into %s.dn%d values(%" PRId64, tsMonitorDbName, dnodeGetDnodeId(), ts); pos += monitorBuildCpuSql(sql + pos); pos += monitorBuildMemorySql(sql + pos); From 269d15c485a911d6213532b8de0dd2642a985ca2 Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Sat, 9 May 2020 11:25:27 +0800 Subject: [PATCH 08/23] fixup: change default charset to UTF-8 --- tests/pytest/util/dnodes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/pytest/util/dnodes.py b/tests/pytest/util/dnodes.py index 51eed3d25a..2532cec702 100644 --- a/tests/pytest/util/dnodes.py +++ b/tests/pytest/util/dnodes.py @@ -69,7 +69,7 @@ class TDSimClient: self.cfg("numOfLogLines", "100000000") self.cfg("numOfThreadsPerCore", "2.0") self.cfg("locale", "en_US.UTF-8") - self.cfg("charset", "GBK") + self.cfg("charset", "UTF-8") self.cfg("asyncLog", "0") self.cfg("anyIp", "0") self.cfg("sdbDebugFlag", "135") From 4c8955f48b19895adf3de180e821a043d73b1cd0 Mon Sep 17 00:00:00 2001 From: hjxilinx Date: Sat, 9 May 2020 11:42:24 +0800 Subject: [PATCH 09/23] [td-225] remove macro define --- src/client/src/tscSubquery.c | 49 ------------------------------------ 1 file changed, 49 deletions(-) diff --git a/src/client/src/tscSubquery.c b/src/client/src/tscSubquery.c index 5c5b725ea2..020a1b3606 100644 --- a/src/client/src/tscSubquery.c +++ b/src/client/src/tscSubquery.c @@ -1032,55 +1032,6 @@ void tscJoinQueryCallback(void* param, TAOS_RES* tres, int code) { ///////////////////////////////////////////////////////////////////////////////////////// static void tscRetrieveDataRes(void *param, TAOS_RES *tres, int code); -//static void ddx(TAOS* taos) { -// -// SSqlCmd* pCmd = &pSql->cmd; -// -// tscPartiallyFreeSqlObj(pSql); -//// tscTrace("continue parse sql: %s", pSql->cmd.curSql); -// -// SQueryInfo* pQueryInfo = NULL; -// int32_t code = tscGetQueryInfoDetailSafely(pCmd, pCmd->clauseIndex, &pQueryInfo); -// assert(code == TSDB_CODE_SUCCESS); -// -// STableMetaInfo* pTableMetaInfo = tscGetMetaInfo(pQueryInfo, 0); -// -// if (UTIL_TABLE_IS_SUPERTABLE(pTableMetaInfo)) { // return the tableId & tag -// SSchema s = {0}; -// SColumnIndex index = {0}; -// -// size_t numOfTags = taosArrayGetSize(pTableMetaInfo->tagColList); -// for (int32_t i = 0; i < numOfTags; ++i) { -// SColumn* c = taosArrayGetP(pTableMetaInfo->tagColList, i); -// index = (SColumnIndex){.tableIndex = 0, .columnIndex = c->colIndex.columnIndex}; -// -// SSchema* pTagSchema = tscGetTableTagSchema(pTableMetaInfo->pTableMeta); -// s = pTagSchema[c->colIndex.columnIndex]; -// -// int16_t bytes = 0; -// int16_t type = 0; -// int16_t inter = 0; -// -// getResultDataInfo(s.type, s.bytes, TSDB_FUNC_TID_TAG, 0, &type, &bytes, &inter, 0, 0); -// -// s.type = type; -// s.bytes = bytes; -//// pSupporter->tagSize = s.bytes; -// } -// -// // set get tags query type -// TSDB_QUERY_SET_TYPE(pQueryInfo->type, TSDB_QUERY_TYPE_TAG_FILTER_QUERY); -// -// tscAddSpecialColumnForSelect(pQueryInfo, 0, TSDB_FUNC_TID_TAG, &index, &s, TSDB_COL_TAG); -// size_t numOfCols = taosArrayGetSize(pQueryInfo->colList); -// -// tscTrace( "%p vgroupIndex:%d, type:%d, tid_tag query to retrieve (tableId, tags), " -// "exprInfo:%d, colList:%d, fieldsInfo:%d, name:%s", -// pSql, pTableMetaInfo->vgroupIndex, pQueryInfo->type, tscSqlExprNumOfExprs(pQueryInfo), -// numOfCols, pQueryInfo->fieldsInfo.numOfOutput, pQueryInfo->pTableMetaInfo[0]->name); -// } -//} - static SSqlObj *tscCreateSqlObjForSubquery(SSqlObj *pSql, SRetrieveSupport *trsupport, SSqlObj *prevSqlObj); // todo merge with callback From b7e4b7eefdebf9f20a84e1e62708fe27c5caac02 Mon Sep 17 00:00:00 2001 From: slguan Date: Sat, 9 May 2020 13:48:18 +0800 Subject: [PATCH 10/23] invalid read while sync --- src/mnode/src/mgmtMain.c | 21 ++++++++++----------- src/mnode/src/mgmtShell.c | 15 ++++++++++----- tests/script/unique/mnode/mgmt22.sim | 13 +++++++++---- 3 files changed, 29 insertions(+), 20 deletions(-) diff --git a/src/mnode/src/mgmtMain.c b/src/mnode/src/mgmtMain.c index 37edddec10..434552980f 100644 --- a/src/mnode/src/mgmtMain.c +++ b/src/mnode/src/mgmtMain.c @@ -55,11 +55,6 @@ int32_t mgmtStartSystem() { return -1; } - if (grantInit() < 0) { - mError("failed to init grant"); - return -1; - } - if (mgmtInitUsers() < 0) { mError("failed to init users"); return -1; @@ -99,6 +94,11 @@ int32_t mgmtStartSystem() { mError("failed to init balance") } + if (grantInit() < 0) { + mError("failed to init grant"); + return -1; + } + if (mgmtInitServer() < 0) { return -1; } @@ -132,19 +132,18 @@ int32_t mgmtInitSystem() { void mgmtCleanUpSystem() { mPrint("starting to clean up mgmt"); - grantCleanUp(); - mgmtCleanupMnodes(); - balanceCleanUp(); mgmtCleanUpShell(); mgmtCleanupServer(); - mgmtCleanUpAccts(); + grantCleanUp(); + balanceCleanUp(); + sdbCleanUp(); + mgmtCleanupMnodes(); mgmtCleanUpTables(); mgmtCleanUpVgroups(); mgmtCleanUpDbs(); mgmtCleanupDnodes(); mgmtCleanUpUsers(); - sdbCleanUp(); - taosTmrCleanUp(tsMgmtTmr); + mgmtCleanUpAccts(); tsMgmtIsRunning = false; mPrint("mgmt is cleaned up"); } diff --git a/src/mnode/src/mgmtShell.c b/src/mnode/src/mgmtShell.c index 3cb0225b97..c869e752d3 100644 --- a/src/mnode/src/mgmtShell.c +++ b/src/mnode/src/mgmtShell.c @@ -66,21 +66,26 @@ int32_t mgmtInitShell() { tsMgmtTmr = taosTmrInit((tsMaxShellConns) * 3, 200, 3600000, "MND"); tsMgmtTranQhandle = taosInitScheduler(tsMaxShellConns, 1, "mnodeT"); - tsQhandleCache = taosCacheInit(tsMgmtTmr, 2); + tsQhandleCache = taosCacheInit(tsMgmtTmr, 10); return 0; } void mgmtCleanUpShell() { - if (tsMgmtTranQhandle) { - taosCleanUpScheduler(tsMgmtTranQhandle); - tsMgmtTranQhandle = NULL; + if (tsMgmtTmr != NULL){ + taosTmrCleanUp(tsMgmtTmr); + tsMgmtTmr = NULL; } - if (tsQhandleCache) { + if (tsQhandleCache != NULL) { taosCacheCleanup(tsQhandleCache); tsQhandleCache = NULL; } + + if (tsMgmtTranQhandle != NULL) { + taosCleanUpScheduler(tsMgmtTranQhandle); + tsMgmtTranQhandle = NULL; + } } void mgmtAddShellMsgHandle(uint8_t showType, void (*fp)(SQueuedMsg *queuedMsg)) { diff --git a/tests/script/unique/mnode/mgmt22.sim b/tests/script/unique/mnode/mgmt22.sim index ae3c386122..50692524cf 100644 --- a/tests/script/unique/mnode/mgmt22.sim +++ b/tests/script/unique/mnode/mgmt22.sim @@ -8,7 +8,8 @@ system sh/cfg.sh -n dnode2 -c numOfMPeers -v 2 system sh/cfg.sh -n dnode3 -c numOfMPeers -v 2 print ============== step1 -system sh/exec_up.sh -n dnode1 -s start +system sh/exec_up.sh -n dnode1 -s start -t +sleep 3000 sql connect sql show mnodes @@ -19,7 +20,7 @@ if $data2_1 != master then endi print ============== step2 -system sh/exec_up.sh -n dnode2 -s start +system sh/exec_up.sh -n dnode2 -s start -t sql create dnode $hostname2 $x = 0 @@ -44,8 +45,12 @@ print ============== step3 sql_error drop dnode $hostname1 -x error1 print should not drop master +system sh/exec_up.sh -n dnode1 -s stop -x SIGINT +system sh/exec_up.sh -n dnode2 -s stop -x SIGINT +return + print ============== step4 -system sh/exec_up.sh -n dnode1 -s stop +system sh/exec_up.sh -n dnode1 -s stop -x SIGINT sql_error show mnodes print error of no master @@ -78,7 +83,7 @@ if $data2_2 != slave then endi print ============== step7 -system sh/exec_up.sh -n dnode3 -s start +system sh/exec_up.sh -n dnode3 -s start -t sql create dnode $hostname3 sleep 5000 From 29a514314b77dff067fcb119ed0092ec81e84789 Mon Sep 17 00:00:00 2001 From: liuyq-617 <183030384@qq.com> Date: Sat, 9 May 2020 13:51:56 +0800 Subject: [PATCH 11/23] change describe log.dn --- tests/examples/JDBC/springbootdemo/readme.md | 2 +- .../springbootdemo/src/main/resources/application.properties | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/examples/JDBC/springbootdemo/readme.md b/tests/examples/JDBC/springbootdemo/readme.md index 64aabedcdc..ac3bb44ef9 100644 --- a/tests/examples/JDBC/springbootdemo/readme.md +++ b/tests/examples/JDBC/springbootdemo/readme.md @@ -14,7 +14,7 @@ spring.datasource.druid.max-active=5 # max wait time for get connection, ms spring.datasource.druid.max-wait=60000 -spring.datasource.druid.validation-query=describe log.dn +spring.datasource.druid.validation-query=select server_status(); spring.datasource.druid.validation-query-timeout=5000 spring.datasource.druid.test-on-borrow=false spring.datasource.druid.test-on-return=false diff --git a/tests/examples/JDBC/springbootdemo/src/main/resources/application.properties b/tests/examples/JDBC/springbootdemo/src/main/resources/application.properties index dc77e144f0..926559a90c 100644 --- a/tests/examples/JDBC/springbootdemo/src/main/resources/application.properties +++ b/tests/examples/JDBC/springbootdemo/src/main/resources/application.properties @@ -10,7 +10,7 @@ spring.datasource.druid.max-active=5 # max wait time for get connection, ms spring.datasource.druid.max-wait=60000 -spring.datasource.druid.validation-query=describe log.dn +spring.datasource.druid.validation-query=select server_status(); spring.datasource.druid.validation-query-timeout=5000 spring.datasource.druid.test-on-borrow=false spring.datasource.druid.test-on-return=false @@ -23,4 +23,4 @@ spring.datasource.druid.max-evictable-idle-time-millis=900000 #mybatis mybatis.mapper-locations=classpath:mapper/*.xml -logging.level.com.taosdata.jdbc.springbootdemo.dao=debug \ No newline at end of file +logging.level.com.taosdata.jdbc.springbootdemo.dao=debug From 3a9a9ed1d204bfe5a4d968a4c21c56a2bd8c1a24 Mon Sep 17 00:00:00 2001 From: slguan Date: Sat, 9 May 2020 13:54:10 +0800 Subject: [PATCH 12/23] crash while print log --- src/client/src/tscSubquery.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/src/tscSubquery.c b/src/client/src/tscSubquery.c index 020a1b3606..d3a81adca6 100644 --- a/src/client/src/tscSubquery.c +++ b/src/client/src/tscSubquery.c @@ -1436,7 +1436,7 @@ void tscHandleSubqueryError(SRetrieveSupport *trsupport, SSqlObj *pSql, int numO return; } else { // reach the maximum retry count, abort atomic_val_compare_exchange_32(&pState->code, TSDB_CODE_SUCCESS, numOfRows); - tscError("%p sub:%p retrieve failed,code:%s,orderOfSub:%d failed.no more retry,set global code:%d", pPObj, pSql, + tscError("%p sub:%p retrieve failed,code:%d,orderOfSub:%d failed.no more retry,set global code:%d", pPObj, pSql, numOfRows, subqueryIndex, tstrerror(pState->code)); } } From b69e67bd7fc189ae8fad56b2cd11454a7335e8db Mon Sep 17 00:00:00 2001 From: slguan Date: Sat, 9 May 2020 13:58:16 +0800 Subject: [PATCH 13/23] scripts --- tests/script/unique/db/replica_add12.sim | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/script/unique/db/replica_add12.sim b/tests/script/unique/db/replica_add12.sim index 5d1ec79450..b0de807fca 100644 --- a/tests/script/unique/db/replica_add12.sim +++ b/tests/script/unique/db/replica_add12.sim @@ -73,9 +73,9 @@ endi sleep 2000 sql show dnodes -print dnode1 ==> openVnodes: $data3_1 -print dnode2 ==> openVnodes: $data3_2 -print dnode3 ==> openVnodes: $data3_3 +print dnode1 ==> openVnodes: $data2_1 +print dnode2 ==> openVnodes: $data2_2 +print dnode3 ==> openVnodes: $data2_3 if $data2_1 != 0 then return -1 @@ -99,9 +99,9 @@ sleep 10000 print ======== step3 sql show dnodes -print dnode1 ==> openVnodes: $data3_1 -print dnode2 ==> openVnodes: $data3_2 -print dnode3 ==> openVnodes: $data3_3 +print dnode1 ==> openVnodes: $data2_1 +print dnode2 ==> openVnodes: $data2_2 +print dnode3 ==> openVnodes: $data2_3 if $data2_1 != 0 then return -1 From 1ebaa4e27a947d870c67ec6b76c01993faf4a93a Mon Sep 17 00:00:00 2001 From: slguan Date: Sat, 9 May 2020 17:06:09 +0800 Subject: [PATCH 14/23] fix bug while alter dnode --- src/client/src/tscSQLParser.c | 5 +++-- src/client/src/tscServer.c | 23 ++++++++--------------- src/common/src/tglobal.c | 21 +++++++++++++++++---- src/dnode/src/dnodeShell.c | 1 - src/inc/taosmsg.h | 4 ---- src/mnode/src/mgmtDnode.c | 2 +- src/mnode/src/mgmtMain.c | 2 +- src/mnode/src/mgmtSdb.c | 14 +++++++++++--- tests/script/jenkins/basic.txt | 14 +++++++------- tests/script/sh/deploy.sh | 1 + 10 files changed, 49 insertions(+), 38 deletions(-) diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index cd5dd6355a..c0ee6f9d89 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -370,10 +370,11 @@ int32_t tscToSQLCmd(SSqlObj* pSql, struct SSqlInfo* pInfo) { return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg2); } - char* pMsg = pCmd->payload + tsRpcHeadSize; - pMsg += sizeof(SMgmtHead); + char* pMsg = pCmd->payload; SCMCfgDnodeMsg* pCfg = (SCMCfgDnodeMsg*)pMsg; + pDCL->a[0].n = strdequote(pDCL->a[0].z); + strncpy(pCfg->ep, pDCL->a[0].z, pDCL->a[0].n); strncpy(pCfg->config, pDCL->a[1].z, pDCL->a[1].n); diff --git a/src/client/src/tscServer.c b/src/client/src/tscServer.c index 35e2250dd8..119a84e964 100644 --- a/src/client/src/tscServer.c +++ b/src/client/src/tscServer.c @@ -1005,13 +1005,7 @@ int32_t tscBuildUserMsg(SSqlObj *pSql, SSqlInfo *pInfo) { int32_t tscBuildCfgDnodeMsg(SSqlObj *pSql, SSqlInfo *pInfo) { SSqlCmd *pCmd = &pSql->cmd; pCmd->payloadLen = sizeof(SCMCfgDnodeMsg); - - if (TSDB_CODE_SUCCESS != tscAllocPayload(pCmd, pCmd->payloadLen)) { - tscError("%p failed to malloc for query msg", pSql); - return TSDB_CODE_CLI_OUT_OF_MEMORY; - } - - pCmd->msgType = TSDB_MSG_TYPE_MD_CONFIG_DNODE; + pCmd->msgType = TSDB_MSG_TYPE_CM_CONFIG_DNODE; return TSDB_CODE_SUCCESS; } @@ -1189,7 +1183,7 @@ int32_t tscBuildKillMsg(SSqlObj *pSql, SSqlInfo *pInfo) { int tscEstimateCreateTableMsgLength(SSqlObj *pSql, SSqlInfo *pInfo) { SSqlCmd *pCmd = &(pSql->cmd); - int32_t size = minMsgSize() + sizeof(SMgmtHead) + sizeof(SCMCreateTableMsg); + int32_t size = minMsgSize() + sizeof(SCMCreateTableMsg); SCreateTableSQL *pCreateTableInfo = pInfo->pCreateTableInfo; if (pCreateTableInfo->type == TSQL_CREATE_TABLE_FROM_STABLE) { @@ -1277,7 +1271,7 @@ int tscBuildCreateTableMsg(SSqlObj *pSql, SSqlInfo *pInfo) { int tscEstimateAlterTableMsgLength(SSqlCmd *pCmd) { SQueryInfo *pQueryInfo = tscGetQueryInfoDetail(pCmd, 0); - return minMsgSize() + sizeof(SMgmtHead) + sizeof(SCMAlterTableMsg) + sizeof(SSchema) * tscNumOfFields(pQueryInfo) + + return minMsgSize() + sizeof(SCMAlterTableMsg) + sizeof(SSchema) * tscNumOfFields(pQueryInfo) + TSDB_EXTRA_PAYLOAD_SIZE; } @@ -1534,6 +1528,7 @@ int tscBuildTableMetaMsg(SSqlObj *pSql, SSqlInfo *pInfo) { * no used 4B **/ int tscBuildMultiMeterMetaMsg(SSqlObj *pSql, SSqlInfo *pInfo) { +#if 0 SSqlCmd *pCmd = &pSql->cmd; // copy payload content to temp buff @@ -1566,6 +1561,8 @@ int tscBuildMultiMeterMetaMsg(SSqlObj *pSql, SSqlInfo *pInfo) { pCmd->payloadLen); return pCmd->payloadLen; +#endif + return 0; } //static UNUSED_FUNC int32_t tscEstimateMetricMetaMsgSize(SSqlCmd *pCmd) { @@ -1765,7 +1762,7 @@ int tscEstimateHeartBeatMsgLength(SSqlObj *pSql) { int size = 0; STscObj *pObj = pSql->pTscObj; - size += tsRpcHeadSize + sizeof(SMgmtHead); + size += tsRpcHeadSize; size += sizeof(SQqueryList); SSqlObj *tpSql = pObj->sqlList; @@ -1801,13 +1798,9 @@ int tscBuildHeartBeatMsg(SSqlObj *pSql, SSqlInfo *pInfo) { return -1; } - pMsg = pCmd->payload + tsRpcHeadSize; + pMsg = pCmd->payload; pStart = pMsg; - SMgmtHead *pMgmt = (SMgmtHead *)pMsg; - strcpy(pMgmt->db, pObj->db); - pMsg += sizeof(SMgmtHead); - pMsg = tscBuildQueryStreamDesc(pMsg, pObj); pthread_mutex_unlock(&pObj->mutex); diff --git a/src/common/src/tglobal.c b/src/common/src/tglobal.c index 9828906532..991c1b403b 100644 --- a/src/common/src/tglobal.c +++ b/src/common/src/tglobal.c @@ -204,10 +204,19 @@ static pthread_once_t tsInitGlobalCfgOnce = PTHREAD_ONCE_INIT; void taosSetAllDebugFlag() { for (int32_t i = 0; i < tsGlobalConfigNum; ++i) { - SGlobalCfg *cfg = &tsGlobalConfig[i]; - if ((cfg->cfgType & TSDB_CFG_CTYPE_B_LOG) && cfg->cfgType == TAOS_CFG_VTYPE_INT32) { - *((int32_t*)cfg->ptr) = debugFlag; - } + mdebugFlag = debugFlag; + sdbDebugFlag = debugFlag; + dDebugFlag = debugFlag; + vDebugFlag = debugFlag; + cdebugFlag = debugFlag; + jnidebugFlag = debugFlag; + odbcdebugFlag = debugFlag; + httpDebugFlag = debugFlag; + monitorDebugFlag = debugFlag; + rpcDebugFlag = debugFlag; + uDebugFlag = debugFlag; + sDebugFlag = debugFlag; + //qdebugFlag = debugFlag; } uPrint("all debug flag are set to %d", debugFlag); } @@ -1189,6 +1198,10 @@ void taosInitGlobalCfg() { } bool taosCheckGlobalCfg() { + if (debugFlag == 135 || debugFlag == 199) { + taosSetAllDebugFlag(); + } + taosGetFqdn(tsLocalEp); sprintf(tsLocalEp + strlen(tsLocalEp), ":%d", tsServerPort); uPrint("localEp is %s", tsLocalEp); diff --git a/src/dnode/src/dnodeShell.c b/src/dnode/src/dnodeShell.c index 8ca3aa12e1..cf6b5e38ab 100644 --- a/src/dnode/src/dnodeShell.c +++ b/src/dnode/src/dnodeShell.c @@ -137,7 +137,6 @@ void dnodeProcessMsgFromShell(SRpcMsg *pMsg) { } } - static int dnodeRetrieveUserAuthInfo(char *user, char *spi, char *encrypt, char *secret, char *ckey) { return TSDB_CODE_SUCCESS; } diff --git a/src/inc/taosmsg.h b/src/inc/taosmsg.h index fec14bd938..c359ede22e 100644 --- a/src/inc/taosmsg.h +++ b/src/inc/taosmsg.h @@ -317,10 +317,6 @@ typedef struct { int8_t flag; } SCMCreateUserMsg, SCMAlterUserMsg; -typedef struct { - char db[TSDB_TABLE_ID_LEN + 1]; -} SMgmtHead; - typedef struct { int32_t contLen; int32_t vgId; diff --git a/src/mnode/src/mgmtDnode.c b/src/mnode/src/mgmtDnode.c index a170aa2d02..54a9e53cd9 100644 --- a/src/mnode/src/mgmtDnode.c +++ b/src/mnode/src/mgmtDnode.c @@ -252,7 +252,7 @@ void mgmtProcessCfgDnodeMsg(SQueuedMsg *pMsg) { } static void mgmtProcessCfgDnodeMsgRsp(SRpcMsg *rpcMsg) { - mPrint("cfg vnode rsp is received, result:%s", tstrerror(rpcMsg->code)); + mPrint("cfg dnode rsp is received"); } void mgmtProcessDnodeStatusMsg(SRpcMsg *rpcMsg) { diff --git a/src/mnode/src/mgmtMain.c b/src/mnode/src/mgmtMain.c index 434552980f..2a8e139eec 100644 --- a/src/mnode/src/mgmtMain.c +++ b/src/mnode/src/mgmtMain.c @@ -132,6 +132,7 @@ int32_t mgmtInitSystem() { void mgmtCleanUpSystem() { mPrint("starting to clean up mgmt"); + tsMgmtIsRunning = false; mgmtCleanUpShell(); mgmtCleanupServer(); grantCleanUp(); @@ -144,7 +145,6 @@ void mgmtCleanUpSystem() { mgmtCleanupDnodes(); mgmtCleanUpUsers(); mgmtCleanUpAccts(); - tsMgmtIsRunning = false; mPrint("mgmt is cleaned up"); } diff --git a/src/mnode/src/mgmtSdb.c b/src/mnode/src/mgmtSdb.c index d2a5287f13..4a18c5e285 100644 --- a/src/mnode/src/mgmtSdb.c +++ b/src/mnode/src/mgmtSdb.c @@ -323,11 +323,19 @@ void sdbCleanUp() { if (tsSdbObj.status != SDB_STATUS_SERVING) return; tsSdbObj.status = SDB_STATUS_CLOSING; - syncStop(tsSdbObj.sync); - walClose(tsSdbObj.wal); + + if (tsSdbObj.sync) { + syncStop(tsSdbObj.sync); + tsSdbObj.sync = NULL; + } + + if (tsSdbObj.wal) { + walClose(tsSdbObj.wal); + tsSdbObj.wal = NULL; + } + sem_destroy(&tsSdbObj.sem); pthread_mutex_destroy(&tsSdbObj.mutex); - memset(&tsSdbObj, 0, sizeof(tsSdbObj)); } void sdbIncRef(void *handle, void *pRow) { diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt index 44fc24e107..1858211c50 100644 --- a/tests/script/jenkins/basic.txt +++ b/tests/script/jenkins/basic.txt @@ -27,21 +27,21 @@ cd ../../../debug; make ./test.sh -f general/compress/compress2.sim ./test.sh -f general/compress/uncompress.sim -#./test.sh -f general/compute/avg.sim +./test.sh -f general/compute/avg.sim ./test.sh -f general/compute/bottom.sim -#./test.sh -f general/compute/count.sim +./test.sh -f general/compute/count.sim ./test.sh -f general/compute/diff.sim #./test.sh -f general/compute/diff2.sim -#./test.sh -f general/compute/first.sim +./test.sh -f general/compute/first.sim #./test.sh -f general/compute/interval.sim #./test.sh -f general/compute/last.sim #./test.sh -f general/compute/leastsquare.sim -#./test.sh -f general/compute/max.sim -#./test.sh -f general/compute/min.sim +./test.sh -f general/compute/max.sim +./test.sh -f general/compute/min.sim ./test.sh -f general/compute/null.sim ./test.sh -f general/compute/percentile.sim ./test.sh -f general/compute/stddev.sim -#./test.sh -f general/compute/sum.sim +./test.sh -f general/compute/sum.sim ./test.sh -f general/compute/top.sim ./test.sh -f general/db/basic.sim @@ -109,7 +109,7 @@ cd ../../../debug; make # ./test.sh -f general/parser/auto_create_tb.sim # ./test.sh -f general/parser/auto_create_tb_drop_tb.sim ./test.sh -f general/parser/binary_escapeCharacter.sim -./test.sh -f general/parser/bug.sim +#./test.sh -f general/parser/bug.sim ./test.sh -f general/parser/col_arithmetic_operation.sim ./test.sh -f general/parser/columnValue_bigint.sim ./test.sh -f general/parser/columnValue_bool.sim diff --git a/tests/script/sh/deploy.sh b/tests/script/sh/deploy.sh index bfbba3a012..5587e3bb8c 100755 --- a/tests/script/sh/deploy.sh +++ b/tests/script/sh/deploy.sh @@ -108,6 +108,7 @@ echo "udebugFlag 131" >> $TAOS_CFG echo "jnidebugFlag 131" >> $TAOS_CFG echo "sdebugFlag 135" >> $TAOS_CFG echo "monitor 0" >> $TAOS_CFG +echo "monitorInterval 1" >> $TAOS_CFG echo "http 0" >> $TAOS_CFG echo "numOfThreadsPerCore 2.0" >> $TAOS_CFG echo "defaultPass taosdata" >> $TAOS_CFG From 08a816fc2d77ddb4dbc34520296b0119b8d45cee Mon Sep 17 00:00:00 2001 From: chang Date: Sat, 9 May 2020 18:10:11 +0800 Subject: [PATCH 15/23] feat: add user test case --- tests/pytest/account/__init__.py | 0 tests/pytest/account/account_create.py | 41 +++++++++++++++++ tests/pytest/account/account_del.py | 52 +++++++++++++++++++++ tests/pytest/fulltest.sh | 4 ++ tests/pytest/user/__init__.py | 0 tests/pytest/user/pass_len.py | 63 ++++++++++++++++++++++++++ tests/pytest/user/user_create.py | 54 ++++++++++++++++++++++ 7 files changed, 214 insertions(+) create mode 100644 tests/pytest/account/__init__.py create mode 100644 tests/pytest/account/account_create.py create mode 100644 tests/pytest/account/account_del.py create mode 100644 tests/pytest/user/__init__.py create mode 100644 tests/pytest/user/pass_len.py create mode 100644 tests/pytest/user/user_create.py diff --git a/tests/pytest/account/__init__.py b/tests/pytest/account/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/pytest/account/account_create.py b/tests/pytest/account/account_create.py new file mode 100644 index 0000000000..24bcc8df2f --- /dev/null +++ b/tests/pytest/account/account_create.py @@ -0,0 +1,41 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +import sys +import taos +from util.log import tdLog +from util.cases import tdCases +from util.sql import tdSql + + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + try: + tdSql.execute("create account a&cc PASS 'pass123'") + except Exception as e: + print("create account a&cc PASS 'pass123'") + return + + tdLog.exit("drop built-in user is error.") + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/account/account_del.py b/tests/pytest/account/account_del.py new file mode 100644 index 0000000000..43690c6e37 --- /dev/null +++ b/tests/pytest/account/account_del.py @@ -0,0 +1,52 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +import sys +import taos +from util.log import tdLog +from util.cases import tdCases +from util.sql import tdSql + + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + print("==========step1") + print("drop built-in account") + try: + tdSql.execute("drop account root") + except Exception as e: + if len(e.args) > 0 and 'no rights' != e.args[0]: + tdLog.exit(e) + + print("==========step2") + print("drop built-in user") + try: + tdSql.execute("drop user root") + except Exception as e: + if len(e.args) > 0 and 'no rights' != e.args[0]: + tdLog.exit(e) + return + + tdLog.exit("drop built-in user is error.") + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/fulltest.sh b/tests/pytest/fulltest.sh index 249245c762..6aec67f9ce 100755 --- a/tests/pytest/fulltest.sh +++ b/tests/pytest/fulltest.sh @@ -81,3 +81,7 @@ python3 ./test.py $1 -f import_merge/importToCommit.py python3 ./test.py $1 -f import_merge/importTORestart.py python3 ./test.py $1 -f import_merge/importTPORestart.py python3 ./test.py $1 -f import_merge/importTRestart.py + +# user +python3 ./test.py $1 -f user/user_create.py +python3 ./test.py $1 -f user/pass_len.py \ No newline at end of file diff --git a/tests/pytest/user/__init__.py b/tests/pytest/user/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/pytest/user/pass_len.py b/tests/pytest/user/pass_len.py new file mode 100644 index 0000000000..40bd1ca5fc --- /dev/null +++ b/tests/pytest/user/pass_len.py @@ -0,0 +1,63 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +import sys +import taos +from util.log import tdLog +from util.cases import tdCases +from util.sql import tdSql + + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + print("==============step1") + try: + tdSql.execute("create user abc pass '123456'") + except Exception as e: + tdLog.exit(e) + print("create user abc pass '123456'") + + print("==============step2") + try: + tdSql.execute("alter user abc pass 'taosdata'") + except Exception as e: + tdLog.exit(e) + print("alter user abc pass 'taosdata'") + + print("==============step3") + try: + tdSql.execute("alter user abc pass ''") + except Exception as e: + print("alter user abc pass ''") + else: + tdLog.exit("Error: alert user abc pass''") + + print("==============step4") + try: + tdSql.execute("alter user abc pass null") + except Exception as e: + print("alter user abc pass null") + else: + tdLog.exit("Error: alter user abc pass null") + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/user/user_create.py b/tests/pytest/user/user_create.py new file mode 100644 index 0000000000..f8ac5c6799 --- /dev/null +++ b/tests/pytest/user/user_create.py @@ -0,0 +1,54 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +import sys +import taos +from util.log import tdLog +from util.cases import tdCases +from util.sql import tdSql + + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + print("==============step1") + try: + tdSql.execute("create user &abc PASS 'pass123'") + except Exception as e: + print(e) + + print("==============step2") + try: + tdSql.execute("create user a&bc PASS 'pass123'") + except Exception as e: + print(e) + + print("==============step3") + try: + tdSql.execute("create user '涛思' PASS 'pass123'") + except Exception as e: + print(e) + return + + tdLog.exit("create user with special character.") + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) From 924c46bb87ea9449ec7edb3251dac77871f35721 Mon Sep 17 00:00:00 2001 From: slguan Date: Sat, 9 May 2020 18:33:41 +0800 Subject: [PATCH 16/23] scripts --- src/vnode/src/vnodeWrite.c | 16 ++-- tests/script/basicSuite.sim | 58 ++++---------- tests/script/general/http/grafana_bug.sim | 38 ++++----- tests/script/general/http/telegraf.sim | 14 ++-- tests/script/general/insert/insert_drop.sim | 11 ++- tests/script/jenkins/basic.txt | 86 ++++++++++----------- 6 files changed, 102 insertions(+), 121 deletions(-) diff --git a/src/vnode/src/vnodeWrite.c b/src/vnode/src/vnodeWrite.c index 6f0bc5fcce..f560c648e1 100644 --- a/src/vnode/src/vnodeWrite.c +++ b/src/vnode/src/vnodeWrite.c @@ -184,7 +184,7 @@ static int32_t vnodeProcessAlterTableMsg(SVnodeObj *pVnode, void *pCont, SRspRet int16_t numOfColumns = htons(pTable->numOfColumns); int16_t numOfTags = htons(pTable->numOfTags); int32_t sid = htonl(pTable->sid); - uint64_t uid = htobe64(pTable->uid); + uint64_t uid = htobe64(pTable->uid); SSchema *pSchema = (SSchema *) pTable->data; int32_t totalCols = numOfColumns + numOfTags; @@ -231,13 +231,15 @@ static int32_t vnodeProcessDropStableMsg(SVnodeObj *pVnode, void *pCont, SRspRet int32_t code = 0; vTrace("vgId:%d, stable:%s, start to drop", pVnode->vgId, pTable->tableId); - // TODO: drop stable in vvnode - //int64_t uid = htobe64(pTable->uid); - //void *pTsdb = dnodeGetVnodeTsdb(pMsg->pVnode); - //rpcRsp.code = tsdbDropTable(pTsdb, pTable->uid); + + STableId stableId = { + .uid = htobe64(pTable->uid), + .tid = -1 + }; - code = TSDB_CODE_SUCCESS; - vTrace("vgId:%d, stable:%s, drop stable result:%x", pVnode, pTable->tableId, code); + code = tsdbDropTable(pVnode->tsdb, stableId); + + vTrace("vgId:%d, stable:%s, drop stable result:%s", pVnode, pTable->tableId, tstrerror(code)); return code; } diff --git a/tests/script/basicSuite.sim b/tests/script/basicSuite.sim index 93cd0de4d2..676ac93bf2 100644 --- a/tests/script/basicSuite.sim +++ b/tests/script/basicSuite.sim @@ -1,49 +1,25 @@ ################################# -run general/db/basic1.sim -run general/db/basic2.sim -run general/db/basic3.sim +run general/cache/new_metrics.sim +run general/compress/compress.sim +run general/compute/avg.sim +run general/compute/bottom.sim +run general/compute/count.sim +run general/db/len.sim run general/db/basic4.sim -run general/db/basic5.sim - -run general/table/basic1.sim -run general/table/basic2.sim +run general/http/restful_insert.sim +run general/import/basic.sim +run general/import/commit.sim +run general/insert/basic.sim +run general/insert/query_file_memory.sim +run general/parser/binary_escapeCharacter.sim +run general/parser/columnValue_bigint.sim +run general/parser/select_from_cache_disk.sim +run general/table/autocreate.sim run general/table/basic3.sim -run general/table/column_num.sim run general/table/column_name.sim -run general/table/bigint.sim -run general/table/bool.sim -run general/table/double.sim -run general/table/float.sim run general/table/int.sim -run general/table/smallint.sim -run general/table/tinyint.sim -run general/table/db.table.sim - +run general/table/vgroup.sim run general/user/basic1.sim -run general/user/pass_alter.sim -run general/user/pass_len.sim -run general/user/user_create.sim run general/user/user_len.sim - -# run general/compute/count.sim -# run general/compute/avg.sim -# run general/compute/sum.sim -# run general/compute/min.sim -# run general/compute/max.sim -# run general/compute/first.sim -# run general/compute/last.sim -run general/compute/stddev.sim -# run general/compute/leastsquare.sim -run general/compute/top.sim -run general/compute/bottom.sim -run general/compute/percentile.sim -run general/compute/diff.sim -# run general/compute/interval.sim -run general/compute/null.sim -# run general/compute/diff2.sim - -run general/parse/testSuite.sim -run general/field/testSuite.sim - - +run general/vector/single.sim ################################## diff --git a/tests/script/general/http/grafana_bug.sim b/tests/script/general/http/grafana_bug.sim index 6f12849b2b..708af23cfc 100644 --- a/tests/script/general/http/grafana_bug.sim +++ b/tests/script/general/http/grafana_bug.sim @@ -35,7 +35,7 @@ print =============== step1 - one query, 1 column, with timestamp system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"A","alias":"","sql":"select ts from db.tb where ts >= 1577980800000 "} ]' 127.0.0.1:6020/grafana/query print step1-> $system_content -if $system_content != @[{"refId":"A","target":"A","datapoints":[["-",1577980800000],["-",1578067200000]]}]@ then +if $system_content != @[{"refId":"A","target":"A","datapoints":[[null,1577980800000],[null,1578067200000]]}]@ then return -1 endi @@ -51,32 +51,32 @@ print =============== step3 - one query, 3 column, with timestamp system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"A","alias":"","sql":"select ts,val,val1 from db.tb where ts >= 1577980800000 "} ]' 127.0.0.1:6020/grafana/query print step3.1-> $system_content -if $system_content != @[{"refId":"A","target":"13","datapoints":[[2,1577980800000]]},{"refId":"A","target":"14","datapoints":[[2,1578067200000]]}]@ then +if $system_content != @[{"refId":"A","target":"{val1:13,}","datapoints":[[2,1577980800000]]},{"refId":"A","target":"{val1:14,}","datapoints":[[2,1578067200000]]}]@ then return -1 endi system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"A","alias":"","sql":"select ts,val,val1 from db.tb "} ]' 127.0.0.1:6020/grafana/query print step3.2-> $system_content -if $system_content != @[{"refId":"A","target":"11","datapoints":[[1,1577808000000]]},{"refId":"A","target":"12","datapoints":[[1,1577894400000]]},{"refId":"A","target":"13","datapoints":[[2,1577980800000]]},{"refId":"A","target":"14","datapoints":[[2,1578067200000]]}]@ then +if $system_content != @[{"refId":"A","target":"{val1:11,}","datapoints":[[1,1577808000000]]},{"refId":"A","target":"{val1:12,}","datapoints":[[1,1577894400000]]},{"refId":"A","target":"{val1:13,}","datapoints":[[2,1577980800000]]},{"refId":"A","target":"{val1:14,}","datapoints":[[2,1578067200000]]}]@ then return -1 endi system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"A","alias":"","sql":"select ts,val1,val from db.tb "} ]' 127.0.0.1:6020/grafana/query print step3.3-> $system_content -if $system_content != @[{"refId":"A","target":"1","datapoints":[[11,1577808000000],[12,1577894400000]]},{"refId":"A","target":"2","datapoints":[[13,1577980800000],[14,1578067200000]]}]@ then +if $system_content != @[{"refId":"A","target":"{val:1,}","datapoints":[[11,1577808000000],[12,1577894400000]]},{"refId":"A","target":"{val:2,}","datapoints":[[13,1577980800000],[14,1578067200000]]}]@ then return -1 endi print =============== step4 - one query, 4 column, with timestamp system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"A","alias":"","sql":"select ts,val2,val1,val from db.tb "} ]' 127.0.0.1:6020/grafana/query print step4.1-> $system_content -if $system_content != @[{"refId":"A","target":"1","datapoints":[[21,1577808000000],[22,1577894400000]]},{"refId":"A","target":"2","datapoints":[[23,1577980800000],[24,1578067200000]]}]@ then +if $system_content != @[{"refId":"A","target":"{val1:11,, val:1,}","datapoints":[[21,1577808000000]]},{"refId":"A","target":"{val1:12,, val:1,}","datapoints":[[22,1577894400000]]},{"refId":"A","target":"{val1:13,, val:2,}","datapoints":[[23,1577980800000]]},{"refId":"A","target":"{val1:14,, val:2,}","datapoints":[[24,1578067200000]]}]@ then return -1 endi system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"A","alias":"","sql":"select ts,val,val1,val2 from db.tb "} ]' 127.0.0.1:6020/grafana/query print step4.2-> $system_content -if $system_content != @[{"refId":"A","target":"21","datapoints":[[1,1577808000000]]},{"refId":"A","target":"22","datapoints":[[1,1577894400000]]},{"refId":"A","target":"23","datapoints":[[2,1577980800000]]},{"refId":"A","target":"24","datapoints":[[2,1578067200000]]}]@ then +if $system_content != @[{"refId":"A","target":"{val1:11,, val2:21,}","datapoints":[[1,1577808000000]]},{"refId":"A","target":"{val1:12,, val2:22,}","datapoints":[[1,1577894400000]]},{"refId":"A","target":"{val1:13,, val2:23,}","datapoints":[[2,1577980800000]]},{"refId":"A","target":"{val1:14,, val2:24,}","datapoints":[[2,1578067200000]]}]@ then return -1 endi @@ -90,20 +90,20 @@ endi print =============== step6 - one query, 2 column, no timestamp system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"A","alias":"","sql":"select val1,val2 from db.tb where ts >= 1577980800000 "} ]' 127.0.0.1:6020/grafana/query print step1-> $system_content -if $system_content != @[{"refId":"A","target":"23","datapoints":[[13,"-"]]},{"refId":"A","target":"24","datapoints":[[14,"-"]]}]@ then +if $system_content != @[{"refId":"A","target":"{val2:23,}","datapoints":[[13,"-"]]},{"refId":"A","target":"{val2:24,}","datapoints":[[14,"-"]]}]@ then return -1 endi print =============== step7 - one query, 3 column, no timestamp system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"A","alias":"","sql":"select val1,val2,val from db.tb where ts >= 1577980800000 "} ]' 127.0.0.1:6020/grafana/query print step1-> $system_content -if $system_content != @[{"refId":"A","target":"2","datapoints":[[13,"-"],[14,"-"]]}]@ then +if $system_content != @[{"refId":"A","target":"{val2:23,, val:2,}","datapoints":[[13,"-"]]},{"refId":"A","target":"{val2:24,, val:2,}","datapoints":[[14,"-"]]}]@ then return -1 endi system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"A","alias":"","sql":"select val1,val2,val from db.tb"} ]' 127.0.0.1:6020/grafana/query print step1-> $system_content -if $system_content != @[{"refId":"A","target":"1","datapoints":[[11,"-"],[12,"-"]]},{"refId":"A","target":"2","datapoints":[[13,"-"],[14,"-"]]}]@ then +if $system_content != @[{"refId":"A","target":"{val2:21,, val:1,}","datapoints":[[11,"-"]]},{"refId":"A","target":"{val2:22,, val:1,}","datapoints":[[12,"-"]]},{"refId":"A","target":"{val2:23,, val:2,}","datapoints":[[13,"-"]]},{"refId":"A","target":"{val2:24,, val:2,}","datapoints":[[14,"-"]]}]@ then return -1 endi @@ -132,7 +132,7 @@ print =============== step11 - two query, 1 column, with timestamp, 1 column, w system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"B","alias":"BB","sql":"select ts from db.tb2 where ts >= 1577980800000 "},{"refId":"A","alias":"","sql":"select ts from db.tb where ts >= 1577980800000 "} ]' 127.0.0.1:6020/grafana/query print step1-> $system_content -if $system_content != @[{"refId":"B","target":"BB","datapoints":[["-",1577980800000],["-",1578067200000]]},{"refId":"A","target":"A","datapoints":[["-",1577980800000],["-",1578067200000]]}]@ then +if $system_content != @[{"refId":"B","target":"BB","datapoints":[[null,1577980800000],[null,1578067200000]]},{"refId":"A","target":"A","datapoints":[[null,1577980800000],[null,1578067200000]]}]@ then return -1 endi @@ -140,14 +140,14 @@ print =============== step12 - two query, 1 column, with timestamp, 2 column, w system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"B","alias":"BB","sql":"select ts from db.tb2 where ts >= 1577980800000 "},{"refId":"A","alias":"","sql":"select ts,val from db.tb where ts >= 1577980800000 "} ]' 127.0.0.1:6020/grafana/query print step1-> $system_content -if $system_content != @[{"refId":"B","target":"BB","datapoints":[["-",1577980800000],["-",1578067200000]]},{"refId":"A","target":"A","datapoints":[[2,1577980800000],[2,1578067200000]]}]@ then +if $system_content != @[{"refId":"B","target":"BB","datapoints":[[null,1577980800000],[null,1578067200000]]},{"refId":"A","target":"A","datapoints":[[2,1577980800000],[2,1578067200000]]}]@ then return -1 endi print =============== step13 - two query, 1 column, with timestamp, 3 column, with timestamp system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"B","alias":"BB","sql":"select ts from db.tb2 where ts >= 1577980800000 "},{"refId":"A","alias":"","sql":"select ts,val,val1 from db.tb where ts >= 1577980800000 "} ]' 127.0.0.1:6020/grafana/query print step1-> $system_content -if $system_content != @[{"refId":"B","target":"BB","datapoints":[["-",1577980800000],["-",1578067200000]]},{"refId":"A","target":"13","datapoints":[[2,1577980800000]]},{"refId":"A","target":"14","datapoints":[[2,1578067200000]]}]@ then +if $system_content != @[{"refId":"B","target":"BB","datapoints":[[null,1577980800000],[null,1578067200000]]},{"refId":"A","target":"{val1:13,}","datapoints":[[2,1577980800000]]},{"refId":"A","target":"{val1:14,}","datapoints":[[2,1578067200000]]}]@ then return -1 endi @@ -161,14 +161,14 @@ endi print =============== step15 - two query, 2 column, with timestamp, 3 column, with timestamp system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"B","alias":"BB","sql":"select ts, val2, val1 from db.tb2 where ts >= 1577980800000 "},{"refId":"A","alias":"AA","sql":"select ts,val from db.tb where ts >= 1577980800000 "} ]' 127.0.0.1:6020/grafana/query print step1-> $system_content -if $system_content != @[{"refId":"B","target":"BB213","datapoints":[[223,1577980800000]]},{"refId":"B","target":"BB214","datapoints":[[224,1578067200000]]},{"refId":"A","target":"AA","datapoints":[[2,1577980800000],[2,1578067200000]]}]@ then +if $system_content != @[{"refId":"B","target":"BB{val1:213,}","datapoints":[[223,1577980800000]]},{"refId":"B","target":"BB{val1:214,}","datapoints":[[224,1578067200000]]},{"refId":"A","target":"AA","datapoints":[[2,1577980800000],[2,1578067200000]]}]@ then return -1 endi print =============== step16 - two query, 3 column, with timestamp, 4 column, with timestamp system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"B","alias":"BB","sql":"select ts, val, val1, val2, val1 from db.tb2 where ts >= 1577980800000 "},{"refId":"A","alias":"AA","sql":"select ts,val,val1 from db.tb where ts >= 1577980800000 "} ]' 127.0.0.1:6020/grafana/query print step1-> $system_content -if $system_content != @[{"refId":"B","target":"BB213","datapoints":[[22,1577980800000]]},{"refId":"B","target":"BB214","datapoints":[[22,1578067200000]]},{"refId":"A","target":"AA13","datapoints":[[2,1577980800000]]},{"refId":"A","target":"AA14","datapoints":[[2,1578067200000]]}]@ then +if $system_content != @[{"refId":"B","target":"BB{val1:213,, val2:223,, val1:213,}","datapoints":[[22,1577980800000]]},{"refId":"B","target":"BB{val1:214,, val2:224,, val1:214,}","datapoints":[[22,1578067200000]]},{"refId":"A","target":"AA{val1:13,}","datapoints":[[2,1577980800000]]},{"refId":"A","target":"AA{val1:14,}","datapoints":[[2,1578067200000]]}]@ then return -1 endi @@ -196,7 +196,7 @@ endi print =============== step20 - two query, 1 column, no timestamp, 1 column, with timestamp system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"B","alias":"BB","sql":"select val from db.tb2 where ts >= 1577980800000 "},{"refId":"A","alias":"AA","sql":"select ts from db.tb2 where ts >= 1577980800000 "} ]' 127.0.0.1:6020/grafana/query print step1-> $system_content -if $system_content != @[{"refId":"B","target":"BB","datapoints":[[22,"-"],[22,"-"]]},{"refId":"A","target":"AA","datapoints":[["-",1577980800000],["-",1578067200000]]}]@ then +if $system_content != @[{"refId":"B","target":"BB","datapoints":[[22,"-"],[22,"-"]]},{"refId":"A","target":"AA","datapoints":[[null,1577980800000],[null,1578067200000]]}]@ then return -1 endi @@ -210,28 +210,28 @@ endi print =============== step22 - two query, 1 column, no timestamp, 3 column, with timestamp system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"B","alias":"BB","sql":"select val from db.tb2 where ts >= 1577980800000 "},{"refId":"A","alias":"AA","sql":"select ts,val1, val2 from db.tb2 where ts >= 1577980800000 "} ]' 127.0.0.1:6020/grafana/query print step1-> $system_content -if $system_content != @[{"refId":"B","target":"BB","datapoints":[[22,"-"],[22,"-"]]},{"refId":"A","target":"AA223","datapoints":[[213,1577980800000]]},{"refId":"A","target":"AA224","datapoints":[[214,1578067200000]]}]@ then +if $system_content != @[{"refId":"B","target":"BB","datapoints":[[22,"-"],[22,"-"]]},{"refId":"A","target":"AA{val2:223,}","datapoints":[[213,1577980800000]]},{"refId":"A","target":"AA{val2:224,}","datapoints":[[214,1578067200000]]}]@ then return -1 endi print =============== step23 - two query, 2 column, no timestamp, 1 column, no timestamp system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"B","alias":"BB","sql":"select val1,val2 from db.tb2 where ts >= 1577980800000 "},{"refId":"A","alias":"AA","sql":"select val1 from db.tb2 where ts >= 1577980800000 "} ]' 127.0.0.1:6020/grafana/query print step1-> $system_content -if $system_content != @[{"refId":"B","target":"BB223","datapoints":[[213,"-"]]},{"refId":"B","target":"BB224","datapoints":[[214,"-"]]},{"refId":"A","target":"AA","datapoints":[[213,"-"],[214,"-"]]}]@ then +if $system_content != @[{"refId":"B","target":"BB{val2:223,}","datapoints":[[213,"-"]]},{"refId":"B","target":"BB{val2:224,}","datapoints":[[214,"-"]]},{"refId":"A","target":"AA","datapoints":[[213,"-"],[214,"-"]]}]@ then return -1 endi print =============== step24 - two query, 2 column, no timestamp, 2 column, no timestamp system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"B","alias":"BB","sql":"select val1,val2 from db.tb2 where ts >= 1577980800000 "},{"refId":"A","alias":"AA","sql":"select val,val1 from db.tb2 where ts >= 1577980800000 "} ]' 127.0.0.1:6020/grafana/query print step1-> $system_content -if $system_content != @[{"refId":"B","target":"BB223","datapoints":[[213,"-"]]},{"refId":"B","target":"BB224","datapoints":[[214,"-"]]},{"refId":"A","target":"AA213","datapoints":[[22,"-"]]},{"refId":"A","target":"AA214","datapoints":[[22,"-"]]}]@ then +if $system_content != @[{"refId":"B","target":"BB{val2:223,}","datapoints":[[213,"-"]]},{"refId":"B","target":"BB{val2:224,}","datapoints":[[214,"-"]]},{"refId":"A","target":"AA{val1:213,}","datapoints":[[22,"-"]]},{"refId":"A","target":"AA{val1:214,}","datapoints":[[22,"-"]]}]@ then return -1 endi print =============== step25 - two query, 2 column, no timestamp, 3 column, no timestamp system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"B","alias":"BB","sql":"select val1,val2 from db.tb2 where ts >= 1577980800000 "},{"refId":"A","alias":"AA","sql":"select val,val1,val2 from db.tb2 where ts >= 1577980800000 "} ]' 127.0.0.1:6020/grafana/query print step1-> $system_content -if $system_content != @[{"refId":"B","target":"BB223","datapoints":[[213,"-"]]},{"refId":"B","target":"BB224","datapoints":[[214,"-"]]},{"refId":"A","target":"AA223","datapoints":[[22,"-"]]},{"refId":"A","target":"AA224","datapoints":[[22,"-"]]}]@ then +if $system_content != @[{"refId":"B","target":"BB{val2:223,}","datapoints":[[213,"-"]]},{"refId":"B","target":"BB{val2:224,}","datapoints":[[214,"-"]]},{"refId":"A","target":"AA{val1:213,, val2:223,}","datapoints":[[22,"-"]]},{"refId":"A","target":"AA{val1:214,, val2:224,}","datapoints":[[22,"-"]]}]@ then return -1 endi diff --git a/tests/script/general/http/telegraf.sim b/tests/script/general/http/telegraf.sim index 60eeec652e..d9f3340f06 100644 --- a/tests/script/general/http/telegraf.sim +++ b/tests/script/general/http/telegraf.sim @@ -16,14 +16,14 @@ print =============== step1 - parse system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{"host":"windows","instance":"1","objectname":"Processor"},"timestamp":1535784122}' 127.0.0.1:6020/telegraf/ print $system_content -if $system_content != @{"status":"error","code":1022,"desc":"database name can not be NULL"}@ then +if $system_content != @{"status":"error","code":1022,"desc":"database name can not be null"}@ then return -1 endi system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'select * from d1.table_admin' -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{"host":"windows","instance":"1","objectname":"Processor"},"timestamp":1535784122}' 127.0.0.1:6020/telegraf/ print $system_content -if $system_content != @{"status":"error","code":1022,"desc":"database name can not be NULL"}@ then +if $system_content != @{"status":"error","code":1022,"desc":"database name can not be null"}@ then return -1 endi @@ -170,7 +170,7 @@ endi system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{"":"windows"},"timestamp":1535784122}' 127.0.0.1:6020/telegraf/db/root/taosdata1 print $system_content -if $system_content != @{"status":"error","code":1038,"desc":"tag name is NULL"}@ then +if $system_content != @{"status":"error","code":1038,"desc":"tag name is null"}@ then return -1 endi @@ -191,14 +191,14 @@ endi system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{"host":""},"timestamp":1535784122}' 127.0.0.1:6020/telegraf/db/root/taosdata1 print $system_content -if $system_content != @{"status":"error","code":1041,"desc":"tag value is NULL"}@ then +if $system_content != @{"status":"error","code":1041,"desc":"tag value is null"}@ then return -1 endi system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{"1022":"111"},"timestamp":1535784122}' 127.0.0.1:6020/telegraf/db/root/taosdata1 print $system_content -if $system_content != @{"status":"error","code":1042,"desc":"table is NULL"}@ then +if $system_content != @{"status":"error","code":1042,"desc":"table is null"}@ then return -1 endi @@ -219,14 +219,14 @@ endi system_content curl -u root:taosdata -d '{"fields":{"":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{"host":"windows","instance":"1","objectname":"Processor"},"timestamp":1535784122}' 127.0.0.1:6020/telegraf/db/root/taosdata1 print $system_content -if $system_content != @{"status":"error","code":1048,"desc":"field name is NULL"}@ then +if $system_content != @{"status":"error","code":1048,"desc":"field name is null"}@ then return -1 endi system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":"","Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{"host":"windows","instance":"1","objectname":"Processor"},"timestamp":1535784122}' 127.0.0.1:6020/telegraf/db/root/taosdata1 print $system_content -if $system_content != @{"status":"error","code":1051,"desc":"field value is NULL"}@ then +if $system_content != @{"status":"error","code":1051,"desc":"field value is null"}@ then return -1 endi diff --git a/tests/script/general/insert/insert_drop.sim b/tests/script/general/insert/insert_drop.sim index 087b9f6aa9..5655576e20 100644 --- a/tests/script/general/insert/insert_drop.sim +++ b/tests/script/general/insert/insert_drop.sim @@ -46,8 +46,9 @@ system sh/exec.sh -n dnode1 -s stop -x SIGINT sleep 2000 system sh/exec.sh -n dnode1 -s start print ================== server restart completed -sql connect -sleep 3000 + +sql reset query cache +sleep 1000 sql use $db sql drop table tb5 @@ -71,13 +72,15 @@ system sh/exec.sh -n dnode1 -s stop -x SIGINT sleep 2000 system sh/exec.sh -n dnode1 -s start print ================== server restart completed -sql connect -sleep 3000 + +sql reset query cache +sleep 1000 sql use $db sql create table tb5 using $stb tags(5) sql select * from tb5 +print $rows should be 0 if $rows != 0 then return -1 endi diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt index 1858211c50..6e9572e83c 100644 --- a/tests/script/jenkins/basic.txt +++ b/tests/script/jenkins/basic.txt @@ -65,20 +65,20 @@ cd ../../../debug; make #./test.sh -f general/field/4.sim #./test.sh -f general/field/5.sim #./test.sh -f general/field/6.sim -./test.sh -f general/field/bigint.sim +##./test.sh -f general/field/bigint.sim #./test.sh -f general/field/binary.sim -./test.sh -f general/field/bool.sim +##./test.sh -f general/field/bool.sim #./test.sh -f general/field/single.sim -./test.sh -f general/field/smallint.sim -./test.sh -f general/field/tinyint.sim +##./test.sh -f general/field/smallint.sim +##./test.sh -f general/field/tinyint.sim -./test.sh -f general/http/restful.sim +##./test.sh -f general/http/restful.sim ./test.sh -f general/http/restful_insert.sim ./test.sh -f general/http/restful_limit.sim -./test.sh -f general/http/restful_full.sim +##./test.sh -f general/http/restful_full.sim ./test.sh -f general/http/prepare.sim ./test.sh -f general/http/telegraf.sim -#./test.sh -f general/http/grafana_bug.sim +./test.sh -f general/http/grafana_bug.sim #./test.sh -f general/http/grafana.sim ./test.sh -f general/import/basic.sim @@ -220,9 +220,9 @@ cd ../../../debug; make ./test.sh -f general/user/basic1.sim #./test.sh -f general/user/monitor.sim -./test.sh -f general/user/pass_alter.sim +##./test.sh -f general/user/pass_alter.sim ./test.sh -f general/user/pass_len.sim -./test.sh -f general/user/user_create.sim +##./test.sh -f general/user/user_create.sim ./test.sh -f general/user/user_len.sim #./test.sh -f general/vector/metrics_field.sim @@ -240,24 +240,24 @@ cd ../../../debug; make ################################# ./test.sh -u -f unique/account/account_create.sim -./test.sh -u -f unique/account/account_delete.sim +##./test.sh -u -f unique/account/account_delete.sim ./test.sh -u -f unique/account/account_len.sim -./test.sh -u -f unique/account/authority.sim +##./test.sh -u -f unique/account/authority.sim ./test.sh -u -f unique/account/basic.sim ./test.sh -u -f unique/account/paras.sim -./test.sh -u -f unique/account/pass_alter.sim +##./test.sh -u -f unique/account/pass_alter.sim ./test.sh -u -f unique/account/pass_len.sim ./test.sh -u -f unique/account/usage.sim -./test.sh -u -f unique/account/user_create.sim +##./test.sh -u -f unique/account/user_create.sim ./test.sh -u -f unique/account/user_len.sim #./test.sh -u -f unique/big/balance.sim #./test.sh -u -f unique/big/maxvnodes.sim #./test.sh -u -f unique/big/tcp.sim -./test.sh -u -f unique/cluster/balance1.sim -./test.sh -u -f unique/cluster/balance2.sim -./test.sh -u -f unique/cluster/balance3.sim +##./test.sh -u -f unique/cluster/balance1.sim +##./test.sh -u -f unique/cluster/balance2.sim +##./test.sh -u -f unique/cluster/balance3.sim #./test.sh -u -f unique/cluster/cache.sim ./test.sh -u -f unique/column/replica3.sim @@ -265,26 +265,26 @@ cd ../../../debug; make #./test.sh -u -f unique/db/commit.sim #./test.sh -u -f unique/db/delete.sim #./test.sh -u -f unique/db/delete_part.sim -./test.sh -u -f unique/db/replica_add12.sim -./test.sh -u -f unique/db/replica_add13.sim -./test.sh -u -f unique/db/replica_add23.sim -./test.sh -u -f unique/db/replica_reduce21.sim -./test.sh -u -f unique/db/replica_reduce32.sim -./test.sh -u -f unique/db/replica_reduce31.sim -./test.sh -u -f unique/db/replica_part.sim +##./test.sh -u -f unique/db/replica_add12.sim +##./test.sh -u -f unique/db/replica_add13.sim +##./test.sh -u -f unique/db/replica_add23.sim +##./test.sh -u -f unique/db/replica_reduce21.sim +##./test.sh -u -f unique/db/replica_reduce32.sim +##./test.sh -u -f unique/db/replica_reduce31.sim +##./test.sh -u -f unique/db/replica_part.sim -./test.sh -u -f unique/dnode/balance1.sim -./test.sh -u -f unique/dnode/balance2.sim -./test.sh -u -f unique/dnode/balance3.sim -./test.sh -u -f unique/dnode/balancex.sim -./test.sh -u -f unique/dnode/offline1.sim -./test.sh -u -f unique/dnode/offline2.sim +##./test.sh -u -f unique/dnode/balance1.sim +##./test.sh -u -f unique/dnode/balance2.sim +##./test.sh -u -f unique/dnode/balance3.sim +##./test.sh -u -f unique/dnode/balancex.sim +##./test.sh -u -f unique/dnode/offline1.sim +##./test.sh -u -f unique/dnode/offline2.sim #./test.sh -u -f unique/dnode/remove1.sim #./test.sh -u -f unique/dnode/remove2.sim #./test.sh -u -f unique/dnode/vnode_clean.sim -./test.sh -u -f unique/http/admin.sim -./test.sh -u -f unique/http/opentsdb.sim +##./test.sh -u -f unique/http/admin.sim +##./test.sh -u -f unique/http/opentsdb.sim #./test.sh -u -f unique/import/replica2.sim #./test.sh -u -f unique/import/replica3.sim @@ -298,28 +298,28 @@ cd ../../../debug; make #./test.sh -u -f unique/metrics/replica3_dnode6.sim #./test.sh -u -f unique/metrics/replica3_vnode3.sim -./test.sh -u -f unique/mnode/mgmt22.sim -./test.sh -u -f unique/mnode/mgmt23.sim -./test.sh -u -f unique/mnode/mgmt24.sim -./test.sh -u -f unique/mnode/mgmt25.sim -./test.sh -u -f unique/mnode/mgmt26.sim -./test.sh -u -f unique/mnode/mgmt33.sim -./test.sh -u -f unique/mnode/mgmt34.sim +##./test.sh -u -f unique/mnode/mgmt22.sim +##./test.sh -u -f unique/mnode/mgmt23.sim +##./test.sh -u -f unique/mnode/mgmt24.sim +##./test.sh -u -f unique/mnode/mgmt25.sim +##./test.sh -u -f unique/mnode/mgmt26.sim +##./test.sh -u -f unique/mnode/mgmt33.sim +##./test.sh -u -f unique/mnode/mgmt34.sim #./test.sh -u -f unique/mnode/mgmtr2.sim #./test.sh -u -f unique/mnode/secondIp.sim #stream -./test.sh -u -f unique/table/delete_part.sim +##./test.sh -u -f unique/table/delete_part.sim -./test.sh -u -f unique/vnode/replica2_basic2.sim -./test.sh -u -f unique/vnode/replica3_basic.sim +##./test.sh -u -f unique/vnode/replica2_basic2.sim +##./test.sh -u -f unique/vnode/replica3_basic.sim #./test.sh -u -f unique/vnode/commit.sim #./test.sh -u -f unique/vnode/many.sim #./test.sh -u -f unique/vnode/replica2_basic.sim -./test.sh -u -f unique/vnode/replica2_basic2.sim +##./test.sh -u -f unique/vnode/replica2_basic2.sim #./test.sh -u -f unique/vnode/replica2_repeat.sim -./test.sh -u -f unique/vnode/replica3_basic.sim +##./test.sh -u -f unique/vnode/replica3_basic.sim #./test.sh -u -f unique/vnode/replica3_repeat.sim #./test.sh -u -f unique/vnode/replica3_vgroup.sim From 78dc2bdfbd0d5b7591255fb2d7b93f76eeb32156 Mon Sep 17 00:00:00 2001 From: chang Date: Sat, 9 May 2020 18:49:58 +0800 Subject: [PATCH 17/23] fix: sys -> monitor stream -> _root --- tests/script/general/user/user_create.sim | 8 ++++---- tests/script/sh/stop_dnodes.sh | 10 +++++----- tests/script/unique/account/user_create.sim | 8 ++++---- tests/script/windows/account/user_create.sim | 8 ++++---- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/tests/script/general/user/user_create.sim b/tests/script/general/user/user_create.sim index 4da60b7e39..34934d09e6 100644 --- a/tests/script/general/user/user_create.sim +++ b/tests/script/general/user/user_create.sim @@ -34,10 +34,10 @@ print =============== step3 sql drop user read -x step31 return -1 step31: -sql drop user sys -x step32 +sql drop user _root -x step32 return -1 step32: -sql drop user stream -x step33 +sql drop user monitor -x step33 return -1 step33: @@ -71,11 +71,11 @@ sql alter user read privilege 1 -x step43 return -1 step43: -sql drop user sys -x step41 +sql drop user _root -x step41 return -1 step41: -sql drop user stream -x step42 +sql drop user monitor -x step42 return -1 step42: diff --git a/tests/script/sh/stop_dnodes.sh b/tests/script/sh/stop_dnodes.sh index a873eb5654..2364dff9b3 100755 --- a/tests/script/sh/stop_dnodes.sh +++ b/tests/script/sh/stop_dnodes.sh @@ -2,14 +2,14 @@ PID=`ps -ef|grep /usr/bin/taosd | grep -v grep | awk '{print $2}'` if [ -n "$PID" ]; then - echo sudo systemctl stop taosd - sudo systemctl stop taosd + echo systemctl stop taosd + systemctl stop taosd fi PID=`ps -ef|grep -w taosd | grep -v grep | awk '{print $2}'` while [ -n "$PID" ]; do - echo sudo kill -9 $PID - sudo pkill -9 taosd - sudo fuser -k -n tcp 6030 + echo kill -9 $PID + pkill -9 taosd + fuser -k -n tcp 6030 PID=`ps -ef|grep -w taosd | grep -v grep | awk '{print $2}'` done diff --git a/tests/script/unique/account/user_create.sim b/tests/script/unique/account/user_create.sim index 075da848d6..789035cfcc 100644 --- a/tests/script/unique/account/user_create.sim +++ b/tests/script/unique/account/user_create.sim @@ -35,10 +35,10 @@ print =============== step3 sql drop user read -x step31 return -1 step31: -sql drop user sys -x step32 +sql drop user _root -x step32 return -1 step32: -sql drop user stream -x step33 +sql drop user monitor -x step33 return -1 step33: @@ -71,11 +71,11 @@ sql alter user read privilege 1 -x step43 return -1 step43: -sql drop user sys -x step41 +sql drop user _root -x step41 return -1 step41: -sql drop user stream -x step42 +sql drop user monitor -x step42 return -1 step42: diff --git a/tests/script/windows/account/user_create.sim b/tests/script/windows/account/user_create.sim index aea95b7c5c..6dc9ab05b3 100644 --- a/tests/script/windows/account/user_create.sim +++ b/tests/script/windows/account/user_create.sim @@ -30,10 +30,10 @@ print =============== step3 sql drop user read -x step31 return -1 step31: -sql drop user sys -x step32 +sql drop user _root -x step32 return -1 step32: -sql drop user stream -x step33 +sql drop user monitor -x step33 return -1 step33: @@ -64,11 +64,11 @@ sql alter user read privilege 1 -x step43 return -1 step43: -sql drop user sys -x step41 +sql drop user _root -x step41 return -1 step41: -sql drop user stream -x step42 +sql drop user monitor -x step42 return -1 step42: From 224496954f2f0dc42954970fc2983eab4206c968 Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Sat, 9 May 2020 19:14:33 +0800 Subject: [PATCH 18/23] fix issue pytest stop dnode by pkill. --- .travis.yml | 4 +- tests/pytest/insert/binary.py | 1 - tests/pytest/smoketest.sh | 168 ++++++++++++---------------------- tests/pytest/test.py | 14 +-- tests/pytest/util/dnodes.py | 78 +++++++++++++--- 5 files changed, 129 insertions(+), 136 deletions(-) diff --git a/.travis.yml b/.travis.yml index f9a27fdabd..17ede412d2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -72,8 +72,8 @@ matrix: fi done - grep 'definitely lost' mem-error-out.txt | uniq | tee uniq-definitely-lost-out.txt - for defiMemError in `cat uniq-definitely-lost-out.txt | awk '{print $7}'` + grep 'definitely lost:' mem-error-out.txt | uniq | tee uniq-definitely-lost-out.txt + for defiMemError in `cat uniq-definitely-lost-out.txt | awk '{print $4}'` do if [ -n "$defiMemError" ]; then if [ "$defiMemError" -gt 16 ]; then diff --git a/tests/pytest/insert/binary.py b/tests/pytest/insert/binary.py index e254fb1438..677ae4bf29 100644 --- a/tests/pytest/insert/binary.py +++ b/tests/pytest/insert/binary.py @@ -14,7 +14,6 @@ class TDTestCase: def run(self): tdSql.prepare() - tdLog.info('=============== step1') tdLog.info('create table tb (ts timestamp, speed binary(5))') tdSql.execute('create table tb (ts timestamp, speed binary(5))') diff --git a/tests/pytest/smoketest.sh b/tests/pytest/smoketest.sh index 37af5f3f42..e51e8792ec 100755 --- a/tests/pytest/smoketest.sh +++ b/tests/pytest/smoketest.sh @@ -1,172 +1,116 @@ #!/bin/bash python3 ./test.py $1 -f insert/basic.py -python3 ./test.py -s $1 -sleep 1 +python3 ./test.py $1 -s && sleep 1 python3 ./test.py $1 -f insert/int.py -python3 ./test.py -s $1 -sleep 1 +python3 ./test.py $1 -s && sleep 1 python3 ./test.py $1 -f insert/float.py -python3 ./test.py -s $1 -sleep 1 +python3 ./test.py $1 -s && sleep 1 python3 ./test.py $1 -f insert/bigint.py -python3 ./test.py -s $1 -sleep 1 +python3 ./test.py $1 -s && sleep 1 python3 ./test.py $1 -f insert/bool.py -python3 ./test.py -s $1 -sleep 1 +python3 ./test.py $1 -s && sleep 1 python3 ./test.py $1 -f insert/double.py -python3 ./test.py -s $1 -sleep 1 +python3 ./test.py $1 -s && sleep 1 python3 ./test.py $1 -f insert/smallint.py -python3 ./test.py -s $1 -sleep 1 +python3 ./test.py $1 -s && sleep 1 python3 ./test.py $1 -f insert/tinyint.py -python3 ./test.py -s $1 -sleep 1 +python3 ./test.py $1 -s && sleep 1 python3 ./test.py $1 -f insert/binary.py -python3 ./test.py -s $1 -sleep 1 +python3 ./test.py $1 -s && sleep 1 python3 ./test.py $1 -f insert/date.py -python3 ./test.py -s $1 -sleep 1 +python3 ./test.py $1 -s && sleep 1 python3 ./test.py $1 -f insert/nchar.py -python3 ./test.py -s $1 -sleep 1 +python3 ./test.py $1 -s && sleep 1 python3 ./test.py $1 -f table/column_name.py -python3 ./test.py -s $1 -sleep 1 +python3 ./test.py $1 -s && sleep 1 python3 ./test.py $1 -f table/column_num.py -python3 ./test.py -s $1 -sleep 1 +python3 ./test.py $1 -s && sleep 1 python3 ./test.py $1 -f table/db_table.py -python3 ./test.py -s $1 -sleep 1 +python3 ./test.py $1 -s && sleep 1 python3 ./test.py $1 -f import_merge/importDataLastTO.py -python3 ./test.py -s $1 -sleep 1 +python3 ./test.py $1 -s && sleep 1 python3 ./test.py $1 -f import_merge/importDataLastT.py -python3 ./test.py -s $1 -sleep 1 +python3 ./test.py $1 -s && sleep 1 python3 ./test.py $1 -f import_merge/importDataTO.py -python3 ./test.py -s $1 -sleep 1 +python3 ./test.py $1 -s && sleep 1 python3 ./test.py $1 -f import_merge/importDataT.py -python3 ./test.py -s $1 -sleep 1 +python3 ./test.py $1 -s && sleep 1 python3 ./test.py $1 -f import_merge/importHeadOverlap.py -python3 ./test.py -s $1 -sleep 1 +python3 ./test.py $1 -s && sleep 1 python3 ./test.py $1 -f import_merge/importHeadPartOverlap.py -python3 ./test.py -s $1 -sleep 1 +python3 ./test.py $1 -s && sleep 1 python3 ./test.py $1 -f import_merge/importHORestart.py -python3 ./test.py -s $1 -sleep 1 +python3 ./test.py $1 -s && sleep 1 python3 ./test.py $1 -f import_merge/importHPORestart.py -python3 ./test.py -s $1 -sleep 1 +python3 ./test.py $1 -s && sleep 1 python3 ./test.py $1 -f import_merge/importHRestart.py -python3 ./test.py -s $1 -sleep 1 +python3 ./test.py $1 -s && sleep 1 python3 ./test.py $1 -f import_merge/importLastSub.py -python3 ./test.py -s $1 -sleep 1 +python3 ./test.py $1 -s && sleep 1 python3 ./test.py $1 -f import_merge/importBlock1HO.py -python3 ./test.py -s $1 -sleep 1 +python3 ./test.py $1 -s && sleep 1 python3 ./test.py $1 -f import_merge/importBlock1HPO.py -python3 ./test.py -s $1 -sleep 1 +python3 ./test.py $1 -s && sleep 1 python3 ./test.py $1 -f import_merge/importBlock1H.py -python3 ./test.py -s $1 -sleep 1 +python3 ./test.py $1 -s && sleep 1 python3 ./test.py $1 -f import_merge/importBlock1S.py -python3 ./test.py -s $1 -sleep 1 +python3 ./test.py $1 -s && sleep 1 python3 ./test.py $1 -f import_merge/importBlock1Sub.py -python3 ./test.py -s $1 -sleep 1 +python3 ./test.py $1 -s && sleep 1 python3 ./test.py $1 -f import_merge/importBlock1TO.py -python3 ./test.py -s $1 -sleep 1 +python3 ./test.py $1 -s && sleep 1 python3 ./test.py $1 -f import_merge/importBlock1TPO.py -python3 ./test.py -s $1 -sleep 1 +python3 ./test.py $1 -s && sleep 1 python3 ./test.py $1 -f import_merge/importBlock1T.py -python3 ./test.py -s $1 -sleep 1 +python3 ./test.py $1 -s && sleep 1 python3 ./test.py $1 -f import_merge/importBlock2HO.py -python3 ./test.py -s $1 -sleep 1 +python3 ./test.py $1 -s && sleep 1 python3 ./test.py $1 -f import_merge/importBlock2HPO.py -python3 ./test.py -s $1 -sleep 1 +python3 ./test.py $1 -s && sleep 1 python3 ./test.py $1 -f import_merge/importBlock2H.py -python3 ./test.py -s $1 -sleep 1 +python3 ./test.py $1 -s && sleep 1 python3 ./test.py $1 -f import_merge/importBlock2S.py -python3 ./test.py -s $1 -sleep 1 +python3 ./test.py $1 -s && sleep 1 python3 ./test.py $1 -f import_merge/importBlock2Sub.py -python3 ./test.py -s $1 -sleep 1 +python3 ./test.py $1 -s && sleep 1 python3 ./test.py $1 -f import_merge/importBlock2TO.py -python3 ./test.py -s $1 -sleep 1 +python3 ./test.py $1 -s && sleep 1 python3 ./test.py $1 -f import_merge/importBlock2TPO.py -python3 ./test.py -s $1 -sleep 1 +python3 ./test.py $1 -s && sleep 1 python3 ./test.py $1 -f import_merge/importBlock2T.py -python3 ./test.py -s $1 -sleep 1 +python3 ./test.py $1 -s && sleep 1 python3 ./test.py $1 -f import_merge/importBlockbetween.py -python3 ./test.py -s $1 -sleep 1 +python3 ./test.py $1 -s && sleep 1 python3 ./test.py $1 -f import_merge/importCacheFileSub.py -python3 ./test.py -s $1 -sleep 1 +python3 ./test.py $1 -s && sleep 1 python3 ./test.py $1 -f import_merge/importCacheFileTO.py -python3 ./test.py -s $1 -sleep 1 +python3 ./test.py $1 -s && sleep 1 python3 ./test.py $1 -f import_merge/importCacheFileT.py -python3 ./test.py -s $1 -sleep 1 +python3 ./test.py $1 -s && sleep 1 python3 ./test.py $1 -f import_merge/importDataLastSub.py -python3 ./test.py -s $1 -sleep 1 +python3 ./test.py $1 -s && sleep 1 python3 ./test.py $1 -f import_merge/importHead.py -python3 ./test.py -s $1 -sleep 1 +python3 ./test.py $1 -s && sleep 1 python3 ./test.py $1 -f import_merge/importLastTO.py -python3 ./test.py -s $1 -sleep 1 +python3 ./test.py $1 -s && sleep 1 python3 ./test.py $1 -f import_merge/importLastT.py -python3 ./test.py -s $1 -sleep 1 +python3 ./test.py $1 -s && sleep 1 python3 ./test.py $1 -f import_merge/importSpan.py -python3 ./test.py -s $1 -sleep 1 +python3 ./test.py $1 -s && sleep 1 python3 ./test.py $1 -f import_merge/importSRestart.py -python3 ./test.py -s $1 -sleep 1 +python3 ./test.py $1 -s && sleep 1 python3 ./test.py $1 -f import_merge/importSubRestart.py -python3 ./test.py -s $1 -sleep 1 +python3 ./test.py $1 -s && sleep 1 python3 ./test.py $1 -f import_merge/importTailOverlap.py -python3 ./test.py -s $1 -sleep 1 +python3 ./test.py $1 -s && sleep 1 python3 ./test.py $1 -f import_merge/importTail.py -python3 ./test.py -s $1 -sleep 1 +python3 ./test.py $1 -s && sleep 1 python3 ./test.py $1 -f import_merge/importTORestart.py -python3 ./test.py -s $1 -sleep 1 +python3 ./test.py $1 -s && sleep 1 python3 ./test.py $1 -f import_merge/importTPORestart.py -python3 ./test.py -s $1 -sleep 1 +python3 ./test.py $1 -s && sleep 1 python3 ./test.py $1 -f import_merge/importTRestart.py -python3 ./test.py -s $1 -sleep 1 +python3 ./test.py $1 -s && sleep 1 diff --git a/tests/pytest/test.py b/tests/pytest/test.py index 9bf1660634..a4129be34c 100644 --- a/tests/pytest/test.py +++ b/tests/pytest/test.py @@ -92,23 +92,23 @@ if __name__ == "__main__": tdDnodes.start(1) if masterIp == "": - host='127.0.0.1' + host = '127.0.0.1' else: - host=masterIp + host = masterIp - tdLog.notice("Procedures for tdengine deployed in %s" % (host)) + tdLog.info("Procedures for tdengine deployed in %s" % (host)) if testCluster: - tdLog.notice("Procedures for testing cluster") + tdLog.info("Procedures for testing cluster") if fileName == "all": tdCases.runAllCluster() else: tdCases.runOneCluster(fileName) else: - tdLog.notice("Procedures for testing self-deployment") + tdLog.info("Procedures for testing self-deployment") conn = taos.connect( - host, - config=tdDnodes.getSimCfgPath()) + host, + config=tdDnodes.getSimCfgPath()) if fileName == "all": tdCases.runAllLinux(conn) else: diff --git a/tests/pytest/util/dnodes.py b/tests/pytest/util/dnodes.py index 2532cec702..e492a35c20 100644 --- a/tests/pytest/util/dnodes.py +++ b/tests/pytest/util/dnodes.py @@ -205,24 +205,47 @@ class TDDnode: time.sleep(2) def stop(self): + if self.valgrind == 0: + toBeKilled = "taosd" + else: + toBeKilled = "valgrind.bin" + if self.running != 0: - cmd = "ps -ef|grep -w taosd | grep '%s' | grep -v grep | awk '{print $2}' && pkill -sigint taosd" % ( - self.cfgDir) - if os.system(cmd) != 0: - tdLog.exit(cmd) - tdLog.debug("dnode:%d is stopped by kill -SIGINT" % (self.index)) + killCmd = "ps -ef|grep -w %s| grep '%s' | grep -v grep | awk '{print $2}' | xargs kill -INT" % ( + toBeKilled, self.cfgDir) + + psCmd = "ps -ef|grep -w %s| grep -v grep | awk '{print $2}'" % toBeKilled + processID = subprocess.check_output(psCmd, shell=True) + + while(processID): + os.system(killCmd) + time.sleep(1) + processID = subprocess.check_output(psCmd, shell=True) + + tdLog.debug("dnode:%d is stopped by kill -INT" % (self.index)) tdLog.debug( "wait 2 seconds for the dnode:%d to stop." % (self.index)) time.sleep(2) def forcestop(self): + if self.valgrind == 0: + toBeKilled = "taosd" + else: + toBeKilled = "valgrind.bin" + if self.running != 0: - cmd = "ps -ef|grep -w taosd | grep '%s' | grep -v grep | awk '{print $2}' && pkill -sigkill taosd" % ( - self.cfgDir) - if os.system(cmd) != 0: - tdLog.exit(cmd) - tdLog.debug("dnode:%d is stopped by kill -9" % (self.index)) + killCmd = "ps -ef|grep -w %s| grep '%s' | grep -v grep | awk '{print $2}' | xargs kill -KILL" % ( + toBeKilled, self.cfgDir) + psCmd = "ps -ef|grep -w %s| grep -v grep | awk '{print $2}'" % toBeKilled + processID = subprocess.check_output(psCmd, shell=True) + + while(processID): + os.system(killCmd) + time.sleep(1) + processID = subprocess.check_output(psCmd, shell=True) + + tdLog.debug("dnode:%d is stopped by kill -KILL" % (self.index)) tdLog.debug( "wait 2 seconds for the dnode:%d to stop." % (self.index)) @@ -268,8 +291,21 @@ class TDDnodes: self.dnodes.append(TDDnode(10)) def init(self, path): - cmd = "ps -ef|grep -w taosd | grep 'taosd' | grep -v grep | awk '{print $2}' && pkill -sigkill taosd" - os.system(cmd) + killCmd = "ps -ef|grep -w taosd | grep -v grep | awk '{print $2}' | xargs kill -KILL" + psCmd = "ps -ef|grep -w taosd| grep -v grep | awk '{print $2}'" + processID = subprocess.check_output(psCmd, shell=True) + while(processID): + os.system(killCmd) + time.sleep(1) + processID = subprocess.check_output(psCmd, shell=True) + + killCmd = "ps -ef|grep -w valgrind.bin| grep -v grep | awk '{print $2}' | xargs kill -KILL" + psCmd = "ps -ef|grep -w valgrind.bin| grep -v grep | awk '{print $2}'" + processID = subprocess.check_output(psCmd, shell=True) + while(processID): + os.system(killCmd) + time.sleep(1) + processID = subprocess.check_output(psCmd, shell=True) binPath = os.path.dirname(os.path.realpath(__file__)) binPath = binPath + "/../../../debug/" @@ -361,8 +397,22 @@ class TDDnodes: os.system(cmd) # if os.system(cmd) != 0 : # tdLog.exit(cmd) - cmd = "ps -ef | grep -w taosd | grep 'dnode' | grep -v grep | awk '{print $2}' && pkill -sigkill taosd" - os.system(cmd) + killCmd = "ps -ef|grep -w taosd| grep -v grep | awk '{print $2}' | xargs kill -KILL" + psCmd = "ps -ef|grep -w taosd| grep -v grep | awk '{print $2}'" + processID = subprocess.check_output(psCmd, shell=True) + while(processID): + os.system(killCmd) + time.sleep(1) + processID = subprocess.check_output(psCmd, shell=True) + + killCmd = "ps -ef|grep -w valgrind.bin| grep -v grep | awk '{print $2}' | xargs kill -KILL" + psCmd = "ps -ef|grep -w valgrind.bin| grep -v grep | awk '{print $2}'" + processID = subprocess.check_output(psCmd, shell=True) + while(processID): + os.system(killCmd) + time.sleep(1) + processID = subprocess.check_output(psCmd, shell=True) + # if os.system(cmd) != 0 : # tdLog.exit(cmd) From 0b1cab6cc60e3fc1c152437e0f2ef9c4cd951b4b Mon Sep 17 00:00:00 2001 From: slguan Date: Sat, 9 May 2020 22:08:41 +0800 Subject: [PATCH 19/23] fix bug while drop sdb --- src/dnode/src/dnodeVWrite.c | 2 +- src/inc/taosmsg.h | 1 + src/mnode/src/mgmtTable.c | 49 ++++++++++++++++++++----------------- src/vnode/src/vnodeMain.c | 2 +- 4 files changed, 29 insertions(+), 25 deletions(-) diff --git a/src/dnode/src/dnodeVWrite.c b/src/dnode/src/dnodeVWrite.c index 147d2bdfbb..5de4c16c50 100644 --- a/src/dnode/src/dnodeVWrite.c +++ b/src/dnode/src/dnodeVWrite.c @@ -85,7 +85,7 @@ void dnodeCleanupWrite() { void dnodeDispatchToVnodeWriteQueue(SRpcMsg *pMsg) { char *pCont = (char *)pMsg->pCont; - if (pMsg->msgType == TSDB_MSG_TYPE_SUBMIT || pMsg->msgType == TSDB_MSG_TYPE_MD_DROP_STABLE) { + if (pMsg->msgType == TSDB_MSG_TYPE_SUBMIT) { SMsgDesc *pDesc = (SMsgDesc *)pCont; pDesc->numOfVnodes = htonl(pDesc->numOfVnodes); pCont += sizeof(SMsgDesc); diff --git a/src/inc/taosmsg.h b/src/inc/taosmsg.h index c359ede22e..8dac73606d 100644 --- a/src/inc/taosmsg.h +++ b/src/inc/taosmsg.h @@ -326,6 +326,7 @@ typedef struct { } SMDDropTableMsg; typedef struct { + int32_t contLen; int32_t vgId; int64_t uid; char tableId[TSDB_TABLE_ID_LEN + 1]; diff --git a/src/mnode/src/mgmtTable.c b/src/mnode/src/mgmtTable.c index 2225e08f58..bfe357cf7c 100644 --- a/src/mnode/src/mgmtTable.c +++ b/src/mnode/src/mgmtTable.c @@ -701,10 +701,10 @@ static void mgmtProcessDropTableMsg(SQueuedMsg *pMsg) { } if (pMsg->pTable->type == TSDB_SUPER_TABLE) { - mTrace("table:%s, start to drop stable", pDrop->tableId); + mPrint("table:%s, start to drop stable", pDrop->tableId); mgmtProcessDropSuperTableMsg(pMsg); } else { - mTrace("table:%s, start to drop ctable", pDrop->tableId); + mPrint("table:%s, start to drop ctable", pDrop->tableId); mgmtProcessDropChildTableMsg(pMsg); } } @@ -802,29 +802,32 @@ static void mgmtProcessDropSuperTableMsg(SQueuedMsg *pMsg) { int32_t vgId = pStable->vgList[vg]; if (vgId == 0) break; + SVgObj *pVgroup = mgmtGetVgroup(vgId); + if (pVgroup == NULL) break; + SMDDropSTableMsg *pDrop = rpcMallocCont(sizeof(SMDDropSTableMsg)); + pDrop->contLen = htonl(sizeof(SMDDropSTableMsg)); pDrop->vgId = htonl(vgId); pDrop->uid = htobe64(pStable->uid); mgmtExtractTableName(pStable->info.tableId, pDrop->tableId); - - SVgObj *pVgroup = mgmtGetVgroup(vgId); - if (pVgroup != NULL) { - SRpcIpSet ipSet = mgmtGetIpSetFromVgroup(pVgroup); - SRpcMsg rpcMsg = {.pCont = pDrop, .contLen = sizeof(SMDDropSTableMsg), .msgType = TSDB_MSG_TYPE_MD_DROP_STABLE}; - dnodeSendMsgToDnode(&ipSet, &rpcMsg); - mgmtDecVgroupRef(pVgroup); - } + + mPrint("stable:%s, send drop stable msg to vgId:%d", pStable->info.tableId, vgId); + SRpcIpSet ipSet = mgmtGetIpSetFromVgroup(pVgroup); + SRpcMsg rpcMsg = {.pCont = pDrop, .contLen = sizeof(SMDDropSTableMsg), .msgType = TSDB_MSG_TYPE_MD_DROP_STABLE}; + dnodeSendMsgToDnode(&ipSet, &rpcMsg); + mgmtDecVgroupRef(pVgroup); } - } else { - SSdbOper oper = { - .type = SDB_OPER_GLOBAL, - .table = tsSuperTableSdb, - .pObj = pStable - }; - int32_t code = sdbDeleteRow(&oper); - mLPrint("stable:%s, is dropped from sdb, result:%s", pStable->info.tableId, tstrerror(code)); - mgmtSendSimpleResp(pMsg->thandle, code); - } + } + + SSdbOper oper = { + .type = SDB_OPER_GLOBAL, + .table = tsSuperTableSdb, + .pObj = pStable + }; + + int32_t code = sdbDeleteRow(&oper); + mLPrint("stable:%s, is dropped from sdb, result:%s", pStable->info.tableId, tstrerror(code)); + mgmtSendSimpleResp(pMsg->thandle, code); } static int32_t mgmtFindSuperTableTagIndex(SSuperTableObj *pStable, const char *tagName) { @@ -1303,7 +1306,7 @@ static void mgmtProcessSuperTableVgroupMsg(SQueuedMsg *pMsg) { } static void mgmtProcessDropSuperTableRsp(SRpcMsg *rpcMsg) { - mTrace("drop stable rsp received, handle:%p code:%s", rpcMsg->handle, tstrerror(rpcMsg->code)); + mPrint("drop stable rsp received, result:%s", tstrerror(rpcMsg->code)); } static void *mgmtBuildCreateChildTableMsg(SCMCreateTableMsg *pMsg, SChildTableObj *pTable) { @@ -1540,7 +1543,7 @@ static void mgmtProcessDropChildTableMsg(SQueuedMsg *pMsg) { SRpcIpSet ipSet = mgmtGetIpSetFromVgroup(pMsg->pVgroup); - mTrace("table:%s, send drop ctable msg", pDrop->tableId); + mPrint("table:%s, send drop ctable msg", pDrop->tableId); SQueuedMsg *newMsg = mgmtCloneQueuedMsg(pMsg); newMsg->ahandle = pMsg->pTable; SRpcMsg rpcMsg = { @@ -1867,7 +1870,7 @@ static void mgmtProcessDropChildTableRsp(SRpcMsg *rpcMsg) { queueMsg->received++; SChildTableObj *pTable = queueMsg->ahandle; - mTrace("table:%s, drop table rsp received, thandle:%p result:%s", pTable->info.tableId, queueMsg->thandle, tstrerror(rpcMsg->code)); + mPrint("table:%s, drop table rsp received, thandle:%p result:%s", pTable->info.tableId, queueMsg->thandle, tstrerror(rpcMsg->code)); if (rpcMsg->code != TSDB_CODE_SUCCESS) { mError("table:%s, failed to drop in dnode, reason:%s", pTable->info.tableId, tstrerror(rpcMsg->code)); diff --git a/src/vnode/src/vnodeMain.c b/src/vnode/src/vnodeMain.c index 6ffac08b4e..16845812bf 100644 --- a/src/vnode/src/vnodeMain.c +++ b/src/vnode/src/vnodeMain.c @@ -301,7 +301,7 @@ void *vnodeGetVnode(int32_t vgId) { SVnodeObj **ppVnode = (SVnodeObj **)taosGetIntHashData(tsDnodeVnodesHash, vgId); if (ppVnode == NULL || *ppVnode == NULL) { terrno = TSDB_CODE_INVALID_VGROUP_ID; - vPrint("vgId:%d not exist", vgId); + vPrint("vgId:%d, not exist", vgId); return NULL; } From 92a19d9c164f39d7982fa19e9ca6b4e4ccc5c92f Mon Sep 17 00:00:00 2001 From: slguan Date: Sat, 9 May 2020 22:15:45 +0800 Subject: [PATCH 20/23] scripts --- tests/script/general/metrics/testSuite.sim | 4 ---- tests/script/general/{metrics => stable}/disk.sim | 0 tests/script/general/{metrics => stable}/metrics.sim | 0 tests/script/general/stable/testSuite.sim | 4 ++++ tests/script/general/{metrics => stable}/values.sim | 0 tests/script/general/{metrics => stable}/vnode3.sim | 0 tests/script/general/table/basic3.sim | 7 +++++++ tests/script/jenkins/basic.txt | 10 +++++----- 8 files changed, 16 insertions(+), 9 deletions(-) delete mode 100644 tests/script/general/metrics/testSuite.sim rename tests/script/general/{metrics => stable}/disk.sim (100%) rename tests/script/general/{metrics => stable}/metrics.sim (100%) create mode 100644 tests/script/general/stable/testSuite.sim rename tests/script/general/{metrics => stable}/values.sim (100%) rename tests/script/general/{metrics => stable}/vnode3.sim (100%) diff --git a/tests/script/general/metrics/testSuite.sim b/tests/script/general/metrics/testSuite.sim deleted file mode 100644 index 55300034b6..0000000000 --- a/tests/script/general/metrics/testSuite.sim +++ /dev/null @@ -1,4 +0,0 @@ -run general/metrics/disk.sim -run general/metrics/metrics.sim -run general/metrics/values.sim -run general/metrics/vnode3.sim diff --git a/tests/script/general/metrics/disk.sim b/tests/script/general/stable/disk.sim similarity index 100% rename from tests/script/general/metrics/disk.sim rename to tests/script/general/stable/disk.sim diff --git a/tests/script/general/metrics/metrics.sim b/tests/script/general/stable/metrics.sim similarity index 100% rename from tests/script/general/metrics/metrics.sim rename to tests/script/general/stable/metrics.sim diff --git a/tests/script/general/stable/testSuite.sim b/tests/script/general/stable/testSuite.sim new file mode 100644 index 0000000000..a3696c8706 --- /dev/null +++ b/tests/script/general/stable/testSuite.sim @@ -0,0 +1,4 @@ +run general/stable/disk.sim +run general/stable/metrics.sim +run general/stable/values.sim +run general/stable/vnode3.sim diff --git a/tests/script/general/metrics/values.sim b/tests/script/general/stable/values.sim similarity index 100% rename from tests/script/general/metrics/values.sim rename to tests/script/general/stable/values.sim diff --git a/tests/script/general/metrics/vnode3.sim b/tests/script/general/stable/vnode3.sim similarity index 100% rename from tests/script/general/metrics/vnode3.sim rename to tests/script/general/stable/vnode3.sim diff --git a/tests/script/general/table/basic3.sim b/tests/script/general/table/basic3.sim index 7f90dc0c52..ded00e153a 100644 --- a/tests/script/general/table/basic3.sim +++ b/tests/script/general/table/basic3.sim @@ -70,4 +70,11 @@ if $data21 != 3 then return -1 endi +print =============== drop stable +sql drop table db.st +sql show db.stables +if $rows != 0 then + return -1 +endi + system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt index 6e9572e83c..48617c149a 100644 --- a/tests/script/jenkins/basic.txt +++ b/tests/script/jenkins/basic.txt @@ -96,11 +96,6 @@ cd ../../../debug; make ./test.sh -f general/insert/query_multi_file.sim ./test.sh -f general/insert/tcp.sim -#./test.sh -f general/metrics/disk.sim -#./test.sh -f general/metrics/metrics.sim -#./test.sh -f general/metrics/values.sim -#./test.sh -f general/metrics/vnode3.sim - #parser # ./test.sh -f general/parser/alter.sim @@ -162,6 +157,11 @@ cd ../../../debug; make # ./test.sh -f general/parser/select_with_tags.sim # ./test.sh -f general/parser/groupby.sim +#./test.sh -f general/stable/disk.sim +#./test.sh -f general/stable/metrics.sim +#./test.sh -f general/stable/values.sim +#./test.sh -f general/stable/vnode3.sim + #stream ./test.sh -f general/table/autocreate.sim From dba2b23ce375cf367744f22412ca6d877fddafed Mon Sep 17 00:00:00 2001 From: slguan Date: Sat, 9 May 2020 22:41:46 +0800 Subject: [PATCH 21/23] fix valgrind error --- src/mnode/src/mgmtSdb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mnode/src/mgmtSdb.c b/src/mnode/src/mgmtSdb.c index 4a18c5e285..c25f4457a9 100644 --- a/src/mnode/src/mgmtSdb.c +++ b/src/mnode/src/mgmtSdb.c @@ -278,7 +278,7 @@ void sdbUpdateSync() { sdbPrint("mnode:%d, %s:%d", syncCfg.nodeInfo[i].nodeId, syncCfg.nodeInfo[i].nodeFqdn, syncCfg.nodeInfo[i].nodePort); } - SSyncInfo syncInfo; + SSyncInfo syncInfo = {0}; syncInfo.vgId = 1; syncInfo.version = sdbGetVersion(); syncInfo.syncCfg = syncCfg; From c43695e344d1e495cdbd08bf2bf555fe56e81414 Mon Sep 17 00:00:00 2001 From: slguan Date: Sun, 10 May 2020 00:06:37 +0800 Subject: [PATCH 22/23] fix bug in pass_alter.sim, add log, revise shellActiveTimer --- src/client/src/tscSql.c | 4 ++-- src/client/src/tscSystem.c | 2 ++ src/client/src/tscUtil.c | 2 +- src/dnode/src/dnodePeer.c | 4 ++-- src/dnode/src/dnodeShell.c | 2 +- src/rpc/src/rpcMain.c | 2 +- tests/script/general/user/pass_alter.sim | 25 +++++++++++++++++++++--- 7 files changed, 31 insertions(+), 10 deletions(-) diff --git a/src/client/src/tscSql.c b/src/client/src/tscSql.c index a45db94b49..14f0fa07ca 100644 --- a/src/client/src/tscSql.c +++ b/src/client/src/tscSql.c @@ -172,7 +172,7 @@ static void syncConnCallback(void *param, TAOS_RES *tres, int code) { } TAOS *taos_connect(const char *ip, const char *user, const char *pass, const char *db, uint16_t port) { - tscTrace("try to create a connection to %s", ip); + tscTrace("try to create a connection to %s:%u, user:%s db:%s", ip, port, user, db); STscObj *pObj = taosConnectImpl(ip, user, pass, db, port, NULL, NULL, NULL); if (pObj != NULL) { @@ -191,7 +191,7 @@ TAOS *taos_connect(const char *ip, const char *user, const char *pass, const cha return NULL; } - tscTrace("%p DB connection is opening", pObj); + tscTrace("%p DB connection is opening, dnodeConn:%p", pObj, pObj->pDnodeConn); // version compare only requires the first 3 segments of the version string int code = taosCheckVersion(version, taos_get_server_info(pObj), 3); diff --git a/src/client/src/tscSystem.c b/src/client/src/tscSystem.c index d713a9ee5f..07926306db 100644 --- a/src/client/src/tscSystem.c +++ b/src/client/src/tscSystem.c @@ -69,6 +69,8 @@ int32_t tscInitRpc(const char *user, const char *secret, void** pDnodeConn) { if (*pDnodeConn == NULL) { tscError("failed to init connection to TDengine"); return -1; + } else { + tscTrace("dnodeConn:%p is created, user:%s", *pDnodeConn, user); } } diff --git a/src/client/src/tscUtil.c b/src/client/src/tscUtil.c index ccb363d9e8..dd3cb76cbf 100644 --- a/src/client/src/tscUtil.c +++ b/src/client/src/tscUtil.c @@ -766,7 +766,7 @@ void tscCloseTscObj(STscObj* pObj) { rpcClose(pObj->pDnodeConn); } - tscTrace("%p DB connection is closed", pObj); + tscTrace("%p DB connection is closed, dnodeConn:%p", pObj, pObj->pDnodeConn); tfree(pObj); } diff --git a/src/dnode/src/dnodePeer.c b/src/dnode/src/dnodePeer.c index b1e5d9fd38..ea21ed0206 100644 --- a/src/dnode/src/dnodePeer.c +++ b/src/dnode/src/dnodePeer.c @@ -61,7 +61,7 @@ int32_t dnodeInitServer() { rpcInit.cfp = dnodeProcessReqMsgFromDnode; rpcInit.sessions = 100; rpcInit.connType = TAOS_CONN_SERVER; - rpcInit.idleTime = tsShellActivityTimer * 2000; + rpcInit.idleTime = tsShellActivityTimer * 1000; tsDnodeServerRpc = rpcOpen(&rpcInit); if (tsDnodeServerRpc == NULL) { @@ -122,7 +122,7 @@ int32_t dnodeInitClient() { rpcInit.ufp = dnodeUpdateIpSet; rpcInit.sessions = 100; rpcInit.connType = TAOS_CONN_CLIENT; - rpcInit.idleTime = tsShellActivityTimer * 2000; + rpcInit.idleTime = tsShellActivityTimer * 1000; rpcInit.user = "t"; rpcInit.ckey = "key"; rpcInit.secret = "secret"; diff --git a/src/dnode/src/dnodeShell.c b/src/dnode/src/dnodeShell.c index cf6b5e38ab..28679262fa 100644 --- a/src/dnode/src/dnodeShell.c +++ b/src/dnode/src/dnodeShell.c @@ -86,7 +86,7 @@ int32_t dnodeInitShell() { rpcInit.cfp = dnodeProcessMsgFromShell; rpcInit.sessions = TSDB_SESSIONS_PER_DNODE; rpcInit.connType = TAOS_CONN_SERVER; - rpcInit.idleTime = tsShellActivityTimer * 1500; + rpcInit.idleTime = tsShellActivityTimer * 1000; rpcInit.afp = dnodeRetrieveUserAuthInfo; tsDnodeShellRpc = rpcOpen(&rpcInit); diff --git a/src/rpc/src/rpcMain.c b/src/rpc/src/rpcMain.c index 685b0f2b86..f5244545fc 100644 --- a/src/rpc/src/rpcMain.c +++ b/src/rpc/src/rpcMain.c @@ -793,7 +793,7 @@ static SRpcConn *rpcProcessMsgHead(SRpcInfo *pRpc, SRecvInfo *pRecv) { pConn->chandle = pRecv->chandle; pConn->peerIp = pRecv->ip; - if (pConn->peerPort == 0) pConn->peerPort = pRecv->port; + pConn->peerPort = pRecv->port; if (pHead->port) pConn->peerPort = htons(pHead->port); terrno = rpcCheckAuthentication(pConn, (char *)pHead, pRecv->msgLen); diff --git a/tests/script/general/user/pass_alter.sim b/tests/script/general/user/pass_alter.sim index 034e704a87..857d658db1 100644 --- a/tests/script/general/user/pass_alter.sim +++ b/tests/script/general/user/pass_alter.sim @@ -19,28 +19,47 @@ endi print ============= step2 sql close +sleep 2500 +print user read login sql connect read -sleep 2000 sql alter user read pass 'taosdata' sql alter user write pass 'taosdata1' -x step2 return -1 step2: +sql_error create user read pass 'taosdata1' +sql_error create user write pass 'taosdata1' + +sql show users +if $rows != 5 then + return -1 +endi print ============= step3 sql close +sleep 2500 +print user write login sql connect write -sleep 2000 + +sql_error create user read pass 'taosdata1' +sql_error create user write pass 'taosdata1' sql alter user write pass 'taosdata' sql alter user read pass 'taosdata' -x step3 return -1 step3: +sql show users +if $rows != 5 then + return -1 +endi + print ============= step4 sql close +sleep 2500 +print root write login sql connect -sleep 2000 sql create user oroot pass 'taosdata' + sql show users if $rows != 6 then return -1 From 105f44069083d5120dabc7a223cf8a3081171421 Mon Sep 17 00:00:00 2001 From: slguan Date: Sun, 10 May 2020 00:10:37 +0800 Subject: [PATCH 23/23] scripts --- tests/script/basicSuite.sim | 1 + tests/script/jenkins/basic.txt | 12 ++++++------ tests/tsim/src/simExe.c | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/tests/script/basicSuite.sim b/tests/script/basicSuite.sim index 676ac93bf2..aa0fbf65b7 100644 --- a/tests/script/basicSuite.sim +++ b/tests/script/basicSuite.sim @@ -20,6 +20,7 @@ run general/table/column_name.sim run general/table/int.sim run general/table/vgroup.sim run general/user/basic1.sim +run general/user/pass_alter.sim run general/user/user_len.sim run general/vector/single.sim ################################## diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt index 48617c149a..d96a1db2b4 100644 --- a/tests/script/jenkins/basic.txt +++ b/tests/script/jenkins/basic.txt @@ -220,9 +220,9 @@ cd ../../../debug; make ./test.sh -f general/user/basic1.sim #./test.sh -f general/user/monitor.sim -##./test.sh -f general/user/pass_alter.sim +./test.sh -f general/user/pass_alter.sim ./test.sh -f general/user/pass_len.sim -##./test.sh -f general/user/user_create.sim +./test.sh -f general/user/user_create.sim ./test.sh -f general/user/user_len.sim #./test.sh -f general/vector/metrics_field.sim @@ -240,15 +240,15 @@ cd ../../../debug; make ################################# ./test.sh -u -f unique/account/account_create.sim -##./test.sh -u -f unique/account/account_delete.sim +./test.sh -u -f unique/account/account_delete.sim ./test.sh -u -f unique/account/account_len.sim -##./test.sh -u -f unique/account/authority.sim +./test.sh -u -f unique/account/authority.sim ./test.sh -u -f unique/account/basic.sim ./test.sh -u -f unique/account/paras.sim -##./test.sh -u -f unique/account/pass_alter.sim +./test.sh -u -f unique/account/pass_alter.sim ./test.sh -u -f unique/account/pass_len.sim ./test.sh -u -f unique/account/usage.sim -##./test.sh -u -f unique/account/user_create.sim +./test.sh -u -f unique/account/user_create.sim ./test.sh -u -f unique/account/user_len.sim #./test.sh -u -f unique/big/balance.sim diff --git a/tests/tsim/src/simExe.c b/tests/tsim/src/simExe.c index d6ab2d5b92..5ea1cb4a1a 100644 --- a/tests/tsim/src/simExe.c +++ b/tests/tsim/src/simExe.c @@ -415,7 +415,7 @@ void simCloseNativeConnect(SScript *script) { simTrace("script:%s, taos:%p closed", script->fileName, script->taos); taos_close(script->taos); - taosMsleep(1000); + taosMsleep(1200); script->taos = NULL; }