diff --git a/include/common/tmsg.h b/include/common/tmsg.h index 4fa47d4825..c82bd4396b 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -826,7 +826,8 @@ typedef struct SShowRsp { } SShowRsp; typedef struct { - char ep[TSDB_EP_LEN]; // end point, hostname:port + char fqdn[TSDB_FQDN_LEN]; // end point, hostname:port + int32_t port; } SCreateDnodeMsg; typedef struct { @@ -852,6 +853,18 @@ typedef struct { int32_t dnodeId; } SDropMnodeInMsg; +typedef struct { + int32_t dnodeId; +} SCreateQnodeInMsg, SDropQnodeInMsg; + +typedef struct { + int32_t dnodeId; +} SCreateSnodeInMsg, SDropSnodeInMsg; + +typedef struct { + int32_t dnodeId; +} SCreateBnodeInMsg, SDropBnodeInMsg; + typedef struct { int32_t dnodeId; int32_t vgId; diff --git a/include/dnode/bnode/bnode.h b/include/dnode/bnode/bnode.h new file mode 100644 index 0000000000..74574f5462 --- /dev/null +++ b/include/dnode/bnode/bnode.h @@ -0,0 +1,86 @@ +/* + * 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 _TD_BNODE_H_ +#define _TD_BNODE_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* ------------------------ TYPES EXPOSED ------------------------ */ +typedef struct SDnode SDnode; +typedef struct SBnode SBnode; +typedef void (*SendMsgToDnodeFp)(SDnode *pDnode, struct SEpSet *epSet, struct SRpcMsg *rpcMsg); +typedef void (*SendMsgToMnodeFp)(SDnode *pDnode, struct SRpcMsg *rpcMsg); +typedef void (*SendRedirectMsgFp)(SDnode *pDnode, struct SRpcMsg *rpcMsg); + +typedef struct { + int64_t numOfErrors; +} SBnodeLoad; + +typedef struct { + int32_t sver; +} SBnodeCfg; + +typedef struct { + int32_t dnodeId; + int64_t clusterId; + SBnodeCfg cfg; + SDnode *pDnode; + SendMsgToDnodeFp sendMsgToDnodeFp; + SendMsgToMnodeFp sendMsgToMnodeFp; + SendRedirectMsgFp sendRedirectMsgFp; +} SBnodeOpt; + +/* ------------------------ SBnode ------------------------ */ +/** + * @brief Start one Bnode in Dnode. + * + * @param pOption Option of the bnode. + * @return SBnode* The bnode object. + */ +SBnode *bndOpen(const SBnodeOpt *pOption); + +/** + * @brief Stop Bnode in Dnode. + * + * @param pBnode The bnode object to close. + */ +void bndClose(SBnode *pBnode); + +/** + * @brief Get the statistical information of Bnode + * + * @param pBnode The bnode object. + * @param pLoad Statistics of the bnode. + * @return int32_t 0 for success, -1 for failure. + */ +int32_t bndGetLoad(SBnode *pBnode, SBnodeLoad *pLoad); + +/** + * @brief Process a query message. + * + * @param pBnode The bnode object. + * @param pMsgs The array of SRpcMsg + * @return int32_t 0 for success, -1 for failure + */ +int32_t bndProcessWMsgs(SBnode *pBnode, SArray *pMsgs); + +#ifdef __cplusplus +} +#endif + +#endif /*_TD_BNODE_H_*/ \ No newline at end of file diff --git a/include/dnode/mgmt/dnode.h b/include/dnode/mgmt/dnode.h index b7f3cea7fc..e12ce09422 100644 --- a/include/dnode/mgmt/dnode.h +++ b/include/dnode/mgmt/dnode.h @@ -29,6 +29,7 @@ typedef struct { int32_t sver; int16_t numOfCores; int16_t numOfSupportVnodes; + int16_t numOfCommitThreads; int8_t enableTelem; int32_t statusInterval; float numOfThreadsPerCore; diff --git a/include/dnode/qnode/qnode.h b/include/dnode/qnode/qnode.h index aa4c3af392..8084175a90 100644 --- a/include/dnode/qnode/qnode.h +++ b/include/dnode/qnode/qnode.h @@ -19,52 +19,73 @@ #ifdef __cplusplus extern "C" { #endif -#include "trpc.h" + +/* ------------------------ TYPES EXPOSED ------------------------ */ +typedef struct SDnode SDnode; +typedef struct SQnode SQnode; +typedef void (*SendMsgToDnodeFp)(SDnode *pDnode, struct SEpSet *epSet, struct SRpcMsg *rpcMsg); +typedef void (*SendMsgToMnodeFp)(SDnode *pDnode, struct SRpcMsg *rpcMsg); +typedef void (*SendRedirectMsgFp)(SDnode *pDnode, struct SRpcMsg *rpcMsg); typedef struct { - uint64_t numOfStartTask; - uint64_t numOfStopTask; - uint64_t numOfRecvedFetch; - uint64_t numOfSentHb; - uint64_t numOfSentFetch; - uint64_t numOfTaskInQueue; - uint64_t numOfFetchInQueue; - uint64_t numOfErrors; -} SQnodeStat; + int64_t numOfStartTask; + int64_t numOfStopTask; + int64_t numOfRecvedFetch; + int64_t numOfSentHb; + int64_t numOfSentFetch; + int64_t numOfTaskInQueue; + int64_t numOfFetchInQueue; + int64_t numOfErrors; +} SQnodeLoad; +typedef struct { + int32_t sver; +} SQnodeCfg; +typedef struct { + int32_t dnodeId; + int64_t clusterId; + SQnodeCfg cfg; + SDnode *pDnode; + SendMsgToDnodeFp sendMsgToDnodeFp; + SendMsgToMnodeFp sendMsgToMnodeFp; + SendRedirectMsgFp sendRedirectMsgFp; +} SQnodeOpt; + +/* ------------------------ SQnode ------------------------ */ /** - * Start one Qnode in Dnode. - * @return Error Code. - */ -int32_t qnodeStart(); - -/** - * Stop Qnode in Dnode. + * @brief Start one Qnode in Dnode. * - * @param qnodeId Qnode ID to stop, -1 for all Qnodes. + * @param pOption Option of the qnode. + * @return SQnode* The qnode object. */ -void qnodeStop(int64_t qnodeId); +SQnode *qndOpen(const SQnodeOpt *pOption); - /** - * Get the statistical information of Qnode + * @brief Stop Qnode in Dnode. * - * @param qnodeId Qnode ID to get statistics, -1 for all - * @param stat Statistical information. - * @return Error Code. + * @param pQnode The qnode object to close. */ -int32_t qnodeGetStatistics(int64_t qnodeId, SQnodeStat *stat); +void qndClose(SQnode *pQnode); /** - * Interface for processing Qnode messages. - * - * @param pMsg Message to be processed. - * @return Error code + * @brief Get the statistical information of Qnode + * + * @param pQnode The qnode object. + * @param pLoad Statistics of the qnode. + * @return int32_t 0 for success, -1 for failure. */ -void qnodeProcessReq(SRpcMsg *pMsg); - +int32_t qndGetLoad(SQnode *pQnode, SQnodeLoad *pLoad); +/** + * @brief Process a query or fetch message. + * + * @param pQnode The qnode object. + * @param pMsg The request message + * @param pRsp The response message + * @return int32_t 0 for success, -1 for failure + */ +int32_t qndProcessMsg(SQnode *pQnode, SRpcMsg *pMsg, SRpcMsg **pRsp); #ifdef __cplusplus } diff --git a/include/dnode/snode/snode.h b/include/dnode/snode/snode.h new file mode 100644 index 0000000000..1d30bd1e43 --- /dev/null +++ b/include/dnode/snode/snode.h @@ -0,0 +1,87 @@ +/* + * 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 _TD_SNODE_H_ +#define _TD_SNODE_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* ------------------------ TYPES EXPOSED ------------------------ */ +typedef struct SDnode SDnode; +typedef struct SSnode SSnode; +typedef void (*SendMsgToDnodeFp)(SDnode *pDnode, struct SEpSet *epSet, struct SRpcMsg *rpcMsg); +typedef void (*SendMsgToMnodeFp)(SDnode *pDnode, struct SRpcMsg *rpcMsg); +typedef void (*SendRedirectMsgFp)(SDnode *pDnode, struct SRpcMsg *rpcMsg); + +typedef struct { + int64_t numOfErrors; +} SSnodeLoad; + +typedef struct { + int32_t sver; +} SSnodeCfg; + +typedef struct { + int32_t dnodeId; + int64_t clusterId; + SSnodeCfg cfg; + SDnode *pDnode; + SendMsgToDnodeFp sendMsgToDnodeFp; + SendMsgToMnodeFp sendMsgToMnodeFp; + SendRedirectMsgFp sendRedirectMsgFp; +} SSnodeOpt; + +/* ------------------------ SSnode ------------------------ */ +/** + * @brief Start one Snode in Dnode. + * + * @param pOption Option of the snode. + * @return SSnode* The snode object. + */ +SSnode *sndOpen(const SSnodeOpt *pOption); + +/** + * @brief Stop Snode in Dnode. + * + * @param pSnode The snode object to close. + */ +void sndClose(SSnode *pSnode); + +/** + * @brief Get the statistical information of Snode + * + * @param pSnode The snode object. + * @param pLoad Statistics of the snode. + * @return int32_t 0 for success, -1 for failure. + */ +int32_t sndGetLoad(SSnode *pSnode, SSnodeLoad *pLoad); + +/** + * @brief Process a query message. + * + * @param pSnode The snode object. + * @param pMsg The request message + * @param pRsp The response message + * @return int32_t 0 for success, -1 for failure + */ +int32_t sndProcessWriteMsg(SSnode *pSnode, SRpcMsg *pMsg, SRpcMsg **pRsp); + +#ifdef __cplusplus +} +#endif + +#endif /*_TD_SNODE_H_*/ \ No newline at end of file diff --git a/include/libs/planner/planner.h b/include/libs/planner/planner.h index b3262953b5..3ca923b0aa 100644 --- a/include/libs/planner/planner.h +++ b/include/libs/planner/planner.h @@ -21,6 +21,7 @@ extern "C" { #endif #include "tmsg.h" +#include "tarray.h" #define QUERY_TYPE_MERGE 1 #define QUERY_TYPE_PARTIAL 2 @@ -131,7 +132,7 @@ typedef struct SSubplan { typedef struct SQueryDag { uint64_t queryId; int32_t numOfSubplans; - SArray *pSubplans; // Element is SArray*, and nested element is SSubplan. The execution level of subplan, starting from 0. + SArray *pSubplans; // SArray*>. The execution level of subplan, starting from 0. } SQueryDag; struct SQueryNode; @@ -165,8 +166,11 @@ void qDestroySubplan(SSubplan* pSubplan); */ void qDestroyQueryDag(SQueryDag* pDag); +char* qDagToString(const SQueryDag* pDag); +SQueryDag* qStringToDag(const char* pStr); + #ifdef __cplusplus } #endif -#endif /*_TD_PLANNER_H_*/ \ No newline at end of file +#endif /*_TD_PLANNER_H_*/ diff --git a/include/libs/qcom/query.h b/include/libs/qcom/query.h index 1e970fbd66..5ff42146e9 100644 --- a/include/libs/qcom/query.h +++ b/include/libs/qcom/query.h @@ -124,6 +124,15 @@ int32_t cleanupTaskQueue(); */ int32_t taosAsyncExec(__async_exec_fn_t execFn, void* execParam, int32_t* code); +/** + * Asynchronously send message to server, after the response received, the callback will be incured. + * + * @param pTransporter + * @param epSet + * @param pTransporterId + * @param pInfo + * @return + */ int32_t asyncSendMsgToServer(void *pTransporter, SEpSet* epSet, int64_t* pTransporterId, const SMsgSendInfo* pInfo); const SSchema* tGetTbnameColumnSchema(); diff --git a/include/util/taoserror.h b/include/util/taoserror.h index b6e8964b98..ba3e122db3 100644 --- a/include/util/taoserror.h +++ b/include/util/taoserror.h @@ -69,6 +69,7 @@ int32_t* taosGetErrno(); #define TSDB_CODE_CHECKSUM_ERROR TAOS_DEF_ERROR_CODE(0, 0x0107) #define TSDB_CODE_INVALID_MSG TAOS_DEF_ERROR_CODE(0, 0x0108) #define TSDB_CODE_MSG_NOT_PROCESSED TAOS_DEF_ERROR_CODE(0, 0x0109) +#define TSDB_CODE_INVALID_PARA TAOS_DEF_ERROR_CODE(0, 0x010A) #define TSDB_CODE_REF_NO_MEMORY TAOS_DEF_ERROR_CODE(0, 0x0110) #define TSDB_CODE_REF_FULL TAOS_DEF_ERROR_CODE(0, 0x0111) #define TSDB_CODE_REF_ID_REMOVED TAOS_DEF_ERROR_CODE(0, 0x0112) @@ -256,9 +257,27 @@ int32_t* taosGetErrno(); #define TSDB_CODE_DND_MNODE_ID_NOT_FOUND TAOS_DEF_ERROR_CODE(0, 0x0423) #define TSDB_CODE_DND_MNODE_READ_FILE_ERROR TAOS_DEF_ERROR_CODE(0, 0x0424) #define TSDB_CODE_DND_MNODE_WRITE_FILE_ERROR TAOS_DEF_ERROR_CODE(0, 0x0425) -#define TSDB_CODE_DND_VNODE_TOO_MANY_VNODES TAOS_DEF_ERROR_CODE(0, 0x0430) -#define TSDB_CODE_DND_VNODE_READ_FILE_ERROR TAOS_DEF_ERROR_CODE(0, 0x0431) -#define TSDB_CODE_DND_VNODE_WRITE_FILE_ERROR TAOS_DEF_ERROR_CODE(0, 0x0432) +#define TSDB_CODE_DND_QNODE_ALREADY_DEPLOYED TAOS_DEF_ERROR_CODE(0, 0x0430) +#define TSDB_CODE_DND_QNODE_NOT_DEPLOYED TAOS_DEF_ERROR_CODE(0, 0x0431) +#define TSDB_CODE_DND_QNODE_ID_INVALID TAOS_DEF_ERROR_CODE(0, 0x0432) +#define TSDB_CODE_DND_QNODE_ID_NOT_FOUND TAOS_DEF_ERROR_CODE(0, 0x0433) +#define TSDB_CODE_DND_QNODE_READ_FILE_ERROR TAOS_DEF_ERROR_CODE(0, 0x0434) +#define TSDB_CODE_DND_QNODE_WRITE_FILE_ERROR TAOS_DEF_ERROR_CODE(0, 0x0435) +#define TSDB_CODE_DND_SNODE_ALREADY_DEPLOYED TAOS_DEF_ERROR_CODE(0, 0x0440) +#define TSDB_CODE_DND_SNODE_NOT_DEPLOYED TAOS_DEF_ERROR_CODE(0, 0x0441) +#define TSDB_CODE_DND_SNODE_ID_INVALID TAOS_DEF_ERROR_CODE(0, 0x0442) +#define TSDB_CODE_DND_SNODE_ID_NOT_FOUND TAOS_DEF_ERROR_CODE(0, 0x0443) +#define TSDB_CODE_DND_SNODE_READ_FILE_ERROR TAOS_DEF_ERROR_CODE(0, 0x0444) +#define TSDB_CODE_DND_SNODE_WRITE_FILE_ERROR TAOS_DEF_ERROR_CODE(0, 0x0445) +#define TSDB_CODE_DND_BNODE_ALREADY_DEPLOYED TAOS_DEF_ERROR_CODE(0, 0x0450) +#define TSDB_CODE_DND_BNODE_NOT_DEPLOYED TAOS_DEF_ERROR_CODE(0, 0x0451) +#define TSDB_CODE_DND_BNODE_ID_INVALID TAOS_DEF_ERROR_CODE(0, 0x0452) +#define TSDB_CODE_DND_BNODE_ID_NOT_FOUND TAOS_DEF_ERROR_CODE(0, 0x0453) +#define TSDB_CODE_DND_BNODE_READ_FILE_ERROR TAOS_DEF_ERROR_CODE(0, 0x0454) +#define TSDB_CODE_DND_BNODE_WRITE_FILE_ERROR TAOS_DEF_ERROR_CODE(0, 0x0455) +#define TSDB_CODE_DND_VNODE_TOO_MANY_VNODES TAOS_DEF_ERROR_CODE(0, 0x0460) +#define TSDB_CODE_DND_VNODE_READ_FILE_ERROR TAOS_DEF_ERROR_CODE(0, 0x0461) +#define TSDB_CODE_DND_VNODE_WRITE_FILE_ERROR TAOS_DEF_ERROR_CODE(0, 0x0462) // vnode #define TSDB_CODE_VND_ACTION_IN_PROGRESS TAOS_DEF_ERROR_CODE(0, 0x0500) //"Action in progress") @@ -377,132 +396,6 @@ int32_t* taosGetErrno(); #define TSDB_CODE_WAL_FILE_CORRUPTED TAOS_DEF_ERROR_CODE(0, 0x1001) //"WAL file is corrupted") #define TSDB_CODE_WAL_SIZE_LIMIT TAOS_DEF_ERROR_CODE(0, 0x1002) //"WAL size exceeds limit") -// http -#define TSDB_CODE_HTTP_SERVER_OFFLINE TAOS_DEF_ERROR_CODE(0, 0x1100) //"http server is not onlin") -#define TSDB_CODE_HTTP_UNSUPPORT_URL TAOS_DEF_ERROR_CODE(0, 0x1101) //"url is not support") -#define TSDB_CODE_HTTP_INVALID_URL TAOS_DEF_ERROR_CODE(0, 0x1102) //invalid url format") -#define TSDB_CODE_HTTP_NO_ENOUGH_MEMORY TAOS_DEF_ERROR_CODE(0, 0x1103) //"no enough memory") -#define TSDB_CODE_HTTP_REQUSET_TOO_BIG TAOS_DEF_ERROR_CODE(0, 0x1104) //"request size is too big") -#define TSDB_CODE_HTTP_NO_AUTH_INFO TAOS_DEF_ERROR_CODE(0, 0x1105) //"no auth info input") -#define TSDB_CODE_HTTP_NO_MSG_INPUT TAOS_DEF_ERROR_CODE(0, 0x1106) //"request is empty") -#define TSDB_CODE_HTTP_NO_SQL_INPUT TAOS_DEF_ERROR_CODE(0, 0x1107) //"no sql input") -#define TSDB_CODE_HTTP_NO_EXEC_USEDB TAOS_DEF_ERROR_CODE(0, 0x1108) //"no need to execute use db cmd") -#define TSDB_CODE_HTTP_SESSION_FULL TAOS_DEF_ERROR_CODE(0, 0x1109) //"session list was full") -#define TSDB_CODE_HTTP_GEN_TAOSD_TOKEN_ERR TAOS_DEF_ERROR_CODE(0, 0x110A) //"generate taosd token error") -#define TSDB_CODE_HTTP_INVALID_MULTI_REQUEST TAOS_DEF_ERROR_CODE(0, 0x110B) //"size of multi request is 0") -#define TSDB_CODE_HTTP_CREATE_GZIP_FAILED TAOS_DEF_ERROR_CODE(0, 0x110C) //"failed to create gzip") -#define TSDB_CODE_HTTP_FINISH_GZIP_FAILED TAOS_DEF_ERROR_CODE(0, 0x110D) //"failed to finish gzip") -#define TSDB_CODE_HTTP_LOGIN_FAILED TAOS_DEF_ERROR_CODE(0, 0x110E) //"failed to login") - -#define TSDB_CODE_HTTP_INVALID_VERSION TAOS_DEF_ERROR_CODE(0, 0x1120) //"invalid http version") -#define TSDB_CODE_HTTP_INVALID_CONTENT_LENGTH TAOS_DEF_ERROR_CODE(0, 0x1121) //"invalid content length") -#define TSDB_CODE_HTTP_INVALID_AUTH_TYPE TAOS_DEF_ERROR_CODE(0, 0x1122) //"invalid type of Authorization") -#define TSDB_CODE_HTTP_INVALID_AUTH_FORMAT TAOS_DEF_ERROR_CODE(0, 0x1123) //"invalid format of Authorization") -#define TSDB_CODE_HTTP_INVALID_BASIC_AUTH TAOS_DEF_ERROR_CODE(0, 0x1124) //"invalid basic Authorization") -#define TSDB_CODE_HTTP_INVALID_TAOSD_AUTH TAOS_DEF_ERROR_CODE(0, 0x1125) //"invalid taosd Authorization") -#define TSDB_CODE_HTTP_PARSE_METHOD_FAILED TAOS_DEF_ERROR_CODE(0, 0x1126) //"failed to parse method") -#define TSDB_CODE_HTTP_PARSE_TARGET_FAILED TAOS_DEF_ERROR_CODE(0, 0x1127) //"failed to parse target") -#define TSDB_CODE_HTTP_PARSE_VERSION_FAILED TAOS_DEF_ERROR_CODE(0, 0x1128) //"failed to parse http version") -#define TSDB_CODE_HTTP_PARSE_SP_FAILED TAOS_DEF_ERROR_CODE(0, 0x1129) //"failed to parse sp") -#define TSDB_CODE_HTTP_PARSE_STATUS_FAILED TAOS_DEF_ERROR_CODE(0, 0x112A) //"failed to parse status") -#define TSDB_CODE_HTTP_PARSE_PHRASE_FAILED TAOS_DEF_ERROR_CODE(0, 0x112B) //"failed to parse phrase") -#define TSDB_CODE_HTTP_PARSE_CRLF_FAILED TAOS_DEF_ERROR_CODE(0, 0x112C) //"failed to parse crlf") -#define TSDB_CODE_HTTP_PARSE_HEADER_FAILED TAOS_DEF_ERROR_CODE(0, 0x112D) //"failed to parse header") -#define TSDB_CODE_HTTP_PARSE_HEADER_KEY_FAILED TAOS_DEF_ERROR_CODE(0, 0x112E) //"failed to parse header key") -#define TSDB_CODE_HTTP_PARSE_HEADER_VAL_FAILED TAOS_DEF_ERROR_CODE(0, 0x112F) //"failed to parse header val") -#define TSDB_CODE_HTTP_PARSE_CHUNK_SIZE_FAILED TAOS_DEF_ERROR_CODE(0, 0x1130) //"failed to parse chunk size") -#define TSDB_CODE_HTTP_PARSE_CHUNK_FAILED TAOS_DEF_ERROR_CODE(0, 0x1131) //"failed to parse chunk") -#define TSDB_CODE_HTTP_PARSE_END_FAILED TAOS_DEF_ERROR_CODE(0, 0x1132) //"failed to parse end section") -#define TSDB_CODE_HTTP_PARSE_INVALID_STATE TAOS_DEF_ERROR_CODE(0, 0x1134) //"invalid parse state") -#define TSDB_CODE_HTTP_PARSE_ERROR_STATE TAOS_DEF_ERROR_CODE(0, 0x1135) //"failed to parse error section") - -#define TSDB_CODE_HTTP_GC_QUERY_NULL TAOS_DEF_ERROR_CODE(0, 0x1150) //"query size is 0") -#define TSDB_CODE_HTTP_GC_QUERY_SIZE TAOS_DEF_ERROR_CODE(0, 0x1151) //"query size can not more than 100") -#define TSDB_CODE_HTTP_GC_REQ_PARSE_ERROR TAOS_DEF_ERROR_CODE(0, 0x1152) //"parse grafana json error") - -#define TSDB_CODE_HTTP_TG_DB_NOT_INPUT TAOS_DEF_ERROR_CODE(0, 0x1160) //"database name can not be null") -#define TSDB_CODE_HTTP_TG_DB_TOO_LONG TAOS_DEF_ERROR_CODE(0, 0x1161) //"database name too long") -#define TSDB_CODE_HTTP_TG_INVALID_JSON TAOS_DEF_ERROR_CODE(0, 0x1162) //"invalid telegraf json fromat") -#define TSDB_CODE_HTTP_TG_METRICS_NULL TAOS_DEF_ERROR_CODE(0, 0x1163) //"metrics size is 0") -#define TSDB_CODE_HTTP_TG_METRICS_SIZE TAOS_DEF_ERROR_CODE(0, 0x1164) //"metrics size can not more than 1K") -#define TSDB_CODE_HTTP_TG_METRIC_NULL TAOS_DEF_ERROR_CODE(0, 0x1165) //"metric name not find") -#define TSDB_CODE_HTTP_TG_METRIC_TYPE TAOS_DEF_ERROR_CODE(0, 0x1166) //"metric name type should be string") -#define TSDB_CODE_HTTP_TG_METRIC_NAME_NULL TAOS_DEF_ERROR_CODE(0, 0x1167) //"metric name length is 0") -#define TSDB_CODE_HTTP_TG_METRIC_NAME_LONG TAOS_DEF_ERROR_CODE(0, 0x1168) //"metric name length too long") -#define TSDB_CODE_HTTP_TG_TIMESTAMP_NULL TAOS_DEF_ERROR_CODE(0, 0x1169) //"timestamp not find") -#define TSDB_CODE_HTTP_TG_TIMESTAMP_TYPE TAOS_DEF_ERROR_CODE(0, 0x116A) //"timestamp type should be integer") -#define TSDB_CODE_HTTP_TG_TIMESTAMP_VAL_NULL TAOS_DEF_ERROR_CODE(0, 0x116B) //"timestamp value smaller than 0") -#define TSDB_CODE_HTTP_TG_TAGS_NULL TAOS_DEF_ERROR_CODE(0, 0x116C) //"tags not find") -#define TSDB_CODE_HTTP_TG_TAGS_SIZE_0 TAOS_DEF_ERROR_CODE(0, 0x116D) //"tags size is 0") -#define TSDB_CODE_HTTP_TG_TAGS_SIZE_LONG TAOS_DEF_ERROR_CODE(0, 0x116E) //"tags size too long") -#define TSDB_CODE_HTTP_TG_TAG_NULL TAOS_DEF_ERROR_CODE(0, 0x116F) //"tag is null") -#define TSDB_CODE_HTTP_TG_TAG_NAME_NULL TAOS_DEF_ERROR_CODE(0, 0x1170) //"tag name is null") -#define TSDB_CODE_HTTP_TG_TAG_NAME_SIZE TAOS_DEF_ERROR_CODE(0, 0x1171) //"tag name length too long") -#define TSDB_CODE_HTTP_TG_TAG_VALUE_TYPE TAOS_DEF_ERROR_CODE(0, 0x1172) //"tag value type should be number or string") -#define TSDB_CODE_HTTP_TG_TAG_VALUE_NULL TAOS_DEF_ERROR_CODE(0, 0x1173) //"tag value is null") -#define TSDB_CODE_HTTP_TG_TABLE_NULL TAOS_DEF_ERROR_CODE(0, 0x1174) //"table is null") -#define TSDB_CODE_HTTP_TG_TABLE_SIZE TAOS_DEF_ERROR_CODE(0, 0x1175) //"table name length too long") -#define TSDB_CODE_HTTP_TG_FIELDS_NULL TAOS_DEF_ERROR_CODE(0, 0x1176) //"fields not find") -#define TSDB_CODE_HTTP_TG_FIELDS_SIZE_0 TAOS_DEF_ERROR_CODE(0, 0x1177) //"fields size is 0") -#define TSDB_CODE_HTTP_TG_FIELDS_SIZE_LONG TAOS_DEF_ERROR_CODE(0, 0x1178) //"fields size too long") -#define TSDB_CODE_HTTP_TG_FIELD_NULL TAOS_DEF_ERROR_CODE(0, 0x1179) //"field is null") -#define TSDB_CODE_HTTP_TG_FIELD_NAME_NULL TAOS_DEF_ERROR_CODE(0, 0x117A) //"field name is null") -#define TSDB_CODE_HTTP_TG_FIELD_NAME_SIZE TAOS_DEF_ERROR_CODE(0, 0x117B) //"field name length too long") -#define TSDB_CODE_HTTP_TG_FIELD_VALUE_TYPE TAOS_DEF_ERROR_CODE(0, 0x117C) //"field value type should be number or string") -#define TSDB_CODE_HTTP_TG_FIELD_VALUE_NULL TAOS_DEF_ERROR_CODE(0, 0x117D) //"field value is null") -#define TSDB_CODE_HTTP_TG_HOST_NOT_STRING TAOS_DEF_ERROR_CODE(0, 0x117E) //"host type should be string") -#define TSDB_CODE_HTTP_TG_STABLE_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x117F) //"stable not exist") - -#define TSDB_CODE_HTTP_OP_DB_NOT_INPUT TAOS_DEF_ERROR_CODE(0, 0x1190) //"database name can not be null") -#define TSDB_CODE_HTTP_OP_DB_TOO_LONG TAOS_DEF_ERROR_CODE(0, 0x1191) //"database name too long") -#define TSDB_CODE_HTTP_OP_INVALID_JSON TAOS_DEF_ERROR_CODE(0, 0x1192) //"invalid opentsdb json fromat") -#define TSDB_CODE_HTTP_OP_METRICS_NULL TAOS_DEF_ERROR_CODE(0, 0x1193) //"metrics size is 0") -#define TSDB_CODE_HTTP_OP_METRICS_SIZE TAOS_DEF_ERROR_CODE(0, 0x1194) //"metrics size can not more than 10K") -#define TSDB_CODE_HTTP_OP_METRIC_NULL TAOS_DEF_ERROR_CODE(0, 0x1195) //"metric name not find") -#define TSDB_CODE_HTTP_OP_METRIC_TYPE TAOS_DEF_ERROR_CODE(0, 0x1196) //"metric name type should be string") -#define TSDB_CODE_HTTP_OP_METRIC_NAME_NULL TAOS_DEF_ERROR_CODE(0, 0x1197) //"metric name length is 0") -#define TSDB_CODE_HTTP_OP_METRIC_NAME_LONG TAOS_DEF_ERROR_CODE(0, 0x1198) //"metric name length can not more than 22") -#define TSDB_CODE_HTTP_OP_TIMESTAMP_NULL TAOS_DEF_ERROR_CODE(0, 0x1199) //"timestamp not find") -#define TSDB_CODE_HTTP_OP_TIMESTAMP_TYPE TAOS_DEF_ERROR_CODE(0, 0x119A) //"timestamp type should be integer") -#define TSDB_CODE_HTTP_OP_TIMESTAMP_VAL_NULL TAOS_DEF_ERROR_CODE(0, 0x119B) //"timestamp value smaller than 0") -#define TSDB_CODE_HTTP_OP_TAGS_NULL TAOS_DEF_ERROR_CODE(0, 0x119C) //"tags not find") -#define TSDB_CODE_HTTP_OP_TAGS_SIZE_0 TAOS_DEF_ERROR_CODE(0, 0x119D) //"tags size is 0") -#define TSDB_CODE_HTTP_OP_TAGS_SIZE_LONG TAOS_DEF_ERROR_CODE(0, 0x119E) //"tags size too long") -#define TSDB_CODE_HTTP_OP_TAG_NULL TAOS_DEF_ERROR_CODE(0, 0x119F) //"tag is null") -#define TSDB_CODE_HTTP_OP_TAG_NAME_NULL TAOS_DEF_ERROR_CODE(0, 0x11A0) //"tag name is null") -#define TSDB_CODE_HTTP_OP_TAG_NAME_SIZE TAOS_DEF_ERROR_CODE(0, 0x11A1) //"tag name length too long") -#define TSDB_CODE_HTTP_OP_TAG_VALUE_TYPE TAOS_DEF_ERROR_CODE(0, 0x11A2) //"tag value type should be boolean number or string") -#define TSDB_CODE_HTTP_OP_TAG_VALUE_NULL TAOS_DEF_ERROR_CODE(0, 0x11A3) //"tag value is null") -#define TSDB_CODE_HTTP_OP_TAG_VALUE_TOO_LONG TAOS_DEF_ERROR_CODE(0, 0x11A4) //"tag value can not more than 64") -#define TSDB_CODE_HTTP_OP_VALUE_NULL TAOS_DEF_ERROR_CODE(0, 0x11A5) //"value not find") -#define TSDB_CODE_HTTP_OP_VALUE_TYPE TAOS_DEF_ERROR_CODE(0, 0x11A6) //"value type should be boolean number or string") - -#define TSDB_CODE_HTTP_REQUEST_JSON_ERROR TAOS_DEF_ERROR_CODE(0, 0x1F00) //"http request json error") - -// odbc -#define TSDB_CODE_ODBC_OOM TAOS_DEF_ERROR_CODE(0, 0x2100) //"out of memory") -#define TSDB_CODE_ODBC_CONV_CHAR_NOT_NUM TAOS_DEF_ERROR_CODE(0, 0x2101) //"convertion not a valid literal input") -#define TSDB_CODE_ODBC_CONV_UNDEF TAOS_DEF_ERROR_CODE(0, 0x2102) //"convertion undefined") -#define TSDB_CODE_ODBC_CONV_TRUNC_FRAC TAOS_DEF_ERROR_CODE(0, 0x2103) //"convertion fractional truncated") -#define TSDB_CODE_ODBC_CONV_TRUNC TAOS_DEF_ERROR_CODE(0, 0x2104) //"convertion truncated") -#define TSDB_CODE_ODBC_CONV_NOT_SUPPORT TAOS_DEF_ERROR_CODE(0, 0x2105) //"convertion not supported") -#define TSDB_CODE_ODBC_CONV_OOR TAOS_DEF_ERROR_CODE(0, 0x2106) //"convertion numeric value out of range") -#define TSDB_CODE_ODBC_OUT_OF_RANGE TAOS_DEF_ERROR_CODE(0, 0x2107) //"out of range") -#define TSDB_CODE_ODBC_NOT_SUPPORT TAOS_DEF_ERROR_CODE(0, 0x2108) //"not supported yet") -#define TSDB_CODE_ODBC_INVALID_HANDLE TAOS_DEF_ERROR_CODE(0, 0x2109) //"invalid handle") -#define TSDB_CODE_ODBC_NO_RESULT TAOS_DEF_ERROR_CODE(0, 0x210a) //"no result set") -#define TSDB_CODE_ODBC_NO_FIELDS TAOS_DEF_ERROR_CODE(0, 0x210b) //"no fields returned") -#define TSDB_CODE_ODBC_INVALID_CURSOR TAOS_DEF_ERROR_CODE(0, 0x210c) //"invalid cursor") -#define TSDB_CODE_ODBC_STATEMENT_NOT_READY TAOS_DEF_ERROR_CODE(0, 0x210d) //"statement not ready") -#define TSDB_CODE_ODBC_CONNECTION_BUSY TAOS_DEF_ERROR_CODE(0, 0x210e) //"connection still busy") -#define TSDB_CODE_ODBC_BAD_CONNSTR TAOS_DEF_ERROR_CODE(0, 0x210f) //"bad connection string") -#define TSDB_CODE_ODBC_BAD_ARG TAOS_DEF_ERROR_CODE(0, 0x2110) //"bad argument") -#define TSDB_CODE_ODBC_CONV_NOT_VALID_TS TAOS_DEF_ERROR_CODE(0, 0x2111) //"not a valid timestamp") -#define TSDB_CODE_ODBC_CONV_SRC_TOO_LARGE TAOS_DEF_ERROR_CODE(0, 0x2112) //"src too large") -#define TSDB_CODE_ODBC_CONV_SRC_BAD_SEQ TAOS_DEF_ERROR_CODE(0, 0x2113) //"src bad sequence") -#define TSDB_CODE_ODBC_CONV_SRC_INCOMPLETE TAOS_DEF_ERROR_CODE(0, 0x2114) //"src incomplete") -#define TSDB_CODE_ODBC_CONV_SRC_GENERAL TAOS_DEF_ERROR_CODE(0, 0x2115) //"src general") - // tfs #define TSDB_CODE_FS_OUT_OF_MEMORY TAOS_DEF_ERROR_CODE(0, 0x2200) //"tfs out of memory") #define TSDB_CODE_FS_INVLD_CFG TAOS_DEF_ERROR_CODE(0, 0x2201) //"tfs invalid mount config") diff --git a/include/util/tdef.h b/include/util/tdef.h index 64a169b4f1..5edd0549f0 100644 --- a/include/util/tdef.h +++ b/include/util/tdef.h @@ -204,7 +204,7 @@ do { \ #define TSDB_CLUSTER_ID_LEN 40 #define TSDB_FQDN_LEN 128 -#define TSDB_EP_LEN (TSDB_FQDN_LEN+6) +#define TSDB_EP_LEN (TSDB_FQDN_LEN + 6) #define TSDB_IPv4ADDR_LEN 16 #define TSDB_FILENAME_LEN 128 #define TSDB_SHOW_SQL_LEN 512 diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index 0ee99f77aa..da10332652 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -152,6 +152,7 @@ int32_t parseSql(SRequestObj* pRequest, SQueryNode** pQuery) { .pMsg = pRequest->msgBuf, .msgLen = ERROR_MSG_BUF_DEFAULT_SIZE }; + int32_t code = qParseQuerySql(&cxt, pQuery); tfree(cxt.ctx.db); return code; @@ -361,30 +362,6 @@ static void destroySendMsgInfo(SMsgSendInfo* pMsgBody) { tfree(pMsgBody); } -int32_t asyncSendMsgToServer(void *pTransporter, SEpSet* epSet, int64_t* pTransporterId, const SMsgSendInfo* pInfo) { - char *pMsg = rpcMallocCont(pInfo->msgInfo.len); - if (NULL == pMsg) { - tscError("0x%"PRIx64" msg:%s malloc failed", pInfo->requestId, TMSG_INFO(pInfo->msgType)); - terrno = TSDB_CODE_TSC_OUT_OF_MEMORY; - return -1; - } - - memcpy(pMsg, pInfo->msgInfo.pData, pInfo->msgInfo.len); - SRpcMsg rpcMsg = { - .msgType = pInfo->msgType, - .pCont = pMsg, - .contLen = pInfo->msgInfo.len, - .ahandle = (void*) pInfo, - .handle = NULL, - .code = 0 - }; - - assert(pInfo->fp != NULL); - - rpcSendRequest(pTransporter, epSet, &rpcMsg, pTransporterId); - return TSDB_CODE_SUCCESS; -} - void processMsgFromServer(void* parent, SRpcMsg* pMsg, SEpSet* pEpSet) { SMsgSendInfo *pSendInfo = (SMsgSendInfo *) pMsg->ahandle; assert(pMsg->ahandle != NULL); @@ -420,7 +397,15 @@ void processMsgFromServer(void* parent, SRpcMsg* pMsg, SEpSet* pEpSet) { taosReleaseRef(clientReqRefPool, pSendInfo->requestObjRefId); } - SDataBuf buf = {.pData = pMsg->pCont, .len = pMsg->contLen}; + SDataBuf buf = {.len = pMsg->contLen}; + buf.pData = calloc(1, pMsg->contLen); + if (buf.pData == NULL) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + pMsg->code = TSDB_CODE_OUT_OF_MEMORY; + } else { + memcpy(buf.pData, pMsg->pCont, pMsg->contLen); + } + pSendInfo->fp(pSendInfo->param, &buf, pMsg->code); rpcFreeCont(pMsg->pCont); } diff --git a/source/client/src/clientMsgHandler.c b/source/client/src/clientMsgHandler.c index bdf54eb21c..b46304e622 100644 --- a/source/client/src/clientMsgHandler.c +++ b/source/client/src/clientMsgHandler.c @@ -99,10 +99,10 @@ SMsgSendInfo* buildSendMsgInfoImpl(SRequestObj *pRequest) { } else { assert(pRequest != NULL); pMsgSendInfo->requestObjRefId = pRequest->self; - pMsgSendInfo->msgInfo = pRequest->body.requestMsg; - pMsgSendInfo->msgType = pRequest->type; + pMsgSendInfo->msgInfo = pRequest->body.requestMsg; + pMsgSendInfo->msgType = pRequest->type; pMsgSendInfo->requestId = pRequest->requestId; - pMsgSendInfo->param = pRequest; + pMsgSendInfo->param = pRequest; pMsgSendInfo->fp = (handleRequestRspFp[pRequest->type] == NULL)? genericRspCallback:handleRequestRspFp[pRequest->type]; } @@ -165,8 +165,11 @@ int32_t processRetrieveMnodeRsp(void* param, const SDataBuf* pMsg, int32_t code) pRetrieve->precision = htons(pRetrieve->precision); SReqResultInfo* pResInfo = &pRequest->body.resInfo; + + tfree(pResInfo->pRspMsg); + pResInfo->pRspMsg = pMsg->pData; pResInfo->numOfRows = pRetrieve->numOfRows; - pResInfo->pData = pRetrieve->data; // todo fix this in async model + pResInfo->pData = pRetrieve->data; // todo fix this in async model pResInfo->current = 0; setResultDataPtr(pResInfo, pResInfo->fields, pResInfo->numOfCols, pResInfo->numOfRows); diff --git a/source/client/test/clientTests.cpp b/source/client/test/clientTests.cpp index d14719fffb..83d0e61eb3 100644 --- a/source/client/test/clientTests.cpp +++ b/source/client/test/clientTests.cpp @@ -50,13 +50,13 @@ int main(int argc, char** argv) { TEST(testCase, driverInit_Test) { taos_init(); } TEST(testCase, connect_Test) { - TAOS* pConn = taos_connect("ubuntu", "root", "taosdata", NULL, 0); + TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0); assert(pConn != NULL); taos_close(pConn); } TEST(testCase, create_user_Test) { - TAOS* pConn = taos_connect("ubuntu", "root", "taosdata", NULL, 0); + TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0); assert(pConn != NULL); TAOS_RES* pRes = taos_query(pConn, "create user abc pass 'abc'"); @@ -69,7 +69,7 @@ TEST(testCase, create_user_Test) { } TEST(testCase, create_account_Test) { - TAOS* pConn = taos_connect("ubuntu", "root", "taosdata", NULL, 0); + TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0); assert(pConn != NULL); TAOS_RES* pRes = taos_query(pConn, "create account aabc pass 'abc'"); @@ -82,7 +82,7 @@ TEST(testCase, create_account_Test) { } TEST(testCase, drop_account_Test) { - TAOS* pConn = taos_connect("ubuntu", "root", "taosdata", NULL, 0); + TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0); assert(pConn != NULL); TAOS_RES* pRes = taos_query(pConn, "drop account aabc"); @@ -95,7 +95,7 @@ TEST(testCase, drop_account_Test) { } TEST(testCase, show_user_Test) { - TAOS* pConn = taos_connect("ubuntu", "root", "taosdata", NULL, 0); + TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0); assert(pConn != NULL); TAOS_RES* pRes = taos_query(pConn, "show users"); @@ -114,7 +114,7 @@ TEST(testCase, show_user_Test) { } TEST(testCase, drop_user_Test) { - TAOS* pConn = taos_connect("ubuntu", "root", "taosdata", NULL, 0); + TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0); assert(pConn != NULL); TAOS_RES* pRes = taos_query(pConn, "drop user abc"); @@ -127,7 +127,7 @@ TEST(testCase, drop_user_Test) { } TEST(testCase, show_db_Test) { - TAOS* pConn = taos_connect("ubuntu", "root", "taosdata", NULL, 0); + TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0); // assert(pConn != NULL); TAOS_RES* pRes = taos_query(pConn, "show databases"); @@ -146,7 +146,7 @@ TEST(testCase, show_db_Test) { } TEST(testCase, create_db_Test) { - TAOS* pConn = taos_connect("ubuntu", "root", "taosdata", NULL, 0); + TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0); assert(pConn != NULL); TAOS_RES* pRes = taos_query(pConn, "create database abc1"); @@ -169,8 +169,46 @@ TEST(testCase, create_db_Test) { taos_close(pConn); } +TEST(testCase, create_dnode_Test) { + TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0); + assert(pConn != NULL); + + TAOS_RES* pRes = taos_query(pConn, "create dnode abc1 port 7000"); + if (taos_errno(pRes) != 0) { + printf("error in create dnode, reason:%s\n", taos_errstr(pRes)); + } + + TAOS_FIELD* pFields = taos_fetch_fields(pRes); + ASSERT_TRUE(pFields == NULL); + + int32_t numOfFields = taos_num_fields(pRes); + ASSERT_EQ(numOfFields, 0); + + taos_free_result(pRes); + taos_close(pConn); +} + +TEST(testCase, drop_dnode_Test) { + TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0); + assert(pConn != NULL); + + TAOS_RES* pRes = taos_query(pConn, "drop dnode 2"); + if (taos_errno(pRes) != 0) { + printf("error in drop dnode, reason:%s\n", taos_errstr(pRes)); + } + + TAOS_FIELD* pFields = taos_fetch_fields(pRes); + ASSERT_TRUE(pFields == NULL); + + int32_t numOfFields = taos_num_fields(pRes); + ASSERT_EQ(numOfFields, 0); + + taos_free_result(pRes); + taos_close(pConn); +} + TEST(testCase, use_db_test) { - TAOS* pConn = taos_connect("ubuntu", "root", "taosdata", NULL, 0); + TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0); assert(pConn != NULL); TAOS_RES* pRes = taos_query(pConn, "use abc1"); @@ -188,7 +226,7 @@ TEST(testCase, use_db_test) { } TEST(testCase, drop_db_test) { - TAOS* pConn = taos_connect("ubuntu", "root", "taosdata", NULL, 0); + TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0); assert(pConn != NULL); showDB(pConn); @@ -210,7 +248,7 @@ TEST(testCase, drop_db_test) { } TEST(testCase, create_stable_Test) { - TAOS* pConn = taos_connect("ubuntu", "root", "taosdata", NULL, 0); + TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0); assert(pConn != NULL); TAOS_RES* pRes = taos_query(pConn, "create database abc1"); @@ -241,7 +279,7 @@ TEST(testCase, drop_db_test) { } TEST(testCase, create_table_Test) { - // TAOS* pConn = taos_connect("ubuntu", "root", "taosdata", NULL, 0); + // TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0); // assert(pConn != NULL); // // TAOS_RES* pRes = taos_query(pConn, "use abc1"); @@ -253,10 +291,27 @@ TEST(testCase, create_table_Test) { // taos_close(pConn); } -TEST(testCase, create_ctable_Test) {} +TEST(testCase, create_ctable_Test) { + TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0); + assert(pConn != NULL); + + TAOS_RES* pRes = taos_query(pConn, "use abc1"); + if (taos_errno(pRes) != 0) { + printf("failed to use db, reason:%s\n", taos_errstr(pRes)); + } + taos_free_result(pRes); + + pRes = taos_query(pConn, "create table tm0 using st1 tags(1)"); + if (taos_errno(pRes) != 0) { + printf("failed to create child table tm0, reason:%s\n", taos_errstr(pRes)); + } + + taos_free_result(pRes); + taos_close(pConn); +} TEST(testCase, show_stable_Test) { - TAOS* pConn = taos_connect("ubuntu", "root", "taosdata", NULL, 0); + TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0); assert(pConn != NULL); TAOS_RES* pRes = taos_query(pConn, "use abc1"); @@ -273,7 +328,6 @@ TEST(testCase, show_stable_Test) { } TAOS_ROW pRow = NULL; - TAOS_FIELD* pFields = taos_fetch_fields(pRes); int32_t numOfFields = taos_num_fields(pRes); @@ -284,12 +338,11 @@ TEST(testCase, show_stable_Test) { } taos_free_result(pRes); - taos_close(pConn); } TEST(testCase, show_vgroup_Test) { - TAOS* pConn = taos_connect("ubuntu", "root", "taosdata", NULL, 0); + TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0); assert(pConn != NULL); TAOS_RES* pRes = taos_query(pConn, "use abc1"); @@ -322,7 +375,7 @@ TEST(testCase, show_vgroup_Test) { } TEST(testCase, drop_stable_Test) { - TAOS* pConn = taos_connect("ubuntu", "root", "taosdata", NULL, 0); + TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0); assert(pConn != NULL); TAOS_RES* pRes = taos_query(pConn, "create database abc1"); @@ -347,7 +400,7 @@ TEST(testCase, drop_stable_Test) { } //TEST(testCase, show_table_Test) { -// TAOS* pConn = taos_connect("ubuntu", "root", "taosdata", NULL, 0); +// TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0); // assert(pConn != NULL); // // TAOS_RES* pRes = taos_query(pConn, "use abc1"); diff --git a/source/dnode/CMakeLists.txt b/source/dnode/CMakeLists.txt index af132dea80..87e4c5fc46 100644 --- a/source/dnode/CMakeLists.txt +++ b/source/dnode/CMakeLists.txt @@ -1,4 +1,6 @@ add_subdirectory(mnode) add_subdirectory(vnode) add_subdirectory(qnode) +add_subdirectory(snode) +add_subdirectory(bnode) add_subdirectory(mgmt) \ No newline at end of file diff --git a/source/dnode/bnode/CMakeLists.txt b/source/dnode/bnode/CMakeLists.txt new file mode 100644 index 0000000000..a284437450 --- /dev/null +++ b/source/dnode/bnode/CMakeLists.txt @@ -0,0 +1,14 @@ +aux_source_directory(src BNODE_SRC) +add_library(bnode ${BNODE_SRC}) +target_include_directories( + bnode + PUBLIC "${CMAKE_SOURCE_DIR}/include/dnode/bnode" + private "${CMAKE_CURRENT_SOURCE_DIR}/inc" +) +target_link_libraries( + bnode + PRIVATE transport + PRIVATE os + PRIVATE common + PRIVATE util +) \ No newline at end of file diff --git a/source/dnode/bnode/inc/bndInt.h b/source/dnode/bnode/inc/bndInt.h new file mode 100644 index 0000000000..d44c520a26 --- /dev/null +++ b/source/dnode/bnode/inc/bndInt.h @@ -0,0 +1,45 @@ +/* + * 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 _TD_BNODE_INT_H_ +#define _TD_BNODE_INT_H_ + +#include "os.h" + +#include "tarray.h" +#include "tlog.h" +#include "tmsg.h" +#include "trpc.h" + +#include "bnode.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct SBnode { + int32_t dnodeId; + int64_t clusterId; + SBnodeCfg cfg; + SendMsgToDnodeFp sendMsgToDnodeFp; + SendMsgToMnodeFp sendMsgToMnodeFp; + SendRedirectMsgFp sendRedirectMsgFp; +} SBnode; + +#ifdef __cplusplus +} +#endif + +#endif /*_TD_BNODE_INT_H_*/ \ No newline at end of file diff --git a/source/dnode/bnode/src/bnode.c b/source/dnode/bnode/src/bnode.c new file mode 100644 index 0000000000..40b22dd58d --- /dev/null +++ b/source/dnode/bnode/src/bnode.c @@ -0,0 +1,27 @@ +/* + * 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 . + */ + +#include "bndInt.h" + +SBnode *bndOpen(const SBnodeOpt *pOption) { + SBnode *pBnode = calloc(1, sizeof(SBnode)); + return pBnode; +} + +void bndClose(SBnode *pBnode) { free(pBnode); } + +int32_t bndGetLoad(SBnode *pBnode, SBnodeLoad *pLoad) { return 0; } + +int32_t bndProcessWMsgs(SBnode *pBnode, SArray *pMsgs) { return 0; } diff --git a/source/dnode/mgmt/daemon/src/daemon.c b/source/dnode/mgmt/daemon/src/daemon.c index 75c2ff00e0..6c4fae406e 100644 --- a/source/dnode/mgmt/daemon/src/daemon.c +++ b/source/dnode/mgmt/daemon/src/daemon.c @@ -140,6 +140,7 @@ void dmnInitOption(SDnodeOpt *pOption) { pOption->sver = 30000000; //3.0.0.0 pOption->numOfCores = tsNumOfCores; pOption->numOfSupportVnodes = 1; + pOption->numOfCommitThreads = 1; pOption->statusInterval = tsStatusInterval; pOption->numOfThreadsPerCore = tsNumOfThreadsPerCore; pOption->ratioOfQueryCores = tsRatioOfQueryCores; diff --git a/source/dnode/mgmt/impl/CMakeLists.txt b/source/dnode/mgmt/impl/CMakeLists.txt index 51131ede6a..866eced51a 100644 --- a/source/dnode/mgmt/impl/CMakeLists.txt +++ b/source/dnode/mgmt/impl/CMakeLists.txt @@ -5,6 +5,9 @@ target_link_libraries( PUBLIC cjson PUBLIC mnode PUBLIC vnode + PUBLIC qnode + PUBLIC snode + PUBLIC bnode PUBLIC wal PUBLIC sync PUBLIC taos diff --git a/source/dnode/mgmt/impl/inc/dndBnode.h b/source/dnode/mgmt/impl/inc/dndBnode.h new file mode 100644 index 0000000000..a350eae2d4 --- /dev/null +++ b/source/dnode/mgmt/impl/inc/dndBnode.h @@ -0,0 +1,35 @@ +/* + * 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 _TD_DND_BNODE_H_ +#define _TD_DND_BNODE_H_ + +#ifdef __cplusplus +extern "C" { +#endif +#include "dndInt.h" + +int32_t dndInitBnode(SDnode *pDnode); +void dndCleanupBnode(SDnode *pDnode); + +ioid dndProcessBnodeWriteMsg(SDnode *pDnode, SRpcMsg *pMsg, SEpSet *pEpSet); +int32_t dndProcessCreateBnodeReq(SDnode *pDnode, SRpcMsg *pRpcMsg); +int32_t dndProcessDropBnodeReq(SDnode *pDnode, SRpcMsg *pRpcMsg); + +#ifdef __cplusplus +} +#endif + +#endif /*_TD_DND_BNODE_H_*/ \ No newline at end of file diff --git a/source/dnode/mgmt/impl/inc/dndInt.h b/source/dnode/mgmt/impl/inc/dndInt.h index d6e9a6b4a1..0d37828ecd 100644 --- a/source/dnode/mgmt/impl/inc/dndInt.h +++ b/source/dnode/mgmt/impl/inc/dndInt.h @@ -20,8 +20,11 @@ extern "C" { #endif -#include "cJSON.h" #include "os.h" + +#include "cJSON.h" +#include "tcache.h" +#include "tcrc32c.h" #include "tep.h" #include "thash.h" #include "tlockfree.h" @@ -34,7 +37,11 @@ extern "C" { #include "tworker.h" #include "dnode.h" + +#include "bnode.h" #include "mnode.h" +#include "qnode.h" +#include "snode.h" #include "vnode.h" extern int32_t dDebugFlag; @@ -47,12 +54,23 @@ extern int32_t dDebugFlag; #define dTrace(...) { if (dDebugFlag & DEBUG_TRACE) { taosPrintLog("DND ", dDebugFlag, __VA_ARGS__); }} typedef enum { DND_STAT_INIT, DND_STAT_RUNNING, DND_STAT_STOPPED } EStat; +typedef enum { DND_WORKER_SINGLE, DND_WORKER_MULTI } EDndWorkerType; typedef void (*DndMsgFp)(SDnode *pDnode, SRpcMsg *pMsg, SEpSet *pEps); +typedef struct { + EDndWorkerType type; + const char *name; + int32_t minNum; + int32_t maxNum; + FProcessItem fp; + SDnode *pDnode; + taos_queue queue; + SWorkerPool pool; +} SDnodeWorker; + typedef struct { char *dnode; char *mnode; - char *qnode; char *snode; char *bnode; char *vnodes; @@ -93,6 +111,38 @@ typedef struct { SWorkerPool syncPool; } SMnodeMgmt; +typedef struct { + int32_t refCount; + int8_t deployed; + int8_t dropped; + SQnode *pQnode; + SRWLatch latch; + SDnodeWorker queryWorker; + SDnodeWorker fetchWorker; +} SQnodeMgmt; + +typedef struct { + int32_t refCount; + int8_t deployed; + int8_t dropped; + char *file; + SSnode *pSnode; + SRWLatch latch; + taos_queue pWriteQ; + SWorkerPool writePool; +} SSnodeMgmt; + +typedef struct { + int32_t refCount; + int8_t deployed; + int8_t dropped; + char *file; + SBnode *pBnode; + SRWLatch latch; + taos_queue pWriteQ; + SMWorkerPool writePool; +} SBnodeMgmt; + typedef struct { SHashObj *hash; int32_t openVnodes; @@ -117,6 +167,9 @@ typedef struct SDnode { FileFd lockFd; SDnodeMgmt dmgmt; SMnodeMgmt mmgmt; + SQnodeMgmt qmgmt; + SSnodeMgmt smgmt; + SBnodeMgmt bmgmt; SVnodesMgmt vmgmt; STransMgmt tmgmt; SStartupMsg startup; diff --git a/source/dnode/mgmt/impl/inc/dndQnode.h b/source/dnode/mgmt/impl/inc/dndQnode.h new file mode 100644 index 0000000000..677c234679 --- /dev/null +++ b/source/dnode/mgmt/impl/inc/dndQnode.h @@ -0,0 +1,36 @@ +/* + * 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 _TD_DND_QNODE_H_ +#define _TD_DND_QNODE_H_ + +#ifdef __cplusplus +extern "C" { +#endif +#include "dndInt.h" + +int32_t dndInitQnode(SDnode *pDnode); +void dndCleanupQnode(SDnode *pDnode); + +void dndProcessQnodeQueryMsg(SDnode *pDnode, SRpcMsg *pMsg, SEpSet *pEpSet); +void dndProcessQnodeFetchMsg(SDnode *pDnode, SRpcMsg *pMsg, SEpSet *pEpSet); +int32_t dndProcessCreateQnodeReq(SDnode *pDnode, SRpcMsg *pRpcMsg); +int32_t dndProcessDropQnodeReq(SDnode *pDnode, SRpcMsg *pRpcMsg); + +#ifdef __cplusplus +} +#endif + +#endif /*_TD_DND_QNODE_H_*/ \ No newline at end of file diff --git a/source/dnode/mgmt/impl/inc/dndSnode.h b/source/dnode/mgmt/impl/inc/dndSnode.h new file mode 100644 index 0000000000..8cb883794d --- /dev/null +++ b/source/dnode/mgmt/impl/inc/dndSnode.h @@ -0,0 +1,35 @@ +/* + * 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 _TD_DND_SNODE_H_ +#define _TD_DND_SNODE_H_ + +#ifdef __cplusplus +extern "C" { +#endif +#include "dndInt.h" + +int32_t dndInitSnode(SDnode *pDnode); +void dndCleanupSnode(SDnode *pDnode); + +void dndProcessSnodeWriteMsg(SDnode *pDnode, SRpcMsg *pMsg, SEpSet *pEpSet); +int32_t dndProcessCreateSnodeReq(SDnode *pDnode, SRpcMsg *pRpcMsg); +int32_t dndProcessDropSnodeReq(SDnode *pDnode, SRpcMsg *pRpcMsg); + +#ifdef __cplusplus +} +#endif + +#endif /*_TD_DND_SNODE_H_*/ \ No newline at end of file diff --git a/source/dnode/mgmt/impl/inc/dndWorker.h b/source/dnode/mgmt/impl/inc/dndWorker.h new file mode 100644 index 0000000000..237c0518e8 --- /dev/null +++ b/source/dnode/mgmt/impl/inc/dndWorker.h @@ -0,0 +1,33 @@ +/* + * 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 _TD_DND_WORKER_H_ +#define _TD_DND_WORKER_H_ + +#ifdef __cplusplus +extern "C" { +#endif +#include "dndInt.h" + +int32_t dndInitWorker(SDnode *pDnode, SDnodeWorker *pWorker, EDndWorkerType type, const char *name, int32_t minNum, + int32_t maxNum, FProcessItem fp); +void dndCleanupWorker(SDnodeWorker *pWorker); +int32_t dndWriteMsgToWorker(SDnodeWorker *pWorker, void *pCont, int32_t contLen); + +#ifdef __cplusplus +} +#endif + +#endif /*_TD_DND_WORKER_H_*/ \ No newline at end of file diff --git a/source/dnode/mgmt/impl/src/dndDnode.c b/source/dnode/mgmt/impl/src/dndDnode.c index c67e55f048..ca0552b8ad 100644 --- a/source/dnode/mgmt/impl/src/dndDnode.c +++ b/source/dnode/mgmt/impl/src/dndDnode.c @@ -17,6 +17,7 @@ #include "dndDnode.h" #include "dndTransport.h" #include "dndVnodes.h" +#include "dndMnode.h" static int32_t dndInitMgmtWorker(SDnode *pDnode); static void dndCleanupMgmtWorker(SDnode *pDnode); @@ -28,10 +29,10 @@ static int32_t dndReadDnodes(SDnode *pDnode); static int32_t dndWriteDnodes(SDnode *pDnode); static void *dnodeThreadRoutine(void *param); -static void dndProcessConfigDnodeReq(SDnode *pDnode, SRpcMsg *pMsg); -static void dndProcessStatusRsp(SDnode *pDnode, SRpcMsg *pMsg); -static void dndProcessAuthRsp(SDnode *pDnode, SRpcMsg *pMsg); -static void dndProcessGrantRsp(SDnode *pDnode, SRpcMsg *pMsg); +static int32_t dndProcessConfigDnodeReq(SDnode *pDnode, SRpcMsg *pMsg); +static void dndProcessStatusRsp(SDnode *pDnode, SRpcMsg *pMsg); +static void dndProcessAuthRsp(SDnode *pDnode, SRpcMsg *pMsg); +static void dndProcessGrantRsp(SDnode *pDnode, SRpcMsg *pMsg); int32_t dndGetDnodeId(SDnode *pDnode) { SDnodeMgmt *pMgmt = &pDnode->dmgmt; @@ -458,13 +459,11 @@ static void dndProcessAuthRsp(SDnode *pDnode, SRpcMsg *pMsg) { assert(1); } static void dndProcessGrantRsp(SDnode *pDnode, SRpcMsg *pMsg) { assert(1); } -static void dndProcessConfigDnodeReq(SDnode *pDnode, SRpcMsg *pMsg) { +static int32_t dndProcessConfigDnodeReq(SDnode *pDnode, SRpcMsg *pMsg) { dError("config msg is received, but not supported yet"); SCfgDnodeMsg *pCfg = pMsg->pCont; - int32_t code = TSDB_CODE_OPS_NOT_SUPPORT; - SRpcMsg rspMsg = {.handle = pMsg->handle, .pCont = NULL, .contLen = 0, .code = code}; - rpcSendResponse(&rspMsg); + return TSDB_CODE_OPS_NOT_SUPPORT; } void dndProcessStartupReq(SDnode *pDnode, SRpcMsg *pMsg) { @@ -646,11 +645,8 @@ static void dndProcessMgmtQueue(SDnode *pDnode, SRpcMsg *pMsg) { case TDMT_DND_DROP_MNODE: code = dndProcessDropMnodeReq(pDnode, pMsg); break; - case TDMT_DND_NETWORK_TEST: - dndProcessStartupReq(pDnode, pMsg); - break; case TDMT_DND_CONFIG_DNODE: - dndProcessConfigDnodeReq(pDnode, pMsg); + code = dndProcessConfigDnodeReq(pDnode, pMsg); break; case TDMT_MND_STATUS_RSP: dndProcessStatusRsp(pDnode, pMsg); diff --git a/source/dnode/mgmt/impl/src/dndMnode.c b/source/dnode/mgmt/impl/src/dndMnode.c index 50da49d325..59f809489e 100644 --- a/source/dnode/mgmt/impl/src/dndMnode.c +++ b/source/dnode/mgmt/impl/src/dndMnode.c @@ -796,6 +796,7 @@ void dndCleanupMnode(SDnode *pDnode) { if (pMgmt->pMnode) dndStopMnodeWorker(pDnode); tfree(pMgmt->file); mndClose(pMgmt->pMnode); + pMgmt->pMnode = NULL; dInfo("dnode-mnode is cleaned up"); } diff --git a/source/dnode/mgmt/impl/src/dndQnode.c b/source/dnode/mgmt/impl/src/dndQnode.c new file mode 100644 index 0000000000..8c76bf95a6 --- /dev/null +++ b/source/dnode/mgmt/impl/src/dndQnode.c @@ -0,0 +1,355 @@ +/* + * 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 . + */ + +#define _DEFAULT_SOURCE +#include "dndQnode.h" +#include "dndDnode.h" +#include "dndTransport.h" +#include "dndWorker.h" + +static void dndProcessQnodeQueue(SDnode *pDnode, SRpcMsg *pMsg); + +static SQnode *dndAcquireQnode(SDnode *pDnode) { + SQnodeMgmt *pMgmt = &pDnode->qmgmt; + SQnode *pQnode = NULL; + int32_t refCount = 0; + + taosRLockLatch(&pMgmt->latch); + if (pMgmt->deployed && !pMgmt->dropped) { + refCount = atomic_add_fetch_32(&pMgmt->refCount, 1); + pQnode = pMgmt->pQnode; + } else { + terrno = TSDB_CODE_DND_QNODE_NOT_DEPLOYED; + } + taosRUnLockLatch(&pMgmt->latch); + + if (pQnode != NULL) { + dTrace("acquire qnode, refCount:%d", refCount); + } + return pQnode; +} + +static void dndReleaseQnode(SDnode *pDnode, SQnode *pQnode) { + SQnodeMgmt *pMgmt = &pDnode->qmgmt; + int32_t refCount = 0; + + taosRLockLatch(&pMgmt->latch); + if (pQnode != NULL) { + refCount = atomic_sub_fetch_32(&pMgmt->refCount, 1); + } + taosRUnLockLatch(&pMgmt->latch); + + if (pQnode != NULL) { + dTrace("release qnode, refCount:%d", refCount); + } +} + +static int32_t dndReadQnodeFile(SDnode *pDnode) { + SQnodeMgmt *pMgmt = &pDnode->qmgmt; + int32_t code = TSDB_CODE_DND_QNODE_READ_FILE_ERROR; + int32_t len = 0; + int32_t maxLen = 4096; + char *content = calloc(1, maxLen + 1); + cJSON *root = NULL; + + char file[PATH_MAX + 20]; + snprintf(file, PATH_MAX + 20, "%s/qnode.json", pDnode->dir.dnode); + + FILE *fp = fopen(file, "r"); + if (fp == NULL) { + dDebug("file %s not exist", file); + code = 0; + goto PRASE_QNODE_OVER; + } + + len = (int32_t)fread(content, 1, maxLen, fp); + if (len <= 0) { + dError("failed to read %s since content is null", file); + goto PRASE_QNODE_OVER; + } + + content[len] = 0; + root = cJSON_Parse(content); + if (root == NULL) { + dError("failed to read %s since invalid json format", file); + goto PRASE_QNODE_OVER; + } + + cJSON *deployed = cJSON_GetObjectItem(root, "deployed"); + if (!deployed || deployed->type != cJSON_Number) { + dError("failed to read %s since deployed not found", file); + goto PRASE_QNODE_OVER; + } + pMgmt->deployed = deployed->valueint; + + cJSON *dropped = cJSON_GetObjectItem(root, "dropped"); + if (!dropped || dropped->type != cJSON_Number) { + dError("failed to read %s since dropped not found", file); + goto PRASE_QNODE_OVER; + } + pMgmt->dropped = dropped->valueint; + + code = 0; + dDebug("succcessed to read file %s, deployed:%d dropped:%d", file, pMgmt->deployed, pMgmt->dropped); + +PRASE_QNODE_OVER: + if (content != NULL) free(content); + if (root != NULL) cJSON_Delete(root); + if (fp != NULL) fclose(fp); + + terrno = code; + return code; +} + +static int32_t dndWriteQnodeFile(SDnode *pDnode) { + SQnodeMgmt *pMgmt = &pDnode->qmgmt; + + char file[PATH_MAX + 20]; + snprintf(file, PATH_MAX + 20, "%s/qnode.json", pDnode->dir.dnode); + + FILE *fp = fopen(file, "w"); + if (fp == NULL) { + terrno = TSDB_CODE_DND_QNODE_WRITE_FILE_ERROR; + dError("failed to write %s since %s", file, terrstr()); + return -1; + } + + int32_t len = 0; + int32_t maxLen = 4096; + char *content = calloc(1, maxLen + 1); + + len += snprintf(content + len, maxLen - len, "{\n"); + len += snprintf(content + len, maxLen - len, " \"deployed\": %d,\n", pMgmt->deployed); + len += snprintf(content + len, maxLen - len, " \"dropped\": %d\n", pMgmt->dropped); + len += snprintf(content + len, maxLen - len, "}\n"); + + fwrite(content, 1, len, fp); + taosFsyncFile(fileno(fp)); + fclose(fp); + free(content); + + if (taosRenameFile(file, file) != 0) { + terrno = TSDB_CODE_DND_QNODE_WRITE_FILE_ERROR; + dError("failed to rename %s since %s", file, terrstr()); + return -1; + } + + dInfo("successed to write %s, deployed:%d dropped:%d", file, pMgmt->deployed, pMgmt->dropped); + return 0; +} + +static int32_t dndStartQnodeWorker(SDnode *pDnode) { + SQnodeMgmt *pMgmt = &pDnode->qmgmt; + if (dndInitWorker(pDnode, &pMgmt->queryWorker, DND_WORKER_SINGLE, "qnode-query", 0, 1, + (FProcessItem)dndProcessQnodeQueue) != 0) { + dError("failed to start qnode query worker since %s", terrstr()); + return -1; + } + + if (dndInitWorker(pDnode, &pMgmt->fetchWorker, DND_WORKER_SINGLE, "qnode-fetch", 0, 1, + (FProcessItem)dndProcessQnodeQueue) != 0) { + dError("failed to start qnode fetch worker since %s", terrstr()); + return -1; + } + + return 0; +} + +static void dndStopQnodeWorker(SDnode *pDnode) { + SQnodeMgmt *pMgmt = &pDnode->qmgmt; + + taosWLockLatch(&pMgmt->latch); + pMgmt->deployed = 0; + taosWUnLockLatch(&pMgmt->latch); + + while (pMgmt->refCount > 1) { + taosMsleep(10); + } + + dndCleanupWorker(&pMgmt->queryWorker); + dndCleanupWorker(&pMgmt->fetchWorker); +} + +static void dndBuildQnodeOption(SDnode *pDnode, SQnodeOpt *pOption) { + pOption->pDnode = pDnode; + pOption->sendMsgToDnodeFp = dndSendMsgToDnode; + pOption->sendMsgToMnodeFp = dndSendMsgToMnode; + pOption->sendRedirectMsgFp = dndSendRedirectMsg; + pOption->dnodeId = dndGetDnodeId(pDnode); + pOption->clusterId = dndGetClusterId(pDnode); + pOption->cfg.sver = pDnode->opt.sver; +} + +static int32_t dndOpenQnode(SDnode *pDnode) { + SQnodeMgmt *pMgmt = &pDnode->qmgmt; + SQnodeOpt option = {0}; + dndBuildQnodeOption(pDnode, &option); + + SQnode *pQnode = qndOpen(&option); + if (pQnode == NULL) { + dError("failed to open qnode since %s", terrstr()); + return -1; + } + + if (dndStartQnodeWorker(pDnode) != 0) { + dError("failed to start qnode worker since %s", terrstr()); + qndClose(pQnode); + return -1; + } + + if (dndWriteQnodeFile(pDnode) != 0) { + dError("failed to write qnode file since %s", terrstr()); + dndStopQnodeWorker(pDnode); + qndClose(pQnode); + return -1; + } + + taosWLockLatch(&pMgmt->latch); + pMgmt->pQnode = pQnode; + pMgmt->deployed = 1; + taosWUnLockLatch(&pMgmt->latch); + + dInfo("qnode open successfully"); + return 0; +} + +static int32_t dndDropQnode(SDnode *pDnode) { + SQnodeMgmt *pMgmt = &pDnode->qmgmt; + + SQnode *pQnode = dndAcquireQnode(pDnode); + if (pQnode == NULL) { + dError("failed to drop qnode since %s", terrstr()); + return -1; + } + + taosRLockLatch(&pMgmt->latch); + pMgmt->dropped = 1; + taosRUnLockLatch(&pMgmt->latch); + + if (dndWriteQnodeFile(pDnode) != 0) { + taosRLockLatch(&pMgmt->latch); + pMgmt->dropped = 0; + taosRUnLockLatch(&pMgmt->latch); + + dndReleaseQnode(pDnode, pQnode); + dError("failed to drop qnode since %s", terrstr()); + return -1; + } + + dndReleaseQnode(pDnode, pQnode); + dndStopQnodeWorker(pDnode); + qndClose(pQnode); + pMgmt->pQnode = NULL; + // qndDestroy(pDnode->dir.qnode); + + return 0; +} + +int32_t dndProcessCreateQnodeReq(SDnode *pDnode, SRpcMsg *pRpcMsg) { + SCreateQnodeInMsg *pMsg = pRpcMsg->pCont; + pMsg->dnodeId = htonl(pMsg->dnodeId); + + if (pMsg->dnodeId != dndGetDnodeId(pDnode)) { + terrno = TSDB_CODE_DND_QNODE_ID_INVALID; + return -1; + } else { + return dndOpenQnode(pDnode); + } +} + +int32_t dndProcessDropQnodeReq(SDnode *pDnode, SRpcMsg *pRpcMsg) { + SDropQnodeInMsg *pMsg = pRpcMsg->pCont; + pMsg->dnodeId = htonl(pMsg->dnodeId); + + if (pMsg->dnodeId != dndGetDnodeId(pDnode)) { + terrno = TSDB_CODE_DND_QNODE_ID_INVALID; + return -1; + } else { + return dndDropQnode(pDnode); + } +} + +static void dndProcessQnodeQueue(SDnode *pDnode, SRpcMsg *pMsg) { + SQnodeMgmt *pMgmt = &pDnode->qmgmt; + SRpcMsg *pRsp = NULL; + int32_t code = TSDB_CODE_DND_QNODE_NOT_DEPLOYED; + + SQnode *pQnode = dndAcquireQnode(pDnode); + if (pQnode != NULL) { + code = qndProcessMsg(pQnode, pMsg, &pRsp); + } + + if (pRsp != NULL) { + pRsp->ahandle = pMsg->ahandle; + rpcSendResponse(pRsp); + free(pRsp); + } else { + if (code != 0) code = terrno; + SRpcMsg rpcRsp = {.handle = pMsg->handle, .ahandle = pMsg->ahandle, .code = code}; + rpcSendResponse(&rpcRsp); + } + + rpcFreeCont(pMsg->pCont); + taosFreeQitem(pMsg); +} + +static void dndWriteQnodeMsgToWorker(SDnode *pDnode, SDnodeWorker *pWorker, SRpcMsg *pMsg) { + int32_t code = TSDB_CODE_DND_QNODE_NOT_DEPLOYED; + + SQnode *pQnode = dndAcquireQnode(pDnode); + if (pQnode != NULL) { + code = dndWriteMsgToWorker(pWorker, pMsg, sizeof(SRpcMsg)); + } + dndReleaseQnode(pDnode, pQnode); + + if (code != 0) { + if (pMsg->msgType & 1u) { + SRpcMsg rsp = {.handle = pMsg->handle, .ahandle = pMsg->ahandle, .code = code}; + rpcSendResponse(&rsp); + } + rpcFreeCont(pMsg->pCont); + } +} + +void dndProcessQnodeQueryMsg(SDnode *pDnode, SRpcMsg *pMsg, SEpSet *pEpSet) { + dndWriteQnodeMsgToWorker(pDnode, &pDnode->qmgmt.queryWorker, pMsg); +} + +void dndProcessQnodeFetchMsg(SDnode *pDnode, SRpcMsg *pMsg, SEpSet *pEpSet) { + dndWriteQnodeMsgToWorker(pDnode, &pDnode->qmgmt.queryWorker, pMsg); +} + +int32_t dndInitQnode(SDnode *pDnode) { + SQnodeMgmt *pMgmt = &pDnode->qmgmt; + taosInitRWLatch(&pMgmt->latch); + + if (dndReadQnodeFile(pDnode) != 0) { + return -1; + } + + if (pMgmt->dropped) return 0; + if (!pMgmt->deployed) return 0; + + return dndOpenQnode(pDnode); +} + +void dndCleanupQnode(SDnode *pDnode) { + SQnodeMgmt *pMgmt = &pDnode->qmgmt; + if (pMgmt->pQnode) { + dndStopQnodeWorker(pDnode); + qndClose(pMgmt->pQnode); + pMgmt->pQnode = NULL; + } +} diff --git a/source/dnode/mgmt/impl/src/dndWorker.c b/source/dnode/mgmt/impl/src/dndWorker.c new file mode 100644 index 0000000000..da0e3a9319 --- /dev/null +++ b/source/dnode/mgmt/impl/src/dndWorker.c @@ -0,0 +1,85 @@ +/* + * 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 . + */ + +#define _DEFAULT_SOURCE +#include "dndWorker.h" + +int32_t dndInitWorker(SDnode *pDnode, SDnodeWorker *pWorker, EDndWorkerType type, const char *name, int32_t minNum, + int32_t maxNum, FProcessItem fp) { + if (pDnode == NULL || pWorker == NULL || name == NULL || minNum < 0 || maxNum <= 0 || fp == NULL) { + terrno = TSDB_CODE_INVALID_PARA; + return -1; + } + + pWorker->type = type; + pWorker->name = name; + pWorker->minNum = minNum; + pWorker->maxNum = maxNum; + pWorker->fp = fp; + pWorker->pDnode = pDnode; + + if (pWorker->type == DND_WORKER_SINGLE) { + SWorkerPool *pPool = &pWorker->pool; + pPool->min = minNum; + pPool->max = maxNum; + if (tWorkerInit(pPool) != 0) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + return -1; + } + + pWorker->queue = tWorkerAllocQueue(&pPool, pDnode, fp); + if (pWorker->queue == NULL) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + return -1; + } + } else { + terrno = TSDB_CODE_INVALID_PARA; + } + + return 0; +} + +void dndCleanupWorker(SDnodeWorker *pWorker) { + if (pWorker->type == DND_WORKER_SINGLE) { + while (!taosQueueEmpty(pWorker->queue)) { + taosMsleep(10); + } + tWorkerCleanup(&pWorker->pool); + tWorkerFreeQueue(&pWorker->pool, pWorker->queue); + } +} + +int32_t dndWriteMsgToWorker(SDnodeWorker *pWorker, void *pCont, int32_t contLen) { + if (pWorker == NULL || pWorker->queue == NULL) { + terrno = TSDB_CODE_INVALID_PARA; + return -1; + } + + void *pMsg = taosAllocateQitem(contLen); + if (pMsg == NULL) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + return -1; + } + + memcpy(pMsg, pCont, contLen); + + if (taosWriteQitem(pWorker, pMsg) != 0) { + taosFreeItem(pMsg); + terrno = TSDB_CODE_OUT_OF_MEMORY; + return -1; + } + + return 0; +} \ No newline at end of file diff --git a/source/dnode/mgmt/impl/src/dnode.c b/source/dnode/mgmt/impl/src/dnode.c index a4996ecb3b..88a96dadc4 100644 --- a/source/dnode/mgmt/impl/src/dnode.c +++ b/source/dnode/mgmt/impl/src/dnode.c @@ -19,8 +19,6 @@ #include "dndTransport.h" #include "dndVnodes.h" #include "sync.h" -#include "tcache.h" -#include "tcrc32c.h" #include "wal.h" EStat dndGetStat(SDnode *pDnode) { return pDnode->stat; } @@ -86,12 +84,14 @@ static int32_t dndInitEnv(SDnode *pDnode, SDnodeOpt *pOption) { char path[PATH_MAX + 100]; snprintf(path, sizeof(path), "%s%smnode", pOption->dataDir, TD_DIRSEP); pDnode->dir.mnode = tstrdup(path); - snprintf(path, sizeof(path), "%s%svnode", pOption->dataDir, TD_DIRSEP); pDnode->dir.vnodes = tstrdup(path); - snprintf(path, sizeof(path), "%s%sdnode", pOption->dataDir, TD_DIRSEP); pDnode->dir.dnode = tstrdup(path); + snprintf(path, sizeof(path), "%s%ssnode", pOption->dataDir, TD_DIRSEP); + pDnode->dir.snode = tstrdup(path); + snprintf(path, sizeof(path), "%s%sbnode", pOption->dataDir, TD_DIRSEP); + pDnode->dir.bnode = tstrdup(path); if (pDnode->dir.mnode == NULL || pDnode->dir.vnodes == NULL || pDnode->dir.dnode == NULL) { dError("failed to malloc dir object"); @@ -117,22 +117,28 @@ static int32_t dndInitEnv(SDnode *pDnode, SDnodeOpt *pOption) { return -1; } + if (taosMkDir(pDnode->dir.snode) != 0) { + dError("failed to create dir:%s since %s", pDnode->dir.snode, strerror(errno)); + terrno = TAOS_SYSTEM_ERROR(errno); + return -1; + } + + if (taosMkDir(pDnode->dir.bnode) != 0) { + dError("failed to create dir:%s since %s", pDnode->dir.bnode, strerror(errno)); + terrno = TAOS_SYSTEM_ERROR(errno); + return -1; + } + memcpy(&pDnode->opt, pOption, sizeof(SDnodeOpt)); return 0; } static void dndCleanupEnv(SDnode *pDnode) { - if (pDnode->dir.mnode != NULL) { - tfree(pDnode->dir.mnode); - } - - if (pDnode->dir.vnodes != NULL) { - tfree(pDnode->dir.vnodes); - } - - if (pDnode->dir.dnode != NULL) { - tfree(pDnode->dir.dnode); - } + tfree(pDnode->dir.mnode); + tfree(pDnode->dir.vnodes); + tfree(pDnode->dir.dnode); + tfree(pDnode->dir.snode); + tfree(pDnode->dir.bnode); if (pDnode->lockFd >= 0) { taosUnLockFile(pDnode->lockFd); @@ -176,7 +182,7 @@ SDnode *dndInit(SDnodeOpt *pOption) { return NULL; } - if (vnodeInit(1) != 0) { + if (vnodeInit(pDnode->opt.numOfCommitThreads) != 0) { dError("failed to init vnode env"); dndCleanup(pDnode); return NULL; diff --git a/source/dnode/mgmt/impl/test/dnode/dnode.cpp b/source/dnode/mgmt/impl/test/dnode/dnode.cpp index 4009a83cd0..dc352c5a3f 100644 --- a/source/dnode/mgmt/impl/test/dnode/dnode.cpp +++ b/source/dnode/mgmt/impl/test/dnode/dnode.cpp @@ -91,7 +91,8 @@ TEST_F(DndTestDnode, 03_Create_Drop_Restart_Dnode) { int32_t contLen = sizeof(SCreateDnodeMsg); SCreateDnodeMsg* pReq = (SCreateDnodeMsg*)rpcMallocCont(contLen); - strcpy(pReq->ep, "localhost:9042"); + strcpy(pReq->fqdn, "localhost"); + pReq->port = htonl(9042); SRpcMsg* pMsg = test.SendMsg(TDMT_MND_CREATE_DNODE, pReq, contLen); ASSERT_NE(pMsg, nullptr); @@ -148,7 +149,8 @@ TEST_F(DndTestDnode, 03_Create_Drop_Restart_Dnode) { int32_t contLen = sizeof(SCreateDnodeMsg); SCreateDnodeMsg* pReq = (SCreateDnodeMsg*)rpcMallocCont(contLen); - strcpy(pReq->ep, "localhost:9043"); + strcpy(pReq->fqdn, "localhost"); + pReq->port = htonl(9043); SRpcMsg* pMsg = test.SendMsg(TDMT_MND_CREATE_DNODE, pReq, contLen); ASSERT_NE(pMsg, nullptr); @@ -159,7 +161,8 @@ TEST_F(DndTestDnode, 03_Create_Drop_Restart_Dnode) { int32_t contLen = sizeof(SCreateDnodeMsg); SCreateDnodeMsg* pReq = (SCreateDnodeMsg*)rpcMallocCont(contLen); - strcpy(pReq->ep, "localhost:9044"); + strcpy(pReq->fqdn, "localhost"); + pReq->port = htonl(904); SRpcMsg* pMsg = test.SendMsg(TDMT_MND_CREATE_DNODE, pReq, contLen); ASSERT_NE(pMsg, nullptr); @@ -170,7 +173,8 @@ TEST_F(DndTestDnode, 03_Create_Drop_Restart_Dnode) { int32_t contLen = sizeof(SCreateDnodeMsg); SCreateDnodeMsg* pReq = (SCreateDnodeMsg*)rpcMallocCont(contLen); - strcpy(pReq->ep, "localhost:9045"); + strcpy(pReq->fqdn, "localhost"); + pReq->port = htonl(9045); SRpcMsg* pMsg = test.SendMsg(TDMT_MND_CREATE_DNODE, pReq, contLen); ASSERT_NE(pMsg, nullptr); diff --git a/source/dnode/mgmt/impl/test/mnode/mnode.cpp b/source/dnode/mgmt/impl/test/mnode/mnode.cpp index 0d89542288..a6cec93539 100644 --- a/source/dnode/mgmt/impl/test/mnode/mnode.cpp +++ b/source/dnode/mgmt/impl/test/mnode/mnode.cpp @@ -102,7 +102,8 @@ TEST_F(DndTestMnode, 04_Create_Mnode) { int32_t contLen = sizeof(SCreateDnodeMsg); SCreateDnodeMsg* pReq = (SCreateDnodeMsg*)rpcMallocCont(contLen); - strcpy(pReq->ep, "localhost:9062"); + strcpy(pReq->fqdn, "localhost"); + pReq->port = htonl(9062); SRpcMsg* pMsg = test.SendMsg(TDMT_MND_CREATE_DNODE, pReq, contLen); ASSERT_NE(pMsg, nullptr); diff --git a/source/dnode/mgmt/impl/test/sut/src/base.cpp b/source/dnode/mgmt/impl/test/sut/src/base.cpp index f3fe8cfa86..98371e9893 100644 --- a/source/dnode/mgmt/impl/test/sut/src/base.cpp +++ b/source/dnode/mgmt/impl/test/sut/src/base.cpp @@ -31,6 +31,7 @@ void Testbase::InitLog(const char* path) { tsdbDebugFlag = 0; cqDebugFlag = 0; tscEmbeddedInUtil = 1; + tsAsyncLog = 0; taosRemoveDir(path); taosMkDir(path); @@ -47,7 +48,7 @@ void Testbase::Init(const char* path, int16_t port) { char firstEp[TSDB_EP_LEN] = {0}; snprintf(firstEp, TSDB_EP_LEN, "%s:%u", fqdn, port); - InitLog("/tmp/tdlog"); + InitLog("/tmp/td"); server.Start(path, fqdn, port, firstEp); client.Init("root", "taosdata", fqdn, port); taosMsleep(1100); diff --git a/source/dnode/mgmt/impl/test/sut/src/server.cpp b/source/dnode/mgmt/impl/test/sut/src/server.cpp index a001748a12..f29b2fad1d 100644 --- a/source/dnode/mgmt/impl/test/sut/src/server.cpp +++ b/source/dnode/mgmt/impl/test/sut/src/server.cpp @@ -27,6 +27,7 @@ SDnodeOpt TestServer::BuildOption(const char* path, const char* fqdn, uint16_t p option.sver = 1; option.numOfCores = 1; option.numOfSupportVnodes = 1; + option.numOfCommitThreads = 1; option.statusInterval = 1; option.numOfThreadsPerCore = 1; option.ratioOfQueryCores = 1; diff --git a/source/dnode/mnode/impl/src/mndDnode.c b/source/dnode/mnode/impl/src/mndDnode.c index 153d75ffd0..56559cbea1 100644 --- a/source/dnode/mnode/impl/src/mndDnode.c +++ b/source/dnode/mnode/impl/src/mndDnode.c @@ -386,20 +386,16 @@ static int32_t mndCreateDnode(SMnode *pMnode, SMnodeMsg *pMsg, SCreateDnodeMsg * dnodeObj.id = sdbGetMaxId(pMnode->pSdb, SDB_DNODE); dnodeObj.createdTime = taosGetTimestampMs(); dnodeObj.updateTime = dnodeObj.createdTime; - taosGetFqdnPortFromEp(pCreate->ep, dnodeObj.fqdn, &dnodeObj.port); - - if (dnodeObj.fqdn[0] == 0 || dnodeObj.port <= 0) { - terrno = TSDB_CODE_MND_INVALID_DNODE_EP; - mError("dnode:%s, failed to create since %s", pCreate->ep, terrstr()); - return terrno; - } + dnodeObj.port = pCreate->port; + memcpy(dnodeObj.fqdn, pCreate->fqdn, TSDB_FQDN_LEN); + snprintf(dnodeObj.ep, "%s:%u", dnodeObj.fqdn, dnodeObj.port); STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, &pMsg->rpcMsg); if (pTrans == NULL) { - mError("dnode:%s, failed to create since %s", pCreate->ep, terrstr()); + mError("dnode:%s, failed to create since %s", dnodeObj.ep, terrstr()); return -1; } - mDebug("trans:%d, used to create dnode:%s", pTrans->id, pCreate->ep); + mDebug("trans:%d, used to create dnode:%s", pTrans->id, dnodeObj.ep); SSdbRaw *pRedoRaw = mndDnodeActionEncode(&dnodeObj); if (pRedoRaw == NULL || mndTransAppendRedolog(pTrans, pRedoRaw) != 0) { @@ -423,17 +419,20 @@ static int32_t mndProcessCreateDnodeMsg(SMnodeMsg *pMsg) { SMnode *pMnode = pMsg->pMnode; SCreateDnodeMsg *pCreate = pMsg->rpcMsg.pCont; - mDebug("dnode:%s, start to create", pCreate->ep); + mDebug("dnode:%s:%d, start to create", pCreate->fqdn, pCreate->port); - if (pCreate->ep[0] == 0) { + pCreate->port = htonl(pCreate->port); + if (pCreate->fqdn[0] == 0 || pCreate->port <= 0 || pCreate->port > UINT16_MAX) { terrno = TSDB_CODE_MND_INVALID_DNODE_EP; - mError("dnode:%s, failed to create since %s", pCreate->ep, terrstr()); + mError("dnode:%s:%d, failed to create since %s", pCreate->fqdn, pCreate->port, terrstr()); return -1; } - SDnodeObj *pDnode = mndAcquireDnodeByEp(pMnode, pCreate->ep); + char ep[TSDB_EP_LEN]; + snprintf(ep, TSDB_EP_LEN, "%s:%d", pCreate->fqdn, pCreate->port); + SDnodeObj *pDnode = mndAcquireDnodeByEp(pMnode, ep); if (pDnode != NULL) { - mError("dnode:%d, already exist", pDnode->id); + mError("dnode:%d, already exist, %s:%u", pDnode->id, pCreate->fqdn, pCreate->port); mndReleaseDnode(pMnode, pDnode); terrno = TSDB_CODE_MND_DNODE_ALREADY_EXIST; return -1; @@ -442,7 +441,7 @@ static int32_t mndProcessCreateDnodeMsg(SMnodeMsg *pMsg) { int32_t code = mndCreateDnode(pMnode, pMsg, pCreate); if (code != 0) { - mError("dnode:%s, failed to create since %s", pCreate->ep, terrstr()); + mError("dnode:%s:%d, failed to create since %s", pCreate->fqdn, pCreate->port, terrstr()); return -1; } diff --git a/source/dnode/qnode/CMakeLists.txt b/source/dnode/qnode/CMakeLists.txt index d9f932a631..f6f78f7357 100644 --- a/source/dnode/qnode/CMakeLists.txt +++ b/source/dnode/qnode/CMakeLists.txt @@ -4,4 +4,11 @@ target_include_directories( qnode PUBLIC "${CMAKE_SOURCE_DIR}/include/dnode/qnode" private "${CMAKE_CURRENT_SOURCE_DIR}/inc" +) +target_link_libraries( + qnode + PRIVATE transport + PRIVATE os + PRIVATE common + PRIVATE util ) \ No newline at end of file diff --git a/source/dnode/qnode/inc/qnodeInt.h b/source/dnode/qnode/inc/qndInt.h similarity index 70% rename from source/dnode/qnode/inc/qnodeInt.h rename to source/dnode/qnode/inc/qndInt.h index 43df47845b..e9f1229a9d 100644 --- a/source/dnode/qnode/inc/qnodeInt.h +++ b/source/dnode/qnode/inc/qndInt.h @@ -16,10 +16,27 @@ #ifndef _TD_QNODE_INT_H_ #define _TD_QNODE_INT_H_ +#include "os.h" + +#include "tlog.h" +#include "tmsg.h" +#include "trpc.h" + +#include "qnode.h" + #ifdef __cplusplus extern "C" { #endif +typedef struct SQnode { + int32_t dnodeId; + int64_t clusterId; + SQnodeCfg cfg; + SendMsgToDnodeFp sendMsgToDnodeFp; + SendMsgToMnodeFp sendMsgToMnodeFp; + SendRedirectMsgFp sendRedirectMsgFp; +} SQnode; + #ifdef __cplusplus } #endif diff --git a/source/dnode/qnode/src/qnode.c b/source/dnode/qnode/src/qnode.c index 6dea4a4e57..ff1a460228 100644 --- a/source/dnode/qnode/src/qnode.c +++ b/source/dnode/qnode/src/qnode.c @@ -11,4 +11,25 @@ * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . - */ \ No newline at end of file + */ + +#include "qndInt.h" + +SQnode *qndOpen(const SQnodeOpt *pOption) { + SQnode *pQnode = calloc(1, sizeof(SQnode)); + return pQnode; +} + +void qndClose(SQnode *pQnode) { free(pQnode); } + +int32_t qndGetLoad(SQnode *pQnode, SQnodeLoad *pLoad) { return 0; } + +int32_t qndProcessQueryReq(SQnode *pQnode, SRpcMsg *pMsg, SRpcMsg **pRsp) { + *pRsp = NULL; + return 0; +} + +int32_t qndProcessFetchReq(SQnode *pQnode, SRpcMsg *pMsg, SRpcMsg **pRsp) { + *pRsp = NULL; + return 0; +} diff --git a/source/dnode/snode/CMakeLists.txt b/source/dnode/snode/CMakeLists.txt new file mode 100644 index 0000000000..a94dd9edd8 --- /dev/null +++ b/source/dnode/snode/CMakeLists.txt @@ -0,0 +1,14 @@ +aux_source_directory(src SNODE_SRC) +add_library(snode ${SNODE_SRC}) +target_include_directories( + snode + PUBLIC "${CMAKE_SOURCE_DIR}/include/dnode/snode" + private "${CMAKE_CURRENT_SOURCE_DIR}/inc" +) +target_link_libraries( + snode + PRIVATE transport + PRIVATE os + PRIVATE common + PRIVATE util +) \ No newline at end of file diff --git a/source/dnode/snode/inc/sndInt.h b/source/dnode/snode/inc/sndInt.h new file mode 100644 index 0000000000..8827c92eef --- /dev/null +++ b/source/dnode/snode/inc/sndInt.h @@ -0,0 +1,44 @@ +/* + * 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 _TD_SNODE_INT_H_ +#define _TD_SNODE_INT_H_ + +#include "os.h" + +#include "tlog.h" +#include "tmsg.h" +#include "trpc.h" + +#include "snode.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct SSnode { + int32_t dnodeId; + int64_t clusterId; + SSnodeCfg cfg; + SendMsgToDnodeFp sendMsgToDnodeFp; + SendMsgToMnodeFp sendMsgToMnodeFp; + SendRedirectMsgFp sendRedirectMsgFp; +} SSnode; + +#ifdef __cplusplus +} +#endif + +#endif /*_TD_SNODE_INT_H_*/ \ No newline at end of file diff --git a/source/dnode/snode/src/snode.c b/source/dnode/snode/src/snode.c new file mode 100644 index 0000000000..3423ce41e2 --- /dev/null +++ b/source/dnode/snode/src/snode.c @@ -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 . + */ + +#include "sndInt.h" + +SSnode *sndOpen(const SSnodeOpt *pOption) { + SSnode *pSnode = calloc(1, sizeof(SSnode)); + return pSnode; +} + +void sndClose(SSnode *pSnode) { free(pSnode); } + +int32_t sndGetLoad(SSnode *pSnode, SSnodeLoad *pLoad) { return 0; } + +int32_t sndProcessWriteMsg(SSnode *pSnode, SRpcMsg *pMsg, SRpcMsg **pRsp) { + *pRsp = NULL; + return 0; +} diff --git a/source/libs/index/inc/indexInt.h b/source/libs/index/inc/indexInt.h index a8f231da0a..048c9e804e 100644 --- a/source/libs/index/inc/indexInt.h +++ b/source/libs/index/inc/indexInt.h @@ -51,6 +51,8 @@ struct SIndex { int64_t suid; // current super table id, -1 is normal table int32_t cVersion; // current version allocated to cache + char* path; + SIndexStat stat; pthread_mutex_t mtx; }; @@ -87,12 +89,23 @@ typedef struct SIndexTermQuery { EIndexQueryType qType; } SIndexTermQuery; -typedef struct Iterate { - void* iter; +typedef struct Iterate Iterate; + +typedef struct IterateValue { int8_t type; char* colVal; SArray* val; +} IterateValue; + +typedef struct Iterate { + void* iter; + IterateValue val; + bool (*next)(Iterate* iter); + IterateValue* (*getValue)(Iterate* iter); } Iterate; + +void iterateValueDestroy(IterateValue* iv, bool destroy); + extern void* indexQhandle; int indexFlushCacheTFile(SIndex* sIdx, void*); diff --git a/source/libs/index/inc/index_cache.h b/source/libs/index/inc/index_cache.h index 07b5b8d564..0e7405869a 100644 --- a/source/libs/index/inc/index_cache.h +++ b/source/libs/index/inc/index_cache.h @@ -39,8 +39,10 @@ typedef struct IndexCache { int32_t nTerm; int8_t type; + pthread_mutex_t mtx; } IndexCache; +#define CACHE_VERSION(cache) atomic_load_32(&cache->version) typedef struct CacheTerm { // key int32_t nColVal; @@ -57,6 +59,9 @@ IndexCache* indexCacheCreate(SIndex* idx, const char* colName, int8_t type); void indexCacheDestroy(void* cache); +Iterate* indexCacheIteratorCreate(IndexCache* cache); +void indexCacheIteratorDestroy(Iterate* iiter); + int indexCachePut(void* cache, SIndexTerm* term, uint64_t uid); // int indexCacheGet(void *cache, uint64_t *rst); @@ -66,6 +71,8 @@ void indexCacheRef(IndexCache* cache); void indexCacheUnRef(IndexCache* cache); void indexCacheDebug(IndexCache* cache); + +void indexCacheDestroyImm(IndexCache* cache); #ifdef __cplusplus } #endif diff --git a/source/libs/index/inc/index_fst.h b/source/libs/index/inc/index_fst.h index 3c572787fc..73c79b2619 100644 --- a/source/libs/index/inc/index_fst.h +++ b/source/libs/index/inc/index_fst.h @@ -319,6 +319,8 @@ bool streamWithStateSeekMin(StreamWithState* sws, FstBoundWithData* min); StreamWithStateResult* streamWithStateNextWith(StreamWithState* sws, StreamCallback callback); FstStreamBuilder* fstStreamBuilderCreate(Fst* fst, AutomationCtx* aut); + +void fstStreamBuilderDestroy(FstStreamBuilder* b); // set up bound range // refator, simple code by marco diff --git a/source/libs/index/inc/index_tfile.h b/source/libs/index/inc/index_tfile.h index 550492ba50..f97a3126c8 100644 --- a/source/libs/index/inc/index_tfile.h +++ b/source/libs/index/inc/index_tfile.h @@ -113,6 +113,8 @@ int tfileReaderSearch(TFileReader* reader, SIndexTermQuery* query, SArr void tfileReaderRef(TFileReader* reader); void tfileReaderUnRef(TFileReader* reader); +TFileWriter* tfileWriterOpen(char* path, uint64_t suid, int32_t version, const char* colName, uint8_t type); +void tfileWriteClose(TFileWriter* tw); TFileWriter* tfileWriterCreate(WriterCtx* ctx, TFileHeader* header); void tfileWriterDestroy(TFileWriter* tw); int tfileWriterPut(TFileWriter* tw, void* data); @@ -123,6 +125,14 @@ IndexTFile* indexTFileCreate(const char* path); int indexTFilePut(void* tfile, SIndexTerm* term, uint64_t uid); int indexTFileSearch(void* tfile, SIndexTermQuery* query, SArray* result); +Iterate* tfileIteratorCreate(TFileReader* reader); +void tfileIteratorDestroy(Iterate* iterator); + +TFileValue* tfileValueCreate(char* val); + +int tfileValuePush(TFileValue* tf, uint64_t val); +void tfileValueDestroy(TFileValue* tf); + #ifdef __cplusplus } diff --git a/source/libs/index/src/index.c b/source/libs/index/src/index.c index 3f871af01d..06e7e8ba44 100644 --- a/source/libs/index/src/index.c +++ b/source/libs/index/src/index.c @@ -75,9 +75,12 @@ int indexOpen(SIndexOpts* opts, const char* path, SIndex** index) { sIdx->tindex = indexTFileCreate(path); sIdx->colObj = taosHashInit(8, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK); sIdx->cVersion = 1; + sIdx->path = calloc(1, strlen(path) + 1); + memcpy(sIdx->path, path, strlen(path)); pthread_mutex_init(&sIdx->mtx, NULL); *index = sIdx; + return 0; #endif @@ -361,14 +364,94 @@ static int indexMergeFinalResults(SArray* interResults, EIndexOperatorType oType } return 0; } + int indexFlushCacheTFile(SIndex* sIdx, void* cache) { if (sIdx == NULL) { return -1; } indexWarn("suid %" PRIu64 " merge cache into tindex", sIdx->suid); - IndexCache* pCache = (IndexCache*)cache; + IndexCache* pCache = (IndexCache*)cache; TFileReader* pReader = tfileGetReaderByCol(sIdx->tindex, pCache->colName); + // handle flush + Iterate* cacheIter = indexCacheIteratorCreate(pCache); + Iterate* tfileIter = tfileIteratorCreate(pReader); + + SArray* result = taosArrayInit(1024, sizeof(void*)); + + bool cn = cacheIter->next(cacheIter); + bool tn = tfileIter->next(tfileIter); + while (cn == true && tn == true) { + IterateValue* cv = cacheIter->getValue(cacheIter); + IterateValue* tv = tfileIter->getValue(tfileIter); + + // dump value + int comp = strcmp(cv->colVal, tv->colVal); + if (comp == 0) { + TFileValue* tfv = tfileValueCreate(cv->colVal); + taosArrayAddAll(tfv->tableId, cv->val); + taosArrayAddAll(tfv->tableId, tv->val); + taosArrayPush(result, &tfv); + + cn = cacheIter->next(cacheIter); + tn = tfileIter->next(tfileIter); + continue; + } else if (comp < 0) { + TFileValue* tfv = tfileValueCreate(cv->colVal); + taosArrayAddAll(tfv->tableId, cv->val); + taosArrayPush(result, &tfv); + + // copy to final Result; + cn = cacheIter->next(cacheIter); + } else { + TFileValue* tfv = tfileValueCreate(tv->colVal); + taosArrayPush(result, &tfv); + taosArrayAddAll(tfv->tableId, tv->val); + // copy to final result + tn = tfileIter->next(tfileIter); + } + } + while (cn == true) { + IterateValue* cv = cacheIter->getValue(cacheIter); + TFileValue* tfv = tfileValueCreate(cv->colVal); + taosArrayAddAll(tfv->tableId, cv->val); + taosArrayPush(result, &tfv); + cn = cacheIter->next(cacheIter); + } + while (tn == true) { + IterateValue* tv = tfileIter->getValue(tfileIter); + TFileValue* tfv = tfileValueCreate(tv->colVal); + taosArrayAddAll(tfv->tableId, tv->val); + taosArrayPush(result, &tfv); + tn = tfileIter->next(tfileIter); + } + + int32_t version = CACHE_VERSION(pCache); + uint8_t colType = pCache->type; + + TFileWriter* tw = tfileWriterOpen(sIdx->path, sIdx->suid, version, pCache->colName, colType); + if (tw == NULL) { + indexError("faile to open file to write"); + } else { + int ret = tfileWriterPut(tw, result); + if (ret != 0) { indexError("faile to write into tindex "); } + } + // not free later, just put int table cache + indexCacheDestroyImm(pCache); + + tfileWriteClose(tw); + indexCacheIteratorDestroy(cacheIter); + tfileIteratorDestroy(tfileIter); + tfileReaderUnRef(pReader); indexCacheUnRef(pCache); return 0; } +void iterateValueDestroy(IterateValue* value, bool destroy) { + if (destroy) { + taosArrayDestroy(value->val); + } else { + taosArrayClear(value->val); + } + free(value->colVal); + value->colVal = NULL; +} diff --git a/source/libs/index/src/index_cache.c b/source/libs/index/src/index_cache.c index 8181c17505..3f99d04bc9 100644 --- a/source/libs/index/src/index_cache.c +++ b/source/libs/index/src/index_cache.c @@ -20,7 +20,7 @@ #define MAX_INDEX_KEY_LEN 256 // test only, change later -#define CACH_LIMIT 1000000 +#define MEM_TERM_LIMIT 1000000 // ref index_cache.h:22 //#define CACHE_KEY_LEN(p) \ // (sizeof(int32_t) + sizeof(uint16_t) + sizeof(p->colType) + sizeof(p->nColVal) + p->nColVal + sizeof(uint64_t) + sizeof(p->operType)) @@ -78,6 +78,7 @@ IndexCache* indexCacheCreate(SIndex* idx, const char* colName, int8_t type) { cache->index = idx; cache->version = 0; + pthread_mutex_init(&cache->mtx, NULL); indexCacheRef(cache); return cache; } @@ -94,12 +95,30 @@ void indexCacheDebug(IndexCache* cache) { tSkipListDestroyIter(iter); } +void indexCacheDestroySkiplist(SSkipList* slt) { + SSkipListIterator* iter = tSkipListCreateIter(slt); + while (tSkipListIterNext(iter)) { + SSkipListNode* node = tSkipListIterGet(iter); + CacheTerm* ct = (CacheTerm*)SL_GET_NODE_DATA(node); + if (ct != NULL) {} + } + tSkipListDestroyIter(iter); +} +void indexCacheDestroyImm(IndexCache* cache) { + pthread_mutex_lock(&cache->mtx); + SSkipList* timm = (SSkipList*)cache->imm; + cache->imm = NULL; // or throw int bg thread + pthread_mutex_unlock(&cache->mtx); + + indexCacheDestroySkiplist(timm); +} void indexCacheDestroy(void* cache) { IndexCache* pCache = cache; if (pCache == NULL) { return; } tSkipListDestroy(pCache->mem); tSkipListDestroy(pCache->imm); free(pCache->colName); + free(pCache); } @@ -108,6 +127,48 @@ static void doMergeWork(SSchedMsg* msg) { SIndex* sidx = (SIndex*)pCache->index; indexFlushCacheTFile(sidx, pCache); } +static bool indexCacheIteratorNext(Iterate* itera) { + SSkipListIterator* iter = itera->iter; + if (iter == NULL) { return false; } + + IterateValue* iv = &itera->val; + iterateValueDestroy(iv, false); + + bool next = tSkipListIterNext(iter); + if (next) { + SSkipListNode* node = tSkipListIterGet(iter); + CacheTerm* ct = (CacheTerm*)SL_GET_NODE_DATA(node); + + iv->type = ct->operaType; + iv->colVal = ct->colVal; + + taosArrayPush(iv->val, &ct->uid); + } + + return next; +} + +static IterateValue* indexCacheIteratorGetValue(Iterate* iter) { + return &iter->val; +} +Iterate* indexCacheIteratorCreate(IndexCache* cache) { + Iterate* iiter = calloc(1, sizeof(Iterate)); + if (iiter == NULL) { return NULL; } + + iiter->val.val = taosArrayInit(1, sizeof(uint64_t)); + iiter->iter = cache->imm != NULL ? tSkipListCreateIter(cache->imm) : NULL; + iiter->next = indexCacheIteratorNext; + iiter->getValue = indexCacheIteratorGetValue; + + return iiter; +} +void indexCacheIteratorDestroy(Iterate* iter) { + if (iter == NULL) { return; } + + tSkipListDestroyIter(iter->iter); + iterateValueDestroy(&iter->val, true); + free(iter); +} int indexCacheSchedToMerge(IndexCache* pCache) { SSchedMsg schedMsg = {0}; @@ -118,6 +179,27 @@ int indexCacheSchedToMerge(IndexCache* pCache) { taosScheduleTask(indexQhandle, &schedMsg); } +static void indexCacheMakeRoomForWrite(IndexCache* cache) { + while (true) { + if (cache->nTerm < MEM_TERM_LIMIT) { + cache->nTerm += 1; + break; + } else if (cache->imm != NULL) { + // TODO: wake up by condition variable + pthread_mutex_unlock(&cache->mtx); + taosMsleep(50); + pthread_mutex_lock(&cache->mtx); + } else { + cache->imm = cache->mem; + cache->mem = indexInternalCacheCreate(cache->type); + cache->nTerm = 1; + // sched to merge + // unref cache in bgwork + indexCacheSchedToMerge(cache); + } + } +} + int indexCachePut(void* cache, SIndexTerm* term, uint64_t uid) { if (cache == NULL) { return -1; } @@ -136,23 +218,12 @@ int indexCachePut(void* cache, SIndexTerm* term, uint64_t uid) { ct->uid = uid; ct->operaType = term->operType; + // ugly code, refactor later + pthread_mutex_lock(&pCache->mtx); + indexCacheMakeRoomForWrite(pCache); tSkipListPut(pCache->mem, (char*)ct); - pCache->nTerm += 1; + pthread_mutex_unlock(&pCache->mtx); - if (pCache->nTerm >= CACH_LIMIT) { - pCache->nTerm = 0; - - while (pCache->imm != NULL) { - // do nothong - } - - pCache->imm = pCache->mem; - pCache->mem = indexInternalCacheCreate(pCache->type); - - // sched to merge - // unref cache int bgwork - indexCacheSchedToMerge(pCache); - } indexCacheUnRef(pCache); return 0; // encode end diff --git a/source/libs/index/src/index_tfile.c b/source/libs/index/src/index_tfile.c index 0dfb14cc8d..fc31ff3c29 100644 --- a/source/libs/index/src/index_tfile.c +++ b/source/libs/index/src/index_tfile.c @@ -23,6 +23,13 @@ #include "taosdef.h" #include "tcompare.h" +typedef struct TFileFstIter { + FstStreamBuilder* fb; + StreamWithState* st; + AutomationCtx* ctx; + TFileReader* rdr; +} TFileFstIter; + #define TF_TABLE_TATOAL_SIZE(sz) (sizeof(sz) + sz * sizeof(uint64_t)) static int tfileStrCompare(const void* a, const void* b); @@ -184,6 +191,23 @@ int tfileReaderSearch(TFileReader* reader, SIndexTermQuery* query, SArray* resul return ret; } +TFileWriter* tfileWriterOpen(char* path, uint64_t suid, int32_t version, const char* colName, uint8_t colType) { + char filename[128] = {0}; + int32_t coldId = 1; + tfileGenFileName(filename, suid, coldId, version); + + char fullname[256] = {0}; + snprintf(fullname, sizeof(fullname), "%s/%s", path, filename); + WriterCtx* wcx = writerCtxCreate(TFile, fullname, true, 1024 * 1024); + + TFileHeader tfh = {0}; + tfh.suid = suid; + tfh.version = version; + memcpy(tfh.colName, colName, strlen(colName)); + tfh.colType = colType; + + return tfileWriterCreate(wcx, &tfh); +} TFileWriter* tfileWriterCreate(WriterCtx* ctx, TFileHeader* header) { // char pathBuf[128] = {0}; // sprintf(pathBuf, "%s/% " PRIu64 "-%d-%d.tindex", path, suid, colId, version); @@ -279,6 +303,11 @@ int tfileWriterPut(TFileWriter* tw, void* data) { tw->fb = NULL; return 0; } +void tfileWriteClose(TFileWriter* tw) { + if (tw == NULL) { return; } + writerCtxDestroy(tw->ctx); + free(tw); +} void tfileWriterDestroy(TFileWriter* tw) { if (tw == NULL) { return; } @@ -314,6 +343,71 @@ int indexTFilePut(void* tfile, SIndexTerm* term, uint64_t uid) { return 0; } +static bool tfileIteratorNext(Iterate* iiter) { + IterateValue* iv = &iiter->val; + iterateValueDestroy(iv, false); + // SArray* tblIds = iv->val; + + char* colVal = NULL; + uint64_t offset = 0; + + TFileFstIter* tIter = iiter->iter; + StreamWithStateResult* rt = streamWithStateNextWith(tIter->st, NULL); + if (rt == NULL) { return false; } + + int32_t sz = 0; + char* ch = (char*)fstSliceData(&rt->data, &sz); + colVal = calloc(1, sz + 1); + memcpy(colVal, ch, sz); + + offset = (uint64_t)(rt->out.out); + + swsResultDestroy(rt); + // set up iterate value + if (tfileReaderLoadTableIds(tIter->rdr, offset, iv->val) != 0) { return false; } + + iv->colVal = colVal; + + // std::string key(ch, sz); +} + +static IterateValue* tifileIterateGetValue(Iterate* iter) { + return &iter->val; +} + +static TFileFstIter* tfileFstIteratorCreate(TFileReader* reader) { + TFileFstIter* tIter = calloc(1, sizeof(Iterate)); + if (tIter == NULL) { return NULL; } + tIter->ctx = automCtxCreate(NULL, AUTOMATION_ALWAYS); + tIter->fb = fstSearch(reader->fst, tIter->ctx); + tIter->st = streamBuilderIntoStream(tIter->fb); + tIter->rdr = reader; + return tIter; +} + +Iterate* tfileIteratorCreate(TFileReader* reader) { + Iterate* iter = calloc(1, sizeof(Iterate)); + + iter->iter = tfileFstIteratorCreate(reader); + if (iter->iter == NULL) { return NULL; } + + iter->next = tfileIteratorNext; + iter->getValue = tifileIterateGetValue; + return iter; +} +void tfileIteratorDestroy(Iterate* iter) { + if (iter == NULL) { return; } + IterateValue* iv = &iter->val; + iterateValueDestroy(iv, true); + + TFileFstIter* tIter = iter->iter; + streamWithStateDestroy(tIter->st); + fstStreamBuilderDestroy(tIter->fb); + automCtxDestroy(tIter->ctx); + + free(iter); +} + TFileReader* tfileGetReaderByCol(IndexTFile* tf, char* colName) { if (tf == NULL) { return NULL; } TFileCacheKey key = {.suid = 0, .colType = TSDB_DATA_TYPE_BINARY, .colName = colName, .nColName = strlen(colName)}; @@ -334,6 +428,23 @@ static int tfileValueCompare(const void* a, const void* b, const void* param) { return fn(av->colVal, bv->colVal); } + +TFileValue* tfileValueCreate(char* val) { + TFileValue* tf = calloc(1, sizeof(TFileValue)); + if (tf == NULL) { return NULL; } + + tf->tableId = taosArrayInit(32, sizeof(uint64_t)); + return tf; +} +int tfileValuePush(TFileValue* tf, uint64_t val) { + if (tf == NULL) { return -1; } + taosArrayPush(tf->tableId, &val); + return 0; +} +void tfileValueDestroy(TFileValue* tf) { + taosArrayDestroy(tf->tableId); + free(tf); +} static void tfileSerialTableIdsToBuf(char* buf, SArray* ids) { int sz = taosArrayGetSize(ids); SERIALIZE_VAR_TO_BUF(buf, sz, int32_t); diff --git a/source/libs/parser/inc/astToMsg.h b/source/libs/parser/inc/astToMsg.h index 848bbc346e..5358a523fa 100644 --- a/source/libs/parser/inc/astToMsg.h +++ b/source/libs/parser/inc/astToMsg.h @@ -12,6 +12,8 @@ SDropUserMsg* buildDropUserMsg(SSqlInfo* pInfo, int32_t* outputLen, int64_t id, SShowMsg* buildShowMsg(SShowInfo* pShowInfo, SParseBasicCtx* pParseCtx, char* msgBuf, int32_t msgLen); SCreateDbMsg* buildCreateDbMsg(SCreateDbInfo* pCreateDbInfo, SParseBasicCtx *pCtx, SMsgBuf* pMsgBuf); SCreateStbMsg* buildCreateTableMsg(SCreateTableSql* pCreateTableSql, int32_t* len, SParseBasicCtx* pParseCtx, SMsgBuf* pMsgBuf); -SDropTableMsg* buildDropTableMsg(SSqlInfo* pInfo, int32_t* len, SParseBasicCtx* pParseCtx, SMsgBuf* pMsgBuf); +SDropStbMsg* buildDropStableMsg(SSqlInfo* pInfo, int32_t* len, SParseBasicCtx* pParseCtx, SMsgBuf* pMsgBuf); +SCreateDnodeMsg *buildCreateDnodeMsg(SSqlInfo* pInfo, int32_t* len, SMsgBuf* pMsgBuf); +SDropDnodeMsg *buildDropDnodeMsg(SSqlInfo* pInfo, int32_t* len, SMsgBuf* pMsgBuf); #endif // TDENGINE_ASTTOMSG_H diff --git a/source/libs/parser/inc/sql.y b/source/libs/parser/inc/sql.y index 183b71483b..a3ce3c2427 100644 --- a/source/libs/parser/inc/sql.y +++ b/source/libs/parser/inc/sql.y @@ -200,7 +200,7 @@ ifnotexists(X) ::= . { X.n = 0;} /////////////////////////////////THE CREATE STATEMENT/////////////////////////////////////// //create option for dnode/db/user/account -cmd ::= CREATE DNODE ids(X). { setDCLSqlElems(pInfo, TSDB_SQL_CREATE_DNODE, 1, &X);} +cmd ::= CREATE DNODE ids(X) PORT ids(Y). { setDCLSqlElems(pInfo, TSDB_SQL_CREATE_DNODE, 2, &X, &Y);} cmd ::= CREATE ACCOUNT ids(X) PASS ids(Y) acct_optr(Z). { setCreateAcctSql(pInfo, TSDB_SQL_CREATE_ACCT, &X, &Y, &Z);} cmd ::= CREATE DATABASE ifnotexists(Z) ids(X) db_optr(Y). { setCreateDbInfo(pInfo, TSDB_SQL_CREATE_DB, &X, &Y, &Z);} @@ -398,13 +398,13 @@ create_stable_args(A) ::= ifnotexists(U) ids(V) cpxName(Z) LP columnlist(X) RP T // create table by using super table // create table table_name using super_table_name tags(tag_values1, tag_values2) %type create_from_stable{SCreatedTableInfo} -create_from_stable(A) ::= ifnotexists(U) ids(V) cpxName(Z) USING ids(X) cpxName(F) TAGS LP tagitemlist(Y) RP. { +create_from_stable(A) ::= ifnotexists(U) ids(V) cpxName(Z) USING ids(X) cpxName(F) TAGS LP tagitemlist1(Y) RP. { X.n += F.n; V.n += Z.n; A = createNewChildTableInfo(&X, NULL, Y, &V, &U); } -create_from_stable(A) ::= ifnotexists(U) ids(V) cpxName(Z) USING ids(X) cpxName(F) LP tagNamelist(P) RP TAGS LP tagitemlist(Y) RP. { +create_from_stable(A) ::= ifnotexists(U) ids(V) cpxName(Z) USING ids(X) cpxName(F) LP tagNamelist(P) RP TAGS LP tagitemlist1(Y) RP. { X.n += F.n; V.n += Z.n; A = createNewChildTableInfo(&X, P, Y, &V, &U); @@ -437,6 +437,15 @@ column(A) ::= ids(X) typename(Y). { tSetColumnInfo(&A, &X, &Y); } +%type tagitemlist1 {SArray*} +%destructor tagitemlist1 {taosArrayDestroy($$);} + +tagitemlist1(A) ::= tagitemlist1(X) COMMA tagitem1(Y). { taosArrayPush(X, &Y); A = X;} +tagitemlist1(A) ::= tagitem1(Y). { A = taosArrayInit(4, sizeof(SToken)); taosArrayPush(A, &Y); } + +%type tagitem1 {SToken} +tagitem1(A) ::= MINUS(X) INTEGER(Y). { A.n = X.n + Y.n; A.type = Y.type; } + %type tagitemlist {SArray*} %destructor tagitemlist {taosArrayDestroy($$);} diff --git a/source/libs/parser/inc/ttokendef.h b/source/libs/parser/inc/ttokendef.h index ccb62b3320..4a5427c170 100644 --- a/source/libs/parser/inc/ttokendef.h +++ b/source/libs/parser/inc/ttokendef.h @@ -103,114 +103,115 @@ #define TK_RP 85 #define TK_IF 86 #define TK_EXISTS 87 -#define TK_AS 88 -#define TK_OUTPUTTYPE 89 -#define TK_AGGREGATE 90 -#define TK_BUFSIZE 91 -#define TK_PPS 92 -#define TK_TSERIES 93 -#define TK_DBS 94 -#define TK_STORAGE 95 -#define TK_QTIME 96 -#define TK_CONNS 97 -#define TK_STATE 98 -#define TK_COMMA 99 -#define TK_KEEP 100 -#define TK_CACHE 101 -#define TK_REPLICA 102 -#define TK_QUORUM 103 -#define TK_DAYS 104 -#define TK_MINROWS 105 -#define TK_MAXROWS 106 -#define TK_BLOCKS 107 -#define TK_CTIME 108 -#define TK_WAL 109 -#define TK_FSYNC 110 -#define TK_COMP 111 -#define TK_PRECISION 112 -#define TK_UPDATE 113 -#define TK_CACHELAST 114 -#define TK_UNSIGNED 115 -#define TK_TAGS 116 -#define TK_USING 117 -#define TK_NULL 118 -#define TK_NOW 119 -#define TK_SELECT 120 -#define TK_UNION 121 -#define TK_ALL 122 -#define TK_DISTINCT 123 -#define TK_FROM 124 -#define TK_VARIABLE 125 -#define TK_INTERVAL 126 -#define TK_EVERY 127 -#define TK_SESSION 128 -#define TK_STATE_WINDOW 129 -#define TK_FILL 130 -#define TK_SLIDING 131 -#define TK_ORDER 132 -#define TK_BY 133 -#define TK_ASC 134 -#define TK_GROUP 135 -#define TK_HAVING 136 -#define TK_LIMIT 137 -#define TK_OFFSET 138 -#define TK_SLIMIT 139 -#define TK_SOFFSET 140 -#define TK_WHERE 141 -#define TK_RESET 142 -#define TK_QUERY 143 -#define TK_SYNCDB 144 -#define TK_ADD 145 -#define TK_COLUMN 146 -#define TK_MODIFY 147 -#define TK_TAG 148 -#define TK_CHANGE 149 -#define TK_SET 150 -#define TK_KILL 151 -#define TK_CONNECTION 152 -#define TK_STREAM 153 -#define TK_COLON 154 -#define TK_ABORT 155 -#define TK_AFTER 156 -#define TK_ATTACH 157 -#define TK_BEFORE 158 -#define TK_BEGIN 159 -#define TK_CASCADE 160 -#define TK_CLUSTER 161 -#define TK_CONFLICT 162 -#define TK_COPY 163 -#define TK_DEFERRED 164 -#define TK_DELIMITERS 165 -#define TK_DETACH 166 -#define TK_EACH 167 -#define TK_END 168 -#define TK_EXPLAIN 169 -#define TK_FAIL 170 -#define TK_FOR 171 -#define TK_IGNORE 172 -#define TK_IMMEDIATE 173 -#define TK_INITIALLY 174 -#define TK_INSTEAD 175 -#define TK_KEY 176 -#define TK_OF 177 -#define TK_RAISE 178 -#define TK_REPLACE 179 -#define TK_RESTRICT 180 -#define TK_ROW 181 -#define TK_STATEMENT 182 -#define TK_TRIGGER 183 -#define TK_VIEW 184 -#define TK_IPTOKEN 185 -#define TK_SEMI 186 -#define TK_NONE 187 -#define TK_PREV 188 -#define TK_LINEAR 189 -#define TK_IMPORT 190 -#define TK_TBNAME 191 -#define TK_JOIN 192 -#define TK_INSERT 193 -#define TK_INTO 194 -#define TK_VALUES 195 +#define TK_PORT 88 +#define TK_AS 89 +#define TK_OUTPUTTYPE 90 +#define TK_AGGREGATE 91 +#define TK_BUFSIZE 92 +#define TK_PPS 93 +#define TK_TSERIES 94 +#define TK_DBS 95 +#define TK_STORAGE 96 +#define TK_QTIME 97 +#define TK_CONNS 98 +#define TK_STATE 99 +#define TK_COMMA 100 +#define TK_KEEP 101 +#define TK_CACHE 102 +#define TK_REPLICA 103 +#define TK_QUORUM 104 +#define TK_DAYS 105 +#define TK_MINROWS 106 +#define TK_MAXROWS 107 +#define TK_BLOCKS 108 +#define TK_CTIME 109 +#define TK_WAL 110 +#define TK_FSYNC 111 +#define TK_COMP 112 +#define TK_PRECISION 113 +#define TK_UPDATE 114 +#define TK_CACHELAST 115 +#define TK_UNSIGNED 116 +#define TK_TAGS 117 +#define TK_USING 118 +#define TK_NULL 119 +#define TK_NOW 120 +#define TK_SELECT 121 +#define TK_UNION 122 +#define TK_ALL 123 +#define TK_DISTINCT 124 +#define TK_FROM 125 +#define TK_VARIABLE 126 +#define TK_INTERVAL 127 +#define TK_EVERY 128 +#define TK_SESSION 129 +#define TK_STATE_WINDOW 130 +#define TK_FILL 131 +#define TK_SLIDING 132 +#define TK_ORDER 133 +#define TK_BY 134 +#define TK_ASC 135 +#define TK_GROUP 136 +#define TK_HAVING 137 +#define TK_LIMIT 138 +#define TK_OFFSET 139 +#define TK_SLIMIT 140 +#define TK_SOFFSET 141 +#define TK_WHERE 142 +#define TK_RESET 143 +#define TK_QUERY 144 +#define TK_SYNCDB 145 +#define TK_ADD 146 +#define TK_COLUMN 147 +#define TK_MODIFY 148 +#define TK_TAG 149 +#define TK_CHANGE 150 +#define TK_SET 151 +#define TK_KILL 152 +#define TK_CONNECTION 153 +#define TK_STREAM 154 +#define TK_COLON 155 +#define TK_ABORT 156 +#define TK_AFTER 157 +#define TK_ATTACH 158 +#define TK_BEFORE 159 +#define TK_BEGIN 160 +#define TK_CASCADE 161 +#define TK_CLUSTER 162 +#define TK_CONFLICT 163 +#define TK_COPY 164 +#define TK_DEFERRED 165 +#define TK_DELIMITERS 166 +#define TK_DETACH 167 +#define TK_EACH 168 +#define TK_END 169 +#define TK_EXPLAIN 170 +#define TK_FAIL 171 +#define TK_FOR 172 +#define TK_IGNORE 173 +#define TK_IMMEDIATE 174 +#define TK_INITIALLY 175 +#define TK_INSTEAD 176 +#define TK_KEY 177 +#define TK_OF 178 +#define TK_RAISE 179 +#define TK_REPLACE 180 +#define TK_RESTRICT 181 +#define TK_ROW 182 +#define TK_STATEMENT 183 +#define TK_TRIGGER 184 +#define TK_VIEW 185 +#define TK_IPTOKEN 186 +#define TK_SEMI 187 +#define TK_NONE 188 +#define TK_PREV 189 +#define TK_LINEAR 190 +#define TK_IMPORT 191 +#define TK_TBNAME 192 +#define TK_JOIN 193 +#define TK_INSERT 194 +#define TK_INTO 195 +#define TK_VALUES 196 diff --git a/source/libs/parser/src/astToMsg.c b/source/libs/parser/src/astToMsg.c index 6b92357748..2f80af225a 100644 --- a/source/libs/parser/src/astToMsg.c +++ b/source/libs/parser/src/astToMsg.c @@ -356,7 +356,7 @@ SCreateStbMsg* buildCreateTableMsg(SCreateTableSql* pCreateTableSql, int32_t* le return pCreateTableMsg; } -SDropTableMsg* buildDropTableMsg(SSqlInfo* pInfo, int32_t* len, SParseBasicCtx* pParseCtx, SMsgBuf* pMsgBuf) { +SDropStbMsg* buildDropStableMsg(SSqlInfo* pInfo, int32_t* len, SParseBasicCtx* pParseCtx, SMsgBuf* pMsgBuf) { SToken* tableName = taosArrayGet(pInfo->pMiscInfo->a, 0); SName name = {0}; @@ -366,13 +366,76 @@ SDropTableMsg* buildDropTableMsg(SSqlInfo* pInfo, int32_t* len, SParseBasicCtx* return NULL; } - SDropTableMsg *pDropTableMsg = (SDropTableMsg*) calloc(1, sizeof(SDropTableMsg)); + SDropStbMsg *pDropTableMsg = (SDropStbMsg*) calloc(1, sizeof(SDropStbMsg)); code = tNameExtractFullName(&name, pDropTableMsg->name); assert(code == TSDB_CODE_SUCCESS && name.type == TSDB_TABLE_NAME_T); - pDropTableMsg->ignoreNotExists = pInfo->pMiscInfo->existsCheck ? 1 : 0; + pDropTableMsg->igNotExists = pInfo->pMiscInfo->existsCheck ? 1 : 0; *len = sizeof(SDropTableMsg); return pDropTableMsg; } +SCreateDnodeMsg *buildCreateDnodeMsg(SSqlInfo* pInfo, int32_t* len, SMsgBuf* pMsgBuf) { + const char* msg1 = "invalid host name (name too long, maximum length 128)"; + const char* msg2 = "dnode name can not be string"; + const char* msg3 = "port should be an integer that is less than 65535"; + const char* msg4 = "failed prepare create dnode message"; + + if (taosArrayGetSize(pInfo->pMiscInfo->a) != 2) { + buildInvalidOperationMsg(pMsgBuf, msg1); + return NULL; + } + + SToken* id = taosArrayGet(pInfo->pMiscInfo->a, 0); + if (id->type != TK_ID) { + buildInvalidOperationMsg(pMsgBuf, msg2); + return NULL; + } + + SToken* port = taosArrayGet(pInfo->pMiscInfo->a, 1); + if (port->type != TK_INTEGER) { + buildInvalidOperationMsg(pMsgBuf, msg3); + return NULL; + } + + bool isSign = false; + int64_t val = 0; + + toInteger(port->z, port->n, 10, &val, &isSign); + if (val >= UINT16_MAX) { + buildInvalidOperationMsg(pMsgBuf, msg3); + return NULL; + } + + SCreateDnodeMsg *pCreate = (SCreateDnodeMsg *) calloc(1, sizeof(SCreateDnodeMsg)); + if (pCreate == NULL) { + buildInvalidOperationMsg(pMsgBuf, msg4); + return NULL; + } + + strncpy(pCreate->fqdn, id->z, id->n); + pCreate->port = htonl(val); + + *len = sizeof(SCreateDnodeMsg); + return pCreate; +} + +SDropDnodeMsg *buildDropDnodeMsg(SSqlInfo* pInfo, int32_t* len, SMsgBuf* pMsgBuf) { + SToken* pzName = taosArrayGet(pInfo->pMiscInfo->a, 0); + + + char* end = NULL; + SDropDnodeMsg * pDrop = (SDropDnodeMsg *)calloc(1, sizeof(SDropDnodeMsg)); + pDrop->dnodeId = strtoll(pzName->z, &end, 10); + *len = sizeof(SDropDnodeMsg); + + if (end - pzName->z != pzName->n) { + buildInvalidOperationMsg(pMsgBuf, "invalid dnode id"); + tfree(pDrop); + return NULL; + } + + return pDrop; +} + diff --git a/source/libs/parser/src/astValidate.c b/source/libs/parser/src/astValidate.c index 6325620f54..b2466fd2dc 100644 --- a/source/libs/parser/src/astValidate.c +++ b/source/libs/parser/src/astValidate.c @@ -3986,7 +3986,6 @@ int32_t qParserValidateSqlNode(struct SCatalog* pCatalog, SSqlInfo* pInfo, SQuer return buildInvalidOperationMsg(pMsgBuf, "not support sql expression"); } - SCatalogReq req = {0}; SMetaData data = {0}; @@ -4023,6 +4022,5 @@ int32_t qParserValidateSqlNode(struct SCatalog* pCatalog, SSqlInfo* pInfo, SQuer validateSqlNode(p, pQueryInfo, &buf); } - return code; } diff --git a/source/libs/parser/src/dCDAstProcess.c b/source/libs/parser/src/dCDAstProcess.c index ddbd6eb58c..a0410e6ec0 100644 --- a/source/libs/parser/src/dCDAstProcess.c +++ b/source/libs/parser/src/dCDAstProcess.c @@ -1,8 +1,9 @@ -#include "tglobal.h" -#include "parserInt.h" +#include #include "astToMsg.h" +#include "parserInt.h" #include "parserUtil.h" #include "queryInfoUtil.h" +#include "tglobal.h" /* is contained in pFieldList or not */ static bool has(SArray* pFieldList, int32_t startIndex, const char* name) { @@ -293,7 +294,6 @@ int32_t doCheckForCreateCTable(SSqlInfo* pInfo, SParseBasicCtx *pCtx, SMsgBuf* p // super table name, create table by using dst int32_t numOfTables = (int32_t) taosArrayGetSize(pCreateTable->childTableInfo); for(int32_t j = 0; j < numOfTables; ++j) { -#if 0 SCreatedTableInfo* pCreateTableInfo = taosArrayGet(pCreateTable->childTableInfo, j); SToken* pSTableNameToken = &pCreateTableInfo->stbName; @@ -341,12 +341,7 @@ int32_t doCheckForCreateCTable(SSqlInfo* pInfo, SParseBasicCtx *pCtx, SMsgBuf* p pNameList = pCreateTableInfo->pTagNames; nameSize = taosArrayGetSize(pNameList); - if (valSize != nameSize) { - tdDestroyKVRowBuilder(&kvRowBuilder); - return buildInvalidOperationMsg(pMsgBuf, msg2); - } - - if (schemaSize < valSize) { + if (valSize != nameSize || schemaSize < valSize) { tdDestroyKVRowBuilder(&kvRowBuilder); return buildInvalidOperationMsg(pMsgBuf, msg2); } @@ -359,15 +354,15 @@ int32_t doCheckForCreateCTable(SSqlInfo* pInfo, SParseBasicCtx *pCtx, SMsgBuf* p strncpy(tmpTokenBuf, sToken->z, sToken->n); sToken->z = tmpTokenBuf; - if (TK_STRING == sToken->type) { - tscDequoteAndTrimToken(sToken); - } +// if (TK_STRING == sToken->type) { +// tscDequoteAndTrimToken(sToken); +// } - if (TK_ID == sToken->type) { - tscRmEscapeAndTrimToken(sToken); - } +// if (TK_ID == sToken->type) { +// tscRmEscapeAndTrimToken(sToken); +// } - tVariantListItem* pItem = taosArrayGet(pValList, i); + SListItem* pItem = taosArrayGet(pValList, i); findColumnIndex = false; @@ -384,16 +379,16 @@ int32_t doCheckForCreateCTable(SSqlInfo* pInfo, SParseBasicCtx *pCtx, SMsgBuf* p } } else if (pSchema->type == TSDB_DATA_TYPE_TIMESTAMP) { if (pItem->pVar.nType == TSDB_DATA_TYPE_BINARY) { - ret = convertTimestampStrToInt64(&(pItem->pVar), tinfo.precision); - if (ret != TSDB_CODE_SUCCESS) { - return buildInvalidOperationMsg(pMsgBuf, msg4); - } +// code = convertTimestampStrToInt64(&(pItem->pVar), tinfo.precision); +// if (code != TSDB_CODE_SUCCESS) { +// return buildInvalidOperationMsg(pMsgBuf, msg4); +// } } else if (pItem->pVar.nType == TSDB_DATA_TYPE_TIMESTAMP) { - pItem->pVar.i64 = convertTimePrecision(pItem->pVar.i64, TSDB_TIME_PRECISION_NANO, tinfo.precision); + pItem->pVar.i = convertTimePrecision(pItem->pVar.i, TSDB_TIME_PRECISION_NANO, tinfo.precision); } } - code = tVariantDump(&(pItem->pVar), tagVal, pSchema->type, true); + code = taosVariantDump(&(pItem->pVar), tagVal, pSchema->type, true); // check again after the convert since it may be converted from binary to nchar. if (pSchema->type == TSDB_DATA_TYPE_BINARY || pSchema->type == TSDB_DATA_TYPE_NCHAR) { @@ -428,8 +423,8 @@ int32_t doCheckForCreateCTable(SSqlInfo* pInfo, SParseBasicCtx *pCtx, SMsgBuf* p } for (int32_t i = 0; i < valSize; ++i) { - SSchema* pSchema = &pTagSchema[i]; - tVariantListItem* pItem = taosArrayGet(pValList, i); + SSchema *pSchema = &pTagSchema[i]; + SListItem *pItem = taosArrayGet(pValList, i); char tagVal[TSDB_MAX_TAGS_LEN]; if (pSchema->type == TSDB_DATA_TYPE_BINARY || pSchema->type == TSDB_DATA_TYPE_NCHAR) { @@ -439,16 +434,16 @@ int32_t doCheckForCreateCTable(SSqlInfo* pInfo, SParseBasicCtx *pCtx, SMsgBuf* p } } else if (pSchema->type == TSDB_DATA_TYPE_TIMESTAMP) { if (pItem->pVar.nType == TSDB_DATA_TYPE_BINARY) { - ret = convertTimestampStrToInt64(&(pItem->pVar), tinfo.precision); - if (ret != TSDB_CODE_SUCCESS) { +// code = convertTimestampStrToInt64(&(pItem->pVar), tinfo.precision); + if (code != TSDB_CODE_SUCCESS) { return buildInvalidOperationMsg(pMsgBuf, msg4); } } else if (pItem->pVar.nType == TSDB_DATA_TYPE_TIMESTAMP) { - pItem->pVar.i64 = convertTimePrecision(pItem->pVar.i64, TSDB_TIME_PRECISION_NANO, tinfo.precision); + pItem->pVar.i = convertTimePrecision(pItem->pVar.i, TSDB_TIME_PRECISION_NANO, tinfo.precision); } } - code = tVariantDump(&(pItem->pVar), tagVal, pSchema->type, true); + code = taosVariantDump(&(pItem->pVar), tagVal, pSchema->type, true); // check again after the convert since it may be converted from binary to nchar. if (pSchema->type == TSDB_DATA_TYPE_BINARY || pSchema->type == TSDB_DATA_TYPE_NCHAR) { @@ -485,22 +480,21 @@ int32_t doCheckForCreateCTable(SSqlInfo* pInfo, SParseBasicCtx *pCtx, SMsgBuf* p bool dbIncluded2 = false; // table name - if (tscValidateName(&(pCreateTableInfo->name), true, &dbIncluded2) != TSDB_CODE_SUCCESS) { - return buildInvalidOperationMsg(pMsgBuf, msg1); - } +// if (tscValidateName(&(pCreateTableInfo->name), true, &dbIncluded2) != TSDB_CODE_SUCCESS) { +// return buildInvalidOperationMsg(pMsgBuf, msg1); +// } - STableMetaInfo* pTableMetaInfo = tscGetMetaInfo(pQueryInfo, TABLE_INDEX); - code = tscSetTableFullName(&pTableMetaInfo->name, &pCreateTableInfo->name, pSql, dbIncluded2); - if (code != TSDB_CODE_SUCCESS) { - return code; - } +// STableMetaInfo* pTableMetaInfo = tscGetMetaInfo(pQueryInfo, TABLE_INDEX); +// code = tscSetTableFullName(&pTableMetaInfo->name, &pCreateTableInfo->name, pSql, dbIncluded2); +// if (code != TSDB_CODE_SUCCESS) { +// return code; +// } - pCreateTableInfo->fullname = calloc(1, tNameLen(&pTableMetaInfo->name) + 1); - code = tNameExtractFullName(&pTableMetaInfo->name, pCreateTableInfo->fullname); - if (code != TSDB_CODE_SUCCESS) { - return buildInvalidOperationMsg(pMsgBuf, msg1); - } -#endif +// pCreateTableInfo->fullname = calloc(1, tNameLen(&pTableMetaInfo->name) + 1); +// code = tNameExtractFullName(&pTableMetaInfo->name, pCreateTableInfo->fullname); +// if (code != TSDB_CODE_SUCCESS) { +// return buildInvalidOperationMsg(pMsgBuf, msg1); +// } } return TSDB_CODE_SUCCESS; @@ -710,13 +704,32 @@ int32_t qParserValidateDclSqlNode(SSqlInfo* pInfo, SParseBasicCtx* pCtx, SDclStm } case TSDB_SQL_DROP_TABLE: { - pDcl->pMsg = (char*)buildDropTableMsg(pInfo, &pDcl->msgLen, pCtx, pMsgBuf); + pDcl->pMsg = (char*)buildDropStableMsg(pInfo, &pDcl->msgLen, pCtx, pMsgBuf); if (pDcl->pMsg == NULL) { - return terrno; + code = terrno; } pDcl->msgType = TDMT_MND_DROP_STB; - return TSDB_CODE_SUCCESS; + break; + } + + case TSDB_SQL_CREATE_DNODE: { + pDcl->pMsg = (char*) buildCreateDnodeMsg(pInfo, &pDcl->msgLen, pMsgBuf); + if (pDcl->pMsg == NULL) { + code = terrno; + } + + pDcl->msgType = TDMT_MND_CREATE_DNODE; + break; + } + + case TSDB_SQL_DROP_DNODE: { + pDcl->pMsg = (char*) buildDropDnodeMsg(pInfo, &pDcl->msgLen, pMsgBuf); + if (pDcl->pMsg == NULL) { + code = terrno; + } + + pDcl->msgType = TDMT_MND_DROP_DNODE; break; } diff --git a/source/libs/parser/src/parser.c b/source/libs/parser/src/parser.c index 0f77135ec1..5c9a48e52f 100644 --- a/source/libs/parser/src/parser.c +++ b/source/libs/parser/src/parser.c @@ -44,11 +44,12 @@ int32_t parseQuerySql(SParseContext* pCxt, SQueryNode** pQuery) { } if (!isDqlSqlStatement(&info)) { - SDclStmtInfo* pDcl = calloc(1, sizeof(SQueryStmtInfo)); + SDclStmtInfo* pDcl = calloc(1, sizeof(SDclStmtInfo)); if (NULL == pDcl) { terrno = TSDB_CODE_TSC_OUT_OF_MEMORY; // set correct error code. return terrno; } + pDcl->nodeType = info.type; int32_t code = qParserValidateDclSqlNode(&info, &pCxt->ctx, pDcl, pCxt->pMsg, pCxt->msgLen); if (code == TSDB_CODE_SUCCESS) { diff --git a/source/libs/parser/src/sql.c b/source/libs/parser/src/sql.c index 5295faf645..5d89901989 100644 --- a/source/libs/parser/src/sql.c +++ b/source/libs/parser/src/sql.c @@ -97,30 +97,30 @@ #endif /************* Begin control #defines *****************************************/ #define YYCODETYPE unsigned short int -#define YYNOCODE 276 +#define YYNOCODE 279 #define YYACTIONTYPE unsigned short int #define ParseTOKENTYPE SToken typedef union { int yyinit; ParseTOKENTYPE yy0; - SSessionWindowVal yy39; - SCreateDbInfo yy42; - SVariant yy43; - int yy44; - tSqlExpr* yy46; - SLimit yy55; - SCreatedTableInfo yy96; - SArray* yy131; - SSqlNode* yy256; - SCreateTableSql* yy272; - SField yy290; - SSubclause* yy303; - int32_t yy310; - SCreateAcctInfo yy341; - int64_t yy459; - SIntervalVal yy530; - SWindowStateVal yy538; - SRelationInfo* yy544; + SRelationInfo* yy8; + SWindowStateVal yy40; + SSqlNode* yy56; + SVariant yy69; + SCreateDbInfo yy90; + int yy96; + SField yy100; + int32_t yy104; + SSessionWindowVal yy147; + SSubclause* yy149; + SCreatedTableInfo yy152; + SCreateAcctInfo yy171; + SLimit yy231; + int64_t yy325; + SIntervalVal yy400; + SArray* yy421; + SCreateTableSql* yy438; + tSqlExpr* yy439; } YYMINORTYPE; #ifndef YYSTACKDEPTH #define YYSTACKDEPTH 100 @@ -130,17 +130,17 @@ typedef union { #define ParseARG_FETCH SSqlInfo* pInfo = yypParser->pInfo #define ParseARG_STORE yypParser->pInfo = pInfo #define YYFALLBACK 1 -#define YYNSTATE 358 -#define YYNRULE 288 -#define YYNTOKEN 196 -#define YY_MAX_SHIFT 357 -#define YY_MIN_SHIFTREDUCE 564 -#define YY_MAX_SHIFTREDUCE 851 -#define YY_ERROR_ACTION 852 -#define YY_ACCEPT_ACTION 853 -#define YY_NO_ACTION 854 -#define YY_MIN_REDUCE 855 -#define YY_MAX_REDUCE 1142 +#define YYNSTATE 362 +#define YYNRULE 291 +#define YYNTOKEN 197 +#define YY_MAX_SHIFT 361 +#define YY_MIN_SHIFTREDUCE 571 +#define YY_MAX_SHIFTREDUCE 861 +#define YY_ERROR_ACTION 862 +#define YY_ACCEPT_ACTION 863 +#define YY_NO_ACTION 864 +#define YY_MIN_REDUCE 865 +#define YY_MAX_REDUCE 1155 /************* End control #defines *******************************************/ /* Define the yytestcase() macro to be a no-op if is not already defined @@ -206,287 +206,291 @@ typedef union { ** yy_default[] Default action for each state. ** *********** Begin parsing tables **********************************************/ -#define YY_ACTTAB_COUNT (762) +#define YY_ACTTAB_COUNT (767) static const YYACTIONTYPE yy_action[] = { - /* 0 */ 94, 615, 233, 244, 356, 227, 1004, 239, 243, 616, - /* 10 */ 615, 1004, 21, 55, 56, 241, 59, 60, 616, 1004, - /* 20 */ 247, 49, 48, 47, 200, 58, 315, 63, 61, 64, - /* 30 */ 62, 987, 988, 33, 991, 54, 53, 853, 357, 52, - /* 40 */ 51, 50, 55, 56, 97, 59, 60, 650, 248, 247, - /* 50 */ 49, 48, 47, 201, 58, 315, 63, 61, 64, 62, - /* 60 */ 976, 203, 974, 975, 54, 53, 203, 977, 52, 51, - /* 70 */ 50, 978, 1119, 979, 980, 54, 53, 1119, 992, 52, - /* 80 */ 51, 50, 55, 56, 1017, 59, 60, 159, 79, 247, - /* 90 */ 49, 48, 47, 27, 58, 315, 63, 61, 64, 62, - /* 100 */ 269, 313, 693, 990, 54, 53, 203, 998, 52, 51, - /* 110 */ 50, 345, 55, 57, 788, 59, 60, 1119, 36, 247, - /* 120 */ 49, 48, 47, 615, 58, 315, 63, 61, 64, 62, - /* 130 */ 1017, 616, 335, 334, 54, 53, 152, 615, 52, 51, - /* 140 */ 50, 56, 36, 59, 60, 616, 230, 247, 49, 48, - /* 150 */ 47, 240, 58, 315, 63, 61, 64, 62, 159, 1066, - /* 160 */ 229, 287, 54, 53, 1001, 73, 52, 51, 50, 565, - /* 170 */ 566, 567, 568, 569, 570, 571, 572, 573, 574, 575, - /* 180 */ 576, 577, 578, 150, 237, 228, 59, 60, 1001, 313, - /* 190 */ 247, 49, 48, 47, 250, 58, 315, 63, 61, 64, - /* 200 */ 62, 203, 275, 274, 74, 54, 53, 753, 754, 52, - /* 210 */ 51, 50, 1118, 42, 311, 351, 350, 310, 309, 308, - /* 220 */ 349, 307, 306, 305, 348, 304, 347, 346, 289, 22, - /* 230 */ 90, 970, 958, 959, 960, 961, 962, 963, 964, 965, - /* 240 */ 966, 967, 968, 969, 971, 972, 212, 1017, 246, 803, - /* 250 */ 36, 36, 792, 213, 795, 36, 798, 168, 36, 134, - /* 260 */ 133, 132, 214, 231, 246, 803, 320, 85, 792, 251, - /* 270 */ 795, 249, 798, 323, 322, 277, 63, 61, 64, 62, - /* 280 */ 206, 255, 225, 226, 54, 53, 316, 85, 52, 51, - /* 290 */ 50, 12, 238, 324, 85, 93, 1001, 1001, 225, 226, - /* 300 */ 325, 1000, 717, 43, 1001, 714, 261, 715, 207, 716, - /* 310 */ 194, 192, 190, 159, 1027, 265, 264, 189, 138, 137, - /* 320 */ 136, 135, 36, 43, 96, 268, 42, 77, 351, 350, - /* 330 */ 43, 65, 84, 349, 221, 252, 253, 348, 36, 347, - /* 340 */ 346, 3, 39, 175, 119, 113, 123, 65, 36, 103, - /* 350 */ 107, 99, 106, 128, 131, 122, 257, 36, 254, 36, - /* 360 */ 330, 329, 125, 159, 326, 804, 799, 300, 1001, 734, - /* 370 */ 36, 121, 800, 52, 51, 50, 794, 256, 797, 1024, - /* 380 */ 327, 804, 799, 345, 1001, 1065, 173, 793, 800, 796, - /* 390 */ 331, 149, 147, 146, 1001, 355, 354, 143, 256, 332, - /* 400 */ 256, 333, 903, 1001, 770, 1001, 78, 174, 185, 1002, - /* 410 */ 352, 940, 337, 70, 92, 731, 1001, 913, 718, 719, - /* 420 */ 904, 82, 270, 185, 790, 83, 185, 750, 80, 760, - /* 430 */ 761, 703, 292, 705, 294, 91, 37, 704, 989, 32, - /* 440 */ 7, 154, 826, 66, 24, 37, 37, 66, 95, 805, - /* 450 */ 245, 66, 317, 738, 71, 614, 23, 69, 76, 208, - /* 460 */ 769, 69, 791, 23, 14, 112, 13, 111, 16, 23, - /* 470 */ 15, 295, 4, 722, 720, 723, 721, 18, 118, 17, - /* 480 */ 117, 20, 1113, 19, 130, 129, 1112, 1111, 223, 692, - /* 490 */ 224, 204, 205, 209, 202, 210, 801, 211, 216, 217, - /* 500 */ 218, 215, 199, 1003, 1138, 1130, 1019, 802, 1076, 1075, - /* 510 */ 235, 1072, 1071, 44, 236, 336, 266, 1058, 169, 151, - /* 520 */ 1026, 148, 1037, 1034, 1035, 1018, 272, 1057, 1039, 999, - /* 530 */ 1015, 276, 153, 232, 278, 280, 31, 158, 283, 163, - /* 540 */ 170, 160, 997, 161, 749, 162, 164, 165, 166, 171, - /* 550 */ 172, 301, 917, 297, 290, 807, 284, 298, 299, 302, - /* 560 */ 303, 197, 40, 75, 314, 912, 321, 1137, 109, 72, - /* 570 */ 46, 1136, 1133, 288, 176, 328, 1129, 115, 1128, 1125, - /* 580 */ 177, 286, 937, 41, 38, 198, 901, 279, 124, 899, - /* 590 */ 126, 127, 897, 896, 258, 187, 188, 893, 892, 891, - /* 600 */ 890, 889, 888, 282, 887, 191, 193, 884, 882, 880, - /* 610 */ 878, 195, 875, 196, 871, 45, 120, 271, 81, 86, - /* 620 */ 338, 281, 1059, 339, 340, 341, 222, 343, 342, 242, - /* 630 */ 296, 344, 353, 851, 259, 260, 219, 220, 850, 104, - /* 640 */ 916, 915, 262, 263, 849, 832, 895, 894, 831, 267, - /* 650 */ 291, 139, 69, 886, 180, 140, 179, 938, 178, 181, - /* 660 */ 182, 184, 183, 939, 141, 885, 8, 142, 877, 2, - /* 670 */ 1, 876, 725, 28, 273, 167, 87, 751, 155, 157, - /* 680 */ 762, 156, 234, 756, 88, 29, 758, 89, 285, 9, - /* 690 */ 30, 10, 11, 25, 293, 26, 96, 98, 101, 34, - /* 700 */ 100, 628, 35, 102, 663, 661, 660, 659, 657, 656, - /* 710 */ 655, 652, 619, 312, 105, 5, 318, 806, 319, 6, - /* 720 */ 808, 108, 110, 67, 68, 695, 37, 694, 691, 114, - /* 730 */ 644, 116, 642, 634, 640, 636, 638, 632, 630, 665, - /* 740 */ 664, 662, 658, 654, 653, 186, 617, 144, 582, 855, - /* 750 */ 854, 854, 854, 854, 854, 854, 854, 854, 854, 854, - /* 760 */ 854, 145, + /* 0 */ 94, 622, 34, 1008, 622, 21, 246, 700, 205, 623, + /* 10 */ 360, 229, 623, 55, 56, 1000, 59, 60, 160, 1131, + /* 20 */ 249, 49, 48, 47, 1040, 58, 319, 63, 61, 64, + /* 30 */ 62, 997, 998, 31, 1001, 54, 53, 339, 338, 52, + /* 40 */ 51, 50, 55, 56, 231, 59, 60, 242, 1011, 249, + /* 50 */ 49, 48, 47, 297, 58, 319, 63, 61, 64, 62, + /* 60 */ 657, 245, 863, 361, 54, 53, 205, 258, 52, 51, + /* 70 */ 50, 55, 56, 202, 59, 60, 175, 1132, 249, 49, + /* 80 */ 48, 47, 622, 58, 319, 63, 61, 64, 62, 79, + /* 90 */ 623, 1037, 1078, 54, 53, 235, 1017, 52, 51, 50, + /* 100 */ 622, 316, 247, 55, 57, 160, 59, 60, 623, 1030, + /* 110 */ 249, 49, 48, 47, 798, 58, 319, 63, 61, 64, + /* 120 */ 62, 205, 913, 153, 4, 54, 53, 271, 187, 52, + /* 130 */ 51, 50, 1132, 196, 194, 192, 160, 52, 51, 50, + /* 140 */ 191, 139, 138, 137, 136, 316, 572, 573, 574, 575, + /* 150 */ 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, + /* 160 */ 151, 56, 230, 59, 60, 25, 92, 249, 49, 48, + /* 170 */ 47, 97, 58, 319, 63, 61, 64, 62, 321, 1079, + /* 180 */ 80, 289, 54, 53, 160, 34, 52, 51, 50, 59, + /* 190 */ 60, 277, 276, 249, 49, 48, 47, 263, 58, 319, + /* 200 */ 63, 61, 64, 62, 250, 1002, 267, 266, 54, 53, + /* 210 */ 91, 85, 52, 51, 50, 42, 314, 355, 354, 313, + /* 220 */ 312, 311, 353, 310, 309, 308, 352, 307, 351, 350, + /* 230 */ 22, 1010, 980, 968, 969, 970, 971, 972, 973, 974, + /* 240 */ 975, 976, 977, 978, 979, 981, 982, 214, 43, 248, + /* 250 */ 813, 763, 764, 802, 215, 805, 291, 808, 90, 252, + /* 260 */ 135, 134, 133, 216, 205, 248, 813, 324, 85, 802, + /* 270 */ 34, 805, 34, 808, 169, 1132, 12, 63, 61, 64, + /* 280 */ 62, 93, 817, 227, 228, 54, 53, 320, 34, 52, + /* 290 */ 51, 50, 279, 3, 37, 177, 804, 258, 807, 227, + /* 300 */ 228, 103, 108, 99, 106, 43, 176, 34, 727, 34, + /* 310 */ 96, 724, 239, 725, 240, 726, 1011, 34, 1011, 803, + /* 320 */ 303, 806, 258, 349, 257, 122, 744, 270, 203, 77, + /* 330 */ 328, 1012, 65, 34, 1011, 253, 223, 251, 349, 327, + /* 340 */ 326, 254, 255, 42, 208, 355, 354, 272, 65, 329, + /* 350 */ 353, 330, 85, 1011, 352, 1011, 351, 350, 986, 331, + /* 360 */ 984, 985, 35, 1011, 34, 987, 34, 814, 809, 988, + /* 370 */ 73, 989, 990, 1032, 810, 335, 120, 114, 124, 1011, + /* 380 */ 356, 950, 34, 814, 809, 129, 132, 123, 780, 43, + /* 390 */ 810, 84, 54, 53, 126, 78, 52, 51, 50, 1016, + /* 400 */ 259, 923, 256, 1030, 334, 333, 336, 187, 337, 74, + /* 410 */ 1011, 748, 1011, 359, 358, 144, 1030, 811, 150, 148, + /* 420 */ 147, 232, 741, 82, 341, 728, 729, 999, 1011, 241, + /* 430 */ 914, 70, 83, 1014, 233, 760, 187, 243, 770, 800, + /* 440 */ 812, 1014, 209, 771, 710, 779, 294, 7, 712, 296, + /* 450 */ 155, 711, 30, 66, 1151, 836, 815, 210, 24, 35, + /* 460 */ 69, 35, 76, 172, 95, 621, 172, 131, 130, 69, + /* 470 */ 23, 23, 71, 14, 113, 13, 112, 801, 1126, 16, + /* 480 */ 23, 15, 732, 1125, 733, 298, 730, 18, 731, 17, + /* 490 */ 119, 20, 118, 19, 699, 1089, 1143, 1124, 225, 226, + /* 500 */ 206, 207, 211, 204, 212, 213, 218, 219, 1088, 220, + /* 510 */ 217, 237, 201, 1085, 1084, 238, 340, 268, 152, 1039, + /* 520 */ 44, 1050, 149, 1047, 1048, 1031, 274, 1071, 1052, 154, + /* 530 */ 159, 1070, 162, 285, 170, 1009, 171, 1007, 304, 173, + /* 540 */ 167, 174, 927, 278, 1028, 300, 759, 161, 301, 302, + /* 550 */ 164, 305, 306, 163, 234, 199, 40, 288, 280, 282, + /* 560 */ 317, 75, 922, 292, 72, 318, 46, 325, 290, 1150, + /* 570 */ 165, 286, 110, 1149, 1146, 178, 332, 1142, 284, 116, + /* 580 */ 281, 1141, 1138, 179, 947, 41, 36, 45, 200, 911, + /* 590 */ 125, 909, 127, 128, 907, 906, 260, 189, 190, 903, + /* 600 */ 902, 901, 900, 899, 898, 897, 193, 195, 894, 892, + /* 610 */ 890, 888, 197, 885, 198, 881, 121, 342, 273, 81, + /* 620 */ 86, 283, 343, 1072, 344, 345, 347, 346, 348, 224, + /* 630 */ 357, 861, 262, 244, 261, 299, 860, 264, 265, 859, + /* 640 */ 842, 221, 222, 841, 104, 926, 925, 269, 69, 293, + /* 650 */ 8, 275, 735, 87, 158, 26, 156, 905, 904, 186, + /* 660 */ 181, 948, 180, 182, 140, 141, 184, 183, 185, 896, + /* 670 */ 2, 142, 895, 1, 143, 949, 887, 886, 166, 168, + /* 680 */ 29, 1013, 761, 772, 157, 236, 766, 88, 27, 768, + /* 690 */ 89, 287, 9, 28, 10, 11, 38, 295, 721, 39, + /* 700 */ 96, 98, 101, 32, 635, 100, 670, 33, 102, 668, + /* 710 */ 667, 666, 664, 663, 662, 659, 626, 315, 105, 5, + /* 720 */ 107, 816, 322, 6, 818, 323, 109, 67, 111, 68, + /* 730 */ 115, 702, 117, 701, 698, 651, 649, 35, 641, 647, + /* 740 */ 643, 645, 639, 637, 672, 671, 669, 665, 661, 660, + /* 750 */ 188, 589, 624, 145, 865, 864, 864, 864, 864, 864, + /* 760 */ 864, 864, 864, 864, 864, 864, 146, }; static const YYCODETYPE yy_lookahead[] = { - /* 0 */ 206, 1, 242, 205, 199, 200, 246, 242, 205, 9, - /* 10 */ 1, 246, 263, 13, 14, 242, 16, 17, 9, 246, - /* 20 */ 20, 21, 22, 23, 263, 25, 26, 27, 28, 29, - /* 30 */ 30, 237, 238, 239, 240, 35, 36, 197, 198, 39, - /* 40 */ 40, 41, 13, 14, 206, 16, 17, 5, 205, 20, - /* 50 */ 21, 22, 23, 263, 25, 26, 27, 28, 29, 30, - /* 60 */ 221, 263, 223, 224, 35, 36, 263, 228, 39, 40, - /* 70 */ 41, 232, 274, 234, 235, 35, 36, 274, 240, 39, - /* 80 */ 40, 41, 13, 14, 244, 16, 17, 199, 88, 20, - /* 90 */ 21, 22, 23, 84, 25, 26, 27, 28, 29, 30, - /* 100 */ 260, 86, 5, 0, 35, 36, 263, 199, 39, 40, - /* 110 */ 41, 92, 13, 14, 85, 16, 17, 274, 199, 20, - /* 120 */ 21, 22, 23, 1, 25, 26, 27, 28, 29, 30, - /* 130 */ 244, 9, 35, 36, 35, 36, 199, 1, 39, 40, - /* 140 */ 41, 14, 199, 16, 17, 9, 260, 20, 21, 22, - /* 150 */ 23, 243, 25, 26, 27, 28, 29, 30, 199, 271, - /* 160 */ 241, 273, 35, 36, 245, 99, 39, 40, 41, 47, - /* 170 */ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, - /* 180 */ 58, 59, 60, 61, 241, 63, 16, 17, 245, 86, - /* 190 */ 20, 21, 22, 23, 70, 25, 26, 27, 28, 29, - /* 200 */ 30, 263, 265, 266, 138, 35, 36, 126, 127, 39, - /* 210 */ 40, 41, 274, 100, 101, 102, 103, 104, 105, 106, - /* 220 */ 107, 108, 109, 110, 111, 112, 113, 114, 269, 46, - /* 230 */ 271, 221, 222, 223, 224, 225, 226, 227, 228, 229, - /* 240 */ 230, 231, 232, 233, 234, 235, 63, 244, 1, 2, - /* 250 */ 199, 199, 5, 70, 7, 199, 9, 250, 199, 76, - /* 260 */ 77, 78, 79, 260, 1, 2, 83, 84, 5, 145, - /* 270 */ 7, 147, 9, 149, 150, 268, 27, 28, 29, 30, - /* 280 */ 263, 70, 35, 36, 35, 36, 39, 84, 39, 40, - /* 290 */ 41, 84, 241, 241, 84, 88, 245, 245, 35, 36, - /* 300 */ 241, 245, 2, 120, 245, 5, 143, 7, 263, 9, - /* 310 */ 64, 65, 66, 199, 199, 152, 153, 71, 72, 73, - /* 320 */ 74, 75, 199, 120, 117, 142, 100, 144, 102, 103, - /* 330 */ 120, 84, 122, 107, 151, 35, 36, 111, 199, 113, - /* 340 */ 114, 64, 65, 66, 64, 65, 66, 84, 199, 72, - /* 350 */ 73, 74, 75, 73, 74, 75, 145, 199, 147, 199, - /* 360 */ 149, 150, 82, 199, 241, 118, 119, 90, 245, 39, - /* 370 */ 199, 80, 125, 39, 40, 41, 5, 199, 7, 264, - /* 380 */ 241, 118, 119, 92, 245, 271, 208, 5, 125, 7, - /* 390 */ 241, 64, 65, 66, 245, 67, 68, 69, 199, 241, - /* 400 */ 199, 241, 204, 245, 78, 245, 206, 208, 210, 208, - /* 410 */ 219, 220, 241, 99, 247, 99, 245, 204, 118, 119, - /* 420 */ 204, 85, 85, 210, 1, 85, 210, 85, 261, 85, - /* 430 */ 85, 85, 85, 85, 85, 271, 99, 85, 238, 84, - /* 440 */ 124, 99, 85, 99, 99, 99, 99, 99, 99, 85, - /* 450 */ 62, 99, 15, 123, 140, 85, 99, 121, 84, 263, - /* 460 */ 134, 121, 39, 99, 146, 146, 148, 148, 146, 99, - /* 470 */ 148, 116, 84, 5, 5, 7, 7, 146, 146, 148, - /* 480 */ 148, 146, 263, 148, 80, 81, 263, 263, 263, 115, - /* 490 */ 263, 263, 263, 263, 263, 263, 125, 263, 263, 263, - /* 500 */ 263, 263, 263, 246, 246, 246, 244, 125, 236, 236, - /* 510 */ 236, 236, 236, 262, 236, 236, 199, 272, 248, 199, - /* 520 */ 199, 62, 199, 199, 199, 244, 244, 272, 199, 244, - /* 530 */ 259, 267, 199, 267, 267, 267, 249, 199, 199, 255, - /* 540 */ 199, 258, 199, 257, 125, 256, 254, 253, 252, 199, - /* 550 */ 199, 91, 199, 199, 132, 118, 129, 199, 199, 199, - /* 560 */ 199, 199, 199, 137, 199, 199, 199, 199, 199, 139, - /* 570 */ 136, 199, 199, 135, 199, 199, 199, 199, 199, 199, - /* 580 */ 199, 130, 199, 199, 199, 199, 199, 131, 199, 199, - /* 590 */ 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, - /* 600 */ 199, 199, 199, 128, 199, 199, 199, 199, 199, 199, - /* 610 */ 199, 199, 199, 199, 199, 141, 98, 201, 201, 201, - /* 620 */ 97, 201, 201, 53, 94, 96, 201, 95, 57, 201, - /* 630 */ 201, 93, 86, 5, 154, 5, 201, 201, 5, 206, - /* 640 */ 209, 209, 154, 5, 5, 102, 201, 201, 101, 143, - /* 650 */ 116, 202, 121, 201, 212, 202, 216, 218, 217, 215, - /* 660 */ 213, 211, 214, 220, 202, 201, 84, 202, 201, 203, - /* 670 */ 207, 201, 85, 84, 99, 251, 99, 85, 84, 99, - /* 680 */ 85, 84, 1, 85, 84, 99, 85, 84, 84, 133, - /* 690 */ 99, 133, 84, 84, 116, 84, 117, 80, 72, 89, - /* 700 */ 88, 5, 89, 88, 9, 5, 5, 5, 5, 5, - /* 710 */ 5, 5, 87, 15, 80, 84, 26, 85, 61, 84, - /* 720 */ 118, 148, 148, 16, 16, 5, 99, 5, 85, 148, - /* 730 */ 5, 148, 5, 5, 5, 5, 5, 5, 5, 5, - /* 740 */ 5, 5, 5, 5, 5, 99, 87, 21, 62, 0, - /* 750 */ 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, - /* 760 */ 275, 21, 275, 275, 275, 275, 275, 275, 275, 275, - /* 770 */ 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, - /* 780 */ 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, - /* 790 */ 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, - /* 800 */ 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, - /* 810 */ 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, - /* 820 */ 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, - /* 830 */ 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, - /* 840 */ 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, - /* 850 */ 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, - /* 860 */ 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, - /* 870 */ 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, - /* 880 */ 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, - /* 890 */ 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, - /* 900 */ 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, - /* 910 */ 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, - /* 920 */ 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, - /* 930 */ 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, - /* 940 */ 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, - /* 950 */ 275, 275, 275, 275, 275, 275, 275, 275, + /* 0 */ 207, 1, 200, 200, 1, 266, 206, 5, 266, 9, + /* 10 */ 200, 201, 9, 13, 14, 0, 16, 17, 200, 277, + /* 20 */ 20, 21, 22, 23, 200, 25, 26, 27, 28, 29, + /* 30 */ 30, 238, 239, 240, 241, 35, 36, 35, 36, 39, + /* 40 */ 40, 41, 13, 14, 242, 16, 17, 244, 246, 20, + /* 50 */ 21, 22, 23, 36, 25, 26, 27, 28, 29, 30, + /* 60 */ 5, 206, 198, 199, 35, 36, 266, 200, 39, 40, + /* 70 */ 41, 13, 14, 266, 16, 17, 209, 277, 20, 21, + /* 80 */ 22, 23, 1, 25, 26, 27, 28, 29, 30, 89, + /* 90 */ 9, 267, 274, 35, 36, 248, 249, 39, 40, 41, + /* 100 */ 1, 86, 62, 13, 14, 200, 16, 17, 9, 245, + /* 110 */ 20, 21, 22, 23, 85, 25, 26, 27, 28, 29, + /* 120 */ 30, 266, 205, 200, 84, 35, 36, 263, 211, 39, + /* 130 */ 40, 41, 277, 64, 65, 66, 200, 39, 40, 41, + /* 140 */ 71, 72, 73, 74, 75, 86, 47, 48, 49, 50, + /* 150 */ 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, + /* 160 */ 61, 14, 63, 16, 17, 84, 250, 20, 21, 22, + /* 170 */ 23, 207, 25, 26, 27, 28, 29, 30, 15, 274, + /* 180 */ 264, 276, 35, 36, 200, 200, 39, 40, 41, 16, + /* 190 */ 17, 268, 269, 20, 21, 22, 23, 144, 25, 26, + /* 200 */ 27, 28, 29, 30, 206, 241, 153, 154, 35, 36, + /* 210 */ 274, 84, 39, 40, 41, 101, 102, 103, 104, 105, + /* 220 */ 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, + /* 230 */ 46, 246, 222, 223, 224, 225, 226, 227, 228, 229, + /* 240 */ 230, 231, 232, 233, 234, 235, 236, 63, 121, 1, + /* 250 */ 2, 127, 128, 5, 70, 7, 272, 9, 274, 70, + /* 260 */ 76, 77, 78, 79, 266, 1, 2, 83, 84, 5, + /* 270 */ 200, 7, 200, 9, 253, 277, 84, 27, 28, 29, + /* 280 */ 30, 89, 119, 35, 36, 35, 36, 39, 200, 39, + /* 290 */ 40, 41, 271, 64, 65, 66, 5, 200, 7, 35, + /* 300 */ 36, 72, 73, 74, 75, 121, 209, 200, 2, 200, + /* 310 */ 118, 5, 242, 7, 242, 9, 246, 200, 246, 5, + /* 320 */ 91, 7, 200, 93, 70, 80, 39, 143, 266, 145, + /* 330 */ 242, 209, 84, 200, 246, 146, 152, 148, 93, 150, + /* 340 */ 151, 35, 36, 101, 266, 103, 104, 85, 84, 242, + /* 350 */ 108, 242, 84, 246, 112, 246, 114, 115, 222, 242, + /* 360 */ 224, 225, 100, 246, 200, 229, 200, 119, 120, 233, + /* 370 */ 100, 235, 236, 245, 126, 242, 64, 65, 66, 246, + /* 380 */ 220, 221, 200, 119, 120, 73, 74, 75, 78, 121, + /* 390 */ 126, 123, 35, 36, 82, 207, 39, 40, 41, 249, + /* 400 */ 146, 205, 148, 245, 150, 151, 242, 211, 242, 139, + /* 410 */ 246, 124, 246, 67, 68, 69, 245, 126, 64, 65, + /* 420 */ 66, 263, 100, 85, 242, 119, 120, 239, 246, 243, + /* 430 */ 205, 100, 85, 247, 263, 85, 211, 243, 85, 1, + /* 440 */ 126, 247, 266, 85, 85, 135, 85, 125, 85, 85, + /* 450 */ 100, 85, 84, 100, 249, 85, 85, 266, 100, 100, + /* 460 */ 122, 100, 84, 100, 100, 85, 100, 80, 81, 122, + /* 470 */ 100, 100, 141, 147, 147, 149, 149, 39, 266, 147, + /* 480 */ 100, 149, 5, 266, 7, 117, 5, 147, 7, 149, + /* 490 */ 147, 147, 149, 149, 116, 237, 249, 266, 266, 266, + /* 500 */ 266, 266, 266, 266, 266, 266, 266, 266, 237, 266, + /* 510 */ 266, 237, 266, 237, 237, 237, 237, 200, 200, 200, + /* 520 */ 265, 200, 62, 200, 200, 245, 245, 275, 200, 200, + /* 530 */ 200, 275, 260, 200, 251, 245, 200, 200, 92, 200, + /* 540 */ 255, 200, 200, 270, 262, 200, 126, 261, 200, 200, + /* 550 */ 258, 200, 200, 259, 270, 200, 200, 131, 270, 270, + /* 560 */ 200, 138, 200, 133, 140, 200, 137, 200, 136, 200, + /* 570 */ 257, 130, 200, 200, 200, 200, 200, 200, 129, 200, + /* 580 */ 132, 200, 200, 200, 200, 200, 200, 142, 200, 200, + /* 590 */ 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, + /* 600 */ 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, + /* 610 */ 200, 200, 200, 200, 200, 200, 99, 98, 202, 202, + /* 620 */ 202, 202, 53, 202, 95, 97, 96, 57, 94, 202, + /* 630 */ 86, 5, 5, 202, 155, 202, 5, 155, 5, 5, + /* 640 */ 103, 202, 202, 102, 207, 210, 210, 144, 122, 117, + /* 650 */ 84, 100, 85, 100, 100, 84, 84, 202, 202, 212, + /* 660 */ 217, 219, 218, 213, 203, 203, 214, 216, 215, 202, + /* 670 */ 204, 203, 202, 208, 203, 221, 202, 202, 256, 254, + /* 680 */ 252, 247, 85, 85, 84, 1, 85, 84, 100, 85, + /* 690 */ 84, 84, 134, 100, 134, 84, 84, 117, 5, 84, + /* 700 */ 118, 80, 72, 90, 5, 89, 9, 90, 89, 5, + /* 710 */ 5, 5, 5, 5, 5, 5, 87, 15, 80, 84, + /* 720 */ 88, 85, 26, 84, 119, 61, 149, 16, 149, 16, + /* 730 */ 149, 5, 149, 5, 85, 5, 5, 100, 5, 5, + /* 740 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + /* 750 */ 100, 62, 87, 21, 0, 278, 278, 278, 278, 278, + /* 760 */ 278, 278, 278, 278, 278, 278, 21, 278, 278, 278, + /* 770 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, + /* 780 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, + /* 790 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, + /* 800 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, + /* 810 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, + /* 820 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, + /* 830 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, + /* 840 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, + /* 850 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, + /* 860 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, + /* 870 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, + /* 880 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, + /* 890 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, + /* 900 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, + /* 910 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, + /* 920 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, + /* 930 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, + /* 940 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, + /* 950 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, + /* 960 */ 278, 278, 278, 278, }; -#define YY_SHIFT_COUNT (357) +#define YY_SHIFT_COUNT (361) #define YY_SHIFT_MIN (0) -#define YY_SHIFT_MAX (749) +#define YY_SHIFT_MAX (754) static const unsigned short int yy_shift_ofst[] = { - /* 0 */ 183, 113, 226, 15, 247, 263, 263, 9, 136, 136, - /* 10 */ 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, - /* 20 */ 136, 0, 122, 263, 300, 300, 300, 203, 203, 136, - /* 30 */ 136, 81, 136, 103, 136, 136, 136, 136, 291, 15, - /* 40 */ 19, 19, 42, 762, 263, 263, 263, 263, 263, 263, - /* 50 */ 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, - /* 60 */ 263, 263, 263, 263, 263, 263, 300, 300, 300, 210, - /* 70 */ 97, 97, 97, 97, 97, 97, 97, 136, 136, 136, - /* 80 */ 330, 136, 136, 136, 203, 203, 136, 136, 136, 136, - /* 90 */ 326, 326, 316, 203, 136, 136, 136, 136, 136, 136, - /* 100 */ 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, - /* 110 */ 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, - /* 120 */ 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, - /* 130 */ 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, - /* 140 */ 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, - /* 150 */ 136, 459, 459, 459, 419, 419, 419, 419, 459, 459, - /* 160 */ 426, 430, 422, 434, 438, 451, 427, 475, 456, 474, - /* 170 */ 459, 459, 459, 460, 460, 15, 459, 459, 518, 523, - /* 180 */ 570, 530, 529, 571, 532, 538, 42, 459, 459, 546, - /* 190 */ 546, 459, 546, 459, 546, 459, 459, 762, 762, 29, - /* 200 */ 69, 69, 99, 69, 127, 170, 249, 249, 249, 249, - /* 210 */ 249, 249, 277, 246, 280, 40, 40, 40, 40, 124, - /* 220 */ 211, 163, 207, 334, 334, 371, 382, 328, 327, 337, - /* 230 */ 336, 340, 342, 344, 345, 314, 66, 346, 347, 348, - /* 240 */ 349, 352, 355, 357, 364, 423, 388, 437, 370, 318, - /* 250 */ 319, 322, 468, 469, 331, 332, 374, 335, 404, 628, - /* 260 */ 480, 630, 633, 488, 638, 639, 543, 547, 506, 531, - /* 270 */ 534, 582, 587, 589, 575, 577, 592, 594, 595, 597, - /* 280 */ 598, 580, 600, 601, 603, 681, 604, 586, 556, 591, - /* 290 */ 558, 608, 534, 609, 578, 611, 579, 617, 610, 612, - /* 300 */ 626, 696, 613, 615, 695, 700, 701, 702, 703, 704, - /* 310 */ 705, 706, 625, 698, 634, 631, 632, 602, 635, 690, - /* 320 */ 657, 707, 573, 574, 627, 627, 627, 627, 708, 581, - /* 330 */ 583, 627, 627, 627, 720, 722, 643, 627, 725, 727, - /* 340 */ 728, 729, 730, 731, 732, 733, 734, 735, 736, 737, - /* 350 */ 738, 739, 646, 659, 726, 740, 686, 749, + /* 0 */ 184, 114, 242, 59, 248, 264, 264, 81, 3, 3, + /* 10 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + /* 20 */ 3, 0, 99, 264, 306, 127, 127, 3, 3, 124, + /* 30 */ 3, 15, 3, 3, 3, 3, 245, 59, 17, 17, + /* 40 */ 230, 230, 55, 767, 264, 264, 264, 264, 264, 264, + /* 50 */ 264, 264, 264, 264, 264, 264, 264, 264, 264, 264, + /* 60 */ 264, 264, 264, 264, 264, 264, 306, 306, 306, 268, + /* 70 */ 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, + /* 80 */ 287, 3, 3, 3, 127, 127, 3, 3, 3, 3, + /* 90 */ 310, 310, 322, 127, 3, 3, 3, 3, 3, 3, + /* 100 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + /* 110 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + /* 120 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + /* 130 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + /* 140 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + /* 150 */ 3, 3, 460, 460, 460, 420, 420, 420, 420, 460, + /* 160 */ 460, 423, 424, 430, 429, 432, 426, 441, 449, 448, + /* 170 */ 445, 460, 17, 460, 460, 446, 446, 59, 460, 460, + /* 180 */ 517, 519, 569, 529, 528, 570, 530, 534, 55, 460, + /* 190 */ 460, 544, 544, 460, 544, 460, 544, 460, 460, 767, + /* 200 */ 767, 29, 58, 58, 90, 58, 147, 173, 250, 250, + /* 210 */ 250, 250, 250, 250, 229, 69, 312, 357, 357, 357, + /* 220 */ 357, 189, 254, 53, 192, 98, 98, 291, 314, 346, + /* 230 */ 354, 262, 338, 347, 350, 353, 358, 331, 270, 359, + /* 240 */ 361, 363, 364, 366, 368, 370, 371, 438, 40, 163, + /* 250 */ 380, 326, 327, 332, 477, 481, 340, 343, 378, 344, + /* 260 */ 387, 626, 479, 627, 631, 482, 633, 634, 537, 541, + /* 270 */ 503, 526, 532, 566, 567, 571, 551, 553, 597, 572, + /* 280 */ 598, 600, 601, 554, 603, 604, 606, 684, 607, 588, + /* 290 */ 558, 593, 560, 611, 532, 612, 580, 693, 615, 582, + /* 300 */ 621, 613, 616, 630, 699, 617, 619, 697, 704, 705, + /* 310 */ 706, 707, 708, 709, 710, 629, 702, 638, 632, 635, + /* 320 */ 636, 605, 639, 696, 664, 711, 577, 579, 637, 637, + /* 330 */ 637, 637, 713, 581, 583, 637, 637, 637, 726, 728, + /* 340 */ 649, 637, 730, 731, 733, 734, 735, 736, 737, 738, + /* 350 */ 739, 740, 741, 742, 743, 744, 650, 665, 732, 745, + /* 360 */ 689, 754, }; -#define YY_REDUCE_COUNT (198) -#define YY_REDUCE_MIN (-251) -#define YY_REDUCE_MAX (470) +#define YY_REDUCE_COUNT (200) +#define YY_REDUCE_MIN (-261) +#define YY_REDUCE_MAX (475) static const short yy_reduce_ofst[] = { - /* 0 */ -160, 10, -161, -206, -202, -197, -157, -63, -81, -112, - /* 10 */ -41, -57, 51, 52, 59, 123, 139, 149, 158, 160, - /* 20 */ 171, 115, -195, -62, -240, -235, -227, -114, 3, 114, - /* 30 */ 164, 7, -92, -162, 178, 199, 201, 56, 198, 200, - /* 40 */ 213, 216, 191, 167, -251, -239, -210, 17, 45, 196, - /* 50 */ 219, 223, 224, 225, 227, 228, 229, 230, 231, 232, - /* 60 */ 234, 235, 236, 237, 238, 239, 257, 258, 259, 262, - /* 70 */ 272, 273, 274, 275, 276, 278, 279, 317, 320, 321, - /* 80 */ 251, 323, 324, 325, 281, 282, 329, 333, 338, 339, - /* 90 */ 245, 255, 270, 285, 341, 343, 350, 351, 353, 354, - /* 100 */ 358, 359, 360, 361, 362, 363, 365, 366, 367, 368, - /* 110 */ 369, 372, 373, 375, 376, 377, 378, 379, 380, 381, - /* 120 */ 383, 384, 385, 386, 387, 389, 390, 391, 392, 393, + /* 0 */ -136, 10, 136, -207, -200, -145, -2, -77, -198, -95, + /* 10 */ -16, 70, 72, 88, 107, 109, 117, 133, 164, 166, + /* 20 */ 182, -176, -190, -258, -153, 158, 171, -182, -64, 21, + /* 30 */ -197, -36, -133, 97, 122, -15, -83, 188, 186, 194, + /* 40 */ 196, 225, 160, -84, -261, -193, 62, 78, 176, 191, + /* 50 */ 212, 217, 231, 232, 233, 234, 235, 236, 237, 238, + /* 60 */ 239, 240, 241, 243, 244, 246, 150, 205, 247, 128, + /* 70 */ 258, 271, 274, 276, 277, 278, 279, 317, 318, 319, + /* 80 */ 255, 321, 323, 324, 280, 281, 328, 329, 330, 333, + /* 90 */ 252, 256, 283, 290, 336, 337, 339, 341, 342, 345, + /* 100 */ 348, 349, 351, 352, 355, 356, 360, 362, 365, 367, + /* 110 */ 369, 372, 373, 374, 375, 376, 377, 379, 381, 382, + /* 120 */ 383, 384, 385, 386, 388, 389, 390, 391, 392, 393, /* 130 */ 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, - /* 140 */ 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, - /* 150 */ 415, 416, 417, 418, 264, 266, 267, 268, 420, 421, - /* 160 */ 271, 283, 286, 289, 284, 292, 294, 296, 424, 287, - /* 170 */ 425, 428, 429, 431, 432, 433, 435, 436, 439, 441, - /* 180 */ 440, 442, 444, 447, 448, 450, 443, 445, 446, 449, - /* 190 */ 453, 452, 462, 464, 465, 467, 470, 463, 466, + /* 140 */ 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, + /* 150 */ 414, 415, 416, 417, 418, 273, 284, 288, 289, 419, + /* 160 */ 421, 282, 286, 272, 294, 292, 313, 422, 285, 425, + /* 170 */ 428, 427, 434, 431, 433, 435, 436, 437, 439, 440, + /* 180 */ 442, 444, 443, 450, 451, 452, 453, 447, 454, 455, + /* 190 */ 456, 461, 462, 467, 468, 470, 471, 474, 475, 465, + /* 200 */ 466, }; static const YYACTIONTYPE yy_default[] = { - /* 0 */ 852, 914, 902, 911, 1121, 1121, 1121, 852, 852, 852, - /* 10 */ 852, 852, 852, 852, 852, 852, 852, 852, 852, 852, - /* 20 */ 852, 1028, 872, 1121, 852, 852, 852, 852, 852, 852, - /* 30 */ 852, 1043, 852, 911, 852, 852, 852, 852, 920, 911, - /* 40 */ 920, 920, 852, 1023, 852, 852, 852, 852, 852, 852, - /* 50 */ 852, 852, 852, 852, 852, 852, 852, 852, 852, 852, - /* 60 */ 852, 852, 852, 852, 852, 852, 852, 852, 852, 852, - /* 70 */ 852, 852, 852, 852, 852, 852, 852, 852, 852, 852, - /* 80 */ 1030, 1036, 1033, 852, 852, 852, 1038, 852, 852, 852, - /* 90 */ 1062, 1062, 1021, 852, 852, 852, 852, 852, 852, 852, - /* 100 */ 852, 852, 852, 852, 852, 852, 852, 852, 852, 852, - /* 110 */ 852, 852, 852, 852, 852, 852, 852, 852, 852, 852, - /* 120 */ 852, 852, 852, 852, 900, 852, 898, 852, 852, 852, - /* 130 */ 852, 852, 852, 852, 852, 852, 852, 852, 852, 852, - /* 140 */ 852, 852, 852, 883, 852, 852, 852, 852, 852, 852, - /* 150 */ 870, 874, 874, 874, 852, 852, 852, 852, 874, 874, - /* 160 */ 1069, 1073, 1055, 1067, 1063, 1050, 1048, 1046, 1054, 1077, - /* 170 */ 874, 874, 874, 918, 918, 911, 874, 874, 936, 934, - /* 180 */ 932, 924, 930, 926, 928, 922, 852, 874, 874, 909, - /* 190 */ 909, 874, 909, 874, 909, 874, 874, 957, 973, 852, - /* 200 */ 1078, 1068, 852, 1120, 1108, 1107, 1116, 1115, 1114, 1106, - /* 210 */ 1105, 1104, 852, 852, 852, 1100, 1103, 1102, 1101, 852, - /* 220 */ 852, 852, 852, 1110, 1109, 852, 852, 852, 852, 852, - /* 230 */ 852, 852, 852, 852, 852, 1074, 1070, 852, 852, 852, - /* 240 */ 852, 852, 852, 852, 852, 852, 1080, 852, 852, 852, - /* 250 */ 852, 852, 852, 852, 852, 852, 981, 852, 852, 852, - /* 260 */ 852, 852, 852, 852, 852, 852, 852, 852, 852, 1020, - /* 270 */ 852, 852, 852, 852, 1032, 1031, 852, 852, 852, 852, - /* 280 */ 852, 852, 852, 852, 852, 852, 852, 1064, 852, 1056, - /* 290 */ 852, 852, 993, 852, 852, 852, 852, 852, 852, 852, - /* 300 */ 852, 852, 852, 852, 852, 852, 852, 852, 852, 852, - /* 310 */ 852, 852, 852, 852, 852, 852, 852, 852, 852, 852, - /* 320 */ 852, 852, 852, 852, 1139, 1134, 1135, 1132, 852, 852, - /* 330 */ 852, 1131, 1126, 1127, 852, 852, 852, 1124, 852, 852, - /* 340 */ 852, 852, 852, 852, 852, 852, 852, 852, 852, 852, - /* 350 */ 852, 852, 942, 852, 881, 879, 852, 852, + /* 0 */ 862, 924, 912, 921, 1134, 1134, 1134, 862, 862, 862, + /* 10 */ 862, 862, 862, 862, 862, 862, 862, 862, 862, 862, + /* 20 */ 862, 1041, 882, 1134, 862, 862, 862, 862, 862, 1056, + /* 30 */ 862, 921, 862, 862, 862, 862, 930, 921, 862, 862, + /* 40 */ 930, 930, 862, 1036, 862, 862, 862, 862, 862, 862, + /* 50 */ 862, 862, 862, 862, 862, 862, 862, 862, 862, 862, + /* 60 */ 862, 862, 862, 862, 862, 862, 862, 862, 862, 862, + /* 70 */ 862, 862, 862, 862, 862, 862, 862, 862, 862, 862, + /* 80 */ 1043, 1049, 1046, 862, 862, 862, 1051, 862, 862, 862, + /* 90 */ 1075, 1075, 1034, 862, 862, 862, 862, 862, 862, 862, + /* 100 */ 862, 862, 862, 862, 862, 862, 862, 862, 862, 862, + /* 110 */ 862, 862, 862, 862, 862, 862, 862, 862, 862, 862, + /* 120 */ 862, 862, 862, 862, 862, 910, 862, 908, 862, 862, + /* 130 */ 862, 862, 862, 862, 862, 862, 862, 862, 862, 862, + /* 140 */ 862, 862, 862, 862, 893, 862, 862, 862, 862, 862, + /* 150 */ 862, 880, 884, 884, 884, 862, 862, 862, 862, 884, + /* 160 */ 884, 1082, 1086, 1068, 1080, 1076, 1063, 1061, 1059, 1067, + /* 170 */ 1090, 884, 862, 884, 884, 928, 928, 921, 884, 884, + /* 180 */ 946, 944, 942, 934, 940, 936, 938, 932, 862, 884, + /* 190 */ 884, 919, 919, 884, 919, 884, 919, 884, 884, 967, + /* 200 */ 983, 862, 1091, 1081, 862, 1133, 1121, 1120, 1129, 1128, + /* 210 */ 1127, 1119, 1118, 1117, 862, 862, 862, 1113, 1116, 1115, + /* 220 */ 1114, 862, 862, 862, 862, 1123, 1122, 862, 862, 862, + /* 230 */ 862, 862, 862, 862, 862, 862, 862, 1087, 1083, 862, + /* 240 */ 862, 862, 862, 862, 862, 862, 862, 862, 1093, 862, + /* 250 */ 862, 862, 862, 862, 862, 862, 862, 862, 991, 862, + /* 260 */ 862, 862, 862, 862, 862, 862, 862, 862, 862, 862, + /* 270 */ 862, 1033, 862, 862, 862, 862, 1045, 1044, 862, 862, + /* 280 */ 862, 862, 862, 862, 862, 862, 862, 862, 862, 1077, + /* 290 */ 862, 1069, 862, 862, 1003, 862, 862, 862, 862, 862, + /* 300 */ 862, 862, 862, 862, 862, 862, 862, 862, 862, 862, + /* 310 */ 862, 862, 862, 862, 862, 862, 862, 862, 862, 862, + /* 320 */ 862, 862, 862, 862, 862, 862, 862, 862, 1152, 1147, + /* 330 */ 1148, 1145, 862, 862, 862, 1144, 1139, 1140, 862, 862, + /* 340 */ 862, 1137, 862, 862, 862, 862, 862, 862, 862, 862, + /* 350 */ 862, 862, 862, 862, 862, 862, 952, 862, 891, 889, + /* 360 */ 862, 862, }; /********** End of lemon-generated parsing tables *****************************/ @@ -594,6 +598,7 @@ static const YYCODETYPE yyFallback[] = { 0, /* RP => nothing */ 0, /* IF => nothing */ 0, /* EXISTS => nothing */ + 0, /* PORT => nothing */ 0, /* AS => nothing */ 0, /* OUTPUTTYPE => nothing */ 0, /* AGGREGATE => nothing */ @@ -876,193 +881,196 @@ static const char *const yyTokenName[] = { /* 85 */ "RP", /* 86 */ "IF", /* 87 */ "EXISTS", - /* 88 */ "AS", - /* 89 */ "OUTPUTTYPE", - /* 90 */ "AGGREGATE", - /* 91 */ "BUFSIZE", - /* 92 */ "PPS", - /* 93 */ "TSERIES", - /* 94 */ "DBS", - /* 95 */ "STORAGE", - /* 96 */ "QTIME", - /* 97 */ "CONNS", - /* 98 */ "STATE", - /* 99 */ "COMMA", - /* 100 */ "KEEP", - /* 101 */ "CACHE", - /* 102 */ "REPLICA", - /* 103 */ "QUORUM", - /* 104 */ "DAYS", - /* 105 */ "MINROWS", - /* 106 */ "MAXROWS", - /* 107 */ "BLOCKS", - /* 108 */ "CTIME", - /* 109 */ "WAL", - /* 110 */ "FSYNC", - /* 111 */ "COMP", - /* 112 */ "PRECISION", - /* 113 */ "UPDATE", - /* 114 */ "CACHELAST", - /* 115 */ "UNSIGNED", - /* 116 */ "TAGS", - /* 117 */ "USING", - /* 118 */ "NULL", - /* 119 */ "NOW", - /* 120 */ "SELECT", - /* 121 */ "UNION", - /* 122 */ "ALL", - /* 123 */ "DISTINCT", - /* 124 */ "FROM", - /* 125 */ "VARIABLE", - /* 126 */ "INTERVAL", - /* 127 */ "EVERY", - /* 128 */ "SESSION", - /* 129 */ "STATE_WINDOW", - /* 130 */ "FILL", - /* 131 */ "SLIDING", - /* 132 */ "ORDER", - /* 133 */ "BY", - /* 134 */ "ASC", - /* 135 */ "GROUP", - /* 136 */ "HAVING", - /* 137 */ "LIMIT", - /* 138 */ "OFFSET", - /* 139 */ "SLIMIT", - /* 140 */ "SOFFSET", - /* 141 */ "WHERE", - /* 142 */ "RESET", - /* 143 */ "QUERY", - /* 144 */ "SYNCDB", - /* 145 */ "ADD", - /* 146 */ "COLUMN", - /* 147 */ "MODIFY", - /* 148 */ "TAG", - /* 149 */ "CHANGE", - /* 150 */ "SET", - /* 151 */ "KILL", - /* 152 */ "CONNECTION", - /* 153 */ "STREAM", - /* 154 */ "COLON", - /* 155 */ "ABORT", - /* 156 */ "AFTER", - /* 157 */ "ATTACH", - /* 158 */ "BEFORE", - /* 159 */ "BEGIN", - /* 160 */ "CASCADE", - /* 161 */ "CLUSTER", - /* 162 */ "CONFLICT", - /* 163 */ "COPY", - /* 164 */ "DEFERRED", - /* 165 */ "DELIMITERS", - /* 166 */ "DETACH", - /* 167 */ "EACH", - /* 168 */ "END", - /* 169 */ "EXPLAIN", - /* 170 */ "FAIL", - /* 171 */ "FOR", - /* 172 */ "IGNORE", - /* 173 */ "IMMEDIATE", - /* 174 */ "INITIALLY", - /* 175 */ "INSTEAD", - /* 176 */ "KEY", - /* 177 */ "OF", - /* 178 */ "RAISE", - /* 179 */ "REPLACE", - /* 180 */ "RESTRICT", - /* 181 */ "ROW", - /* 182 */ "STATEMENT", - /* 183 */ "TRIGGER", - /* 184 */ "VIEW", - /* 185 */ "IPTOKEN", - /* 186 */ "SEMI", - /* 187 */ "NONE", - /* 188 */ "PREV", - /* 189 */ "LINEAR", - /* 190 */ "IMPORT", - /* 191 */ "TBNAME", - /* 192 */ "JOIN", - /* 193 */ "INSERT", - /* 194 */ "INTO", - /* 195 */ "VALUES", - /* 196 */ "error", - /* 197 */ "program", - /* 198 */ "cmd", - /* 199 */ "ids", - /* 200 */ "dbPrefix", - /* 201 */ "cpxName", - /* 202 */ "ifexists", - /* 203 */ "alter_db_optr", - /* 204 */ "acct_optr", - /* 205 */ "exprlist", - /* 206 */ "ifnotexists", - /* 207 */ "db_optr", - /* 208 */ "typename", - /* 209 */ "bufsize", - /* 210 */ "pps", - /* 211 */ "tseries", - /* 212 */ "dbs", - /* 213 */ "streams", - /* 214 */ "storage", - /* 215 */ "qtime", - /* 216 */ "users", - /* 217 */ "conns", - /* 218 */ "state", - /* 219 */ "intitemlist", - /* 220 */ "intitem", - /* 221 */ "keep", - /* 222 */ "cache", - /* 223 */ "replica", - /* 224 */ "quorum", - /* 225 */ "days", - /* 226 */ "minrows", - /* 227 */ "maxrows", - /* 228 */ "blocks", - /* 229 */ "ctime", - /* 230 */ "wal", - /* 231 */ "fsync", - /* 232 */ "comp", - /* 233 */ "prec", - /* 234 */ "update", - /* 235 */ "cachelast", - /* 236 */ "signed", - /* 237 */ "create_table_args", - /* 238 */ "create_stable_args", - /* 239 */ "create_table_list", - /* 240 */ "create_from_stable", - /* 241 */ "columnlist", - /* 242 */ "tagitemlist", - /* 243 */ "tagNamelist", - /* 244 */ "select", - /* 245 */ "column", - /* 246 */ "tagitem", - /* 247 */ "selcollist", - /* 248 */ "from", - /* 249 */ "where_opt", - /* 250 */ "interval_option", - /* 251 */ "sliding_opt", - /* 252 */ "session_option", - /* 253 */ "windowstate_option", - /* 254 */ "fill_opt", - /* 255 */ "groupby_opt", - /* 256 */ "having_opt", - /* 257 */ "orderby_opt", - /* 258 */ "slimit_opt", - /* 259 */ "limit_opt", - /* 260 */ "union", - /* 261 */ "sclp", - /* 262 */ "distinct", - /* 263 */ "expr", - /* 264 */ "as", - /* 265 */ "tablelist", - /* 266 */ "sub", - /* 267 */ "tmvar", - /* 268 */ "intervalKey", - /* 269 */ "sortlist", - /* 270 */ "sortitem", - /* 271 */ "item", - /* 272 */ "sortorder", - /* 273 */ "grouplist", - /* 274 */ "expritem", + /* 88 */ "PORT", + /* 89 */ "AS", + /* 90 */ "OUTPUTTYPE", + /* 91 */ "AGGREGATE", + /* 92 */ "BUFSIZE", + /* 93 */ "PPS", + /* 94 */ "TSERIES", + /* 95 */ "DBS", + /* 96 */ "STORAGE", + /* 97 */ "QTIME", + /* 98 */ "CONNS", + /* 99 */ "STATE", + /* 100 */ "COMMA", + /* 101 */ "KEEP", + /* 102 */ "CACHE", + /* 103 */ "REPLICA", + /* 104 */ "QUORUM", + /* 105 */ "DAYS", + /* 106 */ "MINROWS", + /* 107 */ "MAXROWS", + /* 108 */ "BLOCKS", + /* 109 */ "CTIME", + /* 110 */ "WAL", + /* 111 */ "FSYNC", + /* 112 */ "COMP", + /* 113 */ "PRECISION", + /* 114 */ "UPDATE", + /* 115 */ "CACHELAST", + /* 116 */ "UNSIGNED", + /* 117 */ "TAGS", + /* 118 */ "USING", + /* 119 */ "NULL", + /* 120 */ "NOW", + /* 121 */ "SELECT", + /* 122 */ "UNION", + /* 123 */ "ALL", + /* 124 */ "DISTINCT", + /* 125 */ "FROM", + /* 126 */ "VARIABLE", + /* 127 */ "INTERVAL", + /* 128 */ "EVERY", + /* 129 */ "SESSION", + /* 130 */ "STATE_WINDOW", + /* 131 */ "FILL", + /* 132 */ "SLIDING", + /* 133 */ "ORDER", + /* 134 */ "BY", + /* 135 */ "ASC", + /* 136 */ "GROUP", + /* 137 */ "HAVING", + /* 138 */ "LIMIT", + /* 139 */ "OFFSET", + /* 140 */ "SLIMIT", + /* 141 */ "SOFFSET", + /* 142 */ "WHERE", + /* 143 */ "RESET", + /* 144 */ "QUERY", + /* 145 */ "SYNCDB", + /* 146 */ "ADD", + /* 147 */ "COLUMN", + /* 148 */ "MODIFY", + /* 149 */ "TAG", + /* 150 */ "CHANGE", + /* 151 */ "SET", + /* 152 */ "KILL", + /* 153 */ "CONNECTION", + /* 154 */ "STREAM", + /* 155 */ "COLON", + /* 156 */ "ABORT", + /* 157 */ "AFTER", + /* 158 */ "ATTACH", + /* 159 */ "BEFORE", + /* 160 */ "BEGIN", + /* 161 */ "CASCADE", + /* 162 */ "CLUSTER", + /* 163 */ "CONFLICT", + /* 164 */ "COPY", + /* 165 */ "DEFERRED", + /* 166 */ "DELIMITERS", + /* 167 */ "DETACH", + /* 168 */ "EACH", + /* 169 */ "END", + /* 170 */ "EXPLAIN", + /* 171 */ "FAIL", + /* 172 */ "FOR", + /* 173 */ "IGNORE", + /* 174 */ "IMMEDIATE", + /* 175 */ "INITIALLY", + /* 176 */ "INSTEAD", + /* 177 */ "KEY", + /* 178 */ "OF", + /* 179 */ "RAISE", + /* 180 */ "REPLACE", + /* 181 */ "RESTRICT", + /* 182 */ "ROW", + /* 183 */ "STATEMENT", + /* 184 */ "TRIGGER", + /* 185 */ "VIEW", + /* 186 */ "IPTOKEN", + /* 187 */ "SEMI", + /* 188 */ "NONE", + /* 189 */ "PREV", + /* 190 */ "LINEAR", + /* 191 */ "IMPORT", + /* 192 */ "TBNAME", + /* 193 */ "JOIN", + /* 194 */ "INSERT", + /* 195 */ "INTO", + /* 196 */ "VALUES", + /* 197 */ "error", + /* 198 */ "program", + /* 199 */ "cmd", + /* 200 */ "ids", + /* 201 */ "dbPrefix", + /* 202 */ "cpxName", + /* 203 */ "ifexists", + /* 204 */ "alter_db_optr", + /* 205 */ "acct_optr", + /* 206 */ "exprlist", + /* 207 */ "ifnotexists", + /* 208 */ "db_optr", + /* 209 */ "typename", + /* 210 */ "bufsize", + /* 211 */ "pps", + /* 212 */ "tseries", + /* 213 */ "dbs", + /* 214 */ "streams", + /* 215 */ "storage", + /* 216 */ "qtime", + /* 217 */ "users", + /* 218 */ "conns", + /* 219 */ "state", + /* 220 */ "intitemlist", + /* 221 */ "intitem", + /* 222 */ "keep", + /* 223 */ "cache", + /* 224 */ "replica", + /* 225 */ "quorum", + /* 226 */ "days", + /* 227 */ "minrows", + /* 228 */ "maxrows", + /* 229 */ "blocks", + /* 230 */ "ctime", + /* 231 */ "wal", + /* 232 */ "fsync", + /* 233 */ "comp", + /* 234 */ "prec", + /* 235 */ "update", + /* 236 */ "cachelast", + /* 237 */ "signed", + /* 238 */ "create_table_args", + /* 239 */ "create_stable_args", + /* 240 */ "create_table_list", + /* 241 */ "create_from_stable", + /* 242 */ "columnlist", + /* 243 */ "tagitemlist1", + /* 244 */ "tagNamelist", + /* 245 */ "select", + /* 246 */ "column", + /* 247 */ "tagitem1", + /* 248 */ "tagitemlist", + /* 249 */ "tagitem", + /* 250 */ "selcollist", + /* 251 */ "from", + /* 252 */ "where_opt", + /* 253 */ "interval_option", + /* 254 */ "sliding_opt", + /* 255 */ "session_option", + /* 256 */ "windowstate_option", + /* 257 */ "fill_opt", + /* 258 */ "groupby_opt", + /* 259 */ "having_opt", + /* 260 */ "orderby_opt", + /* 261 */ "slimit_opt", + /* 262 */ "limit_opt", + /* 263 */ "union", + /* 264 */ "sclp", + /* 265 */ "distinct", + /* 266 */ "expr", + /* 267 */ "as", + /* 268 */ "tablelist", + /* 269 */ "sub", + /* 270 */ "tmvar", + /* 271 */ "intervalKey", + /* 272 */ "sortlist", + /* 273 */ "sortitem", + /* 274 */ "item", + /* 275 */ "sortorder", + /* 276 */ "grouplist", + /* 277 */ "expritem", }; #endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */ @@ -1127,7 +1135,7 @@ static const char *const yyRuleName[] = { /* 54 */ "ifexists ::=", /* 55 */ "ifnotexists ::= IF NOT EXISTS", /* 56 */ "ifnotexists ::=", - /* 57 */ "cmd ::= CREATE DNODE ids", + /* 57 */ "cmd ::= CREATE DNODE ids PORT ids", /* 58 */ "cmd ::= CREATE ACCOUNT ids PASS ids acct_optr", /* 59 */ "cmd ::= CREATE DATABASE ifnotexists ids db_optr", /* 60 */ "cmd ::= CREATE FUNCTION ids AS ids OUTPUTTYPE typename bufsize", @@ -1210,154 +1218,157 @@ static const char *const yyRuleName[] = { /* 137 */ "create_table_list ::= create_table_list create_from_stable", /* 138 */ "create_table_args ::= ifnotexists ids cpxName LP columnlist RP", /* 139 */ "create_stable_args ::= ifnotexists ids cpxName LP columnlist RP TAGS LP columnlist RP", - /* 140 */ "create_from_stable ::= ifnotexists ids cpxName USING ids cpxName TAGS LP tagitemlist RP", - /* 141 */ "create_from_stable ::= ifnotexists ids cpxName USING ids cpxName LP tagNamelist RP TAGS LP tagitemlist RP", + /* 140 */ "create_from_stable ::= ifnotexists ids cpxName USING ids cpxName TAGS LP tagitemlist1 RP", + /* 141 */ "create_from_stable ::= ifnotexists ids cpxName USING ids cpxName LP tagNamelist RP TAGS LP tagitemlist1 RP", /* 142 */ "tagNamelist ::= tagNamelist COMMA ids", /* 143 */ "tagNamelist ::= ids", /* 144 */ "create_table_args ::= ifnotexists ids cpxName AS select", /* 145 */ "columnlist ::= columnlist COMMA column", /* 146 */ "columnlist ::= column", /* 147 */ "column ::= ids typename", - /* 148 */ "tagitemlist ::= tagitemlist COMMA tagitem", - /* 149 */ "tagitemlist ::= tagitem", - /* 150 */ "tagitem ::= INTEGER", - /* 151 */ "tagitem ::= FLOAT", - /* 152 */ "tagitem ::= STRING", - /* 153 */ "tagitem ::= BOOL", - /* 154 */ "tagitem ::= NULL", - /* 155 */ "tagitem ::= NOW", - /* 156 */ "tagitem ::= MINUS INTEGER", - /* 157 */ "tagitem ::= MINUS FLOAT", - /* 158 */ "tagitem ::= PLUS INTEGER", - /* 159 */ "tagitem ::= PLUS FLOAT", - /* 160 */ "select ::= SELECT selcollist from where_opt interval_option sliding_opt session_option windowstate_option fill_opt groupby_opt having_opt orderby_opt slimit_opt limit_opt", - /* 161 */ "select ::= LP select RP", - /* 162 */ "union ::= select", - /* 163 */ "union ::= union UNION ALL select", - /* 164 */ "union ::= union UNION select", - /* 165 */ "cmd ::= union", - /* 166 */ "select ::= SELECT selcollist", - /* 167 */ "sclp ::= selcollist COMMA", - /* 168 */ "sclp ::=", - /* 169 */ "selcollist ::= sclp distinct expr as", - /* 170 */ "selcollist ::= sclp STAR", - /* 171 */ "as ::= AS ids", - /* 172 */ "as ::= ids", - /* 173 */ "as ::=", - /* 174 */ "distinct ::= DISTINCT", - /* 175 */ "distinct ::=", - /* 176 */ "from ::= FROM tablelist", - /* 177 */ "from ::= FROM sub", - /* 178 */ "sub ::= LP union RP", - /* 179 */ "sub ::= LP union RP ids", - /* 180 */ "sub ::= sub COMMA LP union RP ids", - /* 181 */ "tablelist ::= ids cpxName", - /* 182 */ "tablelist ::= ids cpxName ids", - /* 183 */ "tablelist ::= tablelist COMMA ids cpxName", - /* 184 */ "tablelist ::= tablelist COMMA ids cpxName ids", - /* 185 */ "tmvar ::= VARIABLE", - /* 186 */ "interval_option ::= intervalKey LP tmvar RP", - /* 187 */ "interval_option ::= intervalKey LP tmvar COMMA tmvar RP", - /* 188 */ "interval_option ::=", - /* 189 */ "intervalKey ::= INTERVAL", - /* 190 */ "intervalKey ::= EVERY", - /* 191 */ "session_option ::=", - /* 192 */ "session_option ::= SESSION LP ids cpxName COMMA tmvar RP", - /* 193 */ "windowstate_option ::=", - /* 194 */ "windowstate_option ::= STATE_WINDOW LP ids RP", - /* 195 */ "fill_opt ::=", - /* 196 */ "fill_opt ::= FILL LP ID COMMA tagitemlist RP", - /* 197 */ "fill_opt ::= FILL LP ID RP", - /* 198 */ "sliding_opt ::= SLIDING LP tmvar RP", - /* 199 */ "sliding_opt ::=", - /* 200 */ "orderby_opt ::=", - /* 201 */ "orderby_opt ::= ORDER BY sortlist", - /* 202 */ "sortlist ::= sortlist COMMA item sortorder", - /* 203 */ "sortlist ::= item sortorder", - /* 204 */ "item ::= ids cpxName", - /* 205 */ "sortorder ::= ASC", - /* 206 */ "sortorder ::= DESC", - /* 207 */ "sortorder ::=", - /* 208 */ "groupby_opt ::=", - /* 209 */ "groupby_opt ::= GROUP BY grouplist", - /* 210 */ "grouplist ::= grouplist COMMA item", - /* 211 */ "grouplist ::= item", - /* 212 */ "having_opt ::=", - /* 213 */ "having_opt ::= HAVING expr", - /* 214 */ "limit_opt ::=", - /* 215 */ "limit_opt ::= LIMIT signed", - /* 216 */ "limit_opt ::= LIMIT signed OFFSET signed", - /* 217 */ "limit_opt ::= LIMIT signed COMMA signed", - /* 218 */ "slimit_opt ::=", - /* 219 */ "slimit_opt ::= SLIMIT signed", - /* 220 */ "slimit_opt ::= SLIMIT signed SOFFSET signed", - /* 221 */ "slimit_opt ::= SLIMIT signed COMMA signed", - /* 222 */ "where_opt ::=", - /* 223 */ "where_opt ::= WHERE expr", - /* 224 */ "expr ::= LP expr RP", - /* 225 */ "expr ::= ID", - /* 226 */ "expr ::= ID DOT ID", - /* 227 */ "expr ::= ID DOT STAR", - /* 228 */ "expr ::= INTEGER", - /* 229 */ "expr ::= MINUS INTEGER", - /* 230 */ "expr ::= PLUS INTEGER", - /* 231 */ "expr ::= FLOAT", - /* 232 */ "expr ::= MINUS FLOAT", - /* 233 */ "expr ::= PLUS FLOAT", - /* 234 */ "expr ::= STRING", - /* 235 */ "expr ::= NOW", - /* 236 */ "expr ::= VARIABLE", - /* 237 */ "expr ::= PLUS VARIABLE", - /* 238 */ "expr ::= MINUS VARIABLE", - /* 239 */ "expr ::= BOOL", - /* 240 */ "expr ::= NULL", - /* 241 */ "expr ::= ID LP exprlist RP", - /* 242 */ "expr ::= ID LP STAR RP", - /* 243 */ "expr ::= expr IS NULL", - /* 244 */ "expr ::= expr IS NOT NULL", - /* 245 */ "expr ::= expr LT expr", - /* 246 */ "expr ::= expr GT expr", - /* 247 */ "expr ::= expr LE expr", - /* 248 */ "expr ::= expr GE expr", - /* 249 */ "expr ::= expr NE expr", - /* 250 */ "expr ::= expr EQ expr", - /* 251 */ "expr ::= expr BETWEEN expr AND expr", - /* 252 */ "expr ::= expr AND expr", - /* 253 */ "expr ::= expr OR expr", - /* 254 */ "expr ::= expr PLUS expr", - /* 255 */ "expr ::= expr MINUS expr", - /* 256 */ "expr ::= expr STAR expr", - /* 257 */ "expr ::= expr SLASH expr", - /* 258 */ "expr ::= expr REM expr", - /* 259 */ "expr ::= expr LIKE expr", - /* 260 */ "expr ::= expr MATCH expr", - /* 261 */ "expr ::= expr NMATCH expr", - /* 262 */ "expr ::= expr IN LP exprlist RP", - /* 263 */ "exprlist ::= exprlist COMMA expritem", - /* 264 */ "exprlist ::= expritem", - /* 265 */ "expritem ::= expr", - /* 266 */ "expritem ::=", - /* 267 */ "cmd ::= RESET QUERY CACHE", - /* 268 */ "cmd ::= SYNCDB ids REPLICA", - /* 269 */ "cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist", - /* 270 */ "cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids", - /* 271 */ "cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist", - /* 272 */ "cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist", - /* 273 */ "cmd ::= ALTER TABLE ids cpxName DROP TAG ids", - /* 274 */ "cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids", - /* 275 */ "cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem", - /* 276 */ "cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist", - /* 277 */ "cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist", - /* 278 */ "cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids", - /* 279 */ "cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist", - /* 280 */ "cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist", - /* 281 */ "cmd ::= ALTER STABLE ids cpxName DROP TAG ids", - /* 282 */ "cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids", - /* 283 */ "cmd ::= ALTER STABLE ids cpxName SET TAG ids EQ tagitem", - /* 284 */ "cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist", - /* 285 */ "cmd ::= KILL CONNECTION INTEGER", - /* 286 */ "cmd ::= KILL STREAM INTEGER COLON INTEGER", - /* 287 */ "cmd ::= KILL QUERY INTEGER COLON INTEGER", + /* 148 */ "tagitemlist1 ::= tagitemlist1 COMMA tagitem1", + /* 149 */ "tagitemlist1 ::= tagitem1", + /* 150 */ "tagitem1 ::= MINUS INTEGER", + /* 151 */ "tagitemlist ::= tagitemlist COMMA tagitem", + /* 152 */ "tagitemlist ::= tagitem", + /* 153 */ "tagitem ::= INTEGER", + /* 154 */ "tagitem ::= FLOAT", + /* 155 */ "tagitem ::= STRING", + /* 156 */ "tagitem ::= BOOL", + /* 157 */ "tagitem ::= NULL", + /* 158 */ "tagitem ::= NOW", + /* 159 */ "tagitem ::= MINUS INTEGER", + /* 160 */ "tagitem ::= MINUS FLOAT", + /* 161 */ "tagitem ::= PLUS INTEGER", + /* 162 */ "tagitem ::= PLUS FLOAT", + /* 163 */ "select ::= SELECT selcollist from where_opt interval_option sliding_opt session_option windowstate_option fill_opt groupby_opt having_opt orderby_opt slimit_opt limit_opt", + /* 164 */ "select ::= LP select RP", + /* 165 */ "union ::= select", + /* 166 */ "union ::= union UNION ALL select", + /* 167 */ "union ::= union UNION select", + /* 168 */ "cmd ::= union", + /* 169 */ "select ::= SELECT selcollist", + /* 170 */ "sclp ::= selcollist COMMA", + /* 171 */ "sclp ::=", + /* 172 */ "selcollist ::= sclp distinct expr as", + /* 173 */ "selcollist ::= sclp STAR", + /* 174 */ "as ::= AS ids", + /* 175 */ "as ::= ids", + /* 176 */ "as ::=", + /* 177 */ "distinct ::= DISTINCT", + /* 178 */ "distinct ::=", + /* 179 */ "from ::= FROM tablelist", + /* 180 */ "from ::= FROM sub", + /* 181 */ "sub ::= LP union RP", + /* 182 */ "sub ::= LP union RP ids", + /* 183 */ "sub ::= sub COMMA LP union RP ids", + /* 184 */ "tablelist ::= ids cpxName", + /* 185 */ "tablelist ::= ids cpxName ids", + /* 186 */ "tablelist ::= tablelist COMMA ids cpxName", + /* 187 */ "tablelist ::= tablelist COMMA ids cpxName ids", + /* 188 */ "tmvar ::= VARIABLE", + /* 189 */ "interval_option ::= intervalKey LP tmvar RP", + /* 190 */ "interval_option ::= intervalKey LP tmvar COMMA tmvar RP", + /* 191 */ "interval_option ::=", + /* 192 */ "intervalKey ::= INTERVAL", + /* 193 */ "intervalKey ::= EVERY", + /* 194 */ "session_option ::=", + /* 195 */ "session_option ::= SESSION LP ids cpxName COMMA tmvar RP", + /* 196 */ "windowstate_option ::=", + /* 197 */ "windowstate_option ::= STATE_WINDOW LP ids RP", + /* 198 */ "fill_opt ::=", + /* 199 */ "fill_opt ::= FILL LP ID COMMA tagitemlist RP", + /* 200 */ "fill_opt ::= FILL LP ID RP", + /* 201 */ "sliding_opt ::= SLIDING LP tmvar RP", + /* 202 */ "sliding_opt ::=", + /* 203 */ "orderby_opt ::=", + /* 204 */ "orderby_opt ::= ORDER BY sortlist", + /* 205 */ "sortlist ::= sortlist COMMA item sortorder", + /* 206 */ "sortlist ::= item sortorder", + /* 207 */ "item ::= ids cpxName", + /* 208 */ "sortorder ::= ASC", + /* 209 */ "sortorder ::= DESC", + /* 210 */ "sortorder ::=", + /* 211 */ "groupby_opt ::=", + /* 212 */ "groupby_opt ::= GROUP BY grouplist", + /* 213 */ "grouplist ::= grouplist COMMA item", + /* 214 */ "grouplist ::= item", + /* 215 */ "having_opt ::=", + /* 216 */ "having_opt ::= HAVING expr", + /* 217 */ "limit_opt ::=", + /* 218 */ "limit_opt ::= LIMIT signed", + /* 219 */ "limit_opt ::= LIMIT signed OFFSET signed", + /* 220 */ "limit_opt ::= LIMIT signed COMMA signed", + /* 221 */ "slimit_opt ::=", + /* 222 */ "slimit_opt ::= SLIMIT signed", + /* 223 */ "slimit_opt ::= SLIMIT signed SOFFSET signed", + /* 224 */ "slimit_opt ::= SLIMIT signed COMMA signed", + /* 225 */ "where_opt ::=", + /* 226 */ "where_opt ::= WHERE expr", + /* 227 */ "expr ::= LP expr RP", + /* 228 */ "expr ::= ID", + /* 229 */ "expr ::= ID DOT ID", + /* 230 */ "expr ::= ID DOT STAR", + /* 231 */ "expr ::= INTEGER", + /* 232 */ "expr ::= MINUS INTEGER", + /* 233 */ "expr ::= PLUS INTEGER", + /* 234 */ "expr ::= FLOAT", + /* 235 */ "expr ::= MINUS FLOAT", + /* 236 */ "expr ::= PLUS FLOAT", + /* 237 */ "expr ::= STRING", + /* 238 */ "expr ::= NOW", + /* 239 */ "expr ::= VARIABLE", + /* 240 */ "expr ::= PLUS VARIABLE", + /* 241 */ "expr ::= MINUS VARIABLE", + /* 242 */ "expr ::= BOOL", + /* 243 */ "expr ::= NULL", + /* 244 */ "expr ::= ID LP exprlist RP", + /* 245 */ "expr ::= ID LP STAR RP", + /* 246 */ "expr ::= expr IS NULL", + /* 247 */ "expr ::= expr IS NOT NULL", + /* 248 */ "expr ::= expr LT expr", + /* 249 */ "expr ::= expr GT expr", + /* 250 */ "expr ::= expr LE expr", + /* 251 */ "expr ::= expr GE expr", + /* 252 */ "expr ::= expr NE expr", + /* 253 */ "expr ::= expr EQ expr", + /* 254 */ "expr ::= expr BETWEEN expr AND expr", + /* 255 */ "expr ::= expr AND expr", + /* 256 */ "expr ::= expr OR expr", + /* 257 */ "expr ::= expr PLUS expr", + /* 258 */ "expr ::= expr MINUS expr", + /* 259 */ "expr ::= expr STAR expr", + /* 260 */ "expr ::= expr SLASH expr", + /* 261 */ "expr ::= expr REM expr", + /* 262 */ "expr ::= expr LIKE expr", + /* 263 */ "expr ::= expr MATCH expr", + /* 264 */ "expr ::= expr NMATCH expr", + /* 265 */ "expr ::= expr IN LP exprlist RP", + /* 266 */ "exprlist ::= exprlist COMMA expritem", + /* 267 */ "exprlist ::= expritem", + /* 268 */ "expritem ::= expr", + /* 269 */ "expritem ::=", + /* 270 */ "cmd ::= RESET QUERY CACHE", + /* 271 */ "cmd ::= SYNCDB ids REPLICA", + /* 272 */ "cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist", + /* 273 */ "cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids", + /* 274 */ "cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist", + /* 275 */ "cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist", + /* 276 */ "cmd ::= ALTER TABLE ids cpxName DROP TAG ids", + /* 277 */ "cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids", + /* 278 */ "cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem", + /* 279 */ "cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist", + /* 280 */ "cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist", + /* 281 */ "cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids", + /* 282 */ "cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist", + /* 283 */ "cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist", + /* 284 */ "cmd ::= ALTER STABLE ids cpxName DROP TAG ids", + /* 285 */ "cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids", + /* 286 */ "cmd ::= ALTER STABLE ids cpxName SET TAG ids EQ tagitem", + /* 287 */ "cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist", + /* 288 */ "cmd ::= KILL CONNECTION INTEGER", + /* 289 */ "cmd ::= KILL STREAM INTEGER COLON INTEGER", + /* 290 */ "cmd ::= KILL QUERY INTEGER COLON INTEGER", }; #endif /* NDEBUG */ @@ -1478,60 +1489,61 @@ static void yy_destructor( ** inside the C code. */ /********* Begin destructor definitions ***************************************/ - case 205: /* exprlist */ - case 247: /* selcollist */ - case 261: /* sclp */ + case 206: /* exprlist */ + case 250: /* selcollist */ + case 264: /* sclp */ { -tSqlExprListDestroy((yypminor->yy131)); +tSqlExprListDestroy((yypminor->yy421)); } break; - case 219: /* intitemlist */ - case 221: /* keep */ - case 241: /* columnlist */ - case 242: /* tagitemlist */ - case 243: /* tagNamelist */ - case 254: /* fill_opt */ - case 255: /* groupby_opt */ - case 257: /* orderby_opt */ - case 269: /* sortlist */ - case 273: /* grouplist */ + case 220: /* intitemlist */ + case 222: /* keep */ + case 242: /* columnlist */ + case 243: /* tagitemlist1 */ + case 244: /* tagNamelist */ + case 248: /* tagitemlist */ + case 257: /* fill_opt */ + case 258: /* groupby_opt */ + case 260: /* orderby_opt */ + case 272: /* sortlist */ + case 276: /* grouplist */ { -taosArrayDestroy((yypminor->yy131)); +taosArrayDestroy((yypminor->yy421)); } break; - case 239: /* create_table_list */ + case 240: /* create_table_list */ { -destroyCreateTableSql((yypminor->yy272)); +destroyCreateTableSql((yypminor->yy438)); } break; - case 244: /* select */ + case 245: /* select */ { -destroySqlNode((yypminor->yy256)); +destroySqlNode((yypminor->yy56)); } break; - case 248: /* from */ - case 265: /* tablelist */ - case 266: /* sub */ + case 251: /* from */ + case 268: /* tablelist */ + case 269: /* sub */ { -destroyRelationInfo((yypminor->yy544)); +destroyRelationInfo((yypminor->yy8)); } break; - case 249: /* where_opt */ - case 256: /* having_opt */ - case 263: /* expr */ - case 274: /* expritem */ + case 252: /* where_opt */ + case 259: /* having_opt */ + case 266: /* expr */ + case 277: /* expritem */ { -tSqlExprDestroy((yypminor->yy46)); +tSqlExprDestroy((yypminor->yy439)); } break; - case 260: /* union */ + case 263: /* union */ { -destroyAllSqlNode((yypminor->yy303)); +destroyAllSqlNode((yypminor->yy149)); } break; - case 270: /* sortitem */ + case 273: /* sortitem */ { -taosVariantDestroy(&(yypminor->yy43)); +taosVariantDestroy(&(yypminor->yy69)); } break; /********* End destructor definitions *****************************************/ @@ -1825,294 +1837,297 @@ 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[] = { - { 197, -1 }, /* (0) program ::= cmd */ - { 198, -2 }, /* (1) cmd ::= SHOW DATABASES */ - { 198, -2 }, /* (2) cmd ::= SHOW TOPICS */ - { 198, -2 }, /* (3) cmd ::= SHOW FUNCTIONS */ - { 198, -2 }, /* (4) cmd ::= SHOW MNODES */ - { 198, -2 }, /* (5) cmd ::= SHOW DNODES */ - { 198, -2 }, /* (6) cmd ::= SHOW ACCOUNTS */ - { 198, -2 }, /* (7) cmd ::= SHOW USERS */ - { 198, -2 }, /* (8) cmd ::= SHOW MODULES */ - { 198, -2 }, /* (9) cmd ::= SHOW QUERIES */ - { 198, -2 }, /* (10) cmd ::= SHOW CONNECTIONS */ - { 198, -2 }, /* (11) cmd ::= SHOW STREAMS */ - { 198, -2 }, /* (12) cmd ::= SHOW VARIABLES */ - { 198, -2 }, /* (13) cmd ::= SHOW SCORES */ - { 198, -2 }, /* (14) cmd ::= SHOW GRANTS */ - { 198, -2 }, /* (15) cmd ::= SHOW VNODES */ - { 198, -3 }, /* (16) cmd ::= SHOW VNODES ids */ - { 200, 0 }, /* (17) dbPrefix ::= */ - { 200, -2 }, /* (18) dbPrefix ::= ids DOT */ - { 201, 0 }, /* (19) cpxName ::= */ - { 201, -2 }, /* (20) cpxName ::= DOT ids */ - { 198, -5 }, /* (21) cmd ::= SHOW CREATE TABLE ids cpxName */ - { 198, -5 }, /* (22) cmd ::= SHOW CREATE STABLE ids cpxName */ - { 198, -4 }, /* (23) cmd ::= SHOW CREATE DATABASE ids */ - { 198, -3 }, /* (24) cmd ::= SHOW dbPrefix TABLES */ - { 198, -5 }, /* (25) cmd ::= SHOW dbPrefix TABLES LIKE ids */ - { 198, -3 }, /* (26) cmd ::= SHOW dbPrefix STABLES */ - { 198, -5 }, /* (27) cmd ::= SHOW dbPrefix STABLES LIKE ids */ - { 198, -3 }, /* (28) cmd ::= SHOW dbPrefix VGROUPS */ - { 198, -4 }, /* (29) cmd ::= SHOW dbPrefix VGROUPS ids */ - { 198, -5 }, /* (30) cmd ::= DROP TABLE ifexists ids cpxName */ - { 198, -5 }, /* (31) cmd ::= DROP STABLE ifexists ids cpxName */ - { 198, -4 }, /* (32) cmd ::= DROP DATABASE ifexists ids */ - { 198, -4 }, /* (33) cmd ::= DROP TOPIC ifexists ids */ - { 198, -3 }, /* (34) cmd ::= DROP FUNCTION ids */ - { 198, -3 }, /* (35) cmd ::= DROP DNODE ids */ - { 198, -3 }, /* (36) cmd ::= DROP USER ids */ - { 198, -3 }, /* (37) cmd ::= DROP ACCOUNT ids */ - { 198, -2 }, /* (38) cmd ::= USE ids */ - { 198, -3 }, /* (39) cmd ::= DESCRIBE ids cpxName */ - { 198, -3 }, /* (40) cmd ::= DESC ids cpxName */ - { 198, -5 }, /* (41) cmd ::= ALTER USER ids PASS ids */ - { 198, -5 }, /* (42) cmd ::= ALTER USER ids PRIVILEGE ids */ - { 198, -4 }, /* (43) cmd ::= ALTER DNODE ids ids */ - { 198, -5 }, /* (44) cmd ::= ALTER DNODE ids ids ids */ - { 198, -3 }, /* (45) cmd ::= ALTER LOCAL ids */ - { 198, -4 }, /* (46) cmd ::= ALTER LOCAL ids ids */ - { 198, -4 }, /* (47) cmd ::= ALTER DATABASE ids alter_db_optr */ - { 198, -4 }, /* (48) cmd ::= ALTER ACCOUNT ids acct_optr */ - { 198, -6 }, /* (49) cmd ::= ALTER ACCOUNT ids PASS ids acct_optr */ - { 198, -6 }, /* (50) cmd ::= COMPACT VNODES IN LP exprlist RP */ - { 199, -1 }, /* (51) ids ::= ID */ - { 199, -1 }, /* (52) ids ::= STRING */ - { 202, -2 }, /* (53) ifexists ::= IF EXISTS */ - { 202, 0 }, /* (54) ifexists ::= */ - { 206, -3 }, /* (55) ifnotexists ::= IF NOT EXISTS */ - { 206, 0 }, /* (56) ifnotexists ::= */ - { 198, -3 }, /* (57) cmd ::= CREATE DNODE ids */ - { 198, -6 }, /* (58) cmd ::= CREATE ACCOUNT ids PASS ids acct_optr */ - { 198, -5 }, /* (59) cmd ::= CREATE DATABASE ifnotexists ids db_optr */ - { 198, -8 }, /* (60) cmd ::= CREATE FUNCTION ids AS ids OUTPUTTYPE typename bufsize */ - { 198, -9 }, /* (61) cmd ::= CREATE AGGREGATE FUNCTION ids AS ids OUTPUTTYPE typename bufsize */ - { 198, -5 }, /* (62) cmd ::= CREATE USER ids PASS ids */ - { 209, 0 }, /* (63) bufsize ::= */ - { 209, -2 }, /* (64) bufsize ::= BUFSIZE INTEGER */ - { 210, 0 }, /* (65) pps ::= */ - { 210, -2 }, /* (66) pps ::= PPS INTEGER */ - { 211, 0 }, /* (67) tseries ::= */ - { 211, -2 }, /* (68) tseries ::= TSERIES INTEGER */ - { 212, 0 }, /* (69) dbs ::= */ - { 212, -2 }, /* (70) dbs ::= DBS INTEGER */ - { 213, 0 }, /* (71) streams ::= */ - { 213, -2 }, /* (72) streams ::= STREAMS INTEGER */ - { 214, 0 }, /* (73) storage ::= */ - { 214, -2 }, /* (74) storage ::= STORAGE INTEGER */ - { 215, 0 }, /* (75) qtime ::= */ - { 215, -2 }, /* (76) qtime ::= QTIME INTEGER */ - { 216, 0 }, /* (77) users ::= */ - { 216, -2 }, /* (78) users ::= USERS INTEGER */ - { 217, 0 }, /* (79) conns ::= */ - { 217, -2 }, /* (80) conns ::= CONNS INTEGER */ - { 218, 0 }, /* (81) state ::= */ - { 218, -2 }, /* (82) state ::= STATE ids */ - { 204, -9 }, /* (83) acct_optr ::= pps tseries storage streams qtime dbs users conns state */ - { 219, -3 }, /* (84) intitemlist ::= intitemlist COMMA intitem */ - { 219, -1 }, /* (85) intitemlist ::= intitem */ - { 220, -1 }, /* (86) intitem ::= INTEGER */ - { 221, -2 }, /* (87) keep ::= KEEP intitemlist */ - { 222, -2 }, /* (88) cache ::= CACHE INTEGER */ - { 223, -2 }, /* (89) replica ::= REPLICA INTEGER */ - { 224, -2 }, /* (90) quorum ::= QUORUM INTEGER */ - { 225, -2 }, /* (91) days ::= DAYS INTEGER */ - { 226, -2 }, /* (92) minrows ::= MINROWS INTEGER */ - { 227, -2 }, /* (93) maxrows ::= MAXROWS INTEGER */ - { 228, -2 }, /* (94) blocks ::= BLOCKS INTEGER */ - { 229, -2 }, /* (95) ctime ::= CTIME INTEGER */ - { 230, -2 }, /* (96) wal ::= WAL INTEGER */ - { 231, -2 }, /* (97) fsync ::= FSYNC INTEGER */ - { 232, -2 }, /* (98) comp ::= COMP INTEGER */ - { 233, -2 }, /* (99) prec ::= PRECISION STRING */ - { 234, -2 }, /* (100) update ::= UPDATE INTEGER */ - { 235, -2 }, /* (101) cachelast ::= CACHELAST INTEGER */ - { 207, 0 }, /* (102) db_optr ::= */ - { 207, -2 }, /* (103) db_optr ::= db_optr cache */ - { 207, -2 }, /* (104) db_optr ::= db_optr replica */ - { 207, -2 }, /* (105) db_optr ::= db_optr quorum */ - { 207, -2 }, /* (106) db_optr ::= db_optr days */ - { 207, -2 }, /* (107) db_optr ::= db_optr minrows */ - { 207, -2 }, /* (108) db_optr ::= db_optr maxrows */ - { 207, -2 }, /* (109) db_optr ::= db_optr blocks */ - { 207, -2 }, /* (110) db_optr ::= db_optr ctime */ - { 207, -2 }, /* (111) db_optr ::= db_optr wal */ - { 207, -2 }, /* (112) db_optr ::= db_optr fsync */ - { 207, -2 }, /* (113) db_optr ::= db_optr comp */ - { 207, -2 }, /* (114) db_optr ::= db_optr prec */ - { 207, -2 }, /* (115) db_optr ::= db_optr keep */ - { 207, -2 }, /* (116) db_optr ::= db_optr update */ - { 207, -2 }, /* (117) db_optr ::= db_optr cachelast */ - { 203, 0 }, /* (118) alter_db_optr ::= */ - { 203, -2 }, /* (119) alter_db_optr ::= alter_db_optr replica */ - { 203, -2 }, /* (120) alter_db_optr ::= alter_db_optr quorum */ - { 203, -2 }, /* (121) alter_db_optr ::= alter_db_optr keep */ - { 203, -2 }, /* (122) alter_db_optr ::= alter_db_optr blocks */ - { 203, -2 }, /* (123) alter_db_optr ::= alter_db_optr comp */ - { 203, -2 }, /* (124) alter_db_optr ::= alter_db_optr update */ - { 203, -2 }, /* (125) alter_db_optr ::= alter_db_optr cachelast */ - { 208, -1 }, /* (126) typename ::= ids */ - { 208, -4 }, /* (127) typename ::= ids LP signed RP */ - { 208, -2 }, /* (128) typename ::= ids UNSIGNED */ - { 236, -1 }, /* (129) signed ::= INTEGER */ - { 236, -2 }, /* (130) signed ::= PLUS INTEGER */ - { 236, -2 }, /* (131) signed ::= MINUS INTEGER */ - { 198, -3 }, /* (132) cmd ::= CREATE TABLE create_table_args */ - { 198, -3 }, /* (133) cmd ::= CREATE TABLE create_stable_args */ - { 198, -3 }, /* (134) cmd ::= CREATE STABLE create_stable_args */ - { 198, -3 }, /* (135) cmd ::= CREATE TABLE create_table_list */ - { 239, -1 }, /* (136) create_table_list ::= create_from_stable */ - { 239, -2 }, /* (137) create_table_list ::= create_table_list create_from_stable */ - { 237, -6 }, /* (138) create_table_args ::= ifnotexists ids cpxName LP columnlist RP */ - { 238, -10 }, /* (139) create_stable_args ::= ifnotexists ids cpxName LP columnlist RP TAGS LP columnlist RP */ - { 240, -10 }, /* (140) create_from_stable ::= ifnotexists ids cpxName USING ids cpxName TAGS LP tagitemlist RP */ - { 240, -13 }, /* (141) create_from_stable ::= ifnotexists ids cpxName USING ids cpxName LP tagNamelist RP TAGS LP tagitemlist RP */ - { 243, -3 }, /* (142) tagNamelist ::= tagNamelist COMMA ids */ - { 243, -1 }, /* (143) tagNamelist ::= ids */ - { 237, -5 }, /* (144) create_table_args ::= ifnotexists ids cpxName AS select */ - { 241, -3 }, /* (145) columnlist ::= columnlist COMMA column */ - { 241, -1 }, /* (146) columnlist ::= column */ - { 245, -2 }, /* (147) column ::= ids typename */ - { 242, -3 }, /* (148) tagitemlist ::= tagitemlist COMMA tagitem */ - { 242, -1 }, /* (149) tagitemlist ::= tagitem */ - { 246, -1 }, /* (150) tagitem ::= INTEGER */ - { 246, -1 }, /* (151) tagitem ::= FLOAT */ - { 246, -1 }, /* (152) tagitem ::= STRING */ - { 246, -1 }, /* (153) tagitem ::= BOOL */ - { 246, -1 }, /* (154) tagitem ::= NULL */ - { 246, -1 }, /* (155) tagitem ::= NOW */ - { 246, -2 }, /* (156) tagitem ::= MINUS INTEGER */ - { 246, -2 }, /* (157) tagitem ::= MINUS FLOAT */ - { 246, -2 }, /* (158) tagitem ::= PLUS INTEGER */ - { 246, -2 }, /* (159) tagitem ::= PLUS FLOAT */ - { 244, -14 }, /* (160) select ::= SELECT selcollist from where_opt interval_option sliding_opt session_option windowstate_option fill_opt groupby_opt having_opt orderby_opt slimit_opt limit_opt */ - { 244, -3 }, /* (161) select ::= LP select RP */ - { 260, -1 }, /* (162) union ::= select */ - { 260, -4 }, /* (163) union ::= union UNION ALL select */ - { 260, -3 }, /* (164) union ::= union UNION select */ - { 198, -1 }, /* (165) cmd ::= union */ - { 244, -2 }, /* (166) select ::= SELECT selcollist */ - { 261, -2 }, /* (167) sclp ::= selcollist COMMA */ - { 261, 0 }, /* (168) sclp ::= */ - { 247, -4 }, /* (169) selcollist ::= sclp distinct expr as */ - { 247, -2 }, /* (170) selcollist ::= sclp STAR */ - { 264, -2 }, /* (171) as ::= AS ids */ - { 264, -1 }, /* (172) as ::= ids */ - { 264, 0 }, /* (173) as ::= */ - { 262, -1 }, /* (174) distinct ::= DISTINCT */ - { 262, 0 }, /* (175) distinct ::= */ - { 248, -2 }, /* (176) from ::= FROM tablelist */ - { 248, -2 }, /* (177) from ::= FROM sub */ - { 266, -3 }, /* (178) sub ::= LP union RP */ - { 266, -4 }, /* (179) sub ::= LP union RP ids */ - { 266, -6 }, /* (180) sub ::= sub COMMA LP union RP ids */ - { 265, -2 }, /* (181) tablelist ::= ids cpxName */ - { 265, -3 }, /* (182) tablelist ::= ids cpxName ids */ - { 265, -4 }, /* (183) tablelist ::= tablelist COMMA ids cpxName */ - { 265, -5 }, /* (184) tablelist ::= tablelist COMMA ids cpxName ids */ - { 267, -1 }, /* (185) tmvar ::= VARIABLE */ - { 250, -4 }, /* (186) interval_option ::= intervalKey LP tmvar RP */ - { 250, -6 }, /* (187) interval_option ::= intervalKey LP tmvar COMMA tmvar RP */ - { 250, 0 }, /* (188) interval_option ::= */ - { 268, -1 }, /* (189) intervalKey ::= INTERVAL */ - { 268, -1 }, /* (190) intervalKey ::= EVERY */ - { 252, 0 }, /* (191) session_option ::= */ - { 252, -7 }, /* (192) session_option ::= SESSION LP ids cpxName COMMA tmvar RP */ - { 253, 0 }, /* (193) windowstate_option ::= */ - { 253, -4 }, /* (194) windowstate_option ::= STATE_WINDOW LP ids RP */ - { 254, 0 }, /* (195) fill_opt ::= */ - { 254, -6 }, /* (196) fill_opt ::= FILL LP ID COMMA tagitemlist RP */ - { 254, -4 }, /* (197) fill_opt ::= FILL LP ID RP */ - { 251, -4 }, /* (198) sliding_opt ::= SLIDING LP tmvar RP */ - { 251, 0 }, /* (199) sliding_opt ::= */ - { 257, 0 }, /* (200) orderby_opt ::= */ - { 257, -3 }, /* (201) orderby_opt ::= ORDER BY sortlist */ - { 269, -4 }, /* (202) sortlist ::= sortlist COMMA item sortorder */ - { 269, -2 }, /* (203) sortlist ::= item sortorder */ - { 271, -2 }, /* (204) item ::= ids cpxName */ - { 272, -1 }, /* (205) sortorder ::= ASC */ - { 272, -1 }, /* (206) sortorder ::= DESC */ - { 272, 0 }, /* (207) sortorder ::= */ - { 255, 0 }, /* (208) groupby_opt ::= */ - { 255, -3 }, /* (209) groupby_opt ::= GROUP BY grouplist */ - { 273, -3 }, /* (210) grouplist ::= grouplist COMMA item */ - { 273, -1 }, /* (211) grouplist ::= item */ - { 256, 0 }, /* (212) having_opt ::= */ - { 256, -2 }, /* (213) having_opt ::= HAVING expr */ - { 259, 0 }, /* (214) limit_opt ::= */ - { 259, -2 }, /* (215) limit_opt ::= LIMIT signed */ - { 259, -4 }, /* (216) limit_opt ::= LIMIT signed OFFSET signed */ - { 259, -4 }, /* (217) limit_opt ::= LIMIT signed COMMA signed */ - { 258, 0 }, /* (218) slimit_opt ::= */ - { 258, -2 }, /* (219) slimit_opt ::= SLIMIT signed */ - { 258, -4 }, /* (220) slimit_opt ::= SLIMIT signed SOFFSET signed */ - { 258, -4 }, /* (221) slimit_opt ::= SLIMIT signed COMMA signed */ - { 249, 0 }, /* (222) where_opt ::= */ - { 249, -2 }, /* (223) where_opt ::= WHERE expr */ - { 263, -3 }, /* (224) expr ::= LP expr RP */ - { 263, -1 }, /* (225) expr ::= ID */ - { 263, -3 }, /* (226) expr ::= ID DOT ID */ - { 263, -3 }, /* (227) expr ::= ID DOT STAR */ - { 263, -1 }, /* (228) expr ::= INTEGER */ - { 263, -2 }, /* (229) expr ::= MINUS INTEGER */ - { 263, -2 }, /* (230) expr ::= PLUS INTEGER */ - { 263, -1 }, /* (231) expr ::= FLOAT */ - { 263, -2 }, /* (232) expr ::= MINUS FLOAT */ - { 263, -2 }, /* (233) expr ::= PLUS FLOAT */ - { 263, -1 }, /* (234) expr ::= STRING */ - { 263, -1 }, /* (235) expr ::= NOW */ - { 263, -1 }, /* (236) expr ::= VARIABLE */ - { 263, -2 }, /* (237) expr ::= PLUS VARIABLE */ - { 263, -2 }, /* (238) expr ::= MINUS VARIABLE */ - { 263, -1 }, /* (239) expr ::= BOOL */ - { 263, -1 }, /* (240) expr ::= NULL */ - { 263, -4 }, /* (241) expr ::= ID LP exprlist RP */ - { 263, -4 }, /* (242) expr ::= ID LP STAR RP */ - { 263, -3 }, /* (243) expr ::= expr IS NULL */ - { 263, -4 }, /* (244) expr ::= expr IS NOT NULL */ - { 263, -3 }, /* (245) expr ::= expr LT expr */ - { 263, -3 }, /* (246) expr ::= expr GT expr */ - { 263, -3 }, /* (247) expr ::= expr LE expr */ - { 263, -3 }, /* (248) expr ::= expr GE expr */ - { 263, -3 }, /* (249) expr ::= expr NE expr */ - { 263, -3 }, /* (250) expr ::= expr EQ expr */ - { 263, -5 }, /* (251) expr ::= expr BETWEEN expr AND expr */ - { 263, -3 }, /* (252) expr ::= expr AND expr */ - { 263, -3 }, /* (253) expr ::= expr OR expr */ - { 263, -3 }, /* (254) expr ::= expr PLUS expr */ - { 263, -3 }, /* (255) expr ::= expr MINUS expr */ - { 263, -3 }, /* (256) expr ::= expr STAR expr */ - { 263, -3 }, /* (257) expr ::= expr SLASH expr */ - { 263, -3 }, /* (258) expr ::= expr REM expr */ - { 263, -3 }, /* (259) expr ::= expr LIKE expr */ - { 263, -3 }, /* (260) expr ::= expr MATCH expr */ - { 263, -3 }, /* (261) expr ::= expr NMATCH expr */ - { 263, -5 }, /* (262) expr ::= expr IN LP exprlist RP */ - { 205, -3 }, /* (263) exprlist ::= exprlist COMMA expritem */ - { 205, -1 }, /* (264) exprlist ::= expritem */ - { 274, -1 }, /* (265) expritem ::= expr */ - { 274, 0 }, /* (266) expritem ::= */ - { 198, -3 }, /* (267) cmd ::= RESET QUERY CACHE */ - { 198, -3 }, /* (268) cmd ::= SYNCDB ids REPLICA */ - { 198, -7 }, /* (269) cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */ - { 198, -7 }, /* (270) cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */ - { 198, -7 }, /* (271) cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist */ - { 198, -7 }, /* (272) cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ - { 198, -7 }, /* (273) cmd ::= ALTER TABLE ids cpxName DROP TAG ids */ - { 198, -8 }, /* (274) cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */ - { 198, -9 }, /* (275) cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */ - { 198, -7 }, /* (276) cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist */ - { 198, -7 }, /* (277) cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */ - { 198, -7 }, /* (278) cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */ - { 198, -7 }, /* (279) cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist */ - { 198, -7 }, /* (280) cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */ - { 198, -7 }, /* (281) cmd ::= ALTER STABLE ids cpxName DROP TAG ids */ - { 198, -8 }, /* (282) cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */ - { 198, -9 }, /* (283) cmd ::= ALTER STABLE ids cpxName SET TAG ids EQ tagitem */ - { 198, -7 }, /* (284) cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist */ - { 198, -3 }, /* (285) cmd ::= KILL CONNECTION INTEGER */ - { 198, -5 }, /* (286) cmd ::= KILL STREAM INTEGER COLON INTEGER */ - { 198, -5 }, /* (287) cmd ::= KILL QUERY INTEGER COLON INTEGER */ + { 198, -1 }, /* (0) program ::= cmd */ + { 199, -2 }, /* (1) cmd ::= SHOW DATABASES */ + { 199, -2 }, /* (2) cmd ::= SHOW TOPICS */ + { 199, -2 }, /* (3) cmd ::= SHOW FUNCTIONS */ + { 199, -2 }, /* (4) cmd ::= SHOW MNODES */ + { 199, -2 }, /* (5) cmd ::= SHOW DNODES */ + { 199, -2 }, /* (6) cmd ::= SHOW ACCOUNTS */ + { 199, -2 }, /* (7) cmd ::= SHOW USERS */ + { 199, -2 }, /* (8) cmd ::= SHOW MODULES */ + { 199, -2 }, /* (9) cmd ::= SHOW QUERIES */ + { 199, -2 }, /* (10) cmd ::= SHOW CONNECTIONS */ + { 199, -2 }, /* (11) cmd ::= SHOW STREAMS */ + { 199, -2 }, /* (12) cmd ::= SHOW VARIABLES */ + { 199, -2 }, /* (13) cmd ::= SHOW SCORES */ + { 199, -2 }, /* (14) cmd ::= SHOW GRANTS */ + { 199, -2 }, /* (15) cmd ::= SHOW VNODES */ + { 199, -3 }, /* (16) cmd ::= SHOW VNODES ids */ + { 201, 0 }, /* (17) dbPrefix ::= */ + { 201, -2 }, /* (18) dbPrefix ::= ids DOT */ + { 202, 0 }, /* (19) cpxName ::= */ + { 202, -2 }, /* (20) cpxName ::= DOT ids */ + { 199, -5 }, /* (21) cmd ::= SHOW CREATE TABLE ids cpxName */ + { 199, -5 }, /* (22) cmd ::= SHOW CREATE STABLE ids cpxName */ + { 199, -4 }, /* (23) cmd ::= SHOW CREATE DATABASE ids */ + { 199, -3 }, /* (24) cmd ::= SHOW dbPrefix TABLES */ + { 199, -5 }, /* (25) cmd ::= SHOW dbPrefix TABLES LIKE ids */ + { 199, -3 }, /* (26) cmd ::= SHOW dbPrefix STABLES */ + { 199, -5 }, /* (27) cmd ::= SHOW dbPrefix STABLES LIKE ids */ + { 199, -3 }, /* (28) cmd ::= SHOW dbPrefix VGROUPS */ + { 199, -4 }, /* (29) cmd ::= SHOW dbPrefix VGROUPS ids */ + { 199, -5 }, /* (30) cmd ::= DROP TABLE ifexists ids cpxName */ + { 199, -5 }, /* (31) cmd ::= DROP STABLE ifexists ids cpxName */ + { 199, -4 }, /* (32) cmd ::= DROP DATABASE ifexists ids */ + { 199, -4 }, /* (33) cmd ::= DROP TOPIC ifexists ids */ + { 199, -3 }, /* (34) cmd ::= DROP FUNCTION ids */ + { 199, -3 }, /* (35) cmd ::= DROP DNODE ids */ + { 199, -3 }, /* (36) cmd ::= DROP USER ids */ + { 199, -3 }, /* (37) cmd ::= DROP ACCOUNT ids */ + { 199, -2 }, /* (38) cmd ::= USE ids */ + { 199, -3 }, /* (39) cmd ::= DESCRIBE ids cpxName */ + { 199, -3 }, /* (40) cmd ::= DESC ids cpxName */ + { 199, -5 }, /* (41) cmd ::= ALTER USER ids PASS ids */ + { 199, -5 }, /* (42) cmd ::= ALTER USER ids PRIVILEGE ids */ + { 199, -4 }, /* (43) cmd ::= ALTER DNODE ids ids */ + { 199, -5 }, /* (44) cmd ::= ALTER DNODE ids ids ids */ + { 199, -3 }, /* (45) cmd ::= ALTER LOCAL ids */ + { 199, -4 }, /* (46) cmd ::= ALTER LOCAL ids ids */ + { 199, -4 }, /* (47) cmd ::= ALTER DATABASE ids alter_db_optr */ + { 199, -4 }, /* (48) cmd ::= ALTER ACCOUNT ids acct_optr */ + { 199, -6 }, /* (49) cmd ::= ALTER ACCOUNT ids PASS ids acct_optr */ + { 199, -6 }, /* (50) cmd ::= COMPACT VNODES IN LP exprlist RP */ + { 200, -1 }, /* (51) ids ::= ID */ + { 200, -1 }, /* (52) ids ::= STRING */ + { 203, -2 }, /* (53) ifexists ::= IF EXISTS */ + { 203, 0 }, /* (54) ifexists ::= */ + { 207, -3 }, /* (55) ifnotexists ::= IF NOT EXISTS */ + { 207, 0 }, /* (56) ifnotexists ::= */ + { 199, -5 }, /* (57) cmd ::= CREATE DNODE ids PORT ids */ + { 199, -6 }, /* (58) cmd ::= CREATE ACCOUNT ids PASS ids acct_optr */ + { 199, -5 }, /* (59) cmd ::= CREATE DATABASE ifnotexists ids db_optr */ + { 199, -8 }, /* (60) cmd ::= CREATE FUNCTION ids AS ids OUTPUTTYPE typename bufsize */ + { 199, -9 }, /* (61) cmd ::= CREATE AGGREGATE FUNCTION ids AS ids OUTPUTTYPE typename bufsize */ + { 199, -5 }, /* (62) cmd ::= CREATE USER ids PASS ids */ + { 210, 0 }, /* (63) bufsize ::= */ + { 210, -2 }, /* (64) bufsize ::= BUFSIZE INTEGER */ + { 211, 0 }, /* (65) pps ::= */ + { 211, -2 }, /* (66) pps ::= PPS INTEGER */ + { 212, 0 }, /* (67) tseries ::= */ + { 212, -2 }, /* (68) tseries ::= TSERIES INTEGER */ + { 213, 0 }, /* (69) dbs ::= */ + { 213, -2 }, /* (70) dbs ::= DBS INTEGER */ + { 214, 0 }, /* (71) streams ::= */ + { 214, -2 }, /* (72) streams ::= STREAMS INTEGER */ + { 215, 0 }, /* (73) storage ::= */ + { 215, -2 }, /* (74) storage ::= STORAGE INTEGER */ + { 216, 0 }, /* (75) qtime ::= */ + { 216, -2 }, /* (76) qtime ::= QTIME INTEGER */ + { 217, 0 }, /* (77) users ::= */ + { 217, -2 }, /* (78) users ::= USERS INTEGER */ + { 218, 0 }, /* (79) conns ::= */ + { 218, -2 }, /* (80) conns ::= CONNS INTEGER */ + { 219, 0 }, /* (81) state ::= */ + { 219, -2 }, /* (82) state ::= STATE ids */ + { 205, -9 }, /* (83) acct_optr ::= pps tseries storage streams qtime dbs users conns state */ + { 220, -3 }, /* (84) intitemlist ::= intitemlist COMMA intitem */ + { 220, -1 }, /* (85) intitemlist ::= intitem */ + { 221, -1 }, /* (86) intitem ::= INTEGER */ + { 222, -2 }, /* (87) keep ::= KEEP intitemlist */ + { 223, -2 }, /* (88) cache ::= CACHE INTEGER */ + { 224, -2 }, /* (89) replica ::= REPLICA INTEGER */ + { 225, -2 }, /* (90) quorum ::= QUORUM INTEGER */ + { 226, -2 }, /* (91) days ::= DAYS INTEGER */ + { 227, -2 }, /* (92) minrows ::= MINROWS INTEGER */ + { 228, -2 }, /* (93) maxrows ::= MAXROWS INTEGER */ + { 229, -2 }, /* (94) blocks ::= BLOCKS INTEGER */ + { 230, -2 }, /* (95) ctime ::= CTIME INTEGER */ + { 231, -2 }, /* (96) wal ::= WAL INTEGER */ + { 232, -2 }, /* (97) fsync ::= FSYNC INTEGER */ + { 233, -2 }, /* (98) comp ::= COMP INTEGER */ + { 234, -2 }, /* (99) prec ::= PRECISION STRING */ + { 235, -2 }, /* (100) update ::= UPDATE INTEGER */ + { 236, -2 }, /* (101) cachelast ::= CACHELAST INTEGER */ + { 208, 0 }, /* (102) db_optr ::= */ + { 208, -2 }, /* (103) db_optr ::= db_optr cache */ + { 208, -2 }, /* (104) db_optr ::= db_optr replica */ + { 208, -2 }, /* (105) db_optr ::= db_optr quorum */ + { 208, -2 }, /* (106) db_optr ::= db_optr days */ + { 208, -2 }, /* (107) db_optr ::= db_optr minrows */ + { 208, -2 }, /* (108) db_optr ::= db_optr maxrows */ + { 208, -2 }, /* (109) db_optr ::= db_optr blocks */ + { 208, -2 }, /* (110) db_optr ::= db_optr ctime */ + { 208, -2 }, /* (111) db_optr ::= db_optr wal */ + { 208, -2 }, /* (112) db_optr ::= db_optr fsync */ + { 208, -2 }, /* (113) db_optr ::= db_optr comp */ + { 208, -2 }, /* (114) db_optr ::= db_optr prec */ + { 208, -2 }, /* (115) db_optr ::= db_optr keep */ + { 208, -2 }, /* (116) db_optr ::= db_optr update */ + { 208, -2 }, /* (117) db_optr ::= db_optr cachelast */ + { 204, 0 }, /* (118) alter_db_optr ::= */ + { 204, -2 }, /* (119) alter_db_optr ::= alter_db_optr replica */ + { 204, -2 }, /* (120) alter_db_optr ::= alter_db_optr quorum */ + { 204, -2 }, /* (121) alter_db_optr ::= alter_db_optr keep */ + { 204, -2 }, /* (122) alter_db_optr ::= alter_db_optr blocks */ + { 204, -2 }, /* (123) alter_db_optr ::= alter_db_optr comp */ + { 204, -2 }, /* (124) alter_db_optr ::= alter_db_optr update */ + { 204, -2 }, /* (125) alter_db_optr ::= alter_db_optr cachelast */ + { 209, -1 }, /* (126) typename ::= ids */ + { 209, -4 }, /* (127) typename ::= ids LP signed RP */ + { 209, -2 }, /* (128) typename ::= ids UNSIGNED */ + { 237, -1 }, /* (129) signed ::= INTEGER */ + { 237, -2 }, /* (130) signed ::= PLUS INTEGER */ + { 237, -2 }, /* (131) signed ::= MINUS INTEGER */ + { 199, -3 }, /* (132) cmd ::= CREATE TABLE create_table_args */ + { 199, -3 }, /* (133) cmd ::= CREATE TABLE create_stable_args */ + { 199, -3 }, /* (134) cmd ::= CREATE STABLE create_stable_args */ + { 199, -3 }, /* (135) cmd ::= CREATE TABLE create_table_list */ + { 240, -1 }, /* (136) create_table_list ::= create_from_stable */ + { 240, -2 }, /* (137) create_table_list ::= create_table_list create_from_stable */ + { 238, -6 }, /* (138) create_table_args ::= ifnotexists ids cpxName LP columnlist RP */ + { 239, -10 }, /* (139) create_stable_args ::= ifnotexists ids cpxName LP columnlist RP TAGS LP columnlist RP */ + { 241, -10 }, /* (140) create_from_stable ::= ifnotexists ids cpxName USING ids cpxName TAGS LP tagitemlist1 RP */ + { 241, -13 }, /* (141) create_from_stable ::= ifnotexists ids cpxName USING ids cpxName LP tagNamelist RP TAGS LP tagitemlist1 RP */ + { 244, -3 }, /* (142) tagNamelist ::= tagNamelist COMMA ids */ + { 244, -1 }, /* (143) tagNamelist ::= ids */ + { 238, -5 }, /* (144) create_table_args ::= ifnotexists ids cpxName AS select */ + { 242, -3 }, /* (145) columnlist ::= columnlist COMMA column */ + { 242, -1 }, /* (146) columnlist ::= column */ + { 246, -2 }, /* (147) column ::= ids typename */ + { 243, -3 }, /* (148) tagitemlist1 ::= tagitemlist1 COMMA tagitem1 */ + { 243, -1 }, /* (149) tagitemlist1 ::= tagitem1 */ + { 247, -2 }, /* (150) tagitem1 ::= MINUS INTEGER */ + { 248, -3 }, /* (151) tagitemlist ::= tagitemlist COMMA tagitem */ + { 248, -1 }, /* (152) tagitemlist ::= tagitem */ + { 249, -1 }, /* (153) tagitem ::= INTEGER */ + { 249, -1 }, /* (154) tagitem ::= FLOAT */ + { 249, -1 }, /* (155) tagitem ::= STRING */ + { 249, -1 }, /* (156) tagitem ::= BOOL */ + { 249, -1 }, /* (157) tagitem ::= NULL */ + { 249, -1 }, /* (158) tagitem ::= NOW */ + { 249, -2 }, /* (159) tagitem ::= MINUS INTEGER */ + { 249, -2 }, /* (160) tagitem ::= MINUS FLOAT */ + { 249, -2 }, /* (161) tagitem ::= PLUS INTEGER */ + { 249, -2 }, /* (162) tagitem ::= PLUS FLOAT */ + { 245, -14 }, /* (163) select ::= SELECT selcollist from where_opt interval_option sliding_opt session_option windowstate_option fill_opt groupby_opt having_opt orderby_opt slimit_opt limit_opt */ + { 245, -3 }, /* (164) select ::= LP select RP */ + { 263, -1 }, /* (165) union ::= select */ + { 263, -4 }, /* (166) union ::= union UNION ALL select */ + { 263, -3 }, /* (167) union ::= union UNION select */ + { 199, -1 }, /* (168) cmd ::= union */ + { 245, -2 }, /* (169) select ::= SELECT selcollist */ + { 264, -2 }, /* (170) sclp ::= selcollist COMMA */ + { 264, 0 }, /* (171) sclp ::= */ + { 250, -4 }, /* (172) selcollist ::= sclp distinct expr as */ + { 250, -2 }, /* (173) selcollist ::= sclp STAR */ + { 267, -2 }, /* (174) as ::= AS ids */ + { 267, -1 }, /* (175) as ::= ids */ + { 267, 0 }, /* (176) as ::= */ + { 265, -1 }, /* (177) distinct ::= DISTINCT */ + { 265, 0 }, /* (178) distinct ::= */ + { 251, -2 }, /* (179) from ::= FROM tablelist */ + { 251, -2 }, /* (180) from ::= FROM sub */ + { 269, -3 }, /* (181) sub ::= LP union RP */ + { 269, -4 }, /* (182) sub ::= LP union RP ids */ + { 269, -6 }, /* (183) sub ::= sub COMMA LP union RP ids */ + { 268, -2 }, /* (184) tablelist ::= ids cpxName */ + { 268, -3 }, /* (185) tablelist ::= ids cpxName ids */ + { 268, -4 }, /* (186) tablelist ::= tablelist COMMA ids cpxName */ + { 268, -5 }, /* (187) tablelist ::= tablelist COMMA ids cpxName ids */ + { 270, -1 }, /* (188) tmvar ::= VARIABLE */ + { 253, -4 }, /* (189) interval_option ::= intervalKey LP tmvar RP */ + { 253, -6 }, /* (190) interval_option ::= intervalKey LP tmvar COMMA tmvar RP */ + { 253, 0 }, /* (191) interval_option ::= */ + { 271, -1 }, /* (192) intervalKey ::= INTERVAL */ + { 271, -1 }, /* (193) intervalKey ::= EVERY */ + { 255, 0 }, /* (194) session_option ::= */ + { 255, -7 }, /* (195) session_option ::= SESSION LP ids cpxName COMMA tmvar RP */ + { 256, 0 }, /* (196) windowstate_option ::= */ + { 256, -4 }, /* (197) windowstate_option ::= STATE_WINDOW LP ids RP */ + { 257, 0 }, /* (198) fill_opt ::= */ + { 257, -6 }, /* (199) fill_opt ::= FILL LP ID COMMA tagitemlist RP */ + { 257, -4 }, /* (200) fill_opt ::= FILL LP ID RP */ + { 254, -4 }, /* (201) sliding_opt ::= SLIDING LP tmvar RP */ + { 254, 0 }, /* (202) sliding_opt ::= */ + { 260, 0 }, /* (203) orderby_opt ::= */ + { 260, -3 }, /* (204) orderby_opt ::= ORDER BY sortlist */ + { 272, -4 }, /* (205) sortlist ::= sortlist COMMA item sortorder */ + { 272, -2 }, /* (206) sortlist ::= item sortorder */ + { 274, -2 }, /* (207) item ::= ids cpxName */ + { 275, -1 }, /* (208) sortorder ::= ASC */ + { 275, -1 }, /* (209) sortorder ::= DESC */ + { 275, 0 }, /* (210) sortorder ::= */ + { 258, 0 }, /* (211) groupby_opt ::= */ + { 258, -3 }, /* (212) groupby_opt ::= GROUP BY grouplist */ + { 276, -3 }, /* (213) grouplist ::= grouplist COMMA item */ + { 276, -1 }, /* (214) grouplist ::= item */ + { 259, 0 }, /* (215) having_opt ::= */ + { 259, -2 }, /* (216) having_opt ::= HAVING expr */ + { 262, 0 }, /* (217) limit_opt ::= */ + { 262, -2 }, /* (218) limit_opt ::= LIMIT signed */ + { 262, -4 }, /* (219) limit_opt ::= LIMIT signed OFFSET signed */ + { 262, -4 }, /* (220) limit_opt ::= LIMIT signed COMMA signed */ + { 261, 0 }, /* (221) slimit_opt ::= */ + { 261, -2 }, /* (222) slimit_opt ::= SLIMIT signed */ + { 261, -4 }, /* (223) slimit_opt ::= SLIMIT signed SOFFSET signed */ + { 261, -4 }, /* (224) slimit_opt ::= SLIMIT signed COMMA signed */ + { 252, 0 }, /* (225) where_opt ::= */ + { 252, -2 }, /* (226) where_opt ::= WHERE expr */ + { 266, -3 }, /* (227) expr ::= LP expr RP */ + { 266, -1 }, /* (228) expr ::= ID */ + { 266, -3 }, /* (229) expr ::= ID DOT ID */ + { 266, -3 }, /* (230) expr ::= ID DOT STAR */ + { 266, -1 }, /* (231) expr ::= INTEGER */ + { 266, -2 }, /* (232) expr ::= MINUS INTEGER */ + { 266, -2 }, /* (233) expr ::= PLUS INTEGER */ + { 266, -1 }, /* (234) expr ::= FLOAT */ + { 266, -2 }, /* (235) expr ::= MINUS FLOAT */ + { 266, -2 }, /* (236) expr ::= PLUS FLOAT */ + { 266, -1 }, /* (237) expr ::= STRING */ + { 266, -1 }, /* (238) expr ::= NOW */ + { 266, -1 }, /* (239) expr ::= VARIABLE */ + { 266, -2 }, /* (240) expr ::= PLUS VARIABLE */ + { 266, -2 }, /* (241) expr ::= MINUS VARIABLE */ + { 266, -1 }, /* (242) expr ::= BOOL */ + { 266, -1 }, /* (243) expr ::= NULL */ + { 266, -4 }, /* (244) expr ::= ID LP exprlist RP */ + { 266, -4 }, /* (245) expr ::= ID LP STAR RP */ + { 266, -3 }, /* (246) expr ::= expr IS NULL */ + { 266, -4 }, /* (247) expr ::= expr IS NOT NULL */ + { 266, -3 }, /* (248) expr ::= expr LT expr */ + { 266, -3 }, /* (249) expr ::= expr GT expr */ + { 266, -3 }, /* (250) expr ::= expr LE expr */ + { 266, -3 }, /* (251) expr ::= expr GE expr */ + { 266, -3 }, /* (252) expr ::= expr NE expr */ + { 266, -3 }, /* (253) expr ::= expr EQ expr */ + { 266, -5 }, /* (254) expr ::= expr BETWEEN expr AND expr */ + { 266, -3 }, /* (255) expr ::= expr AND expr */ + { 266, -3 }, /* (256) expr ::= expr OR expr */ + { 266, -3 }, /* (257) expr ::= expr PLUS expr */ + { 266, -3 }, /* (258) expr ::= expr MINUS expr */ + { 266, -3 }, /* (259) expr ::= expr STAR expr */ + { 266, -3 }, /* (260) expr ::= expr SLASH expr */ + { 266, -3 }, /* (261) expr ::= expr REM expr */ + { 266, -3 }, /* (262) expr ::= expr LIKE expr */ + { 266, -3 }, /* (263) expr ::= expr MATCH expr */ + { 266, -3 }, /* (264) expr ::= expr NMATCH expr */ + { 266, -5 }, /* (265) expr ::= expr IN LP exprlist RP */ + { 206, -3 }, /* (266) exprlist ::= exprlist COMMA expritem */ + { 206, -1 }, /* (267) exprlist ::= expritem */ + { 277, -1 }, /* (268) expritem ::= expr */ + { 277, 0 }, /* (269) expritem ::= */ + { 199, -3 }, /* (270) cmd ::= RESET QUERY CACHE */ + { 199, -3 }, /* (271) cmd ::= SYNCDB ids REPLICA */ + { 199, -7 }, /* (272) cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */ + { 199, -7 }, /* (273) cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */ + { 199, -7 }, /* (274) cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist */ + { 199, -7 }, /* (275) cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ + { 199, -7 }, /* (276) cmd ::= ALTER TABLE ids cpxName DROP TAG ids */ + { 199, -8 }, /* (277) cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */ + { 199, -9 }, /* (278) cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */ + { 199, -7 }, /* (279) cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist */ + { 199, -7 }, /* (280) cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */ + { 199, -7 }, /* (281) cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */ + { 199, -7 }, /* (282) cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist */ + { 199, -7 }, /* (283) cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */ + { 199, -7 }, /* (284) cmd ::= ALTER STABLE ids cpxName DROP TAG ids */ + { 199, -8 }, /* (285) cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */ + { 199, -9 }, /* (286) cmd ::= ALTER STABLE ids cpxName SET TAG ids EQ tagitem */ + { 199, -7 }, /* (287) cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist */ + { 199, -3 }, /* (288) cmd ::= KILL CONNECTION INTEGER */ + { 199, -5 }, /* (289) cmd ::= KILL STREAM INTEGER COLON INTEGER */ + { 199, -5 }, /* (290) cmd ::= KILL QUERY INTEGER COLON INTEGER */ }; static void yy_accept(yyParser*); /* Forward Declaration */ @@ -2371,16 +2386,16 @@ static void yy_reduce( { setDCLSqlElems(pInfo, TSDB_SQL_CFG_LOCAL, 2, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } break; case 47: /* cmd ::= ALTER DATABASE ids alter_db_optr */ -{ SToken t = {0}; setCreateDbInfo(pInfo, TSDB_SQL_ALTER_DB, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy42, &t);} +{ SToken t = {0}; setCreateDbInfo(pInfo, TSDB_SQL_ALTER_DB, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy90, &t);} break; case 48: /* cmd ::= ALTER ACCOUNT ids acct_optr */ -{ setCreateAcctSql(pInfo, TSDB_SQL_ALTER_ACCT, &yymsp[-1].minor.yy0, NULL, &yymsp[0].minor.yy341);} +{ setCreateAcctSql(pInfo, TSDB_SQL_ALTER_ACCT, &yymsp[-1].minor.yy0, NULL, &yymsp[0].minor.yy171);} break; case 49: /* 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.yy341);} +{ setCreateAcctSql(pInfo, TSDB_SQL_ALTER_ACCT, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy171);} break; case 50: /* cmd ::= COMPACT VNODES IN LP exprlist RP */ -{ setCompactVnodeSql(pInfo, TSDB_SQL_COMPACT_VNODE, yymsp[-1].minor.yy131);} +{ setCompactVnodeSql(pInfo, TSDB_SQL_COMPACT_VNODE, yymsp[-1].minor.yy421);} break; case 51: /* ids ::= ID */ case 52: /* ids ::= STRING */ yytestcase(yyruleno==52); @@ -2392,26 +2407,26 @@ static void yy_reduce( break; case 54: /* ifexists ::= */ case 56: /* ifnotexists ::= */ yytestcase(yyruleno==56); - case 175: /* distinct ::= */ yytestcase(yyruleno==175); + case 178: /* distinct ::= */ yytestcase(yyruleno==178); { yymsp[1].minor.yy0.n = 0;} break; case 55: /* ifnotexists ::= IF NOT EXISTS */ { yymsp[-2].minor.yy0.n = 1;} break; - case 57: /* cmd ::= CREATE DNODE ids */ -{ setDCLSqlElems(pInfo, TSDB_SQL_CREATE_DNODE, 1, &yymsp[0].minor.yy0);} + case 57: /* cmd ::= CREATE DNODE ids PORT ids */ +{ setDCLSqlElems(pInfo, TSDB_SQL_CREATE_DNODE, 2, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0);} break; case 58: /* 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.yy341);} +{ setCreateAcctSql(pInfo, TSDB_SQL_CREATE_ACCT, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy171);} break; case 59: /* cmd ::= CREATE DATABASE ifnotexists ids db_optr */ -{ setCreateDbInfo(pInfo, TSDB_SQL_CREATE_DB, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy42, &yymsp[-2].minor.yy0);} +{ setCreateDbInfo(pInfo, TSDB_SQL_CREATE_DB, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy90, &yymsp[-2].minor.yy0);} break; case 60: /* cmd ::= CREATE FUNCTION ids AS ids OUTPUTTYPE typename bufsize */ -{ setCreateFuncInfo(pInfo, TSDB_SQL_CREATE_FUNCTION, &yymsp[-5].minor.yy0, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy290, &yymsp[0].minor.yy0, 1);} +{ setCreateFuncInfo(pInfo, TSDB_SQL_CREATE_FUNCTION, &yymsp[-5].minor.yy0, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy100, &yymsp[0].minor.yy0, 1);} break; case 61: /* cmd ::= CREATE AGGREGATE FUNCTION ids AS ids OUTPUTTYPE typename bufsize */ -{ setCreateFuncInfo(pInfo, TSDB_SQL_CREATE_FUNCTION, &yymsp[-5].minor.yy0, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy290, &yymsp[0].minor.yy0, 2);} +{ setCreateFuncInfo(pInfo, TSDB_SQL_CREATE_FUNCTION, &yymsp[-5].minor.yy0, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy100, &yymsp[0].minor.yy0, 2);} break; case 62: /* cmd ::= CREATE USER ids PASS ids */ { setCreateUserSql(pInfo, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0);} @@ -2442,38 +2457,38 @@ static void yy_reduce( break; case 83: /* acct_optr ::= pps tseries storage streams qtime dbs users conns state */ { - yylhsminor.yy341.maxUsers = (yymsp[-2].minor.yy0.n>0)?atoi(yymsp[-2].minor.yy0.z):-1; - yylhsminor.yy341.maxDbs = (yymsp[-3].minor.yy0.n>0)?atoi(yymsp[-3].minor.yy0.z):-1; - yylhsminor.yy341.maxTimeSeries = (yymsp[-7].minor.yy0.n>0)?atoi(yymsp[-7].minor.yy0.z):-1; - yylhsminor.yy341.maxStreams = (yymsp[-5].minor.yy0.n>0)?atoi(yymsp[-5].minor.yy0.z):-1; - yylhsminor.yy341.maxPointsPerSecond = (yymsp[-8].minor.yy0.n>0)?atoi(yymsp[-8].minor.yy0.z):-1; - yylhsminor.yy341.maxStorage = (yymsp[-6].minor.yy0.n>0)?strtoll(yymsp[-6].minor.yy0.z, NULL, 10):-1; - yylhsminor.yy341.maxQueryTime = (yymsp[-4].minor.yy0.n>0)?strtoll(yymsp[-4].minor.yy0.z, NULL, 10):-1; - yylhsminor.yy341.maxConnections = (yymsp[-1].minor.yy0.n>0)?atoi(yymsp[-1].minor.yy0.z):-1; - yylhsminor.yy341.stat = yymsp[0].minor.yy0; + yylhsminor.yy171.maxUsers = (yymsp[-2].minor.yy0.n>0)?atoi(yymsp[-2].minor.yy0.z):-1; + yylhsminor.yy171.maxDbs = (yymsp[-3].minor.yy0.n>0)?atoi(yymsp[-3].minor.yy0.z):-1; + yylhsminor.yy171.maxTimeSeries = (yymsp[-7].minor.yy0.n>0)?atoi(yymsp[-7].minor.yy0.z):-1; + yylhsminor.yy171.maxStreams = (yymsp[-5].minor.yy0.n>0)?atoi(yymsp[-5].minor.yy0.z):-1; + yylhsminor.yy171.maxPointsPerSecond = (yymsp[-8].minor.yy0.n>0)?atoi(yymsp[-8].minor.yy0.z):-1; + yylhsminor.yy171.maxStorage = (yymsp[-6].minor.yy0.n>0)?strtoll(yymsp[-6].minor.yy0.z, NULL, 10):-1; + yylhsminor.yy171.maxQueryTime = (yymsp[-4].minor.yy0.n>0)?strtoll(yymsp[-4].minor.yy0.z, NULL, 10):-1; + yylhsminor.yy171.maxConnections = (yymsp[-1].minor.yy0.n>0)?atoi(yymsp[-1].minor.yy0.z):-1; + yylhsminor.yy171.stat = yymsp[0].minor.yy0; } - yymsp[-8].minor.yy341 = yylhsminor.yy341; + yymsp[-8].minor.yy171 = yylhsminor.yy171; break; case 84: /* intitemlist ::= intitemlist COMMA intitem */ - case 148: /* tagitemlist ::= tagitemlist COMMA tagitem */ yytestcase(yyruleno==148); -{ yylhsminor.yy131 = tListItemAppend(yymsp[-2].minor.yy131, &yymsp[0].minor.yy43, -1); } - yymsp[-2].minor.yy131 = yylhsminor.yy131; + case 151: /* tagitemlist ::= tagitemlist COMMA tagitem */ yytestcase(yyruleno==151); +{ yylhsminor.yy421 = tListItemAppend(yymsp[-2].minor.yy421, &yymsp[0].minor.yy69, -1); } + yymsp[-2].minor.yy421 = yylhsminor.yy421; break; case 85: /* intitemlist ::= intitem */ - case 149: /* tagitemlist ::= tagitem */ yytestcase(yyruleno==149); -{ yylhsminor.yy131 = tListItemAppend(NULL, &yymsp[0].minor.yy43, -1); } - yymsp[0].minor.yy131 = yylhsminor.yy131; + case 152: /* tagitemlist ::= tagitem */ yytestcase(yyruleno==152); +{ yylhsminor.yy421 = tListItemAppend(NULL, &yymsp[0].minor.yy69, -1); } + yymsp[0].minor.yy421 = yylhsminor.yy421; break; case 86: /* intitem ::= INTEGER */ - case 150: /* tagitem ::= INTEGER */ yytestcase(yyruleno==150); - case 151: /* tagitem ::= FLOAT */ yytestcase(yyruleno==151); - case 152: /* tagitem ::= STRING */ yytestcase(yyruleno==152); - case 153: /* tagitem ::= BOOL */ yytestcase(yyruleno==153); -{ toTSDBType(yymsp[0].minor.yy0.type); taosVariantCreate(&yylhsminor.yy43, yymsp[0].minor.yy0.z, yymsp[0].minor.yy0.n, yymsp[0].minor.yy0.type); } - yymsp[0].minor.yy43 = yylhsminor.yy43; + case 153: /* tagitem ::= INTEGER */ yytestcase(yyruleno==153); + case 154: /* tagitem ::= FLOAT */ yytestcase(yyruleno==154); + case 155: /* tagitem ::= STRING */ yytestcase(yyruleno==155); + case 156: /* tagitem ::= BOOL */ yytestcase(yyruleno==156); +{ toTSDBType(yymsp[0].minor.yy0.type); taosVariantCreate(&yylhsminor.yy69, yymsp[0].minor.yy0.z, yymsp[0].minor.yy0.n, yymsp[0].minor.yy0.type); } + yymsp[0].minor.yy69 = yylhsminor.yy69; break; case 87: /* keep ::= KEEP intitemlist */ -{ yymsp[-1].minor.yy131 = yymsp[0].minor.yy131; } +{ yymsp[-1].minor.yy421 = yymsp[0].minor.yy421; } break; case 88: /* cache ::= CACHE INTEGER */ case 89: /* replica ::= REPLICA INTEGER */ yytestcase(yyruleno==89); @@ -2492,646 +2507,658 @@ static void yy_reduce( { yymsp[-1].minor.yy0 = yymsp[0].minor.yy0; } break; case 102: /* db_optr ::= */ -{setDefaultCreateDbOption(&yymsp[1].minor.yy42);} +{setDefaultCreateDbOption(&yymsp[1].minor.yy90);} break; case 103: /* db_optr ::= db_optr cache */ -{ yylhsminor.yy42 = yymsp[-1].minor.yy42; yylhsminor.yy42.cacheBlockSize = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy42 = yylhsminor.yy42; +{ yylhsminor.yy90 = yymsp[-1].minor.yy90; yylhsminor.yy90.cacheBlockSize = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy90 = yylhsminor.yy90; break; case 104: /* db_optr ::= db_optr replica */ case 119: /* alter_db_optr ::= alter_db_optr replica */ yytestcase(yyruleno==119); -{ yylhsminor.yy42 = yymsp[-1].minor.yy42; yylhsminor.yy42.replica = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy42 = yylhsminor.yy42; +{ yylhsminor.yy90 = yymsp[-1].minor.yy90; yylhsminor.yy90.replica = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy90 = yylhsminor.yy90; break; case 105: /* db_optr ::= db_optr quorum */ case 120: /* alter_db_optr ::= alter_db_optr quorum */ yytestcase(yyruleno==120); -{ yylhsminor.yy42 = yymsp[-1].minor.yy42; yylhsminor.yy42.quorum = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy42 = yylhsminor.yy42; +{ yylhsminor.yy90 = yymsp[-1].minor.yy90; yylhsminor.yy90.quorum = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy90 = yylhsminor.yy90; break; case 106: /* db_optr ::= db_optr days */ -{ yylhsminor.yy42 = yymsp[-1].minor.yy42; yylhsminor.yy42.daysPerFile = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy42 = yylhsminor.yy42; +{ yylhsminor.yy90 = yymsp[-1].minor.yy90; yylhsminor.yy90.daysPerFile = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy90 = yylhsminor.yy90; break; case 107: /* db_optr ::= db_optr minrows */ -{ yylhsminor.yy42 = yymsp[-1].minor.yy42; yylhsminor.yy42.minRowsPerBlock = strtod(yymsp[0].minor.yy0.z, NULL); } - yymsp[-1].minor.yy42 = yylhsminor.yy42; +{ yylhsminor.yy90 = yymsp[-1].minor.yy90; yylhsminor.yy90.minRowsPerBlock = strtod(yymsp[0].minor.yy0.z, NULL); } + yymsp[-1].minor.yy90 = yylhsminor.yy90; break; case 108: /* db_optr ::= db_optr maxrows */ -{ yylhsminor.yy42 = yymsp[-1].minor.yy42; yylhsminor.yy42.maxRowsPerBlock = strtod(yymsp[0].minor.yy0.z, NULL); } - yymsp[-1].minor.yy42 = yylhsminor.yy42; +{ yylhsminor.yy90 = yymsp[-1].minor.yy90; yylhsminor.yy90.maxRowsPerBlock = strtod(yymsp[0].minor.yy0.z, NULL); } + yymsp[-1].minor.yy90 = yylhsminor.yy90; break; case 109: /* db_optr ::= db_optr blocks */ case 122: /* alter_db_optr ::= alter_db_optr blocks */ yytestcase(yyruleno==122); -{ yylhsminor.yy42 = yymsp[-1].minor.yy42; yylhsminor.yy42.numOfBlocks = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy42 = yylhsminor.yy42; +{ yylhsminor.yy90 = yymsp[-1].minor.yy90; yylhsminor.yy90.numOfBlocks = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy90 = yylhsminor.yy90; break; case 110: /* db_optr ::= db_optr ctime */ -{ yylhsminor.yy42 = yymsp[-1].minor.yy42; yylhsminor.yy42.commitTime = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy42 = yylhsminor.yy42; +{ yylhsminor.yy90 = yymsp[-1].minor.yy90; yylhsminor.yy90.commitTime = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy90 = yylhsminor.yy90; break; case 111: /* db_optr ::= db_optr wal */ -{ yylhsminor.yy42 = yymsp[-1].minor.yy42; yylhsminor.yy42.walLevel = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy42 = yylhsminor.yy42; +{ yylhsminor.yy90 = yymsp[-1].minor.yy90; yylhsminor.yy90.walLevel = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy90 = yylhsminor.yy90; break; case 112: /* db_optr ::= db_optr fsync */ -{ yylhsminor.yy42 = yymsp[-1].minor.yy42; yylhsminor.yy42.fsyncPeriod = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy42 = yylhsminor.yy42; +{ yylhsminor.yy90 = yymsp[-1].minor.yy90; yylhsminor.yy90.fsyncPeriod = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy90 = yylhsminor.yy90; break; case 113: /* db_optr ::= db_optr comp */ case 123: /* alter_db_optr ::= alter_db_optr comp */ yytestcase(yyruleno==123); -{ yylhsminor.yy42 = yymsp[-1].minor.yy42; yylhsminor.yy42.compressionLevel = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy42 = yylhsminor.yy42; +{ yylhsminor.yy90 = yymsp[-1].minor.yy90; yylhsminor.yy90.compressionLevel = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy90 = yylhsminor.yy90; break; case 114: /* db_optr ::= db_optr prec */ -{ yylhsminor.yy42 = yymsp[-1].minor.yy42; yylhsminor.yy42.precision = yymsp[0].minor.yy0; } - yymsp[-1].minor.yy42 = yylhsminor.yy42; +{ yylhsminor.yy90 = yymsp[-1].minor.yy90; yylhsminor.yy90.precision = yymsp[0].minor.yy0; } + yymsp[-1].minor.yy90 = yylhsminor.yy90; break; case 115: /* db_optr ::= db_optr keep */ case 121: /* alter_db_optr ::= alter_db_optr keep */ yytestcase(yyruleno==121); -{ yylhsminor.yy42 = yymsp[-1].minor.yy42; yylhsminor.yy42.keep = yymsp[0].minor.yy131; } - yymsp[-1].minor.yy42 = yylhsminor.yy42; +{ yylhsminor.yy90 = yymsp[-1].minor.yy90; yylhsminor.yy90.keep = yymsp[0].minor.yy421; } + yymsp[-1].minor.yy90 = yylhsminor.yy90; break; case 116: /* db_optr ::= db_optr update */ case 124: /* alter_db_optr ::= alter_db_optr update */ yytestcase(yyruleno==124); -{ yylhsminor.yy42 = yymsp[-1].minor.yy42; yylhsminor.yy42.update = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy42 = yylhsminor.yy42; +{ yylhsminor.yy90 = yymsp[-1].minor.yy90; yylhsminor.yy90.update = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy90 = yylhsminor.yy90; break; case 117: /* db_optr ::= db_optr cachelast */ case 125: /* alter_db_optr ::= alter_db_optr cachelast */ yytestcase(yyruleno==125); -{ yylhsminor.yy42 = yymsp[-1].minor.yy42; yylhsminor.yy42.cachelast = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy42 = yylhsminor.yy42; +{ yylhsminor.yy90 = yymsp[-1].minor.yy90; yylhsminor.yy90.cachelast = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy90 = yylhsminor.yy90; break; case 118: /* alter_db_optr ::= */ -{ setDefaultCreateDbOption(&yymsp[1].minor.yy42);} +{ setDefaultCreateDbOption(&yymsp[1].minor.yy90);} break; case 126: /* typename ::= ids */ { yymsp[0].minor.yy0.type = 0; - tSetColumnType (&yylhsminor.yy290, &yymsp[0].minor.yy0); + tSetColumnType (&yylhsminor.yy100, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy290 = yylhsminor.yy290; + yymsp[0].minor.yy100 = yylhsminor.yy100; break; case 127: /* typename ::= ids LP signed RP */ { - if (yymsp[-1].minor.yy459 <= 0) { + if (yymsp[-1].minor.yy325 <= 0) { yymsp[-3].minor.yy0.type = 0; - tSetColumnType(&yylhsminor.yy290, &yymsp[-3].minor.yy0); + tSetColumnType(&yylhsminor.yy100, &yymsp[-3].minor.yy0); } else { - yymsp[-3].minor.yy0.type = -yymsp[-1].minor.yy459; // negative value of name length - tSetColumnType(&yylhsminor.yy290, &yymsp[-3].minor.yy0); + yymsp[-3].minor.yy0.type = -yymsp[-1].minor.yy325; // negative value of name length + tSetColumnType(&yylhsminor.yy100, &yymsp[-3].minor.yy0); } } - yymsp[-3].minor.yy290 = yylhsminor.yy290; + yymsp[-3].minor.yy100 = yylhsminor.yy100; break; case 128: /* typename ::= ids UNSIGNED */ { yymsp[-1].minor.yy0.type = 0; yymsp[-1].minor.yy0.n = ((yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z); - tSetColumnType (&yylhsminor.yy290, &yymsp[-1].minor.yy0); + tSetColumnType (&yylhsminor.yy100, &yymsp[-1].minor.yy0); } - yymsp[-1].minor.yy290 = yylhsminor.yy290; + yymsp[-1].minor.yy100 = yylhsminor.yy100; break; case 129: /* signed ::= INTEGER */ -{ yylhsminor.yy459 = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[0].minor.yy459 = yylhsminor.yy459; +{ yylhsminor.yy325 = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[0].minor.yy325 = yylhsminor.yy325; break; case 130: /* signed ::= PLUS INTEGER */ -{ yymsp[-1].minor.yy459 = strtol(yymsp[0].minor.yy0.z, NULL, 10); } +{ yymsp[-1].minor.yy325 = strtol(yymsp[0].minor.yy0.z, NULL, 10); } break; case 131: /* signed ::= MINUS INTEGER */ -{ yymsp[-1].minor.yy459 = -strtol(yymsp[0].minor.yy0.z, NULL, 10);} +{ yymsp[-1].minor.yy325 = -strtol(yymsp[0].minor.yy0.z, NULL, 10);} break; case 135: /* cmd ::= CREATE TABLE create_table_list */ -{ pInfo->type = TSDB_SQL_CREATE_TABLE; pInfo->pCreateTableInfo = yymsp[0].minor.yy272;} +{ pInfo->type = TSDB_SQL_CREATE_TABLE; pInfo->pCreateTableInfo = yymsp[0].minor.yy438;} break; case 136: /* create_table_list ::= create_from_stable */ { SCreateTableSql* pCreateTable = calloc(1, sizeof(SCreateTableSql)); pCreateTable->childTableInfo = taosArrayInit(4, sizeof(SCreatedTableInfo)); - taosArrayPush(pCreateTable->childTableInfo, &yymsp[0].minor.yy96); + taosArrayPush(pCreateTable->childTableInfo, &yymsp[0].minor.yy152); pCreateTable->type = TSQL_CREATE_CTABLE; - yylhsminor.yy272 = pCreateTable; + yylhsminor.yy438 = pCreateTable; } - yymsp[0].minor.yy272 = yylhsminor.yy272; + yymsp[0].minor.yy438 = yylhsminor.yy438; break; case 137: /* create_table_list ::= create_table_list create_from_stable */ { - taosArrayPush(yymsp[-1].minor.yy272->childTableInfo, &yymsp[0].minor.yy96); - yylhsminor.yy272 = yymsp[-1].minor.yy272; + taosArrayPush(yymsp[-1].minor.yy438->childTableInfo, &yymsp[0].minor.yy152); + yylhsminor.yy438 = yymsp[-1].minor.yy438; } - yymsp[-1].minor.yy272 = yylhsminor.yy272; + yymsp[-1].minor.yy438 = yylhsminor.yy438; break; case 138: /* create_table_args ::= ifnotexists ids cpxName LP columnlist RP */ { - yylhsminor.yy272 = tSetCreateTableInfo(yymsp[-1].minor.yy131, NULL, NULL, TSQL_CREATE_TABLE); - setSqlInfo(pInfo, yylhsminor.yy272, NULL, TSDB_SQL_CREATE_TABLE); + yylhsminor.yy438 = tSetCreateTableInfo(yymsp[-1].minor.yy421, NULL, NULL, TSQL_CREATE_TABLE); + setSqlInfo(pInfo, yylhsminor.yy438, NULL, TSDB_SQL_CREATE_TABLE); yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; setCreatedTableName(pInfo, &yymsp[-4].minor.yy0, &yymsp[-5].minor.yy0); } - yymsp[-5].minor.yy272 = yylhsminor.yy272; + yymsp[-5].minor.yy438 = yylhsminor.yy438; break; case 139: /* create_stable_args ::= ifnotexists ids cpxName LP columnlist RP TAGS LP columnlist RP */ { - yylhsminor.yy272 = tSetCreateTableInfo(yymsp[-5].minor.yy131, yymsp[-1].minor.yy131, NULL, TSQL_CREATE_STABLE); - setSqlInfo(pInfo, yylhsminor.yy272, NULL, TSDB_SQL_CREATE_TABLE); + yylhsminor.yy438 = tSetCreateTableInfo(yymsp[-5].minor.yy421, yymsp[-1].minor.yy421, NULL, TSQL_CREATE_STABLE); + setSqlInfo(pInfo, yylhsminor.yy438, NULL, TSDB_SQL_CREATE_TABLE); yymsp[-8].minor.yy0.n += yymsp[-7].minor.yy0.n; setCreatedTableName(pInfo, &yymsp[-8].minor.yy0, &yymsp[-9].minor.yy0); } - yymsp[-9].minor.yy272 = yylhsminor.yy272; + yymsp[-9].minor.yy438 = yylhsminor.yy438; break; - case 140: /* create_from_stable ::= ifnotexists ids cpxName USING ids cpxName TAGS LP tagitemlist RP */ + case 140: /* create_from_stable ::= ifnotexists ids cpxName USING ids cpxName TAGS LP tagitemlist1 RP */ { yymsp[-5].minor.yy0.n += yymsp[-4].minor.yy0.n; yymsp[-8].minor.yy0.n += yymsp[-7].minor.yy0.n; - yylhsminor.yy96 = createNewChildTableInfo(&yymsp[-5].minor.yy0, NULL, yymsp[-1].minor.yy131, &yymsp[-8].minor.yy0, &yymsp[-9].minor.yy0); + yylhsminor.yy152 = createNewChildTableInfo(&yymsp[-5].minor.yy0, NULL, yymsp[-1].minor.yy421, &yymsp[-8].minor.yy0, &yymsp[-9].minor.yy0); } - yymsp[-9].minor.yy96 = yylhsminor.yy96; + yymsp[-9].minor.yy152 = yylhsminor.yy152; break; - case 141: /* create_from_stable ::= ifnotexists ids cpxName USING ids cpxName LP tagNamelist RP TAGS LP tagitemlist RP */ + case 141: /* create_from_stable ::= ifnotexists ids cpxName USING ids cpxName LP tagNamelist RP TAGS LP tagitemlist1 RP */ { yymsp[-8].minor.yy0.n += yymsp[-7].minor.yy0.n; yymsp[-11].minor.yy0.n += yymsp[-10].minor.yy0.n; - yylhsminor.yy96 = createNewChildTableInfo(&yymsp[-8].minor.yy0, yymsp[-5].minor.yy131, yymsp[-1].minor.yy131, &yymsp[-11].minor.yy0, &yymsp[-12].minor.yy0); + yylhsminor.yy152 = createNewChildTableInfo(&yymsp[-8].minor.yy0, yymsp[-5].minor.yy421, yymsp[-1].minor.yy421, &yymsp[-11].minor.yy0, &yymsp[-12].minor.yy0); } - yymsp[-12].minor.yy96 = yylhsminor.yy96; + yymsp[-12].minor.yy152 = yylhsminor.yy152; break; case 142: /* tagNamelist ::= tagNamelist COMMA ids */ -{taosArrayPush(yymsp[-2].minor.yy131, &yymsp[0].minor.yy0); yylhsminor.yy131 = yymsp[-2].minor.yy131; } - yymsp[-2].minor.yy131 = yylhsminor.yy131; +{taosArrayPush(yymsp[-2].minor.yy421, &yymsp[0].minor.yy0); yylhsminor.yy421 = yymsp[-2].minor.yy421; } + yymsp[-2].minor.yy421 = yylhsminor.yy421; break; case 143: /* tagNamelist ::= ids */ -{yylhsminor.yy131 = taosArrayInit(4, sizeof(SToken)); taosArrayPush(yylhsminor.yy131, &yymsp[0].minor.yy0);} - yymsp[0].minor.yy131 = yylhsminor.yy131; +{yylhsminor.yy421 = taosArrayInit(4, sizeof(SToken)); taosArrayPush(yylhsminor.yy421, &yymsp[0].minor.yy0);} + yymsp[0].minor.yy421 = yylhsminor.yy421; break; case 144: /* create_table_args ::= ifnotexists ids cpxName AS select */ { - yylhsminor.yy272 = tSetCreateTableInfo(NULL, NULL, yymsp[0].minor.yy256, TSQL_CREATE_STREAM); - setSqlInfo(pInfo, yylhsminor.yy272, NULL, TSDB_SQL_CREATE_TABLE); + yylhsminor.yy438 = tSetCreateTableInfo(NULL, NULL, yymsp[0].minor.yy56, TSQL_CREATE_STREAM); + setSqlInfo(pInfo, yylhsminor.yy438, NULL, TSDB_SQL_CREATE_TABLE); yymsp[-3].minor.yy0.n += yymsp[-2].minor.yy0.n; setCreatedTableName(pInfo, &yymsp[-3].minor.yy0, &yymsp[-4].minor.yy0); } - yymsp[-4].minor.yy272 = yylhsminor.yy272; + yymsp[-4].minor.yy438 = yylhsminor.yy438; break; case 145: /* columnlist ::= columnlist COMMA column */ -{taosArrayPush(yymsp[-2].minor.yy131, &yymsp[0].minor.yy290); yylhsminor.yy131 = yymsp[-2].minor.yy131; } - yymsp[-2].minor.yy131 = yylhsminor.yy131; +{taosArrayPush(yymsp[-2].minor.yy421, &yymsp[0].minor.yy100); yylhsminor.yy421 = yymsp[-2].minor.yy421; } + yymsp[-2].minor.yy421 = yylhsminor.yy421; break; case 146: /* columnlist ::= column */ -{yylhsminor.yy131 = taosArrayInit(4, sizeof(SField)); taosArrayPush(yylhsminor.yy131, &yymsp[0].minor.yy290);} - yymsp[0].minor.yy131 = yylhsminor.yy131; +{yylhsminor.yy421 = taosArrayInit(4, sizeof(SField)); taosArrayPush(yylhsminor.yy421, &yymsp[0].minor.yy100);} + yymsp[0].minor.yy421 = yylhsminor.yy421; break; case 147: /* column ::= ids typename */ { - tSetColumnInfo(&yylhsminor.yy290, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy290); + tSetColumnInfo(&yylhsminor.yy100, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy100); } - yymsp[-1].minor.yy290 = yylhsminor.yy290; + yymsp[-1].minor.yy100 = yylhsminor.yy100; break; - case 154: /* tagitem ::= NULL */ -{ yymsp[0].minor.yy0.type = 0; taosVariantCreate(&yylhsminor.yy43, yymsp[0].minor.yy0.z, yymsp[0].minor.yy0.n, yymsp[0].minor.yy0.type); } - yymsp[0].minor.yy43 = yylhsminor.yy43; + case 148: /* tagitemlist1 ::= tagitemlist1 COMMA tagitem1 */ +{ taosArrayPush(yymsp[-2].minor.yy421, &yymsp[0].minor.yy0); yylhsminor.yy421 = yymsp[-2].minor.yy421;} + yymsp[-2].minor.yy421 = yylhsminor.yy421; break; - case 155: /* tagitem ::= NOW */ -{ yymsp[0].minor.yy0.type = TSDB_DATA_TYPE_TIMESTAMP; taosVariantCreate(&yylhsminor.yy43, yymsp[0].minor.yy0.z, yymsp[0].minor.yy0.n, yymsp[0].minor.yy0.type);} - yymsp[0].minor.yy43 = yylhsminor.yy43; + case 149: /* tagitemlist1 ::= tagitem1 */ +{ yylhsminor.yy421 = taosArrayInit(4, sizeof(SToken)); taosArrayPush(yylhsminor.yy421, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy421 = yylhsminor.yy421; break; - case 156: /* tagitem ::= MINUS INTEGER */ - case 157: /* tagitem ::= MINUS FLOAT */ yytestcase(yyruleno==157); - case 158: /* tagitem ::= PLUS INTEGER */ yytestcase(yyruleno==158); - case 159: /* tagitem ::= PLUS FLOAT */ yytestcase(yyruleno==159); + case 150: /* tagitem1 ::= MINUS INTEGER */ +{ yylhsminor.yy0.n = yymsp[-1].minor.yy0.n + yymsp[0].minor.yy0.n; yylhsminor.yy0.type = yymsp[0].minor.yy0.type; } + yymsp[-1].minor.yy0 = yylhsminor.yy0; + break; + case 157: /* tagitem ::= NULL */ +{ yymsp[0].minor.yy0.type = 0; taosVariantCreate(&yylhsminor.yy69, yymsp[0].minor.yy0.z, yymsp[0].minor.yy0.n, yymsp[0].minor.yy0.type); } + yymsp[0].minor.yy69 = yylhsminor.yy69; + break; + case 158: /* tagitem ::= NOW */ +{ yymsp[0].minor.yy0.type = TSDB_DATA_TYPE_TIMESTAMP; taosVariantCreate(&yylhsminor.yy69, yymsp[0].minor.yy0.z, yymsp[0].minor.yy0.n, yymsp[0].minor.yy0.type);} + yymsp[0].minor.yy69 = yylhsminor.yy69; + break; + case 159: /* tagitem ::= MINUS INTEGER */ + case 160: /* tagitem ::= MINUS FLOAT */ yytestcase(yyruleno==160); + case 161: /* tagitem ::= PLUS INTEGER */ yytestcase(yyruleno==161); + case 162: /* tagitem ::= PLUS FLOAT */ yytestcase(yyruleno==162); { 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); - taosVariantCreate(&yylhsminor.yy43, yymsp[-1].minor.yy0.z, yymsp[-1].minor.yy0.n, yymsp[-1].minor.yy0.type); + taosVariantCreate(&yylhsminor.yy69, yymsp[-1].minor.yy0.z, yymsp[-1].minor.yy0.n, yymsp[-1].minor.yy0.type); } - yymsp[-1].minor.yy43 = yylhsminor.yy43; + yymsp[-1].minor.yy69 = yylhsminor.yy69; break; - case 160: /* select ::= SELECT selcollist from where_opt interval_option sliding_opt session_option windowstate_option fill_opt groupby_opt having_opt orderby_opt slimit_opt limit_opt */ + case 163: /* select ::= SELECT selcollist from where_opt interval_option sliding_opt session_option windowstate_option fill_opt groupby_opt having_opt orderby_opt slimit_opt limit_opt */ { - yylhsminor.yy256 = tSetQuerySqlNode(&yymsp[-13].minor.yy0, yymsp[-12].minor.yy131, yymsp[-11].minor.yy544, yymsp[-10].minor.yy46, yymsp[-4].minor.yy131, yymsp[-2].minor.yy131, &yymsp[-9].minor.yy530, &yymsp[-7].minor.yy39, &yymsp[-6].minor.yy538, &yymsp[-8].minor.yy0, yymsp[-5].minor.yy131, &yymsp[0].minor.yy55, &yymsp[-1].minor.yy55, yymsp[-3].minor.yy46); + yylhsminor.yy56 = tSetQuerySqlNode(&yymsp[-13].minor.yy0, yymsp[-12].minor.yy421, yymsp[-11].minor.yy8, yymsp[-10].minor.yy439, yymsp[-4].minor.yy421, yymsp[-2].minor.yy421, &yymsp[-9].minor.yy400, &yymsp[-7].minor.yy147, &yymsp[-6].minor.yy40, &yymsp[-8].minor.yy0, yymsp[-5].minor.yy421, &yymsp[0].minor.yy231, &yymsp[-1].minor.yy231, yymsp[-3].minor.yy439); } - yymsp[-13].minor.yy256 = yylhsminor.yy256; + yymsp[-13].minor.yy56 = yylhsminor.yy56; break; - case 161: /* select ::= LP select RP */ -{yymsp[-2].minor.yy256 = yymsp[-1].minor.yy256;} + case 164: /* select ::= LP select RP */ +{yymsp[-2].minor.yy56 = yymsp[-1].minor.yy56;} break; - case 162: /* union ::= select */ -{ yylhsminor.yy303 = setSubclause(NULL, yymsp[0].minor.yy256); } - yymsp[0].minor.yy303 = yylhsminor.yy303; + case 165: /* union ::= select */ +{ yylhsminor.yy149 = setSubclause(NULL, yymsp[0].minor.yy56); } + yymsp[0].minor.yy149 = yylhsminor.yy149; break; - case 163: /* union ::= union UNION ALL select */ -{ yylhsminor.yy303 = appendSelectClause(yymsp[-3].minor.yy303, SQL_TYPE_UNIONALL, yymsp[0].minor.yy256); } - yymsp[-3].minor.yy303 = yylhsminor.yy303; + case 166: /* union ::= union UNION ALL select */ +{ yylhsminor.yy149 = appendSelectClause(yymsp[-3].minor.yy149, SQL_TYPE_UNIONALL, yymsp[0].minor.yy56); } + yymsp[-3].minor.yy149 = yylhsminor.yy149; break; - case 164: /* union ::= union UNION select */ -{ yylhsminor.yy303 = appendSelectClause(yymsp[-2].minor.yy303, SQL_TYPE_UNION, yymsp[0].minor.yy256); } - yymsp[-2].minor.yy303 = yylhsminor.yy303; + case 167: /* union ::= union UNION select */ +{ yylhsminor.yy149 = appendSelectClause(yymsp[-2].minor.yy149, SQL_TYPE_UNION, yymsp[0].minor.yy56); } + yymsp[-2].minor.yy149 = yylhsminor.yy149; break; - case 165: /* cmd ::= union */ -{ setSqlInfo(pInfo, yymsp[0].minor.yy303, NULL, TSDB_SQL_SELECT); } + case 168: /* cmd ::= union */ +{ setSqlInfo(pInfo, yymsp[0].minor.yy149, NULL, TSDB_SQL_SELECT); } break; - case 166: /* select ::= SELECT selcollist */ + case 169: /* select ::= SELECT selcollist */ { - yylhsminor.yy256 = tSetQuerySqlNode(&yymsp[-1].minor.yy0, yymsp[0].minor.yy131, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + yylhsminor.yy56 = tSetQuerySqlNode(&yymsp[-1].minor.yy0, yymsp[0].minor.yy421, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); } - yymsp[-1].minor.yy256 = yylhsminor.yy256; + yymsp[-1].minor.yy56 = yylhsminor.yy56; break; - case 167: /* sclp ::= selcollist COMMA */ -{yylhsminor.yy131 = yymsp[-1].minor.yy131;} - yymsp[-1].minor.yy131 = yylhsminor.yy131; + case 170: /* sclp ::= selcollist COMMA */ +{yylhsminor.yy421 = yymsp[-1].minor.yy421;} + yymsp[-1].minor.yy421 = yylhsminor.yy421; break; - case 168: /* sclp ::= */ - case 200: /* orderby_opt ::= */ yytestcase(yyruleno==200); -{yymsp[1].minor.yy131 = 0;} + case 171: /* sclp ::= */ + case 203: /* orderby_opt ::= */ yytestcase(yyruleno==203); +{yymsp[1].minor.yy421 = 0;} break; - case 169: /* selcollist ::= sclp distinct expr as */ + case 172: /* selcollist ::= sclp distinct expr as */ { - yylhsminor.yy131 = tSqlExprListAppend(yymsp[-3].minor.yy131, yymsp[-1].minor.yy46, yymsp[-2].minor.yy0.n? &yymsp[-2].minor.yy0:0, yymsp[0].minor.yy0.n?&yymsp[0].minor.yy0:0); + yylhsminor.yy421 = tSqlExprListAppend(yymsp[-3].minor.yy421, yymsp[-1].minor.yy439, yymsp[-2].minor.yy0.n? &yymsp[-2].minor.yy0:0, yymsp[0].minor.yy0.n?&yymsp[0].minor.yy0:0); } - yymsp[-3].minor.yy131 = yylhsminor.yy131; + yymsp[-3].minor.yy421 = yylhsminor.yy421; break; - case 170: /* selcollist ::= sclp STAR */ + case 173: /* selcollist ::= sclp STAR */ { tSqlExpr *pNode = tSqlExprCreateIdValue(NULL, TK_ALL); - yylhsminor.yy131 = tSqlExprListAppend(yymsp[-1].minor.yy131, pNode, 0, 0); + yylhsminor.yy421 = tSqlExprListAppend(yymsp[-1].minor.yy421, pNode, 0, 0); } - yymsp[-1].minor.yy131 = yylhsminor.yy131; + yymsp[-1].minor.yy421 = yylhsminor.yy421; break; - case 171: /* as ::= AS ids */ + case 174: /* as ::= AS ids */ { yymsp[-1].minor.yy0 = yymsp[0].minor.yy0; } break; - case 172: /* as ::= ids */ + case 175: /* as ::= ids */ { yylhsminor.yy0 = yymsp[0].minor.yy0; } yymsp[0].minor.yy0 = yylhsminor.yy0; break; - case 173: /* as ::= */ + case 176: /* as ::= */ { yymsp[1].minor.yy0.n = 0; } break; - case 174: /* distinct ::= DISTINCT */ + case 177: /* distinct ::= DISTINCT */ { yylhsminor.yy0 = yymsp[0].minor.yy0; } yymsp[0].minor.yy0 = yylhsminor.yy0; break; - case 176: /* from ::= FROM tablelist */ - case 177: /* from ::= FROM sub */ yytestcase(yyruleno==177); -{yymsp[-1].minor.yy544 = yymsp[0].minor.yy544;} + case 179: /* from ::= FROM tablelist */ + case 180: /* from ::= FROM sub */ yytestcase(yyruleno==180); +{yymsp[-1].minor.yy8 = yymsp[0].minor.yy8;} break; - case 178: /* sub ::= LP union RP */ -{yymsp[-2].minor.yy544 = addSubquery(NULL, yymsp[-1].minor.yy303, NULL);} + case 181: /* sub ::= LP union RP */ +{yymsp[-2].minor.yy8 = addSubquery(NULL, yymsp[-1].minor.yy149, NULL);} break; - case 179: /* sub ::= LP union RP ids */ -{yymsp[-3].minor.yy544 = addSubquery(NULL, yymsp[-2].minor.yy303, &yymsp[0].minor.yy0);} + case 182: /* sub ::= LP union RP ids */ +{yymsp[-3].minor.yy8 = addSubquery(NULL, yymsp[-2].minor.yy149, &yymsp[0].minor.yy0);} break; - case 180: /* sub ::= sub COMMA LP union RP ids */ -{yylhsminor.yy544 = addSubquery(yymsp[-5].minor.yy544, yymsp[-2].minor.yy303, &yymsp[0].minor.yy0);} - yymsp[-5].minor.yy544 = yylhsminor.yy544; + case 183: /* sub ::= sub COMMA LP union RP ids */ +{yylhsminor.yy8 = addSubquery(yymsp[-5].minor.yy8, yymsp[-2].minor.yy149, &yymsp[0].minor.yy0);} + yymsp[-5].minor.yy8 = yylhsminor.yy8; break; - case 181: /* tablelist ::= ids cpxName */ + case 184: /* tablelist ::= ids cpxName */ { yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; - yylhsminor.yy544 = setTableNameList(NULL, &yymsp[-1].minor.yy0, NULL); + yylhsminor.yy8 = setTableNameList(NULL, &yymsp[-1].minor.yy0, NULL); } - yymsp[-1].minor.yy544 = yylhsminor.yy544; + yymsp[-1].minor.yy8 = yylhsminor.yy8; break; - case 182: /* tablelist ::= ids cpxName ids */ + case 185: /* tablelist ::= ids cpxName ids */ { yymsp[-2].minor.yy0.n += yymsp[-1].minor.yy0.n; - yylhsminor.yy544 = setTableNameList(NULL, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); + yylhsminor.yy8 = setTableNameList(NULL, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy544 = yylhsminor.yy544; + yymsp[-2].minor.yy8 = yylhsminor.yy8; break; - case 183: /* tablelist ::= tablelist COMMA ids cpxName */ + case 186: /* tablelist ::= tablelist COMMA ids cpxName */ { yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; - yylhsminor.yy544 = setTableNameList(yymsp[-3].minor.yy544, &yymsp[-1].minor.yy0, NULL); + yylhsminor.yy8 = setTableNameList(yymsp[-3].minor.yy8, &yymsp[-1].minor.yy0, NULL); } - yymsp[-3].minor.yy544 = yylhsminor.yy544; + yymsp[-3].minor.yy8 = yylhsminor.yy8; break; - case 184: /* tablelist ::= tablelist COMMA ids cpxName ids */ + case 187: /* tablelist ::= tablelist COMMA ids cpxName ids */ { yymsp[-2].minor.yy0.n += yymsp[-1].minor.yy0.n; - yylhsminor.yy544 = setTableNameList(yymsp[-4].minor.yy544, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); + yylhsminor.yy8 = setTableNameList(yymsp[-4].minor.yy8, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } - yymsp[-4].minor.yy544 = yylhsminor.yy544; + yymsp[-4].minor.yy8 = yylhsminor.yy8; break; - case 185: /* tmvar ::= VARIABLE */ + case 188: /* tmvar ::= VARIABLE */ {yylhsminor.yy0 = yymsp[0].minor.yy0;} yymsp[0].minor.yy0 = yylhsminor.yy0; break; - case 186: /* interval_option ::= intervalKey LP tmvar RP */ -{yylhsminor.yy530.interval = yymsp[-1].minor.yy0; yylhsminor.yy530.offset.n = 0; yylhsminor.yy530.token = yymsp[-3].minor.yy310;} - yymsp[-3].minor.yy530 = yylhsminor.yy530; + case 189: /* interval_option ::= intervalKey LP tmvar RP */ +{yylhsminor.yy400.interval = yymsp[-1].minor.yy0; yylhsminor.yy400.offset.n = 0; yylhsminor.yy400.token = yymsp[-3].minor.yy104;} + yymsp[-3].minor.yy400 = yylhsminor.yy400; break; - case 187: /* interval_option ::= intervalKey LP tmvar COMMA tmvar RP */ -{yylhsminor.yy530.interval = yymsp[-3].minor.yy0; yylhsminor.yy530.offset = yymsp[-1].minor.yy0; yylhsminor.yy530.token = yymsp[-5].minor.yy310;} - yymsp[-5].minor.yy530 = yylhsminor.yy530; + case 190: /* interval_option ::= intervalKey LP tmvar COMMA tmvar RP */ +{yylhsminor.yy400.interval = yymsp[-3].minor.yy0; yylhsminor.yy400.offset = yymsp[-1].minor.yy0; yylhsminor.yy400.token = yymsp[-5].minor.yy104;} + yymsp[-5].minor.yy400 = yylhsminor.yy400; break; - case 188: /* interval_option ::= */ -{memset(&yymsp[1].minor.yy530, 0, sizeof(yymsp[1].minor.yy530));} + case 191: /* interval_option ::= */ +{memset(&yymsp[1].minor.yy400, 0, sizeof(yymsp[1].minor.yy400));} break; - case 189: /* intervalKey ::= INTERVAL */ -{yymsp[0].minor.yy310 = TK_INTERVAL;} + case 192: /* intervalKey ::= INTERVAL */ +{yymsp[0].minor.yy104 = TK_INTERVAL;} break; - case 190: /* intervalKey ::= EVERY */ -{yymsp[0].minor.yy310 = TK_EVERY; } + case 193: /* intervalKey ::= EVERY */ +{yymsp[0].minor.yy104 = TK_EVERY; } break; - case 191: /* session_option ::= */ -{yymsp[1].minor.yy39.col.n = 0; yymsp[1].minor.yy39.gap.n = 0;} + case 194: /* session_option ::= */ +{yymsp[1].minor.yy147.col.n = 0; yymsp[1].minor.yy147.gap.n = 0;} break; - case 192: /* session_option ::= SESSION LP ids cpxName COMMA tmvar RP */ + case 195: /* session_option ::= SESSION LP ids cpxName COMMA tmvar RP */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; - yymsp[-6].minor.yy39.col = yymsp[-4].minor.yy0; - yymsp[-6].minor.yy39.gap = yymsp[-1].minor.yy0; + yymsp[-6].minor.yy147.col = yymsp[-4].minor.yy0; + yymsp[-6].minor.yy147.gap = yymsp[-1].minor.yy0; } break; - case 193: /* windowstate_option ::= */ -{ yymsp[1].minor.yy538.col.n = 0; yymsp[1].minor.yy538.col.z = NULL;} + case 196: /* windowstate_option ::= */ +{ yymsp[1].minor.yy40.col.n = 0; yymsp[1].minor.yy40.col.z = NULL;} break; - case 194: /* windowstate_option ::= STATE_WINDOW LP ids RP */ -{ yymsp[-3].minor.yy538.col = yymsp[-1].minor.yy0; } + case 197: /* windowstate_option ::= STATE_WINDOW LP ids RP */ +{ yymsp[-3].minor.yy40.col = yymsp[-1].minor.yy0; } break; - case 195: /* fill_opt ::= */ -{ yymsp[1].minor.yy131 = 0; } + case 198: /* fill_opt ::= */ +{ yymsp[1].minor.yy421 = 0; } break; - case 196: /* fill_opt ::= FILL LP ID COMMA tagitemlist RP */ + case 199: /* fill_opt ::= FILL LP ID COMMA tagitemlist RP */ { SVariant A = {0}; toTSDBType(yymsp[-3].minor.yy0.type); taosVariantCreate(&A, yymsp[-3].minor.yy0.z, yymsp[-3].minor.yy0.n, yymsp[-3].minor.yy0.type); - tListItemInsert(yymsp[-1].minor.yy131, &A, -1, 0); - yymsp[-5].minor.yy131 = yymsp[-1].minor.yy131; + tListItemInsert(yymsp[-1].minor.yy421, &A, -1, 0); + yymsp[-5].minor.yy421 = yymsp[-1].minor.yy421; } break; - case 197: /* fill_opt ::= FILL LP ID RP */ + case 200: /* fill_opt ::= FILL LP ID RP */ { toTSDBType(yymsp[-1].minor.yy0.type); - yymsp[-3].minor.yy131 = tListItemAppendToken(NULL, &yymsp[-1].minor.yy0, -1); + yymsp[-3].minor.yy421 = tListItemAppendToken(NULL, &yymsp[-1].minor.yy0, -1); } break; - case 198: /* sliding_opt ::= SLIDING LP tmvar RP */ + case 201: /* sliding_opt ::= SLIDING LP tmvar RP */ {yymsp[-3].minor.yy0 = yymsp[-1].minor.yy0; } break; - case 199: /* sliding_opt ::= */ + case 202: /* sliding_opt ::= */ {yymsp[1].minor.yy0.n = 0; yymsp[1].minor.yy0.z = NULL; yymsp[1].minor.yy0.type = 0; } break; - case 201: /* orderby_opt ::= ORDER BY sortlist */ -{yymsp[-2].minor.yy131 = yymsp[0].minor.yy131;} + case 204: /* orderby_opt ::= ORDER BY sortlist */ +{yymsp[-2].minor.yy421 = yymsp[0].minor.yy421;} break; - case 202: /* sortlist ::= sortlist COMMA item sortorder */ + case 205: /* sortlist ::= sortlist COMMA item sortorder */ { - yylhsminor.yy131 = tListItemAppend(yymsp[-3].minor.yy131, &yymsp[-1].minor.yy43, yymsp[0].minor.yy44); + yylhsminor.yy421 = tListItemAppend(yymsp[-3].minor.yy421, &yymsp[-1].minor.yy69, yymsp[0].minor.yy96); } - yymsp[-3].minor.yy131 = yylhsminor.yy131; + yymsp[-3].minor.yy421 = yylhsminor.yy421; break; - case 203: /* sortlist ::= item sortorder */ + case 206: /* sortlist ::= item sortorder */ { - yylhsminor.yy131 = tListItemAppend(NULL, &yymsp[-1].minor.yy43, yymsp[0].minor.yy44); + yylhsminor.yy421 = tListItemAppend(NULL, &yymsp[-1].minor.yy69, yymsp[0].minor.yy96); } - yymsp[-1].minor.yy131 = yylhsminor.yy131; + yymsp[-1].minor.yy421 = yylhsminor.yy421; break; - case 204: /* item ::= ids cpxName */ + case 207: /* item ::= ids cpxName */ { toTSDBType(yymsp[-1].minor.yy0.type); yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; - taosVariantCreate(&yylhsminor.yy43, yymsp[-1].minor.yy0.z, yymsp[-1].minor.yy0.n, yymsp[-1].minor.yy0.type); + taosVariantCreate(&yylhsminor.yy69, yymsp[-1].minor.yy0.z, yymsp[-1].minor.yy0.n, yymsp[-1].minor.yy0.type); } - yymsp[-1].minor.yy43 = yylhsminor.yy43; + yymsp[-1].minor.yy69 = yylhsminor.yy69; break; - case 205: /* sortorder ::= ASC */ -{ yymsp[0].minor.yy44 = TSDB_ORDER_ASC; } + case 208: /* sortorder ::= ASC */ +{ yymsp[0].minor.yy96 = TSDB_ORDER_ASC; } break; - case 206: /* sortorder ::= DESC */ -{ yymsp[0].minor.yy44 = TSDB_ORDER_DESC;} + case 209: /* sortorder ::= DESC */ +{ yymsp[0].minor.yy96 = TSDB_ORDER_DESC;} break; - case 207: /* sortorder ::= */ -{ yymsp[1].minor.yy44 = TSDB_ORDER_ASC; } + case 210: /* sortorder ::= */ +{ yymsp[1].minor.yy96 = TSDB_ORDER_ASC; } break; - case 208: /* groupby_opt ::= */ -{ yymsp[1].minor.yy131 = 0;} + case 211: /* groupby_opt ::= */ +{ yymsp[1].minor.yy421 = 0;} break; - case 209: /* groupby_opt ::= GROUP BY grouplist */ -{ yymsp[-2].minor.yy131 = yymsp[0].minor.yy131;} + case 212: /* groupby_opt ::= GROUP BY grouplist */ +{ yymsp[-2].minor.yy421 = yymsp[0].minor.yy421;} break; - case 210: /* grouplist ::= grouplist COMMA item */ + case 213: /* grouplist ::= grouplist COMMA item */ { - yylhsminor.yy131 = tListItemAppend(yymsp[-2].minor.yy131, &yymsp[0].minor.yy43, -1); + yylhsminor.yy421 = tListItemAppend(yymsp[-2].minor.yy421, &yymsp[0].minor.yy69, -1); } - yymsp[-2].minor.yy131 = yylhsminor.yy131; + yymsp[-2].minor.yy421 = yylhsminor.yy421; break; - case 211: /* grouplist ::= item */ + case 214: /* grouplist ::= item */ { - yylhsminor.yy131 = tListItemAppend(NULL, &yymsp[0].minor.yy43, -1); + yylhsminor.yy421 = tListItemAppend(NULL, &yymsp[0].minor.yy69, -1); } - yymsp[0].minor.yy131 = yylhsminor.yy131; + yymsp[0].minor.yy421 = yylhsminor.yy421; break; - case 212: /* having_opt ::= */ - case 222: /* where_opt ::= */ yytestcase(yyruleno==222); - case 266: /* expritem ::= */ yytestcase(yyruleno==266); -{yymsp[1].minor.yy46 = 0;} + case 215: /* having_opt ::= */ + case 225: /* where_opt ::= */ yytestcase(yyruleno==225); + case 269: /* expritem ::= */ yytestcase(yyruleno==269); +{yymsp[1].minor.yy439 = 0;} break; - case 213: /* having_opt ::= HAVING expr */ - case 223: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==223); -{yymsp[-1].minor.yy46 = yymsp[0].minor.yy46;} + case 216: /* having_opt ::= HAVING expr */ + case 226: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==226); +{yymsp[-1].minor.yy439 = yymsp[0].minor.yy439;} break; - case 214: /* limit_opt ::= */ - case 218: /* slimit_opt ::= */ yytestcase(yyruleno==218); -{yymsp[1].minor.yy55.limit = -1; yymsp[1].minor.yy55.offset = 0;} + case 217: /* limit_opt ::= */ + case 221: /* slimit_opt ::= */ yytestcase(yyruleno==221); +{yymsp[1].minor.yy231.limit = -1; yymsp[1].minor.yy231.offset = 0;} break; - case 215: /* limit_opt ::= LIMIT signed */ - case 219: /* slimit_opt ::= SLIMIT signed */ yytestcase(yyruleno==219); -{yymsp[-1].minor.yy55.limit = yymsp[0].minor.yy459; yymsp[-1].minor.yy55.offset = 0;} + case 218: /* limit_opt ::= LIMIT signed */ + case 222: /* slimit_opt ::= SLIMIT signed */ yytestcase(yyruleno==222); +{yymsp[-1].minor.yy231.limit = yymsp[0].minor.yy325; yymsp[-1].minor.yy231.offset = 0;} break; - case 216: /* limit_opt ::= LIMIT signed OFFSET signed */ -{ yymsp[-3].minor.yy55.limit = yymsp[-2].minor.yy459; yymsp[-3].minor.yy55.offset = yymsp[0].minor.yy459;} + case 219: /* limit_opt ::= LIMIT signed OFFSET signed */ +{ yymsp[-3].minor.yy231.limit = yymsp[-2].minor.yy325; yymsp[-3].minor.yy231.offset = yymsp[0].minor.yy325;} break; - case 217: /* limit_opt ::= LIMIT signed COMMA signed */ -{ yymsp[-3].minor.yy55.limit = yymsp[0].minor.yy459; yymsp[-3].minor.yy55.offset = yymsp[-2].minor.yy459;} + case 220: /* limit_opt ::= LIMIT signed COMMA signed */ +{ yymsp[-3].minor.yy231.limit = yymsp[0].minor.yy325; yymsp[-3].minor.yy231.offset = yymsp[-2].minor.yy325;} break; - case 220: /* slimit_opt ::= SLIMIT signed SOFFSET signed */ -{yymsp[-3].minor.yy55.limit = yymsp[-2].minor.yy459; yymsp[-3].minor.yy55.offset = yymsp[0].minor.yy459;} + case 223: /* slimit_opt ::= SLIMIT signed SOFFSET signed */ +{yymsp[-3].minor.yy231.limit = yymsp[-2].minor.yy325; yymsp[-3].minor.yy231.offset = yymsp[0].minor.yy325;} break; - case 221: /* slimit_opt ::= SLIMIT signed COMMA signed */ -{yymsp[-3].minor.yy55.limit = yymsp[0].minor.yy459; yymsp[-3].minor.yy55.offset = yymsp[-2].minor.yy459;} + case 224: /* slimit_opt ::= SLIMIT signed COMMA signed */ +{yymsp[-3].minor.yy231.limit = yymsp[0].minor.yy325; yymsp[-3].minor.yy231.offset = yymsp[-2].minor.yy325;} break; - case 224: /* expr ::= LP expr RP */ -{yylhsminor.yy46 = yymsp[-1].minor.yy46; yylhsminor.yy46->exprToken.z = yymsp[-2].minor.yy0.z; yylhsminor.yy46->exprToken.n = (yymsp[0].minor.yy0.z - yymsp[-2].minor.yy0.z + 1);} - yymsp[-2].minor.yy46 = yylhsminor.yy46; + case 227: /* expr ::= LP expr RP */ +{yylhsminor.yy439 = yymsp[-1].minor.yy439; yylhsminor.yy439->exprToken.z = yymsp[-2].minor.yy0.z; yylhsminor.yy439->exprToken.n = (yymsp[0].minor.yy0.z - yymsp[-2].minor.yy0.z + 1);} + yymsp[-2].minor.yy439 = yylhsminor.yy439; break; - case 225: /* expr ::= ID */ -{ yylhsminor.yy46 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_ID);} - yymsp[0].minor.yy46 = yylhsminor.yy46; + case 228: /* expr ::= ID */ +{ yylhsminor.yy439 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_ID);} + yymsp[0].minor.yy439 = yylhsminor.yy439; break; - case 226: /* expr ::= ID DOT ID */ -{ yymsp[-2].minor.yy0.n += (1+yymsp[0].minor.yy0.n); yylhsminor.yy46 = tSqlExprCreateIdValue(&yymsp[-2].minor.yy0, TK_ID);} - yymsp[-2].minor.yy46 = yylhsminor.yy46; + case 229: /* expr ::= ID DOT ID */ +{ yymsp[-2].minor.yy0.n += (1+yymsp[0].minor.yy0.n); yylhsminor.yy439 = tSqlExprCreateIdValue(&yymsp[-2].minor.yy0, TK_ID);} + yymsp[-2].minor.yy439 = yylhsminor.yy439; break; - case 227: /* expr ::= ID DOT STAR */ -{ yymsp[-2].minor.yy0.n += (1+yymsp[0].minor.yy0.n); yylhsminor.yy46 = tSqlExprCreateIdValue(&yymsp[-2].minor.yy0, TK_ALL);} - yymsp[-2].minor.yy46 = yylhsminor.yy46; + case 230: /* expr ::= ID DOT STAR */ +{ yymsp[-2].minor.yy0.n += (1+yymsp[0].minor.yy0.n); yylhsminor.yy439 = tSqlExprCreateIdValue(&yymsp[-2].minor.yy0, TK_ALL);} + yymsp[-2].minor.yy439 = yylhsminor.yy439; break; - case 228: /* expr ::= INTEGER */ -{ yylhsminor.yy46 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_INTEGER);} - yymsp[0].minor.yy46 = yylhsminor.yy46; + case 231: /* expr ::= INTEGER */ +{ yylhsminor.yy439 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_INTEGER);} + yymsp[0].minor.yy439 = yylhsminor.yy439; break; - case 229: /* expr ::= MINUS INTEGER */ - case 230: /* expr ::= PLUS INTEGER */ yytestcase(yyruleno==230); -{ yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_INTEGER; yylhsminor.yy46 = tSqlExprCreateIdValue(&yymsp[-1].minor.yy0, TK_INTEGER);} - yymsp[-1].minor.yy46 = yylhsminor.yy46; + case 232: /* expr ::= MINUS INTEGER */ + case 233: /* expr ::= PLUS INTEGER */ yytestcase(yyruleno==233); +{ yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_INTEGER; yylhsminor.yy439 = tSqlExprCreateIdValue(&yymsp[-1].minor.yy0, TK_INTEGER);} + yymsp[-1].minor.yy439 = yylhsminor.yy439; break; - case 231: /* expr ::= FLOAT */ -{ yylhsminor.yy46 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_FLOAT);} - yymsp[0].minor.yy46 = yylhsminor.yy46; + case 234: /* expr ::= FLOAT */ +{ yylhsminor.yy439 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_FLOAT);} + yymsp[0].minor.yy439 = yylhsminor.yy439; break; - case 232: /* expr ::= MINUS FLOAT */ - case 233: /* expr ::= PLUS FLOAT */ yytestcase(yyruleno==233); -{ yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_FLOAT; yylhsminor.yy46 = tSqlExprCreateIdValue(&yymsp[-1].minor.yy0, TK_FLOAT);} - yymsp[-1].minor.yy46 = yylhsminor.yy46; + case 235: /* expr ::= MINUS FLOAT */ + case 236: /* expr ::= PLUS FLOAT */ yytestcase(yyruleno==236); +{ yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_FLOAT; yylhsminor.yy439 = tSqlExprCreateIdValue(&yymsp[-1].minor.yy0, TK_FLOAT);} + yymsp[-1].minor.yy439 = yylhsminor.yy439; break; - case 234: /* expr ::= STRING */ -{ yylhsminor.yy46 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_STRING);} - yymsp[0].minor.yy46 = yylhsminor.yy46; + case 237: /* expr ::= STRING */ +{ yylhsminor.yy439 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_STRING);} + yymsp[0].minor.yy439 = yylhsminor.yy439; break; - case 235: /* expr ::= NOW */ -{ yylhsminor.yy46 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_NOW); } - yymsp[0].minor.yy46 = yylhsminor.yy46; + case 238: /* expr ::= NOW */ +{ yylhsminor.yy439 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_NOW); } + yymsp[0].minor.yy439 = yylhsminor.yy439; break; - case 236: /* expr ::= VARIABLE */ -{ yylhsminor.yy46 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_VARIABLE);} - yymsp[0].minor.yy46 = yylhsminor.yy46; + case 239: /* expr ::= VARIABLE */ +{ yylhsminor.yy439 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_VARIABLE);} + yymsp[0].minor.yy439 = yylhsminor.yy439; break; - case 237: /* expr ::= PLUS VARIABLE */ - case 238: /* expr ::= MINUS VARIABLE */ yytestcase(yyruleno==238); -{ yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_VARIABLE; yylhsminor.yy46 = tSqlExprCreateIdValue(&yymsp[-1].minor.yy0, TK_VARIABLE);} - yymsp[-1].minor.yy46 = yylhsminor.yy46; + case 240: /* expr ::= PLUS VARIABLE */ + case 241: /* expr ::= MINUS VARIABLE */ yytestcase(yyruleno==241); +{ yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_VARIABLE; yylhsminor.yy439 = tSqlExprCreateIdValue(&yymsp[-1].minor.yy0, TK_VARIABLE);} + yymsp[-1].minor.yy439 = yylhsminor.yy439; break; - case 239: /* expr ::= BOOL */ -{ yylhsminor.yy46 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_BOOL);} - yymsp[0].minor.yy46 = yylhsminor.yy46; + case 242: /* expr ::= BOOL */ +{ yylhsminor.yy439 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_BOOL);} + yymsp[0].minor.yy439 = yylhsminor.yy439; break; - case 240: /* expr ::= NULL */ -{ yylhsminor.yy46 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_NULL);} - yymsp[0].minor.yy46 = yylhsminor.yy46; + case 243: /* expr ::= NULL */ +{ yylhsminor.yy439 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_NULL);} + yymsp[0].minor.yy439 = yylhsminor.yy439; break; - case 241: /* expr ::= ID LP exprlist RP */ -{ tRecordFuncName(pInfo->funcs, &yymsp[-3].minor.yy0); yylhsminor.yy46 = tSqlExprCreateFunction(yymsp[-1].minor.yy131, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type); } - yymsp[-3].minor.yy46 = yylhsminor.yy46; + case 244: /* expr ::= ID LP exprlist RP */ +{ tRecordFuncName(pInfo->funcs, &yymsp[-3].minor.yy0); yylhsminor.yy439 = tSqlExprCreateFunction(yymsp[-1].minor.yy421, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type); } + yymsp[-3].minor.yy439 = yylhsminor.yy439; break; - case 242: /* expr ::= ID LP STAR RP */ -{ tRecordFuncName(pInfo->funcs, &yymsp[-3].minor.yy0); yylhsminor.yy46 = tSqlExprCreateFunction(NULL, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type); } - yymsp[-3].minor.yy46 = yylhsminor.yy46; + case 245: /* expr ::= ID LP STAR RP */ +{ tRecordFuncName(pInfo->funcs, &yymsp[-3].minor.yy0); yylhsminor.yy439 = tSqlExprCreateFunction(NULL, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type); } + yymsp[-3].minor.yy439 = yylhsminor.yy439; break; - case 243: /* expr ::= expr IS NULL */ -{yylhsminor.yy46 = tSqlExprCreate(yymsp[-2].minor.yy46, NULL, TK_ISNULL);} - yymsp[-2].minor.yy46 = yylhsminor.yy46; + case 246: /* expr ::= expr IS NULL */ +{yylhsminor.yy439 = tSqlExprCreate(yymsp[-2].minor.yy439, NULL, TK_ISNULL);} + yymsp[-2].minor.yy439 = yylhsminor.yy439; break; - case 244: /* expr ::= expr IS NOT NULL */ -{yylhsminor.yy46 = tSqlExprCreate(yymsp[-3].minor.yy46, NULL, TK_NOTNULL);} - yymsp[-3].minor.yy46 = yylhsminor.yy46; + case 247: /* expr ::= expr IS NOT NULL */ +{yylhsminor.yy439 = tSqlExprCreate(yymsp[-3].minor.yy439, NULL, TK_NOTNULL);} + yymsp[-3].minor.yy439 = yylhsminor.yy439; break; - case 245: /* expr ::= expr LT expr */ -{yylhsminor.yy46 = tSqlExprCreate(yymsp[-2].minor.yy46, yymsp[0].minor.yy46, TK_LT);} - yymsp[-2].minor.yy46 = yylhsminor.yy46; + case 248: /* expr ::= expr LT expr */ +{yylhsminor.yy439 = tSqlExprCreate(yymsp[-2].minor.yy439, yymsp[0].minor.yy439, TK_LT);} + yymsp[-2].minor.yy439 = yylhsminor.yy439; break; - case 246: /* expr ::= expr GT expr */ -{yylhsminor.yy46 = tSqlExprCreate(yymsp[-2].minor.yy46, yymsp[0].minor.yy46, TK_GT);} - yymsp[-2].minor.yy46 = yylhsminor.yy46; + case 249: /* expr ::= expr GT expr */ +{yylhsminor.yy439 = tSqlExprCreate(yymsp[-2].minor.yy439, yymsp[0].minor.yy439, TK_GT);} + yymsp[-2].minor.yy439 = yylhsminor.yy439; break; - case 247: /* expr ::= expr LE expr */ -{yylhsminor.yy46 = tSqlExprCreate(yymsp[-2].minor.yy46, yymsp[0].minor.yy46, TK_LE);} - yymsp[-2].minor.yy46 = yylhsminor.yy46; + case 250: /* expr ::= expr LE expr */ +{yylhsminor.yy439 = tSqlExprCreate(yymsp[-2].minor.yy439, yymsp[0].minor.yy439, TK_LE);} + yymsp[-2].minor.yy439 = yylhsminor.yy439; break; - case 248: /* expr ::= expr GE expr */ -{yylhsminor.yy46 = tSqlExprCreate(yymsp[-2].minor.yy46, yymsp[0].minor.yy46, TK_GE);} - yymsp[-2].minor.yy46 = yylhsminor.yy46; + case 251: /* expr ::= expr GE expr */ +{yylhsminor.yy439 = tSqlExprCreate(yymsp[-2].minor.yy439, yymsp[0].minor.yy439, TK_GE);} + yymsp[-2].minor.yy439 = yylhsminor.yy439; break; - case 249: /* expr ::= expr NE expr */ -{yylhsminor.yy46 = tSqlExprCreate(yymsp[-2].minor.yy46, yymsp[0].minor.yy46, TK_NE);} - yymsp[-2].minor.yy46 = yylhsminor.yy46; + case 252: /* expr ::= expr NE expr */ +{yylhsminor.yy439 = tSqlExprCreate(yymsp[-2].minor.yy439, yymsp[0].minor.yy439, TK_NE);} + yymsp[-2].minor.yy439 = yylhsminor.yy439; break; - case 250: /* expr ::= expr EQ expr */ -{yylhsminor.yy46 = tSqlExprCreate(yymsp[-2].minor.yy46, yymsp[0].minor.yy46, TK_EQ);} - yymsp[-2].minor.yy46 = yylhsminor.yy46; + case 253: /* expr ::= expr EQ expr */ +{yylhsminor.yy439 = tSqlExprCreate(yymsp[-2].minor.yy439, yymsp[0].minor.yy439, TK_EQ);} + yymsp[-2].minor.yy439 = yylhsminor.yy439; break; - case 251: /* expr ::= expr BETWEEN expr AND expr */ -{ tSqlExpr* X2 = tSqlExprClone(yymsp[-4].minor.yy46); yylhsminor.yy46 = tSqlExprCreate(tSqlExprCreate(yymsp[-4].minor.yy46, yymsp[-2].minor.yy46, TK_GE), tSqlExprCreate(X2, yymsp[0].minor.yy46, TK_LE), TK_AND);} - yymsp[-4].minor.yy46 = yylhsminor.yy46; + case 254: /* expr ::= expr BETWEEN expr AND expr */ +{ tSqlExpr* X2 = tSqlExprClone(yymsp[-4].minor.yy439); yylhsminor.yy439 = tSqlExprCreate(tSqlExprCreate(yymsp[-4].minor.yy439, yymsp[-2].minor.yy439, TK_GE), tSqlExprCreate(X2, yymsp[0].minor.yy439, TK_LE), TK_AND);} + yymsp[-4].minor.yy439 = yylhsminor.yy439; break; - case 252: /* expr ::= expr AND expr */ -{yylhsminor.yy46 = tSqlExprCreate(yymsp[-2].minor.yy46, yymsp[0].minor.yy46, TK_AND);} - yymsp[-2].minor.yy46 = yylhsminor.yy46; + case 255: /* expr ::= expr AND expr */ +{yylhsminor.yy439 = tSqlExprCreate(yymsp[-2].minor.yy439, yymsp[0].minor.yy439, TK_AND);} + yymsp[-2].minor.yy439 = yylhsminor.yy439; break; - case 253: /* expr ::= expr OR expr */ -{yylhsminor.yy46 = tSqlExprCreate(yymsp[-2].minor.yy46, yymsp[0].minor.yy46, TK_OR); } - yymsp[-2].minor.yy46 = yylhsminor.yy46; + case 256: /* expr ::= expr OR expr */ +{yylhsminor.yy439 = tSqlExprCreate(yymsp[-2].minor.yy439, yymsp[0].minor.yy439, TK_OR); } + yymsp[-2].minor.yy439 = yylhsminor.yy439; break; - case 254: /* expr ::= expr PLUS expr */ -{yylhsminor.yy46 = tSqlExprCreate(yymsp[-2].minor.yy46, yymsp[0].minor.yy46, TK_PLUS); } - yymsp[-2].minor.yy46 = yylhsminor.yy46; + case 257: /* expr ::= expr PLUS expr */ +{yylhsminor.yy439 = tSqlExprCreate(yymsp[-2].minor.yy439, yymsp[0].minor.yy439, TK_PLUS); } + yymsp[-2].minor.yy439 = yylhsminor.yy439; break; - case 255: /* expr ::= expr MINUS expr */ -{yylhsminor.yy46 = tSqlExprCreate(yymsp[-2].minor.yy46, yymsp[0].minor.yy46, TK_MINUS); } - yymsp[-2].minor.yy46 = yylhsminor.yy46; + case 258: /* expr ::= expr MINUS expr */ +{yylhsminor.yy439 = tSqlExprCreate(yymsp[-2].minor.yy439, yymsp[0].minor.yy439, TK_MINUS); } + yymsp[-2].minor.yy439 = yylhsminor.yy439; break; - case 256: /* expr ::= expr STAR expr */ -{yylhsminor.yy46 = tSqlExprCreate(yymsp[-2].minor.yy46, yymsp[0].minor.yy46, TK_STAR); } - yymsp[-2].minor.yy46 = yylhsminor.yy46; + case 259: /* expr ::= expr STAR expr */ +{yylhsminor.yy439 = tSqlExprCreate(yymsp[-2].minor.yy439, yymsp[0].minor.yy439, TK_STAR); } + yymsp[-2].minor.yy439 = yylhsminor.yy439; break; - case 257: /* expr ::= expr SLASH expr */ -{yylhsminor.yy46 = tSqlExprCreate(yymsp[-2].minor.yy46, yymsp[0].minor.yy46, TK_DIVIDE);} - yymsp[-2].minor.yy46 = yylhsminor.yy46; + case 260: /* expr ::= expr SLASH expr */ +{yylhsminor.yy439 = tSqlExprCreate(yymsp[-2].minor.yy439, yymsp[0].minor.yy439, TK_DIVIDE);} + yymsp[-2].minor.yy439 = yylhsminor.yy439; break; - case 258: /* expr ::= expr REM expr */ -{yylhsminor.yy46 = tSqlExprCreate(yymsp[-2].minor.yy46, yymsp[0].minor.yy46, TK_REM); } - yymsp[-2].minor.yy46 = yylhsminor.yy46; + case 261: /* expr ::= expr REM expr */ +{yylhsminor.yy439 = tSqlExprCreate(yymsp[-2].minor.yy439, yymsp[0].minor.yy439, TK_REM); } + yymsp[-2].minor.yy439 = yylhsminor.yy439; break; - case 259: /* expr ::= expr LIKE expr */ -{yylhsminor.yy46 = tSqlExprCreate(yymsp[-2].minor.yy46, yymsp[0].minor.yy46, TK_LIKE); } - yymsp[-2].minor.yy46 = yylhsminor.yy46; + case 262: /* expr ::= expr LIKE expr */ +{yylhsminor.yy439 = tSqlExprCreate(yymsp[-2].minor.yy439, yymsp[0].minor.yy439, TK_LIKE); } + yymsp[-2].minor.yy439 = yylhsminor.yy439; break; - case 260: /* expr ::= expr MATCH expr */ -{yylhsminor.yy46 = tSqlExprCreate(yymsp[-2].minor.yy46, yymsp[0].minor.yy46, TK_MATCH); } - yymsp[-2].minor.yy46 = yylhsminor.yy46; + case 263: /* expr ::= expr MATCH expr */ +{yylhsminor.yy439 = tSqlExprCreate(yymsp[-2].minor.yy439, yymsp[0].minor.yy439, TK_MATCH); } + yymsp[-2].minor.yy439 = yylhsminor.yy439; break; - case 261: /* expr ::= expr NMATCH expr */ -{yylhsminor.yy46 = tSqlExprCreate(yymsp[-2].minor.yy46, yymsp[0].minor.yy46, TK_NMATCH); } - yymsp[-2].minor.yy46 = yylhsminor.yy46; + case 264: /* expr ::= expr NMATCH expr */ +{yylhsminor.yy439 = tSqlExprCreate(yymsp[-2].minor.yy439, yymsp[0].minor.yy439, TK_NMATCH); } + yymsp[-2].minor.yy439 = yylhsminor.yy439; break; - case 262: /* expr ::= expr IN LP exprlist RP */ -{yylhsminor.yy46 = tSqlExprCreate(yymsp[-4].minor.yy46, (tSqlExpr*)yymsp[-1].minor.yy131, TK_IN); } - yymsp[-4].minor.yy46 = yylhsminor.yy46; + case 265: /* expr ::= expr IN LP exprlist RP */ +{yylhsminor.yy439 = tSqlExprCreate(yymsp[-4].minor.yy439, (tSqlExpr*)yymsp[-1].minor.yy421, TK_IN); } + yymsp[-4].minor.yy439 = yylhsminor.yy439; break; - case 263: /* exprlist ::= exprlist COMMA expritem */ -{yylhsminor.yy131 = tSqlExprListAppend(yymsp[-2].minor.yy131,yymsp[0].minor.yy46,0, 0);} - yymsp[-2].minor.yy131 = yylhsminor.yy131; + case 266: /* exprlist ::= exprlist COMMA expritem */ +{yylhsminor.yy421 = tSqlExprListAppend(yymsp[-2].minor.yy421,yymsp[0].minor.yy439,0, 0);} + yymsp[-2].minor.yy421 = yylhsminor.yy421; break; - case 264: /* exprlist ::= expritem */ -{yylhsminor.yy131 = tSqlExprListAppend(0,yymsp[0].minor.yy46,0, 0);} - yymsp[0].minor.yy131 = yylhsminor.yy131; + case 267: /* exprlist ::= expritem */ +{yylhsminor.yy421 = tSqlExprListAppend(0,yymsp[0].minor.yy439,0, 0);} + yymsp[0].minor.yy421 = yylhsminor.yy421; break; - case 265: /* expritem ::= expr */ -{yylhsminor.yy46 = yymsp[0].minor.yy46;} - yymsp[0].minor.yy46 = yylhsminor.yy46; + case 268: /* expritem ::= expr */ +{yylhsminor.yy439 = yymsp[0].minor.yy439;} + yymsp[0].minor.yy439 = yylhsminor.yy439; break; - case 267: /* cmd ::= RESET QUERY CACHE */ + case 270: /* cmd ::= RESET QUERY CACHE */ { setDCLSqlElems(pInfo, TSDB_SQL_RESET_CACHE, 0);} break; - case 268: /* cmd ::= SYNCDB ids REPLICA */ + case 271: /* cmd ::= SYNCDB ids REPLICA */ { setDCLSqlElems(pInfo, TSDB_SQL_SYNC_DB_REPLICA, 1, &yymsp[-1].minor.yy0);} break; - case 269: /* cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */ + case 272: /* cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; - SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy131, NULL, TSDB_ALTER_TABLE_ADD_COLUMN, -1); + SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy421, NULL, TSDB_ALTER_TABLE_ADD_COLUMN, -1); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 270: /* cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */ + case 273: /* cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; toTSDBType(yymsp[0].minor.yy0.type); @@ -3140,21 +3167,21 @@ static void yy_reduce( setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 271: /* cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist */ + case 274: /* cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; - SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy131, NULL, TSDB_ALTER_TABLE_CHANGE_COLUMN, -1); + SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy421, NULL, TSDB_ALTER_TABLE_CHANGE_COLUMN, -1); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 272: /* cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ + case 275: /* cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; - SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy131, NULL, TSDB_ALTER_TABLE_ADD_TAG_COLUMN, -1); + SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy421, NULL, TSDB_ALTER_TABLE_ADD_TAG_COLUMN, -1); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 273: /* cmd ::= ALTER TABLE ids cpxName DROP TAG ids */ + case 276: /* cmd ::= ALTER TABLE ids cpxName DROP TAG ids */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; @@ -3165,7 +3192,7 @@ static void yy_reduce( setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 274: /* cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */ + case 277: /* cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */ { yymsp[-5].minor.yy0.n += yymsp[-4].minor.yy0.n; @@ -3179,33 +3206,33 @@ static void yy_reduce( setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 275: /* cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */ + case 278: /* cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */ { yymsp[-6].minor.yy0.n += yymsp[-5].minor.yy0.n; toTSDBType(yymsp[-2].minor.yy0.type); SArray* A = tListItemAppendToken(NULL, &yymsp[-2].minor.yy0, -1); - A = tListItemAppend(A, &yymsp[0].minor.yy43, -1); + A = tListItemAppend(A, &yymsp[0].minor.yy69, -1); SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-6].minor.yy0, NULL, A, TSDB_ALTER_TABLE_UPDATE_TAG_VAL, -1); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 276: /* cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist */ + case 279: /* cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; - SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy131, NULL, TSDB_ALTER_TABLE_MODIFY_TAG_COLUMN, -1); + SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy421, NULL, TSDB_ALTER_TABLE_MODIFY_TAG_COLUMN, -1); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 277: /* cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */ + case 280: /* cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; - SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy131, NULL, TSDB_ALTER_TABLE_ADD_COLUMN, TSDB_SUPER_TABLE); + SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy421, NULL, TSDB_ALTER_TABLE_ADD_COLUMN, TSDB_SUPER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 278: /* cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */ + case 281: /* cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; @@ -3216,21 +3243,21 @@ static void yy_reduce( setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 279: /* cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist */ + case 282: /* cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; - SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy131, NULL, TSDB_ALTER_TABLE_CHANGE_COLUMN, TSDB_SUPER_TABLE); + SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy421, NULL, TSDB_ALTER_TABLE_CHANGE_COLUMN, TSDB_SUPER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 280: /* cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */ + case 283: /* cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; - SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy131, NULL, TSDB_ALTER_TABLE_ADD_TAG_COLUMN, TSDB_SUPER_TABLE); + SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy421, NULL, TSDB_ALTER_TABLE_ADD_TAG_COLUMN, TSDB_SUPER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 281: /* cmd ::= ALTER STABLE ids cpxName DROP TAG ids */ + case 284: /* cmd ::= ALTER STABLE ids cpxName DROP TAG ids */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; @@ -3241,7 +3268,7 @@ static void yy_reduce( setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 282: /* cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */ + case 285: /* cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */ { yymsp[-5].minor.yy0.n += yymsp[-4].minor.yy0.n; @@ -3255,32 +3282,32 @@ static void yy_reduce( setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 283: /* cmd ::= ALTER STABLE ids cpxName SET TAG ids EQ tagitem */ + case 286: /* cmd ::= ALTER STABLE ids cpxName SET TAG ids EQ tagitem */ { yymsp[-6].minor.yy0.n += yymsp[-5].minor.yy0.n; toTSDBType(yymsp[-2].minor.yy0.type); SArray* A = tListItemAppendToken(NULL, &yymsp[-2].minor.yy0, -1); - A = tListItemAppend(A, &yymsp[0].minor.yy43, -1); + A = tListItemAppend(A, &yymsp[0].minor.yy69, -1); SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-6].minor.yy0, NULL, A, TSDB_ALTER_TABLE_UPDATE_TAG_VAL, TSDB_SUPER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 284: /* cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist */ + case 287: /* cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; - SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy131, NULL, TSDB_ALTER_TABLE_MODIFY_TAG_COLUMN, TSDB_SUPER_TABLE); + SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy421, NULL, TSDB_ALTER_TABLE_MODIFY_TAG_COLUMN, TSDB_SUPER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 285: /* cmd ::= KILL CONNECTION INTEGER */ + case 288: /* cmd ::= KILL CONNECTION INTEGER */ {setKillSql(pInfo, TSDB_SQL_KILL_CONNECTION, &yymsp[0].minor.yy0);} break; - case 286: /* cmd ::= KILL STREAM INTEGER COLON INTEGER */ + case 289: /* cmd ::= KILL STREAM INTEGER COLON INTEGER */ {yymsp[-2].minor.yy0.n += (yymsp[-1].minor.yy0.n + yymsp[0].minor.yy0.n); setKillSql(pInfo, TSDB_SQL_KILL_STREAM, &yymsp[-2].minor.yy0);} break; - case 287: /* cmd ::= KILL QUERY INTEGER COLON INTEGER */ + case 290: /* cmd ::= KILL QUERY INTEGER COLON INTEGER */ {yymsp[-2].minor.yy0.n += (yymsp[-1].minor.yy0.n + yymsp[0].minor.yy0.n); setKillSql(pInfo, TSDB_SQL_KILL_QUERY, &yymsp[-2].minor.yy0);} break; default: diff --git a/source/libs/parser/src/ttokenizer.c b/source/libs/parser/src/ttokenizer.c index 4e6b77a3d6..6f2b52498d 100644 --- a/source/libs/parser/src/ttokenizer.c +++ b/source/libs/parser/src/ttokenizer.c @@ -70,7 +70,7 @@ static SKeyword keywordTable[] = { {"STAR", TK_STAR}, {"SLASH", TK_SLASH}, {"REM ", TK_REM}, - {"||", TK_CONCAT}, + {"||", TK_CONCAT}, {"UMINUS", TK_UMINUS}, {"UPLUS", TK_UPLUS}, {"BITNOT", TK_BITNOT}, @@ -227,6 +227,7 @@ static SKeyword keywordTable[] = { {"OUTPUTTYPE", TK_OUTPUTTYPE}, {"AGGREGATE", TK_AGGREGATE}, {"BUFSIZE", TK_BUFSIZE}, + {"PORT", TK_PORT}, }; static const char isIdChar[] = { diff --git a/source/libs/planner/src/physicalPlanJson.c b/source/libs/planner/src/physicalPlanJson.c index 5a1b2a6da2..9b2c9c1796 100644 --- a/source/libs/planner/src/physicalPlanJson.c +++ b/source/libs/planner/src/physicalPlanJson.c @@ -857,3 +857,84 @@ int32_t stringToSubplan(const char* str, SSubplan** subplan) { *subplan = subplanFromJson(json); return (NULL == *subplan ? TSDB_CODE_FAILED : TSDB_CODE_SUCCESS); } + +cJSON* qDagToJson(const SQueryDag* pDag) { + cJSON* pRoot = cJSON_CreateObject(); + if(pRoot == NULL) { + return NULL; + } + cJSON_AddNumberToObject(pRoot, "numOfSubplans", pDag->numOfSubplans); + cJSON_AddNumberToObject(pRoot, "queryId", pDag->queryId); + cJSON *pLevels = cJSON_CreateArray(); + if(pLevels == NULL) { + cJSON_Delete(pRoot); + return NULL; + } + cJSON_AddItemToObject(pRoot, "pSubplans", pLevels); + size_t level = taosArrayGetSize(pDag->pSubplans); + for(size_t i = 0; i < level; i++) { + const SArray* pSubplans = (const SArray*)taosArrayGetP(pDag->pSubplans, i); + size_t num = taosArrayGetSize(pSubplans); + cJSON* plansOneLevel = cJSON_CreateArray(); + if(plansOneLevel == NULL) { + cJSON_Delete(pRoot); + return NULL; + } + cJSON_AddItemToArray(pLevels, plansOneLevel); + for(size_t j = 0; j < num; j++) { + cJSON* pSubplan = subplanToJson((const SSubplan*)taosArrayGetP(pSubplans, j)); + if(pSubplan == NULL) { + cJSON_Delete(pRoot); + return NULL; + } + cJSON_AddItemToArray(plansOneLevel, pSubplan); + } + } + return pRoot; +} + +char* qDagToString(const SQueryDag* pDag) { + cJSON* pRoot = qDagToJson(pDag); + return cJSON_Print(pRoot); +} + +SQueryDag* qJsonToDag(const cJSON* pRoot) { + SQueryDag* pDag = malloc(sizeof(SQueryDag)); + if(pDag == NULL) { + return NULL; + } + pDag->numOfSubplans = cJSON_GetNumberValue(cJSON_GetObjectItem(pRoot, "numOfSubplans")); + pDag->queryId = cJSON_GetNumberValue(cJSON_GetObjectItem(pRoot, "queryId")); + pDag->pSubplans = taosArrayInit(0, sizeof(SArray)); + if (pDag->pSubplans == NULL) { + free(pDag); + return NULL; + } + cJSON* pLevels = cJSON_GetObjectItem(pRoot, "pSubplans"); + int level = cJSON_GetArraySize(pLevels); + for(int i = 0; i < level; i++) { + SArray* plansOneLevel = taosArrayInit(0, sizeof(void*)); + if(plansOneLevel == NULL) { + for(int j = 0; j < i; j++) { + taosArrayDestroy(taosArrayGetP(pDag->pSubplans, j)); + } + taosArrayDestroy(pDag->pSubplans); + free(pDag); + return NULL; + } + cJSON* pItem = cJSON_GetArrayItem(pLevels, i); + int sz = cJSON_GetArraySize(pItem); + for(int j = 0; j < sz; j++) { + cJSON* pSubplanJson = cJSON_GetArrayItem(pItem, j); + SSubplan* pSubplan = subplanFromJson(pSubplanJson); + taosArrayPush(plansOneLevel, &pSubplan); + } + taosArrayPush(pDag->pSubplans, plansOneLevel); + } + return pDag; +} + +SQueryDag* qStringToDag(const char* pStr) { + cJSON* pRoot = cJSON_Parse(pStr); + return qJsonToDag(pRoot); +} diff --git a/source/libs/planner/test/phyPlanTests.cpp b/source/libs/planner/test/phyPlanTests.cpp index d0f6fd5adf..02d06bb49d 100644 --- a/source/libs/planner/test/phyPlanTests.cpp +++ b/source/libs/planner/test/phyPlanTests.cpp @@ -83,7 +83,7 @@ protected: } } - SQueryDag* reslut() { + SQueryDag* result() { return dag_.get(); } @@ -149,16 +149,23 @@ TEST_F(PhyPlanTest, tableScanTest) { pushScan("test", "t1", QNODE_TABLESCAN); ASSERT_EQ(run(), TSDB_CODE_SUCCESS); explain(); - SQueryDag* dag = reslut(); + SQueryDag* dag = result(); // todo check } +TEST_F(PhyPlanTest, serializeTest) { + pushScan("test", "t1", QNODE_TABLESCAN); + ASSERT_EQ(run(), TSDB_CODE_SUCCESS); + SQueryDag* dag = result(); + cout << qDagToString(dag) << endl; +} + // select * from supertable TEST_F(PhyPlanTest, superTableScanTest) { pushScan("test", "st1", QNODE_TABLESCAN); ASSERT_EQ(run(), TSDB_CODE_SUCCESS); explain(); - SQueryDag* dag = reslut(); + SQueryDag* dag = result(); // todo check } @@ -166,6 +173,6 @@ TEST_F(PhyPlanTest, superTableScanTest) { TEST_F(PhyPlanTest, insertTest) { ASSERT_EQ(run("test", "insert into t1 values (now, 1, \"beijing\")"), TSDB_CODE_SUCCESS); explain(); - SQueryDag* dag = reslut(); + SQueryDag* dag = result(); // todo check } diff --git a/source/libs/qcom/src/queryUtil.c b/source/libs/qcom/src/queryUtil.c index 12fb6e3385..90a4388485 100644 --- a/source/libs/qcom/src/queryUtil.c +++ b/source/libs/qcom/src/queryUtil.c @@ -3,6 +3,7 @@ #include "query.h" #include "tglobal.h" #include "tsched.h" +#include "trpc.h" #define VALIDNUMOFCOLS(x) ((x) >= TSDB_MIN_COLUMNS && (x) <= TSDB_MAX_COLUMNS) #define VALIDNUMOFTAGS(x) ((x) >= 0 && (x) <= TSDB_MAX_TAGS) @@ -121,3 +122,27 @@ int32_t taosAsyncExec(__async_exec_fn_t execFn, void* execParam, int32_t* code) taosScheduleTask(pTaskQueue, &schedMsg); } + +int32_t asyncSendMsgToServer(void *pTransporter, SEpSet* epSet, int64_t* pTransporterId, const SMsgSendInfo* pInfo) { + char *pMsg = rpcMallocCont(pInfo->msgInfo.len); + if (NULL == pMsg) { + qError("0x%"PRIx64" msg:%s malloc failed", pInfo->requestId, TMSG_INFO(pInfo->msgType)); + terrno = TSDB_CODE_TSC_OUT_OF_MEMORY; + return -1; + } + + memcpy(pMsg, pInfo->msgInfo.pData, pInfo->msgInfo.len); + SRpcMsg rpcMsg = { + .msgType = pInfo->msgType, + .pCont = pMsg, + .contLen = pInfo->msgInfo.len, + .ahandle = (void*) pInfo, + .handle = NULL, + .code = 0 + }; + + assert(pInfo->fp != NULL); + + rpcSendRequest(pTransporter, epSet, &rpcMsg, pTransporterId); + return TSDB_CODE_SUCCESS; +} \ No newline at end of file diff --git a/source/util/src/terror.c b/source/util/src/terror.c index 65057501b9..3a923c6653 100644 --- a/source/util/src/terror.c +++ b/source/util/src/terror.c @@ -79,6 +79,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_FILE_CORRUPTED, "Data file corrupted") TAOS_DEFINE_ERROR(TSDB_CODE_CHECKSUM_ERROR, "Checksum error") TAOS_DEFINE_ERROR(TSDB_CODE_INVALID_MSG, "Invalid config message") TAOS_DEFINE_ERROR(TSDB_CODE_MSG_NOT_PROCESSED, "Message not processed") +TAOS_DEFINE_ERROR(TSDB_CODE_INVALID_PARA, "Invalid parameters") TAOS_DEFINE_ERROR(TSDB_CODE_REF_NO_MEMORY, "Ref out of memory") TAOS_DEFINE_ERROR(TSDB_CODE_REF_FULL, "too many Ref Objs") TAOS_DEFINE_ERROR(TSDB_CODE_REF_ID_REMOVED, "Ref ID is removed") @@ -256,6 +257,24 @@ TAOS_DEFINE_ERROR(TSDB_CODE_DND_MNODE_ID_INVALID, "Mnode Id invalid") TAOS_DEFINE_ERROR(TSDB_CODE_DND_MNODE_ID_NOT_FOUND, "Mnode Id not found") TAOS_DEFINE_ERROR(TSDB_CODE_DND_MNODE_READ_FILE_ERROR, "Read mnode.json error") TAOS_DEFINE_ERROR(TSDB_CODE_DND_MNODE_WRITE_FILE_ERROR, "Write mnode.json error") +TAOS_DEFINE_ERROR(TSDB_CODE_DND_QNODE_ALREADY_DEPLOYED, "Qnode already deployed") +TAOS_DEFINE_ERROR(TSDB_CODE_DND_QNODE_NOT_DEPLOYED, "Qnode not deployed") +TAOS_DEFINE_ERROR(TSDB_CODE_DND_QNODE_ID_INVALID, "Qnode Id invalid") +TAOS_DEFINE_ERROR(TSDB_CODE_DND_QNODE_ID_NOT_FOUND, "Qnode Id not found") +TAOS_DEFINE_ERROR(TSDB_CODE_DND_QNODE_READ_FILE_ERROR, "Read qnode.json error") +TAOS_DEFINE_ERROR(TSDB_CODE_DND_QNODE_WRITE_FILE_ERROR, "Write qnode.json error") +TAOS_DEFINE_ERROR(TSDB_CODE_DND_SNODE_ALREADY_DEPLOYED, "Snode already deployed") +TAOS_DEFINE_ERROR(TSDB_CODE_DND_SNODE_NOT_DEPLOYED, "Snode not deployed") +TAOS_DEFINE_ERROR(TSDB_CODE_DND_SNODE_ID_INVALID, "Snode Id invalid") +TAOS_DEFINE_ERROR(TSDB_CODE_DND_SNODE_ID_NOT_FOUND, "Snode Id not found") +TAOS_DEFINE_ERROR(TSDB_CODE_DND_SNODE_READ_FILE_ERROR, "Read snode.json error") +TAOS_DEFINE_ERROR(TSDB_CODE_DND_SNODE_WRITE_FILE_ERROR, "Write snode.json error") +TAOS_DEFINE_ERROR(TSDB_CODE_DND_BNODE_ALREADY_DEPLOYED, "Bnode already deployed") +TAOS_DEFINE_ERROR(TSDB_CODE_DND_BNODE_NOT_DEPLOYED, "Bnode not deployed") +TAOS_DEFINE_ERROR(TSDB_CODE_DND_BNODE_ID_INVALID, "Bnode Id invalid") +TAOS_DEFINE_ERROR(TSDB_CODE_DND_BNODE_ID_NOT_FOUND, "Bnode Id not found") +TAOS_DEFINE_ERROR(TSDB_CODE_DND_BNODE_READ_FILE_ERROR, "Read bnode.json error") +TAOS_DEFINE_ERROR(TSDB_CODE_DND_BNODE_WRITE_FILE_ERROR, "Write bnode.json error") TAOS_DEFINE_ERROR(TSDB_CODE_DND_VNODE_TOO_MANY_VNODES, "Too many vnode directories") TAOS_DEFINE_ERROR(TSDB_CODE_DND_VNODE_READ_FILE_ERROR, "Read vnodes.json error") TAOS_DEFINE_ERROR(TSDB_CODE_DND_VNODE_WRITE_FILE_ERROR, "Write vnodes.json error") @@ -360,132 +379,6 @@ TAOS_DEFINE_ERROR(TSDB_CODE_WAL_APP_ERROR, "Unexpected generic er TAOS_DEFINE_ERROR(TSDB_CODE_WAL_FILE_CORRUPTED, "WAL file is corrupted") TAOS_DEFINE_ERROR(TSDB_CODE_WAL_SIZE_LIMIT, "WAL size exceeds limit") -// http -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_SERVER_OFFLINE, "http server is not onlin") -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_UNSUPPORT_URL, "url is not support") -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_INVALID_URL, "invalid url format") -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_NO_ENOUGH_MEMORY, "no enough memory") -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_REQUSET_TOO_BIG, "request size is too big") -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_NO_AUTH_INFO, "no auth info input") -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_NO_MSG_INPUT, "request is empty") -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_NO_SQL_INPUT, "no sql input") -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_NO_EXEC_USEDB, "no need to execute use db cmd") -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_SESSION_FULL, "session list was full") -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_GEN_TAOSD_TOKEN_ERR, "generate taosd token error") -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_INVALID_MULTI_REQUEST, "size of multi request is 0") -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_CREATE_GZIP_FAILED, "failed to create gzip") -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_FINISH_GZIP_FAILED, "failed to finish gzip") -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_LOGIN_FAILED, "failed to login") - -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_INVALID_VERSION, "invalid http version") -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_INVALID_CONTENT_LENGTH, "invalid content length") -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_INVALID_AUTH_TYPE, "invalid type of Authorization") -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_INVALID_AUTH_FORMAT, "invalid format of Authorization") -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_INVALID_BASIC_AUTH, "invalid basic Authorization") -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_INVALID_TAOSD_AUTH, "invalid taosd Authorization") -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_PARSE_METHOD_FAILED, "failed to parse method") -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_PARSE_TARGET_FAILED, "failed to parse target") -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_PARSE_VERSION_FAILED, "failed to parse http version") -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_PARSE_SP_FAILED, "failed to parse sp") -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_PARSE_STATUS_FAILED, "failed to parse status") -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_PARSE_PHRASE_FAILED, "failed to parse phrase") -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_PARSE_CRLF_FAILED, "failed to parse crlf") -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_PARSE_HEADER_FAILED, "failed to parse header") -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_PARSE_HEADER_KEY_FAILED, "failed to parse header key") -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_PARSE_HEADER_VAL_FAILED, "failed to parse header val") -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_PARSE_CHUNK_SIZE_FAILED, "failed to parse chunk size") -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_PARSE_CHUNK_FAILED, "failed to parse chunk") -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_PARSE_END_FAILED, "failed to parse end section") -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_PARSE_INVALID_STATE, "invalid parse state") -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_PARSE_ERROR_STATE, "failed to parse error section") - -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_GC_QUERY_NULL, "query size is 0") -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_GC_QUERY_SIZE, "query size can not more than 100") -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_GC_REQ_PARSE_ERROR, "parse grafana json error") - -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_TG_DB_NOT_INPUT, "database name can not be null") -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_TG_DB_TOO_LONG, "database name too long") -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_TG_INVALID_JSON, "invalid telegraf json fromat") -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_TG_METRICS_NULL, "metrics size is 0") -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_TG_METRICS_SIZE, "metrics size can not more than 1K") -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_TG_METRIC_NULL, "metric name not find") -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_TG_METRIC_TYPE, "metric name type should be string") -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_TG_METRIC_NAME_NULL, "metric name length is 0") -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_TG_METRIC_NAME_LONG, "metric name length too long") -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_TG_TIMESTAMP_NULL, "timestamp not find") -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_TG_TIMESTAMP_TYPE, "timestamp type should be integer") -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_TG_TIMESTAMP_VAL_NULL, "timestamp value smaller than 0") -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_TG_TAGS_NULL, "tags not find") -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_TG_TAGS_SIZE_0, "tags size is 0") -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_TG_TAGS_SIZE_LONG, "tags size too long") -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_TG_TAG_NULL, "tag is null") -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_TG_TAG_NAME_NULL, "tag name is null") -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_TG_TAG_NAME_SIZE, "tag name length too long") -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_TG_TAG_VALUE_TYPE, "tag value type should be number or string") -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_TG_TAG_VALUE_NULL, "tag value is null") -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_TG_TABLE_NULL, "table is null") -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_TG_TABLE_SIZE, "table name length too long") -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_TG_FIELDS_NULL, "fields not find") -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_TG_FIELDS_SIZE_0, "fields size is 0") -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_TG_FIELDS_SIZE_LONG, "fields size too long") -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_TG_FIELD_NULL, "field is null") -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_TG_FIELD_NAME_NULL, "field name is null") -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_TG_FIELD_NAME_SIZE, "field name length too long") -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_TG_FIELD_VALUE_TYPE, "field value type should be number or string") -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_TG_FIELD_VALUE_NULL, "field value is null") -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_TG_HOST_NOT_STRING, "host type should be string") -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_TG_STABLE_NOT_EXIST, "stable not exist") - -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_OP_DB_NOT_INPUT, "database name can not be null") -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_OP_DB_TOO_LONG, "database name too long") -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_OP_INVALID_JSON, "invalid opentsdb json fromat") -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_OP_METRICS_NULL, "metrics size is 0") -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_OP_METRICS_SIZE, "metrics size can not more than 10K") -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_OP_METRIC_NULL, "metric name not find") -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_OP_METRIC_TYPE, "metric name type should be string") -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_OP_METRIC_NAME_NULL, "metric name length is 0") -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_OP_METRIC_NAME_LONG, "metric name length can not more than 22") -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_OP_TIMESTAMP_NULL, "timestamp not find") -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_OP_TIMESTAMP_TYPE, "timestamp type should be integer") -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_OP_TIMESTAMP_VAL_NULL, "timestamp value smaller than 0") -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_OP_TAGS_NULL, "tags not find") -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_OP_TAGS_SIZE_0, "tags size is 0") -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_OP_TAGS_SIZE_LONG, "tags size too long") -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_OP_TAG_NULL, "tag is null") -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_OP_TAG_NAME_NULL, "tag name is null") -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_OP_TAG_NAME_SIZE, "tag name length too long") -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_OP_TAG_VALUE_TYPE, "tag value type should be boolean, number or string") -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_OP_TAG_VALUE_NULL, "tag value is null") -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_OP_TAG_VALUE_TOO_LONG, "tag value can not more than 64") -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_OP_VALUE_NULL, "value not find") -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_OP_VALUE_TYPE, "value type should be boolean, number or string") - -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_REQUEST_JSON_ERROR, "http request json error") - -// odbc -TAOS_DEFINE_ERROR(TSDB_CODE_ODBC_OOM, "out of memory") -TAOS_DEFINE_ERROR(TSDB_CODE_ODBC_CONV_CHAR_NOT_NUM, "convertion not a valid literal input") -TAOS_DEFINE_ERROR(TSDB_CODE_ODBC_CONV_UNDEF, "convertion undefined") -TAOS_DEFINE_ERROR(TSDB_CODE_ODBC_CONV_TRUNC_FRAC, "convertion fractional truncated") -TAOS_DEFINE_ERROR(TSDB_CODE_ODBC_CONV_TRUNC, "convertion truncated") -TAOS_DEFINE_ERROR(TSDB_CODE_ODBC_CONV_NOT_SUPPORT, "convertion not supported") -TAOS_DEFINE_ERROR(TSDB_CODE_ODBC_CONV_OOR, "convertion numeric value out of range") -TAOS_DEFINE_ERROR(TSDB_CODE_ODBC_OUT_OF_RANGE, "out of range") -TAOS_DEFINE_ERROR(TSDB_CODE_ODBC_NOT_SUPPORT, "not supported yet") -TAOS_DEFINE_ERROR(TSDB_CODE_ODBC_INVALID_HANDLE, "invalid handle") -TAOS_DEFINE_ERROR(TSDB_CODE_ODBC_NO_RESULT, "no result set") -TAOS_DEFINE_ERROR(TSDB_CODE_ODBC_NO_FIELDS, "no fields returned") -TAOS_DEFINE_ERROR(TSDB_CODE_ODBC_INVALID_CURSOR, "invalid cursor") -TAOS_DEFINE_ERROR(TSDB_CODE_ODBC_STATEMENT_NOT_READY, "statement not ready") -TAOS_DEFINE_ERROR(TSDB_CODE_ODBC_CONNECTION_BUSY, "connection still busy") -TAOS_DEFINE_ERROR(TSDB_CODE_ODBC_BAD_CONNSTR, "bad connection string") -TAOS_DEFINE_ERROR(TSDB_CODE_ODBC_BAD_ARG, "bad argument") -TAOS_DEFINE_ERROR(TSDB_CODE_ODBC_CONV_NOT_VALID_TS, "not a valid timestamp") -TAOS_DEFINE_ERROR(TSDB_CODE_ODBC_CONV_SRC_TOO_LARGE, "src too large") -TAOS_DEFINE_ERROR(TSDB_CODE_ODBC_CONV_SRC_BAD_SEQ, "src bad sequence") -TAOS_DEFINE_ERROR(TSDB_CODE_ODBC_CONV_SRC_INCOMPLETE, "src incomplete") -TAOS_DEFINE_ERROR(TSDB_CODE_ODBC_CONV_SRC_GENERAL, "src general") - // tfs TAOS_DEFINE_ERROR(TSDB_CODE_FS_OUT_OF_MEMORY, "tfs out of memory") TAOS_DEFINE_ERROR(TSDB_CODE_FS_INVLD_CFG, "tfs invalid mount config") diff --git a/src/query/inc/sql.y b/src/query/inc/sql.y index 50806fdfd6..d37aaf5a6d 100644 --- a/src/query/inc/sql.y +++ b/src/query/inc/sql.y @@ -438,6 +438,12 @@ column(A) ::= ids(X) typename(Y). { tSetColumnInfo(&A, &X, &Y); } +%type tagitemlist1 {SArray*} +%destructor tagitemlist1 {taosArrayDestroy($$);} + +%type tagitem1 {SToken} + + %type tagitemlist {SArray*} %destructor tagitemlist {taosArrayDestroy($$);} diff --git a/tests/script/general/db/basic1.sim b/tests/script/general/db/basic1.sim index 666a9dfd9e..618b1377b8 100644 --- a/tests/script/general/db/basic1.sim +++ b/tests/script/general/db/basic1.sim @@ -58,4 +58,11 @@ if $data03 != 0 then return -1 endi +print =============== show vgroups +sql use d4 + +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/general/http/autocreate.sim b/tests/script/general/http/autocreate.sim deleted file mode 100644 index 39af990b50..0000000000 --- a/tests/script/general/http/autocreate.sim +++ /dev/null @@ -1,33 +0,0 @@ -system sh/stop_dnodes.sh -sleep 2000 -system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c wallevel -v 0 -system sh/cfg.sh -n dnode1 -c http -v 1 -system sh/cfg.sh -n dnode1 -c httpEnableRecordSql -v 1 -system sh/exec.sh -n dnode1 -s start - -sleep 2000 -sql connect - -print ============================ dnode1 start - -print =============== step1 - prepare data -sql create database db -sql use db -sql create table if not exists db.win_cpu(ts timestamp,f_percent_dpc_time double,f_percent_idle_time double,f_percent_interrupt_time double,f_percent_privileged_time double,f_percent_processor_time double,f_percent_user_time double) tags(t_host binary(32),t_instance binary(32),t_objectname binary(32)); - -print =============== step2 - auto create - -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'import into db.win_cpu_windows_1_processor using db.win_cpu tags('windows','1','Processor') values(1564641722000,0.000000,95.598305,0.000000,0.000000,0.000000,0.000000);' 127.0.0.1:7111/rest/sql -print curl 127.0.0.1:7111/rest/sql -----> $system_content -#if $system_content != @{"status":"succ","head":["ts","i"],"data":[["2017-12-25 21:28:41.022",1],["2017-12-25 21:28:42.022",2],["2017-12-25 21:28:43.022",3],["2017-12-25 21:28:44.022",4],["2017-12-25 21:28:45.022",5],["2017-12-25 21:28:46.022",6],["2017-12-25 21:28:47.022",7],["2017-12-25 21:28:48.022",8],["2017-12-25 21:28:49.022",9],["2017-12-25 21:28:50.022",10],["2017-12-25 21:28:51.022",11]],"rows":11}@ then -# return -1 -#endi - -sql select * from db.win_cpu_windows_1_processor -print rows: $rows -if $rows != 1 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/general/http/bug.go b/tests/script/general/http/bug.go deleted file mode 100644 index 9455a48c56..0000000000 --- a/tests/script/general/http/bug.go +++ /dev/null @@ -1,344 +0,0 @@ -/* - * 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 . - */ - -package main - -import ( - "bytes" - "encoding/json" - "fmt" - "io/ioutil" - "math/rand" - "net/http" - "os" - "sync" - "sync/atomic" - "time" - "flag" -) - -var ( - token string - url string - config Config - request int64 - period int64 - errorNum int64 -) - -type Config struct { - HostIp string `json:"hostIp"` - ConnNum int `json:"connNum"` - InsertModel string `json:"insertModel"` - WaitTime int `json:"waitTime"` - TableDesc string `json:"tableDesc"` - TablePrefix string `json:"tablePrefix"` - TablePerConn int `json:"tablePerConn"` - TableCreate bool `json:"tableCreate"` - TableStart int `json:"tableStart"` - DbName string `json:"dbName"` - DbReplica int `json:"dbReplica"` - DbKeep int `json:"dbKeep"` - DbDays int `json:"dbDays"` - MetricsName string `json:"metricsName"` - TagNum int `json:"tagNum"` - DataNum int `json:"dataNum"` - DataBegin int64 `json:"dataBegin"` - DataInterval int `json:"dataInterval"` - DataBatch int `json:"dataBatch"` - DataInsert bool `json:"dataInsert"` - DataRandom bool `json:"dataRandom"` -} - -type TokenResult struct { - Status string `json:"status"` - Code int `json:"code"` - Desc string `json:"desc"` -} - -type JsonResult struct { - Status string `json:"status"` - Code int `json:"code"` -} - -func readFile(filename string) { - file, err := os.Open(filename) - if err != nil { - println("taos_cloud.json not found") - panic(err) - } - defer file.Close() - - dec := json.NewDecoder(file) - err = dec.Decode(&config) - if err != nil { - println("taos_cloud.json parse error") - panic(err) - } - - if config.TagNum <= 0 { - config.TagNum = 1 - } - request = 0 - period = 0 - errorNum = 0 - - fmt.Println("================config parameters======================") - fmt.Println("HostIp:", config.HostIp) - fmt.Println("connNum:", config.ConnNum) - fmt.Println("insertModel:", config.InsertModel) - fmt.Println("waitTime:", config.WaitTime) - fmt.Println("tableDesc:", config.TableDesc) - fmt.Println("tablePrefix:", config.TablePrefix) - fmt.Println("tablePerConn:", config.TablePerConn) - fmt.Println("tableCreate:", config.TableCreate) - fmt.Println("tableStart:", config.TableStart) - fmt.Println("dbName:", config.DbName) - fmt.Println("dbReplica:", config.DbReplica) - fmt.Println("dbKeep:", config.DbKeep) - fmt.Println("dbDays:", config.DbDays) - fmt.Println("metricsName:", config.MetricsName) - fmt.Println("tagNum:", config.TagNum) - fmt.Println("dataNum:", config.DataNum) - fmt.Println("dataBegin:", config.DataBegin) - fmt.Println("dataInterval:", config.DataInterval) - fmt.Println("dataBatch:", config.DataBatch) - fmt.Println("dataInsert:", config.DataInsert) - fmt.Println("dataRandom:", config.DataRandom) - - fmt.Println("================http token=============================") - token, err = getToken() - url = fmt.Sprintf("http://%s:%d/rest/sql", config.HostIp, 6020) - - fmt.Println("httpToken:", token) - fmt.Println("httpUrl:", url) - - if err != nil { - panic(err) - } -} - -func getToken() (string, error) { - resp, err := http.Get(fmt.Sprintf("http://%s:%d/rest/login/%s/%s", config.HostIp, 6020, "root", "taosdata")) - if err != nil { - return "", err - } - - defer resp.Body.Close() - - var tokenResult TokenResult - - data, err := ioutil.ReadAll(resp.Body) - - if err != nil { - return "", err - } - - err = json.Unmarshal(data, &tokenResult) - if err != nil { - return "", err - } - - if tokenResult.Status != "succ" { - fmt.Println("get http token failed") - fmt.Println(tokenResult) - return "", err - } - - return tokenResult.Desc, nil -} - -func exec(client *http.Client, sql string) { - for times := 0; times < 10; times++ { - - req, err1 := http.NewRequest("POST", url, bytes.NewReader([]byte(sql))) - if err1 != nil { - continue - } - req.Header.Add("Authorization", "Taosd "+token) - - begin := time.Now() - resp, err := client.Do(req) - - if err != nil { - continue - } - - data, err := ioutil.ReadAll(resp.Body) - if err != nil { - resp.Body.Close() - continue - } - - spend := (time.Since(begin).Nanoseconds()) - - var jsonResult JsonResult - err = json.Unmarshal(data, &jsonResult) - if err != nil { - resp.Body.Close() - continue - } - - if jsonResult.Status != "succ" { - resp.Body.Close() - continue - } - atomic.AddInt64(&request, 1) - if (request < 103) { - return - } - - atomic.AddInt64(&period, spend) - if request%5000 == 0 && request != 0 { - requestAvg := float64(period) / float64(1000000) / float64(request) - qps := float64(1000) / float64(requestAvg) * float64(config.ConnNum) - dps := qps * float64(config.DataBatch) - fmt.Println("====== req:", request, ", error:", errorNum, ", qps:", int64(qps), ", wait:", int64(requestAvg), "ms", ", data per second:", int64(dps)) - } - return - } - fmt.Println("xxxx>sql:", sql, ", retryTimes:", 10) - errorNum++ -} - -func insertTable(conn int) { - client := &http.Client{} - - tbStart := conn*config.TablePerConn + config.TableStart - tmStart := config.DataBegin - - - for j := 0; j < config.DataNum; j++ { - for i := 0; i < config.TablePerConn; i++ { - tmVal := int64(j)*int64(config.DataInterval) + tmStart + 1 - tbIndex := i + tbStart - - dataVal := j - if config.DataRandom { - dataVal = rand.Intn(1000) - } - - sql := fmt.Sprintf("import into %s.%s%d values(%d, %d)", config.DbName, config.TablePrefix, tbIndex, tmVal, dataVal) - exec(client, sql) - time.Sleep(time.Millisecond * time.Duration(10)) - } - } -} - -func insertLoop(conn int) { - client := &http.Client{} - - tbStart := conn*config.TablePerConn + config.TableStart - tmStart := config.DataBegin - - for j := 0; j < config.DataNum; j++ { - - for i := 0; i < config.TablePerConn; i++ { - tbIndex := i + tbStart - - tmVal := int64(j)*int64(config.DataInterval) + tmStart - - dataVal := j - if config.DataRandom { - dataVal = rand.Intn(1000) - } - - sql := fmt.Sprintf("insert into %s.%s%d values(%d, %d)", config.DbName, config.TablePrefix, tbIndex, tmVal, dataVal) - for k := 1; k < config.DataBatch; k++ { - tmVal := int64(j)*int64(config.DataInterval) + int64(k) + tmStart - - dataVal := j + k - if config.DataRandom { - dataVal = rand.Intn(1000) - } - sql += fmt.Sprintf("values(%d, %d)", tmVal, dataVal) - } - - j += (config.DataBatch - 1) - - exec(client, sql) - - if config.WaitTime != 0 { - time.Sleep(time.Millisecond * time.Duration(config.WaitTime)) - } - } - - } -} - -func insertTb(wg *sync.WaitGroup, conn int) { - defer wg.Done() - - if !config.DataInsert { - return - } - - if config.InsertModel == "insertTable" { - insertTable(conn) - } else { - insertLoop(conn) - } -} - -func selectData(wg *sync.WaitGroup, conn int) { - defer wg.Done() - - client := &http.Client{} - - - tbStart := conn*config.TablePerConn + config.TableStart - for j := 0; j < config.DataNum; j++ { - tbIndex := 0 + tbStart - sql := fmt.Sprintf("select max(i),min(i) from db.mt where tbname in ('%s%d'", config.TablePrefix, tbIndex) - for i := 1; i < 2000; i++ { - tbIndex := i + tbStart - sql += fmt.Sprintf(",'%s%d'", config.TablePrefix, tbIndex) - } - sql += ") group by orgno" - - //sql := fmt.Sprintf("select count(*) from db.mt") - //sql := fmt.Sprintf("select max(i),min(i) from db.mt", config.TablePrefix, tbIndex) - - exec(client, sql) - time.Sleep(time.Millisecond * time.Duration(10)) - } -} - -func main() { - filename := flag.String("config", "taos_cloud.json", "config file name") - - flag.Parse() - - readFile(*filename) - - fmt.Println("\n================http test start======================") - - var wg sync.WaitGroup - - fmt.Println("\n================select data ========================") - - - for i := 0; i < config.ConnNum; i++ { - wg.Add(1) - go insertTb(&wg, i) - } - for i := 0; i < config.ConnNum; i++ { - wg.Add(1) - go selectData(&wg, i) - } - wg.Wait() - - fmt.Println("\n================http test stop ======================") -} diff --git a/tests/script/general/http/chunked.sim b/tests/script/general/http/chunked.sim deleted file mode 100644 index c5855e5d29..0000000000 --- a/tests/script/general/http/chunked.sim +++ /dev/null @@ -1,37 +0,0 @@ -system sh/stop_dnodes.sh -sleep 2000 -system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c wallevel -v 0 -system sh/cfg.sh -n dnode1 -c http -v 1 -system sh/cfg.sh -n dnode1 -c maxSQLLength -v 340032 -system sh/exec.sh -n dnode1 -s start - -sleep 2000 -sql connect - -print ============================ dnode1 start - -print =============== step1 - prepare data -sql create database d1 -sql use d1 - -sql create table table_rest (ts timestamp, i int) -print sql length is 270KB -restful d1 table_rest 1591072800 10000 -restful d1 table_rest 1591172800 10000 -restful d1 table_rest 1591272800 10000 -restful d1 table_rest 1591372800 10000 -restful d1 table_rest 1591472800 10000 -restful d1 table_rest 1591572800 10000 -restful d1 table_rest 1591672800 10000 -restful d1 table_rest 1591772800 10000 -restful d1 table_rest 1591872800 10000 -restful d1 table_rest 1591972800 10000 - -sql select * from table_rest; -print rows: $rows -if $rows != 100000 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/general/http/grafana.sim b/tests/script/general/http/grafana.sim deleted file mode 100644 index 414b859bd3..0000000000 --- a/tests/script/general/http/grafana.sim +++ /dev/null @@ -1,182 +0,0 @@ -system sh/stop_dnodes.sh -sleep 2000 -system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c walLevel -v 1 -system sh/cfg.sh -n dnode1 -c http -v 1 -#system sh/cfg.sh -n dnode1 -c adminRowLimit -v 10 -system sh/cfg.sh -n dnode1 -c httpDebugFlag -v 135 -system sh/exec.sh -n dnode1 -s start - -sleep 2000 -sql connect - -print ============================ dnode1 start - -print =============== step1 - prepare data - -sql create database d1 -sql use d1 -sql create table table_gc (ts timestamp, db binary(10), tb binary(20), col binary(20)) -sql create table m1 (ts timestamp, v1 int, v2 float) -sql create table m2 (ts timestamp, v1 int, v2 float) - -sql insert into table_gc values('2017-12-25 21:28:41.022', 'd1', 'm1', 'v1') -sql insert into table_gc values('2017-12-25 21:28:42.022', 'd1', 'm1', 'v2') -sql insert into table_gc values('2017-12-25 21:28:43.022', 'd1', 'm2', 'v1') -sql insert into table_gc values('2017-12-25 21:28:44.022', 'd1', 'm2', 'v2') - -sql insert into m1 values(1514208523020, 1, 4.1) -sql insert into m1 values(1514208523021, 2, 5.1) -sql insert into m1 values(1514208523022, 3, 6.1) - -sql insert into m2 values(1514208523024, 3, 6.1) -sql insert into m2 values(1514208523025, 2, 5.1) -sql insert into m2 values(1514208523026, 1, 4.1) - -sql create table mt (ts timestamp, i int) tags(a int, b binary(10)) -sql create table t1 using mt tags (1, 'a') -sql create table t2 using mt tags (2, 'b') -sql create table t3 using mt tags (3, 'c') -sql insert into t1 values('2017-12-25 21:25:41', 1) -sql insert into t1 values('2017-12-25 21:26:41', 1) -sql insert into t1 values('2017-12-25 21:27:41', 1) -sql insert into t1 values('2017-12-25 21:28:41', 1) -sql insert into t1 values('2017-12-25 21:29:41', 1) -sql insert into t2 values('2017-12-25 21:25:41', 2) -sql insert into t2 values('2017-12-25 21:26:41', 2) -sql insert into t2 values('2017-12-25 21:27:41', 2) -sql insert into t2 values('2017-12-25 21:28:41', 2) -sql insert into t3 values('2017-12-25 21:25:41', 3) -sql insert into t3 values('2017-12-25 21:26:41', 3) -sql insert into t3 values('2017-12-25 21:27:41', 3) - -print =============== step2 - login - -system_content curl 127.0.0.1:7111/grafana/ -print 1-> $system_content -if $system_content != @{"status":"error","code":4357,"desc":"no auth info input"}@ then - return -1 -endi - -system_content curl 127.0.0.1:7111/grafana/xx -print 2-> $system_content -if $system_content != @{"status":"error","code":4357,"desc":"no auth info input"}@ then - return -1 -endi - -system_content curl 127.0.0.1:7111/grafana/login/xx/xx/ -print 3-> $system_content -if $system_content != @{"status":"error","code":849,"desc":"Invalid user"}@ then - return -1 -endi - -system_content curl 127.0.0.1:7111/grafana/root/1/123/1/1/3 -print 4-> $system_content -if $system_content != @{"status":"error","code":4357,"desc":"no auth info input"}@ then - return -1 -endi - -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'show databases' 127.0.0.1:7111/grafana/login/1/root/1/ -print 5-> $system_content -if $system_content != @{"status":"error","code":849,"desc":"Invalid user"}@ then - return -1 -endi - -system_content curl -H 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ3d3cudGFvc2RhdGEuY29tIiwicGFzcyI6InRhb3NkYXRhIiwic3ViIjoicm9vdCJ9.xPv3b5odlR7YF8G_QWASjIRbMtA5v4ItToJ35fFgi' -d 'show databases' 127.0.0.1:7111/grafana/root/1/login -print 6-> $system_content -if $system_content != @{"status":"error","code":4387,"desc":"invalid format of Authorization"}@ then - return -1 -endi - -system_content curl -H 'Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ3d3cudGFvc2RhdGEuY29tIiwicGFzcyI6InRhb3NkYXRhIiwic3ViIjoicm9vdCJ9.xPv3b5odlR7YF8G_QWASjIRbMtA5v4ItToJ35fFgi' -d 'show databases' 127.0.0.1:7111/grafana/root/1/login -print 7-> $system_content -if $system_content != @{"status":"error","code":4387,"desc":"invalid format of Authorization"}@ then - return -1 -endi - -sleep 2000 -system_content curl 127.0.0.1:7111/grafana/login/root/taosdata -print 8-> $system_content -if $system_content != @{"status":"succ","code":0,"desc":"/KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04"}@ then - return -1 -endi - -print =============== step3 - heartbeat - -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' 127.0.0.1:7111/grafana/d1/table_gc -print 9-> $system_content -if $system_content != @{"message":"Grafana server receive a quest from you!"}@ then - return -1 -endi - -print =============== step4 - search - -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' 127.0.0.1:7111/grafana/heartbeat -print 10-> $system_content -if $system_content != @{"message":"Grafana server receive a quest from you!"}@ then - return -1 -endi - -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' 127.0.0.1:7111/grafana/d1/table_invalid/search -print 11-> $system_content -if $system_content != @{"message":"Grafana server receive a quest from you!"}@ then - return -1 -endi - -system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' 127.0.0.1:7111/grafana/d1/m1/search -print 12-> $system_content -if $system_content != @{"message":"Grafana server receive a quest from you!"}@ then - return -1 -endi - -print =============== step5 - query - -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d '[{"refId":"A","alias":"taosd","sql":"select first(v1) from d1.m1 where ts > 1514208523020 and ts < 1514208523030 interval(1m)"},{"refId":"B","alias":"system","sql":"select first(v2) from d1.m1 where ts > 1514208523020 and ts < 1514208523030 interval(1m)"}]' 127.0.0.1:7111/grafana/query -print 13-> $system_content -if $system_content != @[{"refId":"A","target":"taosd","datapoints":[[2,1514208480000]]},{"refId":"B","target":"system","datapoints":[[5.10000,1514208480000]]}]@ then - return -1 -endi - -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d '[{"refId":"A","alias":"","sql":"select first(v1) from d1.m1 where ts > 1514208523020 and ts < 1514208523030 interval(1m)"},{"refId":"B","alias":"","sql":"select first(v2) from d1.m1 where ts > 1514208523020 and ts < 1514208523030 interval(1m)"}]' 127.0.0.1:7111/grafana/query -print 14-> $system_content -if $system_content != @[{"refId":"A","target":"A","datapoints":[[2,1514208480000]]},{"refId":"B","target":"B","datapoints":[[5.10000,1514208480000]]}]@ then - return -1 -endi - -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d '[{"refId":"A","alias":"","sql":"select count(v1) from d1.m1"},{"refId":"B","alias":"","sql":"select count(v2) from d1.m1"}]' 127.0.0.1:7111/grafana/query -print 15-> $system_content -if $system_content != @[{"refId":"A","target":"A","datapoints":[[3,"-"]]},{"refId":"B","target":"B","datapoints":[[3,"-"]]}]@ then - return -1 -endi - -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d '[{"refId":"A","alias":"","sql":"select count(v1) from d1.m1"},{"refId":"B","alias":"","sql":"select count(v2) from d1.m1"}]' 127.0.0.1:7111/grafana/query -print 15-> $system_content -if $system_content != @[{"refId":"A","target":"A","datapoints":[[3,"-"]]},{"refId":"B","target":"B","datapoints":[[3,"-"]]}]@ then - return -1 -endi - -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d '[{"refId":"A","alias":"","sql":"select count(i) from d1.mt group by a"},{"refId":"B","alias":"","sql":"select sum(i) from d1.mt group by b"}]' 127.0.0.1:7111/grafana/query -print 16-> $system_content -if $system_content != @[{"refId":"A","target":"{a:1,}","datapoints":[[5,"-"]]},{"refId":"A","target":"{a:2,}","datapoints":[[4,"-"]]},{"refId":"A","target":"{a:3,}","datapoints":[[3,"-"]]},{"refId":"B","target":"{b:a}","datapoints":[[5,"-"]]},{"refId":"B","target":"{b:b}","datapoints":[[8,"-"]]},{"refId":"B","target":"{b:c}","datapoints":[[9,"-"]]}]@ then - return -1 -endi - -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d '[{"refId":"A","alias":"count","sql":"select count(i) from d1.mt group by a"},{"refId":"B","alias":"sum-","sql":"select sum(i) from d1.mt group by b"}]' 127.0.0.1:7111/grafana/query -print 17-> $system_content -if $system_content != @[{"refId":"A","target":"count{a:1,}","datapoints":[[5,"-"]]},{"refId":"A","target":"count{a:2,}","datapoints":[[4,"-"]]},{"refId":"A","target":"count{a:3,}","datapoints":[[3,"-"]]},{"refId":"B","target":"sum-{b:a}","datapoints":[[5,"-"]]},{"refId":"B","target":"sum-{b:b}","datapoints":[[8,"-"]]},{"refId":"B","target":"sum-{b:c}","datapoints":[[9,"-"]]}]@ then - return -1 -endi - -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d '[{"refId":"A","alias":"count","sql":"select count(i) from d1.mt interval(1m) group by a "}]' 127.0.0.1:7111/grafana/query -print 18-> $system_content -if $system_content != @[{"refId":"A","target":"count{a:1,}","datapoints":[[1,1514208300000],[1,1514208360000],[1,1514208420000],[1,1514208480000],[1,1514208540000]]},{"refId":"A","target":"count{a:2,}","datapoints":[[1,1514208300000],[1,1514208360000],[1,1514208420000],[1,1514208480000]]},{"refId":"A","target":"count{a:3,}","datapoints":[[1,1514208300000],[1,1514208360000],[1,1514208420000]]}]@ then - return -1 -endi - -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d '[{"refId":"A","alias":"","sql":"select sum(v2), count(v1) from d1.m1"},{"refId":"B","alias":"","sql":"select count(v2), sum(v2) from d1.m1"}]' 127.0.0.1:7111/grafana/query -print 19-> $system_content -if $system_content != @[{"refId":"A","target":"{count(v1):3}","datapoints":[[15.299999714,"-"]]},{"refId":"B","target":"{sum(v2):15.299999714}","datapoints":[[3,"-"]]}]@ 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/general/http/grafana_bug.sim b/tests/script/general/http/grafana_bug.sim deleted file mode 100644 index ed184e17c6..0000000000 --- a/tests/script/general/http/grafana_bug.sim +++ /dev/null @@ -1,271 +0,0 @@ -system sh/stop_dnodes.sh -sleep 2000 -system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c http -v 1 -system sh/cfg.sh -n dnode1 -c walLevel -v 1 -#system sh/cfg.sh -n dnode1 -c adminRowLimit -v 10 -system sh/cfg.sh -n dnode1 -c httpDebugFlag -v 135 -system sh/exec.sh -n dnode1 -s start - -sql connect -sleep 2000 - -print ============================ dnode1 start - -print =============== step0 - prepare data - -sql create database db -sql use db - -sql create table tb (ts timestamp, val int, val1 int, val2 int) -sql create table tb2 (ts timestamp, val int, val1 int, val2 int) -sql create table t2 (ts timestamp, val int) -sql create table tb3 (ts timestamp, val int, val1 int, val2 int) - -sql insert into tb values('2020-01-01 00:00:00.000', 1, 11, 21) -sql insert into tb values('2020-01-02 00:00:00.000', 1, 12, 22) -sql insert into tb values('2020-01-03 00:00:00.000', 2, 13, 23) -sql insert into tb values('2020-01-04 00:00:00.000', 2, 14, 24) - - -sql insert into tb2 values('2020-01-01 00:00:00.000', 21, 211, 221) -sql insert into tb2 values('2020-01-02 00:00:00.000', 21, 212, 222) -sql insert into tb2 values('2020-01-03 00:00:00.000', 22, 213, 223) -sql insert into tb2 values('2020-01-04 00:00:00.000', 22, 214, 224) - - -sql insert into tb3 values('2020-01-01 00:00:00.000', NULL, NULL, NULL) -sql insert into tb3 values('2020-01-02 00:00:00.000', NULL, NULL, NULL) -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:7111/grafana/query -print step1-> $system_content -if $system_content != @[{"refId":"A","target":"A","datapoints":[[null,1577980800000],[null,1578067200000]]}]@ then - return -1 -endi - -print =============== step2 - one query, 2 column, with timestamp - -system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"A","alias":"","sql":"select ts,val from db.tb where ts >= 1577980800000 "} ]' 127.0.0.1:7111/grafana/query -print step2-> $system_content -if $system_content != @[{"refId":"A","target":"A","datapoints":[[2,1577980800000],[2,1578067200000]]}]@ then - return -1 -endi - -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:7111/grafana/query -print step3.1-> $system_content -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:7111/grafana/query -print step3.2-> $system_content -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:7111/grafana/query -print step3.3-> $system_content -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:7111/grafana/query -print step4.1-> $system_content -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:7111/grafana/query -print step4.2-> $system_content -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 - -print =============== step5 - one query, 1 column, no timestamp -system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"A","alias":"","sql":"select val from db.tb where ts >= 1577980800000 "} ]' 127.0.0.1:7111/grafana/query -print step1-> $system_content -if $system_content != @[{"refId":"A","target":"A","datapoints":[[2,"-"],[2,"-"]]}]@ then - return -1 -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:7111/grafana/query -print step1-> $system_content -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:7111/grafana/query -print step1-> $system_content -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:7111/grafana/query -print step1-> $system_content -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 - -print =============== step8 - one query, no return -system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"A","alias":"","sql":"select val1,val2,val from db.tb where ts >= 1677980800000 "} ]' 127.0.0.1:7111/grafana/query -print step1-> $system_content -if $system_content != @[]@ then - return -1 -endi - -print =============== step9 - one query, insert sql -system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"A","alias":"","sql":"insert into db.t2 values(now, 1) "} ]' 127.0.0.1:7111/grafana/query -print step1-> $system_content -if $system_content != @[]@ then - return -1 -endi - -print =============== step10 - one query, error sql -system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"A","alias":"","sql":"select * from db.tt "} ]' 127.0.0.1:7111/grafana/query -print step1-> $system_content -if $system_content != @[]@ then - return -1 -endi - -print =============== step11 - two query, 1 column, with timestamp, 1 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 from db.tb where ts >= 1577980800000 "} ]' 127.0.0.1:7111/grafana/query -print step1-> $system_content -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 - -print =============== step12 - two query, 1 column, with timestamp, 2 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 from db.tb where ts >= 1577980800000 "} ]' 127.0.0.1:7111/grafana/query -print step1-> $system_content -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:7111/grafana/query -print step1-> $system_content -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 - -print =============== step14 - two query, 2 column, with timestamp, 2 column, with timestamp -system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"B","alias":"BB","sql":"select ts, val2 from db.tb2 where ts >= 1577980800000 "},{"refId":"A","alias":"AA","sql":"select ts,val from db.tb where ts >= 1577980800000 "} ]' 127.0.0.1:7111/grafana/query -print step1-> $system_content -if $system_content != @[{"refId":"B","target":"BB","datapoints":[[223,1577980800000],[224,1578067200000]]},{"refId":"A","target":"AA","datapoints":[[2,1577980800000],[2,1578067200000]]}]@ then - return -1 -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:7111/grafana/query -print step1-> $system_content -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:7111/grafana/query -print step1-> $system_content -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 - -print =============== step17 - two query, 2 column, with timestamp, no return -system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"B","alias":"BB","sql":"select ts, val from db.tb2 where ts >= 1577980800000 "},{"refId":"A","alias":"AA","sql":"select ts,val from db.tb where ts >= 1677980800000 "} ]' 127.0.0.1:7111/grafana/query -print step1-> $system_content -if $system_content != @[{"refId":"B","target":"BB","datapoints":[[22,1577980800000],[22,1578067200000]]}]@ then - return -1 -endi - -print =============== step18 - two query, 2 column, with timestamp, invalid sql -system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"B","alias":"BB","sql":"select ts, val from db.tb2 where ts >= 1577980800000 "},{"refId":"A","alias":"AA","sql":"select ts,val from db.tb222 where ts >= 1677980800000 "} ]' 127.0.0.1:7111/grafana/query -print step1-> $system_content -if $system_content != @[{"refId":"B","target":"BB","datapoints":[[22,1577980800000],[22,1578067200000]]}]@ then - return -1 -endi - -print =============== step19 - two query, 2 column, with timestamp, insert sql -system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"B","alias":"BB","sql":"select ts, val from db.tb2 where ts >= 1577980800000 "},{"refId":"A","alias":"AA","sql":"insert into db.t2 values(now, 1)"} ]' 127.0.0.1:7111/grafana/query -print step1-> $system_content -if $system_content != @[{"refId":"B","target":"BB","datapoints":[[22,1577980800000],[22,1578067200000]]}]@ then - return -1 -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:7111/grafana/query -print step1-> $system_content -if $system_content != @[{"refId":"B","target":"BB","datapoints":[[22,"-"],[22,"-"]]},{"refId":"A","target":"AA","datapoints":[[null,1577980800000],[null,1578067200000]]}]@ then - return -1 -endi - -print =============== step21 - two query, 1 column, no timestamp, 2 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,val2 from db.tb2 where ts >= 1577980800000 "} ]' 127.0.0.1:7111/grafana/query -print step1-> $system_content -if $system_content != @[{"refId":"B","target":"BB","datapoints":[[22,"-"],[22,"-"]]},{"refId":"A","target":"AA","datapoints":[[223,1577980800000],[224,1578067200000]]}]@ then - return -1 -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:7111/grafana/query -print step1-> $system_content -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:7111/grafana/query -print step1-> $system_content -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:7111/grafana/query -print step1-> $system_content -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:7111/grafana/query -print step1-> $system_content -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 - -print =============== step26 - 2 column, no timestamp, NULL -system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"A","alias":"","sql":"select * from db.tb3 "} ]' 127.0.0.1:7111/grafana/query -print step1-> $system_content -if $system_content != @[{"refId":"A","target":"{val1:nil, val2:nil}","datapoints":[[null,1577808000000],[null,1577894400000]]}]@ then - return -1 -endi - -sql create table tt (ts timestamp ,i int) tags(j binary(20),k binary(20)); -sql insert into t1 using tt tags('jnetworki','t1') values('2020-01-01 00:00:00.000',1)('2020-01-01 00:01:00.000',2)('2020-01-01 00:02:00.000',3)('2020-01-01 00:03:00.000',4)('2020-01-01 00:04:00.000',5); - -system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"A","alias":"","sql":"select max(i) from db.tt where j like \u0027%network%\u0027 and ts >= \u00272020-01-01 00:00:00.000\u0027 and ts < \u00272020-01-01 00:05:00.000\u0027 interval(5m) group by k "} ]' 127.0.0.1:7111/grafana/query -print step1-> $system_content -if $system_content != @[{"refId":"A","target":"{k:t1}","datapoints":[[5,1577808000000]]}]@ then - return -1 -endi - -system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"A","alias":"","sql":"select max(i) from db.tt where j like \u0027jnetwo%\u0027 and ts >= \u00272020-01-01 00:00:00.000\u0027 and ts < \u00272020-01-01 00:05:00.000\u0027 interval(5m) group by k "} ]' 127.0.0.1:7111/grafana/query -print step1-> $system_content -if $system_content != @[{"refId":"A","target":"{k:t1}","datapoints":[[5,1577808000000]]}]@ then - return -1 -endi - -system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"A","alias":"","sql":"select max(i) from db.tt where j like \u0027%networki\u0027 and ts >= \u00272020-01-01 00:00:00.000\u0027 and ts < \u00272020-01-01 00:05:00.000\u0027 interval(5m) group by k "} ]' 127.0.0.1:7111/grafana/query -print step1-> $system_content -if $system_content != @[{"refId":"A","target":"{k:t1}","datapoints":[[5,1577808000000]]}]@ 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/general/http/gzip.sim b/tests/script/general/http/gzip.sim deleted file mode 100644 index ce358d84a1..0000000000 --- a/tests/script/general/http/gzip.sim +++ /dev/null @@ -1,39 +0,0 @@ -system sh/stop_dnodes.sh -sleep 2000 -system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c wallevel -v 0 -system sh/cfg.sh -n dnode1 -c http -v 1 -system sh/cfg.sh -n dnode1 -c maxSQLLength -v 340032 -system sh/exec.sh -n dnode1 -s start - -sleep 2000 -sql connect - -print ============================ dnode1 start - -print =============== step1 - prepare data -sql create database d1 -sql use d1 - -sql create table table_rest (ts timestamp, i int) -print sql length is 270KB -restful d1 table_rest 1591072800 10000 gzip -restful d1 table_rest 1591172800 10000 gzip -restful d1 table_rest 1591272800 10000 gzip -restful d1 table_rest 1591372800 10000 gzip -restful d1 table_rest 1591472800 10000 gzip -restful d1 table_rest 1591572800 10000 gzip -restful d1 table_rest 1591672800 10000 gzip -restful d1 table_rest 1591772800 10000 gzip -restful d1 table_rest 1591872800 10000 gzip -restful d1 table_rest 1591972800 10000 gzip - -sql select * from table_rest; -print rows: $rows -if $rows != 100000 then - return -1 -endi - -system curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'select * from d1.table_rest' 127.0.0.1:7111/rest/sql --compressed - -system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/http/http.json b/tests/script/general/http/http.json deleted file mode 100644 index 087f4eab5b..0000000000 --- a/tests/script/general/http/http.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "hostIp": "192.168.100.128", - "connNum": 1, - "insertModel": "insertTable", - "waitTime": 0, - "tableDesc": "ts timestamp i int", - "tablePrefix": "t", - "tablePerConn": 1, - "tableCreate": true, - "tableStart": 1, - "dbName": "db", - "dbReplica": 1, - "dbKeep": 3650, - "dbDays": 7, - "metricsName": "mt", - "tagNum": 10, - "dataNum": 100, - "dataBegin": 1485878400000, - "dataInterval": 1000, - "dataBatch": 1, - "dataInsert": true, - "dataRandom": false -} diff --git a/tests/script/general/http/httpTestNew.go b/tests/script/general/http/httpTestNew.go deleted file mode 100644 index 9ca7733d44..0000000000 --- a/tests/script/general/http/httpTestNew.go +++ /dev/null @@ -1,247 +0,0 @@ -/* - * 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 . - */ - -package main - -import ( - "bytes" - "encoding/json" - "flag" - "fmt" - "io/ioutil" - "math/rand" - "net/http" - "os" - "sync" - "sync/atomic" - "time" -) - -var ( - token string - url string - config Config - request int64 - begin time.Time - errorNum int64 -) - -type Config struct { - HostIp string `json:"hostIp"` - TableNum int `json:"tableNum"` - DbName string `json:"dbName"` - MetricsName string `json:"metricsName"` - DataNum int `json:"dataNum"` - BatchNum int `json:"batchNum"` -} - -type TokenResult struct { - Status string `json:"status"` - Code int `json:"code"` - Desc string `json:"desc"` -} - -type JsonResult struct { - Status string `json:"status"` - Code int `json:"code"` -} - -func readFile(filename string) { - file, err := os.Open(filename) - if err != nil { - println("taos.json not found") - panic(err) - } - defer file.Close() - - dec := json.NewDecoder(file) - err = dec.Decode(&config) - if err != nil { - println("taos.json parse error") - panic(err) - } - - request = 0 - errorNum = 0 - - fmt.Println("================config parameters======================") - fmt.Println("HostIp:", config.HostIp) - fmt.Println("TableNum:", config.TableNum) - fmt.Println("dbName:", config.DbName) - fmt.Println("metricsName:", config.MetricsName) - fmt.Println("dataNum:", config.DataNum) - fmt.Println("batchNum:", config.BatchNum) - - fmt.Println("================http token=============================") - token, err = getToken() - url = fmt.Sprintf("http://%s:%d/rest/sql", config.HostIp, 6020) - - fmt.Println("httpToken:", token) - fmt.Println("httpUrl:", url) - - if err != nil { - panic(err) - } -} - -func getToken() (string, error) { - resp, err := http.Get(fmt.Sprintf("http://%s:%d/rest/login/%s/%s", config.HostIp, 6020, "root", "taosdata")) - if err != nil { - return "", err - } - - defer resp.Body.Close() - - var tokenResult TokenResult - - data, err := ioutil.ReadAll(resp.Body) - - if err != nil { - return "", err - } - - err = json.Unmarshal(data, &tokenResult) - if err != nil { - return "", err - } - - if tokenResult.Status != "succ" { - fmt.Println("get http token failed") - fmt.Println(tokenResult) - return "", err - } - - return tokenResult.Desc, nil -} - -func exec(client *http.Client, sql string) { - for reTryTimes := 0; reTryTimes < 10; reTryTimes++ { - - req, err1 := http.NewRequest("POST", url, bytes.NewReader([]byte(sql))) - if err1 != nil { - continue - } - req.Header.Add("Authorization", "Taosd "+token) - - resp, err := client.Do(req) - - if err != nil { - continue - } - - data, err := ioutil.ReadAll(resp.Body) - if err != nil { - resp.Body.Close() - continue - } - - var jsonResult JsonResult - err = json.Unmarshal(data, &jsonResult) - if err != nil { - resp.Body.Close() - continue - } - - if jsonResult.Status != "succ" { - resp.Body.Close() - continue - } - - atomic.AddInt64(&request, 1) - - if (request*int64(config.BatchNum))%100000 == 0 && request != 0 { - spend := time.Since(begin).Seconds() - if spend >= 1 && spend < 10000000 { - total := (request - errorNum - 2 - int64(config.TableNum)) * int64(config.BatchNum) - fmt.Printf("request:%d, error:%d, insert:%d, spend:%.2f seconds, dps:%.1f \n", request, errorNum, total, spend, float64(total)/float64(spend)) - } - } - - return - } - - //fmt.Println("exec failed, sql:", sql) - errorNum++ -} - -func createDb() { - fmt.Println("================create database =====================") - - client := &http.Client{} - sql := fmt.Sprintf("create database %s", config.DbName) - exec(client, sql) -} - -func createTb() { - fmt.Println("================create table ========================") - - client := &http.Client{} - sql := fmt.Sprintf("create table %s.%s(ts timestamp, f1 int, f2 int) tags (tb int)", config.DbName, config.MetricsName) - exec(client, sql) - - for i := 0; i < config.TableNum; i++ { - sql := fmt.Sprintf("create table %s.t%d using %s.%s tags(%d)", config.DbName, i, config.DbName, config.MetricsName, i) - exec(client, sql) - } -} - -func insertData(wg *sync.WaitGroup, tableIndex int) { - defer wg.Done() - - client := &http.Client{} - beginTime := int64(1519833600000) - - for i := 0; i < config.DataNum; i += config.BatchNum { - var sql bytes.Buffer - sql.WriteString(fmt.Sprintf("insert into %s.t%d values", config.DbName, tableIndex)) - - for j := 0; j < config.BatchNum; j++ { - sql.WriteString(fmt.Sprintf("(%d,%d,%d)", beginTime+int64(i)+int64(j), rand.Intn(1000), rand.Intn(1000))) - } - exec(client, sql.String()) - } -} - -func main() { - filename := flag.String("config", "http.json", "config file name") - - flag.Parse() - - readFile(*filename) - - fmt.Println("\n================http test start======================") - - createDb() - createTb() - - begin = time.Now() - - var wg sync.WaitGroup - - fmt.Println("================insert data ========================") - for i := 0; i < config.TableNum; i++ { - wg.Add(1) - go insertData(&wg, i) - } - - wg.Wait() - - fmt.Println("\n================http test stop ======================") - - spend := time.Since(begin).Seconds() - - total := (request - errorNum - 2 - int64(config.TableNum)) * int64(config.BatchNum) - fmt.Printf("request:%d, error:%d, insert:%d, spend:%.2f seconds, dps:%.1f \n", request, errorNum, total, spend, float64(total)/float64(spend)) -} diff --git a/tests/script/general/http/httpTest_cloud.go b/tests/script/general/http/httpTest_cloud.go deleted file mode 100644 index 1d849a245f..0000000000 --- a/tests/script/general/http/httpTest_cloud.go +++ /dev/null @@ -1,387 +0,0 @@ -/* - * 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 . - */ - -package main - -import ( - "bytes" - "encoding/json" - "fmt" - "io/ioutil" - "math/rand" - "net/http" - "os" - "sync" - "sync/atomic" - "time" - "flag" -) - -var ( - token string - url string - config Config - request int64 - period int64 - errorNum int64 -) - -type Config struct { - HostIp string `json:"hostIp"` - ConnNum int `json:"connNum"` - InsertModel string `json:"insertModel"` - WaitTime int `json:"waitTime"` - TableDesc string `json:"tableDesc"` - TablePrefix string `json:"tablePrefix"` - TablePerConn int `json:"tablePerConn"` - TableCreate bool `json:"tableCreate"` - TableStart int `json:"tableStart"` - DbName string `json:"dbName"` - DbReplica int `json:"dbReplica"` - DbKeep int `json:"dbKeep"` - DbDays int `json:"dbDays"` - MetricsName string `json:"metricsName"` - TagNum int `json:"tagNum"` - DataNum int `json:"dataNum"` - DataBegin int64 `json:"dataBegin"` - DataInterval int `json:"dataInterval"` - DataBatch int `json:"dataBatch"` - DataInsert bool `json:"dataInsert"` - DataRandom bool `json:"dataRandom"` -} - -type TokenResult struct { - Status string `json:"status"` - Code int `json:"code"` - Desc string `json:"desc"` -} - -type JsonResult struct { - Status string `json:"status"` - Code int `json:"code"` -} - -func readFile(filename string) { - file, err := os.Open(filename) - if err != nil { - println("taos_cloud.json not found") - panic(err) - } - defer file.Close() - - dec := json.NewDecoder(file) - err = dec.Decode(&config) - if err != nil { - println("taos_cloud.json parse error") - panic(err) - } - - if config.TagNum <= 0 { - config.TagNum = 1 - } - request = 0 - period = 0 - errorNum = 0 - - fmt.Println("================config parameters======================") - fmt.Println("HostIp:", config.HostIp) - fmt.Println("connNum:", config.ConnNum) - fmt.Println("insertModel:", config.InsertModel) - fmt.Println("waitTime:", config.WaitTime) - fmt.Println("tableDesc:", config.TableDesc) - fmt.Println("tablePrefix:", config.TablePrefix) - fmt.Println("tablePerConn:", config.TablePerConn) - fmt.Println("tableCreate:", config.TableCreate) - fmt.Println("tableStart:", config.TableStart) - fmt.Println("dbName:", config.DbName) - fmt.Println("dbReplica:", config.DbReplica) - fmt.Println("dbKeep:", config.DbKeep) - fmt.Println("dbDays:", config.DbDays) - fmt.Println("metricsName:", config.MetricsName) - fmt.Println("tagNum:", config.TagNum) - fmt.Println("dataNum:", config.DataNum) - fmt.Println("dataBegin:", config.DataBegin) - fmt.Println("dataInterval:", config.DataInterval) - fmt.Println("dataBatch:", config.DataBatch) - fmt.Println("dataInsert:", config.DataInsert) - fmt.Println("dataRandom:", config.DataRandom) - - fmt.Println("================http token=============================") - token, err = getToken() - url = fmt.Sprintf("http://%s:%d/rest/sql", config.HostIp, 6020) - - fmt.Println("httpToken:", token) - fmt.Println("httpUrl:", url) - - if err != nil { - panic(err) - } -} - -func getToken() (string, error) { - resp, err := http.Get(fmt.Sprintf("http://%s:%d/rest/login/%s/%s", config.HostIp, 6020, "tiger", "tiger")) - if err != nil { - return "", err - } - - defer resp.Body.Close() - - var tokenResult TokenResult - - data, err := ioutil.ReadAll(resp.Body) - - if err != nil { - return "", err - } - - err = json.Unmarshal(data, &tokenResult) - if err != nil { - return "", err - } - - if tokenResult.Status != "succ" { - fmt.Println("get http token failed") - fmt.Println(tokenResult) - return "", err - } - - return tokenResult.Desc, nil -} - -func exec(client *http.Client, sql string) { - for times := 0; times < 10; times++ { - - req, err1 := http.NewRequest("POST", url, bytes.NewReader([]byte(sql))) - if err1 != nil { - continue - } - req.Header.Add("Authorization", "Taosd "+token) - - begin := time.Now() - resp, err := client.Do(req) - - if err != nil { - continue - } - - data, err := ioutil.ReadAll(resp.Body) - if err != nil { - resp.Body.Close() - continue - } - - spend := (time.Since(begin).Nanoseconds()) - - var jsonResult JsonResult - err = json.Unmarshal(data, &jsonResult) - if err != nil { - resp.Body.Close() - continue - } - - if jsonResult.Status != "succ" { - resp.Body.Close() - continue - } - atomic.AddInt64(&request, 1) - if (request < 103) { - return - } - - atomic.AddInt64(&period, spend) - if request%5000 == 0 && request != 0 { - requestAvg := float64(period) / float64(1000000) / float64(request) - qps := float64(1000) / float64(requestAvg) * float64(config.ConnNum) - dps := qps * float64(config.DataBatch) - fmt.Println("====== req:", request, ", error:", errorNum, ", qps:", int64(qps), ", wait:", int64(requestAvg), "ms", ", data per second:", int64(dps)) - } - return - } - fmt.Println("xxxx>sql:", sql, ", retryTimes:", 10) - errorNum++ -} - -func createDb() { - if !config.TableCreate { - return - } - - client := &http.Client{} - - fmt.Println("\n================create database =====================") - sql := fmt.Sprintf("create database %s keep %d", config.DbName, config.DbKeep) - exec(client, sql) -} - -func createTb() { - if !config.TableCreate { - return - } - client := &http.Client{} - - fmt.Println("\n================create table ========================") - sql := fmt.Sprintf("create table %s.%s(%s) tags (orgno int)", config.DbName, config.MetricsName, config.TableDesc) - exec(client, sql) - tbNum := config.TablePerConn*config.ConnNum + config.TableStart - for i := config.TableStart; i < tbNum; i++ { - sql := fmt.Sprintf("create table %s.%s%d using %s.%s tags(%d)", config.DbName, config.TablePrefix, i, config.DbName, config.MetricsName, i%config.TagNum+1) - exec(client, sql) - } - -} - -func insertTable(conn int) { - client := &http.Client{} - - tbStart := conn*config.TablePerConn + config.TableStart - tmStart := config.DataBegin - - for i := 0; i < config.TablePerConn; i++ { - tbIndex := i + tbStart - - for j := 0; j < config.DataNum; j++ { - tmVal := int64(j)*int64(config.DataInterval) + tmStart - - dataVal := j - if config.DataRandom { - dataVal = rand.Intn(1000) - } - - sql := fmt.Sprintf("insert into %s.%s%d values(%d, %d)", config.DbName, config.TablePrefix, tbIndex, tmVal, dataVal) - for k := 1; k < config.DataBatch; k++ { - tmVal := int64(j)*int64(config.DataInterval) + int64(k) + tmStart - - dataVal := j + k - if config.DataRandom { - dataVal = rand.Intn(1000) - } - - sql += fmt.Sprintf("(%d, %d)", tmVal, dataVal) - } - - j += (config.DataBatch - 1) - - exec(client, sql) - if config.WaitTime != 0 { - time.Sleep(time.Millisecond * time.Duration(config.WaitTime)) - } - } - } -} - -func insertLoop(conn int) { - client := &http.Client{} - - tbStart := conn*config.TablePerConn + config.TableStart - tmStart := config.DataBegin - - for j := 0; j < config.DataNum; j++ { - - for i := 0; i < config.TablePerConn; i++ { - tbIndex := i + tbStart - - tmVal := int64(j)*int64(config.DataInterval) + tmStart - - dataVal := j - if config.DataRandom { - dataVal = rand.Intn(1000) - } - - sql := fmt.Sprintf("insert into %s.%s%d values(%d, %d)", config.DbName, config.TablePrefix, tbIndex, tmVal, dataVal) - for k := 1; k < config.DataBatch; k++ { - tmVal := int64(j)*int64(config.DataInterval) + int64(k) + tmStart - - dataVal := j + k - if config.DataRandom { - dataVal = rand.Intn(1000) - } - sql += fmt.Sprintf("values(%d, %d)", tmVal, dataVal) - } - - j += (config.DataBatch - 1) - - exec(client, sql) - - if config.WaitTime != 0 { - time.Sleep(time.Millisecond * time.Duration(config.WaitTime)) - } - } - - } -} - -func insertTb(wg *sync.WaitGroup, conn int) { - defer wg.Done() - - if !config.DataInsert { - return - } - - if config.InsertModel == "insertTable" { - insertTable(conn) - } else { - insertLoop(conn) - } -} - -func selectData(wg *sync.WaitGroup, conn int) { - defer wg.Done() - - client := &http.Client{} - - for i := 0; i < config.DataNum; i++ { - exec(client, config.TableDesc) - } -} - -func main() { - filename := flag.String("config", "taos_cloud.json", "config file name") - - flag.Parse() - - readFile(*filename) - - fmt.Println("\n================http test start======================") - - var wg sync.WaitGroup - - if config.InsertModel == "selectData" { - fmt.Println("\n================select data ========================") - for i := 0; i < config.ConnNum; i++ { - wg.Add(1) - go selectData(&wg, i) - } - } else { - createDb() - createTb() - - if config.DataInsert { - fmt.Println("\n================insert data ========================") - } - - for i := 0; i < config.ConnNum; i++ { - wg.Add(1) - go insertTb(&wg, i) - } - } - - wg.Wait() - - fmt.Println("\n================http test stop ======================") - requestAvg := float64(period) / float64(1000000) / float64(request) - qps := float64(1000) / float64(requestAvg) * float64(config.ConnNum) - dps := qps * float64(config.DataBatch) - fmt.Println("====== req:", request, ", error:", errorNum, ", qps:", int64(qps), ", wait:", int64(requestAvg), "ms", ", data per second:", int64(dps)) -} diff --git a/tests/script/general/http/httpTest_private.go b/tests/script/general/http/httpTest_private.go deleted file mode 100644 index 66f19ec896..0000000000 --- a/tests/script/general/http/httpTest_private.go +++ /dev/null @@ -1,387 +0,0 @@ -/* - * 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 . - */ - -package main - -import ( - "bytes" - "encoding/json" - "fmt" - "io/ioutil" - "math/rand" - "net/http" - "os" - "sync" - "sync/atomic" - "time" - "flag" -) - -var ( - token string - url string - config Config - request int64 - period int64 - errorNum int64 -) - -type Config struct { - HostIp string `json:"hostIp"` - ConnNum int `json:"connNum"` - InsertModel string `json:"insertModel"` - WaitTime int `json:"waitTime"` - TableDesc string `json:"tableDesc"` - TablePrefix string `json:"tablePrefix"` - TablePerConn int `json:"tablePerConn"` - TableCreate bool `json:"tableCreate"` - TableStart int `json:"tableStart"` - DbName string `json:"dbName"` - DbReplica int `json:"dbReplica"` - DbKeep int `json:"dbKeep"` - DbDays int `json:"dbDays"` - MetricsName string `json:"metricsName"` - TagNum int `json:"tagNum"` - DataNum int `json:"dataNum"` - DataBegin int64 `json:"dataBegin"` - DataInterval int `json:"dataInterval"` - DataBatch int `json:"dataBatch"` - DataInsert bool `json:"dataInsert"` - DataRandom bool `json:"dataRandom"` -} - -type TokenResult struct { - Status string `json:"status"` - Code int `json:"code"` - Desc string `json:"desc"` -} - -type JsonResult struct { - Status string `json:"status"` - Code int `json:"code"` -} - -func readFile(filename string) { - file, err := os.Open(filename) - if err != nil { - println("taos_cloud.json not found") - panic(err) - } - defer file.Close() - - dec := json.NewDecoder(file) - err = dec.Decode(&config) - if err != nil { - println("taos_cloud.json parse error") - panic(err) - } - - if config.TagNum <= 0 { - config.TagNum = 1 - } - request = 0 - period = 0 - errorNum = 0 - - fmt.Println("================config parameters======================") - fmt.Println("HostIp:", config.HostIp) - fmt.Println("connNum:", config.ConnNum) - fmt.Println("insertModel:", config.InsertModel) - fmt.Println("waitTime:", config.WaitTime) - fmt.Println("tableDesc:", config.TableDesc) - fmt.Println("tablePrefix:", config.TablePrefix) - fmt.Println("tablePerConn:", config.TablePerConn) - fmt.Println("tableCreate:", config.TableCreate) - fmt.Println("tableStart:", config.TableStart) - fmt.Println("dbName:", config.DbName) - fmt.Println("dbReplica:", config.DbReplica) - fmt.Println("dbKeep:", config.DbKeep) - fmt.Println("dbDays:", config.DbDays) - fmt.Println("metricsName:", config.MetricsName) - fmt.Println("tagNum:", config.TagNum) - fmt.Println("dataNum:", config.DataNum) - fmt.Println("dataBegin:", config.DataBegin) - fmt.Println("dataInterval:", config.DataInterval) - fmt.Println("dataBatch:", config.DataBatch) - fmt.Println("dataInsert:", config.DataInsert) - fmt.Println("dataRandom:", config.DataRandom) - - fmt.Println("================http token=============================") - token, err = getToken() - url = fmt.Sprintf("http://%s:%d/rest/sql", config.HostIp, 6020) - - fmt.Println("httpToken:", token) - fmt.Println("httpUrl:", url) - - if err != nil { - panic(err) - } -} - -func getToken() (string, error) { - resp, err := http.Get(fmt.Sprintf("http://%s:%d/rest/login/%s/%s", config.HostIp, 6020, "root", "taosdata")) - if err != nil { - return "", err - } - - defer resp.Body.Close() - - var tokenResult TokenResult - - data, err := ioutil.ReadAll(resp.Body) - - if err != nil { - return "", err - } - - err = json.Unmarshal(data, &tokenResult) - if err != nil { - return "", err - } - - if tokenResult.Status != "succ" { - fmt.Println("get http token failed") - fmt.Println(tokenResult) - return "", err - } - - return tokenResult.Desc, nil -} - -func exec(client *http.Client, sql string) { - for times := 0; times < 1; times++ { - - req, err1 := http.NewRequest("POST", url, bytes.NewReader([]byte(sql))) - if err1 != nil { - continue - } - req.Header.Add("Authorization", "Taosd "+token) - - begin := time.Now() - resp, err := client.Do(req) - - if err != nil { - continue - } - - data, err := ioutil.ReadAll(resp.Body) - if err != nil { - resp.Body.Close() - continue - } - - spend := (time.Since(begin).Nanoseconds()) - - var jsonResult JsonResult - err = json.Unmarshal(data, &jsonResult) - if err != nil { - resp.Body.Close() - continue - } - - if jsonResult.Status != "succ" { - resp.Body.Close() - continue - } - atomic.AddInt64(&request, 1) - if (request < 103) { - return - } - - atomic.AddInt64(&period, spend) - if request%5000 == 0 && request != 0 { - requestAvg := float64(period) / float64(1000000) / float64(request) - qps := float64(1000) / float64(requestAvg) * float64(config.ConnNum) - dps := qps * float64(config.DataBatch) - fmt.Println("====== req:", request, ", error:", errorNum, ", qps:", int64(qps), ", wait:", int64(requestAvg), "ms", ", data per second:", int64(dps)) - } - return - } - fmt.Println("xxxx>sql:", sql, ", retryTimes:", 10) - errorNum++ -} - -func createDb() { - if !config.TableCreate { - return - } - - client := &http.Client{} - - fmt.Println("\n================create database =====================") - sql := fmt.Sprintf("create database %s keep %d", config.DbName, config.DbKeep) - exec(client, sql) -} - -func createTb() { - if !config.TableCreate { - return - } - client := &http.Client{} - - fmt.Println("\n================create table ========================") - sql := fmt.Sprintf("create table %s.%s(%s) tags (orgno int)", config.DbName, config.MetricsName, config.TableDesc) - exec(client, sql) - tbNum := config.TablePerConn*config.ConnNum + config.TableStart - for i := config.TableStart; i < tbNum; i++ { - sql := fmt.Sprintf("create table %s.%s%d using %s.%s tags(%d)", config.DbName, config.TablePrefix, i, config.DbName, config.MetricsName, i%config.TagNum+1) - exec(client, sql) - } - -} - -func insertTable(conn int) { - client := &http.Client{} - - tbStart := conn*config.TablePerConn + config.TableStart - tmStart := config.DataBegin - - for j := 0; j < config.DataNum; j++ { - for i := 0; i < config.TablePerConn; i++ { - tbIndex := i + tbStart - - tmVal := int64(j)*int64(config.DataInterval) + tmStart - - dataVal := j - if config.DataRandom { - dataVal = rand.Intn(1000) - } - - sql := fmt.Sprintf("insert into %s.%s%d values(%d, %d)", config.DbName, config.TablePrefix, tbIndex, tmVal, dataVal) - for k := 1; k < config.DataBatch; k++ { - tmVal := int64(j)*int64(config.DataInterval) + int64(k) + tmStart - - dataVal := j + k - if config.DataRandom { - dataVal = rand.Intn(1000) - } - - sql += fmt.Sprintf("(%d, %d)", tmVal, dataVal) - } - - - exec(client, sql) - if config.WaitTime != 0 { - time.Sleep(time.Millisecond * time.Duration(config.WaitTime)) - } - } - j += (config.DataBatch - 1) - } -} - -func insertLoop(conn int) { - client := &http.Client{} - - tbStart := conn*config.TablePerConn + config.TableStart - tmStart := config.DataBegin - - for j := 0; j < config.DataNum; j++ { - - for i := 0; i < config.TablePerConn; i++ { - tbIndex := i + tbStart - - tmVal := int64(j)*int64(config.DataInterval) + tmStart - - dataVal := j - if config.DataRandom { - dataVal = rand.Intn(1000) - } - - sql := fmt.Sprintf("insert into %s.%s%d values(%d, %d)", config.DbName, config.TablePrefix, tbIndex, tmVal, dataVal) - for k := 1; k < config.DataBatch; k++ { - tmVal := int64(j)*int64(config.DataInterval) + int64(k) + tmStart - - dataVal := j + k - if config.DataRandom { - dataVal = rand.Intn(1000) - } - sql += fmt.Sprintf("values(%d, %d)", tmVal, dataVal) - } - - j += (config.DataBatch - 1) - - exec(client, sql) - - if config.WaitTime != 0 { - time.Sleep(time.Millisecond * time.Duration(config.WaitTime)) - } - } - - } -} - -func insertTb(wg *sync.WaitGroup, conn int) { - defer wg.Done() - - if !config.DataInsert { - return - } - - if config.InsertModel == "insertTable" { - insertTable(conn) - } else { - insertLoop(conn) - } -} - -func selectData(wg *sync.WaitGroup, conn int) { - defer wg.Done() - - client := &http.Client{} - - for i := 0; i < config.DataNum; i++ { - exec(client, config.TableDesc) - } -} - -func main() { - filename := flag.String("config", "taos_cloud.json", "config file name") - - flag.Parse() - - readFile(*filename) - - fmt.Println("\n================http test start======================") - - var wg sync.WaitGroup - - if config.InsertModel == "selectData" { - fmt.Println("\n================select data ========================") - for i := 0; i < config.ConnNum; i++ { - wg.Add(1) - go selectData(&wg, i) - } - } else { - createDb() - createTb() - - if config.DataInsert { - fmt.Println("\n================insert data ========================") - } - - for i := 0; i < config.ConnNum; i++ { - wg.Add(1) - go insertTb(&wg, i) - } - } - - wg.Wait() - - fmt.Println("\n================http test stop ======================") - requestAvg := float64(period) / float64(1000000) / float64(request) - qps := float64(1000) / float64(requestAvg) * float64(config.ConnNum) - dps := qps * float64(config.DataBatch) - fmt.Println("====== req:", request, ", error:", errorNum, ", qps:", int64(qps), ", wait:", int64(requestAvg), "ms", ", data per second:", int64(dps)) -} diff --git a/tests/script/general/http/prepare.sim b/tests/script/general/http/prepare.sim deleted file mode 100644 index 4bf6b61198..0000000000 --- a/tests/script/general/http/prepare.sim +++ /dev/null @@ -1,54 +0,0 @@ -system sh/stop_dnodes.sh -sleep 2000 -system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c walLevel -v 1 -system sh/cfg.sh -n dnode1 -c http -v 1 -system sh/exec.sh -n dnode1 -s start - -sleep 2000 -sql connect - -print ============================ dnode1 start - -print =============== step1 - prepare data -sql create database d1 -sql use d1 - -sql create table t1 (ts timestamp, i int, b binary(100)) - -sql insert into t1 values('2017-12-25 21:28:41.022', 1, 11) -sql insert into t1 values('2017-12-25 21:28:42.022', 2, '22') -sql insert into t1 values('2017-12-25 21:28:43.022', 3, "33") -sql insert into t1 values('2017-12-25 21:28:44.022', 4, '44"') -sql insert into t1 values('2017-12-25 21:28:45.022', 5, "55'") -sql insert into t1 values('2017-12-25 21:28:46.022', 6, "66'6'") -sql insert into t1 values('2017-12-25 21:28:47.022', 7, '77"7"') -sql insert into t1 values('2017-12-25 21:28:48.022', 8, '88""88') -sql insert into t1 values('2017-12-25 21:28:49.022', 9, '99\99') -sql insert into t1 values('2017-12-25 21:28:51.022', 11, '11\\11') -sql insert into t1 values('2017-12-25 21:28:52.022', 12, '22\\11') -sql insert into t1 values('2017-12-25 21:28:53.022', 13, '33\\"33') -sql insert into t1 values('2017-12-25 21:28:54.022', 14, '44\\""44') - -sleep 4000 - -print =============== step2 - login - -system_content curl 127.0.0.1:7111/rest/login/root/taosdata -print curl 127.0.0.1:7111/rest/login/root/taosdata -----> $system_content - -if $system_content != @{"status":"succ","code":0,"desc":"/KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04"}@ then - return -1 -endi - -return - -print =============== step3 - query data - -system_content curl -H 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ3d3cudGFvc2RhdGEuY29tIiwia2V5IjoiYkVsOExjdkxVZDdhOHFkdE5abXRPTnJ5cDIwMW1hMDQiLCJzdWIiOiJyb290In0.k7CkgmpOJImIkLqZqzASlPmkdeEw7Wfk4XUrqGZX-LQ' -d 'select * from t1' 127.0.0.1:7111/rest/sql/d1 -print curl 127.0.0.1:7111/rest/sql/d1 -----> $system_content -if $system_content != @{"status":"succ","head":["ts","i","b"],"data":[["2017-12-25 21:28:54.022",14,"44\\\\\"\"44"],["2017-12-25 21:28:53.022",13,"33\\\\\"33"],["2017-12-25 21:28:52.022",12,"22\\\\11"],["2017-12-25 21:28:51.022",11,"11\\\\11"],["2017-12-25 21:28:49.022",9,"99\\99"],["2017-12-25 21:28:48.022",8,"88\"\"88"],["2017-12-25 21:28:47.022",7,"77\"7\""],["2017-12-25 21:28:46.022",6,"66'6'"],["2017-12-25 21:28:45.022",5,"55'"],["2017-12-25 21:28:44.022",4,"44\""],["2017-12-25 21:28:43.022",3,"33"],["2017-12-25 21:28:42.022",2,"22"],["2017-12-25 21:28:41.022",1,"11"]],"rows":13}@ 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/general/http/restful.sim b/tests/script/general/http/restful.sim deleted file mode 100644 index 6ebf5644e7..0000000000 --- a/tests/script/general/http/restful.sim +++ /dev/null @@ -1,82 +0,0 @@ -system sh/stop_dnodes.sh -system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c wallevel -v 0 -system sh/cfg.sh -n dnode1 -c http -v 1 -system sh/cfg.sh -n dnode1 -c httpEnableRecordSql -v 1 -system sh/exec.sh -n dnode1 -s start - -sql connect - -print ============================ dnode1 start - -print =============== step1 - prepare data -sql create database d1 -sql use d1 - -sql create table table_rest (ts timestamp, i int) - -sql insert into table_rest values('2017-12-25 21:28:41.022', 1) -sql insert into table_rest values('2017-12-25 21:28:42.022', 2) -sql insert into table_rest values('2017-12-25 21:28:43.022', 3) -sql insert into table_rest values('2017-12-25 21:28:44.022', 4) -sql insert into table_rest values('2017-12-25 21:28:45.022', 5) -sql insert into table_rest values('2017-12-25 21:28:46.022', 6) -sql insert into table_rest values('2017-12-25 21:28:47.022', 7) -sql insert into table_rest values('2017-12-25 21:28:48.022', 8) -sql insert into table_rest values('2017-12-25 21:28:49.022', 9) -sql insert into table_rest values('2017-12-25 21:28:50.022', 10) - -print =============== step2 - login - -system_content curl 127.0.0.1:7111/rest/login/root/taosdata -print curl 127.0.0.1:7111/rest/login/root/taosdata -----> $system_content - -if $system_content != {"status":"succ","code":0,"desc":"/KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04"} then - return -1 -endi - -print =============== step3 - query data - -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'select * from d1.table_rest' 127.0.0.1:7111/rest/sql -print curl 127.0.0.1:7111/rest/sql -----> $system_content -if $system_content != @{"status":"succ","head":["ts","i"],"column_meta":[["ts",9,8],["i",4,4]],"data":[["2017-12-25 21:28:41.022",1],["2017-12-25 21:28:42.022",2],["2017-12-25 21:28:43.022",3],["2017-12-25 21:28:44.022",4],["2017-12-25 21:28:45.022",5],["2017-12-25 21:28:46.022",6],["2017-12-25 21:28:47.022",7],["2017-12-25 21:28:48.022",8],["2017-12-25 21:28:49.022",9],["2017-12-25 21:28:50.022",10]],"rows":10}@ then - return -1 -endi - -print =============== step4 - insert data -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d "insert into d1.table_rest values('2017-12-25 21:28:51.022', 11)" 127.0.0.1:7111/rest/sql -print curl 127.0.0.1:7111/rest/sql -----> $system_content -if $system_content != @{"status":"succ","head":["affected_rows"],"column_meta":[["affected_rows",4,4]],"data":[[1]],"rows":1}@ then - return -1 -endi - -print =============== step5 - query data - -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'select * from d1.table_rest' 127.0.0.1:7111/rest/sql -print curl 127.0.0.1:7111/rest/sql -----> $system_content -if $system_content != @{"status":"succ","head":["ts","i"],"column_meta":[["ts",9,8],["i",4,4]],"data":[["2017-12-25 21:28:41.022",1],["2017-12-25 21:28:42.022",2],["2017-12-25 21:28:43.022",3],["2017-12-25 21:28:44.022",4],["2017-12-25 21:28:45.022",5],["2017-12-25 21:28:46.022",6],["2017-12-25 21:28:47.022",7],["2017-12-25 21:28:48.022",8],["2017-12-25 21:28:49.022",9],["2017-12-25 21:28:50.022",10],["2017-12-25 21:28:51.022",11]],"rows":11}@ then - return -1 -endi - -print =============== step6 - query no db data - -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'show dnodes' 127.0.0.1:7111/rest/sql -print curl 127.0.0.1:7111/rest/sql -----> $system_content - -print =============== step7 - change password -sql create user u1 PASS 'abcd@1234' -sql create user u2 PASS 'abcd_1234' - -system_content curl 127.0.0.1:7111/rest/login/u1/abcd@1234 -print curl 127.0.0.1:7111/rest/login/u1/abcd@1234 -----> $system_content -if $system_content != @{"status":"succ","code":0,"desc":"jIlItaLFFIPa8qdtNZmtONryp201ma04SXX8PEJowKAB/46k1gwnPNryp201ma04"}@ then - return -1 -endi - -system_content curl 127.0.0.1:7111/rest/login/u2/aabcd_1234 -print curl 127.0.0.1:7111/rest/login/u2/abcd_1234 -----> $system_content -if $system_content != @{"status":"error","code":3,"desc":"Authentication failure"}@ then - return -1 -endi - -system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/general/http/restful_dbname.sim b/tests/script/general/http/restful_dbname.sim deleted file mode 100644 index 75cd198507..0000000000 --- a/tests/script/general/http/restful_dbname.sim +++ /dev/null @@ -1,124 +0,0 @@ -system sh/stop_dnodes.sh -sleep 2000 -system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c walLevel -v 1 -system sh/cfg.sh -n dnode1 -c http -v 1 -system sh/cfg.sh -n dnode1 -c httpDbNameMandatory -v 1 -system sh/exec.sh -n dnode1 -s start - -sleep 2000 -sql connect -sql drop database if exists db - -print ============================ dnode1 start - -print =============== step1 - login - -system_content curl 127.0.0.1:7111/rest/login/root/taosdata -print curl 127.0.0.1:7111/rest/login/root/taosdata -----> $system_content - -if $system_content != @{"status":"succ","code":0,"desc":"/KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04"}@ then - return -1 -endi - -print =============== step2 - execute sql without db_name - -print curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'show databases' 127.0.0.1:7111/rest/sql - -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'show databases' 127.0.0.1:7111/rest/sql - -if $system_content != @{"status":"error","code":4354,"desc":"invalid url format"}@ then - return -1 -endi - -print curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'create database if not exists db' 127.0.0.1:7111/rest/sql - -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'create database if not exists db' 127.0.0.1:7111/rest/sql - -if $system_content != @{"status":"error","code":4354,"desc":"invalid url format"}@ then - return -1 -endi - -print curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'create table table_rest (ts timestamp, i int)' 127.0.0.1:7111/rest/sql - -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'create table table_rest (ts timestamp, i int)' 127.0.0.1:7111/rest/sql - -if $system_content != @{"status":"error","code":4354,"desc":"invalid url format"}@ then - return -1 -endi - -print curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'insert into table_rest (now, 1)' 127.0.0.1:7111/rest/sql - -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'insert into table_rest values (now, 1)' 127.0.0.1:7111/rest/sql - -if $system_content != @{"status":"error","code":4354,"desc":"invalid url format"}@ then - return -1 -endi - -print curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'select * from table_rest' 127.0.0.1:7111/rest/sql - -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'select * from table_rest' 127.0.0.1:7111/rest/sql - -if $system_content != @{"status":"error","code":4354,"desc":"invalid url format"}@ then - return -1 -endi - -print curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'drop database if exists db' 127.0.0.1:7111/rest/sql - -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'drop database if exists db' 127.0.0.1:7111/rest/sql - -if $system_content != @{"status":"error","code":4354,"desc":"invalid url format"}@ then - return -1 -endi - -print =============== step3 - execute sql with db_name - -print curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'show databases' 127.0.0.1:7111/rest/sql/databases - -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'show databases' 127.0.0.1:7111/rest/sql/databases - -if $system_content != @{"status":"succ","head":["name","created_time","ntables","vgroups","replica","quorum","days","keep","cache(MB)","blocks","minrows","maxrows","wallevel","fsync","comp","cachelast","precision","update","status"],"column_meta":[["name",8,32],["created_time",9,8],["ntables",4,4],["vgroups",4,4],["replica",3,2],["quorum",3,2],["days",3,2],["keep",8,24],["cache(MB)",4,4],["blocks",4,4],["minrows",4,4],["maxrows",4,4],["wallevel",2,1],["fsync",4,4],["comp",2,1],["cachelast",2,1],["precision",8,3],["update",2,1],["status",8,10]],"data":[],"rows":0}@ then - return -1 -endi - -print curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'create database if not exists db' 127.0.0.1:7111/rest/sql/db - -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'create database if not exists db' 127.0.0.1:7111/rest/sql/db - -if $system_content != @{"status":"succ","head":["affected_rows"],"column_meta":[["affected_rows",4,4]],"data":[[0]],"rows":1}@ then - return -1 -endi - -print curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'create table table_rest (ts timestamp, i int)' 127.0.0.1:7111/rest/sql/db - -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'create table table_rest (ts timestamp, i int)' 127.0.0.1:7111/rest/sql/db - -if $system_content != @{"status":"succ","head":["affected_rows"],"column_meta":[["affected_rows",4,4]],"data":[[0]],"rows":1}@ then - return -1 -endi - -print curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'insert into table_rest (now, 1)' 127.0.0.1:7111/rest/sql/db - -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'insert into table_rest values (1629904789233, 1)' 127.0.0.1:7111/rest/sql/db - -if $system_content != @{"status":"succ","head":["affected_rows"],"column_meta":[["affected_rows",4,4]],"data":[[1]],"rows":1}@ then - return -1 -endi - -print curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'select * from table_rest' 127.0.0.1:7111/rest/sql/db - -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'select * from table_rest' 127.0.0.1:7111/rest/sql/db - -if $system_content != @{"status":"succ","head":["ts","i"],"column_meta":[["ts",9,8],["i",4,4]],"data":[["2021-08-25 23:19:49.233",1]],"rows":1}@ then - return -1 -endi - -print curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'drop database if exists db' 127.0.0.1:7111/rest/sql/db - -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'drop database if exists db' 127.0.0.1:7111/rest/sql/db - -if $system_content != @{"status":"succ","head":["affected_rows"],"column_meta":[["affected_rows",4,4]],"data":[[0]],"rows":1}@ then - return -1 -endi - -system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/general/http/restful_full.sim b/tests/script/general/http/restful_full.sim deleted file mode 100644 index a5d3ac2b86..0000000000 --- a/tests/script/general/http/restful_full.sim +++ /dev/null @@ -1,240 +0,0 @@ -system sh/stop_dnodes.sh -sleep 2000 -system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c wallevel -v 0 -system sh/cfg.sh -n dnode1 -c http -v 1 -system sh/exec.sh -n dnode1 -s start - -#sleep 2000 -sql connect - -print ============================ dnode1 start - -print =============== step1 - login - -system_content curl 127.0.0.1:7111/rest/ -print 1-> $system_content -if $system_content != @{"status":"error","code":4357,"desc":"no auth info input"}@ then - print $system_content - return -1 -endi - -system_content curl 127.0.0.1:7111/rest/xx -print 2-> $system_content -if $system_content != @{"status":"error","code":4357,"desc":"no auth info input"}@ then - return -1 -endi - -system_content curl 127.0.0.1:7111/rest/login -print 3-> $system_content -if $system_content != @{"status":"error","code":4357,"desc":"no auth info input"}@ then - return -1 -endi - -#4 -system_content curl 127.0.0.1:7111/rest/login/root -print 4-> $system_content -if $system_content != @{"status":"error","code":4357,"desc":"no auth info input"}@ then - return -1 -endi - -system_content curl 127.0.0.1:7111/rest/login/root/123 -print 5-> $system_content -if $system_content != @{"status":"error","code":3,"desc":"Authentication failure"}@ then - return -1 -endi - -system_content curl 127.0.0.1:7111/rest/login/root/123/1/1/3 -print 6-> $system_content -if $system_content != @{"status":"error","code":3,"desc":"Authentication failure"}@ then - return -1 -endi - -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'show databases' 127.0.0.1:7111/rest/login/root/1 -print 7-> $system_content -if $system_content != @{"status":"error","code":3,"desc":"Authentication failure"}@ then - return -1 -endi - -#8 -system_content curl -H 'Authorization: Beare eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9' -d 'show databases' 127.0.0.1:7111/rest/login/root/1 -print 8-> $system_content -if $system_content != @{"status":"error","code":4386,"desc":"invalid type of Authorization"}@ then - return -1 -endi - -system_content curl -H 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ3d3cudGFvc2RhdGEuY29tIiwicGFzcyI6InRhb3NkYXRhIiwic3ViIjoicm9vdCJ9.xPv3b5odlR7YF8G_QWASjIRbMtA5v4ItToJ35fFgi' -d 'show databases' 127.0.0.1:7111/rest/login/root/1 -print 8-> $system_content -if $system_content != @{"status":"error","code":4387,"desc":"invalid format of Authorization"}@ then - return -1 -endi - -system_content curl -H 'Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ3d3cudGFvc2RhdGEuY29tIiwicGFzcyI6InRhb3NkYXRhIiwic3ViIjoicm9vdCJ9.xPv3b5odlR7YF8G_QWASjIRbMtA5v4ItToJ35fFgi' -d 'show databases' 127.0.0.1:7111/rest/login/root/1 -print 9-> $system_content -if $system_content != @{"status":"error","code":4387,"desc":"invalid format of Authorization"}@ then - return -1 -endi - -sleep 2000 - -system_content curl 127.0.0.1:7111/rest/login/root/taosdata/ -print 10-> $system_content -if $system_content != @{"status":"succ","code":0,"desc":"/KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04"}@ then - return -1 -endi - -print =============== step2 - no db - -#11 -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'show databases' 127.0.0.1:7111/rest/sql -print 11-> $system_content -if $system_content != @{"status":"succ","head":["name","created_time","ntables","vgroups","replica","quorum","days","keep0,keep1,keep2","cache(MB)","blocks","minrows","maxrows","wallevel","fsync","comp","cachelast","precision","update","status"],"column_meta":[["name",8,32],["created_time",9,8],["ntables",4,4],["vgroups",4,4],["replica",3,2],["quorum",3,2],["days",3,2],["keep0,keep1,keep2",8,24],["cache(MB)",4,4],["blocks",4,4],["minrows",4,4],["maxrows",4,4],["wallevel",2,1],["fsync",4,4],["comp",2,1],["cachelast",2,1],["precision",8,3],["update",2,1],["status",8,10]],"data":[],"rows":0}@ then - return -1 -endi - -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'create database d1' 127.0.0.1:7111/rest/sql -print 12-> $system_content -if $system_content != @{"status":"succ","head":["affected_rows"],"column_meta":[["affected_rows",4,4]],"data":[[0]],"rows":1}@ then - return -1 -endi - -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'create database d1' 127.0.0.1:7111/rest/sql -print 13-> $system_content -if $system_content != @{"status":"error","code":897,"desc":"Database already exists"}@ then - return -1 -endi - -#14 -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d '' 127.0.0.1:7111/rest/sql -print 14-> $system_content -if $system_content != @{"status":"error","code":4359,"desc":"no sql input"}@ then - return -1 -endi - -#system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'use d1' 127.0.0.1:7111/rest/sql -#print 15-> $system_content -#if $system_content != @{"status":"error","code":5017,"desc":"no need to execute use db cmd"}@ then -#if $system_content != @{"status":"succ","head":["affected_rows"],"data":[[1]],"rows":1}@ then -# return -1 -#endi - -#system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d ' use d1' 127.0.0.1:7111/rest/sql -#print 16-> $system_content -#if $system_content != @{"status":"error","code":5017,"desc":"no need to execute use db cmd"}@ then -# return -1 -#endi - -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d ' used1' 127.0.0.1:7111/rest/sql -print 17-> $system_content -if $system_content != @{"status":"error","code":534,"desc":"Syntax error in SQL"}@ then - return -1 -endi - -#18 -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d ' show tables;' 127.0.0.1:7111/rest/sql -print 18-> $system_content -if $system_content != @{"status":"error","code":896,"desc":"Database not specified or available"}@ then - return -1 -endi - -print =============== step3 - db - -#19 -#system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d ' show tables;' 127.0.0.1:7111/rest/sql/d4 -#print 19-> $system_content -#if $system_content != @{"status":"error","code":1000,"desc":"invalid DB"}@ then -# return -1 -#endi - -#system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d ' show tables;' 127.0.0.1:7111/rest/sql/d1 -#print 20-> $system_content -#if $system_content != @{"status":"succ","head":["name","created time","columns","metric"],"data":[],"rows":0}@ then -# return -1 -#endi - -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d ' select * from d1.t1;' 127.0.0.1:7111/rest/sql -print 21-> $system_content -if $system_content != @{"status":"error","code":866,"desc":"Table does not exist"}@ then - return -1 -endi - -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d ' create table d1.t1 (ts timestamp, speed int)' 127.0.0.1:7111/rest/sql -print 22-> $system_content -if $system_content != @{"status":"succ","head":["affected_rows"],"column_meta":[["affected_rows",4,4]],"data":[[0]],"rows":1}@ then - return -1 -endi - -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d ' select * from d1.t1 ' 127.0.0.1:7111/rest/sql -print 23-> $system_content -if $system_content != @{"status":"succ","head":["ts","speed"],"column_meta":[["ts",9,8],["speed",4,4]],"data":[],"rows":0}@ then - return -1 -endi - -#24 -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d "insert into d1.t1 values('2017-12-25 21:28:41.022', 1)" 127.0.0.1:7111/rest/sql -print 24-> $system_content -if $system_content != @{"status":"succ","head":["affected_rows"],"column_meta":[["affected_rows",4,4]],"data":[[1]],"rows":1}@ then - return -1 -endi - -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d ' select * from d1.t1 ' 127.0.0.1:7111/rest/sql -print 25-> $system_content -if $system_content != @{"status":"succ","head":["ts","speed"],"column_meta":[["ts",9,8],["speed",4,4]],"data":[["2017-12-25 21:28:41.022",1]],"rows":1}@ then - return -1 -endi - -#26 -print 25-> no print -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d "insert into d1.t1 values('2017-12-25 21:28:42.022', 2)" 127.0.0.1:7111/rest/sql - -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d "insert into d1.t1 values('2017-12-25 21:28:43.022', 3)" 127.0.0.1:7111/rest/sql - -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d "insert into d1.t1 values('2017-12-25 21:28:44.022', 4)" 127.0.0.1:7111/rest/sql - -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d "insert into d1.t1 values('2017-12-25 21:28:45.022', 5)" 127.0.0.1:7111/rest/sql - -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d "insert into d1.t1 values('2017-12-25 21:28:46.022', 6)" 127.0.0.1:7111/rest/sql - -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d "insert into d1.t1 values('2017-12-25 21:28:47.022', 7)" 127.0.0.1:7111/rest/sql - -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d "insert into d1.t1 values('2017-12-25 21:28:48.022', 8)" 127.0.0.1:7111/rest/sql - -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d "insert into d1.t1 values('2017-12-25 21:28:49.022', 9)" 127.0.0.1:7111/rest/sql - -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d "insert into d1.t1 values('2017-12-25 21:28:50.022', 10)" 127.0.0.1:7111/rest/sql - -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d "insert into d1.t1 values('2017-12-25 21:28:51.022', 11)" 127.0.0.1:7111/rest/sql - -#27 -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d ' select * from d1.t1 ' 127.0.0.1:7111/rest/sql -print 27-> $system_content -if $system_content != @{"status":"succ","head":["ts","speed"],"column_meta":[["ts",9,8],["speed",4,4]],"data":[["2017-12-25 21:28:41.022",1],["2017-12-25 21:28:42.022",2],["2017-12-25 21:28:43.022",3],["2017-12-25 21:28:44.022",4],["2017-12-25 21:28:45.022",5],["2017-12-25 21:28:46.022",6],["2017-12-25 21:28:47.022",7],["2017-12-25 21:28:48.022",8],["2017-12-25 21:28:49.022",9],["2017-12-25 21:28:50.022",10],["2017-12-25 21:28:51.022",11]],"rows":11}@ then - return -1 -endi - -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'create database d2' 127.0.0.1:7111/rest/sql -print 28-> $system_content -if $system_content != @{"status":"succ","head":["affected_rows"],"column_meta":[["affected_rows",4,4]],"data":[[0]],"rows":1}@ then - return -1 -endi - -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d ' create table d2.t1 (ts timestamp, speed int)' 127.0.0.1:7111/rest/sql -print 29-> $system_content -if $system_content != @{"status":"succ","head":["affected_rows"],"column_meta":[["affected_rows",4,4]],"data":[[0]],"rows":1}@ then - return -1 -endi - -#30 -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d "insert into d2.t1 values('2017-12-25 21:28:41.022', 1)" 127.0.0.1:7111/rest/sql -print 30-> $system_content -if $system_content != @{"status":"succ","head":["affected_rows"],"column_meta":[["affected_rows",4,4]],"data":[[1]],"rows":1}@ then - return -1 -endi - -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d ' select * from d2.t1 ' 127.0.0.1:7111/rest/sql -print 31-> $system_content -if $system_content != @{"status":"succ","head":["ts","speed"],"column_meta":[["ts",9,8],["speed",4,4]],"data":[["2017-12-25 21:28:41.022",1]],"rows":1}@ then - return -1 -endi - -system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/general/http/restful_insert.sim b/tests/script/general/http/restful_insert.sim deleted file mode 100644 index b77a1dd497..0000000000 --- a/tests/script/general/http/restful_insert.sim +++ /dev/null @@ -1,53 +0,0 @@ -system sh/stop_dnodes.sh -sleep 2000 -system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c walLevel -v 1 -system sh/cfg.sh -n dnode1 -c http -v 1 -system sh/cfg.sh -n dnode1 -c httpEnableRecordSql -v 1 -system sh/exec.sh -n dnode1 -s start - -sleep 2000 -sql connect - -print ============================ dnode1 start - -print =============== step1 - prepare data -sql create database d1 -sql use d1 - -sql create table d1.table_rest0 (ts timestamp, i int) -sql create table d1.table_rest1 (ts timestamp, i int) -sql create table d1.table_rest2 (ts timestamp, i int) -sql create table d1.table_rest3 (ts timestamp, i int) -sql create table d1.table_rest4 (ts timestamp, i int) -sql create table d1.table_rest5 (ts timestamp, i int) -sql create table d1.table_rest6 (ts timestamp, i int) -sql create table d1.table_rest7 (ts timestamp, i int) -sql create table d1.table_rest8 (ts timestamp, i int) -sql create table d1.table_rest9 (ts timestamp, i int) - -print =============== step2 - login - -system_content curl 127.0.0.1:7111/rest/login/root/taosdata -print curl 127.0.0.1:7111/rest/login/root/taosdata -----> $system_content - -if $system_content != {"status":"succ","code":0,"desc":"/KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04"} then - return -1 -endi - -print =============== step3 - query data - -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'insert into d1.table_rest1 values('now+1s', 1) d1.table_rest2 values('now+1s', 1) d1.table_rest3 values('now+1s', 1) d1.table_rest4 values('now+1s', 1) ' 127.0.0.1:7111/rest/sql -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'insert into d1.table_rest1 values('now+1s', 1) d1.table_rest2 values('now+1s', 1) d1.table_rest3 values('now+1s', 1) d1.table_rest4 values('now+1s', 1) ' 127.0.0.1:7111/rest/sql -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'insert into d1.table_rest1 values('now+1s', 1) d1.table_rest2 values('now+1s', 1) d1.table_rest3 values('now+1s', 1) d1.table_rest4 values('now+1s', 1) ' 127.0.0.1:7111/rest/sql -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'insert into d1.table_rest1 values('now+1s', 1) d1.table_rest2 values('now+1s', 1) d1.table_rest3 values('now+1s', 1) d1.table_rest4 values('now+1s', 1) ' 127.0.0.1:7111/rest/sql -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'insert into d1.table_rest1 values('now+1s', 1) d1.table_rest2 values('now+1s', 1) d1.table_rest3 values('now+1s', 1) d1.table_rest4 values('now+1s', 1) ' 127.0.0.1:7111/rest/sql -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'insert into d1.table_rest1 values('now+1s', 1) d1.table_rest2 values('now+1s', 1) d1.table_rest3 values('now+1s', 1) d1.table_rest4 values('now+1s', 1) ' 127.0.0.1:7111/rest/sql -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'insert into d1.table_rest1 values('now+1s', 1) d1.table_rest2 values('now+1s', 1) d1.table_rest3 values('now+1s', 1) d1.table_rest4 values('now+1s', 1) ' 127.0.0.1:7111/rest/sql - -print =============== step5 - query data - -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'select * from d1.table_rest1' 127.0.0.1:7111/rest/sql -print curl 127.0.0.1:7111/rest/sql -----> $system_content - -system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/http/restful_limit.sim b/tests/script/general/http/restful_limit.sim deleted file mode 100644 index 48a4fdf7d3..0000000000 --- a/tests/script/general/http/restful_limit.sim +++ /dev/null @@ -1,46 +0,0 @@ -system sh/stop_dnodes.sh -sleep 2000 -system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c walLevel -v 1 -system sh/exec.sh -n dnode1 -s start - -sleep 2000 -sql connect - -print ============================ dnode1 start - -print =============== step1 - prepare data - -$dbPrefix = db -$tbPrefix = tb -$mtPrefix = st - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol bigint, t1 bigint, t2 bigint, t3 bigint, t4 bigint, t5 bigint, t6 bigint, t7 bigint, t8 bigint, t9 bigint, t0 nchar(20)) TAGS(tgcol bigint) - -$i = 0 -while $i < 2 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 0 ) - $x = 0 - while $x < 2000 - $ms = $x . m - sql insert into $tb values (now + $ms , 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, '浣犲ソ' ) - $x = $x + 1 - endw - $i = $i + 1 -endw - -system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d 'select * from db0.st0 limit 100' 127.0.0.1:7111/rest/sql -print curl 127.0.0.1:7111/rest/sql -----> $system_content - -#system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d "select * from db0.st0 where tbname in ('tb0', 'tb1') limit 1000" 127.0.0.1:7111/rest/sql -#print curl 127.0.0.1:7111/rest/sql -----> $system_content - -system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/http/taos.json b/tests/script/general/http/taos.json deleted file mode 100644 index abc25f19a2..0000000000 --- a/tests/script/general/http/taos.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "hostIp": "192.168.100.128", - "connNum": 1, - "insertModel": "insertTable", - "waitTime": 0, - "tableDesc": "ts timestamp, i int", - "tablePrefix": "t", - "tablePerConn": 1, - "tableCreate": true, - "tableStart": 1, - "dbName": "db", - "dbReplica": 1, - "dbKeep": 3650, - "dbDays": 7, - "metricsName": "mt", - "tagNum": 10, - "dataNum": 1000, - "dataBegin": 1485878400000, - "dataInterval": 1000, - "dataBatch": 1000, - "dataInsert": true, - "dataRandom": false -} diff --git a/tests/script/general/http/taos_cloud.json b/tests/script/general/http/taos_cloud.json deleted file mode 100644 index c54186b65c..0000000000 --- a/tests/script/general/http/taos_cloud.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "hostIp": "192.168.100.128", - "connNum": 10, - "insertModel": "insertTable", - "waitTime": 0, - "tableDesc": "ts timestamp, i int", - "tablePrefix": "t", - "tablePerConn": 1, - "tableCreate": true, - "tableStart": 1, - "dbName": "db", - "dbKeep": 3650, - "metricsName": "mt", - "tagNum": 10, - "dataNum": 1000, - "dataBegin": 1517414400000, - "dataInterval": 1000, - "dataBatch": 1000, - "dataInsert": true, - "dataRandom": false -} diff --git a/tests/script/general/http/telegraf.json b/tests/script/general/http/telegraf.json deleted file mode 100644 index baf7c5e711..0000000000 --- a/tests/script/general/http/telegraf.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "hostIp": "192.168.0.1", - "machineNum": 100, - "loopNum": 100, - "dbName": "db", - "dataBegin": 1485878400000 -} diff --git a/tests/script/general/http/telegraf.req b/tests/script/general/http/telegraf.req deleted file mode 100644 index 1a3b732999..0000000000 --- a/tests/script/general/http/telegraf.req +++ /dev/null @@ -1,621 +0,0 @@ -{ - "metrics": [{ - "fields": { - "result_code": 2, - "result_type": "connection_failed" - }, - "name": "net_response", - "tags": { - "host": "panshi-gsl", - "port": "80", - "protocol": "tcp", - "result": "connection_failed", - "server": "localhost" - }, - "timestamp": 1536750390000 - },{ - "fields": { - "load1": 0.27, - "load15": 0.09, - "load5": 0.22, - "n_cpus": 4, - "n_users": 4 - }, - "name": "system", - "tags": { - "host": "panshi-gsl" - }, - "timestamp": 1536750390000 - },{ - "fields": { - "uptime": 122 - }, - "name": "system", - "tags": { - "host": "panshi-gsl" - }, - "timestamp": 1536750390000 - }, - { - "fields": { - "uptime_format": " 0:02" - }, - "name": "system", - "tags": { - "host": "panshi-gsl" - }, - "timestamp": 1536750390000 - }, - { - "fields": { - "bytes_recv": 19964, - "bytes_sent": 11077, - "drop_in": 0, - "drop_out": 0, - "err_in": 0, - "err_out": 0, - "packets_recv": 237, - "packets_sent": 124 - }, - "name": "net", - "tags": { - "host": "panshi-gsl", - "interface": "eth0" - }, - "timestamp": 1536750390000 - }, - { - "fields": { - "usage_guest": 0, - "usage_guest_nice": 0, - "usage_idle": 99.39879759519036, - "usage_iowait": 0, - "usage_irq": 0, - "usage_nice": 0, - "usage_softirq": 0, - "usage_steal": 0, - "usage_system": 0.300601202404812, - "usage_user": 0.30060120240480753 - }, - "name": "cpu", - "tags": { - "cpu": "cpu0", - "host": "panshi-gsl" - }, - "timestamp": 1536750390000 - }, - { - "fields": { - "usage_guest": 0, - "usage_guest_nice": 0, - "usage_idle": 99.79959919839683, - "usage_iowait": 0, - "usage_irq": 0, - "usage_nice": 0, - "usage_softirq": 0, - "usage_steal": 0, - "usage_system": 0.2004008016032065, - "usage_user": 0 - }, - "name": "cpu", - "tags": { - "cpu": "cpu1", - "host": "panshi-gsl" - }, - "timestamp": 1536750390000 - }, - { - "fields": { - "usage_guest": 0, - "usage_guest_nice": 0, - "usage_idle": 99.7999999999999, - "usage_iowait": 0, - "usage_irq": 0, - "usage_nice": 0, - "usage_softirq": 0, - "usage_steal": 0, - "usage_system": 0.10000000000000217, - "usage_user": 0.09999999999999995 - }, - "name": "cpu", - "tags": { - "cpu": "cpu2", - "host": "panshi-gsl" - }, - "timestamp": 1536750390000 - }, - { - "fields": { - "usage_guest": 0, - "usage_guest_nice": 0, - "usage_idle": 99.7999999999999, - "usage_iowait": 0, - "usage_irq": 0, - "usage_nice": 0, - "usage_softirq": 0.09999999999999988, - "usage_steal": 0, - "usage_system": 0.09999999999999995, - "usage_user": 0 - }, - "name": "cpu", - "tags": { - "cpu": "cpu3", - "host": "panshi-gsl" - }, - "timestamp": 1536750390000 - }, - { - "fields": { - "usage_guest": 0, - "usage_guest_nice": 0, - "usage_idle": 99.74956173303289, - "usage_iowait": 0, - "usage_irq": 0, - "usage_nice": 0, - "usage_softirq": 0.025043826696719312, - "usage_steal": 0, - "usage_system": 0.12521913348359823, - "usage_user": 0.10017530678687725 - }, - "name": "cpu", - "tags": { - "cpu": "cpu-total", - "host": "panshi-gsl" - }, - "timestamp": 1536750390000 - }, - { - "fields": { - "icmp_inaddrmaskreps": 0, - "icmp_inaddrmasks": 0, - "icmp_indestunreachs": 1, - "icmp_inechoreps": 0, - "icmp_inechos": 0, - "icmp_inerrors": 0, - "icmp_inmsgs": 1, - "icmp_inparmprobs": 0, - "icmp_inredirects": 0, - "icmp_insrcquenchs": 0, - "icmp_intimeexcds": 0, - "icmp_intimestampreps": 0, - "icmp_intimestamps": 0, - "icmp_outaddrmaskreps": 0, - "icmp_outaddrmasks": 0, - "icmp_outdestunreachs": 5, - "icmp_outechoreps": 0, - "icmp_outechos": 0, - "icmp_outerrors": 0, - "icmp_outmsgs": 5, - "icmp_outparmprobs": 0, - "icmp_outredirects": 0, - "icmp_outsrcquenchs": 0, - "icmp_outtimeexcds": 0, - "icmp_outtimestampreps": 0, - "icmp_outtimestamps": 0, - "icmpmsg_intype3": 1, - "icmpmsg_outtype3": 5, - "ip_defaultttl": 64, - "ip_forwarding": 2, - "ip_forwdatagrams": 0, - "ip_fragcreates": 0, - "ip_fragfails": 0, - "ip_fragoks": 0, - "ip_inaddrerrors": 0, - "ip_indelivers": 132, - "ip_indiscards": 0, - "ip_inhdrerrors": 0, - "ip_inreceives": 132, - "ip_inunknownprotos": 0, - "ip_outdiscards": 0, - "ip_outnoroutes": 40, - "ip_outrequests": 134, - "ip_reasmfails": 0, - "ip_reasmoks": 0, - "ip_reasmreqds": 0, - "ip_reasmtimeout": 0, - "tcp_activeopens": 11, - "tcp_attemptfails": 11, - "tcp_currestab": 0, - "tcp_estabresets": 0, - "tcp_inerrs": 0, - "tcp_insegs": 22, - "tcp_maxconn": -1, - "tcp_outrsts": 11, - "tcp_outsegs": 22, - "tcp_passiveopens": 0, - "tcp_retranssegs": 0, - "tcp_rtoalgorithm": 1, - "tcp_rtomax": 120000, - "tcp_rtomin": 200, - "udp_indatagrams": 101, - "udp_inerrors": 0, - "udp_noports": 5, - "udp_outdatagrams": 109, - "udp_rcvbuferrors": 0, - "udp_sndbuferrors": 0, - "udplite_indatagrams": 0, - "udplite_inerrors": 0, - "udplite_noports": 0, - "udplite_outdatagrams": 0, - "udplite_rcvbuferrors": 0, - "udplite_sndbuferrors": 0 - }, - "name": "net", - "tags": { - "host": "panshi-gsl", - "interface": "all" - }, - "timestamp": 1536750390000 - }, - { - "fields": { - "io_time": 44, - "iops_in_progress": 0, - "read_bytes": 569344, - "read_time": 44, - "reads": 108, - "weighted_io_time": 44, - "write_bytes": 0, - "write_time": 0, - "writes": 0 - }, - "name": "diskio", - "tags": { - "host": "panshi-gsl", - "name": "sda5" - }, - "timestamp": 1536750390000 - }, - { - "fields": { - "io_time": 4900, - "iops_in_progress": 0, - "read_bytes": 262294528, - "read_time": 13607, - "reads": 8122, - "weighted_io_time": 27970, - "write_bytes": 12054528, - "write_time": 14369, - "writes": 1073 - }, - "name": "diskio", - "tags": { - "host": "panshi-gsl", - "name": "sda" - }, - "timestamp": 1536750390000 - }, - { - "fields": { - "io_time": 4874, - "iops_in_progress": 0, - "read_bytes": 261522432, - "read_time": 13538, - "reads": 7963, - "weighted_io_time": 27901, - "write_bytes": 12054528, - "write_time": 14369, - "writes": 1073 - }, - "name": "diskio", - "tags": { - "host": "panshi-gsl", - "name": "sda1" - }, - "timestamp": 1536750390000 - }, - { - "fields": { - "io_time": 15, - "iops_in_progress": 0, - "read_bytes": 2048, - "read_time": 15, - "reads": 2, - "weighted_io_time": 15, - "write_bytes": 0, - "write_time": 0, - "writes": 0 - }, - "name": "diskio", - "tags": { - "host": "panshi-gsl", - "name": "sda2" - }, - "timestamp": 1536750390000 - }, - { - "fields": { - "free": 4106956800, - "inodes_free": 526746, - "inodes_total": 752192, - "inodes_used": 225446, - "total": 12112691200, - "used": 7390433280, - "used_percent": 64.27922535963918 - }, - "name": "disk", - "tags": { - "device": "rootfs", - "fstype": "rootfs", - "host": "panshi-gsl", - "mode": "rw", - "path": "/" - }, - "timestamp": 1536750390000 - }, - { - "fields": { - "free": 4106956800, - "inodes_free": 526746, - "inodes_total": 752192, - "inodes_used": 225446, - "total": 12112691200, - "used": 7390433280, - "used_percent": 64.27922535963918 - }, - "name": "disk", - "tags": { - "device": "disk/by-uuid/d4becabf-b49c-4c1c-a4ea-b2f593018766", - "fstype": "ext3", - "host": "panshi-gsl", - "mode": "rw", - "path": "/" - }, - "timestamp": 1536750390000 - }, - { - "fields": { - "boot_time": 1536750268, - "context_switches": 135890, - "entropy_avail": 514, - "interrupts": 112317, - "processes_forked": 3595 - }, - "name": "kernel", - "tags": { - "host": "panshi-gsl" - }, - "timestamp": 1536750390000 - }, - { - "fields": { - "active": 211845120, - "available": 3829399552, - "available_percent": 92.37877479393148, - "buffered": 12083200, - "cached": 254320640, - "commit_limit": 2648322048, - "committed_as": 549027840, - "dirty": 49152, - "free": 3562995712, - "high_free": 0, - "high_total": 0, - "huge_page_size": 2097152, - "huge_pages_free": 0, - "huge_pages_total": 0, - "inactive": 214351872, - "low_free": 0, - "low_total": 0, - "mapped": 81797120, - "page_tables": 13062144, - "shared": 2682880, - "slab": 33386496, - "swap_cached": 0, - "swap_free": 575660032, - "swap_total": 575660032, - "total": 4145324032, - "used": 315924480, - "used_percent": 7.621225206068523, - "vmalloc_chunk": 35184198369280, - "vmalloc_total": 35184372087808, - "vmalloc_used": 168906752, - "wired": 0, - "write_back": 0, - "write_back_tmp": 0 - }, - "name": "mem", - "tags": { - "host": "panshi-gsl" - }, - "timestamp": 1536750390000 - }, - { - "fields": { - "IpExtInBcastOctets": 1291, - "IpExtInBcastPkts": 6, - "IpExtInMcastOctets": 0, - "IpExtInMcastPkts": 0, - "IpExtInNoRoutes": 0, - "IpExtInOctets": 12160, - "IpExtInTruncatedPkts": 0, - "IpExtOutBcastOctets": 0, - "IpExtOutBcastPkts": 0, - "IpExtOutMcastOctets": 0, - "IpExtOutMcastPkts": 0, - "IpExtOutOctets": 9881, - "TcpExtArpFilter": 0, - "TcpExtDelayedACKLocked": 0, - "TcpExtDelayedACKLost": 0, - "TcpExtDelayedACKs": 0, - "TcpExtEmbryonicRsts": 0, - "TcpExtListenDrops": 0, - "TcpExtListenOverflows": 0, - "TcpExtLockDroppedIcmps": 0, - "TcpExtOfoPruned": 0, - "TcpExtOutOfWindowIcmps": 0, - "TcpExtPAWSActive": 0, - "TcpExtPAWSEstab": 0, - "TcpExtPAWSPassive": 0, - "TcpExtPruneCalled": 0, - "TcpExtRcvPruned": 0, - "TcpExtSyncookiesFailed": 0, - "TcpExtSyncookiesRecv": 0, - "TcpExtSyncookiesSent": 0, - "TcpExtTCPAbortFailed": 0, - "TcpExtTCPAbortOnClose": 0, - "TcpExtTCPAbortOnData": 0, - "TcpExtTCPAbortOnLinger": 0, - "TcpExtTCPAbortOnMemory": 0, - "TcpExtTCPAbortOnSyn": 0, - "TcpExtTCPAbortOnTimeout": 0, - "TcpExtTCPDSACKIgnoredNoUndo": 0, - "TcpExtTCPDSACKIgnoredOld": 0, - "TcpExtTCPDSACKOfoRecv": 0, - "TcpExtTCPDSACKOfoSent": 0, - "TcpExtTCPDSACKOldSent": 0, - "TcpExtTCPDSACKRecv": 0, - "TcpExtTCPDSACKUndo": 0, - "TcpExtTCPDirectCopyFromBacklog": 0, - "TcpExtTCPDirectCopyFromPrequeue": 0, - "TcpExtTCPFACKReorder": 0, - "TcpExtTCPFastRetrans": 0, - "TcpExtTCPForwardRetrans": 0, - "TcpExtTCPFullUndo": 0, - "TcpExtTCPHPAcks": 0, - "TcpExtTCPHPHits": 0, - "TcpExtTCPHPHitsToUser": 0, - "TcpExtTCPLoss": 0, - "TcpExtTCPLossFailures": 0, - "TcpExtTCPLossUndo": 0, - "TcpExtTCPLostRetransmit": 0, - "TcpExtTCPMD5NotFound": 0, - "TcpExtTCPMD5Unexpected": 0, - "TcpExtTCPMemoryPressures": 0, - "TcpExtTCPPartialUndo": 0, - "TcpExtTCPPrequeueDropped": 0, - "TcpExtTCPPrequeued": 0, - "TcpExtTCPPureAcks": 0, - "TcpExtTCPRcvCollapsed": 0, - "TcpExtTCPRenoFailures": 0, - "TcpExtTCPRenoRecovery": 0, - "TcpExtTCPRenoRecoveryFail": 0, - "TcpExtTCPRenoReorder": 0, - "TcpExtTCPSACKDiscard": 0, - "TcpExtTCPSACKReneging": 0, - "TcpExtTCPSACKReorder": 0, - "TcpExtTCPSackFailures": 0, - "TcpExtTCPSackMerged": 0, - "TcpExtTCPSackRecovery": 0, - "TcpExtTCPSackRecoveryFail": 0, - "TcpExtTCPSackShiftFallback": 0, - "TcpExtTCPSackShifted": 0, - "TcpExtTCPSchedulerFailed": 0, - "TcpExtTCPSlowStartRetrans": 0, - "TcpExtTCPSpuriousRTOs": 0, - "TcpExtTCPTSReorder": 0, - "TcpExtTCPTimeouts": 0, - "TcpExtTW": 0, - "TcpExtTWKilled": 0, - "TcpExtTWRecycled": 0 - }, - "name": "nstat", - "tags": { - "host": "panshi-gsl", - "name": "netstat" - }, - "timestamp": 1536750390000 - }, - { - "fields": { - "IcmpInAddrMaskReps": 0, - "IcmpInAddrMasks": 0, - "IcmpInDestUnreachs": 1, - "IcmpInEchoReps": 0, - "IcmpInEchos": 0, - "IcmpInErrors": 0, - "IcmpInMsgs": 1, - "IcmpInParmProbs": 0, - "IcmpInRedirects": 0, - "IcmpInSrcQuenchs": 0, - "IcmpInTimeExcds": 0, - "IcmpInTimestampReps": 0, - "IcmpInTimestamps": 0, - "IcmpMsgInType3": 1, - "IcmpMsgOutType3": 5, - "IcmpOutAddrMaskReps": 0, - "IcmpOutAddrMasks": 0, - "IcmpOutDestUnreachs": 5, - "IcmpOutEchoReps": 0, - "IcmpOutEchos": 0, - "IcmpOutErrors": 0, - "IcmpOutMsgs": 5, - "IcmpOutParmProbs": 0, - "IcmpOutRedirects": 0, - "IcmpOutSrcQuenchs": 0, - "IcmpOutTimeExcds": 0, - "IcmpOutTimestampReps": 0, - "IcmpOutTimestamps": 0, - "IpDefaultTTL": 64, - "IpForwDatagrams": 0, - "IpForwarding": 2, - "IpFragCreates": 0, - "IpFragFails": 0, - "IpFragOKs": 0, - "IpInAddrErrors": 0, - "IpInDelivers": 132, - "IpInDiscards": 0, - "IpInHdrErrors": 0, - "IpInReceives": 132, - "IpInUnknownProtos": 0, - "IpOutDiscards": 0, - "IpOutNoRoutes": 40, - "IpOutRequests": 134, - "IpReasmFails": 0, - "IpReasmOKs": 0, - "IpReasmReqds": 0, - "IpReasmTimeout": 0, - "TcpActiveOpens": 12, - "TcpAttemptFails": 12, - "TcpCurrEstab": 0, - "TcpEstabResets": 0, - "TcpInErrs": 0, - "TcpInSegs": 24, - "TcpMaxConn": -1, - "TcpOutRsts": 12, - "TcpOutSegs": 24, - "TcpPassiveOpens": 0, - "TcpRetransSegs": 0, - "TcpRtoAlgorithm": 1, - "TcpRtoMax": 120000, - "TcpRtoMin": 200, - "UdpInDatagrams": 101, - "UdpInErrors": 0, - "UdpLiteInDatagrams": 0, - "UdpLiteInErrors": 0, - "UdpLiteNoPorts": 0, - "UdpLiteOutDatagrams": 0, - "UdpLiteRcvbufErrors": 0, - "UdpLiteSndbufErrors": 0, - "UdpNoPorts": 5, - "UdpOutDatagrams": 109, - "UdpRcvbufErrors": 0, - "UdpSndbufErrors": 0 - }, - "name": "nstat", - "tags": { - "host": "panshi-gsl", - "name": "snmp" - }, - "timestamp": 1536750390000 - }, - { - "fields": { - "blocked": 0, - "dead": 0, - "idle": 0, - "paging": 0, - "running": 1, - "sleeping": 181, - "stopped": 0, - "total": 182, - "total_threads": 280, - "unknown": 0, - "zombies": 0 - }, - "name": "processes", - "tags": { - "host": "panshi-gsl" - }, - "timestamp": 1536750390000 - }] -} \ No newline at end of file diff --git a/tests/script/general/http/telegraf.sim b/tests/script/general/http/telegraf.sim deleted file mode 100644 index 9fc153b232..0000000000 --- a/tests/script/general/http/telegraf.sim +++ /dev/null @@ -1,292 +0,0 @@ -system sh/stop_dnodes.sh -sleep 2000 -system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c walLevel -v 1 -system sh/cfg.sh -n dnode1 -c http -v 1 -system sh/cfg.sh -n dnode1 -c httpEnableRecordSql -v 1 -system sh/cfg.sh -n dnode1 -c telegrafUseFieldNum -v 0 -system sh/exec.sh -n dnode1 -s start - -sleep 2000 -sql connect - -print ============================ dnode1 start - -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:7111/telegraf/ -print $system_content - -if $system_content != @{"status":"error","code":4448,"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:7111/telegraf/ -print $system_content - -if $system_content != @{"status":"error","code":4448,"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:7111/telegraf/d123456789012345678901234567890123456 -print $system_content - -if $system_content != @{"status":"error","code":4449,"desc":"database name too long"}@ then - return -1 -endi - -system_content curl -u root:taosdata -d '[]' 127.0.0.1:7111/telegraf/db/root/taosdata1 -print $system_content - -if $system_content != @{"status":"error","code":4453,"desc":"metric name not find"}@ then - return -1 -endi - -system_content curl -u root:taosdata -d '{}' 127.0.0.1:7111/telegraf/db/root/taosdata1 -print $system_content - -if $system_content != @{"status":"error","code":4453,"desc":"metric name not find"}@ then - return -1 -endi - -system_content curl -u root:taosdata -d '[{}]' 127.0.0.1:7111/telegraf/db/root/taosdata1 -print $system_content - -if $system_content != @{"status":"error","code":4453,"desc":"metric name not find"}@ then - return -1 -endi - -system_content curl -u root:taosdata -d '{"metrics": []}' 127.0.0.1:7111/telegraf/db/root/taosdata1 -print $system_content - -if $system_content != @{"status":"error","code":4451,"desc":"metrics size is 0"}@ then - return -1 -endi - -system_content curl -u root:taosdata -d '{"metrics": [{}]}' 127.0.0.1:7111/telegraf/db/root/taosdata1 -print $system_content - -if $system_content != @{"status":"error","code":4453,"desc":"metric name not find"}@ then - return -1 -endi - -system_content curl -u root:taosdata -d '{"metrics": 12}' 127.0.0.1:7111/telegraf/db/root/taosdata1 -print $system_content - -if $system_content != @{"status":"error","code":4451,"desc":"metrics size is 0"}@ then - return -1 -endi - -#system_content curl -u root:taosdata -d '{"metrics": [{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{}]}' 127.0.0.1:7111/telegraf/db/root/taosdata1 -#print $system_content - -#if $system_content != @{"status":"error","code":4452,"desc":"metrics size can not more than 50"}@ 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},"tags":{"host":"windows","instance":"1","objectname":"Processor"},"timestamp":1535784122}' 127.0.0.1:7111/telegraf/db/root/taosdata1 -print $system_content - -if $system_content != @{"status":"error","code":4453,"desc":"metric name not find"}@ 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":111,"tags":{"host":"windows","instance":"1","objectname":"Processor"},"timestamp":1535784122}' 127.0.0.1:7111/telegraf/db/root/taosdata1 -print $system_content - -if $system_content != @{"status":"error","code":4454,"desc":"metric name type should be string"}@ 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":"","tags":{"host":"windows","instance":"1","objectname":"Processor"},"timestamp":1535784122}' 127.0.0.1:7111/telegraf/db/root/taosdata1 -print $system_content - -if $system_content != @{"status":"error","code":4455,"desc":"metric name length is 0"}@ 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":"a1234567890123456789012345678901234a1234567890123456789012345678901234a1234567890123456789012345678901234a1234567890123456789012345678901234a1234567890123456789012345678901234a1234567890123456789012345678901234a1234567890123456789012345678901234a1234567890123456789012345678901234a1234567890123456789012345678901234a1234567890123456789012345678901234a1234567890123456789012345678901234a1234567890123456789012345678901234","tags":{"host":"windows","instance":"1","objectname":"Processor"},"timestamp":1535784122}' 127.0.0.1:7111/telegraf/db/root/taosdata1 -print $system_content - -if $system_content != @{"status":"error","code":4456,"desc":"metric name length too long"}@ 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":{"host":"windows","instance":"1","objectname":"Processor"}}' 127.0.0.1:7111/telegraf/db/root/taosdata1 -print $system_content - -if $system_content != @{"status":"error","code":4457,"desc":"timestamp not find"}@ 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":{"host":"windows","instance":"1","objectname":"Processor"},"timestamp":""}' 127.0.0.1:7111/telegraf/db/root/taosdata1 -print $system_content - -if $system_content != @{"status":"error","code":4458,"desc":"timestamp type should be integer"}@ 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":{"host":"windows","instance":"1","objectname":"Processor"},"timestamp":-1}' 127.0.0.1:7111/telegraf/db/root/taosdata1 -print $system_content - -if $system_content != @{"status":"error","code":4459,"desc":"timestamp value smaller than 0"}@ 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","timestamp":1535784122}' 127.0.0.1:7111/telegraf/db/root/taosdata1 -print $system_content - -if $system_content != @{"status":"error","code":4460,"desc":"tags not find"}@ 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":{},"timestamp":1535784122}' 127.0.0.1:7111/telegraf/db/root/taosdata1 -print $system_content - -if $system_content != @{"status":"error","code":4461,"desc":"tags size is 0"}@ 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":"","timestamp":1535784122}' 127.0.0.1:7111/telegraf/db/root/taosdata1 -print $system_content - -if $system_content != @{"status":"error","code":4461,"desc":"tags size is 0"}@ 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":{"host":"windows","instance":"1","objectname":"Processor","host":"windows","instance":"1","objectname":"Processor","objectname":"Processor"},"timestamp":1535784122}' 127.0.0.1:7111/telegraf/db/root/taosdata -#print $system_content - -#if $system_content != @{"status":"error","code":4461,"desc":"tags size too long"}@ 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":{},"timestamp":1535784122}' 127.0.0.1:7111/telegraf/db/root/taosdata1 -print $system_content - -if $system_content != @{"status":"error","code":4461,"desc":"tags size is 0"}@ 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":{"":"windows"},"timestamp":1535784122}' 127.0.0.1:7111/telegraf/db/root/taosdata1 -print $system_content - -if $system_content != @{"status":"error","code":4464,"desc":"tag name 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":{"host111111111111222222222222222222222":""},"timestamp":1535784122}' 127.0.0.1:7111/telegraf/db/root/taosdata1 -#print $system_content - -#if $system_content != @{"status":"error","code":4465,"desc":"tag name length too long"}@ 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":{"host":true},"timestamp":1535784122}' 127.0.0.1:7111/telegraf/db/root/taosdata1 -print $system_content - -if $system_content != @{"status":"error","code":4466,"desc":"tag value type should be number or string"}@ 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":{"host":""},"timestamp":1535784122}' 127.0.0.1:7111/telegraf/db/root/taosdata1 -print $system_content - -if $system_content != @{"status":"error","code":4467,"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":{"5022":"111"},"timestamp":1535784122}' 127.0.0.1:7111/telegraf/db/root/taosdata1 -print $system_content - -if $system_content != @{"status":"error","code":4468,"desc":"table 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":{"host":"host111111111111222222222222222222222host111111111111222222222222222222222host111111111111222222222222222222222host111111111111222222222222222222222host111111111111222222222222222222222host111111111111222222222222222222222host111111111111222222222222222222222host111111111111222222222222222222222"},"timestamp":1535784122}' 127.0.0.1:7111/telegraf/db/root/taosdata1 -print $system_content - -if $system_content != @{"status":"error","code":4469,"desc":"table name length too long"}@ then - return -1 -endi - -system_content curl -u root:taosdata -d '{"fields":{},"name":"win_cpu","tags":{"host":"windows","instance":"1","objectname":"Processor"},"timestamp":1535784122}' 127.0.0.1:7111/telegraf/db/root/taosdata1 -print $system_content - -if $system_content != @{"status":"error","code":4471,"desc":"fields size is 0"}@ then - return -1 -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:7111/telegraf/db/root/taosdata1 -print $system_content - -if $system_content != @{"status":"error","code":4474,"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:7111/telegraf/db/root/taosdata1 -print $system_content - -if $system_content != @{"status":"error","code":4477,"desc":"field value is null"}@ then - return -1 -endi - -system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":true,"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:7111/telegraf/db/root/taosdata1 -print $system_content - -if $system_content != @{"status":"error","code":4476,"desc":"field value type should be number or string"}@ 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":{"host":"windows","instance":"1","objectname":"Processor"},"timestamp":1564641722000}' 127.0.0.1:7111/telegraf/db - -print $system_content - -if $system_content != @{"metrics":[{"metric":"win_cpu","stable":"win_cpu","table":"win_cpu_windows_1_Processor","timestamp":"1564641722000","affected_rows":1,"status":"succ"}]}@ then - return -1 -endi - -sleep 2000 - -print =============== step2 - insert single data -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":1564641722000}' 127.0.0.1:7111/telegraf/db/ - -print $system_content - -#if $system_content != @{"metrics":[{"metric":"win_cpu","stable":"win_cpu","table":"win_cpu_windows_1_Processor","timestamp":"1564641722000","affected_rows":1,"status":"succ"}]}@ then -# return -1 -#endi - -system_content curl -u root:taosdata -d 'select * from db.win_cpu_windows_1_Processor' 127.0.0.1:7111/rest/sql/ - -print $system_content - -#if $system_content != @{"status":"succ","head":["ts","f_percent_dpc_time","f_percent_idle_time","f_percent_interrupt_time","f_percent_privileged_time","f_percent_processor_time","f_percent_user_time"],"data":[["2019-08-01 06:42:02.000",0.000000000,95.598305000,0.000000000,0.000000000,0.000000000,0.000000000]],"rows":1}@ then -# return -1 -#endi - -print =============== step3 - multi-query data -system_content curl -u root:taosdata -d '{"metrics": [{"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":"window1","instance":"1","objectname":"Processor"},"timestamp":1564641723000},{"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":"window2","instance":"1","objectname":"Processor"},"timestamp":1564641723000}]}' 127.0.0.1:7111/telegraf/db/ - -print $system_content - -if $system_content != @{"metrics":[{"metric":"win_cpu","stable":"win_cpu","table":"win_cpu_window1_1_Processor","timestamp":"1564641723000","affected_rows":1,"status":"succ"},{"metric":"win_cpu","stable":"win_cpu","table":"win_cpu_window2_1_Processor","timestamp":"1564641723000","affected_rows":1,"status":"succ"}]}@ then - return -1 -endi - -system_content curl -u root:taosdata -d 'select * from db.win_cpu_window1_1_Processor' 127.0.0.1:7111/rest/sql/ - -print $system_content - -#if $system_content != @{"status":"succ","head":["ts","f_percent_dpc_time","f_percent_idle_time","f_percent_interrupt_time","f_percent_privileged_time","f_percent_processor_time","f_percent_user_time"],"data":[["2019-08-01 14:42:03.000",0.000000000,95.598305000,0.000000000,0.000000000,0.000000000,0.000000000]],"rows":1}@ then -# return -1 -#endi - -system_content curl -u root:taosdata -d 'select count(*) from db.win_cpu' 127.0.0.1:7111/rest/sql/ - -print $system_content - -if $system_content != @{"status":"succ","head":["count(*)"],"column_meta":[["count(*)",5,8]],"data":[[3]],"rows":1}@ then - return -1 -endi - -system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/general/http/telegrafTest.go b/tests/script/general/http/telegrafTest.go deleted file mode 100644 index caa6493c82..0000000000 --- a/tests/script/general/http/telegrafTest.go +++ /dev/null @@ -1,238 +0,0 @@ -/* - * 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 . - */ - -package main - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "io/ioutil" - "net/http" - "os" - "sync" - "sync/atomic" - "time" - "flag" -) - -var ( - token string - url string - config Config - request int64 - period int64 - errorNum int64 - template string -) - -type Config struct { - HostIp string `json:"hostIp"` - MachineNum int `json:"machineNum"` - LoopNum int `json:"loopNum"` - DbName string `json:"dbName"` - DataBegin int64 `json:"dataBegin"` -} - -type TokenResult struct { - Status string `json:"status"` - Code int `json:"code"` - Desc string `json:"desc"` -} - -type JsonResult struct { - Status string `json:"status"` - Code int `json:"code"` -} - -func readConf(filename string) { - file, err := os.Open(filename) - if err != nil { - println("%s not found", filename) - panic(err) - } - defer file.Close() - - dec := json.NewDecoder(file) - err = dec.Decode(&config) - if err != nil { - println("%s parse error", filename) - panic(err) - } - - request = 0 - period = 0 - errorNum = 0 - - fmt.Println("================config parameters======================") - fmt.Println("HostIp:", config.HostIp) - fmt.Println("MachineNum:", config.MachineNum) - fmt.Println("LoopNum:", config.LoopNum) - fmt.Println("dbName:", config.DbName) - fmt.Println("dataBegin:", config.DataBegin) - - fmt.Println("================http token=============================") - token, err = getToken() - url = fmt.Sprintf("http://%s:%d/telegraf/%s", config.HostIp, 6020, config.DbName) - - fmt.Println("httpToken:", token) - fmt.Println("httpUrl:", url) - - if err != nil { - panic(err) - } -} - -func readReq(filename string) { - file, err := os.Open(filename) - if err != nil { - println("%s not found", filename) - panic(err) - } - defer file.Close() - - data, _ := ioutil.ReadAll(file) - - template = string(data[:]) - - //fmt.Println(template) -} - -func getToken() (string, error) { - resp, err := http.Get(fmt.Sprintf("http://%s:%d/rest/login/%s/%s", config.HostIp, 6020, "root", "taosdata")) - if err != nil { - return "", err - } - - defer resp.Body.Close() - - var tokenResult TokenResult - - data, err := ioutil.ReadAll(resp.Body) - - if err != nil { - return "", err - } - - err = json.Unmarshal(data, &tokenResult) - if err != nil { - return "", err - } - - if tokenResult.Status != "succ" { - fmt.Println("get http token failed") - fmt.Println(tokenResult) - return "", err - } - - return tokenResult.Desc, nil -} - -func exec(client *http.Client, sql string) { - for times := 0; times < 10; times++ { - - req, err1 := http.NewRequest("POST", url, bytes.NewReader([]byte(sql))) - if err1 != nil { - continue - } - req.Header.Add("Authorization", "Taosd "+token) - - begin := time.Now() - resp, err := client.Do(req) - - if err != nil { - continue - } - - data, err := ioutil.ReadAll(resp.Body) - if err != nil { - fmt.Println(data) - resp.Body.Close() - continue - } - - spend := (time.Since(begin).Nanoseconds()) - - var jsonResult JsonResult - err = json.Unmarshal(data, &jsonResult) - if err != nil { - fmt.Println("parse json error: ", string(data[:])) - resp.Body.Close() - continue - } - - - atomic.AddInt64(&request, 1) - atomic.AddInt64(&period, spend) - - if request%1000 == 0 && request != 0 { - requestAvg := float64(period) / float64(1000000) / float64(request) - qps := float64(1000) / float64(requestAvg) * float64(config.MachineNum) - dps := qps * float64(22) - fmt.Println("====== req:", request, ", error:", errorNum, ", qps:", int64(qps), ", wait:", int64(requestAvg), "ms", ", data per second:", int64(dps)) - } - return - } - //fmt.Println("xxxx>sql:", sql, ", retryTimes:", 10) - fmt.Println("exec sql failed") - errorNum++ -} - -func writeData(wg *sync.WaitGroup, tbIndex int) { - defer wg.Done() - client := &http.Client{} - - tbName := fmt.Sprintf("t%d", tbIndex) - - for j := 0; j < config.LoopNum; j++ { - tmVal := fmt.Sprintf("%d", int64(j)*int64(10000) + config.DataBegin) - //fmt.Println(tmVal) - - req1 := strings.Replace(template, "panshi-gsl", tbName, -1) - req2 := strings.Replace(req1, "1536750390000", tmVal, -1) - - //fmt.Println(req2) - exec(client, req2) - } -} - -func main() { - filename := flag.String("config", "telegraf.json", "config file name") - - flag.Parse() - - readReq("telegraf.req") - - readConf(*filename) - - fmt.Println("\n================telegraf test start======================") - - var wg sync.WaitGroup - - for i := 0; i < config.MachineNum; i++ { - wg.Add(1) - go writeData(&wg, i) - } - - wg.Wait() - - fmt.Println("\n================telegraf test stop ======================") - - requestAvg := float64(period) / float64(1000000) / float64(request) - qps := float64(1000) / float64(requestAvg) * float64(config.MachineNum) - dps := qps * float64(22) - fmt.Println("====== req:", request, ", error:", errorNum, ", qps:", int64(qps), ", wait:", int64(requestAvg), "ms", ", data per second:", int64(dps)) -} diff --git a/tests/script/general/http/telegraf_help.txt b/tests/script/general/http/telegraf_help.txt deleted file mode 100644 index a2e6d6e49c..0000000000 --- a/tests/script/general/http/telegraf_help.txt +++ /dev/null @@ -1,24 +0,0 @@ -1.编译 -将main.go编译成可执行文件,telegrafTest -2.执行 -./telegrafTest -3.参数 telegraf.json的配置文件 - hostIp TDengine机器IP地址 - machineNum 模拟的机器数量 - loopNum 每个机器发送请求的次数 - dbName 创建的数据库名称 - dataBegin 生成模拟数据的开始时间戳 -4.telegraf.req(通常不变) - 1)替换panshi-gsl和1536750380000这两个字符串,生成http请求 - 2)通过http发送给TDengine -5.注意 - 1)修改配置文件/etc/taos/taos.cfg - httpDebugFlag 设置为131(131-httpDebug,135-httpDebug) - httpMaxThreads 按照机器情况设置,设置范围为(1-cpu cores) - httpCacheSessions 设置为可能的http连接的2倍 - maxVnodeConnections 设置为100000 - maxMeterConnections 设置为100000 - maxShellConns 设置为100000 - maxMgmtConnections 设置为100000 - 2)设置linux参数,例如 - ulimit -n 600000 \ No newline at end of file diff --git a/tests/script/general/http/testSuite.sim b/tests/script/general/http/testSuite.sim deleted file mode 100644 index f35362bf07..0000000000 --- a/tests/script/general/http/testSuite.sim +++ /dev/null @@ -1,10 +0,0 @@ -run general/http/autocreate.sim -run general/http/chunked.sim -run general/http/restful.sim -run general/http/restful_insert.sim -run general/http/restful_limit.sim -run general/http/restful_full.sim -run general/http/prepare.sim -run general/http/telegraf.sim -run general/http/grafana_bug.sim -run general/http/grafana.sim diff --git a/tests/script/general/table/basic1.sim b/tests/script/general/table/basic1.sim index ded8d79a3f..5892a81f2e 100644 --- a/tests/script/general/table/basic1.sim +++ b/tests/script/general/table/basic1.sim @@ -23,6 +23,26 @@ endi print $data00 $data01 $data02 +sql create table st2 (ts timestamp, i float) tags (j bigint) +sql show stables +if $rows != 2 then + return -1 +endi + +print $data00 $data01 $data02 +print $data10 $data11 $data12 + +sql drop table st2 + +sql show stables +if $rows != 1 then + return -1 +endi + +print --> +print $data00 $data01 $data02 +print $data10 $data11 $data12 + return print =============== create child table diff --git a/tests/script/general/user/testSuite.sim b/tests/script/general/user/testSuite.sim deleted file mode 100644 index b4bf52cfd1..0000000000 --- a/tests/script/general/user/testSuite.sim +++ /dev/null @@ -1,6 +0,0 @@ -run general/user/basic1.sim -run general/user/monitor.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 \ No newline at end of file diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt index 1cc15f731d..f960abb4e0 100644 --- a/tests/script/jenkins/basic.txt +++ b/tests/script/jenkins/basic.txt @@ -7,5 +7,10 @@ # ---- db ./test.sh -f general/db/basic1.sim +# ---- table +./test.sh -f general/table/basic1.sim + +# ---- dnode +./test.sh -f unique/dnode/basic1.sim #======================b1-end=============== diff --git a/tests/script/jenkins/simple.txt b/tests/script/jenkins/simple.txt deleted file mode 100644 index 88ff4d6601..0000000000 --- a/tests/script/jenkins/simple.txt +++ /dev/null @@ -1,231 +0,0 @@ -cd ../../../debug; cmake .. -cd ../../../debug; make - -#./test.sh -f general/alter/cached_schema_after_alter.sim -./test.sh -f general/alter/count.sim -./test.sh -f general/alter/import.sim -#./test.sh -f general/alter/insert1.sim -./test.sh -f general/alter/insert2.sim -./test.sh -f general/alter/metrics.sim -./test.sh -f general/alter/table.sim - -./test.sh -f general/cache/new_metrics.sim -./test.sh -f general/cache/restart_metrics.sim -./test.sh -f general/cache/restart_table.sim - -./test.sh -f general/connection/connection.sim - -./test.sh -f general/column/commit.sim -./test.sh -f general/column/metrics.sim -./test.sh -f general/column/table.sim - -./test.sh -f general/compress/commitlog.sim -./test.sh -f general/compress/compress.sim -./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/bottom.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/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/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/top.sim - -./test.sh -f general/db/alter_option.sim -./test.sh -f general/db/alter_tables_d2.sim -./test.sh -f general/db/alter_tables_v1.sim -./test.sh -f general/db/alter_tables_v4.sim -./test.sh -f general/db/alter_vgroups.sim -./test.sh -f general/db/basic.sim -./test.sh -f general/db/basic1.sim -./test.sh -f general/db/basic2.sim -./test.sh -f general/db/basic3.sim -./test.sh -f general/db/basic4.sim -./test.sh -f general/db/basic5.sim -./test.sh -f general/db/delete_reuse1.sim -./test.sh -f general/db/delete_reuse2.sim -./test.sh -f general/db/delete_reusevnode.sim -./test.sh -f general/db/delete_reusevnode2.sim -./test.sh -f general/db/delete_writing1.sim -./test.sh -f general/db/delete_writing2.sim -./test.sh -f general/db/delete.sim -./test.sh -f general/db/len.sim -./test.sh -f general/db/repeat.sim -./test.sh -f general/db/tables.sim -./test.sh -f general/db/vnodes.sim - -./test.sh -f general/field/2.sim -./test.sh -f general/field/3.sim -./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/binary.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/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/prepare.sim -./test.sh -f general/http/telegraf.sim -./test.sh -f general/http/grafana_bug.sim -./test.sh -f general/http/grafana.sim - -./test.sh -f general/import/basic.sim -./test.sh -f general/import/commit.sim -./test.sh -f general/import/large.sim -./test.sh -f general/import/replica1.sim - -./test.sh -f general/insert/basic.sim -./test.sh -f general/insert/insert_drop.sim -./test.sh -f general/insert/query_block1_memory.sim -./test.sh -f general/insert/query_block2_memory.sim -./test.sh -f general/insert/query_block1_file.sim -./test.sh -f general/insert/query_block2_file.sim -./test.sh -f general/insert/query_file_memory.sim -./test.sh -f general/insert/query_multi_file.sim -./test.sh -f general/insert/tcp.sim - -./test.sh -f general/parser/alter.sim -./test.sh -f general/parser/alter1.sim -./test.sh -f general/parser/alter_stable.sim -./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/col_arithmetic_operation.sim -./test.sh -f general/parser/columnValue.sim -./test.sh -f general/parser/commit.sim -./test.sh -f general/parser/create_db.sim -./test.sh -f general/parser/create_mt.sim -./test.sh -f general/parser/create_tb.sim -./test.sh -f general/parser/dbtbnameValidate.sim -./test.sh -f general/parser/import_commit1.sim -./test.sh -f general/parser/import_commit2.sim -./test.sh -f general/parser/import_commit3.sim -./test.sh -f general/parser/insert_tb.sim -./test.sh -f general/parser/first_last.sim -#./test.sh -f general/parser/import_file.sim -./test.sh -f general/parser/lastrow.sim -./test.sh -f general/parser/nchar.sim -./test.sh -f general/parser/null_char.sim -./test.sh -f general/parser/single_row_in_tb.sim -./test.sh -f general/parser/select_from_cache_disk.sim -./test.sh -f general/parser/mixed_blocks.sim -./test.sh -f general/parser/selectResNum.sim -./test.sh -f general/parser/limit.sim -./test.sh -f general/parser/limit1.sim -./test.sh -f general/parser/limit1_tblocks100.sim -./test.sh -f general/parser/select_across_vnodes.sim -./test.sh -f general/parser/slimit1.sim -./test.sh -f general/parser/tbnameIn.sim -./test.sh -f general/parser/projection_limit_offset.sim -./test.sh -f general/parser/limit2.sim -./test.sh -f general/parser/fill.sim -./test.sh -f general/parser/fill_stb.sim -./test.sh -f general/parser/where.sim -./test.sh -f general/parser/slimit.sim -./test.sh -f general/parser/select_with_tags.sim -./test.sh -f general/parser/interp.sim -./test.sh -f general/parser/tags_dynamically_specifiy.sim -./test.sh -f general/parser/groupby.sim -./test.sh -f general/parser/set_tag_vals.sim -#./test.sh -f general/parser/slimit_alter_tags.sim -./test.sh -f general/parser/join.sim -./test.sh -f general/parser/join_multivnode.sim -./test.sh -f general/parser/binary_escapeCharacter.sim -./test.sh -f general/parser/bug.sim -./test.sh -f general/parser/repeatAlter.sim - -./test.sh -f general/stable/disk.sim -./test.sh -f general/stable/dnode3.sim -./test.sh -f general/stable/metrics.sim -./test.sh -f general/stable/refcount.sim -./test.sh -f general/stable/show.sim -./test.sh -f general/stable/values.sim -./test.sh -f general/stable/vnode3.sim - -./test.sh -f general/table/autocreate.sim -./test.sh -f general/table/basic1.sim -./test.sh -f general/table/basic2.sim -./test.sh -f general/table/basic3.sim -./test.sh -f general/table/bigint.sim -./test.sh -f general/table/binary.sim -./test.sh -f general/table/bool.sim -./test.sh -f general/table/column_name.sim -./test.sh -f general/table/column_num.sim -./test.sh -f general/table/column_value.sim -./test.sh -f general/table/column2.sim -./test.sh -f general/table/date.sim -./test.sh -f general/table/db.table.sim -./test.sh -f general/table/delete_reuse1.sim -./test.sh -f general/table/delete_reuse2.sim -./test.sh -f general/table/delete_writing.sim -./test.sh -f general/table/describe.sim -./test.sh -f general/table/double.sim -./test.sh -f general/table/fill.sim -./test.sh -f general/table/float.sim -./test.sh -f general/table/int.sim -./test.sh -f general/table/limit.sim -./test.sh -f general/table/smallint.sim -./test.sh -f general/table/table_len.sim -./test.sh -f general/table/table.sim -./test.sh -f general/table/tinyint.sim -./test.sh -f general/table/vgroup.sim - -./test.sh -f general/tag/3.sim -./test.sh -f general/tag/4.sim -./test.sh -f general/tag/5.sim -./test.sh -f general/tag/6.sim -./test.sh -f general/tag/add.sim -./test.sh -f general/tag/bigint.sim -./test.sh -f general/tag/binary_binary.sim -./test.sh -f general/tag/binary.sim -./test.sh -f general/tag/bool_binary.sim -./test.sh -f general/tag/bool_int.sim -./test.sh -f general/tag/bool.sim -./test.sh -f general/tag/change.sim -./test.sh -f general/tag/column.sim -#./test.sh -f general/tag/commit.sim -./test.sh -f general/tag/create.sim -./test.sh -f general/tag/delete.sim -./test.sh -f general/tag/double.sim -./test.sh -f general/tag/filter.sim -./test.sh -f general/tag/float.sim -./test.sh -f general/tag/int_binary.sim -./test.sh -f general/tag/int_float.sim -./test.sh -f general/tag/int.sim -./test.sh -f general/tag/set.sim -./test.sh -f general/tag/smallint.sim -./test.sh -f general/tag/tinyint.sim - -./test.sh -f general/user/authority.sim -./test.sh -f general/user/monitor.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_len.sim - -./test.sh -f general/vector/metrics_field.sim -./test.sh -f general/vector/metrics_mix.sim -./test.sh -f general/vector/metrics_query.sim -./test.sh -f general/vector/metrics_tag.sim -./test.sh -f general/vector/metrics_time.sim -./test.sh -f general/vector/multi.sim -./test.sh -f general/vector/single.sim -./test.sh -f general/vector/table_field.sim -./test.sh -f general/vector/table_mix.sim -./test.sh -f general/vector/table_query.sim -./test.sh -f general/vector/table_time.sim diff --git a/tests/script/jenkins/unique.txt b/tests/script/jenkins/unique.txt deleted file mode 100644 index 372bdc9d9d..0000000000 --- a/tests/script/jenkins/unique.txt +++ /dev/null @@ -1,127 +0,0 @@ -cd ../../../debug; cmake .. -cd ../../../debug; make - -./test.sh -f unique/big/balance.sim -./test.sh -f unique/big/maxvnodes.sim -./test.sh -f unique/big/tcp.sim - -./test.sh -f unique/cluster/alter.sim -./test.sh -f unique/cluster/balance1.sim -./test.sh -f unique/cluster/balance2.sim -./test.sh -f unique/cluster/balance3.sim -./test.sh -f unique/cluster/cache.sim -./test.sh -f unique/cluster/vgroup100.sim - -./test.sh -f unique/column/replica3.sim - -./test.sh -f unique/db/commit.sim -./test.sh -f unique/db/delete.sim -./test.sh -f unique/db/delete_part.sim -./test.sh -f unique/db/replica_add12.sim -./test.sh -f unique/db/replica_add13.sim -./test.sh -f unique/db/replica_add23.sim -./test.sh -f unique/db/replica_reduce21.sim -./test.sh -f unique/db/replica_reduce32.sim -./test.sh -f unique/db/replica_reduce31.sim -./test.sh -f unique/db/replica_part.sim - -./test.sh -f unique/dnode/alternativeRole.sim -./test.sh -f unique/dnode/monitor.sim -./test.sh -f unique/dnode/monitor_bug.sim -./test.sh -f unique/dnode/simple.sim -./test.sh -f unique/dnode/balance1.sim -./test.sh -f unique/dnode/balance2.sim -./test.sh -f unique/dnode/balance3.sim -./test.sh -f unique/dnode/balancex.sim -./test.sh -f unique/dnode/data1.sim -./test.sh -f unique/dnode/m2.sim -./test.sh -f unique/dnode/m3.sim -./test.sh -f unique/dnode/lossdata.sim -./test.sh -f unique/dnode/offline1.sim -./test.sh -f unique/dnode/offline2.sim -./test.sh -f unique/dnode/offline3.sim -./test.sh -f unique/dnode/reason.sim -./test.sh -f unique/dnode/remove1.sim -./test.sh -f unique/dnode/remove2.sim -./test.sh -f unique/dnode/vnode_clean.sim - -./test.sh -f unique/http/admin.sim -./test.sh -f unique/http/opentsdb.sim - -./test.sh -f unique/import/replica2.sim -./test.sh -f unique/import/replica3.sim - -./test.sh -f unique/stable/balance_replica1.sim -./test.sh -f unique/stable/dnode2_stop.sim -./test.sh -f unique/stable/dnode2.sim -./test.sh -f unique/stable/dnode3.sim -./test.sh -f unique/stable/replica2_dnode4.sim -./test.sh -f unique/stable/replica2_vnode3.sim -./test.sh -f unique/stable/replica3_dnode6.sim -./test.sh -f unique/stable/replica3_vnode3.sim - -./test.sh -f unique/mnode/mgmt20.sim -./test.sh -f unique/mnode/mgmt21.sim -./test.sh -f unique/mnode/mgmt22.sim -./test.sh -f unique/mnode/mgmt23.sim -./test.sh -f unique/mnode/mgmt24.sim -./test.sh -f unique/mnode/mgmt25.sim -./test.sh -f unique/mnode/mgmt26.sim -./test.sh -f unique/mnode/mgmt30.sim -./test.sh -f unique/mnode/mgmt33.sim -./test.sh -f unique/mnode/mgmt34.sim -./test.sh -f unique/mnode/mgmtr2.sim - -./test.sh -f unique/vnode/many.sim -./test.sh -f unique/vnode/replica2_basic2.sim -./test.sh -f unique/vnode/replica2_repeat.sim -./test.sh -f unique/vnode/replica3_basic.sim -./test.sh -f unique/vnode/replica3_repeat.sim -./test.sh -f unique/vnode/replica3_vgroup.sim - -./test.sh -f unique/arbitrator/check_cluster_cfg_para.sim -#./test.sh -f unique/arbitrator/dn2_mn1_cache_file_sync.sim -./test.sh -f unique/arbitrator/dn3_mn1_full_createTableFail.sim -./test.sh -f unique/arbitrator/dn3_mn1_multiCreateDropTable.sim -#./test.sh -f unique/arbitrator/dn3_mn1_nw_disable_timeout_autoDropDnode.sim -#./test.sh -f unique/arbitrator/dn3_mn1_replica2_wal1_AddDelDnode.sim -./test.sh -f unique/arbitrator/dn3_mn1_replica_change_dropDnod.sim -./test.sh -f unique/arbitrator/dn3_mn1_replica_change.sim -#./test.sh -f unique/arbitrator/dn3_mn1_stopDnode_timeout.sim -# lower the priority while file corruption -#./test.sh -f unique/arbitrator/dn3_mn1_vnode_change.sim -#./test.sh -f unique/arbitrator/dn3_mn1_vnode_corruptFile_offline.sim -#./test.sh -f unique/arbitrator/dn3_mn1_vnode_corruptFile_online.sim -#./test.sh -f unique/arbitrator/dn3_mn1_vnode_createErrData_online.sim -./test.sh -f unique/arbitrator/dn3_mn1_vnode_noCorruptFile_offline.sim -./test.sh -f unique/arbitrator/dn3_mn1_vnode_delDir.sim -./test.sh -f unique/arbitrator/dn3_mn1_r2_vnode_delDir.sim -./test.sh -f unique/arbitrator/dn3_mn1_r3_vnode_delDir.sim -./test.sh -f unique/arbitrator/dn3_mn1_vnode_nomaster.sim -./test.sh -f unique/arbitrator/dn3_mn2_killDnode.sim -./test.sh -f unique/arbitrator/insert_duplicationTs.sim -./test.sh -f unique/arbitrator/offline_replica2_alterTable_online.sim -./test.sh -f unique/arbitrator/offline_replica2_alterTag_online.sim -./test.sh -f unique/arbitrator/offline_replica2_createTable_online.sim -./test.sh -f unique/arbitrator/offline_replica2_dropDb_online.sim -./test.sh -f unique/arbitrator/offline_replica2_dropTable_online.sim -./test.sh -f unique/arbitrator/offline_replica3_alterTable_online.sim -./test.sh -f unique/arbitrator/offline_replica3_alterTag_online.sim -./test.sh -f unique/arbitrator/offline_replica3_createTable_online.sim -./test.sh -f unique/arbitrator/offline_replica3_dropDb_online.sim -./test.sh -f unique/arbitrator/offline_replica3_dropTable_online.sim -./test.sh -f unique/arbitrator/replica_changeWithArbitrator.sim -./test.sh -f unique/arbitrator/sync_replica2_alterTable_add.sim -./test.sh -f unique/arbitrator/sync_replica2_alterTable_drop.sim - -./test.sh -f unique/arbitrator/sync_replica2_dropDb.sim -./test.sh -f unique/arbitrator/sync_replica2_dropTable.sim -./test.sh -f unique/arbitrator/sync_replica3_alterTable_add.sim -./test.sh -f unique/arbitrator/sync_replica3_alterTable_drop.sim -./test.sh -f unique/arbitrator/sync_replica3_dropDb.sim -./test.sh -f unique/arbitrator/sync_replica3_dropTable.sim - -./test.sh -f unique/migrate/mn2_vn2_repl2_rmMnodeDir.sim -./test.sh -f unique/migrate/mn2_vn2_repl2_rmMnodeVnodeDir.sim -./test.sh -f unique/migrate/mn2_vn2_repl2_rmMnodeVnodeDir_stopAll_starAll.sim -./test.sh -f unique/migrate/mn2_vn2_repl2_rmVnodeDir.sim diff --git a/tests/script/jenkins/wbasic.txt b/tests/script/jenkins/wbasic.txt deleted file mode 100644 index 984b15fc5a..0000000000 --- a/tests/script/jenkins/wbasic.txt +++ /dev/null @@ -1,393 +0,0 @@ -wtest.bat -f issue/TD-2677.sim -wtest.bat -f issue/TD-2680.sim -wtest.bat -f issue/TD-2713.sim - -wtest.bat -f general/alter/cached_schema_after_alter.sim -wtest.bat -f general/alter/count.sim -wtest.bat -f general/alter/dnode.sim -wtest.bat -f general/alter/import.sim -wtest.bat -f general/alter/insert1.sim -wtest.bat -f general/alter/insert2.sim -wtest.bat -f general/alter/metrics.sim -wtest.bat -f general/alter/table.sim - -wtest.bat -f general/cache/new_metrics.sim -wtest.bat -f general/cache/restart_metrics.sim -wtest.bat -f general/cache/restart_table.sim - -wtest.bat -f general/connection/connection.sim - -wtest.bat -f general/column/commit.sim -wtest.bat -f general/column/metrics.sim -wtest.bat -f general/column/table.sim - -wtest.bat -f general/compress/commitlog.sim -wtest.bat -f general/compress/compress.sim -wtest.bat -f general/compress/compress2.sim -wtest.bat -f general/compress/uncompress.sim - -wtest.bat -f general/compute/avg.sim -wtest.bat -f general/compute/bottom.sim -wtest.bat -f general/compute/count.sim -wtest.bat -f general/compute/diff.sim -wtest.bat -f general/compute/diff2.sim -wtest.bat -f general/compute/first.sim -wtest.bat -f general/compute/interval.sim -wtest.bat -f general/compute/last.sim -wtest.bat -f general/compute/leastsquare.sim -wtest.bat -f general/compute/max.sim -wtest.bat -f general/compute/min.sim -wtest.bat -f general/compute/null.sim -wtest.bat -f general/compute/percentile.sim -wtest.bat -f general/compute/stddev.sim -wtest.bat -f general/compute/sum.sim -wtest.bat -f general/compute/top.sim - -wtest.bat -f general/db/alter_option.sim -wtest.bat -f general/db/alter_tables_d2.sim -wtest.bat -f general/db/alter_tables_v1.sim -wtest.bat -f general/db/alter_tables_v4.sim -wtest.bat -f general/db/alter_vgroups.sim -wtest.bat -f general/db/basic.sim -wtest.bat -f general/db/basic1.sim -wtest.bat -f general/db/basic2.sim -wtest.bat -f general/db/basic3.sim -wtest.bat -f general/db/basic4.sim -wtest.bat -f general/db/basic5.sim -wtest.bat -f general/db/delete_reuse1.sim -wtest.bat -f general/db/delete_reuse2.sim -wtest.bat -f general/db/delete_reusevnode.sim -wtest.bat -f general/db/delete_reusevnode2.sim -wtest.bat -f general/db/delete_writing1.sim -wtest.bat -f general/db/delete_writing2.sim -wtest.bat -f general/db/delete.sim -wtest.bat -f general/db/len.sim -wtest.bat -f general/db/repeat.sim -wtest.bat -f general/db/tables.sim -wtest.bat -f general/db/vnodes.sim -wtest.bat -f general/db/nosuchfile.sim - -wtest.bat -f general/field/2.sim -wtest.bat -f general/field/3.sim -wtest.bat -f general/field/4.sim -wtest.bat -f general/field/5.sim -wtest.bat -f general/field/6.sim -wtest.bat -f general/field/bigint.sim -wtest.bat -f general/field/binary.sim -wtest.bat -f general/field/bool.sim -wtest.bat -f general/field/single.sim -wtest.bat -f general/field/smallint.sim -wtest.bat -f general/field/tinyint.sim - -wtest.bat -f general/http/autocreate.sim -wtest.bat -f general/http/chunked.sim -wtest.bat -f general/http/gzip.sim -wtest.bat -f general/http/restful.sim -wtest.bat -f general/http/restful_insert.sim -wtest.bat -f general/http/restful_limit.sim -wtest.bat -f general/http/restful_full.sim -wtest.bat -f general/http/prepare.sim -wtest.bat -f general/http/telegraf.sim -wtest.bat -f general/http/grafana_bug.sim -wtest.bat -f general/http/grafana.sim - -wtest.bat -f general/import/basic.sim -wtest.bat -f general/import/commit.sim -wtest.bat -f general/import/large.sim -wtest.bat -f general/import/replica1.sim - -wtest.bat -f general/insert/basic.sim -wtest.bat -f general/insert/insert_drop.sim -wtest.bat -f general/insert/query_block1_memory.sim -wtest.bat -f general/insert/query_block2_memory.sim -wtest.bat -f general/insert/query_block1_file.sim -wtest.bat -f general/insert/query_block2_file.sim -wtest.bat -f general/insert/query_file_memory.sim -wtest.bat -f general/insert/query_multi_file.sim -wtest.bat -f general/insert/tcp.sim - -wtest.bat -f general/parser/alter.sim -wtest.bat -f general/parser/alter1.sim -wtest.bat -f general/parser/alter_stable.sim -wtest.bat -f general/parser/auto_create_tb.sim -wtest.bat -f general/parser/auto_create_tb_drop_tb.sim -wtest.bat -f general/parser/col_arithmetic_operation.sim -wtest.bat -f general/parser/columnValue.sim -wtest.bat -f general/parser/commit.sim -wtest.bat -f general/parser/create_db.sim -wtest.bat -f general/parser/create_mt.sim -wtest.bat -f general/parser/create_tb.sim -wtest.bat -f general/parser/dbtbnameValidate.sim -wtest.bat -f general/parser/import_commit1.sim -wtest.bat -f general/parser/import_commit2.sim -wtest.bat -f general/parser/import_commit3.sim -wtest.bat -f general/parser/insert_tb.sim -wtest.bat -f general/parser/first_last.sim -wtest.bat -f general/parser/lastrow.sim -wtest.bat -f general/parser/nchar.sim -wtest.bat -f general/parser/null_char.sim -wtest.bat -f general/parser/single_row_in_tb.sim -wtest.bat -f general/parser/select_from_cache_disk.sim -wtest.bat -f general/parser/mixed_blocks.sim -wtest.bat -f general/parser/selectResNum.sim -wtest.bat -f general/parser/limit.sim -wtest.bat -f general/parser/limit1.sim -wtest.bat -f general/parser/limit1_tblocks100.sim -wtest.bat -f general/parser/select_across_vnodes.sim -wtest.bat -f general/parser/slimit1.sim -wtest.bat -f general/parser/tbnameIn.sim -wtest.bat -f general/parser/projection_limit_offset.sim -wtest.bat -f general/parser/limit2.sim -wtest.bat -f general/parser/fill.sim -wtest.bat -f general/parser/fill_stb.sim -wtest.bat -f general/parser/where.sim -wtest.bat -f general/parser/slimit.sim -wtest.bat -f general/parser/select_with_tags.sim -wtest.bat -f general/parser/interp.sim -wtest.bat -f general/parser/tags_dynamically_specifiy.sim -wtest.bat -f general/parser/groupby.sim -wtest.bat -f general/parser/set_tag_vals.sim -wtest.bat -f general/parser/tags_filter.sim -wtest.bat -f general/parser/slimit_alter_tags.sim -wtest.bat -f general/parser/join.sim -wtest.bat -f general/parser/join_multivnode.sim -wtest.bat -f general/parser/binary_escapeCharacter.sim -wtest.bat -f general/parser/repeatAlter.sim -wtest.bat -f general/parser/union.sim -wtest.bat -f general/parser/topbot.sim -wtest.bat -f general/parser/function.sim - -wtest.bat -f general/stable/disk.sim -wtest.bat -f general/stable/dnode3.sim -wtest.bat -f general/stable/metrics.sim -wtest.bat -f general/stable/refcount.sim -wtest.bat -f general/stable/show.sim -wtest.bat -f general/stable/values.sim -wtest.bat -f general/stable/vnode3.sim - -wtest.bat -f general/table/autocreate.sim -wtest.bat -f general/table/basic1.sim -wtest.bat -f general/table/basic2.sim -wtest.bat -f general/table/basic3.sim -wtest.bat -f general/table/bigint.sim -wtest.bat -f general/table/binary.sim -wtest.bat -f general/table/bool.sim -wtest.bat -f general/table/column_name.sim -wtest.bat -f general/table/column_num.sim -wtest.bat -f general/table/column_value.sim -wtest.bat -f general/table/column2.sim -wtest.bat -f general/table/date.sim -wtest.bat -f general/table/db.table.sim -wtest.bat -f general/table/delete_reuse1.sim -wtest.bat -f general/table/delete_reuse2.sim -wtest.bat -f general/table/delete_writing.sim -wtest.bat -f general/table/describe.sim -wtest.bat -f general/table/double.sim -wtest.bat -f general/table/fill.sim -wtest.bat -f general/table/float.sim -wtest.bat -f general/table/int.sim -wtest.bat -f general/table/limit.sim -wtest.bat -f general/table/smallint.sim -wtest.bat -f general/table/table_len.sim -wtest.bat -f general/table/table.sim -wtest.bat -f general/table/tinyint.sim -wtest.bat -f general/table/vgroup.sim - -wtest.bat -f general/tag/3.sim -wtest.bat -f general/tag/4.sim -wtest.bat -f general/tag/5.sim -wtest.bat -f general/tag/6.sim -wtest.bat -f general/tag/add.sim -wtest.bat -f general/tag/bigint.sim -wtest.bat -f general/tag/binary_binary.sim -wtest.bat -f general/tag/binary.sim -wtest.bat -f general/tag/bool_binary.sim -wtest.bat -f general/tag/bool_int.sim -wtest.bat -f general/tag/bool.sim -wtest.bat -f general/tag/change.sim -wtest.bat -f general/tag/column.sim -wtest.bat -f general/tag/commit.sim -wtest.bat -f general/tag/create.sim -wtest.bat -f general/tag/delete.sim -wtest.bat -f general/tag/double.sim -wtest.bat -f general/tag/filter.sim -wtest.bat -f general/tag/float.sim -wtest.bat -f general/tag/int_binary.sim -wtest.bat -f general/tag/int_float.sim -wtest.bat -f general/tag/int.sim -wtest.bat -f general/tag/set.sim -wtest.bat -f general/tag/smallint.sim -wtest.bat -f general/tag/tinyint.sim - -wtest.bat -f general/user/authority.sim -wtest.bat -f general/user/monitor.sim -wtest.bat -f general/user/pass_alter.sim -wtest.bat -f general/user/pass_len.sim -wtest.bat -f general/user/user_create.sim -wtest.bat -f general/user/user_len.sim - -wtest.bat -f general/vector/metrics_field.sim -wtest.bat -f general/vector/metrics_mix.sim -wtest.bat -f general/vector/metrics_query.sim -wtest.bat -f general/vector/metrics_tag.sim -wtest.bat -f general/vector/metrics_time.sim -wtest.bat -f general/vector/multi.sim -wtest.bat -f general/vector/single.sim -wtest.bat -f general/vector/table_field.sim -wtest.bat -f general/vector/table_mix.sim -wtest.bat -f general/vector/table_query.sim -wtest.bat -f general/vector/table_time.sim - -wtest.bat -f general/wal/sync.sim -wtest.bat -f general/wal/kill.sim -wtest.bat -f general/wal/maxtables.sim - -wtest.bat -f unique/account/account_create.sim -wtest.bat -f unique/account/account_delete.sim -wtest.bat -f unique/account/account_len.sim -wtest.bat -f unique/account/authority.sim -wtest.bat -f unique/account/basic.sim -wtest.bat -f unique/account/paras.sim -wtest.bat -f unique/account/pass_alter.sim -wtest.bat -f unique/account/pass_len.sim -wtest.bat -f unique/account/usage.sim -wtest.bat -f unique/account/user_create.sim -wtest.bat -f unique/account/user_len.sim - -wtest.bat -f unique/big/balance.sim -wtest.bat -f unique/big/maxvnodes.sim -wtest.bat -f unique/big/tcp.sim - -wtest.bat -f unique/cluster/alter.sim -wtest.bat -f unique/cluster/balance1.sim -wtest.bat -f unique/cluster/balance2.sim -wtest.bat -f unique/cluster/balance3.sim -wtest.bat -f unique/cluster/cache.sim -wtest.bat -f unique/cluster/vgroup100.sim - -wtest.bat -f unique/column/replica3.sim - -wtest.bat -f unique/db/commit.sim -wtest.bat -f unique/db/delete.sim -wtest.bat -f unique/db/delete_part.sim -wtest.bat -f unique/db/replica_add12.sim -wtest.bat -f unique/db/replica_add13.sim -wtest.bat -f unique/db/replica_add23.sim -wtest.bat -f unique/db/replica_reduce21.sim -wtest.bat -f unique/db/replica_reduce32.sim -wtest.bat -f unique/db/replica_reduce31.sim -wtest.bat -f unique/db/replica_part.sim - -wtest.bat -f unique/dnode/alternativeRole.sim -wtest.bat -f unique/dnode/monitor.sim -wtest.bat -f unique/dnode/monitor_bug.sim -wtest.bat -f unique/dnode/simple.sim -wtest.bat -f unique/dnode/balance1.sim -wtest.bat -f unique/dnode/balance2.sim -wtest.bat -f unique/dnode/balance3.sim -wtest.bat -f unique/dnode/balancex.sim -wtest.bat -f unique/dnode/data1.sim -wtest.bat -f unique/dnode/m2.sim -wtest.bat -f unique/dnode/m3.sim -wtest.bat -f unique/dnode/lossdata.sim -wtest.bat -f unique/dnode/offline1.sim -wtest.bat -f unique/dnode/offline2.sim -wtest.bat -f unique/dnode/offline3.sim -wtest.bat -f unique/dnode/reason.sim -wtest.bat -f unique/dnode/remove1.sim -wtest.bat -f unique/dnode/remove2.sim -wtest.bat -f unique/dnode/vnode_clean.sim - -wtest.bat -f unique/http/admin.sim -wtest.bat -f unique/http/opentsdb.sim - -wtest.bat -f unique/import/replica2.sim -wtest.bat -f unique/import/replica3.sim - -wtest.bat -f unique/stable/balance_replica1.sim -wtest.bat -f unique/stable/dnode2_stop.sim -wtest.bat -f unique/stable/dnode2.sim -wtest.bat -f unique/stable/dnode3.sim -wtest.bat -f unique/stable/replica2_dnode4.sim -wtest.bat -f unique/stable/replica2_vnode3.sim -wtest.bat -f unique/stable/replica3_dnode6.sim -wtest.bat -f unique/stable/replica3_vnode3.sim - -wtest.bat -f unique/mnode/mgmt20.sim -wtest.bat -f unique/mnode/mgmt21.sim -wtest.bat -f unique/mnode/mgmt22.sim -wtest.bat -f unique/mnode/mgmt23.sim -wtest.bat -f unique/mnode/mgmt24.sim -wtest.bat -f unique/mnode/mgmt25.sim -wtest.bat -f unique/mnode/mgmt26.sim -wtest.bat -f unique/mnode/mgmt30.sim -wtest.bat -f unique/mnode/mgmt33.sim -wtest.bat -f unique/mnode/mgmt34.sim -wtest.bat -f unique/mnode/mgmtr2.sim - -wtest.bat -f unique/vnode/many.sim -wtest.bat -f unique/vnode/replica2_basic2.sim -wtest.bat -f unique/vnode/replica2_repeat.sim -wtest.bat -f unique/vnode/replica3_basic.sim -wtest.bat -f unique/vnode/replica3_repeat.sim -wtest.bat -f unique/vnode/replica3_vgroup.sim - -wtest.bat -f general/stream/metrics_del.sim -wtest.bat -f general/stream/metrics_replica1_vnoden.sim -wtest.bat -f general/stream/restart_stream.sim -wtest.bat -f general/stream/stream_3.sim -wtest.bat -f general/stream/stream_restart.sim -wtest.bat -f general/stream/table_del.sim -wtest.bat -f general/stream/table_replica1_vnoden.sim - -wtest.bat -f unique/arbitrator/check_cluster_cfg_para.sim -#wtest.bat -f unique/arbitrator/dn2_mn1_cache_file_sync.sim -wtest.bat -f unique/arbitrator/dn3_mn1_full_createTableFail.sim -wtest.bat -f unique/arbitrator/dn3_mn1_multiCreateDropTable.sim -#wtest.bat -f unique/arbitrator/dn3_mn1_nw_disable_timeout_autoDropDnode.sim -#wtest.bat -f unique/arbitrator/dn3_mn1_replica2_wal1_AddDelDnode.sim -wtest.bat -f unique/arbitrator/dn3_mn1_replica_change_dropDnod.sim -wtest.bat -f unique/arbitrator/dn3_mn1_replica_change.sim -#wtest.bat -f unique/arbitrator/dn3_mn1_stopDnode_timeout.sim -# lower the priority while file corruption -#wtest.bat -f unique/arbitrator/dn3_mn1_vnode_change.sim -#wtest.bat -f unique/arbitrator/dn3_mn1_vnode_corruptFile_offline.sim -#wtest.bat -f unique/arbitrator/dn3_mn1_vnode_corruptFile_online.sim -#wtest.bat -f unique/arbitrator/dn3_mn1_vnode_createErrData_online.sim -wtest.bat -f unique/arbitrator/dn3_mn1_vnode_noCorruptFile_offline.sim -wtest.bat -f unique/arbitrator/dn3_mn1_vnode_delDir.sim -wtest.bat -f unique/arbitrator/dn3_mn1_r2_vnode_delDir.sim -wtest.bat -f unique/arbitrator/dn3_mn1_r3_vnode_delDir.sim -wtest.bat -f unique/arbitrator/dn3_mn1_vnode_nomaster.sim -wtest.bat -f unique/arbitrator/dn3_mn2_killDnode.sim -wtest.bat -f unique/arbitrator/insert_duplicationTs.sim -wtest.bat -f unique/arbitrator/offline_replica2_alterTable_online.sim -wtest.bat -f unique/arbitrator/offline_replica2_alterTag_online.sim -wtest.bat -f unique/arbitrator/offline_replica2_createTable_online.sim -wtest.bat -f unique/arbitrator/offline_replica2_dropDb_online.sim -wtest.bat -f unique/arbitrator/offline_replica2_dropTable_online.sim -wtest.bat -f unique/arbitrator/offline_replica3_alterTable_online.sim -wtest.bat -f unique/arbitrator/offline_replica3_alterTag_online.sim -wtest.bat -f unique/arbitrator/offline_replica3_createTable_online.sim -wtest.bat -f unique/arbitrator/offline_replica3_dropDb_online.sim -wtest.bat -f unique/arbitrator/offline_replica3_dropTable_online.sim -wtest.bat -f unique/arbitrator/replica_changeWithArbitrator.sim -wtest.bat -f unique/arbitrator/sync_replica2_alterTable_add.sim -wtest.bat -f unique/arbitrator/sync_replica2_alterTable_drop.sim - -wtest.bat -f unique/arbitrator/sync_replica2_dropDb.sim -wtest.bat -f unique/arbitrator/sync_replica2_dropTable.sim -wtest.bat -f unique/arbitrator/sync_replica3_alterTable_add.sim -wtest.bat -f unique/arbitrator/sync_replica3_alterTable_drop.sim -wtest.bat -f unique/arbitrator/sync_replica3_dropDb.sim -wtest.bat -f unique/arbitrator/sync_replica3_dropTable.sim - -wtest.bat -f unique/migrate/mn2_vn2_repl2_rmMnodeDir.sim -wtest.bat -f unique/migrate/mn2_vn2_repl2_rmMnodeVnodeDir.sim -wtest.bat -f unique/migrate/mn2_vn2_repl2_rmMnodeVnodeDir_stopAll_starAll.sim -wtest.bat -f unique/migrate/mn2_vn2_repl2_rmVnodeDir.sim - -wtest.bat -f general/connection/test_old_data.sim -wtest.bat -f unique/dnode/datatrans_3node.sim -wtest.bat -f unique/dnode/datatrans_3node_2.sim - diff --git a/tests/script/sh/deploy.sh b/tests/script/sh/deploy.sh index 03ce1c2888..0ccc85c347 100755 --- a/tests/script/sh/deploy.sh +++ b/tests/script/sh/deploy.sh @@ -118,49 +118,30 @@ fi echo " " >> $TAOS_CFG echo "firstEp ${HOSTNAME}:7100" >> $TAOS_CFG echo "secondEp ${HOSTNAME}:7200" >> $TAOS_CFG +echo "fqdn ${HOSTNAME}" >> $TAOS_CFG echo "serverPort ${NODE}" >> $TAOS_CFG echo "dataDir $DATA_DIR" >> $TAOS_CFG echo "logDir $LOG_DIR" >> $TAOS_CFG echo "debugFlag 0" >> $TAOS_CFG echo "mDebugFlag 143" >> $TAOS_CFG -echo "sdbDebugFlag 143" >> $TAOS_CFG echo "dDebugFlag 143" >> $TAOS_CFG echo "vDebugFlag 143" >> $TAOS_CFG echo "tsdbDebugFlag 143" >> $TAOS_CFG echo "cDebugFlag 143" >> $TAOS_CFG echo "jnidebugFlag 143" >> $TAOS_CFG -echo "odbcdebugFlag 143" >> $TAOS_CFG -echo "httpDebugFlag 143" >> $TAOS_CFG -echo "monDebugFlag 143" >> $TAOS_CFG -echo "mqttDebugFlag 143" >> $TAOS_CFG echo "qdebugFlag 143" >> $TAOS_CFG echo "rpcDebugFlag 143" >> $TAOS_CFG echo "tmrDebugFlag 131" >> $TAOS_CFG echo "udebugFlag 143" >> $TAOS_CFG echo "sdebugFlag 143" >> $TAOS_CFG echo "wdebugFlag 143" >> $TAOS_CFG -echo "cqdebugFlag 143" >> $TAOS_CFG -echo "monitor 0" >> $TAOS_CFG -echo "monitorInterval 1" >> $TAOS_CFG -echo "http 0" >> $TAOS_CFG echo "slaveQuery 0" >> $TAOS_CFG echo "numOfThreadsPerCore 2.0" >> $TAOS_CFG echo "defaultPass taosdata" >> $TAOS_CFG echo "numOfLogLines 20000000" >> $TAOS_CFG -echo "mnodeEqualVnodeNum 0" >> $TAOS_CFG -echo "balanceInterval 1" >> $TAOS_CFG -echo "clog 2" >> $TAOS_CFG -#echo "cache 1" >> $TAOS_CFG -echo "days 10" >> $TAOS_CFG echo "statusInterval 1" >> $TAOS_CFG -echo "maxVgroupsPerDb 4" >> $TAOS_CFG -echo "minTablesPerVnode 4" >> $TAOS_CFG -echo "maxTablesPerVnode 1000" >> $TAOS_CFG -echo "tableIncStepPerVnode 10000" >> $TAOS_CFG echo "asyncLog 0" >> $TAOS_CFG -echo "numOfMnodes 1" >> $TAOS_CFG echo "locale en_US.UTF-8" >> $TAOS_CFG echo "fsync 0" >> $TAOS_CFG echo "telemetryReporting 0" >> $TAOS_CFG echo " " >> $TAOS_CFG - diff --git a/tests/script/tmp/182.sim b/tests/script/tmp/182.sim deleted file mode 100644 index a178282cf8..0000000000 --- a/tests/script/tmp/182.sim +++ /dev/null @@ -1,41 +0,0 @@ -system sh/stop_dnodes.sh - -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/deploy.sh -n dnode4 -i 4 - -system sh/cfg.sh -n dnode1 -c walLevel -v 2 -system sh/cfg.sh -n dnode2 -c walLevel -v 2 -system sh/cfg.sh -n dnode3 -c walLevel -v 2 -system sh/cfg.sh -n dnode4 -c walLevel -v 2 - -system sh/cfg.sh -n dnode1 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode2 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode3 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode4 -c numOfMnodes -v 1 - -system sh/cfg.sh -n dnode1 -c activeCode -v eglxDLzRpslJWl7OxrPZ2K3sQ5631AP9SVpezsaz2dhJWl7OxrPZ2ElaXs7Gs9nYSVpezsaz2djGIj5StnQ3ZvLHcsE8cwcN - -system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode4 -c mnodeEqualVnodeNum -v 4 - -system sh/cfg.sh -n dnode1 -c maxTablesPerVnode -v 100000 -system sh/cfg.sh -n dnode2 -c maxTablesPerVnode -v 100000 -system sh/cfg.sh -n dnode3 -c maxTablesPerVnode -v 100000 -system sh/cfg.sh -n dnode4 -c maxTablesPerVnode -v 100000 - -system sh/cfg.sh -n dnode1 -c http -v 1 -system sh/cfg.sh -n dnode2 -c http -v 1 -system sh/cfg.sh -n dnode3 -c http -v 1 -system sh/cfg.sh -n dnode4 -c http -v 1 - -system sh/cfg.sh -n dnode1 -c httpMaxThreads -v 4 - -system sh/cfg.sh -n dnode1 -c firstEp -v 127.0.0.1:6030 -system sh/cfg.sh -n dnode1 -c secondEp -v 127.0.0.1:6030 -system sh/cfg.sh -n dnode1 -c serverPort -v 6030 -system sh/cfg.sh -n dnode1 -c fqdn -v 127.0.0.1 -system sh/exec.sh -n dnode1 -s start diff --git a/tests/script/tmp/dnodes.sim b/tests/script/tmp/dnodes.sim new file mode 100644 index 0000000000..f5146620c5 --- /dev/null +++ b/tests/script/tmp/dnodes.sim @@ -0,0 +1,78 @@ +system sh/stop_dnodes.sh + + +############## config parameter ##################### +$node1 = 192.168.101.174 +$node2 = 192.168.0.202 +$node2 = 192.168.0.203 +$node3 = 192.168.0.204 + +$first = 1 +$num = 5 +$self = $node1 + +############### deploy firstEp ##################### + +$firstEp = $node1 . :7100 +$firstPort = 7100 +if $first == 1 then + system sh/deploy.sh -n dnode1 -i 1 + system sh/cfg.sh -n dnode1 -c firstEp -v $firstEp + system sh/cfg.sh -n dnode1 -c secondEp -v $firstEp + system sh/cfg.sh -n dnode1 -c fqdn -v $node1 + system sh/cfg.sh -n dnode1 -c serverPort -v $firstPort + + system sh/exec.sh -n dnode1 -s start + sql connect + + $i = 0 + while $i < $num + $port = $i * 100 + $port = $port + 8000 + $i = $i + 1 + sql create dnode $node1 port $port + endw + + $i = 0 + while $i < $num + $port = $i * 100 + $port = $port + 8000 + $i = $i + 1 + sql create dnode $node2 port $port + endw + + $i = 0 + while $i < $num + $port = $i * 100 + $port = $port + 8000 + $i = $i + 1 + sql create dnode $node3 port $port + endw + + $i = 0 + while $i < $num + $port = $i * 100 + $port = $port + 8000 + $i = $i + 1 + sql create dnode $node4 port $port + endw +endi + +############### deploy nodes ##################### + +$i = 0 +while $i < $num + $index = $i + 80 + $port = $i * 100 + $port = $port + 8000 + $dnodename = dnode . $index + $i = $i + 1 + + system sh/deploy.sh -n $dnodename -i 1 + system sh/cfg.sh -n $dnodename -c firstEp -v $firstEp + system sh/cfg.sh -n $dnodename -c secondEp -v $firstEp + system sh/cfg.sh -n $dnodename -c fqdn -v $self + system sh/cfg.sh -n $dnodename -c serverPort -v $port + + #system sh/exec.sh -n $dnodename -s start +endw diff --git a/tests/script/tmp/http.sim b/tests/script/tmp/http.sim deleted file mode 100644 index a5212905ae..0000000000 --- a/tests/script/tmp/http.sim +++ /dev/null @@ -1,35 +0,0 @@ -system sh/stop_dnodes.sh - -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/deploy.sh -n dnode4 -i 4 - -system sh/cfg.sh -n dnode1 -c walLevel -v 2 -system sh/cfg.sh -n dnode2 -c walLevel -v 2 -system sh/cfg.sh -n dnode3 -c walLevel -v 2 -system sh/cfg.sh -n dnode4 -c walLevel -v 2 - -system sh/cfg.sh -n dnode1 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode2 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode3 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode4 -c numOfMnodes -v 1 - -system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode4 -c mnodeEqualVnodeNum -v 4 - -system sh/cfg.sh -n dnode1 -c http -v 1 -system sh/cfg.sh -n dnode2 -c http -v 1 -system sh/cfg.sh -n dnode3 -c http -v 1 - -system sh/cfg.sh -n dnode1 -c monitor -v 1 -system sh/cfg.sh -n dnode2 -c monitor -v 1 -system sh/cfg.sh -n dnode3 -c monitor -v 1 - -system sh/cfg.sh -n dnode1 -c monitorInterval -v 1 -system sh/cfg.sh -n dnode2 -c monitorInterval -v 1 -system sh/cfg.sh -n dnode3 -c monitorInterval -v 1 - -system sh/exec.sh -n dnode1 -s start \ No newline at end of file diff --git a/tests/script/tmp/mnodes.sim b/tests/script/tmp/mnodes.sim deleted file mode 100644 index 8bca76c38b..0000000000 --- a/tests/script/tmp/mnodes.sim +++ /dev/null @@ -1,115 +0,0 @@ -system sh/stop_dnodes.sh - -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 - -system sh/cfg.sh -n dnode1 -c numOfMnodes -v 3 -system sh/cfg.sh -n dnode2 -c numOfMnodes -v 3 -system sh/cfg.sh -n dnode3 -c numOfMnodes -v 3 - -system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 4 - -system sh/cfg.sh -n dnode1 -c http -v 0 -system sh/cfg.sh -n dnode2 -c http -v 0 -system sh/cfg.sh -n dnode3 -c http -v 0 - -system sh/cfg.sh -n dnode1 -c maxTablesPerVnode -v 20000 -system sh/cfg.sh -n dnode2 -c maxTablesPerVnode -v 20000 -system sh/cfg.sh -n dnode3 -c maxTablesPerVnode -v 20000 - -system sh/cfg.sh -n dnode1 -c minTablesPerVnode -v 1000 -system sh/cfg.sh -n dnode2 -c minTablesPerVnode -v 1000 -system sh/cfg.sh -n dnode3 -c minTablesPerVnode -v 1000 - -system sh/cfg.sh -n dnode1 -c maxVgroupsPerDb -v 20 -system sh/cfg.sh -n dnode2 -c maxVgroupsPerDb -v 20 -system sh/cfg.sh -n dnode3 -c maxVgroupsPerDb -v 20 - -system sh/cfg.sh -n dnode1 -c replica -v 3 -system sh/cfg.sh -n dnode2 -c replica -v 3 -system sh/cfg.sh -n dnode3 -c replica -v 3 - -print ============== deploy - -system sh/exec.sh -n dnode1 -s start -sql connect - -sql create dnode $hostname2 -sql create dnode $hostname3 -system sh/exec.sh -n dnode2 -s start -system sh/exec.sh -n dnode3 -s start - -print =============== step1 -$x = 0 -step1: - $x = $x + 1 - sleep 1000 - if $x == 10 then - return -1 - endi - -sql show dnodes -print dnode1 $data4_1 -print dnode2 $data4_2 -print dnode3 $data4_3 - -if $data4_1 != ready then - goto step1 -endi -if $data4_2 != ready then - goto step1 -endi -if $data4_3 != ready then - goto step1 -endi - -sql show mnodes -$mnode1Role = $data2_1 -print mnode1Role $mnode1Role -$mnode2Role = $data2_2 -print mnode2Role $mnode2Role -$mnode3Role = $data2_3 -print mnode3Role $mnode3Role - -if $mnode1Role != master then - goto step1 -endi -if $mnode2Role != slave then - goto step1 -endi -if $mnode3Role != slave then - goto step1 -endi - -$x = 1 -show2: - -print =============== step $x -sql show mnodes -print $data0_1 $data2_1 - -sql show dnodes -print dnode1 $data4_1 -print dnode2 $data4_2 -print dnode3 $data4_3 - -if $data4_1 != ready then - goto step1 -endi -if $data4_2 != ready then - goto step1 -endi -if $data4_3 != ready then - goto step1 -endi - -$x = $x + 1 -sleep 3000 -if $x == 100000 then - return -1 -endi - -goto show2 diff --git a/tests/script/tmp/prepare.sim b/tests/script/tmp/prepare.sim index 343c422e9f..28675be808 100644 --- a/tests/script/tmp/prepare.sim +++ b/tests/script/tmp/prepare.sim @@ -9,41 +9,3 @@ system sh/cfg.sh -n dnode1 -c walLevel -v 2 system sh/cfg.sh -n dnode2 -c walLevel -v 2 system sh/cfg.sh -n dnode3 -c walLevel -v 2 system sh/cfg.sh -n dnode4 -c walLevel -v 2 - -system sh/cfg.sh -n dnode1 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode2 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode3 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode4 -c numOfMnodes -v 1 - -system sh/cfg.sh -n dnode1 -c activeCode -v eglxDLzRpslJWl7OxrPZ2K3sQ5631AP9SVpezsaz2dhJWl7OxrPZ2ElaXs7Gs9nYSVpezsaz2djGIj5StnQ3ZvLHcsE8cwcN - -system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode4 -c mnodeEqualVnodeNum -v 4 - -system sh/cfg.sh -n dnode1 -c maxTablesPerVnode -v 100000 -system sh/cfg.sh -n dnode2 -c maxTablesPerVnode -v 100000 -system sh/cfg.sh -n dnode3 -c maxTablesPerVnode -v 100000 -system sh/cfg.sh -n dnode4 -c maxTablesPerVnode -v 100000 - -system sh/cfg.sh -n dnode1 -c http -v 1 -system sh/cfg.sh -n dnode2 -c http -v 1 -system sh/cfg.sh -n dnode3 -c http -v 1 -system sh/cfg.sh -n dnode4 -c http -v 1 - -return -# for crash_gen -system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 10 -system sh/cfg.sh -n dnode1 -c rpcMaxTime -v 101 -system sh/cfg.sh -n dnode1 -c cache -v 2 -system sh/cfg.sh -n dnode1 -c keep -v 36500 -system sh/cfg.sh -n dnode1 -c walLevel -v 1 - - -# for windows - -system sh/cfg.sh -n dnode1 -c firstEp -v 152.136.17.116:6030 -system sh/cfg.sh -n dnode1 -c secondEp -v 152.136.17.116:6030 -system sh/cfg.sh -n dnode1 -c serverPort -v 6030 -system sh/cfg.sh -n dnode1 -c fqdn -v 152.136.17.116 diff --git a/tests/script/unique/dnode/basic1.sim b/tests/script/unique/dnode/basic1.sim index 5382e88e53..730864ef26 100644 --- a/tests/script/unique/dnode/basic1.sim +++ b/tests/script/unique/dnode/basic1.sim @@ -15,7 +15,7 @@ if $data00 != 1 then return -1 endi -if $data01 != 192.168.0.1 then +if $data02 != 0 then return -1 endi @@ -28,12 +28,14 @@ if $data00 != 1 then return -1 endi -if $data01 != 192.168.0.1 then +if $data02 != master then return -1 endi print =============== create dnodes -sql create dnode $hostname2 +sql create dnode $hostname port 7200 +sleep 2000 + sql show dnodes; if $rows != 2 then return -1 @@ -43,15 +45,23 @@ if $data00 != 1 then return -1 endi -if $data01 != 192.168.0.1 then - return -1 -endi - if $data10 != 2 then return -1 endi -if $data11 != 192.168.0.2 then +if $data02 != 0 then + return -1 +endi + +if $data12 != 0 then + return -1 +endi + +if $data04 != ready then + return -1 +endi + +if $data14 != ready then return -1 endi @@ -64,27 +74,25 @@ if $data00 != 1 then return -1 endi -if $data01 != 192.168.0.1 then +if $data02 != master then return -1 endi print =============== create table sql create database d1; sql create database d2; -sql create database d3; -sql create database d4; -sql create database d5; -sql create table d1.t1 (ts timestamp, i int); -sql create table d2.t1 (ts timestamp, i int); -sql create table d3.t1 (ts timestamp, i int); -sql create table d4.t1 (ts timestamp, i int); - -sql show dnodes; -if $data05 != 2 then +sql show databases +if $rows != 2 then return -1 endi -if $data15 != 2 then +sql use d1 +sql show vgroups; + +if $rows != 2 then return -1 endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT +system sh/exec.sh -n dnode2 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/tsim/src/simSystem.c b/tests/tsim/src/simSystem.c index cb61e6b814..016b6500ed 100644 --- a/tests/tsim/src/simSystem.c +++ b/tests/tsim/src/simSystem.c @@ -42,41 +42,7 @@ char *simParseArbitratorName(char *varName) { char *simParseHostName(char *varName) { static char hostName[140]; - - int32_t index = atoi(varName + 8); - int32_t port = 7100; - switch (index) { - case 1: - port = 7100; - break; - case 2: - port = 7200; - break; - case 3: - port = 7300; - break; - case 4: - port = 7400; - break; - case 5: - port = 7500; - break; - case 6: - port = 7600; - break; - case 7: - port = 7700; - break; - case 8: - port = 7800; - break; - case 9: - port = 7900; - break; - } - - sprintf(hostName, "'%s:%d'", simHostName, port); - // simInfo("hostName:%s", hostName); + sprintf(hostName, "%s", simHostName); return hostName; }