diff --git a/Jenkinsfile2 b/Jenkinsfile2 index 9e89e5a2f8..33c3ef55c9 100644 --- a/Jenkinsfile2 +++ b/Jenkinsfile2 @@ -430,8 +430,6 @@ pipeline { rm -rf ${WKC}/debug cd ${WKC}/tests/parallel_test time ./container_build.sh -w ${WKDIR} -t 10 -e - rm -f /tmp/cases.task - ./collect_cases.sh -e ''' def extra_param = "" def log_server_file = "/home/log_server.json" @@ -462,7 +460,7 @@ pipeline { cd ${WKC}/tests/parallel_test export DEFAULT_RETRY_TIME=2 date - ''' + timeout_cmd + ''' time ./run.sh -e -m /home/m.json -t /tmp/cases.task -b ${BRANCH_NAME}_${BUILD_ID} -l ${WKDIR}/log -o 480 ''' + extra_param + ''' + ''' + timeout_cmd + ''' time ./run.sh -e -m /home/m.json -t cases.task -b ${BRANCH_NAME}_${BUILD_ID} -l ${WKDIR}/log -o 480 ''' + extra_param + ''' ''' } } diff --git a/cmake/cmake.version b/cmake/cmake.version index 92f7f8b895..03598519ed 100644 --- a/cmake/cmake.version +++ b/cmake/cmake.version @@ -65,13 +65,14 @@ ELSE () ENDIF () MESSAGE(STATUS "============= compile version parameter information start ============= ") -MESSAGE(STATUS "ver number:" ${TD_VER_NUMBER}) -MESSAGE(STATUS "compatible ver number:" ${TD_VER_COMPATIBLE}) -MESSAGE(STATUS "communit commit id:" ${TD_VER_GIT}) -MESSAGE(STATUS "build date:" ${TD_VER_DATE}) -MESSAGE(STATUS "ver type:" ${TD_VER_VERTYPE}) -MESSAGE(STATUS "ver cpu:" ${TD_VER_CPUTYPE}) -MESSAGE(STATUS "os type:" ${TD_VER_OSTYPE}) +MESSAGE(STATUS "version: " ${TD_VER_NUMBER}) +MESSAGE(STATUS "compatible: " ${TD_VER_COMPATIBLE}) +MESSAGE(STATUS "commit id: " ${TD_VER_GIT}) +MESSAGE(STATUS "build date: " ${TD_VER_DATE}) +MESSAGE(STATUS "build type: " ${CMAKE_BUILD_TYPE}) +MESSAGE(STATUS "type: " ${TD_VER_VERTYPE}) +MESSAGE(STATUS "cpu: " ${TD_VER_CPUTYPE}) +MESSAGE(STATUS "os: " ${TD_VER_OSTYPE}) MESSAGE(STATUS "============= compile version parameter information end ============= ") STRING(REPLACE "." "_" TD_LIB_VER_NUMBER ${TD_VER_NUMBER}) diff --git a/include/common/tdatablock.h b/include/common/tdatablock.h index fdbb2c5123..502ba10d33 100644 --- a/include/common/tdatablock.h +++ b/include/common/tdatablock.h @@ -244,7 +244,7 @@ int32_t blockDataAppendColInfo(SSDataBlock* pBlock, SColumnInfoData* pColIn SColumnInfoData createColumnInfoData(int16_t type, int32_t bytes, int16_t colId); SColumnInfoData* bdGetColumnInfoData(const SSDataBlock* pBlock, int32_t index); -void blockEncode(const SSDataBlock* pBlock, char* data, int32_t* dataLen, int32_t numOfCols, int8_t needCompress); +int32_t blockEncode(const SSDataBlock* pBlock, char* data, int32_t numOfCols); const char* blockDecode(SSDataBlock* pBlock, const char* pData); void blockDebugShowDataBlock(SSDataBlock* pBlock, const char* flag); diff --git a/include/common/tglobal.h b/include/common/tglobal.h index 681d1beb79..2076906f70 100644 --- a/include/common/tglobal.h +++ b/include/common/tglobal.h @@ -135,6 +135,9 @@ extern int32_t tsTtlPushInterval; extern int32_t tsGrantHBInterval; extern int32_t tsUptimeInterval; +extern int32_t tsRpcRetryLimit; +extern int32_t tsRpcRetryInterval; + //#define NEEDTO_COMPRESSS_MSG(size) (tsCompressMsgSize != -1 && (size) > tsCompressMsgSize) int32_t taosCreateLog(const char *logname, int32_t logFileNum, const char *cfgDir, const char **envCmd, diff --git a/include/common/tmsg.h b/include/common/tmsg.h index b840053b08..b16b5a2d4b 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -190,6 +190,7 @@ typedef struct { int64_t dbId; int32_t vgVersion; int32_t numOfTable; // unit is TSDB_TABLE_NUM_UNIT + int64_t stateTs; } SBuildUseDBInput; typedef struct SField { @@ -1805,7 +1806,7 @@ int32_t tDeserializeSCMCreateTopicRsp(void* buf, int32_t bufLen, SCMCreateTopicR typedef struct { int64_t consumerId; -} SMqConsumerLostMsg, SMqConsumerRecoverMsg; +} SMqConsumerLostMsg, SMqConsumerRecoverMsg, SMqConsumerClearMsg; typedef struct { int64_t consumerId; diff --git a/include/common/tmsgdef.h b/include/common/tmsgdef.h index 9868fc49bc..a12a635837 100644 --- a/include/common/tmsgdef.h +++ b/include/common/tmsgdef.h @@ -149,7 +149,7 @@ enum { TD_DEF_MSG_TYPE(TDMT_MND_TMQ_DO_REBALANCE, "do-rebalance", SMqDoRebalanceMsg, NULL) TD_DEF_MSG_TYPE(TDMT_MND_TMQ_DROP_CGROUP, "drop-cgroup", SMqDropCGroupReq, SMqDropCGroupRsp) TD_DEF_MSG_TYPE(TDMT_MND_UNUSED2, "unused2", NULL, NULL) - TD_DEF_MSG_TYPE(TDMT_MND_TMQ_TIMER, "mq-tmr", SMTimerReq, NULL) + TD_DEF_MSG_TYPE(TDMT_MND_TMQ_TIMER, "tmq-tmr", SMTimerReq, NULL) TD_DEF_MSG_TYPE(TDMT_MND_TELEM_TIMER, "telem-tmr", SMTimerReq, SMTimerReq) TD_DEF_MSG_TYPE(TDMT_MND_TRANS_TIMER, "trans-tmr", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_MND_TTL_TIMER, "ttl-tmr", NULL, NULL) @@ -171,6 +171,7 @@ enum { TD_DEF_MSG_TYPE(TDMT_MND_SHOW_VARIABLES, "show-variables", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_MND_SERVER_VERSION, "server-version", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_MND_UPTIME_TIMER, "uptime-timer", NULL, NULL) + TD_DEF_MSG_TYPE(TDMT_MND_TMQ_LOST_CONSUMER_CLEAR, "lost-consumer-clear", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_MND_MAX_MSG, "mnd-max", NULL, NULL) TD_NEW_MSG_SEG(TDMT_VND_MSG) diff --git a/include/common/ttokendef.h b/include/common/ttokendef.h index f5c99fcae7..f3c570aa85 100644 --- a/include/common/ttokendef.h +++ b/include/common/ttokendef.h @@ -174,61 +174,61 @@ #define TK_SUBSCRIPTIONS 156 #define TK_VNODES 157 #define TK_LIKE 158 -#define TK_INDEX 159 -#define TK_FUNCTION 160 -#define TK_INTERVAL 161 -#define TK_TOPIC 162 -#define TK_AS 163 -#define TK_WITH 164 -#define TK_META 165 -#define TK_CONSUMER 166 -#define TK_GROUP 167 -#define TK_DESC 168 -#define TK_DESCRIBE 169 -#define TK_RESET 170 -#define TK_QUERY 171 -#define TK_CACHE 172 -#define TK_EXPLAIN 173 -#define TK_ANALYZE 174 -#define TK_VERBOSE 175 -#define TK_NK_BOOL 176 -#define TK_RATIO 177 -#define TK_NK_FLOAT 178 -#define TK_OUTPUTTYPE 179 -#define TK_AGGREGATE 180 -#define TK_BUFSIZE 181 -#define TK_STREAM 182 -#define TK_INTO 183 -#define TK_TRIGGER 184 -#define TK_AT_ONCE 185 -#define TK_WINDOW_CLOSE 186 -#define TK_IGNORE 187 -#define TK_EXPIRED 188 -#define TK_FILL_HISTORY 189 -#define TK_SUBTABLE 190 -#define TK_KILL 191 -#define TK_CONNECTION 192 -#define TK_TRANSACTION 193 -#define TK_BALANCE 194 -#define TK_VGROUP 195 -#define TK_MERGE 196 -#define TK_REDISTRIBUTE 197 -#define TK_SPLIT 198 -#define TK_DELETE 199 -#define TK_INSERT 200 -#define TK_NULL 201 -#define TK_NK_QUESTION 202 -#define TK_NK_ARROW 203 -#define TK_ROWTS 204 -#define TK_TBNAME 205 -#define TK_QSTART 206 -#define TK_QEND 207 -#define TK_QDURATION 208 -#define TK_WSTART 209 -#define TK_WEND 210 -#define TK_WDURATION 211 -#define TK_IROWTS 212 -#define TK_QTAGS 213 +#define TK_TBNAME 159 +#define TK_QTAGS 160 +#define TK_AS 161 +#define TK_INDEX 162 +#define TK_FUNCTION 163 +#define TK_INTERVAL 164 +#define TK_TOPIC 165 +#define TK_WITH 166 +#define TK_META 167 +#define TK_CONSUMER 168 +#define TK_GROUP 169 +#define TK_DESC 170 +#define TK_DESCRIBE 171 +#define TK_RESET 172 +#define TK_QUERY 173 +#define TK_CACHE 174 +#define TK_EXPLAIN 175 +#define TK_ANALYZE 176 +#define TK_VERBOSE 177 +#define TK_NK_BOOL 178 +#define TK_RATIO 179 +#define TK_NK_FLOAT 180 +#define TK_OUTPUTTYPE 181 +#define TK_AGGREGATE 182 +#define TK_BUFSIZE 183 +#define TK_STREAM 184 +#define TK_INTO 185 +#define TK_TRIGGER 186 +#define TK_AT_ONCE 187 +#define TK_WINDOW_CLOSE 188 +#define TK_IGNORE 189 +#define TK_EXPIRED 190 +#define TK_FILL_HISTORY 191 +#define TK_SUBTABLE 192 +#define TK_KILL 193 +#define TK_CONNECTION 194 +#define TK_TRANSACTION 195 +#define TK_BALANCE 196 +#define TK_VGROUP 197 +#define TK_MERGE 198 +#define TK_REDISTRIBUTE 199 +#define TK_SPLIT 200 +#define TK_DELETE 201 +#define TK_INSERT 202 +#define TK_NULL 203 +#define TK_NK_QUESTION 204 +#define TK_NK_ARROW 205 +#define TK_ROWTS 206 +#define TK_QSTART 207 +#define TK_QEND 208 +#define TK_QDURATION 209 +#define TK_WSTART 210 +#define TK_WEND 211 +#define TK_WDURATION 212 +#define TK_IROWTS 213 #define TK_CAST 214 #define TK_NOW 215 #define TK_TODAY 216 diff --git a/include/libs/catalog/catalog.h b/include/libs/catalog/catalog.h index 7717d3bccc..6154882756 100644 --- a/include/libs/catalog/catalog.h +++ b/include/libs/catalog/catalog.h @@ -56,6 +56,7 @@ typedef struct SDbInfo { int32_t vgVer; int32_t tbNum; int64_t dbId; + int64_t stateTs; } SDbInfo; typedef struct STablesReq { @@ -153,7 +154,7 @@ int32_t catalogInit(SCatalogCfg* cfg); */ int32_t catalogGetHandle(uint64_t clusterId, SCatalog** catalogHandle); -int32_t catalogGetDBVgVersion(SCatalog* pCtg, const char* dbFName, int32_t* version, int64_t* dbId, int32_t* tableNum); +int32_t catalogGetDBVgVersion(SCatalog* pCtg, const char* dbFName, int32_t* version, int64_t* dbId, int32_t* tableNum, int64_t* stateTs); /** * Get a DB's all vgroup info. diff --git a/include/libs/nodes/cmdnodes.h b/include/libs/nodes/cmdnodes.h index 59f64f1863..fc9bd461f6 100644 --- a/include/libs/nodes/cmdnodes.h +++ b/include/libs/nodes/cmdnodes.h @@ -284,6 +284,13 @@ typedef struct SShowVnodesStmt { SNode* pDnodeEndpoint; } SShowVnodesStmt; +typedef struct SShowTableTagsStmt { + ENodeType type; + SNode* pDbName; // SValueNode + SNode* pTbName; // SValueNode + SNodeList* pTags; +} SShowTableTagsStmt; + typedef enum EIndexType { INDEX_TYPE_SMA = 1, INDEX_TYPE_FULLTEXT } EIndexType; typedef struct SIndexOptions { diff --git a/include/libs/nodes/querynodes.h b/include/libs/nodes/querynodes.h index a85f8bf63d..a1dad1806d 100644 --- a/include/libs/nodes/querynodes.h +++ b/include/libs/nodes/querynodes.h @@ -297,6 +297,7 @@ typedef struct SSelectStmt { bool hasStateKey; bool onlyHasKeepOrderFunc; bool groupSort; + bool tagScan; } SSelectStmt; typedef enum ESetOperatorType { SET_OP_TYPE_UNION_ALL = 1, SET_OP_TYPE_UNION } ESetOperatorType; diff --git a/include/libs/qcom/query.h b/include/libs/qcom/query.h index 74c1a8c07c..96ccef7164 100644 --- a/include/libs/qcom/query.h +++ b/include/libs/qcom/query.h @@ -127,6 +127,7 @@ typedef struct SDBVgInfo { int16_t hashSuffix; int8_t hashMethod; int32_t numOfTable; // DB's table num, unit is TSDB_TABLE_NUM_UNIT + int64_t stateTs; SHashObj* vgHash; // key:vgId, value:SVgroupInfo } SDBVgInfo; @@ -203,6 +204,8 @@ int32_t taosAsyncExec(__async_exec_fn_t execFn, void* execParam, int32_t* code); void destroySendMsgInfo(SMsgSendInfo* pMsgBody); +void destroyAhandle(void* ahandle); + int32_t asyncSendMsgToServerExt(void* pTransporter, SEpSet* epSet, int64_t* pTransporterId, SMsgSendInfo* pInfo, bool persistHandle, void* ctx); diff --git a/include/libs/sync/sync.h b/include/libs/sync/sync.h index a27be95049..7419841dc8 100644 --- a/include/libs/sync/sync.h +++ b/include/libs/sync/sync.h @@ -38,6 +38,7 @@ extern "C" { #define SYNC_MNODE_LOG_RETENTION 10000 #define SYNC_VNODE_LOG_RETENTION 100 #define SNAPSHOT_MAX_CLOCK_SKEW_MS 1000 * 10 +#define SNAPSHOT_WAIT_MS 1000 * 60 #define SYNC_APPEND_ENTRIES_TIMEOUT_MS 10000 diff --git a/include/libs/transport/trpc.h b/include/libs/transport/trpc.h index 53edcd4fee..8cc37910fd 100644 --- a/include/libs/transport/trpc.h +++ b/include/libs/transport/trpc.h @@ -72,15 +72,18 @@ typedef struct SRpcMsg { typedef void (*RpcCfp)(void *parent, SRpcMsg *, SEpSet *epset); typedef bool (*RpcRfp)(int32_t code, tmsg_t msgType); typedef bool (*RpcTfp)(int32_t code, tmsg_t msgType); +typedef void (*RpcDfp)(void *ahandle); typedef struct SRpcInit { char localFqdn[TSDB_FQDN_LEN]; - uint16_t localPort; // local port - char *label; // for debug purpose - int32_t numOfThreads; // number of threads to handle connections - int32_t sessions; // number of sessions allowed - int8_t connType; // TAOS_CONN_UDP, TAOS_CONN_TCPC, TAOS_CONN_TCPS - int32_t idleTime; // milliseconds, 0 means idle timer is disabled + uint16_t localPort; // local port + char *label; // for debug purpose + int32_t numOfThreads; // number of threads to handle connections + int32_t sessions; // number of sessions allowed + int8_t connType; // TAOS_CONN_UDP, TAOS_CONN_TCPC, TAOS_CONN_TCPS + int32_t idleTime; // milliseconds, 0 means idle timer is disabled + int32_t retryLimit; // retry limit + int32_t retryInterval; // retry interval ms int32_t compressSize; // -1: no compress, 0 : all data compressed, size: compress data if larger than size int8_t encryption; // encrypt or not @@ -97,6 +100,9 @@ typedef struct SRpcInit { // set up timeout for particular msg RpcTfp tfp; + // destroy client ahandle; + RpcDfp dfp; + void *parent; } SRpcInit; diff --git a/include/util/tdef.h b/include/util/tdef.h index 6e1fa87854..556ad6b680 100644 --- a/include/util/tdef.h +++ b/include/util/tdef.h @@ -26,7 +26,7 @@ extern "C" { #define TSKEY int64_t #define TSKEY_MIN INT64_MIN -#define TSKEY_MAX (INT64_MAX - 1) +#define TSKEY_MAX INT64_MAX #define TSKEY_INITIAL_VAL TSKEY_MIN #define TD_VER_MAX UINT64_MAX // TODO: use the real max version from query handle @@ -290,7 +290,7 @@ typedef enum ELogicConditionType { #define TSDB_DEFAULT_VN_PER_DB 2 #define TSDB_MIN_BUFFER_PER_VNODE 3 // unit MB #define TSDB_MAX_BUFFER_PER_VNODE 16384 // unit MB -#define TSDB_DEFAULT_BUFFER_PER_VNODE 96 +#define TSDB_DEFAULT_BUFFER_PER_VNODE 256 #define TSDB_MIN_PAGES_PER_VNODE 64 #define TSDB_MAX_PAGES_PER_VNODE (INT32_MAX - 1) #define TSDB_DEFAULT_PAGES_PER_VNODE 256 diff --git a/source/client/src/clientEnv.c b/source/client/src/clientEnv.c index bb25a595af..3f4e1bb513 100644 --- a/source/client/src/clientEnv.c +++ b/source/client/src/clientEnv.c @@ -140,12 +140,15 @@ void *openTransporter(const char *user, const char *auth, int32_t numOfThread) { rpcInit.numOfThreads = numOfThread; rpcInit.cfp = processMsgFromServer; rpcInit.rfp = clientRpcRfp; - // rpcInit.tfp = clientRpcTfp; rpcInit.sessions = 1024; rpcInit.connType = TAOS_CONN_CLIENT; rpcInit.user = (char *)user; rpcInit.idleTime = tsShellActivityTimer * 1000; rpcInit.compressSize = tsCompressMsgSize; + rpcInit.dfp = destroyAhandle; + rpcInit.retryLimit = tsRpcRetryLimit; + rpcInit.retryInterval = tsRpcRetryInterval; + void *pDnodeConn = rpcOpen(&rpcInit); if (pDnodeConn == NULL) { tscError("failed to init connection to server"); diff --git a/source/client/src/clientHb.c b/source/client/src/clientHb.c index fa0e3212a3..bf34d3e2df 100644 --- a/source/client/src/clientHb.c +++ b/source/client/src/clientHb.c @@ -61,7 +61,7 @@ static int32_t hbProcessDBInfoRsp(void *value, int32_t valueLen, struct SCatalog int32_t numOfBatchs = taosArrayGetSize(batchUseRsp.pArray); for (int32_t i = 0; i < numOfBatchs; ++i) { SUseDbRsp *rsp = taosArrayGet(batchUseRsp.pArray, i); - tscDebug("hb db rsp, db:%s, vgVersion:%d, uid:%" PRIx64, rsp->db, rsp->vgVersion, rsp->uid); + tscDebug("hb db rsp, db:%s, vgVersion:%d, stateTs:%" PRId64 ", uid:%" PRIx64, rsp->db, rsp->vgVersion, rsp->stateTs, rsp->uid); if (rsp->vgVersion < 0) { code = catalogRemoveDB(pCatalog, rsp->db, rsp->uid); @@ -72,6 +72,7 @@ static int32_t hbProcessDBInfoRsp(void *value, int32_t valueLen, struct SCatalog } vgInfo->vgVersion = rsp->vgVersion; + vgInfo->stateTs = rsp->stateTs; vgInfo->hashMethod = rsp->hashMethod; vgInfo->hashPrefix = rsp->hashPrefix; vgInfo->hashSuffix = rsp->hashSuffix; @@ -486,6 +487,7 @@ int32_t hbGetExpiredDBInfo(SClientHbKey *connKey, struct SCatalog *pCatalog, SCl db->dbId = htobe64(db->dbId); db->vgVersion = htonl(db->vgVersion); db->numOfTable = htonl(db->numOfTable); + db->stateTs = htobe64(db->stateTs); } SKv kv = { diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index 88d7823593..c3140371c4 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -1971,6 +1971,8 @@ TSDB_SERVER_STATUS taos_check_server_status(const char* fqdn, int port, char* de rpcInit.idleTime = tsShellActivityTimer * 1000; rpcInit.compressSize = tsCompressMsgSize; rpcInit.user = "_dnd"; + rpcInit.retryLimit = tsRpcRetryLimit; + rpcInit.retryInterval = tsRpcRetryInterval; clientRpc = rpcOpen(&rpcInit); if (clientRpc == NULL) { diff --git a/source/client/src/clientMain.c b/source/client/src/clientMain.c index 71a87a4b54..efa7d095c5 100644 --- a/source/client/src/clientMain.c +++ b/source/client/src/clientMain.c @@ -990,7 +990,7 @@ void taos_fetch_rows_a(TAOS_RES *res, __taos_async_fn_t fp, void *param) { // all data has returned to App already, no need to try again if (pResultInfo->completed) { // it is a local executed query, no need to do async fetch - if (QUERY_EXEC_MODE_LOCAL == pRequest->body.execMode) { + if (QUERY_EXEC_MODE_SCHEDULE != pRequest->body.execMode) { if (pResultInfo->localResultFetched) { pResultInfo->numOfRows = 0; pResultInfo->current = 0; diff --git a/source/client/src/clientMsgHandler.c b/source/client/src/clientMsgHandler.c index e17e7e79c6..8437c93bae 100644 --- a/source/client/src/clientMsgHandler.c +++ b/source/client/src/clientMsgHandler.c @@ -181,7 +181,7 @@ int32_t processUseDbRsp(void* param, SDataBuf* pMsg, int32_t code) { tDeserializeSUseDbRsp(pMsg->pData, pMsg->len, &usedbRsp); struct SCatalog* pCatalog = NULL; - if (usedbRsp.vgVersion >= 0) { + if (usedbRsp.vgVersion >= 0) { // cached in local uint64_t clusterId = pRequest->pTscObj->pAppInfo->clusterId; int32_t code1 = catalogGetHandle(clusterId, &pCatalog); if (code1 != TSDB_CODE_SUCCESS) { @@ -442,8 +442,7 @@ static int32_t buildShowVariablesRsp(SArray* pVars, SRetrieveTableRsp** pRsp) { (*pRsp)->numOfRows = htonl(pBlock->info.rows); (*pRsp)->numOfCols = htonl(SHOW_VARIABLES_RESULT_COLS); - int32_t len = 0; - blockEncode(pBlock, (*pRsp)->data, &len, SHOW_VARIABLES_RESULT_COLS, false); + int32_t len = blockEncode(pBlock, (*pRsp)->data, SHOW_VARIABLES_RESULT_COLS); ASSERT(len == rspSize - sizeof(SRetrieveTableRsp)); blockDataDestroy(pBlock); diff --git a/source/common/src/tdatablock.c b/source/common/src/tdatablock.c index 5d0121aa15..536cbed33e 100644 --- a/source/common/src/tdatablock.c +++ b/source/common/src/tdatablock.c @@ -2197,7 +2197,9 @@ char* buildCtbNameByGroupId(const char* stbFullName, uint64_t groupId) { return rname.ctbShortName; } -void blockEncode(const SSDataBlock* pBlock, char* data, int32_t* dataLen, int32_t numOfCols, int8_t needCompress) { +int32_t blockEncode(const SSDataBlock* pBlock, char* data, int32_t numOfCols) { + int32_t dataLen = 0; + // todo extract method int32_t* version = (int32_t*)data; *version = 1; @@ -2238,7 +2240,7 @@ void blockEncode(const SSDataBlock* pBlock, char* data, int32_t* dataLen, int32_ int32_t* colSizes = (int32_t*)data; data += numOfCols * sizeof(int32_t); - *dataLen = blockDataGetSerialMetaSize(numOfCols); + dataLen = blockDataGetSerialMetaSize(numOfCols); int32_t numOfRows = pBlock->info.rows; for (int32_t col = 0; col < numOfCols; ++col) { @@ -2255,26 +2257,23 @@ void blockEncode(const SSDataBlock* pBlock, char* data, int32_t* dataLen, int32_ } data += metaSize; - (*dataLen) += metaSize; + dataLen += metaSize; - if (needCompress) { - colSizes[col] = blockCompressColData(pColRes, numOfRows, data, needCompress); - data += colSizes[col]; - (*dataLen) += colSizes[col]; - } else { - colSizes[col] = colDataGetLength(pColRes, numOfRows); - (*dataLen) += colSizes[col]; - memmove(data, pColRes->pData, colSizes[col]); - data += colSizes[col]; - } + colSizes[col] = colDataGetLength(pColRes, numOfRows); + dataLen += colSizes[col]; + memmove(data, pColRes->pData, colSizes[col]); + data += colSizes[col]; colSizes[col] = htonl(colSizes[col]); } - *actualLen = *dataLen; + *actualLen = dataLen; *groupId = pBlock->info.groupId; - ASSERT(*dataLen > 0); - uDebug("build data block, actualLen:%d, rows:%d, cols:%d", *dataLen, *rows, *cols); + ASSERT(dataLen > 0); + + uDebug("build data block, actualLen:%d, rows:%d, cols:%d", dataLen, *rows, *cols); + + return dataLen; } const char* blockDecode(SSDataBlock* pBlock, const char* pData) { diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c index 1be77077b6..27dcbd5be3 100644 --- a/source/common/src/tglobal.c +++ b/source/common/src/tglobal.c @@ -163,10 +163,12 @@ int32_t tsMqRebalanceInterval = 2; int32_t tsTtlUnit = 86400; int32_t tsTtlPushInterval = 86400; int32_t tsGrantHBInterval = 60; -int32_t tsUptimeInterval = 300; // seconds +int32_t tsUptimeInterval = 300; // seconds char tsUdfdResFuncs[512] = ""; // udfd resident funcs that teardown when udfd exits char tsUdfdLdLibPath[512] = ""; +int32_t tsRpcRetryLimit = 100; +int32_t tsRpcRetryInterval = 15; #ifndef _STORAGE int32_t taosSetTfsCfg(SConfig *pCfg) { SConfigItem *pItem = cfgGetItem(pCfg, "dataDir"); @@ -297,6 +299,8 @@ static int32_t taosAddClientCfg(SConfig *pCfg) { if (cfgAddString(pCfg, "smlTagName", tsSmlTagName, 1) != 0) return -1; if (cfgAddBool(pCfg, "smlDataFormat", tsSmlDataFormat, 1) != 0) return -1; if (cfgAddInt32(pCfg, "maxMemUsedByInsert", tsMaxMemUsedByInsert, 1, INT32_MAX, true) != 0) return -1; + if (cfgAddInt32(pCfg, "rpcRetryLimit", tsRpcRetryLimit, 1, 100000, 0) != 0) return -1; + if (cfgAddInt32(pCfg, "rpcRetryInterval", tsRpcRetryInterval, 1, 100000, 0) != 0) return -1; tsNumOfTaskQueueThreads = tsNumOfCores / 2; tsNumOfTaskQueueThreads = TMAX(tsNumOfTaskQueueThreads, 4); @@ -422,6 +426,10 @@ static int32_t taosAddServerCfg(SConfig *pCfg) { if (cfgAddBool(pCfg, "udf", tsStartUdfd, 0) != 0) return -1; if (cfgAddString(pCfg, "udfdResFuncs", tsUdfdResFuncs, 0) != 0) return -1; if (cfgAddString(pCfg, "udfdLdLibPath", tsUdfdLdLibPath, 0) != 0) return -1; + + if (cfgAddInt32(pCfg, "rpcRetryLimit", tsRpcRetryLimit, 1, 100000, 0) != 0) return -1; + if (cfgAddInt32(pCfg, "rpcRetryInterval", tsRpcRetryInterval, 1, 100000, 0) != 0) return -1; + GRANT_CFG_ADD; return 0; } @@ -634,6 +642,9 @@ static int32_t taosSetClientCfg(SConfig *pCfg) { tsQueryNodeChunkSize = cfgGetItem(pCfg, "queryNodeChunkSize")->i32; tsQueryUseNodeAllocator = cfgGetItem(pCfg, "queryUseNodeAllocator")->bval; tsKeepColumnName = cfgGetItem(pCfg, "keepColumnName")->bval; + + tsRpcRetryLimit = cfgGetItem(pCfg, "rpcRetryLimit")->i32; + tsRpcRetryInterval = cfgGetItem(pCfg, "rpcRetryInterval")->i32; return 0; } @@ -708,6 +719,9 @@ static int32_t taosSetServerCfg(SConfig *pCfg) { if (tsQueryBufferSize >= 0) { tsQueryBufferSizeBytes = tsQueryBufferSize * 1048576UL; } + + tsRpcRetryLimit = cfgGetItem(pCfg, "rpcRetryLimit")->i32; + tsRpcRetryInterval = cfgGetItem(pCfg, "rpcRetryInterval")->i32; GRANT_CFG_GET; return 0; } diff --git a/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c b/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c index 85a09b79fd..8a8561161b 100644 --- a/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c +++ b/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c @@ -307,8 +307,7 @@ int32_t dmProcessRetrieve(SDnodeMgmt *pMgmt, SRpcMsg *pMsg) { pStart += sizeof(SSysTableSchema); } - int32_t len = 0; - blockEncode(pBlock, pStart, &len, numOfCols, false); + int32_t len = blockEncode(pBlock, pStart, numOfCols); pRsp->numOfRows = htonl(pBlock->info.rows); pRsp->precision = TSDB_TIME_PRECISION_MILLI; // millisecond time precision diff --git a/source/dnode/mgmt/node_mgmt/src/dmTransport.c b/source/dnode/mgmt/node_mgmt/src/dmTransport.c index 1e5f3139aa..5546d762f4 100644 --- a/source/dnode/mgmt/node_mgmt/src/dmTransport.c +++ b/source/dnode/mgmt/node_mgmt/src/dmTransport.c @@ -258,6 +258,8 @@ int32_t dmInitClient(SDnode *pDnode) { rpcInit.parent = pDnode; rpcInit.rfp = rpcRfp; rpcInit.compressSize = tsCompressMsgSize; + rpcInit.retryLimit = tsRpcRetryLimit; + rpcInit.retryInterval = tsRpcRetryInterval; pTrans->clientRpc = rpcOpen(&rpcInit); if (pTrans->clientRpc == NULL) { diff --git a/source/dnode/mnode/impl/inc/mndConsumer.h b/source/dnode/mnode/impl/inc/mndConsumer.h index 210e336ac2..1176e1af0b 100644 --- a/source/dnode/mnode/impl/inc/mndConsumer.h +++ b/source/dnode/mnode/impl/inc/mndConsumer.h @@ -44,6 +44,7 @@ SSdbRaw *mndConsumerActionEncode(SMqConsumerObj *pConsumer); SSdbRow *mndConsumerActionDecode(SSdbRaw *pRaw); int32_t mndSetConsumerCommitLogs(SMnode *pMnode, STrans *pTrans, SMqConsumerObj *pConsumer); +int32_t mndSetConsumerDropLogs(SMnode *pMnode, STrans *pTrans, SMqConsumerObj *pConsumer); bool mndRebTryStart(); void mndRebEnd(); diff --git a/source/dnode/mnode/impl/src/mndConsumer.c b/source/dnode/mnode/impl/src/mndConsumer.c index df999316eb..62ad5bae15 100644 --- a/source/dnode/mnode/impl/src/mndConsumer.c +++ b/source/dnode/mnode/impl/src/mndConsumer.c @@ -32,7 +32,8 @@ #define MND_CONSUMER_VER_NUMBER 1 #define MND_CONSUMER_RESERVE_SIZE 64 -#define MND_CONSUMER_LOST_HB_CNT 3 +#define MND_CONSUMER_LOST_HB_CNT 3 +#define MND_CONSUMER_LOST_CLEAR_THRESHOLD 43200 static int8_t mqRebInExecCnt = 0; @@ -50,6 +51,7 @@ static int32_t mndProcessAskEpReq(SRpcMsg *pMsg); static int32_t mndProcessMqHbReq(SRpcMsg *pMsg); static int32_t mndProcessMqTimerMsg(SRpcMsg *pMsg); static int32_t mndProcessConsumerLostMsg(SRpcMsg *pMsg); +static int32_t mndProcessConsumerClearMsg(SRpcMsg *pMsg); static int32_t mndProcessConsumerRecoverMsg(SRpcMsg *pMsg); int32_t mndInitConsumer(SMnode *pMnode) { @@ -69,6 +71,7 @@ int32_t mndInitConsumer(SMnode *pMnode) { mndSetMsgHandle(pMnode, TDMT_MND_TMQ_TIMER, mndProcessMqTimerMsg); mndSetMsgHandle(pMnode, TDMT_MND_TMQ_CONSUMER_LOST, mndProcessConsumerLostMsg); mndSetMsgHandle(pMnode, TDMT_MND_TMQ_CONSUMER_RECOVER, mndProcessConsumerRecoverMsg); + mndSetMsgHandle(pMnode, TDMT_MND_TMQ_LOST_CONSUMER_CLEAR, mndProcessConsumerClearMsg); mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_CONSUMERS, mndRetrieveConsumer); mndAddShowFreeIterHandle(pMnode, TSDB_MGMT_TABLE_CONSUMERS, mndCancelGetNextConsumer); @@ -162,6 +165,43 @@ FAIL: return -1; } +static int32_t mndProcessConsumerClearMsg(SRpcMsg *pMsg) { + SMnode *pMnode = pMsg->info.node; + SMqConsumerClearMsg *pClearMsg = pMsg->pCont; + SMqConsumerObj *pConsumer = mndAcquireConsumer(pMnode, pClearMsg->consumerId); + if (pConsumer == NULL) { + return 0; + } + + mInfo("receive consumer clear msg, consumer id %" PRId64 ", status %s", pClearMsg->consumerId, + mndConsumerStatusName(pConsumer->status)); + + if (pConsumer->status != MQ_CONSUMER_STATUS__LOST_REBD) { + mndReleaseConsumer(pMnode, pConsumer); + return -1; + } + + SMqConsumerObj *pConsumerNew = tNewSMqConsumerObj(pConsumer->consumerId, pConsumer->cgroup); + pConsumerNew->updateType = CONSUMER_UPDATE__LOST; + + mndReleaseConsumer(pMnode, pConsumer); + + STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pMsg, "clear-csm"); + if (pTrans == NULL) goto FAIL; + if (mndSetConsumerDropLogs(pMnode, pTrans, pConsumerNew) != 0) goto FAIL; + if (mndTransPrepare(pMnode, pTrans) != 0) goto FAIL; + + tDeleteSMqConsumerObj(pConsumerNew); + taosMemoryFree(pConsumerNew); + mndTransDrop(pTrans); + return 0; +FAIL: + tDeleteSMqConsumerObj(pConsumerNew); + taosMemoryFree(pConsumerNew); + mndTransDrop(pTrans); + return -1; +} + static SMqRebInfo *mndGetOrCreateRebSub(SHashObj *pHash, const char *key) { SMqRebInfo *pRebInfo = taosHashGet(pHash, key, strlen(key) + 1); if (pRebInfo == NULL) { @@ -206,15 +246,28 @@ static int32_t mndProcessMqTimerMsg(SRpcMsg *pMsg) { SMqConsumerLostMsg *pLostMsg = rpcMallocCont(sizeof(SMqConsumerLostMsg)); pLostMsg->consumerId = pConsumer->consumerId; - SRpcMsg pRpcMsg = { + SRpcMsg rpcMsg = { .msgType = TDMT_MND_TMQ_CONSUMER_LOST, .pCont = pLostMsg, .contLen = sizeof(SMqConsumerLostMsg), }; - tmsgPutToQueue(&pMnode->msgCb, WRITE_QUEUE, &pRpcMsg); + tmsgPutToQueue(&pMnode->msgCb, WRITE_QUEUE, &rpcMsg); } - if (status == MQ_CONSUMER_STATUS__LOST_REBD || status == MQ_CONSUMER_STATUS__READY) { + + if (status == MQ_CONSUMER_STATUS__READY) { // do nothing + } else if (status == MQ_CONSUMER_STATUS__LOST_REBD) { + if (hbStatus > MND_CONSUMER_LOST_CLEAR_THRESHOLD) { + SMqConsumerClearMsg *pClearMsg = rpcMallocCont(sizeof(SMqConsumerClearMsg)); + + pClearMsg->consumerId = pConsumer->consumerId; + SRpcMsg rpcMsg = { + .msgType = TDMT_MND_TMQ_LOST_CONSUMER_CLEAR, + .pCont = pClearMsg, + .contLen = sizeof(SMqConsumerClearMsg), + }; + tmsgPutToQueue(&pMnode->msgCb, WRITE_QUEUE, &rpcMsg); + } } else if (status == MQ_CONSUMER_STATUS__LOST) { taosRLockLatch(&pConsumer->lock); int32_t topicNum = taosArrayGetSize(pConsumer->currentTopics); @@ -444,6 +497,14 @@ FAIL: return -1; } +int32_t mndSetConsumerDropLogs(SMnode *pMnode, STrans *pTrans, SMqConsumerObj *pConsumer) { + SSdbRaw *pCommitRaw = mndConsumerActionEncode(pConsumer); + if (pCommitRaw == NULL) return -1; + if (mndTransAppendCommitlog(pTrans, pCommitRaw) != 0) return -1; + if (sdbSetRawStatus(pCommitRaw, SDB_STATUS_DROPPED) != 0) return -1; + return 0; +} + int32_t mndSetConsumerCommitLogs(SMnode *pMnode, STrans *pTrans, SMqConsumerObj *pConsumer) { SSdbRaw *pCommitRaw = mndConsumerActionEncode(pConsumer); if (pCommitRaw == NULL) return -1; diff --git a/source/dnode/mnode/impl/src/mndDb.c b/source/dnode/mnode/impl/src/mndDb.c index f2a4462bf5..78d84c9c25 100644 --- a/source/dnode/mnode/impl/src/mndDb.c +++ b/source/dnode/mnode/impl/src/mndDb.c @@ -606,7 +606,7 @@ static int32_t mndProcessCreateDbReq(SRpcMsg *pReq) { } else { if (terrno == TSDB_CODE_MND_DB_IN_CREATING) { if (mndSetRpcInfoForDbTrans(pMnode, pReq, MND_OPER_CREATE_DB, createReq.db) == 0) { - mInfo("db:%s, is creating and response after trans finished", createReq.db); + mInfo("db:%s, is creating and createdb response after trans finished", createReq.db); code = TSDB_CODE_ACTION_IN_PROGRESS; goto _OVER; } else { @@ -1175,7 +1175,7 @@ int32_t mndExtractDbInfo(SMnode *pMnode, SDbObj *pDb, SUseDbRsp *pRsp, const SUs int32_t numOfTable = mndGetDBTableNum(pDb, pMnode); - if (pReq == NULL || pReq->vgVersion < pDb->vgVersion || pReq->dbId != pDb->uid || numOfTable != pReq->numOfTable) { + if (pReq == NULL || pReq->vgVersion < pDb->vgVersion || pReq->dbId != pDb->uid || numOfTable != pReq->numOfTable || pReq->stateTs < pDb->stateTs) { mndBuildDBVgroupInfo(pDb, pMnode, pRsp->pVgroupInfos); } @@ -1225,6 +1225,14 @@ static int32_t mndProcessUseDbReq(SRpcMsg *pReq) { usedbRsp.vgVersion = usedbReq.vgVersion; usedbRsp.errCode = terrno; + if (terrno == TSDB_CODE_MND_DB_IN_CREATING) { + if (mndSetRpcInfoForDbTrans(pMnode, pReq, MND_OPER_CREATE_DB, usedbReq.db) == 0) { + mInfo("db:%s, is creating and usedb response after trans finished", usedbReq.db); + code = TSDB_CODE_ACTION_IN_PROGRESS; + goto _OVER; + } + } + mError("db:%s, failed to process use db req since %s", usedbReq.db, terrstr()); } else { if (mndCheckDbPrivilege(pMnode, pReq->info.conn.user, MND_OPER_USE_DB, pDb) != 0) { @@ -1255,7 +1263,7 @@ static int32_t mndProcessUseDbReq(SRpcMsg *pReq) { pReq->info.rspLen = contLen; _OVER: - if (code != 0) { + if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) { mError("db:%s, failed to process use db req since %s", usedbReq.db, terrstr()); } @@ -1275,12 +1283,31 @@ int32_t mndValidateDbInfo(SMnode *pMnode, SDbVgVersion *pDbs, int32_t numOfDbs, for (int32_t i = 0; i < numOfDbs; ++i) { SDbVgVersion *pDbVgVersion = &pDbs[i]; - pDbVgVersion->dbId = htobe64(pDbVgVersion->dbId); + pDbVgVersion->dbId = be64toh(pDbVgVersion->dbId); pDbVgVersion->vgVersion = htonl(pDbVgVersion->vgVersion); pDbVgVersion->numOfTable = htonl(pDbVgVersion->numOfTable); + pDbVgVersion->stateTs = be64toh(pDbVgVersion->stateTs); SUseDbRsp usedbRsp = {0}; + if ((0 == strcasecmp(pDbVgVersion->dbFName, TSDB_INFORMATION_SCHEMA_DB) || (0 == strcasecmp(pDbVgVersion->dbFName, TSDB_PERFORMANCE_SCHEMA_DB)))) { + memcpy(usedbRsp.db, pDbVgVersion->dbFName, TSDB_DB_FNAME_LEN); + int32_t vgVersion = mndGetGlobalVgroupVersion(pMnode); + if (pDbVgVersion->vgVersion < vgVersion) { + usedbRsp.pVgroupInfos = taosArrayInit(10, sizeof(SVgroupInfo)); + + mndBuildDBVgroupInfo(NULL, pMnode, usedbRsp.pVgroupInfos); + usedbRsp.vgVersion = vgVersion++; + } else { + usedbRsp.vgVersion = pDbVgVersion->vgVersion; + } + usedbRsp.vgNum = taosArrayGetSize(usedbRsp.pVgroupInfos); + + taosArrayPush(batchUseRsp.pArray, &usedbRsp); + + continue; + } + SDbObj *pDb = mndAcquireDb(pMnode, pDbVgVersion->dbFName); if (pDb == NULL) { mTrace("db:%s, no exist", pDbVgVersion->dbFName); @@ -1293,8 +1320,8 @@ int32_t mndValidateDbInfo(SMnode *pMnode, SDbVgVersion *pDbs, int32_t numOfDbs, int32_t numOfTable = mndGetDBTableNum(pDb, pMnode); - if (pDbVgVersion->vgVersion >= pDb->vgVersion && numOfTable == pDbVgVersion->numOfTable /* && - pDbVgVersion->stateTs == pDb->stateTs */) { + if (pDbVgVersion->vgVersion >= pDb->vgVersion && numOfTable == pDbVgVersion->numOfTable && + pDbVgVersion->stateTs == pDb->stateTs) { mTrace("db:%s, valid dbinfo, vgVersion:%d stateTs:%" PRId64 " numOfTables:%d, not changed vgVersion:%d stateTs:%" PRId64 " numOfTables:%d", pDbVgVersion->dbFName, pDbVgVersion->vgVersion, pDbVgVersion->stateTs, pDbVgVersion->numOfTable, diff --git a/source/dnode/mnode/impl/src/mndShow.c b/source/dnode/mnode/impl/src/mndShow.c index 637a3818e6..b0af98b933 100644 --- a/source/dnode/mnode/impl/src/mndShow.c +++ b/source/dnode/mnode/impl/src/mndShow.c @@ -303,8 +303,7 @@ static int32_t mndProcessRetrieveSysTableReq(SRpcMsg *pReq) { pStart += sizeof(SSysTableSchema); } - int32_t len = 0; - blockEncode(pBlock, pStart, &len, pShow->pMeta->numOfColumns, false); + int32_t len = blockEncode(pBlock, pStart, pShow->pMeta->numOfColumns); } pRsp->numOfRows = htonl(rowsRead); diff --git a/source/dnode/mnode/impl/src/mndTrans.c b/source/dnode/mnode/impl/src/mndTrans.c index ac05598bdc..db878d72b9 100644 --- a/source/dnode/mnode/impl/src/mndTrans.c +++ b/source/dnode/mnode/impl/src/mndTrans.c @@ -938,11 +938,15 @@ static void mndTransSendRpcRsp(SMnode *pMnode, STrans *pTrans) { for (int32_t i = 0; i < size; ++i) { SRpcHandleInfo *pInfo = taosArrayGet(pTrans->pRpcArray, i); if (pInfo->handle != NULL) { - mInfo("trans:%d, send rsp, code:0x%x stage:%s app:%p", pTrans->id, code, mndTransStr(pTrans->stage), - pInfo->ahandle); if (code == TSDB_CODE_RPC_NETWORK_UNAVAIL) { code = TSDB_CODE_MND_TRANS_NETWORK_UNAVAILL; } + if (i != 0 && code == 0) { + code = TSDB_CODE_RPC_REDIRECT; + } + mInfo("trans:%d, client:%d send rsp, code:0x%x stage:%s app:%p", pTrans->id, i, code, mndTransStr(pTrans->stage), + pInfo->ahandle); + SRpcMsg rspMsg = {.code = code, .info = *pInfo}; if (pTrans->originRpcType == TDMT_MND_CREATE_DB) { diff --git a/source/dnode/vnode/src/inc/tsdb.h b/source/dnode/vnode/src/inc/tsdb.h index a5257b32c0..ba9d68ee7f 100644 --- a/source/dnode/vnode/src/inc/tsdb.h +++ b/source/dnode/vnode/src/inc/tsdb.h @@ -110,7 +110,6 @@ static FORCE_INLINE int64_t tsdbLogicToFileSize(int64_t lSize, int32_t szPage) { #define tsdbRowFromBlockData(BLOCKDATA, IROW) ((TSDBROW){.type = 1, .pBlockData = (BLOCKDATA), .iRow = (IROW)}) void tsdbRowGetColVal(TSDBROW *pRow, STSchema *pTSchema, int32_t iCol, SColVal *pColVal); int32_t tPutTSDBRow(uint8_t *p, TSDBROW *pRow); -int32_t tGetTSDBRow(uint8_t *p, TSDBROW *pRow); int32_t tsdbRowCmprFn(const void *p1, const void *p2); // SRowIter void tRowIterInit(SRowIter *pIter, TSDBROW *pRow, STSchema *pTSchema); @@ -210,11 +209,10 @@ void tsdbRefMemTable(SMemTable *pMemTable); void tsdbUnrefMemTable(SMemTable *pMemTable); SArray *tsdbMemTableGetTbDataArray(SMemTable *pMemTable); // STbDataIter -int32_t tsdbTbDataIterCreate(STbData *pTbData, TSDBKEY *pFrom, int8_t backward, STbDataIter **ppIter); -void *tsdbTbDataIterDestroy(STbDataIter *pIter); -void tsdbTbDataIterOpen(STbData *pTbData, TSDBKEY *pFrom, int8_t backward, STbDataIter *pIter); -TSDBROW *tsdbTbDataIterGet(STbDataIter *pIter); -bool tsdbTbDataIterNext(STbDataIter *pIter); +int32_t tsdbTbDataIterCreate(STbData *pTbData, TSDBKEY *pFrom, int8_t backward, STbDataIter **ppIter); +void *tsdbTbDataIterDestroy(STbDataIter *pIter); +void tsdbTbDataIterOpen(STbData *pTbData, TSDBKEY *pFrom, int8_t backward, STbDataIter *pIter); +bool tsdbTbDataIterNext(STbDataIter *pIter); // STbData int32_t tsdbGetNRowsInTbData(STbData *pTbData); // tsdbFile.c ============================================================================================== @@ -772,6 +770,40 @@ static FORCE_INLINE int32_t tsdbKeyCmprFn(const void *p1, const void *p2) { return 0; } +#define SL_NODE_FORWARD(n, l) ((n)->forwards[l]) +#define SL_NODE_BACKWARD(n, l) ((n)->forwards[(n)->level + (l)]) +#define SL_NODE_DATA(n) (&SL_NODE_BACKWARD(n, (n)->level)) + +static FORCE_INLINE int32_t tGetTSDBRow(uint8_t *p, TSDBROW *pRow) { + int32_t n = tGetI64(p, &pRow->version); + pRow->pTSRow = (STSRow *)(p + n); + n += pRow->pTSRow->len; + return n; +} + +static FORCE_INLINE TSDBROW *tsdbTbDataIterGet(STbDataIter *pIter) { + if (pIter == NULL) return NULL; + + if (pIter->pRow) { + return pIter->pRow; + } + + if (pIter->backward) { + if (pIter->pNode == pIter->pTbData->sl.pHead) { + return NULL; + } + } else { + if (pIter->pNode == pIter->pTbData->sl.pTail) { + return NULL; + } + } + + tGetTSDBRow((uint8_t *)SL_NODE_DATA(pIter->pNode), &pIter->row); + pIter->pRow = &pIter->row; + + return pIter->pRow; +} + #ifdef __cplusplus } #endif diff --git a/source/dnode/vnode/src/tq/tqExec.c b/source/dnode/vnode/src/tq/tqExec.c index a6e8767a4d..48c14bc758 100644 --- a/source/dnode/vnode/src/tq/tqExec.c +++ b/source/dnode/vnode/src/tq/tqExec.c @@ -27,9 +27,7 @@ int32_t tqAddBlockDataToRsp(const SSDataBlock* pBlock, SMqDataRsp* pRsp, int32_t pRetrieve->completed = 1; pRetrieve->numOfRows = htonl(pBlock->info.rows); - // TODO enable compress - int32_t actualLen = 0; - blockEncode(pBlock, pRetrieve->data, &actualLen, numOfCols, false); + int32_t actualLen = blockEncode(pBlock, pRetrieve->data, numOfCols); actualLen += sizeof(SRetrieveTableRsp); ASSERT(actualLen <= dataStrLen); taosArrayPush(pRsp->blockDataLen, &actualLen); diff --git a/source/dnode/vnode/src/tsdb/tsdbCache.c b/source/dnode/vnode/src/tsdb/tsdbCache.c index 76236e5078..291a5ab1eb 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCache.c +++ b/source/dnode/vnode/src/tsdb/tsdbCache.c @@ -475,7 +475,7 @@ _err: } return code; } - +/* static int32_t getTableDelIdx(SDelFReader *pDelFReader, tb_uid_t suid, tb_uid_t uid, SDelIdx *pDelIdx) { int32_t code = 0; SArray *pDelIdxArray = NULL; @@ -499,7 +499,7 @@ _err: } return code; } - +*/ typedef enum { SFSLASTNEXTROW_FS, SFSLASTNEXTROW_FILESET, @@ -997,8 +997,6 @@ static int32_t nextRowIterOpen(CacheNextRowIter *pIter, tb_uid_t uid, STsdb *pTs pIter->pSkyline = taosArrayInit(32, sizeof(TSDBKEY)); - SDelIdx delIdx; - SDelFile *pDelFile = pReadSnap->fs.pDelFile; if (pDelFile) { SDelFReader *pDelFReader; @@ -1006,18 +1004,20 @@ static int32_t nextRowIterOpen(CacheNextRowIter *pIter, tb_uid_t uid, STsdb *pTs code = tsdbDelFReaderOpen(&pDelFReader, pDelFile, pTsdb); if (code) goto _err; - code = getTableDelIdx(pDelFReader, suid, uid, &delIdx); - if (code) { - tsdbDelFReaderClose(&pDelFReader); - goto _err; - } - - code = getTableDelSkyline(pMem, pIMem, pDelFReader, &delIdx, pIter->pSkyline); + SArray *pDelIdxArray = taosArrayInit(32, sizeof(SDelIdx)); + + code = tsdbReadDelIdx(pDelFReader, pDelIdxArray); + if (code) goto _err; + + SDelIdx *delIdx = taosArraySearch(pDelIdxArray, &(SDelIdx){.suid = suid, .uid = uid}, tCmprDelIdx, TD_EQ); + + code = getTableDelSkyline(pMem, pIMem, pDelFReader, delIdx, pIter->pSkyline); if (code) { tsdbDelFReaderClose(&pDelFReader); goto _err; } + taosArrayDestroy(pDelIdxArray); tsdbDelFReaderClose(&pDelFReader); } else { code = getTableDelSkyline(pMem, pIMem, NULL, NULL, pIter->pSkyline); diff --git a/source/dnode/vnode/src/tsdb/tsdbCommit.c b/source/dnode/vnode/src/tsdb/tsdbCommit.c index 874fe3c958..65a46331aa 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCommit.c +++ b/source/dnode/vnode/src/tsdb/tsdbCommit.c @@ -495,6 +495,10 @@ static int32_t tsdbCommitFileDataStart(SCommitter *pCommitter) { pCommitter->commitFid = tsdbKeyFid(pCommitter->nextKey, pCommitter->minutes, pCommitter->precision); tsdbFidKeyRange(pCommitter->commitFid, pCommitter->minutes, pCommitter->precision, &pCommitter->minKey, &pCommitter->maxKey); +#if 0 + ASSERT(pCommitter->minKey <= pCommitter->nextKey && pCommitter->maxKey >= pCommitter->nextKey); +#endif + pCommitter->nextKey = TSKEY_MAX; // Reader diff --git a/source/dnode/vnode/src/tsdb/tsdbMemTable.c b/source/dnode/vnode/src/tsdb/tsdbMemTable.c index c663e2b526..52c7a07c49 100644 --- a/source/dnode/vnode/src/tsdb/tsdbMemTable.c +++ b/source/dnode/vnode/src/tsdb/tsdbMemTable.c @@ -294,31 +294,6 @@ bool tsdbTbDataIterNext(STbDataIter *pIter) { return true; } -TSDBROW *tsdbTbDataIterGet(STbDataIter *pIter) { - // we add here for commit usage - if (pIter == NULL) return NULL; - - if (pIter->pRow) { - goto _exit; - } - - if (pIter->backward) { - if (pIter->pNode == pIter->pTbData->sl.pHead) { - goto _exit; - } - } else { - if (pIter->pNode == pIter->pTbData->sl.pTail) { - goto _exit; - } - } - - tGetTSDBRow((uint8_t *)SL_NODE_DATA(pIter->pNode), &pIter->row); - pIter->pRow = &pIter->row; - -_exit: - return pIter->pRow; -} - static int32_t tsdbMemTableRehash(SMemTable *pMemTable) { int32_t code = 0; diff --git a/source/dnode/vnode/src/tsdb/tsdbRead.c b/source/dnode/vnode/src/tsdb/tsdbRead.c index 9dab1e1d33..c157faecb1 100644 --- a/source/dnode/vnode/src/tsdb/tsdbRead.c +++ b/source/dnode/vnode/src/tsdb/tsdbRead.c @@ -973,7 +973,7 @@ static void copyNumericCols(const SColData* pData, SFileBlockDumpInfo* pDumpInfo int32_t mid = dumpedRows >> 1u; int8_t* pts = (int8_t*)pColData->pData; for (int32_t j = 0; j < mid; ++j) { - int64_t t = pts[j]; + int8_t t = pts[j]; pts[j] = pts[dumpedRows - j - 1]; pts[dumpedRows - j - 1] = t; } @@ -998,7 +998,7 @@ static void copyNumericCols(const SColData* pData, SFileBlockDumpInfo* pDumpInfo int32_t mid = dumpedRows >> 1u; int32_t* pts = (int32_t*)pColData->pData; for (int32_t j = 0; j < mid; ++j) { - int64_t t = pts[j]; + int32_t t = pts[j]; pts[j] = pts[dumpedRows - j - 1]; pts[dumpedRows - j - 1] = t; } diff --git a/source/dnode/vnode/src/tsdb/tsdbUtil.c b/source/dnode/vnode/src/tsdb/tsdbUtil.c index 52b74aea3f..a40b1667c5 100644 --- a/source/dnode/vnode/src/tsdb/tsdbUtil.c +++ b/source/dnode/vnode/src/tsdb/tsdbUtil.c @@ -505,8 +505,8 @@ int32_t tsdbKeyFid(TSKEY key, int32_t minutes, int8_t precision) { } void tsdbFidKeyRange(int32_t fid, int32_t minutes, int8_t precision, TSKEY *minKey, TSKEY *maxKey) { - *minKey = fid * minutes * tsTickPerMin[precision]; - *maxKey = *minKey + minutes * tsTickPerMin[precision] - 1; + *minKey = tsTickPerMin[precision] * fid * minutes; + *maxKey = *minKey + tsTickPerMin[precision] * minutes - 1; } int32_t tsdbFidLevel(int32_t fid, STsdbKeepCfg *pKeepCfg, int64_t now) { @@ -575,16 +575,6 @@ int32_t tPutTSDBRow(uint8_t *p, TSDBROW *pRow) { return n; } -int32_t tGetTSDBRow(uint8_t *p, TSDBROW *pRow) { - int32_t n = 0; - - n += tGetI64(p, &pRow->version); - pRow->pTSRow = (STSRow *)(p + n); - n += pRow->pTSRow->len; - - return n; -} - int32_t tsdbRowCmprFn(const void *p1, const void *p2) { return tsdbKeyCmprFn(&TSDBROW_KEY((TSDBROW *)p1), &TSDBROW_KEY((TSDBROW *)p2)); } @@ -1053,7 +1043,7 @@ int32_t tBlockDataAppendRow(SBlockData *pBlockData, TSDBROW *pRow, STSchema *pTS tRowIterInit(&rIter, pRow, pTSchema); pColVal = tRowIterNext(&rIter); for (int32_t iColData = 0; iColData < pBlockData->nColData; iColData++) { - SColData *pColData = tBlockDataGetColDataByIdx(pBlockData, iColData); + SColData *pColData = &((SColData *)pBlockData->aColData->pData)[iColData]; while (pColVal && pColVal->cid < pColData->cid) { pColVal = tRowIterNext(&rIter); diff --git a/source/dnode/vnode/src/tsdb/tsdbWrite.c b/source/dnode/vnode/src/tsdb/tsdbWrite.c index f38802aee7..49d5eaac43 100644 --- a/source/dnode/vnode/src/tsdb/tsdbWrite.c +++ b/source/dnode/vnode/src/tsdb/tsdbWrite.c @@ -15,6 +15,15 @@ #include "tsdb.h" +/** + * @brief max key by precision + * approximately calculation: + * ms: 3600*1000*8765*1000 // 1970 + 1000 years + * us: 3600*1000000*8765*1000 // 1970 + 1000 years + * ns: 3600*1000000000*8765*292 // 1970 + 292 years + */ +static int64_t tsMaxKeyByPrecision[] = {31556995200000L, 31556995200000000L, 9214646400000000000L}; + // static int tsdbScanAndConvertSubmitMsg(STsdb *pTsdb, SSubmitReq *pMsg); int tsdbInsertData(STsdb *pTsdb, int64_t version, SSubmitReq *pMsg, SSubmitRsp *pRsp) { @@ -97,7 +106,7 @@ int tsdbScanAndConvertSubmitMsg(STsdb *pTsdb, SSubmitReq *pMsg) { STsdbKeepCfg *pCfg = &pTsdb->keepCfg; TSKEY now = taosGetTimestamp(pCfg->precision); TSKEY minKey = now - tsTickPerMin[pCfg->precision] * pCfg->keep2; - TSKEY maxKey = now + tsTickPerMin[pCfg->precision] * pCfg->days; + TSKEY maxKey = tsMaxKeyByPrecision[pCfg->precision]; terrno = TSDB_CODE_SUCCESS; // pMsg->length = htonl(pMsg->length); diff --git a/source/dnode/vnode/src/vnd/vnodeModule.c b/source/dnode/vnode/src/vnd/vnodeModule.c index 9fe37505ad..782ffd788d 100644 --- a/source/dnode/vnode/src/vnd/vnodeModule.c +++ b/source/dnode/vnode/src/vnd/vnodeModule.c @@ -37,6 +37,12 @@ struct SVnodeGlobal vnodeGlobal; static void* loop(void* arg); +static tsem_t canCommit = {0}; + +static void vnodeInitCommit() { tsem_init(&canCommit, 0, 4); }; +void vnode_wait_commit() { tsem_wait(&canCommit); } +void vnode_done_commit() { tsem_wait(&canCommit); } + int vnodeInit(int nthreads) { int8_t init; int ret; diff --git a/source/libs/catalog/src/catalog.c b/source/libs/catalog/src/catalog.c index 1f87066c82..2dcd681205 100644 --- a/source/libs/catalog/src/catalog.c +++ b/source/libs/catalog/src/catalog.c @@ -715,10 +715,10 @@ _return: CTG_API_LEAVE(code); } -int32_t catalogGetDBVgVersion(SCatalog* pCtg, const char* dbFName, int32_t* version, int64_t* dbId, int32_t* tableNum) { +int32_t catalogGetDBVgVersion(SCatalog* pCtg, const char* dbFName, int32_t* version, int64_t* dbId, int32_t* tableNum, int64_t* pStateTs) { CTG_API_ENTER(); - if (NULL == pCtg || NULL == dbFName || NULL == version || NULL == dbId) { + if (NULL == pCtg || NULL == dbFName || NULL == version || NULL == dbId || NULL == tableNum || NULL == pStateTs) { CTG_API_LEAVE(TSDB_CODE_CTG_INVALID_INPUT); } diff --git a/source/libs/catalog/src/ctgAsync.c b/source/libs/catalog/src/ctgAsync.c index b601865306..ff3bd4d33c 100644 --- a/source/libs/catalog/src/ctgAsync.c +++ b/source/libs/catalog/src/ctgAsync.c @@ -1998,6 +1998,7 @@ int32_t ctgLaunchGetDbInfoTask(SCtgTask* pTask) { pInfo->vgVer = dbCache->vgCache.vgInfo->vgVersion; pInfo->dbId = dbCache->dbId; pInfo->tbNum = dbCache->vgCache.vgInfo->numOfTable; + pInfo->stateTs = dbCache->vgCache.vgInfo->stateTs; ctgReleaseVgInfoToCache(pCtg, dbCache); dbCache = NULL; diff --git a/source/libs/catalog/src/ctgCache.c b/source/libs/catalog/src/ctgCache.c index 51807a145a..e99beca69a 100644 --- a/source/libs/catalog/src/ctgCache.c +++ b/source/libs/catalog/src/ctgCache.c @@ -1231,14 +1231,16 @@ int32_t ctgAddNewDBCache(SCatalog *pCtg, const char *dbFName, uint64_t dbId) { CTG_CACHE_STAT_INC(numOfDb, 1); - SDbVgVersion vgVersion = {.dbId = newDBCache.dbId, .vgVersion = -1}; + SDbVgVersion vgVersion = {.dbId = newDBCache.dbId, .vgVersion = -1, .stateTs = 0}; tstrncpy(vgVersion.dbFName, dbFName, sizeof(vgVersion.dbFName)); ctgDebug("db added to cache, dbFName:%s, dbId:0x%" PRIx64, dbFName, dbId); - CTG_ERR_RET(ctgMetaRentAdd(&pCtg->dbRent, &vgVersion, dbId, sizeof(SDbVgVersion))); + if (!IS_SYS_DBNAME(dbFName)) { + CTG_ERR_RET(ctgMetaRentAdd(&pCtg->dbRent, &vgVersion, dbId, sizeof(SDbVgVersion))); - ctgDebug("db added to rent, dbFName:%s, vgVersion:%d, dbId:0x%" PRIx64, dbFName, vgVersion.vgVersion, dbId); + ctgDebug("db added to rent, dbFName:%s, vgVersion:%d, dbId:0x%" PRIx64, dbFName, vgVersion.vgVersion, dbId); + } return TSDB_CODE_SUCCESS; @@ -1563,7 +1565,7 @@ int32_t ctgOpUpdateVgroup(SCtgCacheOperation *operation) { } bool newAdded = false; - SDbVgVersion vgVersion = {.dbId = msg->dbId, .vgVersion = dbInfo->vgVersion, .numOfTable = dbInfo->numOfTable}; + SDbVgVersion vgVersion = {.dbId = msg->dbId, .vgVersion = dbInfo->vgVersion, .numOfTable = dbInfo->numOfTable, .stateTs = dbInfo->stateTs}; SCtgDBCache *dbCache = NULL; CTG_ERR_JRET(ctgGetAddDBCache(msg->pCtg, dbFName, msg->dbId, &dbCache)); @@ -1579,15 +1581,15 @@ int32_t ctgOpUpdateVgroup(SCtgCacheOperation *operation) { SDBVgInfo *vgInfo = vgCache->vgInfo; if (dbInfo->vgVersion < vgInfo->vgVersion) { - ctgDebug("db vgVer is old, dbFName:%s, vgVer:%d, curVer:%d", dbFName, dbInfo->vgVersion, vgInfo->vgVersion); + ctgDebug("db updateVgroup is ignored, dbFName:%s, vgVer:%d, curVer:%d", dbFName, dbInfo->vgVersion, vgInfo->vgVersion); ctgWUnlockVgInfo(dbCache); goto _return; } - if (dbInfo->vgVersion == vgInfo->vgVersion && dbInfo->numOfTable == vgInfo->numOfTable) { - ctgDebug("no new db vgVer or numOfTable, dbFName:%s, vgVer:%d, numOfTable:%d", dbFName, dbInfo->vgVersion, - dbInfo->numOfTable); + if (dbInfo->vgVersion == vgInfo->vgVersion && dbInfo->numOfTable == vgInfo->numOfTable && dbInfo->stateTs == vgInfo->stateTs) { + ctgDebug("no new db vgroup update info, dbFName:%s, vgVer:%d, numOfTable:%d, stateTs:%" PRId64, dbFName, dbInfo->vgVersion, + dbInfo->numOfTable, dbInfo->stateTs); ctgWUnlockVgInfo(dbCache); goto _return; @@ -1599,15 +1601,17 @@ int32_t ctgOpUpdateVgroup(SCtgCacheOperation *operation) { vgCache->vgInfo = dbInfo; msg->dbInfo = NULL; - ctgDebug("db vgInfo updated, dbFName:%s, vgVer:%d, dbId:0x%" PRIx64, dbFName, vgVersion.vgVersion, vgVersion.dbId); + ctgDebug("db vgInfo updated, dbFName:%s, vgVer:%d, stateTs:%" PRId64 ", dbId:0x%" PRIx64, dbFName, vgVersion.vgVersion, vgVersion.stateTs, vgVersion.dbId); ctgWUnlockVgInfo(dbCache); dbCache = NULL; - tstrncpy(vgVersion.dbFName, dbFName, sizeof(vgVersion.dbFName)); - CTG_ERR_JRET(ctgMetaRentUpdate(&msg->pCtg->dbRent, &vgVersion, vgVersion.dbId, sizeof(SDbVgVersion), - ctgDbVgVersionSortCompare, ctgDbVgVersionSearchCompare)); + if (!IS_SYS_DBNAME(dbFName)) { + tstrncpy(vgVersion.dbFName, dbFName, sizeof(vgVersion.dbFName)); + CTG_ERR_JRET(ctgMetaRentUpdate(&msg->pCtg->dbRent, &vgVersion, vgVersion.dbId, sizeof(SDbVgVersion), + ctgDbVgVersionSortCompare, ctgDbVgVersionSearchCompare)); + } _return: @@ -2170,7 +2174,6 @@ void *ctgUpdateThreadFunc(void *param) { CTG_RT_STAT_INC(numOfOpDequeue, 1); ctgdShowCacheInfo(); - ctgdShowClusterCache(pCtg); } qInfo("catalog update thread stopped"); diff --git a/source/libs/catalog/src/ctgDbg.c b/source/libs/catalog/src/ctgDbg.c index 26b5903bb0..b6ff1c8b98 100644 --- a/source/libs/catalog/src/ctgDbg.c +++ b/source/libs/catalog/src/ctgDbg.c @@ -78,7 +78,7 @@ void ctgdUserCallback(SMetaData *pResult, void *param, int32_t code) { num = taosArrayGetSize(pResult->pDbInfo); for (int32_t i = 0; i < num; ++i) { SDbInfo *pDb = taosArrayGet(pResult->pDbInfo, i); - qDebug("db %d dbInfo: vgVer:%d, tbNum:%d, dbId:0x%" PRIx64, i, pDb->vgVer, pDb->tbNum, pDb->dbId); + qDebug("db %d dbInfo: vgVer:%d, tbNum:%d, stateTs:%" PRId64 " dbId:0x%" PRIx64, i, pDb->vgVer, pDb->tbNum, pDb->stateTs, pDb->dbId); } } else { qDebug("empty db info"); @@ -462,6 +462,7 @@ void ctgdShowDBCache(SCatalog *pCtg, SHashObj *dbHash) { int32_t hashMethod = -1; int16_t hashPrefix = 0; int16_t hashSuffix = 0; + int64_t stateTs = 0; int32_t vgNum = 0; if (dbCache->vgCache.vgInfo) { @@ -469,16 +470,35 @@ void ctgdShowDBCache(SCatalog *pCtg, SHashObj *dbHash) { hashMethod = dbCache->vgCache.vgInfo->hashMethod; hashPrefix = dbCache->vgCache.vgInfo->hashPrefix; hashSuffix = dbCache->vgCache.vgInfo->hashSuffix; + stateTs = dbCache->vgCache.vgInfo->stateTs; if (dbCache->vgCache.vgInfo->vgHash) { vgNum = taosHashGetSize(dbCache->vgCache.vgInfo->vgHash); } } ctgDebug("[%d] db [%.*s][0x%" PRIx64 - "] %s: metaNum:%d, stbNum:%d, vgVersion:%d, hashMethod:%d, prefix:%d, suffix:%d, vgNum:%d", - i, (int32_t)len, dbFName, dbCache->dbId, dbCache->deleted ? "deleted" : "", metaNum, stbNum, vgVersion, + "] %s: metaNum:%d, stbNum:%d, vgVersion:%d, stateTs:%" PRId64 ", hashMethod:%d, prefix:%d, suffix:%d, vgNum:%d", + i, (int32_t)len, dbFName, dbCache->dbId, dbCache->deleted ? "deleted" : "", metaNum, stbNum, vgVersion, stateTs, hashMethod, hashPrefix, hashSuffix, vgNum); + if (dbCache->vgCache.vgInfo) { + int32_t i = 0; + void *pVgIter = taosHashIterate(dbCache->vgCache.vgInfo->vgHash, NULL); + while (pVgIter) { + SVgroupInfo * pVg = (SVgroupInfo *)pVgIter; + + ctgDebug("The %04dth VG [id:%d, hashBegin:%u, hashEnd:%u, numOfTable:%d, epNum:%d, inUse:%d]", + i++, pVg->vgId, pVg->hashBegin, pVg->hashEnd, pVg->numOfTable, pVg->epSet.numOfEps, pVg->epSet.inUse); + + for (int32_t n = 0; n < pVg->epSet.numOfEps; ++n) { + SEp *pEp = &pVg->epSet.eps[n]; + ctgDebug("\tEp %d [fqdn:%s, port:%d]", n, pEp->fqdn, pEp->port); + } + + pVgIter = taosHashIterate(dbCache->vgCache.vgInfo->vgHash, pVgIter); + } + } + pIter = taosHashIterate(dbHash, pIter); } } diff --git a/source/libs/catalog/test/catalogTests.cpp b/source/libs/catalog/test/catalogTests.cpp index ebf7c7baeb..5e543384ac 100644 --- a/source/libs/catalog/test/catalogTests.cpp +++ b/source/libs/catalog/test/catalogTests.cpp @@ -2486,7 +2486,8 @@ TEST(dbVgroup, getSetDbVgroupCase) { int32_t dbVer = 0; int64_t dbId = 0; int32_t tbNum = 0; - code = catalogGetDBVgVersion(pCtg, ctgTestDbname, &dbVer, &dbId, &tbNum); + int64_t stateTs = 0; + code = catalogGetDBVgVersion(pCtg, ctgTestDbname, &dbVer, &dbId, &tbNum, &stateTs); ASSERT_EQ(code, 0); ASSERT_EQ(dbVer, ctgTestVgVersion); ASSERT_EQ(dbId, ctgTestDbId); diff --git a/source/libs/command/src/command.c b/source/libs/command/src/command.c index 76c84b3be9..1c2d7e1f66 100644 --- a/source/libs/command/src/command.c +++ b/source/libs/command/src/command.c @@ -39,8 +39,7 @@ static int32_t buildRetrieveTableRsp(SSDataBlock* pBlock, int32_t numOfCols, SRe (*pRsp)->numOfRows = htonl(pBlock->info.rows); (*pRsp)->numOfCols = htonl(numOfCols); - int32_t len = 0; - blockEncode(pBlock, (*pRsp)->data, &len, numOfCols, false); + int32_t len = blockEncode(pBlock, (*pRsp)->data, numOfCols); ASSERT(len == rspSize - sizeof(SRetrieveTableRsp)); return TSDB_CODE_SUCCESS; diff --git a/source/libs/command/src/explain.c b/source/libs/command/src/explain.c index 80a524496c..915dc08c14 100644 --- a/source/libs/command/src/explain.c +++ b/source/libs/command/src/explain.c @@ -1610,8 +1610,7 @@ int32_t qExplainGetRspFromCtx(void *ctx, SRetrieveTableRsp **pRsp) { rsp->completed = 1; rsp->numOfRows = htonl(rowNum); - int32_t len = 0; - blockEncode(pBlock, rsp->data, &len, taosArrayGetSize(pBlock->pDataBlock), 0); + int32_t len = blockEncode(pBlock, rsp->data, taosArrayGetSize(pBlock->pDataBlock)); ASSERT(len == rspSize - sizeof(SRetrieveTableRsp)); rsp->compLen = htonl(len); diff --git a/source/libs/executor/inc/executorimpl.h b/source/libs/executor/inc/executorimpl.h index ced668cf37..62146b6048 100644 --- a/source/libs/executor/inc/executorimpl.h +++ b/source/libs/executor/inc/executorimpl.h @@ -842,10 +842,8 @@ typedef struct SJoinOperatorInfo { #define OPTR_IS_OPENED(_optr) (((_optr)->status & OP_OPENED) == OP_OPENED) #define OPTR_SET_OPENED(_optr) ((_optr)->status |= OP_OPENED) -void doDestroyExchangeOperatorInfo(void* param); - -SOperatorFpSet createOperatorFpSet(__optr_open_fn_t openFn, __optr_fn_t nextFn, __optr_fn_t streamFn, - __optr_fn_t cleanup, __optr_close_fn_t closeFn, __optr_explain_fn_t explain); +SOperatorFpSet createOperatorFpSet(__optr_open_fn_t openFn, __optr_fn_t nextFn, __optr_fn_t cleanup, + __optr_close_fn_t closeFn, __optr_explain_fn_t explain); int32_t operatorDummyOpenFn(SOperatorInfo* pOperator); int32_t appendDownstream(SOperatorInfo* p, SOperatorInfo** pDownstream, int32_t num); @@ -881,7 +879,11 @@ STimeWindow getFirstQualifiedTimeWindow(int64_t ts, STimeWindow* pWindow, SInter int32_t getTableScanInfo(SOperatorInfo* pOperator, int32_t* order, int32_t* scanFlag); int32_t getBufferPgSize(int32_t rowSize, uint32_t* defaultPgsz, uint32_t* defaultBufsz); -void doSetOperatorCompleted(SOperatorInfo* pOperator); +void doDestroyExchangeOperatorInfo(void* param); + +void setOperatorCompleted(SOperatorInfo* pOperator); +void setOperatorInfo(SOperatorInfo* pOperator, const char* name, int32_t type, bool blocking, int32_t status, void* pInfo, + SExecTaskInfo* pTaskInfo); void doFilter(SSDataBlock* pBlock, SFilterInfo* pFilterInfo, SColMatchInfo* pColMatchInfo); int32_t addTagPseudoColumnData(SReadHandle* pHandle, const SExprInfo* pExpr, int32_t numOfExpr, SSDataBlock* pBlock, int32_t rows, const char* idStr, STableMetaCacheInfo * pCache); diff --git a/source/libs/executor/src/cachescanoperator.c b/source/libs/executor/src/cachescanoperator.c index 76866eedb7..6f9084ce52 100644 --- a/source/libs/executor/src/cachescanoperator.c +++ b/source/libs/executor/src/cachescanoperator.c @@ -93,16 +93,11 @@ SOperatorInfo* createCacherowsScanOperator(SLastRowScanPhysiNode* pScanNode, SRe p->pCtx = createSqlFunctionCtx(p->pExprInfo, p->numOfExprs, &p->rowEntryInfoOffset); } - pOperator->name = "LastrowScanOperator"; - pOperator->operatorType = QUERY_NODE_PHYSICAL_PLAN_LAST_ROW_SCAN; - pOperator->blocking = false; - pOperator->status = OP_NOT_OPENED; - pOperator->info = pInfo; - pOperator->pTaskInfo = pTaskInfo; + setOperatorInfo(pOperator, "CachedRowScanOperator", QUERY_NODE_PHYSICAL_PLAN_LAST_ROW_SCAN, false, OP_NOT_OPENED, pInfo, pTaskInfo); pOperator->exprSupp.numOfExprs = taosArrayGetSize(pInfo->pRes->pDataBlock); pOperator->fpSet = - createOperatorFpSet(operatorDummyOpenFn, doScanCache, NULL, NULL, destroyLastrowScanOperator, NULL); + createOperatorFpSet(operatorDummyOpenFn, doScanCache, NULL, destroyLastrowScanOperator, NULL); pOperator->cost.openCost = 0; return pOperator; @@ -126,7 +121,7 @@ SSDataBlock* doScanCache(SOperatorInfo* pOperator) { uint64_t suid = tableListGetSuid(pTableList); int32_t size = tableListGetSize(pTableList); if (size == 0) { - doSetOperatorCompleted(pOperator); + setOperatorCompleted(pOperator); return NULL; } @@ -182,7 +177,7 @@ SSDataBlock* doScanCache(SOperatorInfo* pOperator) { pInfo->indexOfBufferedRes += 1; return pRes; } else { - doSetOperatorCompleted(pOperator); + setOperatorCompleted(pOperator); return NULL; } } else { @@ -234,7 +229,7 @@ SSDataBlock* doScanCache(SOperatorInfo* pOperator) { } } - doSetOperatorCompleted(pOperator); + setOperatorCompleted(pOperator); return NULL; } } diff --git a/source/libs/executor/src/dataDispatcher.c b/source/libs/executor/src/dataDispatcher.c index bc4ab9c468..3d9757c96f 100644 --- a/source/libs/executor/src/dataDispatcher.c +++ b/source/libs/executor/src/dataDispatcher.c @@ -76,7 +76,7 @@ static void toDataCacheEntry(SDataDispatchHandle* pHandle, const SInputData* pIn pEntry->dataLen = 0; pBuf->useSize = sizeof(SDataCacheEntry); - blockEncode(pInput->pData, pEntry->data, &pEntry->dataLen, numOfCols, pEntry->compressed); + pEntry->dataLen = blockEncode(pInput->pData, pEntry->data, numOfCols); ASSERT(pEntry->numOfRows == *(int32_t*)(pEntry->data + 8)); ASSERT(pEntry->numOfCols == *(int32_t*)(pEntry->data + 8 + 4)); diff --git a/source/libs/executor/src/exchangeoperator.c b/source/libs/executor/src/exchangeoperator.c new file mode 100644 index 0000000000..049de727df --- /dev/null +++ b/source/libs/executor/src/exchangeoperator.c @@ -0,0 +1,638 @@ +/* + * 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 "filter.h" +#include "function.h" +#include "functionMgt.h" +#include "os.h" +#include "querynodes.h" +#include "tfill.h" +#include "tname.h" +#include "tref.h" + +#include "tdatablock.h" +#include "tglobal.h" +#include "tmsg.h" +#include "tsort.h" +#include "ttime.h" + +#include "executorimpl.h" +#include "index.h" +#include "query.h" +#include "tcompare.h" +#include "thash.h" +#include "ttypes.h" +#include "vnode.h" + +typedef struct SFetchRspHandleWrapper { + uint32_t exchangeId; + int32_t sourceIndex; +} SFetchRspHandleWrapper; + +static void destroyExchangeOperatorInfo(void* param); +static void freeBlock(void* pParam); +static void freeSourceDataInfo(void* param); +static void* setAllSourcesCompleted(SOperatorInfo* pOperator, int64_t startTs); + +static int32_t loadRemoteDataCallback(void* param, SDataBuf* pMsg, int32_t code); +static int32_t doSendFetchDataRequest(SExchangeInfo* pExchangeInfo, SExecTaskInfo* pTaskInfo, int32_t sourceIndex); +static int32_t getCompletedSources(const SArray* pArray); +static int32_t prepareConcurrentlyLoad(SOperatorInfo* pOperator); +static int32_t seqLoadRemoteData(SOperatorInfo* pOperator); +static int32_t prepareLoadRemoteData(SOperatorInfo* pOperator); + +static void concurrentlyLoadRemoteDataImpl(SOperatorInfo* pOperator, SExchangeInfo* pExchangeInfo, + SExecTaskInfo* pTaskInfo) { + int32_t code = 0; + size_t totalSources = taosArrayGetSize(pExchangeInfo->pSourceDataInfo); + int32_t completed = getCompletedSources(pExchangeInfo->pSourceDataInfo); + if (completed == totalSources) { + setAllSourcesCompleted(pOperator, pExchangeInfo->openedTs); + return; + } + + while (1) { + tsem_wait(&pExchangeInfo->ready); + + for (int32_t i = 0; i < totalSources; ++i) { + SSourceDataInfo* pDataInfo = taosArrayGet(pExchangeInfo->pSourceDataInfo, i); + if (pDataInfo->status == EX_SOURCE_DATA_EXHAUSTED) { + continue; + } + + if (pDataInfo->status != EX_SOURCE_DATA_READY) { + continue; + } + + if (pDataInfo->code != TSDB_CODE_SUCCESS) { + code = pDataInfo->code; + goto _error; + } + + SRetrieveTableRsp* pRsp = pDataInfo->pRsp; + SDownstreamSourceNode* pSource = taosArrayGet(pExchangeInfo->pSources, i); + + // todo + SLoadRemoteDataInfo* pLoadInfo = &pExchangeInfo->loadInfo; + if (pRsp->numOfRows == 0) { + pDataInfo->status = EX_SOURCE_DATA_EXHAUSTED; + qDebug("%s vgId:%d, taskId:0x%" PRIx64 " execId:%d index:%d completed, rowsOfSource:%" PRIu64 + ", totalRows:%" PRIu64 ", try next %d/%" PRIzu, + GET_TASKID(pTaskInfo), pSource->addr.nodeId, pSource->taskId, pSource->execId, i, pDataInfo->totalRows, + pExchangeInfo->loadInfo.totalRows, i + 1, totalSources); + taosMemoryFreeClear(pDataInfo->pRsp); + break; + } + + SRetrieveTableRsp* pRetrieveRsp = pDataInfo->pRsp; + int32_t index = 0; + char* pStart = pRetrieveRsp->data; + while (index++ < pRetrieveRsp->numOfBlocks) { + SSDataBlock* pb = createOneDataBlock(pExchangeInfo->pDummyBlock, false); + code = extractDataBlockFromFetchRsp(pb, pStart, NULL, &pStart); + if (code != 0) { + taosMemoryFreeClear(pDataInfo->pRsp); + goto _error; + } + + taosArrayPush(pExchangeInfo->pResultBlockList, &pb); + } + + updateLoadRemoteInfo(pLoadInfo, pRetrieveRsp->numOfRows, pRetrieveRsp->compLen, pExchangeInfo->openedTs, pOperator); + + if (pRsp->completed == 1) { + pDataInfo->status = EX_SOURCE_DATA_EXHAUSTED; + qDebug("%s fetch msg rsp from vgId:%d, taskId:0x%" PRIx64 + " execId:%d index:%d completed, blocks:%d, numOfRows:%d, rowsOfSource:%" PRIu64 ", totalRows:%" PRIu64 + ", total:%.2f Kb, try next %d/%" PRIzu, + GET_TASKID(pTaskInfo), pSource->addr.nodeId, pSource->taskId, pSource->execId, i, pRsp->numOfBlocks, + pRsp->numOfRows, pDataInfo->totalRows, pLoadInfo->totalRows, pLoadInfo->totalSize / 1024.0, + i + 1, totalSources); + } else { + qDebug("%s fetch msg rsp from vgId:%d, taskId:0x%" PRIx64 + " execId:%d blocks:%d, numOfRows:%d, totalRows:%" PRIu64 ", total:%.2f Kb", + GET_TASKID(pTaskInfo), pSource->addr.nodeId, pSource->taskId, pSource->execId, pRsp->numOfBlocks, + pRsp->numOfRows, pLoadInfo->totalRows, pLoadInfo->totalSize / 1024.0); + } + + taosMemoryFreeClear(pDataInfo->pRsp); + + if (pDataInfo->status != EX_SOURCE_DATA_EXHAUSTED) { + pDataInfo->status = EX_SOURCE_DATA_NOT_READY; + code = doSendFetchDataRequest(pExchangeInfo, pTaskInfo, i); + if (code != TSDB_CODE_SUCCESS) { + taosMemoryFreeClear(pDataInfo->pRsp); + goto _error; + } + } + return; + } // end loop + + int32_t complete1 = getCompletedSources(pExchangeInfo->pSourceDataInfo); + if (complete1 == totalSources) { + qDebug("all sources are completed, %s", GET_TASKID(pTaskInfo)); + return; + } + } + + _error: + pTaskInfo->code = code; +} + +static SSDataBlock* doLoadRemoteDataImpl(SOperatorInfo* pOperator) { + SExchangeInfo* pExchangeInfo = pOperator->info; + SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo; + + pTaskInfo->code = pOperator->fpSet._openFn(pOperator); + if (pTaskInfo->code != TSDB_CODE_SUCCESS) { + return NULL; + } + + size_t totalSources = taosArrayGetSize(pExchangeInfo->pSources); + + SLoadRemoteDataInfo* pLoadInfo = &pExchangeInfo->loadInfo; + if (pOperator->status == OP_EXEC_DONE) { + qDebug("%s all %" PRIzu " source(s) are exhausted, total rows:%" PRIu64 " bytes:%" PRIu64 ", elapsed:%.2f ms", + GET_TASKID(pTaskInfo), totalSources, pLoadInfo->totalRows, pLoadInfo->totalSize, + pLoadInfo->totalElapsed / 1000.0); + return NULL; + } + + size_t size = taosArrayGetSize(pExchangeInfo->pResultBlockList); + if (size == 0 || pExchangeInfo->rspBlockIndex >= size) { + pExchangeInfo->rspBlockIndex = 0; + taosArrayClearEx(pExchangeInfo->pResultBlockList, freeBlock); + if (pExchangeInfo->seqLoadData) { + seqLoadRemoteData(pOperator); + } else { + concurrentlyLoadRemoteDataImpl(pOperator, pExchangeInfo, pTaskInfo); + } + + if (taosArrayGetSize(pExchangeInfo->pResultBlockList) == 0) { + return NULL; + } + } + + // we have buffered retrieved datablock, return it directly + return taosArrayGetP(pExchangeInfo->pResultBlockList, pExchangeInfo->rspBlockIndex++); +} + +static SSDataBlock* doLoadRemoteData(SOperatorInfo* pOperator) { + SExchangeInfo* pExchangeInfo = pOperator->info; + SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo; + + if (pOperator->status == OP_EXEC_DONE) { + return NULL; + } + + while (1) { + SSDataBlock* pBlock = doLoadRemoteDataImpl(pOperator); + if (pBlock == NULL) { + return NULL; + } + + SLimitInfo* pLimitInfo = &pExchangeInfo->limitInfo; + if (hasLimitOffsetInfo(pLimitInfo)) { + int32_t status = handleLimitOffset(pOperator, pLimitInfo, pBlock, false); + if (status == PROJECT_RETRIEVE_CONTINUE) { + continue; + } else if (status == PROJECT_RETRIEVE_DONE) { + size_t rows = pBlock->info.rows; + pExchangeInfo->limitInfo.numOfOutputRows += rows; + + if (rows == 0) { + setOperatorCompleted(pOperator); + return NULL; + } else { + return pBlock; + } + } + } else { + return pBlock; + } + } +} + +static int32_t initDataSource(int32_t numOfSources, SExchangeInfo* pInfo, const char* id) { + pInfo->pSourceDataInfo = taosArrayInit(numOfSources, sizeof(SSourceDataInfo)); + if (pInfo->pSourceDataInfo == NULL) { + return TSDB_CODE_OUT_OF_MEMORY; + } + + for (int32_t i = 0; i < numOfSources; ++i) { + SSourceDataInfo dataInfo = {0}; + dataInfo.status = EX_SOURCE_DATA_NOT_READY; + dataInfo.taskId = id; + dataInfo.index = i; + SSourceDataInfo* pDs = taosArrayPush(pInfo->pSourceDataInfo, &dataInfo); + if (pDs == NULL) { + taosArrayDestroy(pInfo->pSourceDataInfo); + return TSDB_CODE_OUT_OF_MEMORY; + } + } + + return TSDB_CODE_SUCCESS; +} + +static int32_t initExchangeOperator(SExchangePhysiNode* pExNode, SExchangeInfo* pInfo, const char* id) { + size_t numOfSources = LIST_LENGTH(pExNode->pSrcEndPoints); + + if (numOfSources == 0) { + qError("%s invalid number: %d of sources in exchange operator", id, (int32_t)numOfSources); + return TSDB_CODE_INVALID_PARA; + } + + pInfo->pSources = taosArrayInit(numOfSources, sizeof(SDownstreamSourceNode)); + if (pInfo->pSources == NULL) { + return TSDB_CODE_OUT_OF_MEMORY; + } + + for (int32_t i = 0; i < numOfSources; ++i) { + SDownstreamSourceNode* pNode = (SDownstreamSourceNode*)nodesListGetNode((SNodeList*)pExNode->pSrcEndPoints, i); + taosArrayPush(pInfo->pSources, pNode); + } + + initLimitInfo(pExNode->node.pLimit, pExNode->node.pSlimit, &pInfo->limitInfo); + pInfo->self = taosAddRef(exchangeObjRefPool, pInfo); + + return initDataSource(numOfSources, pInfo, id); +} + +SOperatorInfo* createExchangeOperatorInfo(void* pTransporter, SExchangePhysiNode* pExNode, SExecTaskInfo* pTaskInfo) { + SExchangeInfo* pInfo = taosMemoryCalloc(1, sizeof(SExchangeInfo)); + SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo)); + if (pInfo == NULL || pOperator == NULL) { + goto _error; + } + + int32_t code = initExchangeOperator(pExNode, pInfo, GET_TASKID(pTaskInfo)); + if (code != TSDB_CODE_SUCCESS) { + goto _error; + } + + tsem_init(&pInfo->ready, 0, 0); + pInfo->pDummyBlock = createResDataBlock(pExNode->node.pOutputDataBlockDesc); + pInfo->pResultBlockList = taosArrayInit(1, POINTER_BYTES); + + pInfo->seqLoadData = false; + pInfo->pTransporter = pTransporter; + + setOperatorInfo(pOperator, "ExchangeOperator", QUERY_NODE_PHYSICAL_PLAN_EXCHANGE, false, OP_NOT_OPENED, pInfo, pTaskInfo); + pOperator->exprSupp.numOfExprs = taosArrayGetSize(pInfo->pDummyBlock->pDataBlock); + + pOperator->fpSet = createOperatorFpSet(prepareLoadRemoteData, doLoadRemoteData, NULL, destroyExchangeOperatorInfo, NULL); + return pOperator; + + _error: + if (pInfo != NULL) { + doDestroyExchangeOperatorInfo(pInfo); + } + + taosMemoryFreeClear(pOperator); + pTaskInfo->code = code; + return NULL; +} + +void destroyExchangeOperatorInfo(void* param) { + SExchangeInfo* pExInfo = (SExchangeInfo*)param; + taosRemoveRef(exchangeObjRefPool, pExInfo->self); +} + +void freeBlock(void* pParam) { + SSDataBlock* pBlock = *(SSDataBlock**)pParam; + blockDataDestroy(pBlock); +} + +void freeSourceDataInfo(void* p) { + SSourceDataInfo* pInfo = (SSourceDataInfo*)p; + taosMemoryFreeClear(pInfo->pRsp); +} + +void doDestroyExchangeOperatorInfo(void* param) { + SExchangeInfo* pExInfo = (SExchangeInfo*)param; + + taosArrayDestroy(pExInfo->pSources); + taosArrayDestroyEx(pExInfo->pSourceDataInfo, freeSourceDataInfo); + + if (pExInfo->pResultBlockList != NULL) { + taosArrayDestroyEx(pExInfo->pResultBlockList, freeBlock); + pExInfo->pResultBlockList = NULL; + } + + blockDataDestroy(pExInfo->pDummyBlock); + + tsem_destroy(&pExInfo->ready); + taosMemoryFreeClear(param); +} + +int32_t loadRemoteDataCallback(void* param, SDataBuf* pMsg, int32_t code) { + SFetchRspHandleWrapper* pWrapper = (SFetchRspHandleWrapper*)param; + + SExchangeInfo* pExchangeInfo = taosAcquireRef(exchangeObjRefPool, pWrapper->exchangeId); + if (pExchangeInfo == NULL) { + qWarn("failed to acquire exchange operator, since it may have been released"); + taosMemoryFree(pMsg->pData); + return TSDB_CODE_SUCCESS; + } + + int32_t index = pWrapper->sourceIndex; + SSourceDataInfo* pSourceDataInfo = taosArrayGet(pExchangeInfo->pSourceDataInfo, index); + + if (code == TSDB_CODE_SUCCESS) { + pSourceDataInfo->pRsp = pMsg->pData; + + SRetrieveTableRsp* pRsp = pSourceDataInfo->pRsp; + pRsp->numOfRows = htonl(pRsp->numOfRows); + pRsp->compLen = htonl(pRsp->compLen); + pRsp->numOfCols = htonl(pRsp->numOfCols); + pRsp->useconds = htobe64(pRsp->useconds); + pRsp->numOfBlocks = htonl(pRsp->numOfBlocks); + + ASSERT(pRsp != NULL); + qDebug("%s fetch rsp received, index:%d, blocks:%d, rows:%d", pSourceDataInfo->taskId, index, pRsp->numOfBlocks, + pRsp->numOfRows); + } else { + taosMemoryFree(pMsg->pData); + pSourceDataInfo->code = code; + qDebug("%s fetch rsp received, index:%d, error:%s", pSourceDataInfo->taskId, index, tstrerror(code)); + } + + pSourceDataInfo->status = EX_SOURCE_DATA_READY; + + tsem_post(&pExchangeInfo->ready); + taosReleaseRef(exchangeObjRefPool, pWrapper->exchangeId); + + return TSDB_CODE_SUCCESS; +} + +int32_t doSendFetchDataRequest(SExchangeInfo* pExchangeInfo, SExecTaskInfo* pTaskInfo, int32_t sourceIndex) { + size_t totalSources = taosArrayGetSize(pExchangeInfo->pSources); + + SDownstreamSourceNode* pSource = taosArrayGet(pExchangeInfo->pSources, sourceIndex); + SSourceDataInfo* pDataInfo = taosArrayGet(pExchangeInfo->pSourceDataInfo, sourceIndex); + + ASSERT(pDataInfo->status == EX_SOURCE_DATA_NOT_READY); + + SFetchRspHandleWrapper* pWrapper = taosMemoryCalloc(1, sizeof(SFetchRspHandleWrapper)); + pWrapper->exchangeId = pExchangeInfo->self; + pWrapper->sourceIndex = sourceIndex; + + if (pSource->localExec) { + SDataBuf pBuf = {0}; + int32_t code = + (*pTaskInfo->localFetch.fp)(pTaskInfo->localFetch.handle, pSource->schedId, pTaskInfo->id.queryId, + pSource->taskId, 0, pSource->execId, &pBuf.pData, pTaskInfo->localFetch.explainRes); + loadRemoteDataCallback(pWrapper, &pBuf, code); + taosMemoryFree(pWrapper); + } else { + SResFetchReq* pMsg = taosMemoryCalloc(1, sizeof(SResFetchReq)); + if (NULL == pMsg) { + pTaskInfo->code = TSDB_CODE_QRY_OUT_OF_MEMORY; + taosMemoryFree(pWrapper); + return pTaskInfo->code; + } + + qDebug("%s build fetch msg and send to vgId:%d, ep:%s, taskId:0x%" PRIx64 ", execId:%d, %d/%" PRIzu, + GET_TASKID(pTaskInfo), pSource->addr.nodeId, pSource->addr.epSet.eps[0].fqdn, pSource->taskId, + pSource->execId, sourceIndex, totalSources); + + pMsg->header.vgId = htonl(pSource->addr.nodeId); + pMsg->sId = htobe64(pSource->schedId); + pMsg->taskId = htobe64(pSource->taskId); + pMsg->queryId = htobe64(pTaskInfo->id.queryId); + pMsg->execId = htonl(pSource->execId); + + // send the fetch remote task result reques + SMsgSendInfo* pMsgSendInfo = taosMemoryCalloc(1, sizeof(SMsgSendInfo)); + if (NULL == pMsgSendInfo) { + taosMemoryFreeClear(pMsg); + taosMemoryFree(pWrapper); + qError("%s prepare message %d failed", GET_TASKID(pTaskInfo), (int32_t)sizeof(SMsgSendInfo)); + pTaskInfo->code = TSDB_CODE_QRY_OUT_OF_MEMORY; + return pTaskInfo->code; + } + + pMsgSendInfo->param = pWrapper; + pMsgSendInfo->paramFreeFp = taosMemoryFree; + pMsgSendInfo->msgInfo.pData = pMsg; + pMsgSendInfo->msgInfo.len = sizeof(SResFetchReq); + pMsgSendInfo->msgType = pSource->fetchMsgType; + pMsgSendInfo->fp = loadRemoteDataCallback; + + int64_t transporterId = 0; + int32_t code = + asyncSendMsgToServer(pExchangeInfo->pTransporter, &pSource->addr.epSet, &transporterId, pMsgSendInfo); + } + + return TSDB_CODE_SUCCESS; +} + +void updateLoadRemoteInfo(SLoadRemoteDataInfo* pInfo, int32_t numOfRows, int32_t dataLen, int64_t startTs, + SOperatorInfo* pOperator) { + pInfo->totalRows += numOfRows; + pInfo->totalSize += dataLen; + pInfo->totalElapsed += (taosGetTimestampUs() - startTs); + pOperator->resultInfo.totalRows += numOfRows; +} + +int32_t extractDataBlockFromFetchRsp(SSDataBlock* pRes, char* pData, SArray* pColList, char** pNextStart) { + if (pColList == NULL) { // data from other sources + blockDataCleanup(pRes); + *pNextStart = (char*)blockDecode(pRes, pData); + } else { // extract data according to pColList + char* pStart = pData; + + int32_t numOfCols = htonl(*(int32_t*)pStart); + pStart += sizeof(int32_t); + + // todo refactor:extract method + SSysTableSchema* pSchema = (SSysTableSchema*)pStart; + for (int32_t i = 0; i < numOfCols; ++i) { + SSysTableSchema* p = (SSysTableSchema*)pStart; + + p->colId = htons(p->colId); + p->bytes = htonl(p->bytes); + pStart += sizeof(SSysTableSchema); + } + + SSDataBlock* pBlock = createDataBlock(); + for (int32_t i = 0; i < numOfCols; ++i) { + SColumnInfoData idata = createColumnInfoData(pSchema[i].type, pSchema[i].bytes, pSchema[i].colId); + blockDataAppendColInfo(pBlock, &idata); + } + + blockDecode(pBlock, pStart); + blockDataEnsureCapacity(pRes, pBlock->info.rows); + + // data from mnode + pRes->info.rows = pBlock->info.rows; + relocateColumnData(pRes, pColList, pBlock->pDataBlock, false); + blockDataDestroy(pBlock); + } + + // todo move this to time window aggregator, since the primary timestamp may not be known by exchange operator. + blockDataUpdateTsWindow(pRes, 0); + return TSDB_CODE_SUCCESS; +} + +void* setAllSourcesCompleted(SOperatorInfo* pOperator, int64_t startTs) { + SExchangeInfo* pExchangeInfo = pOperator->info; + SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo; + + int64_t el = taosGetTimestampUs() - startTs; + SLoadRemoteDataInfo* pLoadInfo = &pExchangeInfo->loadInfo; + + pLoadInfo->totalElapsed += el; + + size_t totalSources = taosArrayGetSize(pExchangeInfo->pSources); + qDebug("%s all %" PRIzu " sources are exhausted, total rows: %" PRIu64 " bytes:%" PRIu64 ", elapsed:%.2f ms", + GET_TASKID(pTaskInfo), totalSources, pLoadInfo->totalRows, pLoadInfo->totalSize, + pLoadInfo->totalElapsed / 1000.0); + + setOperatorCompleted(pOperator); + return NULL; +} + +int32_t getCompletedSources(const SArray* pArray) { + size_t total = taosArrayGetSize(pArray); + + int32_t completed = 0; + for (int32_t k = 0; k < total; ++k) { + SSourceDataInfo* p = taosArrayGet(pArray, k); + if (p->status == EX_SOURCE_DATA_EXHAUSTED) { + completed += 1; + } + } + + return completed; +} + +int32_t prepareConcurrentlyLoad(SOperatorInfo* pOperator) { + SExchangeInfo* pExchangeInfo = pOperator->info; + SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo; + + size_t totalSources = taosArrayGetSize(pExchangeInfo->pSources); + int64_t startTs = taosGetTimestampUs(); + + // Asynchronously send all fetch requests to all sources. + for (int32_t i = 0; i < totalSources; ++i) { + int32_t code = doSendFetchDataRequest(pExchangeInfo, pTaskInfo, i); + if (code != TSDB_CODE_SUCCESS) { + pTaskInfo->code = code; + return code; + } + } + + int64_t endTs = taosGetTimestampUs(); + qDebug("%s send all fetch requests to %" PRIzu " sources completed, elapsed:%.2fms", GET_TASKID(pTaskInfo), + totalSources, (endTs - startTs) / 1000.0); + + pOperator->status = OP_RES_TO_RETURN; + pOperator->cost.openCost = taosGetTimestampUs() - startTs; + + tsem_wait(&pExchangeInfo->ready); + tsem_post(&pExchangeInfo->ready); + return TSDB_CODE_SUCCESS; +} + +int32_t seqLoadRemoteData(SOperatorInfo* pOperator) { + SExchangeInfo* pExchangeInfo = pOperator->info; + SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo; + + size_t totalSources = taosArrayGetSize(pExchangeInfo->pSources); + int64_t startTs = taosGetTimestampUs(); + + while (1) { + if (pExchangeInfo->current >= totalSources) { + setAllSourcesCompleted(pOperator, startTs); + return TSDB_CODE_SUCCESS; + } + + doSendFetchDataRequest(pExchangeInfo, pTaskInfo, pExchangeInfo->current); + tsem_wait(&pExchangeInfo->ready); + + SSourceDataInfo* pDataInfo = taosArrayGet(pExchangeInfo->pSourceDataInfo, pExchangeInfo->current); + SDownstreamSourceNode* pSource = taosArrayGet(pExchangeInfo->pSources, pExchangeInfo->current); + + if (pDataInfo->code != TSDB_CODE_SUCCESS) { + qError("%s vgId:%d, taskID:0x%" PRIx64 " execId:%d error happens, code:%s", GET_TASKID(pTaskInfo), + pSource->addr.nodeId, pSource->taskId, pSource->execId, tstrerror(pDataInfo->code)); + pOperator->pTaskInfo->code = pDataInfo->code; + return pOperator->pTaskInfo->code; + } + + SRetrieveTableRsp* pRsp = pDataInfo->pRsp; + SLoadRemoteDataInfo* pLoadInfo = &pExchangeInfo->loadInfo; + if (pRsp->numOfRows == 0) { + qDebug("%s vgId:%d, taskID:0x%" PRIx64 " execId:%d %d of total completed, rowsOfSource:%" PRIu64 + ", totalRows:%" PRIu64 " try next", + GET_TASKID(pTaskInfo), pSource->addr.nodeId, pSource->taskId, pSource->execId, pExchangeInfo->current + 1, + pDataInfo->totalRows, pLoadInfo->totalRows); + + pDataInfo->status = EX_SOURCE_DATA_EXHAUSTED; + pExchangeInfo->current += 1; + taosMemoryFreeClear(pDataInfo->pRsp); + continue; + } + + SRetrieveTableRsp* pRetrieveRsp = pDataInfo->pRsp; + + char* pStart = pRetrieveRsp->data; + int32_t code = extractDataBlockFromFetchRsp(NULL, pStart, NULL, &pStart); + + if (pRsp->completed == 1) { + qDebug("%s fetch msg rsp from vgId:%d, taskId:0x%" PRIx64 " execId:%d numOfRows:%d, rowsOfSource:%" PRIu64 + ", totalRows:%" PRIu64 ", totalBytes:%" PRIu64 " try next %d/%" PRIzu, + GET_TASKID(pTaskInfo), pSource->addr.nodeId, pSource->taskId, pSource->execId, pRetrieveRsp->numOfRows, + pDataInfo->totalRows, pLoadInfo->totalRows, pLoadInfo->totalSize, pExchangeInfo->current + 1, + totalSources); + + pDataInfo->status = EX_SOURCE_DATA_EXHAUSTED; + pExchangeInfo->current += 1; + } else { + qDebug("%s fetch msg rsp from vgId:%d, taskId:0x%" PRIx64 " execId:%d numOfRows:%d, totalRows:%" PRIu64 + ", totalBytes:%" PRIu64, + GET_TASKID(pTaskInfo), pSource->addr.nodeId, pSource->taskId, pSource->execId, pRetrieveRsp->numOfRows, + pLoadInfo->totalRows, pLoadInfo->totalSize); + } + + updateLoadRemoteInfo(pLoadInfo, pRetrieveRsp->numOfRows, pRetrieveRsp->compLen, startTs, pOperator); + pDataInfo->totalRows += pRetrieveRsp->numOfRows; + + taosMemoryFreeClear(pDataInfo->pRsp); + return TSDB_CODE_SUCCESS; + } +} + +int32_t prepareLoadRemoteData(SOperatorInfo* pOperator) { + if (OPTR_IS_OPENED(pOperator)) { + return TSDB_CODE_SUCCESS; + } + + int64_t st = taosGetTimestampUs(); + + SExchangeInfo* pExchangeInfo = pOperator->info; + if (!pExchangeInfo->seqLoadData) { + int32_t code = prepareConcurrentlyLoad(pOperator); + if (code != TSDB_CODE_SUCCESS) { + return code; + } + pExchangeInfo->openedTs = taosGetTimestampUs(); + } + + OPTR_SET_OPENED(pOperator); + pOperator->cost.openCost = (taosGetTimestampUs() - st) / 1000.0; + return TSDB_CODE_SUCCESS; +} diff --git a/source/libs/executor/src/executor.c b/source/libs/executor/src/executor.c index 1cf01c8661..1aa9a3c613 100644 --- a/source/libs/executor/src/executor.c +++ b/source/libs/executor/src/executor.c @@ -1106,3 +1106,24 @@ int32_t qStreamPrepareScan(qTaskInfo_t tinfo, STqOffsetVal* pOffset, int8_t subT } return 0; } + +void qProcessRspMsg(void* parent, SRpcMsg* pMsg, SEpSet* pEpSet) { + SMsgSendInfo* pSendInfo = (SMsgSendInfo*)pMsg->info.ahandle; + assert(pMsg->info.ahandle != NULL); + + SDataBuf buf = {.len = pMsg->contLen, .pData = NULL}; + + if (pMsg->contLen > 0) { + buf.pData = taosMemoryCalloc(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); + destroySendMsgInfo(pSendInfo); +} \ No newline at end of file diff --git a/source/libs/executor/src/executorimpl.c b/source/libs/executor/src/executorimpl.c index 7d662f8784..709e981a1f 100644 --- a/source/libs/executor/src/executorimpl.c +++ b/source/libs/executor/src/executorimpl.c @@ -32,7 +32,6 @@ #include "index.h" #include "query.h" #include "tcompare.h" -#include "tcompression.h" #include "thash.h" #include "ttypes.h" #include "vnode.h" @@ -91,11 +90,11 @@ static void destroySortOperatorInfo(void* param); static void destroyAggOperatorInfo(void* param); static void destroyIntervalOperatorInfo(void* param); -static void destroyExchangeOperatorInfo(void* param); + static void destroyOperatorInfo(SOperatorInfo* pOperator); -void doSetOperatorCompleted(SOperatorInfo* pOperator) { +void setOperatorCompleted(SOperatorInfo* pOperator) { pOperator->status = OP_EXEC_DONE; ASSERT(pOperator->pTaskInfo != NULL); @@ -103,14 +102,24 @@ void doSetOperatorCompleted(SOperatorInfo* pOperator) { setTaskStatus(pOperator->pTaskInfo, TASK_COMPLETED); } +void setOperatorInfo(SOperatorInfo* pOperator, const char* name, int32_t type, bool blocking, int32_t status, + void* pInfo, SExecTaskInfo* pTaskInfo) { + pOperator->name = (char*)name; + pOperator->operatorType = type; + pOperator->blocking = blocking; + pOperator->status = status; + pOperator->info = pInfo; + pOperator->pTaskInfo = pTaskInfo; +} + int32_t operatorDummyOpenFn(SOperatorInfo* pOperator) { OPTR_SET_OPENED(pOperator); pOperator->cost.openCost = 0; return TSDB_CODE_SUCCESS; } -SOperatorFpSet createOperatorFpSet(__optr_open_fn_t openFn, __optr_fn_t nextFn, __optr_fn_t streamFn, - __optr_fn_t cleanup, __optr_close_fn_t closeFn, __optr_explain_fn_t explain) { +SOperatorFpSet createOperatorFpSet(__optr_open_fn_t openFn, __optr_fn_t nextFn, __optr_fn_t cleanup, + __optr_close_fn_t closeFn, __optr_explain_fn_t explain) { SOperatorFpSet fpSet = { ._openFn = openFn, .getNextFn = nextFn, @@ -1652,596 +1661,6 @@ int32_t appendDownstream(SOperatorInfo* p, SOperatorInfo** pDownstream, int32_t return TSDB_CODE_SUCCESS; } -typedef struct SFetchRspHandleWrapper { - uint32_t exchangeId; - int32_t sourceIndex; -} SFetchRspHandleWrapper; - -int32_t loadRemoteDataCallback(void* param, SDataBuf* pMsg, int32_t code) { - SFetchRspHandleWrapper* pWrapper = (SFetchRspHandleWrapper*)param; - - SExchangeInfo* pExchangeInfo = taosAcquireRef(exchangeObjRefPool, pWrapper->exchangeId); - if (pExchangeInfo == NULL) { - qWarn("failed to acquire exchange operator, since it may have been released"); - taosMemoryFree(pMsg->pData); - return TSDB_CODE_SUCCESS; - } - - int32_t index = pWrapper->sourceIndex; - SSourceDataInfo* pSourceDataInfo = taosArrayGet(pExchangeInfo->pSourceDataInfo, index); - - if (code == TSDB_CODE_SUCCESS) { - pSourceDataInfo->pRsp = pMsg->pData; - - SRetrieveTableRsp* pRsp = pSourceDataInfo->pRsp; - pRsp->numOfRows = htonl(pRsp->numOfRows); - pRsp->compLen = htonl(pRsp->compLen); - pRsp->numOfCols = htonl(pRsp->numOfCols); - pRsp->useconds = htobe64(pRsp->useconds); - pRsp->numOfBlocks = htonl(pRsp->numOfBlocks); - - ASSERT(pRsp != NULL); - qDebug("%s fetch rsp received, index:%d, blocks:%d, rows:%d", pSourceDataInfo->taskId, index, pRsp->numOfBlocks, - pRsp->numOfRows); - } else { - taosMemoryFree(pMsg->pData); - pSourceDataInfo->code = code; - qDebug("%s fetch rsp received, index:%d, error:%s", pSourceDataInfo->taskId, index, tstrerror(code)); - } - - pSourceDataInfo->status = EX_SOURCE_DATA_READY; - - tsem_post(&pExchangeInfo->ready); - taosReleaseRef(exchangeObjRefPool, pWrapper->exchangeId); - - return TSDB_CODE_SUCCESS; -} - -void qProcessRspMsg(void* parent, SRpcMsg* pMsg, SEpSet* pEpSet) { - SMsgSendInfo* pSendInfo = (SMsgSendInfo*)pMsg->info.ahandle; - assert(pMsg->info.ahandle != NULL); - - SDataBuf buf = {.len = pMsg->contLen, .pData = NULL}; - - if (pMsg->contLen > 0) { - buf.pData = taosMemoryCalloc(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); - destroySendMsgInfo(pSendInfo); -} - -static int32_t doSendFetchDataRequest(SExchangeInfo* pExchangeInfo, SExecTaskInfo* pTaskInfo, int32_t sourceIndex) { - size_t totalSources = taosArrayGetSize(pExchangeInfo->pSources); - - SDownstreamSourceNode* pSource = taosArrayGet(pExchangeInfo->pSources, sourceIndex); - SSourceDataInfo* pDataInfo = taosArrayGet(pExchangeInfo->pSourceDataInfo, sourceIndex); - - ASSERT(pDataInfo->status == EX_SOURCE_DATA_NOT_READY); - - SFetchRspHandleWrapper* pWrapper = taosMemoryCalloc(1, sizeof(SFetchRspHandleWrapper)); - pWrapper->exchangeId = pExchangeInfo->self; - pWrapper->sourceIndex = sourceIndex; - - if (pSource->localExec) { - SDataBuf pBuf = {0}; - int32_t code = - (*pTaskInfo->localFetch.fp)(pTaskInfo->localFetch.handle, pSource->schedId, pTaskInfo->id.queryId, - pSource->taskId, 0, pSource->execId, &pBuf.pData, pTaskInfo->localFetch.explainRes); - loadRemoteDataCallback(pWrapper, &pBuf, code); - taosMemoryFree(pWrapper); - } else { - SResFetchReq* pMsg = taosMemoryCalloc(1, sizeof(SResFetchReq)); - if (NULL == pMsg) { - pTaskInfo->code = TSDB_CODE_QRY_OUT_OF_MEMORY; - taosMemoryFree(pWrapper); - return pTaskInfo->code; - } - - qDebug("%s build fetch msg and send to vgId:%d, ep:%s, taskId:0x%" PRIx64 ", execId:%d, %d/%" PRIzu, - GET_TASKID(pTaskInfo), pSource->addr.nodeId, pSource->addr.epSet.eps[0].fqdn, pSource->taskId, - pSource->execId, sourceIndex, totalSources); - - pMsg->header.vgId = htonl(pSource->addr.nodeId); - pMsg->sId = htobe64(pSource->schedId); - pMsg->taskId = htobe64(pSource->taskId); - pMsg->queryId = htobe64(pTaskInfo->id.queryId); - pMsg->execId = htonl(pSource->execId); - - // send the fetch remote task result reques - SMsgSendInfo* pMsgSendInfo = taosMemoryCalloc(1, sizeof(SMsgSendInfo)); - if (NULL == pMsgSendInfo) { - taosMemoryFreeClear(pMsg); - taosMemoryFree(pWrapper); - qError("%s prepare message %d failed", GET_TASKID(pTaskInfo), (int32_t)sizeof(SMsgSendInfo)); - pTaskInfo->code = TSDB_CODE_QRY_OUT_OF_MEMORY; - return pTaskInfo->code; - } - - pMsgSendInfo->param = pWrapper; - pMsgSendInfo->paramFreeFp = taosMemoryFree; - pMsgSendInfo->msgInfo.pData = pMsg; - pMsgSendInfo->msgInfo.len = sizeof(SResFetchReq); - pMsgSendInfo->msgType = pSource->fetchMsgType; - pMsgSendInfo->fp = loadRemoteDataCallback; - - int64_t transporterId = 0; - int32_t code = - asyncSendMsgToServer(pExchangeInfo->pTransporter, &pSource->addr.epSet, &transporterId, pMsgSendInfo); - } - - return TSDB_CODE_SUCCESS; -} - -void updateLoadRemoteInfo(SLoadRemoteDataInfo* pInfo, int32_t numOfRows, int32_t dataLen, int64_t startTs, - SOperatorInfo* pOperator) { - pInfo->totalRows += numOfRows; - pInfo->totalSize += dataLen; - pInfo->totalElapsed += (taosGetTimestampUs() - startTs); - pOperator->resultInfo.totalRows += numOfRows; -} - -int32_t extractDataBlockFromFetchRsp(SSDataBlock* pRes, char* pData, SArray* pColList, char** pNextStart) { - if (pColList == NULL) { // data from other sources - blockDataCleanup(pRes); - *pNextStart = (char*)blockDecode(pRes, pData); - } else { // extract data according to pColList - char* pStart = pData; - - int32_t numOfCols = htonl(*(int32_t*)pStart); - pStart += sizeof(int32_t); - - // todo refactor:extract method - SSysTableSchema* pSchema = (SSysTableSchema*)pStart; - for (int32_t i = 0; i < numOfCols; ++i) { - SSysTableSchema* p = (SSysTableSchema*)pStart; - - p->colId = htons(p->colId); - p->bytes = htonl(p->bytes); - pStart += sizeof(SSysTableSchema); - } - - SSDataBlock* pBlock = createDataBlock(); - for (int32_t i = 0; i < numOfCols; ++i) { - SColumnInfoData idata = createColumnInfoData(pSchema[i].type, pSchema[i].bytes, pSchema[i].colId); - blockDataAppendColInfo(pBlock, &idata); - } - - blockDecode(pBlock, pStart); - blockDataEnsureCapacity(pRes, pBlock->info.rows); - - // data from mnode - pRes->info.rows = pBlock->info.rows; - relocateColumnData(pRes, pColList, pBlock->pDataBlock, false); - blockDataDestroy(pBlock); - } - - // todo move this to time window aggregator, since the primary timestamp may not be known by exchange operator. - blockDataUpdateTsWindow(pRes, 0); - return TSDB_CODE_SUCCESS; -} - -static void* setAllSourcesCompleted(SOperatorInfo* pOperator, int64_t startTs) { - SExchangeInfo* pExchangeInfo = pOperator->info; - SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo; - - int64_t el = taosGetTimestampUs() - startTs; - SLoadRemoteDataInfo* pLoadInfo = &pExchangeInfo->loadInfo; - - pLoadInfo->totalElapsed += el; - - size_t totalSources = taosArrayGetSize(pExchangeInfo->pSources); - qDebug("%s all %" PRIzu " sources are exhausted, total rows: %" PRIu64 " bytes:%" PRIu64 ", elapsed:%.2f ms", - GET_TASKID(pTaskInfo), totalSources, pLoadInfo->totalRows, pLoadInfo->totalSize, - pLoadInfo->totalElapsed / 1000.0); - - doSetOperatorCompleted(pOperator); - return NULL; -} - - -static int32_t getCompletedSources(const SArray* pArray) { - size_t total = taosArrayGetSize(pArray); - - int32_t completed = 0; - for (int32_t k = 0; k < total; ++k) { - SSourceDataInfo* p = taosArrayGet(pArray, k); - if (p->status == EX_SOURCE_DATA_EXHAUSTED) { - completed += 1; - } - } - - return completed; -} - -static void concurrentlyLoadRemoteDataImpl(SOperatorInfo* pOperator, SExchangeInfo* pExchangeInfo, - SExecTaskInfo* pTaskInfo) { - int32_t code = 0; - size_t totalSources = taosArrayGetSize(pExchangeInfo->pSourceDataInfo); - int32_t completed = getCompletedSources(pExchangeInfo->pSourceDataInfo); - if (completed == totalSources) { - setAllSourcesCompleted(pOperator, pExchangeInfo->openedTs); - return; - } - - while (1) { - tsem_wait(&pExchangeInfo->ready); - - for (int32_t i = 0; i < totalSources; ++i) { - SSourceDataInfo* pDataInfo = taosArrayGet(pExchangeInfo->pSourceDataInfo, i); - if (pDataInfo->status == EX_SOURCE_DATA_EXHAUSTED) { - continue; - } - - if (pDataInfo->status != EX_SOURCE_DATA_READY) { - continue; - } - - if (pDataInfo->code != TSDB_CODE_SUCCESS) { - code = pDataInfo->code; - goto _error; - } - - SRetrieveTableRsp* pRsp = pDataInfo->pRsp; - SDownstreamSourceNode* pSource = taosArrayGet(pExchangeInfo->pSources, i); - - // todo - SLoadRemoteDataInfo* pLoadInfo = &pExchangeInfo->loadInfo; - if (pRsp->numOfRows == 0) { - pDataInfo->status = EX_SOURCE_DATA_EXHAUSTED; - qDebug("%s vgId:%d, taskId:0x%" PRIx64 " execId:%d index:%d completed, rowsOfSource:%" PRIu64 - ", totalRows:%" PRIu64 ", try next %d/%" PRIzu, - GET_TASKID(pTaskInfo), pSource->addr.nodeId, pSource->taskId, pSource->execId, i, pDataInfo->totalRows, - pExchangeInfo->loadInfo.totalRows, i + 1, totalSources); - taosMemoryFreeClear(pDataInfo->pRsp); - break; - } - - SRetrieveTableRsp* pRetrieveRsp = pDataInfo->pRsp; - int32_t index = 0; - char* pStart = pRetrieveRsp->data; - while (index++ < pRetrieveRsp->numOfBlocks) { - SSDataBlock* pb = createOneDataBlock(pExchangeInfo->pDummyBlock, false); - code = extractDataBlockFromFetchRsp(pb, pStart, NULL, &pStart); - if (code != 0) { - taosMemoryFreeClear(pDataInfo->pRsp); - goto _error; - } - - taosArrayPush(pExchangeInfo->pResultBlockList, &pb); - } - - updateLoadRemoteInfo(pLoadInfo, pRetrieveRsp->numOfRows, pRetrieveRsp->compLen, pExchangeInfo->openedTs, pOperator); - - if (pRsp->completed == 1) { - pDataInfo->status = EX_SOURCE_DATA_EXHAUSTED; - qDebug("%s fetch msg rsp from vgId:%d, taskId:0x%" PRIx64 - " execId:%d index:%d completed, blocks:%d, numOfRows:%d, rowsOfSource:%" PRIu64 ", totalRows:%" PRIu64 - ", total:%.2f Kb, try next %d/%" PRIzu, - GET_TASKID(pTaskInfo), pSource->addr.nodeId, pSource->taskId, pSource->execId, i, pRsp->numOfBlocks, - pRsp->numOfRows, pDataInfo->totalRows, pLoadInfo->totalRows, pLoadInfo->totalSize / 1024.0, - i + 1, totalSources); - } else { - qDebug("%s fetch msg rsp from vgId:%d, taskId:0x%" PRIx64 - " execId:%d blocks:%d, numOfRows:%d, totalRows:%" PRIu64 ", total:%.2f Kb", - GET_TASKID(pTaskInfo), pSource->addr.nodeId, pSource->taskId, pSource->execId, pRsp->numOfBlocks, - pRsp->numOfRows, pLoadInfo->totalRows, pLoadInfo->totalSize / 1024.0); - } - - taosMemoryFreeClear(pDataInfo->pRsp); - - if (pDataInfo->status != EX_SOURCE_DATA_EXHAUSTED) { - pDataInfo->status = EX_SOURCE_DATA_NOT_READY; - code = doSendFetchDataRequest(pExchangeInfo, pTaskInfo, i); - if (code != TSDB_CODE_SUCCESS) { - taosMemoryFreeClear(pDataInfo->pRsp); - goto _error; - } - } - return; - } // end loop - - int32_t complete1 = getCompletedSources(pExchangeInfo->pSourceDataInfo); - if (complete1 == totalSources) { - qDebug("all sources are completed, %s", GET_TASKID(pTaskInfo)); - return; - } - } - -_error: - pTaskInfo->code = code; -} - -static int32_t prepareConcurrentlyLoad(SOperatorInfo* pOperator) { - SExchangeInfo* pExchangeInfo = pOperator->info; - SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo; - - size_t totalSources = taosArrayGetSize(pExchangeInfo->pSources); - int64_t startTs = taosGetTimestampUs(); - - // Asynchronously send all fetch requests to all sources. - for (int32_t i = 0; i < totalSources; ++i) { - int32_t code = doSendFetchDataRequest(pExchangeInfo, pTaskInfo, i); - if (code != TSDB_CODE_SUCCESS) { - pTaskInfo->code = code; - return code; - } - } - - int64_t endTs = taosGetTimestampUs(); - qDebug("%s send all fetch requests to %" PRIzu " sources completed, elapsed:%.2fms", GET_TASKID(pTaskInfo), - totalSources, (endTs - startTs) / 1000.0); - - pOperator->status = OP_RES_TO_RETURN; - pOperator->cost.openCost = taosGetTimestampUs() - startTs; - - tsem_wait(&pExchangeInfo->ready); - tsem_post(&pExchangeInfo->ready); - return TSDB_CODE_SUCCESS; -} - -static int32_t seqLoadRemoteData(SOperatorInfo* pOperator) { - SExchangeInfo* pExchangeInfo = pOperator->info; - SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo; - - size_t totalSources = taosArrayGetSize(pExchangeInfo->pSources); - int64_t startTs = taosGetTimestampUs(); - - while (1) { - if (pExchangeInfo->current >= totalSources) { - setAllSourcesCompleted(pOperator, startTs); - return TSDB_CODE_SUCCESS; - } - - doSendFetchDataRequest(pExchangeInfo, pTaskInfo, pExchangeInfo->current); - tsem_wait(&pExchangeInfo->ready); - - SSourceDataInfo* pDataInfo = taosArrayGet(pExchangeInfo->pSourceDataInfo, pExchangeInfo->current); - SDownstreamSourceNode* pSource = taosArrayGet(pExchangeInfo->pSources, pExchangeInfo->current); - - if (pDataInfo->code != TSDB_CODE_SUCCESS) { - qError("%s vgId:%d, taskID:0x%" PRIx64 " execId:%d error happens, code:%s", GET_TASKID(pTaskInfo), - pSource->addr.nodeId, pSource->taskId, pSource->execId, tstrerror(pDataInfo->code)); - pOperator->pTaskInfo->code = pDataInfo->code; - return pOperator->pTaskInfo->code; - } - - SRetrieveTableRsp* pRsp = pDataInfo->pRsp; - SLoadRemoteDataInfo* pLoadInfo = &pExchangeInfo->loadInfo; - if (pRsp->numOfRows == 0) { - qDebug("%s vgId:%d, taskID:0x%" PRIx64 " execId:%d %d of total completed, rowsOfSource:%" PRIu64 - ", totalRows:%" PRIu64 " try next", - GET_TASKID(pTaskInfo), pSource->addr.nodeId, pSource->taskId, pSource->execId, pExchangeInfo->current + 1, - pDataInfo->totalRows, pLoadInfo->totalRows); - - pDataInfo->status = EX_SOURCE_DATA_EXHAUSTED; - pExchangeInfo->current += 1; - taosMemoryFreeClear(pDataInfo->pRsp); - continue; - } - - SRetrieveTableRsp* pRetrieveRsp = pDataInfo->pRsp; - - char* pStart = pRetrieveRsp->data; - int32_t code = extractDataBlockFromFetchRsp(NULL, pStart, NULL, &pStart); - - if (pRsp->completed == 1) { - qDebug("%s fetch msg rsp from vgId:%d, taskId:0x%" PRIx64 " execId:%d numOfRows:%d, rowsOfSource:%" PRIu64 - ", totalRows:%" PRIu64 ", totalBytes:%" PRIu64 " try next %d/%" PRIzu, - GET_TASKID(pTaskInfo), pSource->addr.nodeId, pSource->taskId, pSource->execId, pRetrieveRsp->numOfRows, - pDataInfo->totalRows, pLoadInfo->totalRows, pLoadInfo->totalSize, pExchangeInfo->current + 1, - totalSources); - - pDataInfo->status = EX_SOURCE_DATA_EXHAUSTED; - pExchangeInfo->current += 1; - } else { - qDebug("%s fetch msg rsp from vgId:%d, taskId:0x%" PRIx64 " execId:%d numOfRows:%d, totalRows:%" PRIu64 - ", totalBytes:%" PRIu64, - GET_TASKID(pTaskInfo), pSource->addr.nodeId, pSource->taskId, pSource->execId, pRetrieveRsp->numOfRows, - pLoadInfo->totalRows, pLoadInfo->totalSize); - } - - updateLoadRemoteInfo(pLoadInfo, pRetrieveRsp->numOfRows, pRetrieveRsp->compLen, startTs, pOperator); - pDataInfo->totalRows += pRetrieveRsp->numOfRows; - - taosMemoryFreeClear(pDataInfo->pRsp); - return TSDB_CODE_SUCCESS; - } -} - -static int32_t prepareLoadRemoteData(SOperatorInfo* pOperator) { - if (OPTR_IS_OPENED(pOperator)) { - return TSDB_CODE_SUCCESS; - } - - int64_t st = taosGetTimestampUs(); - - SExchangeInfo* pExchangeInfo = pOperator->info; - if (!pExchangeInfo->seqLoadData) { - int32_t code = prepareConcurrentlyLoad(pOperator); - if (code != TSDB_CODE_SUCCESS) { - return code; - } - pExchangeInfo->openedTs = taosGetTimestampUs(); - } - - OPTR_SET_OPENED(pOperator); - pOperator->cost.openCost = (taosGetTimestampUs() - st) / 1000.0; - return TSDB_CODE_SUCCESS; -} - -static void freeBlock(void* pParam) { - SSDataBlock* pBlock = *(SSDataBlock**)pParam; - blockDataDestroy(pBlock); -} - -static SSDataBlock* doLoadRemoteDataImpl(SOperatorInfo* pOperator) { - SExchangeInfo* pExchangeInfo = pOperator->info; - SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo; - - pTaskInfo->code = pOperator->fpSet._openFn(pOperator); - if (pTaskInfo->code != TSDB_CODE_SUCCESS) { - return NULL; - } - - size_t totalSources = taosArrayGetSize(pExchangeInfo->pSources); - - SLoadRemoteDataInfo* pLoadInfo = &pExchangeInfo->loadInfo; - if (pOperator->status == OP_EXEC_DONE) { - qDebug("%s all %" PRIzu " source(s) are exhausted, total rows:%" PRIu64 " bytes:%" PRIu64 ", elapsed:%.2f ms", - GET_TASKID(pTaskInfo), totalSources, pLoadInfo->totalRows, pLoadInfo->totalSize, - pLoadInfo->totalElapsed / 1000.0); - return NULL; - } - - size_t size = taosArrayGetSize(pExchangeInfo->pResultBlockList); - if (size == 0 || pExchangeInfo->rspBlockIndex >= size) { - pExchangeInfo->rspBlockIndex = 0; - taosArrayClearEx(pExchangeInfo->pResultBlockList, freeBlock); - if (pExchangeInfo->seqLoadData) { - seqLoadRemoteData(pOperator); - } else { - concurrentlyLoadRemoteDataImpl(pOperator, pExchangeInfo, pTaskInfo); - } - - if (taosArrayGetSize(pExchangeInfo->pResultBlockList) == 0) { - return NULL; - } - } - - // we have buffered retrieved datablock, return it directly - return taosArrayGetP(pExchangeInfo->pResultBlockList, pExchangeInfo->rspBlockIndex++); -} - -static SSDataBlock* doLoadRemoteData(SOperatorInfo* pOperator) { - SExchangeInfo* pExchangeInfo = pOperator->info; - SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo; - - if (pOperator->status == OP_EXEC_DONE) { - return NULL; - } - - while (1) { - SSDataBlock* pBlock = doLoadRemoteDataImpl(pOperator); - if (pBlock == NULL) { - return NULL; - } - - SLimitInfo* pLimitInfo = &pExchangeInfo->limitInfo; - if (hasLimitOffsetInfo(pLimitInfo)) { - int32_t status = handleLimitOffset(pOperator, pLimitInfo, pBlock, false); - if (status == PROJECT_RETRIEVE_CONTINUE) { - continue; - } else if (status == PROJECT_RETRIEVE_DONE) { - size_t rows = pBlock->info.rows; - pExchangeInfo->limitInfo.numOfOutputRows += rows; - - if (rows == 0) { - doSetOperatorCompleted(pOperator); - return NULL; - } else { - return pBlock; - } - } - } else { - return pBlock; - } - } -} - -static int32_t initDataSource(int32_t numOfSources, SExchangeInfo* pInfo, const char* id) { - pInfo->pSourceDataInfo = taosArrayInit(numOfSources, sizeof(SSourceDataInfo)); - if (pInfo->pSourceDataInfo == NULL) { - return TSDB_CODE_OUT_OF_MEMORY; - } - - for (int32_t i = 0; i < numOfSources; ++i) { - SSourceDataInfo dataInfo = {0}; - dataInfo.status = EX_SOURCE_DATA_NOT_READY; - dataInfo.taskId = id; - dataInfo.index = i; - SSourceDataInfo* pDs = taosArrayPush(pInfo->pSourceDataInfo, &dataInfo); - if (pDs == NULL) { - taosArrayDestroy(pInfo->pSourceDataInfo); - return TSDB_CODE_OUT_OF_MEMORY; - } - } - - return TSDB_CODE_SUCCESS; -} - -static int32_t initExchangeOperator(SExchangePhysiNode* pExNode, SExchangeInfo* pInfo, const char* id) { - size_t numOfSources = LIST_LENGTH(pExNode->pSrcEndPoints); - - if (numOfSources == 0) { - qError("%s invalid number: %d of sources in exchange operator", id, (int32_t)numOfSources); - return TSDB_CODE_INVALID_PARA; - } - - pInfo->pSources = taosArrayInit(numOfSources, sizeof(SDownstreamSourceNode)); - if (pInfo->pSources == NULL) { - return TSDB_CODE_OUT_OF_MEMORY; - } - - for (int32_t i = 0; i < numOfSources; ++i) { - SDownstreamSourceNode* pNode = (SDownstreamSourceNode*)nodesListGetNode((SNodeList*)pExNode->pSrcEndPoints, i); - taosArrayPush(pInfo->pSources, pNode); - } - - initLimitInfo(pExNode->node.pLimit, pExNode->node.pSlimit, &pInfo->limitInfo); - pInfo->self = taosAddRef(exchangeObjRefPool, pInfo); - - return initDataSource(numOfSources, pInfo, id); -} - -SOperatorInfo* createExchangeOperatorInfo(void* pTransporter, SExchangePhysiNode* pExNode, SExecTaskInfo* pTaskInfo) { - SExchangeInfo* pInfo = taosMemoryCalloc(1, sizeof(SExchangeInfo)); - SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo)); - if (pInfo == NULL || pOperator == NULL) { - goto _error; - } - - int32_t code = initExchangeOperator(pExNode, pInfo, GET_TASKID(pTaskInfo)); - if (code != TSDB_CODE_SUCCESS) { - goto _error; - } - - tsem_init(&pInfo->ready, 0, 0); - pInfo->pDummyBlock = createResDataBlock(pExNode->node.pOutputDataBlockDesc); - pInfo->pResultBlockList = taosArrayInit(1, POINTER_BYTES); - - pInfo->seqLoadData = false; - pInfo->pTransporter = pTransporter; - - pOperator->name = "ExchangeOperator"; - pOperator->operatorType = QUERY_NODE_PHYSICAL_PLAN_EXCHANGE; - pOperator->blocking = false; - pOperator->status = OP_NOT_OPENED; - pOperator->info = pInfo; - pOperator->exprSupp.numOfExprs = taosArrayGetSize(pInfo->pDummyBlock->pDataBlock); - pOperator->pTaskInfo = pTaskInfo; - - pOperator->fpSet = - createOperatorFpSet(prepareLoadRemoteData, doLoadRemoteData, NULL, NULL, destroyExchangeOperatorInfo, NULL); - return pOperator; - -_error: - if (pInfo != NULL) { - doDestroyExchangeOperatorInfo(pInfo); - } - - taosMemoryFreeClear(pOperator); - pTaskInfo->code = code; - return NULL; -} - static int32_t doInitAggInfoSup(SAggSupporter* pAggSup, SqlFunctionCtx* pCtx, int32_t numOfOutput, size_t keyBufSize, const char* pKey); @@ -2386,7 +1805,7 @@ static SSDataBlock* getAggregateResult(SOperatorInfo* pOperator) { SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo; pTaskInfo->code = pOperator->fpSet._openFn(pOperator); if (pTaskInfo->code != TSDB_CODE_SUCCESS) { - doSetOperatorCompleted(pOperator); + setOperatorCompleted(pOperator); return NULL; } @@ -2396,7 +1815,7 @@ static SSDataBlock* getAggregateResult(SOperatorInfo* pOperator) { doFilter(pInfo->pRes, pOperator->exprSupp.pFilterInfo, NULL); if (!hasRemainResults(&pAggInfo->groupResInfo)) { - doSetOperatorCompleted(pOperator); + setOperatorCompleted(pOperator); break; } @@ -2645,7 +2064,7 @@ static SSDataBlock* doFillImpl(SOperatorInfo* pOperator) { SSDataBlock* pBlock = pDownstream->fpSet.getNextFn(pDownstream); if (pBlock == NULL) { if (pInfo->totalInputRows == 0) { - doSetOperatorCompleted(pOperator); + setOperatorCompleted(pOperator); return NULL; } @@ -2722,7 +2141,7 @@ static SSDataBlock* doFill(SOperatorInfo* pOperator) { while (true) { fillResult = doFillImpl(pOperator); if (fillResult == NULL) { - doSetOperatorCompleted(pOperator); + setOperatorCompleted(pOperator); break; } @@ -2952,15 +2371,10 @@ SOperatorInfo* createAggregateOperatorInfo(SOperatorInfo* downstream, SAggPhysiN pInfo->binfo.mergeResultBlock = pAggNode->mergeDataBlock; pInfo->groupId = UINT64_MAX; - pOperator->name = "TableAggregate"; - pOperator->operatorType = QUERY_NODE_PHYSICAL_PLAN_HASH_AGG; - pOperator->blocking = true; - pOperator->status = OP_NOT_OPENED; - pOperator->info = pInfo; - pOperator->pTaskInfo = pTaskInfo; + setOperatorInfo(pOperator, "TableAggregate", QUERY_NODE_PHYSICAL_PLAN_HASH_AGG, true, OP_NOT_OPENED, pInfo, pTaskInfo); pOperator->fpSet = - createOperatorFpSet(doOpenAggregateOptr, getAggregateResult, NULL, NULL, destroyAggOperatorInfo, NULL); + createOperatorFpSet(doOpenAggregateOptr, getAggregateResult, NULL, destroyAggOperatorInfo, NULL); if (downstream->operatorType == QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN) { STableScanInfo* pTableScanInfo = downstream->info; @@ -3024,33 +2438,6 @@ void destroyFillOperatorInfo(void* param) { taosMemoryFreeClear(param); } -void destroyExchangeOperatorInfo(void* param) { - SExchangeInfo* pExInfo = (SExchangeInfo*)param; - taosRemoveRef(exchangeObjRefPool, pExInfo->self); -} - -void freeSourceDataInfo(void* p) { - SSourceDataInfo* pInfo = (SSourceDataInfo*)p; - taosMemoryFreeClear(pInfo->pRsp); -} - -void doDestroyExchangeOperatorInfo(void* param) { - SExchangeInfo* pExInfo = (SExchangeInfo*)param; - - taosArrayDestroy(pExInfo->pSources); - taosArrayDestroyEx(pExInfo->pSourceDataInfo, freeSourceDataInfo); - - if (pExInfo->pResultBlockList != NULL) { - taosArrayDestroyEx(pExInfo->pResultBlockList, freeBlock); - pExInfo->pResultBlockList = NULL; - } - - blockDataDestroy(pExInfo->pDummyBlock); - - tsem_destroy(&pExInfo->ready); - taosMemoryFreeClear(param); -} - static int32_t initFillInfo(SFillOperatorInfo* pInfo, SExprInfo* pExpr, int32_t numOfCols, SExprInfo* pNotFillExpr, int32_t numOfNotFillCols, SNodeListNode* pValNode, STimeWindow win, int32_t capacity, const char* id, SInterval* pInterval, int32_t fillType, int32_t order) { @@ -3182,15 +2569,9 @@ SOperatorInfo* createFillOperatorInfo(SOperatorInfo* downstream, SFillPhysiNode* goto _error; } - pOperator->name = "FillOperator"; - pOperator->blocking = false; - pOperator->status = OP_NOT_OPENED; - pOperator->operatorType = QUERY_NODE_PHYSICAL_PLAN_FILL; + setOperatorInfo(pOperator, "FillOperator", QUERY_NODE_PHYSICAL_PLAN_FILL, false, OP_NOT_OPENED, pInfo, pTaskInfo); pOperator->exprSupp.numOfExprs = pInfo->numOfExpr; - pOperator->info = pInfo; - pOperator->pTaskInfo = pTaskInfo; - - pOperator->fpSet = createOperatorFpSet(operatorDummyOpenFn, doFill, NULL, NULL, destroyFillOperatorInfo, NULL); + pOperator->fpSet = createOperatorFpSet(operatorDummyOpenFn, doFill, NULL, destroyFillOperatorInfo, NULL); code = appendDownstream(pOperator, &downstream, 1); return pOperator; diff --git a/source/libs/executor/src/groupoperator.c b/source/libs/executor/src/groupoperator.c index 891eb6e7a4..47ee663abe 100644 --- a/source/libs/executor/src/groupoperator.c +++ b/source/libs/executor/src/groupoperator.c @@ -316,7 +316,7 @@ static SSDataBlock* buildGroupResultDataBlock(SOperatorInfo* pOperator) { doFilter(pRes, pOperator->exprSupp.pFilterInfo, NULL); if (!hasRemainResults(&pInfo->groupResInfo)) { - doSetOperatorCompleted(pOperator); + setOperatorCompleted(pOperator); break; } @@ -438,15 +438,10 @@ SOperatorInfo* createGroupOperatorInfo(SOperatorInfo* downstream, SAggPhysiNode* } initResultRowInfo(&pInfo->binfo.resultRowInfo); - - pOperator->name = "GroupbyAggOperator"; - pOperator->blocking = true; - pOperator->status = OP_NOT_OPENED; - pOperator->info = pInfo; - pOperator->pTaskInfo = pTaskInfo; + setOperatorInfo(pOperator, "GroupbyAggOperator", 0, true, OP_NOT_OPENED, pInfo, pTaskInfo); pOperator->fpSet = - createOperatorFpSet(operatorDummyOpenFn, hashGroupbyAggregate, NULL, NULL, destroyGroupOperatorInfo, NULL); + createOperatorFpSet(operatorDummyOpenFn, hashGroupbyAggregate, NULL, destroyGroupOperatorInfo, NULL); code = appendDownstream(pOperator, &downstream, 1); if (code != TSDB_CODE_SUCCESS) { goto _error; @@ -654,7 +649,7 @@ static SSDataBlock* buildPartitionResult(SOperatorInfo* pOperator) { // try next group data ++pInfo->groupIndex; if (pInfo->groupIndex >= taosArrayGetSize(pInfo->sortedGroupArray)) { - doSetOperatorCompleted(pOperator); + setOperatorCompleted(pOperator); clearPartitionOperator(pInfo); return NULL; } @@ -821,17 +816,12 @@ SOperatorInfo* createPartitionOperatorInfo(SOperatorInfo* downstream, SPartition goto _error; } - pOperator->name = "PartitionOperator"; - pOperator->blocking = true; - pOperator->status = OP_NOT_OPENED; - pOperator->operatorType = QUERY_NODE_PHYSICAL_PLAN_PARTITION; + setOperatorInfo(pOperator, "PartitionOperator", QUERY_NODE_PHYSICAL_PLAN_PARTITION, false, OP_NOT_OPENED, pInfo, pTaskInfo); pOperator->exprSupp.numOfExprs = numOfCols; pOperator->exprSupp.pExprInfo = pExprInfo; - pOperator->info = pInfo; - pOperator->pTaskInfo = pTaskInfo; pOperator->fpSet = - createOperatorFpSet(operatorDummyOpenFn, hashPartition, NULL, NULL, destroyPartitionOperatorInfo, NULL); + createOperatorFpSet(operatorDummyOpenFn, hashPartition, NULL, destroyPartitionOperatorInfo, NULL); code = appendDownstream(pOperator, &downstream, 1); return pOperator; @@ -909,7 +899,10 @@ static SSDataBlock* buildStreamPartitionResult(SOperatorInfo* pOperator) { void* pData = colDataGetVarData(pCol, 0); // TODO check tbname validity if (pData != (void*)-1) { - memcpy(pDest->info.parTbName, varDataVal(pData), varDataLen(pData)); + memset(pDest->info.parTbName, 0, TSDB_TABLE_NAME_LEN); + int32_t len = TMIN(varDataLen(pData), TSDB_TABLE_NAME_LEN); + memcpy(pDest->info.parTbName, varDataVal(pData), len); + /*pDest->info.parTbName[len + 1] = 0;*/ } else { pDest->info.parTbName[0] = 0; } @@ -918,6 +911,8 @@ static SSDataBlock* buildStreamPartitionResult(SOperatorInfo* pOperator) { blockDataDestroy(pResBlock); } } + taosArrayDestroy(pParInfo->rowIds); + pParInfo->rowIds = NULL; blockDataUpdateTsWindow(pDest, pInfo->tsColIndex); pDest->info.groupId = pParInfo->groupId; pOperator->resultInfo.totalRows += pDest->info.rows; @@ -963,7 +958,7 @@ static SSDataBlock* doStreamHashPartition(SOperatorInfo* pOperator) { pInfo->pInputDataBlock = NULL; SSDataBlock* pBlock = downstream->fpSet.getNextFn(downstream); if (pBlock == NULL) { - doSetOperatorCompleted(pOperator); + setOperatorCompleted(pOperator); return NULL; } printDataBlock(pBlock, "stream partitionby recv"); @@ -1016,6 +1011,7 @@ static void destroyStreamPartitionOperatorInfo(void* param) { cleanupExprSupp(&pInfo->tbnameCalSup); cleanupExprSupp(&pInfo->tagCalSup); blockDataDestroy(pInfo->pDelRes); + taosHashCleanup(pInfo->pPartitions); taosMemoryFreeClear(param); } @@ -1103,15 +1099,10 @@ SOperatorInfo* createStreamPartitionOperatorInfo(SOperatorInfo* downstream, SStr int32_t numOfCols = 0; SExprInfo* pExprInfo = createExprInfo(pPartNode->part.pTargets, NULL, &numOfCols); - pOperator->name = "StreamPartitionOperator"; - pOperator->blocking = false; - pOperator->status = OP_NOT_OPENED; - pOperator->operatorType = QUERY_NODE_PHYSICAL_PLAN_STREAM_PARTITION; + setOperatorInfo(pOperator, "StreamPartitionOperator", QUERY_NODE_PHYSICAL_PLAN_STREAM_PARTITION, false, OP_NOT_OPENED, pInfo, pTaskInfo); pOperator->exprSupp.numOfExprs = numOfCols; pOperator->exprSupp.pExprInfo = pExprInfo; - pOperator->info = pInfo; - pOperator->pTaskInfo = pTaskInfo; - pOperator->fpSet = createOperatorFpSet(operatorDummyOpenFn, doStreamHashPartition, NULL, NULL, + pOperator->fpSet = createOperatorFpSet(operatorDummyOpenFn, doStreamHashPartition, NULL, destroyStreamPartitionOperatorInfo, NULL); initParDownStream(downstream, &pInfo->partitionSup, &pInfo->scalarSup); diff --git a/source/libs/executor/src/joinoperator.c b/source/libs/executor/src/joinoperator.c index 45d76dce74..4e1daac643 100644 --- a/source/libs/executor/src/joinoperator.c +++ b/source/libs/executor/src/joinoperator.c @@ -73,14 +73,10 @@ SOperatorInfo* createMergeJoinOperatorInfo(SOperatorInfo** pDownstream, int32_t initResultSizeInfo(&pOperator->resultInfo, 4096); pInfo->pRes = pResBlock; - pOperator->name = "MergeJoinOperator"; - pOperator->operatorType = QUERY_NODE_PHYSICAL_PLAN_MERGE_JOIN; - pOperator->blocking = false; - pOperator->status = OP_NOT_OPENED; + + setOperatorInfo(pOperator, "MergeJoinOperator", QUERY_NODE_PHYSICAL_PLAN_MERGE_JOIN, false, OP_NOT_OPENED, pInfo, pTaskInfo); pOperator->exprSupp.pExprInfo = pExprInfo; pOperator->exprSupp.numOfExprs = numOfCols; - pOperator->info = pInfo; - pOperator->pTaskInfo = pTaskInfo; extractTimeCondition(pInfo, pDownstream, numOfDownstream, pJoinNode); @@ -121,8 +117,7 @@ SOperatorInfo* createMergeJoinOperatorInfo(SOperatorInfo** pDownstream, int32_t pInfo->inputOrder = TSDB_ORDER_DESC; } - pOperator->fpSet = - createOperatorFpSet(operatorDummyOpenFn, doMergeJoin, NULL, NULL, destroyMergeJoinOperator, NULL); + pOperator->fpSet = createOperatorFpSet(operatorDummyOpenFn, doMergeJoin, NULL, destroyMergeJoinOperator, NULL); code = appendDownstream(pOperator, pDownstream, numOfDownstream); if (code != TSDB_CODE_SUCCESS) { goto _error; @@ -372,13 +367,13 @@ static void doMergeJoinImpl(struct SOperatorInfo* pOperator, SSDataBlock* pRes) if (leftTs == rightTs) { mergeJoinJoinDownstreamTsRanges(pOperator, leftTs, pRes, &nrows); - } else if (asc && leftTs < rightTs || !asc && leftTs > rightTs) { + } else if ((asc && leftTs < rightTs) || (!asc && leftTs > rightTs)) { pJoinInfo->leftPos += 1; if (pJoinInfo->leftPos >= pJoinInfo->pLeft->info.rows) { continue; } - } else if (asc && leftTs > rightTs || !asc && leftTs < rightTs) { + } else if ((asc && leftTs > rightTs) || (!asc && leftTs < rightTs)) { pJoinInfo->rightPos += 1; if (pJoinInfo->rightPos >= pJoinInfo->pRight->info.rows) { continue; diff --git a/source/libs/executor/src/projectoperator.c b/source/libs/executor/src/projectoperator.c index b2865d15f0..ce1d13775c 100644 --- a/source/libs/executor/src/projectoperator.c +++ b/source/libs/executor/src/projectoperator.c @@ -98,13 +98,9 @@ SOperatorInfo* createProjectOperatorInfo(SOperatorInfo* downstream, SProjectPhys } pInfo->pPseudoColInfo = setRowTsColumnOutputInfo(pOperator->exprSupp.pCtx, numOfCols); - pOperator->name = "ProjectOperator"; - pOperator->operatorType = QUERY_NODE_PHYSICAL_PLAN_PROJECT; - pOperator->blocking = false; - pOperator->status = OP_NOT_OPENED; - pOperator->info = pInfo; - pOperator->fpSet = createOperatorFpSet(operatorDummyOpenFn, doProjectOperation, NULL, NULL, + setOperatorInfo(pOperator, "ProjectOperator", QUERY_NODE_PHYSICAL_PLAN_PROJECT, false, OP_NOT_OPENED, pInfo, pTaskInfo); + pOperator->fpSet = createOperatorFpSet(operatorDummyOpenFn, doProjectOperation, NULL, destroyProjectOperatorInfo, NULL); code = appendDownstream(pOperator, &downstream, 1); @@ -153,7 +149,7 @@ static int32_t setInfoForNewGroup(SSDataBlock* pBlock, SLimitInfo* pLimitInfo, S if (pLimitInfo->currentGroupId != 0 && pLimitInfo->currentGroupId != pBlock->info.groupId) { pLimitInfo->numOfOutputGroups += 1; if ((pLimitInfo->slimit.limit > 0) && (pLimitInfo->slimit.limit <= pLimitInfo->numOfOutputGroups)) { - doSetOperatorCompleted(pOperator); + setOperatorCompleted(pOperator); return PROJECT_RETRIEVE_DONE; } @@ -187,7 +183,7 @@ static int32_t doIngroupLimitOffset(SLimitInfo* pLimitInfo, uint64_t groupId, SS // TODO: optimize it later when partition by + limit if ((pLimitInfo->slimit.limit == -1 && pLimitInfo->currentGroupId == 0) || (pLimitInfo->slimit.limit > 0 && pLimitInfo->slimit.limit <= pLimitInfo->numOfOutputGroups)) { - doSetOperatorCompleted(pOperator); + setOperatorCompleted(pOperator); } } @@ -252,7 +248,7 @@ SSDataBlock* doProjectOperation(SOperatorInfo* pOperator) { } qDebug("set op close, exec %d, status %d rows %d", pTaskInfo->execModel, pOperator->status, pFinalRes->info.rows); - doSetOperatorCompleted(pOperator); + setOperatorCompleted(pOperator); break; } if (pTaskInfo->execModel == OPTR_EXEC_MODEL_QUEUE) { @@ -400,14 +396,8 @@ SOperatorInfo* createIndefinitOutputOperatorInfo(SOperatorInfo* downstream, SPhy pInfo->binfo.pRes = pResBlock; pInfo->pPseudoColInfo = setRowTsColumnOutputInfo(pSup->pCtx, numOfExpr); - pOperator->name = "IndefinitOperator"; - pOperator->operatorType = QUERY_NODE_PHYSICAL_PLAN_INDEF_ROWS_FUNC; - pOperator->blocking = false; - pOperator->status = OP_NOT_OPENED; - pOperator->info = pInfo; - - pOperator->fpSet = createOperatorFpSet(operatorDummyOpenFn, doApplyIndefinitFunction, NULL, NULL, - destroyIndefinitOperatorInfo, NULL); + setOperatorInfo(pOperator, "IndefinitOperator", QUERY_NODE_PHYSICAL_PLAN_INDEF_ROWS_FUNC, false, OP_NOT_OPENED, pInfo, pTaskInfo); + pOperator->fpSet = createOperatorFpSet(operatorDummyOpenFn, doApplyIndefinitFunction, NULL, destroyIndefinitOperatorInfo, NULL); code = appendDownstream(pOperator, &downstream, 1); if (code != TSDB_CODE_SUCCESS) { @@ -499,7 +489,7 @@ SSDataBlock* doApplyIndefinitFunction(SOperatorInfo* pOperator) { // The downstream exec may change the value of the newgroup, so use a local variable instead. SSDataBlock* pBlock = downstream->fpSet.getNextFn(downstream); if (pBlock == NULL) { - doSetOperatorCompleted(pOperator); + setOperatorCompleted(pOperator); break; } @@ -628,7 +618,7 @@ SSDataBlock* doGenerateSourceData(SOperatorInfo* pOperator) { pOperator->resultInfo.totalRows += pRes->info.rows; - doSetOperatorCompleted(pOperator); + setOperatorCompleted(pOperator); if (pOperator->cost.openCost == 0) { pOperator->cost.openCost = (taosGetTimestampUs() - st) / 1000.0; } diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index 7faf75d5cd..b83fac9fa6 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -284,7 +284,7 @@ static int32_t doDynamicPruneDataBlock(SOperatorInfo* pOperator, SDataBlockInfo* } static bool doFilterByBlockSMA(SFilterInfo* pFilterInfo, SColumnDataAgg** pColsAgg, int32_t numOfCols, - int32_t numOfRows) { + int32_t numOfRows) { if (pColsAgg == NULL || pFilterInfo == NULL) { return true; } @@ -345,7 +345,7 @@ static void doSetTagColumnData(STableScanInfo* pTableScanInfo, SSDataBlock* pBlo // todo handle the slimit info void applyLimitOffset(SLimitInfo* pLimitInfo, SSDataBlock* pBlock, SExecTaskInfo* pTaskInfo, SOperatorInfo* pOperator) { - SLimit* pLimit = &pLimitInfo->limit; + SLimit* pLimit = &pLimitInfo->limit; const char* id = GET_TASKID(pTaskInfo); if (pLimit->offset > 0 && pLimitInfo->remainOffset > 0) { @@ -499,7 +499,7 @@ static void prepareForDescendingScan(STableScanInfo* pTableScanInfo, SqlFunction typedef struct STableCachedVal { const char* pName; - STag* pTags; + STag* pTags; } STableCachedVal; static void freeTableCachedVal(void* param) { @@ -513,13 +513,11 @@ static void freeTableCachedVal(void* param) { taosMemoryFree(pVal); } -//const void *key, size_t keyLen, void *value -static void freeCachedMetaItem(const void *key, size_t keyLen, void *value) { - freeTableCachedVal(value); -} +// const void *key, size_t keyLen, void *value +static void freeCachedMetaItem(const void* key, size_t keyLen, void* value) { freeTableCachedVal(value); } -int32_t addTagPseudoColumnData(SReadHandle* pHandle, const SExprInfo* pExpr, int32_t numOfExpr, - SSDataBlock* pBlock, int32_t rows, const char* idStr, STableMetaCacheInfo* pCache) { +int32_t addTagPseudoColumnData(SReadHandle* pHandle, const SExprInfo* pExpr, int32_t numOfExpr, SSDataBlock* pBlock, + int32_t rows, const char* idStr, STableMetaCacheInfo* pCache) { // currently only the tbname pseudo column if (numOfExpr <= 0) { return TSDB_CODE_SUCCESS; @@ -531,11 +529,11 @@ int32_t addTagPseudoColumnData(SReadHandle* pHandle, const SExprInfo* pExpr, int int32_t backupRows = pBlock->info.rows; pBlock->info.rows = rows; - bool freeReader = false; + bool freeReader = false; STableCachedVal val = {0}; SMetaReader mr = {0}; - LRUHandle* h = NULL; + LRUHandle* h = NULL; // 1. check if it is existed in meta cache if (pCache == NULL) { @@ -582,7 +580,8 @@ int32_t addTagPseudoColumnData(SReadHandle* pHandle, const SExprInfo* pExpr, int val = *pVal; freeReader = true; - int32_t ret = taosLRUCacheInsert(pCache->pTableMetaEntryCache, &pBlock->info.uid, sizeof(uint64_t), pVal, sizeof(STableCachedVal), freeCachedMetaItem, NULL, TAOS_LRU_PRIORITY_LOW); + int32_t ret = taosLRUCacheInsert(pCache->pTableMetaEntryCache, &pBlock->info.uid, sizeof(uint64_t), pVal, + sizeof(STableCachedVal), freeCachedMetaItem, NULL, TAOS_LRU_PRIORITY_LOW); if (ret != TAOS_LRU_STATUS_OK) { qError("failed to put meta into lru cache, code:%d, %s", ret, idStr); freeTableCachedVal(pVal); @@ -594,13 +593,13 @@ int32_t addTagPseudoColumnData(SReadHandle* pHandle, const SExprInfo* pExpr, int taosLRUCacheRelease(pCache->pTableMetaEntryCache, h, false); } - qDebug("retrieve table meta from cache:%"PRIu64", hit:%"PRIu64 " miss:%"PRIu64", %s", pCache->metaFetch, pCache->cacheHit, - (pCache->metaFetch - pCache->cacheHit), idStr); + qDebug("retrieve table meta from cache:%" PRIu64 ", hit:%" PRIu64 " miss:%" PRIu64 ", %s", pCache->metaFetch, + pCache->cacheHit, (pCache->metaFetch - pCache->cacheHit), idStr); } for (int32_t j = 0; j < numOfExpr; ++j) { const SExprInfo* pExpr1 = &pExpr[j]; - int32_t dstSlotId = pExpr1->base.resSchema.slotId; + int32_t dstSlotId = pExpr1->base.resSchema.slotId; SColumnInfoData* pColInfoData = taosArrayGet(pBlock->pDataBlock, dstSlotId); colInfoDataCleanup(pColInfoData, pBlock->info.rows); @@ -652,7 +651,7 @@ void setTbNameColData(const SSDataBlock* pBlock, SColumnInfoData* pColInfoData, fmGetScalarFuncExecFuncs(functionId, &fpSet); size_t len = TSDB_TABLE_FNAME_LEN + VARSTR_HEADER_SIZE; - char buf[TSDB_TABLE_FNAME_LEN + VARSTR_HEADER_SIZE] = {0}; + char buf[TSDB_TABLE_FNAME_LEN + VARSTR_HEADER_SIZE] = {0}; STR_TO_VARSTR(buf, name) SColumnInfoData infoData = createColumnInfoData(TSDB_DATA_TYPE_VARCHAR, len, 1); @@ -820,7 +819,7 @@ static SSDataBlock* doTableScan(SOperatorInfo* pOperator) { } else { // scan table group by group sequentially if (pInfo->currentGroupId == -1) { if ((++pInfo->currentGroupId) >= tableListGetOutputGroups(pTaskInfo->pTableInfoList)) { - doSetOperatorCompleted(pOperator); + setOperatorCompleted(pOperator); return NULL; } @@ -843,7 +842,7 @@ static SSDataBlock* doTableScan(SOperatorInfo* pOperator) { } if ((++pInfo->currentGroupId) >= tableListGetOutputGroups(pTaskInfo->pTableInfoList)) { - doSetOperatorCompleted(pOperator); + setOperatorCompleted(pOperator); return NULL; } @@ -865,7 +864,7 @@ static SSDataBlock* doTableScan(SOperatorInfo* pOperator) { return result; } - doSetOperatorCompleted(pOperator); + setOperatorCompleted(pOperator); return NULL; } } @@ -904,12 +903,12 @@ SOperatorInfo* createTableScanOperatorInfo(STableScanPhysiNode* pTableScanNode, goto _error; } - SScanPhysiNode* pScanNode = &pTableScanNode->scan; + SScanPhysiNode* pScanNode = &pTableScanNode->scan; SDataBlockDescNode* pDescNode = pScanNode->node.pOutputDataBlockDesc; int32_t numOfCols = 0; - int32_t code = extractColMatchInfo(pScanNode->pScanCols, pDescNode, &numOfCols, COL_MATCH_FROM_COL_ID, - &pInfo->matchInfo); + int32_t code = + extractColMatchInfo(pScanNode->pScanCols, pDescNode, &numOfCols, COL_MATCH_FROM_COL_ID, &pInfo->matchInfo); if (code != TSDB_CODE_SUCCESS) { goto _error; } @@ -947,22 +946,17 @@ SOperatorInfo* createTableScanOperatorInfo(STableScanPhysiNode* pTableScanNode, pInfo->currentGroupId = -1; pInfo->assignBlockUid = pTableScanNode->assignBlockUid; - pOperator->name = "TableScanOperator"; // for debug purpose - pOperator->operatorType = QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN; - pOperator->blocking = false; - pOperator->status = OP_NOT_OPENED; - pOperator->info = pInfo; + setOperatorInfo(pOperator, "TableScanOperator", QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN, false, OP_NOT_OPENED, pInfo, pTaskInfo); pOperator->exprSupp.numOfExprs = numOfCols; - pOperator->pTaskInfo = pTaskInfo; - pInfo->metaCache.pTableMetaEntryCache = taosLRUCacheInit(1024*128, -1, .5); + pInfo->metaCache.pTableMetaEntryCache = taosLRUCacheInit(1024 * 128, -1, .5); if (pInfo->metaCache.pTableMetaEntryCache == NULL) { code = terrno; goto _error; } taosLRUCacheSetStrictCapacity(pInfo->metaCache.pTableMetaEntryCache, false); - pOperator->fpSet = createOperatorFpSet(operatorDummyOpenFn, doTableScan, NULL, NULL, destroyTableScanOperatorInfo, + pOperator->fpSet = createOperatorFpSet(operatorDummyOpenFn, doTableScan, NULL, destroyTableScanOperatorInfo, getTableScannerExecInfo); // for non-blocking operator, the open cost is always 0 @@ -986,14 +980,8 @@ SOperatorInfo* createTableSeqScanOperatorInfo(void* pReadHandle, SExecTaskInfo* pInfo->dataReader = pReadHandle; // pInfo->prevGroupId = -1; - pOperator->name = "TableSeqScanOperator"; - pOperator->operatorType = QUERY_NODE_PHYSICAL_PLAN_TABLE_SEQ_SCAN; - pOperator->blocking = false; - pOperator->status = OP_NOT_OPENED; - pOperator->info = pInfo; - pOperator->pTaskInfo = pTaskInfo; - - pOperator->fpSet = createOperatorFpSet(operatorDummyOpenFn, doTableScanImpl, NULL, NULL, NULL, NULL); + setOperatorInfo(pOperator, "TableSeqScanOperator", QUERY_NODE_PHYSICAL_PLAN_TABLE_SEQ_SCAN, false, OP_NOT_OPENED, pInfo, pTaskInfo); + pOperator->fpSet = createOperatorFpSet(operatorDummyOpenFn, doTableScanImpl, NULL, NULL, NULL); return pOperator; } @@ -1049,8 +1037,8 @@ static SSDataBlock* doBlockInfoScan(SOperatorInfo* pOperator) { SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo; STableBlockDistInfo blockDistInfo = {.minRows = INT_MAX, .maxRows = INT_MIN}; - int32_t code = doGetTableRowSize(pBlockScanInfo->readHandle.meta, pBlockScanInfo->uid, (int32_t*)&blockDistInfo.rowSize, - GET_TASKID(pTaskInfo)); + int32_t code = doGetTableRowSize(pBlockScanInfo->readHandle.meta, pBlockScanInfo->uid, + (int32_t*)&blockDistInfo.rowSize, GET_TASKID(pTaskInfo)); if (code != TSDB_CODE_SUCCESS) { T_LONG_JMP(pTaskInfo->env, code); } @@ -1148,15 +1136,8 @@ SOperatorInfo* createDataBlockInfoScanOperator(SReadHandle* readHandle, SBlockDi goto _error; } - pOperator->name = "DataBlockDistScanOperator"; - pOperator->operatorType = QUERY_NODE_PHYSICAL_PLAN_BLOCK_DIST_SCAN; - pOperator->blocking = false; - pOperator->status = OP_NOT_OPENED; - pOperator->info = pInfo; - pOperator->pTaskInfo = pTaskInfo; - - pOperator->fpSet = - createOperatorFpSet(operatorDummyOpenFn, doBlockInfoScan, NULL, NULL, destroyBlockDistScanOperatorInfo, NULL); + setOperatorInfo(pOperator, "DataBlockDistScanOperator", QUERY_NODE_PHYSICAL_PLAN_BLOCK_DIST_SCAN, false, OP_NOT_OPENED, pInfo, pTaskInfo); + pOperator->fpSet = createOperatorFpSet(operatorDummyOpenFn, doBlockInfoScan, NULL, destroyBlockDistScanOperatorInfo, NULL); return pOperator; _error: @@ -1599,8 +1580,10 @@ static void calBlockTbName(SExprSupp* pTbNameCalSup, SSDataBlock* pBlock) { void* pData = colDataGetData(pCol, 0); // TODO check tbname validation if (pData != (void*)-1 && pData != NULL) { - memcpy(pBlock->info.parTbName, varDataVal(pData), TMIN(varDataLen(pData), TSDB_TABLE_NAME_LEN)); - pBlock->info.parTbName[TSDB_TABLE_NAME_LEN - 1] = 0; + memset(pBlock->info.parTbName, 0, TSDB_TABLE_NAME_LEN); + int32_t len = TMIN(varDataLen(pData), TSDB_TABLE_NAME_LEN); + memcpy(pBlock->info.parTbName, varDataVal(pData), len); + /*pBlock->info.parTbName[len + 1] = 0;*/ } else { pBlock->info.parTbName[0] = 0; } @@ -2368,11 +2351,9 @@ SOperatorInfo* createRawScanOperatorInfo(SReadHandle* pHandle, SExecTaskInfo* pT pInfo->vnode = pHandle->vnode; pInfo->sContext = pHandle->sContext; - pOperator->name = "RawScanOperator"; - pOperator->info = pInfo; - pOperator->pTaskInfo = pTaskInfo; + setOperatorInfo(pOperator, "RawScanOperator", QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN, false, OP_NOT_OPENED, pInfo, pTaskInfo); - pOperator->fpSet = createOperatorFpSet(NULL, doRawScan, NULL, NULL, destroyRawScanOperatorInfo, NULL); + pOperator->fpSet = createOperatorFpSet(NULL, doRawScan, NULL, destroyRawScanOperatorInfo, NULL); return pOperator; _end: @@ -2556,16 +2537,11 @@ SOperatorInfo* createStreamScanOperatorInfo(SReadHandle* pHandle, STableScanPhys pInfo->assignBlockUid = pTableScanNode->assignBlockUid; pInfo->partitionSup.needCalc = false; - pOperator->name = "StreamScanOperator"; - pOperator->operatorType = QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN; - pOperator->blocking = false; - pOperator->status = OP_NOT_OPENED; - pOperator->info = pInfo; + setOperatorInfo(pOperator, "StreamScanOperator", QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN, false, OP_NOT_OPENED, pInfo, pTaskInfo); pOperator->exprSupp.numOfExprs = taosArrayGetSize(pInfo->pRes->pDataBlock); - pOperator->pTaskInfo = pTaskInfo; __optr_fn_t nextFn = pTaskInfo->execModel == OPTR_EXEC_MODEL_STREAM ? doStreamScan : doQueueScan; - pOperator->fpSet = createOperatorFpSet(operatorDummyOpenFn, nextFn, NULL, NULL, destroyStreamScanOperatorInfo, NULL); + pOperator->fpSet = createOperatorFpSet(operatorDummyOpenFn, nextFn, NULL, destroyStreamScanOperatorInfo, NULL); return pOperator; @@ -2900,7 +2876,7 @@ static SSDataBlock* sysTableScanUserTags(SOperatorInfo* pOperator) { } blockDataDestroy(dataBlock); pInfo->loadInfo.totalRows += pInfo->pRes->info.rows; - doSetOperatorCompleted(pOperator); + setOperatorCompleted(pOperator); return (pInfo->pRes->info.rows == 0) ? NULL : pInfo->pRes; } @@ -2953,7 +2929,7 @@ static SSDataBlock* sysTableScanUserTags(SOperatorInfo* pOperator) { if (ret != 0) { metaCloseTbCursor(pInfo->pCur); pInfo->pCur = NULL; - doSetOperatorCompleted(pOperator); + setOperatorCompleted(pOperator); } pInfo->loadInfo.totalRows += pInfo->pRes->info.rows; @@ -3743,7 +3719,7 @@ static SSDataBlock* sysTableBuildUserTablesByUids(SOperatorInfo* pOperator) { } if (i >= taosArrayGetSize(pIdx->uids)) { - doSetOperatorCompleted(pOperator); + setOperatorCompleted(pOperator); } else { pIdx->lastIdx = i + 1; } @@ -3925,7 +3901,7 @@ static SSDataBlock* sysTableBuildUserTables(SOperatorInfo* pOperator) { if (ret != 0) { metaCloseTbCursor(pInfo->pCur); pInfo->pCur = NULL; - doSetOperatorCompleted(pOperator); + setOperatorCompleted(pOperator); } pInfo->loadInfo.totalRows += pInfo->pRes->info.rows; @@ -3947,7 +3923,7 @@ static SSDataBlock* sysTableScanUserTables(SOperatorInfo* pOperator) { doFilterResult(pInfo->pRes, pOperator->exprSupp.pFilterInfo); pInfo->loadInfo.totalRows += pInfo->pRes->info.rows; - doSetOperatorCompleted(pOperator); + setOperatorCompleted(pOperator); return (pInfo->pRes->info.rows == 0) ? NULL : pInfo->pRes; } else { if (pInfo->showRewrite == false) { @@ -4199,15 +4175,9 @@ SOperatorInfo* createSysTableScanOperatorInfo(void* readHandle, SSystemTableScan pInfo->readHandle = *(SReadHandle*)readHandle; } - pOperator->name = "SysTableScanOperator"; - pOperator->operatorType = QUERY_NODE_PHYSICAL_PLAN_SYSTABLE_SCAN; - pOperator->blocking = false; - pOperator->status = OP_NOT_OPENED; - pOperator->info = pInfo; + setOperatorInfo(pOperator, "SysTableScanOperator", QUERY_NODE_PHYSICAL_PLAN_SYSTABLE_SCAN, false, OP_NOT_OPENED, pInfo, pTaskInfo); pOperator->exprSupp.numOfExprs = taosArrayGetSize(pInfo->pRes->pDataBlock); - pOperator->pTaskInfo = pTaskInfo; - - pOperator->fpSet = createOperatorFpSet(operatorDummyOpenFn, doSysTableScan, NULL, NULL, destroySysScanOperator, NULL); + pOperator->fpSet = createOperatorFpSet(operatorDummyOpenFn, doSysTableScan, NULL, destroySysScanOperator, NULL); return pOperator; _error: @@ -4283,7 +4253,7 @@ static SSDataBlock* doTagScan(SOperatorInfo* pOperator) { count += 1; if (++pInfo->curPos >= size) { - doSetOperatorCompleted(pOperator); + setOperatorCompleted(pOperator); } } @@ -4319,7 +4289,7 @@ SOperatorInfo* createTagScanOperatorInfo(SReadHandle* pReadHandle, STagScanPhysi int32_t numOfExprs = 0; SExprInfo* pExprInfo = createExprInfo(pPhyNode->pScanPseudoCols, NULL, &numOfExprs); - int32_t code = initExprSupp(&pOperator->exprSupp, pExprInfo, numOfExprs); + int32_t code = initExprSupp(&pOperator->exprSupp, pExprInfo, numOfExprs); if (code != TSDB_CODE_SUCCESS) { goto _error; } @@ -4335,18 +4305,11 @@ SOperatorInfo* createTagScanOperatorInfo(SReadHandle* pReadHandle, STagScanPhysi pInfo->readHandle = *pReadHandle; pInfo->curPos = 0; - pOperator->name = "TagScanOperator"; - pOperator->operatorType = QUERY_NODE_PHYSICAL_PLAN_TAG_SCAN; - - pOperator->blocking = false; - pOperator->status = OP_NOT_OPENED; - pOperator->info = pInfo; - pOperator->pTaskInfo = pTaskInfo; - + setOperatorInfo(pOperator, "TagScanOperator", QUERY_NODE_PHYSICAL_PLAN_TAG_SCAN, false, OP_NOT_OPENED, pInfo, pTaskInfo); initResultSizeInfo(&pOperator->resultInfo, 4096); blockDataEnsureCapacity(pInfo->pRes, pOperator->resultInfo.capacity); - pOperator->fpSet = createOperatorFpSet(operatorDummyOpenFn, doTagScan, NULL, NULL, destroyTagScanOperatorInfo, NULL); + pOperator->fpSet = createOperatorFpSet(operatorDummyOpenFn, doTagScan, NULL, destroyTagScanOperatorInfo, NULL); return pOperator; @@ -4455,7 +4418,7 @@ static int32_t loadDataBlockFromOneTable(SOperatorInfo* pOperator, STableMergeSc T_LONG_JMP(pTaskInfo->env, code); } - if (pOperator->exprSupp.pFilterInfo!= NULL) { + if (pOperator->exprSupp.pFilterInfo != NULL) { int64_t st = taosGetTimestampMs(); doFilter(pBlock, pOperator->exprSupp.pFilterInfo, &pTableScanInfo->matchInfo); @@ -4713,7 +4676,7 @@ SSDataBlock* doTableMergeScan(SOperatorInfo* pOperator) { pInfo->hasGroupId = true; if (tableListSize == 0) { - doSetOperatorCompleted(pOperator); + setOperatorCompleted(pOperator); return NULL; } pInfo->tableStartIndex = 0; @@ -4732,7 +4695,7 @@ SSDataBlock* doTableMergeScan(SOperatorInfo* pOperator) { } else { stopGroupTableMergeScan(pOperator); if (pInfo->tableEndIndex >= tableListSize - 1) { - doSetOperatorCompleted(pOperator); + setOperatorCompleted(pOperator); break; } pInfo->tableStartIndex = pInfo->tableEndIndex + 1; @@ -4831,7 +4794,6 @@ SOperatorInfo* createTableMergeScanOperatorInfo(STableScanPhysiNode* pTableScanN pInfo->sample.seed = taosGetTimestampSec(); pInfo->dataBlockLoadFlag = pTableScanNode->dataRequired; - code = filterInitFromNode((SNode*)pTableScanNode->scan.node.pConditions, &pOperator->exprSupp.pFilterInfo, 0); if (code != TSDB_CODE_SUCCESS) { goto _error; @@ -4853,15 +4815,10 @@ SOperatorInfo* createTableMergeScanOperatorInfo(STableScanPhysiNode* pTableScanN int32_t rowSize = pInfo->pResBlock->info.rowSize; pInfo->bufPageSize = getProperSortPageSize(rowSize); - pOperator->name = "TableMergeScanOperator"; - pOperator->operatorType = QUERY_NODE_PHYSICAL_PLAN_TABLE_MERGE_SCAN; - pOperator->blocking = false; - pOperator->status = OP_NOT_OPENED; - pOperator->info = pInfo; + setOperatorInfo(pOperator, "TableMergeScanOperator", QUERY_NODE_PHYSICAL_PLAN_TABLE_MERGE_SCAN, false, OP_NOT_OPENED, pInfo, pTaskInfo); pOperator->exprSupp.numOfExprs = numOfCols; - pOperator->pTaskInfo = pTaskInfo; - pOperator->fpSet = createOperatorFpSet(operatorDummyOpenFn, doTableMergeScan, NULL, NULL, + pOperator->fpSet = createOperatorFpSet(operatorDummyOpenFn, doTableMergeScan, NULL, destroyTableMergeScanOperatorInfo, getTableMergeScanExplainExecInfo); pOperator->cost.openCost = 0; return pOperator; diff --git a/source/libs/executor/src/sortoperator.c b/source/libs/executor/src/sortoperator.c index af87c4b2eb..fc53623d44 100644 --- a/source/libs/executor/src/sortoperator.c +++ b/source/libs/executor/src/sortoperator.c @@ -53,11 +53,7 @@ SOperatorInfo* createSortOperatorInfo(SOperatorInfo* downstream, SSortPhysiNode* pInfo->pSortInfo = createSortInfo(pSortNode->pSortKeys); initLimitInfo(pSortNode->node.pLimit, pSortNode->node.pSlimit, &pInfo->limitInfo); - pOperator->name = "SortOperator"; - pOperator->operatorType = QUERY_NODE_PHYSICAL_PLAN_SORT; - pOperator->blocking = true; - pOperator->status = OP_NOT_OPENED; - pOperator->info = pInfo; + setOperatorInfo(pOperator, "SortOperator", QUERY_NODE_PHYSICAL_PLAN_SORT, true, OP_NOT_OPENED, pInfo, pTaskInfo); pOperator->exprSupp.pExprInfo = pExprInfo; pOperator->exprSupp.numOfExprs = numOfCols; @@ -67,7 +63,7 @@ SOperatorInfo* createSortOperatorInfo(SOperatorInfo* downstream, SSortPhysiNode* // TODO dynamic set the available sort buffer pOperator->fpSet = - createOperatorFpSet(doOpenSortOperator, doSort, NULL, NULL, destroySortOperatorInfo, getExplainExecInfo); + createOperatorFpSet(doOpenSortOperator, doSort, NULL, destroySortOperatorInfo, getExplainExecInfo); code = appendDownstream(pOperator, &downstream, 1); if (code != TSDB_CODE_SUCCESS) { @@ -214,7 +210,7 @@ SSDataBlock* doSort(SOperatorInfo* pOperator) { pBlock = getSortedBlockData(pInfo->pSortHandle, pInfo->binfo.pRes, pOperator->resultInfo.capacity, pInfo->matchInfo.pList, pInfo); if (pBlock == NULL) { - doSetOperatorCompleted(pOperator); + setOperatorCompleted(pOperator); return NULL; } @@ -428,7 +424,7 @@ SSDataBlock* doGroupSort(SOperatorInfo* pOperator) { pInfo->prefetchedSortInput = pOperator->pDownstream[0]->fpSet.getNextFn(pOperator->pDownstream[0]); if (pInfo->prefetchedSortInput == NULL) { - doSetOperatorCompleted(pOperator); + setOperatorCompleted(pOperator); return NULL; } pInfo->currGroupId = pInfo->prefetchedSortInput->info.groupId; @@ -453,7 +449,7 @@ SSDataBlock* doGroupSort(SOperatorInfo* pOperator) { beginSortGroup(pOperator); } else if (pInfo->childOpStatus == CHILD_OP_FINISHED) { finishSortGroup(pOperator); - doSetOperatorCompleted(pOperator); + setOperatorCompleted(pOperator); return NULL; } } @@ -509,15 +505,8 @@ SOperatorInfo* createGroupSortOperatorInfo(SOperatorInfo* downstream, SGroupSort } pInfo->pSortInfo = createSortInfo(pSortPhyNode->pSortKeys); - - pOperator->name = "GroupSortOperator"; - pOperator->operatorType = QUERY_NODE_PHYSICAL_PLAN_GROUP_SORT; - pOperator->blocking = false; - pOperator->status = OP_NOT_OPENED; - pOperator->info = pInfo; - pOperator->pTaskInfo = pTaskInfo; - - pOperator->fpSet = createOperatorFpSet(operatorDummyOpenFn, doGroupSort, NULL, NULL, destroyGroupSortOperatorInfo, + setOperatorInfo(pOperator, "GroupSortOperator", QUERY_NODE_PHYSICAL_PLAN_GROUP_SORT, false, OP_NOT_OPENED, pInfo, pTaskInfo); + pOperator->fpSet = createOperatorFpSet(operatorDummyOpenFn, doGroupSort, NULL, destroyGroupSortOperatorInfo, getGroupSortExplainExecInfo); code = appendDownstream(pOperator, &downstream, 1); @@ -705,7 +694,7 @@ SSDataBlock* doMultiwayMerge(SOperatorInfo* pOperator) { if (pBlock != NULL) { pOperator->resultInfo.totalRows += pBlock->info.rows; } else { - doSetOperatorCompleted(pOperator); + setOperatorCompleted(pOperator); } return pBlock; @@ -774,14 +763,8 @@ SOperatorInfo* createMultiwayMergeOperatorInfo(SOperatorInfo** downStreams, size pInfo->bufPageSize = getProperSortPageSize(rowSize); pInfo->sortBufSize = pInfo->bufPageSize * (numStreams + 1); // one additional is reserved for merged result. - pOperator->name = "MultiwayMerge"; - pOperator->operatorType = QUERY_NODE_PHYSICAL_PLAN_MERGE; - pOperator->blocking = false; - pOperator->status = OP_NOT_OPENED; - pOperator->info = pInfo; - pOperator->pTaskInfo = pTaskInfo; - - pOperator->fpSet = createOperatorFpSet(doOpenMultiwayMergeOperator, doMultiwayMerge, NULL, NULL, + setOperatorInfo(pOperator, "MultiwayMergeOperator", QUERY_NODE_PHYSICAL_PLAN_MERGE, false, OP_NOT_OPENED, pInfo, pTaskInfo); + pOperator->fpSet = createOperatorFpSet(doOpenMultiwayMergeOperator, doMultiwayMerge, NULL, destroyMultiwayMergeOperatorInfo, getMultiwayMergeExplainExecInfo); code = appendDownstream(pOperator, downStreams, numStreams); diff --git a/source/libs/executor/src/tfill.c b/source/libs/executor/src/tfill.c index 9f06e639b3..7c9d73ad13 100644 --- a/source/libs/executor/src/tfill.c +++ b/source/libs/executor/src/tfill.c @@ -1443,7 +1443,7 @@ static SSDataBlock* doStreamFill(SOperatorInfo* pOperator) { printDataBlock(pInfo->pRes, "stream fill"); return pInfo->pRes; } - doSetOperatorCompleted(pOperator); + setOperatorCompleted(pOperator); resetStreamFillInfo(pInfo); return NULL; } @@ -1512,7 +1512,7 @@ static SSDataBlock* doStreamFill(SOperatorInfo* pOperator) { } if (pInfo->pRes->info.rows == 0) { - doSetOperatorCompleted(pOperator); + setOperatorCompleted(pOperator); resetStreamFillInfo(pInfo); return NULL; } @@ -1690,15 +1690,9 @@ SOperatorInfo* createStreamFillOperatorInfo(SOperatorInfo* downstream, SStreamFi } pInfo->srcRowIndex = 0; - - pOperator->name = "StreamFillOperator"; - pOperator->blocking = false; - pOperator->status = OP_NOT_OPENED; - pOperator->operatorType = QUERY_NODE_PHYSICAL_PLAN_STREAM_FILL; - pOperator->info = pInfo; - pOperator->pTaskInfo = pTaskInfo; + setOperatorInfo(pOperator, "StreamFillOperator", QUERY_NODE_PHYSICAL_PLAN_STREAM_FILL, false, OP_NOT_OPENED, pInfo, pTaskInfo); pOperator->fpSet = - createOperatorFpSet(operatorDummyOpenFn, doStreamFill, NULL, NULL, destroyStreamFillOperatorInfo, NULL); + createOperatorFpSet(operatorDummyOpenFn, doStreamFill, NULL, destroyStreamFillOperatorInfo, NULL); code = appendDownstream(pOperator, &downstream, 1); if (code != TSDB_CODE_SUCCESS) { diff --git a/source/libs/executor/src/timewindowoperator.c b/source/libs/executor/src/timewindowoperator.c index e5b49acf0b..4c369e8802 100644 --- a/source/libs/executor/src/timewindowoperator.c +++ b/source/libs/executor/src/timewindowoperator.c @@ -1221,7 +1221,7 @@ static SSDataBlock* doStateWindowAgg(SOperatorInfo* pOperator) { pTaskInfo->code = pOperator->fpSet._openFn(pOperator); if (pTaskInfo->code != TSDB_CODE_SUCCESS) { - doSetOperatorCompleted(pOperator); + setOperatorCompleted(pOperator); return NULL; } @@ -1232,7 +1232,7 @@ static SSDataBlock* doStateWindowAgg(SOperatorInfo* pOperator) { bool hasRemain = hasRemainResults(&pInfo->groupResInfo); if (!hasRemain) { - doSetOperatorCompleted(pOperator); + setOperatorCompleted(pOperator); break; } @@ -1269,7 +1269,7 @@ static SSDataBlock* doBuildIntervalResult(SOperatorInfo* pOperator) { bool hasRemain = hasRemainResults(&pInfo->groupResInfo); if (!hasRemain) { - doSetOperatorCompleted(pOperator); + setOperatorCompleted(pOperator); break; } @@ -1739,7 +1739,6 @@ SOperatorInfo* createIntervalOperatorInfo(SOperatorInfo* downstream, SIntervalPh ASSERT(as.calTrigger != STREAM_TRIGGER_MAX_DELAY); - pOperator->pTaskInfo = pTaskInfo; pInfo->win = pTaskInfo->window; pInfo->inputOrder = (pPhyNode->window.inputTsOrder == ORDER_ASC) ? TSDB_ORDER_ASC : TSDB_ORDER_DESC; pInfo->resultTsOrder = (pPhyNode->window.outputTsOrder == ORDER_ASC) ? TSDB_ORDER_ASC : TSDB_ORDER_DESC; @@ -1777,15 +1776,11 @@ SOperatorInfo* createIntervalOperatorInfo(SOperatorInfo* downstream, SIntervalPh } initResultRowInfo(&pInfo->binfo.resultRowInfo); - - pOperator->name = "TimeIntervalAggOperator"; - pOperator->operatorType = QUERY_NODE_PHYSICAL_PLAN_HASH_INTERVAL; - pOperator->blocking = true; - pOperator->status = OP_NOT_OPENED; - pOperator->info = pInfo; + setOperatorInfo(pOperator, "TimeIntervalAggOperator", QUERY_NODE_PHYSICAL_PLAN_HASH_INTERVAL, true, OP_NOT_OPENED, + pInfo, pTaskInfo); pOperator->fpSet = - createOperatorFpSet(doOpenIntervalAgg, doBuildIntervalResult, NULL, NULL, destroyIntervalOperatorInfo, NULL); + createOperatorFpSet(doOpenIntervalAgg, doBuildIntervalResult, NULL, destroyIntervalOperatorInfo, NULL); code = appendDownstream(pOperator, &downstream, 1); if (code != TSDB_CODE_SUCCESS) { @@ -1890,7 +1885,7 @@ static SSDataBlock* doSessionWindowAgg(SOperatorInfo* pOperator) { bool hasRemain = hasRemainResults(&pInfo->groupResInfo); if (!hasRemain) { - doSetOperatorCompleted(pOperator); + setOperatorCompleted(pOperator); break; } @@ -1933,7 +1928,7 @@ static SSDataBlock* doSessionWindowAgg(SOperatorInfo* pOperator) { bool hasRemain = hasRemainResults(&pInfo->groupResInfo); if (!hasRemain) { - doSetOperatorCompleted(pOperator); + setOperatorCompleted(pOperator); break; } @@ -2281,7 +2276,7 @@ static SSDataBlock* doTimeslice(SOperatorInfo* pOperator) { } if (pSliceInfo->current > pSliceInfo->win.ekey) { - doSetOperatorCompleted(pOperator); + setOperatorCompleted(pOperator); break; } @@ -2330,7 +2325,7 @@ static SSDataBlock* doTimeslice(SOperatorInfo* pOperator) { } if (pSliceInfo->current > pSliceInfo->win.ekey) { - doSetOperatorCompleted(pOperator); + setOperatorCompleted(pOperator); break; } } @@ -2342,7 +2337,7 @@ static SSDataBlock* doTimeslice(SOperatorInfo* pOperator) { pSliceInfo->current = taosTimeAdd(pSliceInfo->current, pInterval->interval, pInterval->intervalUnit, pInterval->precision); if (pSliceInfo->current > pSliceInfo->win.ekey) { - doSetOperatorCompleted(pOperator); + setOperatorCompleted(pOperator); break; } } @@ -2365,7 +2360,7 @@ static SSDataBlock* doTimeslice(SOperatorInfo* pOperator) { } if (pSliceInfo->current > pSliceInfo->win.ekey) { - doSetOperatorCompleted(pOperator); + setOperatorCompleted(pOperator); break; } } @@ -2386,7 +2381,7 @@ static SSDataBlock* doTimeslice(SOperatorInfo* pOperator) { } if (pSliceInfo->current > pSliceInfo->win.ekey) { - doSetOperatorCompleted(pOperator); + setOperatorCompleted(pOperator); break; } } else { @@ -2448,7 +2443,7 @@ static SSDataBlock* doTimeslice(SOperatorInfo* pOperator) { } if (pSliceInfo->current > pSliceInfo->win.ekey) { - doSetOperatorCompleted(pOperator); + setOperatorCompleted(pOperator); break; } } @@ -2463,7 +2458,7 @@ static SSDataBlock* doTimeslice(SOperatorInfo* pOperator) { } if (pSliceInfo->current > pSliceInfo->win.ekey) { - doSetOperatorCompleted(pOperator); + setOperatorCompleted(pOperator); break; } } @@ -2557,15 +2552,9 @@ SOperatorInfo* createTimeSliceOperatorInfo(SOperatorInfo* downstream, SPhysiNode pScanInfo->cond.twindows = pInfo->win; pScanInfo->cond.type = TIMEWINDOW_RANGE_EXTERNAL; - pOperator->name = "TimeSliceOperator"; - pOperator->operatorType = QUERY_NODE_PHYSICAL_PLAN_INTERP_FUNC; - pOperator->blocking = false; - pOperator->status = OP_NOT_OPENED; - pOperator->info = pInfo; - pOperator->pTaskInfo = pTaskInfo; - - pOperator->fpSet = - createOperatorFpSet(operatorDummyOpenFn, doTimeslice, NULL, NULL, destroyTimeSliceOperatorInfo, NULL); + setOperatorInfo(pOperator, "TimeSliceOperator", QUERY_NODE_PHYSICAL_PLAN_INTERP_FUNC, false, OP_NOT_OPENED, pInfo, + pTaskInfo); + pOperator->fpSet = createOperatorFpSet(operatorDummyOpenFn, doTimeslice, NULL, destroyTimeSliceOperatorInfo, NULL); blockDataEnsureCapacity(pInfo->pRes, pOperator->resultInfo.capacity); @@ -2633,15 +2622,11 @@ SOperatorInfo* createStatewindowOperatorInfo(SOperatorInfo* downstream, SStateWi initExecTimeWindowInfo(&pInfo->twAggSup.timeWindowData, &pTaskInfo->window); pInfo->tsSlotId = tsSlotId; - pOperator->name = "StateWindowOperator"; - pOperator->operatorType = QUERY_NODE_PHYSICAL_PLAN_MERGE_STATE; - pOperator->blocking = true; - pOperator->status = OP_NOT_OPENED; - pOperator->pTaskInfo = pTaskInfo; - pOperator->info = pInfo; + setOperatorInfo(pOperator, "StateWindowOperator", QUERY_NODE_PHYSICAL_PLAN_MERGE_STATE, true, OP_NOT_OPENED, pInfo, + pTaskInfo); pOperator->fpSet = - createOperatorFpSet(openStateWindowAggOptr, doStateWindowAgg, NULL, NULL, destroyStateWindowOperatorInfo, NULL); + createOperatorFpSet(openStateWindowAggOptr, doStateWindowAgg, NULL, destroyStateWindowOperatorInfo, NULL); code = appendDownstream(pOperator, &downstream, 1); if (code != TSDB_CODE_SUCCESS) { @@ -2711,14 +2696,10 @@ SOperatorInfo* createSessionAggOperatorInfo(SOperatorInfo* downstream, SSessionW goto _error; } - pOperator->name = "SessionWindowAggOperator"; - pOperator->operatorType = QUERY_NODE_PHYSICAL_PLAN_MERGE_SESSION; - pOperator->blocking = true; - pOperator->status = OP_NOT_OPENED; - pOperator->info = pInfo; - + setOperatorInfo(pOperator, "SessionWindowAggOperator", QUERY_NODE_PHYSICAL_PLAN_MERGE_SESSION, true, OP_NOT_OPENED, + pInfo, pTaskInfo); pOperator->fpSet = - createOperatorFpSet(operatorDummyOpenFn, doSessionWindowAgg, NULL, NULL, destroySWindowOperatorInfo, NULL); + createOperatorFpSet(operatorDummyOpenFn, doSessionWindowAgg, NULL, destroySWindowOperatorInfo, NULL); pOperator->pTaskInfo = pTaskInfo; code = appendDownstream(pOperator, &downstream, 1); if (code != TSDB_CODE_SUCCESS) { @@ -3134,7 +3115,7 @@ static SSDataBlock* doStreamFinalIntervalAgg(SOperatorInfo* pOperator) { return pInfo->binfo.pRes; } - doSetOperatorCompleted(pOperator); + setOperatorCompleted(pOperator); if (!IS_FINAL_OP(pInfo)) { clearFunctionContext(&pOperator->exprSupp); // semi interval operator clear disk buffer @@ -3403,7 +3384,7 @@ SOperatorInfo* createStreamFinalIntervalOperatorInfo(SOperatorInfo* downstream, pOperator->info = pInfo; pOperator->fpSet = - createOperatorFpSet(NULL, doStreamFinalIntervalAgg, NULL, NULL, destroyStreamFinalIntervalOperatorInfo, NULL); + createOperatorFpSet(NULL, doStreamFinalIntervalAgg, NULL, destroyStreamFinalIntervalOperatorInfo, NULL); if (pPhyNode->type == QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_INTERVAL) { initIntervalDownStream(downstream, pPhyNode->type, &pInfo->aggSup, &pInfo->interval, &pInfo->twAggSup); } @@ -3844,7 +3825,7 @@ static int32_t copyUpdateResult(SSHashObj* pStUpdated, SArray* pUpdated) { return TSDB_CODE_SUCCESS; } -void doBuildDeleteDataBlock(SSHashObj* pStDeleted, SSDataBlock* pBlock, void** Ite) { +void doBuildDeleteDataBlock(SOperatorInfo* pOp, SSHashObj* pStDeleted, SSDataBlock* pBlock, void** Ite) { blockDataCleanup(pBlock); int32_t size = tSimpleHashGetSize(pStDeleted); if (size == 0) { @@ -3870,6 +3851,26 @@ void doBuildDeleteDataBlock(SSHashObj* pStDeleted, SSDataBlock* pBlock, void** I colDataAppendNULL(pCalStCol, pBlock->info.rows); SColumnInfoData* pCalEdCol = taosArrayGet(pBlock->pDataBlock, CALCULATE_END_TS_COLUMN_INDEX); colDataAppendNULL(pCalEdCol, pBlock->info.rows); + + SHashObj* pGroupIdTbNameMap = NULL; + if (pOp->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_SESSION || + pOp->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_SESSION) { + SStreamSessionAggOperatorInfo* pInfo = pOp->info; + pGroupIdTbNameMap = pInfo->pGroupIdTbNameMap; + } else if (pOp->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_STATE) { + SStreamStateAggOperatorInfo* pInfo = pOp->info; + pGroupIdTbNameMap = pInfo->pGroupIdTbNameMap; + } + + char* tbname = taosHashGet(pGroupIdTbNameMap, &res->groupId, sizeof(int64_t)); + SColumnInfoData* pTableCol = taosArrayGet(pBlock->pDataBlock, TABLE_NAME_COLUMN_INDEX); + if (tbname == NULL) { + colDataAppendNULL(pTableCol, pBlock->info.rows); + } else { + char parTbName[VARSTR_HEADER_SIZE + TSDB_TABLE_NAME_LEN]; + STR_WITH_MAXSIZE_TO_VARSTR(parTbName, tbname, sizeof(parTbName)); + colDataAppend(pTableCol, pBlock->info.rows, (const char*)parTbName, false); + } pBlock->info.rows += 1; } if ((*Ite) == NULL) { @@ -4016,7 +4017,7 @@ static SSDataBlock* doStreamSessionAgg(SOperatorInfo* pOperator) { if (pOperator->status == OP_EXEC_DONE) { return NULL; } else if (pOperator->status == OP_RES_TO_RETURN) { - doBuildDeleteDataBlock(pInfo->pStDeleted, pInfo->pDelRes, &pInfo->pDelIterator); + doBuildDeleteDataBlock(pOperator, pInfo->pStDeleted, pInfo->pDelRes, &pInfo->pDelIterator); if (pInfo->pDelRes->info.rows > 0) { printDataBlock(pInfo->pDelRes, IS_FINAL_OP(pInfo) ? "final session" : "single session"); return pInfo->pDelRes; @@ -4027,7 +4028,7 @@ static SSDataBlock* doStreamSessionAgg(SOperatorInfo* pOperator) { return pBInfo->pRes; } - doSetOperatorCompleted(pOperator); + setOperatorCompleted(pOperator); return NULL; } @@ -4121,7 +4122,7 @@ static SSDataBlock* doStreamSessionAgg(SOperatorInfo* pOperator) { taosMemoryFree(pBuf); #endif - doBuildDeleteDataBlock(pInfo->pStDeleted, pInfo->pDelRes, &pInfo->pDelIterator); + doBuildDeleteDataBlock(pOperator, pInfo->pStDeleted, pInfo->pDelRes, &pInfo->pDelIterator); if (pInfo->pDelRes->info.rows > 0) { printDataBlock(pInfo->pDelRes, IS_FINAL_OP(pInfo) ? "final session" : "single session"); return pInfo->pDelRes; @@ -4133,7 +4134,7 @@ static SSDataBlock* doStreamSessionAgg(SOperatorInfo* pOperator) { return pBInfo->pRes; } - doSetOperatorCompleted(pOperator); + setOperatorCompleted(pOperator); return NULL; } @@ -4200,13 +4201,11 @@ SOperatorInfo* createStreamSessionAggOperatorInfo(SOperatorInfo* downstream, SPh pInfo->pGroupIdTbNameMap = taosHashInit(1024, taosGetDefaultHashFunction(TSDB_DATA_TYPE_UBIGINT), false, HASH_NO_LOCK); - pOperator->name = "StreamSessionWindowAggOperator"; - pOperator->operatorType = QUERY_NODE_PHYSICAL_PLAN_STREAM_SESSION; - pOperator->blocking = true; - pOperator->status = OP_NOT_OPENED; - pOperator->info = pInfo; - pOperator->fpSet = createOperatorFpSet(operatorDummyOpenFn, doStreamSessionAgg, NULL, NULL, - destroyStreamSessionAggOperatorInfo, NULL); + setOperatorInfo(pOperator, "StreamSessionWindowAggOperator", QUERY_NODE_PHYSICAL_PLAN_STREAM_SESSION, true, + OP_NOT_OPENED, pInfo, pTaskInfo); + pOperator->fpSet = + createOperatorFpSet(operatorDummyOpenFn, doStreamSessionAgg, NULL, destroyStreamSessionAggOperatorInfo, NULL); + if (downstream) { initDownStream(downstream, &pInfo->streamAggSup, pInfo->twAggSup.waterMark, pOperator->operatorType, pInfo->primaryTsIndex); @@ -4247,7 +4246,7 @@ static SSDataBlock* doStreamSessionSemiAgg(SOperatorInfo* pOperator) { return pBInfo->pRes; } - doBuildDeleteDataBlock(pInfo->pStDeleted, pInfo->pDelRes, &pInfo->pDelIterator); + doBuildDeleteDataBlock(pOperator, pInfo->pStDeleted, pInfo->pDelRes, &pInfo->pDelIterator); if (pInfo->pDelRes->info.rows > 0) { printDataBlock(pInfo->pDelRes, "semi session delete"); return pInfo->pDelRes; @@ -4257,7 +4256,7 @@ static SSDataBlock* doStreamSessionSemiAgg(SOperatorInfo* pOperator) { clearFunctionContext(&pOperator->exprSupp); // semi interval operator clear disk buffer clearStreamSessionOperator(pInfo); - doSetOperatorCompleted(pOperator); + setOperatorCompleted(pOperator); return NULL; } } @@ -4327,7 +4326,7 @@ static SSDataBlock* doStreamSessionSemiAgg(SOperatorInfo* pOperator) { return pBInfo->pRes; } - doBuildDeleteDataBlock(pInfo->pStDeleted, pInfo->pDelRes, &pInfo->pDelIterator); + doBuildDeleteDataBlock(pOperator, pInfo->pStDeleted, pInfo->pDelRes, &pInfo->pDelIterator); if (pInfo->pDelRes->info.rows > 0) { printDataBlock(pInfo->pDelRes, "semi session delete"); return pInfo->pDelRes; @@ -4336,7 +4335,7 @@ static SSDataBlock* doStreamSessionSemiAgg(SOperatorInfo* pOperator) { clearFunctionContext(&pOperator->exprSupp); // semi interval operator clear disk buffer clearStreamSessionOperator(pInfo); - doSetOperatorCompleted(pOperator); + setOperatorCompleted(pOperator); return NULL; } @@ -4347,20 +4346,21 @@ SOperatorInfo* createStreamFinalSessionAggOperatorInfo(SOperatorInfo* downstream if (pOperator == NULL) { goto _error; } + SStreamSessionAggOperatorInfo* pInfo = pOperator->info; - if (pPhyNode->type == QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_SESSION) { - pInfo->isFinal = true; - pOperator->name = "StreamSessionFinalAggOperator"; - } else { - pInfo->isFinal = false; + pInfo->isFinal = (pPhyNode->type == QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_SESSION); + char* name = (pInfo->isFinal) ? "StreamSessionFinalAggOperator" : "StreamSessionSemiAggOperator"; + + if (pPhyNode->type != QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_SESSION) { pInfo->pUpdateRes = createSpecialDataBlock(STREAM_CLEAR); blockDataEnsureCapacity(pInfo->pUpdateRes, 128); - pOperator->name = "StreamSessionSemiAggOperator"; - pOperator->fpSet = createOperatorFpSet(operatorDummyOpenFn, doStreamSessionSemiAgg, NULL, NULL, + pOperator->fpSet = createOperatorFpSet(operatorDummyOpenFn, doStreamSessionSemiAgg, NULL, destroyStreamSessionAggOperatorInfo, NULL); } + setOperatorInfo(pOperator, name, pPhyNode->type, false, OP_NOT_OPENED, pInfo, pTaskInfo); + pInfo->pGroupIdTbNameMap = taosHashInit(1024, taosGetDefaultHashFunction(TSDB_DATA_TYPE_UBIGINT), false, HASH_NO_LOCK); @@ -4578,7 +4578,7 @@ static SSDataBlock* doStreamStateAgg(SOperatorInfo* pOperator) { SOptrBasicInfo* pBInfo = &pInfo->binfo; int64_t maxTs = INT64_MIN; if (pOperator->status == OP_RES_TO_RETURN) { - doBuildDeleteDataBlock(pInfo->pSeDeleted, pInfo->pDelRes, &pInfo->pDelIterator); + doBuildDeleteDataBlock(pOperator, pInfo->pSeDeleted, pInfo->pDelRes, &pInfo->pDelIterator); if (pInfo->pDelRes->info.rows > 0) { printDataBlock(pInfo->pDelRes, "single state delete"); return pInfo->pDelRes; @@ -4590,7 +4590,7 @@ static SSDataBlock* doStreamStateAgg(SOperatorInfo* pOperator) { return pBInfo->pRes; } - doSetOperatorCompleted(pOperator); + setOperatorCompleted(pOperator); return NULL; } @@ -4645,7 +4645,7 @@ static SSDataBlock* doStreamStateAgg(SOperatorInfo* pOperator) { initGroupResInfoFromArrayList(&pInfo->groupResInfo, pUpdated); blockDataEnsureCapacity(pInfo->binfo.pRes, pOperator->resultInfo.capacity); - doBuildDeleteDataBlock(pInfo->pSeDeleted, pInfo->pDelRes, &pInfo->pDelIterator); + doBuildDeleteDataBlock(pOperator, pInfo->pSeDeleted, pInfo->pDelRes, &pInfo->pDelIterator); if (pInfo->pDelRes->info.rows > 0) { printDataBlock(pInfo->pDelRes, "single state delete"); return pInfo->pDelRes; @@ -4656,7 +4656,7 @@ static SSDataBlock* doStreamStateAgg(SOperatorInfo* pOperator) { printDataBlock(pBInfo->pRes, "single state"); return pBInfo->pRes; } - doSetOperatorCompleted(pOperator); + setOperatorCompleted(pOperator); return NULL; } @@ -4721,14 +4721,10 @@ SOperatorInfo* createStreamStateAggOperatorInfo(SOperatorInfo* downstream, SPhys pInfo->pGroupIdTbNameMap = taosHashInit(1024, taosGetDefaultHashFunction(TSDB_DATA_TYPE_UBIGINT), false, HASH_NO_LOCK); - pOperator->name = "StreamStateAggOperator"; - pOperator->operatorType = QUERY_NODE_PHYSICAL_PLAN_STREAM_STATE; - pOperator->blocking = true; - pOperator->status = OP_NOT_OPENED; - pOperator->pTaskInfo = pTaskInfo; - pOperator->info = pInfo; + setOperatorInfo(pOperator, "StreamStateAggOperator", QUERY_NODE_PHYSICAL_PLAN_STREAM_STATE, true, OP_NOT_OPENED, + pInfo, pTaskInfo); pOperator->fpSet = - createOperatorFpSet(operatorDummyOpenFn, doStreamStateAgg, NULL, NULL, destroyStreamStateOperatorInfo, NULL); + createOperatorFpSet(operatorDummyOpenFn, doStreamStateAgg, NULL, destroyStreamStateOperatorInfo, NULL); initDownStream(downstream, &pInfo->streamAggSup, pInfo->twAggSup.waterMark, pOperator->operatorType, pInfo->primaryTsIndex); code = appendDownstream(pOperator, &downstream, 1); @@ -4876,7 +4872,7 @@ static void doMergeAlignedIntervalAgg(SOperatorInfo* pOperator) { cleanupAfterGroupResultGen(pMiaInfo, pRes); } - doSetOperatorCompleted(pOperator); + setOperatorCompleted(pOperator); break; } @@ -5001,16 +4997,11 @@ SOperatorInfo* createMergeAlignedIntervalOperatorInfo(SOperatorInfo* downstream, initResultRowInfo(&iaInfo->binfo.resultRowInfo); blockDataEnsureCapacity(iaInfo->binfo.pRes, pOperator->resultInfo.capacity); - - pOperator->name = "TimeMergeAlignedIntervalAggOperator"; - pOperator->operatorType = QUERY_NODE_PHYSICAL_PLAN_MERGE_ALIGNED_INTERVAL; - pOperator->blocking = false; - pOperator->status = OP_NOT_OPENED; - pOperator->pTaskInfo = pTaskInfo; - pOperator->info = miaInfo; + setOperatorInfo(pOperator, "TimeMergeAlignedIntervalAggOperator", QUERY_NODE_PHYSICAL_PLAN_MERGE_ALIGNED_INTERVAL, + false, OP_NOT_OPENED, miaInfo, pTaskInfo); pOperator->fpSet = - createOperatorFpSet(operatorDummyOpenFn, mergeAlignedIntervalAgg, NULL, NULL, destroyMAIOperatorInfo, NULL); + createOperatorFpSet(operatorDummyOpenFn, mergeAlignedIntervalAgg, NULL, destroyMAIOperatorInfo, NULL); code = appendDownstream(pOperator, &downstream, 1); if (code != TSDB_CODE_SUCCESS) { @@ -5254,7 +5245,7 @@ static SSDataBlock* doMergeIntervalAgg(SOperatorInfo* pOperator) { } if (pRes->info.rows == 0) { - doSetOperatorCompleted(pOperator); + setOperatorCompleted(pOperator); } size_t rows = pRes->info.rows; @@ -5313,16 +5304,10 @@ SOperatorInfo* createMergeIntervalOperatorInfo(SOperatorInfo* downstream, SMerge } initResultRowInfo(&pIntervalInfo->binfo.resultRowInfo); - - pOperator->name = "TimeMergeIntervalAggOperator"; - pOperator->operatorType = QUERY_NODE_PHYSICAL_PLAN_MERGE_INTERVAL; - pOperator->blocking = false; - pOperator->status = OP_NOT_OPENED; - pOperator->pTaskInfo = pTaskInfo; - pOperator->info = pMergeIntervalInfo; - + setOperatorInfo(pOperator, "TimeMergeIntervalAggOperator", QUERY_NODE_PHYSICAL_PLAN_MERGE_INTERVAL, false, + OP_NOT_OPENED, pMergeIntervalInfo, pTaskInfo); pOperator->fpSet = - createOperatorFpSet(operatorDummyOpenFn, doMergeIntervalAgg, NULL, NULL, destroyMergeIntervalOperatorInfo, NULL); + createOperatorFpSet(operatorDummyOpenFn, doMergeIntervalAgg, NULL, destroyMergeIntervalOperatorInfo, NULL); code = appendDownstream(pOperator, &downstream, 1); if (code != TSDB_CODE_SUCCESS) { @@ -5366,7 +5351,7 @@ static SSDataBlock* doStreamIntervalAgg(SOperatorInfo* pOperator) { } deleteIntervalDiscBuf(pInfo->pState, NULL, pInfo->twAggSup.maxTs - pInfo->twAggSup.deleteMark, &pInfo->interval, &pInfo->delKey); - doSetOperatorCompleted(pOperator); + setOperatorCompleted(pOperator); streamStateCommit(pTaskInfo->streamInfo.pState); return NULL; } @@ -5550,13 +5535,10 @@ SOperatorInfo* createStreamIntervalOperatorInfo(SOperatorInfo* downstream, SPhys pInfo->pGroupIdTbNameMap = taosHashInit(1024, taosGetDefaultHashFunction(TSDB_DATA_TYPE_UBIGINT), false, HASH_NO_LOCK); - pOperator->name = "StreamIntervalOperator"; - pOperator->operatorType = QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERVAL; - pOperator->blocking = true; - pOperator->status = OP_NOT_OPENED; - pOperator->info = pInfo; - pOperator->fpSet = createOperatorFpSet(operatorDummyOpenFn, doStreamIntervalAgg, NULL, NULL, - destroyStreamFinalIntervalOperatorInfo, NULL); + setOperatorInfo(pOperator, "StreamIntervalOperator", QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERVAL, true, OP_NOT_OPENED, + pInfo, pTaskInfo); + pOperator->fpSet = + createOperatorFpSet(operatorDummyOpenFn, doStreamIntervalAgg, NULL, destroyStreamFinalIntervalOperatorInfo, NULL); initIntervalDownStream(downstream, pPhyNode->type, &pInfo->aggSup, &pInfo->interval, &pInfo->twAggSup); code = appendDownstream(pOperator, &downstream, 1); diff --git a/source/libs/function/src/builtinsimpl.c b/source/libs/function/src/builtinsimpl.c index 6eb57c1a18..079e553b07 100644 --- a/source/libs/function/src/builtinsimpl.c +++ b/source/libs/function/src/builtinsimpl.c @@ -3096,27 +3096,86 @@ int32_t lastFunction(SqlFunctionCtx* pCtx) { } #else int64_t* pts = (int64_t*)pInput->pPTS->pData; - for (int32_t i = pInput->startRowIndex; i < pInput->numOfRows + pInput->startRowIndex; ++i) { - if (pInputCol->hasNull && colDataIsNull(pInputCol, pInput->totalRows, i, pColAgg)) { - continue; - } - numOfElems++; +#if 0 + for (int32_t i = pInput->startRowIndex; i < pInput->numOfRows + pInput->startRowIndex; ++i) { + if (pInputCol->hasNull && colDataIsNull(pInputCol, pInput->totalRows, i, pColAgg)) { + continue; + } - char* data = colDataGetData(pInputCol, i); - TSKEY cts = pts[i]; - if (pResInfo->numOfRes == 0 || pInfo->ts < cts) { - doSaveCurrentVal(pCtx, i, cts, type, data); - pResInfo->numOfRes = 1; + numOfElems++; + if (pResInfo->numOfRes == 0 || pInfo->ts < pts[i]) { + char* data = colDataGetData(pInputCol, i); + doSaveCurrentVal(pCtx, i, pts[i], type, data); + pResInfo->numOfRes = 1; + } } - } +#else + if (!pInputCol->hasNull) { + numOfElems = 1; + + int32_t round = pInput->numOfRows >> 2; + int32_t reminder = pInput->numOfRows & 0x03; + + int32_t tick = 0; + for (int32_t i = pInput->startRowIndex; tick < round; i += 4, tick += 1) { + int64_t cts = pts[i]; + int32_t chosen = i; + + if (cts < pts[i + 1]) { + cts = pts[i + 1]; + chosen = i + 1; + } + + if (cts < pts[i + 2]) { + cts = pts[i + 2]; + chosen = i + 2; + } + + if (cts < pts[i + 3]) { + cts = pts[i + 3]; + chosen = i + 3; + } + + if (pResInfo->numOfRes == 0 || pInfo->ts < cts) { + char* data = colDataGetData(pInputCol, chosen); + doSaveCurrentVal(pCtx, i, cts, type, data); + pResInfo->numOfRes = 1; + } + } + + for (int32_t i = pInput->startRowIndex + round * 4; i < pInput->startRowIndex + pInput->numOfRows; ++i) { + if (pResInfo->numOfRes == 0 || pInfo->ts < pts[i]) { + char* data = colDataGetData(pInputCol, i); + doSaveCurrentVal(pCtx, i, pts[i], type, data); + pResInfo->numOfRes = 1; + } + } + } else { + for (int32_t i = pInput->startRowIndex; i < pInput->startRowIndex + pInput->numOfRows; ++i) { + if (pInputCol->hasNull && colDataIsNull(pInputCol, pInput->totalRows, i, pColAgg)) { + continue; + } + + numOfElems++; + + if (pResInfo->numOfRes == 0 || pInfo->ts < pts[i]) { + char* data = colDataGetData(pInputCol, i); + doSaveCurrentVal(pCtx, i, pts[i], type, data); + pResInfo->numOfRes = 1; + } + } + } +#endif + #endif // save selectivity value for column consisted of all null values if (numOfElems == 0) { firstlastSaveTupleData(pCtx->pSrcBlock, pInput->startRowIndex, pCtx, pInfo); } - SET_VAL(pResInfo, numOfElems, 1); + +// SET_VAL(pResInfo, numOfElems, 1); return TSDB_CODE_SUCCESS; } @@ -3266,8 +3325,8 @@ int32_t lastRowFunction(SqlFunctionCtx* pCtx) { #if 0 int32_t blockDataOrder = (startKey <= endKey) ? TSDB_ORDER_ASC : TSDB_ORDER_DESC; - // the optimized version only function if all tuples in one block are monotonious increasing or descreasing. - // this is NOT always works if project operator exists in downstream. + // the optimized version only valid if all tuples in one block are monotonious increasing or descreasing. + // this assumption is NOT always works if project operator exists in downstream. if (blockDataOrder == TSDB_ORDER_ASC) { for (int32_t i = pInput->numOfRows + pInput->startRowIndex - 1; i >= pInput->startRowIndex; --i) { char* data = colDataGetData(pInputCol, i); diff --git a/source/libs/function/src/tudf.c b/source/libs/function/src/tudf.c index 1dedfe8364..8715aa0be1 100644 --- a/source/libs/function/src/tudf.c +++ b/source/libs/function/src/tudf.c @@ -131,7 +131,8 @@ static int32_t udfSpawnUdfd(SUdfdData *pData) { char udfdPathLdLib[1024] = {0}; size_t udfdLdLibPathLen = strlen(tsUdfdLdLibPath); - strncpy(udfdPathLdLib, tsUdfdLdLibPath, udfdLdLibPathLen); + strncpy(udfdPathLdLib, tsUdfdLdLibPath, tListLen(udfdPathLdLib)); + udfdPathLdLib[udfdLdLibPathLen] = ':'; strncpy(udfdPathLdLib + udfdLdLibPathLen + 1, pathTaosdLdLib, sizeof(udfdPathLdLib) - udfdLdLibPathLen - 1); if (udfdLdLibPathLen + taosdLdLibPathLen < 1024) { diff --git a/source/libs/nodes/src/nodesUtilFuncs.c b/source/libs/nodes/src/nodesUtilFuncs.c index c5b2dfed66..39d17153d0 100644 --- a/source/libs/nodes/src/nodesUtilFuncs.c +++ b/source/libs/nodes/src/nodesUtilFuncs.c @@ -424,8 +424,9 @@ SNode* nodesMakeNode(ENodeType type) { case QUERY_NODE_SHOW_TRANSACTIONS_STMT: case QUERY_NODE_SHOW_SUBSCRIPTIONS_STMT: case QUERY_NODE_SHOW_TAGS_STMT: - case QUERY_NODE_SHOW_TABLE_TAGS_STMT: return makeNode(type, sizeof(SShowStmt)); + case QUERY_NODE_SHOW_TABLE_TAGS_STMT: + return makeNode(type, sizeof(SShowTableTagsStmt)); case QUERY_NODE_SHOW_DNODE_VARIABLES_STMT: return makeNode(type, sizeof(SShowDnodeVariablesStmt)); case QUERY_NODE_SHOW_CREATE_DATABASE_STMT: @@ -942,13 +943,19 @@ void nodesDestroyNode(SNode* pNode) { case QUERY_NODE_SHOW_LOCAL_VARIABLES_STMT: case QUERY_NODE_SHOW_TRANSACTIONS_STMT: case QUERY_NODE_SHOW_SUBSCRIPTIONS_STMT: - case QUERY_NODE_SHOW_TAGS_STMT: - case QUERY_NODE_SHOW_TABLE_TAGS_STMT: { + case QUERY_NODE_SHOW_TAGS_STMT: { SShowStmt* pStmt = (SShowStmt*)pNode; nodesDestroyNode(pStmt->pDbName); nodesDestroyNode(pStmt->pTbName); break; } + case QUERY_NODE_SHOW_TABLE_TAGS_STMT: { + SShowTableTagsStmt* pStmt = (SShowTableTagsStmt*)pNode; + nodesDestroyNode(pStmt->pDbName); + nodesDestroyNode(pStmt->pTbName); + nodesDestroyList(pStmt->pTags); + break; + } case QUERY_NODE_SHOW_DNODE_VARIABLES_STMT: nodesDestroyNode(((SShowDnodeVariablesStmt*)pNode)->pDnodeId); nodesDestroyNode(((SShowDnodeVariablesStmt*)pNode)->pLikePattern); diff --git a/source/libs/parser/inc/parAst.h b/source/libs/parser/inc/parAst.h index 86940a9d7a..a6c56f3ae4 100644 --- a/source/libs/parser/inc/parAst.h +++ b/source/libs/parser/inc/parAst.h @@ -178,6 +178,7 @@ SNode* createShowCreateTableStmt(SAstCreateContext* pCxt, ENodeType type, SNode* SNode* createShowTableDistributedStmt(SAstCreateContext* pCxt, SNode* pRealTable); SNode* createShowDnodeVariablesStmt(SAstCreateContext* pCxt, SNode* pDnodeId, SNode* pLikePattern); SNode* createShowVnodesStmt(SAstCreateContext* pCxt, SNode* pDnodeId, SNode* pDnodeEndpoint); +SNode* createShowTableTagsStmt(SAstCreateContext* pCxt, SNode* pTbName, SNode* pDbName, SNodeList* pTags); SNode* createCreateUserStmt(SAstCreateContext* pCxt, SToken* pUserName, const SToken* pPassword, int8_t sysinfo); SNode* createAlterUserStmt(SAstCreateContext* pCxt, SToken* pUserName, int8_t alterType, const SToken* pVal); SNode* createDropUserStmt(SAstCreateContext* pCxt, SToken* pUserName); diff --git a/source/libs/parser/inc/parUtil.h b/source/libs/parser/inc/parUtil.h index 10a86866d5..c53d3f9320 100644 --- a/source/libs/parser/inc/parUtil.h +++ b/source/libs/parser/inc/parUtil.h @@ -108,7 +108,7 @@ int32_t getTableMetaFromCache(SParseMetaCache* pMetaCache, const SName* pName, S int32_t getDbVgInfoFromCache(SParseMetaCache* pMetaCache, const char* pDbFName, SArray** pVgInfo); int32_t getTableVgroupFromCache(SParseMetaCache* pMetaCache, const SName* pName, SVgroupInfo* pVgroup); int32_t getDbVgVersionFromCache(SParseMetaCache* pMetaCache, const char* pDbFName, int32_t* pVersion, int64_t* pDbId, - int32_t* pTableNum); + int32_t* pTableNum, int64_t* pStateTs); int32_t getDbCfgFromCache(SParseMetaCache* pMetaCache, const char* pDbFName, SDbCfgInfo* pInfo); int32_t getUserAuthFromCache(SParseMetaCache* pMetaCache, const char* pUser, const char* pDbFName, AUTH_TYPE type, bool* pPass); diff --git a/source/libs/parser/inc/sql.y b/source/libs/parser/inc/sql.y index b143f1624e..ec5bb765db 100644 --- a/source/libs/parser/inc/sql.y +++ b/source/libs/parser/inc/sql.y @@ -426,7 +426,7 @@ cmd ::= SHOW TABLE DISTRIBUTED full_table_name(A). cmd ::= SHOW CONSUMERS. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONSUMERS_STMT); } cmd ::= SHOW SUBSCRIPTIONS. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SUBSCRIPTIONS_STMT); } cmd ::= SHOW TAGS FROM table_name_cond(A) from_db_opt(B). { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, B, A, OP_TYPE_EQUAL); } -cmd ::= SHOW TABLE TAGS FROM table_name_cond(A) from_db_opt(B). { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TABLE_TAGS_STMT, B, A, OP_TYPE_EQUAL); } +cmd ::= SHOW TABLE TAGS tag_list_opt(C) FROM table_name_cond(A) from_db_opt(B). { pCxt->pRootNode = createShowTableTagsStmt(pCxt, A, B, C); } cmd ::= SHOW VNODES NK_INTEGER(A). { pCxt->pRootNode = createShowVnodesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &A), NULL); } cmd ::= SHOW VNODES NK_STRING(A). { pCxt->pRootNode = createShowVnodesStmt(pCxt, NULL, createValueNode(pCxt, TSDB_DATA_TYPE_VARCHAR, &A)); } @@ -441,6 +441,18 @@ table_name_cond(A) ::= table_name(B). from_db_opt(A) ::= . { A = createDefaultDatabaseCondValue(pCxt); } from_db_opt(A) ::= FROM db_name(B). { A = createIdentifierValueNode(pCxt, &B); } +%type tag_list_opt { SNodeList* } +%destructor tag_list_opt { nodesDestroyList($$); } +tag_list_opt(A) ::= . { A = NULL; } +tag_list_opt(A) ::= tag_item(B). { A = createNodeList(pCxt, B); } +tag_list_opt(A) ::= tag_list_opt(B) NK_COMMA tag_item(C). { A = addNodeToList(pCxt, B, C); } + +tag_item(A) ::= TBNAME(B). { A = setProjectionAlias(pCxt, createFunctionNode(pCxt, &B, NULL), &B); } +tag_item(A) ::= QTAGS(B). { A = createFunctionNode(pCxt, &B, NULL); } +tag_item(A) ::= column_name(B). { A = createColumnNode(pCxt, NULL, &B); } +tag_item(A) ::= column_name(B) column_alias(C). { A = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &B), &C); } +tag_item(A) ::= column_name(B) AS column_alias(C). { A = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &B), &C); } + /************************************************ create index ********************************************************/ cmd ::= CREATE SMA INDEX not_exists_opt(D) full_table_name(A) ON full_table_name(B) index_options(C). { pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, D, A, B, NULL, C); } diff --git a/source/libs/parser/src/parAstCreater.c b/source/libs/parser/src/parAstCreater.c index 49685112a9..1db52c123c 100644 --- a/source/libs/parser/src/parAstCreater.c +++ b/source/libs/parser/src/parAstCreater.c @@ -1390,6 +1390,21 @@ SNode* createShowVnodesStmt(SAstCreateContext* pCxt, SNode* pDnodeId, SNode* pDn return (SNode*)pStmt; } +SNode* createShowTableTagsStmt(SAstCreateContext* pCxt, SNode* pTbName, SNode* pDbName, SNodeList* pTags) { + CHECK_PARSER_STATUS(pCxt); + if (NULL == pDbName) { + snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen, "database not specified"); + pCxt->errCode = TSDB_CODE_PAR_SYNTAX_ERROR; + return NULL; + } + SShowTableTagsStmt* pStmt = (SShowTableTagsStmt*)nodesMakeNode(QUERY_NODE_SHOW_TABLE_TAGS_STMT); + CHECK_OUT_OF_MEM(pStmt); + pStmt->pDbName = pDbName; + pStmt->pTbName = pTbName; + pStmt->pTags = pTags; + return (SNode*)pStmt; +} + SNode* createCreateUserStmt(SAstCreateContext* pCxt, SToken* pUserName, const SToken* pPassword, int8_t sysinfo) { CHECK_PARSER_STATUS(pCxt); char password[TSDB_USET_PASSWORD_LEN] = {0}; diff --git a/source/libs/parser/src/parAstParser.c b/source/libs/parser/src/parAstParser.c index bb3d1a2cb3..5aa87d780d 100644 --- a/source/libs/parser/src/parAstParser.c +++ b/source/libs/parser/src/parAstParser.c @@ -440,7 +440,7 @@ static int32_t collectMetaKeyFromShowTags(SCollectMetaKeyCxt* pCxt, SShowStmt* p return code; } -static int32_t collectMetaKeyFromShowStableTags(SCollectMetaKeyCxt* pCxt, SShowStmt* pStmt) { +static int32_t collectMetaKeyFromShowStableTags(SCollectMetaKeyCxt* pCxt, SShowTableTagsStmt* pStmt) { return collectMetaKeyFromRealTableImpl(pCxt, ((SValueNode*)pStmt->pDbName)->literal, ((SValueNode*)pStmt->pTbName)->literal, AUTH_TYPE_READ); } @@ -627,7 +627,7 @@ static int32_t collectMetaKeyFromQuery(SCollectMetaKeyCxt* pCxt, SNode* pStmt) { case QUERY_NODE_SHOW_TAGS_STMT: return collectMetaKeyFromShowTags(pCxt, (SShowStmt*)pStmt); case QUERY_NODE_SHOW_TABLE_TAGS_STMT: - return collectMetaKeyFromShowStableTags(pCxt, (SShowStmt*)pStmt); + return collectMetaKeyFromShowStableTags(pCxt, (SShowTableTagsStmt*)pStmt); case QUERY_NODE_SHOW_USERS_STMT: return collectMetaKeyFromShowUsers(pCxt, (SShowStmt*)pStmt); case QUERY_NODE_SHOW_LICENCES_STMT: diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index dea3b959ed..7897623ab1 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -466,14 +466,14 @@ static int32_t getTableHashVgroup(STranslateContext* pCxt, const char* pDbName, } static int32_t getDBVgVersion(STranslateContext* pCxt, const char* pDbFName, int32_t* pVersion, int64_t* pDbId, - int32_t* pTableNum) { + int32_t* pTableNum, int64_t* pStateTs) { SParseContext* pParCxt = pCxt->pParseCxt; int32_t code = collectUseDatabaseImpl(pDbFName, pCxt->pDbs); if (TSDB_CODE_SUCCESS == code) { if (pParCxt->async) { - code = getDbVgVersionFromCache(pCxt->pMetaCache, pDbFName, pVersion, pDbId, pTableNum); + code = getDbVgVersionFromCache(pCxt->pMetaCache, pDbFName, pVersion, pDbId, pTableNum, pStateTs); } else { - code = catalogGetDBVgVersion(pParCxt->pCatalog, pDbFName, pVersion, pDbId, pTableNum); + code = catalogGetDBVgVersion(pParCxt->pCatalog, pDbFName, pVersion, pDbId, pTableNum, pStateTs); } } if (TSDB_CODE_SUCCESS != code) { @@ -1252,6 +1252,19 @@ static bool dataTypeEqual(const SDataType* l, const SDataType* r) { return (l->type == r->type && l->bytes == r->bytes && l->precision == r->precision && l->scale == r->scale); } +// 0 means equal, 1 means the left shall prevail, -1 means the right shall prevail +static int32_t dataTypeComp(const SDataType* l, const SDataType* r) { + if (l->type != r->type) { + return 1; + } + + if (l->bytes != r->bytes) { + return l->bytes > r->bytes ? 1 : -1; + } + + return (l->precision == r->precision && l->scale == r->scale) ? 0 : 1; +} + static EDealRes translateOperator(STranslateContext* pCxt, SOperatorNode* pOp) { if (isMultiResFunc(pOp->pLeft)) { return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_WRONG_VALUE_TYPE, ((SExprNode*)(pOp->pLeft))->aliasName); @@ -1876,10 +1889,15 @@ static EDealRes translateCaseWhen(STranslateContext* pCxt, SCaseWhenNode* pCaseW } pWhenThen->pWhen = pIsTrue; } - if (first) { - first = false; + if (first || dataTypeComp(&pCaseWhen->node.resType, &((SExprNode*)pNode)->resType) < 0) { pCaseWhen->node.resType = ((SExprNode*)pNode)->resType; - } else if (!dataTypeEqual(&pCaseWhen->node.resType, &((SExprNode*)pNode)->resType)) { + } + first = false; + } + + FOREACH(pNode, pCaseWhen->pWhenThenList) { + SWhenThenNode* pWhenThen = (SWhenThenNode*)pNode; + if (!dataTypeEqual(&pCaseWhen->node.resType, &((SExprNode*)pNode)->resType)) { SNode* pCastFunc = NULL; pCxt->errCode = createCastFunc(pCxt, pWhenThen->pThen, pCaseWhen->node.resType, &pCastFunc); if (TSDB_CODE_SUCCESS != pCxt->errCode) { @@ -1889,6 +1907,7 @@ static EDealRes translateCaseWhen(STranslateContext* pCxt, SCaseWhenNode* pCaseW pWhenThen->node.resType = pCaseWhen->node.resType; } } + if (NULL != pCaseWhen->pElse && !dataTypeEqual(&pCaseWhen->node.resType, &((SExprNode*)pCaseWhen->pElse)->resType)) { SNode* pCastFunc = NULL; pCxt->errCode = createCastFunc(pCxt, pCaseWhen->pElse, pCaseWhen->node.resType, &pCastFunc); @@ -2393,6 +2412,9 @@ static int32_t translateTable(STranslateContext* pCxt, SNode* pTable) { if (TSDB_SUPER_TABLE == pRealTable->pMeta->tableType) { pCxt->stableQuery = true; } + if (TSDB_SYSTEM_TABLE == pRealTable->pMeta->tableType && isSelectStmt(pCxt->pCurrStmt)) { + ((SSelectStmt*)pCxt->pCurrStmt)->isTimeLineResult = false; + } code = addNamespace(pCxt, pRealTable); } break; @@ -3440,7 +3462,8 @@ static int32_t translateSetOperProject(STranslateContext* pCxt, SSetOperator* pS FORBOTH(pLeft, pLeftProjections, pRight, pRightProjections) { SExprNode* pLeftExpr = (SExprNode*)pLeft; SExprNode* pRightExpr = (SExprNode*)pRight; - if (!dataTypeEqual(&pLeftExpr->resType, &pRightExpr->resType)) { + int32_t comp = dataTypeComp(&pLeftExpr->resType, &pRightExpr->resType); + if (comp > 0) { SNode* pRightFunc = NULL; int32_t code = createCastFunc(pCxt, pRight, pLeftExpr->resType, &pRightFunc); if (TSDB_CODE_SUCCESS != code) { @@ -3448,9 +3471,20 @@ static int32_t translateSetOperProject(STranslateContext* pCxt, SSetOperator* pS } REPLACE_LIST2_NODE(pRightFunc); pRightExpr = (SExprNode*)pRightFunc; + } else if (comp < 0) { + SNode* pLeftFunc = NULL; + int32_t code = createCastFunc(pCxt, pLeft, pRightExpr->resType, &pLeftFunc); + if (TSDB_CODE_SUCCESS != code) { + return code; + } + REPLACE_LIST1_NODE(pLeftFunc); + SExprNode* pLeftFuncExpr = (SExprNode*)pLeftFunc; + snprintf(pLeftFuncExpr->aliasName, sizeof(pLeftFuncExpr->aliasName), "%s", pLeftExpr->aliasName); + snprintf(pLeftFuncExpr->userAlias, sizeof(pLeftFuncExpr->userAlias), "%s", pLeftExpr->userAlias); + pLeft = pLeftFunc; + pLeftExpr = pLeftFuncExpr; } - strcpy(pRightExpr->aliasName, pLeftExpr->aliasName); - pRightExpr->aliasName[strlen(pLeftExpr->aliasName)] = '\0'; + snprintf(pRightExpr->aliasName, sizeof(pRightExpr->aliasName), "%s", pLeftExpr->aliasName); if (TSDB_CODE_SUCCESS != nodesListMakeStrictAppend(&pSetOperator->pProjectionList, createSetOperProject(pSetOperator->stmtName, pLeft))) { return TSDB_CODE_OUT_OF_MEMORY; @@ -4941,7 +4975,8 @@ static int32_t translateUseDatabase(STranslateContext* pCxt, SUseDatabaseStmt* p SName name = {0}; tNameSetDbName(&name, pCxt->pParseCxt->acctId, pStmt->dbName, strlen(pStmt->dbName)); tNameExtractFullName(&name, usedbReq.db); - int32_t code = getDBVgVersion(pCxt, usedbReq.db, &usedbReq.vgVersion, &usedbReq.dbId, &usedbReq.numOfTable); + int32_t code = + getDBVgVersion(pCxt, usedbReq.db, &usedbReq.vgVersion, &usedbReq.dbId, &usedbReq.numOfTable, &usedbReq.stateTs); if (TSDB_CODE_SUCCESS == code) { code = buildCmdMsg(pCxt, TDMT_MND_USE_DB, (FSerializeFunc)tSerializeSUseDbReq, &usedbReq); } @@ -6253,21 +6288,29 @@ static SNode* createTagsFunction() { return (SNode*)pFunc; } +static int32_t createShowTableTagsProjections(SNodeList** pProjections, SNodeList** pTags) { + if (NULL != *pTags) { + TSWAP(*pProjections, *pTags); + return TSDB_CODE_SUCCESS; + } + int32_t code = nodesListMakeStrictAppend(pProjections, createTbnameFunction()); + if (TSDB_CODE_SUCCESS == code) { + code = nodesListStrictAppend(*pProjections, createTagsFunction()); + } + return code; +} + static int32_t rewriteShowStableTags(STranslateContext* pCxt, SQuery* pQuery) { - const char* cols[] = {"tbname", "_tags"}; - SShowStmt* pShow = (SShowStmt*)pQuery->pRoot; - SSelectStmt* pSelect = NULL; + SShowTableTagsStmt* pShow = (SShowTableTagsStmt*)pQuery->pRoot; + SSelectStmt* pSelect = NULL; int32_t code = createSimpleSelectStmt(((SValueNode*)pShow->pDbName)->literal, ((SValueNode*)pShow->pTbName)->literal, -1, NULL, &pSelect); if (TSDB_CODE_SUCCESS == code) { - code = nodesListMakeStrictAppend(&pSelect->pProjectionList, createTbnameFunction()); + code = createShowTableTagsProjections(&pSelect->pProjectionList, &pShow->pTags); } if (TSDB_CODE_SUCCESS == code) { - code = nodesListMakeStrictAppend(&pSelect->pProjectionList, createTagsFunction()); - } - if (TSDB_CODE_SUCCESS == code) { - pSelect->isDistinct = true; pQuery->showRewrite = true; + pSelect->tagScan = true; nodesDestroyNode(pQuery->pRoot); pQuery->pRoot = (SNode*)pSelect; } else { diff --git a/source/libs/parser/src/parUtil.c b/source/libs/parser/src/parUtil.c index 466c6edd24..00a72a1946 100644 --- a/source/libs/parser/src/parUtil.c +++ b/source/libs/parser/src/parUtil.c @@ -876,13 +876,14 @@ int32_t reserveDbVgVersionInCache(int32_t acctId, const char* pDb, SParseMetaCac } int32_t getDbVgVersionFromCache(SParseMetaCache* pMetaCache, const char* pDbFName, int32_t* pVersion, int64_t* pDbId, - int32_t* pTableNum) { + int32_t* pTableNum, int64_t* pStateTs) { SDbInfo* pDbInfo = NULL; int32_t code = getMetaDataFromHash(pDbFName, strlen(pDbFName), pMetaCache->pDbInfo, (void**)&pDbInfo); if (TSDB_CODE_SUCCESS == code) { *pVersion = pDbInfo->vgVer; *pDbId = pDbInfo->dbId; *pTableNum = pDbInfo->tbNum; + *pStateTs = pDbInfo->stateTs; } return code; } diff --git a/source/libs/parser/src/sql.c b/source/libs/parser/src/sql.c index 292060515c..a8044fa848 100644 --- a/source/libs/parser/src/sql.c +++ b/source/libs/parser/src/sql.c @@ -104,26 +104,26 @@ #endif /************* Begin control #defines *****************************************/ #define YYCODETYPE unsigned short int -#define YYNOCODE 452 +#define YYNOCODE 454 #define YYACTIONTYPE unsigned short int #define ParseTOKENTYPE SToken typedef union { int yyinit; ParseTOKENTYPE yy0; - EOperatorType yy4; - int64_t yy37; - SAlterOption yy101; - SNode* yy232; - SDataType yy264; - SNodeList* yy288; - SToken yy481; - int8_t yy607; - EFillMode yy614; - int32_t yy692; - EJoinType yy700; - bool yy777; - ENullOrder yy833; - EOrder yy866; + ENullOrder yy153; + SNode* yy164; + bool yy193; + SAlterOption yy213; + EOrder yy238; + int32_t yy512; + int64_t yy577; + SToken yy593; + EFillMode yy638; + SNodeList* yy648; + EOperatorType yy656; + int8_t yy687; + SDataType yy720; + EJoinType yy868; } YYMINORTYPE; #ifndef YYSTACKDEPTH #define YYSTACKDEPTH 100 @@ -139,17 +139,17 @@ typedef union { #define ParseCTX_FETCH #define ParseCTX_STORE #define YYFALLBACK 1 -#define YYNSTATE 701 -#define YYNRULE 528 +#define YYNSTATE 705 +#define YYNRULE 536 #define YYNTOKEN 319 -#define YY_MAX_SHIFT 700 -#define YY_MIN_SHIFTREDUCE 1036 -#define YY_MAX_SHIFTREDUCE 1563 -#define YY_ERROR_ACTION 1564 -#define YY_ACCEPT_ACTION 1565 -#define YY_NO_ACTION 1566 -#define YY_MIN_REDUCE 1567 -#define YY_MAX_REDUCE 2094 +#define YY_MAX_SHIFT 704 +#define YY_MIN_SHIFTREDUCE 1046 +#define YY_MAX_SHIFTREDUCE 1581 +#define YY_ERROR_ACTION 1582 +#define YY_ACCEPT_ACTION 1583 +#define YY_NO_ACTION 1584 +#define YY_MIN_REDUCE 1585 +#define YY_MAX_REDUCE 2120 /************* End control #defines *******************************************/ #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0]))) @@ -216,861 +216,821 @@ typedef union { ** yy_default[] Default action for each state. ** *********** Begin parsing tables **********************************************/ -#define YY_ACTTAB_COUNT (3333) +#define YY_ACTTAB_COUNT (3135) static const YYACTIONTYPE yy_action[] = { - /* 0 */ 450, 167, 451, 1602, 77, 458, 1711, 451, 1602, 538, - /* 10 */ 1824, 552, 44, 42, 1759, 339, 338, 1892, 1069, 1821, - /* 20 */ 353, 1568, 1344, 154, 120, 552, 1896, 1716, 593, 1897, - /* 30 */ 1910, 488, 1722, 1424, 156, 1342, 593, 1892, 52, 1673, - /* 40 */ 1892, 1720, 110, 1888, 1894, 109, 108, 107, 106, 105, - /* 50 */ 104, 103, 102, 101, 590, 1720, 600, 1419, 1073, 1074, - /* 60 */ 1928, 1370, 17, 1888, 1894, 341, 1888, 1894, 607, 1350, - /* 70 */ 44, 42, 1494, 1878, 449, 606, 600, 453, 353, 600, - /* 80 */ 1344, 467, 37, 36, 132, 1772, 43, 41, 40, 39, - /* 90 */ 38, 1424, 1910, 1342, 1372, 1, 608, 157, 552, 1579, - /* 100 */ 1944, 1771, 1896, 46, 98, 352, 1911, 610, 1913, 1914, - /* 110 */ 605, 176, 600, 1892, 58, 1419, 552, 697, 1910, 1997, - /* 120 */ 17, 130, 1928, 317, 1993, 398, 1698, 1350, 1720, 120, - /* 130 */ 607, 1426, 1427, 635, 2065, 1878, 493, 606, 47, 1888, - /* 140 */ 1894, 347, 592, 169, 2005, 2006, 1720, 2010, 1928, 577, - /* 150 */ 171, 455, 600, 1, 2066, 579, 607, 1367, 1908, 77, - /* 160 */ 1590, 1878, 1944, 606, 313, 329, 97, 1909, 1911, 610, - /* 170 */ 1913, 1914, 605, 125, 600, 697, 1345, 129, 1343, 141, - /* 180 */ 1968, 1997, 1715, 1928, 1908, 346, 1993, 467, 1944, 1426, - /* 190 */ 1427, 572, 159, 1909, 1911, 610, 1913, 1914, 605, 435, - /* 200 */ 600, 1348, 1349, 1878, 1399, 1400, 1402, 1403, 1404, 1405, - /* 210 */ 1406, 1407, 1408, 1409, 602, 598, 1417, 1418, 1420, 1421, - /* 220 */ 1422, 1423, 1425, 1428, 3, 1565, 330, 1369, 328, 327, - /* 230 */ 571, 490, 222, 573, 1345, 492, 1343, 246, 457, 236, - /* 240 */ 237, 453, 174, 110, 580, 2086, 109, 108, 107, 106, - /* 250 */ 105, 104, 103, 102, 101, 186, 185, 491, 182, 1348, - /* 260 */ 1349, 174, 1399, 1400, 1402, 1403, 1404, 1405, 1406, 1407, - /* 270 */ 1408, 1409, 602, 598, 1417, 1418, 1420, 1421, 1422, 1423, - /* 280 */ 1425, 1428, 3, 44, 42, 174, 368, 1371, 79, 315, - /* 290 */ 643, 353, 542, 1344, 540, 74, 1696, 315, 73, 593, - /* 300 */ 542, 1910, 540, 534, 1424, 2070, 1342, 1195, 632, 631, - /* 310 */ 630, 1199, 629, 1201, 1202, 628, 1204, 625, 230, 1210, - /* 320 */ 622, 1212, 1213, 619, 616, 11, 358, 9, 1419, 1765, - /* 330 */ 1767, 1928, 2065, 17, 2065, 2012, 62, 1498, 87, 607, - /* 340 */ 1350, 44, 42, 1369, 1878, 1865, 606, 2071, 171, 353, - /* 350 */ 2069, 1344, 2066, 579, 2066, 2068, 58, 643, 81, 700, - /* 360 */ 1713, 58, 1424, 2009, 1342, 1520, 1, 608, 387, 7, - /* 370 */ 1086, 1944, 1085, 277, 46, 297, 352, 1911, 610, 1913, - /* 380 */ 1914, 605, 1567, 600, 1368, 207, 1419, 165, 697, 389, - /* 390 */ 385, 17, 375, 690, 686, 682, 678, 275, 1350, 1491, - /* 400 */ 1087, 1155, 1426, 1427, 11, 2065, 119, 118, 117, 116, - /* 410 */ 115, 114, 113, 112, 111, 565, 1518, 1519, 1521, 1522, - /* 420 */ 577, 171, 1772, 1350, 1, 2066, 579, 58, 1589, 322, - /* 430 */ 269, 504, 503, 502, 95, 1157, 1434, 243, 1770, 126, - /* 440 */ 498, 391, 1369, 390, 497, 496, 697, 1345, 655, 1343, - /* 450 */ 495, 501, 392, 1697, 1369, 1370, 494, 1814, 37, 36, - /* 460 */ 1426, 1427, 43, 41, 40, 39, 38, 578, 179, 534, - /* 470 */ 549, 1878, 1348, 1349, 1709, 1399, 1400, 1402, 1403, 1404, - /* 480 */ 1405, 1406, 1407, 1408, 1409, 602, 598, 1417, 1418, 1420, - /* 490 */ 1421, 1422, 1423, 1425, 1428, 3, 2065, 11, 2065, 1772, - /* 500 */ 34, 270, 232, 174, 1705, 1345, 340, 1343, 174, 1707, - /* 510 */ 94, 577, 171, 2071, 171, 1770, 2066, 579, 2066, 579, - /* 520 */ 1315, 174, 225, 229, 127, 1766, 1767, 1910, 1401, 58, - /* 530 */ 1348, 1349, 1712, 1399, 1400, 1402, 1403, 1404, 1405, 1406, - /* 540 */ 1407, 1408, 1409, 602, 598, 1417, 1418, 1420, 1421, 1422, - /* 550 */ 1423, 1425, 1428, 3, 44, 42, 2070, 1928, 500, 499, - /* 560 */ 641, 356, 353, 80, 1344, 607, 1237, 1238, 568, 154, - /* 570 */ 1878, 1487, 606, 1371, 174, 1424, 1814, 1342, 1722, 145, - /* 580 */ 144, 638, 637, 636, 37, 36, 1910, 180, 43, 41, - /* 590 */ 40, 39, 38, 1908, 554, 552, 1969, 1944, 1086, 1419, - /* 600 */ 1085, 158, 1909, 1911, 610, 1913, 1914, 605, 396, 600, - /* 610 */ 1772, 1350, 44, 42, 1429, 1455, 1928, 357, 1560, 518, - /* 620 */ 353, 336, 1344, 552, 607, 1720, 1770, 1401, 1087, 1878, - /* 630 */ 1703, 606, 516, 1424, 514, 1342, 397, 8, 1490, 235, - /* 640 */ 37, 36, 557, 2034, 43, 41, 40, 39, 38, 1553, - /* 650 */ 359, 226, 1908, 1720, 574, 569, 1944, 1419, 154, 697, - /* 660 */ 304, 1909, 1911, 610, 1913, 1914, 605, 1722, 600, 1350, - /* 670 */ 349, 348, 1530, 1426, 1427, 1344, 174, 37, 36, 552, - /* 680 */ 1358, 43, 41, 40, 39, 38, 31, 223, 1342, 552, - /* 690 */ 1750, 1424, 407, 1351, 30, 8, 1460, 2012, 1321, 1322, - /* 700 */ 37, 36, 421, 538, 43, 41, 40, 39, 38, 1720, - /* 710 */ 2012, 552, 26, 1822, 1559, 1419, 269, 697, 1345, 1720, - /* 720 */ 1343, 2069, 1350, 32, 422, 2008, 399, 1350, 1510, 37, - /* 730 */ 36, 1426, 1427, 43, 41, 40, 39, 38, 2007, 400, - /* 740 */ 2070, 1720, 128, 1348, 1349, 1968, 1399, 1400, 1402, 1403, - /* 750 */ 1404, 1405, 1406, 1407, 1408, 1409, 602, 598, 1417, 1418, - /* 760 */ 1420, 1421, 1422, 1423, 1425, 1428, 3, 13, 12, 2065, - /* 770 */ 697, 40, 39, 38, 601, 596, 1345, 641, 1343, 43, - /* 780 */ 41, 40, 39, 38, 174, 2069, 634, 37, 36, 2066, - /* 790 */ 2067, 43, 41, 40, 39, 38, 145, 144, 638, 637, - /* 800 */ 636, 1348, 1349, 143, 1399, 1400, 1402, 1403, 1404, 1405, - /* 810 */ 1406, 1407, 1408, 1409, 602, 598, 1417, 1418, 1420, 1421, - /* 820 */ 1422, 1423, 1425, 1428, 3, 44, 42, 492, 552, 1345, - /* 830 */ 1820, 1343, 308, 353, 1359, 1344, 1354, 585, 556, 552, - /* 840 */ 1969, 465, 668, 666, 529, 1588, 1424, 1587, 1342, 491, - /* 850 */ 552, 537, 466, 1814, 1348, 1349, 51, 1910, 1720, 1362, - /* 860 */ 1364, 1369, 1467, 1717, 184, 1073, 1074, 1586, 534, 1720, - /* 870 */ 1419, 1585, 1674, 598, 1417, 1418, 1420, 1421, 1422, 1423, - /* 880 */ 1720, 552, 1350, 44, 42, 552, 552, 1928, 1878, 1580, - /* 890 */ 1878, 353, 366, 1344, 137, 607, 1634, 2065, 530, 535, - /* 900 */ 1878, 656, 606, 1690, 1424, 1584, 1342, 406, 8, 534, - /* 910 */ 1878, 1720, 2071, 171, 1878, 1720, 1720, 2066, 579, 1621, - /* 920 */ 1819, 1583, 308, 1908, 1582, 2017, 1487, 1944, 1419, 1581, - /* 930 */ 697, 98, 1909, 1911, 610, 1913, 1914, 605, 2065, 600, - /* 940 */ 1350, 505, 153, 1578, 1426, 1427, 1997, 1577, 1878, 1614, - /* 950 */ 1996, 1993, 552, 2071, 171, 72, 1576, 552, 2066, 579, - /* 960 */ 504, 503, 502, 45, 1878, 240, 1, 1878, 126, 498, - /* 970 */ 360, 507, 1878, 497, 496, 639, 2037, 581, 1763, 495, - /* 980 */ 501, 206, 1720, 1372, 208, 494, 1878, 1720, 697, 1345, - /* 990 */ 1878, 1343, 365, 1695, 522, 582, 1575, 264, 161, 1878, - /* 1000 */ 1574, 1573, 1426, 1427, 484, 480, 476, 472, 205, 534, - /* 1010 */ 640, 534, 234, 1763, 1348, 1349, 1292, 1399, 1400, 1402, - /* 1020 */ 1403, 1404, 1405, 1406, 1407, 1408, 1409, 602, 598, 1417, - /* 1030 */ 1418, 1420, 1421, 1422, 1423, 1425, 1428, 3, 2065, 1878, - /* 1040 */ 2065, 154, 566, 1878, 1878, 78, 1401, 1345, 203, 1343, - /* 1050 */ 1723, 48, 4, 2071, 171, 2071, 171, 586, 2066, 579, - /* 1060 */ 2066, 579, 37, 36, 1572, 238, 43, 41, 40, 39, - /* 1070 */ 38, 1571, 1348, 1349, 1631, 1399, 1400, 1402, 1403, 1404, - /* 1080 */ 1405, 1406, 1407, 1408, 1409, 602, 598, 1417, 1418, 1420, - /* 1090 */ 1421, 1422, 1423, 1425, 1428, 3, 312, 1801, 1367, 282, - /* 1100 */ 641, 590, 1750, 50, 533, 429, 590, 1878, 440, 213, - /* 1110 */ 202, 196, 211, 201, 1878, 215, 138, 463, 214, 145, - /* 1120 */ 144, 638, 637, 636, 1570, 413, 245, 441, 142, 217, - /* 1130 */ 415, 132, 216, 194, 219, 143, 132, 218, 674, 673, - /* 1140 */ 672, 671, 363, 258, 670, 669, 133, 664, 663, 662, - /* 1150 */ 661, 660, 659, 658, 657, 147, 653, 652, 651, 362, - /* 1160 */ 361, 648, 647, 646, 645, 644, 155, 1878, 130, 545, - /* 1170 */ 552, 288, 325, 130, 597, 1562, 1563, 13, 12, 60, - /* 1180 */ 1353, 242, 2070, 548, 402, 286, 66, 1612, 1188, 65, - /* 1190 */ 170, 2005, 2006, 1608, 2010, 172, 2005, 2006, 250, 2010, - /* 1200 */ 1720, 60, 1929, 45, 364, 45, 190, 446, 444, 510, - /* 1210 */ 614, 142, 439, 583, 1910, 434, 433, 432, 431, 428, - /* 1220 */ 427, 426, 425, 424, 420, 419, 418, 417, 326, 410, - /* 1230 */ 409, 408, 1517, 404, 403, 324, 1352, 1603, 1899, 1760, - /* 1240 */ 552, 692, 552, 58, 1928, 143, 416, 552, 2027, 122, - /* 1250 */ 591, 253, 594, 550, 1461, 551, 1410, 1878, 281, 606, - /* 1260 */ 271, 37, 36, 1216, 1220, 43, 41, 40, 39, 38, - /* 1270 */ 1720, 509, 1720, 93, 266, 1553, 590, 1720, 263, 2, - /* 1280 */ 1908, 96, 578, 90, 1944, 5, 519, 1901, 97, 1909, - /* 1290 */ 1911, 610, 1913, 1914, 605, 1115, 600, 142, 1227, 369, - /* 1300 */ 221, 168, 1225, 1997, 374, 323, 132, 346, 1993, 1308, - /* 1310 */ 278, 2065, 649, 1445, 512, 318, 71, 70, 395, 506, - /* 1320 */ 173, 178, 183, 1356, 220, 1910, 577, 171, 2023, 1116, - /* 1330 */ 650, 2066, 579, 401, 1135, 437, 405, 411, 1367, 311, - /* 1340 */ 430, 423, 383, 121, 381, 377, 373, 370, 367, 1816, - /* 1350 */ 146, 1910, 1133, 436, 438, 1928, 442, 1453, 443, 1373, - /* 1360 */ 448, 64, 187, 594, 63, 267, 2005, 589, 1878, 588, - /* 1370 */ 606, 456, 2065, 445, 1375, 447, 459, 193, 1374, 1355, - /* 1380 */ 460, 1928, 1376, 195, 461, 462, 198, 577, 171, 607, - /* 1390 */ 174, 1908, 2066, 579, 1878, 1944, 606, 464, 200, 97, - /* 1400 */ 1909, 1911, 610, 1913, 1914, 605, 75, 600, 1089, 468, - /* 1410 */ 76, 1454, 168, 485, 1997, 204, 486, 1908, 346, 1993, - /* 1420 */ 487, 1944, 489, 99, 1710, 97, 1909, 1911, 610, 1913, - /* 1430 */ 1914, 605, 314, 600, 210, 1706, 521, 523, 2085, 2024, - /* 1440 */ 1997, 212, 148, 149, 346, 1993, 1708, 1704, 279, 224, - /* 1450 */ 150, 151, 1855, 524, 2031, 528, 227, 531, 536, 231, - /* 1460 */ 564, 525, 546, 1910, 84, 335, 539, 1854, 1826, 543, - /* 1470 */ 280, 337, 86, 1721, 1372, 139, 560, 567, 2043, 562, - /* 1480 */ 140, 2042, 33, 350, 1448, 1449, 1450, 1451, 1452, 1456, - /* 1490 */ 1457, 1458, 1459, 1928, 547, 248, 6, 563, 342, 252, - /* 1500 */ 2019, 607, 2028, 570, 2038, 576, 1878, 561, 606, 559, - /* 1510 */ 558, 257, 343, 587, 2064, 2088, 584, 1487, 1371, 262, - /* 1520 */ 57, 131, 88, 1691, 2013, 612, 283, 274, 1764, 1908, - /* 1530 */ 1910, 693, 694, 1944, 696, 49, 295, 97, 1909, 1911, - /* 1540 */ 610, 1913, 1914, 605, 307, 600, 306, 162, 259, 260, - /* 1550 */ 2085, 1978, 1997, 285, 261, 305, 346, 1993, 287, 1872, - /* 1560 */ 1928, 1871, 265, 68, 1870, 1869, 2059, 69, 607, 371, - /* 1570 */ 372, 1336, 1337, 1878, 1866, 606, 177, 376, 1864, 378, - /* 1580 */ 379, 380, 1863, 382, 1910, 1862, 384, 1861, 386, 1860, - /* 1590 */ 388, 1311, 1310, 1837, 1836, 393, 1908, 394, 1835, 1834, - /* 1600 */ 1944, 1809, 1280, 1808, 97, 1909, 1911, 610, 1913, 1914, - /* 1610 */ 605, 1806, 600, 134, 1928, 1805, 1804, 2085, 1807, 1997, - /* 1620 */ 181, 135, 607, 346, 1993, 1803, 1802, 1878, 1800, 606, - /* 1630 */ 1799, 1798, 412, 2016, 1797, 414, 1796, 1795, 1910, 1794, - /* 1640 */ 1793, 1792, 1791, 1790, 1789, 1788, 1787, 1786, 1785, 1784, - /* 1650 */ 1908, 1783, 1782, 1781, 1944, 136, 1780, 1779, 97, 1909, - /* 1660 */ 1911, 610, 1913, 1914, 605, 1778, 600, 1777, 1928, 1776, - /* 1670 */ 1775, 1972, 1282, 1997, 188, 1635, 607, 346, 1993, 1774, - /* 1680 */ 1773, 1878, 1636, 606, 189, 1633, 1599, 1076, 1598, 1163, - /* 1690 */ 1075, 1910, 1108, 199, 1832, 1818, 1699, 191, 123, 1850, - /* 1700 */ 1844, 166, 192, 124, 1908, 1833, 452, 454, 1944, 1632, - /* 1710 */ 197, 1630, 97, 1909, 1911, 610, 1913, 1914, 605, 469, - /* 1720 */ 600, 1928, 471, 1628, 470, 1970, 473, 1997, 474, 607, - /* 1730 */ 1626, 346, 1993, 1624, 1878, 1611, 606, 475, 477, 481, - /* 1740 */ 478, 479, 1610, 1595, 1910, 483, 1701, 1231, 482, 1230, - /* 1750 */ 1700, 1154, 1153, 1152, 1151, 1150, 665, 1908, 667, 1147, - /* 1760 */ 1146, 1944, 1145, 1144, 1622, 97, 1909, 1911, 610, 1913, - /* 1770 */ 1914, 605, 59, 600, 1928, 331, 1615, 332, 555, 1613, - /* 1780 */ 1997, 508, 607, 333, 346, 1993, 511, 1878, 1594, 606, - /* 1790 */ 1593, 209, 513, 515, 1592, 517, 1849, 100, 53, 1843, - /* 1800 */ 1317, 152, 526, 1328, 1831, 1910, 1829, 1830, 2070, 25, - /* 1810 */ 1908, 1828, 1827, 18, 1944, 1825, 1326, 233, 98, 1909, - /* 1820 */ 1911, 610, 1913, 1914, 605, 1817, 600, 1325, 532, 1910, - /* 1830 */ 83, 239, 228, 1997, 82, 1928, 85, 595, 1993, 90, - /* 1840 */ 19, 527, 15, 604, 244, 20, 241, 27, 1878, 1436, - /* 1850 */ 606, 56, 1532, 334, 541, 247, 255, 1435, 544, 1928, - /* 1860 */ 10, 29, 249, 1514, 251, 256, 1516, 607, 1509, 160, - /* 1870 */ 1899, 1908, 1878, 254, 606, 1944, 61, 28, 89, 303, - /* 1880 */ 1909, 1911, 610, 1913, 1914, 605, 603, 600, 553, 1962, - /* 1890 */ 22, 1910, 1547, 1546, 344, 1908, 1552, 1553, 1551, 1944, - /* 1900 */ 1550, 345, 268, 98, 1909, 1911, 610, 1913, 1914, 605, - /* 1910 */ 1484, 600, 1483, 55, 1898, 163, 12, 1360, 1997, 1414, - /* 1920 */ 164, 1928, 1947, 1994, 599, 175, 35, 1446, 1412, 604, - /* 1930 */ 1411, 14, 23, 1392, 1878, 1384, 606, 24, 613, 611, - /* 1940 */ 609, 1217, 1910, 355, 615, 617, 1214, 618, 620, 1211, - /* 1950 */ 621, 623, 626, 1194, 21, 624, 16, 1908, 1205, 1209, - /* 1960 */ 1203, 1944, 54, 1208, 1226, 303, 1909, 1911, 610, 1913, - /* 1970 */ 1914, 605, 1928, 600, 1222, 1963, 272, 627, 91, 633, - /* 1980 */ 607, 92, 67, 1106, 642, 1878, 1207, 606, 1141, 1140, - /* 1990 */ 1206, 1139, 1138, 1137, 1136, 1134, 1910, 1132, 1131, 1130, - /* 2000 */ 1128, 1161, 1127, 1126, 654, 1125, 1124, 1123, 1908, 273, - /* 2010 */ 1122, 1121, 1944, 1158, 1910, 1156, 158, 1909, 1911, 610, - /* 2020 */ 1913, 1914, 605, 1118, 600, 1117, 1928, 1114, 1113, 1112, - /* 2030 */ 1111, 1629, 675, 677, 607, 1627, 676, 679, 680, 1878, - /* 2040 */ 681, 606, 1625, 683, 1928, 684, 1623, 687, 685, 689, - /* 2050 */ 688, 1609, 607, 691, 1066, 1591, 276, 1878, 2035, 606, - /* 2060 */ 695, 1566, 1908, 1346, 699, 284, 1944, 1566, 698, 1566, - /* 2070 */ 299, 1909, 1911, 610, 1913, 1914, 605, 1566, 600, 1566, - /* 2080 */ 1908, 1566, 1566, 1566, 1944, 1566, 1566, 1566, 159, 1909, - /* 2090 */ 1911, 610, 1913, 1914, 605, 1566, 600, 1910, 1566, 1566, - /* 2100 */ 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, - /* 2110 */ 1566, 1566, 1566, 1566, 575, 1566, 1566, 1566, 1566, 1566, - /* 2120 */ 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1928, 1566, 1566, - /* 2130 */ 1566, 1566, 351, 1566, 1566, 607, 1566, 1566, 1566, 1566, - /* 2140 */ 1878, 2087, 606, 1566, 1566, 1566, 1566, 1566, 1566, 1566, - /* 2150 */ 1566, 1566, 1910, 1566, 1566, 1566, 1566, 1566, 1566, 1566, - /* 2160 */ 1566, 1566, 1566, 1908, 1566, 1566, 1566, 1944, 1566, 1566, - /* 2170 */ 1566, 304, 1909, 1911, 610, 1913, 1914, 605, 1566, 600, - /* 2180 */ 1566, 1566, 1928, 1566, 1566, 1566, 1566, 354, 1566, 1566, - /* 2190 */ 607, 1566, 1566, 1566, 1566, 1878, 1566, 606, 1566, 1566, - /* 2200 */ 1566, 1566, 1566, 1910, 1566, 1566, 1566, 1566, 1566, 1566, - /* 2210 */ 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1908, 1566, - /* 2220 */ 1566, 1566, 1944, 1566, 1566, 1566, 304, 1909, 1911, 610, - /* 2230 */ 1913, 1914, 605, 1928, 600, 1566, 1566, 1566, 1566, 1566, - /* 2240 */ 1566, 607, 1566, 1566, 1566, 1566, 1878, 1566, 606, 1566, - /* 2250 */ 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1910, 1566, 1566, - /* 2260 */ 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 520, - /* 2270 */ 1566, 1566, 1566, 1944, 1566, 1566, 1566, 297, 1909, 1911, - /* 2280 */ 610, 1913, 1914, 605, 1566, 600, 1566, 1928, 1566, 1566, - /* 2290 */ 1566, 1566, 1566, 1566, 1566, 607, 1566, 1566, 1566, 1566, - /* 2300 */ 1878, 1566, 606, 1566, 1566, 1566, 1566, 1566, 1910, 1566, - /* 2310 */ 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, - /* 2320 */ 1566, 1566, 1566, 1908, 1566, 1566, 1566, 1944, 1566, 1566, - /* 2330 */ 1566, 289, 1909, 1911, 610, 1913, 1914, 605, 1928, 600, - /* 2340 */ 1566, 1566, 1566, 1566, 1566, 1566, 607, 1566, 1566, 1566, - /* 2350 */ 1566, 1878, 1566, 606, 1566, 1566, 1566, 1566, 1566, 1566, - /* 2360 */ 1566, 1566, 1910, 1566, 1566, 1566, 1566, 1566, 1566, 1566, - /* 2370 */ 1566, 1566, 1566, 1566, 1908, 1566, 1566, 1566, 1944, 1566, - /* 2380 */ 1910, 1566, 290, 1909, 1911, 610, 1913, 1914, 605, 1566, - /* 2390 */ 600, 1566, 1928, 1566, 1566, 1566, 1566, 1566, 1566, 1566, - /* 2400 */ 607, 1566, 1566, 1566, 1566, 1878, 1566, 606, 1566, 1566, - /* 2410 */ 1928, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 607, 1566, - /* 2420 */ 1566, 1566, 1566, 1878, 1566, 606, 1566, 1566, 1908, 1566, - /* 2430 */ 1566, 1566, 1944, 1566, 1566, 1566, 291, 1909, 1911, 610, - /* 2440 */ 1913, 1914, 605, 1566, 600, 1566, 1908, 1566, 1566, 1566, - /* 2450 */ 1944, 1566, 1566, 1566, 298, 1909, 1911, 610, 1913, 1914, - /* 2460 */ 605, 1566, 600, 1910, 1566, 1566, 1566, 1566, 1566, 1566, - /* 2470 */ 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, - /* 2480 */ 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, - /* 2490 */ 1566, 1566, 1566, 1928, 1566, 1566, 1566, 1566, 1566, 1566, - /* 2500 */ 1566, 607, 1566, 1566, 1566, 1566, 1878, 1566, 606, 1566, - /* 2510 */ 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1910, 1566, - /* 2520 */ 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1908, - /* 2530 */ 1566, 1566, 1566, 1944, 1566, 1566, 1566, 300, 1909, 1911, - /* 2540 */ 610, 1913, 1914, 605, 1566, 600, 1566, 1566, 1928, 1566, - /* 2550 */ 1566, 1566, 1566, 1566, 1566, 1566, 607, 1566, 1566, 1566, - /* 2560 */ 1566, 1878, 1566, 606, 1566, 1566, 1566, 1566, 1566, 1910, - /* 2570 */ 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, - /* 2580 */ 1566, 1566, 1566, 1566, 1908, 1566, 1566, 1566, 1944, 1566, - /* 2590 */ 1566, 1566, 292, 1909, 1911, 610, 1913, 1914, 605, 1928, - /* 2600 */ 600, 1566, 1566, 1566, 1566, 1566, 1566, 607, 1566, 1566, - /* 2610 */ 1566, 1566, 1878, 1566, 606, 1566, 1566, 1566, 1566, 1566, - /* 2620 */ 1566, 1566, 1566, 1910, 1566, 1566, 1566, 1566, 1566, 1566, - /* 2630 */ 1566, 1566, 1566, 1566, 1566, 1908, 1566, 1566, 1566, 1944, - /* 2640 */ 1566, 1566, 1566, 301, 1909, 1911, 610, 1913, 1914, 605, - /* 2650 */ 1566, 600, 1566, 1928, 1566, 1566, 1566, 1566, 1566, 1566, - /* 2660 */ 1566, 607, 1566, 1566, 1566, 1566, 1878, 1566, 606, 1566, - /* 2670 */ 1566, 1566, 1566, 1566, 1910, 1566, 1566, 1566, 1566, 1566, - /* 2680 */ 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1908, - /* 2690 */ 1566, 1566, 1566, 1944, 1566, 1566, 1566, 293, 1909, 1911, - /* 2700 */ 610, 1913, 1914, 605, 1928, 600, 1566, 1566, 1566, 1566, - /* 2710 */ 1566, 1566, 607, 1566, 1566, 1566, 1566, 1878, 1566, 606, - /* 2720 */ 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1910, 1566, - /* 2730 */ 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, - /* 2740 */ 1908, 1566, 1566, 1566, 1944, 1566, 1910, 1566, 302, 1909, - /* 2750 */ 1911, 610, 1913, 1914, 605, 1566, 600, 1566, 1928, 1566, - /* 2760 */ 1566, 1566, 1566, 1566, 1566, 1566, 607, 1566, 1566, 1566, - /* 2770 */ 1566, 1878, 1566, 606, 1566, 1566, 1928, 1566, 1566, 1566, - /* 2780 */ 1566, 1566, 1566, 1566, 607, 1566, 1566, 1566, 1566, 1878, - /* 2790 */ 1566, 606, 1566, 1566, 1908, 1566, 1566, 1566, 1944, 1566, - /* 2800 */ 1566, 1566, 294, 1909, 1911, 610, 1913, 1914, 605, 1566, - /* 2810 */ 600, 1566, 1908, 1566, 1566, 1566, 1944, 1566, 1566, 1566, - /* 2820 */ 309, 1909, 1911, 610, 1913, 1914, 605, 1566, 600, 1910, - /* 2830 */ 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, - /* 2840 */ 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, - /* 2850 */ 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1928, - /* 2860 */ 1566, 1566, 1566, 1566, 1566, 1566, 1566, 607, 1566, 1566, - /* 2870 */ 1566, 1566, 1878, 1566, 606, 1566, 1566, 1566, 1566, 1566, - /* 2880 */ 1566, 1566, 1566, 1566, 1910, 1566, 1566, 1566, 1566, 1566, - /* 2890 */ 1566, 1566, 1566, 1566, 1566, 1908, 1566, 1566, 1566, 1944, - /* 2900 */ 1566, 1566, 1566, 310, 1909, 1911, 610, 1913, 1914, 605, - /* 2910 */ 1566, 600, 1566, 1566, 1928, 1566, 1566, 1566, 1566, 1566, - /* 2920 */ 1566, 1566, 607, 1566, 1566, 1566, 1566, 1878, 1566, 606, - /* 2930 */ 1566, 1566, 1566, 1566, 1566, 1910, 1566, 1566, 1566, 1566, - /* 2940 */ 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, - /* 2950 */ 1908, 1566, 1566, 1566, 1944, 1566, 1566, 1566, 1922, 1909, - /* 2960 */ 1911, 610, 1913, 1914, 605, 1928, 600, 1566, 1566, 1566, - /* 2970 */ 1566, 1566, 1566, 607, 1566, 1566, 1566, 1566, 1878, 1566, - /* 2980 */ 606, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1910, - /* 2990 */ 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, - /* 3000 */ 1566, 1908, 1566, 1566, 1566, 1944, 1566, 1566, 1566, 1921, - /* 3010 */ 1909, 1911, 610, 1913, 1914, 605, 1566, 600, 1566, 1928, - /* 3020 */ 1566, 1566, 1566, 1566, 1566, 1566, 1566, 607, 1566, 1566, - /* 3030 */ 1566, 1566, 1878, 1566, 606, 1566, 1566, 1566, 1566, 1566, - /* 3040 */ 1910, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, - /* 3050 */ 1566, 1566, 1566, 1566, 1566, 1908, 1566, 1566, 1566, 1944, - /* 3060 */ 1566, 1566, 1566, 1920, 1909, 1911, 610, 1913, 1914, 605, - /* 3070 */ 1928, 600, 1566, 1566, 1566, 1566, 1566, 1566, 607, 1566, - /* 3080 */ 1566, 1566, 1566, 1878, 1566, 606, 1566, 1566, 1566, 1566, - /* 3090 */ 1566, 1566, 1566, 1566, 1910, 1566, 1566, 1566, 1566, 1566, - /* 3100 */ 1566, 1566, 1566, 1566, 1566, 1566, 1908, 1566, 1566, 1566, - /* 3110 */ 1944, 1566, 1910, 1566, 319, 1909, 1911, 610, 1913, 1914, - /* 3120 */ 605, 1566, 600, 1566, 1928, 1566, 1566, 1566, 1566, 1566, - /* 3130 */ 1566, 1566, 607, 1566, 1566, 1566, 1566, 1878, 1566, 606, - /* 3140 */ 1566, 1566, 1928, 1566, 1566, 1566, 1566, 1566, 1566, 1566, - /* 3150 */ 607, 1566, 1566, 1566, 1566, 1878, 1566, 606, 1566, 1566, - /* 3160 */ 1908, 1566, 1566, 1566, 1944, 1566, 1566, 1566, 320, 1909, - /* 3170 */ 1911, 610, 1913, 1914, 605, 1566, 600, 1566, 1908, 1566, - /* 3180 */ 1566, 1566, 1944, 1566, 1566, 1566, 316, 1909, 1911, 610, - /* 3190 */ 1913, 1914, 605, 1566, 600, 1910, 1566, 1566, 1566, 1566, - /* 3200 */ 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, - /* 3210 */ 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, - /* 3220 */ 1566, 1566, 1566, 1566, 1566, 1928, 1566, 1566, 1566, 1566, - /* 3230 */ 1566, 1566, 1566, 607, 1566, 1566, 1566, 1566, 1878, 1566, - /* 3240 */ 606, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, - /* 3250 */ 1910, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, - /* 3260 */ 1566, 1908, 1566, 1566, 1566, 1944, 1566, 1566, 1566, 321, - /* 3270 */ 1909, 1911, 610, 1913, 1914, 605, 1566, 600, 1566, 1566, - /* 3280 */ 1928, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 607, 1566, - /* 3290 */ 1566, 1566, 1566, 1878, 1566, 606, 1566, 1566, 1566, 1566, - /* 3300 */ 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, - /* 3310 */ 1566, 1566, 1566, 1566, 1566, 1566, 1908, 1566, 1566, 1566, - /* 3320 */ 1944, 1566, 1566, 1566, 296, 1909, 1911, 610, 1913, 1914, - /* 3330 */ 605, 1566, 600, + /* 0 */ 454, 1936, 455, 1620, 1832, 168, 363, 594, 556, 1783, + /* 10 */ 1785, 556, 44, 42, 462, 182, 455, 1620, 1790, 1922, + /* 20 */ 358, 121, 1362, 1585, 52, 326, 329, 1836, 492, 453, + /* 30 */ 1918, 1954, 457, 1442, 1788, 1360, 1819, 134, 1738, 611, + /* 40 */ 158, 1738, 95, 1727, 1904, 1691, 610, 120, 119, 118, + /* 50 */ 117, 116, 115, 114, 113, 112, 129, 1437, 513, 1914, + /* 60 */ 1920, 346, 17, 1079, 1730, 582, 62, 344, 597, 1368, + /* 70 */ 612, 604, 1388, 523, 1970, 156, 122, 99, 357, 1937, + /* 80 */ 614, 1939, 1940, 609, 1740, 604, 1096, 225, 1095, 40, + /* 90 */ 39, 38, 2023, 439, 2091, 1, 321, 2019, 271, 2031, + /* 100 */ 593, 516, 592, 1083, 1084, 2091, 510, 2091, 397, 581, + /* 110 */ 174, 224, 34, 274, 2092, 583, 1097, 701, 1608, 403, + /* 120 */ 581, 174, 581, 174, 538, 2092, 583, 2092, 583, 37, + /* 130 */ 36, 1444, 1445, 43, 41, 40, 39, 38, 58, 234, + /* 140 */ 47, 1390, 556, 46, 44, 42, 1512, 597, 64, 190, + /* 150 */ 189, 63, 358, 2091, 1362, 179, 58, 58, 317, 1418, + /* 160 */ 1427, 1904, 508, 507, 506, 1442, 1165, 1360, 2097, 174, + /* 170 */ 128, 502, 1738, 2092, 583, 501, 500, 58, 1363, 82, + /* 180 */ 1361, 499, 505, 1247, 1248, 420, 1790, 498, 1387, 1437, + /* 190 */ 597, 37, 36, 345, 17, 43, 41, 40, 39, 38, + /* 200 */ 1167, 1368, 1788, 1366, 1367, 1586, 1417, 1420, 1421, 1422, + /* 210 */ 1423, 1424, 1425, 1426, 606, 602, 1435, 1436, 1438, 1439, + /* 220 */ 1440, 1441, 1443, 1446, 3, 78, 111, 1, 541, 110, + /* 230 */ 109, 108, 107, 106, 105, 104, 103, 102, 396, 127, + /* 240 */ 395, 316, 177, 1385, 538, 1784, 1785, 1387, 1733, 701, + /* 250 */ 433, 111, 65, 444, 110, 109, 108, 107, 106, 105, + /* 260 */ 104, 103, 102, 1444, 1445, 46, 2096, 1790, 542, 582, + /* 270 */ 417, 471, 445, 2091, 362, 419, 44, 42, 343, 1548, + /* 280 */ 1607, 1847, 250, 1788, 358, 177, 1362, 177, 2097, 174, + /* 290 */ 177, 1418, 1427, 2092, 583, 2091, 1388, 1442, 2091, 1360, + /* 300 */ 73, 37, 36, 177, 177, 43, 41, 40, 39, 38, + /* 310 */ 1363, 2095, 1361, 581, 174, 2092, 2094, 330, 2092, 583, + /* 320 */ 572, 1437, 58, 1904, 177, 1387, 17, 1299, 1300, 407, + /* 330 */ 13, 12, 159, 1368, 1597, 1366, 1367, 233, 1417, 1420, + /* 340 */ 1421, 1422, 1423, 1424, 1425, 1426, 606, 602, 1435, 1436, + /* 350 */ 1438, 1439, 1440, 1441, 1443, 1446, 3, 443, 577, 1, + /* 360 */ 438, 437, 436, 435, 432, 431, 430, 429, 428, 424, + /* 370 */ 423, 422, 421, 331, 414, 413, 412, 81, 409, 408, + /* 380 */ 328, 701, 37, 36, 1371, 371, 43, 41, 40, 39, + /* 390 */ 38, 212, 1096, 170, 1095, 1444, 1445, 461, 2096, 392, + /* 400 */ 457, 538, 361, 578, 573, 163, 1777, 211, 44, 42, + /* 410 */ 156, 488, 484, 480, 476, 209, 358, 26, 1362, 1740, + /* 420 */ 394, 390, 1097, 1418, 1427, 1485, 30, 2091, 647, 1442, + /* 430 */ 2091, 1360, 37, 36, 226, 1583, 43, 41, 40, 39, + /* 440 */ 38, 78, 1363, 2095, 1361, 2097, 174, 2092, 2093, 364, + /* 450 */ 2092, 583, 79, 1437, 1954, 207, 1386, 156, 17, 1538, + /* 460 */ 504, 503, 576, 1578, 1734, 1368, 1740, 1366, 1367, 177, + /* 470 */ 1417, 1420, 1421, 1422, 1423, 1424, 1425, 1426, 606, 602, + /* 480 */ 1435, 1436, 1438, 1439, 1440, 1441, 1443, 1446, 3, 522, + /* 490 */ 11, 1, 80, 319, 1083, 1084, 546, 2096, 544, 373, + /* 500 */ 1606, 594, 520, 575, 518, 2038, 370, 569, 1536, 1537, + /* 510 */ 1539, 1540, 1516, 701, 1389, 538, 645, 526, 1387, 239, + /* 520 */ 206, 200, 538, 205, 459, 1605, 467, 1444, 1445, 1374, + /* 530 */ 1385, 134, 2035, 538, 1716, 147, 146, 642, 641, 640, + /* 540 */ 44, 42, 198, 1904, 2091, 556, 1604, 168, 358, 1715, + /* 550 */ 1362, 2091, 558, 639, 1995, 1418, 1427, 1577, 401, 2097, + /* 560 */ 174, 1442, 2091, 1360, 2092, 583, 2097, 174, 1904, 1837, + /* 570 */ 132, 2092, 583, 1452, 1363, 1738, 1361, 2097, 174, 1387, + /* 580 */ 1339, 1340, 2092, 583, 1713, 1437, 1389, 1729, 1603, 1904, + /* 590 */ 1571, 596, 172, 2031, 2032, 471, 2036, 1368, 1918, 1366, + /* 600 */ 1367, 1602, 1417, 1420, 1421, 1422, 1423, 1424, 1425, 1426, + /* 610 */ 606, 602, 1435, 1436, 1438, 1439, 1440, 1441, 1443, 1446, + /* 620 */ 3, 186, 1601, 8, 11, 1850, 9, 1914, 1920, 37, + /* 630 */ 36, 1904, 11, 43, 41, 40, 39, 38, 1473, 604, + /* 640 */ 32, 1600, 88, 1891, 1904, 701, 37, 36, 672, 670, + /* 650 */ 43, 41, 40, 39, 38, 273, 645, 1419, 75, 1444, + /* 660 */ 1445, 74, 37, 36, 1731, 1904, 43, 41, 40, 39, + /* 670 */ 38, 2038, 44, 42, 1447, 147, 146, 642, 641, 640, + /* 680 */ 358, 1923, 1362, 322, 1904, 1936, 556, 1418, 1427, 1790, + /* 690 */ 380, 645, 1918, 1442, 556, 1360, 37, 36, 2034, 402, + /* 700 */ 43, 41, 40, 39, 38, 1789, 1363, 411, 1361, 31, + /* 710 */ 147, 146, 642, 641, 640, 1954, 1738, 1437, 1419, 1478, + /* 720 */ 1368, 1914, 1920, 598, 1738, 1471, 659, 273, 1904, 1368, + /* 730 */ 610, 1366, 1367, 604, 1417, 1420, 1421, 1422, 1423, 1424, + /* 740 */ 1425, 1426, 606, 602, 1435, 1436, 1438, 1439, 1440, 1441, + /* 750 */ 1443, 1446, 3, 1509, 1934, 8, 1599, 145, 1970, 1596, + /* 760 */ 1832, 98, 1935, 1937, 614, 1939, 1940, 609, 1714, 604, + /* 770 */ 177, 184, 227, 334, 171, 1768, 2023, 701, 1595, 1472, + /* 780 */ 351, 2019, 37, 36, 1528, 1594, 43, 41, 40, 39, + /* 790 */ 38, 1444, 1445, 176, 43, 41, 40, 39, 38, 1904, + /* 800 */ 556, 2049, 1904, 556, 44, 42, 1832, 560, 2038, 1995, + /* 810 */ 51, 556, 358, 425, 1362, 155, 121, 188, 556, 1418, + /* 820 */ 1427, 1904, 1390, 497, 426, 1442, 2095, 1360, 1904, 647, + /* 830 */ 1738, 469, 556, 1738, 335, 2033, 333, 332, 1363, 494, + /* 840 */ 1361, 1738, 1390, 496, 1846, 470, 312, 1387, 1738, 1437, + /* 850 */ 33, 355, 1466, 1467, 1468, 1469, 1470, 1474, 1475, 1476, + /* 860 */ 1477, 1368, 1738, 1366, 1367, 495, 1417, 1420, 1421, 1422, + /* 870 */ 1423, 1424, 1425, 1426, 606, 602, 1435, 1436, 1438, 1439, + /* 880 */ 1440, 1441, 1443, 1446, 3, 240, 241, 8, 1205, 636, + /* 890 */ 635, 634, 1209, 633, 1211, 1212, 632, 1214, 629, 1593, + /* 900 */ 1220, 626, 1222, 1223, 623, 620, 542, 156, 556, 701, + /* 910 */ 1592, 2043, 1505, 556, 1922, 1845, 1741, 312, 404, 1848, + /* 920 */ 7, 1735, 1591, 1444, 1445, 1918, 139, 660, 556, 1708, + /* 930 */ 1590, 405, 1589, 1588, 556, 45, 44, 42, 1738, 48, + /* 940 */ 4, 534, 1904, 1738, 358, 319, 1362, 539, 546, 556, + /* 950 */ 544, 1418, 1427, 1904, 1914, 1920, 352, 1442, 1738, 1360, + /* 960 */ 1652, 556, 244, 183, 1738, 1904, 604, 496, 643, 238, + /* 970 */ 1363, 1781, 1361, 1904, 552, 1904, 1904, 130, 533, 1738, + /* 980 */ 1994, 1437, 644, 249, 286, 1781, 1419, 1768, 1310, 495, + /* 990 */ 586, 1738, 1508, 1368, 1723, 1366, 1367, 1936, 1417, 1420, + /* 1000 */ 1421, 1422, 1423, 1424, 1425, 1426, 606, 602, 1435, 1436, + /* 1010 */ 1438, 1439, 1440, 1441, 1443, 1446, 3, 556, 140, 1, + /* 1020 */ 137, 123, 242, 556, 508, 507, 506, 1954, 594, 589, + /* 1030 */ 554, 217, 128, 502, 215, 598, 555, 501, 500, 556, + /* 1040 */ 1904, 701, 610, 499, 505, 219, 1639, 1738, 218, 498, + /* 1050 */ 144, 221, 275, 1738, 220, 1444, 1445, 223, 134, 556, + /* 1060 */ 222, 145, 50, 60, 254, 60, 1934, 537, 509, 1738, + /* 1070 */ 1970, 549, 365, 98, 1935, 1937, 614, 1939, 1940, 609, + /* 1080 */ 1370, 604, 585, 1418, 1427, 1649, 171, 1632, 2023, 1738, + /* 1090 */ 1630, 601, 351, 2019, 1580, 1581, 2096, 132, 94, 13, + /* 1100 */ 12, 45, 1363, 246, 1361, 1725, 1721, 230, 91, 511, + /* 1110 */ 605, 638, 514, 2050, 1198, 2063, 1535, 257, 1479, 173, + /* 1120 */ 2031, 2032, 1505, 2036, 1692, 268, 1598, 1366, 1367, 1925, + /* 1130 */ 1417, 1420, 1421, 1422, 1423, 1424, 1425, 1426, 606, 602, + /* 1140 */ 1435, 1436, 1438, 1439, 1440, 1441, 1443, 1446, 3, 678, + /* 1150 */ 677, 676, 675, 368, 1428, 674, 673, 135, 668, 667, + /* 1160 */ 666, 665, 664, 663, 662, 661, 149, 657, 656, 655, + /* 1170 */ 367, 366, 652, 651, 650, 649, 648, 157, 1927, 570, + /* 1180 */ 45, 618, 292, 144, 1936, 145, 124, 144, 1362, 1571, + /* 1190 */ 653, 654, 1125, 1626, 210, 262, 290, 67, 594, 1955, + /* 1200 */ 66, 1360, 369, 1841, 1621, 1778, 2053, 595, 587, 270, + /* 1210 */ 267, 5, 1145, 1143, 1954, 2, 379, 194, 450, 448, + /* 1220 */ 1326, 327, 611, 374, 282, 1373, 1126, 1904, 134, 610, + /* 1230 */ 187, 406, 1463, 285, 1226, 1368, 1230, 1390, 1237, 1235, + /* 1240 */ 148, 696, 1842, 415, 410, 1385, 441, 427, 1834, 590, + /* 1250 */ 434, 447, 440, 1934, 58, 442, 446, 1970, 191, 449, + /* 1260 */ 98, 1935, 1937, 614, 1939, 1940, 609, 132, 604, 451, + /* 1270 */ 1391, 131, 452, 143, 1994, 2023, 1393, 460, 463, 351, + /* 1280 */ 2019, 1392, 464, 701, 197, 199, 465, 1394, 468, 175, + /* 1290 */ 2031, 2032, 97, 2036, 466, 1936, 202, 204, 472, 76, + /* 1300 */ 77, 208, 1099, 489, 490, 491, 493, 1728, 214, 1724, + /* 1310 */ 1881, 216, 100, 318, 525, 527, 283, 228, 528, 529, + /* 1320 */ 340, 150, 151, 231, 535, 1954, 1726, 540, 1722, 72, + /* 1330 */ 71, 400, 152, 611, 181, 153, 550, 235, 1904, 85, + /* 1340 */ 610, 568, 543, 284, 1363, 87, 1361, 571, 2045, 580, + /* 1350 */ 1936, 6, 315, 1880, 532, 388, 1852, 386, 382, 378, + /* 1360 */ 375, 372, 565, 141, 1934, 547, 342, 2054, 1970, 1366, + /* 1370 */ 1367, 98, 1935, 1937, 614, 1939, 1940, 609, 551, 604, + /* 1380 */ 1954, 564, 566, 142, 2111, 1739, 2023, 252, 611, 2064, + /* 1390 */ 351, 2019, 567, 1904, 562, 610, 347, 256, 574, 348, + /* 1400 */ 2057, 177, 563, 591, 2114, 1505, 1936, 588, 266, 133, + /* 1410 */ 1389, 57, 2004, 2069, 89, 616, 1782, 1709, 697, 1934, + /* 1420 */ 700, 287, 278, 1970, 698, 264, 98, 1935, 1937, 614, + /* 1430 */ 1939, 1940, 609, 2068, 604, 2039, 1954, 311, 49, 2111, + /* 1440 */ 299, 2023, 164, 263, 611, 351, 2019, 261, 310, 1904, + /* 1450 */ 289, 610, 309, 291, 265, 2085, 1898, 1897, 69, 1896, + /* 1460 */ 2090, 1936, 1895, 70, 1892, 376, 377, 1354, 1355, 180, + /* 1470 */ 269, 381, 1890, 383, 384, 1934, 385, 1889, 387, 1970, + /* 1480 */ 1936, 1888, 98, 1935, 1937, 614, 1939, 1940, 609, 389, + /* 1490 */ 604, 1954, 1887, 391, 1886, 2111, 393, 2023, 1329, 611, + /* 1500 */ 1328, 351, 2019, 1863, 1904, 1862, 610, 398, 399, 1861, + /* 1510 */ 1954, 2042, 1860, 1290, 1827, 1826, 1824, 136, 611, 1823, + /* 1520 */ 1822, 1825, 1821, 1904, 1820, 610, 1818, 1817, 1816, 185, + /* 1530 */ 612, 416, 1815, 418, 1970, 1814, 1813, 301, 357, 1937, + /* 1540 */ 614, 1939, 1940, 609, 1812, 604, 1811, 1810, 1809, 1934, + /* 1550 */ 1808, 1807, 1806, 1970, 1805, 1804, 98, 1935, 1937, 614, + /* 1560 */ 1939, 1940, 609, 1803, 604, 1802, 1801, 2091, 1173, 1998, + /* 1570 */ 1800, 2023, 138, 1799, 1798, 351, 2019, 1936, 1797, 1796, + /* 1580 */ 354, 353, 581, 174, 1795, 1794, 1292, 2092, 583, 1086, + /* 1590 */ 1376, 1793, 1792, 1791, 1654, 192, 1653, 193, 1936, 1651, + /* 1600 */ 1617, 1442, 169, 1369, 195, 1616, 125, 1954, 126, 1085, + /* 1610 */ 1876, 1870, 1859, 203, 1858, 611, 196, 456, 458, 201, + /* 1620 */ 1904, 1844, 610, 1717, 1118, 1437, 1650, 1648, 1954, 474, + /* 1630 */ 1646, 1644, 473, 477, 478, 482, 611, 1368, 1642, 481, + /* 1640 */ 475, 1904, 479, 610, 485, 483, 1934, 487, 1629, 486, + /* 1650 */ 1970, 1628, 1613, 98, 1935, 1937, 614, 1939, 1940, 609, + /* 1660 */ 1719, 604, 59, 1241, 1240, 1718, 1996, 1934, 2023, 1164, + /* 1670 */ 1163, 1970, 351, 2019, 98, 1935, 1937, 614, 1939, 1940, + /* 1680 */ 609, 1162, 604, 1936, 1161, 600, 669, 559, 213, 2023, + /* 1690 */ 1160, 1155, 1157, 351, 2019, 1640, 671, 1156, 1154, 336, + /* 1700 */ 1633, 337, 1631, 512, 338, 515, 1612, 1611, 517, 519, + /* 1710 */ 1610, 521, 101, 1954, 1346, 25, 1875, 53, 1335, 1869, + /* 1720 */ 154, 611, 1857, 530, 1855, 1856, 1904, 18, 610, 237, + /* 1730 */ 1851, 1344, 2096, 1854, 1853, 545, 243, 1843, 531, 1343, + /* 1740 */ 83, 86, 84, 248, 232, 91, 1377, 15, 1372, 646, + /* 1750 */ 536, 339, 1934, 27, 19, 20, 1970, 1550, 56, 99, + /* 1760 */ 1935, 1937, 614, 1939, 1940, 609, 1454, 604, 1936, 245, + /* 1770 */ 10, 1380, 1382, 251, 2023, 259, 253, 548, 2022, 2019, + /* 1780 */ 1532, 255, 1453, 602, 1435, 1436, 1438, 1439, 1440, 1441, + /* 1790 */ 1534, 260, 1925, 162, 258, 29, 61, 22, 1954, 21, + /* 1800 */ 28, 1565, 1564, 349, 1527, 1570, 611, 1569, 90, 1568, + /* 1810 */ 1571, 1904, 350, 610, 1502, 272, 1501, 1924, 55, 165, + /* 1820 */ 12, 1378, 1464, 1973, 1936, 166, 178, 1432, 1410, 613, + /* 1830 */ 603, 617, 1430, 35, 1171, 1429, 14, 1934, 23, 360, + /* 1840 */ 1402, 1970, 621, 24, 99, 1935, 1937, 614, 1939, 1940, + /* 1850 */ 609, 1227, 604, 1936, 1954, 615, 54, 619, 622, 2023, + /* 1860 */ 1224, 16, 608, 599, 2019, 624, 1221, 1904, 627, 610, + /* 1870 */ 1219, 625, 630, 1204, 1215, 1218, 628, 1217, 1213, 631, + /* 1880 */ 1216, 92, 1936, 1954, 93, 1236, 68, 276, 1232, 1116, + /* 1890 */ 637, 611, 1151, 1934, 1150, 1149, 1904, 1970, 610, 1148, + /* 1900 */ 307, 1935, 1937, 614, 1939, 1940, 609, 607, 604, 557, + /* 1910 */ 1988, 1936, 1954, 1147, 1146, 1144, 1142, 1141, 1140, 658, + /* 1920 */ 611, 1138, 1934, 1137, 1136, 1904, 1970, 610, 277, 160, + /* 1930 */ 1935, 1937, 614, 1939, 1940, 609, 1135, 604, 1134, 1133, + /* 1940 */ 1132, 1954, 1131, 1168, 1166, 1128, 1127, 1124, 1123, 611, + /* 1950 */ 1122, 1934, 1121, 1647, 1904, 1970, 610, 679, 161, 1935, + /* 1960 */ 1937, 614, 1939, 1940, 609, 680, 604, 1645, 681, 683, + /* 1970 */ 561, 2060, 684, 1643, 685, 687, 689, 688, 1936, 1641, + /* 1980 */ 1934, 691, 693, 692, 1970, 1627, 695, 99, 1935, 1937, + /* 1990 */ 614, 1939, 1940, 609, 1936, 604, 1076, 1609, 280, 699, + /* 2000 */ 1584, 702, 2023, 1364, 288, 1584, 703, 2020, 1954, 1584, + /* 2010 */ 584, 2112, 1584, 341, 1584, 1584, 611, 1584, 1584, 1584, + /* 2020 */ 1584, 1904, 1584, 610, 1954, 1584, 1584, 1584, 1584, 1584, + /* 2030 */ 1584, 1584, 608, 1584, 1584, 1584, 1584, 1904, 1584, 610, + /* 2040 */ 1584, 1584, 1584, 1584, 1584, 1584, 1584, 1934, 1584, 1936, + /* 2050 */ 1584, 1970, 1584, 1584, 308, 1935, 1937, 614, 1939, 1940, + /* 2060 */ 609, 1584, 604, 1934, 1584, 1584, 1584, 1970, 1584, 1936, + /* 2070 */ 307, 1935, 1937, 614, 1939, 1940, 609, 1584, 604, 1954, + /* 2080 */ 1989, 1584, 1584, 1584, 1584, 1584, 1584, 611, 1584, 1584, + /* 2090 */ 1584, 1584, 1904, 1584, 610, 1584, 1584, 1584, 1584, 1954, + /* 2100 */ 1584, 1584, 1584, 1584, 1584, 1584, 1584, 611, 1584, 1584, + /* 2110 */ 1584, 1584, 1904, 1584, 610, 1584, 1584, 1584, 1934, 1584, + /* 2120 */ 1584, 1584, 1970, 1584, 1584, 160, 1935, 1937, 614, 1939, + /* 2130 */ 1940, 609, 1584, 604, 1936, 1584, 1584, 1584, 1934, 1584, + /* 2140 */ 1584, 1584, 1970, 1584, 1584, 303, 1935, 1937, 614, 1939, + /* 2150 */ 1940, 609, 1584, 604, 1584, 1584, 1584, 1584, 1584, 1584, + /* 2160 */ 1584, 1584, 1584, 1584, 1954, 1584, 1584, 2061, 1584, 1584, + /* 2170 */ 1584, 1584, 611, 1584, 1584, 1584, 1584, 1904, 1584, 610, + /* 2180 */ 1584, 1584, 1584, 1584, 1584, 1584, 1584, 1584, 1584, 579, + /* 2190 */ 1584, 1584, 1936, 1584, 1584, 1584, 1584, 1584, 1584, 1584, + /* 2200 */ 1584, 1584, 1584, 1934, 1584, 1584, 1936, 1970, 1584, 1584, + /* 2210 */ 161, 1935, 1937, 614, 1939, 1940, 609, 1584, 604, 1584, + /* 2220 */ 1584, 1584, 1954, 1584, 1584, 1584, 1584, 356, 1584, 1584, + /* 2230 */ 611, 1584, 1584, 1584, 1584, 1904, 1954, 610, 1584, 1584, + /* 2240 */ 1584, 359, 1584, 1584, 611, 1584, 1584, 1584, 1584, 1904, + /* 2250 */ 1584, 610, 1584, 1584, 1584, 1584, 1584, 1584, 1584, 1584, + /* 2260 */ 1584, 1934, 1584, 2113, 1936, 1970, 1584, 1584, 308, 1935, + /* 2270 */ 1937, 614, 1939, 1940, 609, 1934, 604, 1584, 1936, 1970, + /* 2280 */ 1584, 1584, 308, 1935, 1937, 614, 1939, 1940, 609, 1584, + /* 2290 */ 604, 1584, 1584, 1584, 1954, 1584, 1584, 1584, 1584, 1584, + /* 2300 */ 1584, 1584, 611, 1584, 1584, 1584, 1584, 1904, 1954, 610, + /* 2310 */ 1584, 1584, 1584, 1584, 1584, 1584, 611, 1584, 1584, 1584, + /* 2320 */ 1584, 1904, 1584, 610, 1584, 1584, 1584, 1584, 1584, 1584, + /* 2330 */ 1584, 1936, 1584, 524, 1584, 1584, 1584, 1970, 1584, 1584, + /* 2340 */ 301, 1935, 1937, 614, 1939, 1940, 609, 1934, 604, 1584, + /* 2350 */ 1584, 1970, 1584, 1584, 293, 1935, 1937, 614, 1939, 1940, + /* 2360 */ 609, 1954, 604, 1584, 1584, 1584, 1584, 1584, 1584, 611, + /* 2370 */ 1584, 1584, 1584, 1584, 1904, 1584, 610, 1584, 1584, 1584, + /* 2380 */ 1584, 1584, 1584, 1584, 1584, 1584, 1936, 1584, 1584, 1584, + /* 2390 */ 1584, 1584, 1584, 1584, 1584, 1584, 1584, 1584, 1584, 1584, + /* 2400 */ 1934, 1584, 1936, 1584, 1970, 1584, 1584, 294, 1935, 1937, + /* 2410 */ 614, 1939, 1940, 609, 1584, 604, 1954, 1584, 1584, 1584, + /* 2420 */ 1584, 1584, 1584, 1584, 611, 1584, 1584, 1584, 1584, 1904, + /* 2430 */ 1584, 610, 1954, 1584, 1584, 1584, 1584, 1584, 1584, 1584, + /* 2440 */ 611, 1584, 1584, 1584, 1584, 1904, 1584, 610, 1584, 1584, + /* 2450 */ 1584, 1584, 1584, 1584, 1584, 1934, 1584, 1936, 1584, 1970, + /* 2460 */ 1584, 1584, 295, 1935, 1937, 614, 1939, 1940, 609, 1584, + /* 2470 */ 604, 1934, 1584, 1936, 1584, 1970, 1584, 1584, 302, 1935, + /* 2480 */ 1937, 614, 1939, 1940, 609, 1584, 604, 1954, 1584, 1584, + /* 2490 */ 1584, 1584, 1584, 1584, 1584, 611, 1584, 1584, 1584, 1584, + /* 2500 */ 1904, 1584, 610, 1954, 1584, 1584, 1584, 1584, 1584, 1584, + /* 2510 */ 1584, 611, 1584, 1584, 1584, 1584, 1904, 1584, 610, 1584, + /* 2520 */ 1584, 1584, 1584, 1584, 1584, 1584, 1934, 1584, 1584, 1936, + /* 2530 */ 1970, 1584, 1584, 304, 1935, 1937, 614, 1939, 1940, 609, + /* 2540 */ 1584, 604, 1934, 1584, 1584, 1936, 1970, 1584, 1584, 296, + /* 2550 */ 1935, 1937, 614, 1939, 1940, 609, 1584, 604, 1584, 1954, + /* 2560 */ 1584, 1584, 1584, 1584, 1584, 1584, 1584, 611, 1584, 1584, + /* 2570 */ 1584, 1584, 1904, 1584, 610, 1954, 1584, 1584, 1584, 1584, + /* 2580 */ 1584, 1584, 1584, 611, 1584, 1584, 1584, 1584, 1904, 1584, + /* 2590 */ 610, 1584, 1584, 1584, 1584, 1584, 1584, 1584, 1934, 1584, + /* 2600 */ 1584, 1936, 1970, 1584, 1584, 305, 1935, 1937, 614, 1939, + /* 2610 */ 1940, 609, 1584, 604, 1934, 1584, 1584, 1936, 1970, 1584, + /* 2620 */ 1584, 297, 1935, 1937, 614, 1939, 1940, 609, 1584, 604, + /* 2630 */ 1584, 1954, 1584, 1584, 1584, 1584, 1584, 1584, 1584, 611, + /* 2640 */ 1584, 1584, 1584, 1584, 1904, 1584, 610, 1954, 1584, 1584, + /* 2650 */ 1584, 1584, 1584, 1584, 1584, 611, 1584, 1584, 1584, 1584, + /* 2660 */ 1904, 1584, 610, 1584, 1584, 1584, 1584, 1584, 1584, 1584, + /* 2670 */ 1934, 1584, 1584, 1584, 1970, 1584, 1584, 306, 1935, 1937, + /* 2680 */ 614, 1939, 1940, 609, 1936, 604, 1934, 1584, 1584, 1584, + /* 2690 */ 1970, 1584, 1584, 298, 1935, 1937, 614, 1939, 1940, 609, + /* 2700 */ 1584, 604, 1584, 1584, 1584, 1584, 1584, 1584, 1584, 1936, + /* 2710 */ 1584, 1584, 1584, 1584, 1954, 1584, 1584, 1584, 1584, 1584, + /* 2720 */ 1584, 1584, 611, 1584, 1584, 1584, 1584, 1904, 1584, 610, + /* 2730 */ 1584, 1584, 1584, 1584, 1584, 1584, 1584, 1584, 1584, 1954, + /* 2740 */ 1584, 1584, 1584, 1584, 1584, 1584, 1584, 611, 1584, 1584, + /* 2750 */ 1584, 1584, 1904, 1934, 610, 1584, 1584, 1970, 1584, 1584, + /* 2760 */ 313, 1935, 1937, 614, 1939, 1940, 609, 704, 604, 1584, + /* 2770 */ 1936, 1584, 1584, 1584, 1584, 1584, 1584, 1584, 1934, 1584, + /* 2780 */ 1584, 281, 1970, 1584, 1584, 314, 1935, 1937, 614, 1939, + /* 2790 */ 1940, 609, 1584, 604, 1584, 167, 1584, 1584, 1584, 1584, + /* 2800 */ 1954, 694, 690, 686, 682, 279, 1584, 1584, 611, 1584, + /* 2810 */ 1584, 1584, 1584, 1904, 1584, 610, 1584, 1584, 1584, 1584, + /* 2820 */ 1584, 1584, 1584, 1936, 1584, 1584, 1584, 1584, 1584, 1584, + /* 2830 */ 1584, 1584, 1584, 1584, 1584, 1584, 1584, 1584, 1584, 1934, + /* 2840 */ 1584, 1936, 96, 1970, 1584, 247, 1948, 1935, 1937, 614, + /* 2850 */ 1939, 1940, 609, 1954, 604, 1584, 1584, 1584, 1584, 1584, + /* 2860 */ 1584, 611, 1584, 1584, 1584, 1584, 1904, 1584, 610, 1584, + /* 2870 */ 1584, 1954, 1584, 1584, 1584, 1584, 1584, 1584, 553, 611, + /* 2880 */ 1584, 1584, 1584, 1584, 1904, 1584, 610, 1584, 1584, 1584, + /* 2890 */ 1584, 1584, 1934, 1584, 1584, 1584, 1970, 1936, 1584, 1947, + /* 2900 */ 1935, 1937, 614, 1939, 1940, 609, 1584, 604, 1584, 1584, + /* 2910 */ 1934, 1936, 1584, 236, 1970, 1584, 1584, 1946, 1935, 1937, + /* 2920 */ 614, 1939, 1940, 609, 1584, 604, 1584, 1954, 1584, 1584, + /* 2930 */ 1333, 1584, 229, 1584, 1584, 611, 1584, 1584, 1584, 1584, + /* 2940 */ 1904, 1954, 610, 1584, 1584, 1584, 1584, 1584, 1584, 611, + /* 2950 */ 1584, 1584, 1584, 1584, 1904, 1584, 610, 1584, 1584, 1584, + /* 2960 */ 1584, 1584, 1584, 1584, 1584, 1584, 1934, 1936, 1584, 1584, + /* 2970 */ 1970, 1584, 1584, 323, 1935, 1937, 614, 1939, 1940, 609, + /* 2980 */ 1934, 604, 1584, 1936, 1970, 1584, 1584, 324, 1935, 1937, + /* 2990 */ 614, 1939, 1940, 609, 1584, 604, 1584, 1954, 1584, 1584, + /* 3000 */ 1584, 1584, 1584, 1584, 1584, 611, 1584, 1584, 1584, 1584, + /* 3010 */ 1904, 1584, 610, 1954, 1584, 1584, 1584, 1584, 1584, 1584, + /* 3020 */ 1584, 611, 1584, 1584, 1584, 1584, 1904, 1584, 610, 1584, + /* 3030 */ 1584, 1584, 1584, 1584, 1584, 1584, 1934, 1584, 1584, 1584, + /* 3040 */ 1970, 1584, 1584, 320, 1935, 1937, 614, 1939, 1940, 609, + /* 3050 */ 1936, 604, 1934, 1584, 1584, 1584, 1970, 1584, 1584, 325, + /* 3060 */ 1935, 1937, 614, 1939, 1940, 609, 1584, 604, 1584, 1584, + /* 3070 */ 1584, 1584, 1584, 1584, 1584, 1584, 1584, 1584, 1584, 1584, + /* 3080 */ 1954, 1584, 1584, 1584, 1584, 1584, 1584, 1584, 611, 1584, + /* 3090 */ 1584, 1584, 1584, 1904, 1584, 610, 1584, 1584, 1584, 1584, + /* 3100 */ 1584, 1584, 1584, 1584, 1584, 1584, 1584, 1584, 1584, 1584, + /* 3110 */ 1584, 1584, 1584, 1584, 1584, 1584, 1584, 1584, 1584, 1934, + /* 3120 */ 1584, 1584, 1584, 1970, 1584, 1584, 300, 1935, 1937, 614, + /* 3130 */ 1939, 1940, 609, 1584, 604, }; static const YYCODETYPE yy_lookahead[] = { - /* 0 */ 326, 351, 328, 329, 335, 326, 354, 328, 329, 367, - /* 10 */ 0, 330, 12, 13, 364, 344, 374, 365, 4, 377, - /* 20 */ 20, 0, 22, 352, 343, 330, 354, 358, 20, 354, - /* 30 */ 322, 350, 361, 33, 336, 35, 20, 365, 343, 341, - /* 40 */ 365, 360, 21, 391, 392, 24, 25, 26, 27, 28, - /* 50 */ 29, 30, 31, 32, 330, 360, 404, 57, 44, 45, - /* 60 */ 352, 20, 62, 391, 392, 393, 391, 392, 360, 69, - /* 70 */ 12, 13, 14, 365, 327, 367, 404, 330, 20, 404, - /* 80 */ 22, 61, 8, 9, 360, 352, 12, 13, 14, 15, - /* 90 */ 16, 33, 322, 35, 20, 95, 388, 321, 330, 323, - /* 100 */ 392, 368, 354, 95, 396, 397, 398, 399, 400, 401, - /* 110 */ 402, 343, 404, 365, 95, 57, 330, 117, 322, 411, - /* 120 */ 62, 397, 352, 415, 416, 330, 0, 69, 360, 343, - /* 130 */ 360, 131, 132, 106, 426, 365, 350, 367, 95, 391, - /* 140 */ 392, 393, 418, 419, 420, 421, 360, 423, 352, 441, - /* 150 */ 442, 14, 404, 95, 446, 447, 360, 20, 388, 335, - /* 160 */ 322, 365, 392, 367, 369, 37, 396, 397, 398, 399, - /* 170 */ 400, 401, 402, 349, 404, 117, 176, 407, 178, 409, - /* 180 */ 410, 411, 358, 352, 388, 415, 416, 61, 392, 131, - /* 190 */ 132, 360, 396, 397, 398, 399, 400, 401, 402, 79, - /* 200 */ 404, 201, 202, 365, 204, 205, 206, 207, 208, 209, + /* 0 */ 326, 322, 328, 329, 360, 352, 363, 330, 330, 366, + /* 10 */ 367, 330, 12, 13, 326, 371, 328, 329, 352, 354, + /* 20 */ 20, 343, 22, 0, 343, 359, 373, 374, 350, 327, + /* 30 */ 365, 352, 330, 33, 368, 35, 0, 360, 360, 360, + /* 40 */ 336, 360, 333, 353, 365, 341, 367, 24, 25, 26, + /* 50 */ 27, 28, 29, 30, 31, 32, 347, 57, 4, 394, + /* 60 */ 395, 396, 62, 4, 355, 399, 4, 344, 20, 69, + /* 70 */ 391, 406, 20, 19, 395, 352, 399, 398, 399, 400, + /* 80 */ 401, 402, 403, 404, 361, 406, 20, 33, 22, 14, + /* 90 */ 15, 16, 413, 79, 428, 95, 417, 418, 421, 422, + /* 100 */ 423, 47, 425, 44, 45, 428, 52, 428, 383, 443, + /* 110 */ 444, 57, 414, 415, 448, 449, 50, 117, 322, 330, + /* 120 */ 443, 444, 443, 444, 399, 448, 449, 448, 449, 8, + /* 130 */ 9, 131, 132, 12, 13, 14, 15, 16, 95, 57, + /* 140 */ 95, 20, 330, 95, 12, 13, 14, 20, 94, 135, + /* 150 */ 136, 97, 20, 428, 22, 343, 95, 95, 369, 159, + /* 160 */ 160, 365, 64, 65, 66, 33, 35, 35, 443, 444, + /* 170 */ 72, 73, 360, 448, 449, 77, 78, 95, 178, 97, + /* 180 */ 180, 83, 84, 131, 132, 149, 352, 89, 20, 57, + /* 190 */ 20, 8, 9, 359, 62, 12, 13, 14, 15, 16, + /* 200 */ 69, 69, 368, 203, 204, 0, 206, 207, 208, 209, /* 210 */ 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, - /* 220 */ 220, 221, 222, 223, 224, 319, 98, 20, 100, 101, - /* 230 */ 399, 103, 127, 20, 176, 107, 178, 163, 327, 126, - /* 240 */ 127, 330, 242, 21, 448, 449, 24, 25, 26, 27, - /* 250 */ 28, 29, 30, 31, 32, 135, 136, 129, 57, 201, - /* 260 */ 202, 242, 204, 205, 206, 207, 208, 209, 210, 211, - /* 270 */ 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, - /* 280 */ 222, 223, 224, 12, 13, 242, 380, 20, 183, 184, - /* 290 */ 61, 20, 187, 22, 189, 94, 0, 184, 97, 20, - /* 300 */ 187, 322, 189, 397, 33, 397, 35, 108, 109, 110, - /* 310 */ 111, 112, 113, 114, 115, 116, 117, 118, 57, 120, - /* 320 */ 121, 122, 123, 124, 125, 226, 363, 228, 57, 366, - /* 330 */ 367, 352, 426, 62, 426, 394, 4, 14, 333, 360, - /* 340 */ 69, 12, 13, 20, 365, 0, 367, 441, 442, 20, - /* 350 */ 442, 22, 446, 447, 446, 447, 95, 61, 97, 19, - /* 360 */ 355, 95, 33, 422, 35, 201, 95, 388, 171, 39, - /* 370 */ 20, 392, 22, 33, 95, 396, 397, 398, 399, 400, - /* 380 */ 401, 402, 0, 404, 20, 35, 57, 47, 117, 192, - /* 390 */ 193, 62, 47, 53, 54, 55, 56, 57, 69, 4, - /* 400 */ 50, 35, 131, 132, 226, 426, 24, 25, 26, 27, - /* 410 */ 28, 29, 30, 31, 32, 251, 252, 253, 254, 255, - /* 420 */ 441, 442, 352, 69, 95, 446, 447, 95, 322, 359, - /* 430 */ 163, 64, 65, 66, 94, 69, 14, 97, 368, 72, - /* 440 */ 73, 175, 20, 177, 77, 78, 117, 176, 69, 178, - /* 450 */ 83, 84, 380, 0, 20, 20, 89, 360, 8, 9, - /* 460 */ 131, 132, 12, 13, 14, 15, 16, 397, 371, 397, - /* 470 */ 130, 365, 201, 202, 353, 204, 205, 206, 207, 208, - /* 480 */ 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, - /* 490 */ 219, 220, 221, 222, 223, 224, 426, 226, 426, 352, - /* 500 */ 412, 413, 162, 242, 353, 176, 359, 178, 242, 353, - /* 510 */ 333, 441, 442, 441, 442, 368, 446, 447, 446, 447, - /* 520 */ 180, 242, 182, 57, 347, 366, 367, 322, 205, 95, - /* 530 */ 201, 202, 355, 204, 205, 206, 207, 208, 209, 210, - /* 540 */ 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, - /* 550 */ 221, 222, 223, 224, 12, 13, 3, 352, 338, 339, - /* 560 */ 107, 344, 20, 97, 22, 360, 131, 132, 161, 352, - /* 570 */ 365, 241, 367, 20, 242, 33, 360, 35, 361, 126, - /* 580 */ 127, 128, 129, 130, 8, 9, 322, 371, 12, 13, - /* 590 */ 14, 15, 16, 388, 408, 330, 410, 392, 20, 57, - /* 600 */ 22, 396, 397, 398, 399, 400, 401, 402, 343, 404, - /* 610 */ 352, 69, 12, 13, 14, 158, 352, 359, 168, 21, - /* 620 */ 20, 357, 22, 330, 360, 360, 368, 205, 50, 365, - /* 630 */ 353, 367, 34, 33, 36, 35, 343, 95, 243, 126, - /* 640 */ 8, 9, 437, 438, 12, 13, 14, 15, 16, 96, - /* 650 */ 344, 353, 388, 360, 247, 248, 392, 57, 352, 117, - /* 660 */ 396, 397, 398, 399, 400, 401, 402, 361, 404, 69, - /* 670 */ 12, 13, 96, 131, 132, 22, 242, 8, 9, 330, - /* 680 */ 22, 12, 13, 14, 15, 16, 229, 345, 35, 330, - /* 690 */ 348, 33, 343, 35, 2, 95, 239, 394, 185, 186, - /* 700 */ 8, 9, 343, 367, 12, 13, 14, 15, 16, 360, - /* 710 */ 394, 330, 43, 377, 264, 57, 163, 117, 176, 360, - /* 720 */ 178, 3, 69, 2, 343, 422, 22, 69, 96, 8, - /* 730 */ 9, 131, 132, 12, 13, 14, 15, 16, 422, 35, - /* 740 */ 397, 360, 407, 201, 202, 410, 204, 205, 206, 207, - /* 750 */ 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, - /* 760 */ 218, 219, 220, 221, 222, 223, 224, 1, 2, 426, - /* 770 */ 117, 14, 15, 16, 353, 117, 176, 107, 178, 12, - /* 780 */ 13, 14, 15, 16, 242, 442, 353, 8, 9, 446, - /* 790 */ 447, 12, 13, 14, 15, 16, 126, 127, 128, 129, - /* 800 */ 130, 201, 202, 43, 204, 205, 206, 207, 208, 209, - /* 810 */ 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, - /* 820 */ 220, 221, 222, 223, 224, 12, 13, 107, 330, 176, - /* 830 */ 376, 178, 378, 20, 176, 22, 178, 43, 408, 330, - /* 840 */ 410, 343, 338, 339, 384, 322, 33, 322, 35, 129, - /* 850 */ 330, 380, 343, 360, 201, 202, 96, 322, 360, 201, - /* 860 */ 202, 20, 96, 343, 371, 44, 45, 322, 397, 360, - /* 870 */ 57, 322, 341, 215, 216, 217, 218, 219, 220, 221, - /* 880 */ 360, 330, 69, 12, 13, 330, 330, 352, 365, 323, - /* 890 */ 365, 20, 380, 22, 343, 360, 0, 426, 343, 343, - /* 900 */ 365, 340, 367, 342, 33, 322, 35, 106, 95, 397, - /* 910 */ 365, 360, 441, 442, 365, 360, 360, 446, 447, 0, - /* 920 */ 376, 322, 378, 388, 322, 240, 241, 392, 57, 322, - /* 930 */ 117, 396, 397, 398, 399, 400, 401, 402, 426, 404, - /* 940 */ 69, 22, 163, 322, 131, 132, 411, 322, 365, 0, - /* 950 */ 415, 416, 330, 441, 442, 154, 322, 330, 446, 447, - /* 960 */ 64, 65, 66, 43, 365, 343, 95, 365, 72, 73, - /* 970 */ 343, 22, 365, 77, 78, 362, 395, 259, 365, 83, - /* 980 */ 84, 331, 360, 20, 33, 89, 365, 360, 117, 176, - /* 990 */ 365, 178, 380, 0, 380, 43, 322, 450, 47, 365, - /* 1000 */ 322, 322, 131, 132, 53, 54, 55, 56, 57, 397, - /* 1010 */ 362, 397, 43, 365, 201, 202, 96, 204, 205, 206, - /* 1020 */ 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, - /* 1030 */ 217, 218, 219, 220, 221, 222, 223, 224, 426, 365, - /* 1040 */ 426, 352, 439, 365, 365, 94, 205, 176, 97, 178, - /* 1050 */ 361, 42, 43, 441, 442, 441, 442, 263, 446, 447, - /* 1060 */ 446, 447, 8, 9, 322, 96, 12, 13, 14, 15, - /* 1070 */ 16, 322, 201, 202, 0, 204, 205, 206, 207, 208, - /* 1080 */ 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, - /* 1090 */ 219, 220, 221, 222, 223, 224, 18, 0, 20, 345, - /* 1100 */ 107, 330, 348, 163, 164, 27, 330, 365, 30, 99, - /* 1110 */ 159, 160, 102, 162, 365, 99, 43, 166, 102, 126, - /* 1120 */ 127, 128, 129, 130, 322, 47, 163, 49, 43, 99, - /* 1130 */ 52, 360, 102, 182, 99, 43, 360, 102, 64, 65, - /* 1140 */ 66, 67, 68, 433, 70, 71, 72, 73, 74, 75, - /* 1150 */ 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, - /* 1160 */ 86, 87, 88, 89, 90, 91, 18, 365, 397, 96, - /* 1170 */ 330, 23, 94, 397, 62, 131, 132, 1, 2, 43, - /* 1180 */ 35, 96, 3, 343, 106, 37, 38, 0, 96, 41, - /* 1190 */ 419, 420, 421, 0, 423, 419, 420, 421, 43, 423, - /* 1200 */ 360, 43, 352, 43, 331, 43, 58, 59, 60, 22, - /* 1210 */ 43, 43, 134, 261, 322, 137, 138, 139, 140, 141, - /* 1220 */ 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, - /* 1230 */ 152, 153, 96, 155, 156, 157, 35, 329, 46, 364, - /* 1240 */ 330, 48, 330, 95, 352, 43, 149, 330, 395, 43, - /* 1250 */ 424, 96, 360, 343, 96, 343, 96, 365, 96, 367, - /* 1260 */ 343, 8, 9, 96, 96, 12, 13, 14, 15, 16, - /* 1270 */ 360, 4, 360, 95, 443, 96, 330, 360, 417, 427, - /* 1280 */ 388, 133, 397, 105, 392, 244, 19, 95, 396, 397, - /* 1290 */ 398, 399, 400, 401, 402, 35, 404, 43, 96, 390, - /* 1300 */ 33, 409, 96, 411, 47, 389, 360, 415, 416, 174, - /* 1310 */ 382, 426, 13, 201, 47, 62, 168, 169, 170, 52, - /* 1320 */ 428, 173, 42, 178, 57, 322, 441, 442, 436, 69, - /* 1330 */ 13, 446, 447, 372, 35, 158, 372, 370, 20, 191, - /* 1340 */ 372, 330, 194, 397, 196, 197, 198, 199, 200, 330, - /* 1350 */ 96, 322, 35, 370, 370, 352, 93, 104, 337, 20, - /* 1360 */ 324, 94, 330, 360, 97, 419, 420, 421, 365, 423, - /* 1370 */ 367, 324, 426, 330, 20, 330, 386, 335, 20, 178, - /* 1380 */ 367, 352, 20, 335, 379, 381, 335, 441, 442, 360, - /* 1390 */ 242, 388, 446, 447, 365, 392, 367, 379, 335, 396, - /* 1400 */ 397, 398, 399, 400, 401, 402, 335, 404, 51, 330, - /* 1410 */ 335, 158, 409, 332, 411, 335, 332, 388, 415, 416, - /* 1420 */ 324, 392, 352, 330, 352, 396, 397, 398, 399, 400, - /* 1430 */ 401, 402, 324, 404, 352, 352, 190, 387, 409, 436, - /* 1440 */ 411, 352, 352, 352, 415, 416, 352, 352, 386, 333, - /* 1450 */ 352, 352, 365, 181, 425, 367, 333, 330, 330, 333, - /* 1460 */ 249, 385, 160, 322, 333, 379, 365, 365, 365, 365, - /* 1470 */ 348, 365, 333, 360, 20, 375, 365, 250, 432, 365, - /* 1480 */ 375, 432, 229, 230, 231, 232, 233, 234, 235, 236, - /* 1490 */ 237, 238, 239, 352, 373, 375, 256, 365, 365, 375, - /* 1500 */ 435, 360, 395, 365, 395, 167, 365, 258, 367, 257, - /* 1510 */ 245, 434, 265, 262, 445, 451, 260, 241, 20, 390, - /* 1520 */ 95, 360, 95, 342, 394, 356, 330, 333, 365, 388, - /* 1530 */ 322, 36, 325, 392, 324, 383, 346, 396, 397, 398, - /* 1540 */ 399, 400, 401, 402, 378, 404, 346, 432, 431, 430, - /* 1550 */ 409, 414, 411, 334, 429, 346, 415, 416, 320, 0, - /* 1560 */ 352, 0, 444, 183, 0, 0, 425, 42, 360, 35, - /* 1570 */ 195, 35, 35, 365, 0, 367, 35, 195, 0, 35, - /* 1580 */ 35, 195, 0, 195, 322, 0, 35, 0, 22, 0, - /* 1590 */ 35, 178, 176, 0, 0, 172, 388, 171, 0, 0, - /* 1600 */ 392, 0, 46, 0, 396, 397, 398, 399, 400, 401, - /* 1610 */ 402, 0, 404, 42, 352, 0, 0, 409, 0, 411, - /* 1620 */ 149, 42, 360, 415, 416, 0, 0, 365, 0, 367, - /* 1630 */ 0, 0, 35, 425, 0, 149, 0, 0, 322, 0, - /* 1640 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - /* 1650 */ 388, 0, 0, 0, 392, 42, 0, 0, 396, 397, - /* 1660 */ 398, 399, 400, 401, 402, 0, 404, 0, 352, 0, - /* 1670 */ 0, 409, 22, 411, 57, 0, 360, 415, 416, 0, - /* 1680 */ 0, 365, 0, 367, 57, 0, 0, 14, 0, 35, - /* 1690 */ 14, 322, 63, 167, 0, 0, 0, 42, 39, 0, - /* 1700 */ 0, 43, 40, 39, 388, 0, 46, 46, 392, 0, - /* 1710 */ 39, 0, 396, 397, 398, 399, 400, 401, 402, 35, - /* 1720 */ 404, 352, 39, 0, 47, 409, 35, 411, 47, 360, - /* 1730 */ 0, 415, 416, 0, 365, 0, 367, 39, 35, 35, - /* 1740 */ 47, 39, 0, 0, 322, 39, 0, 35, 47, 22, - /* 1750 */ 0, 35, 35, 22, 35, 35, 43, 388, 43, 35, - /* 1760 */ 35, 392, 22, 35, 0, 396, 397, 398, 399, 400, - /* 1770 */ 401, 402, 104, 404, 352, 22, 0, 22, 409, 0, - /* 1780 */ 411, 49, 360, 22, 415, 416, 35, 365, 0, 367, - /* 1790 */ 0, 102, 35, 35, 0, 22, 0, 20, 163, 0, - /* 1800 */ 35, 179, 22, 96, 0, 322, 0, 0, 3, 95, - /* 1810 */ 388, 0, 0, 95, 392, 0, 35, 96, 396, 397, - /* 1820 */ 398, 399, 400, 401, 402, 0, 404, 35, 165, 322, - /* 1830 */ 39, 95, 160, 411, 95, 352, 95, 415, 416, 105, - /* 1840 */ 43, 163, 246, 360, 46, 43, 159, 95, 365, 225, - /* 1850 */ 367, 43, 96, 163, 188, 95, 43, 225, 161, 352, - /* 1860 */ 227, 43, 96, 96, 95, 46, 96, 360, 96, 95, - /* 1870 */ 46, 388, 365, 95, 367, 392, 3, 95, 95, 396, - /* 1880 */ 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, - /* 1890 */ 43, 322, 35, 35, 35, 388, 96, 96, 35, 392, - /* 1900 */ 35, 35, 46, 396, 397, 398, 399, 400, 401, 402, - /* 1910 */ 96, 404, 96, 43, 46, 46, 2, 22, 411, 96, - /* 1920 */ 46, 352, 95, 416, 95, 46, 95, 201, 96, 360, - /* 1930 */ 96, 95, 95, 22, 365, 96, 367, 95, 35, 106, - /* 1940 */ 203, 96, 322, 35, 95, 35, 96, 95, 35, 96, - /* 1950 */ 95, 35, 35, 22, 246, 95, 246, 388, 96, 119, - /* 1960 */ 96, 392, 240, 119, 35, 396, 397, 398, 399, 400, - /* 1970 */ 401, 402, 352, 404, 22, 406, 43, 95, 95, 107, - /* 1980 */ 360, 95, 95, 63, 62, 365, 119, 367, 35, 35, - /* 1990 */ 119, 35, 35, 35, 35, 35, 322, 35, 35, 35, - /* 2000 */ 35, 69, 35, 22, 92, 35, 22, 35, 388, 43, - /* 2010 */ 35, 35, 392, 69, 322, 35, 396, 397, 398, 399, - /* 2020 */ 400, 401, 402, 35, 404, 35, 352, 35, 35, 22, - /* 2030 */ 35, 0, 35, 39, 360, 0, 47, 35, 47, 365, - /* 2040 */ 39, 367, 0, 35, 352, 47, 0, 35, 39, 39, - /* 2050 */ 47, 0, 360, 35, 35, 0, 22, 365, 438, 367, - /* 2060 */ 21, 452, 388, 22, 20, 22, 392, 452, 21, 452, - /* 2070 */ 396, 397, 398, 399, 400, 401, 402, 452, 404, 452, - /* 2080 */ 388, 452, 452, 452, 392, 452, 452, 452, 396, 397, - /* 2090 */ 398, 399, 400, 401, 402, 452, 404, 322, 452, 452, - /* 2100 */ 452, 452, 452, 452, 452, 452, 452, 452, 452, 452, - /* 2110 */ 452, 452, 452, 452, 440, 452, 452, 452, 452, 452, - /* 2120 */ 452, 452, 452, 452, 452, 452, 452, 352, 452, 452, - /* 2130 */ 452, 452, 357, 452, 452, 360, 452, 452, 452, 452, - /* 2140 */ 365, 449, 367, 452, 452, 452, 452, 452, 452, 452, - /* 2150 */ 452, 452, 322, 452, 452, 452, 452, 452, 452, 452, - /* 2160 */ 452, 452, 452, 388, 452, 452, 452, 392, 452, 452, - /* 2170 */ 452, 396, 397, 398, 399, 400, 401, 402, 452, 404, - /* 2180 */ 452, 452, 352, 452, 452, 452, 452, 357, 452, 452, - /* 2190 */ 360, 452, 452, 452, 452, 365, 452, 367, 452, 452, - /* 2200 */ 452, 452, 452, 322, 452, 452, 452, 452, 452, 452, - /* 2210 */ 452, 452, 452, 452, 452, 452, 452, 452, 388, 452, - /* 2220 */ 452, 452, 392, 452, 452, 452, 396, 397, 398, 399, - /* 2230 */ 400, 401, 402, 352, 404, 452, 452, 452, 452, 452, - /* 2240 */ 452, 360, 452, 452, 452, 452, 365, 452, 367, 452, - /* 2250 */ 452, 452, 452, 452, 452, 452, 452, 322, 452, 452, - /* 2260 */ 452, 452, 452, 452, 452, 452, 452, 452, 452, 388, - /* 2270 */ 452, 452, 452, 392, 452, 452, 452, 396, 397, 398, - /* 2280 */ 399, 400, 401, 402, 452, 404, 452, 352, 452, 452, - /* 2290 */ 452, 452, 452, 452, 452, 360, 452, 452, 452, 452, - /* 2300 */ 365, 452, 367, 452, 452, 452, 452, 452, 322, 452, - /* 2310 */ 452, 452, 452, 452, 452, 452, 452, 452, 452, 452, - /* 2320 */ 452, 452, 452, 388, 452, 452, 452, 392, 452, 452, - /* 2330 */ 452, 396, 397, 398, 399, 400, 401, 402, 352, 404, - /* 2340 */ 452, 452, 452, 452, 452, 452, 360, 452, 452, 452, - /* 2350 */ 452, 365, 452, 367, 452, 452, 452, 452, 452, 452, - /* 2360 */ 452, 452, 322, 452, 452, 452, 452, 452, 452, 452, - /* 2370 */ 452, 452, 452, 452, 388, 452, 452, 452, 392, 452, - /* 2380 */ 322, 452, 396, 397, 398, 399, 400, 401, 402, 452, - /* 2390 */ 404, 452, 352, 452, 452, 452, 452, 452, 452, 452, - /* 2400 */ 360, 452, 452, 452, 452, 365, 452, 367, 452, 452, - /* 2410 */ 352, 452, 452, 452, 452, 452, 452, 452, 360, 452, - /* 2420 */ 452, 452, 452, 365, 452, 367, 452, 452, 388, 452, - /* 2430 */ 452, 452, 392, 452, 452, 452, 396, 397, 398, 399, - /* 2440 */ 400, 401, 402, 452, 404, 452, 388, 452, 452, 452, - /* 2450 */ 392, 452, 452, 452, 396, 397, 398, 399, 400, 401, - /* 2460 */ 402, 452, 404, 322, 452, 452, 452, 452, 452, 452, - /* 2470 */ 452, 452, 452, 452, 452, 452, 452, 452, 452, 452, - /* 2480 */ 452, 452, 452, 452, 452, 452, 452, 452, 452, 452, - /* 2490 */ 452, 452, 452, 352, 452, 452, 452, 452, 452, 452, - /* 2500 */ 452, 360, 452, 452, 452, 452, 365, 452, 367, 452, - /* 2510 */ 452, 452, 452, 452, 452, 452, 452, 452, 322, 452, - /* 2520 */ 452, 452, 452, 452, 452, 452, 452, 452, 452, 388, - /* 2530 */ 452, 452, 452, 392, 452, 452, 452, 396, 397, 398, - /* 2540 */ 399, 400, 401, 402, 452, 404, 452, 452, 352, 452, - /* 2550 */ 452, 452, 452, 452, 452, 452, 360, 452, 452, 452, - /* 2560 */ 452, 365, 452, 367, 452, 452, 452, 452, 452, 322, - /* 2570 */ 452, 452, 452, 452, 452, 452, 452, 452, 452, 452, - /* 2580 */ 452, 452, 452, 452, 388, 452, 452, 452, 392, 452, - /* 2590 */ 452, 452, 396, 397, 398, 399, 400, 401, 402, 352, - /* 2600 */ 404, 452, 452, 452, 452, 452, 452, 360, 452, 452, - /* 2610 */ 452, 452, 365, 452, 367, 452, 452, 452, 452, 452, - /* 2620 */ 452, 452, 452, 322, 452, 452, 452, 452, 452, 452, - /* 2630 */ 452, 452, 452, 452, 452, 388, 452, 452, 452, 392, - /* 2640 */ 452, 452, 452, 396, 397, 398, 399, 400, 401, 402, - /* 2650 */ 452, 404, 452, 352, 452, 452, 452, 452, 452, 452, - /* 2660 */ 452, 360, 452, 452, 452, 452, 365, 452, 367, 452, - /* 2670 */ 452, 452, 452, 452, 322, 452, 452, 452, 452, 452, - /* 2680 */ 452, 452, 452, 452, 452, 452, 452, 452, 452, 388, - /* 2690 */ 452, 452, 452, 392, 452, 452, 452, 396, 397, 398, - /* 2700 */ 399, 400, 401, 402, 352, 404, 452, 452, 452, 452, - /* 2710 */ 452, 452, 360, 452, 452, 452, 452, 365, 452, 367, - /* 2720 */ 452, 452, 452, 452, 452, 452, 452, 452, 322, 452, - /* 2730 */ 452, 452, 452, 452, 452, 452, 452, 452, 452, 452, - /* 2740 */ 388, 452, 452, 452, 392, 452, 322, 452, 396, 397, - /* 2750 */ 398, 399, 400, 401, 402, 452, 404, 452, 352, 452, - /* 2760 */ 452, 452, 452, 452, 452, 452, 360, 452, 452, 452, - /* 2770 */ 452, 365, 452, 367, 452, 452, 352, 452, 452, 452, - /* 2780 */ 452, 452, 452, 452, 360, 452, 452, 452, 452, 365, - /* 2790 */ 452, 367, 452, 452, 388, 452, 452, 452, 392, 452, - /* 2800 */ 452, 452, 396, 397, 398, 399, 400, 401, 402, 452, - /* 2810 */ 404, 452, 388, 452, 452, 452, 392, 452, 452, 452, - /* 2820 */ 396, 397, 398, 399, 400, 401, 402, 452, 404, 322, - /* 2830 */ 452, 452, 452, 452, 452, 452, 452, 452, 452, 452, - /* 2840 */ 452, 452, 452, 452, 452, 452, 452, 452, 452, 452, - /* 2850 */ 452, 452, 452, 452, 452, 452, 452, 452, 452, 352, - /* 2860 */ 452, 452, 452, 452, 452, 452, 452, 360, 452, 452, - /* 2870 */ 452, 452, 365, 452, 367, 452, 452, 452, 452, 452, - /* 2880 */ 452, 452, 452, 452, 322, 452, 452, 452, 452, 452, - /* 2890 */ 452, 452, 452, 452, 452, 388, 452, 452, 452, 392, - /* 2900 */ 452, 452, 452, 396, 397, 398, 399, 400, 401, 402, - /* 2910 */ 452, 404, 452, 452, 352, 452, 452, 452, 452, 452, - /* 2920 */ 452, 452, 360, 452, 452, 452, 452, 365, 452, 367, - /* 2930 */ 452, 452, 452, 452, 452, 322, 452, 452, 452, 452, - /* 2940 */ 452, 452, 452, 452, 452, 452, 452, 452, 452, 452, - /* 2950 */ 388, 452, 452, 452, 392, 452, 452, 452, 396, 397, - /* 2960 */ 398, 399, 400, 401, 402, 352, 404, 452, 452, 452, - /* 2970 */ 452, 452, 452, 360, 452, 452, 452, 452, 365, 452, - /* 2980 */ 367, 452, 452, 452, 452, 452, 452, 452, 452, 322, - /* 2990 */ 452, 452, 452, 452, 452, 452, 452, 452, 452, 452, - /* 3000 */ 452, 388, 452, 452, 452, 392, 452, 452, 452, 396, - /* 3010 */ 397, 398, 399, 400, 401, 402, 452, 404, 452, 352, - /* 3020 */ 452, 452, 452, 452, 452, 452, 452, 360, 452, 452, - /* 3030 */ 452, 452, 365, 452, 367, 452, 452, 452, 452, 452, - /* 3040 */ 322, 452, 452, 452, 452, 452, 452, 452, 452, 452, - /* 3050 */ 452, 452, 452, 452, 452, 388, 452, 452, 452, 392, - /* 3060 */ 452, 452, 452, 396, 397, 398, 399, 400, 401, 402, - /* 3070 */ 352, 404, 452, 452, 452, 452, 452, 452, 360, 452, - /* 3080 */ 452, 452, 452, 365, 452, 367, 452, 452, 452, 452, - /* 3090 */ 452, 452, 452, 452, 322, 452, 452, 452, 452, 452, - /* 3100 */ 452, 452, 452, 452, 452, 452, 388, 452, 452, 452, - /* 3110 */ 392, 452, 322, 452, 396, 397, 398, 399, 400, 401, - /* 3120 */ 402, 452, 404, 452, 352, 452, 452, 452, 452, 452, - /* 3130 */ 452, 452, 360, 452, 452, 452, 452, 365, 452, 367, - /* 3140 */ 452, 452, 352, 452, 452, 452, 452, 452, 452, 452, - /* 3150 */ 360, 452, 452, 452, 452, 365, 452, 367, 452, 452, - /* 3160 */ 388, 452, 452, 452, 392, 452, 452, 452, 396, 397, - /* 3170 */ 398, 399, 400, 401, 402, 452, 404, 452, 388, 452, - /* 3180 */ 452, 452, 392, 452, 452, 452, 396, 397, 398, 399, - /* 3190 */ 400, 401, 402, 452, 404, 322, 452, 452, 452, 452, - /* 3200 */ 452, 452, 452, 452, 452, 452, 452, 452, 452, 452, - /* 3210 */ 452, 452, 452, 452, 452, 452, 452, 452, 452, 452, - /* 3220 */ 452, 452, 452, 452, 452, 352, 452, 452, 452, 452, - /* 3230 */ 452, 452, 452, 360, 452, 452, 452, 452, 365, 452, - /* 3240 */ 367, 452, 452, 452, 452, 452, 452, 452, 452, 452, - /* 3250 */ 322, 452, 452, 452, 452, 452, 452, 452, 452, 452, - /* 3260 */ 452, 388, 452, 452, 452, 392, 452, 452, 452, 396, - /* 3270 */ 397, 398, 399, 400, 401, 402, 452, 404, 452, 452, - /* 3280 */ 352, 452, 452, 452, 452, 452, 452, 452, 360, 452, - /* 3290 */ 452, 452, 452, 365, 452, 367, 452, 452, 452, 452, - /* 3300 */ 452, 452, 452, 452, 452, 452, 452, 452, 452, 452, - /* 3310 */ 452, 452, 452, 452, 452, 452, 388, 452, 452, 452, - /* 3320 */ 392, 452, 452, 452, 396, 397, 398, 399, 400, 401, - /* 3330 */ 402, 452, 404, + /* 220 */ 220, 221, 222, 223, 224, 335, 21, 95, 383, 24, + /* 230 */ 25, 26, 27, 28, 29, 30, 31, 32, 177, 349, + /* 240 */ 179, 18, 242, 20, 399, 366, 367, 20, 358, 117, + /* 250 */ 27, 21, 106, 30, 24, 25, 26, 27, 28, 29, + /* 260 */ 30, 31, 32, 131, 132, 95, 399, 352, 367, 399, + /* 270 */ 47, 61, 49, 428, 359, 52, 12, 13, 377, 96, + /* 280 */ 322, 380, 161, 368, 20, 242, 22, 242, 443, 444, + /* 290 */ 242, 159, 160, 448, 449, 428, 20, 33, 428, 35, + /* 300 */ 154, 8, 9, 242, 242, 12, 13, 14, 15, 16, + /* 310 */ 178, 444, 180, 443, 444, 448, 449, 94, 448, 449, + /* 320 */ 164, 57, 95, 365, 242, 20, 62, 159, 160, 106, + /* 330 */ 1, 2, 321, 69, 323, 203, 204, 57, 206, 207, + /* 340 */ 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, + /* 350 */ 218, 219, 220, 221, 222, 223, 224, 134, 20, 95, + /* 360 */ 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, + /* 370 */ 147, 148, 149, 150, 151, 152, 153, 97, 155, 156, + /* 380 */ 157, 117, 8, 9, 35, 383, 12, 13, 14, 15, + /* 390 */ 16, 33, 20, 351, 22, 131, 132, 327, 399, 173, + /* 400 */ 330, 399, 344, 247, 248, 47, 364, 35, 12, 13, + /* 410 */ 352, 53, 54, 55, 56, 57, 20, 43, 22, 361, + /* 420 */ 194, 195, 50, 159, 160, 96, 2, 428, 61, 33, + /* 430 */ 428, 35, 8, 9, 127, 319, 12, 13, 14, 15, + /* 440 */ 16, 335, 178, 444, 180, 443, 444, 448, 449, 344, + /* 450 */ 448, 449, 94, 57, 352, 97, 20, 352, 62, 203, + /* 460 */ 338, 339, 360, 170, 358, 69, 361, 203, 204, 242, + /* 470 */ 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, + /* 480 */ 216, 217, 218, 219, 220, 221, 222, 223, 224, 21, + /* 490 */ 226, 95, 185, 186, 44, 45, 189, 3, 191, 383, + /* 500 */ 322, 330, 34, 401, 36, 397, 383, 251, 252, 253, + /* 510 */ 254, 255, 14, 117, 20, 399, 107, 383, 20, 126, + /* 520 */ 162, 163, 399, 165, 14, 322, 168, 131, 132, 180, + /* 530 */ 20, 360, 424, 399, 0, 126, 127, 128, 129, 130, + /* 540 */ 12, 13, 184, 365, 428, 330, 322, 352, 20, 0, + /* 550 */ 22, 428, 410, 106, 412, 159, 160, 264, 343, 443, + /* 560 */ 444, 33, 428, 35, 448, 449, 443, 444, 365, 374, + /* 570 */ 399, 448, 449, 14, 178, 360, 180, 443, 444, 20, + /* 580 */ 187, 188, 448, 449, 0, 57, 20, 354, 322, 365, + /* 590 */ 96, 420, 421, 422, 423, 61, 425, 69, 365, 203, + /* 600 */ 204, 322, 206, 207, 208, 209, 210, 211, 212, 213, + /* 610 */ 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, + /* 620 */ 224, 57, 322, 95, 226, 0, 228, 394, 395, 8, + /* 630 */ 9, 365, 226, 12, 13, 14, 15, 16, 158, 406, + /* 640 */ 2, 322, 333, 0, 365, 117, 8, 9, 338, 339, + /* 650 */ 12, 13, 14, 15, 16, 161, 107, 159, 94, 131, + /* 660 */ 132, 97, 8, 9, 355, 365, 12, 13, 14, 15, + /* 670 */ 16, 397, 12, 13, 14, 126, 127, 128, 129, 130, + /* 680 */ 20, 354, 22, 62, 365, 322, 330, 159, 160, 352, + /* 690 */ 47, 107, 365, 33, 330, 35, 8, 9, 424, 343, + /* 700 */ 12, 13, 14, 15, 16, 368, 178, 343, 180, 229, + /* 710 */ 126, 127, 128, 129, 130, 352, 360, 57, 159, 239, + /* 720 */ 69, 394, 395, 360, 360, 104, 69, 161, 365, 69, + /* 730 */ 367, 203, 204, 406, 206, 207, 208, 209, 210, 211, + /* 740 */ 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, + /* 750 */ 222, 223, 224, 4, 391, 95, 322, 43, 395, 322, + /* 760 */ 360, 398, 399, 400, 401, 402, 403, 404, 0, 406, + /* 770 */ 242, 371, 345, 37, 411, 348, 413, 117, 322, 158, + /* 780 */ 417, 418, 8, 9, 96, 322, 12, 13, 14, 15, + /* 790 */ 16, 131, 132, 430, 12, 13, 14, 15, 16, 365, + /* 800 */ 330, 438, 365, 330, 12, 13, 360, 410, 397, 412, + /* 810 */ 96, 330, 20, 343, 22, 161, 343, 371, 330, 159, + /* 820 */ 160, 365, 20, 350, 343, 33, 3, 35, 365, 61, + /* 830 */ 360, 343, 330, 360, 98, 424, 100, 101, 178, 103, + /* 840 */ 180, 360, 20, 107, 379, 343, 381, 20, 360, 57, + /* 850 */ 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, + /* 860 */ 239, 69, 360, 203, 204, 129, 206, 207, 208, 209, + /* 870 */ 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, + /* 880 */ 220, 221, 222, 223, 224, 126, 127, 95, 108, 109, + /* 890 */ 110, 111, 112, 113, 114, 115, 116, 117, 118, 322, + /* 900 */ 120, 121, 122, 123, 124, 125, 367, 352, 330, 117, + /* 910 */ 322, 240, 241, 330, 354, 379, 361, 381, 22, 380, + /* 920 */ 39, 343, 322, 131, 132, 365, 343, 340, 330, 342, + /* 930 */ 322, 35, 322, 322, 330, 43, 12, 13, 360, 42, + /* 940 */ 43, 343, 365, 360, 20, 186, 22, 343, 189, 330, + /* 950 */ 191, 159, 160, 365, 394, 395, 396, 33, 360, 35, + /* 960 */ 0, 330, 343, 161, 360, 365, 406, 107, 362, 43, + /* 970 */ 178, 365, 180, 365, 343, 365, 365, 409, 387, 360, + /* 980 */ 412, 57, 362, 161, 345, 365, 159, 348, 96, 129, + /* 990 */ 43, 360, 243, 69, 353, 203, 204, 322, 206, 207, + /* 1000 */ 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, + /* 1010 */ 218, 219, 220, 221, 222, 223, 224, 330, 43, 95, + /* 1020 */ 42, 43, 96, 330, 64, 65, 66, 352, 330, 43, + /* 1030 */ 343, 99, 72, 73, 102, 360, 343, 77, 78, 330, + /* 1040 */ 365, 117, 367, 83, 84, 99, 0, 360, 102, 89, + /* 1050 */ 43, 99, 343, 360, 102, 131, 132, 99, 360, 330, + /* 1060 */ 102, 43, 161, 43, 43, 43, 391, 166, 22, 360, + /* 1070 */ 395, 96, 343, 398, 399, 400, 401, 402, 403, 404, + /* 1080 */ 35, 406, 259, 159, 160, 0, 411, 0, 413, 360, + /* 1090 */ 0, 62, 417, 418, 131, 132, 3, 399, 95, 1, + /* 1100 */ 2, 43, 178, 96, 180, 353, 353, 353, 105, 22, + /* 1110 */ 353, 353, 22, 438, 96, 375, 96, 96, 96, 421, + /* 1120 */ 422, 423, 241, 425, 341, 452, 323, 203, 204, 46, + /* 1130 */ 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, + /* 1140 */ 216, 217, 218, 219, 220, 221, 222, 223, 224, 64, + /* 1150 */ 65, 66, 67, 68, 96, 70, 71, 72, 73, 74, + /* 1160 */ 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, + /* 1170 */ 85, 86, 87, 88, 89, 90, 91, 18, 95, 441, + /* 1180 */ 43, 43, 23, 43, 322, 43, 43, 43, 22, 96, + /* 1190 */ 13, 13, 35, 0, 331, 435, 37, 38, 330, 352, + /* 1200 */ 41, 35, 331, 375, 329, 364, 375, 426, 261, 445, + /* 1210 */ 419, 244, 35, 35, 352, 429, 47, 58, 59, 60, + /* 1220 */ 176, 392, 360, 393, 385, 180, 69, 365, 360, 367, + /* 1230 */ 42, 372, 203, 96, 96, 69, 96, 20, 96, 96, + /* 1240 */ 96, 48, 375, 370, 372, 20, 158, 330, 330, 263, + /* 1250 */ 372, 337, 370, 391, 95, 370, 93, 395, 330, 330, + /* 1260 */ 398, 399, 400, 401, 402, 403, 404, 399, 406, 330, + /* 1270 */ 20, 409, 324, 411, 412, 413, 20, 324, 389, 417, + /* 1280 */ 418, 20, 367, 117, 335, 335, 382, 20, 382, 421, + /* 1290 */ 422, 423, 133, 425, 384, 322, 335, 335, 330, 335, + /* 1300 */ 335, 335, 51, 332, 332, 324, 352, 352, 352, 352, + /* 1310 */ 365, 352, 330, 324, 192, 390, 389, 333, 183, 388, + /* 1320 */ 382, 352, 352, 333, 330, 352, 352, 330, 352, 170, + /* 1330 */ 171, 172, 352, 360, 175, 352, 163, 333, 365, 333, + /* 1340 */ 367, 249, 365, 348, 178, 333, 180, 250, 437, 169, + /* 1350 */ 322, 256, 193, 365, 367, 196, 365, 198, 199, 200, + /* 1360 */ 201, 202, 258, 378, 391, 365, 365, 375, 395, 203, + /* 1370 */ 204, 398, 399, 400, 401, 402, 403, 404, 376, 406, + /* 1380 */ 352, 365, 365, 378, 411, 360, 413, 378, 360, 375, + /* 1390 */ 417, 418, 365, 365, 245, 367, 365, 378, 365, 265, + /* 1400 */ 427, 242, 257, 262, 453, 241, 322, 260, 393, 360, + /* 1410 */ 20, 95, 416, 434, 95, 356, 365, 342, 36, 391, + /* 1420 */ 324, 330, 333, 395, 325, 432, 398, 399, 400, 401, + /* 1430 */ 402, 403, 404, 434, 406, 397, 352, 381, 386, 411, + /* 1440 */ 346, 413, 434, 433, 360, 417, 418, 436, 346, 365, + /* 1450 */ 334, 367, 346, 320, 431, 427, 0, 0, 185, 0, + /* 1460 */ 447, 322, 0, 42, 0, 35, 197, 35, 35, 35, + /* 1470 */ 446, 197, 0, 35, 35, 391, 197, 0, 197, 395, + /* 1480 */ 322, 0, 398, 399, 400, 401, 402, 403, 404, 35, + /* 1490 */ 406, 352, 0, 22, 0, 411, 35, 413, 180, 360, + /* 1500 */ 178, 417, 418, 0, 365, 0, 367, 174, 173, 0, + /* 1510 */ 352, 427, 0, 46, 0, 0, 0, 42, 360, 0, + /* 1520 */ 0, 0, 0, 365, 0, 367, 0, 0, 0, 149, + /* 1530 */ 391, 35, 0, 149, 395, 0, 0, 398, 399, 400, + /* 1540 */ 401, 402, 403, 404, 0, 406, 0, 0, 0, 391, + /* 1550 */ 0, 0, 0, 395, 0, 0, 398, 399, 400, 401, + /* 1560 */ 402, 403, 404, 0, 406, 0, 0, 428, 35, 411, + /* 1570 */ 0, 413, 42, 0, 0, 417, 418, 322, 0, 0, + /* 1580 */ 12, 13, 443, 444, 0, 0, 22, 448, 449, 14, + /* 1590 */ 22, 0, 0, 0, 0, 57, 0, 57, 322, 0, + /* 1600 */ 0, 33, 43, 35, 42, 0, 39, 352, 39, 14, + /* 1610 */ 0, 0, 0, 169, 0, 360, 40, 46, 46, 39, + /* 1620 */ 365, 0, 367, 0, 63, 57, 0, 0, 352, 47, + /* 1630 */ 0, 0, 35, 35, 47, 47, 360, 69, 0, 35, + /* 1640 */ 39, 365, 39, 367, 35, 39, 391, 39, 0, 47, + /* 1650 */ 395, 0, 0, 398, 399, 400, 401, 402, 403, 404, + /* 1660 */ 0, 406, 104, 35, 22, 0, 411, 391, 413, 35, + /* 1670 */ 35, 395, 417, 418, 398, 399, 400, 401, 402, 403, + /* 1680 */ 404, 22, 406, 322, 35, 117, 43, 411, 102, 413, + /* 1690 */ 35, 22, 35, 417, 418, 0, 43, 35, 35, 22, + /* 1700 */ 0, 22, 0, 49, 22, 35, 0, 0, 35, 35, + /* 1710 */ 0, 22, 20, 352, 96, 95, 0, 161, 35, 0, + /* 1720 */ 181, 360, 0, 22, 0, 0, 365, 95, 367, 96, + /* 1730 */ 0, 35, 3, 0, 0, 190, 95, 0, 161, 35, + /* 1740 */ 95, 95, 39, 46, 163, 105, 178, 246, 180, 62, + /* 1750 */ 167, 161, 391, 95, 43, 43, 395, 96, 43, 398, + /* 1760 */ 399, 400, 401, 402, 403, 404, 225, 406, 322, 162, + /* 1770 */ 227, 203, 204, 95, 413, 43, 96, 164, 417, 418, + /* 1780 */ 96, 95, 225, 215, 216, 217, 218, 219, 220, 221, + /* 1790 */ 96, 46, 46, 95, 95, 43, 3, 43, 352, 246, + /* 1800 */ 95, 35, 35, 35, 96, 96, 360, 35, 95, 35, + /* 1810 */ 96, 365, 35, 367, 96, 46, 96, 46, 43, 46, + /* 1820 */ 2, 22, 203, 95, 322, 46, 46, 96, 22, 205, + /* 1830 */ 95, 35, 96, 95, 69, 96, 95, 391, 95, 35, + /* 1840 */ 96, 395, 35, 95, 398, 399, 400, 401, 402, 403, + /* 1850 */ 404, 96, 406, 322, 352, 106, 240, 95, 95, 413, + /* 1860 */ 96, 246, 360, 417, 418, 35, 96, 365, 35, 367, + /* 1870 */ 119, 95, 35, 22, 96, 119, 95, 119, 96, 95, + /* 1880 */ 119, 95, 322, 352, 95, 35, 95, 43, 22, 63, + /* 1890 */ 107, 360, 35, 391, 35, 35, 365, 395, 367, 35, + /* 1900 */ 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, + /* 1910 */ 408, 322, 352, 35, 35, 35, 35, 35, 35, 92, + /* 1920 */ 360, 35, 391, 35, 22, 365, 395, 367, 43, 398, + /* 1930 */ 399, 400, 401, 402, 403, 404, 35, 406, 22, 35, + /* 1940 */ 35, 352, 35, 69, 35, 35, 35, 35, 35, 360, + /* 1950 */ 22, 391, 35, 0, 365, 395, 367, 35, 398, 399, + /* 1960 */ 400, 401, 402, 403, 404, 47, 406, 0, 39, 35, + /* 1970 */ 439, 440, 47, 0, 39, 35, 39, 47, 322, 0, + /* 1980 */ 391, 35, 39, 47, 395, 0, 35, 398, 399, 400, + /* 1990 */ 401, 402, 403, 404, 322, 406, 35, 0, 22, 21, + /* 2000 */ 454, 21, 413, 22, 22, 454, 20, 418, 352, 454, + /* 2010 */ 450, 451, 454, 357, 454, 454, 360, 454, 454, 454, + /* 2020 */ 454, 365, 454, 367, 352, 454, 454, 454, 454, 454, + /* 2030 */ 454, 454, 360, 454, 454, 454, 454, 365, 454, 367, + /* 2040 */ 454, 454, 454, 454, 454, 454, 454, 391, 454, 322, + /* 2050 */ 454, 395, 454, 454, 398, 399, 400, 401, 402, 403, + /* 2060 */ 404, 454, 406, 391, 454, 454, 454, 395, 454, 322, + /* 2070 */ 398, 399, 400, 401, 402, 403, 404, 454, 406, 352, + /* 2080 */ 408, 454, 454, 454, 454, 454, 454, 360, 454, 454, + /* 2090 */ 454, 454, 365, 454, 367, 454, 454, 454, 454, 352, + /* 2100 */ 454, 454, 454, 454, 454, 454, 454, 360, 454, 454, + /* 2110 */ 454, 454, 365, 454, 367, 454, 454, 454, 391, 454, + /* 2120 */ 454, 454, 395, 454, 454, 398, 399, 400, 401, 402, + /* 2130 */ 403, 404, 454, 406, 322, 454, 454, 454, 391, 454, + /* 2140 */ 454, 454, 395, 454, 454, 398, 399, 400, 401, 402, + /* 2150 */ 403, 404, 454, 406, 454, 454, 454, 454, 454, 454, + /* 2160 */ 454, 454, 454, 454, 352, 454, 454, 440, 454, 454, + /* 2170 */ 454, 454, 360, 454, 454, 454, 454, 365, 454, 367, + /* 2180 */ 454, 454, 454, 454, 454, 454, 454, 454, 454, 442, + /* 2190 */ 454, 454, 322, 454, 454, 454, 454, 454, 454, 454, + /* 2200 */ 454, 454, 454, 391, 454, 454, 322, 395, 454, 454, + /* 2210 */ 398, 399, 400, 401, 402, 403, 404, 454, 406, 454, + /* 2220 */ 454, 454, 352, 454, 454, 454, 454, 357, 454, 454, + /* 2230 */ 360, 454, 454, 454, 454, 365, 352, 367, 454, 454, + /* 2240 */ 454, 357, 454, 454, 360, 454, 454, 454, 454, 365, + /* 2250 */ 454, 367, 454, 454, 454, 454, 454, 454, 454, 454, + /* 2260 */ 454, 391, 454, 451, 322, 395, 454, 454, 398, 399, + /* 2270 */ 400, 401, 402, 403, 404, 391, 406, 454, 322, 395, + /* 2280 */ 454, 454, 398, 399, 400, 401, 402, 403, 404, 454, + /* 2290 */ 406, 454, 454, 454, 352, 454, 454, 454, 454, 454, + /* 2300 */ 454, 454, 360, 454, 454, 454, 454, 365, 352, 367, + /* 2310 */ 454, 454, 454, 454, 454, 454, 360, 454, 454, 454, + /* 2320 */ 454, 365, 454, 367, 454, 454, 454, 454, 454, 454, + /* 2330 */ 454, 322, 454, 391, 454, 454, 454, 395, 454, 454, + /* 2340 */ 398, 399, 400, 401, 402, 403, 404, 391, 406, 454, + /* 2350 */ 454, 395, 454, 454, 398, 399, 400, 401, 402, 403, + /* 2360 */ 404, 352, 406, 454, 454, 454, 454, 454, 454, 360, + /* 2370 */ 454, 454, 454, 454, 365, 454, 367, 454, 454, 454, + /* 2380 */ 454, 454, 454, 454, 454, 454, 322, 454, 454, 454, + /* 2390 */ 454, 454, 454, 454, 454, 454, 454, 454, 454, 454, + /* 2400 */ 391, 454, 322, 454, 395, 454, 454, 398, 399, 400, + /* 2410 */ 401, 402, 403, 404, 454, 406, 352, 454, 454, 454, + /* 2420 */ 454, 454, 454, 454, 360, 454, 454, 454, 454, 365, + /* 2430 */ 454, 367, 352, 454, 454, 454, 454, 454, 454, 454, + /* 2440 */ 360, 454, 454, 454, 454, 365, 454, 367, 454, 454, + /* 2450 */ 454, 454, 454, 454, 454, 391, 454, 322, 454, 395, + /* 2460 */ 454, 454, 398, 399, 400, 401, 402, 403, 404, 454, + /* 2470 */ 406, 391, 454, 322, 454, 395, 454, 454, 398, 399, + /* 2480 */ 400, 401, 402, 403, 404, 454, 406, 352, 454, 454, + /* 2490 */ 454, 454, 454, 454, 454, 360, 454, 454, 454, 454, + /* 2500 */ 365, 454, 367, 352, 454, 454, 454, 454, 454, 454, + /* 2510 */ 454, 360, 454, 454, 454, 454, 365, 454, 367, 454, + /* 2520 */ 454, 454, 454, 454, 454, 454, 391, 454, 454, 322, + /* 2530 */ 395, 454, 454, 398, 399, 400, 401, 402, 403, 404, + /* 2540 */ 454, 406, 391, 454, 454, 322, 395, 454, 454, 398, + /* 2550 */ 399, 400, 401, 402, 403, 404, 454, 406, 454, 352, + /* 2560 */ 454, 454, 454, 454, 454, 454, 454, 360, 454, 454, + /* 2570 */ 454, 454, 365, 454, 367, 352, 454, 454, 454, 454, + /* 2580 */ 454, 454, 454, 360, 454, 454, 454, 454, 365, 454, + /* 2590 */ 367, 454, 454, 454, 454, 454, 454, 454, 391, 454, + /* 2600 */ 454, 322, 395, 454, 454, 398, 399, 400, 401, 402, + /* 2610 */ 403, 404, 454, 406, 391, 454, 454, 322, 395, 454, + /* 2620 */ 454, 398, 399, 400, 401, 402, 403, 404, 454, 406, + /* 2630 */ 454, 352, 454, 454, 454, 454, 454, 454, 454, 360, + /* 2640 */ 454, 454, 454, 454, 365, 454, 367, 352, 454, 454, + /* 2650 */ 454, 454, 454, 454, 454, 360, 454, 454, 454, 454, + /* 2660 */ 365, 454, 367, 454, 454, 454, 454, 454, 454, 454, + /* 2670 */ 391, 454, 454, 454, 395, 454, 454, 398, 399, 400, + /* 2680 */ 401, 402, 403, 404, 322, 406, 391, 454, 454, 454, + /* 2690 */ 395, 454, 454, 398, 399, 400, 401, 402, 403, 404, + /* 2700 */ 454, 406, 454, 454, 454, 454, 454, 454, 454, 322, + /* 2710 */ 454, 454, 454, 454, 352, 454, 454, 454, 454, 454, + /* 2720 */ 454, 454, 360, 454, 454, 454, 454, 365, 454, 367, + /* 2730 */ 454, 454, 454, 454, 454, 454, 454, 454, 454, 352, + /* 2740 */ 454, 454, 454, 454, 454, 454, 454, 360, 454, 454, + /* 2750 */ 454, 454, 365, 391, 367, 454, 454, 395, 454, 454, + /* 2760 */ 398, 399, 400, 401, 402, 403, 404, 19, 406, 454, + /* 2770 */ 322, 454, 454, 454, 454, 454, 454, 454, 391, 454, + /* 2780 */ 454, 33, 395, 454, 454, 398, 399, 400, 401, 402, + /* 2790 */ 403, 404, 454, 406, 454, 47, 454, 454, 454, 454, + /* 2800 */ 352, 53, 54, 55, 56, 57, 454, 454, 360, 454, + /* 2810 */ 454, 454, 454, 365, 454, 367, 454, 454, 454, 454, + /* 2820 */ 454, 454, 454, 322, 454, 454, 454, 454, 454, 454, + /* 2830 */ 454, 454, 454, 454, 454, 454, 454, 454, 454, 391, + /* 2840 */ 454, 322, 94, 395, 454, 97, 398, 399, 400, 401, + /* 2850 */ 402, 403, 404, 352, 406, 454, 454, 454, 454, 454, + /* 2860 */ 454, 360, 454, 454, 454, 454, 365, 454, 367, 454, + /* 2870 */ 454, 352, 454, 454, 454, 454, 454, 454, 130, 360, + /* 2880 */ 454, 454, 454, 454, 365, 454, 367, 454, 454, 454, + /* 2890 */ 454, 454, 391, 454, 454, 454, 395, 322, 454, 398, + /* 2900 */ 399, 400, 401, 402, 403, 404, 454, 406, 454, 454, + /* 2910 */ 391, 322, 454, 165, 395, 454, 454, 398, 399, 400, + /* 2920 */ 401, 402, 403, 404, 454, 406, 454, 352, 454, 454, + /* 2930 */ 182, 454, 184, 454, 454, 360, 454, 454, 454, 454, + /* 2940 */ 365, 352, 367, 454, 454, 454, 454, 454, 454, 360, + /* 2950 */ 454, 454, 454, 454, 365, 454, 367, 454, 454, 454, + /* 2960 */ 454, 454, 454, 454, 454, 454, 391, 322, 454, 454, + /* 2970 */ 395, 454, 454, 398, 399, 400, 401, 402, 403, 404, + /* 2980 */ 391, 406, 454, 322, 395, 454, 454, 398, 399, 400, + /* 2990 */ 401, 402, 403, 404, 454, 406, 454, 352, 454, 454, + /* 3000 */ 454, 454, 454, 454, 454, 360, 454, 454, 454, 454, + /* 3010 */ 365, 454, 367, 352, 454, 454, 454, 454, 454, 454, + /* 3020 */ 454, 360, 454, 454, 454, 454, 365, 454, 367, 454, + /* 3030 */ 454, 454, 454, 454, 454, 454, 391, 454, 454, 454, + /* 3040 */ 395, 454, 454, 398, 399, 400, 401, 402, 403, 404, + /* 3050 */ 322, 406, 391, 454, 454, 454, 395, 454, 454, 398, + /* 3060 */ 399, 400, 401, 402, 403, 404, 454, 406, 454, 454, + /* 3070 */ 454, 454, 454, 454, 454, 454, 454, 454, 454, 454, + /* 3080 */ 352, 454, 454, 454, 454, 454, 454, 454, 360, 454, + /* 3090 */ 454, 454, 454, 365, 454, 367, 454, 454, 454, 454, + /* 3100 */ 454, 454, 454, 454, 454, 454, 454, 454, 454, 454, + /* 3110 */ 454, 454, 454, 454, 454, 454, 454, 454, 454, 391, + /* 3120 */ 454, 454, 454, 395, 454, 454, 398, 399, 400, 401, + /* 3130 */ 402, 403, 404, 454, 406, }; -#define YY_SHIFT_COUNT (700) +#define YY_SHIFT_COUNT (704) #define YY_SHIFT_MIN (0) -#define YY_SHIFT_MAX (2055) +#define YY_SHIFT_MAX (2748) static const unsigned short int yy_shift_ofst[] = { - /* 0 */ 1148, 0, 58, 271, 58, 329, 329, 329, 542, 329, - /* 10 */ 329, 329, 329, 329, 600, 813, 813, 871, 813, 813, - /* 20 */ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813, - /* 30 */ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813, - /* 40 */ 813, 813, 813, 813, 813, 813, 279, 434, 8, 266, - /* 50 */ 261, 19, 43, 19, 8, 8, 658, 658, 19, 658, - /* 60 */ 658, 332, 19, 16, 16, 14, 14, 435, 16, 16, - /* 70 */ 16, 16, 16, 16, 16, 16, 16, 16, 20, 16, - /* 80 */ 16, 16, 41, 16, 16, 207, 16, 16, 207, 213, - /* 90 */ 16, 207, 207, 207, 16, 229, 1078, 1253, 1253, 367, - /* 100 */ 222, 653, 653, 653, 653, 653, 653, 653, 653, 653, - /* 110 */ 653, 653, 653, 653, 653, 653, 653, 653, 653, 653, - /* 120 */ 128, 553, 435, 137, 137, 126, 366, 296, 99, 99, - /* 130 */ 267, 267, 267, 366, 364, 364, 364, 27, 41, 10, - /* 140 */ 10, 178, 207, 207, 354, 354, 27, 379, 199, 199, - /* 150 */ 199, 199, 199, 199, 199, 340, 896, 21, 74, 450, - /* 160 */ 164, 350, 407, 323, 422, 578, 821, 720, 963, 685, - /* 170 */ 330, 718, 685, 1009, 395, 841, 1041, 1257, 1135, 1280, - /* 180 */ 1280, 1177, 1318, 1318, 1280, 1177, 1177, 1263, 1318, 1318, - /* 190 */ 1318, 1339, 1339, 1354, 20, 41, 20, 1358, 1362, 20, - /* 200 */ 1358, 20, 20, 20, 1318, 20, 1357, 1357, 1339, 207, - /* 210 */ 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, - /* 220 */ 1318, 1339, 354, 1246, 1354, 229, 1272, 41, 229, 1318, - /* 230 */ 1318, 1358, 229, 1211, 354, 354, 354, 354, 1211, 354, - /* 240 */ 1302, 229, 27, 229, 364, 1454, 1454, 354, 1227, 1211, - /* 250 */ 354, 354, 1227, 1211, 354, 354, 207, 1240, 1338, 1227, - /* 260 */ 1249, 1252, 1265, 1041, 1247, 1251, 1256, 1276, 364, 1498, - /* 270 */ 1425, 1427, 354, 379, 1318, 229, 1495, 1339, 3333, 3333, - /* 280 */ 3333, 3333, 3333, 3333, 3333, 1074, 951, 382, 1267, 576, - /* 290 */ 669, 632, 692, 721, 779, 453, 1054, 1054, 1054, 1054, - /* 300 */ 1054, 1054, 1054, 1054, 1054, 993, 670, 105, 113, 767, - /* 310 */ 767, 197, 201, 120, 598, 513, 757, 766, 457, 757, - /* 320 */ 757, 757, 760, 345, 704, 801, 1097, 1010, 1016, 1030, - /* 330 */ 1035, 919, 949, 1187, 466, 940, 920, 969, 1073, 1085, - /* 340 */ 1092, 1136, 1155, 1044, 952, 794, 1176, 1158, 1145, 1201, - /* 350 */ 1112, 1160, 1179, 1192, 1162, 1167, 1168, 1202, 1206, 1254, - /* 360 */ 1178, 1299, 1317, 1260, 1193, 1559, 1561, 1380, 1564, 1565, - /* 370 */ 1525, 1574, 1534, 1375, 1536, 1537, 1541, 1382, 1578, 1544, - /* 380 */ 1545, 1386, 1582, 1388, 1585, 1551, 1587, 1566, 1589, 1555, - /* 390 */ 1413, 1416, 1593, 1594, 1423, 1426, 1598, 1599, 1556, 1601, - /* 400 */ 1603, 1611, 1571, 1615, 1616, 1618, 1579, 1625, 1626, 1628, - /* 410 */ 1630, 1631, 1471, 1597, 1634, 1486, 1636, 1637, 1639, 1640, - /* 420 */ 1641, 1642, 1643, 1644, 1645, 1646, 1647, 1648, 1649, 1651, - /* 430 */ 1652, 1613, 1653, 1656, 1657, 1665, 1667, 1650, 1669, 1670, - /* 440 */ 1679, 1680, 1654, 1682, 1617, 1675, 1627, 1685, 1686, 1655, - /* 450 */ 1659, 1658, 1673, 1660, 1676, 1661, 1688, 1662, 1664, 1699, - /* 460 */ 1700, 1705, 1671, 1526, 1694, 1695, 1696, 1629, 1709, 1711, - /* 470 */ 1684, 1677, 1683, 1723, 1691, 1681, 1698, 1730, 1703, 1693, - /* 480 */ 1702, 1733, 1704, 1701, 1706, 1735, 1742, 1743, 1746, 1668, - /* 490 */ 1689, 1712, 1727, 1750, 1716, 1717, 1731, 1719, 1720, 1713, - /* 500 */ 1715, 1724, 1725, 1740, 1728, 1764, 1753, 1776, 1755, 1732, - /* 510 */ 1779, 1761, 1751, 1788, 1757, 1790, 1758, 1794, 1773, 1777, - /* 520 */ 1707, 1714, 1796, 1635, 1765, 1799, 1622, 1780, 1678, 1672, - /* 530 */ 1804, 1806, 1690, 1663, 1805, 1807, 1811, 1812, 1718, 1721, - /* 540 */ 1781, 1792, 1666, 1815, 1736, 1697, 1739, 1825, 1791, 1687, - /* 550 */ 1741, 1734, 1798, 1797, 1624, 1633, 1632, 1802, 1596, 1752, - /* 560 */ 1756, 1760, 1766, 1767, 1769, 1808, 1770, 1774, 1778, 1782, - /* 570 */ 1772, 1813, 1819, 1824, 1783, 1818, 1708, 1800, 1801, 1873, - /* 580 */ 1847, 1710, 1857, 1858, 1859, 1863, 1865, 1866, 1814, 1816, - /* 590 */ 1856, 1722, 1870, 1868, 1869, 1914, 1895, 1726, 1827, 1823, - /* 600 */ 1829, 1832, 1831, 1834, 1874, 1836, 1837, 1879, 1839, 1911, - /* 610 */ 1737, 1842, 1833, 1845, 1903, 1908, 1849, 1850, 1910, 1852, - /* 620 */ 1853, 1913, 1855, 1862, 1916, 1860, 1864, 1917, 1882, 1840, - /* 630 */ 1844, 1867, 1871, 1931, 1872, 1883, 1886, 1929, 1887, 1933, - /* 640 */ 1933, 1952, 1920, 1922, 1953, 1954, 1956, 1957, 1958, 1959, - /* 650 */ 1960, 1962, 1963, 1964, 1932, 1912, 1966, 1965, 1967, 1981, - /* 660 */ 1970, 1984, 1972, 1975, 1976, 1944, 1713, 1980, 1715, 1988, - /* 670 */ 1990, 1992, 1993, 2007, 1995, 2031, 1997, 1989, 1994, 2035, - /* 680 */ 2002, 1991, 2001, 2042, 2008, 1998, 2009, 2046, 2012, 2003, - /* 690 */ 2010, 2051, 2018, 2019, 2055, 2034, 2039, 2041, 2043, 2047, - /* 700 */ 2044, + /* 0 */ 1159, 0, 132, 264, 132, 396, 396, 396, 528, 396, + /* 10 */ 396, 396, 396, 396, 660, 792, 792, 924, 792, 792, + /* 20 */ 792, 792, 792, 792, 792, 792, 792, 792, 792, 792, + /* 30 */ 792, 792, 792, 792, 792, 792, 792, 792, 792, 792, + /* 40 */ 792, 792, 792, 792, 792, 792, 48, 227, 170, 61, + /* 50 */ 82, 43, 45, 43, 170, 170, 1568, 1568, 43, 1568, + /* 60 */ 1568, 62, 43, 127, 127, 168, 59, 59, 52, 127, + /* 70 */ 127, 127, 127, 127, 127, 127, 127, 127, 127, 210, + /* 80 */ 127, 127, 127, 276, 127, 127, 305, 127, 127, 305, + /* 90 */ 338, 127, 305, 305, 305, 127, 367, 223, 621, 621, + /* 100 */ 98, 230, 1166, 1166, 1166, 1166, 1166, 1166, 1166, 1166, + /* 110 */ 1166, 1166, 1166, 1166, 1166, 1166, 1166, 1166, 1166, 1166, + /* 120 */ 1166, 736, 494, 168, 52, 510, 510, 534, 131, 768, + /* 130 */ 398, 398, 566, 566, 566, 131, 436, 436, 436, 447, + /* 140 */ 276, 625, 625, 406, 305, 305, 651, 651, 447, 657, + /* 150 */ 780, 780, 780, 780, 780, 780, 780, 2748, 960, 205, + /* 160 */ 121, 293, 256, 372, 156, 498, 559, 66, 802, 450, + /* 170 */ 860, 822, 671, 881, 823, 671, 897, 749, 827, 967, + /* 180 */ 1169, 1044, 1188, 1217, 1188, 1088, 1225, 1225, 1188, 1088, + /* 190 */ 1088, 1163, 1225, 1225, 1225, 1250, 1250, 1256, 210, 276, + /* 200 */ 210, 1261, 1267, 210, 1261, 210, 210, 210, 1225, 210, + /* 210 */ 1251, 1251, 1250, 305, 305, 305, 305, 305, 305, 305, + /* 220 */ 305, 305, 305, 305, 1225, 1250, 651, 1122, 1256, 367, + /* 230 */ 1135, 276, 367, 1225, 1225, 1261, 367, 1092, 651, 651, + /* 240 */ 651, 651, 1092, 651, 1173, 367, 447, 367, 436, 1217, + /* 250 */ 1217, 651, 1097, 1092, 651, 651, 1097, 1092, 651, 651, + /* 260 */ 305, 1095, 1180, 1097, 1104, 1145, 1149, 967, 1134, 1141, + /* 270 */ 1147, 1164, 436, 1390, 1316, 1319, 651, 657, 1225, 367, + /* 280 */ 1382, 1250, 3135, 3135, 3135, 3135, 3135, 3135, 3135, 1085, + /* 290 */ 358, 23, 54, 183, 374, 688, 424, 638, 654, 549, + /* 300 */ 774, 774, 774, 774, 774, 774, 774, 774, 774, 584, + /* 310 */ 409, 307, 759, 782, 782, 226, 564, 14, 468, 393, + /* 320 */ 75, 329, 480, 75, 75, 75, 714, 643, 896, 978, + /* 330 */ 146, 36, 932, 946, 952, 958, 1046, 1087, 1090, 280, + /* 340 */ 901, 892, 926, 975, 1007, 1018, 1020, 1021, 963, 947, + /* 350 */ 986, 1098, 1022, 349, 1045, 1029, 1058, 1093, 1083, 1137, + /* 360 */ 1138, 1140, 1142, 1143, 1144, 1003, 1177, 1178, 1157, 1193, + /* 370 */ 1456, 1457, 1273, 1459, 1462, 1421, 1464, 1430, 1269, 1432, + /* 380 */ 1433, 1434, 1274, 1472, 1438, 1439, 1279, 1477, 1281, 1481, + /* 390 */ 1454, 1492, 1471, 1494, 1461, 1318, 1322, 1503, 1505, 1333, + /* 400 */ 1335, 1509, 1512, 1467, 1514, 1515, 1516, 1475, 1519, 1520, + /* 410 */ 1521, 1522, 1524, 1526, 1527, 1528, 1380, 1496, 1532, 1384, + /* 420 */ 1535, 1536, 1544, 1546, 1547, 1548, 1550, 1551, 1552, 1554, + /* 430 */ 1555, 1563, 1565, 1566, 1570, 1530, 1573, 1574, 1578, 1579, + /* 440 */ 1584, 1564, 1585, 1591, 1592, 1593, 1533, 1594, 1538, 1596, + /* 450 */ 1540, 1599, 1600, 1562, 1567, 1559, 1575, 1571, 1595, 1572, + /* 460 */ 1605, 1576, 1569, 1610, 1611, 1612, 1580, 1444, 1614, 1621, + /* 470 */ 1623, 1561, 1626, 1627, 1597, 1582, 1601, 1630, 1598, 1587, + /* 480 */ 1603, 1631, 1604, 1588, 1606, 1638, 1609, 1602, 1608, 1648, + /* 490 */ 1651, 1652, 1660, 1558, 1586, 1628, 1642, 1665, 1634, 1635, + /* 500 */ 1659, 1649, 1655, 1643, 1653, 1657, 1662, 1669, 1663, 1695, + /* 510 */ 1677, 1700, 1679, 1654, 1702, 1682, 1670, 1706, 1673, 1707, + /* 520 */ 1674, 1710, 1689, 1692, 1618, 1620, 1716, 1556, 1683, 1719, + /* 530 */ 1539, 1701, 1577, 1581, 1722, 1724, 1590, 1583, 1729, 1725, + /* 540 */ 1733, 1734, 1632, 1633, 1696, 1704, 1545, 1730, 1641, 1613, + /* 550 */ 1645, 1737, 1703, 1607, 1646, 1640, 1697, 1711, 1541, 1543, + /* 560 */ 1557, 1712, 1501, 1658, 1661, 1678, 1680, 1684, 1686, 1715, + /* 570 */ 1694, 1698, 1699, 1705, 1708, 1732, 1745, 1746, 1713, 1752, + /* 580 */ 1553, 1709, 1714, 1793, 1754, 1615, 1766, 1767, 1768, 1772, + /* 590 */ 1774, 1777, 1718, 1720, 1769, 1616, 1775, 1771, 1773, 1818, + /* 600 */ 1799, 1619, 1728, 1731, 1735, 1736, 1738, 1739, 1779, 1741, + /* 610 */ 1743, 1780, 1744, 1806, 1624, 1748, 1749, 1755, 1796, 1804, + /* 620 */ 1762, 1764, 1807, 1763, 1770, 1830, 1776, 1778, 1833, 1781, + /* 630 */ 1782, 1837, 1784, 1751, 1756, 1758, 1761, 1851, 1783, 1786, + /* 640 */ 1789, 1850, 1791, 1844, 1844, 1866, 1826, 1687, 1857, 1859, + /* 650 */ 1860, 1864, 1878, 1879, 1880, 1881, 1882, 1883, 1765, 1827, + /* 660 */ 1885, 1886, 1888, 1902, 1901, 1916, 1904, 1905, 1907, 1874, + /* 670 */ 1643, 1909, 1653, 1910, 1911, 1912, 1913, 1928, 1917, 1953, + /* 680 */ 1922, 1918, 1929, 1967, 1934, 1925, 1935, 1973, 1940, 1930, + /* 690 */ 1937, 1979, 1946, 1936, 1943, 1985, 1951, 1961, 1997, 1976, + /* 700 */ 1978, 1981, 1982, 1980, 1986, }; -#define YY_REDUCE_COUNT (284) -#define YY_REDUCE_MIN (-358) -#define YY_REDUCE_MAX (2928) +#define YY_REDUCE_COUNT (288) +#define YY_REDUCE_MIN (-357) +#define YY_REDUCE_MAX (2728) static const short yy_reduce_ofst[] = { - /* 0 */ -94, -292, 892, -230, 1003, 1029, 1141, 1208, -21, 1262, - /* 10 */ 1316, 1369, 535, 1422, 1483, 205, -204, 1507, 264, 1569, - /* 20 */ 1620, 1674, 1692, 1775, 1830, 1881, 1935, 1986, 2040, 2058, - /* 30 */ 2141, 2196, 2247, 2301, 2352, 2406, 2424, 2507, 2562, 2613, - /* 40 */ 2667, 2718, 2772, 2790, 2873, 2928, 946, 70, -276, 72, - /* 50 */ 471, 512, 612, 614, 771, 776, -328, -252, 885, -348, - /* 60 */ -325, -92, 343, -319, -214, -326, -321, -37, -305, -232, - /* 70 */ 265, 293, 349, 359, 381, 498, 509, 520, -176, 551, - /* 80 */ 555, 556, -358, 622, 840, -329, 910, 912, 147, -169, - /* 90 */ 917, 217, 258, 306, 627, 177, -205, 88, 88, -302, - /* 100 */ -224, -162, 106, 523, 525, 545, 549, 583, 599, 602, - /* 110 */ 607, 621, 625, 634, 674, 678, 679, 742, 749, 802, - /* 120 */ -350, -59, 159, -253, -89, -331, 220, 5, 186, 430, - /* 130 */ -59, 303, 316, 504, 97, 216, 493, 342, 336, 454, - /* 140 */ 544, 335, 689, -267, 613, 648, 754, 561, 121, 151, - /* 150 */ 156, 277, 298, 421, 433, 460, 531, 566, 581, 547, - /* 160 */ 603, 650, 710, 850, 850, 873, 908, 875, 853, 826, - /* 170 */ 826, 831, 826, 861, 852, 850, 909, 916, 928, 961, - /* 180 */ 964, 967, 1011, 1019, 968, 983, 984, 1021, 1032, 1043, - /* 190 */ 1045, 1036, 1047, 990, 1042, 1013, 1048, 1005, 1004, 1051, - /* 200 */ 1018, 1063, 1071, 1075, 1079, 1080, 1081, 1084, 1096, 1070, - /* 210 */ 1072, 1082, 1083, 1089, 1090, 1091, 1094, 1095, 1098, 1099, - /* 220 */ 1093, 1108, 1087, 1050, 1062, 1116, 1076, 1088, 1123, 1127, - /* 230 */ 1128, 1086, 1126, 1100, 1101, 1102, 1103, 1104, 1105, 1106, - /* 240 */ 1121, 1131, 1122, 1139, 1113, 1107, 1109, 1111, 1046, 1120, - /* 250 */ 1114, 1132, 1049, 1124, 1133, 1138, 850, 1065, 1077, 1115, - /* 260 */ 1117, 1119, 1125, 1129, 1064, 1069, 1118, 826, 1161, 1130, - /* 270 */ 1137, 1169, 1163, 1181, 1196, 1194, 1207, 1210, 1152, 1166, - /* 280 */ 1190, 1200, 1209, 1219, 1238, + /* 0 */ 116, -321, 363, 862, 675, 973, 1028, 1084, 1139, 1158, + /* 10 */ 1255, 1276, 1361, 1446, 1502, 1531, 1560, 1589, 1656, 1672, + /* 20 */ 1727, 1747, 1812, 1870, 1884, 1942, 1956, 2009, 2064, 2080, + /* 30 */ 2135, 2151, 2207, 2223, 2279, 2295, 2362, 2387, 2448, 2501, + /* 40 */ 2519, 2575, 2589, 2645, 2661, 2728, -323, -334, 171, -275, + /* 50 */ -155, 2, 123, 134, 698, 868, -335, 560, -130, 233, + /* 60 */ 327, -133, -1, -322, 473, -347, -326, -312, -357, -319, + /* 70 */ -188, 215, 356, 364, 470, 481, 488, 502, 578, -110, + /* 80 */ 583, 598, 604, -99, 619, 631, -277, 687, 693, -166, + /* 90 */ 102, 709, 58, -85, 105, 729, -291, -211, -302, -302, + /* 100 */ -296, 11, -204, -42, 178, 203, 224, 266, 279, 300, + /* 110 */ 319, 434, 437, 456, 463, 577, 588, 600, 608, 610, + /* 120 */ 611, 42, 108, 195, -121, -298, 70, 106, 122, 309, + /* 130 */ 142, 397, 108, 274, 411, 310, -356, 400, 446, 427, + /* 140 */ 539, 465, 536, 568, 555, 337, 606, 620, 639, 587, + /* 150 */ -310, 641, 752, 753, 754, 757, 758, 591, 783, 803, + /* 160 */ 740, 673, 738, 863, 760, 847, 847, 871, 828, 875, + /* 170 */ 841, 831, 781, 781, 764, 781, 791, 786, 847, 830, + /* 180 */ 829, 839, 859, 867, 872, 873, 917, 918, 878, 882, + /* 190 */ 885, 914, 928, 929, 939, 948, 953, 889, 949, 915, + /* 200 */ 950, 904, 910, 961, 906, 962, 964, 965, 968, 966, + /* 210 */ 971, 972, 981, 954, 955, 956, 957, 959, 969, 970, + /* 220 */ 974, 976, 980, 983, 982, 989, 945, 925, 927, 984, + /* 230 */ 931, 987, 990, 994, 997, 938, 1004, 985, 977, 988, + /* 240 */ 991, 1000, 1005, 1001, 1002, 1006, 995, 1012, 1025, 992, + /* 250 */ 1014, 1016, 979, 1009, 1017, 1027, 999, 1019, 1031, 1033, + /* 260 */ 847, 911, 1011, 1008, 1010, 993, 1023, 1015, 951, 1013, + /* 270 */ 1024, 781, 1049, 1038, 996, 1059, 1051, 1075, 1091, 1089, + /* 280 */ 1099, 1096, 1052, 1056, 1094, 1102, 1106, 1116, 1133, }; static const YYACTIONTYPE yy_default[] = { - /* 0 */ 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, - /* 10 */ 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, - /* 20 */ 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, - /* 30 */ 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, - /* 40 */ 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, - /* 50 */ 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, - /* 60 */ 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, - /* 70 */ 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1640, 1564, - /* 80 */ 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, - /* 90 */ 1564, 1564, 1564, 1564, 1564, 1638, 1810, 1999, 1564, 1564, - /* 100 */ 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, - /* 110 */ 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, - /* 120 */ 1564, 2011, 1564, 1564, 1564, 1640, 1564, 1638, 1971, 1971, - /* 130 */ 2011, 2011, 2011, 1564, 1564, 1564, 1564, 1749, 1564, 1851, - /* 140 */ 1851, 1564, 1564, 1564, 1564, 1564, 1749, 1564, 1564, 1564, - /* 150 */ 1564, 1564, 1564, 1564, 1564, 1845, 1564, 1564, 2036, 2089, - /* 160 */ 1564, 1564, 2039, 1564, 1564, 1564, 1564, 1702, 2026, 2003, - /* 170 */ 2017, 2073, 2004, 2001, 2020, 1564, 2030, 1564, 1838, 1815, - /* 180 */ 1815, 1812, 1564, 1564, 1815, 1812, 1812, 1693, 1564, 1564, - /* 190 */ 1564, 1564, 1564, 1564, 1640, 1564, 1640, 1564, 1564, 1640, - /* 200 */ 1564, 1640, 1640, 1640, 1564, 1640, 1619, 1619, 1564, 1564, - /* 210 */ 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, - /* 220 */ 1564, 1564, 1564, 1858, 1564, 1638, 1847, 1564, 1638, 1564, - /* 230 */ 1564, 1564, 1638, 2044, 1564, 1564, 1564, 1564, 2044, 1564, - /* 240 */ 1564, 1638, 1564, 1638, 1564, 1564, 1564, 1564, 2046, 2044, - /* 250 */ 1564, 1564, 2046, 2044, 1564, 1564, 1564, 2058, 2054, 2046, - /* 260 */ 2062, 2060, 2032, 2030, 2092, 2079, 2075, 2017, 1564, 1564, - /* 270 */ 1564, 1718, 1564, 1564, 1564, 1638, 1596, 1564, 1840, 1851, - /* 280 */ 1752, 1752, 1752, 1641, 1569, 1564, 1564, 1564, 1564, 1564, - /* 290 */ 1564, 1564, 1564, 1564, 1564, 1564, 1927, 1564, 2057, 2056, - /* 300 */ 1975, 1974, 1973, 1964, 1926, 1564, 1714, 1564, 1564, 1925, - /* 310 */ 1924, 1564, 1564, 1564, 1564, 1564, 1918, 1564, 1564, 1919, - /* 320 */ 1917, 1916, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, - /* 330 */ 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, - /* 340 */ 1564, 1564, 1564, 1564, 2076, 2080, 2000, 1564, 1564, 1564, - /* 350 */ 1564, 1564, 1909, 1900, 1564, 1564, 1564, 1564, 1564, 1564, - /* 360 */ 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, - /* 370 */ 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, - /* 380 */ 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, - /* 390 */ 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, - /* 400 */ 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, - /* 410 */ 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, - /* 420 */ 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, - /* 430 */ 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, - /* 440 */ 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, - /* 450 */ 1564, 1601, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, - /* 460 */ 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, - /* 470 */ 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, - /* 480 */ 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, - /* 490 */ 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1680, - /* 500 */ 1679, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, - /* 510 */ 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, - /* 520 */ 1908, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, - /* 530 */ 1564, 1564, 1564, 1564, 2072, 1564, 1564, 1564, 1564, 1564, - /* 540 */ 1564, 1564, 1564, 1855, 1564, 1564, 1564, 1564, 1564, 1564, - /* 550 */ 1564, 1564, 1564, 1961, 1564, 1564, 1564, 2033, 1564, 1564, - /* 560 */ 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, - /* 570 */ 1564, 1564, 1564, 1900, 1564, 2055, 1564, 1564, 2070, 1564, - /* 580 */ 2074, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 2010, 2006, - /* 590 */ 1564, 1564, 2002, 1899, 1564, 1995, 1564, 1564, 1946, 1564, - /* 600 */ 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1908, 1564, - /* 610 */ 1912, 1564, 1564, 1564, 1564, 1564, 1746, 1564, 1564, 1564, - /* 620 */ 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1731, - /* 630 */ 1729, 1728, 1727, 1564, 1724, 1564, 1564, 1564, 1564, 1755, - /* 640 */ 1754, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, - /* 650 */ 1564, 1564, 1564, 1564, 1564, 1564, 1660, 1564, 1564, 1564, - /* 660 */ 1564, 1564, 1564, 1564, 1564, 1564, 1651, 1564, 1650, 1564, - /* 670 */ 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, - /* 680 */ 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, - /* 690 */ 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, - /* 700 */ 1564, + /* 0 */ 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, + /* 10 */ 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, + /* 20 */ 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, + /* 30 */ 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, + /* 40 */ 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, + /* 50 */ 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, + /* 60 */ 1582, 1582, 1582, 1582, 1582, 1835, 1582, 1582, 1582, 1582, + /* 70 */ 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1658, + /* 80 */ 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, + /* 90 */ 1582, 1582, 1582, 1582, 1582, 1582, 1656, 1828, 2025, 1582, + /* 100 */ 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, + /* 110 */ 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, + /* 120 */ 1582, 1582, 2037, 1582, 1582, 1582, 1582, 1658, 1582, 1656, + /* 130 */ 1997, 1997, 2037, 2037, 2037, 1582, 1582, 1582, 1582, 1767, + /* 140 */ 1582, 1877, 1877, 1582, 1582, 1582, 1582, 1582, 1767, 1582, + /* 150 */ 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1871, 1582, 1582, + /* 160 */ 2062, 2115, 1582, 1582, 2065, 1582, 1582, 1582, 1840, 1582, + /* 170 */ 1720, 2052, 2029, 2043, 2099, 2030, 2027, 2046, 1582, 2056, + /* 180 */ 1582, 1864, 1833, 1582, 1833, 1830, 1582, 1582, 1833, 1830, + /* 190 */ 1830, 1711, 1582, 1582, 1582, 1582, 1582, 1582, 1658, 1582, + /* 200 */ 1658, 1582, 1582, 1658, 1582, 1658, 1658, 1658, 1582, 1658, + /* 210 */ 1637, 1637, 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, + /* 220 */ 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1884, 1582, 1656, + /* 230 */ 1873, 1582, 1656, 1582, 1582, 1582, 1656, 2070, 1582, 1582, + /* 240 */ 1582, 1582, 2070, 1582, 1582, 1656, 1582, 1656, 1582, 1582, + /* 250 */ 1582, 1582, 2072, 2070, 1582, 1582, 2072, 2070, 1582, 1582, + /* 260 */ 1582, 2084, 2080, 2072, 2088, 2086, 2058, 2056, 2118, 2105, + /* 270 */ 2101, 2043, 1582, 1582, 1582, 1736, 1582, 1582, 1582, 1656, + /* 280 */ 1614, 1582, 1866, 1877, 1770, 1770, 1770, 1659, 1587, 1582, + /* 290 */ 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, + /* 300 */ 1953, 1582, 2083, 2082, 2001, 2000, 1999, 1990, 1952, 1582, + /* 310 */ 1732, 1582, 1582, 1951, 1950, 1582, 1582, 1582, 1582, 1582, + /* 320 */ 1944, 1582, 1582, 1945, 1943, 1942, 1582, 1582, 1582, 1582, + /* 330 */ 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, + /* 340 */ 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, 2102, + /* 350 */ 2106, 2026, 1582, 1582, 1582, 1582, 1582, 1935, 1926, 1582, + /* 360 */ 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, + /* 370 */ 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, + /* 380 */ 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, + /* 390 */ 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, + /* 400 */ 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, + /* 410 */ 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, + /* 420 */ 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, + /* 430 */ 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, + /* 440 */ 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, + /* 450 */ 1582, 1582, 1582, 1582, 1582, 1619, 1582, 1582, 1582, 1582, + /* 460 */ 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, + /* 470 */ 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, + /* 480 */ 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, + /* 490 */ 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, + /* 500 */ 1582, 1582, 1582, 1698, 1697, 1582, 1582, 1582, 1582, 1582, + /* 510 */ 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, + /* 520 */ 1582, 1582, 1582, 1582, 1934, 1582, 1582, 1582, 1582, 1582, + /* 530 */ 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, 2098, 1582, + /* 540 */ 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1881, 1582, 1582, + /* 550 */ 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1987, 1582, 1582, + /* 560 */ 1582, 2059, 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, + /* 570 */ 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1926, 1582, 2081, + /* 580 */ 1582, 1582, 2096, 1582, 2100, 1582, 1582, 1582, 1582, 1582, + /* 590 */ 1582, 1582, 2036, 2032, 1582, 1582, 2028, 1925, 1582, 2021, + /* 600 */ 1582, 1582, 1972, 1582, 1582, 1582, 1582, 1582, 1582, 1582, + /* 610 */ 1582, 1582, 1934, 1582, 1938, 1582, 1582, 1582, 1582, 1582, + /* 620 */ 1764, 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, + /* 630 */ 1582, 1582, 1582, 1749, 1747, 1746, 1745, 1582, 1742, 1582, + /* 640 */ 1582, 1582, 1582, 1773, 1772, 1582, 1582, 1582, 1582, 1582, + /* 650 */ 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, + /* 660 */ 1678, 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, + /* 670 */ 1669, 1582, 1668, 1582, 1582, 1582, 1582, 1582, 1582, 1582, + /* 680 */ 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, + /* 690 */ 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1582, + /* 700 */ 1582, 1582, 1582, 1582, 1582, }; /********** End of lemon-generated parsing tables *****************************/ @@ -1249,11 +1209,13 @@ static const YYCODETYPE yyFallback[] = { 0, /* SUBSCRIPTIONS => nothing */ 0, /* VNODES => nothing */ 0, /* LIKE => nothing */ + 0, /* TBNAME => nothing */ + 0, /* QTAGS => nothing */ + 0, /* AS => nothing */ 0, /* INDEX => nothing */ 0, /* FUNCTION => nothing */ 0, /* INTERVAL => nothing */ 0, /* TOPIC => nothing */ - 0, /* AS => nothing */ 0, /* WITH => nothing */ 0, /* META => nothing */ 0, /* CONSUMER => nothing */ @@ -1295,7 +1257,6 @@ static const YYCODETYPE yyFallback[] = { 0, /* NK_QUESTION => nothing */ 0, /* NK_ARROW => nothing */ 0, /* ROWTS => nothing */ - 0, /* TBNAME => nothing */ 0, /* QSTART => nothing */ 0, /* QEND => nothing */ 0, /* QDURATION => nothing */ @@ -1303,7 +1264,6 @@ static const YYCODETYPE yyFallback[] = { 0, /* WEND => nothing */ 0, /* WDURATION => nothing */ 0, /* IROWTS => nothing */ - 0, /* QTAGS => nothing */ 0, /* CAST => nothing */ 0, /* NOW => nothing */ 0, /* TODAY => nothing */ @@ -1655,61 +1615,61 @@ static const char *const yyTokenName[] = { /* 156 */ "SUBSCRIPTIONS", /* 157 */ "VNODES", /* 158 */ "LIKE", - /* 159 */ "INDEX", - /* 160 */ "FUNCTION", - /* 161 */ "INTERVAL", - /* 162 */ "TOPIC", - /* 163 */ "AS", - /* 164 */ "WITH", - /* 165 */ "META", - /* 166 */ "CONSUMER", - /* 167 */ "GROUP", - /* 168 */ "DESC", - /* 169 */ "DESCRIBE", - /* 170 */ "RESET", - /* 171 */ "QUERY", - /* 172 */ "CACHE", - /* 173 */ "EXPLAIN", - /* 174 */ "ANALYZE", - /* 175 */ "VERBOSE", - /* 176 */ "NK_BOOL", - /* 177 */ "RATIO", - /* 178 */ "NK_FLOAT", - /* 179 */ "OUTPUTTYPE", - /* 180 */ "AGGREGATE", - /* 181 */ "BUFSIZE", - /* 182 */ "STREAM", - /* 183 */ "INTO", - /* 184 */ "TRIGGER", - /* 185 */ "AT_ONCE", - /* 186 */ "WINDOW_CLOSE", - /* 187 */ "IGNORE", - /* 188 */ "EXPIRED", - /* 189 */ "FILL_HISTORY", - /* 190 */ "SUBTABLE", - /* 191 */ "KILL", - /* 192 */ "CONNECTION", - /* 193 */ "TRANSACTION", - /* 194 */ "BALANCE", - /* 195 */ "VGROUP", - /* 196 */ "MERGE", - /* 197 */ "REDISTRIBUTE", - /* 198 */ "SPLIT", - /* 199 */ "DELETE", - /* 200 */ "INSERT", - /* 201 */ "NULL", - /* 202 */ "NK_QUESTION", - /* 203 */ "NK_ARROW", - /* 204 */ "ROWTS", - /* 205 */ "TBNAME", - /* 206 */ "QSTART", - /* 207 */ "QEND", - /* 208 */ "QDURATION", - /* 209 */ "WSTART", - /* 210 */ "WEND", - /* 211 */ "WDURATION", - /* 212 */ "IROWTS", - /* 213 */ "QTAGS", + /* 159 */ "TBNAME", + /* 160 */ "QTAGS", + /* 161 */ "AS", + /* 162 */ "INDEX", + /* 163 */ "FUNCTION", + /* 164 */ "INTERVAL", + /* 165 */ "TOPIC", + /* 166 */ "WITH", + /* 167 */ "META", + /* 168 */ "CONSUMER", + /* 169 */ "GROUP", + /* 170 */ "DESC", + /* 171 */ "DESCRIBE", + /* 172 */ "RESET", + /* 173 */ "QUERY", + /* 174 */ "CACHE", + /* 175 */ "EXPLAIN", + /* 176 */ "ANALYZE", + /* 177 */ "VERBOSE", + /* 178 */ "NK_BOOL", + /* 179 */ "RATIO", + /* 180 */ "NK_FLOAT", + /* 181 */ "OUTPUTTYPE", + /* 182 */ "AGGREGATE", + /* 183 */ "BUFSIZE", + /* 184 */ "STREAM", + /* 185 */ "INTO", + /* 186 */ "TRIGGER", + /* 187 */ "AT_ONCE", + /* 188 */ "WINDOW_CLOSE", + /* 189 */ "IGNORE", + /* 190 */ "EXPIRED", + /* 191 */ "FILL_HISTORY", + /* 192 */ "SUBTABLE", + /* 193 */ "KILL", + /* 194 */ "CONNECTION", + /* 195 */ "TRANSACTION", + /* 196 */ "BALANCE", + /* 197 */ "VGROUP", + /* 198 */ "MERGE", + /* 199 */ "REDISTRIBUTE", + /* 200 */ "SPLIT", + /* 201 */ "DELETE", + /* 202 */ "INSERT", + /* 203 */ "NULL", + /* 204 */ "NK_QUESTION", + /* 205 */ "NK_ARROW", + /* 206 */ "ROWTS", + /* 207 */ "QSTART", + /* 208 */ "QEND", + /* 209 */ "QDURATION", + /* 210 */ "WSTART", + /* 211 */ "WEND", + /* 212 */ "WDURATION", + /* 213 */ "IROWTS", /* 214 */ "CAST", /* 215 */ "NOW", /* 216 */ "TODAY", @@ -1869,85 +1829,87 @@ static const char *const yyTokenName[] = { /* 370 */ "like_pattern_opt", /* 371 */ "table_name_cond", /* 372 */ "from_db_opt", - /* 373 */ "index_options", - /* 374 */ "func_list", - /* 375 */ "sliding_opt", - /* 376 */ "sma_stream_opt", - /* 377 */ "func", - /* 378 */ "stream_options", - /* 379 */ "topic_name", - /* 380 */ "query_or_subquery", - /* 381 */ "cgroup_name", - /* 382 */ "analyze_opt", - /* 383 */ "explain_options", - /* 384 */ "agg_func_opt", - /* 385 */ "bufsize_opt", - /* 386 */ "stream_name", - /* 387 */ "subtable_opt", - /* 388 */ "expression", - /* 389 */ "dnode_list", - /* 390 */ "where_clause_opt", - /* 391 */ "signed", - /* 392 */ "literal_func", - /* 393 */ "literal_list", - /* 394 */ "table_alias", - /* 395 */ "column_alias", - /* 396 */ "expr_or_subquery", - /* 397 */ "subquery", - /* 398 */ "pseudo_column", - /* 399 */ "column_reference", - /* 400 */ "function_expression", - /* 401 */ "case_when_expression", - /* 402 */ "star_func", - /* 403 */ "star_func_para_list", - /* 404 */ "noarg_func", - /* 405 */ "other_para_list", - /* 406 */ "star_func_para", - /* 407 */ "when_then_list", - /* 408 */ "case_when_else_opt", - /* 409 */ "common_expression", - /* 410 */ "when_then_expr", - /* 411 */ "predicate", - /* 412 */ "compare_op", - /* 413 */ "in_op", - /* 414 */ "in_predicate_value", - /* 415 */ "boolean_value_expression", - /* 416 */ "boolean_primary", - /* 417 */ "from_clause_opt", - /* 418 */ "table_reference_list", - /* 419 */ "table_reference", - /* 420 */ "table_primary", - /* 421 */ "joined_table", - /* 422 */ "alias_opt", - /* 423 */ "parenthesized_joined_table", - /* 424 */ "join_type", - /* 425 */ "search_condition", - /* 426 */ "query_specification", - /* 427 */ "set_quantifier_opt", - /* 428 */ "select_list", - /* 429 */ "partition_by_clause_opt", - /* 430 */ "range_opt", - /* 431 */ "every_opt", - /* 432 */ "fill_opt", - /* 433 */ "twindow_clause_opt", - /* 434 */ "group_by_clause_opt", - /* 435 */ "having_clause_opt", - /* 436 */ "select_item", - /* 437 */ "partition_list", - /* 438 */ "partition_item", - /* 439 */ "fill_mode", - /* 440 */ "group_by_list", - /* 441 */ "query_expression", - /* 442 */ "query_simple", - /* 443 */ "order_by_clause_opt", - /* 444 */ "slimit_clause_opt", - /* 445 */ "limit_clause_opt", - /* 446 */ "union_query_expression", - /* 447 */ "query_simple_or_subquery", - /* 448 */ "sort_specification_list", - /* 449 */ "sort_specification", - /* 450 */ "ordering_specification_opt", - /* 451 */ "null_ordering_opt", + /* 373 */ "tag_list_opt", + /* 374 */ "tag_item", + /* 375 */ "column_alias", + /* 376 */ "index_options", + /* 377 */ "func_list", + /* 378 */ "sliding_opt", + /* 379 */ "sma_stream_opt", + /* 380 */ "func", + /* 381 */ "stream_options", + /* 382 */ "topic_name", + /* 383 */ "query_or_subquery", + /* 384 */ "cgroup_name", + /* 385 */ "analyze_opt", + /* 386 */ "explain_options", + /* 387 */ "agg_func_opt", + /* 388 */ "bufsize_opt", + /* 389 */ "stream_name", + /* 390 */ "subtable_opt", + /* 391 */ "expression", + /* 392 */ "dnode_list", + /* 393 */ "where_clause_opt", + /* 394 */ "signed", + /* 395 */ "literal_func", + /* 396 */ "literal_list", + /* 397 */ "table_alias", + /* 398 */ "expr_or_subquery", + /* 399 */ "subquery", + /* 400 */ "pseudo_column", + /* 401 */ "column_reference", + /* 402 */ "function_expression", + /* 403 */ "case_when_expression", + /* 404 */ "star_func", + /* 405 */ "star_func_para_list", + /* 406 */ "noarg_func", + /* 407 */ "other_para_list", + /* 408 */ "star_func_para", + /* 409 */ "when_then_list", + /* 410 */ "case_when_else_opt", + /* 411 */ "common_expression", + /* 412 */ "when_then_expr", + /* 413 */ "predicate", + /* 414 */ "compare_op", + /* 415 */ "in_op", + /* 416 */ "in_predicate_value", + /* 417 */ "boolean_value_expression", + /* 418 */ "boolean_primary", + /* 419 */ "from_clause_opt", + /* 420 */ "table_reference_list", + /* 421 */ "table_reference", + /* 422 */ "table_primary", + /* 423 */ "joined_table", + /* 424 */ "alias_opt", + /* 425 */ "parenthesized_joined_table", + /* 426 */ "join_type", + /* 427 */ "search_condition", + /* 428 */ "query_specification", + /* 429 */ "set_quantifier_opt", + /* 430 */ "select_list", + /* 431 */ "partition_by_clause_opt", + /* 432 */ "range_opt", + /* 433 */ "every_opt", + /* 434 */ "fill_opt", + /* 435 */ "twindow_clause_opt", + /* 436 */ "group_by_clause_opt", + /* 437 */ "having_clause_opt", + /* 438 */ "select_item", + /* 439 */ "partition_list", + /* 440 */ "partition_item", + /* 441 */ "fill_mode", + /* 442 */ "group_by_list", + /* 443 */ "query_expression", + /* 444 */ "query_simple", + /* 445 */ "order_by_clause_opt", + /* 446 */ "slimit_clause_opt", + /* 447 */ "limit_clause_opt", + /* 448 */ "union_query_expression", + /* 449 */ "query_simple_or_subquery", + /* 450 */ "sort_specification_list", + /* 451 */ "sort_specification", + /* 452 */ "ordering_specification_opt", + /* 453 */ "null_ordering_opt", }; #endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */ @@ -2195,7 +2157,7 @@ static const char *const yyRuleName[] = { /* 237 */ "cmd ::= SHOW CONSUMERS", /* 238 */ "cmd ::= SHOW SUBSCRIPTIONS", /* 239 */ "cmd ::= SHOW TAGS FROM table_name_cond from_db_opt", - /* 240 */ "cmd ::= SHOW TABLE TAGS FROM table_name_cond from_db_opt", + /* 240 */ "cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt", /* 241 */ "cmd ::= SHOW VNODES NK_INTEGER", /* 242 */ "cmd ::= SHOW VNODES NK_STRING", /* 243 */ "db_name_cond_opt ::=", @@ -2205,284 +2167,292 @@ static const char *const yyRuleName[] = { /* 247 */ "table_name_cond ::= table_name", /* 248 */ "from_db_opt ::=", /* 249 */ "from_db_opt ::= FROM db_name", - /* 250 */ "cmd ::= CREATE SMA INDEX not_exists_opt full_table_name ON full_table_name index_options", - /* 251 */ "cmd ::= DROP INDEX exists_opt full_table_name", - /* 252 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt", - /* 253 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt sma_stream_opt", - /* 254 */ "func_list ::= func", - /* 255 */ "func_list ::= func_list NK_COMMA func", - /* 256 */ "func ::= function_name NK_LP expression_list NK_RP", - /* 257 */ "sma_stream_opt ::=", - /* 258 */ "sma_stream_opt ::= stream_options WATERMARK duration_literal", - /* 259 */ "sma_stream_opt ::= stream_options MAX_DELAY duration_literal", - /* 260 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery", - /* 261 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name", - /* 262 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name", - /* 263 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name", - /* 264 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name", - /* 265 */ "cmd ::= DROP TOPIC exists_opt topic_name", - /* 266 */ "cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name", - /* 267 */ "cmd ::= DESC full_table_name", - /* 268 */ "cmd ::= DESCRIBE full_table_name", - /* 269 */ "cmd ::= RESET QUERY CACHE", - /* 270 */ "cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery", - /* 271 */ "analyze_opt ::=", - /* 272 */ "analyze_opt ::= ANALYZE", - /* 273 */ "explain_options ::=", - /* 274 */ "explain_options ::= explain_options VERBOSE NK_BOOL", - /* 275 */ "explain_options ::= explain_options RATIO NK_FLOAT", - /* 276 */ "cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt", - /* 277 */ "cmd ::= DROP FUNCTION exists_opt function_name", - /* 278 */ "agg_func_opt ::=", - /* 279 */ "agg_func_opt ::= AGGREGATE", - /* 280 */ "bufsize_opt ::=", - /* 281 */ "bufsize_opt ::= BUFSIZE NK_INTEGER", - /* 282 */ "cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name tags_def_opt subtable_opt AS query_or_subquery", - /* 283 */ "cmd ::= DROP STREAM exists_opt stream_name", - /* 284 */ "stream_options ::=", - /* 285 */ "stream_options ::= stream_options TRIGGER AT_ONCE", - /* 286 */ "stream_options ::= stream_options TRIGGER WINDOW_CLOSE", - /* 287 */ "stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal", - /* 288 */ "stream_options ::= stream_options WATERMARK duration_literal", - /* 289 */ "stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER", - /* 290 */ "stream_options ::= stream_options FILL_HISTORY NK_INTEGER", - /* 291 */ "subtable_opt ::=", - /* 292 */ "subtable_opt ::= SUBTABLE NK_LP expression NK_RP", - /* 293 */ "cmd ::= KILL CONNECTION NK_INTEGER", - /* 294 */ "cmd ::= KILL QUERY NK_STRING", - /* 295 */ "cmd ::= KILL TRANSACTION NK_INTEGER", - /* 296 */ "cmd ::= BALANCE VGROUP", - /* 297 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER", - /* 298 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list", - /* 299 */ "cmd ::= SPLIT VGROUP NK_INTEGER", - /* 300 */ "dnode_list ::= DNODE NK_INTEGER", - /* 301 */ "dnode_list ::= dnode_list DNODE NK_INTEGER", - /* 302 */ "cmd ::= DELETE FROM full_table_name where_clause_opt", - /* 303 */ "cmd ::= query_or_subquery", - /* 304 */ "cmd ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery", - /* 305 */ "cmd ::= INSERT INTO full_table_name query_or_subquery", - /* 306 */ "literal ::= NK_INTEGER", - /* 307 */ "literal ::= NK_FLOAT", - /* 308 */ "literal ::= NK_STRING", - /* 309 */ "literal ::= NK_BOOL", - /* 310 */ "literal ::= TIMESTAMP NK_STRING", - /* 311 */ "literal ::= duration_literal", - /* 312 */ "literal ::= NULL", - /* 313 */ "literal ::= NK_QUESTION", - /* 314 */ "duration_literal ::= NK_VARIABLE", - /* 315 */ "signed ::= NK_INTEGER", - /* 316 */ "signed ::= NK_PLUS NK_INTEGER", - /* 317 */ "signed ::= NK_MINUS NK_INTEGER", - /* 318 */ "signed ::= NK_FLOAT", - /* 319 */ "signed ::= NK_PLUS NK_FLOAT", - /* 320 */ "signed ::= NK_MINUS NK_FLOAT", - /* 321 */ "signed_literal ::= signed", - /* 322 */ "signed_literal ::= NK_STRING", - /* 323 */ "signed_literal ::= NK_BOOL", - /* 324 */ "signed_literal ::= TIMESTAMP NK_STRING", - /* 325 */ "signed_literal ::= duration_literal", - /* 326 */ "signed_literal ::= NULL", - /* 327 */ "signed_literal ::= literal_func", - /* 328 */ "signed_literal ::= NK_QUESTION", - /* 329 */ "literal_list ::= signed_literal", - /* 330 */ "literal_list ::= literal_list NK_COMMA signed_literal", - /* 331 */ "db_name ::= NK_ID", - /* 332 */ "table_name ::= NK_ID", - /* 333 */ "column_name ::= NK_ID", - /* 334 */ "function_name ::= NK_ID", - /* 335 */ "table_alias ::= NK_ID", - /* 336 */ "column_alias ::= NK_ID", - /* 337 */ "user_name ::= NK_ID", - /* 338 */ "topic_name ::= NK_ID", - /* 339 */ "stream_name ::= NK_ID", - /* 340 */ "cgroup_name ::= NK_ID", - /* 341 */ "expr_or_subquery ::= expression", - /* 342 */ "expr_or_subquery ::= subquery", - /* 343 */ "expression ::= literal", - /* 344 */ "expression ::= pseudo_column", - /* 345 */ "expression ::= column_reference", - /* 346 */ "expression ::= function_expression", - /* 347 */ "expression ::= case_when_expression", - /* 348 */ "expression ::= NK_LP expression NK_RP", - /* 349 */ "expression ::= NK_PLUS expr_or_subquery", - /* 350 */ "expression ::= NK_MINUS expr_or_subquery", - /* 351 */ "expression ::= expr_or_subquery NK_PLUS expr_or_subquery", - /* 352 */ "expression ::= expr_or_subquery NK_MINUS expr_or_subquery", - /* 353 */ "expression ::= expr_or_subquery NK_STAR expr_or_subquery", - /* 354 */ "expression ::= expr_or_subquery NK_SLASH expr_or_subquery", - /* 355 */ "expression ::= expr_or_subquery NK_REM expr_or_subquery", - /* 356 */ "expression ::= column_reference NK_ARROW NK_STRING", - /* 357 */ "expression ::= expr_or_subquery NK_BITAND expr_or_subquery", - /* 358 */ "expression ::= expr_or_subquery NK_BITOR expr_or_subquery", - /* 359 */ "expression_list ::= expr_or_subquery", - /* 360 */ "expression_list ::= expression_list NK_COMMA expr_or_subquery", - /* 361 */ "column_reference ::= column_name", - /* 362 */ "column_reference ::= table_name NK_DOT column_name", - /* 363 */ "pseudo_column ::= ROWTS", - /* 364 */ "pseudo_column ::= TBNAME", - /* 365 */ "pseudo_column ::= table_name NK_DOT TBNAME", - /* 366 */ "pseudo_column ::= QSTART", - /* 367 */ "pseudo_column ::= QEND", - /* 368 */ "pseudo_column ::= QDURATION", - /* 369 */ "pseudo_column ::= WSTART", - /* 370 */ "pseudo_column ::= WEND", - /* 371 */ "pseudo_column ::= WDURATION", - /* 372 */ "pseudo_column ::= IROWTS", - /* 373 */ "pseudo_column ::= QTAGS", - /* 374 */ "function_expression ::= function_name NK_LP expression_list NK_RP", - /* 375 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP", - /* 376 */ "function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP", - /* 377 */ "function_expression ::= literal_func", - /* 378 */ "literal_func ::= noarg_func NK_LP NK_RP", - /* 379 */ "literal_func ::= NOW", - /* 380 */ "noarg_func ::= NOW", - /* 381 */ "noarg_func ::= TODAY", - /* 382 */ "noarg_func ::= TIMEZONE", - /* 383 */ "noarg_func ::= DATABASE", - /* 384 */ "noarg_func ::= CLIENT_VERSION", - /* 385 */ "noarg_func ::= SERVER_VERSION", - /* 386 */ "noarg_func ::= SERVER_STATUS", - /* 387 */ "noarg_func ::= CURRENT_USER", - /* 388 */ "noarg_func ::= USER", - /* 389 */ "star_func ::= COUNT", - /* 390 */ "star_func ::= FIRST", - /* 391 */ "star_func ::= LAST", - /* 392 */ "star_func ::= LAST_ROW", - /* 393 */ "star_func_para_list ::= NK_STAR", - /* 394 */ "star_func_para_list ::= other_para_list", - /* 395 */ "other_para_list ::= star_func_para", - /* 396 */ "other_para_list ::= other_para_list NK_COMMA star_func_para", - /* 397 */ "star_func_para ::= expr_or_subquery", - /* 398 */ "star_func_para ::= table_name NK_DOT NK_STAR", - /* 399 */ "case_when_expression ::= CASE when_then_list case_when_else_opt END", - /* 400 */ "case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END", - /* 401 */ "when_then_list ::= when_then_expr", - /* 402 */ "when_then_list ::= when_then_list when_then_expr", - /* 403 */ "when_then_expr ::= WHEN common_expression THEN common_expression", - /* 404 */ "case_when_else_opt ::=", - /* 405 */ "case_when_else_opt ::= ELSE common_expression", - /* 406 */ "predicate ::= expr_or_subquery compare_op expr_or_subquery", - /* 407 */ "predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery", - /* 408 */ "predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery", - /* 409 */ "predicate ::= expr_or_subquery IS NULL", - /* 410 */ "predicate ::= expr_or_subquery IS NOT NULL", - /* 411 */ "predicate ::= expr_or_subquery in_op in_predicate_value", - /* 412 */ "compare_op ::= NK_LT", - /* 413 */ "compare_op ::= NK_GT", - /* 414 */ "compare_op ::= NK_LE", - /* 415 */ "compare_op ::= NK_GE", - /* 416 */ "compare_op ::= NK_NE", - /* 417 */ "compare_op ::= NK_EQ", - /* 418 */ "compare_op ::= LIKE", - /* 419 */ "compare_op ::= NOT LIKE", - /* 420 */ "compare_op ::= MATCH", - /* 421 */ "compare_op ::= NMATCH", - /* 422 */ "compare_op ::= CONTAINS", - /* 423 */ "in_op ::= IN", - /* 424 */ "in_op ::= NOT IN", - /* 425 */ "in_predicate_value ::= NK_LP literal_list NK_RP", - /* 426 */ "boolean_value_expression ::= boolean_primary", - /* 427 */ "boolean_value_expression ::= NOT boolean_primary", - /* 428 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", - /* 429 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", - /* 430 */ "boolean_primary ::= predicate", - /* 431 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", - /* 432 */ "common_expression ::= expr_or_subquery", - /* 433 */ "common_expression ::= boolean_value_expression", - /* 434 */ "from_clause_opt ::=", - /* 435 */ "from_clause_opt ::= FROM table_reference_list", - /* 436 */ "table_reference_list ::= table_reference", - /* 437 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", - /* 438 */ "table_reference ::= table_primary", - /* 439 */ "table_reference ::= joined_table", - /* 440 */ "table_primary ::= table_name alias_opt", - /* 441 */ "table_primary ::= db_name NK_DOT table_name alias_opt", - /* 442 */ "table_primary ::= subquery alias_opt", - /* 443 */ "table_primary ::= parenthesized_joined_table", - /* 444 */ "alias_opt ::=", - /* 445 */ "alias_opt ::= table_alias", - /* 446 */ "alias_opt ::= AS table_alias", - /* 447 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", - /* 448 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", - /* 449 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition", - /* 450 */ "join_type ::=", - /* 451 */ "join_type ::= INNER", - /* 452 */ "query_specification ::= SELECT set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt", - /* 453 */ "set_quantifier_opt ::=", - /* 454 */ "set_quantifier_opt ::= DISTINCT", - /* 455 */ "set_quantifier_opt ::= ALL", - /* 456 */ "select_list ::= select_item", - /* 457 */ "select_list ::= select_list NK_COMMA select_item", - /* 458 */ "select_item ::= NK_STAR", - /* 459 */ "select_item ::= common_expression", - /* 460 */ "select_item ::= common_expression column_alias", - /* 461 */ "select_item ::= common_expression AS column_alias", - /* 462 */ "select_item ::= table_name NK_DOT NK_STAR", - /* 463 */ "where_clause_opt ::=", - /* 464 */ "where_clause_opt ::= WHERE search_condition", - /* 465 */ "partition_by_clause_opt ::=", - /* 466 */ "partition_by_clause_opt ::= PARTITION BY partition_list", - /* 467 */ "partition_list ::= partition_item", - /* 468 */ "partition_list ::= partition_list NK_COMMA partition_item", - /* 469 */ "partition_item ::= expr_or_subquery", - /* 470 */ "partition_item ::= expr_or_subquery column_alias", - /* 471 */ "partition_item ::= expr_or_subquery AS column_alias", - /* 472 */ "twindow_clause_opt ::=", - /* 473 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP", - /* 474 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP", - /* 475 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt", - /* 476 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt", - /* 477 */ "sliding_opt ::=", - /* 478 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP", - /* 479 */ "fill_opt ::=", - /* 480 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", - /* 481 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP", - /* 482 */ "fill_mode ::= NONE", - /* 483 */ "fill_mode ::= PREV", - /* 484 */ "fill_mode ::= NULL", - /* 485 */ "fill_mode ::= LINEAR", - /* 486 */ "fill_mode ::= NEXT", - /* 487 */ "group_by_clause_opt ::=", - /* 488 */ "group_by_clause_opt ::= GROUP BY group_by_list", - /* 489 */ "group_by_list ::= expr_or_subquery", - /* 490 */ "group_by_list ::= group_by_list NK_COMMA expr_or_subquery", - /* 491 */ "having_clause_opt ::=", - /* 492 */ "having_clause_opt ::= HAVING search_condition", - /* 493 */ "range_opt ::=", - /* 494 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP", - /* 495 */ "every_opt ::=", - /* 496 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP", - /* 497 */ "query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt", - /* 498 */ "query_simple ::= query_specification", - /* 499 */ "query_simple ::= union_query_expression", - /* 500 */ "union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery", - /* 501 */ "union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery", - /* 502 */ "query_simple_or_subquery ::= query_simple", - /* 503 */ "query_simple_or_subquery ::= subquery", - /* 504 */ "query_or_subquery ::= query_expression", - /* 505 */ "query_or_subquery ::= subquery", - /* 506 */ "order_by_clause_opt ::=", - /* 507 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", - /* 508 */ "slimit_clause_opt ::=", - /* 509 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", - /* 510 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", - /* 511 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 512 */ "limit_clause_opt ::=", - /* 513 */ "limit_clause_opt ::= LIMIT NK_INTEGER", - /* 514 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", - /* 515 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 516 */ "subquery ::= NK_LP query_expression NK_RP", - /* 517 */ "subquery ::= NK_LP subquery NK_RP", - /* 518 */ "search_condition ::= common_expression", - /* 519 */ "sort_specification_list ::= sort_specification", - /* 520 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", - /* 521 */ "sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt", - /* 522 */ "ordering_specification_opt ::=", - /* 523 */ "ordering_specification_opt ::= ASC", - /* 524 */ "ordering_specification_opt ::= DESC", - /* 525 */ "null_ordering_opt ::=", - /* 526 */ "null_ordering_opt ::= NULLS FIRST", - /* 527 */ "null_ordering_opt ::= NULLS LAST", + /* 250 */ "tag_list_opt ::=", + /* 251 */ "tag_list_opt ::= tag_item", + /* 252 */ "tag_list_opt ::= tag_list_opt NK_COMMA tag_item", + /* 253 */ "tag_item ::= TBNAME", + /* 254 */ "tag_item ::= QTAGS", + /* 255 */ "tag_item ::= column_name", + /* 256 */ "tag_item ::= column_name column_alias", + /* 257 */ "tag_item ::= column_name AS column_alias", + /* 258 */ "cmd ::= CREATE SMA INDEX not_exists_opt full_table_name ON full_table_name index_options", + /* 259 */ "cmd ::= DROP INDEX exists_opt full_table_name", + /* 260 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt", + /* 261 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt sma_stream_opt", + /* 262 */ "func_list ::= func", + /* 263 */ "func_list ::= func_list NK_COMMA func", + /* 264 */ "func ::= function_name NK_LP expression_list NK_RP", + /* 265 */ "sma_stream_opt ::=", + /* 266 */ "sma_stream_opt ::= stream_options WATERMARK duration_literal", + /* 267 */ "sma_stream_opt ::= stream_options MAX_DELAY duration_literal", + /* 268 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery", + /* 269 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name", + /* 270 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name", + /* 271 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name", + /* 272 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name", + /* 273 */ "cmd ::= DROP TOPIC exists_opt topic_name", + /* 274 */ "cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name", + /* 275 */ "cmd ::= DESC full_table_name", + /* 276 */ "cmd ::= DESCRIBE full_table_name", + /* 277 */ "cmd ::= RESET QUERY CACHE", + /* 278 */ "cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery", + /* 279 */ "analyze_opt ::=", + /* 280 */ "analyze_opt ::= ANALYZE", + /* 281 */ "explain_options ::=", + /* 282 */ "explain_options ::= explain_options VERBOSE NK_BOOL", + /* 283 */ "explain_options ::= explain_options RATIO NK_FLOAT", + /* 284 */ "cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt", + /* 285 */ "cmd ::= DROP FUNCTION exists_opt function_name", + /* 286 */ "agg_func_opt ::=", + /* 287 */ "agg_func_opt ::= AGGREGATE", + /* 288 */ "bufsize_opt ::=", + /* 289 */ "bufsize_opt ::= BUFSIZE NK_INTEGER", + /* 290 */ "cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name tags_def_opt subtable_opt AS query_or_subquery", + /* 291 */ "cmd ::= DROP STREAM exists_opt stream_name", + /* 292 */ "stream_options ::=", + /* 293 */ "stream_options ::= stream_options TRIGGER AT_ONCE", + /* 294 */ "stream_options ::= stream_options TRIGGER WINDOW_CLOSE", + /* 295 */ "stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal", + /* 296 */ "stream_options ::= stream_options WATERMARK duration_literal", + /* 297 */ "stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER", + /* 298 */ "stream_options ::= stream_options FILL_HISTORY NK_INTEGER", + /* 299 */ "subtable_opt ::=", + /* 300 */ "subtable_opt ::= SUBTABLE NK_LP expression NK_RP", + /* 301 */ "cmd ::= KILL CONNECTION NK_INTEGER", + /* 302 */ "cmd ::= KILL QUERY NK_STRING", + /* 303 */ "cmd ::= KILL TRANSACTION NK_INTEGER", + /* 304 */ "cmd ::= BALANCE VGROUP", + /* 305 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER", + /* 306 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list", + /* 307 */ "cmd ::= SPLIT VGROUP NK_INTEGER", + /* 308 */ "dnode_list ::= DNODE NK_INTEGER", + /* 309 */ "dnode_list ::= dnode_list DNODE NK_INTEGER", + /* 310 */ "cmd ::= DELETE FROM full_table_name where_clause_opt", + /* 311 */ "cmd ::= query_or_subquery", + /* 312 */ "cmd ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery", + /* 313 */ "cmd ::= INSERT INTO full_table_name query_or_subquery", + /* 314 */ "literal ::= NK_INTEGER", + /* 315 */ "literal ::= NK_FLOAT", + /* 316 */ "literal ::= NK_STRING", + /* 317 */ "literal ::= NK_BOOL", + /* 318 */ "literal ::= TIMESTAMP NK_STRING", + /* 319 */ "literal ::= duration_literal", + /* 320 */ "literal ::= NULL", + /* 321 */ "literal ::= NK_QUESTION", + /* 322 */ "duration_literal ::= NK_VARIABLE", + /* 323 */ "signed ::= NK_INTEGER", + /* 324 */ "signed ::= NK_PLUS NK_INTEGER", + /* 325 */ "signed ::= NK_MINUS NK_INTEGER", + /* 326 */ "signed ::= NK_FLOAT", + /* 327 */ "signed ::= NK_PLUS NK_FLOAT", + /* 328 */ "signed ::= NK_MINUS NK_FLOAT", + /* 329 */ "signed_literal ::= signed", + /* 330 */ "signed_literal ::= NK_STRING", + /* 331 */ "signed_literal ::= NK_BOOL", + /* 332 */ "signed_literal ::= TIMESTAMP NK_STRING", + /* 333 */ "signed_literal ::= duration_literal", + /* 334 */ "signed_literal ::= NULL", + /* 335 */ "signed_literal ::= literal_func", + /* 336 */ "signed_literal ::= NK_QUESTION", + /* 337 */ "literal_list ::= signed_literal", + /* 338 */ "literal_list ::= literal_list NK_COMMA signed_literal", + /* 339 */ "db_name ::= NK_ID", + /* 340 */ "table_name ::= NK_ID", + /* 341 */ "column_name ::= NK_ID", + /* 342 */ "function_name ::= NK_ID", + /* 343 */ "table_alias ::= NK_ID", + /* 344 */ "column_alias ::= NK_ID", + /* 345 */ "user_name ::= NK_ID", + /* 346 */ "topic_name ::= NK_ID", + /* 347 */ "stream_name ::= NK_ID", + /* 348 */ "cgroup_name ::= NK_ID", + /* 349 */ "expr_or_subquery ::= expression", + /* 350 */ "expr_or_subquery ::= subquery", + /* 351 */ "expression ::= literal", + /* 352 */ "expression ::= pseudo_column", + /* 353 */ "expression ::= column_reference", + /* 354 */ "expression ::= function_expression", + /* 355 */ "expression ::= case_when_expression", + /* 356 */ "expression ::= NK_LP expression NK_RP", + /* 357 */ "expression ::= NK_PLUS expr_or_subquery", + /* 358 */ "expression ::= NK_MINUS expr_or_subquery", + /* 359 */ "expression ::= expr_or_subquery NK_PLUS expr_or_subquery", + /* 360 */ "expression ::= expr_or_subquery NK_MINUS expr_or_subquery", + /* 361 */ "expression ::= expr_or_subquery NK_STAR expr_or_subquery", + /* 362 */ "expression ::= expr_or_subquery NK_SLASH expr_or_subquery", + /* 363 */ "expression ::= expr_or_subquery NK_REM expr_or_subquery", + /* 364 */ "expression ::= column_reference NK_ARROW NK_STRING", + /* 365 */ "expression ::= expr_or_subquery NK_BITAND expr_or_subquery", + /* 366 */ "expression ::= expr_or_subquery NK_BITOR expr_or_subquery", + /* 367 */ "expression_list ::= expr_or_subquery", + /* 368 */ "expression_list ::= expression_list NK_COMMA expr_or_subquery", + /* 369 */ "column_reference ::= column_name", + /* 370 */ "column_reference ::= table_name NK_DOT column_name", + /* 371 */ "pseudo_column ::= ROWTS", + /* 372 */ "pseudo_column ::= TBNAME", + /* 373 */ "pseudo_column ::= table_name NK_DOT TBNAME", + /* 374 */ "pseudo_column ::= QSTART", + /* 375 */ "pseudo_column ::= QEND", + /* 376 */ "pseudo_column ::= QDURATION", + /* 377 */ "pseudo_column ::= WSTART", + /* 378 */ "pseudo_column ::= WEND", + /* 379 */ "pseudo_column ::= WDURATION", + /* 380 */ "pseudo_column ::= IROWTS", + /* 381 */ "pseudo_column ::= QTAGS", + /* 382 */ "function_expression ::= function_name NK_LP expression_list NK_RP", + /* 383 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP", + /* 384 */ "function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP", + /* 385 */ "function_expression ::= literal_func", + /* 386 */ "literal_func ::= noarg_func NK_LP NK_RP", + /* 387 */ "literal_func ::= NOW", + /* 388 */ "noarg_func ::= NOW", + /* 389 */ "noarg_func ::= TODAY", + /* 390 */ "noarg_func ::= TIMEZONE", + /* 391 */ "noarg_func ::= DATABASE", + /* 392 */ "noarg_func ::= CLIENT_VERSION", + /* 393 */ "noarg_func ::= SERVER_VERSION", + /* 394 */ "noarg_func ::= SERVER_STATUS", + /* 395 */ "noarg_func ::= CURRENT_USER", + /* 396 */ "noarg_func ::= USER", + /* 397 */ "star_func ::= COUNT", + /* 398 */ "star_func ::= FIRST", + /* 399 */ "star_func ::= LAST", + /* 400 */ "star_func ::= LAST_ROW", + /* 401 */ "star_func_para_list ::= NK_STAR", + /* 402 */ "star_func_para_list ::= other_para_list", + /* 403 */ "other_para_list ::= star_func_para", + /* 404 */ "other_para_list ::= other_para_list NK_COMMA star_func_para", + /* 405 */ "star_func_para ::= expr_or_subquery", + /* 406 */ "star_func_para ::= table_name NK_DOT NK_STAR", + /* 407 */ "case_when_expression ::= CASE when_then_list case_when_else_opt END", + /* 408 */ "case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END", + /* 409 */ "when_then_list ::= when_then_expr", + /* 410 */ "when_then_list ::= when_then_list when_then_expr", + /* 411 */ "when_then_expr ::= WHEN common_expression THEN common_expression", + /* 412 */ "case_when_else_opt ::=", + /* 413 */ "case_when_else_opt ::= ELSE common_expression", + /* 414 */ "predicate ::= expr_or_subquery compare_op expr_or_subquery", + /* 415 */ "predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery", + /* 416 */ "predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery", + /* 417 */ "predicate ::= expr_or_subquery IS NULL", + /* 418 */ "predicate ::= expr_or_subquery IS NOT NULL", + /* 419 */ "predicate ::= expr_or_subquery in_op in_predicate_value", + /* 420 */ "compare_op ::= NK_LT", + /* 421 */ "compare_op ::= NK_GT", + /* 422 */ "compare_op ::= NK_LE", + /* 423 */ "compare_op ::= NK_GE", + /* 424 */ "compare_op ::= NK_NE", + /* 425 */ "compare_op ::= NK_EQ", + /* 426 */ "compare_op ::= LIKE", + /* 427 */ "compare_op ::= NOT LIKE", + /* 428 */ "compare_op ::= MATCH", + /* 429 */ "compare_op ::= NMATCH", + /* 430 */ "compare_op ::= CONTAINS", + /* 431 */ "in_op ::= IN", + /* 432 */ "in_op ::= NOT IN", + /* 433 */ "in_predicate_value ::= NK_LP literal_list NK_RP", + /* 434 */ "boolean_value_expression ::= boolean_primary", + /* 435 */ "boolean_value_expression ::= NOT boolean_primary", + /* 436 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", + /* 437 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", + /* 438 */ "boolean_primary ::= predicate", + /* 439 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", + /* 440 */ "common_expression ::= expr_or_subquery", + /* 441 */ "common_expression ::= boolean_value_expression", + /* 442 */ "from_clause_opt ::=", + /* 443 */ "from_clause_opt ::= FROM table_reference_list", + /* 444 */ "table_reference_list ::= table_reference", + /* 445 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", + /* 446 */ "table_reference ::= table_primary", + /* 447 */ "table_reference ::= joined_table", + /* 448 */ "table_primary ::= table_name alias_opt", + /* 449 */ "table_primary ::= db_name NK_DOT table_name alias_opt", + /* 450 */ "table_primary ::= subquery alias_opt", + /* 451 */ "table_primary ::= parenthesized_joined_table", + /* 452 */ "alias_opt ::=", + /* 453 */ "alias_opt ::= table_alias", + /* 454 */ "alias_opt ::= AS table_alias", + /* 455 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", + /* 456 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", + /* 457 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition", + /* 458 */ "join_type ::=", + /* 459 */ "join_type ::= INNER", + /* 460 */ "query_specification ::= SELECT set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt", + /* 461 */ "set_quantifier_opt ::=", + /* 462 */ "set_quantifier_opt ::= DISTINCT", + /* 463 */ "set_quantifier_opt ::= ALL", + /* 464 */ "select_list ::= select_item", + /* 465 */ "select_list ::= select_list NK_COMMA select_item", + /* 466 */ "select_item ::= NK_STAR", + /* 467 */ "select_item ::= common_expression", + /* 468 */ "select_item ::= common_expression column_alias", + /* 469 */ "select_item ::= common_expression AS column_alias", + /* 470 */ "select_item ::= table_name NK_DOT NK_STAR", + /* 471 */ "where_clause_opt ::=", + /* 472 */ "where_clause_opt ::= WHERE search_condition", + /* 473 */ "partition_by_clause_opt ::=", + /* 474 */ "partition_by_clause_opt ::= PARTITION BY partition_list", + /* 475 */ "partition_list ::= partition_item", + /* 476 */ "partition_list ::= partition_list NK_COMMA partition_item", + /* 477 */ "partition_item ::= expr_or_subquery", + /* 478 */ "partition_item ::= expr_or_subquery column_alias", + /* 479 */ "partition_item ::= expr_or_subquery AS column_alias", + /* 480 */ "twindow_clause_opt ::=", + /* 481 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP", + /* 482 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP", + /* 483 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt", + /* 484 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt", + /* 485 */ "sliding_opt ::=", + /* 486 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP", + /* 487 */ "fill_opt ::=", + /* 488 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", + /* 489 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP", + /* 490 */ "fill_mode ::= NONE", + /* 491 */ "fill_mode ::= PREV", + /* 492 */ "fill_mode ::= NULL", + /* 493 */ "fill_mode ::= LINEAR", + /* 494 */ "fill_mode ::= NEXT", + /* 495 */ "group_by_clause_opt ::=", + /* 496 */ "group_by_clause_opt ::= GROUP BY group_by_list", + /* 497 */ "group_by_list ::= expr_or_subquery", + /* 498 */ "group_by_list ::= group_by_list NK_COMMA expr_or_subquery", + /* 499 */ "having_clause_opt ::=", + /* 500 */ "having_clause_opt ::= HAVING search_condition", + /* 501 */ "range_opt ::=", + /* 502 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP", + /* 503 */ "every_opt ::=", + /* 504 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP", + /* 505 */ "query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt", + /* 506 */ "query_simple ::= query_specification", + /* 507 */ "query_simple ::= union_query_expression", + /* 508 */ "union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery", + /* 509 */ "union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery", + /* 510 */ "query_simple_or_subquery ::= query_simple", + /* 511 */ "query_simple_or_subquery ::= subquery", + /* 512 */ "query_or_subquery ::= query_expression", + /* 513 */ "query_or_subquery ::= subquery", + /* 514 */ "order_by_clause_opt ::=", + /* 515 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", + /* 516 */ "slimit_clause_opt ::=", + /* 517 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", + /* 518 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", + /* 519 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 520 */ "limit_clause_opt ::=", + /* 521 */ "limit_clause_opt ::= LIMIT NK_INTEGER", + /* 522 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", + /* 523 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 524 */ "subquery ::= NK_LP query_expression NK_RP", + /* 525 */ "subquery ::= NK_LP subquery NK_RP", + /* 526 */ "search_condition ::= common_expression", + /* 527 */ "sort_specification_list ::= sort_specification", + /* 528 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", + /* 529 */ "sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt", + /* 530 */ "ordering_specification_opt ::=", + /* 531 */ "ordering_specification_opt ::= ASC", + /* 532 */ "ordering_specification_opt ::= DESC", + /* 533 */ "null_ordering_opt ::=", + /* 534 */ "null_ordering_opt ::= NULLS FIRST", + /* 535 */ "null_ordering_opt ::= NULLS LAST", }; #endif /* NDEBUG */ @@ -2629,63 +2599,64 @@ static void yy_destructor( case 370: /* like_pattern_opt */ case 371: /* table_name_cond */ case 372: /* from_db_opt */ - case 373: /* index_options */ - case 375: /* sliding_opt */ - case 376: /* sma_stream_opt */ - case 377: /* func */ - case 378: /* stream_options */ - case 380: /* query_or_subquery */ - case 383: /* explain_options */ - case 387: /* subtable_opt */ - case 388: /* expression */ - case 390: /* where_clause_opt */ - case 391: /* signed */ - case 392: /* literal_func */ - case 396: /* expr_or_subquery */ - case 397: /* subquery */ - case 398: /* pseudo_column */ - case 399: /* column_reference */ - case 400: /* function_expression */ - case 401: /* case_when_expression */ - case 406: /* star_func_para */ - case 408: /* case_when_else_opt */ - case 409: /* common_expression */ - case 410: /* when_then_expr */ - case 411: /* predicate */ - case 414: /* in_predicate_value */ - case 415: /* boolean_value_expression */ - case 416: /* boolean_primary */ - case 417: /* from_clause_opt */ - case 418: /* table_reference_list */ - case 419: /* table_reference */ - case 420: /* table_primary */ - case 421: /* joined_table */ - case 423: /* parenthesized_joined_table */ - case 425: /* search_condition */ - case 426: /* query_specification */ - case 430: /* range_opt */ - case 431: /* every_opt */ - case 432: /* fill_opt */ - case 433: /* twindow_clause_opt */ - case 435: /* having_clause_opt */ - case 436: /* select_item */ - case 438: /* partition_item */ - case 441: /* query_expression */ - case 442: /* query_simple */ - case 444: /* slimit_clause_opt */ - case 445: /* limit_clause_opt */ - case 446: /* union_query_expression */ - case 447: /* query_simple_or_subquery */ - case 449: /* sort_specification */ + case 374: /* tag_item */ + case 376: /* index_options */ + case 378: /* sliding_opt */ + case 379: /* sma_stream_opt */ + case 380: /* func */ + case 381: /* stream_options */ + case 383: /* query_or_subquery */ + case 386: /* explain_options */ + case 390: /* subtable_opt */ + case 391: /* expression */ + case 393: /* where_clause_opt */ + case 394: /* signed */ + case 395: /* literal_func */ + case 398: /* expr_or_subquery */ + case 399: /* subquery */ + case 400: /* pseudo_column */ + case 401: /* column_reference */ + case 402: /* function_expression */ + case 403: /* case_when_expression */ + case 408: /* star_func_para */ + case 410: /* case_when_else_opt */ + case 411: /* common_expression */ + case 412: /* when_then_expr */ + case 413: /* predicate */ + case 416: /* in_predicate_value */ + case 417: /* boolean_value_expression */ + case 418: /* boolean_primary */ + case 419: /* from_clause_opt */ + case 420: /* table_reference_list */ + case 421: /* table_reference */ + case 422: /* table_primary */ + case 423: /* joined_table */ + case 425: /* parenthesized_joined_table */ + case 427: /* search_condition */ + case 428: /* query_specification */ + case 432: /* range_opt */ + case 433: /* every_opt */ + case 434: /* fill_opt */ + case 435: /* twindow_clause_opt */ + case 437: /* having_clause_opt */ + case 438: /* select_item */ + case 440: /* partition_item */ + case 443: /* query_expression */ + case 444: /* query_simple */ + case 446: /* slimit_clause_opt */ + case 447: /* limit_clause_opt */ + case 448: /* union_query_expression */ + case 449: /* query_simple_or_subquery */ + case 451: /* sort_specification */ { - nodesDestroyNode((yypminor->yy232)); + nodesDestroyNode((yypminor->yy164)); } break; case 320: /* account_options */ case 321: /* alter_account_options */ case 323: /* alter_account_option */ case 337: /* speed_opt */ - case 385: /* bufsize_opt */ + case 388: /* bufsize_opt */ { } @@ -2697,14 +2668,14 @@ static void yy_destructor( case 352: /* column_name */ case 360: /* table_name */ case 367: /* function_name */ - case 379: /* topic_name */ - case 381: /* cgroup_name */ - case 386: /* stream_name */ - case 394: /* table_alias */ - case 395: /* column_alias */ - case 402: /* star_func */ - case 404: /* noarg_func */ - case 422: /* alias_opt */ + case 375: /* column_alias */ + case 382: /* topic_name */ + case 384: /* cgroup_name */ + case 389: /* stream_name */ + case 397: /* table_alias */ + case 404: /* star_func */ + case 406: /* noarg_func */ + case 424: /* alias_opt */ { } @@ -2724,9 +2695,9 @@ static void yy_destructor( case 332: /* force_opt */ case 333: /* not_exists_opt */ case 335: /* exists_opt */ - case 382: /* analyze_opt */ - case 384: /* agg_func_opt */ - case 427: /* set_quantifier_opt */ + case 385: /* analyze_opt */ + case 387: /* agg_func_opt */ + case 429: /* set_quantifier_opt */ { } @@ -2744,21 +2715,22 @@ static void yy_destructor( case 359: /* col_name_list */ case 362: /* duration_list */ case 363: /* rollup_func_list */ - case 374: /* func_list */ - case 389: /* dnode_list */ - case 393: /* literal_list */ - case 403: /* star_func_para_list */ - case 405: /* other_para_list */ - case 407: /* when_then_list */ - case 428: /* select_list */ - case 429: /* partition_by_clause_opt */ - case 434: /* group_by_clause_opt */ - case 437: /* partition_list */ - case 440: /* group_by_list */ - case 443: /* order_by_clause_opt */ - case 448: /* sort_specification_list */ + case 373: /* tag_list_opt */ + case 377: /* func_list */ + case 392: /* dnode_list */ + case 396: /* literal_list */ + case 405: /* star_func_para_list */ + case 407: /* other_para_list */ + case 409: /* when_then_list */ + case 430: /* select_list */ + case 431: /* partition_by_clause_opt */ + case 436: /* group_by_clause_opt */ + case 439: /* partition_list */ + case 442: /* group_by_list */ + case 445: /* order_by_clause_opt */ + case 450: /* sort_specification_list */ { - nodesDestroyList((yypminor->yy288)); + nodesDestroyList((yypminor->yy648)); } break; case 341: /* alter_db_option */ @@ -2772,28 +2744,28 @@ static void yy_destructor( } break; - case 412: /* compare_op */ - case 413: /* in_op */ + case 414: /* compare_op */ + case 415: /* in_op */ { } break; - case 424: /* join_type */ + case 426: /* join_type */ { } break; - case 439: /* fill_mode */ + case 441: /* fill_mode */ { } break; - case 450: /* ordering_specification_opt */ + case 452: /* ordering_specification_opt */ { } break; - case 451: /* null_ordering_opt */ + case 453: /* null_ordering_opt */ { } @@ -3332,7 +3304,7 @@ static const struct { { 319, -2 }, /* (237) cmd ::= SHOW CONSUMERS */ { 319, -2 }, /* (238) cmd ::= SHOW SUBSCRIPTIONS */ { 319, -5 }, /* (239) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ - { 319, -6 }, /* (240) cmd ::= SHOW TABLE TAGS FROM table_name_cond from_db_opt */ + { 319, -7 }, /* (240) cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ { 319, -3 }, /* (241) cmd ::= SHOW VNODES NK_INTEGER */ { 319, -3 }, /* (242) cmd ::= SHOW VNODES NK_STRING */ { 369, 0 }, /* (243) db_name_cond_opt ::= */ @@ -3342,284 +3314,292 @@ static const struct { { 371, -1 }, /* (247) table_name_cond ::= table_name */ { 372, 0 }, /* (248) from_db_opt ::= */ { 372, -2 }, /* (249) from_db_opt ::= FROM db_name */ - { 319, -8 }, /* (250) cmd ::= CREATE SMA INDEX not_exists_opt full_table_name ON full_table_name index_options */ - { 319, -4 }, /* (251) cmd ::= DROP INDEX exists_opt full_table_name */ - { 373, -10 }, /* (252) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ - { 373, -12 }, /* (253) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt sma_stream_opt */ - { 374, -1 }, /* (254) func_list ::= func */ - { 374, -3 }, /* (255) func_list ::= func_list NK_COMMA func */ - { 377, -4 }, /* (256) func ::= function_name NK_LP expression_list NK_RP */ - { 376, 0 }, /* (257) sma_stream_opt ::= */ - { 376, -3 }, /* (258) sma_stream_opt ::= stream_options WATERMARK duration_literal */ - { 376, -3 }, /* (259) sma_stream_opt ::= stream_options MAX_DELAY duration_literal */ - { 319, -6 }, /* (260) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ - { 319, -7 }, /* (261) cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */ - { 319, -9 }, /* (262) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */ - { 319, -7 }, /* (263) cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */ - { 319, -9 }, /* (264) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */ - { 319, -4 }, /* (265) cmd ::= DROP TOPIC exists_opt topic_name */ - { 319, -7 }, /* (266) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ - { 319, -2 }, /* (267) cmd ::= DESC full_table_name */ - { 319, -2 }, /* (268) cmd ::= DESCRIBE full_table_name */ - { 319, -3 }, /* (269) cmd ::= RESET QUERY CACHE */ - { 319, -4 }, /* (270) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ - { 382, 0 }, /* (271) analyze_opt ::= */ - { 382, -1 }, /* (272) analyze_opt ::= ANALYZE */ - { 383, 0 }, /* (273) explain_options ::= */ - { 383, -3 }, /* (274) explain_options ::= explain_options VERBOSE NK_BOOL */ - { 383, -3 }, /* (275) explain_options ::= explain_options RATIO NK_FLOAT */ - { 319, -10 }, /* (276) cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */ - { 319, -4 }, /* (277) cmd ::= DROP FUNCTION exists_opt function_name */ - { 384, 0 }, /* (278) agg_func_opt ::= */ - { 384, -1 }, /* (279) agg_func_opt ::= AGGREGATE */ - { 385, 0 }, /* (280) bufsize_opt ::= */ - { 385, -2 }, /* (281) bufsize_opt ::= BUFSIZE NK_INTEGER */ - { 319, -11 }, /* (282) cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name tags_def_opt subtable_opt AS query_or_subquery */ - { 319, -4 }, /* (283) cmd ::= DROP STREAM exists_opt stream_name */ - { 378, 0 }, /* (284) stream_options ::= */ - { 378, -3 }, /* (285) stream_options ::= stream_options TRIGGER AT_ONCE */ - { 378, -3 }, /* (286) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ - { 378, -4 }, /* (287) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ - { 378, -3 }, /* (288) stream_options ::= stream_options WATERMARK duration_literal */ - { 378, -4 }, /* (289) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ - { 378, -3 }, /* (290) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ - { 387, 0 }, /* (291) subtable_opt ::= */ - { 387, -4 }, /* (292) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ - { 319, -3 }, /* (293) cmd ::= KILL CONNECTION NK_INTEGER */ - { 319, -3 }, /* (294) cmd ::= KILL QUERY NK_STRING */ - { 319, -3 }, /* (295) cmd ::= KILL TRANSACTION NK_INTEGER */ - { 319, -2 }, /* (296) cmd ::= BALANCE VGROUP */ - { 319, -4 }, /* (297) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ - { 319, -4 }, /* (298) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ - { 319, -3 }, /* (299) cmd ::= SPLIT VGROUP NK_INTEGER */ - { 389, -2 }, /* (300) dnode_list ::= DNODE NK_INTEGER */ - { 389, -3 }, /* (301) dnode_list ::= dnode_list DNODE NK_INTEGER */ - { 319, -4 }, /* (302) cmd ::= DELETE FROM full_table_name where_clause_opt */ - { 319, -1 }, /* (303) cmd ::= query_or_subquery */ - { 319, -7 }, /* (304) cmd ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ - { 319, -4 }, /* (305) cmd ::= INSERT INTO full_table_name query_or_subquery */ - { 322, -1 }, /* (306) literal ::= NK_INTEGER */ - { 322, -1 }, /* (307) literal ::= NK_FLOAT */ - { 322, -1 }, /* (308) literal ::= NK_STRING */ - { 322, -1 }, /* (309) literal ::= NK_BOOL */ - { 322, -2 }, /* (310) literal ::= TIMESTAMP NK_STRING */ - { 322, -1 }, /* (311) literal ::= duration_literal */ - { 322, -1 }, /* (312) literal ::= NULL */ - { 322, -1 }, /* (313) literal ::= NK_QUESTION */ - { 365, -1 }, /* (314) duration_literal ::= NK_VARIABLE */ - { 391, -1 }, /* (315) signed ::= NK_INTEGER */ - { 391, -2 }, /* (316) signed ::= NK_PLUS NK_INTEGER */ - { 391, -2 }, /* (317) signed ::= NK_MINUS NK_INTEGER */ - { 391, -1 }, /* (318) signed ::= NK_FLOAT */ - { 391, -2 }, /* (319) signed ::= NK_PLUS NK_FLOAT */ - { 391, -2 }, /* (320) signed ::= NK_MINUS NK_FLOAT */ - { 354, -1 }, /* (321) signed_literal ::= signed */ - { 354, -1 }, /* (322) signed_literal ::= NK_STRING */ - { 354, -1 }, /* (323) signed_literal ::= NK_BOOL */ - { 354, -2 }, /* (324) signed_literal ::= TIMESTAMP NK_STRING */ - { 354, -1 }, /* (325) signed_literal ::= duration_literal */ - { 354, -1 }, /* (326) signed_literal ::= NULL */ - { 354, -1 }, /* (327) signed_literal ::= literal_func */ - { 354, -1 }, /* (328) signed_literal ::= NK_QUESTION */ - { 393, -1 }, /* (329) literal_list ::= signed_literal */ - { 393, -3 }, /* (330) literal_list ::= literal_list NK_COMMA signed_literal */ - { 330, -1 }, /* (331) db_name ::= NK_ID */ - { 360, -1 }, /* (332) table_name ::= NK_ID */ - { 352, -1 }, /* (333) column_name ::= NK_ID */ - { 367, -1 }, /* (334) function_name ::= NK_ID */ - { 394, -1 }, /* (335) table_alias ::= NK_ID */ - { 395, -1 }, /* (336) column_alias ::= NK_ID */ - { 324, -1 }, /* (337) user_name ::= NK_ID */ - { 379, -1 }, /* (338) topic_name ::= NK_ID */ - { 386, -1 }, /* (339) stream_name ::= NK_ID */ - { 381, -1 }, /* (340) cgroup_name ::= NK_ID */ - { 396, -1 }, /* (341) expr_or_subquery ::= expression */ - { 396, -1 }, /* (342) expr_or_subquery ::= subquery */ - { 388, -1 }, /* (343) expression ::= literal */ - { 388, -1 }, /* (344) expression ::= pseudo_column */ - { 388, -1 }, /* (345) expression ::= column_reference */ - { 388, -1 }, /* (346) expression ::= function_expression */ - { 388, -1 }, /* (347) expression ::= case_when_expression */ - { 388, -3 }, /* (348) expression ::= NK_LP expression NK_RP */ - { 388, -2 }, /* (349) expression ::= NK_PLUS expr_or_subquery */ - { 388, -2 }, /* (350) expression ::= NK_MINUS expr_or_subquery */ - { 388, -3 }, /* (351) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ - { 388, -3 }, /* (352) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ - { 388, -3 }, /* (353) expression ::= expr_or_subquery NK_STAR expr_or_subquery */ - { 388, -3 }, /* (354) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ - { 388, -3 }, /* (355) expression ::= expr_or_subquery NK_REM expr_or_subquery */ - { 388, -3 }, /* (356) expression ::= column_reference NK_ARROW NK_STRING */ - { 388, -3 }, /* (357) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ - { 388, -3 }, /* (358) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ - { 357, -1 }, /* (359) expression_list ::= expr_or_subquery */ - { 357, -3 }, /* (360) expression_list ::= expression_list NK_COMMA expr_or_subquery */ - { 399, -1 }, /* (361) column_reference ::= column_name */ - { 399, -3 }, /* (362) column_reference ::= table_name NK_DOT column_name */ - { 398, -1 }, /* (363) pseudo_column ::= ROWTS */ - { 398, -1 }, /* (364) pseudo_column ::= TBNAME */ - { 398, -3 }, /* (365) pseudo_column ::= table_name NK_DOT TBNAME */ - { 398, -1 }, /* (366) pseudo_column ::= QSTART */ - { 398, -1 }, /* (367) pseudo_column ::= QEND */ - { 398, -1 }, /* (368) pseudo_column ::= QDURATION */ - { 398, -1 }, /* (369) pseudo_column ::= WSTART */ - { 398, -1 }, /* (370) pseudo_column ::= WEND */ - { 398, -1 }, /* (371) pseudo_column ::= WDURATION */ - { 398, -1 }, /* (372) pseudo_column ::= IROWTS */ - { 398, -1 }, /* (373) pseudo_column ::= QTAGS */ - { 400, -4 }, /* (374) function_expression ::= function_name NK_LP expression_list NK_RP */ - { 400, -4 }, /* (375) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ - { 400, -6 }, /* (376) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ - { 400, -1 }, /* (377) function_expression ::= literal_func */ - { 392, -3 }, /* (378) literal_func ::= noarg_func NK_LP NK_RP */ - { 392, -1 }, /* (379) literal_func ::= NOW */ - { 404, -1 }, /* (380) noarg_func ::= NOW */ - { 404, -1 }, /* (381) noarg_func ::= TODAY */ - { 404, -1 }, /* (382) noarg_func ::= TIMEZONE */ - { 404, -1 }, /* (383) noarg_func ::= DATABASE */ - { 404, -1 }, /* (384) noarg_func ::= CLIENT_VERSION */ - { 404, -1 }, /* (385) noarg_func ::= SERVER_VERSION */ - { 404, -1 }, /* (386) noarg_func ::= SERVER_STATUS */ - { 404, -1 }, /* (387) noarg_func ::= CURRENT_USER */ - { 404, -1 }, /* (388) noarg_func ::= USER */ - { 402, -1 }, /* (389) star_func ::= COUNT */ - { 402, -1 }, /* (390) star_func ::= FIRST */ - { 402, -1 }, /* (391) star_func ::= LAST */ - { 402, -1 }, /* (392) star_func ::= LAST_ROW */ - { 403, -1 }, /* (393) star_func_para_list ::= NK_STAR */ - { 403, -1 }, /* (394) star_func_para_list ::= other_para_list */ - { 405, -1 }, /* (395) other_para_list ::= star_func_para */ - { 405, -3 }, /* (396) other_para_list ::= other_para_list NK_COMMA star_func_para */ - { 406, -1 }, /* (397) star_func_para ::= expr_or_subquery */ - { 406, -3 }, /* (398) star_func_para ::= table_name NK_DOT NK_STAR */ - { 401, -4 }, /* (399) case_when_expression ::= CASE when_then_list case_when_else_opt END */ - { 401, -5 }, /* (400) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ - { 407, -1 }, /* (401) when_then_list ::= when_then_expr */ - { 407, -2 }, /* (402) when_then_list ::= when_then_list when_then_expr */ - { 410, -4 }, /* (403) when_then_expr ::= WHEN common_expression THEN common_expression */ - { 408, 0 }, /* (404) case_when_else_opt ::= */ - { 408, -2 }, /* (405) case_when_else_opt ::= ELSE common_expression */ - { 411, -3 }, /* (406) predicate ::= expr_or_subquery compare_op expr_or_subquery */ - { 411, -5 }, /* (407) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ - { 411, -6 }, /* (408) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ - { 411, -3 }, /* (409) predicate ::= expr_or_subquery IS NULL */ - { 411, -4 }, /* (410) predicate ::= expr_or_subquery IS NOT NULL */ - { 411, -3 }, /* (411) predicate ::= expr_or_subquery in_op in_predicate_value */ - { 412, -1 }, /* (412) compare_op ::= NK_LT */ - { 412, -1 }, /* (413) compare_op ::= NK_GT */ - { 412, -1 }, /* (414) compare_op ::= NK_LE */ - { 412, -1 }, /* (415) compare_op ::= NK_GE */ - { 412, -1 }, /* (416) compare_op ::= NK_NE */ - { 412, -1 }, /* (417) compare_op ::= NK_EQ */ - { 412, -1 }, /* (418) compare_op ::= LIKE */ - { 412, -2 }, /* (419) compare_op ::= NOT LIKE */ - { 412, -1 }, /* (420) compare_op ::= MATCH */ - { 412, -1 }, /* (421) compare_op ::= NMATCH */ - { 412, -1 }, /* (422) compare_op ::= CONTAINS */ - { 413, -1 }, /* (423) in_op ::= IN */ - { 413, -2 }, /* (424) in_op ::= NOT IN */ - { 414, -3 }, /* (425) in_predicate_value ::= NK_LP literal_list NK_RP */ - { 415, -1 }, /* (426) boolean_value_expression ::= boolean_primary */ - { 415, -2 }, /* (427) boolean_value_expression ::= NOT boolean_primary */ - { 415, -3 }, /* (428) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ - { 415, -3 }, /* (429) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ - { 416, -1 }, /* (430) boolean_primary ::= predicate */ - { 416, -3 }, /* (431) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ - { 409, -1 }, /* (432) common_expression ::= expr_or_subquery */ - { 409, -1 }, /* (433) common_expression ::= boolean_value_expression */ - { 417, 0 }, /* (434) from_clause_opt ::= */ - { 417, -2 }, /* (435) from_clause_opt ::= FROM table_reference_list */ - { 418, -1 }, /* (436) table_reference_list ::= table_reference */ - { 418, -3 }, /* (437) table_reference_list ::= table_reference_list NK_COMMA table_reference */ - { 419, -1 }, /* (438) table_reference ::= table_primary */ - { 419, -1 }, /* (439) table_reference ::= joined_table */ - { 420, -2 }, /* (440) table_primary ::= table_name alias_opt */ - { 420, -4 }, /* (441) table_primary ::= db_name NK_DOT table_name alias_opt */ - { 420, -2 }, /* (442) table_primary ::= subquery alias_opt */ - { 420, -1 }, /* (443) table_primary ::= parenthesized_joined_table */ - { 422, 0 }, /* (444) alias_opt ::= */ - { 422, -1 }, /* (445) alias_opt ::= table_alias */ - { 422, -2 }, /* (446) alias_opt ::= AS table_alias */ - { 423, -3 }, /* (447) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - { 423, -3 }, /* (448) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ - { 421, -6 }, /* (449) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ - { 424, 0 }, /* (450) join_type ::= */ - { 424, -1 }, /* (451) join_type ::= INNER */ - { 426, -12 }, /* (452) query_specification ::= SELECT set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ - { 427, 0 }, /* (453) set_quantifier_opt ::= */ - { 427, -1 }, /* (454) set_quantifier_opt ::= DISTINCT */ - { 427, -1 }, /* (455) set_quantifier_opt ::= ALL */ - { 428, -1 }, /* (456) select_list ::= select_item */ - { 428, -3 }, /* (457) select_list ::= select_list NK_COMMA select_item */ - { 436, -1 }, /* (458) select_item ::= NK_STAR */ - { 436, -1 }, /* (459) select_item ::= common_expression */ - { 436, -2 }, /* (460) select_item ::= common_expression column_alias */ - { 436, -3 }, /* (461) select_item ::= common_expression AS column_alias */ - { 436, -3 }, /* (462) select_item ::= table_name NK_DOT NK_STAR */ - { 390, 0 }, /* (463) where_clause_opt ::= */ - { 390, -2 }, /* (464) where_clause_opt ::= WHERE search_condition */ - { 429, 0 }, /* (465) partition_by_clause_opt ::= */ - { 429, -3 }, /* (466) partition_by_clause_opt ::= PARTITION BY partition_list */ - { 437, -1 }, /* (467) partition_list ::= partition_item */ - { 437, -3 }, /* (468) partition_list ::= partition_list NK_COMMA partition_item */ - { 438, -1 }, /* (469) partition_item ::= expr_or_subquery */ - { 438, -2 }, /* (470) partition_item ::= expr_or_subquery column_alias */ - { 438, -3 }, /* (471) partition_item ::= expr_or_subquery AS column_alias */ - { 433, 0 }, /* (472) twindow_clause_opt ::= */ - { 433, -6 }, /* (473) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ - { 433, -4 }, /* (474) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ - { 433, -6 }, /* (475) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ - { 433, -8 }, /* (476) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ - { 375, 0 }, /* (477) sliding_opt ::= */ - { 375, -4 }, /* (478) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ - { 432, 0 }, /* (479) fill_opt ::= */ - { 432, -4 }, /* (480) fill_opt ::= FILL NK_LP fill_mode NK_RP */ - { 432, -6 }, /* (481) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ - { 439, -1 }, /* (482) fill_mode ::= NONE */ - { 439, -1 }, /* (483) fill_mode ::= PREV */ - { 439, -1 }, /* (484) fill_mode ::= NULL */ - { 439, -1 }, /* (485) fill_mode ::= LINEAR */ - { 439, -1 }, /* (486) fill_mode ::= NEXT */ - { 434, 0 }, /* (487) group_by_clause_opt ::= */ - { 434, -3 }, /* (488) group_by_clause_opt ::= GROUP BY group_by_list */ - { 440, -1 }, /* (489) group_by_list ::= expr_or_subquery */ - { 440, -3 }, /* (490) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ - { 435, 0 }, /* (491) having_clause_opt ::= */ - { 435, -2 }, /* (492) having_clause_opt ::= HAVING search_condition */ - { 430, 0 }, /* (493) range_opt ::= */ - { 430, -6 }, /* (494) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ - { 431, 0 }, /* (495) every_opt ::= */ - { 431, -4 }, /* (496) every_opt ::= EVERY NK_LP duration_literal NK_RP */ - { 441, -4 }, /* (497) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ - { 442, -1 }, /* (498) query_simple ::= query_specification */ - { 442, -1 }, /* (499) query_simple ::= union_query_expression */ - { 446, -4 }, /* (500) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ - { 446, -3 }, /* (501) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ - { 447, -1 }, /* (502) query_simple_or_subquery ::= query_simple */ - { 447, -1 }, /* (503) query_simple_or_subquery ::= subquery */ - { 380, -1 }, /* (504) query_or_subquery ::= query_expression */ - { 380, -1 }, /* (505) query_or_subquery ::= subquery */ - { 443, 0 }, /* (506) order_by_clause_opt ::= */ - { 443, -3 }, /* (507) order_by_clause_opt ::= ORDER BY sort_specification_list */ - { 444, 0 }, /* (508) slimit_clause_opt ::= */ - { 444, -2 }, /* (509) slimit_clause_opt ::= SLIMIT NK_INTEGER */ - { 444, -4 }, /* (510) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - { 444, -4 }, /* (511) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - { 445, 0 }, /* (512) limit_clause_opt ::= */ - { 445, -2 }, /* (513) limit_clause_opt ::= LIMIT NK_INTEGER */ - { 445, -4 }, /* (514) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ - { 445, -4 }, /* (515) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - { 397, -3 }, /* (516) subquery ::= NK_LP query_expression NK_RP */ - { 397, -3 }, /* (517) subquery ::= NK_LP subquery NK_RP */ - { 425, -1 }, /* (518) search_condition ::= common_expression */ - { 448, -1 }, /* (519) sort_specification_list ::= sort_specification */ - { 448, -3 }, /* (520) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ - { 449, -3 }, /* (521) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ - { 450, 0 }, /* (522) ordering_specification_opt ::= */ - { 450, -1 }, /* (523) ordering_specification_opt ::= ASC */ - { 450, -1 }, /* (524) ordering_specification_opt ::= DESC */ - { 451, 0 }, /* (525) null_ordering_opt ::= */ - { 451, -2 }, /* (526) null_ordering_opt ::= NULLS FIRST */ - { 451, -2 }, /* (527) null_ordering_opt ::= NULLS LAST */ + { 373, 0 }, /* (250) tag_list_opt ::= */ + { 373, -1 }, /* (251) tag_list_opt ::= tag_item */ + { 373, -3 }, /* (252) tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ + { 374, -1 }, /* (253) tag_item ::= TBNAME */ + { 374, -1 }, /* (254) tag_item ::= QTAGS */ + { 374, -1 }, /* (255) tag_item ::= column_name */ + { 374, -2 }, /* (256) tag_item ::= column_name column_alias */ + { 374, -3 }, /* (257) tag_item ::= column_name AS column_alias */ + { 319, -8 }, /* (258) cmd ::= CREATE SMA INDEX not_exists_opt full_table_name ON full_table_name index_options */ + { 319, -4 }, /* (259) cmd ::= DROP INDEX exists_opt full_table_name */ + { 376, -10 }, /* (260) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ + { 376, -12 }, /* (261) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt sma_stream_opt */ + { 377, -1 }, /* (262) func_list ::= func */ + { 377, -3 }, /* (263) func_list ::= func_list NK_COMMA func */ + { 380, -4 }, /* (264) func ::= function_name NK_LP expression_list NK_RP */ + { 379, 0 }, /* (265) sma_stream_opt ::= */ + { 379, -3 }, /* (266) sma_stream_opt ::= stream_options WATERMARK duration_literal */ + { 379, -3 }, /* (267) sma_stream_opt ::= stream_options MAX_DELAY duration_literal */ + { 319, -6 }, /* (268) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ + { 319, -7 }, /* (269) cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */ + { 319, -9 }, /* (270) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */ + { 319, -7 }, /* (271) cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */ + { 319, -9 }, /* (272) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */ + { 319, -4 }, /* (273) cmd ::= DROP TOPIC exists_opt topic_name */ + { 319, -7 }, /* (274) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ + { 319, -2 }, /* (275) cmd ::= DESC full_table_name */ + { 319, -2 }, /* (276) cmd ::= DESCRIBE full_table_name */ + { 319, -3 }, /* (277) cmd ::= RESET QUERY CACHE */ + { 319, -4 }, /* (278) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ + { 385, 0 }, /* (279) analyze_opt ::= */ + { 385, -1 }, /* (280) analyze_opt ::= ANALYZE */ + { 386, 0 }, /* (281) explain_options ::= */ + { 386, -3 }, /* (282) explain_options ::= explain_options VERBOSE NK_BOOL */ + { 386, -3 }, /* (283) explain_options ::= explain_options RATIO NK_FLOAT */ + { 319, -10 }, /* (284) cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */ + { 319, -4 }, /* (285) cmd ::= DROP FUNCTION exists_opt function_name */ + { 387, 0 }, /* (286) agg_func_opt ::= */ + { 387, -1 }, /* (287) agg_func_opt ::= AGGREGATE */ + { 388, 0 }, /* (288) bufsize_opt ::= */ + { 388, -2 }, /* (289) bufsize_opt ::= BUFSIZE NK_INTEGER */ + { 319, -11 }, /* (290) cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name tags_def_opt subtable_opt AS query_or_subquery */ + { 319, -4 }, /* (291) cmd ::= DROP STREAM exists_opt stream_name */ + { 381, 0 }, /* (292) stream_options ::= */ + { 381, -3 }, /* (293) stream_options ::= stream_options TRIGGER AT_ONCE */ + { 381, -3 }, /* (294) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ + { 381, -4 }, /* (295) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ + { 381, -3 }, /* (296) stream_options ::= stream_options WATERMARK duration_literal */ + { 381, -4 }, /* (297) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ + { 381, -3 }, /* (298) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ + { 390, 0 }, /* (299) subtable_opt ::= */ + { 390, -4 }, /* (300) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ + { 319, -3 }, /* (301) cmd ::= KILL CONNECTION NK_INTEGER */ + { 319, -3 }, /* (302) cmd ::= KILL QUERY NK_STRING */ + { 319, -3 }, /* (303) cmd ::= KILL TRANSACTION NK_INTEGER */ + { 319, -2 }, /* (304) cmd ::= BALANCE VGROUP */ + { 319, -4 }, /* (305) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ + { 319, -4 }, /* (306) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ + { 319, -3 }, /* (307) cmd ::= SPLIT VGROUP NK_INTEGER */ + { 392, -2 }, /* (308) dnode_list ::= DNODE NK_INTEGER */ + { 392, -3 }, /* (309) dnode_list ::= dnode_list DNODE NK_INTEGER */ + { 319, -4 }, /* (310) cmd ::= DELETE FROM full_table_name where_clause_opt */ + { 319, -1 }, /* (311) cmd ::= query_or_subquery */ + { 319, -7 }, /* (312) cmd ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ + { 319, -4 }, /* (313) cmd ::= INSERT INTO full_table_name query_or_subquery */ + { 322, -1 }, /* (314) literal ::= NK_INTEGER */ + { 322, -1 }, /* (315) literal ::= NK_FLOAT */ + { 322, -1 }, /* (316) literal ::= NK_STRING */ + { 322, -1 }, /* (317) literal ::= NK_BOOL */ + { 322, -2 }, /* (318) literal ::= TIMESTAMP NK_STRING */ + { 322, -1 }, /* (319) literal ::= duration_literal */ + { 322, -1 }, /* (320) literal ::= NULL */ + { 322, -1 }, /* (321) literal ::= NK_QUESTION */ + { 365, -1 }, /* (322) duration_literal ::= NK_VARIABLE */ + { 394, -1 }, /* (323) signed ::= NK_INTEGER */ + { 394, -2 }, /* (324) signed ::= NK_PLUS NK_INTEGER */ + { 394, -2 }, /* (325) signed ::= NK_MINUS NK_INTEGER */ + { 394, -1 }, /* (326) signed ::= NK_FLOAT */ + { 394, -2 }, /* (327) signed ::= NK_PLUS NK_FLOAT */ + { 394, -2 }, /* (328) signed ::= NK_MINUS NK_FLOAT */ + { 354, -1 }, /* (329) signed_literal ::= signed */ + { 354, -1 }, /* (330) signed_literal ::= NK_STRING */ + { 354, -1 }, /* (331) signed_literal ::= NK_BOOL */ + { 354, -2 }, /* (332) signed_literal ::= TIMESTAMP NK_STRING */ + { 354, -1 }, /* (333) signed_literal ::= duration_literal */ + { 354, -1 }, /* (334) signed_literal ::= NULL */ + { 354, -1 }, /* (335) signed_literal ::= literal_func */ + { 354, -1 }, /* (336) signed_literal ::= NK_QUESTION */ + { 396, -1 }, /* (337) literal_list ::= signed_literal */ + { 396, -3 }, /* (338) literal_list ::= literal_list NK_COMMA signed_literal */ + { 330, -1 }, /* (339) db_name ::= NK_ID */ + { 360, -1 }, /* (340) table_name ::= NK_ID */ + { 352, -1 }, /* (341) column_name ::= NK_ID */ + { 367, -1 }, /* (342) function_name ::= NK_ID */ + { 397, -1 }, /* (343) table_alias ::= NK_ID */ + { 375, -1 }, /* (344) column_alias ::= NK_ID */ + { 324, -1 }, /* (345) user_name ::= NK_ID */ + { 382, -1 }, /* (346) topic_name ::= NK_ID */ + { 389, -1 }, /* (347) stream_name ::= NK_ID */ + { 384, -1 }, /* (348) cgroup_name ::= NK_ID */ + { 398, -1 }, /* (349) expr_or_subquery ::= expression */ + { 398, -1 }, /* (350) expr_or_subquery ::= subquery */ + { 391, -1 }, /* (351) expression ::= literal */ + { 391, -1 }, /* (352) expression ::= pseudo_column */ + { 391, -1 }, /* (353) expression ::= column_reference */ + { 391, -1 }, /* (354) expression ::= function_expression */ + { 391, -1 }, /* (355) expression ::= case_when_expression */ + { 391, -3 }, /* (356) expression ::= NK_LP expression NK_RP */ + { 391, -2 }, /* (357) expression ::= NK_PLUS expr_or_subquery */ + { 391, -2 }, /* (358) expression ::= NK_MINUS expr_or_subquery */ + { 391, -3 }, /* (359) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ + { 391, -3 }, /* (360) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ + { 391, -3 }, /* (361) expression ::= expr_or_subquery NK_STAR expr_or_subquery */ + { 391, -3 }, /* (362) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ + { 391, -3 }, /* (363) expression ::= expr_or_subquery NK_REM expr_or_subquery */ + { 391, -3 }, /* (364) expression ::= column_reference NK_ARROW NK_STRING */ + { 391, -3 }, /* (365) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ + { 391, -3 }, /* (366) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ + { 357, -1 }, /* (367) expression_list ::= expr_or_subquery */ + { 357, -3 }, /* (368) expression_list ::= expression_list NK_COMMA expr_or_subquery */ + { 401, -1 }, /* (369) column_reference ::= column_name */ + { 401, -3 }, /* (370) column_reference ::= table_name NK_DOT column_name */ + { 400, -1 }, /* (371) pseudo_column ::= ROWTS */ + { 400, -1 }, /* (372) pseudo_column ::= TBNAME */ + { 400, -3 }, /* (373) pseudo_column ::= table_name NK_DOT TBNAME */ + { 400, -1 }, /* (374) pseudo_column ::= QSTART */ + { 400, -1 }, /* (375) pseudo_column ::= QEND */ + { 400, -1 }, /* (376) pseudo_column ::= QDURATION */ + { 400, -1 }, /* (377) pseudo_column ::= WSTART */ + { 400, -1 }, /* (378) pseudo_column ::= WEND */ + { 400, -1 }, /* (379) pseudo_column ::= WDURATION */ + { 400, -1 }, /* (380) pseudo_column ::= IROWTS */ + { 400, -1 }, /* (381) pseudo_column ::= QTAGS */ + { 402, -4 }, /* (382) function_expression ::= function_name NK_LP expression_list NK_RP */ + { 402, -4 }, /* (383) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ + { 402, -6 }, /* (384) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ + { 402, -1 }, /* (385) function_expression ::= literal_func */ + { 395, -3 }, /* (386) literal_func ::= noarg_func NK_LP NK_RP */ + { 395, -1 }, /* (387) literal_func ::= NOW */ + { 406, -1 }, /* (388) noarg_func ::= NOW */ + { 406, -1 }, /* (389) noarg_func ::= TODAY */ + { 406, -1 }, /* (390) noarg_func ::= TIMEZONE */ + { 406, -1 }, /* (391) noarg_func ::= DATABASE */ + { 406, -1 }, /* (392) noarg_func ::= CLIENT_VERSION */ + { 406, -1 }, /* (393) noarg_func ::= SERVER_VERSION */ + { 406, -1 }, /* (394) noarg_func ::= SERVER_STATUS */ + { 406, -1 }, /* (395) noarg_func ::= CURRENT_USER */ + { 406, -1 }, /* (396) noarg_func ::= USER */ + { 404, -1 }, /* (397) star_func ::= COUNT */ + { 404, -1 }, /* (398) star_func ::= FIRST */ + { 404, -1 }, /* (399) star_func ::= LAST */ + { 404, -1 }, /* (400) star_func ::= LAST_ROW */ + { 405, -1 }, /* (401) star_func_para_list ::= NK_STAR */ + { 405, -1 }, /* (402) star_func_para_list ::= other_para_list */ + { 407, -1 }, /* (403) other_para_list ::= star_func_para */ + { 407, -3 }, /* (404) other_para_list ::= other_para_list NK_COMMA star_func_para */ + { 408, -1 }, /* (405) star_func_para ::= expr_or_subquery */ + { 408, -3 }, /* (406) star_func_para ::= table_name NK_DOT NK_STAR */ + { 403, -4 }, /* (407) case_when_expression ::= CASE when_then_list case_when_else_opt END */ + { 403, -5 }, /* (408) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ + { 409, -1 }, /* (409) when_then_list ::= when_then_expr */ + { 409, -2 }, /* (410) when_then_list ::= when_then_list when_then_expr */ + { 412, -4 }, /* (411) when_then_expr ::= WHEN common_expression THEN common_expression */ + { 410, 0 }, /* (412) case_when_else_opt ::= */ + { 410, -2 }, /* (413) case_when_else_opt ::= ELSE common_expression */ + { 413, -3 }, /* (414) predicate ::= expr_or_subquery compare_op expr_or_subquery */ + { 413, -5 }, /* (415) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ + { 413, -6 }, /* (416) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ + { 413, -3 }, /* (417) predicate ::= expr_or_subquery IS NULL */ + { 413, -4 }, /* (418) predicate ::= expr_or_subquery IS NOT NULL */ + { 413, -3 }, /* (419) predicate ::= expr_or_subquery in_op in_predicate_value */ + { 414, -1 }, /* (420) compare_op ::= NK_LT */ + { 414, -1 }, /* (421) compare_op ::= NK_GT */ + { 414, -1 }, /* (422) compare_op ::= NK_LE */ + { 414, -1 }, /* (423) compare_op ::= NK_GE */ + { 414, -1 }, /* (424) compare_op ::= NK_NE */ + { 414, -1 }, /* (425) compare_op ::= NK_EQ */ + { 414, -1 }, /* (426) compare_op ::= LIKE */ + { 414, -2 }, /* (427) compare_op ::= NOT LIKE */ + { 414, -1 }, /* (428) compare_op ::= MATCH */ + { 414, -1 }, /* (429) compare_op ::= NMATCH */ + { 414, -1 }, /* (430) compare_op ::= CONTAINS */ + { 415, -1 }, /* (431) in_op ::= IN */ + { 415, -2 }, /* (432) in_op ::= NOT IN */ + { 416, -3 }, /* (433) in_predicate_value ::= NK_LP literal_list NK_RP */ + { 417, -1 }, /* (434) boolean_value_expression ::= boolean_primary */ + { 417, -2 }, /* (435) boolean_value_expression ::= NOT boolean_primary */ + { 417, -3 }, /* (436) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + { 417, -3 }, /* (437) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + { 418, -1 }, /* (438) boolean_primary ::= predicate */ + { 418, -3 }, /* (439) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ + { 411, -1 }, /* (440) common_expression ::= expr_or_subquery */ + { 411, -1 }, /* (441) common_expression ::= boolean_value_expression */ + { 419, 0 }, /* (442) from_clause_opt ::= */ + { 419, -2 }, /* (443) from_clause_opt ::= FROM table_reference_list */ + { 420, -1 }, /* (444) table_reference_list ::= table_reference */ + { 420, -3 }, /* (445) table_reference_list ::= table_reference_list NK_COMMA table_reference */ + { 421, -1 }, /* (446) table_reference ::= table_primary */ + { 421, -1 }, /* (447) table_reference ::= joined_table */ + { 422, -2 }, /* (448) table_primary ::= table_name alias_opt */ + { 422, -4 }, /* (449) table_primary ::= db_name NK_DOT table_name alias_opt */ + { 422, -2 }, /* (450) table_primary ::= subquery alias_opt */ + { 422, -1 }, /* (451) table_primary ::= parenthesized_joined_table */ + { 424, 0 }, /* (452) alias_opt ::= */ + { 424, -1 }, /* (453) alias_opt ::= table_alias */ + { 424, -2 }, /* (454) alias_opt ::= AS table_alias */ + { 425, -3 }, /* (455) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + { 425, -3 }, /* (456) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ + { 423, -6 }, /* (457) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ + { 426, 0 }, /* (458) join_type ::= */ + { 426, -1 }, /* (459) join_type ::= INNER */ + { 428, -12 }, /* (460) query_specification ::= SELECT set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ + { 429, 0 }, /* (461) set_quantifier_opt ::= */ + { 429, -1 }, /* (462) set_quantifier_opt ::= DISTINCT */ + { 429, -1 }, /* (463) set_quantifier_opt ::= ALL */ + { 430, -1 }, /* (464) select_list ::= select_item */ + { 430, -3 }, /* (465) select_list ::= select_list NK_COMMA select_item */ + { 438, -1 }, /* (466) select_item ::= NK_STAR */ + { 438, -1 }, /* (467) select_item ::= common_expression */ + { 438, -2 }, /* (468) select_item ::= common_expression column_alias */ + { 438, -3 }, /* (469) select_item ::= common_expression AS column_alias */ + { 438, -3 }, /* (470) select_item ::= table_name NK_DOT NK_STAR */ + { 393, 0 }, /* (471) where_clause_opt ::= */ + { 393, -2 }, /* (472) where_clause_opt ::= WHERE search_condition */ + { 431, 0 }, /* (473) partition_by_clause_opt ::= */ + { 431, -3 }, /* (474) partition_by_clause_opt ::= PARTITION BY partition_list */ + { 439, -1 }, /* (475) partition_list ::= partition_item */ + { 439, -3 }, /* (476) partition_list ::= partition_list NK_COMMA partition_item */ + { 440, -1 }, /* (477) partition_item ::= expr_or_subquery */ + { 440, -2 }, /* (478) partition_item ::= expr_or_subquery column_alias */ + { 440, -3 }, /* (479) partition_item ::= expr_or_subquery AS column_alias */ + { 435, 0 }, /* (480) twindow_clause_opt ::= */ + { 435, -6 }, /* (481) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ + { 435, -4 }, /* (482) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ + { 435, -6 }, /* (483) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ + { 435, -8 }, /* (484) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ + { 378, 0 }, /* (485) sliding_opt ::= */ + { 378, -4 }, /* (486) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ + { 434, 0 }, /* (487) fill_opt ::= */ + { 434, -4 }, /* (488) fill_opt ::= FILL NK_LP fill_mode NK_RP */ + { 434, -6 }, /* (489) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ + { 441, -1 }, /* (490) fill_mode ::= NONE */ + { 441, -1 }, /* (491) fill_mode ::= PREV */ + { 441, -1 }, /* (492) fill_mode ::= NULL */ + { 441, -1 }, /* (493) fill_mode ::= LINEAR */ + { 441, -1 }, /* (494) fill_mode ::= NEXT */ + { 436, 0 }, /* (495) group_by_clause_opt ::= */ + { 436, -3 }, /* (496) group_by_clause_opt ::= GROUP BY group_by_list */ + { 442, -1 }, /* (497) group_by_list ::= expr_or_subquery */ + { 442, -3 }, /* (498) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ + { 437, 0 }, /* (499) having_clause_opt ::= */ + { 437, -2 }, /* (500) having_clause_opt ::= HAVING search_condition */ + { 432, 0 }, /* (501) range_opt ::= */ + { 432, -6 }, /* (502) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ + { 433, 0 }, /* (503) every_opt ::= */ + { 433, -4 }, /* (504) every_opt ::= EVERY NK_LP duration_literal NK_RP */ + { 443, -4 }, /* (505) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ + { 444, -1 }, /* (506) query_simple ::= query_specification */ + { 444, -1 }, /* (507) query_simple ::= union_query_expression */ + { 448, -4 }, /* (508) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ + { 448, -3 }, /* (509) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ + { 449, -1 }, /* (510) query_simple_or_subquery ::= query_simple */ + { 449, -1 }, /* (511) query_simple_or_subquery ::= subquery */ + { 383, -1 }, /* (512) query_or_subquery ::= query_expression */ + { 383, -1 }, /* (513) query_or_subquery ::= subquery */ + { 445, 0 }, /* (514) order_by_clause_opt ::= */ + { 445, -3 }, /* (515) order_by_clause_opt ::= ORDER BY sort_specification_list */ + { 446, 0 }, /* (516) slimit_clause_opt ::= */ + { 446, -2 }, /* (517) slimit_clause_opt ::= SLIMIT NK_INTEGER */ + { 446, -4 }, /* (518) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + { 446, -4 }, /* (519) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + { 447, 0 }, /* (520) limit_clause_opt ::= */ + { 447, -2 }, /* (521) limit_clause_opt ::= LIMIT NK_INTEGER */ + { 447, -4 }, /* (522) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ + { 447, -4 }, /* (523) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + { 399, -3 }, /* (524) subquery ::= NK_LP query_expression NK_RP */ + { 399, -3 }, /* (525) subquery ::= NK_LP subquery NK_RP */ + { 427, -1 }, /* (526) search_condition ::= common_expression */ + { 450, -1 }, /* (527) sort_specification_list ::= sort_specification */ + { 450, -3 }, /* (528) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ + { 451, -3 }, /* (529) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ + { 452, 0 }, /* (530) ordering_specification_opt ::= */ + { 452, -1 }, /* (531) ordering_specification_opt ::= ASC */ + { 452, -1 }, /* (532) ordering_specification_opt ::= DESC */ + { 453, 0 }, /* (533) null_ordering_opt ::= */ + { 453, -2 }, /* (534) null_ordering_opt ::= NULLS FIRST */ + { 453, -2 }, /* (535) null_ordering_opt ::= NULLS LAST */ }; static void yy_accept(yyParser*); /* Forward Declaration */ @@ -3756,69 +3736,69 @@ static YYACTIONTYPE yy_reduce( yy_destructor(yypParser,322,&yymsp[0].minor); break; case 24: /* cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt */ -{ pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-3].minor.yy481, &yymsp[-1].minor.yy0, yymsp[0].minor.yy607); } +{ pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-3].minor.yy593, &yymsp[-1].minor.yy0, yymsp[0].minor.yy687); } break; case 25: /* cmd ::= ALTER USER user_name PASS NK_STRING */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy481, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy593, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); } break; case 26: /* cmd ::= ALTER USER user_name ENABLE NK_INTEGER */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy481, TSDB_ALTER_USER_ENABLE, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy593, TSDB_ALTER_USER_ENABLE, &yymsp[0].minor.yy0); } break; case 27: /* cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy481, TSDB_ALTER_USER_SYSINFO, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy593, TSDB_ALTER_USER_SYSINFO, &yymsp[0].minor.yy0); } break; case 28: /* cmd ::= DROP USER user_name */ -{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy481); } +{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy593); } break; case 29: /* sysinfo_opt ::= */ -{ yymsp[1].minor.yy607 = 1; } +{ yymsp[1].minor.yy687 = 1; } break; case 30: /* sysinfo_opt ::= SYSINFO NK_INTEGER */ -{ yymsp[-1].minor.yy607 = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); } +{ yymsp[-1].minor.yy687 = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); } break; case 31: /* cmd ::= GRANT privileges ON priv_level TO user_name */ -{ pCxt->pRootNode = createGrantStmt(pCxt, yymsp[-4].minor.yy37, &yymsp[-2].minor.yy481, &yymsp[0].minor.yy481); } +{ pCxt->pRootNode = createGrantStmt(pCxt, yymsp[-4].minor.yy577, &yymsp[-2].minor.yy593, &yymsp[0].minor.yy593); } break; case 32: /* cmd ::= REVOKE privileges ON priv_level FROM user_name */ -{ pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-4].minor.yy37, &yymsp[-2].minor.yy481, &yymsp[0].minor.yy481); } +{ pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-4].minor.yy577, &yymsp[-2].minor.yy593, &yymsp[0].minor.yy593); } break; case 33: /* privileges ::= ALL */ -{ yymsp[0].minor.yy37 = PRIVILEGE_TYPE_ALL; } +{ yymsp[0].minor.yy577 = PRIVILEGE_TYPE_ALL; } break; case 34: /* privileges ::= priv_type_list */ case 35: /* priv_type_list ::= priv_type */ yytestcase(yyruleno==35); -{ yylhsminor.yy37 = yymsp[0].minor.yy37; } - yymsp[0].minor.yy37 = yylhsminor.yy37; +{ yylhsminor.yy577 = yymsp[0].minor.yy577; } + yymsp[0].minor.yy577 = yylhsminor.yy577; break; case 36: /* priv_type_list ::= priv_type_list NK_COMMA priv_type */ -{ yylhsminor.yy37 = yymsp[-2].minor.yy37 | yymsp[0].minor.yy37; } - yymsp[-2].minor.yy37 = yylhsminor.yy37; +{ yylhsminor.yy577 = yymsp[-2].minor.yy577 | yymsp[0].minor.yy577; } + yymsp[-2].minor.yy577 = yylhsminor.yy577; break; case 37: /* priv_type ::= READ */ -{ yymsp[0].minor.yy37 = PRIVILEGE_TYPE_READ; } +{ yymsp[0].minor.yy577 = PRIVILEGE_TYPE_READ; } break; case 38: /* priv_type ::= WRITE */ -{ yymsp[0].minor.yy37 = PRIVILEGE_TYPE_WRITE; } +{ yymsp[0].minor.yy577 = PRIVILEGE_TYPE_WRITE; } break; case 39: /* priv_level ::= NK_STAR NK_DOT NK_STAR */ -{ yylhsminor.yy481 = yymsp[-2].minor.yy0; } - yymsp[-2].minor.yy481 = yylhsminor.yy481; +{ yylhsminor.yy593 = yymsp[-2].minor.yy0; } + yymsp[-2].minor.yy593 = yylhsminor.yy593; break; case 40: /* priv_level ::= db_name NK_DOT NK_STAR */ -{ yylhsminor.yy481 = yymsp[-2].minor.yy481; } - yymsp[-2].minor.yy481 = yylhsminor.yy481; +{ yylhsminor.yy593 = yymsp[-2].minor.yy593; } + yymsp[-2].minor.yy593 = yylhsminor.yy593; break; case 41: /* cmd ::= CREATE DNODE dnode_endpoint */ -{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy481, NULL); } +{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy593, NULL); } break; case 42: /* cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */ -{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy481, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy593, &yymsp[0].minor.yy0); } break; case 43: /* cmd ::= DROP DNODE NK_INTEGER force_opt */ -{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy777); } +{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy193); } break; case 44: /* cmd ::= DROP DNODE dnode_endpoint force_opt */ -{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy481, yymsp[0].minor.yy777); } +{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy593, yymsp[0].minor.yy193); } break; case 45: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ { pCxt->pRootNode = createAlterDnodeStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, NULL); } @@ -3835,45 +3815,45 @@ static YYACTIONTYPE yy_reduce( case 49: /* dnode_endpoint ::= NK_STRING */ case 50: /* dnode_endpoint ::= NK_ID */ yytestcase(yyruleno==50); case 51: /* dnode_endpoint ::= NK_IPTOKEN */ yytestcase(yyruleno==51); - case 331: /* db_name ::= NK_ID */ yytestcase(yyruleno==331); - case 332: /* table_name ::= NK_ID */ yytestcase(yyruleno==332); - case 333: /* column_name ::= NK_ID */ yytestcase(yyruleno==333); - case 334: /* function_name ::= NK_ID */ yytestcase(yyruleno==334); - case 335: /* table_alias ::= NK_ID */ yytestcase(yyruleno==335); - case 336: /* column_alias ::= NK_ID */ yytestcase(yyruleno==336); - case 337: /* user_name ::= NK_ID */ yytestcase(yyruleno==337); - case 338: /* topic_name ::= NK_ID */ yytestcase(yyruleno==338); - case 339: /* stream_name ::= NK_ID */ yytestcase(yyruleno==339); - case 340: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==340); - case 380: /* noarg_func ::= NOW */ yytestcase(yyruleno==380); - case 381: /* noarg_func ::= TODAY */ yytestcase(yyruleno==381); - case 382: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==382); - case 383: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==383); - case 384: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==384); - case 385: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==385); - case 386: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==386); - case 387: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==387); - case 388: /* noarg_func ::= USER */ yytestcase(yyruleno==388); - case 389: /* star_func ::= COUNT */ yytestcase(yyruleno==389); - case 390: /* star_func ::= FIRST */ yytestcase(yyruleno==390); - case 391: /* star_func ::= LAST */ yytestcase(yyruleno==391); - case 392: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==392); -{ yylhsminor.yy481 = yymsp[0].minor.yy0; } - yymsp[0].minor.yy481 = yylhsminor.yy481; + case 339: /* db_name ::= NK_ID */ yytestcase(yyruleno==339); + case 340: /* table_name ::= NK_ID */ yytestcase(yyruleno==340); + case 341: /* column_name ::= NK_ID */ yytestcase(yyruleno==341); + case 342: /* function_name ::= NK_ID */ yytestcase(yyruleno==342); + case 343: /* table_alias ::= NK_ID */ yytestcase(yyruleno==343); + case 344: /* column_alias ::= NK_ID */ yytestcase(yyruleno==344); + case 345: /* user_name ::= NK_ID */ yytestcase(yyruleno==345); + case 346: /* topic_name ::= NK_ID */ yytestcase(yyruleno==346); + case 347: /* stream_name ::= NK_ID */ yytestcase(yyruleno==347); + case 348: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==348); + case 388: /* noarg_func ::= NOW */ yytestcase(yyruleno==388); + case 389: /* noarg_func ::= TODAY */ yytestcase(yyruleno==389); + case 390: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==390); + case 391: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==391); + case 392: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==392); + case 393: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==393); + case 394: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==394); + case 395: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==395); + case 396: /* noarg_func ::= USER */ yytestcase(yyruleno==396); + case 397: /* star_func ::= COUNT */ yytestcase(yyruleno==397); + case 398: /* star_func ::= FIRST */ yytestcase(yyruleno==398); + case 399: /* star_func ::= LAST */ yytestcase(yyruleno==399); + case 400: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==400); +{ yylhsminor.yy593 = yymsp[0].minor.yy0; } + yymsp[0].minor.yy593 = yylhsminor.yy593; break; case 52: /* force_opt ::= */ case 71: /* not_exists_opt ::= */ yytestcase(yyruleno==71); case 73: /* exists_opt ::= */ yytestcase(yyruleno==73); - case 271: /* analyze_opt ::= */ yytestcase(yyruleno==271); - case 278: /* agg_func_opt ::= */ yytestcase(yyruleno==278); - case 453: /* set_quantifier_opt ::= */ yytestcase(yyruleno==453); -{ yymsp[1].minor.yy777 = false; } + case 279: /* analyze_opt ::= */ yytestcase(yyruleno==279); + case 286: /* agg_func_opt ::= */ yytestcase(yyruleno==286); + case 461: /* set_quantifier_opt ::= */ yytestcase(yyruleno==461); +{ yymsp[1].minor.yy193 = false; } break; case 53: /* force_opt ::= FORCE */ - case 272: /* analyze_opt ::= ANALYZE */ yytestcase(yyruleno==272); - case 279: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==279); - case 454: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==454); -{ yymsp[0].minor.yy777 = true; } + case 280: /* analyze_opt ::= ANALYZE */ yytestcase(yyruleno==280); + case 287: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==287); + case 462: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==462); +{ yymsp[0].minor.yy193 = true; } break; case 54: /* cmd ::= ALTER LOCAL NK_STRING */ { pCxt->pRootNode = createAlterLocalStmt(pCxt, &yymsp[0].minor.yy0, NULL); } @@ -3906,213 +3886,213 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_MNODE_STMT, &yymsp[0].minor.yy0); } break; case 64: /* cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ -{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy777, &yymsp[-1].minor.yy481, yymsp[0].minor.yy232); } +{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy193, &yymsp[-1].minor.yy593, yymsp[0].minor.yy164); } break; case 65: /* cmd ::= DROP DATABASE exists_opt db_name */ -{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy777, &yymsp[0].minor.yy481); } +{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy193, &yymsp[0].minor.yy593); } break; case 66: /* cmd ::= USE db_name */ -{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy481); } +{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy593); } break; case 67: /* cmd ::= ALTER DATABASE db_name alter_db_options */ -{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy481, yymsp[0].minor.yy232); } +{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy593, yymsp[0].minor.yy164); } break; case 68: /* cmd ::= FLUSH DATABASE db_name */ -{ pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &yymsp[0].minor.yy481); } +{ pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &yymsp[0].minor.yy593); } break; case 69: /* cmd ::= TRIM DATABASE db_name speed_opt */ -{ pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &yymsp[-1].minor.yy481, yymsp[0].minor.yy692); } +{ pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &yymsp[-1].minor.yy593, yymsp[0].minor.yy512); } break; case 70: /* not_exists_opt ::= IF NOT EXISTS */ -{ yymsp[-2].minor.yy777 = true; } +{ yymsp[-2].minor.yy193 = true; } break; case 72: /* exists_opt ::= IF EXISTS */ -{ yymsp[-1].minor.yy777 = true; } +{ yymsp[-1].minor.yy193 = true; } break; case 74: /* db_options ::= */ -{ yymsp[1].minor.yy232 = createDefaultDatabaseOptions(pCxt); } +{ yymsp[1].minor.yy164 = createDefaultDatabaseOptions(pCxt); } break; case 75: /* db_options ::= db_options BUFFER NK_INTEGER */ -{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy232 = yylhsminor.yy232; +{ yylhsminor.yy164 = setDatabaseOption(pCxt, yymsp[-2].minor.yy164, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy164 = yylhsminor.yy164; break; case 76: /* db_options ::= db_options CACHEMODEL NK_STRING */ -{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_CACHEMODEL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy232 = yylhsminor.yy232; +{ yylhsminor.yy164 = setDatabaseOption(pCxt, yymsp[-2].minor.yy164, DB_OPTION_CACHEMODEL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy164 = yylhsminor.yy164; break; case 77: /* db_options ::= db_options CACHESIZE NK_INTEGER */ -{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_CACHESIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy232 = yylhsminor.yy232; +{ yylhsminor.yy164 = setDatabaseOption(pCxt, yymsp[-2].minor.yy164, DB_OPTION_CACHESIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy164 = yylhsminor.yy164; break; case 78: /* db_options ::= db_options COMP NK_INTEGER */ -{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_COMP, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy232 = yylhsminor.yy232; +{ yylhsminor.yy164 = setDatabaseOption(pCxt, yymsp[-2].minor.yy164, DB_OPTION_COMP, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy164 = yylhsminor.yy164; break; case 79: /* db_options ::= db_options DURATION NK_INTEGER */ case 80: /* db_options ::= db_options DURATION NK_VARIABLE */ yytestcase(yyruleno==80); -{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_DAYS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy232 = yylhsminor.yy232; +{ yylhsminor.yy164 = setDatabaseOption(pCxt, yymsp[-2].minor.yy164, DB_OPTION_DAYS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy164 = yylhsminor.yy164; break; case 81: /* db_options ::= db_options MAXROWS NK_INTEGER */ -{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy232 = yylhsminor.yy232; +{ yylhsminor.yy164 = setDatabaseOption(pCxt, yymsp[-2].minor.yy164, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy164 = yylhsminor.yy164; break; case 82: /* db_options ::= db_options MINROWS NK_INTEGER */ -{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy232 = yylhsminor.yy232; +{ yylhsminor.yy164 = setDatabaseOption(pCxt, yymsp[-2].minor.yy164, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy164 = yylhsminor.yy164; break; case 83: /* db_options ::= db_options KEEP integer_list */ case 84: /* db_options ::= db_options KEEP variable_list */ yytestcase(yyruleno==84); -{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_KEEP, yymsp[0].minor.yy288); } - yymsp[-2].minor.yy232 = yylhsminor.yy232; +{ yylhsminor.yy164 = setDatabaseOption(pCxt, yymsp[-2].minor.yy164, DB_OPTION_KEEP, yymsp[0].minor.yy648); } + yymsp[-2].minor.yy164 = yylhsminor.yy164; break; case 85: /* db_options ::= db_options PAGES NK_INTEGER */ -{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_PAGES, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy232 = yylhsminor.yy232; +{ yylhsminor.yy164 = setDatabaseOption(pCxt, yymsp[-2].minor.yy164, DB_OPTION_PAGES, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy164 = yylhsminor.yy164; break; case 86: /* db_options ::= db_options PAGESIZE NK_INTEGER */ -{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy232 = yylhsminor.yy232; +{ yylhsminor.yy164 = setDatabaseOption(pCxt, yymsp[-2].minor.yy164, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy164 = yylhsminor.yy164; break; case 87: /* db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */ -{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_TSDB_PAGESIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy232 = yylhsminor.yy232; +{ yylhsminor.yy164 = setDatabaseOption(pCxt, yymsp[-2].minor.yy164, DB_OPTION_TSDB_PAGESIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy164 = yylhsminor.yy164; break; case 88: /* db_options ::= db_options PRECISION NK_STRING */ -{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy232 = yylhsminor.yy232; +{ yylhsminor.yy164 = setDatabaseOption(pCxt, yymsp[-2].minor.yy164, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy164 = yylhsminor.yy164; break; case 89: /* db_options ::= db_options REPLICA NK_INTEGER */ -{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy232 = yylhsminor.yy232; +{ yylhsminor.yy164 = setDatabaseOption(pCxt, yymsp[-2].minor.yy164, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy164 = yylhsminor.yy164; break; case 90: /* db_options ::= db_options STRICT NK_STRING */ -{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_STRICT, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy232 = yylhsminor.yy232; +{ yylhsminor.yy164 = setDatabaseOption(pCxt, yymsp[-2].minor.yy164, DB_OPTION_STRICT, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy164 = yylhsminor.yy164; break; case 91: /* db_options ::= db_options VGROUPS NK_INTEGER */ -{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy232 = yylhsminor.yy232; +{ yylhsminor.yy164 = setDatabaseOption(pCxt, yymsp[-2].minor.yy164, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy164 = yylhsminor.yy164; break; case 92: /* db_options ::= db_options SINGLE_STABLE NK_INTEGER */ -{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy232 = yylhsminor.yy232; +{ yylhsminor.yy164 = setDatabaseOption(pCxt, yymsp[-2].minor.yy164, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy164 = yylhsminor.yy164; break; case 93: /* db_options ::= db_options RETENTIONS retention_list */ -{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_RETENTIONS, yymsp[0].minor.yy288); } - yymsp[-2].minor.yy232 = yylhsminor.yy232; +{ yylhsminor.yy164 = setDatabaseOption(pCxt, yymsp[-2].minor.yy164, DB_OPTION_RETENTIONS, yymsp[0].minor.yy648); } + yymsp[-2].minor.yy164 = yylhsminor.yy164; break; case 94: /* db_options ::= db_options SCHEMALESS NK_INTEGER */ -{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy232 = yylhsminor.yy232; +{ yylhsminor.yy164 = setDatabaseOption(pCxt, yymsp[-2].minor.yy164, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy164 = yylhsminor.yy164; break; case 95: /* db_options ::= db_options WAL_LEVEL NK_INTEGER */ -{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_WAL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy232 = yylhsminor.yy232; +{ yylhsminor.yy164 = setDatabaseOption(pCxt, yymsp[-2].minor.yy164, DB_OPTION_WAL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy164 = yylhsminor.yy164; break; case 96: /* db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */ -{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy232 = yylhsminor.yy232; +{ yylhsminor.yy164 = setDatabaseOption(pCxt, yymsp[-2].minor.yy164, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy164 = yylhsminor.yy164; break; case 97: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */ -{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_WAL_RETENTION_PERIOD, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy232 = yylhsminor.yy232; +{ yylhsminor.yy164 = setDatabaseOption(pCxt, yymsp[-2].minor.yy164, DB_OPTION_WAL_RETENTION_PERIOD, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy164 = yylhsminor.yy164; break; case 98: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-3].minor.yy232, DB_OPTION_WAL_RETENTION_PERIOD, &t); + yylhsminor.yy164 = setDatabaseOption(pCxt, yymsp[-3].minor.yy164, DB_OPTION_WAL_RETENTION_PERIOD, &t); } - yymsp[-3].minor.yy232 = yylhsminor.yy232; + yymsp[-3].minor.yy164 = yylhsminor.yy164; break; case 99: /* db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */ -{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_WAL_RETENTION_SIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy232 = yylhsminor.yy232; +{ yylhsminor.yy164 = setDatabaseOption(pCxt, yymsp[-2].minor.yy164, DB_OPTION_WAL_RETENTION_SIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy164 = yylhsminor.yy164; break; case 100: /* db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-3].minor.yy232, DB_OPTION_WAL_RETENTION_SIZE, &t); + yylhsminor.yy164 = setDatabaseOption(pCxt, yymsp[-3].minor.yy164, DB_OPTION_WAL_RETENTION_SIZE, &t); } - yymsp[-3].minor.yy232 = yylhsminor.yy232; + yymsp[-3].minor.yy164 = yylhsminor.yy164; break; case 101: /* db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */ -{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_WAL_ROLL_PERIOD, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy232 = yylhsminor.yy232; +{ yylhsminor.yy164 = setDatabaseOption(pCxt, yymsp[-2].minor.yy164, DB_OPTION_WAL_ROLL_PERIOD, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy164 = yylhsminor.yy164; break; case 102: /* db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */ -{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_WAL_SEGMENT_SIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy232 = yylhsminor.yy232; +{ yylhsminor.yy164 = setDatabaseOption(pCxt, yymsp[-2].minor.yy164, DB_OPTION_WAL_SEGMENT_SIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy164 = yylhsminor.yy164; break; case 103: /* db_options ::= db_options STT_TRIGGER NK_INTEGER */ -{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_STT_TRIGGER, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy232 = yylhsminor.yy232; +{ yylhsminor.yy164 = setDatabaseOption(pCxt, yymsp[-2].minor.yy164, DB_OPTION_STT_TRIGGER, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy164 = yylhsminor.yy164; break; case 104: /* db_options ::= db_options TABLE_PREFIX NK_INTEGER */ -{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_TABLE_PREFIX, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy232 = yylhsminor.yy232; +{ yylhsminor.yy164 = setDatabaseOption(pCxt, yymsp[-2].minor.yy164, DB_OPTION_TABLE_PREFIX, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy164 = yylhsminor.yy164; break; case 105: /* db_options ::= db_options TABLE_SUFFIX NK_INTEGER */ -{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_TABLE_SUFFIX, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy232 = yylhsminor.yy232; +{ yylhsminor.yy164 = setDatabaseOption(pCxt, yymsp[-2].minor.yy164, DB_OPTION_TABLE_SUFFIX, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy164 = yylhsminor.yy164; break; case 106: /* alter_db_options ::= alter_db_option */ -{ yylhsminor.yy232 = createAlterDatabaseOptions(pCxt); yylhsminor.yy232 = setAlterDatabaseOption(pCxt, yylhsminor.yy232, &yymsp[0].minor.yy101); } - yymsp[0].minor.yy232 = yylhsminor.yy232; +{ yylhsminor.yy164 = createAlterDatabaseOptions(pCxt); yylhsminor.yy164 = setAlterDatabaseOption(pCxt, yylhsminor.yy164, &yymsp[0].minor.yy213); } + yymsp[0].minor.yy164 = yylhsminor.yy164; break; case 107: /* alter_db_options ::= alter_db_options alter_db_option */ -{ yylhsminor.yy232 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy232, &yymsp[0].minor.yy101); } - yymsp[-1].minor.yy232 = yylhsminor.yy232; +{ yylhsminor.yy164 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy164, &yymsp[0].minor.yy213); } + yymsp[-1].minor.yy164 = yylhsminor.yy164; break; case 108: /* alter_db_option ::= BUFFER NK_INTEGER */ -{ yymsp[-1].minor.yy101.type = DB_OPTION_BUFFER; yymsp[-1].minor.yy101.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy213.type = DB_OPTION_BUFFER; yymsp[-1].minor.yy213.val = yymsp[0].minor.yy0; } break; case 109: /* alter_db_option ::= CACHEMODEL NK_STRING */ -{ yymsp[-1].minor.yy101.type = DB_OPTION_CACHEMODEL; yymsp[-1].minor.yy101.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy213.type = DB_OPTION_CACHEMODEL; yymsp[-1].minor.yy213.val = yymsp[0].minor.yy0; } break; case 110: /* alter_db_option ::= CACHESIZE NK_INTEGER */ -{ yymsp[-1].minor.yy101.type = DB_OPTION_CACHESIZE; yymsp[-1].minor.yy101.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy213.type = DB_OPTION_CACHESIZE; yymsp[-1].minor.yy213.val = yymsp[0].minor.yy0; } break; case 111: /* alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */ -{ yymsp[-1].minor.yy101.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy101.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy213.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy213.val = yymsp[0].minor.yy0; } break; case 112: /* alter_db_option ::= KEEP integer_list */ case 113: /* alter_db_option ::= KEEP variable_list */ yytestcase(yyruleno==113); -{ yymsp[-1].minor.yy101.type = DB_OPTION_KEEP; yymsp[-1].minor.yy101.pList = yymsp[0].minor.yy288; } +{ yymsp[-1].minor.yy213.type = DB_OPTION_KEEP; yymsp[-1].minor.yy213.pList = yymsp[0].minor.yy648; } break; case 114: /* alter_db_option ::= PAGES NK_INTEGER */ -{ yymsp[-1].minor.yy101.type = DB_OPTION_PAGES; yymsp[-1].minor.yy101.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy213.type = DB_OPTION_PAGES; yymsp[-1].minor.yy213.val = yymsp[0].minor.yy0; } break; case 115: /* alter_db_option ::= REPLICA NK_INTEGER */ -{ yymsp[-1].minor.yy101.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy101.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy213.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy213.val = yymsp[0].minor.yy0; } break; case 116: /* alter_db_option ::= STRICT NK_STRING */ -{ yymsp[-1].minor.yy101.type = DB_OPTION_STRICT; yymsp[-1].minor.yy101.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy213.type = DB_OPTION_STRICT; yymsp[-1].minor.yy213.val = yymsp[0].minor.yy0; } break; case 117: /* alter_db_option ::= WAL_LEVEL NK_INTEGER */ -{ yymsp[-1].minor.yy101.type = DB_OPTION_WAL; yymsp[-1].minor.yy101.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy213.type = DB_OPTION_WAL; yymsp[-1].minor.yy213.val = yymsp[0].minor.yy0; } break; case 118: /* alter_db_option ::= STT_TRIGGER NK_INTEGER */ -{ yymsp[-1].minor.yy101.type = DB_OPTION_STT_TRIGGER; yymsp[-1].minor.yy101.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy213.type = DB_OPTION_STT_TRIGGER; yymsp[-1].minor.yy213.val = yymsp[0].minor.yy0; } break; case 119: /* integer_list ::= NK_INTEGER */ -{ yylhsminor.yy288 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy288 = yylhsminor.yy288; +{ yylhsminor.yy648 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy648 = yylhsminor.yy648; break; case 120: /* integer_list ::= integer_list NK_COMMA NK_INTEGER */ - case 301: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==301); -{ yylhsminor.yy288 = addNodeToList(pCxt, yymsp[-2].minor.yy288, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy288 = yylhsminor.yy288; + case 309: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==309); +{ yylhsminor.yy648 = addNodeToList(pCxt, yymsp[-2].minor.yy648, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy648 = yylhsminor.yy648; break; case 121: /* variable_list ::= NK_VARIABLE */ -{ yylhsminor.yy288 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy288 = yylhsminor.yy288; +{ yylhsminor.yy648 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy648 = yylhsminor.yy648; break; case 122: /* variable_list ::= variable_list NK_COMMA NK_VARIABLE */ -{ yylhsminor.yy288 = addNodeToList(pCxt, yymsp[-2].minor.yy288, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy288 = yylhsminor.yy288; +{ yylhsminor.yy648 = addNodeToList(pCxt, yymsp[-2].minor.yy648, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy648 = yylhsminor.yy648; break; case 123: /* retention_list ::= retention */ case 145: /* multi_create_clause ::= create_subtable_clause */ yytestcase(yyruleno==145); @@ -4120,279 +4100,284 @@ static YYACTIONTYPE yy_reduce( case 155: /* column_def_list ::= column_def */ yytestcase(yyruleno==155); case 198: /* rollup_func_list ::= rollup_func_name */ yytestcase(yyruleno==198); case 203: /* col_name_list ::= col_name */ yytestcase(yyruleno==203); - case 254: /* func_list ::= func */ yytestcase(yyruleno==254); - case 329: /* literal_list ::= signed_literal */ yytestcase(yyruleno==329); - case 395: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==395); - case 401: /* when_then_list ::= when_then_expr */ yytestcase(yyruleno==401); - case 456: /* select_list ::= select_item */ yytestcase(yyruleno==456); - case 467: /* partition_list ::= partition_item */ yytestcase(yyruleno==467); - case 519: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==519); -{ yylhsminor.yy288 = createNodeList(pCxt, yymsp[0].minor.yy232); } - yymsp[0].minor.yy288 = yylhsminor.yy288; + case 251: /* tag_list_opt ::= tag_item */ yytestcase(yyruleno==251); + case 262: /* func_list ::= func */ yytestcase(yyruleno==262); + case 337: /* literal_list ::= signed_literal */ yytestcase(yyruleno==337); + case 403: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==403); + case 409: /* when_then_list ::= when_then_expr */ yytestcase(yyruleno==409); + case 464: /* select_list ::= select_item */ yytestcase(yyruleno==464); + case 475: /* partition_list ::= partition_item */ yytestcase(yyruleno==475); + case 527: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==527); +{ yylhsminor.yy648 = createNodeList(pCxt, yymsp[0].minor.yy164); } + yymsp[0].minor.yy648 = yylhsminor.yy648; break; case 124: /* retention_list ::= retention_list NK_COMMA retention */ case 156: /* column_def_list ::= column_def_list NK_COMMA column_def */ yytestcase(yyruleno==156); case 199: /* rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ yytestcase(yyruleno==199); case 204: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==204); - case 255: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==255); - case 330: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==330); - case 396: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==396); - case 457: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==457); - case 468: /* partition_list ::= partition_list NK_COMMA partition_item */ yytestcase(yyruleno==468); - case 520: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==520); -{ yylhsminor.yy288 = addNodeToList(pCxt, yymsp[-2].minor.yy288, yymsp[0].minor.yy232); } - yymsp[-2].minor.yy288 = yylhsminor.yy288; + case 252: /* tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ yytestcase(yyruleno==252); + case 263: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==263); + case 338: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==338); + case 404: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==404); + case 465: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==465); + case 476: /* partition_list ::= partition_list NK_COMMA partition_item */ yytestcase(yyruleno==476); + case 528: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==528); +{ yylhsminor.yy648 = addNodeToList(pCxt, yymsp[-2].minor.yy648, yymsp[0].minor.yy164); } + yymsp[-2].minor.yy648 = yylhsminor.yy648; break; case 125: /* retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ -{ yylhsminor.yy232 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy232 = yylhsminor.yy232; +{ yylhsminor.yy164 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy164 = yylhsminor.yy164; break; case 126: /* speed_opt ::= */ - case 280: /* bufsize_opt ::= */ yytestcase(yyruleno==280); -{ yymsp[1].minor.yy692 = 0; } + case 288: /* bufsize_opt ::= */ yytestcase(yyruleno==288); +{ yymsp[1].minor.yy512 = 0; } break; case 127: /* speed_opt ::= MAX_SPEED NK_INTEGER */ - case 281: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ yytestcase(yyruleno==281); -{ yymsp[-1].minor.yy692 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); } + case 289: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ yytestcase(yyruleno==289); +{ yymsp[-1].minor.yy512 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); } break; case 128: /* cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ case 130: /* cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ yytestcase(yyruleno==130); -{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy777, yymsp[-5].minor.yy232, yymsp[-3].minor.yy288, yymsp[-1].minor.yy288, yymsp[0].minor.yy232); } +{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy193, yymsp[-5].minor.yy164, yymsp[-3].minor.yy648, yymsp[-1].minor.yy648, yymsp[0].minor.yy164); } break; case 129: /* cmd ::= CREATE TABLE multi_create_clause */ -{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy288); } +{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy648); } break; case 131: /* cmd ::= DROP TABLE multi_drop_clause */ -{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy288); } +{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy648); } break; case 132: /* cmd ::= DROP STABLE exists_opt full_table_name */ -{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy777, yymsp[0].minor.yy232); } +{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy193, yymsp[0].minor.yy164); } break; case 133: /* cmd ::= ALTER TABLE alter_table_clause */ - case 303: /* cmd ::= query_or_subquery */ yytestcase(yyruleno==303); -{ pCxt->pRootNode = yymsp[0].minor.yy232; } + case 311: /* cmd ::= query_or_subquery */ yytestcase(yyruleno==311); +{ pCxt->pRootNode = yymsp[0].minor.yy164; } break; case 134: /* cmd ::= ALTER STABLE alter_table_clause */ -{ pCxt->pRootNode = setAlterSuperTableType(yymsp[0].minor.yy232); } +{ pCxt->pRootNode = setAlterSuperTableType(yymsp[0].minor.yy164); } break; case 135: /* alter_table_clause ::= full_table_name alter_table_options */ -{ yylhsminor.yy232 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy232, yymsp[0].minor.yy232); } - yymsp[-1].minor.yy232 = yylhsminor.yy232; +{ yylhsminor.yy164 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy164, yymsp[0].minor.yy164); } + yymsp[-1].minor.yy164 = yylhsminor.yy164; break; case 136: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ -{ yylhsminor.yy232 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy232, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy481, yymsp[0].minor.yy264); } - yymsp[-4].minor.yy232 = yylhsminor.yy232; +{ yylhsminor.yy164 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy164, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy593, yymsp[0].minor.yy720); } + yymsp[-4].minor.yy164 = yylhsminor.yy164; break; case 137: /* alter_table_clause ::= full_table_name DROP COLUMN column_name */ -{ yylhsminor.yy232 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy232, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy481); } - yymsp[-3].minor.yy232 = yylhsminor.yy232; +{ yylhsminor.yy164 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy164, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy593); } + yymsp[-3].minor.yy164 = yylhsminor.yy164; break; case 138: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ -{ yylhsminor.yy232 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy232, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy481, yymsp[0].minor.yy264); } - yymsp[-4].minor.yy232 = yylhsminor.yy232; +{ yylhsminor.yy164 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy164, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy593, yymsp[0].minor.yy720); } + yymsp[-4].minor.yy164 = yylhsminor.yy164; break; case 139: /* alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ -{ yylhsminor.yy232 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy232, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy481, &yymsp[0].minor.yy481); } - yymsp[-4].minor.yy232 = yylhsminor.yy232; +{ yylhsminor.yy164 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy164, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy593, &yymsp[0].minor.yy593); } + yymsp[-4].minor.yy164 = yylhsminor.yy164; break; case 140: /* alter_table_clause ::= full_table_name ADD TAG column_name type_name */ -{ yylhsminor.yy232 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy232, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy481, yymsp[0].minor.yy264); } - yymsp[-4].minor.yy232 = yylhsminor.yy232; +{ yylhsminor.yy164 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy164, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy593, yymsp[0].minor.yy720); } + yymsp[-4].minor.yy164 = yylhsminor.yy164; break; case 141: /* alter_table_clause ::= full_table_name DROP TAG column_name */ -{ yylhsminor.yy232 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy232, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy481); } - yymsp[-3].minor.yy232 = yylhsminor.yy232; +{ yylhsminor.yy164 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy164, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy593); } + yymsp[-3].minor.yy164 = yylhsminor.yy164; break; case 142: /* alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ -{ yylhsminor.yy232 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy232, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy481, yymsp[0].minor.yy264); } - yymsp[-4].minor.yy232 = yylhsminor.yy232; +{ yylhsminor.yy164 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy164, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy593, yymsp[0].minor.yy720); } + yymsp[-4].minor.yy164 = yylhsminor.yy164; break; case 143: /* alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ -{ yylhsminor.yy232 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy232, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy481, &yymsp[0].minor.yy481); } - yymsp[-4].minor.yy232 = yylhsminor.yy232; +{ yylhsminor.yy164 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy164, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy593, &yymsp[0].minor.yy593); } + yymsp[-4].minor.yy164 = yylhsminor.yy164; break; case 144: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ -{ yylhsminor.yy232 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy232, &yymsp[-2].minor.yy481, yymsp[0].minor.yy232); } - yymsp[-5].minor.yy232 = yylhsminor.yy232; +{ yylhsminor.yy164 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy164, &yymsp[-2].minor.yy593, yymsp[0].minor.yy164); } + yymsp[-5].minor.yy164 = yylhsminor.yy164; break; case 146: /* multi_create_clause ::= multi_create_clause create_subtable_clause */ case 149: /* multi_drop_clause ::= multi_drop_clause drop_table_clause */ yytestcase(yyruleno==149); - case 402: /* when_then_list ::= when_then_list when_then_expr */ yytestcase(yyruleno==402); -{ yylhsminor.yy288 = addNodeToList(pCxt, yymsp[-1].minor.yy288, yymsp[0].minor.yy232); } - yymsp[-1].minor.yy288 = yylhsminor.yy288; + case 410: /* when_then_list ::= when_then_list when_then_expr */ yytestcase(yyruleno==410); +{ yylhsminor.yy648 = addNodeToList(pCxt, yymsp[-1].minor.yy648, yymsp[0].minor.yy164); } + yymsp[-1].minor.yy648 = yylhsminor.yy648; break; case 147: /* create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP expression_list NK_RP table_options */ -{ yylhsminor.yy232 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy777, yymsp[-8].minor.yy232, yymsp[-6].minor.yy232, yymsp[-5].minor.yy288, yymsp[-2].minor.yy288, yymsp[0].minor.yy232); } - yymsp[-9].minor.yy232 = yylhsminor.yy232; +{ yylhsminor.yy164 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy193, yymsp[-8].minor.yy164, yymsp[-6].minor.yy164, yymsp[-5].minor.yy648, yymsp[-2].minor.yy648, yymsp[0].minor.yy164); } + yymsp[-9].minor.yy164 = yylhsminor.yy164; break; case 150: /* drop_table_clause ::= exists_opt full_table_name */ -{ yylhsminor.yy232 = createDropTableClause(pCxt, yymsp[-1].minor.yy777, yymsp[0].minor.yy232); } - yymsp[-1].minor.yy232 = yylhsminor.yy232; +{ yylhsminor.yy164 = createDropTableClause(pCxt, yymsp[-1].minor.yy193, yymsp[0].minor.yy164); } + yymsp[-1].minor.yy164 = yylhsminor.yy164; break; case 151: /* specific_cols_opt ::= */ case 182: /* tags_def_opt ::= */ yytestcase(yyruleno==182); - case 465: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==465); - case 487: /* group_by_clause_opt ::= */ yytestcase(yyruleno==487); - case 506: /* order_by_clause_opt ::= */ yytestcase(yyruleno==506); -{ yymsp[1].minor.yy288 = NULL; } + case 250: /* tag_list_opt ::= */ yytestcase(yyruleno==250); + case 473: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==473); + case 495: /* group_by_clause_opt ::= */ yytestcase(yyruleno==495); + case 514: /* order_by_clause_opt ::= */ yytestcase(yyruleno==514); +{ yymsp[1].minor.yy648 = NULL; } break; case 152: /* specific_cols_opt ::= NK_LP col_name_list NK_RP */ -{ yymsp[-2].minor.yy288 = yymsp[-1].minor.yy288; } +{ yymsp[-2].minor.yy648 = yymsp[-1].minor.yy648; } break; case 153: /* full_table_name ::= table_name */ -{ yylhsminor.yy232 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy481, NULL); } - yymsp[0].minor.yy232 = yylhsminor.yy232; +{ yylhsminor.yy164 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy593, NULL); } + yymsp[0].minor.yy164 = yylhsminor.yy164; break; case 154: /* full_table_name ::= db_name NK_DOT table_name */ -{ yylhsminor.yy232 = createRealTableNode(pCxt, &yymsp[-2].minor.yy481, &yymsp[0].minor.yy481, NULL); } - yymsp[-2].minor.yy232 = yylhsminor.yy232; +{ yylhsminor.yy164 = createRealTableNode(pCxt, &yymsp[-2].minor.yy593, &yymsp[0].minor.yy593, NULL); } + yymsp[-2].minor.yy164 = yylhsminor.yy164; break; case 157: /* column_def ::= column_name type_name */ -{ yylhsminor.yy232 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy481, yymsp[0].minor.yy264, NULL); } - yymsp[-1].minor.yy232 = yylhsminor.yy232; +{ yylhsminor.yy164 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy593, yymsp[0].minor.yy720, NULL); } + yymsp[-1].minor.yy164 = yylhsminor.yy164; break; case 158: /* column_def ::= column_name type_name COMMENT NK_STRING */ -{ yylhsminor.yy232 = createColumnDefNode(pCxt, &yymsp[-3].minor.yy481, yymsp[-2].minor.yy264, &yymsp[0].minor.yy0); } - yymsp[-3].minor.yy232 = yylhsminor.yy232; +{ yylhsminor.yy164 = createColumnDefNode(pCxt, &yymsp[-3].minor.yy593, yymsp[-2].minor.yy720, &yymsp[0].minor.yy0); } + yymsp[-3].minor.yy164 = yylhsminor.yy164; break; case 159: /* type_name ::= BOOL */ -{ yymsp[0].minor.yy264 = createDataType(TSDB_DATA_TYPE_BOOL); } +{ yymsp[0].minor.yy720 = createDataType(TSDB_DATA_TYPE_BOOL); } break; case 160: /* type_name ::= TINYINT */ -{ yymsp[0].minor.yy264 = createDataType(TSDB_DATA_TYPE_TINYINT); } +{ yymsp[0].minor.yy720 = createDataType(TSDB_DATA_TYPE_TINYINT); } break; case 161: /* type_name ::= SMALLINT */ -{ yymsp[0].minor.yy264 = createDataType(TSDB_DATA_TYPE_SMALLINT); } +{ yymsp[0].minor.yy720 = createDataType(TSDB_DATA_TYPE_SMALLINT); } break; case 162: /* type_name ::= INT */ case 163: /* type_name ::= INTEGER */ yytestcase(yyruleno==163); -{ yymsp[0].minor.yy264 = createDataType(TSDB_DATA_TYPE_INT); } +{ yymsp[0].minor.yy720 = createDataType(TSDB_DATA_TYPE_INT); } break; case 164: /* type_name ::= BIGINT */ -{ yymsp[0].minor.yy264 = createDataType(TSDB_DATA_TYPE_BIGINT); } +{ yymsp[0].minor.yy720 = createDataType(TSDB_DATA_TYPE_BIGINT); } break; case 165: /* type_name ::= FLOAT */ -{ yymsp[0].minor.yy264 = createDataType(TSDB_DATA_TYPE_FLOAT); } +{ yymsp[0].minor.yy720 = createDataType(TSDB_DATA_TYPE_FLOAT); } break; case 166: /* type_name ::= DOUBLE */ -{ yymsp[0].minor.yy264 = createDataType(TSDB_DATA_TYPE_DOUBLE); } +{ yymsp[0].minor.yy720 = createDataType(TSDB_DATA_TYPE_DOUBLE); } break; case 167: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy264 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } +{ yymsp[-3].minor.yy720 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } break; case 168: /* type_name ::= TIMESTAMP */ -{ yymsp[0].minor.yy264 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } +{ yymsp[0].minor.yy720 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } break; case 169: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy264 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } +{ yymsp[-3].minor.yy720 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } break; case 170: /* type_name ::= TINYINT UNSIGNED */ -{ yymsp[-1].minor.yy264 = createDataType(TSDB_DATA_TYPE_UTINYINT); } +{ yymsp[-1].minor.yy720 = createDataType(TSDB_DATA_TYPE_UTINYINT); } break; case 171: /* type_name ::= SMALLINT UNSIGNED */ -{ yymsp[-1].minor.yy264 = createDataType(TSDB_DATA_TYPE_USMALLINT); } +{ yymsp[-1].minor.yy720 = createDataType(TSDB_DATA_TYPE_USMALLINT); } break; case 172: /* type_name ::= INT UNSIGNED */ -{ yymsp[-1].minor.yy264 = createDataType(TSDB_DATA_TYPE_UINT); } +{ yymsp[-1].minor.yy720 = createDataType(TSDB_DATA_TYPE_UINT); } break; case 173: /* type_name ::= BIGINT UNSIGNED */ -{ yymsp[-1].minor.yy264 = createDataType(TSDB_DATA_TYPE_UBIGINT); } +{ yymsp[-1].minor.yy720 = createDataType(TSDB_DATA_TYPE_UBIGINT); } break; case 174: /* type_name ::= JSON */ -{ yymsp[0].minor.yy264 = createDataType(TSDB_DATA_TYPE_JSON); } +{ yymsp[0].minor.yy720 = createDataType(TSDB_DATA_TYPE_JSON); } break; case 175: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy264 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } +{ yymsp[-3].minor.yy720 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } break; case 176: /* type_name ::= MEDIUMBLOB */ -{ yymsp[0].minor.yy264 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } +{ yymsp[0].minor.yy720 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } break; case 177: /* type_name ::= BLOB */ -{ yymsp[0].minor.yy264 = createDataType(TSDB_DATA_TYPE_BLOB); } +{ yymsp[0].minor.yy720 = createDataType(TSDB_DATA_TYPE_BLOB); } break; case 178: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy264 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } +{ yymsp[-3].minor.yy720 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } break; case 179: /* type_name ::= DECIMAL */ -{ yymsp[0].minor.yy264 = createDataType(TSDB_DATA_TYPE_DECIMAL); } +{ yymsp[0].minor.yy720 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; case 180: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy264 = createDataType(TSDB_DATA_TYPE_DECIMAL); } +{ yymsp[-3].minor.yy720 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; case 181: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ -{ yymsp[-5].minor.yy264 = createDataType(TSDB_DATA_TYPE_DECIMAL); } +{ yymsp[-5].minor.yy720 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; case 183: /* tags_def_opt ::= tags_def */ - case 394: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==394); -{ yylhsminor.yy288 = yymsp[0].minor.yy288; } - yymsp[0].minor.yy288 = yylhsminor.yy288; + case 402: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==402); +{ yylhsminor.yy648 = yymsp[0].minor.yy648; } + yymsp[0].minor.yy648 = yylhsminor.yy648; break; case 184: /* tags_def ::= TAGS NK_LP column_def_list NK_RP */ -{ yymsp[-3].minor.yy288 = yymsp[-1].minor.yy288; } +{ yymsp[-3].minor.yy648 = yymsp[-1].minor.yy648; } break; case 185: /* table_options ::= */ -{ yymsp[1].minor.yy232 = createDefaultTableOptions(pCxt); } +{ yymsp[1].minor.yy164 = createDefaultTableOptions(pCxt); } break; case 186: /* table_options ::= table_options COMMENT NK_STRING */ -{ yylhsminor.yy232 = setTableOption(pCxt, yymsp[-2].minor.yy232, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy232 = yylhsminor.yy232; +{ yylhsminor.yy164 = setTableOption(pCxt, yymsp[-2].minor.yy164, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy164 = yylhsminor.yy164; break; case 187: /* table_options ::= table_options MAX_DELAY duration_list */ -{ yylhsminor.yy232 = setTableOption(pCxt, yymsp[-2].minor.yy232, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy288); } - yymsp[-2].minor.yy232 = yylhsminor.yy232; +{ yylhsminor.yy164 = setTableOption(pCxt, yymsp[-2].minor.yy164, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy648); } + yymsp[-2].minor.yy164 = yylhsminor.yy164; break; case 188: /* table_options ::= table_options WATERMARK duration_list */ -{ yylhsminor.yy232 = setTableOption(pCxt, yymsp[-2].minor.yy232, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy288); } - yymsp[-2].minor.yy232 = yylhsminor.yy232; +{ yylhsminor.yy164 = setTableOption(pCxt, yymsp[-2].minor.yy164, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy648); } + yymsp[-2].minor.yy164 = yylhsminor.yy164; break; case 189: /* table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ -{ yylhsminor.yy232 = setTableOption(pCxt, yymsp[-4].minor.yy232, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy288); } - yymsp[-4].minor.yy232 = yylhsminor.yy232; +{ yylhsminor.yy164 = setTableOption(pCxt, yymsp[-4].minor.yy164, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy648); } + yymsp[-4].minor.yy164 = yylhsminor.yy164; break; case 190: /* table_options ::= table_options TTL NK_INTEGER */ -{ yylhsminor.yy232 = setTableOption(pCxt, yymsp[-2].minor.yy232, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy232 = yylhsminor.yy232; +{ yylhsminor.yy164 = setTableOption(pCxt, yymsp[-2].minor.yy164, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy164 = yylhsminor.yy164; break; case 191: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */ -{ yylhsminor.yy232 = setTableOption(pCxt, yymsp[-4].minor.yy232, TABLE_OPTION_SMA, yymsp[-1].minor.yy288); } - yymsp[-4].minor.yy232 = yylhsminor.yy232; +{ yylhsminor.yy164 = setTableOption(pCxt, yymsp[-4].minor.yy164, TABLE_OPTION_SMA, yymsp[-1].minor.yy648); } + yymsp[-4].minor.yy164 = yylhsminor.yy164; break; case 192: /* alter_table_options ::= alter_table_option */ -{ yylhsminor.yy232 = createAlterTableOptions(pCxt); yylhsminor.yy232 = setTableOption(pCxt, yylhsminor.yy232, yymsp[0].minor.yy101.type, &yymsp[0].minor.yy101.val); } - yymsp[0].minor.yy232 = yylhsminor.yy232; +{ yylhsminor.yy164 = createAlterTableOptions(pCxt); yylhsminor.yy164 = setTableOption(pCxt, yylhsminor.yy164, yymsp[0].minor.yy213.type, &yymsp[0].minor.yy213.val); } + yymsp[0].minor.yy164 = yylhsminor.yy164; break; case 193: /* alter_table_options ::= alter_table_options alter_table_option */ -{ yylhsminor.yy232 = setTableOption(pCxt, yymsp[-1].minor.yy232, yymsp[0].minor.yy101.type, &yymsp[0].minor.yy101.val); } - yymsp[-1].minor.yy232 = yylhsminor.yy232; +{ yylhsminor.yy164 = setTableOption(pCxt, yymsp[-1].minor.yy164, yymsp[0].minor.yy213.type, &yymsp[0].minor.yy213.val); } + yymsp[-1].minor.yy164 = yylhsminor.yy164; break; case 194: /* alter_table_option ::= COMMENT NK_STRING */ -{ yymsp[-1].minor.yy101.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy101.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy213.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy213.val = yymsp[0].minor.yy0; } break; case 195: /* alter_table_option ::= TTL NK_INTEGER */ -{ yymsp[-1].minor.yy101.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy101.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy213.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy213.val = yymsp[0].minor.yy0; } break; case 196: /* duration_list ::= duration_literal */ - case 359: /* expression_list ::= expr_or_subquery */ yytestcase(yyruleno==359); -{ yylhsminor.yy288 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy232)); } - yymsp[0].minor.yy288 = yylhsminor.yy288; + case 367: /* expression_list ::= expr_or_subquery */ yytestcase(yyruleno==367); +{ yylhsminor.yy648 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy164)); } + yymsp[0].minor.yy648 = yylhsminor.yy648; break; case 197: /* duration_list ::= duration_list NK_COMMA duration_literal */ - case 360: /* expression_list ::= expression_list NK_COMMA expr_or_subquery */ yytestcase(yyruleno==360); -{ yylhsminor.yy288 = addNodeToList(pCxt, yymsp[-2].minor.yy288, releaseRawExprNode(pCxt, yymsp[0].minor.yy232)); } - yymsp[-2].minor.yy288 = yylhsminor.yy288; + case 368: /* expression_list ::= expression_list NK_COMMA expr_or_subquery */ yytestcase(yyruleno==368); +{ yylhsminor.yy648 = addNodeToList(pCxt, yymsp[-2].minor.yy648, releaseRawExprNode(pCxt, yymsp[0].minor.yy164)); } + yymsp[-2].minor.yy648 = yylhsminor.yy648; break; case 200: /* rollup_func_name ::= function_name */ -{ yylhsminor.yy232 = createFunctionNode(pCxt, &yymsp[0].minor.yy481, NULL); } - yymsp[0].minor.yy232 = yylhsminor.yy232; +{ yylhsminor.yy164 = createFunctionNode(pCxt, &yymsp[0].minor.yy593, NULL); } + yymsp[0].minor.yy164 = yylhsminor.yy164; break; case 201: /* rollup_func_name ::= FIRST */ case 202: /* rollup_func_name ::= LAST */ yytestcase(yyruleno==202); -{ yylhsminor.yy232 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); } - yymsp[0].minor.yy232 = yylhsminor.yy232; + case 254: /* tag_item ::= QTAGS */ yytestcase(yyruleno==254); +{ yylhsminor.yy164 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); } + yymsp[0].minor.yy164 = yylhsminor.yy164; break; case 205: /* col_name ::= column_name */ -{ yylhsminor.yy232 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy481); } - yymsp[0].minor.yy232 = yylhsminor.yy232; + case 255: /* tag_item ::= column_name */ yytestcase(yyruleno==255); +{ yylhsminor.yy164 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy593); } + yymsp[0].minor.yy164 = yylhsminor.yy164; break; case 206: /* cmd ::= SHOW DNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DNODES_STMT); } @@ -4404,13 +4389,13 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DATABASES_STMT); } break; case 209: /* cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TABLES_STMT, yymsp[-2].minor.yy232, yymsp[0].minor.yy232, OP_TYPE_LIKE); } +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TABLES_STMT, yymsp[-2].minor.yy164, yymsp[0].minor.yy164, OP_TYPE_LIKE); } break; case 210: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy232, yymsp[0].minor.yy232, OP_TYPE_LIKE); } +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy164, yymsp[0].minor.yy164, OP_TYPE_LIKE); } break; case 211: /* cmd ::= SHOW db_name_cond_opt VGROUPS */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy232, NULL, OP_TYPE_LIKE); } +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy164, NULL, OP_TYPE_LIKE); } break; case 212: /* cmd ::= SHOW MNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_MNODES_STMT); } @@ -4422,7 +4407,7 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_FUNCTIONS_STMT); } break; case 215: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy232, yymsp[-1].minor.yy232, OP_TYPE_EQUAL); } +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy164, yymsp[-1].minor.yy164, OP_TYPE_EQUAL); } break; case 216: /* cmd ::= SHOW STREAMS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STREAMS_STMT); } @@ -4441,13 +4426,13 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LICENCES_STMT); } break; case 222: /* cmd ::= SHOW CREATE DATABASE db_name */ -{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy481); } +{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy593); } break; case 223: /* cmd ::= SHOW CREATE TABLE full_table_name */ -{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy232); } +{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy164); } break; case 224: /* cmd ::= SHOW CREATE STABLE full_table_name */ -{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy232); } +{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy164); } break; case 225: /* cmd ::= SHOW QUERIES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QUERIES_STMT); } @@ -4466,7 +4451,7 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LOCAL_VARIABLES_STMT); } break; case 231: /* cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ -{ pCxt->pRootNode = createShowDnodeVariablesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[-2].minor.yy0), yymsp[0].minor.yy232); } +{ pCxt->pRootNode = createShowDnodeVariablesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[-2].minor.yy0), yymsp[0].minor.yy164); } break; case 232: /* cmd ::= SHOW BNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_BNODES_STMT); } @@ -4481,7 +4466,7 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TRANSACTIONS_STMT); } break; case 236: /* cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ -{ pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy232); } +{ pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy164); } break; case 237: /* cmd ::= SHOW CONSUMERS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONSUMERS_STMT); } @@ -4490,10 +4475,10 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SUBSCRIPTIONS_STMT); } break; case 239: /* cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, yymsp[0].minor.yy232, yymsp[-1].minor.yy232, OP_TYPE_EQUAL); } +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, yymsp[0].minor.yy164, yymsp[-1].minor.yy164, OP_TYPE_EQUAL); } break; - case 240: /* cmd ::= SHOW TABLE TAGS FROM table_name_cond from_db_opt */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TABLE_TAGS_STMT, yymsp[0].minor.yy232, yymsp[-1].minor.yy232, OP_TYPE_EQUAL); } + case 240: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ +{ pCxt->pRootNode = createShowTableTagsStmt(pCxt, yymsp[-1].minor.yy164, yymsp[0].minor.yy164, yymsp[-3].minor.yy648); } break; case 241: /* cmd ::= SHOW VNODES NK_INTEGER */ { pCxt->pRootNode = createShowVnodesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0), NULL); } @@ -4503,722 +4488,734 @@ static YYACTIONTYPE yy_reduce( break; case 243: /* db_name_cond_opt ::= */ case 248: /* from_db_opt ::= */ yytestcase(yyruleno==248); -{ yymsp[1].minor.yy232 = createDefaultDatabaseCondValue(pCxt); } +{ yymsp[1].minor.yy164 = createDefaultDatabaseCondValue(pCxt); } break; case 244: /* db_name_cond_opt ::= db_name NK_DOT */ -{ yylhsminor.yy232 = createIdentifierValueNode(pCxt, &yymsp[-1].minor.yy481); } - yymsp[-1].minor.yy232 = yylhsminor.yy232; +{ yylhsminor.yy164 = createIdentifierValueNode(pCxt, &yymsp[-1].minor.yy593); } + yymsp[-1].minor.yy164 = yylhsminor.yy164; break; case 245: /* like_pattern_opt ::= */ - case 291: /* subtable_opt ::= */ yytestcase(yyruleno==291); - case 404: /* case_when_else_opt ::= */ yytestcase(yyruleno==404); - case 434: /* from_clause_opt ::= */ yytestcase(yyruleno==434); - case 463: /* where_clause_opt ::= */ yytestcase(yyruleno==463); - case 472: /* twindow_clause_opt ::= */ yytestcase(yyruleno==472); - case 477: /* sliding_opt ::= */ yytestcase(yyruleno==477); - case 479: /* fill_opt ::= */ yytestcase(yyruleno==479); - case 491: /* having_clause_opt ::= */ yytestcase(yyruleno==491); - case 493: /* range_opt ::= */ yytestcase(yyruleno==493); - case 495: /* every_opt ::= */ yytestcase(yyruleno==495); - case 508: /* slimit_clause_opt ::= */ yytestcase(yyruleno==508); - case 512: /* limit_clause_opt ::= */ yytestcase(yyruleno==512); -{ yymsp[1].minor.yy232 = NULL; } + case 299: /* subtable_opt ::= */ yytestcase(yyruleno==299); + case 412: /* case_when_else_opt ::= */ yytestcase(yyruleno==412); + case 442: /* from_clause_opt ::= */ yytestcase(yyruleno==442); + case 471: /* where_clause_opt ::= */ yytestcase(yyruleno==471); + case 480: /* twindow_clause_opt ::= */ yytestcase(yyruleno==480); + case 485: /* sliding_opt ::= */ yytestcase(yyruleno==485); + case 487: /* fill_opt ::= */ yytestcase(yyruleno==487); + case 499: /* having_clause_opt ::= */ yytestcase(yyruleno==499); + case 501: /* range_opt ::= */ yytestcase(yyruleno==501); + case 503: /* every_opt ::= */ yytestcase(yyruleno==503); + case 516: /* slimit_clause_opt ::= */ yytestcase(yyruleno==516); + case 520: /* limit_clause_opt ::= */ yytestcase(yyruleno==520); +{ yymsp[1].minor.yy164 = NULL; } break; case 246: /* like_pattern_opt ::= LIKE NK_STRING */ -{ yymsp[-1].minor.yy232 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } +{ yymsp[-1].minor.yy164 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } break; case 247: /* table_name_cond ::= table_name */ -{ yylhsminor.yy232 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy481); } - yymsp[0].minor.yy232 = yylhsminor.yy232; +{ yylhsminor.yy164 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy593); } + yymsp[0].minor.yy164 = yylhsminor.yy164; break; case 249: /* from_db_opt ::= FROM db_name */ -{ yymsp[-1].minor.yy232 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy481); } +{ yymsp[-1].minor.yy164 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy593); } break; - case 250: /* cmd ::= CREATE SMA INDEX not_exists_opt full_table_name ON full_table_name index_options */ -{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy777, yymsp[-3].minor.yy232, yymsp[-1].minor.yy232, NULL, yymsp[0].minor.yy232); } + case 253: /* tag_item ::= TBNAME */ +{ yylhsminor.yy164 = setProjectionAlias(pCxt, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL), &yymsp[0].minor.yy0); } + yymsp[0].minor.yy164 = yylhsminor.yy164; break; - case 251: /* cmd ::= DROP INDEX exists_opt full_table_name */ -{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy777, yymsp[0].minor.yy232); } + case 256: /* tag_item ::= column_name column_alias */ +{ yylhsminor.yy164 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-1].minor.yy593), &yymsp[0].minor.yy593); } + yymsp[-1].minor.yy164 = yylhsminor.yy164; break; - case 252: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ -{ yymsp[-9].minor.yy232 = createIndexOption(pCxt, yymsp[-7].minor.yy288, releaseRawExprNode(pCxt, yymsp[-3].minor.yy232), NULL, yymsp[-1].minor.yy232, yymsp[0].minor.yy232); } + case 257: /* tag_item ::= column_name AS column_alias */ +{ yylhsminor.yy164 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-2].minor.yy593), &yymsp[0].minor.yy593); } + yymsp[-2].minor.yy164 = yylhsminor.yy164; break; - case 253: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt sma_stream_opt */ -{ yymsp[-11].minor.yy232 = createIndexOption(pCxt, yymsp[-9].minor.yy288, releaseRawExprNode(pCxt, yymsp[-5].minor.yy232), releaseRawExprNode(pCxt, yymsp[-3].minor.yy232), yymsp[-1].minor.yy232, yymsp[0].minor.yy232); } + case 258: /* cmd ::= CREATE SMA INDEX not_exists_opt full_table_name ON full_table_name index_options */ +{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy193, yymsp[-3].minor.yy164, yymsp[-1].minor.yy164, NULL, yymsp[0].minor.yy164); } break; - case 256: /* func ::= function_name NK_LP expression_list NK_RP */ -{ yylhsminor.yy232 = createFunctionNode(pCxt, &yymsp[-3].minor.yy481, yymsp[-1].minor.yy288); } - yymsp[-3].minor.yy232 = yylhsminor.yy232; + case 259: /* cmd ::= DROP INDEX exists_opt full_table_name */ +{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy193, yymsp[0].minor.yy164); } break; - case 257: /* sma_stream_opt ::= */ - case 284: /* stream_options ::= */ yytestcase(yyruleno==284); -{ yymsp[1].minor.yy232 = createStreamOptions(pCxt); } + case 260: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ +{ yymsp[-9].minor.yy164 = createIndexOption(pCxt, yymsp[-7].minor.yy648, releaseRawExprNode(pCxt, yymsp[-3].minor.yy164), NULL, yymsp[-1].minor.yy164, yymsp[0].minor.yy164); } break; - case 258: /* sma_stream_opt ::= stream_options WATERMARK duration_literal */ - case 288: /* stream_options ::= stream_options WATERMARK duration_literal */ yytestcase(yyruleno==288); -{ ((SStreamOptions*)yymsp[-2].minor.yy232)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy232); yylhsminor.yy232 = yymsp[-2].minor.yy232; } - yymsp[-2].minor.yy232 = yylhsminor.yy232; + case 261: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt sma_stream_opt */ +{ yymsp[-11].minor.yy164 = createIndexOption(pCxt, yymsp[-9].minor.yy648, releaseRawExprNode(pCxt, yymsp[-5].minor.yy164), releaseRawExprNode(pCxt, yymsp[-3].minor.yy164), yymsp[-1].minor.yy164, yymsp[0].minor.yy164); } break; - case 259: /* sma_stream_opt ::= stream_options MAX_DELAY duration_literal */ -{ ((SStreamOptions*)yymsp[-2].minor.yy232)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy232); yylhsminor.yy232 = yymsp[-2].minor.yy232; } - yymsp[-2].minor.yy232 = yylhsminor.yy232; + case 264: /* func ::= function_name NK_LP expression_list NK_RP */ +{ yylhsminor.yy164 = createFunctionNode(pCxt, &yymsp[-3].minor.yy593, yymsp[-1].minor.yy648); } + yymsp[-3].minor.yy164 = yylhsminor.yy164; break; - case 260: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ -{ pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy777, &yymsp[-2].minor.yy481, yymsp[0].minor.yy232); } + case 265: /* sma_stream_opt ::= */ + case 292: /* stream_options ::= */ yytestcase(yyruleno==292); +{ yymsp[1].minor.yy164 = createStreamOptions(pCxt); } break; - case 261: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */ -{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy777, &yymsp[-3].minor.yy481, &yymsp[0].minor.yy481, false); } + case 266: /* sma_stream_opt ::= stream_options WATERMARK duration_literal */ + case 296: /* stream_options ::= stream_options WATERMARK duration_literal */ yytestcase(yyruleno==296); +{ ((SStreamOptions*)yymsp[-2].minor.yy164)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy164); yylhsminor.yy164 = yymsp[-2].minor.yy164; } + yymsp[-2].minor.yy164 = yylhsminor.yy164; break; - case 262: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */ -{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-6].minor.yy777, &yymsp[-5].minor.yy481, &yymsp[0].minor.yy481, true); } + case 267: /* sma_stream_opt ::= stream_options MAX_DELAY duration_literal */ +{ ((SStreamOptions*)yymsp[-2].minor.yy164)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy164); yylhsminor.yy164 = yymsp[-2].minor.yy164; } + yymsp[-2].minor.yy164 = yylhsminor.yy164; break; - case 263: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */ -{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-4].minor.yy777, &yymsp[-3].minor.yy481, yymsp[0].minor.yy232, false); } + case 268: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ +{ pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy193, &yymsp[-2].minor.yy593, yymsp[0].minor.yy164); } break; - case 264: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */ -{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-6].minor.yy777, &yymsp[-5].minor.yy481, yymsp[0].minor.yy232, true); } + case 269: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */ +{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy193, &yymsp[-3].minor.yy593, &yymsp[0].minor.yy593, false); } break; - case 265: /* cmd ::= DROP TOPIC exists_opt topic_name */ -{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy777, &yymsp[0].minor.yy481); } + case 270: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */ +{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-6].minor.yy193, &yymsp[-5].minor.yy593, &yymsp[0].minor.yy593, true); } break; - case 266: /* cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ -{ pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy777, &yymsp[-2].minor.yy481, &yymsp[0].minor.yy481); } + case 271: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */ +{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-4].minor.yy193, &yymsp[-3].minor.yy593, yymsp[0].minor.yy164, false); } break; - case 267: /* cmd ::= DESC full_table_name */ - case 268: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==268); -{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy232); } + case 272: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */ +{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-6].minor.yy193, &yymsp[-5].minor.yy593, yymsp[0].minor.yy164, true); } break; - case 269: /* cmd ::= RESET QUERY CACHE */ + case 273: /* cmd ::= DROP TOPIC exists_opt topic_name */ +{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy193, &yymsp[0].minor.yy593); } + break; + case 274: /* cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ +{ pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy193, &yymsp[-2].minor.yy593, &yymsp[0].minor.yy593); } + break; + case 275: /* cmd ::= DESC full_table_name */ + case 276: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==276); +{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy164); } + break; + case 277: /* cmd ::= RESET QUERY CACHE */ { pCxt->pRootNode = createResetQueryCacheStmt(pCxt); } break; - case 270: /* cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ -{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy777, yymsp[-1].minor.yy232, yymsp[0].minor.yy232); } + case 278: /* cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ +{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy193, yymsp[-1].minor.yy164, yymsp[0].minor.yy164); } break; - case 273: /* explain_options ::= */ -{ yymsp[1].minor.yy232 = createDefaultExplainOptions(pCxt); } + case 281: /* explain_options ::= */ +{ yymsp[1].minor.yy164 = createDefaultExplainOptions(pCxt); } break; - case 274: /* explain_options ::= explain_options VERBOSE NK_BOOL */ -{ yylhsminor.yy232 = setExplainVerbose(pCxt, yymsp[-2].minor.yy232, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy232 = yylhsminor.yy232; + case 282: /* explain_options ::= explain_options VERBOSE NK_BOOL */ +{ yylhsminor.yy164 = setExplainVerbose(pCxt, yymsp[-2].minor.yy164, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy164 = yylhsminor.yy164; break; - case 275: /* explain_options ::= explain_options RATIO NK_FLOAT */ -{ yylhsminor.yy232 = setExplainRatio(pCxt, yymsp[-2].minor.yy232, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy232 = yylhsminor.yy232; + case 283: /* explain_options ::= explain_options RATIO NK_FLOAT */ +{ yylhsminor.yy164 = setExplainRatio(pCxt, yymsp[-2].minor.yy164, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy164 = yylhsminor.yy164; break; - case 276: /* cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */ -{ pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-6].minor.yy777, yymsp[-8].minor.yy777, &yymsp[-5].minor.yy481, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy264, yymsp[0].minor.yy692); } + case 284: /* cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */ +{ pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-6].minor.yy193, yymsp[-8].minor.yy193, &yymsp[-5].minor.yy593, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy720, yymsp[0].minor.yy512); } break; - case 277: /* cmd ::= DROP FUNCTION exists_opt function_name */ -{ pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy777, &yymsp[0].minor.yy481); } + case 285: /* cmd ::= DROP FUNCTION exists_opt function_name */ +{ pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy193, &yymsp[0].minor.yy593); } break; - case 282: /* cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name tags_def_opt subtable_opt AS query_or_subquery */ -{ pCxt->pRootNode = createCreateStreamStmt(pCxt, yymsp[-8].minor.yy777, &yymsp[-7].minor.yy481, yymsp[-4].minor.yy232, yymsp[-6].minor.yy232, yymsp[-3].minor.yy288, yymsp[-2].minor.yy232, yymsp[0].minor.yy232); } + case 290: /* cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name tags_def_opt subtable_opt AS query_or_subquery */ +{ pCxt->pRootNode = createCreateStreamStmt(pCxt, yymsp[-8].minor.yy193, &yymsp[-7].minor.yy593, yymsp[-4].minor.yy164, yymsp[-6].minor.yy164, yymsp[-3].minor.yy648, yymsp[-2].minor.yy164, yymsp[0].minor.yy164); } break; - case 283: /* cmd ::= DROP STREAM exists_opt stream_name */ -{ pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy777, &yymsp[0].minor.yy481); } + case 291: /* cmd ::= DROP STREAM exists_opt stream_name */ +{ pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy193, &yymsp[0].minor.yy593); } break; - case 285: /* stream_options ::= stream_options TRIGGER AT_ONCE */ -{ ((SStreamOptions*)yymsp[-2].minor.yy232)->triggerType = STREAM_TRIGGER_AT_ONCE; yylhsminor.yy232 = yymsp[-2].minor.yy232; } - yymsp[-2].minor.yy232 = yylhsminor.yy232; + case 293: /* stream_options ::= stream_options TRIGGER AT_ONCE */ +{ ((SStreamOptions*)yymsp[-2].minor.yy164)->triggerType = STREAM_TRIGGER_AT_ONCE; yylhsminor.yy164 = yymsp[-2].minor.yy164; } + yymsp[-2].minor.yy164 = yylhsminor.yy164; break; - case 286: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ -{ ((SStreamOptions*)yymsp[-2].minor.yy232)->triggerType = STREAM_TRIGGER_WINDOW_CLOSE; yylhsminor.yy232 = yymsp[-2].minor.yy232; } - yymsp[-2].minor.yy232 = yylhsminor.yy232; + case 294: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ +{ ((SStreamOptions*)yymsp[-2].minor.yy164)->triggerType = STREAM_TRIGGER_WINDOW_CLOSE; yylhsminor.yy164 = yymsp[-2].minor.yy164; } + yymsp[-2].minor.yy164 = yylhsminor.yy164; break; - case 287: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ -{ ((SStreamOptions*)yymsp[-3].minor.yy232)->triggerType = STREAM_TRIGGER_MAX_DELAY; ((SStreamOptions*)yymsp[-3].minor.yy232)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy232); yylhsminor.yy232 = yymsp[-3].minor.yy232; } - yymsp[-3].minor.yy232 = yylhsminor.yy232; + case 295: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ +{ ((SStreamOptions*)yymsp[-3].minor.yy164)->triggerType = STREAM_TRIGGER_MAX_DELAY; ((SStreamOptions*)yymsp[-3].minor.yy164)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy164); yylhsminor.yy164 = yymsp[-3].minor.yy164; } + yymsp[-3].minor.yy164 = yylhsminor.yy164; break; - case 289: /* stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ -{ ((SStreamOptions*)yymsp[-3].minor.yy232)->ignoreExpired = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); yylhsminor.yy232 = yymsp[-3].minor.yy232; } - yymsp[-3].minor.yy232 = yylhsminor.yy232; + case 297: /* stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ +{ ((SStreamOptions*)yymsp[-3].minor.yy164)->ignoreExpired = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); yylhsminor.yy164 = yymsp[-3].minor.yy164; } + yymsp[-3].minor.yy164 = yylhsminor.yy164; break; - case 290: /* stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ -{ ((SStreamOptions*)yymsp[-2].minor.yy232)->fillHistory = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); yylhsminor.yy232 = yymsp[-2].minor.yy232; } - yymsp[-2].minor.yy232 = yylhsminor.yy232; + case 298: /* stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ +{ ((SStreamOptions*)yymsp[-2].minor.yy164)->fillHistory = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); yylhsminor.yy164 = yymsp[-2].minor.yy164; } + yymsp[-2].minor.yy164 = yylhsminor.yy164; break; - case 292: /* subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ - case 478: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ yytestcase(yyruleno==478); - case 496: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==496); -{ yymsp[-3].minor.yy232 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy232); } + case 300: /* subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ + case 486: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ yytestcase(yyruleno==486); + case 504: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==504); +{ yymsp[-3].minor.yy164 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy164); } break; - case 293: /* cmd ::= KILL CONNECTION NK_INTEGER */ + case 301: /* cmd ::= KILL CONNECTION NK_INTEGER */ { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_CONNECTION_STMT, &yymsp[0].minor.yy0); } break; - case 294: /* cmd ::= KILL QUERY NK_STRING */ + case 302: /* cmd ::= KILL QUERY NK_STRING */ { pCxt->pRootNode = createKillQueryStmt(pCxt, &yymsp[0].minor.yy0); } break; - case 295: /* cmd ::= KILL TRANSACTION NK_INTEGER */ + case 303: /* cmd ::= KILL TRANSACTION NK_INTEGER */ { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_TRANSACTION_STMT, &yymsp[0].minor.yy0); } break; - case 296: /* cmd ::= BALANCE VGROUP */ + case 304: /* cmd ::= BALANCE VGROUP */ { pCxt->pRootNode = createBalanceVgroupStmt(pCxt); } break; - case 297: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ + case 305: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ { pCxt->pRootNode = createMergeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } break; - case 298: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ -{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy288); } + case 306: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ +{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy648); } break; - case 299: /* cmd ::= SPLIT VGROUP NK_INTEGER */ + case 307: /* cmd ::= SPLIT VGROUP NK_INTEGER */ { pCxt->pRootNode = createSplitVgroupStmt(pCxt, &yymsp[0].minor.yy0); } break; - case 300: /* dnode_list ::= DNODE NK_INTEGER */ -{ yymsp[-1].minor.yy288 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + case 308: /* dnode_list ::= DNODE NK_INTEGER */ +{ yymsp[-1].minor.yy648 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } break; - case 302: /* cmd ::= DELETE FROM full_table_name where_clause_opt */ -{ pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy232, yymsp[0].minor.yy232); } + case 310: /* cmd ::= DELETE FROM full_table_name where_clause_opt */ +{ pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy164, yymsp[0].minor.yy164); } break; - case 304: /* cmd ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ -{ pCxt->pRootNode = createInsertStmt(pCxt, yymsp[-4].minor.yy232, yymsp[-2].minor.yy288, yymsp[0].minor.yy232); } + case 312: /* cmd ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ +{ pCxt->pRootNode = createInsertStmt(pCxt, yymsp[-4].minor.yy164, yymsp[-2].minor.yy648, yymsp[0].minor.yy164); } break; - case 305: /* cmd ::= INSERT INTO full_table_name query_or_subquery */ -{ pCxt->pRootNode = createInsertStmt(pCxt, yymsp[-1].minor.yy232, NULL, yymsp[0].minor.yy232); } + case 313: /* cmd ::= INSERT INTO full_table_name query_or_subquery */ +{ pCxt->pRootNode = createInsertStmt(pCxt, yymsp[-1].minor.yy164, NULL, yymsp[0].minor.yy164); } break; - case 306: /* literal ::= NK_INTEGER */ -{ yylhsminor.yy232 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy232 = yylhsminor.yy232; + case 314: /* literal ::= NK_INTEGER */ +{ yylhsminor.yy164 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy164 = yylhsminor.yy164; break; - case 307: /* literal ::= NK_FLOAT */ -{ yylhsminor.yy232 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy232 = yylhsminor.yy232; + case 315: /* literal ::= NK_FLOAT */ +{ yylhsminor.yy164 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy164 = yylhsminor.yy164; break; - case 308: /* literal ::= NK_STRING */ -{ yylhsminor.yy232 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy232 = yylhsminor.yy232; + case 316: /* literal ::= NK_STRING */ +{ yylhsminor.yy164 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy164 = yylhsminor.yy164; break; - case 309: /* literal ::= NK_BOOL */ -{ yylhsminor.yy232 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy232 = yylhsminor.yy232; + case 317: /* literal ::= NK_BOOL */ +{ yylhsminor.yy164 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy164 = yylhsminor.yy164; break; - case 310: /* literal ::= TIMESTAMP NK_STRING */ -{ yylhsminor.yy232 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } - yymsp[-1].minor.yy232 = yylhsminor.yy232; + case 318: /* literal ::= TIMESTAMP NK_STRING */ +{ yylhsminor.yy164 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } + yymsp[-1].minor.yy164 = yylhsminor.yy164; break; - case 311: /* literal ::= duration_literal */ - case 321: /* signed_literal ::= signed */ yytestcase(yyruleno==321); - case 341: /* expr_or_subquery ::= expression */ yytestcase(yyruleno==341); - case 342: /* expr_or_subquery ::= subquery */ yytestcase(yyruleno==342); - case 343: /* expression ::= literal */ yytestcase(yyruleno==343); - case 344: /* expression ::= pseudo_column */ yytestcase(yyruleno==344); - case 345: /* expression ::= column_reference */ yytestcase(yyruleno==345); - case 346: /* expression ::= function_expression */ yytestcase(yyruleno==346); - case 347: /* expression ::= case_when_expression */ yytestcase(yyruleno==347); - case 377: /* function_expression ::= literal_func */ yytestcase(yyruleno==377); - case 426: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==426); - case 430: /* boolean_primary ::= predicate */ yytestcase(yyruleno==430); - case 432: /* common_expression ::= expr_or_subquery */ yytestcase(yyruleno==432); - case 433: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==433); - case 436: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==436); - case 438: /* table_reference ::= table_primary */ yytestcase(yyruleno==438); - case 439: /* table_reference ::= joined_table */ yytestcase(yyruleno==439); - case 443: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==443); - case 498: /* query_simple ::= query_specification */ yytestcase(yyruleno==498); - case 499: /* query_simple ::= union_query_expression */ yytestcase(yyruleno==499); - case 502: /* query_simple_or_subquery ::= query_simple */ yytestcase(yyruleno==502); - case 504: /* query_or_subquery ::= query_expression */ yytestcase(yyruleno==504); -{ yylhsminor.yy232 = yymsp[0].minor.yy232; } - yymsp[0].minor.yy232 = yylhsminor.yy232; + case 319: /* literal ::= duration_literal */ + case 329: /* signed_literal ::= signed */ yytestcase(yyruleno==329); + case 349: /* expr_or_subquery ::= expression */ yytestcase(yyruleno==349); + case 350: /* expr_or_subquery ::= subquery */ yytestcase(yyruleno==350); + case 351: /* expression ::= literal */ yytestcase(yyruleno==351); + case 352: /* expression ::= pseudo_column */ yytestcase(yyruleno==352); + case 353: /* expression ::= column_reference */ yytestcase(yyruleno==353); + case 354: /* expression ::= function_expression */ yytestcase(yyruleno==354); + case 355: /* expression ::= case_when_expression */ yytestcase(yyruleno==355); + case 385: /* function_expression ::= literal_func */ yytestcase(yyruleno==385); + case 434: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==434); + case 438: /* boolean_primary ::= predicate */ yytestcase(yyruleno==438); + case 440: /* common_expression ::= expr_or_subquery */ yytestcase(yyruleno==440); + case 441: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==441); + case 444: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==444); + case 446: /* table_reference ::= table_primary */ yytestcase(yyruleno==446); + case 447: /* table_reference ::= joined_table */ yytestcase(yyruleno==447); + case 451: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==451); + case 506: /* query_simple ::= query_specification */ yytestcase(yyruleno==506); + case 507: /* query_simple ::= union_query_expression */ yytestcase(yyruleno==507); + case 510: /* query_simple_or_subquery ::= query_simple */ yytestcase(yyruleno==510); + case 512: /* query_or_subquery ::= query_expression */ yytestcase(yyruleno==512); +{ yylhsminor.yy164 = yymsp[0].minor.yy164; } + yymsp[0].minor.yy164 = yylhsminor.yy164; break; - case 312: /* literal ::= NULL */ -{ yylhsminor.yy232 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy232 = yylhsminor.yy232; + case 320: /* literal ::= NULL */ +{ yylhsminor.yy164 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy164 = yylhsminor.yy164; break; - case 313: /* literal ::= NK_QUESTION */ -{ yylhsminor.yy232 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy232 = yylhsminor.yy232; + case 321: /* literal ::= NK_QUESTION */ +{ yylhsminor.yy164 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy164 = yylhsminor.yy164; break; - case 314: /* duration_literal ::= NK_VARIABLE */ -{ yylhsminor.yy232 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy232 = yylhsminor.yy232; + case 322: /* duration_literal ::= NK_VARIABLE */ +{ yylhsminor.yy164 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy164 = yylhsminor.yy164; break; - case 315: /* signed ::= NK_INTEGER */ -{ yylhsminor.yy232 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy232 = yylhsminor.yy232; + case 323: /* signed ::= NK_INTEGER */ +{ yylhsminor.yy164 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy164 = yylhsminor.yy164; break; - case 316: /* signed ::= NK_PLUS NK_INTEGER */ -{ yymsp[-1].minor.yy232 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } + case 324: /* signed ::= NK_PLUS NK_INTEGER */ +{ yymsp[-1].minor.yy164 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } break; - case 317: /* signed ::= NK_MINUS NK_INTEGER */ + case 325: /* signed ::= NK_MINUS NK_INTEGER */ { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy232 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t); + yylhsminor.yy164 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t); } - yymsp[-1].minor.yy232 = yylhsminor.yy232; + yymsp[-1].minor.yy164 = yylhsminor.yy164; break; - case 318: /* signed ::= NK_FLOAT */ -{ yylhsminor.yy232 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy232 = yylhsminor.yy232; + case 326: /* signed ::= NK_FLOAT */ +{ yylhsminor.yy164 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy164 = yylhsminor.yy164; break; - case 319: /* signed ::= NK_PLUS NK_FLOAT */ -{ yymsp[-1].minor.yy232 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } + case 327: /* signed ::= NK_PLUS NK_FLOAT */ +{ yymsp[-1].minor.yy164 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } break; - case 320: /* signed ::= NK_MINUS NK_FLOAT */ + case 328: /* signed ::= NK_MINUS NK_FLOAT */ { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy232 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t); + yylhsminor.yy164 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t); } - yymsp[-1].minor.yy232 = yylhsminor.yy232; + yymsp[-1].minor.yy164 = yylhsminor.yy164; break; - case 322: /* signed_literal ::= NK_STRING */ -{ yylhsminor.yy232 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy232 = yylhsminor.yy232; + case 330: /* signed_literal ::= NK_STRING */ +{ yylhsminor.yy164 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy164 = yylhsminor.yy164; break; - case 323: /* signed_literal ::= NK_BOOL */ -{ yylhsminor.yy232 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy232 = yylhsminor.yy232; + case 331: /* signed_literal ::= NK_BOOL */ +{ yylhsminor.yy164 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy164 = yylhsminor.yy164; break; - case 324: /* signed_literal ::= TIMESTAMP NK_STRING */ -{ yymsp[-1].minor.yy232 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } + case 332: /* signed_literal ::= TIMESTAMP NK_STRING */ +{ yymsp[-1].minor.yy164 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } break; - case 325: /* signed_literal ::= duration_literal */ - case 327: /* signed_literal ::= literal_func */ yytestcase(yyruleno==327); - case 397: /* star_func_para ::= expr_or_subquery */ yytestcase(yyruleno==397); - case 459: /* select_item ::= common_expression */ yytestcase(yyruleno==459); - case 469: /* partition_item ::= expr_or_subquery */ yytestcase(yyruleno==469); - case 503: /* query_simple_or_subquery ::= subquery */ yytestcase(yyruleno==503); - case 505: /* query_or_subquery ::= subquery */ yytestcase(yyruleno==505); - case 518: /* search_condition ::= common_expression */ yytestcase(yyruleno==518); -{ yylhsminor.yy232 = releaseRawExprNode(pCxt, yymsp[0].minor.yy232); } - yymsp[0].minor.yy232 = yylhsminor.yy232; + case 333: /* signed_literal ::= duration_literal */ + case 335: /* signed_literal ::= literal_func */ yytestcase(yyruleno==335); + case 405: /* star_func_para ::= expr_or_subquery */ yytestcase(yyruleno==405); + case 467: /* select_item ::= common_expression */ yytestcase(yyruleno==467); + case 477: /* partition_item ::= expr_or_subquery */ yytestcase(yyruleno==477); + case 511: /* query_simple_or_subquery ::= subquery */ yytestcase(yyruleno==511); + case 513: /* query_or_subquery ::= subquery */ yytestcase(yyruleno==513); + case 526: /* search_condition ::= common_expression */ yytestcase(yyruleno==526); +{ yylhsminor.yy164 = releaseRawExprNode(pCxt, yymsp[0].minor.yy164); } + yymsp[0].minor.yy164 = yylhsminor.yy164; break; - case 326: /* signed_literal ::= NULL */ -{ yylhsminor.yy232 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy232 = yylhsminor.yy232; + case 334: /* signed_literal ::= NULL */ +{ yylhsminor.yy164 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy164 = yylhsminor.yy164; break; - case 328: /* signed_literal ::= NK_QUESTION */ -{ yylhsminor.yy232 = createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy232 = yylhsminor.yy232; + case 336: /* signed_literal ::= NK_QUESTION */ +{ yylhsminor.yy164 = createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy164 = yylhsminor.yy164; break; - case 348: /* expression ::= NK_LP expression NK_RP */ - case 431: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==431); - case 517: /* subquery ::= NK_LP subquery NK_RP */ yytestcase(yyruleno==517); -{ yylhsminor.yy232 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy232)); } - yymsp[-2].minor.yy232 = yylhsminor.yy232; + case 356: /* expression ::= NK_LP expression NK_RP */ + case 439: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==439); + case 525: /* subquery ::= NK_LP subquery NK_RP */ yytestcase(yyruleno==525); +{ yylhsminor.yy164 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy164)); } + yymsp[-2].minor.yy164 = yylhsminor.yy164; break; - case 349: /* expression ::= NK_PLUS expr_or_subquery */ + case 357: /* expression ::= NK_PLUS expr_or_subquery */ { - SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy232); - yylhsminor.yy232 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy232)); + SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy164); + yylhsminor.yy164 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy164)); } - yymsp[-1].minor.yy232 = yylhsminor.yy232; + yymsp[-1].minor.yy164 = yylhsminor.yy164; break; - case 350: /* expression ::= NK_MINUS expr_or_subquery */ + case 358: /* expression ::= NK_MINUS expr_or_subquery */ { - SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy232); - yylhsminor.yy232 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy232), NULL)); + SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy164); + yylhsminor.yy164 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy164), NULL)); } - yymsp[-1].minor.yy232 = yylhsminor.yy232; + yymsp[-1].minor.yy164 = yylhsminor.yy164; break; - case 351: /* expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ + case 359: /* expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy232); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy232); - yylhsminor.yy232 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy232), releaseRawExprNode(pCxt, yymsp[0].minor.yy232))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy164); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy164); + yylhsminor.yy164 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy164), releaseRawExprNode(pCxt, yymsp[0].minor.yy164))); } - yymsp[-2].minor.yy232 = yylhsminor.yy232; + yymsp[-2].minor.yy164 = yylhsminor.yy164; break; - case 352: /* expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ + case 360: /* expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy232); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy232); - yylhsminor.yy232 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy232), releaseRawExprNode(pCxt, yymsp[0].minor.yy232))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy164); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy164); + yylhsminor.yy164 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy164), releaseRawExprNode(pCxt, yymsp[0].minor.yy164))); } - yymsp[-2].minor.yy232 = yylhsminor.yy232; + yymsp[-2].minor.yy164 = yylhsminor.yy164; break; - case 353: /* expression ::= expr_or_subquery NK_STAR expr_or_subquery */ + case 361: /* expression ::= expr_or_subquery NK_STAR expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy232); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy232); - yylhsminor.yy232 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy232), releaseRawExprNode(pCxt, yymsp[0].minor.yy232))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy164); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy164); + yylhsminor.yy164 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy164), releaseRawExprNode(pCxt, yymsp[0].minor.yy164))); } - yymsp[-2].minor.yy232 = yylhsminor.yy232; + yymsp[-2].minor.yy164 = yylhsminor.yy164; break; - case 354: /* expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ + case 362: /* expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy232); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy232); - yylhsminor.yy232 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy232), releaseRawExprNode(pCxt, yymsp[0].minor.yy232))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy164); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy164); + yylhsminor.yy164 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy164), releaseRawExprNode(pCxt, yymsp[0].minor.yy164))); } - yymsp[-2].minor.yy232 = yylhsminor.yy232; + yymsp[-2].minor.yy164 = yylhsminor.yy164; break; - case 355: /* expression ::= expr_or_subquery NK_REM expr_or_subquery */ + case 363: /* expression ::= expr_or_subquery NK_REM expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy232); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy232); - yylhsminor.yy232 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy232), releaseRawExprNode(pCxt, yymsp[0].minor.yy232))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy164); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy164); + yylhsminor.yy164 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy164), releaseRawExprNode(pCxt, yymsp[0].minor.yy164))); } - yymsp[-2].minor.yy232 = yylhsminor.yy232; + yymsp[-2].minor.yy164 = yylhsminor.yy164; break; - case 356: /* expression ::= column_reference NK_ARROW NK_STRING */ + case 364: /* expression ::= column_reference NK_ARROW NK_STRING */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy232); - yylhsminor.yy232 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy232), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy164); + yylhsminor.yy164 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy164), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0))); } - yymsp[-2].minor.yy232 = yylhsminor.yy232; + yymsp[-2].minor.yy164 = yylhsminor.yy164; break; - case 357: /* expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ + case 365: /* expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy232); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy232); - yylhsminor.yy232 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy232), releaseRawExprNode(pCxt, yymsp[0].minor.yy232))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy164); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy164); + yylhsminor.yy164 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy164), releaseRawExprNode(pCxt, yymsp[0].minor.yy164))); } - yymsp[-2].minor.yy232 = yylhsminor.yy232; + yymsp[-2].minor.yy164 = yylhsminor.yy164; break; - case 358: /* expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ + case 366: /* expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy232); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy232); - yylhsminor.yy232 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy232), releaseRawExprNode(pCxt, yymsp[0].minor.yy232))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy164); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy164); + yylhsminor.yy164 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy164), releaseRawExprNode(pCxt, yymsp[0].minor.yy164))); } - yymsp[-2].minor.yy232 = yylhsminor.yy232; + yymsp[-2].minor.yy164 = yylhsminor.yy164; break; - case 361: /* column_reference ::= column_name */ -{ yylhsminor.yy232 = createRawExprNode(pCxt, &yymsp[0].minor.yy481, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy481)); } - yymsp[0].minor.yy232 = yylhsminor.yy232; + case 369: /* column_reference ::= column_name */ +{ yylhsminor.yy164 = createRawExprNode(pCxt, &yymsp[0].minor.yy593, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy593)); } + yymsp[0].minor.yy164 = yylhsminor.yy164; break; - case 362: /* column_reference ::= table_name NK_DOT column_name */ -{ yylhsminor.yy232 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy481, &yymsp[0].minor.yy481, createColumnNode(pCxt, &yymsp[-2].minor.yy481, &yymsp[0].minor.yy481)); } - yymsp[-2].minor.yy232 = yylhsminor.yy232; + case 370: /* column_reference ::= table_name NK_DOT column_name */ +{ yylhsminor.yy164 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy593, &yymsp[0].minor.yy593, createColumnNode(pCxt, &yymsp[-2].minor.yy593, &yymsp[0].minor.yy593)); } + yymsp[-2].minor.yy164 = yylhsminor.yy164; break; - case 363: /* pseudo_column ::= ROWTS */ - case 364: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==364); - case 366: /* pseudo_column ::= QSTART */ yytestcase(yyruleno==366); - case 367: /* pseudo_column ::= QEND */ yytestcase(yyruleno==367); - case 368: /* pseudo_column ::= QDURATION */ yytestcase(yyruleno==368); - case 369: /* pseudo_column ::= WSTART */ yytestcase(yyruleno==369); - case 370: /* pseudo_column ::= WEND */ yytestcase(yyruleno==370); - case 371: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==371); - case 372: /* pseudo_column ::= IROWTS */ yytestcase(yyruleno==372); - case 373: /* pseudo_column ::= QTAGS */ yytestcase(yyruleno==373); - case 379: /* literal_func ::= NOW */ yytestcase(yyruleno==379); -{ yylhsminor.yy232 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } - yymsp[0].minor.yy232 = yylhsminor.yy232; + case 371: /* pseudo_column ::= ROWTS */ + case 372: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==372); + case 374: /* pseudo_column ::= QSTART */ yytestcase(yyruleno==374); + case 375: /* pseudo_column ::= QEND */ yytestcase(yyruleno==375); + case 376: /* pseudo_column ::= QDURATION */ yytestcase(yyruleno==376); + case 377: /* pseudo_column ::= WSTART */ yytestcase(yyruleno==377); + case 378: /* pseudo_column ::= WEND */ yytestcase(yyruleno==378); + case 379: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==379); + case 380: /* pseudo_column ::= IROWTS */ yytestcase(yyruleno==380); + case 381: /* pseudo_column ::= QTAGS */ yytestcase(yyruleno==381); + case 387: /* literal_func ::= NOW */ yytestcase(yyruleno==387); +{ yylhsminor.yy164 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } + yymsp[0].minor.yy164 = yylhsminor.yy164; break; - case 365: /* pseudo_column ::= table_name NK_DOT TBNAME */ -{ yylhsminor.yy232 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy481, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy481)))); } - yymsp[-2].minor.yy232 = yylhsminor.yy232; + case 373: /* pseudo_column ::= table_name NK_DOT TBNAME */ +{ yylhsminor.yy164 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy593, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy593)))); } + yymsp[-2].minor.yy164 = yylhsminor.yy164; break; - case 374: /* function_expression ::= function_name NK_LP expression_list NK_RP */ - case 375: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==375); -{ yylhsminor.yy232 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy481, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy481, yymsp[-1].minor.yy288)); } - yymsp[-3].minor.yy232 = yylhsminor.yy232; + case 382: /* function_expression ::= function_name NK_LP expression_list NK_RP */ + case 383: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==383); +{ yylhsminor.yy164 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy593, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy593, yymsp[-1].minor.yy648)); } + yymsp[-3].minor.yy164 = yylhsminor.yy164; break; - case 376: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ -{ yylhsminor.yy232 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy232), yymsp[-1].minor.yy264)); } - yymsp[-5].minor.yy232 = yylhsminor.yy232; + case 384: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ +{ yylhsminor.yy164 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy164), yymsp[-1].minor.yy720)); } + yymsp[-5].minor.yy164 = yylhsminor.yy164; break; - case 378: /* literal_func ::= noarg_func NK_LP NK_RP */ -{ yylhsminor.yy232 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy481, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy481, NULL)); } - yymsp[-2].minor.yy232 = yylhsminor.yy232; + case 386: /* literal_func ::= noarg_func NK_LP NK_RP */ +{ yylhsminor.yy164 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy593, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy593, NULL)); } + yymsp[-2].minor.yy164 = yylhsminor.yy164; break; - case 393: /* star_func_para_list ::= NK_STAR */ -{ yylhsminor.yy288 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy288 = yylhsminor.yy288; + case 401: /* star_func_para_list ::= NK_STAR */ +{ yylhsminor.yy648 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy648 = yylhsminor.yy648; break; - case 398: /* star_func_para ::= table_name NK_DOT NK_STAR */ - case 462: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==462); -{ yylhsminor.yy232 = createColumnNode(pCxt, &yymsp[-2].minor.yy481, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy232 = yylhsminor.yy232; + case 406: /* star_func_para ::= table_name NK_DOT NK_STAR */ + case 470: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==470); +{ yylhsminor.yy164 = createColumnNode(pCxt, &yymsp[-2].minor.yy593, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy164 = yylhsminor.yy164; break; - case 399: /* case_when_expression ::= CASE when_then_list case_when_else_opt END */ -{ yylhsminor.yy232 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, NULL, yymsp[-2].minor.yy288, yymsp[-1].minor.yy232)); } - yymsp[-3].minor.yy232 = yylhsminor.yy232; + case 407: /* case_when_expression ::= CASE when_then_list case_when_else_opt END */ +{ yylhsminor.yy164 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, NULL, yymsp[-2].minor.yy648, yymsp[-1].minor.yy164)); } + yymsp[-3].minor.yy164 = yylhsminor.yy164; break; - case 400: /* case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ -{ yylhsminor.yy232 = createRawExprNodeExt(pCxt, &yymsp[-4].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy232), yymsp[-2].minor.yy288, yymsp[-1].minor.yy232)); } - yymsp[-4].minor.yy232 = yylhsminor.yy232; + case 408: /* case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ +{ yylhsminor.yy164 = createRawExprNodeExt(pCxt, &yymsp[-4].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy164), yymsp[-2].minor.yy648, yymsp[-1].minor.yy164)); } + yymsp[-4].minor.yy164 = yylhsminor.yy164; break; - case 403: /* when_then_expr ::= WHEN common_expression THEN common_expression */ -{ yymsp[-3].minor.yy232 = createWhenThenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy232), releaseRawExprNode(pCxt, yymsp[0].minor.yy232)); } + case 411: /* when_then_expr ::= WHEN common_expression THEN common_expression */ +{ yymsp[-3].minor.yy164 = createWhenThenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy164), releaseRawExprNode(pCxt, yymsp[0].minor.yy164)); } break; - case 405: /* case_when_else_opt ::= ELSE common_expression */ -{ yymsp[-1].minor.yy232 = releaseRawExprNode(pCxt, yymsp[0].minor.yy232); } + case 413: /* case_when_else_opt ::= ELSE common_expression */ +{ yymsp[-1].minor.yy164 = releaseRawExprNode(pCxt, yymsp[0].minor.yy164); } break; - case 406: /* predicate ::= expr_or_subquery compare_op expr_or_subquery */ - case 411: /* predicate ::= expr_or_subquery in_op in_predicate_value */ yytestcase(yyruleno==411); + case 414: /* predicate ::= expr_or_subquery compare_op expr_or_subquery */ + case 419: /* predicate ::= expr_or_subquery in_op in_predicate_value */ yytestcase(yyruleno==419); { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy232); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy232); - yylhsminor.yy232 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy4, releaseRawExprNode(pCxt, yymsp[-2].minor.yy232), releaseRawExprNode(pCxt, yymsp[0].minor.yy232))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy164); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy164); + yylhsminor.yy164 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy656, releaseRawExprNode(pCxt, yymsp[-2].minor.yy164), releaseRawExprNode(pCxt, yymsp[0].minor.yy164))); } - yymsp[-2].minor.yy232 = yylhsminor.yy232; + yymsp[-2].minor.yy164 = yylhsminor.yy164; break; - case 407: /* predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ + case 415: /* predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy232); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy232); - yylhsminor.yy232 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy232), releaseRawExprNode(pCxt, yymsp[-2].minor.yy232), releaseRawExprNode(pCxt, yymsp[0].minor.yy232))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy164); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy164); + yylhsminor.yy164 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy164), releaseRawExprNode(pCxt, yymsp[-2].minor.yy164), releaseRawExprNode(pCxt, yymsp[0].minor.yy164))); } - yymsp[-4].minor.yy232 = yylhsminor.yy232; + yymsp[-4].minor.yy164 = yylhsminor.yy164; break; - case 408: /* predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ + case 416: /* predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy232); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy232); - yylhsminor.yy232 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy232), releaseRawExprNode(pCxt, yymsp[-2].minor.yy232), releaseRawExprNode(pCxt, yymsp[0].minor.yy232))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy164); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy164); + yylhsminor.yy164 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy164), releaseRawExprNode(pCxt, yymsp[-2].minor.yy164), releaseRawExprNode(pCxt, yymsp[0].minor.yy164))); } - yymsp[-5].minor.yy232 = yylhsminor.yy232; + yymsp[-5].minor.yy164 = yylhsminor.yy164; break; - case 409: /* predicate ::= expr_or_subquery IS NULL */ + case 417: /* predicate ::= expr_or_subquery IS NULL */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy232); - yylhsminor.yy232 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy232), NULL)); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy164); + yylhsminor.yy164 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy164), NULL)); } - yymsp[-2].minor.yy232 = yylhsminor.yy232; + yymsp[-2].minor.yy164 = yylhsminor.yy164; break; - case 410: /* predicate ::= expr_or_subquery IS NOT NULL */ + case 418: /* predicate ::= expr_or_subquery IS NOT NULL */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy232); - yylhsminor.yy232 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy232), NULL)); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy164); + yylhsminor.yy164 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy164), NULL)); } - yymsp[-3].minor.yy232 = yylhsminor.yy232; + yymsp[-3].minor.yy164 = yylhsminor.yy164; break; - case 412: /* compare_op ::= NK_LT */ -{ yymsp[0].minor.yy4 = OP_TYPE_LOWER_THAN; } + case 420: /* compare_op ::= NK_LT */ +{ yymsp[0].minor.yy656 = OP_TYPE_LOWER_THAN; } break; - case 413: /* compare_op ::= NK_GT */ -{ yymsp[0].minor.yy4 = OP_TYPE_GREATER_THAN; } + case 421: /* compare_op ::= NK_GT */ +{ yymsp[0].minor.yy656 = OP_TYPE_GREATER_THAN; } break; - case 414: /* compare_op ::= NK_LE */ -{ yymsp[0].minor.yy4 = OP_TYPE_LOWER_EQUAL; } + case 422: /* compare_op ::= NK_LE */ +{ yymsp[0].minor.yy656 = OP_TYPE_LOWER_EQUAL; } break; - case 415: /* compare_op ::= NK_GE */ -{ yymsp[0].minor.yy4 = OP_TYPE_GREATER_EQUAL; } + case 423: /* compare_op ::= NK_GE */ +{ yymsp[0].minor.yy656 = OP_TYPE_GREATER_EQUAL; } break; - case 416: /* compare_op ::= NK_NE */ -{ yymsp[0].minor.yy4 = OP_TYPE_NOT_EQUAL; } + case 424: /* compare_op ::= NK_NE */ +{ yymsp[0].minor.yy656 = OP_TYPE_NOT_EQUAL; } break; - case 417: /* compare_op ::= NK_EQ */ -{ yymsp[0].minor.yy4 = OP_TYPE_EQUAL; } + case 425: /* compare_op ::= NK_EQ */ +{ yymsp[0].minor.yy656 = OP_TYPE_EQUAL; } break; - case 418: /* compare_op ::= LIKE */ -{ yymsp[0].minor.yy4 = OP_TYPE_LIKE; } + case 426: /* compare_op ::= LIKE */ +{ yymsp[0].minor.yy656 = OP_TYPE_LIKE; } break; - case 419: /* compare_op ::= NOT LIKE */ -{ yymsp[-1].minor.yy4 = OP_TYPE_NOT_LIKE; } + case 427: /* compare_op ::= NOT LIKE */ +{ yymsp[-1].minor.yy656 = OP_TYPE_NOT_LIKE; } break; - case 420: /* compare_op ::= MATCH */ -{ yymsp[0].minor.yy4 = OP_TYPE_MATCH; } + case 428: /* compare_op ::= MATCH */ +{ yymsp[0].minor.yy656 = OP_TYPE_MATCH; } break; - case 421: /* compare_op ::= NMATCH */ -{ yymsp[0].minor.yy4 = OP_TYPE_NMATCH; } + case 429: /* compare_op ::= NMATCH */ +{ yymsp[0].minor.yy656 = OP_TYPE_NMATCH; } break; - case 422: /* compare_op ::= CONTAINS */ -{ yymsp[0].minor.yy4 = OP_TYPE_JSON_CONTAINS; } + case 430: /* compare_op ::= CONTAINS */ +{ yymsp[0].minor.yy656 = OP_TYPE_JSON_CONTAINS; } break; - case 423: /* in_op ::= IN */ -{ yymsp[0].minor.yy4 = OP_TYPE_IN; } + case 431: /* in_op ::= IN */ +{ yymsp[0].minor.yy656 = OP_TYPE_IN; } break; - case 424: /* in_op ::= NOT IN */ -{ yymsp[-1].minor.yy4 = OP_TYPE_NOT_IN; } + case 432: /* in_op ::= NOT IN */ +{ yymsp[-1].minor.yy656 = OP_TYPE_NOT_IN; } break; - case 425: /* in_predicate_value ::= NK_LP literal_list NK_RP */ -{ yylhsminor.yy232 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy288)); } - yymsp[-2].minor.yy232 = yylhsminor.yy232; + case 433: /* in_predicate_value ::= NK_LP literal_list NK_RP */ +{ yylhsminor.yy164 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy648)); } + yymsp[-2].minor.yy164 = yylhsminor.yy164; break; - case 427: /* boolean_value_expression ::= NOT boolean_primary */ + case 435: /* boolean_value_expression ::= NOT boolean_primary */ { - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy232); - yylhsminor.yy232 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy232), NULL)); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy164); + yylhsminor.yy164 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy164), NULL)); } - yymsp[-1].minor.yy232 = yylhsminor.yy232; + yymsp[-1].minor.yy164 = yylhsminor.yy164; break; - case 428: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + case 436: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy232); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy232); - yylhsminor.yy232 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy232), releaseRawExprNode(pCxt, yymsp[0].minor.yy232))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy164); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy164); + yylhsminor.yy164 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy164), releaseRawExprNode(pCxt, yymsp[0].minor.yy164))); } - yymsp[-2].minor.yy232 = yylhsminor.yy232; + yymsp[-2].minor.yy164 = yylhsminor.yy164; break; - case 429: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + case 437: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy232); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy232); - yylhsminor.yy232 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy232), releaseRawExprNode(pCxt, yymsp[0].minor.yy232))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy164); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy164); + yylhsminor.yy164 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy164), releaseRawExprNode(pCxt, yymsp[0].minor.yy164))); } - yymsp[-2].minor.yy232 = yylhsminor.yy232; + yymsp[-2].minor.yy164 = yylhsminor.yy164; break; - case 435: /* from_clause_opt ::= FROM table_reference_list */ - case 464: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==464); - case 492: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==492); -{ yymsp[-1].minor.yy232 = yymsp[0].minor.yy232; } + case 443: /* from_clause_opt ::= FROM table_reference_list */ + case 472: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==472); + case 500: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==500); +{ yymsp[-1].minor.yy164 = yymsp[0].minor.yy164; } break; - case 437: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ -{ yylhsminor.yy232 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy232, yymsp[0].minor.yy232, NULL); } - yymsp[-2].minor.yy232 = yylhsminor.yy232; + case 445: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ +{ yylhsminor.yy164 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy164, yymsp[0].minor.yy164, NULL); } + yymsp[-2].minor.yy164 = yylhsminor.yy164; break; - case 440: /* table_primary ::= table_name alias_opt */ -{ yylhsminor.yy232 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy481, &yymsp[0].minor.yy481); } - yymsp[-1].minor.yy232 = yylhsminor.yy232; + case 448: /* table_primary ::= table_name alias_opt */ +{ yylhsminor.yy164 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy593, &yymsp[0].minor.yy593); } + yymsp[-1].minor.yy164 = yylhsminor.yy164; break; - case 441: /* table_primary ::= db_name NK_DOT table_name alias_opt */ -{ yylhsminor.yy232 = createRealTableNode(pCxt, &yymsp[-3].minor.yy481, &yymsp[-1].minor.yy481, &yymsp[0].minor.yy481); } - yymsp[-3].minor.yy232 = yylhsminor.yy232; + case 449: /* table_primary ::= db_name NK_DOT table_name alias_opt */ +{ yylhsminor.yy164 = createRealTableNode(pCxt, &yymsp[-3].minor.yy593, &yymsp[-1].minor.yy593, &yymsp[0].minor.yy593); } + yymsp[-3].minor.yy164 = yylhsminor.yy164; break; - case 442: /* table_primary ::= subquery alias_opt */ -{ yylhsminor.yy232 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy232), &yymsp[0].minor.yy481); } - yymsp[-1].minor.yy232 = yylhsminor.yy232; + case 450: /* table_primary ::= subquery alias_opt */ +{ yylhsminor.yy164 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy164), &yymsp[0].minor.yy593); } + yymsp[-1].minor.yy164 = yylhsminor.yy164; break; - case 444: /* alias_opt ::= */ -{ yymsp[1].minor.yy481 = nil_token; } + case 452: /* alias_opt ::= */ +{ yymsp[1].minor.yy593 = nil_token; } break; - case 445: /* alias_opt ::= table_alias */ -{ yylhsminor.yy481 = yymsp[0].minor.yy481; } - yymsp[0].minor.yy481 = yylhsminor.yy481; + case 453: /* alias_opt ::= table_alias */ +{ yylhsminor.yy593 = yymsp[0].minor.yy593; } + yymsp[0].minor.yy593 = yylhsminor.yy593; break; - case 446: /* alias_opt ::= AS table_alias */ -{ yymsp[-1].minor.yy481 = yymsp[0].minor.yy481; } + case 454: /* alias_opt ::= AS table_alias */ +{ yymsp[-1].minor.yy593 = yymsp[0].minor.yy593; } break; - case 447: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - case 448: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==448); -{ yymsp[-2].minor.yy232 = yymsp[-1].minor.yy232; } + case 455: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + case 456: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==456); +{ yymsp[-2].minor.yy164 = yymsp[-1].minor.yy164; } break; - case 449: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ -{ yylhsminor.yy232 = createJoinTableNode(pCxt, yymsp[-4].minor.yy700, yymsp[-5].minor.yy232, yymsp[-2].minor.yy232, yymsp[0].minor.yy232); } - yymsp[-5].minor.yy232 = yylhsminor.yy232; + case 457: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ +{ yylhsminor.yy164 = createJoinTableNode(pCxt, yymsp[-4].minor.yy868, yymsp[-5].minor.yy164, yymsp[-2].minor.yy164, yymsp[0].minor.yy164); } + yymsp[-5].minor.yy164 = yylhsminor.yy164; break; - case 450: /* join_type ::= */ -{ yymsp[1].minor.yy700 = JOIN_TYPE_INNER; } + case 458: /* join_type ::= */ +{ yymsp[1].minor.yy868 = JOIN_TYPE_INNER; } break; - case 451: /* join_type ::= INNER */ -{ yymsp[0].minor.yy700 = JOIN_TYPE_INNER; } + case 459: /* join_type ::= INNER */ +{ yymsp[0].minor.yy868 = JOIN_TYPE_INNER; } break; - case 452: /* query_specification ::= SELECT set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ + case 460: /* query_specification ::= SELECT set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ { - yymsp[-11].minor.yy232 = createSelectStmt(pCxt, yymsp[-10].minor.yy777, yymsp[-9].minor.yy288, yymsp[-8].minor.yy232); - yymsp[-11].minor.yy232 = addWhereClause(pCxt, yymsp[-11].minor.yy232, yymsp[-7].minor.yy232); - yymsp[-11].minor.yy232 = addPartitionByClause(pCxt, yymsp[-11].minor.yy232, yymsp[-6].minor.yy288); - yymsp[-11].minor.yy232 = addWindowClauseClause(pCxt, yymsp[-11].minor.yy232, yymsp[-2].minor.yy232); - yymsp[-11].minor.yy232 = addGroupByClause(pCxt, yymsp[-11].minor.yy232, yymsp[-1].minor.yy288); - yymsp[-11].minor.yy232 = addHavingClause(pCxt, yymsp[-11].minor.yy232, yymsp[0].minor.yy232); - yymsp[-11].minor.yy232 = addRangeClause(pCxt, yymsp[-11].minor.yy232, yymsp[-5].minor.yy232); - yymsp[-11].minor.yy232 = addEveryClause(pCxt, yymsp[-11].minor.yy232, yymsp[-4].minor.yy232); - yymsp[-11].minor.yy232 = addFillClause(pCxt, yymsp[-11].minor.yy232, yymsp[-3].minor.yy232); + yymsp[-11].minor.yy164 = createSelectStmt(pCxt, yymsp[-10].minor.yy193, yymsp[-9].minor.yy648, yymsp[-8].minor.yy164); + yymsp[-11].minor.yy164 = addWhereClause(pCxt, yymsp[-11].minor.yy164, yymsp[-7].minor.yy164); + yymsp[-11].minor.yy164 = addPartitionByClause(pCxt, yymsp[-11].minor.yy164, yymsp[-6].minor.yy648); + yymsp[-11].minor.yy164 = addWindowClauseClause(pCxt, yymsp[-11].minor.yy164, yymsp[-2].minor.yy164); + yymsp[-11].minor.yy164 = addGroupByClause(pCxt, yymsp[-11].minor.yy164, yymsp[-1].minor.yy648); + yymsp[-11].minor.yy164 = addHavingClause(pCxt, yymsp[-11].minor.yy164, yymsp[0].minor.yy164); + yymsp[-11].minor.yy164 = addRangeClause(pCxt, yymsp[-11].minor.yy164, yymsp[-5].minor.yy164); + yymsp[-11].minor.yy164 = addEveryClause(pCxt, yymsp[-11].minor.yy164, yymsp[-4].minor.yy164); + yymsp[-11].minor.yy164 = addFillClause(pCxt, yymsp[-11].minor.yy164, yymsp[-3].minor.yy164); } break; - case 455: /* set_quantifier_opt ::= ALL */ -{ yymsp[0].minor.yy777 = false; } + case 463: /* set_quantifier_opt ::= ALL */ +{ yymsp[0].minor.yy193 = false; } break; - case 458: /* select_item ::= NK_STAR */ -{ yylhsminor.yy232 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy232 = yylhsminor.yy232; + case 466: /* select_item ::= NK_STAR */ +{ yylhsminor.yy164 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy164 = yylhsminor.yy164; break; - case 460: /* select_item ::= common_expression column_alias */ - case 470: /* partition_item ::= expr_or_subquery column_alias */ yytestcase(yyruleno==470); -{ yylhsminor.yy232 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy232), &yymsp[0].minor.yy481); } - yymsp[-1].minor.yy232 = yylhsminor.yy232; + case 468: /* select_item ::= common_expression column_alias */ + case 478: /* partition_item ::= expr_or_subquery column_alias */ yytestcase(yyruleno==478); +{ yylhsminor.yy164 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy164), &yymsp[0].minor.yy593); } + yymsp[-1].minor.yy164 = yylhsminor.yy164; break; - case 461: /* select_item ::= common_expression AS column_alias */ - case 471: /* partition_item ::= expr_or_subquery AS column_alias */ yytestcase(yyruleno==471); -{ yylhsminor.yy232 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy232), &yymsp[0].minor.yy481); } - yymsp[-2].minor.yy232 = yylhsminor.yy232; + case 469: /* select_item ::= common_expression AS column_alias */ + case 479: /* partition_item ::= expr_or_subquery AS column_alias */ yytestcase(yyruleno==479); +{ yylhsminor.yy164 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy164), &yymsp[0].minor.yy593); } + yymsp[-2].minor.yy164 = yylhsminor.yy164; break; - case 466: /* partition_by_clause_opt ::= PARTITION BY partition_list */ - case 488: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==488); - case 507: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==507); -{ yymsp[-2].minor.yy288 = yymsp[0].minor.yy288; } + case 474: /* partition_by_clause_opt ::= PARTITION BY partition_list */ + case 496: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==496); + case 515: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==515); +{ yymsp[-2].minor.yy648 = yymsp[0].minor.yy648; } break; - case 473: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ -{ yymsp[-5].minor.yy232 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy232), releaseRawExprNode(pCxt, yymsp[-1].minor.yy232)); } + case 481: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ +{ yymsp[-5].minor.yy164 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy164), releaseRawExprNode(pCxt, yymsp[-1].minor.yy164)); } break; - case 474: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ -{ yymsp[-3].minor.yy232 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy232)); } + case 482: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ +{ yymsp[-3].minor.yy164 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy164)); } break; - case 475: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ -{ yymsp[-5].minor.yy232 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy232), NULL, yymsp[-1].minor.yy232, yymsp[0].minor.yy232); } + case 483: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ +{ yymsp[-5].minor.yy164 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy164), NULL, yymsp[-1].minor.yy164, yymsp[0].minor.yy164); } break; - case 476: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ -{ yymsp[-7].minor.yy232 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy232), releaseRawExprNode(pCxt, yymsp[-3].minor.yy232), yymsp[-1].minor.yy232, yymsp[0].minor.yy232); } + case 484: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ +{ yymsp[-7].minor.yy164 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy164), releaseRawExprNode(pCxt, yymsp[-3].minor.yy164), yymsp[-1].minor.yy164, yymsp[0].minor.yy164); } break; - case 480: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ -{ yymsp[-3].minor.yy232 = createFillNode(pCxt, yymsp[-1].minor.yy614, NULL); } + case 488: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ +{ yymsp[-3].minor.yy164 = createFillNode(pCxt, yymsp[-1].minor.yy638, NULL); } break; - case 481: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ -{ yymsp[-5].minor.yy232 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy288)); } + case 489: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ +{ yymsp[-5].minor.yy164 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy648)); } break; - case 482: /* fill_mode ::= NONE */ -{ yymsp[0].minor.yy614 = FILL_MODE_NONE; } + case 490: /* fill_mode ::= NONE */ +{ yymsp[0].minor.yy638 = FILL_MODE_NONE; } break; - case 483: /* fill_mode ::= PREV */ -{ yymsp[0].minor.yy614 = FILL_MODE_PREV; } + case 491: /* fill_mode ::= PREV */ +{ yymsp[0].minor.yy638 = FILL_MODE_PREV; } break; - case 484: /* fill_mode ::= NULL */ -{ yymsp[0].minor.yy614 = FILL_MODE_NULL; } + case 492: /* fill_mode ::= NULL */ +{ yymsp[0].minor.yy638 = FILL_MODE_NULL; } break; - case 485: /* fill_mode ::= LINEAR */ -{ yymsp[0].minor.yy614 = FILL_MODE_LINEAR; } + case 493: /* fill_mode ::= LINEAR */ +{ yymsp[0].minor.yy638 = FILL_MODE_LINEAR; } break; - case 486: /* fill_mode ::= NEXT */ -{ yymsp[0].minor.yy614 = FILL_MODE_NEXT; } + case 494: /* fill_mode ::= NEXT */ +{ yymsp[0].minor.yy638 = FILL_MODE_NEXT; } break; - case 489: /* group_by_list ::= expr_or_subquery */ -{ yylhsminor.yy288 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy232))); } - yymsp[0].minor.yy288 = yylhsminor.yy288; + case 497: /* group_by_list ::= expr_or_subquery */ +{ yylhsminor.yy648 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy164))); } + yymsp[0].minor.yy648 = yylhsminor.yy648; break; - case 490: /* group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ -{ yylhsminor.yy288 = addNodeToList(pCxt, yymsp[-2].minor.yy288, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy232))); } - yymsp[-2].minor.yy288 = yylhsminor.yy288; + case 498: /* group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ +{ yylhsminor.yy648 = addNodeToList(pCxt, yymsp[-2].minor.yy648, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy164))); } + yymsp[-2].minor.yy648 = yylhsminor.yy648; break; - case 494: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ -{ yymsp[-5].minor.yy232 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy232), releaseRawExprNode(pCxt, yymsp[-1].minor.yy232)); } + case 502: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ +{ yymsp[-5].minor.yy164 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy164), releaseRawExprNode(pCxt, yymsp[-1].minor.yy164)); } break; - case 497: /* query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ + case 505: /* query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ { - yylhsminor.yy232 = addOrderByClause(pCxt, yymsp[-3].minor.yy232, yymsp[-2].minor.yy288); - yylhsminor.yy232 = addSlimitClause(pCxt, yylhsminor.yy232, yymsp[-1].minor.yy232); - yylhsminor.yy232 = addLimitClause(pCxt, yylhsminor.yy232, yymsp[0].minor.yy232); + yylhsminor.yy164 = addOrderByClause(pCxt, yymsp[-3].minor.yy164, yymsp[-2].minor.yy648); + yylhsminor.yy164 = addSlimitClause(pCxt, yylhsminor.yy164, yymsp[-1].minor.yy164); + yylhsminor.yy164 = addLimitClause(pCxt, yylhsminor.yy164, yymsp[0].minor.yy164); } - yymsp[-3].minor.yy232 = yylhsminor.yy232; + yymsp[-3].minor.yy164 = yylhsminor.yy164; break; - case 500: /* union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ -{ yylhsminor.yy232 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy232, yymsp[0].minor.yy232); } - yymsp[-3].minor.yy232 = yylhsminor.yy232; + case 508: /* union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ +{ yylhsminor.yy164 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy164, yymsp[0].minor.yy164); } + yymsp[-3].minor.yy164 = yylhsminor.yy164; break; - case 501: /* union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ -{ yylhsminor.yy232 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy232, yymsp[0].minor.yy232); } - yymsp[-2].minor.yy232 = yylhsminor.yy232; + case 509: /* union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ +{ yylhsminor.yy164 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy164, yymsp[0].minor.yy164); } + yymsp[-2].minor.yy164 = yylhsminor.yy164; break; - case 509: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ - case 513: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==513); -{ yymsp[-1].minor.yy232 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } + case 517: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ + case 521: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==521); +{ yymsp[-1].minor.yy164 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } break; - case 510: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - case 514: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==514); -{ yymsp[-3].minor.yy232 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } + case 518: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + case 522: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==522); +{ yymsp[-3].minor.yy164 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } break; - case 511: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - case 515: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==515); -{ yymsp[-3].minor.yy232 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } + case 519: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + case 523: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==523); +{ yymsp[-3].minor.yy164 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } break; - case 516: /* subquery ::= NK_LP query_expression NK_RP */ -{ yylhsminor.yy232 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy232); } - yymsp[-2].minor.yy232 = yylhsminor.yy232; + case 524: /* subquery ::= NK_LP query_expression NK_RP */ +{ yylhsminor.yy164 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy164); } + yymsp[-2].minor.yy164 = yylhsminor.yy164; break; - case 521: /* sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ -{ yylhsminor.yy232 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy232), yymsp[-1].minor.yy866, yymsp[0].minor.yy833); } - yymsp[-2].minor.yy232 = yylhsminor.yy232; + case 529: /* sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ +{ yylhsminor.yy164 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy164), yymsp[-1].minor.yy238, yymsp[0].minor.yy153); } + yymsp[-2].minor.yy164 = yylhsminor.yy164; break; - case 522: /* ordering_specification_opt ::= */ -{ yymsp[1].minor.yy866 = ORDER_ASC; } + case 530: /* ordering_specification_opt ::= */ +{ yymsp[1].minor.yy238 = ORDER_ASC; } break; - case 523: /* ordering_specification_opt ::= ASC */ -{ yymsp[0].minor.yy866 = ORDER_ASC; } + case 531: /* ordering_specification_opt ::= ASC */ +{ yymsp[0].minor.yy238 = ORDER_ASC; } break; - case 524: /* ordering_specification_opt ::= DESC */ -{ yymsp[0].minor.yy866 = ORDER_DESC; } + case 532: /* ordering_specification_opt ::= DESC */ +{ yymsp[0].minor.yy238 = ORDER_DESC; } break; - case 525: /* null_ordering_opt ::= */ -{ yymsp[1].minor.yy833 = NULL_ORDER_DEFAULT; } + case 533: /* null_ordering_opt ::= */ +{ yymsp[1].minor.yy153 = NULL_ORDER_DEFAULT; } break; - case 526: /* null_ordering_opt ::= NULLS FIRST */ -{ yymsp[-1].minor.yy833 = NULL_ORDER_FIRST; } + case 534: /* null_ordering_opt ::= NULLS FIRST */ +{ yymsp[-1].minor.yy153 = NULL_ORDER_FIRST; } break; - case 527: /* null_ordering_opt ::= NULLS LAST */ -{ yymsp[-1].minor.yy833 = NULL_ORDER_LAST; } + case 535: /* null_ordering_opt ::= NULLS LAST */ +{ yymsp[-1].minor.yy153 = NULL_ORDER_LAST; } break; default: break; diff --git a/source/libs/parser/test/mockCatalog.cpp b/source/libs/parser/test/mockCatalog.cpp index 4f5ddd9a51..8f051c67a0 100644 --- a/source/libs/parser/test/mockCatalog.cpp +++ b/source/libs/parser/test/mockCatalog.cpp @@ -249,7 +249,7 @@ int32_t __catalogGetTableDistVgInfo(SCatalog* pCtg, SRequestConnInfo* pConn, con } int32_t __catalogGetDBVgVersion(SCatalog* pCtg, const char* dbFName, int32_t* version, int64_t* dbId, - int32_t* tableNum) { + int32_t* tableNum, int64_t* stateTs) { return 0; } diff --git a/source/libs/parser/test/parSelectTest.cpp b/source/libs/parser/test/parSelectTest.cpp index 0027ac9ca1..fcd8dd1f26 100644 --- a/source/libs/parser/test/parSelectTest.cpp +++ b/source/libs/parser/test/parSelectTest.cpp @@ -425,6 +425,8 @@ TEST_F(ParserSelectTest, informationSchema) { run("SELECT * FROM ins_databases WHERE name = 'information_schema'"); run("SELECT * FROM ins_tags WHERE db_name = 'test' and table_name = 'st1'"); + + run("SELECT * FROM (SELECT table_name FROM ins_tables) t WHERE table_name = 'a'"); } TEST_F(ParserSelectTest, withoutFrom) { diff --git a/source/libs/parser/test/parShowToUse.cpp b/source/libs/parser/test/parShowToUse.cpp index 7f6e4adb2f..e2f833cffa 100644 --- a/source/libs/parser/test/parShowToUse.cpp +++ b/source/libs/parser/test/parShowToUse.cpp @@ -192,6 +192,16 @@ TEST_F(ParserShowToUseTest, showTableDistributed) { run("SHOW TABLE DISTRIBUTED st1"); } +TEST_F(ParserShowToUseTest, showTableTags) { + useDb("root", "test"); + + run("SHOW TABLE TAGS FROM st1"); + + run("SHOW TABLE TAGS tag1, tag2 FROM st1"); + + run("SHOW TABLE TAGS TBNAME, _TAGS, tag3 FROM st1"); +} + TEST_F(ParserShowToUseTest, showTags) { useDb("root", "test"); diff --git a/source/libs/planner/src/planLogicCreater.c b/source/libs/planner/src/planLogicCreater.c index 275983f869..89e8a85895 100644 --- a/source/libs/planner/src/planLogicCreater.c +++ b/source/libs/planner/src/planLogicCreater.c @@ -189,7 +189,7 @@ static int32_t createSelectRootLogicNode(SLogicPlanContext* pCxt, SSelectStmt* p } static EScanType getScanType(SLogicPlanContext* pCxt, SNodeList* pScanPseudoCols, SNodeList* pScanCols, - int8_t tableType) { + int8_t tableType, bool tagScan) { if (pCxt->pPlanCxt->topicQuery || pCxt->pPlanCxt->streamQuery) { return SCAN_TYPE_STREAM; } @@ -198,6 +198,10 @@ static EScanType getScanType(SLogicPlanContext* pCxt, SNodeList* pScanPseudoCols return SCAN_TYPE_SYSTEM_TABLE; } + if (tagScan) { + return SCAN_TYPE_TAG; + } + if (NULL == pScanCols) { return NULL == pScanPseudoCols ? SCAN_TYPE_TABLE @@ -310,7 +314,7 @@ static int32_t createScanLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect code = rewriteExprsForSelect(pScan->pScanPseudoCols, pSelect, SQL_CLAUSE_FROM); } - pScan->scanType = getScanType(pCxt, pScan->pScanPseudoCols, pScan->pScanCols, pScan->tableType); + pScan->scanType = getScanType(pCxt, pScan->pScanPseudoCols, pScan->pScanCols, pScan->tableType, pSelect->tagScan); if (NULL != pScan->pScanCols) { pScan->hasNormalCols = true; diff --git a/source/libs/qcom/src/queryUtil.c b/source/libs/qcom/src/queryUtil.c index cf064881c2..6eadf80e3d 100644 --- a/source/libs/qcom/src/queryUtil.c +++ b/source/libs/qcom/src/queryUtil.c @@ -146,6 +146,12 @@ void destroySendMsgInfo(SMsgSendInfo* pMsgBody) { } taosMemoryFreeClear(pMsgBody); } +void destroyAhandle(void *ahandle) { + SMsgSendInfo *pSendInfo = ahandle; + if (pSendInfo == NULL) return; + + destroySendMsgInfo(pSendInfo); +} int32_t asyncSendMsgToServerExt(void* pTransporter, SEpSet* epSet, int64_t* pTransporterId, SMsgSendInfo* pInfo, bool persistHandle, void* rpcCtx) { diff --git a/source/libs/qcom/src/querymsg.c b/source/libs/qcom/src/querymsg.c index 181abc2247..fadc39f21d 100644 --- a/source/libs/qcom/src/querymsg.c +++ b/source/libs/qcom/src/querymsg.c @@ -41,8 +41,9 @@ int32_t queryBuildUseDbOutput(SUseDbOutput *pOut, SUseDbRsp *usedbRsp) { pOut->dbVgroup->hashMethod = usedbRsp->hashMethod; pOut->dbVgroup->hashPrefix = usedbRsp->hashPrefix; pOut->dbVgroup->hashSuffix = usedbRsp->hashSuffix; + pOut->dbVgroup->stateTs = usedbRsp->stateTs; - qDebug("Got %d vgroup for db %s", usedbRsp->vgNum, usedbRsp->db); + qDebug("Got %d vgroup for db %s, vgVersion:%d, stateTs:%" PRId64, usedbRsp->vgNum, usedbRsp->db, usedbRsp->vgVersion, usedbRsp->stateTs); if (usedbRsp->vgNum <= 0) { return TSDB_CODE_SUCCESS; @@ -103,6 +104,7 @@ int32_t queryBuildUseDbMsg(void *input, char **msg, int32_t msgSize, int32_t *ms usedbReq.vgVersion = pInput->vgVersion; usedbReq.dbId = pInput->dbId; usedbReq.numOfTable = pInput->numOfTable; + usedbReq.stateTs = pInput->stateTs; int32_t bufLen = tSerializeSUseDbReq(NULL, 0, &usedbReq); void *pBuf = (*mallcFp)(bufLen); diff --git a/source/libs/scalar/src/sclfunc.c b/source/libs/scalar/src/sclfunc.c index c89072233f..22fa99d75d 100644 --- a/source/libs/scalar/src/sclfunc.c +++ b/source/libs/scalar/src/sclfunc.c @@ -1028,11 +1028,11 @@ int32_t toISO8601Function(SScalarParam *pInput, int32_t inputNum, SScalarParam * int32_t type = GET_PARAM_TYPE(pInput); bool tzPresent = (inputNum == 2) ? true : false; - char *tz; - int32_t tzLen; + char tz[20] = {0}; + int32_t tzLen = 0; if (tzPresent) { - tz = varDataVal(pInput[1].columnData->pData); tzLen = varDataLen(pInput[1].columnData->pData); + memcpy(tz, varDataVal(pInput[1].columnData->pData), tzLen); } for (int32_t i = 0; i < pInput[0].numOfRows; ++i) { @@ -1071,8 +1071,10 @@ int32_t toISO8601Function(SScalarParam *pInput, int32_t inputNum, SScalarParam * int32_t len = (int32_t)strlen(buf); // add timezone string - snprintf(buf + len, tzLen + 1, "%s", tz); - len += tzLen; + if (tzLen > 0) { + snprintf(buf + len, tzLen + 1, "%s", tz); + len += tzLen; + } if (hasFraction) { int32_t fracLen = (int32_t)strlen(fraction) + 1; diff --git a/source/libs/scheduler/src/schRemote.c b/source/libs/scheduler/src/schRemote.c index 801f38bd1a..22fb66d92f 100644 --- a/source/libs/scheduler/src/schRemote.c +++ b/source/libs/scheduler/src/schRemote.c @@ -425,6 +425,7 @@ int32_t schHandleCallback(void *param, SDataBuf *pMsg, int32_t rspCode) { _return: taosMemoryFreeClear(pMsg->pData); + taosMemoryFreeClear(pMsg->pEpSet); qDebug("end to handle rsp msg, type:%s, handle:%p, code:%s", TMSG_INFO(pMsg->msgType), pMsg->handle, tstrerror(rspCode)); @@ -438,6 +439,7 @@ int32_t schHandleDropCallback(void *param, SDataBuf *pMsg, int32_t code) { code); if (pMsg) { taosMemoryFree(pMsg->pData); + taosMemoryFree(pMsg->pEpSet); } return TSDB_CODE_SUCCESS; } @@ -492,6 +494,7 @@ _return: tFreeSSchedulerHbRsp(&rsp); taosMemoryFree(pMsg->pData); + taosMemoryFree(pMsg->pEpSet); SCH_RET(code); } diff --git a/source/libs/scheduler/src/schTask.c b/source/libs/scheduler/src/schTask.c index dbdccff302..7e5b3faedb 100644 --- a/source/libs/scheduler/src/schTask.c +++ b/source/libs/scheduler/src/schTask.c @@ -439,6 +439,8 @@ int32_t schHandleRedirect(SSchJob *pJob, SSchTask *pTask, SDataBuf *pData, int32 code = schDoTaskRedirect(pJob, pTask, pData, rspCode); taosMemoryFree(pData->pData); taosMemoryFree(pData->pEpSet); + pData->pData = NULL; + pData->pEpSet = NULL; SCH_RET(code); @@ -446,6 +448,8 @@ _return: taosMemoryFree(pData->pData); taosMemoryFree(pData->pEpSet); + pData->pData = NULL; + pData->pEpSet = NULL; SCH_RET(schProcessOnTaskFailure(pJob, pTask, code)); } @@ -942,7 +946,7 @@ int32_t schLaunchLocalTask(SSchJob *pJob, SSchTask *pTask) { } SCH_ERR_JRET(qWorkerProcessLocalQuery(schMgmt.queryMgmt, schMgmt.sId, pJob->queryId, pTask->taskId, pJob->refId, - pTask->execId, &qwMsg, explainRes)); + pTask->execId, &qwMsg, explainRes)); if (SCH_IS_EXPLAIN_JOB(pJob)) { SCH_ERR_RET(schHandleExplainRes(explainRes)); @@ -1115,7 +1119,7 @@ int32_t schExecLocalFetch(SSchJob *pJob, SSchTask *pTask) { } SCH_ERR_JRET(qWorkerProcessLocalFetch(schMgmt.queryMgmt, schMgmt.sId, pJob->queryId, pTask->taskId, pJob->refId, - pTask->execId, &pRsp, explainRes)); + pTask->execId, &pRsp, explainRes)); if (SCH_IS_EXPLAIN_JOB(pJob)) { SCH_ERR_RET(schHandleExplainRes(explainRes)); diff --git a/source/libs/stream/src/streamDispatch.c b/source/libs/stream/src/streamDispatch.c index ad342edfa0..573a1ea31f 100644 --- a/source/libs/stream/src/streamDispatch.c +++ b/source/libs/stream/src/streamDispatch.c @@ -118,8 +118,7 @@ int32_t streamBroadcastToChildren(SStreamTask* pTask, const SSDataBlock* pBlock) pRetrieve->ekey = htobe64(pBlock->info.window.ekey); pRetrieve->version = htobe64(pBlock->info.version); - int32_t actualLen = 0; - blockEncode(pBlock, pRetrieve->data, &actualLen, numOfCols, false); + int32_t actualLen = blockEncode(pBlock, pRetrieve->data, numOfCols); SStreamRetrieveReq req = { .streamId = pTask->streamId, @@ -200,8 +199,7 @@ static int32_t streamAddBlockToDispatchMsg(const SSDataBlock* pBlock, SStreamDis int32_t numOfCols = (int32_t)taosArrayGetSize(pBlock->pDataBlock); pRetrieve->numOfCols = htonl(numOfCols); - int32_t actualLen = 0; - blockEncode(pBlock, pRetrieve->data, &actualLen, numOfCols, false); + int32_t actualLen = blockEncode(pBlock, pRetrieve->data, numOfCols); actualLen += sizeof(SRetrieveTableRsp); ASSERT(actualLen <= dataStrLen); taosArrayPush(pReq->dataLen, &actualLen); diff --git a/source/libs/stream/src/streamMeta.c b/source/libs/stream/src/streamMeta.c index 682bfbaf8d..da082b7f74 100644 --- a/source/libs/stream/src/streamMeta.c +++ b/source/libs/stream/src/streamMeta.c @@ -187,11 +187,9 @@ int32_t streamMetaRemoveTask(SStreamMeta* pMeta, int32_t taskId) { while (1) { int8_t schedStatus = atomic_val_compare_exchange_8(&pTask->schedStatus, TASK_SCHED_STATUS__INACTIVE, TASK_SCHED_STATUS__DROPPING); - if (schedStatus == TASK_SCHED_STATUS__INACTIVE) { + if (schedStatus != TASK_SCHED_STATUS__ACTIVE) { tFreeSStreamTask(pTask); break; - } else if (schedStatus == TASK_SCHED_STATUS__DROPPING) { - break; } taosMsleep(10); } diff --git a/source/libs/sync/inc/syncAppendEntries.h b/source/libs/sync/inc/syncAppendEntries.h index dc40e2fc72..0a67939d35 100644 --- a/source/libs/sync/inc/syncAppendEntries.h +++ b/source/libs/sync/inc/syncAppendEntries.h @@ -20,12 +20,8 @@ extern "C" { #endif -#include -#include -#include #include "syncInt.h" #include "syncMessage.h" -#include "taosdef.h" // TLA+ Spec // HandleAppendEntriesRequest(i, j, m) == diff --git a/source/libs/sync/inc/syncAppendEntriesReply.h b/source/libs/sync/inc/syncAppendEntriesReply.h index 0227d832fc..d2dff92d43 100644 --- a/source/libs/sync/inc/syncAppendEntriesReply.h +++ b/source/libs/sync/inc/syncAppendEntriesReply.h @@ -20,12 +20,8 @@ extern "C" { #endif -#include -#include -#include #include "syncInt.h" #include "syncMessage.h" -#include "taosdef.h" // TLA+ Spec // HandleAppendEntriesResponse(i, j, m) == diff --git a/source/libs/sync/inc/syncCommit.h b/source/libs/sync/inc/syncCommit.h index 7458ce28ab..d3ba556f82 100644 --- a/source/libs/sync/inc/syncCommit.h +++ b/source/libs/sync/inc/syncCommit.h @@ -20,11 +20,7 @@ extern "C" { #endif -#include -#include -#include #include "syncInt.h" -#include "taosdef.h" // \* Leader i advances its commitIndex. // \* This is done as a separate step from handling AppendEntries responses, diff --git a/source/libs/sync/inc/syncElection.h b/source/libs/sync/inc/syncElection.h index 9ccd9dd28f..662c17094e 100644 --- a/source/libs/sync/inc/syncElection.h +++ b/source/libs/sync/inc/syncElection.h @@ -20,11 +20,7 @@ extern "C" { #endif -#include -#include -#include #include "syncInt.h" -#include "taosdef.h" // TLA+ Spec // RequestVote(i, j) == diff --git a/source/libs/sync/inc/syncIndexMgr.h b/source/libs/sync/inc/syncIndexMgr.h index e8f17537b4..bd88f5cdce 100644 --- a/source/libs/sync/inc/syncIndexMgr.h +++ b/source/libs/sync/inc/syncIndexMgr.h @@ -20,11 +20,7 @@ extern "C" { #endif -#include -#include -#include #include "syncInt.h" -#include "taosdef.h" // SIndexMgr ----------------------------- typedef struct SSyncIndexMgr { diff --git a/source/libs/sync/inc/syncInt.h b/source/libs/sync/inc/syncInt.h index 3085b6d8f4..8a951ba38d 100644 --- a/source/libs/sync/inc/syncInt.h +++ b/source/libs/sync/inc/syncInt.h @@ -268,8 +268,6 @@ int32_t syncNodeRestartHeartbeatTimer(SSyncNode* pSyncNode); // utils -------------- int32_t syncNodeSendMsgById(const SRaftId* destRaftId, SSyncNode* pSyncNode, SRpcMsg* pMsg); int32_t syncNodeSendMsgByInfo(const SNodeInfo* nodeInfo, SSyncNode* pSyncNode, SRpcMsg* pMsg); -cJSON* syncNode2Json(const SSyncNode* pSyncNode); -char* syncNode2Str(const SSyncNode* pSyncNode); char* syncNode2SimpleStr(const SSyncNode* pSyncNode); bool syncNodeInConfig(SSyncNode* pSyncNode, const SSyncCfg* config); void syncNodeDoConfigChange(SSyncNode* pSyncNode, SSyncCfg* newConfig, SyncIndex lastConfigChangeIndex); diff --git a/source/libs/sync/inc/syncMessage.h b/source/libs/sync/inc/syncMessage.h index 19079d518d..936081c7b2 100644 --- a/source/libs/sync/inc/syncMessage.h +++ b/source/libs/sync/inc/syncMessage.h @@ -20,12 +20,7 @@ extern "C" { #endif -#include -#include -#include -#include "cJSON.h" #include "syncInt.h" -#include "taosdef.h" // --------------------------------------------- cJSON* syncRpcMsg2Json(SRpcMsg* pRpcMsg); diff --git a/source/libs/sync/inc/syncRaftCfg.h b/source/libs/sync/inc/syncRaftCfg.h index 15ca82664a..6b6ca21399 100644 --- a/source/libs/sync/inc/syncRaftCfg.h +++ b/source/libs/sync/inc/syncRaftCfg.h @@ -20,12 +20,7 @@ extern "C" { #endif -#include -#include -#include -#include "cJSON.h" #include "syncInt.h" -#include "taosdef.h" #define CONFIG_FILE_LEN 2048 diff --git a/source/libs/sync/inc/syncRaftEntry.h b/source/libs/sync/inc/syncRaftEntry.h index bab1dcc661..2a73b95e4d 100644 --- a/source/libs/sync/inc/syncRaftEntry.h +++ b/source/libs/sync/inc/syncRaftEntry.h @@ -20,13 +20,8 @@ extern "C" { #endif -#include -#include -#include #include "syncInt.h" #include "syncMessage.h" -#include "taosdef.h" -#include "tref.h" #include "tskiplist.h" typedef struct SSyncRaftEntry { @@ -42,25 +37,14 @@ typedef struct SSyncRaftEntry { char data[]; // origin RpcMsg.pCont } SSyncRaftEntry; -SSyncRaftEntry* syncEntryBuild(uint32_t dataLen); -SSyncRaftEntry* syncEntryBuild2(SyncClientRequest* pMsg, SyncTerm term, SyncIndex index); // step 4 -SSyncRaftEntry* syncEntryBuild3(SyncClientRequest* pMsg, SyncTerm term, SyncIndex index); -SSyncRaftEntry* syncEntryBuild4(SRpcMsg* pOriginalMsg, SyncTerm term, SyncIndex index); +SSyncRaftEntry* syncEntryBuild(int32_t dataLen); +SSyncRaftEntry* syncEntryBuildFromClientRequest(const SyncClientRequest* pMsg, SyncTerm term, SyncIndex index); +SSyncRaftEntry* syncEntryBuildFromRpcMsg(const SRpcMsg* pMsg, SyncTerm term, SyncIndex index); +SSyncRaftEntry* syncEntryBuildFromAppendEntries(const SyncAppendEntries* pMsg); SSyncRaftEntry* syncEntryBuildNoop(SyncTerm term, SyncIndex index, int32_t vgId); void syncEntryDestory(SSyncRaftEntry* pEntry); -char* syncEntrySerialize(const SSyncRaftEntry* pEntry, uint32_t* len); // step 5 -SSyncRaftEntry* syncEntryDeserialize(const char* buf, uint32_t len); // step 6 -cJSON* syncEntry2Json(const SSyncRaftEntry* pEntry); -char* syncEntry2Str(const SSyncRaftEntry* pEntry); void syncEntry2OriginalRpc(const SSyncRaftEntry* pEntry, SRpcMsg* pRpcMsg); // step 7 -// for debug ---------------------- -void syncEntryPrint(const SSyncRaftEntry* pObj); -void syncEntryPrint2(char* s, const SSyncRaftEntry* pObj); -void syncEntryLog(const SSyncRaftEntry* pObj); -void syncEntryLog2(char* s, const SSyncRaftEntry* pObj); - -//----------------------------------- typedef struct SRaftEntryHashCache { SHashObj* pEntryHash; int32_t maxCount; @@ -78,14 +62,6 @@ int32_t raftCacheDelEntry(struct SRaftEntryHashCache* pCache, SyncI int32_t raftCacheGetAndDel(struct SRaftEntryHashCache* pCache, SyncIndex index, SSyncRaftEntry** ppEntry); int32_t raftCacheClear(struct SRaftEntryHashCache* pCache); -cJSON* raftCache2Json(SRaftEntryHashCache* pObj); -char* raftCache2Str(SRaftEntryHashCache* pObj); -void raftCachePrint(SRaftEntryHashCache* pObj); -void raftCachePrint2(char* s, SRaftEntryHashCache* pObj); -void raftCacheLog(SRaftEntryHashCache* pObj); -void raftCacheLog2(char* s, SRaftEntryHashCache* pObj); - -//----------------------------------- typedef struct SRaftEntryCache { SSkipList* pSkipList; int32_t maxCount; @@ -102,13 +78,6 @@ int32_t raftEntryCacheGetEntry(struct SRaftEntryCache* pCache, SyncInde int32_t raftEntryCacheGetEntryP(struct SRaftEntryCache* pCache, SyncIndex index, SSyncRaftEntry** ppEntry); int32_t raftEntryCacheClear(struct SRaftEntryCache* pCache, int32_t count); -cJSON* raftEntryCache2Json(SRaftEntryCache* pObj); -char* raftEntryCache2Str(SRaftEntryCache* pObj); -void raftEntryCachePrint(SRaftEntryCache* pObj); -void raftEntryCachePrint2(char* s, SRaftEntryCache* pObj); -void raftEntryCacheLog(SRaftEntryCache* pObj); -void raftEntryCacheLog2(char* s, SRaftEntryCache* pObj); - #ifdef __cplusplus } #endif diff --git a/source/libs/sync/inc/syncRaftLog.h b/source/libs/sync/inc/syncRaftLog.h index ff59189a9d..17ea36c640 100644 --- a/source/libs/sync/inc/syncRaftLog.h +++ b/source/libs/sync/inc/syncRaftLog.h @@ -20,12 +20,8 @@ extern "C" { #endif -#include -#include -#include #include "syncInt.h" #include "syncRaftEntry.h" -#include "taosdef.h" #include "wal.h" typedef struct SSyncLogStoreData { @@ -40,25 +36,19 @@ typedef struct SSyncLogStoreData { SSyncLogStore* logStoreCreate(SSyncNode* pSyncNode); void logStoreDestory(SSyncLogStore* pLogStore); -cJSON* logStore2Json(SSyncLogStore* pLogStore); -char* logStore2Str(SSyncLogStore* pLogStore); -cJSON* logStoreSimple2Json(SSyncLogStore* pLogStore); -char* logStoreSimple2Str(SSyncLogStore* pLogStore); SyncIndex logStoreFirstIndex(SSyncLogStore* pLogStore); SyncIndex logStoreWalCommitVer(SSyncLogStore* pLogStore); -// for debug -void logStorePrint(SSyncLogStore* pLogStore); -void logStorePrint2(char* s, SSyncLogStore* pLogStore); -void logStoreLog(SSyncLogStore* pLogStore); -void logStoreLog2(char* s, SSyncLogStore* pLogStore); - -void logStoreSimplePrint(SSyncLogStore* pLogStore); -void logStoreSimplePrint2(char* s, SSyncLogStore* pLogStore); -void logStoreSimpleLog(SSyncLogStore* pLogStore); -void logStoreSimpleLog2(char* s, SSyncLogStore* pLogStore); +SyncIndex raftLogWriteIndex(struct SSyncLogStore* pLogStore); +bool raftLogIsEmpty(struct SSyncLogStore* pLogStore); +SyncIndex raftLogBeginIndex(struct SSyncLogStore* pLogStore); +SyncIndex raftLogEndIndex(struct SSyncLogStore* pLogStore); +int32_t raftLogEntryCount(struct SSyncLogStore* pLogStore); +SyncIndex raftLogLastIndex(struct SSyncLogStore* pLogStore); +SyncTerm raftLogLastTerm(struct SSyncLogStore* pLogStore); +int32_t raftLogGetEntry(struct SSyncLogStore* pLogStore, SyncIndex index, SSyncRaftEntry** ppEntry); #ifdef __cplusplus } diff --git a/source/libs/sync/inc/syncRaftStore.h b/source/libs/sync/inc/syncRaftStore.h index ac298c5375..077e6a7658 100644 --- a/source/libs/sync/inc/syncRaftStore.h +++ b/source/libs/sync/inc/syncRaftStore.h @@ -20,12 +20,7 @@ extern "C" { #endif -#include -#include -#include -#include "cJSON.h" #include "syncInt.h" -#include "taosdef.h" #define RAFT_STORE_BLOCK_SIZE 512 #define RAFT_STORE_PATH_LEN (TSDB_FILENAME_LEN * 2) diff --git a/source/libs/sync/inc/syncReplication.h b/source/libs/sync/inc/syncReplication.h index 4f15a45cec..08a92d1368 100644 --- a/source/libs/sync/inc/syncReplication.h +++ b/source/libs/sync/inc/syncReplication.h @@ -20,11 +20,7 @@ extern "C" { #endif -#include -#include -#include #include "syncInt.h" -#include "taosdef.h" // TLA+ Spec // AppendEntries(i, j) == @@ -55,7 +51,7 @@ int32_t syncNodeHeartbeatPeers(SSyncNode* pSyncNode); int32_t syncNodeSendHeartbeat(SSyncNode* pSyncNode, const SRaftId* pDestId, const SyncHeartbeat* pMsg); int32_t syncNodeReplicate(SSyncNode* pSyncNode); -int32_t syncNodeReplicateOne(SSyncNode* pSyncNode, SRaftId* pDestId); +int32_t syncNodeReplicateOne(SSyncNode* pSyncNode, SRaftId* pDestId, bool snapshot); int32_t syncNodeSendAppendEntries(SSyncNode* pSyncNode, const SRaftId* pDestId, const SyncAppendEntries* pMsg); int32_t syncNodeMaybeSendAppendEntries(SSyncNode* pSyncNode, const SRaftId* pDestId, const SyncAppendEntries* pMsg); diff --git a/source/libs/sync/inc/syncRequestVote.h b/source/libs/sync/inc/syncRequestVote.h index 73b4a0efae..c51ea4eea6 100644 --- a/source/libs/sync/inc/syncRequestVote.h +++ b/source/libs/sync/inc/syncRequestVote.h @@ -20,12 +20,8 @@ extern "C" { #endif -#include -#include -#include #include "syncInt.h" #include "syncMessage.h" -#include "taosdef.h" // TLA+ Spec // HandleRequestVoteRequest(i, j, m) == diff --git a/source/libs/sync/inc/syncRequestVoteReply.h b/source/libs/sync/inc/syncRequestVoteReply.h index 6bef18405c..1adab30aaa 100644 --- a/source/libs/sync/inc/syncRequestVoteReply.h +++ b/source/libs/sync/inc/syncRequestVoteReply.h @@ -20,12 +20,8 @@ extern "C" { #endif -#include -#include -#include #include "syncInt.h" #include "syncMessage.h" -#include "taosdef.h" // TLA+ Spec // HandleRequestVoteResponse(i, j, m) == diff --git a/source/libs/sync/inc/syncRespMgr.h b/source/libs/sync/inc/syncRespMgr.h index 9026ecb66e..1d41c0a85f 100644 --- a/source/libs/sync/inc/syncRespMgr.h +++ b/source/libs/sync/inc/syncRespMgr.h @@ -20,11 +20,7 @@ extern "C" { #endif -#include -#include -#include #include "syncInt.h" -#include "taosdef.h" typedef struct SRespStub { SRpcMsg rpcMsg; diff --git a/source/libs/sync/inc/syncSnapshot.h b/source/libs/sync/inc/syncSnapshot.h index 5594fe46ed..645548c919 100644 --- a/source/libs/sync/inc/syncSnapshot.h +++ b/source/libs/sync/inc/syncSnapshot.h @@ -20,13 +20,7 @@ extern "C" { #endif -#include -#include -#include -#include "cJSON.h" #include "syncInt.h" -#include "syncMessage.h" -#include "taosdef.h" #define SYNC_SNAPSHOT_SEQ_INVALID -2 #define SYNC_SNAPSHOT_SEQ_FORCE_CLOSE -3 @@ -36,7 +30,6 @@ extern "C" { #define SYNC_SNAPSHOT_RETRY_MS 5000 -//--------------------------------------------------- typedef struct SSyncSnapshotSender { bool start; int32_t seq; @@ -65,25 +58,21 @@ int32_t snapshotSenderStop(SSyncSnapshotSender *pSender, bool finis int32_t snapshotSend(SSyncSnapshotSender *pSender); int32_t snapshotReSend(SSyncSnapshotSender *pSender); -cJSON *snapshotSender2Json(SSyncSnapshotSender *pSender); -char *snapshotSender2Str(SSyncSnapshotSender *pSender); - -int32_t syncNodeStartSnapshot(SSyncNode *pSyncNode, SRaftId *pDestId); - -//--------------------------------------------------- typedef struct SSyncSnapshotReceiver { - bool start; - int32_t ack; + // update when pre snapshot + bool start; + int32_t ack; + SyncTerm term; + SRaftId fromId; + int64_t startTime; + + // update when begin void *pWriter; - SyncTerm term; SSnapshotParam snapshotParam; SSnapshot snapshot; - SRaftId fromId; - int64_t startTime; // init when create SSyncNode *pSyncNode; - } SSyncSnapshotReceiver; SSyncSnapshotReceiver *snapshotReceiverCreate(SSyncNode *pSyncNode, SRaftId fromId); @@ -93,14 +82,13 @@ int32_t snapshotReceiverStop(SSyncSnapshotReceiver *pReceiver); bool snapshotReceiverIsStart(SSyncSnapshotReceiver *pReceiver); void snapshotReceiverForceStop(SSyncSnapshotReceiver *pReceiver); -cJSON *snapshotReceiver2Json(SSyncSnapshotReceiver *pReceiver); -char *snapshotReceiver2Str(SSyncSnapshotReceiver *pReceiver); - -//--------------------------------------------------- // on message int32_t syncNodeOnSnapshot(SSyncNode *ths, SyncSnapshotSend *pMsg); int32_t syncNodeOnSnapshotReply(SSyncNode *ths, SyncSnapshotRsp *pMsg); +// start +int32_t syncNodeStartSnapshot(SSyncNode *pSyncNode, SRaftId *pDestId); + #ifdef __cplusplus } #endif diff --git a/source/libs/sync/inc/syncTimeout.h b/source/libs/sync/inc/syncTimeout.h index 112a3d8610..3139707d54 100644 --- a/source/libs/sync/inc/syncTimeout.h +++ b/source/libs/sync/inc/syncTimeout.h @@ -20,12 +20,7 @@ extern "C" { #endif -#include -#include -#include #include "syncInt.h" -#include "syncMessage.h" -#include "taosdef.h" // TLA+ Spec // Timeout(i) == /\ state[i] \in {Follower, Candidate} diff --git a/source/libs/sync/inc/syncTools.h b/source/libs/sync/inc/syncTools.h index 193579030f..3fb4a5ba0c 100644 --- a/source/libs/sync/inc/syncTools.h +++ b/source/libs/sync/inc/syncTools.h @@ -180,17 +180,13 @@ typedef struct SyncClientRequest { } SyncClientRequest; SyncClientRequest* syncClientRequestAlloc(uint32_t dataLen); -SyncClientRequest* syncClientRequestBuild(const SRpcMsg* pMsg, uint64_t seqNum, bool isWeak, int32_t vgId); // step 1 -void syncClientRequestDestroy(SyncClientRequest* pMsg); -void syncClientRequestSerialize(const SyncClientRequest* pMsg, char* buf, uint32_t bufLen); -void syncClientRequestDeserialize(const char* buf, uint32_t len, SyncClientRequest* pMsg); -char* syncClientRequestSerialize2(const SyncClientRequest* pMsg, uint32_t* len); -SyncClientRequest* syncClientRequestDeserialize2(const char* buf, uint32_t len); -void syncClientRequest2RpcMsg(const SyncClientRequest* pMsg, SRpcMsg* pRpcMsg); // step 2 -void syncClientRequestFromRpcMsg(const SRpcMsg* pRpcMsg, SyncClientRequest* pMsg); -SyncClientRequest* syncClientRequestFromRpcMsg2(const SRpcMsg* pRpcMsg); // step 3 -cJSON* syncClientRequest2Json(const SyncClientRequest* pMsg); -char* syncClientRequest2Str(const SyncClientRequest* pMsg); +int32_t syncClientRequestBuildFromRpcMsg(SRpcMsg* pClientRequestRpcMsg, const SRpcMsg* pOriginalRpcMsg, uint64_t seqNum, + bool isWeak, int32_t vgId); +int32_t syncClientRequestBuildFromNoopEntry(SRpcMsg* pClientRequestRpcMsg, const SSyncRaftEntry* pEntry, int32_t vgId); +void syncClientRequest2RpcMsg(const SyncClientRequest* pMsg, SRpcMsg* pRpcMsg); // step 2 +void syncClientRequestFromRpcMsg(const SRpcMsg* pRpcMsg, SyncClientRequest* pMsg); +cJSON* syncClientRequest2Json(const SyncClientRequest* pMsg); +char* syncClientRequest2Str(const SyncClientRequest* pMsg); // for debug ---------------------- void syncClientRequestPrint(const SyncClientRequest* pMsg); @@ -381,14 +377,6 @@ SyncAppendEntriesBatch* syncAppendEntriesBatchDeserialize2(const char* buf, uint void syncAppendEntriesBatch2RpcMsg(const SyncAppendEntriesBatch* pMsg, SRpcMsg* pRpcMsg); void syncAppendEntriesBatchFromRpcMsg(const SRpcMsg* pRpcMsg, SyncAppendEntriesBatch* pMsg); SyncAppendEntriesBatch* syncAppendEntriesBatchFromRpcMsg2(const SRpcMsg* pRpcMsg); -cJSON* syncAppendEntriesBatch2Json(const SyncAppendEntriesBatch* pMsg); -char* syncAppendEntriesBatch2Str(const SyncAppendEntriesBatch* pMsg); - -// for debug ---------------------- -void syncAppendEntriesBatchPrint(const SyncAppendEntriesBatch* pMsg); -void syncAppendEntriesBatchPrint2(char* s, const SyncAppendEntriesBatch* pMsg); -void syncAppendEntriesBatchLog(const SyncAppendEntriesBatch* pMsg); -void syncAppendEntriesBatchLog2(char* s, const SyncAppendEntriesBatch* pMsg); // --------------------------------------------- typedef struct SyncAppendEntriesReply { @@ -739,14 +727,13 @@ int32_t syncNodeOnSnapshotReply(SSyncNode* ths, SyncSnapshotRsp* pMsg); int32_t syncNodeOnHeartbeat(SSyncNode* ths, SyncHeartbeat* pMsg); int32_t syncNodeOnHeartbeatReply(SSyncNode* ths, SyncHeartbeatReply* pMsg); -int32_t syncNodeOnClientRequest(SSyncNode* ths, SyncClientRequest* pMsg, SyncIndex* pRetIndex); -int32_t syncNodeOnTimer(SSyncNode* ths, SyncTimeout* pMsg); +int32_t syncNodeOnClientRequest(SSyncNode* ths, SRpcMsg* pMsg, SyncIndex* pRetIndex); int32_t syncNodeOnLocalCmd(SSyncNode* ths, SyncLocalCmd* pMsg); // ----------------------------------------- typedef int32_t (*FpOnPingCb)(SSyncNode* ths, SyncPing* pMsg); typedef int32_t (*FpOnPingReplyCb)(SSyncNode* ths, SyncPingReply* pMsg); -typedef int32_t (*FpOnClientRequestCb)(SSyncNode* ths, SyncClientRequest* pMsg, SyncIndex* pRetIndex); +typedef int32_t (*FpOnClientRequestCb)(SSyncNode* ths, SRpcMsg* pMsg, SyncIndex* pRetIndex); typedef int32_t (*FpOnRequestVoteCb)(SSyncNode* ths, SyncRequestVote* pMsg); typedef int32_t (*FpOnRequestVoteReplyCb)(SSyncNode* ths, SyncRequestVoteReply* pMsg); typedef int32_t (*FpOnAppendEntriesCb)(SSyncNode* ths, SyncAppendEntries* pMsg); diff --git a/source/libs/sync/inc/syncUtil.h b/source/libs/sync/inc/syncUtil.h index 7f241e827d..076101ef43 100644 --- a/source/libs/sync/inc/syncUtil.h +++ b/source/libs/sync/inc/syncUtil.h @@ -24,17 +24,15 @@ extern "C" { uint64_t syncUtilAddr2U64(const char* host, uint16_t port); void syncUtilU642Addr(uint64_t u64, char* host, int64_t len, uint16_t* port); -void syncUtilnodeInfo2EpSet(const SNodeInfo* pInfo, SEpSet* pEpSet); -void syncUtilraftId2EpSet(const SRaftId* raftId, SEpSet* pEpSet); -bool syncUtilnodeInfo2raftId(const SNodeInfo* pInfo, SyncGroupId vgId, SRaftId* raftId); +void syncUtilNodeInfo2EpSet(const SNodeInfo* pInfo, SEpSet* pEpSet); +void syncUtilRaftId2EpSet(const SRaftId* raftId, SEpSet* pEpSet); +bool syncUtilNodeInfo2RaftId(const SNodeInfo* pInfo, SyncGroupId vgId, SRaftId* raftId); bool syncUtilSameId(const SRaftId* pId1, const SRaftId* pId2); bool syncUtilEmptyId(const SRaftId* pId); int32_t syncUtilElectRandomMS(int32_t min, int32_t max); int32_t syncUtilQuorum(int32_t replicaNum); -cJSON* syncUtilNodeInfo2Json(const SNodeInfo* p); cJSON* syncUtilRaftId2Json(const SRaftId* p); -char* syncUtilRaftId2Str(const SRaftId* p); const char* syncStr(ESyncState state); char* syncUtilPrintBin(char* ptr, uint32_t len); char* syncUtilPrintBin2(char* ptr, uint32_t len); diff --git a/source/libs/sync/inc/syncVoteMgr.h b/source/libs/sync/inc/syncVoteMgr.h index d894e91600..066a4dd76f 100644 --- a/source/libs/sync/inc/syncVoteMgr.h +++ b/source/libs/sync/inc/syncVoteMgr.h @@ -39,8 +39,6 @@ void voteGrantedUpdate(SVotesGranted *pVotesGranted, SSyncNode *pSyncN bool voteGrantedMajority(SVotesGranted *pVotesGranted); void voteGrantedVote(SVotesGranted *pVotesGranted, SyncRequestVoteReply *pMsg); void voteGrantedReset(SVotesGranted *pVotesGranted, SyncTerm term); -cJSON *voteGranted2Json(SVotesGranted *pVotesGranted); -char *voteGranted2Str(SVotesGranted *pVotesGranted); typedef struct SVotesRespond { SRaftId (*replicas)[TSDB_MAX_REPLICA]; @@ -56,8 +54,6 @@ void votesRespondUpdate(SVotesRespond *pVotesRespond, SSyncNode *pSync bool votesResponded(SVotesRespond *pVotesRespond, const SRaftId *pRaftId); void votesRespondAdd(SVotesRespond *pVotesRespond, const SyncRequestVoteReply *pMsg); void votesRespondReset(SVotesRespond *pVotesRespond, SyncTerm term); -cJSON *votesRespond2Json(SVotesRespond *pVotesRespond); -char *votesRespond2Str(SVotesRespond *pVotesRespond); #ifdef __cplusplus } diff --git a/source/libs/sync/src/syncAppendEntries.c b/source/libs/sync/src/syncAppendEntries.c index a72746b5a4..792ce67cd4 100644 --- a/source/libs/sync/src/syncAppendEntries.c +++ b/source/libs/sync/src/syncAppendEntries.c @@ -179,7 +179,7 @@ int32_t syncNodeOnAppendEntries(SSyncNode* ths, SyncAppendEntries* pMsg) { pReply->success = true; bool hasAppendEntries = pMsg->dataLen > 0; if (hasAppendEntries) { - SSyncRaftEntry* pAppendEntry = syncEntryDeserialize(pMsg->data, pMsg->dataLen); + SSyncRaftEntry* pAppendEntry = syncEntryBuildFromAppendEntries(pMsg); ASSERT(pAppendEntry != NULL); SyncIndex appendIndex = pMsg->prevLogIndex + 1; diff --git a/source/libs/sync/src/syncAppendEntriesReply.c b/source/libs/sync/src/syncAppendEntriesReply.c index cf7c391a1d..ea4dee64f1 100644 --- a/source/libs/sync/src/syncAppendEntriesReply.c +++ b/source/libs/sync/src/syncAppendEntriesReply.c @@ -121,7 +121,7 @@ int32_t syncNodeOnAppendEntriesReply(SSyncNode* ths, SyncAppendEntriesReply* pMs ASSERT(pState != NULL); if (pMsg->lastSendIndex == pState->lastSendIndex) { - syncNodeReplicateOne(ths, &(pMsg->srcId)); + syncNodeReplicateOne(ths, &(pMsg->srcId), true); } } diff --git a/source/libs/sync/src/syncMain.c b/source/libs/sync/src/syncMain.c index 85668068a5..b650cd81ab 100644 --- a/source/libs/sync/src/syncMain.c +++ b/source/libs/sync/src/syncMain.c @@ -154,9 +154,7 @@ int32_t syncProcessMsg(int64_t rid, SRpcMsg* pMsg) { code = syncNodeOnPingReply(pSyncNode, pSyncMsg); syncPingReplyDestroy(pSyncMsg); } else if (pMsg->msgType == TDMT_SYNC_CLIENT_REQUEST) { - SyncClientRequest* pSyncMsg = syncClientRequestFromRpcMsg2(pMsg); - code = syncNodeOnClientRequest(pSyncNode, pSyncMsg, NULL); - syncClientRequestDestroy(pSyncMsg); + code = syncNodeOnClientRequest(pSyncNode, pMsg, NULL); } else if (pMsg->msgType == TDMT_SYNC_REQUEST_VOTE) { SyncRequestVote* pSyncMsg = syncRequestVoteFromRpcMsg2(pMsg); code = syncNodeOnRequestVote(pSyncNode, pSyncMsg); @@ -601,44 +599,42 @@ int32_t syncNodePropose(SSyncNode* pSyncNode, SRpcMsg* pMsg, bool isWeak) { return -1; } - int32_t ret = 0; - SyncClientRequest* pSyncMsg; - // optimized one replica if (syncNodeIsOptimizedOneReplica(pSyncNode, pMsg)) { - pSyncMsg = syncClientRequestBuild(pMsg, 0, isWeak, pSyncNode->vgId); - SyncIndex retIndex; - int32_t code = syncNodeOnClientRequest(pSyncNode, pSyncMsg, &retIndex); + int32_t code = syncNodeOnClientRequest(pSyncNode, pMsg, &retIndex); if (code == 0) { pMsg->info.conn.applyIndex = retIndex; pMsg->info.conn.applyTerm = pSyncNode->pRaftStore->currentTerm; - ret = 1; - sTrace("vgId:%d, sync optimize index:%" PRId64 ", type:%s", pSyncNode->vgId, retIndex, TMSG_INFO(pMsg->msgType)); - } else { - ret = -1; - terrno = TSDB_CODE_SYN_INTERNAL_ERROR; - sError("vgId:%d, failed to sync optimize index:%" PRId64 ", type:%s", pSyncNode->vgId, retIndex, + sTrace("vgId:%d, propose optimized msg, index:%" PRId64 " type:%s", pSyncNode->vgId, retIndex, TMSG_INFO(pMsg->msgType)); + return 1; + } else { + terrno = TSDB_CODE_SYN_INTERNAL_ERROR; + sError("vgId:%d, failed to propose optimized msg, index:%" PRId64 " type:%s", pSyncNode->vgId, retIndex, + TMSG_INFO(pMsg->msgType)); + return -1; } } else { SRespStub stub = {.createTime = taosGetTimestampMs(), .rpcMsg = *pMsg}; uint64_t seqNum = syncRespMgrAdd(pSyncNode->pSyncRespMgr, &stub); - - pSyncMsg = syncClientRequestBuild(pMsg, seqNum, isWeak, pSyncNode->vgId); - SRpcMsg rpcMsg = {0}; - syncClientRequest2RpcMsg(pSyncMsg, &rpcMsg); - - sNTrace(pSyncNode, "propose message, type:%s", TMSG_INFO(pMsg->msgType)); - ret = (*pSyncNode->syncEqMsg)(pSyncNode->msgcb, &rpcMsg); - if (ret != 0) { - sError("vgId:%d, failed to enqueue msg since %s", pSyncNode->vgId, terrstr()); - syncRespMgrDel(pSyncNode->pSyncRespMgr, seqNum); + SRpcMsg rpcMsg = {0}; + int32_t code = syncClientRequestBuildFromRpcMsg(&rpcMsg, pMsg, seqNum, isWeak, pSyncNode->vgId); + if (code != 0) { + sError("vgId:%d, failed to propose msg while serialize since %s", pSyncNode->vgId, terrstr()); + (void)syncRespMgrDel(pSyncNode->pSyncRespMgr, seqNum); + return -1; } - } - syncClientRequestDestroy(pSyncMsg); - return ret; + sNTrace(pSyncNode, "propose msg, type:%s", TMSG_INFO(pMsg->msgType)); + code = (*pSyncNode->syncEqMsg)(pSyncNode->msgcb, &rpcMsg); + if (code != 0) { + sError("vgId:%d, failed to propose msg while enqueue since %s", pSyncNode->vgId, terrstr()); + (void)syncRespMgrDel(pSyncNode->pSyncRespMgr, seqNum); + } + + return code; + } } static int32_t syncHbTimerInit(SSyncNode* pSyncNode, SSyncTimer* pSyncTimer, SRaftId destId) { @@ -761,7 +757,7 @@ SSyncNode* syncNodeOpen(SSyncInfo* pSyncInfo) { // init internal pSyncNode->myNodeInfo = pSyncNode->pRaftCfg->cfg.nodeInfo[pSyncNode->pRaftCfg->cfg.myIndex]; - if (!syncUtilnodeInfo2raftId(&pSyncNode->myNodeInfo, pSyncNode->vgId, &pSyncNode->myRaftId)) { + if (!syncUtilNodeInfo2RaftId(&pSyncNode->myNodeInfo, pSyncNode->vgId, &pSyncNode->myRaftId)) { sError("vgId:%d, failed to determine my raft member id", pSyncNode->vgId); goto _error; } @@ -776,7 +772,7 @@ SSyncNode* syncNodeOpen(SSyncInfo* pSyncInfo) { } } for (int32_t i = 0; i < pSyncNode->peersNum; ++i) { - if (!syncUtilnodeInfo2raftId(&pSyncNode->peersNodeInfo[i], pSyncNode->vgId, &pSyncNode->peersId[i])) { + if (!syncUtilNodeInfo2RaftId(&pSyncNode->peersNodeInfo[i], pSyncNode->vgId, &pSyncNode->peersId[i])) { sError("vgId:%d, failed to determine raft member id, peer:%d", pSyncNode->vgId, i); goto _error; } @@ -785,7 +781,7 @@ SSyncNode* syncNodeOpen(SSyncInfo* pSyncInfo) { // init replicaNum, replicasId pSyncNode->replicaNum = pSyncNode->pRaftCfg->cfg.replicaNum; for (int32_t i = 0; i < pSyncNode->pRaftCfg->cfg.replicaNum; ++i) { - if (!syncUtilnodeInfo2raftId(&pSyncNode->pRaftCfg->cfg.nodeInfo[i], pSyncNode->vgId, &pSyncNode->replicasId[i])) { + if (!syncUtilNodeInfo2RaftId(&pSyncNode->pRaftCfg->cfg.nodeInfo[i], pSyncNode->vgId, &pSyncNode->replicasId[i])) { sError("vgId:%d, failed to determine raft member id, replica:%d", pSyncNode->vgId, i); goto _error; } @@ -1085,53 +1081,6 @@ void syncNodeClose(SSyncNode* pSyncNode) { ESyncStrategy syncNodeStrategy(SSyncNode* pSyncNode) { return pSyncNode->pRaftCfg->snapshotStrategy; } -// ping -------------- -int32_t syncNodePing(SSyncNode* pSyncNode, const SRaftId* destRaftId, SyncPing* pMsg) { - syncPingLog2((char*)"==syncNodePing==", pMsg); - int32_t ret = 0; - - SRpcMsg rpcMsg; - syncPing2RpcMsg(pMsg, &rpcMsg); - syncRpcMsgLog2((char*)"==syncNodePing==", &rpcMsg); - - ret = syncNodeSendMsgById(destRaftId, pSyncNode, &rpcMsg); - return ret; -} - -int32_t syncNodePingSelf(SSyncNode* pSyncNode) { - int32_t ret = 0; - SyncPing* pMsg = syncPingBuild3(&pSyncNode->myRaftId, &pSyncNode->myRaftId, pSyncNode->vgId); - ret = syncNodePing(pSyncNode, &pMsg->destId, pMsg); - ASSERT(ret == 0); - - syncPingDestroy(pMsg); - return ret; -} - -int32_t syncNodePingPeers(SSyncNode* pSyncNode) { - int32_t ret = 0; - for (int32_t i = 0; i < pSyncNode->peersNum; ++i) { - SRaftId* destId = &(pSyncNode->peersId[i]); - SyncPing* pMsg = syncPingBuild3(&pSyncNode->myRaftId, destId, pSyncNode->vgId); - ret = syncNodePing(pSyncNode, destId, pMsg); - ASSERT(ret == 0); - syncPingDestroy(pMsg); - } - return ret; -} - -int32_t syncNodePingAll(SSyncNode* pSyncNode) { - int32_t ret = 0; - for (int32_t i = 0; i < pSyncNode->pRaftCfg->cfg.replicaNum; ++i) { - SRaftId* destId = &(pSyncNode->replicasId[i]); - SyncPing* pMsg = syncPingBuild3(&pSyncNode->myRaftId, destId, pSyncNode->vgId); - ret = syncNodePing(pSyncNode, destId, pMsg); - ASSERT(ret == 0); - syncPingDestroy(pMsg); - } - return ret; -} - // timer control -------------- int32_t syncNodeStartPingTimer(SSyncNode* pSyncNode) { int32_t ret = 0; @@ -1264,7 +1213,7 @@ int32_t syncNodeRestartHeartbeatTimer(SSyncNode* pSyncNode) { // utils -------------- int32_t syncNodeSendMsgById(const SRaftId* destRaftId, SSyncNode* pSyncNode, SRpcMsg* pMsg) { SEpSet epSet; - syncUtilraftId2EpSet(destRaftId, &epSet); + syncUtilRaftId2EpSet(destRaftId, &epSet); if (pSyncNode->syncSendMSg != NULL) { // htonl syncUtilMsgHtoN(pMsg->pCont); @@ -1281,7 +1230,7 @@ int32_t syncNodeSendMsgById(const SRaftId* destRaftId, SSyncNode* pSyncNode, SRp int32_t syncNodeSendMsgByInfo(const SNodeInfo* nodeInfo, SSyncNode* pSyncNode, SRpcMsg* pMsg) { SEpSet epSet; - syncUtilnodeInfo2EpSet(nodeInfo, &epSet); + syncUtilNodeInfo2EpSet(nodeInfo, &epSet); if (pSyncNode->syncSendMSg != NULL) { // htonl syncUtilMsgHtoN(pMsg->pCont); @@ -1294,196 +1243,6 @@ int32_t syncNodeSendMsgByInfo(const SNodeInfo* nodeInfo, SSyncNode* pSyncNode, S return 0; } -cJSON* syncNode2Json(const SSyncNode* pSyncNode) { - char u64buf[128] = {0}; - cJSON* pRoot = cJSON_CreateObject(); - - if (pSyncNode != NULL) { - // init by SSyncInfo - cJSON_AddNumberToObject(pRoot, "vgId", pSyncNode->vgId); - cJSON_AddItemToObject(pRoot, "SRaftCfg", raftCfg2Json(pSyncNode->pRaftCfg)); - cJSON_AddStringToObject(pRoot, "path", pSyncNode->path); - cJSON_AddStringToObject(pRoot, "raftStorePath", pSyncNode->raftStorePath); - cJSON_AddStringToObject(pRoot, "configPath", pSyncNode->configPath); - - snprintf(u64buf, sizeof(u64buf), "%p", pSyncNode->pWal); - cJSON_AddStringToObject(pRoot, "pWal", u64buf); - - snprintf(u64buf, sizeof(u64buf), "%p", pSyncNode->msgcb); - cJSON_AddStringToObject(pRoot, "rpcClient", u64buf); - snprintf(u64buf, sizeof(u64buf), "%p", pSyncNode->syncSendMSg); - cJSON_AddStringToObject(pRoot, "syncSendMSg", u64buf); - - snprintf(u64buf, sizeof(u64buf), "%p", pSyncNode->msgcb); - cJSON_AddStringToObject(pRoot, "queue", u64buf); - snprintf(u64buf, sizeof(u64buf), "%p", pSyncNode->syncEqMsg); - cJSON_AddStringToObject(pRoot, "syncEqMsg", u64buf); - - // init internal - cJSON* pMe = syncUtilNodeInfo2Json(&pSyncNode->myNodeInfo); - cJSON_AddItemToObject(pRoot, "myNodeInfo", pMe); - cJSON* pRaftId = syncUtilRaftId2Json(&pSyncNode->myRaftId); - cJSON_AddItemToObject(pRoot, "myRaftId", pRaftId); - - cJSON_AddNumberToObject(pRoot, "peersNum", pSyncNode->peersNum); - cJSON* pPeers = cJSON_CreateArray(); - cJSON_AddItemToObject(pRoot, "peersNodeInfo", pPeers); - for (int32_t i = 0; i < pSyncNode->peersNum; ++i) { - cJSON_AddItemToArray(pPeers, syncUtilNodeInfo2Json(&pSyncNode->peersNodeInfo[i])); - } - cJSON* pPeersId = cJSON_CreateArray(); - cJSON_AddItemToObject(pRoot, "peersId", pPeersId); - for (int32_t i = 0; i < pSyncNode->peersNum; ++i) { - cJSON_AddItemToArray(pPeersId, syncUtilRaftId2Json(&pSyncNode->peersId[i])); - } - - cJSON_AddNumberToObject(pRoot, "replicaNum", pSyncNode->replicaNum); - cJSON* pReplicasId = cJSON_CreateArray(); - cJSON_AddItemToObject(pRoot, "replicasId", pReplicasId); - for (int32_t i = 0; i < pSyncNode->replicaNum; ++i) { - cJSON_AddItemToArray(pReplicasId, syncUtilRaftId2Json(&pSyncNode->replicasId[i])); - } - - // raft algorithm - snprintf(u64buf, sizeof(u64buf), "%p", pSyncNode->pFsm); - cJSON_AddStringToObject(pRoot, "pFsm", u64buf); - cJSON_AddNumberToObject(pRoot, "quorum", pSyncNode->quorum); - cJSON* pLaderCache = syncUtilRaftId2Json(&pSyncNode->leaderCache); - cJSON_AddItemToObject(pRoot, "leaderCache", pLaderCache); - - // life cycle - snprintf(u64buf, sizeof(u64buf), "%" PRId64, pSyncNode->rid); - cJSON_AddStringToObject(pRoot, "rid", u64buf); - - // tla+ server vars - cJSON_AddNumberToObject(pRoot, "state", pSyncNode->state); - cJSON_AddStringToObject(pRoot, "state_str", syncStr(pSyncNode->state)); - cJSON_AddItemToObject(pRoot, "pRaftStore", raftStore2Json(pSyncNode->pRaftStore)); - - // tla+ candidate vars - cJSON_AddItemToObject(pRoot, "pVotesGranted", voteGranted2Json(pSyncNode->pVotesGranted)); - cJSON_AddItemToObject(pRoot, "pVotesRespond", votesRespond2Json(pSyncNode->pVotesRespond)); - - // tla+ leader vars - cJSON_AddItemToObject(pRoot, "pNextIndex", syncIndexMgr2Json(pSyncNode->pNextIndex)); - cJSON_AddItemToObject(pRoot, "pMatchIndex", syncIndexMgr2Json(pSyncNode->pMatchIndex)); - - // tla+ log vars - cJSON_AddItemToObject(pRoot, "pLogStore", logStore2Json(pSyncNode->pLogStore)); - snprintf(u64buf, sizeof(u64buf), "%" PRId64, pSyncNode->commitIndex); - cJSON_AddStringToObject(pRoot, "commitIndex", u64buf); - - // timer ms init - cJSON_AddNumberToObject(pRoot, "pingBaseLine", pSyncNode->pingBaseLine); - cJSON_AddNumberToObject(pRoot, "electBaseLine", pSyncNode->electBaseLine); - cJSON_AddNumberToObject(pRoot, "hbBaseLine", pSyncNode->hbBaseLine); - - // ping timer - snprintf(u64buf, sizeof(u64buf), "%p", pSyncNode->pPingTimer); - cJSON_AddStringToObject(pRoot, "pPingTimer", u64buf); - cJSON_AddNumberToObject(pRoot, "pingTimerMS", pSyncNode->pingTimerMS); - snprintf(u64buf, sizeof(u64buf), "%" PRId64, pSyncNode->pingTimerLogicClock); - cJSON_AddStringToObject(pRoot, "pingTimerLogicClock", u64buf); - snprintf(u64buf, sizeof(u64buf), "%" PRId64, pSyncNode->pingTimerLogicClockUser); - cJSON_AddStringToObject(pRoot, "pingTimerLogicClockUser", u64buf); - snprintf(u64buf, sizeof(u64buf), "%p", pSyncNode->FpPingTimerCB); - cJSON_AddStringToObject(pRoot, "FpPingTimerCB", u64buf); - snprintf(u64buf, sizeof(u64buf), "%" PRId64, pSyncNode->pingTimerCounter); - cJSON_AddStringToObject(pRoot, "pingTimerCounter", u64buf); - - // elect timer - snprintf(u64buf, sizeof(u64buf), "%p", pSyncNode->pElectTimer); - cJSON_AddStringToObject(pRoot, "pElectTimer", u64buf); - cJSON_AddNumberToObject(pRoot, "electTimerMS", pSyncNode->electTimerMS); - snprintf(u64buf, sizeof(u64buf), "%" PRId64, pSyncNode->electTimerLogicClock); - cJSON_AddStringToObject(pRoot, "electTimerLogicClock", u64buf); - snprintf(u64buf, sizeof(u64buf), "%p", pSyncNode->FpElectTimerCB); - cJSON_AddStringToObject(pRoot, "FpElectTimerCB", u64buf); - snprintf(u64buf, sizeof(u64buf), "%" PRId64, pSyncNode->electTimerCounter); - cJSON_AddStringToObject(pRoot, "electTimerCounter", u64buf); - - // heartbeat timer - snprintf(u64buf, sizeof(u64buf), "%p", pSyncNode->pHeartbeatTimer); - cJSON_AddStringToObject(pRoot, "pHeartbeatTimer", u64buf); - cJSON_AddNumberToObject(pRoot, "heartbeatTimerMS", pSyncNode->heartbeatTimerMS); - snprintf(u64buf, sizeof(u64buf), "%" PRId64, pSyncNode->heartbeatTimerLogicClock); - cJSON_AddStringToObject(pRoot, "heartbeatTimerLogicClock", u64buf); - snprintf(u64buf, sizeof(u64buf), "%" PRId64, pSyncNode->heartbeatTimerLogicClockUser); - cJSON_AddStringToObject(pRoot, "heartbeatTimerLogicClockUser", u64buf); - snprintf(u64buf, sizeof(u64buf), "%p", pSyncNode->FpHeartbeatTimerCB); - cJSON_AddStringToObject(pRoot, "FpHeartbeatTimerCB", u64buf); - snprintf(u64buf, sizeof(u64buf), "%" PRId64, pSyncNode->heartbeatTimerCounter); - cJSON_AddStringToObject(pRoot, "heartbeatTimerCounter", u64buf); - - // callback - snprintf(u64buf, sizeof(u64buf), "%p", pSyncNode->FpOnPing); - cJSON_AddStringToObject(pRoot, "FpOnPing", u64buf); - snprintf(u64buf, sizeof(u64buf), "%p", pSyncNode->FpOnPingReply); - cJSON_AddStringToObject(pRoot, "FpOnPingReply", u64buf); - snprintf(u64buf, sizeof(u64buf), "%p", pSyncNode->FpOnRequestVote); - cJSON_AddStringToObject(pRoot, "FpOnRequestVote", u64buf); - snprintf(u64buf, sizeof(u64buf), "%p", pSyncNode->FpOnRequestVoteReply); - cJSON_AddStringToObject(pRoot, "FpOnRequestVoteReply", u64buf); - snprintf(u64buf, sizeof(u64buf), "%p", pSyncNode->FpOnAppendEntries); - cJSON_AddStringToObject(pRoot, "FpOnAppendEntries", u64buf); - snprintf(u64buf, sizeof(u64buf), "%p", pSyncNode->FpOnAppendEntriesReply); - cJSON_AddStringToObject(pRoot, "FpOnAppendEntriesReply", u64buf); - snprintf(u64buf, sizeof(u64buf), "%p", pSyncNode->FpOnTimeout); - cJSON_AddStringToObject(pRoot, "FpOnTimeout", u64buf); - - // restoreFinish - cJSON_AddNumberToObject(pRoot, "restoreFinish", pSyncNode->restoreFinish); - - // snapshot senders - cJSON* pSenders = cJSON_CreateArray(); - cJSON_AddItemToObject(pRoot, "senders", pSenders); - for (int32_t i = 0; i < TSDB_MAX_REPLICA; ++i) { - cJSON_AddItemToArray(pSenders, snapshotSender2Json((pSyncNode->senders)[i])); - } - - // snapshot receivers - cJSON* pReceivers = cJSON_CreateArray(); - cJSON_AddItemToObject(pRoot, "receiver", snapshotReceiver2Json(pSyncNode->pNewNodeReceiver)); - - // changing - cJSON_AddNumberToObject(pRoot, "changing", pSyncNode->changing); - } - - cJSON* pJson = cJSON_CreateObject(); - cJSON_AddItemToObject(pJson, "SSyncNode", pRoot); - return pJson; -} - -char* syncNode2Str(const SSyncNode* pSyncNode) { - cJSON* pJson = syncNode2Json(pSyncNode); - char* serialized = cJSON_Print(pJson); - cJSON_Delete(pJson); - return serialized; -} - -inline char* syncNode2SimpleStr(const SSyncNode* pSyncNode) { - int32_t len = 256; - char* s = (char*)taosMemoryMalloc(len); - - SSnapshot snapshot = {.data = NULL, .lastApplyIndex = -1, .lastApplyTerm = 0}; - if (pSyncNode->pFsm->FpGetSnapshotInfo != NULL) { - pSyncNode->pFsm->FpGetSnapshotInfo(pSyncNode->pFsm, &snapshot); - } - SyncIndex logLastIndex = pSyncNode->pLogStore->syncLogLastIndex(pSyncNode->pLogStore); - SyncIndex logBeginIndex = pSyncNode->pLogStore->syncLogBeginIndex(pSyncNode->pLogStore); - - snprintf(s, len, - "vgId:%d, sync %s, tm:%" PRId64 ", cmt:%" PRId64 ", fst:%" PRId64 ", lst:%" PRId64 ", snap:%" PRId64 - ", sby:%d, " - "r-num:%d, " - "lcfg:%" PRId64 ", chging:%d, rsto:%d", - pSyncNode->vgId, syncStr(pSyncNode->state), pSyncNode->pRaftStore->currentTerm, pSyncNode->commitIndex, - logBeginIndex, logLastIndex, snapshot.lastApplyIndex, pSyncNode->pRaftCfg->isStandBy, pSyncNode->replicaNum, - pSyncNode->pRaftCfg->lastConfigIndex, pSyncNode->changing, pSyncNode->restoreFinish); - - return s; -} - inline bool syncNodeInConfig(SSyncNode* pSyncNode, const SSyncCfg* config) { bool b1 = false; bool b2 = false; @@ -1585,7 +1344,7 @@ void syncNodeDoConfigChange(SSyncNode* pSyncNode, SSyncCfg* pNewConfig, SyncInde // init internal pSyncNode->myNodeInfo = pSyncNode->pRaftCfg->cfg.nodeInfo[pSyncNode->pRaftCfg->cfg.myIndex]; - syncUtilnodeInfo2raftId(&pSyncNode->myNodeInfo, pSyncNode->vgId, &pSyncNode->myRaftId); + syncUtilNodeInfo2RaftId(&pSyncNode->myNodeInfo, pSyncNode->vgId, &pSyncNode->myRaftId); // init peersNum, peers, peersId pSyncNode->peersNum = pSyncNode->pRaftCfg->cfg.replicaNum - 1; @@ -1597,13 +1356,13 @@ void syncNodeDoConfigChange(SSyncNode* pSyncNode, SSyncCfg* pNewConfig, SyncInde } } for (int32_t i = 0; i < pSyncNode->peersNum; ++i) { - syncUtilnodeInfo2raftId(&pSyncNode->peersNodeInfo[i], pSyncNode->vgId, &pSyncNode->peersId[i]); + syncUtilNodeInfo2RaftId(&pSyncNode->peersNodeInfo[i], pSyncNode->vgId, &pSyncNode->peersId[i]); } // init replicaNum, replicasId pSyncNode->replicaNum = pSyncNode->pRaftCfg->cfg.replicaNum; for (int32_t i = 0; i < pSyncNode->pRaftCfg->cfg.replicaNum; ++i) { - syncUtilnodeInfo2raftId(&pSyncNode->pRaftCfg->cfg.nodeInfo[i], pSyncNode->vgId, &pSyncNode->replicasId[i]); + syncUtilNodeInfo2RaftId(&pSyncNode->pRaftCfg->cfg.nodeInfo[i], pSyncNode->vgId, &pSyncNode->replicasId[i]); } // update quorum first @@ -2057,8 +1816,6 @@ int32_t syncNodeGetPreIndexTerm(SSyncNode* pSyncNode, SyncIndex index, SyncIndex return 0; } -// ------ local funciton --------- -// enqueue message ---- static void syncNodeEqPingTimer(void* param, void* tmrId) { SSyncNode* pSyncNode = (SSyncNode*)param; if (atomic_load_64(&pSyncNode->pingTimerLogicClockUser) <= atomic_load_64(&pSyncNode->pingTimerLogicClock)) { @@ -2066,7 +1823,7 @@ static void syncNodeEqPingTimer(void* param, void* tmrId) { pSyncNode->pingTimerMS, pSyncNode->vgId, pSyncNode); SRpcMsg rpcMsg; syncTimeout2RpcMsg(pSyncMsg, &rpcMsg); - syncRpcMsgLog2((char*)"==syncNodeEqPingTimer==", &rpcMsg); + sNTrace(pSyncNode, "enqueue ping timer"); if (pSyncNode->syncEqMsg != NULL) { int32_t code = pSyncNode->syncEqMsg(pSyncNode->msgcb, &rpcMsg); if (code != 0) { @@ -2142,7 +1899,7 @@ static void syncNodeEqHeartbeatTimer(void* param, void* tmrId) { pSyncNode->heartbeatTimerMS, pSyncNode->vgId, pSyncNode); SRpcMsg rpcMsg; syncTimeout2RpcMsg(pSyncMsg, &rpcMsg); - syncRpcMsgLog2((char*)"==syncNodeEqHeartbeatTimer==", &rpcMsg); + sNTrace(pSyncNode, "enqueue heartbeat timer"); if (pSyncNode->syncEqMsg != NULL) { int32_t code = pSyncNode->syncEqMsg(pSyncNode->msgcb, &rpcMsg); if (code != 0) { @@ -2239,34 +1996,28 @@ static void syncNodeEqPeerHeartbeatTimer(void* param, void* tmrId) { } } -static int32_t syncNodeEqNoop(SSyncNode* ths) { - int32_t ret = 0; - ASSERT(ths->state == TAOS_SYNC_STATE_LEADER); - - SyncIndex index = ths->pLogStore->syncLogWriteIndex(ths->pLogStore); - SyncTerm term = ths->pRaftStore->currentTerm; - SSyncRaftEntry* pEntry = syncEntryBuildNoop(term, index, ths->vgId); - ASSERT(pEntry != NULL); - - uint32_t entryLen; - char* serialized = syncEntrySerialize(pEntry, &entryLen); - SyncClientRequest* pSyncMsg = syncClientRequestAlloc(entryLen); - ASSERT(pSyncMsg->dataLen == entryLen); - memcpy(pSyncMsg->data, serialized, entryLen); - - SRpcMsg rpcMsg = {0}; - syncClientRequest2RpcMsg(pSyncMsg, &rpcMsg); - if (ths->syncEqMsg != NULL) { - ths->syncEqMsg(ths->msgcb, &rpcMsg); - } else { - sTrace("syncNodeEqNoop pSyncNode->syncEqMsg is NULL"); +static int32_t syncNodeEqNoop(SSyncNode* pNode) { + if (pNode->state == TAOS_SYNC_STATE_LEADER) { + terrno = TSDB_CODE_SYN_NOT_LEADER; + return -1; } - syncEntryDestory(pEntry); - taosMemoryFree(serialized); - syncClientRequestDestroy(pSyncMsg); + SyncIndex index = pNode->pLogStore->syncLogWriteIndex(pNode->pLogStore); + SyncTerm term = pNode->pRaftStore->currentTerm; + SSyncRaftEntry* pEntry = syncEntryBuildNoop(term, index, pNode->vgId); + if (pEntry == NULL) return -1; - return ret; + SRpcMsg rpcMsg = {0}; + int32_t code = syncClientRequestBuildFromNoopEntry(&rpcMsg, pEntry, pNode->vgId); + syncEntryDestory(pEntry); + + sNTrace(pNode, "propose msg, type:noop"); + code = (*pNode->syncEqMsg)(pNode->msgcb, &rpcMsg); + if (code != 0) { + sNError(pNode, "failed to propose noop msg while enqueue since %s", terrstr()); + } + + return code; } static void deleteCacheEntry(const void* key, size_t keyLen, void* value) { taosMemoryFree(value); } @@ -2447,7 +2198,7 @@ int32_t syncNodeOnLocalCmd(SSyncNode* ths, SyncLocalCmd* pMsg) { // leaderVars, commitIndex>> // -int32_t syncNodeOnClientRequest(SSyncNode* ths, SyncClientRequest* pMsg, SyncIndex* pRetIndex) { +int32_t syncNodeOnClientRequest(SSyncNode* ths, SRpcMsg* pMsg, SyncIndex* pRetIndex) { sNTrace(ths, "on client request"); int32_t ret = 0; @@ -2455,8 +2206,13 @@ int32_t syncNodeOnClientRequest(SSyncNode* ths, SyncClientRequest* pMsg, SyncInd SyncIndex index = ths->pLogStore->syncLogWriteIndex(ths->pLogStore); SyncTerm term = ths->pRaftStore->currentTerm; - SSyncRaftEntry* pEntry = syncEntryBuild2(pMsg, term, index); - ASSERT(pEntry != NULL); + SSyncRaftEntry* pEntry; + + if (pMsg->msgType == TDMT_SYNC_CLIENT_REQUEST) { + pEntry = syncEntryBuildFromClientRequest(pMsg->pCont, term, index); + } else { + pEntry = syncEntryBuildFromRpcMsg(pMsg, term, index); + } LRUHandle* h = NULL; syncCacheEntry(ths->pLogStore, pEntry, &h); @@ -2476,10 +2232,6 @@ int32_t syncNodeOnClientRequest(SSyncNode* ths, SyncClientRequest* pMsg, SyncInd } else { // del resp mgr, call FpCommitCb - - SRpcMsg rpcMsg = {0}; - syncClientRequest2RpcMsg(pMsg, &rpcMsg); - SFsmCbMeta cbMeta = { .index = pEntry->index, .lastConfigIndex = SYNC_INDEX_INVALID, @@ -2491,9 +2243,7 @@ int32_t syncNodeOnClientRequest(SSyncNode* ths, SyncClientRequest* pMsg, SyncInd .currentTerm = ths->pRaftStore->currentTerm, .flag = 0, }; - - syncRespMgrGetAndDel(ths->pSyncRespMgr, cbMeta.seqNum, &rpcMsg.info); - ths->pFsm->FpCommitCb(ths->pFsm, &rpcMsg, &cbMeta); + ths->pFsm->FpCommitCb(ths->pFsm, pMsg, &cbMeta); if (h) { taosLRUCacheRelease(ths->pLogStore->pCache, h, false); @@ -2680,7 +2430,7 @@ int32_t syncNodeDoCommit(SSyncNode* ths, SyncIndex beginIndex, SyncIndex endInde } } - SRpcMsg rpcMsg; + SRpcMsg rpcMsg = {0}; syncEntry2OriginalRpc(pEntry, &rpcMsg); // user commit @@ -3020,10 +2770,47 @@ void syncLogRecvSyncPreSnapshotReply(SSyncNode* pSyncNode, const SyncPreSnapshot port, pMsg->term, pMsg->snapStart, s); } -void syncLogSendSyncSnapshotSend(SSyncNode* pSyncNode, const SyncSnapshotSend* pMsg, const char* s) {} +void syncLogSendSyncSnapshotSend(SSyncNode* pSyncNode, const SyncSnapshotSend* pMsg, const char* s) { + char host[64]; + uint16_t port; + syncUtilU642Addr(pMsg->destId.addr, host, sizeof(host), &port); -void syncLogRecvSyncSnapshotSend(SSyncNode* pSyncNode, const SyncSnapshotSend* pMsg, const char* s) {} + sNTrace(pSyncNode, + "send sync-snapshot-send from %s:%d {term:%" PRId64 ", begin:%" PRId64 ", end:%" PRId64 ", lterm:%" PRId64 + ", stime:%" PRId64 ", seq:%d}, %s", + host, port, pMsg->term, pMsg->beginIndex, pMsg->lastIndex, pMsg->lastTerm, pMsg->startTime, pMsg->seq, s); +} -void syncLogSendSyncSnapshotRsp(SSyncNode* pSyncNode, const SyncSnapshotRsp* pMsg, const char* s) {} +void syncLogRecvSyncSnapshotSend(SSyncNode* pSyncNode, const SyncSnapshotSend* pMsg, const char* s) { + char host[64]; + uint16_t port; + syncUtilU642Addr(pMsg->srcId.addr, host, sizeof(host), &port); -void syncLogRecvSyncSnapshotRsp(SSyncNode* pSyncNode, const SyncSnapshotRsp* pMsg, const char* s) {} + sNTrace(pSyncNode, + "recv sync-snapshot-send from %s:%d {term:%" PRId64 ", begin:%" PRId64 ", lst:%" PRId64 ", lterm:%" PRId64 + ", stime:%" PRId64 ", seq:%d, len:%u}, %s", + host, port, pMsg->term, pMsg->beginIndex, pMsg->lastIndex, pMsg->lastTerm, pMsg->startTime, pMsg->seq, + pMsg->dataLen, s); +} + +void syncLogSendSyncSnapshotRsp(SSyncNode* pSyncNode, const SyncSnapshotRsp* pMsg, const char* s) { + char host[64]; + uint16_t port; + syncUtilU642Addr(pMsg->destId.addr, host, sizeof(host), &port); + + sNTrace(pSyncNode, + "send sync-snapshot-rsp from %s:%d {term:%" PRId64 ", begin:%" PRId64 ", lst:%" PRId64 ", lterm:%" PRId64 + ", stime:%" PRId64 ", ack:%d}, %s", + host, port, pMsg->term, pMsg->snapBeginIndex, pMsg->lastIndex, pMsg->lastTerm, pMsg->startTime, pMsg->ack, s); +} + +void syncLogRecvSyncSnapshotRsp(SSyncNode* pSyncNode, const SyncSnapshotRsp* pMsg, const char* s) { + char host[64]; + uint16_t port; + syncUtilU642Addr(pMsg->srcId.addr, host, sizeof(host), &port); + + sNTrace(pSyncNode, + "recv sync-snapshot-rsp from %s:%d {term:%" PRId64 ", begin:%" PRId64 ", lst:%" PRId64 ", lterm:%" PRId64 + ", stime:%" PRId64 ", ack:%d}, %s", + host, port, pMsg->term, pMsg->snapBeginIndex, pMsg->lastIndex, pMsg->lastTerm, pMsg->startTime, pMsg->ack, s); +} diff --git a/source/libs/sync/src/syncMessage.c b/source/libs/sync/src/syncMessage.c index 6453693576..3fcb563f3b 100644 --- a/source/libs/sync/src/syncMessage.c +++ b/source/libs/sync/src/syncMessage.c @@ -19,146 +19,6 @@ #include "syncUtil.h" #include "tcoding.h" -// --------------------------------------------- -cJSON* syncRpcMsg2Json(SRpcMsg* pRpcMsg) { - cJSON* pRoot; - - // in compiler optimization, switch case = if else constants - if (pRpcMsg->msgType == TDMT_SYNC_TIMEOUT) { - SyncTimeout* pSyncMsg = syncTimeoutDeserialize2(pRpcMsg->pCont, pRpcMsg->contLen); - pRoot = syncTimeout2Json(pSyncMsg); - syncTimeoutDestroy(pSyncMsg); - - } else if (pRpcMsg->msgType == TDMT_SYNC_PING) { - SyncPing* pSyncMsg = syncPingDeserialize2(pRpcMsg->pCont, pRpcMsg->contLen); - pRoot = syncPing2Json(pSyncMsg); - syncPingDestroy(pSyncMsg); - - } else if (pRpcMsg->msgType == TDMT_SYNC_PING_REPLY) { - SyncPingReply* pSyncMsg = syncPingReplyDeserialize2(pRpcMsg->pCont, pRpcMsg->contLen); - pRoot = syncPingReply2Json(pSyncMsg); - syncPingReplyDestroy(pSyncMsg); - - } else if (pRpcMsg->msgType == TDMT_SYNC_CLIENT_REQUEST) { - SyncClientRequest* pSyncMsg = syncClientRequestDeserialize2(pRpcMsg->pCont, pRpcMsg->contLen); - pRoot = syncClientRequest2Json(pSyncMsg); - syncClientRequestDestroy(pSyncMsg); - - } else if (pRpcMsg->msgType == TDMT_SYNC_CLIENT_REQUEST_REPLY) { - pRoot = syncRpcUnknownMsg2Json(); - - } else if (pRpcMsg->msgType == TDMT_SYNC_REQUEST_VOTE) { - SyncRequestVote* pSyncMsg = syncRequestVoteDeserialize2(pRpcMsg->pCont, pRpcMsg->contLen); - pRoot = syncRequestVote2Json(pSyncMsg); - syncRequestVoteDestroy(pSyncMsg); - - } else if (pRpcMsg->msgType == TDMT_SYNC_REQUEST_VOTE_REPLY) { - SyncRequestVoteReply* pSyncMsg = syncRequestVoteReplyDeserialize2(pRpcMsg->pCont, pRpcMsg->contLen); - pRoot = syncRequestVoteReply2Json(pSyncMsg); - syncRequestVoteReplyDestroy(pSyncMsg); - - } else if (pRpcMsg->msgType == TDMT_SYNC_APPEND_ENTRIES) { - SyncAppendEntries* pSyncMsg = syncAppendEntriesDeserialize2(pRpcMsg->pCont, pRpcMsg->contLen); - pRoot = syncAppendEntries2Json(pSyncMsg); - syncAppendEntriesDestroy(pSyncMsg); - - } else if (pRpcMsg->msgType == TDMT_SYNC_APPEND_ENTRIES_REPLY) { - SyncAppendEntriesReply* pSyncMsg = syncAppendEntriesReplyDeserialize2(pRpcMsg->pCont, pRpcMsg->contLen); - pRoot = syncAppendEntriesReply2Json(pSyncMsg); - syncAppendEntriesReplyDestroy(pSyncMsg); - - } else if (pRpcMsg->msgType == TDMT_SYNC_SNAPSHOT_SEND) { - SyncSnapshotSend* pSyncMsg = syncSnapshotSendDeserialize2(pRpcMsg->pCont, pRpcMsg->contLen); - pRoot = syncSnapshotSend2Json(pSyncMsg); - syncSnapshotSendDestroy(pSyncMsg); - - } else if (pRpcMsg->msgType == TDMT_SYNC_SNAPSHOT_RSP) { - SyncSnapshotRsp* pSyncMsg = syncSnapshotRspDeserialize2(pRpcMsg->pCont, pRpcMsg->contLen); - pRoot = syncSnapshotRsp2Json(pSyncMsg); - syncSnapshotRspDestroy(pSyncMsg); - - } else if (pRpcMsg->msgType == TDMT_SYNC_LEADER_TRANSFER) { - SyncLeaderTransfer* pSyncMsg = syncLeaderTransferDeserialize2(pRpcMsg->pCont, pRpcMsg->contLen); - pRoot = syncLeaderTransfer2Json(pSyncMsg); - syncLeaderTransferDestroy(pSyncMsg); - - } else if (pRpcMsg->msgType == TDMT_SYNC_COMMON_RESPONSE) { - pRoot = cJSON_CreateObject(); - char* s; - s = syncUtilPrintBin((char*)(pRpcMsg->pCont), pRpcMsg->contLen); - cJSON_AddStringToObject(pRoot, "pCont", s); - taosMemoryFree(s); - s = syncUtilPrintBin2((char*)(pRpcMsg->pCont), pRpcMsg->contLen); - cJSON_AddStringToObject(pRoot, "pCont2", s); - taosMemoryFree(s); - - } else { - pRoot = cJSON_CreateObject(); - char* s; - s = syncUtilPrintBin((char*)(pRpcMsg->pCont), pRpcMsg->contLen); - cJSON_AddStringToObject(pRoot, "pCont", s); - taosMemoryFree(s); - s = syncUtilPrintBin2((char*)(pRpcMsg->pCont), pRpcMsg->contLen); - cJSON_AddStringToObject(pRoot, "pCont2", s); - taosMemoryFree(s); - } - - cJSON_AddNumberToObject(pRoot, "msgType", pRpcMsg->msgType); - cJSON_AddNumberToObject(pRoot, "contLen", pRpcMsg->contLen); - cJSON_AddNumberToObject(pRoot, "code", pRpcMsg->code); - // cJSON_AddNumberToObject(pRoot, "persist", pRpcMsg->persist); - - cJSON* pJson = cJSON_CreateObject(); - cJSON_AddItemToObject(pJson, "RpcMsg", pRoot); - return pJson; -} - -cJSON* syncRpcUnknownMsg2Json() { - cJSON* pRoot = cJSON_CreateObject(); - cJSON_AddNumberToObject(pRoot, "msgType", TDMT_SYNC_UNKNOWN); - cJSON_AddStringToObject(pRoot, "data", "unknown message"); - - cJSON* pJson = cJSON_CreateObject(); - cJSON_AddItemToObject(pJson, "SyncUnknown", pRoot); - return pJson; -} - -char* syncRpcMsg2Str(SRpcMsg* pRpcMsg) { - cJSON* pJson = syncRpcMsg2Json(pRpcMsg); - char* serialized = cJSON_Print(pJson); - cJSON_Delete(pJson); - return serialized; -} - -// for debug ---------------------- -void syncRpcMsgPrint(SRpcMsg* pMsg) { - char* serialized = syncRpcMsg2Str(pMsg); - printf("syncRpcMsgPrint | len:%d | %s \n", (int32_t)strlen(serialized), serialized); - fflush(NULL); - taosMemoryFree(serialized); -} - -void syncRpcMsgPrint2(char* s, SRpcMsg* pMsg) { - char* serialized = syncRpcMsg2Str(pMsg); - printf("syncRpcMsgPrint2 | len:%d | %s | %s \n", (int32_t)strlen(serialized), s, serialized); - fflush(NULL); - taosMemoryFree(serialized); -} - -void syncRpcMsgLog(SRpcMsg* pMsg) { - char* serialized = syncRpcMsg2Str(pMsg); - sTrace("syncRpcMsgLog | len:%d | %s", (int32_t)strlen(serialized), serialized); - taosMemoryFree(serialized); -} - -void syncRpcMsgLog2(char* s, SRpcMsg* pMsg) { - if (gRaftDetailLog) { - char* serialized = syncRpcMsg2Str(pMsg); - sTrace("syncRpcMsgLog2 | len:%d | %s | %s", (int32_t)strlen(serialized), s, serialized); - taosMemoryFree(serialized); - } -} - // ---- message process SyncTimeout---- SyncTimeout* syncTimeoutBuild() { uint32_t bytes = sizeof(SyncTimeout); @@ -840,69 +700,49 @@ SyncClientRequest* syncClientRequestAlloc(uint32_t dataLen) { return pMsg; } -// step 1. original SRpcMsg => SyncClientRequest, add seqNum, isWeak -SyncClientRequest* syncClientRequestBuild(const SRpcMsg* pOriginalRpcMsg, uint64_t seqNum, bool isWeak, int32_t vgId) { - SyncClientRequest* pMsg = syncClientRequestAlloc(pOriginalRpcMsg->contLen); - pMsg->vgId = vgId; - pMsg->originalRpcType = pOriginalRpcMsg->msgType; - pMsg->seqNum = seqNum; - pMsg->isWeak = isWeak; - memcpy(pMsg->data, pOriginalRpcMsg->pCont, pOriginalRpcMsg->contLen); - return pMsg; -} - -void syncClientRequestDestroy(SyncClientRequest* pMsg) { - if (pMsg != NULL) { - taosMemoryFree(pMsg); +int32_t syncClientRequestBuildFromRpcMsg(SRpcMsg* pClientRequestRpcMsg, const SRpcMsg* pOriginalRpcMsg, uint64_t seqNum, + bool isWeak, int32_t vgId) { + int32_t bytes = sizeof(SyncClientRequest) + pOriginalRpcMsg->contLen; + pClientRequestRpcMsg->pCont = rpcMallocCont(bytes); + if (pClientRequestRpcMsg->pCont == NULL) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + return -1; } + + SyncClientRequest* pClientRequest = pClientRequestRpcMsg->pCont; + pClientRequest->bytes = bytes; + pClientRequest->vgId = vgId; + pClientRequest->msgType = TDMT_SYNC_CLIENT_REQUEST; + pClientRequest->originalRpcType = pOriginalRpcMsg->msgType; + pClientRequest->seqNum = seqNum; + pClientRequest->isWeak = isWeak; + pClientRequest->dataLen = pOriginalRpcMsg->contLen; + memcpy(pClientRequest->data, (char*)pOriginalRpcMsg->pCont, pOriginalRpcMsg->contLen); + + pClientRequestRpcMsg->msgType = TDMT_SYNC_CLIENT_REQUEST; + pClientRequestRpcMsg->contLen = bytes; + return 0; } -void syncClientRequestSerialize(const SyncClientRequest* pMsg, char* buf, uint32_t bufLen) { - ASSERT(pMsg->bytes <= bufLen); - memcpy(buf, pMsg, pMsg->bytes); -} - -void syncClientRequestDeserialize(const char* buf, uint32_t len, SyncClientRequest* pMsg) { - memcpy(pMsg, buf, len); - ASSERT(len == pMsg->bytes); -} - -char* syncClientRequestSerialize2(const SyncClientRequest* pMsg, uint32_t* len) { - char* buf = taosMemoryMalloc(pMsg->bytes); - ASSERT(buf != NULL); - syncClientRequestSerialize(pMsg, buf, pMsg->bytes); - if (len != NULL) { - *len = pMsg->bytes; +int32_t syncClientRequestBuildFromNoopEntry(SRpcMsg* pClientRequestRpcMsg, const SSyncRaftEntry* pEntry, int32_t vgId) { + int32_t bytes = sizeof(SyncClientRequest) + pEntry->bytes; + pClientRequestRpcMsg->pCont = rpcMallocCont(bytes); + if (pClientRequestRpcMsg->pCont == NULL) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + return -1; } - return buf; -} -SyncClientRequest* syncClientRequestDeserialize2(const char* buf, uint32_t len) { - uint32_t bytes = *((uint32_t*)buf); - SyncClientRequest* pMsg = taosMemoryMalloc(bytes); - ASSERT(pMsg != NULL); - syncClientRequestDeserialize(buf, len, pMsg); - ASSERT(len == pMsg->bytes); - return pMsg; -} + SyncClientRequest* pClientRequest = pClientRequestRpcMsg->pCont; + pClientRequest->bytes = bytes; + pClientRequest->vgId = vgId; + pClientRequest->msgType = TDMT_SYNC_CLIENT_REQUEST; + pClientRequest->originalRpcType = TDMT_SYNC_NOOP; + pClientRequest->dataLen = pEntry->bytes; + memcpy(pClientRequest->data, (char*)pEntry, pEntry->bytes); -// step 2. SyncClientRequest => RpcMsg, to queue -void syncClientRequest2RpcMsg(const SyncClientRequest* pMsg, SRpcMsg* pRpcMsg) { - pRpcMsg->msgType = pMsg->msgType; - pRpcMsg->contLen = pMsg->bytes; - pRpcMsg->pCont = rpcMallocCont(pRpcMsg->contLen); - syncClientRequestSerialize(pMsg, pRpcMsg->pCont, pRpcMsg->contLen); -} - -void syncClientRequestFromRpcMsg(const SRpcMsg* pRpcMsg, SyncClientRequest* pMsg) { - syncClientRequestDeserialize(pRpcMsg->pCont, pRpcMsg->contLen, pMsg); -} - -// step 3. RpcMsg => SyncClientRequest, from queue -SyncClientRequest* syncClientRequestFromRpcMsg2(const SRpcMsg* pRpcMsg) { - SyncClientRequest* pMsg = syncClientRequestDeserialize2(pRpcMsg->pCont, pRpcMsg->contLen); - ASSERT(pMsg != NULL); - return pMsg; + pClientRequestRpcMsg->msgType = TDMT_SYNC_CLIENT_REQUEST; + pClientRequestRpcMsg->contLen = bytes; + return 0; } cJSON* syncClientRequest2Json(const SyncClientRequest* pMsg) { @@ -940,35 +780,6 @@ char* syncClientRequest2Str(const SyncClientRequest* pMsg) { return serialized; } -// for debug ---------------------- -void syncClientRequestPrint(const SyncClientRequest* pMsg) { - char* serialized = syncClientRequest2Str(pMsg); - printf("syncClientRequestPrint | len:%d | %s \n", (int32_t)strlen(serialized), serialized); - fflush(NULL); - taosMemoryFree(serialized); -} - -void syncClientRequestPrint2(char* s, const SyncClientRequest* pMsg) { - char* serialized = syncClientRequest2Str(pMsg); - printf("syncClientRequestPrint2 | len:%d | %s | %s \n", (int32_t)strlen(serialized), s, serialized); - fflush(NULL); - taosMemoryFree(serialized); -} - -void syncClientRequestLog(const SyncClientRequest* pMsg) { - char* serialized = syncClientRequest2Str(pMsg); - sTrace("syncClientRequestLog | len:%d | %s", (int32_t)strlen(serialized), serialized); - taosMemoryFree(serialized); -} - -void syncClientRequestLog2(char* s, const SyncClientRequest* pMsg) { - if (gRaftDetailLog) { - char* serialized = syncClientRequest2Str(pMsg); - sTrace("syncClientRequestLog2 | len:%d | %s | %s", (int32_t)strlen(serialized), s, serialized); - taosMemoryFree(serialized); - } -} - // ---- message process SyncClientRequestBatch---- // block1: @@ -1059,86 +870,6 @@ SyncClientRequestBatch* syncClientRequestBatchFromRpcMsg(const SRpcMsg* pRpcMsg) return pSyncMsg; } -cJSON* syncClientRequestBatch2Json(const SyncClientRequestBatch* pMsg) { - char u64buf[128] = {0}; - cJSON* pRoot = cJSON_CreateObject(); - - if (pMsg != NULL) { - cJSON_AddNumberToObject(pRoot, "bytes", pMsg->bytes); - cJSON_AddNumberToObject(pRoot, "vgId", pMsg->vgId); - cJSON_AddNumberToObject(pRoot, "msgType", pMsg->msgType); - cJSON_AddNumberToObject(pRoot, "dataLen", pMsg->dataLen); - cJSON_AddNumberToObject(pRoot, "dataCount", pMsg->dataCount); - - SRaftMeta* metaArr = syncClientRequestBatchMetaArr(pMsg); - SRpcMsg* msgArr = syncClientRequestBatchRpcMsgArr(pMsg); - - cJSON* pMetaArr = cJSON_CreateArray(); - cJSON_AddItemToObject(pRoot, "metaArr", pMetaArr); - for (int i = 0; i < pMsg->dataCount; ++i) { - cJSON* pMeta = cJSON_CreateObject(); - cJSON_AddNumberToObject(pMeta, "seqNum", metaArr[i].seqNum); - cJSON_AddNumberToObject(pMeta, "isWeak", metaArr[i].isWeak); - cJSON_AddItemToArray(pMetaArr, pMeta); - } - - cJSON* pMsgArr = cJSON_CreateArray(); - cJSON_AddItemToObject(pRoot, "msgArr", pMsgArr); - for (int i = 0; i < pMsg->dataCount; ++i) { - cJSON* pRpcMsgJson = syncRpcMsg2Json(&msgArr[i]); - cJSON_AddItemToArray(pMsgArr, pRpcMsgJson); - } - - char* s; - s = syncUtilPrintBin((char*)(pMsg->data), pMsg->dataLen); - cJSON_AddStringToObject(pRoot, "data", s); - taosMemoryFree(s); - s = syncUtilPrintBin2((char*)(pMsg->data), pMsg->dataLen); - cJSON_AddStringToObject(pRoot, "data2", s); - taosMemoryFree(s); - } - - cJSON* pJson = cJSON_CreateObject(); - cJSON_AddItemToObject(pJson, "SyncClientRequestBatch", pRoot); - return pJson; -} - -char* syncClientRequestBatch2Str(const SyncClientRequestBatch* pMsg) { - cJSON* pJson = syncClientRequestBatch2Json(pMsg); - char* serialized = cJSON_Print(pJson); - cJSON_Delete(pJson); - return serialized; -} - -// for debug ---------------------- -void syncClientRequestBatchPrint(const SyncClientRequestBatch* pMsg) { - char* serialized = syncClientRequestBatch2Str(pMsg); - printf("syncClientRequestBatchPrint | len:%d | %s \n", (int32_t)strlen(serialized), serialized); - fflush(NULL); - taosMemoryFree(serialized); -} - -void syncClientRequestBatchPrint2(char* s, const SyncClientRequestBatch* pMsg) { - char* serialized = syncClientRequestBatch2Str(pMsg); - printf("syncClientRequestBatchPrint2 | len:%d | %s | %s \n", (int32_t)strlen(serialized), s, serialized); - fflush(NULL); - taosMemoryFree(serialized); -} - -void syncClientRequestBatchLog(const SyncClientRequestBatch* pMsg) { - char* serialized = syncClientRequestBatch2Str(pMsg); - sTrace("syncClientRequestBatchLog | len:%d | %s", (int32_t)strlen(serialized), serialized); - taosMemoryFree(serialized); -} - -void syncClientRequestBatchLog2(char* s, const SyncClientRequestBatch* pMsg) { - if (gRaftDetailLog) { - char* serialized = syncClientRequestBatch2Str(pMsg); - sLTrace("syncClientRequestBatchLog2 | len:%d | %s | %s", (int32_t)strlen(serialized), s, serialized); - taosMemoryFree(serialized); - } -} - // ---- message process SyncRequestVote---- SyncRequestVote* syncRequestVoteBuild(int32_t vgId) { uint32_t bytes = sizeof(SyncRequestVote); @@ -1716,138 +1447,6 @@ SyncAppendEntriesBatch* syncAppendEntriesBatchFromRpcMsg2(const SRpcMsg* pRpcMsg return pMsg; } -cJSON* syncAppendEntriesBatch2Json(const SyncAppendEntriesBatch* pMsg) { - char u64buf[128] = {0}; - cJSON* pRoot = cJSON_CreateObject(); - - if (pMsg != NULL) { - cJSON_AddNumberToObject(pRoot, "bytes", pMsg->bytes); - cJSON_AddNumberToObject(pRoot, "vgId", pMsg->vgId); - cJSON_AddNumberToObject(pRoot, "msgType", pMsg->msgType); - - cJSON* pSrcId = cJSON_CreateObject(); - snprintf(u64buf, sizeof(u64buf), "%" PRIu64, pMsg->srcId.addr); - cJSON_AddStringToObject(pSrcId, "addr", u64buf); - { - uint64_t u64 = pMsg->srcId.addr; - cJSON* pTmp = pSrcId; - char host[128] = {0}; - uint16_t port; - syncUtilU642Addr(u64, host, sizeof(host), &port); - cJSON_AddStringToObject(pTmp, "addr_host", host); - cJSON_AddNumberToObject(pTmp, "addr_port", port); - } - cJSON_AddNumberToObject(pSrcId, "vgId", pMsg->srcId.vgId); - cJSON_AddItemToObject(pRoot, "srcId", pSrcId); - - cJSON* pDestId = cJSON_CreateObject(); - snprintf(u64buf, sizeof(u64buf), "%" PRIu64, pMsg->destId.addr); - cJSON_AddStringToObject(pDestId, "addr", u64buf); - { - uint64_t u64 = pMsg->destId.addr; - cJSON* pTmp = pDestId; - char host[128] = {0}; - uint16_t port; - syncUtilU642Addr(u64, host, sizeof(host), &port); - cJSON_AddStringToObject(pTmp, "addr_host", host); - cJSON_AddNumberToObject(pTmp, "addr_port", port); - } - cJSON_AddNumberToObject(pDestId, "vgId", pMsg->destId.vgId); - cJSON_AddItemToObject(pRoot, "destId", pDestId); - - snprintf(u64buf, sizeof(u64buf), "%" PRIu64, pMsg->term); - cJSON_AddStringToObject(pRoot, "term", u64buf); - - snprintf(u64buf, sizeof(u64buf), "%" PRId64, pMsg->prevLogIndex); - cJSON_AddStringToObject(pRoot, "prevLogIndex", u64buf); - - snprintf(u64buf, sizeof(u64buf), "%" PRIu64, pMsg->prevLogTerm); - cJSON_AddStringToObject(pRoot, "prevLogTerm", u64buf); - - snprintf(u64buf, sizeof(u64buf), "%" PRId64, pMsg->commitIndex); - cJSON_AddStringToObject(pRoot, "commitIndex", u64buf); - - snprintf(u64buf, sizeof(u64buf), "%" PRIu64, pMsg->privateTerm); - cJSON_AddStringToObject(pRoot, "privateTerm", u64buf); - - cJSON_AddNumberToObject(pRoot, "dataCount", pMsg->dataCount); - cJSON_AddNumberToObject(pRoot, "dataLen", pMsg->dataLen); - - int32_t metaArrayLen = sizeof(SOffsetAndContLen) * pMsg->dataCount; // - int32_t entryArrayLen = pMsg->dataLen - metaArrayLen; - - cJSON_AddNumberToObject(pRoot, "metaArrayLen", metaArrayLen); - cJSON_AddNumberToObject(pRoot, "entryArrayLen", entryArrayLen); - - SOffsetAndContLen* metaArr = (SOffsetAndContLen*)(pMsg->data); - - cJSON* pMetaArr = cJSON_CreateArray(); - cJSON_AddItemToObject(pRoot, "metaArr", pMetaArr); - for (int i = 0; i < pMsg->dataCount; ++i) { - cJSON* pMeta = cJSON_CreateObject(); - cJSON_AddNumberToObject(pMeta, "offset", metaArr[i].offset); - cJSON_AddNumberToObject(pMeta, "contLen", metaArr[i].contLen); - cJSON_AddItemToArray(pMetaArr, pMeta); - } - - cJSON* pEntryArr = cJSON_CreateArray(); - cJSON_AddItemToObject(pRoot, "entryArr", pEntryArr); - for (int i = 0; i < pMsg->dataCount; ++i) { - SSyncRaftEntry* pEntry = (SSyncRaftEntry*)(pMsg->data + metaArr[i].offset); - cJSON* pEntryJson = syncEntry2Json(pEntry); - cJSON_AddItemToArray(pEntryArr, pEntryJson); - } - - char* s; - s = syncUtilPrintBin((char*)(pMsg->data), pMsg->dataLen); - cJSON_AddStringToObject(pRoot, "data", s); - taosMemoryFree(s); - s = syncUtilPrintBin2((char*)(pMsg->data), pMsg->dataLen); - cJSON_AddStringToObject(pRoot, "data2", s); - taosMemoryFree(s); - } - - cJSON* pJson = cJSON_CreateObject(); - cJSON_AddItemToObject(pJson, "SyncAppendEntriesBatch", pRoot); - return pJson; -} - -char* syncAppendEntriesBatch2Str(const SyncAppendEntriesBatch* pMsg) { - cJSON* pJson = syncAppendEntriesBatch2Json(pMsg); - char* serialized = cJSON_Print(pJson); - cJSON_Delete(pJson); - return serialized; -} - -// for debug ---------------------- -void syncAppendEntriesBatchPrint(const SyncAppendEntriesBatch* pMsg) { - char* serialized = syncAppendEntriesBatch2Str(pMsg); - printf("syncAppendEntriesBatchPrint | len:%d | %s \n", (int32_t)strlen(serialized), serialized); - fflush(NULL); - taosMemoryFree(serialized); -} - -void syncAppendEntriesBatchPrint2(char* s, const SyncAppendEntriesBatch* pMsg) { - char* serialized = syncAppendEntriesBatch2Str(pMsg); - printf("syncAppendEntriesBatchPrint2 | len:%d | %s | %s \n", (int32_t)strlen(serialized), s, serialized); - fflush(NULL); - taosMemoryFree(serialized); -} - -void syncAppendEntriesBatchLog(const SyncAppendEntriesBatch* pMsg) { - char* serialized = syncAppendEntriesBatch2Str(pMsg); - sTrace("syncAppendEntriesBatchLog | len:%d | %s", (int32_t)strlen(serialized), serialized); - taosMemoryFree(serialized); -} - -void syncAppendEntriesBatchLog2(char* s, const SyncAppendEntriesBatch* pMsg) { - if (gRaftDetailLog) { - char* serialized = syncAppendEntriesBatch2Str(pMsg); - sLTrace("syncAppendEntriesBatchLog2 | len:%d | %s | %s", (int32_t)strlen(serialized), s, serialized); - taosMemoryFree(serialized); - } -} - // ---- message process SyncAppendEntriesReply---- SyncAppendEntriesReply* syncAppendEntriesReplyBuild(int32_t vgId) { uint32_t bytes = sizeof(SyncAppendEntriesReply); @@ -2827,118 +2426,6 @@ SyncSnapshotSend* syncSnapshotSendFromRpcMsg2(const SRpcMsg* pRpcMsg) { return pMsg; } -cJSON* syncSnapshotSend2Json(const SyncSnapshotSend* pMsg) { - char u64buf[128]; - cJSON* pRoot = cJSON_CreateObject(); - - if (pMsg != NULL) { - cJSON_AddNumberToObject(pRoot, "bytes", pMsg->bytes); - cJSON_AddNumberToObject(pRoot, "vgId", pMsg->vgId); - cJSON_AddNumberToObject(pRoot, "msgType", pMsg->msgType); - - cJSON* pSrcId = cJSON_CreateObject(); - snprintf(u64buf, sizeof(u64buf), "%" PRIu64, pMsg->srcId.addr); - cJSON_AddStringToObject(pSrcId, "addr", u64buf); - { - uint64_t u64 = pMsg->srcId.addr; - cJSON* pTmp = pSrcId; - char host[128]; - uint16_t port; - syncUtilU642Addr(u64, host, sizeof(host), &port); - cJSON_AddStringToObject(pTmp, "addr_host", host); - cJSON_AddNumberToObject(pTmp, "addr_port", port); - } - cJSON_AddNumberToObject(pSrcId, "vgId", pMsg->srcId.vgId); - cJSON_AddItemToObject(pRoot, "srcId", pSrcId); - - cJSON* pDestId = cJSON_CreateObject(); - snprintf(u64buf, sizeof(u64buf), "%" PRIu64, pMsg->destId.addr); - cJSON_AddStringToObject(pDestId, "addr", u64buf); - { - uint64_t u64 = pMsg->destId.addr; - cJSON* pTmp = pDestId; - char host[128]; - uint16_t port; - syncUtilU642Addr(u64, host, sizeof(host), &port); - cJSON_AddStringToObject(pTmp, "addr_host", host); - cJSON_AddNumberToObject(pTmp, "addr_port", port); - } - cJSON_AddNumberToObject(pDestId, "vgId", pMsg->destId.vgId); - cJSON_AddItemToObject(pRoot, "destId", pDestId); - - snprintf(u64buf, sizeof(u64buf), "%" PRIu64, pMsg->term); - cJSON_AddStringToObject(pRoot, "term", u64buf); - - snprintf(u64buf, sizeof(u64buf), "%" PRId64, pMsg->startTime); - cJSON_AddStringToObject(pRoot, "startTime", u64buf); - - snprintf(u64buf, sizeof(u64buf), "%" PRId64, pMsg->beginIndex); - cJSON_AddStringToObject(pRoot, "beginIndex", u64buf); - - snprintf(u64buf, sizeof(u64buf), "%" PRId64, pMsg->lastIndex); - cJSON_AddStringToObject(pRoot, "lastIndex", u64buf); - - snprintf(u64buf, sizeof(u64buf), "%" PRId64, pMsg->lastConfigIndex); - cJSON_AddStringToObject(pRoot, "lastConfigIndex", u64buf); - cJSON_AddItemToObject(pRoot, "lastConfig", syncCfg2Json((SSyncCfg*)&(pMsg->lastConfig))); - - snprintf(u64buf, sizeof(u64buf), "%" PRIu64, pMsg->lastTerm); - cJSON_AddStringToObject(pRoot, "lastTerm", u64buf); - - cJSON_AddNumberToObject(pRoot, "seq", pMsg->seq); - - cJSON_AddNumberToObject(pRoot, "dataLen", pMsg->dataLen); - char* s; - s = syncUtilPrintBin((char*)(pMsg->data), pMsg->dataLen); - cJSON_AddStringToObject(pRoot, "data", s); - taosMemoryFree(s); - s = syncUtilPrintBin2((char*)(pMsg->data), pMsg->dataLen); - cJSON_AddStringToObject(pRoot, "data2", s); - taosMemoryFree(s); - } - - cJSON* pJson = cJSON_CreateObject(); - cJSON_AddItemToObject(pJson, "SyncSnapshotSend", pRoot); - return pJson; -} - -char* syncSnapshotSend2Str(const SyncSnapshotSend* pMsg) { - cJSON* pJson = syncSnapshotSend2Json(pMsg); - char* serialized = cJSON_Print(pJson); - cJSON_Delete(pJson); - return serialized; -} - -// for debug ---------------------- -void syncSnapshotSendPrint(const SyncSnapshotSend* pMsg) { - char* serialized = syncSnapshotSend2Str(pMsg); - printf("syncSnapshotSendPrint | len:%d | %s \n", (int32_t)strlen(serialized), serialized); - fflush(NULL); - taosMemoryFree(serialized); -} - -void syncSnapshotSendPrint2(char* s, const SyncSnapshotSend* pMsg) { - char* serialized = syncSnapshotSend2Str(pMsg); - printf("syncSnapshotSendPrint2 | len:%d | %s | %s \n", (int32_t)strlen(serialized), s, serialized); - fflush(NULL); - taosMemoryFree(serialized); -} - -void syncSnapshotSendLog(const SyncSnapshotSend* pMsg) { - char* serialized = syncSnapshotSend2Str(pMsg); - sTrace("syncSnapshotSendLog | len:%d | %s", (int32_t)strlen(serialized), serialized); - taosMemoryFree(serialized); -} - -void syncSnapshotSendLog2(char* s, const SyncSnapshotSend* pMsg) { - if (gRaftDetailLog) { - char* serialized = syncSnapshotSend2Str(pMsg); - sTrace("syncSnapshotSendLog2 | len:%d | %s | %s", (int32_t)strlen(serialized), s, serialized); - taosMemoryFree(serialized); - } -} - -// --------------------------------------------- SyncSnapshotRsp* syncSnapshotRspBuild(int32_t vgId) { uint32_t bytes = sizeof(SyncSnapshotRsp); SyncSnapshotRsp* pMsg = taosMemoryMalloc(bytes); diff --git a/source/libs/sync/src/syncRaftEntry.c b/source/libs/sync/src/syncRaftEntry.c index 520ecd95db..262a7b0879 100644 --- a/source/libs/sync/src/syncRaftEntry.c +++ b/source/libs/sync/src/syncRaftEntry.c @@ -13,31 +13,29 @@ * along with this program. If not, see . */ +#define _DEFAULT_SOURCE #include "syncRaftEntry.h" #include "syncUtil.h" +#include "tref.h" -SSyncRaftEntry* syncEntryBuild(uint32_t dataLen) { - uint32_t bytes = sizeof(SSyncRaftEntry) + dataLen; +SSyncRaftEntry* syncEntryBuild(int32_t dataLen) { + int32_t bytes = sizeof(SSyncRaftEntry) + dataLen; SSyncRaftEntry* pEntry = taosMemoryMalloc(bytes); - ASSERT(pEntry != NULL); - memset(pEntry, 0, bytes); + if (pEntry == NULL) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + return NULL; + } + pEntry->bytes = bytes; pEntry->dataLen = dataLen; pEntry->rid = -1; - return pEntry; -} - -// step 4. SyncClientRequest => SSyncRaftEntry, add term, index -SSyncRaftEntry* syncEntryBuild2(SyncClientRequest* pMsg, SyncTerm term, SyncIndex index) { - SSyncRaftEntry* pEntry = syncEntryBuild3(pMsg, term, index); - ASSERT(pEntry != NULL); return pEntry; } -SSyncRaftEntry* syncEntryBuild3(SyncClientRequest* pMsg, SyncTerm term, SyncIndex index) { +SSyncRaftEntry* syncEntryBuildFromClientRequest(const SyncClientRequest* pMsg, SyncTerm term, SyncIndex index) { SSyncRaftEntry* pEntry = syncEntryBuild(pMsg->dataLen); - ASSERT(pEntry != NULL); + if (pEntry == NULL) return NULL; pEntry->msgType = pMsg->msgType; pEntry->originalRpcType = pMsg->originalRpcType; @@ -45,42 +43,37 @@ SSyncRaftEntry* syncEntryBuild3(SyncClientRequest* pMsg, SyncTerm term, SyncInde pEntry->isWeak = pMsg->isWeak; pEntry->term = term; pEntry->index = index; - pEntry->dataLen = pMsg->dataLen; memcpy(pEntry->data, pMsg->data, pMsg->dataLen); return pEntry; } -SSyncRaftEntry* syncEntryBuild4(SRpcMsg* pOriginalMsg, SyncTerm term, SyncIndex index) { - SSyncRaftEntry* pEntry = syncEntryBuild(pOriginalMsg->contLen); - ASSERT(pEntry != NULL); +SSyncRaftEntry* syncEntryBuildFromRpcMsg(const SRpcMsg* pMsg, SyncTerm term, SyncIndex index) { + SSyncRaftEntry* pEntry = syncEntryBuild(pMsg->contLen); + if (pEntry == NULL) return NULL; pEntry->msgType = TDMT_SYNC_CLIENT_REQUEST; - pEntry->originalRpcType = pOriginalMsg->msgType; + pEntry->originalRpcType = pMsg->msgType; pEntry->seqNum = 0; pEntry->isWeak = 0; pEntry->term = term; pEntry->index = index; - pEntry->dataLen = pOriginalMsg->contLen; - memcpy(pEntry->data, pOriginalMsg->pCont, pOriginalMsg->contLen); + memcpy(pEntry->data, pMsg->pCont, pMsg->contLen); return pEntry; } -SSyncRaftEntry* syncEntryBuildNoop(SyncTerm term, SyncIndex index, int32_t vgId) { - // init rpcMsg - SMsgHead head; - head.vgId = vgId; - head.contLen = sizeof(SMsgHead); - SRpcMsg rpcMsg; - memset(&rpcMsg, 0, sizeof(SRpcMsg)); - rpcMsg.contLen = head.contLen; - rpcMsg.pCont = rpcMallocCont(rpcMsg.contLen); - rpcMsg.msgType = TDMT_SYNC_NOOP; - memcpy(rpcMsg.pCont, &head, sizeof(head)); +SSyncRaftEntry* syncEntryBuildFromAppendEntries(const SyncAppendEntries* pMsg) { + SSyncRaftEntry* pEntry = syncEntryBuild(pMsg->dataLen); + if (pEntry == NULL) return NULL; - SSyncRaftEntry* pEntry = syncEntryBuild(rpcMsg.contLen); - ASSERT(pEntry != NULL); + memcpy(pEntry, pMsg->data, pMsg->dataLen); + return pEntry; +} + +SSyncRaftEntry* syncEntryBuildNoop(SyncTerm term, SyncIndex index, int32_t vgId) { + SSyncRaftEntry* pEntry = syncEntryBuild(sizeof(SMsgHead)); + if (pEntry == NULL) return NULL; pEntry->msgType = TDMT_SYNC_CLIENT_REQUEST; pEntry->originalRpcType = TDMT_SYNC_NOOP; @@ -89,9 +82,9 @@ SSyncRaftEntry* syncEntryBuildNoop(SyncTerm term, SyncIndex index, int32_t vgId) pEntry->term = term; pEntry->index = index; - ASSERT(pEntry->dataLen == rpcMsg.contLen); - memcpy(pEntry->data, rpcMsg.pCont, rpcMsg.contLen); - rpcFreeCont(rpcMsg.pCont); + SMsgHead* pHead = (SMsgHead*)pEntry->data; + pHead->vgId = vgId; + pHead->contLen = sizeof(SMsgHead); return pEntry; } @@ -102,104 +95,13 @@ void syncEntryDestory(SSyncRaftEntry* pEntry) { } } -// step 5. SSyncRaftEntry => bin, to raft log -char* syncEntrySerialize(const SSyncRaftEntry* pEntry, uint32_t* len) { - char* buf = taosMemoryMalloc(pEntry->bytes); - ASSERT(buf != NULL); - memcpy(buf, pEntry, pEntry->bytes); - if (len != NULL) { - *len = pEntry->bytes; - } - return buf; -} - -// step 6. bin => SSyncRaftEntry, from raft log -SSyncRaftEntry* syncEntryDeserialize(const char* buf, uint32_t len) { - uint32_t bytes = *((uint32_t*)buf); - SSyncRaftEntry* pEntry = taosMemoryMalloc(bytes); - ASSERT(pEntry != NULL); - memcpy(pEntry, buf, len); - ASSERT(len == pEntry->bytes); - return pEntry; -} - -cJSON* syncEntry2Json(const SSyncRaftEntry* pEntry) { - char u64buf[128] = {0}; - cJSON* pRoot = cJSON_CreateObject(); - - if (pEntry != NULL) { - cJSON_AddNumberToObject(pRoot, "bytes", pEntry->bytes); - cJSON_AddNumberToObject(pRoot, "msgType", pEntry->msgType); - cJSON_AddNumberToObject(pRoot, "originalRpcType", pEntry->originalRpcType); - snprintf(u64buf, sizeof(u64buf), "%" PRIu64, pEntry->seqNum); - cJSON_AddStringToObject(pRoot, "seqNum", u64buf); - cJSON_AddNumberToObject(pRoot, "isWeak", pEntry->isWeak); - snprintf(u64buf, sizeof(u64buf), "%" PRIu64, pEntry->term); - cJSON_AddStringToObject(pRoot, "term", u64buf); - snprintf(u64buf, sizeof(u64buf), "%" PRIu64, pEntry->index); - cJSON_AddStringToObject(pRoot, "index", u64buf); - snprintf(u64buf, sizeof(u64buf), "%" PRIu64, pEntry->rid); - cJSON_AddStringToObject(pRoot, "rid", u64buf); - cJSON_AddNumberToObject(pRoot, "dataLen", pEntry->dataLen); - - char* s; - s = syncUtilPrintBin((char*)(pEntry->data), pEntry->dataLen); - cJSON_AddStringToObject(pRoot, "data", s); - taosMemoryFree(s); - - s = syncUtilPrintBin2((char*)(pEntry->data), pEntry->dataLen); - cJSON_AddStringToObject(pRoot, "data2", s); - taosMemoryFree(s); - } - - cJSON* pJson = cJSON_CreateObject(); - cJSON_AddItemToObject(pJson, "SSyncRaftEntry", pRoot); - return pJson; -} - -char* syncEntry2Str(const SSyncRaftEntry* pEntry) { - cJSON* pJson = syncEntry2Json(pEntry); - char* serialized = cJSON_Print(pJson); - cJSON_Delete(pJson); - return serialized; -} - -// step 7. SSyncRaftEntry => original SRpcMsg, commit to user, delete seqNum, isWeak, term, index void syncEntry2OriginalRpc(const SSyncRaftEntry* pEntry, SRpcMsg* pRpcMsg) { - memset(pRpcMsg, 0, sizeof(*pRpcMsg)); pRpcMsg->msgType = pEntry->originalRpcType; pRpcMsg->contLen = pEntry->dataLen; pRpcMsg->pCont = rpcMallocCont(pRpcMsg->contLen); memcpy(pRpcMsg->pCont, pEntry->data, pRpcMsg->contLen); } -// for debug ---------------------- -void syncEntryPrint(const SSyncRaftEntry* pObj) { - char* serialized = syncEntry2Str(pObj); - printf("syncEntryPrint | len:%zu | %s \n", strlen(serialized), serialized); - fflush(NULL); - taosMemoryFree(serialized); -} - -void syncEntryPrint2(char* s, const SSyncRaftEntry* pObj) { - char* serialized = syncEntry2Str(pObj); - printf("syncEntryPrint2 | len:%zu | %s | %s \n", strlen(serialized), s, serialized); - fflush(NULL); - taosMemoryFree(serialized); -} - -void syncEntryLog(const SSyncRaftEntry* pObj) { - char* serialized = syncEntry2Str(pObj); - sTrace("syncEntryLog | len:%zu | %s", strlen(serialized), serialized); - taosMemoryFree(serialized); -} - -void syncEntryLog2(char* s, const SSyncRaftEntry* pObj) { - char* serialized = syncEntry2Str(pObj); - sTrace("syncEntryLog2 | len:%zu | %s | %s", strlen(serialized), s, serialized); - taosMemoryFree(serialized); -} - //----------------------------------- SRaftEntryHashCache* raftCacheCreate(SSyncNode* pSyncNode, int32_t maxCount) { SRaftEntryHashCache* pCache = taosMemoryMalloc(sizeof(SRaftEntryHashCache)); @@ -354,76 +256,6 @@ int32_t raftCacheClear(struct SRaftEntryHashCache* pCache) { return 0; } -//----------------------------------- -cJSON* raftCache2Json(SRaftEntryHashCache* pCache) { - char u64buf[128] = {0}; - cJSON* pRoot = cJSON_CreateObject(); - - if (pCache != NULL) { - taosThreadMutexLock(&pCache->mutex); - - snprintf(u64buf, sizeof(u64buf), "%p", pCache->pSyncNode); - cJSON_AddStringToObject(pRoot, "pSyncNode", u64buf); - cJSON_AddNumberToObject(pRoot, "currentCount", pCache->currentCount); - cJSON_AddNumberToObject(pRoot, "maxCount", pCache->maxCount); - cJSON* pEntries = cJSON_CreateArray(); - cJSON_AddItemToObject(pRoot, "entries", pEntries); - - SSyncRaftEntry* pIter = (SSyncRaftEntry*)taosHashIterate(pCache->pEntryHash, NULL); - if (pIter != NULL) { - SSyncRaftEntry* pEntry = (SSyncRaftEntry*)pIter; - cJSON_AddItemToArray(pEntries, syncEntry2Json(pEntry)); - } - while (pIter) { - pIter = taosHashIterate(pCache->pEntryHash, pIter); - if (pIter != NULL) { - SSyncRaftEntry* pEntry = (SSyncRaftEntry*)pIter; - cJSON_AddItemToArray(pEntries, syncEntry2Json(pEntry)); - } - } - - taosThreadMutexUnlock(&pCache->mutex); - } - - cJSON* pJson = cJSON_CreateObject(); - cJSON_AddItemToObject(pJson, "SRaftEntryHashCache", pRoot); - return pJson; -} - -char* raftCache2Str(SRaftEntryHashCache* pCache) { - cJSON* pJson = raftCache2Json(pCache); - char* serialized = cJSON_Print(pJson); - cJSON_Delete(pJson); - return serialized; -} - -void raftCachePrint(SRaftEntryHashCache* pCache) { - char* serialized = raftCache2Str(pCache); - printf("raftCachePrint | len:%d | %s \n", (int32_t)strlen(serialized), serialized); - fflush(NULL); - taosMemoryFree(serialized); -} - -void raftCachePrint2(char* s, SRaftEntryHashCache* pCache) { - char* serialized = raftCache2Str(pCache); - printf("raftCachePrint2 | len:%d | %s | %s \n", (int32_t)strlen(serialized), s, serialized); - fflush(NULL); - taosMemoryFree(serialized); -} - -void raftCacheLog(SRaftEntryHashCache* pCache) { - char* serialized = raftCache2Str(pCache); - sTrace("raftCacheLog | len:%d | %s", (int32_t)strlen(serialized), serialized); - taosMemoryFree(serialized); -} - -void raftCacheLog2(char* s, SRaftEntryHashCache* pCache) { - if (gRaftDetailLog) { - char* serialized = raftCache2Str(pCache); - sLTrace("raftCacheLog2 | len:%d | %s | %s", (int32_t)strlen(serialized), s, serialized); - taosMemoryFree(serialized); - } -} //----------------------------------- static char* keyFn(const void* pData) { @@ -612,69 +444,3 @@ int32_t raftEntryCacheClear(struct SRaftEntryCache* pCache, int32_t count) { taosThreadMutexUnlock(&pCache->mutex); return returnCnt; } - -cJSON* raftEntryCache2Json(SRaftEntryCache* pCache) { - char u64buf[128] = {0}; - cJSON* pRoot = cJSON_CreateObject(); - - if (pCache != NULL) { - taosThreadMutexLock(&pCache->mutex); - - snprintf(u64buf, sizeof(u64buf), "%p", pCache->pSyncNode); - cJSON_AddStringToObject(pRoot, "pSyncNode", u64buf); - cJSON_AddNumberToObject(pRoot, "currentCount", pCache->currentCount); - cJSON_AddNumberToObject(pRoot, "maxCount", pCache->maxCount); - cJSON* pEntries = cJSON_CreateArray(); - cJSON_AddItemToObject(pRoot, "entries", pEntries); - - SSkipListIterator* pIter = tSkipListCreateIter(pCache->pSkipList); - while (tSkipListIterNext(pIter)) { - SSkipListNode* pNode = tSkipListIterGet(pIter); - ASSERT(pNode != NULL); - SSyncRaftEntry* pEntry = (SSyncRaftEntry*)SL_GET_NODE_DATA(pNode); - cJSON_AddItemToArray(pEntries, syncEntry2Json(pEntry)); - } - tSkipListDestroyIter(pIter); - - taosThreadMutexUnlock(&pCache->mutex); - } - - cJSON* pJson = cJSON_CreateObject(); - cJSON_AddItemToObject(pJson, "SRaftEntryCache", pRoot); - return pJson; -} - -char* raftEntryCache2Str(SRaftEntryCache* pObj) { - cJSON* pJson = raftEntryCache2Json(pObj); - char* serialized = cJSON_Print(pJson); - cJSON_Delete(pJson); - return serialized; -} - -void raftEntryCachePrint(SRaftEntryCache* pObj) { - char* serialized = raftEntryCache2Str(pObj); - printf("raftEntryCachePrint | len:%d | %s \n", (int32_t)strlen(serialized), serialized); - fflush(NULL); - taosMemoryFree(serialized); -} - -void raftEntryCachePrint2(char* s, SRaftEntryCache* pObj) { - char* serialized = raftEntryCache2Str(pObj); - printf("raftEntryCachePrint2 | len:%d | %s | %s \n", (int32_t)strlen(serialized), s, serialized); - fflush(NULL); - taosMemoryFree(serialized); -} - -void raftEntryCacheLog(SRaftEntryCache* pObj) { - char* serialized = raftEntryCache2Str(pObj); - sTrace("raftEntryCacheLog | len:%d | %s", (int32_t)strlen(serialized), serialized); - taosMemoryFree(serialized); -} - -void raftEntryCacheLog2(char* s, SRaftEntryCache* pObj) { - if (gRaftDetailLog) { - char* serialized = raftEntryCache2Str(pObj); - sLTrace("raftEntryCacheLog2 | len:%d | %s | %s", (int32_t)strlen(serialized), s, serialized); - taosMemoryFree(serialized); - } -} diff --git a/source/libs/sync/src/syncRaftLog.c b/source/libs/sync/src/syncRaftLog.c index 7b1158319e..d4a1d35c74 100644 --- a/source/libs/sync/src/syncRaftLog.c +++ b/source/libs/sync/src/syncRaftLog.c @@ -22,15 +22,8 @@ // public function static int32_t raftLogRestoreFromSnapshot(struct SSyncLogStore* pLogStore, SyncIndex snapshotIndex); -static SyncIndex raftLogBeginIndex(struct SSyncLogStore* pLogStore); -static SyncIndex raftLogEndIndex(struct SSyncLogStore* pLogStore); -static SyncIndex raftLogWriteIndex(struct SSyncLogStore* pLogStore); -static bool raftLogIsEmpty(struct SSyncLogStore* pLogStore); -static int32_t raftLogEntryCount(struct SSyncLogStore* pLogStore); -static SyncIndex raftLogLastIndex(struct SSyncLogStore* pLogStore); -static SyncTerm raftLogLastTerm(struct SSyncLogStore* pLogStore); + static int32_t raftLogAppendEntry(struct SSyncLogStore* pLogStore, SSyncRaftEntry* pEntry); -static int32_t raftLogGetEntry(struct SSyncLogStore* pLogStore, SyncIndex index, SSyncRaftEntry** ppEntry); static int32_t raftLogTruncate(struct SSyncLogStore* pLogStore, SyncIndex fromIndex); static bool raftLogExist(struct SSyncLogStore* pLogStore, SyncIndex index); static int32_t raftLogUpdateCommitIndex(SSyncLogStore* pLogStore, SyncIndex index); @@ -126,29 +119,29 @@ static int32_t raftLogRestoreFromSnapshot(struct SSyncLogStore* pLogStore, SyncI return 0; } -static SyncIndex raftLogBeginIndex(struct SSyncLogStore* pLogStore) { +SyncIndex raftLogBeginIndex(struct SSyncLogStore* pLogStore) { SSyncLogStoreData* pData = pLogStore->data; SWal* pWal = pData->pWal; SyncIndex firstVer = walGetFirstVer(pWal); return firstVer; } -static SyncIndex raftLogEndIndex(struct SSyncLogStore* pLogStore) { return raftLogLastIndex(pLogStore); } +SyncIndex raftLogEndIndex(struct SSyncLogStore* pLogStore) { return raftLogLastIndex(pLogStore); } -static bool raftLogIsEmpty(struct SSyncLogStore* pLogStore) { +bool raftLogIsEmpty(struct SSyncLogStore* pLogStore) { SSyncLogStoreData* pData = pLogStore->data; SWal* pWal = pData->pWal; return walIsEmpty(pWal); } -static int32_t raftLogEntryCount(struct SSyncLogStore* pLogStore) { +int32_t raftLogEntryCount(struct SSyncLogStore* pLogStore) { SyncIndex beginIndex = raftLogBeginIndex(pLogStore); SyncIndex endIndex = raftLogEndIndex(pLogStore); int32_t count = endIndex - beginIndex + 1; return count > 0 ? count : 0; } -static SyncIndex raftLogLastIndex(struct SSyncLogStore* pLogStore) { +SyncIndex raftLogLastIndex(struct SSyncLogStore* pLogStore) { SyncIndex lastIndex; SSyncLogStoreData* pData = pLogStore->data; SWal* pWal = pData->pWal; @@ -157,7 +150,7 @@ static SyncIndex raftLogLastIndex(struct SSyncLogStore* pLogStore) { return lastVer; } -static SyncIndex raftLogWriteIndex(struct SSyncLogStore* pLogStore) { +SyncIndex raftLogWriteIndex(struct SSyncLogStore* pLogStore) { SSyncLogStoreData* pData = pLogStore->data; SWal* pWal = pData->pWal; SyncIndex lastVer = walGetLastVer(pWal); @@ -174,7 +167,7 @@ static bool raftLogExist(struct SSyncLogStore* pLogStore, SyncIndex index) { // if success, return last term // if not log, return 0 // if error, return SYNC_TERM_INVALID -static SyncTerm raftLogLastTerm(struct SSyncLogStore* pLogStore) { +SyncTerm raftLogLastTerm(struct SSyncLogStore* pLogStore) { SSyncLogStoreData* pData = pLogStore->data; SWal* pWal = pData->pWal; if (walIsEmpty(pWal)) { @@ -225,7 +218,7 @@ static int32_t raftLogAppendEntry(struct SSyncLogStore* pLogStore, SSyncRaftEntr // entry found, return 0 // entry not found, return -1, terrno = TSDB_CODE_WAL_LOG_NOT_EXIST // other error, return -1 -static int32_t raftLogGetEntry(struct SSyncLogStore* pLogStore, SyncIndex index, SSyncRaftEntry** ppEntry) { +int32_t raftLogGetEntry(struct SSyncLogStore* pLogStore, SyncIndex index, SSyncRaftEntry** ppEntry) { SSyncLogStoreData* pData = pLogStore->data; SWal* pWal = pData->pWal; int32_t code = 0; @@ -370,111 +363,6 @@ SyncIndex raftlogCommitIndex(SSyncLogStore* pLogStore) { return pData->pSyncNode->commitIndex; } -cJSON* logStore2Json(SSyncLogStore* pLogStore) { - char u64buf[128] = {0}; - SSyncLogStoreData* pData = (SSyncLogStoreData*)pLogStore->data; - cJSON* pRoot = cJSON_CreateObject(); - - if (pData != NULL && pData->pWal != NULL) { - snprintf(u64buf, sizeof(u64buf), "%p", pData->pSyncNode); - cJSON_AddStringToObject(pRoot, "pSyncNode", u64buf); - snprintf(u64buf, sizeof(u64buf), "%p", pData->pWal); - cJSON_AddStringToObject(pRoot, "pWal", u64buf); - - SyncIndex beginIndex = raftLogBeginIndex(pLogStore); - snprintf(u64buf, sizeof(u64buf), "%" PRId64, beginIndex); - cJSON_AddStringToObject(pRoot, "beginIndex", u64buf); - - SyncIndex endIndex = raftLogEndIndex(pLogStore); - snprintf(u64buf, sizeof(u64buf), "%" PRId64, endIndex); - cJSON_AddStringToObject(pRoot, "endIndex", u64buf); - - int32_t count = raftLogEntryCount(pLogStore); - cJSON_AddNumberToObject(pRoot, "entryCount", count); - - snprintf(u64buf, sizeof(u64buf), "%" PRId64, raftLogWriteIndex(pLogStore)); - cJSON_AddStringToObject(pRoot, "WriteIndex", u64buf); - - snprintf(u64buf, sizeof(u64buf), "%d", raftLogIsEmpty(pLogStore)); - cJSON_AddStringToObject(pRoot, "IsEmpty", u64buf); - - snprintf(u64buf, sizeof(u64buf), "%" PRId64, raftLogLastIndex(pLogStore)); - cJSON_AddStringToObject(pRoot, "LastIndex", u64buf); - snprintf(u64buf, sizeof(u64buf), "%" PRIu64, raftLogLastTerm(pLogStore)); - cJSON_AddStringToObject(pRoot, "LastTerm", u64buf); - - cJSON* pEntries = cJSON_CreateArray(); - cJSON_AddItemToObject(pRoot, "pEntries", pEntries); - - if (!raftLogIsEmpty(pLogStore)) { - for (SyncIndex i = beginIndex; i <= endIndex; ++i) { - SSyncRaftEntry* pEntry = NULL; - raftLogGetEntry(pLogStore, i, &pEntry); - - cJSON_AddItemToArray(pEntries, syncEntry2Json(pEntry)); - syncEntryDestory(pEntry); - } - } - } - - cJSON* pJson = cJSON_CreateObject(); - cJSON_AddItemToObject(pJson, "SSyncLogStore", pRoot); - return pJson; -} - -char* logStore2Str(SSyncLogStore* pLogStore) { - cJSON* pJson = logStore2Json(pLogStore); - char* serialized = cJSON_Print(pJson); - cJSON_Delete(pJson); - return serialized; -} - -cJSON* logStoreSimple2Json(SSyncLogStore* pLogStore) { - char u64buf[128] = {0}; - SSyncLogStoreData* pData = (SSyncLogStoreData*)pLogStore->data; - cJSON* pRoot = cJSON_CreateObject(); - - if (pData != NULL && pData->pWal != NULL) { - snprintf(u64buf, sizeof(u64buf), "%p", pData->pSyncNode); - cJSON_AddStringToObject(pRoot, "pSyncNode", u64buf); - snprintf(u64buf, sizeof(u64buf), "%p", pData->pWal); - cJSON_AddStringToObject(pRoot, "pWal", u64buf); - - SyncIndex beginIndex = raftLogBeginIndex(pLogStore); - snprintf(u64buf, sizeof(u64buf), "%" PRId64, beginIndex); - cJSON_AddStringToObject(pRoot, "beginIndex", u64buf); - - SyncIndex endIndex = raftLogEndIndex(pLogStore); - snprintf(u64buf, sizeof(u64buf), "%" PRId64, endIndex); - cJSON_AddStringToObject(pRoot, "endIndex", u64buf); - - int32_t count = raftLogEntryCount(pLogStore); - cJSON_AddNumberToObject(pRoot, "entryCount", count); - - snprintf(u64buf, sizeof(u64buf), "%" PRId64, raftLogWriteIndex(pLogStore)); - cJSON_AddStringToObject(pRoot, "WriteIndex", u64buf); - - snprintf(u64buf, sizeof(u64buf), "%d", raftLogIsEmpty(pLogStore)); - cJSON_AddStringToObject(pRoot, "IsEmpty", u64buf); - - snprintf(u64buf, sizeof(u64buf), "%" PRId64, raftLogLastIndex(pLogStore)); - cJSON_AddStringToObject(pRoot, "LastIndex", u64buf); - snprintf(u64buf, sizeof(u64buf), "%" PRIu64, raftLogLastTerm(pLogStore)); - cJSON_AddStringToObject(pRoot, "LastTerm", u64buf); - } - - cJSON* pJson = cJSON_CreateObject(); - cJSON_AddItemToObject(pJson, "SSyncLogStoreSimple", pRoot); - return pJson; -} - -char* logStoreSimple2Str(SSyncLogStore* pLogStore) { - cJSON* pJson = logStoreSimple2Json(pLogStore); - char* serialized = cJSON_Print(pJson); - cJSON_Delete(pJson); - return serialized; -} - SyncIndex logStoreFirstIndex(SSyncLogStore* pLogStore) { SSyncLogStoreData* pData = pLogStore->data; SWal* pWal = pData->pWal; @@ -486,63 +374,3 @@ SyncIndex logStoreWalCommitVer(SSyncLogStore* pLogStore) { SWal* pWal = pData->pWal; return walGetCommittedVer(pWal); } - -// for debug ----------------- -void logStorePrint(SSyncLogStore* pLogStore) { - char* serialized = logStore2Str(pLogStore); - printf("logStorePrint | len:%d | %s \n", (int32_t)strlen(serialized), serialized); - fflush(NULL); - taosMemoryFree(serialized); -} - -void logStorePrint2(char* s, SSyncLogStore* pLogStore) { - char* serialized = logStore2Str(pLogStore); - printf("logStorePrint2 | len:%d | %s | %s \n", (int32_t)strlen(serialized), s, serialized); - fflush(NULL); - taosMemoryFree(serialized); -} - -void logStoreLog(SSyncLogStore* pLogStore) { - if (gRaftDetailLog) { - char* serialized = logStore2Str(pLogStore); - sLTrace("logStoreLog | len:%d | %s", (int32_t)strlen(serialized), serialized); - taosMemoryFree(serialized); - } -} - -void logStoreLog2(char* s, SSyncLogStore* pLogStore) { - if (gRaftDetailLog) { - char* serialized = logStore2Str(pLogStore); - sLTrace("logStoreLog2 | len:%d | %s | %s", (int32_t)strlen(serialized), s, serialized); - taosMemoryFree(serialized); - } -} - -// for debug ----------------- -void logStoreSimplePrint(SSyncLogStore* pLogStore) { - char* serialized = logStoreSimple2Str(pLogStore); - printf("logStoreSimplePrint | len:%d | %s \n", (int32_t)strlen(serialized), serialized); - fflush(NULL); - taosMemoryFree(serialized); -} - -void logStoreSimplePrint2(char* s, SSyncLogStore* pLogStore) { - char* serialized = logStoreSimple2Str(pLogStore); - printf("logStoreSimplePrint2 | len:%d | %s | %s \n", (int32_t)strlen(serialized), s, serialized); - fflush(NULL); - taosMemoryFree(serialized); -} - -void logStoreSimpleLog(SSyncLogStore* pLogStore) { - char* serialized = logStoreSimple2Str(pLogStore); - sTrace("logStoreSimpleLog | len:%d | %s", (int32_t)strlen(serialized), serialized); - taosMemoryFree(serialized); -} - -void logStoreSimpleLog2(char* s, SSyncLogStore* pLogStore) { - if (gRaftDetailLog) { - char* serialized = logStoreSimple2Str(pLogStore); - sTrace("logStoreSimpleLog2 | len:%d | %s | %s", (int32_t)strlen(serialized), s, serialized); - taosMemoryFree(serialized); - } -} diff --git a/source/libs/sync/src/syncReplication.c b/source/libs/sync/src/syncReplication.c index 7b4ef63406..882a4764f7 100644 --- a/source/libs/sync/src/syncReplication.c +++ b/source/libs/sync/src/syncReplication.c @@ -48,19 +48,20 @@ // mdest |-> j]) // /\ UNCHANGED <> -int32_t syncNodeReplicateOne(SSyncNode* pSyncNode, SRaftId* pDestId) { +int32_t syncNodeReplicateOne(SSyncNode* pSyncNode, SRaftId* pDestId, bool snapshot) { // next index SyncIndex nextIndex = syncIndexMgrGetIndex(pSyncNode->pNextIndex, pDestId); - // maybe start snapshot - SyncIndex logStartIndex = pSyncNode->pLogStore->syncLogBeginIndex(pSyncNode->pLogStore); - SyncIndex logEndIndex = pSyncNode->pLogStore->syncLogEndIndex(pSyncNode->pLogStore); - if (nextIndex < logStartIndex || nextIndex - 1 > logEndIndex) { - sNTrace(pSyncNode, "maybe start snapshot for next-index:%" PRId64 ", start:%" PRId64 ", end:%" PRId64, nextIndex, - logStartIndex, logEndIndex); - // start snapshot - // int32_t code = syncNodeStartSnapshot(pSyncNode, pDestId); - return 0; + if (snapshot) { + // maybe start snapshot + SyncIndex logStartIndex = pSyncNode->pLogStore->syncLogBeginIndex(pSyncNode->pLogStore); + SyncIndex logEndIndex = pSyncNode->pLogStore->syncLogEndIndex(pSyncNode->pLogStore); + if (nextIndex < logStartIndex || nextIndex - 1 > logEndIndex) { + sNTrace(pSyncNode, "maybe start snapshot for next-index:%" PRId64 ", start:%" PRId64 ", end:%" PRId64, nextIndex, + logStartIndex, logEndIndex); + // start snapshot + int32_t code = syncNodeStartSnapshot(pSyncNode, pDestId); + } } // pre index, pre term @@ -78,14 +79,7 @@ int32_t syncNodeReplicateOne(SSyncNode* pSyncNode, SRaftId* pDestId) { pMsg = syncAppendEntriesBuild(pEntry->bytes, pSyncNode->vgId); ASSERT(pMsg != NULL); - - // add pEntry into msg - uint32_t len; - char* serialized = syncEntrySerialize(pEntry, &len); - ASSERT(len == pEntry->bytes); - memcpy(pMsg->data, serialized, len); - - taosMemoryFree(serialized); + memcpy(pMsg->data, pEntry, pEntry->bytes); syncEntryDestory(pEntry); } else { @@ -135,7 +129,7 @@ int32_t syncNodeReplicate(SSyncNode* pSyncNode) { int32_t ret = 0; for (int i = 0; i < pSyncNode->peersNum; ++i) { SRaftId* pDestId = &(pSyncNode->peersId[i]); - ret = syncNodeReplicateOne(pSyncNode, pDestId); + ret = syncNodeReplicateOne(pSyncNode, pDestId, true); if (ret != 0) { char host[64]; int16_t port; diff --git a/source/libs/sync/src/syncSnapshot.c b/source/libs/sync/src/syncSnapshot.c index 78413bbeff..e8c5ced5bb 100644 --- a/source/libs/sync/src/syncSnapshot.c +++ b/source/libs/sync/src/syncSnapshot.c @@ -13,33 +13,26 @@ * along with this program. If not, see . */ +#define _DEFAULT_SOURCE #include "syncSnapshot.h" #include "syncIndexMgr.h" #include "syncRaftCfg.h" #include "syncRaftLog.h" #include "syncRaftStore.h" +#include "syncReplication.h" #include "syncUtil.h" -#include "wal.h" -//---------------------------------- -static void snapshotSenderUpdateProgress(SSyncSnapshotSender *pSender, SyncSnapshotRsp *pMsg); -static void snapshotReceiverDoStart(SSyncSnapshotReceiver *pReceiver, SyncSnapshotSend *pBeginMsg); -static void snapshotReceiverGotData(SSyncSnapshotReceiver *pReceiver, SyncSnapshotSend *pMsg); -static int32_t snapshotReceiverFinish(SSyncSnapshotReceiver *pReceiver, SyncSnapshotSend *pMsg); - -//---------------------------------- SSyncSnapshotSender *snapshotSenderCreate(SSyncNode *pSyncNode, int32_t replicaIndex) { bool condition = (pSyncNode->pFsm->FpSnapshotStartRead != NULL) && (pSyncNode->pFsm->FpSnapshotStopRead != NULL) && (pSyncNode->pFsm->FpSnapshotDoRead != NULL); SSyncSnapshotSender *pSender = NULL; if (condition) { - pSender = taosMemoryMalloc(sizeof(SSyncSnapshotSender)); + pSender = taosMemoryCalloc(1, sizeof(SSyncSnapshotSender)); if (pSender == NULL) { terrno = TSDB_CODE_OUT_OF_MEMORY; return NULL; } - memset(pSender, 0, sizeof(*pSender)); pSender->start = false; pSender->seq = SYNC_SNAPSHOT_SEQ_INVALID; @@ -127,6 +120,7 @@ int32_t snapshotSenderStart(SSyncSnapshotSender *pSender) { SRpcMsg rpcMsg; syncSnapshotSend2RpcMsg(pMsg, &rpcMsg); syncNodeSendMsgById(&(pMsg->destId), pSender->pSyncNode, &rpcMsg); + syncLogSendSyncSnapshotSend(pSender->pSyncNode, pMsg, ""); syncSnapshotSendDestroy(pMsg); // event log @@ -199,6 +193,7 @@ int32_t snapshotSend(SSyncSnapshotSender *pSender) { SRpcMsg rpcMsg; syncSnapshotSend2RpcMsg(pMsg, &rpcMsg); syncNodeSendMsgById(&(pMsg->destId), pSender->pSyncNode, &rpcMsg); + syncLogSendSyncSnapshotSend(pSender->pSyncNode, pMsg, ""); syncSnapshotSendDestroy(pMsg); // event log @@ -234,6 +229,7 @@ int32_t snapshotReSend(SSyncSnapshotSender *pSender) { SRpcMsg rpcMsg; syncSnapshotSend2RpcMsg(pMsg, &rpcMsg); syncNodeSendMsgById(&(pMsg->destId), pSender->pSyncNode, &rpcMsg); + syncLogSendSyncSnapshotSend(pSender->pSyncNode, pMsg, ""); syncSnapshotSendDestroy(pMsg); // event log @@ -249,64 +245,9 @@ static void snapshotSenderUpdateProgress(SSyncSnapshotSender *pSender, SyncSnaps ++(pSender->seq); } -cJSON *snapshotSender2Json(SSyncSnapshotSender *pSender) { - char u64buf[128]; - cJSON *pRoot = cJSON_CreateObject(); - - if (pSender != NULL) { - cJSON_AddNumberToObject(pRoot, "start", pSender->start); - cJSON_AddNumberToObject(pRoot, "seq", pSender->seq); - cJSON_AddNumberToObject(pRoot, "ack", pSender->ack); - - snprintf(u64buf, sizeof(u64buf), "%p", pSender->pReader); - cJSON_AddStringToObject(pRoot, "pReader", u64buf); - - snprintf(u64buf, sizeof(u64buf), "%p", pSender->pCurrentBlock); - cJSON_AddStringToObject(pRoot, "pCurrentBlock", u64buf); - cJSON_AddNumberToObject(pRoot, "blockLen", pSender->blockLen); - - if (pSender->pCurrentBlock != NULL) { - char *s; - s = syncUtilPrintBin((char *)(pSender->pCurrentBlock), pSender->blockLen); - cJSON_AddStringToObject(pRoot, "pCurrentBlock", s); - taosMemoryFree(s); - s = syncUtilPrintBin2((char *)(pSender->pCurrentBlock), pSender->blockLen); - cJSON_AddStringToObject(pRoot, "pCurrentBlock2", s); - taosMemoryFree(s); - } - - cJSON *pSnapshot = cJSON_CreateObject(); - snprintf(u64buf, sizeof(u64buf), "%" PRIu64, pSender->snapshot.lastApplyIndex); - cJSON_AddStringToObject(pSnapshot, "lastApplyIndex", u64buf); - snprintf(u64buf, sizeof(u64buf), "%" PRIu64, pSender->snapshot.lastApplyTerm); - cJSON_AddStringToObject(pSnapshot, "lastApplyTerm", u64buf); - cJSON_AddItemToObject(pRoot, "snapshot", pSnapshot); - snprintf(u64buf, sizeof(u64buf), "%" PRIu64, pSender->sendingMS); - cJSON_AddStringToObject(pRoot, "sendingMS", u64buf); - snprintf(u64buf, sizeof(u64buf), "%p", pSender->pSyncNode); - cJSON_AddStringToObject(pRoot, "pSyncNode", u64buf); - cJSON_AddNumberToObject(pRoot, "replicaIndex", pSender->replicaIndex); - snprintf(u64buf, sizeof(u64buf), "%" PRIu64, pSender->term); - cJSON_AddStringToObject(pRoot, "term", u64buf); - - // snprintf(u64buf, sizeof(u64buf), "%" PRIu64, pSender->privateTerm); - // cJSON_AddStringToObject(pRoot, "privateTerm", u64buf); - - cJSON_AddNumberToObject(pRoot, "finish", pSender->finish); - } - - cJSON *pJson = cJSON_CreateObject(); - cJSON_AddItemToObject(pJson, "SSyncSnapshotSender", pRoot); - return pJson; -} - -char *snapshotSender2Str(SSyncSnapshotSender *pSender) { - cJSON *pJson = snapshotSender2Json(pSender); - char *serialized = cJSON_Print(pJson); - cJSON_Delete(pJson); - return serialized; -} - +// return 0, start ok +// return 1, last snapshot finish ok +// return -1, error int32_t syncNodeStartSnapshot(SSyncNode *pSyncNode, SRaftId *pDestId) { sNTrace(pSyncNode, "starting snapshot ..."); @@ -319,11 +260,14 @@ int32_t syncNodeStartSnapshot(SSyncNode *pSyncNode, SRaftId *pDestId) { int32_t code = 0; if (snapshotSenderIsStart(pSender)) { - code = snapshotSenderStop(pSender, false); - if (code != 0) { - sNError(pSyncNode, "snapshot sender stop error"); - return -1; - } + sNTrace(pSyncNode, "snapshot sender already start, ignore"); + return 0; + } + + if (!snapshotSenderIsStart(pSender) && pSender->finish && + taosGetTimestampMs() - pSender->startTime < SNAPSHOT_WAIT_MS) { + sNTrace(pSyncNode, "snapshot sender too frequently, ignore"); + return 1; } code = snapshotSenderStart(pSender); @@ -335,16 +279,17 @@ int32_t syncNodeStartSnapshot(SSyncNode *pSyncNode, SRaftId *pDestId) { return 0; } -// ------------------------------------- SSyncSnapshotReceiver *snapshotReceiverCreate(SSyncNode *pSyncNode, SRaftId fromId) { bool condition = (pSyncNode->pFsm->FpSnapshotStartWrite != NULL) && (pSyncNode->pFsm->FpSnapshotStopWrite != NULL) && (pSyncNode->pFsm->FpSnapshotDoWrite != NULL); SSyncSnapshotReceiver *pReceiver = NULL; if (condition) { - pReceiver = taosMemoryMalloc(sizeof(SSyncSnapshotReceiver)); - ASSERT(pReceiver != NULL); - memset(pReceiver, 0, sizeof(*pReceiver)); + pReceiver = taosMemoryCalloc(1, sizeof(SSyncSnapshotReceiver)); + if (pReceiver == NULL) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + return NULL; + } pReceiver->start = false; pReceiver->ack = SYNC_SNAPSHOT_SEQ_BEGIN; @@ -381,36 +326,6 @@ void snapshotReceiverDestroy(SSyncSnapshotReceiver *pReceiver) { bool snapshotReceiverIsStart(SSyncSnapshotReceiver *pReceiver) { return pReceiver->start; } -// static do start by privateTerm, pBeginMsg -// receive first snapshot data -// write first block data -static void snapshotReceiverDoStart(SSyncSnapshotReceiver *pReceiver, SyncSnapshotSend *pBeginMsg) { - pReceiver->start = true; - pReceiver->ack = SYNC_SNAPSHOT_SEQ_BEGIN; - - // start writer - ASSERT(pReceiver->pWriter == NULL); - int32_t ret = pReceiver->pSyncNode->pFsm->FpSnapshotStartWrite(pReceiver->pSyncNode->pFsm, - &(pReceiver->snapshotParam), &(pReceiver->pWriter)); - ASSERT(ret == 0); - - pReceiver->term = pReceiver->pSyncNode->pRaftStore->currentTerm; - pReceiver->snapshotParam.start = pBeginMsg->beginIndex; - pReceiver->snapshotParam.end = pBeginMsg->lastIndex; - - pReceiver->fromId = pBeginMsg->srcId; - - // update snapshot - pReceiver->snapshot.lastApplyIndex = pBeginMsg->lastIndex; - pReceiver->snapshot.lastApplyTerm = pBeginMsg->lastTerm; - pReceiver->snapshot.lastConfigIndex = pBeginMsg->lastConfigIndex; - - pReceiver->startTime = pBeginMsg->startTime; - - // event log - sRTrace(pReceiver, "snapshot receiver start"); -} - // force stop void snapshotReceiverForceStop(SSyncSnapshotReceiver *pReceiver) { // force close, abandon incomplete data @@ -427,10 +342,43 @@ void snapshotReceiverForceStop(SSyncSnapshotReceiver *pReceiver) { sRTrace(pReceiver, "snapshot receiver force stop"); } -// if receiver receive msg from seq = SYNC_SNAPSHOT_SEQ_BEGIN, start receiver -int32_t snapshotReceiverStart(SSyncSnapshotReceiver *pReceiver, SyncSnapshotSend *pBeginMsg) { +int32_t snapshotReceiverStartWriter(SSyncSnapshotReceiver *pReceiver, SyncSnapshotSend *pBeginMsg) { + ASSERT(snapshotReceiverIsStart(pReceiver)); + + // update ack + pReceiver->ack = SYNC_SNAPSHOT_SEQ_BEGIN; + + // update snapshot + pReceiver->snapshot.lastApplyIndex = pBeginMsg->lastIndex; + pReceiver->snapshot.lastApplyTerm = pBeginMsg->lastTerm; + pReceiver->snapshot.lastConfigIndex = pBeginMsg->lastConfigIndex; + + pReceiver->snapshotParam.start = pBeginMsg->beginIndex; + pReceiver->snapshotParam.end = pBeginMsg->lastIndex; + + // start writer + ASSERT(pReceiver->pWriter == NULL); + int32_t ret = pReceiver->pSyncNode->pFsm->FpSnapshotStartWrite(pReceiver->pSyncNode->pFsm, + &(pReceiver->snapshotParam), &(pReceiver->pWriter)); + ASSERT(ret == 0); + + // event log + sRTrace(pReceiver, "snapshot receiver start writer"); + + return 0; +} + +int32_t snapshotReceiverStart(SSyncSnapshotReceiver *pReceiver, SyncSnapshotSend *pPreMsg) { ASSERT(!snapshotReceiverIsStart(pReceiver)); - snapshotReceiverDoStart(pReceiver, pBeginMsg); + + pReceiver->start = true; + pReceiver->ack = SYNC_SNAPSHOT_SEQ_PRE_SNAPSHOT; + pReceiver->term = pReceiver->pSyncNode->pRaftStore->currentTerm; + pReceiver->fromId = pPreMsg->srcId; + pReceiver->startTime = pPreMsg->startTime; + + // event log + sRTrace(pReceiver, "snapshot receiver start"); return 0; } @@ -530,63 +478,6 @@ static void snapshotReceiverGotData(SSyncSnapshotReceiver *pReceiver, SyncSnapsh } } -cJSON *snapshotReceiver2Json(SSyncSnapshotReceiver *pReceiver) { - char u64buf[128]; - cJSON *pRoot = cJSON_CreateObject(); - - if (pReceiver != NULL) { - cJSON_AddNumberToObject(pRoot, "start", pReceiver->start); - cJSON_AddNumberToObject(pRoot, "ack", pReceiver->ack); - - snprintf(u64buf, sizeof(u64buf), "%p", pReceiver->pWriter); - cJSON_AddStringToObject(pRoot, "pWriter", u64buf); - - snprintf(u64buf, sizeof(u64buf), "%p", pReceiver->pSyncNode); - cJSON_AddStringToObject(pRoot, "pSyncNode", u64buf); - - cJSON *pFromId = cJSON_CreateObject(); - snprintf(u64buf, sizeof(u64buf), "%" PRIu64, pReceiver->fromId.addr); - cJSON_AddStringToObject(pFromId, "addr", u64buf); - { - uint64_t u64 = pReceiver->fromId.addr; - cJSON *pTmp = pFromId; - char host[128] = {0}; - uint16_t port; - syncUtilU642Addr(u64, host, sizeof(host), &port); - cJSON_AddStringToObject(pTmp, "addr_host", host); - cJSON_AddNumberToObject(pTmp, "addr_port", port); - } - cJSON_AddNumberToObject(pFromId, "vgId", pReceiver->fromId.vgId); - cJSON_AddItemToObject(pRoot, "fromId", pFromId); - - snprintf(u64buf, sizeof(u64buf), "%" PRIu64, pReceiver->snapshot.lastApplyIndex); - cJSON_AddStringToObject(pRoot, "snapshot.lastApplyIndex", u64buf); - - snprintf(u64buf, sizeof(u64buf), "%" PRIu64, pReceiver->snapshot.lastApplyTerm); - cJSON_AddStringToObject(pRoot, "snapshot.lastApplyTerm", u64buf); - - snprintf(u64buf, sizeof(u64buf), "%" PRIu64, pReceiver->snapshot.lastConfigIndex); - cJSON_AddStringToObject(pRoot, "snapshot.lastConfigIndex", u64buf); - - snprintf(u64buf, sizeof(u64buf), "%" PRIu64, pReceiver->term); - cJSON_AddStringToObject(pRoot, "term", u64buf); - - snprintf(u64buf, sizeof(u64buf), "%" PRId64, pReceiver->startTime); - cJSON_AddStringToObject(pRoot, "startTime", u64buf); - } - - cJSON *pJson = cJSON_CreateObject(); - cJSON_AddItemToObject(pJson, "SSyncSnapshotReceiver", pRoot); - return pJson; -} - -char *snapshotReceiver2Str(SSyncSnapshotReceiver *pReceiver) { - cJSON *pJson = snapshotReceiver2Json(pReceiver); - char *serialized = cJSON_Print(pJson); - cJSON_Delete(pJson); - return serialized; -} - SyncIndex syncNodeGetSnapBeginIndex(SSyncNode *ths) { SyncIndex snapStart = SYNC_INDEX_INVALID; @@ -640,7 +531,10 @@ _START_RECEIVER: return -1; } else { // waiting for clock match - while (taosGetTimestampMs() > pMsg->startTime) { + int64_t timeNow = taosGetTimestampMs(); + while (timeNow < pMsg->startTime) { + sNTrace(pSyncNode, "snapshot receiver pre waitting for true time, now:%" PRId64 ", stime:%" PRId64, timeNow, + pMsg->startTime); taosMsleep(10); } @@ -665,6 +559,7 @@ _SEND_REPLY: SRpcMsg rpcMsg; syncSnapshotRsp2RpcMsg(pRspMsg, &rpcMsg); syncNodeSendMsgById(&(pRspMsg->destId), pSyncNode, &rpcMsg); + syncLogSendSyncSnapshotRsp(pSyncNode, pRspMsg, ""); syncSnapshotRspDestroy(pRspMsg); return 0; @@ -674,54 +569,119 @@ static int32_t syncNodeOnSnapshotBegin(SSyncNode *pSyncNode, SyncSnapshotSend *p // condition 1 SSyncSnapshotReceiver *pReceiver = pSyncNode->pNewNodeReceiver; - if (snapshotReceiverIsStart(pReceiver)) { - if (pMsg->startTime > pReceiver->startTime) { - snapshotReceiverStop(pReceiver); - - } else if (pMsg->startTime == pReceiver->startTime) { - return 0; - } else { - // ignore - sNTrace(pSyncNode, "msg ignore"); - return 0; - } - } - -_START_RECEIVER: - if (taosGetTimestampMs() - pMsg->startTime > SNAPSHOT_MAX_CLOCK_SKEW_MS) { - sNError(pSyncNode, "snapshot receiver time skew too much"); + if (!snapshotReceiverIsStart(pReceiver)) { + sNError(pSyncNode, "snapshot receiver not start"); return -1; - } else { - // waiting for clock match - while (taosGetTimestampMs() > pMsg->startTime) { - taosMsleep(10); - } - - snapshotReceiverStart(pReceiver, pMsg); - - // build msg - SyncSnapshotRsp *pRspMsg = syncSnapshotRspBuild(pSyncNode->vgId); - pRspMsg->srcId = pSyncNode->myRaftId; - pRspMsg->destId = pMsg->srcId; - pRspMsg->term = pSyncNode->pRaftStore->currentTerm; - pRspMsg->lastIndex = pMsg->lastIndex; - pRspMsg->lastTerm = pMsg->lastTerm; - pRspMsg->ack = pReceiver->ack; // receiver maybe already closed - pRspMsg->code = 0; - - // send msg - SRpcMsg rpcMsg; - syncSnapshotRsp2RpcMsg(pRspMsg, &rpcMsg); - syncNodeSendMsgById(&(pRspMsg->destId), pSyncNode, &rpcMsg); - syncSnapshotRspDestroy(pRspMsg); } + if (pReceiver->startTime != pMsg->startTime) { + sNError(pSyncNode, "snapshot receiver time not equal"); + return -1; + } + + // start writer + snapshotReceiverStartWriter(pReceiver, pMsg); + + // build msg + SyncSnapshotRsp *pRspMsg = syncSnapshotRspBuild(pSyncNode->vgId); + pRspMsg->srcId = pSyncNode->myRaftId; + pRspMsg->destId = pMsg->srcId; + pRspMsg->term = pSyncNode->pRaftStore->currentTerm; + pRspMsg->lastIndex = pMsg->lastIndex; + pRspMsg->lastTerm = pMsg->lastTerm; + pRspMsg->startTime = pReceiver->startTime; + pRspMsg->ack = pReceiver->ack; // receiver maybe already closed + pRspMsg->code = 0; + pRspMsg->snapBeginIndex = pReceiver->snapshotParam.start; + + // send msg + SRpcMsg rpcMsg; + syncSnapshotRsp2RpcMsg(pRspMsg, &rpcMsg); + syncNodeSendMsgById(&(pRspMsg->destId), pSyncNode, &rpcMsg); + syncLogSendSyncSnapshotRsp(pSyncNode, pRspMsg, ""); + syncSnapshotRspDestroy(pRspMsg); + return 0; } -static int32_t syncNodeOnSnapshotTransfer(SSyncNode *pSyncNode, SyncSnapshotSend *pMsg) { return 0; } +static int32_t syncNodeOnSnapshotTransfering(SSyncNode *pSyncNode, SyncSnapshotSend *pMsg) { + // condition 4 + // transfering + SSyncSnapshotReceiver *pReceiver = pSyncNode->pNewNodeReceiver; -static int32_t syncNodeOnSnapshotEnd(SSyncNode *pSyncNode, SyncSnapshotSend *pMsg) { return 0; } + // waiting for clock match + int64_t timeNow = taosGetTimestampMs(); + while (timeNow < pMsg->startTime) { + sNTrace(pSyncNode, "snapshot receiver transfering waitting for true time, now:%" PRId64 ", stime:%" PRId64, timeNow, + pMsg->startTime); + taosMsleep(10); + } + + if (pMsg->seq == pReceiver->ack + 1) { + snapshotReceiverGotData(pReceiver, pMsg); + } + + // build msg + SyncSnapshotRsp *pRspMsg = syncSnapshotRspBuild(pSyncNode->vgId); + pRspMsg->srcId = pSyncNode->myRaftId; + pRspMsg->destId = pMsg->srcId; + pRspMsg->term = pSyncNode->pRaftStore->currentTerm; + pRspMsg->lastIndex = pMsg->lastIndex; + pRspMsg->lastTerm = pMsg->lastTerm; + pRspMsg->startTime = pReceiver->startTime; + pRspMsg->ack = pReceiver->ack; // receiver maybe already closed + pRspMsg->code = 0; + pRspMsg->snapBeginIndex = pReceiver->snapshotParam.start; + + // send msg + SRpcMsg rpcMsg; + syncSnapshotRsp2RpcMsg(pRspMsg, &rpcMsg); + syncNodeSendMsgById(&(pRspMsg->destId), pSyncNode, &rpcMsg); + syncLogSendSyncSnapshotRsp(pSyncNode, pRspMsg, ""); + syncSnapshotRspDestroy(pRspMsg); + + return 0; +} + +static int32_t syncNodeOnSnapshotEnd(SSyncNode *pSyncNode, SyncSnapshotSend *pMsg) { + // condition 2 + // end, finish FSM + SSyncSnapshotReceiver *pReceiver = pSyncNode->pNewNodeReceiver; + + // waiting for clock match + int64_t timeNow = taosGetTimestampMs(); + while (timeNow < pMsg->startTime) { + sNTrace(pSyncNode, "snapshot receiver finish waitting for true time, now:%" PRId64 ", stime:%" PRId64, timeNow, + pMsg->startTime); + taosMsleep(10); + } + + int32_t code = snapshotReceiverFinish(pReceiver, pMsg); + if (code == 0) { + snapshotReceiverStop(pReceiver); + } + + // build msg + SyncSnapshotRsp *pRspMsg = syncSnapshotRspBuild(pSyncNode->vgId); + pRspMsg->srcId = pSyncNode->myRaftId; + pRspMsg->destId = pMsg->srcId; + pRspMsg->term = pSyncNode->pRaftStore->currentTerm; + pRspMsg->lastIndex = pMsg->lastIndex; + pRspMsg->lastTerm = pMsg->lastTerm; + pRspMsg->startTime = pReceiver->startTime; + pRspMsg->ack = pReceiver->ack; // receiver maybe already closed + pRspMsg->code = 0; + pRspMsg->snapBeginIndex = pReceiver->snapshotParam.start; + + // send msg + SRpcMsg rpcMsg; + syncSnapshotRsp2RpcMsg(pRspMsg, &rpcMsg); + syncNodeSendMsgById(&(pRspMsg->destId), pSyncNode, &rpcMsg); + syncLogSendSyncSnapshotRsp(pSyncNode, pRspMsg, ""); + syncSnapshotRspDestroy(pRspMsg); + + return 0; +} // receiver on message // @@ -763,6 +723,8 @@ int32_t syncNodeOnSnapshot(SSyncNode *pSyncNode, SyncSnapshotSend *pMsg) { int32_t code = 0; SSyncSnapshotReceiver *pReceiver = pSyncNode->pNewNodeReceiver; + syncLogRecvSyncSnapshotSend(pSyncNode, pMsg, ""); + // state, term, seq/ack if (pSyncNode->state == TAOS_SYNC_STATE_FOLLOWER) { if (pMsg->term == pSyncNode->pRaftStore->currentTerm) { @@ -773,39 +735,14 @@ int32_t syncNodeOnSnapshot(SSyncNode *pSyncNode, SyncSnapshotSend *pMsg) { syncNodeOnSnapshotBegin(pSyncNode, pMsg); } else if (pMsg->seq == SYNC_SNAPSHOT_SEQ_END) { - // condition 2 - // end, finish FSM - code = snapshotReceiverFinish(pReceiver, pMsg); - if (code == 0) { - snapshotReceiverStop(pReceiver); - } - bool needRsp = true; - - // maybe update lastconfig - if (pMsg->lastConfigIndex >= SYNC_INDEX_BEGIN) { - SSyncCfg oldSyncCfg = pSyncNode->pRaftCfg->cfg; - - // update new config myIndex - SSyncCfg newSyncCfg = pMsg->lastConfig; - syncNodeUpdateNewConfigIndex(pSyncNode, &newSyncCfg); - - // do config change - syncNodeDoConfigChange(pSyncNode, &newSyncCfg, pMsg->lastConfigIndex); - } + syncNodeOnSnapshotEnd(pSyncNode, pMsg); } else if (pMsg->seq == SYNC_SNAPSHOT_SEQ_FORCE_CLOSE) { - // condition 3 - // force close + // force close, no response snapshotReceiverForceStop(pReceiver); - bool needRsp = false; } else if (pMsg->seq > SYNC_SNAPSHOT_SEQ_BEGIN && pMsg->seq < SYNC_SNAPSHOT_SEQ_END) { - // condition 4 - // transfering - if (pMsg->seq == pReceiver->ack + 1) { - snapshotReceiverGotData(pReceiver, pMsg); - } - bool needRsp = true; + syncNodeOnSnapshotTransfering(pSyncNode, pMsg); } else { // error log @@ -839,11 +776,17 @@ int32_t syncNodeOnSnapshotReplyPre(SSyncNode *pSyncNode, SyncSnapshotRsp *pMsg) pSender->snapshotParam.start = pMsg->snapBeginIndex; pSender->snapshotParam.end = snapshot.lastApplyIndex; + sNTrace(pSyncNode, "prepare snapshot, recv-begin:%" PRId64 ", snapshot.last:%" PRId64 ", snapshot.term:%" PRId64, + pMsg->snapBeginIndex, snapshot.lastApplyIndex, snapshot.lastApplyTerm); + if (pMsg->snapBeginIndex > snapshot.lastApplyIndex) { sNError(pSyncNode, "snapshot last index too small"); return -1; } + // update sender + pSender->snapshot = snapshot; + // start reader int32_t code = pSyncNode->pFsm->FpSnapshotStartRead(pSyncNode->pFsm, &(pSender->snapshotParam), &(pSender->pReader)); if (code != 0) { @@ -851,6 +794,9 @@ int32_t syncNodeOnSnapshotReplyPre(SSyncNode *pSyncNode, SyncSnapshotRsp *pMsg) return -1; } + // update seq + pSender->seq = SYNC_SNAPSHOT_SEQ_BEGIN; + // build begin msg SyncSnapshotSend *pSendMsg = syncSnapshotSendBuild(0, pSender->pSyncNode->vgId); pSendMsg->srcId = pSender->pSyncNode->myRaftId; @@ -868,6 +814,7 @@ int32_t syncNodeOnSnapshotReplyPre(SSyncNode *pSyncNode, SyncSnapshotRsp *pMsg) SRpcMsg rpcMsg; syncSnapshotSend2RpcMsg(pSendMsg, &rpcMsg); syncNodeSendMsgById(&(pSendMsg->destId), pSender->pSyncNode, &rpcMsg); + syncLogSendSyncSnapshotSend(pSyncNode, pSendMsg, ""); syncSnapshotSendDestroy(pSendMsg); return 0; @@ -895,6 +842,8 @@ int32_t syncNodeOnSnapshotReply(SSyncNode *pSyncNode, SyncSnapshotRsp *pMsg) { return -1; } + syncLogRecvSyncSnapshotRsp(pSyncNode, pMsg, ""); + // state, term, seq/ack if (pSyncNode->state == TAOS_SYNC_STATE_LEADER) { if (pMsg->term == pSyncNode->pRaftStore->currentTerm) { @@ -904,9 +853,20 @@ int32_t syncNodeOnSnapshotReply(SSyncNode *pSyncNode, SyncSnapshotRsp *pMsg) { return 0; } + if (pMsg->ack == SYNC_SNAPSHOT_SEQ_BEGIN) { + snapshotSenderUpdateProgress(pSender, pMsg); + snapshotSend(pSender); + return 0; + } + // receive ack is finish, close sender if (pMsg->ack == SYNC_SNAPSHOT_SEQ_END) { snapshotSenderStop(pSender, true); + + // update next-index + syncIndexMgrSetIndex(pSyncNode->pNextIndex, &(pMsg->srcId), pMsg->lastIndex + 1); + syncNodeReplicateOne(pSyncNode, &(pMsg->srcId), false); + return 0; } diff --git a/source/libs/sync/src/syncTimeout.c b/source/libs/sync/src/syncTimeout.c index 30e0617f43..91d807319b 100644 --- a/source/libs/sync/src/syncTimeout.c +++ b/source/libs/sync/src/syncTimeout.c @@ -13,28 +13,23 @@ * along with this program. If not, see . */ +#define _DEFAULT_SOURCE #include "syncTimeout.h" #include "syncElection.h" #include "syncRaftCfg.h" #include "syncRaftLog.h" #include "syncReplication.h" -#include "syncRespMgr.h" static void syncNodeCleanConfigIndex(SSyncNode* ths) { int32_t newArrIndex = 0; - SyncIndex newConfigIndexArr[MAX_CONFIG_INDEX_COUNT]; - memset(newConfigIndexArr, 0, sizeof(newConfigIndexArr)); - + SyncIndex newConfigIndexArr[MAX_CONFIG_INDEX_COUNT] = {0}; SSnapshot snapshot = {0}; - if (ths->pFsm != NULL && ths->pFsm->FpGetSnapshotInfo != NULL) { - ths->pFsm->FpGetSnapshotInfo(ths->pFsm, &snapshot); - } - + + ths->pFsm->FpGetSnapshotInfo(ths->pFsm, &snapshot); if (snapshot.lastApplyIndex != SYNC_INDEX_INVALID) { - for (int i = 0; i < ths->pRaftCfg->configIndexCount; ++i) { + for (int32_t i = 0; i < ths->pRaftCfg->configIndexCount; ++i) { if (ths->pRaftCfg->configIndexArr[i] < snapshot.lastConfigIndex) { // pass - ; } else { // save newConfigIndexArr[newArrIndex] = ths->pRaftCfg->configIndexArr[i]; @@ -47,13 +42,15 @@ static void syncNodeCleanConfigIndex(SSyncNode* ths) { memcpy(ths->pRaftCfg->configIndexArr, newConfigIndexArr, sizeof(newConfigIndexArr)); int32_t code = raftCfgPersist(ths->pRaftCfg); - ASSERT(code == 0); - - sNTrace(ths, "clean config index arr, old-cnt:%d, new-cnt:%d", oldCnt, ths->pRaftCfg->configIndexCount); + if (code != 0) { + sNFatal(ths, "failed to persist cfg"); + } else { + sNTrace(ths, "clean config index arr, old-cnt:%d, new-cnt:%d", oldCnt, ths->pRaftCfg->configIndexCount); + } } } -int32_t syncNodeTimerRoutine(SSyncNode* ths) { +static int32_t syncNodeTimerRoutine(SSyncNode* ths) { sNTrace(ths, "timer routines"); // timer replicate @@ -71,7 +68,7 @@ int32_t syncNodeTimerRoutine(SSyncNode* ths) { SSyncLogStoreData* pData = ths->pLogStore->data; int32_t code = walEndSnapshot(pData->pWal); if (code != 0) { - sError("vgId:%d, timer wal snapshot end error since:%s", ths->vgId, terrstr()); + sNError(ths, "timer wal snapshot end error since:%s", terrstr()); return -1; } else { sNTrace(ths, "wal snapshot end, index:%" PRId64, atomic_load_64(&ths->snapshottingIndex)); diff --git a/source/libs/sync/src/syncUtil.c b/source/libs/sync/src/syncUtil.c index 1a00b0f5a4..894aa05aad 100644 --- a/source/libs/sync/src/syncUtil.c +++ b/source/libs/sync/src/syncUtil.c @@ -41,15 +41,15 @@ void syncUtilU642Addr(uint64_t u64, char* host, int64_t len, uint16_t* port) { *port = (uint16_t)((u64 & 0x00000000FFFF0000) >> 16); } -void syncUtilnodeInfo2EpSet(const SNodeInfo* pInfo, SEpSet* pEpSet) { +void syncUtilNodeInfo2EpSet(const SNodeInfo* pInfo, SEpSet* pEpSet) { pEpSet->inUse = 0; pEpSet->numOfEps = 0; addEpIntoEpSet(pEpSet, pInfo->nodeFqdn, pInfo->nodePort); } -void syncUtilraftId2EpSet(const SRaftId* raftId, SEpSet* pEpSet) { +void syncUtilRaftId2EpSet(const SRaftId* raftId, SEpSet* pEpSet) { char host[TSDB_FQDN_LEN] = {0}; - uint16_t port; + uint16_t port = 0; syncUtilU642Addr(raftId->addr, host, sizeof(host), &port); pEpSet->inUse = 0; @@ -57,7 +57,7 @@ void syncUtilraftId2EpSet(const SRaftId* raftId, SEpSet* pEpSet) { addEpIntoEpSet(pEpSet, host, port); } -bool syncUtilnodeInfo2raftId(const SNodeInfo* pInfo, SyncGroupId vgId, SRaftId* raftId) { +bool syncUtilNodeInfo2RaftId(const SNodeInfo* pInfo, SyncGroupId vgId, SRaftId* raftId) { uint32_t ipv4 = taosGetIpv4FromFqdn(pInfo->nodeFqdn); if (ipv4 == 0xFFFFFFFF || ipv4 == 1) { sError("failed to resolve ipv4 addr, fqdn: %s", pInfo->nodeFqdn); @@ -73,8 +73,7 @@ bool syncUtilnodeInfo2raftId(const SNodeInfo* pInfo, SyncGroupId vgId, SRaftId* } bool syncUtilSameId(const SRaftId* pId1, const SRaftId* pId2) { - bool ret = pId1->addr == pId2->addr && pId1->vgId == pId2->vgId; - return ret; + return pId1->addr == pId2->addr && pId1->vgId == pId2->vgId; } bool syncUtilEmptyId(const SRaftId* pId) { return (pId->addr == 0 && pId->vgId == 0); } @@ -90,18 +89,6 @@ int32_t syncUtilElectRandomMS(int32_t min, int32_t max) { int32_t syncUtilQuorum(int32_t replicaNum) { return replicaNum / 2 + 1; } -cJSON* syncUtilNodeInfo2Json(const SNodeInfo* p) { - char u64buf[128] = {0}; - cJSON* pRoot = cJSON_CreateObject(); - - cJSON_AddStringToObject(pRoot, "nodeFqdn", p->nodeFqdn); - cJSON_AddNumberToObject(pRoot, "nodePort", p->nodePort); - - cJSON* pJson = cJSON_CreateObject(); - cJSON_AddItemToObject(pJson, "SNodeInfo", pRoot); - return pJson; -} - cJSON* syncUtilRaftId2Json(const SRaftId* p) { char u64buf[128] = {0}; cJSON* pRoot = cJSON_CreateObject(); @@ -120,13 +107,6 @@ cJSON* syncUtilRaftId2Json(const SRaftId* p) { return pJson; } -char* syncUtilRaftId2Str(const SRaftId* p) { - cJSON* pJson = syncUtilRaftId2Json(p); - char* serialized = cJSON_Print(pJson); - cJSON_Delete(pJson); - return serialized; -} - static inline bool syncUtilCanPrint(char c) { if (c >= 32 && c <= 126) { return true; @@ -165,14 +145,12 @@ char* syncUtilPrintBin2(char* ptr, uint32_t len) { } void syncUtilMsgHtoN(void* msg) { - // htonl SMsgHead* pHead = msg; pHead->contLen = htonl(pHead->contLen); pHead->vgId = htonl(pHead->vgId); } void syncUtilMsgNtoH(void* msg) { - // ntohl SMsgHead* pHead = msg; pHead->contLen = ntohl(pHead->contLen); pHead->vgId = ntohl(pHead->vgId); diff --git a/source/libs/sync/src/syncVoteMgr.c b/source/libs/sync/src/syncVoteMgr.c index ee1f83ee6a..4ca4e26bec 100644 --- a/source/libs/sync/src/syncVoteMgr.c +++ b/source/libs/sync/src/syncVoteMgr.c @@ -23,12 +23,11 @@ static void voteGrantedClearVotes(SVotesGranted *pVotesGranted) { } SVotesGranted *voteGrantedCreate(SSyncNode *pSyncNode) { - SVotesGranted *pVotesGranted = taosMemoryMalloc(sizeof(SVotesGranted)); + SVotesGranted *pVotesGranted = taosMemoryCalloc(1, sizeof(SVotesGranted)); if (pVotesGranted == NULL) { terrno = TSDB_CODE_OUT_OF_MEMORY; return NULL; } - memset(pVotesGranted, 0, sizeof(SVotesGranted)); pVotesGranted->replicas = &(pSyncNode->replicasId); pVotesGranted->replicaNum = pSyncNode->replicaNum; @@ -59,20 +58,24 @@ void voteGrantedUpdate(SVotesGranted *pVotesGranted, SSyncNode *pSyncNode) { pVotesGranted->pSyncNode = pSyncNode; } -bool voteGrantedMajority(SVotesGranted *pVotesGranted) { - bool ret = pVotesGranted->votes >= pVotesGranted->quorum; - return ret; -} +bool voteGrantedMajority(SVotesGranted *pVotesGranted) { return pVotesGranted->votes >= pVotesGranted->quorum; } void voteGrantedVote(SVotesGranted *pVotesGranted, SyncRequestVoteReply *pMsg) { - ASSERT(pMsg->voteGranted == true); - - if (pMsg->term != pVotesGranted->term) { - sNTrace(pVotesGranted->pSyncNode, "vote grant vnode error"); + if (!pMsg->voteGranted) { + sNFatal(pVotesGranted->pSyncNode, "vote granted should be true"); return; } - ASSERT(syncUtilSameId(&pVotesGranted->pSyncNode->myRaftId, &pMsg->destId)); + if (pMsg->term != pVotesGranted->term) { + sNTrace(pVotesGranted->pSyncNode, "vote grant term:%" PRId64 " not matched with msg term:%" PRId64, + pVotesGranted->term, pMsg->term); + return; + } + + if (!syncUtilSameId(&pVotesGranted->pSyncNode->myRaftId, &pMsg->destId)) { + sNFatal(pVotesGranted->pSyncNode, "vote granted raftId not matched with msg"); + return; + } int32_t j = -1; for (int32_t i = 0; i < pVotesGranted->replicaNum; ++i) { @@ -81,14 +84,21 @@ void voteGrantedVote(SVotesGranted *pVotesGranted, SyncRequestVoteReply *pMsg) { break; } } - ASSERT(j != -1); - ASSERT(j >= 0 && j < pVotesGranted->replicaNum); + if ((j == -1) || !(j >= 0 && j < pVotesGranted->replicaNum)) { + sNFatal(pVotesGranted->pSyncNode, "invalid msg srcId, index:%d", j); + return; + } if (pVotesGranted->isGranted[j] != true) { ++(pVotesGranted->votes); pVotesGranted->isGranted[j] = true; } - ASSERT(pVotesGranted->votes <= pVotesGranted->replicaNum); + + if (pVotesGranted->votes > pVotesGranted->replicaNum) { + sNFatal(pVotesGranted->pSyncNode, "votes:%d not matched with replicaNum:%d", pVotesGranted->votes, + pVotesGranted->replicaNum); + return; + } } void voteGrantedReset(SVotesGranted *pVotesGranted, SyncTerm term) { @@ -97,53 +107,12 @@ void voteGrantedReset(SVotesGranted *pVotesGranted, SyncTerm term) { pVotesGranted->toLeader = false; } -cJSON *voteGranted2Json(SVotesGranted *pVotesGranted) { - char u64buf[128] = {0}; - cJSON *pRoot = cJSON_CreateObject(); - - if (pVotesGranted != NULL) { - cJSON_AddNumberToObject(pRoot, "replicaNum", pVotesGranted->replicaNum); - cJSON *pReplicas = cJSON_CreateArray(); - cJSON_AddItemToObject(pRoot, "replicas", pReplicas); - for (int32_t i = 0; i < pVotesGranted->replicaNum; ++i) { - cJSON_AddItemToArray(pReplicas, syncUtilRaftId2Json(&(*(pVotesGranted->replicas))[i])); - } - int32_t *arr = (int32_t *)taosMemoryMalloc(sizeof(int32_t) * pVotesGranted->replicaNum); - for (int32_t i = 0; i < pVotesGranted->replicaNum; ++i) { - arr[i] = pVotesGranted->isGranted[i]; - } - cJSON *pIsGranted = cJSON_CreateIntArray(arr, pVotesGranted->replicaNum); - taosMemoryFree(arr); - cJSON_AddItemToObject(pRoot, "isGranted", pIsGranted); - - cJSON_AddNumberToObject(pRoot, "votes", pVotesGranted->votes); - snprintf(u64buf, sizeof(u64buf), "%" PRIu64, pVotesGranted->term); - cJSON_AddStringToObject(pRoot, "term", u64buf); - cJSON_AddNumberToObject(pRoot, "quorum", pVotesGranted->quorum); - cJSON_AddNumberToObject(pRoot, "toLeader", pVotesGranted->toLeader); - snprintf(u64buf, sizeof(u64buf), "%p", pVotesGranted->pSyncNode); - cJSON_AddStringToObject(pRoot, "pSyncNode", u64buf); - - bool majority = voteGrantedMajority(pVotesGranted); - cJSON_AddNumberToObject(pRoot, "majority", majority); - } - - cJSON *pJson = cJSON_CreateObject(); - cJSON_AddItemToObject(pJson, "SVotesGranted", pRoot); - return pJson; -} - -char *voteGranted2Str(SVotesGranted *pVotesGranted) { - cJSON *pJson = voteGranted2Json(pVotesGranted); - char *serialized = cJSON_Print(pJson); - cJSON_Delete(pJson); - return serialized; -} - SVotesRespond *votesRespondCreate(SSyncNode *pSyncNode) { - SVotesRespond *pVotesRespond = taosMemoryMalloc(sizeof(SVotesRespond)); - ASSERT(pVotesRespond != NULL); - memset(pVotesRespond, 0, sizeof(SVotesRespond)); + SVotesRespond *pVotesRespond = taosMemoryCalloc(1, sizeof(SVotesRespond)); + if (pVotesRespond == NULL) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + return NULL; + } pVotesRespond->replicas = &(pSyncNode->replicasId); pVotesRespond->replicaNum = pSyncNode->replicaNum; @@ -185,62 +154,15 @@ void votesRespondAdd(SVotesRespond *pVotesRespond, const SyncRequestVoteReply *p for (int32_t i = 0; i < pVotesRespond->replicaNum; ++i) { if (syncUtilSameId(&((*(pVotesRespond->replicas))[i]), &pMsg->srcId)) { - // ASSERT(pVotesRespond->isRespond[i] == false); pVotesRespond->isRespond[i] = true; return; } } - ASSERT(0); + + sNFatal(pVotesRespond->pSyncNode, "votes respond not found"); } void votesRespondReset(SVotesRespond *pVotesRespond, SyncTerm term) { pVotesRespond->term = term; memset(pVotesRespond->isRespond, 0, sizeof(pVotesRespond->isRespond)); - /* - for (int32_t i = 0; i < pVotesRespond->replicaNum; ++i) { - pVotesRespond->isRespond[i] = false; - } - */ -} - -cJSON *votesRespond2Json(SVotesRespond *pVotesRespond) { - char u64buf[128] = {0}; - cJSON *pRoot = cJSON_CreateObject(); - - if (pVotesRespond != NULL) { - cJSON_AddNumberToObject(pRoot, "replicaNum", pVotesRespond->replicaNum); - cJSON *pReplicas = cJSON_CreateArray(); - cJSON_AddItemToObject(pRoot, "replicas", pReplicas); - for (int32_t i = 0; i < pVotesRespond->replicaNum; ++i) { - cJSON_AddItemToArray(pReplicas, syncUtilRaftId2Json(&(*(pVotesRespond->replicas))[i])); - } - int32_t respondNum = 0; - int32_t *arr = (int32_t *)taosMemoryMalloc(sizeof(int32_t) * pVotesRespond->replicaNum); - for (int32_t i = 0; i < pVotesRespond->replicaNum; ++i) { - arr[i] = pVotesRespond->isRespond[i]; - if (pVotesRespond->isRespond[i]) { - respondNum++; - } - } - cJSON *pIsRespond = cJSON_CreateIntArray(arr, pVotesRespond->replicaNum); - taosMemoryFree(arr); - cJSON_AddItemToObject(pRoot, "isRespond", pIsRespond); - cJSON_AddNumberToObject(pRoot, "respondNum", respondNum); - - snprintf(u64buf, sizeof(u64buf), "%" PRIu64, pVotesRespond->term); - cJSON_AddStringToObject(pRoot, "term", u64buf); - snprintf(u64buf, sizeof(u64buf), "%p", pVotesRespond->pSyncNode); - cJSON_AddStringToObject(pRoot, "pSyncNode", u64buf); - } - - cJSON *pJson = cJSON_CreateObject(); - cJSON_AddItemToObject(pJson, "SVotesRespond", pRoot); - return pJson; -} - -char *votesRespond2Str(SVotesRespond *pVotesRespond) { - cJSON *pJson = votesRespond2Json(pVotesRespond); - char *serialized = cJSON_Print(pJson); - cJSON_Delete(pJson); - return serialized; } diff --git a/source/libs/sync/test/CMakeLists.txt b/source/libs/sync/test/CMakeLists.txt index b46b775b52..7a22d96972 100644 --- a/source/libs/sync/test/CMakeLists.txt +++ b/source/libs/sync/test/CMakeLists.txt @@ -1,3 +1,4 @@ +add_subdirectory(sync_test_lib) add_executable(syncTest "") add_executable(syncRaftIdCheck "") add_executable(syncEnvTest "") @@ -24,8 +25,6 @@ add_executable(syncRequestVoteReplyTest "") add_executable(syncAppendEntriesTest "") add_executable(syncAppendEntriesBatchTest "") add_executable(syncAppendEntriesReplyTest "") -add_executable(syncClientRequestTest "") -add_executable(syncClientRequestBatchTest "") add_executable(syncTimeoutTest "") add_executable(syncPingTest "") add_executable(syncPingReplyTest "") @@ -167,14 +166,6 @@ target_sources(syncAppendEntriesReplyTest PRIVATE "syncAppendEntriesReplyTest.cpp" ) -target_sources(syncClientRequestTest - PRIVATE - "syncClientRequestTest.cpp" -) -target_sources(syncClientRequestBatchTest - PRIVATE - "syncClientRequestBatchTest.cpp" -) target_sources(syncTimeoutTest PRIVATE "syncTimeoutTest.cpp" @@ -447,16 +438,6 @@ target_include_directories(syncAppendEntriesReplyTest "${TD_SOURCE_DIR}/include/libs/sync" "${CMAKE_CURRENT_SOURCE_DIR}/../inc" ) -target_include_directories(syncClientRequestTest - PUBLIC - "${TD_SOURCE_DIR}/include/libs/sync" - "${CMAKE_CURRENT_SOURCE_DIR}/../inc" -) -target_include_directories(syncClientRequestBatchTest - PUBLIC - "${TD_SOURCE_DIR}/include/libs/sync" - "${CMAKE_CURRENT_SOURCE_DIR}/../inc" -) target_include_directories(syncTimeoutTest PUBLIC "${TD_SOURCE_DIR}/include/libs/sync" @@ -635,255 +616,247 @@ target_include_directories(syncPreSnapshotReplyTest target_link_libraries(syncTest - sync + sync_test_lib gtest_main ) target_link_libraries(syncRaftIdCheck - sync + sync_test_lib gtest_main ) target_link_libraries(syncEnvTest - sync + sync_test_lib gtest_main ) target_link_libraries(syncPingTimerTest - sync + sync_test_lib gtest_main ) target_link_libraries(syncIOTickQTest - sync + sync_test_lib gtest_main ) target_link_libraries(syncIOTickPingTest - sync + sync_test_lib gtest_main ) target_link_libraries(syncIOSendMsgTest - sync + sync_test_lib gtest_main ) target_link_libraries(syncIOClientTest - sync + sync_test_lib gtest_main ) target_link_libraries(syncIOServerTest - sync + sync_test_lib gtest_main ) target_link_libraries(syncRaftStoreTest - sync + sync_test_lib gtest_main ) target_link_libraries(syncEnqTest - sync + sync_test_lib gtest_main ) target_link_libraries(syncIndexTest - sync + sync_test_lib gtest_main ) target_link_libraries(syncInitTest - sync + sync_test_lib gtest_main ) target_link_libraries(syncUtilTest - sync + sync_test_lib gtest_main ) target_link_libraries(syncVotesGrantedTest - sync + sync_test_lib gtest_main ) target_link_libraries(syncVotesRespondTest - sync + sync_test_lib gtest_main ) target_link_libraries(syncIndexMgrTest - sync + sync_test_lib gtest_main ) target_link_libraries(syncLogStoreTest - sync + sync_test_lib gtest_main ) target_link_libraries(syncEntryTest - sync + sync_test_lib gtest_main ) target_link_libraries(syncEntryCacheTest - sync + sync_test_lib gtest_main ) target_link_libraries(syncHashCacheTest - sync + sync_test_lib gtest_main ) target_link_libraries(syncRequestVoteTest - sync + sync_test_lib gtest_main ) target_link_libraries(syncRequestVoteReplyTest - sync + sync_test_lib gtest_main ) target_link_libraries(syncAppendEntriesTest - sync + sync_test_lib gtest_main ) target_link_libraries(syncAppendEntriesBatchTest - sync + sync_test_lib gtest_main ) target_link_libraries(syncAppendEntriesReplyTest - sync - gtest_main -) -target_link_libraries(syncClientRequestTest - sync - gtest_main -) -target_link_libraries(syncClientRequestBatchTest - sync + sync_test_lib gtest_main ) target_link_libraries(syncTimeoutTest - sync + sync_test_lib gtest_main ) target_link_libraries(syncPingTest - sync + sync_test_lib gtest_main ) target_link_libraries(syncPingReplyTest - sync + sync_test_lib gtest_main ) target_link_libraries(syncRpcMsgTest - sync + sync_test_lib gtest_main ) target_link_libraries(syncPingTimerTest2 - sync + sync_test_lib gtest_main ) target_link_libraries(syncPingSelfTest - sync + sync_test_lib gtest_main ) target_link_libraries(syncElectTest - sync + sync_test_lib gtest_main ) target_link_libraries(syncEncodeTest - sync + sync_test_lib gtest_main ) target_link_libraries(syncWriteTest - sync + sync_test_lib gtest_main ) target_link_libraries(syncReplicateTest - sync + sync_test_lib gtest_main ) target_link_libraries(syncRefTest - sync + sync_test_lib gtest_main ) target_link_libraries(syncLogStoreCheck - sync + sync_test_lib gtest_main ) target_link_libraries(syncLogStoreCheck2 - sync + sync_test_lib gtest_main ) target_link_libraries(syncRaftCfgTest - sync + sync_test_lib gtest_main ) target_link_libraries(syncRespMgrTest - sync + sync_test_lib gtest_main ) target_link_libraries(syncSnapshotTest - sync + sync_test_lib gtest_main ) target_link_libraries(syncApplyMsgTest - sync + sync_test_lib gtest_main ) target_link_libraries(syncConfigChangeTest - sync + sync_test_lib gtest_main ) target_link_libraries(syncConfigChangeSnapshotTest - sync + sync_test_lib gtest_main ) target_link_libraries(syncSnapshotSendTest - sync + sync_test_lib gtest_main ) target_link_libraries(syncSnapshotRspTest - sync + sync_test_lib gtest_main ) target_link_libraries(syncSnapshotSenderTest - sync + sync_test_lib gtest_main ) target_link_libraries(syncSnapshotReceiverTest - sync + sync_test_lib gtest_main ) target_link_libraries(syncTestTool - sync + sync_test_lib gtest_main ) target_link_libraries(syncRaftLogTest - sync + sync_test_lib gtest_main ) target_link_libraries(syncRaftLogTest2 - sync + sync_test_lib gtest_main ) target_link_libraries(syncRaftLogTest3 - sync + sync_test_lib gtest_main ) target_link_libraries(syncLeaderTransferTest - sync + sync_test_lib gtest_main ) target_link_libraries(syncRestoreFromSnapshot - sync + sync_test_lib gtest_main ) target_link_libraries(syncRaftCfgIndexTest - sync + sync_test_lib gtest_main ) target_link_libraries(syncHeartbeatTest - sync + sync_test_lib gtest_main ) target_link_libraries(syncHeartbeatReplyTest - sync + sync_test_lib gtest_main ) target_link_libraries(syncLocalCmdTest - sync + sync_test_lib gtest_main ) target_link_libraries(syncPreSnapshotTest - sync + sync_test_lib gtest_main ) target_link_libraries(syncPreSnapshotReplyTest - sync + sync_test_lib gtest_main ) diff --git a/source/libs/sync/test/syncAppendEntriesBatchTest.cpp b/source/libs/sync/test/syncAppendEntriesBatchTest.cpp index f2544d8fec..947a2cb05c 100644 --- a/source/libs/sync/test/syncAppendEntriesBatchTest.cpp +++ b/source/libs/sync/test/syncAppendEntriesBatchTest.cpp @@ -1,11 +1,5 @@ //#include -#include -#include "syncIO.h" -#include "syncInt.h" -#include "syncMessage.h" -#include "syncRaftEntry.h" -#include "syncUtil.h" -#include "trpc.h" +#include "syncTest.h" void logTest() { sTrace("--- sync log test: trace"); diff --git a/source/libs/sync/test/syncAppendEntriesReplyTest.cpp b/source/libs/sync/test/syncAppendEntriesReplyTest.cpp index a5e96233c2..1eb803e846 100644 --- a/source/libs/sync/test/syncAppendEntriesReplyTest.cpp +++ b/source/libs/sync/test/syncAppendEntriesReplyTest.cpp @@ -1,9 +1,5 @@ #include -#include -#include "syncIO.h" -#include "syncInt.h" -#include "syncMessage.h" -#include "syncUtil.h" +#include "syncTest.h" void logTest() { sTrace("--- sync log test: trace"); diff --git a/source/libs/sync/test/syncAppendEntriesTest.cpp b/source/libs/sync/test/syncAppendEntriesTest.cpp index 256c13e267..7b9e04a814 100644 --- a/source/libs/sync/test/syncAppendEntriesTest.cpp +++ b/source/libs/sync/test/syncAppendEntriesTest.cpp @@ -1,9 +1,5 @@ #include -#include -#include "syncIO.h" -#include "syncInt.h" -#include "syncMessage.h" -#include "syncUtil.h" +#include "syncTest.h" void logTest() { sTrace("--- sync log test: trace"); diff --git a/source/libs/sync/test/syncApplyMsgTest.cpp b/source/libs/sync/test/syncApplyMsgTest.cpp index ce129015c6..a8a1931d1d 100644 --- a/source/libs/sync/test/syncApplyMsgTest.cpp +++ b/source/libs/sync/test/syncApplyMsgTest.cpp @@ -1,9 +1,5 @@ #include -#include -#include "syncIO.h" -#include "syncInt.h" -#include "syncMessage.h" -#include "syncUtil.h" +#include "syncTest.h" void logTest() { sTrace("--- sync log test: trace"); diff --git a/source/libs/sync/test/syncClientRequestBatchTest.cpp b/source/libs/sync/test/syncClientRequestBatchTest.cpp deleted file mode 100644 index f07ee08b2b..0000000000 --- a/source/libs/sync/test/syncClientRequestBatchTest.cpp +++ /dev/null @@ -1,125 +0,0 @@ -#include -#include -#include "syncIO.h" -#include "syncInt.h" -#include "syncMessage.h" -#include "syncUtil.h" - -void logTest() { - sTrace("--- sync log test: trace"); - sDebug("--- sync log test: debug"); - sInfo("--- sync log test: info"); - sWarn("--- sync log test: warn"); - sError("--- sync log test: error"); - sFatal("--- sync log test: fatal"); -} - -SRpcMsg *createRpcMsg(int32_t i, int32_t dataLen) { - SyncPing *pSyncMsg = syncPingBuild(20); - snprintf(pSyncMsg->data, pSyncMsg->dataLen, "value_%d", i); - - SRpcMsg *pRpcMsg = (SRpcMsg *)taosMemoryMalloc(sizeof(SRpcMsg)); - memset(pRpcMsg, 0, sizeof(SRpcMsg)); - pRpcMsg->code = 10 * i; - syncPing2RpcMsg(pSyncMsg, pRpcMsg); - - syncPingDestroy(pSyncMsg); - return pRpcMsg; -} - -SyncClientRequestBatch *createMsg() { - SRpcMsg *rpcMsgPArr[5]; - memset(rpcMsgPArr, 0, sizeof(rpcMsgPArr)); - for (int32_t i = 0; i < 5; ++i) { - SRpcMsg *pRpcMsg = createRpcMsg(i, 20); - rpcMsgPArr[i] = pRpcMsg; - // taosMemoryFree(pRpcMsg); - } - - SRaftMeta raftArr[5]; - memset(raftArr, 0, sizeof(raftArr)); - for (int32_t i = 0; i < 5; ++i) { - raftArr[i].seqNum = i * 10; - raftArr[i].isWeak = i % 2; - } - - SyncClientRequestBatch *pMsg = syncClientRequestBatchBuild(rpcMsgPArr, raftArr, 5, 1234); - return pMsg; -} - -void test1() { - SyncClientRequestBatch *pMsg = createMsg(); - syncClientRequestBatchLog2((char *)"==test1==", pMsg); - syncClientRequestBatchDestroyDeep(pMsg); -} - -/* -void test2() { - SyncClientRequest *pMsg = createMsg(); - uint32_t len = pMsg->bytes; - char * serialized = (char *)taosMemoryMalloc(len); - syncClientRequestSerialize(pMsg, serialized, len); - SyncClientRequest *pMsg2 = syncClientRequestAlloc(pMsg->dataLen); - syncClientRequestDeserialize(serialized, len, pMsg2); - syncClientRequestLog2((char *)"test2: syncClientRequestSerialize -> syncClientRequestDeserialize ", pMsg2); - - taosMemoryFree(serialized); - syncClientRequestDestroy(pMsg); - syncClientRequestDestroy(pMsg2); -} - -void test3() { - SyncClientRequest *pMsg = createMsg(); - uint32_t len; - char * serialized = syncClientRequestSerialize2(pMsg, &len); - SyncClientRequest *pMsg2 = syncClientRequestDeserialize2(serialized, len); - syncClientRequestLog2((char *)"test3: syncClientRequestSerialize3 -> syncClientRequestDeserialize2 ", pMsg2); - - taosMemoryFree(serialized); - syncClientRequestDestroy(pMsg); - syncClientRequestDestroy(pMsg2); -} - -void test4() { - SyncClientRequest *pMsg = createMsg(); - SRpcMsg rpcMsg; - syncClientRequest2RpcMsg(pMsg, &rpcMsg); - SyncClientRequest *pMsg2 = (SyncClientRequest *)taosMemoryMalloc(rpcMsg.contLen); - syncClientRequestFromRpcMsg(&rpcMsg, pMsg2); - syncClientRequestLog2((char *)"test4: syncClientRequest2RpcMsg -> syncClientRequestFromRpcMsg ", pMsg2); - - rpcFreeCont(rpcMsg.pCont); - syncClientRequestDestroy(pMsg); - syncClientRequestDestroy(pMsg2); -} - -void test5() { - SyncClientRequest *pMsg = createMsg(); - SRpcMsg rpcMsg; - syncClientRequest2RpcMsg(pMsg, &rpcMsg); - SyncClientRequest *pMsg2 = syncClientRequestFromRpcMsg2(&rpcMsg); - syncClientRequestLog2((char *)"test5: syncClientRequest2RpcMsg -> syncClientRequestFromRpcMsg2 ", pMsg2); - - rpcFreeCont(rpcMsg.pCont); - syncClientRequestDestroy(pMsg); - syncClientRequestDestroy(pMsg2); -} -*/ - -int main() { - gRaftDetailLog = true; - tsAsyncLog = 0; - sDebugFlag = DEBUG_DEBUG + DEBUG_TRACE + DEBUG_SCREEN + DEBUG_FILE; - logTest(); - - test1(); - - /* -test2(); -test3(); -test4(); -test5(); -*/ - - return 0; -} diff --git a/source/libs/sync/test/syncClientRequestTest.cpp b/source/libs/sync/test/syncClientRequestTest.cpp deleted file mode 100644 index b6bfcc2da5..0000000000 --- a/source/libs/sync/test/syncClientRequestTest.cpp +++ /dev/null @@ -1,98 +0,0 @@ -#include -#include -#include "syncIO.h" -#include "syncInt.h" -#include "syncMessage.h" -#include "syncUtil.h" - -void logTest() { - sTrace("--- sync log test: trace"); - sDebug("--- sync log test: debug"); - sInfo("--- sync log test: info"); - sWarn("--- sync log test: warn"); - sError("--- sync log test: error"); - sFatal("--- sync log test: fatal"); -} - -SyncClientRequest *createMsg() { - SRpcMsg rpcMsg; - memset(&rpcMsg, 0, sizeof(rpcMsg)); - rpcMsg.msgType = 12345; - rpcMsg.contLen = 20; - rpcMsg.pCont = rpcMallocCont(rpcMsg.contLen); - strcpy((char *)rpcMsg.pCont, "hello rpc"); - SyncClientRequest *pMsg = syncClientRequestBuild(&rpcMsg, 123, true, 1000); - rpcFreeCont(rpcMsg.pCont); - return pMsg; -} - -void test1() { - SyncClientRequest *pMsg = createMsg(); - syncClientRequestLog2((char *)"test1:", pMsg); - syncClientRequestDestroy(pMsg); -} - -void test2() { - SyncClientRequest *pMsg = createMsg(); - uint32_t len = pMsg->bytes; - char *serialized = (char *)taosMemoryMalloc(len); - syncClientRequestSerialize(pMsg, serialized, len); - SyncClientRequest *pMsg2 = syncClientRequestAlloc(pMsg->dataLen); - syncClientRequestDeserialize(serialized, len, pMsg2); - syncClientRequestLog2((char *)"test2: syncClientRequestSerialize -> syncClientRequestDeserialize ", pMsg2); - - taosMemoryFree(serialized); - syncClientRequestDestroy(pMsg); - syncClientRequestDestroy(pMsg2); -} - -void test3() { - SyncClientRequest *pMsg = createMsg(); - uint32_t len; - char *serialized = syncClientRequestSerialize2(pMsg, &len); - SyncClientRequest *pMsg2 = syncClientRequestDeserialize2(serialized, len); - syncClientRequestLog2((char *)"test3: syncClientRequestSerialize3 -> syncClientRequestDeserialize2 ", pMsg2); - - taosMemoryFree(serialized); - syncClientRequestDestroy(pMsg); - syncClientRequestDestroy(pMsg2); -} - -void test4() { - SyncClientRequest *pMsg = createMsg(); - SRpcMsg rpcMsg = {0}; - syncClientRequest2RpcMsg(pMsg, &rpcMsg); - SyncClientRequest *pMsg2 = (SyncClientRequest *)taosMemoryMalloc(rpcMsg.contLen); - syncClientRequestFromRpcMsg(&rpcMsg, pMsg2); - syncClientRequestLog2((char *)"test4: syncClientRequest2RpcMsg -> syncClientRequestFromRpcMsg ", pMsg2); - - rpcFreeCont(rpcMsg.pCont); - syncClientRequestDestroy(pMsg); - syncClientRequestDestroy(pMsg2); -} - -void test5() { - SyncClientRequest *pMsg = createMsg(); - SRpcMsg rpcMsg = {0}; - syncClientRequest2RpcMsg(pMsg, &rpcMsg); - SyncClientRequest *pMsg2 = syncClientRequestFromRpcMsg2(&rpcMsg); - syncClientRequestLog2((char *)"test5: syncClientRequest2RpcMsg -> syncClientRequestFromRpcMsg2 ", pMsg2); - - rpcFreeCont(rpcMsg.pCont); - syncClientRequestDestroy(pMsg); - syncClientRequestDestroy(pMsg2); -} - -int main() { - tsAsyncLog = 0; - sDebugFlag = DEBUG_TRACE + DEBUG_SCREEN + DEBUG_FILE; - logTest(); - - test1(); - test2(); - test3(); - test4(); - test5(); - - return 0; -} diff --git a/source/libs/sync/test/syncConfigChangeSnapshotTest.cpp b/source/libs/sync/test/syncConfigChangeSnapshotTest.cpp index dcf7249d30..a6d33aa674 100644 --- a/source/libs/sync/test/syncConfigChangeSnapshotTest.cpp +++ b/source/libs/sync/test/syncConfigChangeSnapshotTest.cpp @@ -1,11 +1,5 @@ #include -#include -#include "os.h" -#include "syncEnv.h" -#include "syncIO.h" -#include "syncInt.h" -#include "syncUtil.h" -#include "wal.h" +#include "syncTest.h" void logTest() { sTrace("--- sync log test: trace"); diff --git a/source/libs/sync/test/syncConfigChangeTest.cpp b/source/libs/sync/test/syncConfigChangeTest.cpp index c5548d25d4..cf498933e1 100644 --- a/source/libs/sync/test/syncConfigChangeTest.cpp +++ b/source/libs/sync/test/syncConfigChangeTest.cpp @@ -1,11 +1,5 @@ #include -#include -#include "os.h" -#include "syncEnv.h" -#include "syncIO.h" -#include "syncInt.h" -#include "syncUtil.h" -#include "wal.h" +#include "syncTest.h" void logTest() { sTrace("--- sync log test: trace"); diff --git a/source/libs/sync/test/syncElectTest.cpp b/source/libs/sync/test/syncElectTest.cpp index 5cdbb2cc88..59d731c823 100644 --- a/source/libs/sync/test/syncElectTest.cpp +++ b/source/libs/sync/test/syncElectTest.cpp @@ -1,10 +1,5 @@ #include -#include -#include "syncEnv.h" -#include "syncIO.h" -#include "syncInt.h" -#include "syncUtil.h" -#include "wal.h" +#include "syncTest.h" void logTest() { sTrace("--- sync log test: trace"); diff --git a/source/libs/sync/test/syncEncodeTest.cpp b/source/libs/sync/test/syncEncodeTest.cpp index c60176fbf8..528cc1614d 100644 --- a/source/libs/sync/test/syncEncodeTest.cpp +++ b/source/libs/sync/test/syncEncodeTest.cpp @@ -1,15 +1,7 @@ #include -#include -#include "syncEnv.h" -#include "syncIO.h" -#include "syncInt.h" -#include "syncMessage.h" -#include "syncRaftEntry.h" -#include "syncRaftLog.h" -#include "syncRaftStore.h" -#include "syncUtil.h" -#include "wal.h" +#include "syncTest.h" +#if 0 void logTest() { sTrace("--- sync log test: trace"); sDebug("--- sync log test: debug"); @@ -118,17 +110,7 @@ SyncClientRequest *step3(const SRpcMsg *pMsg) { } SSyncRaftEntry *step4(const SyncClientRequest *pMsg) { - SSyncRaftEntry *pRetMsg = syncEntryBuild2((SyncClientRequest *)pMsg, 100, 0); - return pRetMsg; -} - -char *step5(const SSyncRaftEntry *pMsg, uint32_t *len) { - char *pRetMsg = syncEntrySerialize(pMsg, len); - return pRetMsg; -} - -SSyncRaftEntry *step6(const char *pMsg, uint32_t len) { - SSyncRaftEntry *pRetMsg = syncEntryDeserialize(pMsg, len); + SSyncRaftEntry *pRetMsg = syncEntryBuildFromClientRequest((SyncClientRequest *)pMsg, 100, 0); return pRetMsg; } @@ -137,13 +119,14 @@ SRpcMsg *step7(const SSyncRaftEntry *pMsg) { syncEntry2OriginalRpc(pMsg, pRetMsg); return pRetMsg; } - +#endif int main(int argc, char **argv) { // taosInitLog((char *)"syncTest.log", 100000, 10); tsAsyncLog = 0; sDebugFlag = 143 + 64; void logTest(); +#if 0 myIndex = 0; if (argc >= 2) { myIndex = atoi(argv[1]); @@ -188,20 +171,9 @@ int main(int argc, char **argv) { syncEntryLog2((char *)"==pEntry==", pEntry); - // step5 - uint32_t len; - char *pMsg5 = step5(pMsg4, &len); - char *s = syncUtilPrintBin(pMsg5, len); - printf("==step5== [%s] \n", s); - taosMemoryFree(s); - - // step6 - SSyncRaftEntry *pMsg6 = step6(pMsg5, len); - syncEntryLog2((char *)"==step6==", pMsg6); - // step7 SRpcMsg *pMsg7 = step7(pMsg6); syncRpcMsgLog2((char *)"==step7==", pMsg7); - +#endif return 0; } diff --git a/source/libs/sync/test/syncEnqTest.cpp b/source/libs/sync/test/syncEnqTest.cpp index bb5f968dc6..54bfb1b387 100644 --- a/source/libs/sync/test/syncEnqTest.cpp +++ b/source/libs/sync/test/syncEnqTest.cpp @@ -1,10 +1,5 @@ #include -#include -#include "syncEnv.h" -#include "syncIO.h" -#include "syncInt.h" -#include "syncRaftStore.h" -#include "syncUtil.h" +#include "syncTest.h" void logTest() { sTrace("--- sync log test: trace"); diff --git a/source/libs/sync/test/syncEntryCacheTest.cpp b/source/libs/sync/test/syncEntryCacheTest.cpp index 3ee28ce96b..b86422b0b1 100644 --- a/source/libs/sync/test/syncEntryCacheTest.cpp +++ b/source/libs/sync/test/syncEntryCacheTest.cpp @@ -1,12 +1,4 @@ -#include -#include "syncEnv.h" -#include "syncIO.h" -#include "syncInt.h" -#include "syncRaftLog.h" -#include "syncRaftStore.h" -#include "syncUtil.h" -#include "tref.h" -#include "tskiplist.h" +#include "syncTest.h" void logTest() { sTrace("--- sync log test: trace"); diff --git a/source/libs/sync/test/syncEntryTest.cpp b/source/libs/sync/test/syncEntryTest.cpp index b274408c01..369306b857 100644 --- a/source/libs/sync/test/syncEntryTest.cpp +++ b/source/libs/sync/test/syncEntryTest.cpp @@ -1,11 +1,4 @@ -#include -#include -#include "syncEnv.h" -#include "syncIO.h" -#include "syncInt.h" -#include "syncRaftLog.h" -#include "syncRaftStore.h" -#include "syncUtil.h" +#include "syncTest.h" void logTest() { sTrace("--- sync log test: trace"); @@ -38,10 +31,10 @@ void test2() { pSyncMsg->isWeak = 1; strcpy(pSyncMsg->data, "test2"); - SSyncRaftEntry* pEntry = syncEntryBuild2(pSyncMsg, 100, 200); + SSyncRaftEntry* pEntry = syncEntryBuildFromClientRequest(pSyncMsg, 100, 200); syncEntryPrint(pEntry); - syncClientRequestDestroy(pSyncMsg); + taosMemoryFree(pSyncMsg); syncEntryDestory(pEntry); } @@ -52,10 +45,10 @@ void test3() { pSyncMsg->isWeak = 1; strcpy(pSyncMsg->data, "test3"); - SSyncRaftEntry* pEntry = syncEntryBuild3(pSyncMsg, 100, 200); + SSyncRaftEntry* pEntry = syncEntryBuildFromClientRequest(pSyncMsg, 100, 200); syncEntryPrint(pEntry); - syncClientRequestDestroy(pSyncMsg); + taosMemoryFree(pSyncMsg); syncEntryDestory(pEntry); } @@ -71,14 +64,7 @@ void test4() { strcpy(pEntry->data, "test4"); syncEntryPrint(pEntry); - uint32_t len; - char* serialized = syncEntrySerialize(pEntry, &len); - assert(serialized != NULL); - SSyncRaftEntry* pEntry2 = syncEntryDeserialize(serialized, len); - syncEntryPrint(pEntry2); - - taosMemoryFree(serialized); - syncEntryDestory(pEntry2); + // syncEntryDestory(pEntry2); syncEntryDestory(pEntry); } diff --git a/source/libs/sync/test/syncEnvTest.cpp b/source/libs/sync/test/syncEnvTest.cpp index a220c2aed4..3cd6048428 100644 --- a/source/libs/sync/test/syncEnvTest.cpp +++ b/source/libs/sync/test/syncEnvTest.cpp @@ -1,9 +1,4 @@ -#include "syncEnv.h" -#include -#include "syncIO.h" -#include "syncInt.h" -#include "syncRaftStore.h" -#include "ttime.h" +#include "syncTest.h" void logTest() { sTrace("--- sync log test: trace"); diff --git a/source/libs/sync/test/syncHashCacheTest.cpp b/source/libs/sync/test/syncHashCacheTest.cpp index 7d822971da..14a29c9a1e 100644 --- a/source/libs/sync/test/syncHashCacheTest.cpp +++ b/source/libs/sync/test/syncHashCacheTest.cpp @@ -1,11 +1,4 @@ -#include -#include "syncEnv.h" -#include "syncIO.h" -#include "syncInt.h" -#include "syncRaftLog.h" -#include "syncRaftStore.h" -#include "syncUtil.h" -#include "tskiplist.h" +#include "syncTest.h" void logTest() { sTrace("--- sync log test: trace"); diff --git a/source/libs/sync/test/syncHeartbeatReplyTest.cpp b/source/libs/sync/test/syncHeartbeatReplyTest.cpp index 1fac03652b..6f7f4d18f3 100644 --- a/source/libs/sync/test/syncHeartbeatReplyTest.cpp +++ b/source/libs/sync/test/syncHeartbeatReplyTest.cpp @@ -1,9 +1,5 @@ #include -#include -#include "syncIO.h" -#include "syncInt.h" -#include "syncMessage.h" -#include "syncUtil.h" +#include "syncTest.h" void logTest() { sTrace("--- sync log test: trace"); diff --git a/source/libs/sync/test/syncHeartbeatTest.cpp b/source/libs/sync/test/syncHeartbeatTest.cpp index b0c0554355..c8c38c0c38 100644 --- a/source/libs/sync/test/syncHeartbeatTest.cpp +++ b/source/libs/sync/test/syncHeartbeatTest.cpp @@ -1,9 +1,5 @@ #include -#include -#include "syncIO.h" -#include "syncInt.h" -#include "syncMessage.h" -#include "syncUtil.h" +#include "syncTest.h" void logTest() { sTrace("--- sync log test: trace"); diff --git a/source/libs/sync/test/syncIOClientTest.cpp b/source/libs/sync/test/syncIOClientTest.cpp index bd0221114a..f66a854657 100644 --- a/source/libs/sync/test/syncIOClientTest.cpp +++ b/source/libs/sync/test/syncIOClientTest.cpp @@ -1,10 +1,4 @@ -#include -#include -#include "syncIO.h" -#include "syncInt.h" -#include "syncMessage.h" -#include "syncUtil.h" -#include "tdatablock.h" +#include "syncTest.h" void logTest() { sTrace("--- sync log test: trace"); diff --git a/source/libs/sync/test/syncIOSendMsgTest.cpp b/source/libs/sync/test/syncIOSendMsgTest.cpp index f88e4f240d..a082f9373a 100644 --- a/source/libs/sync/test/syncIOSendMsgTest.cpp +++ b/source/libs/sync/test/syncIOSendMsgTest.cpp @@ -1,10 +1,4 @@ -#include -#include -#include "syncEnv.h" -#include "syncIO.h" -#include "syncInt.h" -#include "syncRaftStore.h" -#include "syncUtil.h" +#include "syncTest.h" void logTest() { sTrace("--- sync log test: trace"); @@ -101,7 +95,7 @@ int main(int argc, char** argv) { syncPingReply2RpcMsg(pSyncMsg, &rpcMsg); SEpSet epSet; - syncUtilnodeInfo2EpSet(&pSyncNode->myNodeInfo, &epSet); + syncUtilNodeInfo2EpSet(&pSyncNode->myNodeInfo, &epSet); rpcMsg.info.noResp = 1; pSyncNode->syncSendMSg(&epSet, &rpcMsg); diff --git a/source/libs/sync/test/syncIOServerTest.cpp b/source/libs/sync/test/syncIOServerTest.cpp index 1d7402e461..add7d6df60 100644 --- a/source/libs/sync/test/syncIOServerTest.cpp +++ b/source/libs/sync/test/syncIOServerTest.cpp @@ -1,8 +1,4 @@ -#include -#include -#include "syncIO.h" -#include "syncInt.h" -#include "syncRaftStore.h" +#include "syncTest.h" void logTest() { sTrace("--- sync log test: trace"); diff --git a/source/libs/sync/test/syncIOTickPingTest.cpp b/source/libs/sync/test/syncIOTickPingTest.cpp index 9c2342828e..71274f5ca3 100644 --- a/source/libs/sync/test/syncIOTickPingTest.cpp +++ b/source/libs/sync/test/syncIOTickPingTest.cpp @@ -1,8 +1,5 @@ #include -#include -#include "syncIO.h" -#include "syncInt.h" -#include "syncRaftStore.h" +#include "syncTest.h" void logTest() { sTrace("--- sync log test: trace"); diff --git a/source/libs/sync/test/syncIOTickQTest.cpp b/source/libs/sync/test/syncIOTickQTest.cpp index 64b65f25c8..9ef8a7ad40 100644 --- a/source/libs/sync/test/syncIOTickQTest.cpp +++ b/source/libs/sync/test/syncIOTickQTest.cpp @@ -1,8 +1,5 @@ #include -#include -#include "syncIO.h" -#include "syncInt.h" -#include "syncRaftStore.h" +#include "syncTest.h" void logTest() { sTrace("--- sync log test: trace"); diff --git a/source/libs/sync/test/syncIndexMgrTest.cpp b/source/libs/sync/test/syncIndexMgrTest.cpp index 23b8693a0b..f84119045f 100644 --- a/source/libs/sync/test/syncIndexMgrTest.cpp +++ b/source/libs/sync/test/syncIndexMgrTest.cpp @@ -1,12 +1,4 @@ -#include "syncIndexMgr.h" -//#include -#include -#include "syncEnv.h" -#include "syncIO.h" -#include "syncInt.h" -#include "syncRaftStore.h" -#include "syncUtil.h" -#include "syncVoteMgr.h" +#include "syncTest.h" void logTest() { sTrace("--- sync log test: trace"); diff --git a/source/libs/sync/test/syncIndexTest.cpp b/source/libs/sync/test/syncIndexTest.cpp index 763117c0c9..a44d9c4e31 100644 --- a/source/libs/sync/test/syncIndexTest.cpp +++ b/source/libs/sync/test/syncIndexTest.cpp @@ -1,8 +1,4 @@ -#include -#include -#include "syncIO.h" -#include "syncInt.h" -#include "syncRaftStore.h" +#include "syncTest.h" void print(SHashObj *pNextIndex) { printf("----------------\n"); diff --git a/source/libs/sync/test/syncInitTest.cpp b/source/libs/sync/test/syncInitTest.cpp index 2fe5dd7e18..b15a767db5 100644 --- a/source/libs/sync/test/syncInitTest.cpp +++ b/source/libs/sync/test/syncInitTest.cpp @@ -1,10 +1,4 @@ -#include -#include -#include "syncEnv.h" -#include "syncIO.h" -#include "syncInt.h" -#include "syncRaftStore.h" -#include "syncUtil.h" +#include "syncTest.h" void logTest() { sTrace("--- sync log test: trace"); diff --git a/source/libs/sync/test/syncLeaderTransferTest.cpp b/source/libs/sync/test/syncLeaderTransferTest.cpp index bd1f22edff..fd8cdfaac0 100644 --- a/source/libs/sync/test/syncLeaderTransferTest.cpp +++ b/source/libs/sync/test/syncLeaderTransferTest.cpp @@ -1,9 +1,5 @@ #include -#include -#include "syncIO.h" -#include "syncInt.h" -#include "syncMessage.h" -#include "syncUtil.h" +#include "syncTest.h" void logTest() { sTrace("--- sync log test: trace"); diff --git a/source/libs/sync/test/syncLocalCmdTest.cpp b/source/libs/sync/test/syncLocalCmdTest.cpp index b42626df29..fa0d91d45f 100644 --- a/source/libs/sync/test/syncLocalCmdTest.cpp +++ b/source/libs/sync/test/syncLocalCmdTest.cpp @@ -1,9 +1,5 @@ #include -#include -#include "syncIO.h" -#include "syncInt.h" -#include "syncMessage.h" -#include "syncUtil.h" +#include "syncTest.h" void logTest() { sTrace("--- sync log test: trace"); diff --git a/source/libs/sync/test/syncLogStoreCheck.cpp b/source/libs/sync/test/syncLogStoreCheck.cpp index 431b291ca7..e02c484729 100644 --- a/source/libs/sync/test/syncLogStoreCheck.cpp +++ b/source/libs/sync/test/syncLogStoreCheck.cpp @@ -1,12 +1,5 @@ #include -#include -#include "syncEnv.h" -#include "syncIO.h" -#include "syncInt.h" -#include "syncRaftLog.h" -#include "syncRaftStore.h" -#include "syncUtil.h" -#include "wal.h" +#include "syncTest.h" void logTest() { sTrace("--- sync log test: trace"); diff --git a/source/libs/sync/test/syncLogStoreCheck2.cpp b/source/libs/sync/test/syncLogStoreCheck2.cpp index 80679bc85c..fce0a21a47 100644 --- a/source/libs/sync/test/syncLogStoreCheck2.cpp +++ b/source/libs/sync/test/syncLogStoreCheck2.cpp @@ -1,12 +1,5 @@ #include -#include -#include "syncEnv.h" -#include "syncIO.h" -#include "syncInt.h" -#include "syncRaftLog.h" -#include "syncRaftStore.h" -#include "syncUtil.h" -#include "wal.h" +#include "syncTest.h" void logTest() { sTrace("--- sync log test: trace"); diff --git a/source/libs/sync/test/syncLogStoreTest.cpp b/source/libs/sync/test/syncLogStoreTest.cpp index 9ff0ed2089..1b898803ef 100644 --- a/source/libs/sync/test/syncLogStoreTest.cpp +++ b/source/libs/sync/test/syncLogStoreTest.cpp @@ -1,12 +1,5 @@ #include -#include -#include "syncEnv.h" -#include "syncIO.h" -#include "syncInt.h" -#include "syncRaftLog.h" -#include "syncRaftStore.h" -#include "syncUtil.h" -#include "wal.h" +#include "syncTest.h" void logTest() { sTrace("--- sync log test: trace"); diff --git a/source/libs/sync/test/syncPingReplyTest.cpp b/source/libs/sync/test/syncPingReplyTest.cpp index e5158a7932..661509e9a2 100644 --- a/source/libs/sync/test/syncPingReplyTest.cpp +++ b/source/libs/sync/test/syncPingReplyTest.cpp @@ -1,9 +1,5 @@ #include -#include -#include "syncIO.h" -#include "syncInt.h" -#include "syncMessage.h" -#include "syncUtil.h" +#include "syncTest.h" void logTest() { sTrace("--- sync log test: trace"); diff --git a/source/libs/sync/test/syncPingSelfTest.cpp b/source/libs/sync/test/syncPingSelfTest.cpp index 781ffc31db..19f377e037 100644 --- a/source/libs/sync/test/syncPingSelfTest.cpp +++ b/source/libs/sync/test/syncPingSelfTest.cpp @@ -1,10 +1,5 @@ #include -#include -#include "syncEnv.h" -#include "syncIO.h" -#include "syncInt.h" -#include "syncRaftStore.h" -#include "syncUtil.h" +#include "syncTest.h" void logTest() { sTrace("--- sync log test: trace"); diff --git a/source/libs/sync/test/syncPingTest.cpp b/source/libs/sync/test/syncPingTest.cpp index 1777b9b9e2..54cc506b03 100644 --- a/source/libs/sync/test/syncPingTest.cpp +++ b/source/libs/sync/test/syncPingTest.cpp @@ -1,9 +1,5 @@ #include -#include -#include "syncIO.h" -#include "syncInt.h" -#include "syncMessage.h" -#include "syncUtil.h" +#include "syncTest.h" void logTest() { sTrace("--- sync log test: trace"); diff --git a/source/libs/sync/test/syncPingTimerTest.cpp b/source/libs/sync/test/syncPingTimerTest.cpp index 5a0b5e9953..ded7e22eac 100644 --- a/source/libs/sync/test/syncPingTimerTest.cpp +++ b/source/libs/sync/test/syncPingTimerTest.cpp @@ -1,10 +1,5 @@ #include -#include -#include "syncEnv.h" -#include "syncIO.h" -#include "syncInt.h" -#include "syncRaftStore.h" -#include "syncUtil.h" +#include "syncTest.h" void logTest() { sTrace("--- sync log test: trace"); diff --git a/source/libs/sync/test/syncPingTimerTest2.cpp b/source/libs/sync/test/syncPingTimerTest2.cpp index 09f56815cd..4f1bb64798 100644 --- a/source/libs/sync/test/syncPingTimerTest2.cpp +++ b/source/libs/sync/test/syncPingTimerTest2.cpp @@ -1,10 +1,5 @@ #include -#include -#include "syncEnv.h" -#include "syncIO.h" -#include "syncInt.h" -#include "syncRaftStore.h" -#include "syncUtil.h" +#include "syncTest.h" void logTest() { sTrace("--- sync log test: trace"); diff --git a/source/libs/sync/test/syncPreSnapshotReplyTest.cpp b/source/libs/sync/test/syncPreSnapshotReplyTest.cpp index a30dcc2c54..e5175f1101 100644 --- a/source/libs/sync/test/syncPreSnapshotReplyTest.cpp +++ b/source/libs/sync/test/syncPreSnapshotReplyTest.cpp @@ -1,10 +1,6 @@ #include -#include -#include "syncIO.h" -#include "syncInt.h" -#include "syncMessage.h" -#include "syncUtil.h" +#include "syncTest.h" void logTest() { sTrace("--- sync log test: trace"); diff --git a/source/libs/sync/test/syncPreSnapshotTest.cpp b/source/libs/sync/test/syncPreSnapshotTest.cpp index 03894dfa84..2ce95abea3 100644 --- a/source/libs/sync/test/syncPreSnapshotTest.cpp +++ b/source/libs/sync/test/syncPreSnapshotTest.cpp @@ -1,9 +1,5 @@ #include -#include -#include "syncIO.h" -#include "syncInt.h" -#include "syncMessage.h" -#include "syncUtil.h" +#include "syncTest.h" void logTest() { sTrace("--- sync log test: trace"); diff --git a/source/libs/sync/test/syncRaftCfgIndexTest.cpp b/source/libs/sync/test/syncRaftCfgIndexTest.cpp index 522da159b5..e6d3f23b58 100644 --- a/source/libs/sync/test/syncRaftCfgIndexTest.cpp +++ b/source/libs/sync/test/syncRaftCfgIndexTest.cpp @@ -1,10 +1,5 @@ #include "syncRaftStore.h" -//#include -#include -#include "syncIO.h" -#include "syncInt.h" -#include "syncRaftCfg.h" -#include "syncUtil.h" +#include "syncTest.h" void logTest() { sTrace("--- sync log test: trace"); diff --git a/source/libs/sync/test/syncRaftCfgTest.cpp b/source/libs/sync/test/syncRaftCfgTest.cpp index b1f820c78e..c841a68fde 100644 --- a/source/libs/sync/test/syncRaftCfgTest.cpp +++ b/source/libs/sync/test/syncRaftCfgTest.cpp @@ -1,10 +1,4 @@ -#include "syncRaftStore.h" -//#include -#include -#include "syncIO.h" -#include "syncInt.h" -#include "syncRaftCfg.h" -#include "syncUtil.h" +#include "syncTest.h" void logTest() { sTrace("--- sync log test: trace"); diff --git a/source/libs/sync/test/syncRaftIdCheck.cpp b/source/libs/sync/test/syncRaftIdCheck.cpp index e7ef69da20..08716c876b 100644 --- a/source/libs/sync/test/syncRaftIdCheck.cpp +++ b/source/libs/sync/test/syncRaftIdCheck.cpp @@ -1,8 +1,5 @@ #include -#include -#include "syncIO.h" -#include "syncInt.h" -#include "syncUtil.h" +#include "syncTest.h" void usage(char* exe) { printf("Usage: %s host port \n", exe); diff --git a/source/libs/sync/test/syncRaftLogTest.cpp b/source/libs/sync/test/syncRaftLogTest.cpp index 278113919a..e309a2e432 100644 --- a/source/libs/sync/test/syncRaftLogTest.cpp +++ b/source/libs/sync/test/syncRaftLogTest.cpp @@ -1,12 +1,5 @@ #include "syncRaftLog.h" -//#include -#include -#include "syncEnv.h" -#include "syncIO.h" -#include "syncInt.h" -#include "syncRaftStore.h" -#include "syncUtil.h" -#include "wal.h" +#include "syncTest.h" void logTest() { sTrace("--- sync log test: trace"); diff --git a/source/libs/sync/test/syncRaftLogTest2.cpp b/source/libs/sync/test/syncRaftLogTest2.cpp index 78c08a6d8d..a7752dcb8b 100644 --- a/source/libs/sync/test/syncRaftLogTest2.cpp +++ b/source/libs/sync/test/syncRaftLogTest2.cpp @@ -1,12 +1,5 @@ #include -#include -#include "syncEnv.h" -#include "syncIO.h" -#include "syncInt.h" -#include "syncRaftLog.h" -#include "syncRaftStore.h" -#include "syncUtil.h" -#include "wal.h" +#include "syncTest.h" void logTest() { sTrace("--- sync log test: trace"); diff --git a/source/libs/sync/test/syncRaftLogTest3.cpp b/source/libs/sync/test/syncRaftLogTest3.cpp index cf862feb2a..31c06625aa 100644 --- a/source/libs/sync/test/syncRaftLogTest3.cpp +++ b/source/libs/sync/test/syncRaftLogTest3.cpp @@ -1,12 +1,5 @@ #include -#include -#include "syncEnv.h" -#include "syncIO.h" -#include "syncInt.h" -#include "syncRaftLog.h" -#include "syncRaftStore.h" -#include "syncUtil.h" -#include "wal.h" +#include "syncTest.h" void logTest() { sTrace("--- sync log test: trace"); diff --git a/source/libs/sync/test/syncRaftStoreTest.cpp b/source/libs/sync/test/syncRaftStoreTest.cpp index 070f8c0f07..87798a7d80 100644 --- a/source/libs/sync/test/syncRaftStoreTest.cpp +++ b/source/libs/sync/test/syncRaftStoreTest.cpp @@ -1,9 +1,5 @@ #include "syncRaftStore.h" -//#include -#include -#include "syncIO.h" -#include "syncInt.h" -#include "syncUtil.h" +#include "syncTest.h" void logTest() { sTrace("--- sync log test: trace"); diff --git a/source/libs/sync/test/syncRefTest.cpp b/source/libs/sync/test/syncRefTest.cpp index c5132018a2..47bc290abe 100644 --- a/source/libs/sync/test/syncRefTest.cpp +++ b/source/libs/sync/test/syncRefTest.cpp @@ -1,9 +1,5 @@ #include -#include -#include "syncIO.h" -#include "syncInt.h" -#include "syncRaftStore.h" -#include "tref.h" +#include "syncTest.h" void logTest() { sTrace("--- sync log test: trace"); diff --git a/source/libs/sync/test/syncReplicateTest.cpp b/source/libs/sync/test/syncReplicateTest.cpp index 7506ae19bd..2419ec0974 100644 --- a/source/libs/sync/test/syncReplicateTest.cpp +++ b/source/libs/sync/test/syncReplicateTest.cpp @@ -1,10 +1,5 @@ #include -#include -#include "syncEnv.h" -#include "syncIO.h" -#include "syncInt.h" -#include "syncUtil.h" -#include "wal.h" +#include "syncTest.h" void logTest() { sTrace("--- sync log test: trace"); diff --git a/source/libs/sync/test/syncRequestVoteReplyTest.cpp b/source/libs/sync/test/syncRequestVoteReplyTest.cpp index 3d9db17725..973ccf040c 100644 --- a/source/libs/sync/test/syncRequestVoteReplyTest.cpp +++ b/source/libs/sync/test/syncRequestVoteReplyTest.cpp @@ -1,9 +1,5 @@ #include -#include -#include "syncIO.h" -#include "syncInt.h" -#include "syncMessage.h" -#include "syncUtil.h" +#include "syncTest.h" void logTest() { sTrace("--- sync log test: trace"); diff --git a/source/libs/sync/test/syncRequestVoteTest.cpp b/source/libs/sync/test/syncRequestVoteTest.cpp index 94e1504add..275f7804bf 100644 --- a/source/libs/sync/test/syncRequestVoteTest.cpp +++ b/source/libs/sync/test/syncRequestVoteTest.cpp @@ -1,9 +1,5 @@ #include -#include -#include "syncIO.h" -#include "syncInt.h" -#include "syncMessage.h" -#include "syncUtil.h" +#include "syncTest.h" void logTest() { sTrace("--- sync log test: trace"); diff --git a/source/libs/sync/test/syncRespMgrTest.cpp b/source/libs/sync/test/syncRespMgrTest.cpp index bf9c070b47..b609ef1a0e 100644 --- a/source/libs/sync/test/syncRespMgrTest.cpp +++ b/source/libs/sync/test/syncRespMgrTest.cpp @@ -1,8 +1,4 @@ -#include "syncRespMgr.h" -//#include -#include -#include "syncIO.h" -#include "syncInt.h" +#include "syncTest.h" void logTest() { sTrace("--- sync log test: trace"); diff --git a/source/libs/sync/test/syncRestoreFromSnapshot.cpp b/source/libs/sync/test/syncRestoreFromSnapshot.cpp index 470dd678b0..44444a7f5e 100644 --- a/source/libs/sync/test/syncRestoreFromSnapshot.cpp +++ b/source/libs/sync/test/syncRestoreFromSnapshot.cpp @@ -1,12 +1,5 @@ #include -#include -#include "syncEnv.h" -#include "syncIO.h" -#include "syncInt.h" -#include "syncRaftLog.h" -#include "syncRaftStore.h" -#include "syncUtil.h" -#include "wal.h" +#include "syncTest.h" void logTest() { sTrace("--- sync log test: trace"); diff --git a/source/libs/sync/test/syncRpcMsgTest.cpp b/source/libs/sync/test/syncRpcMsgTest.cpp index 941fa7eab5..3f66cd9d1c 100644 --- a/source/libs/sync/test/syncRpcMsgTest.cpp +++ b/source/libs/sync/test/syncRpcMsgTest.cpp @@ -1,9 +1,5 @@ #include -#include -#include "syncIO.h" -#include "syncInt.h" -#include "syncMessage.h" -#include "syncUtil.h" +#include "syncTest.h" void logTest() { sTrace("--- sync log test: trace"); @@ -47,7 +43,11 @@ SyncClientRequest *createSyncClientRequest() { rpcMsg.contLen = 20; rpcMsg.pCont = rpcMallocCont(rpcMsg.contLen); strcpy((char *)rpcMsg.pCont, "hello rpc"); - SyncClientRequest *pMsg = syncClientRequestBuild(&rpcMsg, 123, true, 1000); + + SRpcMsg clientRequestMsg; + syncClientRequestBuildFromRpcMsg(&clientRequestMsg, &rpcMsg, 123, true, 1000); + SyncClientRequest *pMsg = (SyncClientRequest *)taosMemoryMalloc(clientRequestMsg.contLen); + memcpy(pMsg->data, clientRequestMsg.pCont, clientRequestMsg.contLen); return pMsg; } @@ -155,11 +155,13 @@ void test7() { } void test8() { +#if 0 SyncClientRequest *pMsg = createSyncClientRequest(); SRpcMsg rpcMsg = {0}; syncClientRequest2RpcMsg(pMsg, &rpcMsg); syncRpcMsgLog2((char *)"test8", &rpcMsg); - syncClientRequestDestroy(pMsg); + taosMemoryFree(pMsg); +#endif } int main() { diff --git a/source/libs/sync/test/syncSnapshotReceiverTest.cpp b/source/libs/sync/test/syncSnapshotReceiverTest.cpp index 6eb8548740..49b06a7d1b 100644 --- a/source/libs/sync/test/syncSnapshotReceiverTest.cpp +++ b/source/libs/sync/test/syncSnapshotReceiverTest.cpp @@ -1,11 +1,5 @@ #include -#include -#include "syncIO.h" -#include "syncInt.h" -#include "syncMessage.h" -#include "syncRaftStore.h" -#include "syncSnapshot.h" -#include "syncUtil.h" +#include "syncTest.h" void logTest() { sTrace("--- sync log test: trace"); diff --git a/source/libs/sync/test/syncSnapshotRspTest.cpp b/source/libs/sync/test/syncSnapshotRspTest.cpp index 63905c2182..0a06b512ea 100644 --- a/source/libs/sync/test/syncSnapshotRspTest.cpp +++ b/source/libs/sync/test/syncSnapshotRspTest.cpp @@ -1,9 +1,5 @@ #include -#include -#include "syncIO.h" -#include "syncInt.h" -#include "syncMessage.h" -#include "syncUtil.h" +#include "syncTest.h" void logTest() { sTrace("--- sync log test: trace"); diff --git a/source/libs/sync/test/syncSnapshotSendTest.cpp b/source/libs/sync/test/syncSnapshotSendTest.cpp index 83f1dfebb3..46f33e0c56 100644 --- a/source/libs/sync/test/syncSnapshotSendTest.cpp +++ b/source/libs/sync/test/syncSnapshotSendTest.cpp @@ -1,9 +1,5 @@ #include -#include -#include "syncIO.h" -#include "syncInt.h" -#include "syncMessage.h" -#include "syncUtil.h" +#include "syncTest.h" void logTest() { sTrace("--- sync log test: trace"); diff --git a/source/libs/sync/test/syncSnapshotSenderTest.cpp b/source/libs/sync/test/syncSnapshotSenderTest.cpp index 7b2c13463c..9a234d412e 100644 --- a/source/libs/sync/test/syncSnapshotSenderTest.cpp +++ b/source/libs/sync/test/syncSnapshotSenderTest.cpp @@ -1,11 +1,5 @@ #include -#include -#include "syncIO.h" -#include "syncInt.h" -#include "syncMessage.h" -#include "syncRaftStore.h" -#include "syncSnapshot.h" -#include "syncUtil.h" +#include "syncTest.h" void logTest() { sTrace("--- sync log test: trace"); diff --git a/source/libs/sync/test/syncSnapshotTest.cpp b/source/libs/sync/test/syncSnapshotTest.cpp index a1cedd624a..40eac0b55f 100644 --- a/source/libs/sync/test/syncSnapshotTest.cpp +++ b/source/libs/sync/test/syncSnapshotTest.cpp @@ -1,14 +1,5 @@ #include -#include -#include "syncEnv.h" -#include "syncIO.h" -#include "syncInt.h" -#include "syncMessage.h" -#include "syncRaftEntry.h" -#include "syncRaftLog.h" -#include "syncRaftStore.h" -#include "syncUtil.h" -#include "wal.h" +#include "syncTest.h" void logTest() { sTrace("--- sync log test: trace"); @@ -162,8 +153,11 @@ SRpcMsg *step0() { } SyncClientRequest *step1(const SRpcMsg *pMsg) { - SyncClientRequest *pRetMsg = syncClientRequestBuild(pMsg, 123, true, 1000); - return pRetMsg; + SRpcMsg clientRequestMsg; + syncClientRequestBuildFromRpcMsg(&clientRequestMsg, pMsg, 123, true, 1000); + SyncClientRequest *pMsg2 = (SyncClientRequest *)taosMemoryMalloc(clientRequestMsg.contLen); + memcpy(pMsg2->data, clientRequestMsg.pCont, clientRequestMsg.contLen); + return pMsg2; } int main(int argc, char **argv) { @@ -207,8 +201,8 @@ int main(int argc, char **argv) { for (int i = 0; i < 10; ++i) { SyncClientRequest *pSyncClientRequest = pMsg1; SRpcMsg rpcMsg = {0}; - syncClientRequest2RpcMsg(pSyncClientRequest, &rpcMsg); - gSyncNode->syncEqMsg(gSyncNode->msgcb, &rpcMsg); + // syncClientRequest2RpcMsg(pSyncClientRequest, &rpcMsg); + // gSyncNode->syncEqMsg(gSyncNode->msgcb, &rpcMsg); taosMsleep(1000); } diff --git a/source/libs/sync/test/syncTest.cpp b/source/libs/sync/test/syncTest.cpp index 97de81572a..55480802da 100644 --- a/source/libs/sync/test/syncTest.cpp +++ b/source/libs/sync/test/syncTest.cpp @@ -1,7 +1,5 @@ #include -#include -#include "syncIO.h" -#include "syncInt.h" +#include "syncTest.h" /* typedef enum { diff --git a/source/libs/sync/test/syncTestTool.cpp b/source/libs/sync/test/syncTestTool.cpp index e6f6006410..b0fe612b7f 100644 --- a/source/libs/sync/test/syncTestTool.cpp +++ b/source/libs/sync/test/syncTestTool.cpp @@ -1,12 +1,5 @@ #include -#include -#include "os.h" -#include "syncEnv.h" -#include "syncIO.h" -#include "syncInt.h" -#include "syncRaftCfg.h" -#include "syncUtil.h" -#include "wal.h" +#include "syncTest.h" void logTest() { sTrace("--- sync log test: trace"); diff --git a/source/libs/sync/test/syncTimeoutTest.cpp b/source/libs/sync/test/syncTimeoutTest.cpp index bae5e0ea88..ed0742f499 100644 --- a/source/libs/sync/test/syncTimeoutTest.cpp +++ b/source/libs/sync/test/syncTimeoutTest.cpp @@ -1,9 +1,5 @@ #include -#include -#include "syncIO.h" -#include "syncInt.h" -#include "syncMessage.h" -#include "syncUtil.h" +#include "syncTest.h" void logTest() { sTrace("--- sync log test: trace"); diff --git a/source/libs/sync/test/syncUtilTest.cpp b/source/libs/sync/test/syncUtilTest.cpp index 411915fe22..bbd4fa7d18 100644 --- a/source/libs/sync/test/syncUtilTest.cpp +++ b/source/libs/sync/test/syncUtilTest.cpp @@ -1,9 +1,4 @@ -#include "syncUtil.h" -//#include -#include -#include "syncIO.h" -#include "syncInt.h" -#include "syncRaftStore.h" +#include "syncTest.h" void logTest() { sTrace("--- sync log test: trace"); diff --git a/source/libs/sync/test/syncVotesGrantedTest.cpp b/source/libs/sync/test/syncVotesGrantedTest.cpp index bbf14c604e..2d2a12c656 100644 --- a/source/libs/sync/test/syncVotesGrantedTest.cpp +++ b/source/libs/sync/test/syncVotesGrantedTest.cpp @@ -1,11 +1,4 @@ -#include -#include -#include "syncEnv.h" -#include "syncIO.h" -#include "syncInt.h" -#include "syncRaftStore.h" -#include "syncUtil.h" -#include "syncVoteMgr.h" +#include "syncTest.h" void logTest() { sTrace("--- sync log test: trace"); diff --git a/source/libs/sync/test/syncVotesRespondTest.cpp b/source/libs/sync/test/syncVotesRespondTest.cpp index adebfe1be2..712e97edc9 100644 --- a/source/libs/sync/test/syncVotesRespondTest.cpp +++ b/source/libs/sync/test/syncVotesRespondTest.cpp @@ -1,11 +1,5 @@ #include -#include -#include "syncEnv.h" -#include "syncIO.h" -#include "syncInt.h" -#include "syncRaftStore.h" -#include "syncUtil.h" -#include "syncVoteMgr.h" +#include "syncTest.h" void logTest() { sTrace("--- sync log test: trace"); diff --git a/source/libs/sync/test/syncWriteTest.cpp b/source/libs/sync/test/syncWriteTest.cpp index 7c5334f668..56dd0a5845 100644 --- a/source/libs/sync/test/syncWriteTest.cpp +++ b/source/libs/sync/test/syncWriteTest.cpp @@ -1,14 +1,5 @@ #include -#include -#include "syncEnv.h" -#include "syncIO.h" -#include "syncInt.h" -#include "syncMessage.h" -#include "syncRaftEntry.h" -#include "syncRaftLog.h" -#include "syncRaftStore.h" -#include "syncUtil.h" -#include "wal.h" +#include "syncTest.h" void logTest() { sTrace("--- sync log test: trace"); @@ -140,7 +131,8 @@ SRpcMsg *step0() { } SyncClientRequest *step1(const SRpcMsg *pMsg) { - SyncClientRequest *pRetMsg = syncClientRequestBuild(pMsg, 123, true, 1000); + SyncClientRequest *pRetMsg = NULL; + // syncClientRequestBuild(pMsg, 123, true, 1000); return pRetMsg; } @@ -179,14 +171,14 @@ int main(int argc, char **argv) { SyncClientRequest *pMsg1 = step1(pMsg0); syncClientRequestLog2((char *)"==step1==", pMsg1); - for (int i = 0; i < 10; ++i) { - SyncClientRequest *pSyncClientRequest = pMsg1; - SRpcMsg rpcMsg = {0}; - syncClientRequest2RpcMsg(pSyncClientRequest, &rpcMsg); - gSyncNode->syncEqMsg(gSyncNode->msgcb, &rpcMsg); + // for (int i = 0; i < 10; ++i) { + // SyncClientRequest *pSyncClientRequest = pMsg1; + // SRpcMsg rpcMsg = {0}; + // syncClientRequest2RpcMsg(pSyncClientRequest, &rpcMsg); + // gSyncNode->syncEqMsg(gSyncNode->msgcb, &rpcMsg); - taosMsleep(1000); - } + // taosMsleep(1000); + // } while (1) { sTrace("while 1 sleep"); diff --git a/source/libs/sync/test/sync_test_lib/CMakeLists.txt b/source/libs/sync/test/sync_test_lib/CMakeLists.txt new file mode 100644 index 0000000000..db775c3662 --- /dev/null +++ b/source/libs/sync/test/sync_test_lib/CMakeLists.txt @@ -0,0 +1,14 @@ +aux_source_directory(src SYNC_TEST_SRC) +add_library(sync_test_lib STATIC ${SYNC_TEST_SRC}) + +target_link_libraries( + sync_test_lib + PUBLIC sync +) + +target_include_directories( + sync_test_lib + PUBLIC "${TD_SOURCE_DIR}/include/libs/sync" + PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/../../inc" + PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/inc" +) diff --git a/source/libs/sync/inc/syncIO.h b/source/libs/sync/test/sync_test_lib/inc/syncIO.h similarity index 95% rename from source/libs/sync/inc/syncIO.h rename to source/libs/sync/test/sync_test_lib/inc/syncIO.h index cfc4dd2472..955a832b68 100644 --- a/source/libs/sync/inc/syncIO.h +++ b/source/libs/sync/test/sync_test_lib/inc/syncIO.h @@ -50,7 +50,7 @@ typedef struct SSyncIO { void *pSyncNode; int32_t (*FpOnSyncPing)(SSyncNode *pSyncNode, SyncPing *pMsg); int32_t (*FpOnSyncPingReply)(SSyncNode *pSyncNode, SyncPingReply *pMsg); - int32_t (*FpOnSyncClientRequest)(SSyncNode *pSyncNode, SyncClientRequest *pMsg, SyncIndex *pRetIndex); + int32_t (*FpOnSyncClientRequest)(SSyncNode *pSyncNode, SRpcMsg *pMsg, SyncIndex *pRetIndex); int32_t (*FpOnSyncRequestVote)(SSyncNode *pSyncNode, SyncRequestVote *pMsg); int32_t (*FpOnSyncRequestVoteReply)(SSyncNode *pSyncNode, SyncRequestVoteReply *pMsg); int32_t (*FpOnSyncAppendEntries)(SSyncNode *pSyncNode, SyncAppendEntries *pMsg); diff --git a/source/libs/sync/test/sync_test_lib/inc/syncTest.h b/source/libs/sync/test/sync_test_lib/inc/syncTest.h new file mode 100644 index 0000000000..a1881bf1b3 --- /dev/null +++ b/source/libs/sync/test/sync_test_lib/inc/syncTest.h @@ -0,0 +1,106 @@ +/* + * 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_LIBS_SYNC_TEST_H +#define _TD_LIBS_SYNC_TEST_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include "syncInt.h" + +#include "tref.h" +#include "wal.h" + +#include "tref.h" +#include "syncEnv.h" +#include "syncIO.h" +#include "syncIndexMgr.h" +#include "syncInt.h" +#include "syncMessage.h" +#include "syncRaftCfg.h" +#include "syncRaftEntry.h" +#include "syncRaftLog.h" +#include "syncRaftStore.h" +#include "syncRespMgr.h" +#include "syncSnapshot.h" +#include "syncUtil.h" +#include "syncVoteMgr.h" + +extern void addEpIntoEpSet(SEpSet* pEpSet, const char* fqdn, uint16_t port); + +cJSON* syncEntry2Json(const SSyncRaftEntry* pEntry); +char* syncEntry2Str(const SSyncRaftEntry* pEntry); +void syncEntryPrint(const SSyncRaftEntry* pObj); +void syncEntryPrint2(char* s, const SSyncRaftEntry* pObj); +void syncEntryLog(const SSyncRaftEntry* pObj); +void syncEntryLog2(char* s, const SSyncRaftEntry* pObj); + +cJSON* raftCache2Json(SRaftEntryHashCache* pObj); +char* raftCache2Str(SRaftEntryHashCache* pObj); +void raftCachePrint(SRaftEntryHashCache* pObj); +void raftCachePrint2(char* s, SRaftEntryHashCache* pObj); +void raftCacheLog(SRaftEntryHashCache* pObj); +void raftCacheLog2(char* s, SRaftEntryHashCache* pObj); + +cJSON* raftEntryCache2Json(SRaftEntryCache* pObj); +char* raftEntryCache2Str(SRaftEntryCache* pObj); +void raftEntryCachePrint(SRaftEntryCache* pObj); +void raftEntryCachePrint2(char* s, SRaftEntryCache* pObj); +void raftEntryCacheLog(SRaftEntryCache* pObj); +void raftEntryCacheLog2(char* s, SRaftEntryCache* pObj); + +cJSON* syncAppendEntriesBatch2Json(const SyncAppendEntriesBatch* pMsg); +char* syncAppendEntriesBatch2Str(const SyncAppendEntriesBatch* pMsg); +void syncAppendEntriesBatchPrint(const SyncAppendEntriesBatch* pMsg); +void syncAppendEntriesBatchPrint2(char* s, const SyncAppendEntriesBatch* pMsg); +void syncAppendEntriesBatchLog(const SyncAppendEntriesBatch* pMsg); +void syncAppendEntriesBatchLog2(char* s, const SyncAppendEntriesBatch* pMsg); + +cJSON* logStore2Json(SSyncLogStore* pLogStore); +char* logStore2Str(SSyncLogStore* pLogStore); +cJSON* logStoreSimple2Json(SSyncLogStore* pLogStore); +char* logStoreSimple2Str(SSyncLogStore* pLogStore); +void logStorePrint(SSyncLogStore* pLogStore); +void logStorePrint2(char* s, SSyncLogStore* pLogStore); +void logStoreLog(SSyncLogStore* pLogStore); +void logStoreLog2(char* s, SSyncLogStore* pLogStore); +void logStoreSimplePrint(SSyncLogStore* pLogStore); +void logStoreSimplePrint2(char* s, SSyncLogStore* pLogStore); +void logStoreSimpleLog(SSyncLogStore* pLogStore); +void logStoreSimpleLog2(char* s, SSyncLogStore* pLogStore); + +cJSON* syncNode2Json(const SSyncNode* pSyncNode); +char* syncNode2Str(const SSyncNode* pSyncNode); + +cJSON* voteGranted2Json(SVotesGranted* pVotesGranted); +char* voteGranted2Str(SVotesGranted* pVotesGranted); +cJSON* votesRespond2Json(SVotesRespond* pVotesRespond); +char* votesRespond2Str(SVotesRespond* pVotesRespond); + +cJSON* syncUtilNodeInfo2Json(const SNodeInfo* p); +char* syncUtilRaftId2Str(const SRaftId* p); + +cJSON* snapshotSender2Json(SSyncSnapshotSender* pSender); +char* snapshotSender2Str(SSyncSnapshotSender* pSender); +cJSON* snapshotReceiver2Json(SSyncSnapshotReceiver* pReceiver); +char* snapshotReceiver2Str(SSyncSnapshotReceiver* pReceiver); + +#ifdef __cplusplus +} +#endif + +#endif /*_TD_LIBS_SYNC_RAFT_ENTRY_H*/ diff --git a/source/libs/sync/src/syncIO.c b/source/libs/sync/test/sync_test_lib/src/syncIO.c similarity index 98% rename from source/libs/sync/src/syncIO.c rename to source/libs/sync/test/sync_test_lib/src/syncIO.c index afa2d43e13..14adc18c66 100644 --- a/source/libs/sync/src/syncIO.c +++ b/source/libs/sync/test/sync_test_lib/src/syncIO.c @@ -279,10 +279,7 @@ static void *syncIOConsumerFunc(void *param) { } else if (pRpcMsg->msgType == TDMT_SYNC_CLIENT_REQUEST) { if (io->FpOnSyncClientRequest != NULL) { - SyncClientRequest *pSyncMsg = syncClientRequestFromRpcMsg2(pRpcMsg); - ASSERT(pSyncMsg != NULL); - io->FpOnSyncClientRequest(io->pSyncNode, pSyncMsg, NULL); - syncClientRequestDestroy(pSyncMsg); + io->FpOnSyncClientRequest(io->pSyncNode, pRpcMsg, NULL); } } else if (pRpcMsg->msgType == TDMT_SYNC_REQUEST_VOTE) { diff --git a/source/libs/sync/test/sync_test_lib/src/syncMainDebug.c b/source/libs/sync/test/sync_test_lib/src/syncMainDebug.c new file mode 100644 index 0000000000..5e1a9be164 --- /dev/null +++ b/source/libs/sync/test/sync_test_lib/src/syncMainDebug.c @@ -0,0 +1,255 @@ +/* + * 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 "syncTest.h" + +cJSON* syncNode2Json(const SSyncNode* pSyncNode) { + char u64buf[128] = {0}; + cJSON* pRoot = cJSON_CreateObject(); + + if (pSyncNode != NULL) { + // init by SSyncInfo + cJSON_AddNumberToObject(pRoot, "vgId", pSyncNode->vgId); + cJSON_AddItemToObject(pRoot, "SRaftCfg", raftCfg2Json(pSyncNode->pRaftCfg)); + cJSON_AddStringToObject(pRoot, "path", pSyncNode->path); + cJSON_AddStringToObject(pRoot, "raftStorePath", pSyncNode->raftStorePath); + cJSON_AddStringToObject(pRoot, "configPath", pSyncNode->configPath); + + snprintf(u64buf, sizeof(u64buf), "%p", pSyncNode->pWal); + cJSON_AddStringToObject(pRoot, "pWal", u64buf); + + snprintf(u64buf, sizeof(u64buf), "%p", pSyncNode->msgcb); + cJSON_AddStringToObject(pRoot, "rpcClient", u64buf); + snprintf(u64buf, sizeof(u64buf), "%p", pSyncNode->syncSendMSg); + cJSON_AddStringToObject(pRoot, "syncSendMSg", u64buf); + + snprintf(u64buf, sizeof(u64buf), "%p", pSyncNode->msgcb); + cJSON_AddStringToObject(pRoot, "queue", u64buf); + snprintf(u64buf, sizeof(u64buf), "%p", pSyncNode->syncEqMsg); + cJSON_AddStringToObject(pRoot, "syncEqMsg", u64buf); + + // init internal + cJSON* pMe = syncUtilNodeInfo2Json(&pSyncNode->myNodeInfo); + cJSON_AddItemToObject(pRoot, "myNodeInfo", pMe); + cJSON* pRaftId = syncUtilRaftId2Json(&pSyncNode->myRaftId); + cJSON_AddItemToObject(pRoot, "myRaftId", pRaftId); + + cJSON_AddNumberToObject(pRoot, "peersNum", pSyncNode->peersNum); + cJSON* pPeers = cJSON_CreateArray(); + cJSON_AddItemToObject(pRoot, "peersNodeInfo", pPeers); + for (int32_t i = 0; i < pSyncNode->peersNum; ++i) { + cJSON_AddItemToArray(pPeers, syncUtilNodeInfo2Json(&pSyncNode->peersNodeInfo[i])); + } + cJSON* pPeersId = cJSON_CreateArray(); + cJSON_AddItemToObject(pRoot, "peersId", pPeersId); + for (int32_t i = 0; i < pSyncNode->peersNum; ++i) { + cJSON_AddItemToArray(pPeersId, syncUtilRaftId2Json(&pSyncNode->peersId[i])); + } + + cJSON_AddNumberToObject(pRoot, "replicaNum", pSyncNode->replicaNum); + cJSON* pReplicasId = cJSON_CreateArray(); + cJSON_AddItemToObject(pRoot, "replicasId", pReplicasId); + for (int32_t i = 0; i < pSyncNode->replicaNum; ++i) { + cJSON_AddItemToArray(pReplicasId, syncUtilRaftId2Json(&pSyncNode->replicasId[i])); + } + + // raft algorithm + snprintf(u64buf, sizeof(u64buf), "%p", pSyncNode->pFsm); + cJSON_AddStringToObject(pRoot, "pFsm", u64buf); + cJSON_AddNumberToObject(pRoot, "quorum", pSyncNode->quorum); + cJSON* pLaderCache = syncUtilRaftId2Json(&pSyncNode->leaderCache); + cJSON_AddItemToObject(pRoot, "leaderCache", pLaderCache); + + // life cycle + snprintf(u64buf, sizeof(u64buf), "%" PRId64, pSyncNode->rid); + cJSON_AddStringToObject(pRoot, "rid", u64buf); + + // tla+ server vars + cJSON_AddNumberToObject(pRoot, "state", pSyncNode->state); + cJSON_AddStringToObject(pRoot, "state_str", syncStr(pSyncNode->state)); + cJSON_AddItemToObject(pRoot, "pRaftStore", raftStore2Json(pSyncNode->pRaftStore)); + + // tla+ candidate vars + cJSON_AddItemToObject(pRoot, "pVotesGranted", voteGranted2Json(pSyncNode->pVotesGranted)); + cJSON_AddItemToObject(pRoot, "pVotesRespond", votesRespond2Json(pSyncNode->pVotesRespond)); + + // tla+ leader vars + cJSON_AddItemToObject(pRoot, "pNextIndex", syncIndexMgr2Json(pSyncNode->pNextIndex)); + cJSON_AddItemToObject(pRoot, "pMatchIndex", syncIndexMgr2Json(pSyncNode->pMatchIndex)); + + // tla+ log vars + cJSON_AddItemToObject(pRoot, "pLogStore", logStore2Json(pSyncNode->pLogStore)); + snprintf(u64buf, sizeof(u64buf), "%" PRId64, pSyncNode->commitIndex); + cJSON_AddStringToObject(pRoot, "commitIndex", u64buf); + + // timer ms init + cJSON_AddNumberToObject(pRoot, "pingBaseLine", pSyncNode->pingBaseLine); + cJSON_AddNumberToObject(pRoot, "electBaseLine", pSyncNode->electBaseLine); + cJSON_AddNumberToObject(pRoot, "hbBaseLine", pSyncNode->hbBaseLine); + + // ping timer + snprintf(u64buf, sizeof(u64buf), "%p", pSyncNode->pPingTimer); + cJSON_AddStringToObject(pRoot, "pPingTimer", u64buf); + cJSON_AddNumberToObject(pRoot, "pingTimerMS", pSyncNode->pingTimerMS); + snprintf(u64buf, sizeof(u64buf), "%" PRId64, pSyncNode->pingTimerLogicClock); + cJSON_AddStringToObject(pRoot, "pingTimerLogicClock", u64buf); + snprintf(u64buf, sizeof(u64buf), "%" PRId64, pSyncNode->pingTimerLogicClockUser); + cJSON_AddStringToObject(pRoot, "pingTimerLogicClockUser", u64buf); + snprintf(u64buf, sizeof(u64buf), "%p", pSyncNode->FpPingTimerCB); + cJSON_AddStringToObject(pRoot, "FpPingTimerCB", u64buf); + snprintf(u64buf, sizeof(u64buf), "%" PRId64, pSyncNode->pingTimerCounter); + cJSON_AddStringToObject(pRoot, "pingTimerCounter", u64buf); + + // elect timer + snprintf(u64buf, sizeof(u64buf), "%p", pSyncNode->pElectTimer); + cJSON_AddStringToObject(pRoot, "pElectTimer", u64buf); + cJSON_AddNumberToObject(pRoot, "electTimerMS", pSyncNode->electTimerMS); + snprintf(u64buf, sizeof(u64buf), "%" PRId64, pSyncNode->electTimerLogicClock); + cJSON_AddStringToObject(pRoot, "electTimerLogicClock", u64buf); + snprintf(u64buf, sizeof(u64buf), "%p", pSyncNode->FpElectTimerCB); + cJSON_AddStringToObject(pRoot, "FpElectTimerCB", u64buf); + snprintf(u64buf, sizeof(u64buf), "%" PRId64, pSyncNode->electTimerCounter); + cJSON_AddStringToObject(pRoot, "electTimerCounter", u64buf); + + // heartbeat timer + snprintf(u64buf, sizeof(u64buf), "%p", pSyncNode->pHeartbeatTimer); + cJSON_AddStringToObject(pRoot, "pHeartbeatTimer", u64buf); + cJSON_AddNumberToObject(pRoot, "heartbeatTimerMS", pSyncNode->heartbeatTimerMS); + snprintf(u64buf, sizeof(u64buf), "%" PRId64, pSyncNode->heartbeatTimerLogicClock); + cJSON_AddStringToObject(pRoot, "heartbeatTimerLogicClock", u64buf); + snprintf(u64buf, sizeof(u64buf), "%" PRId64, pSyncNode->heartbeatTimerLogicClockUser); + cJSON_AddStringToObject(pRoot, "heartbeatTimerLogicClockUser", u64buf); + snprintf(u64buf, sizeof(u64buf), "%p", pSyncNode->FpHeartbeatTimerCB); + cJSON_AddStringToObject(pRoot, "FpHeartbeatTimerCB", u64buf); + snprintf(u64buf, sizeof(u64buf), "%" PRId64, pSyncNode->heartbeatTimerCounter); + cJSON_AddStringToObject(pRoot, "heartbeatTimerCounter", u64buf); + + // callback + snprintf(u64buf, sizeof(u64buf), "%p", pSyncNode->FpOnPing); + cJSON_AddStringToObject(pRoot, "FpOnPing", u64buf); + snprintf(u64buf, sizeof(u64buf), "%p", pSyncNode->FpOnPingReply); + cJSON_AddStringToObject(pRoot, "FpOnPingReply", u64buf); + snprintf(u64buf, sizeof(u64buf), "%p", pSyncNode->FpOnRequestVote); + cJSON_AddStringToObject(pRoot, "FpOnRequestVote", u64buf); + snprintf(u64buf, sizeof(u64buf), "%p", pSyncNode->FpOnRequestVoteReply); + cJSON_AddStringToObject(pRoot, "FpOnRequestVoteReply", u64buf); + snprintf(u64buf, sizeof(u64buf), "%p", pSyncNode->FpOnAppendEntries); + cJSON_AddStringToObject(pRoot, "FpOnAppendEntries", u64buf); + snprintf(u64buf, sizeof(u64buf), "%p", pSyncNode->FpOnAppendEntriesReply); + cJSON_AddStringToObject(pRoot, "FpOnAppendEntriesReply", u64buf); + snprintf(u64buf, sizeof(u64buf), "%p", pSyncNode->FpOnTimeout); + cJSON_AddStringToObject(pRoot, "FpOnTimeout", u64buf); + + // restoreFinish + cJSON_AddNumberToObject(pRoot, "restoreFinish", pSyncNode->restoreFinish); + + // snapshot senders + cJSON* pSenders = cJSON_CreateArray(); + cJSON_AddItemToObject(pRoot, "senders", pSenders); + for (int32_t i = 0; i < TSDB_MAX_REPLICA; ++i) { + cJSON_AddItemToArray(pSenders, snapshotSender2Json((pSyncNode->senders)[i])); + } + + // snapshot receivers + cJSON* pReceivers = cJSON_CreateArray(); + cJSON_AddItemToObject(pRoot, "receiver", snapshotReceiver2Json(pSyncNode->pNewNodeReceiver)); + + // changing + cJSON_AddNumberToObject(pRoot, "changing", pSyncNode->changing); + } + + cJSON* pJson = cJSON_CreateObject(); + cJSON_AddItemToObject(pJson, "SSyncNode", pRoot); + return pJson; +} + +char* syncNode2Str(const SSyncNode* pSyncNode) { + cJSON* pJson = syncNode2Json(pSyncNode); + char* serialized = cJSON_Print(pJson); + cJSON_Delete(pJson); + return serialized; +} + +inline char* syncNode2SimpleStr(const SSyncNode* pSyncNode) { + int32_t len = 256; + char* s = (char*)taosMemoryMalloc(len); + + SSnapshot snapshot = {.data = NULL, .lastApplyIndex = -1, .lastApplyTerm = 0}; + if (pSyncNode->pFsm->FpGetSnapshotInfo != NULL) { + pSyncNode->pFsm->FpGetSnapshotInfo(pSyncNode->pFsm, &snapshot); + } + SyncIndex logLastIndex = pSyncNode->pLogStore->syncLogLastIndex(pSyncNode->pLogStore); + SyncIndex logBeginIndex = pSyncNode->pLogStore->syncLogBeginIndex(pSyncNode->pLogStore); + + snprintf(s, len, + "vgId:%d, sync %s, tm:%" PRId64 ", cmt:%" PRId64 ", fst:%" PRId64 ", lst:%" PRId64 ", snap:%" PRId64 + ", sby:%d, " + "r-num:%d, " + "lcfg:%" PRId64 ", chging:%d, rsto:%d", + pSyncNode->vgId, syncStr(pSyncNode->state), pSyncNode->pRaftStore->currentTerm, pSyncNode->commitIndex, + logBeginIndex, logLastIndex, snapshot.lastApplyIndex, pSyncNode->pRaftCfg->isStandBy, pSyncNode->replicaNum, + pSyncNode->pRaftCfg->lastConfigIndex, pSyncNode->changing, pSyncNode->restoreFinish); + + return s; +} + +// ping -------------- +int32_t syncNodePing(SSyncNode* pSyncNode, const SRaftId* destRaftId, SyncPing* pMsg) { + syncPingLog2((char*)"==syncNodePing==", pMsg); + int32_t ret = 0; + + SRpcMsg rpcMsg; + syncPing2RpcMsg(pMsg, &rpcMsg); + syncRpcMsgLog2((char*)"==syncNodePing==", &rpcMsg); + + ret = syncNodeSendMsgById(destRaftId, pSyncNode, &rpcMsg); + return ret; +} + +int32_t syncNodePingSelf(SSyncNode* pSyncNode) { + int32_t ret = 0; + SyncPing* pMsg = syncPingBuild3(&pSyncNode->myRaftId, &pSyncNode->myRaftId, pSyncNode->vgId); + ret = syncNodePing(pSyncNode, &pMsg->destId, pMsg); + ASSERT(ret == 0); + + syncPingDestroy(pMsg); + return ret; +} + +int32_t syncNodePingPeers(SSyncNode* pSyncNode) { + int32_t ret = 0; + for (int32_t i = 0; i < pSyncNode->peersNum; ++i) { + SRaftId* destId = &(pSyncNode->peersId[i]); + SyncPing* pMsg = syncPingBuild3(&pSyncNode->myRaftId, destId, pSyncNode->vgId); + ret = syncNodePing(pSyncNode, destId, pMsg); + ASSERT(ret == 0); + syncPingDestroy(pMsg); + } + return ret; +} + +int32_t syncNodePingAll(SSyncNode* pSyncNode) { + int32_t ret = 0; + for (int32_t i = 0; i < pSyncNode->pRaftCfg->cfg.replicaNum; ++i) { + SRaftId* destId = &(pSyncNode->replicasId[i]); + SyncPing* pMsg = syncPingBuild3(&pSyncNode->myRaftId, destId, pSyncNode->vgId); + ret = syncNodePing(pSyncNode, destId, pMsg); + ASSERT(ret == 0); + syncPingDestroy(pMsg); + } + return ret; +} + diff --git a/source/libs/sync/test/sync_test_lib/src/syncMessageDebug.c b/source/libs/sync/test/sync_test_lib/src/syncMessageDebug.c new file mode 100644 index 0000000000..012382d69d --- /dev/null +++ b/source/libs/sync/test/sync_test_lib/src/syncMessageDebug.c @@ -0,0 +1,508 @@ +/* + * 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 "syncTest.h" + +// --------------------------------------------- +cJSON* syncRpcMsg2Json(SRpcMsg* pRpcMsg) { + cJSON* pRoot; + + // in compiler optimization, switch case = if else constants + if (pRpcMsg->msgType == TDMT_SYNC_TIMEOUT) { + SyncTimeout* pSyncMsg = syncTimeoutDeserialize2(pRpcMsg->pCont, pRpcMsg->contLen); + pRoot = syncTimeout2Json(pSyncMsg); + syncTimeoutDestroy(pSyncMsg); + + } else if (pRpcMsg->msgType == TDMT_SYNC_PING) { + SyncPing* pSyncMsg = syncPingDeserialize2(pRpcMsg->pCont, pRpcMsg->contLen); + pRoot = syncPing2Json(pSyncMsg); + syncPingDestroy(pSyncMsg); + + } else if (pRpcMsg->msgType == TDMT_SYNC_PING_REPLY) { + SyncPingReply* pSyncMsg = syncPingReplyDeserialize2(pRpcMsg->pCont, pRpcMsg->contLen); + pRoot = syncPingReply2Json(pSyncMsg); + syncPingReplyDestroy(pSyncMsg); + + } else if (pRpcMsg->msgType == TDMT_SYNC_CLIENT_REQUEST) { + SyncClientRequest* pSyncMsg = pRpcMsg->pCont; + pRoot = syncClientRequest2Json(pSyncMsg); + + } else if (pRpcMsg->msgType == TDMT_SYNC_CLIENT_REQUEST_REPLY) { + pRoot = syncRpcUnknownMsg2Json(); + + } else if (pRpcMsg->msgType == TDMT_SYNC_REQUEST_VOTE) { + SyncRequestVote* pSyncMsg = syncRequestVoteDeserialize2(pRpcMsg->pCont, pRpcMsg->contLen); + pRoot = syncRequestVote2Json(pSyncMsg); + syncRequestVoteDestroy(pSyncMsg); + + } else if (pRpcMsg->msgType == TDMT_SYNC_REQUEST_VOTE_REPLY) { + SyncRequestVoteReply* pSyncMsg = syncRequestVoteReplyDeserialize2(pRpcMsg->pCont, pRpcMsg->contLen); + pRoot = syncRequestVoteReply2Json(pSyncMsg); + syncRequestVoteReplyDestroy(pSyncMsg); + + } else if (pRpcMsg->msgType == TDMT_SYNC_APPEND_ENTRIES) { + SyncAppendEntries* pSyncMsg = syncAppendEntriesDeserialize2(pRpcMsg->pCont, pRpcMsg->contLen); + pRoot = syncAppendEntries2Json(pSyncMsg); + syncAppendEntriesDestroy(pSyncMsg); + + } else if (pRpcMsg->msgType == TDMT_SYNC_APPEND_ENTRIES_REPLY) { + SyncAppendEntriesReply* pSyncMsg = syncAppendEntriesReplyDeserialize2(pRpcMsg->pCont, pRpcMsg->contLen); + pRoot = syncAppendEntriesReply2Json(pSyncMsg); + syncAppendEntriesReplyDestroy(pSyncMsg); + + } else if (pRpcMsg->msgType == TDMT_SYNC_SNAPSHOT_SEND) { + SyncSnapshotSend* pSyncMsg = syncSnapshotSendDeserialize2(pRpcMsg->pCont, pRpcMsg->contLen); + pRoot = syncSnapshotSend2Json(pSyncMsg); + syncSnapshotSendDestroy(pSyncMsg); + + } else if (pRpcMsg->msgType == TDMT_SYNC_SNAPSHOT_RSP) { + SyncSnapshotRsp* pSyncMsg = syncSnapshotRspDeserialize2(pRpcMsg->pCont, pRpcMsg->contLen); + pRoot = syncSnapshotRsp2Json(pSyncMsg); + syncSnapshotRspDestroy(pSyncMsg); + + } else if (pRpcMsg->msgType == TDMT_SYNC_LEADER_TRANSFER) { + SyncLeaderTransfer* pSyncMsg = syncLeaderTransferDeserialize2(pRpcMsg->pCont, pRpcMsg->contLen); + pRoot = syncLeaderTransfer2Json(pSyncMsg); + syncLeaderTransferDestroy(pSyncMsg); + + } else if (pRpcMsg->msgType == TDMT_SYNC_COMMON_RESPONSE) { + pRoot = cJSON_CreateObject(); + char* s; + s = syncUtilPrintBin((char*)(pRpcMsg->pCont), pRpcMsg->contLen); + cJSON_AddStringToObject(pRoot, "pCont", s); + taosMemoryFree(s); + s = syncUtilPrintBin2((char*)(pRpcMsg->pCont), pRpcMsg->contLen); + cJSON_AddStringToObject(pRoot, "pCont2", s); + taosMemoryFree(s); + + } else { + pRoot = cJSON_CreateObject(); + char* s; + s = syncUtilPrintBin((char*)(pRpcMsg->pCont), pRpcMsg->contLen); + cJSON_AddStringToObject(pRoot, "pCont", s); + taosMemoryFree(s); + s = syncUtilPrintBin2((char*)(pRpcMsg->pCont), pRpcMsg->contLen); + cJSON_AddStringToObject(pRoot, "pCont2", s); + taosMemoryFree(s); + } + + cJSON_AddNumberToObject(pRoot, "msgType", pRpcMsg->msgType); + cJSON_AddNumberToObject(pRoot, "contLen", pRpcMsg->contLen); + cJSON_AddNumberToObject(pRoot, "code", pRpcMsg->code); + // cJSON_AddNumberToObject(pRoot, "persist", pRpcMsg->persist); + + cJSON* pJson = cJSON_CreateObject(); + cJSON_AddItemToObject(pJson, "RpcMsg", pRoot); + return pJson; +} + +cJSON* syncRpcUnknownMsg2Json() { + cJSON* pRoot = cJSON_CreateObject(); + cJSON_AddNumberToObject(pRoot, "msgType", TDMT_SYNC_UNKNOWN); + cJSON_AddStringToObject(pRoot, "data", "unknown message"); + + cJSON* pJson = cJSON_CreateObject(); + cJSON_AddItemToObject(pJson, "SyncUnknown", pRoot); + return pJson; +} + +char* syncRpcMsg2Str(SRpcMsg* pRpcMsg) { + cJSON* pJson = syncRpcMsg2Json(pRpcMsg); + char* serialized = cJSON_Print(pJson); + cJSON_Delete(pJson); + return serialized; +} + +// for debug ---------------------- +void syncRpcMsgPrint(SRpcMsg* pMsg) { + char* serialized = syncRpcMsg2Str(pMsg); + printf("syncRpcMsgPrint | len:%d | %s \n", (int32_t)strlen(serialized), serialized); + fflush(NULL); + taosMemoryFree(serialized); +} + +void syncRpcMsgPrint2(char* s, SRpcMsg* pMsg) { + char* serialized = syncRpcMsg2Str(pMsg); + printf("syncRpcMsgPrint2 | len:%d | %s | %s \n", (int32_t)strlen(serialized), s, serialized); + fflush(NULL); + taosMemoryFree(serialized); +} + +void syncRpcMsgLog(SRpcMsg* pMsg) { + char* serialized = syncRpcMsg2Str(pMsg); + sTrace("syncRpcMsgLog | len:%d | %s", (int32_t)strlen(serialized), serialized); + taosMemoryFree(serialized); +} + +void syncRpcMsgLog2(char* s, SRpcMsg* pMsg) { + if (gRaftDetailLog) { + char* serialized = syncRpcMsg2Str(pMsg); + sTrace("syncRpcMsgLog2 | len:%d | %s | %s", (int32_t)strlen(serialized), s, serialized); + taosMemoryFree(serialized); + } +} + +cJSON* syncAppendEntriesBatch2Json(const SyncAppendEntriesBatch* pMsg) { + char u64buf[128] = {0}; + cJSON* pRoot = cJSON_CreateObject(); + + if (pMsg != NULL) { + cJSON_AddNumberToObject(pRoot, "bytes", pMsg->bytes); + cJSON_AddNumberToObject(pRoot, "vgId", pMsg->vgId); + cJSON_AddNumberToObject(pRoot, "msgType", pMsg->msgType); + + cJSON* pSrcId = cJSON_CreateObject(); + snprintf(u64buf, sizeof(u64buf), "%" PRIu64, pMsg->srcId.addr); + cJSON_AddStringToObject(pSrcId, "addr", u64buf); + { + uint64_t u64 = pMsg->srcId.addr; + cJSON* pTmp = pSrcId; + char host[128] = {0}; + uint16_t port; + syncUtilU642Addr(u64, host, sizeof(host), &port); + cJSON_AddStringToObject(pTmp, "addr_host", host); + cJSON_AddNumberToObject(pTmp, "addr_port", port); + } + cJSON_AddNumberToObject(pSrcId, "vgId", pMsg->srcId.vgId); + cJSON_AddItemToObject(pRoot, "srcId", pSrcId); + + cJSON* pDestId = cJSON_CreateObject(); + snprintf(u64buf, sizeof(u64buf), "%" PRIu64, pMsg->destId.addr); + cJSON_AddStringToObject(pDestId, "addr", u64buf); + { + uint64_t u64 = pMsg->destId.addr; + cJSON* pTmp = pDestId; + char host[128] = {0}; + uint16_t port; + syncUtilU642Addr(u64, host, sizeof(host), &port); + cJSON_AddStringToObject(pTmp, "addr_host", host); + cJSON_AddNumberToObject(pTmp, "addr_port", port); + } + cJSON_AddNumberToObject(pDestId, "vgId", pMsg->destId.vgId); + cJSON_AddItemToObject(pRoot, "destId", pDestId); + + snprintf(u64buf, sizeof(u64buf), "%" PRIu64, pMsg->term); + cJSON_AddStringToObject(pRoot, "term", u64buf); + + snprintf(u64buf, sizeof(u64buf), "%" PRId64, pMsg->prevLogIndex); + cJSON_AddStringToObject(pRoot, "prevLogIndex", u64buf); + + snprintf(u64buf, sizeof(u64buf), "%" PRIu64, pMsg->prevLogTerm); + cJSON_AddStringToObject(pRoot, "prevLogTerm", u64buf); + + snprintf(u64buf, sizeof(u64buf), "%" PRId64, pMsg->commitIndex); + cJSON_AddStringToObject(pRoot, "commitIndex", u64buf); + + snprintf(u64buf, sizeof(u64buf), "%" PRIu64, pMsg->privateTerm); + cJSON_AddStringToObject(pRoot, "privateTerm", u64buf); + + cJSON_AddNumberToObject(pRoot, "dataCount", pMsg->dataCount); + cJSON_AddNumberToObject(pRoot, "dataLen", pMsg->dataLen); + + int32_t metaArrayLen = sizeof(SOffsetAndContLen) * pMsg->dataCount; // + int32_t entryArrayLen = pMsg->dataLen - metaArrayLen; + + cJSON_AddNumberToObject(pRoot, "metaArrayLen", metaArrayLen); + cJSON_AddNumberToObject(pRoot, "entryArrayLen", entryArrayLen); + + SOffsetAndContLen* metaArr = (SOffsetAndContLen*)(pMsg->data); + + cJSON* pMetaArr = cJSON_CreateArray(); + cJSON_AddItemToObject(pRoot, "metaArr", pMetaArr); + for (int i = 0; i < pMsg->dataCount; ++i) { + cJSON* pMeta = cJSON_CreateObject(); + cJSON_AddNumberToObject(pMeta, "offset", metaArr[i].offset); + cJSON_AddNumberToObject(pMeta, "contLen", metaArr[i].contLen); + cJSON_AddItemToArray(pMetaArr, pMeta); + } + + cJSON* pEntryArr = cJSON_CreateArray(); + cJSON_AddItemToObject(pRoot, "entryArr", pEntryArr); + for (int i = 0; i < pMsg->dataCount; ++i) { + SSyncRaftEntry* pEntry = (SSyncRaftEntry*)(pMsg->data + metaArr[i].offset); + cJSON* pEntryJson = syncEntry2Json(pEntry); + cJSON_AddItemToArray(pEntryArr, pEntryJson); + } + + char* s; + s = syncUtilPrintBin((char*)(pMsg->data), pMsg->dataLen); + cJSON_AddStringToObject(pRoot, "data", s); + taosMemoryFree(s); + s = syncUtilPrintBin2((char*)(pMsg->data), pMsg->dataLen); + cJSON_AddStringToObject(pRoot, "data2", s); + taosMemoryFree(s); + } + + cJSON* pJson = cJSON_CreateObject(); + cJSON_AddItemToObject(pJson, "SyncAppendEntriesBatch", pRoot); + return pJson; +} + +char* syncAppendEntriesBatch2Str(const SyncAppendEntriesBatch* pMsg) { + cJSON* pJson = syncAppendEntriesBatch2Json(pMsg); + char* serialized = cJSON_Print(pJson); + cJSON_Delete(pJson); + return serialized; +} + +// for debug ---------------------- +void syncAppendEntriesBatchPrint(const SyncAppendEntriesBatch* pMsg) { + char* serialized = syncAppendEntriesBatch2Str(pMsg); + printf("syncAppendEntriesBatchPrint | len:%d | %s \n", (int32_t)strlen(serialized), serialized); + fflush(NULL); + taosMemoryFree(serialized); +} + +void syncAppendEntriesBatchPrint2(char* s, const SyncAppendEntriesBatch* pMsg) { + char* serialized = syncAppendEntriesBatch2Str(pMsg); + printf("syncAppendEntriesBatchPrint2 | len:%d | %s | %s \n", (int32_t)strlen(serialized), s, serialized); + fflush(NULL); + taosMemoryFree(serialized); +} + +void syncAppendEntriesBatchLog(const SyncAppendEntriesBatch* pMsg) { + char* serialized = syncAppendEntriesBatch2Str(pMsg); + sTrace("syncAppendEntriesBatchLog | len:%d | %s", (int32_t)strlen(serialized), serialized); + taosMemoryFree(serialized); +} + +void syncAppendEntriesBatchLog2(char* s, const SyncAppendEntriesBatch* pMsg) { + if (gRaftDetailLog) { + char* serialized = syncAppendEntriesBatch2Str(pMsg); + sLTrace("syncAppendEntriesBatchLog2 | len:%d | %s | %s", (int32_t)strlen(serialized), s, serialized); + taosMemoryFree(serialized); + } +} + +cJSON* syncSnapshotSend2Json(const SyncSnapshotSend* pMsg) { + char u64buf[128]; + cJSON* pRoot = cJSON_CreateObject(); + + if (pMsg != NULL) { + cJSON_AddNumberToObject(pRoot, "bytes", pMsg->bytes); + cJSON_AddNumberToObject(pRoot, "vgId", pMsg->vgId); + cJSON_AddNumberToObject(pRoot, "msgType", pMsg->msgType); + + cJSON* pSrcId = cJSON_CreateObject(); + snprintf(u64buf, sizeof(u64buf), "%" PRIu64, pMsg->srcId.addr); + cJSON_AddStringToObject(pSrcId, "addr", u64buf); + { + uint64_t u64 = pMsg->srcId.addr; + cJSON* pTmp = pSrcId; + char host[128]; + uint16_t port; + syncUtilU642Addr(u64, host, sizeof(host), &port); + cJSON_AddStringToObject(pTmp, "addr_host", host); + cJSON_AddNumberToObject(pTmp, "addr_port", port); + } + cJSON_AddNumberToObject(pSrcId, "vgId", pMsg->srcId.vgId); + cJSON_AddItemToObject(pRoot, "srcId", pSrcId); + + cJSON* pDestId = cJSON_CreateObject(); + snprintf(u64buf, sizeof(u64buf), "%" PRIu64, pMsg->destId.addr); + cJSON_AddStringToObject(pDestId, "addr", u64buf); + { + uint64_t u64 = pMsg->destId.addr; + cJSON* pTmp = pDestId; + char host[128]; + uint16_t port; + syncUtilU642Addr(u64, host, sizeof(host), &port); + cJSON_AddStringToObject(pTmp, "addr_host", host); + cJSON_AddNumberToObject(pTmp, "addr_port", port); + } + cJSON_AddNumberToObject(pDestId, "vgId", pMsg->destId.vgId); + cJSON_AddItemToObject(pRoot, "destId", pDestId); + + snprintf(u64buf, sizeof(u64buf), "%" PRIu64, pMsg->term); + cJSON_AddStringToObject(pRoot, "term", u64buf); + + snprintf(u64buf, sizeof(u64buf), "%" PRId64, pMsg->startTime); + cJSON_AddStringToObject(pRoot, "startTime", u64buf); + + snprintf(u64buf, sizeof(u64buf), "%" PRId64, pMsg->beginIndex); + cJSON_AddStringToObject(pRoot, "beginIndex", u64buf); + + snprintf(u64buf, sizeof(u64buf), "%" PRId64, pMsg->lastIndex); + cJSON_AddStringToObject(pRoot, "lastIndex", u64buf); + + snprintf(u64buf, sizeof(u64buf), "%" PRId64, pMsg->lastConfigIndex); + cJSON_AddStringToObject(pRoot, "lastConfigIndex", u64buf); + cJSON_AddItemToObject(pRoot, "lastConfig", syncCfg2Json((SSyncCfg*)&(pMsg->lastConfig))); + + snprintf(u64buf, sizeof(u64buf), "%" PRIu64, pMsg->lastTerm); + cJSON_AddStringToObject(pRoot, "lastTerm", u64buf); + + cJSON_AddNumberToObject(pRoot, "seq", pMsg->seq); + + cJSON_AddNumberToObject(pRoot, "dataLen", pMsg->dataLen); + char* s; + s = syncUtilPrintBin((char*)(pMsg->data), pMsg->dataLen); + cJSON_AddStringToObject(pRoot, "data", s); + taosMemoryFree(s); + s = syncUtilPrintBin2((char*)(pMsg->data), pMsg->dataLen); + cJSON_AddStringToObject(pRoot, "data2", s); + taosMemoryFree(s); + } + + cJSON* pJson = cJSON_CreateObject(); + cJSON_AddItemToObject(pJson, "SyncSnapshotSend", pRoot); + return pJson; +} + +char* syncSnapshotSend2Str(const SyncSnapshotSend* pMsg) { + cJSON* pJson = syncSnapshotSend2Json(pMsg); + char* serialized = cJSON_Print(pJson); + cJSON_Delete(pJson); + return serialized; +} + +// for debug ---------------------- +void syncSnapshotSendPrint(const SyncSnapshotSend* pMsg) { + char* serialized = syncSnapshotSend2Str(pMsg); + printf("syncSnapshotSendPrint | len:%d | %s \n", (int32_t)strlen(serialized), serialized); + fflush(NULL); + taosMemoryFree(serialized); +} + +void syncSnapshotSendPrint2(char* s, const SyncSnapshotSend* pMsg) { + char* serialized = syncSnapshotSend2Str(pMsg); + printf("syncSnapshotSendPrint2 | len:%d | %s | %s \n", (int32_t)strlen(serialized), s, serialized); + fflush(NULL); + taosMemoryFree(serialized); +} + +void syncSnapshotSendLog(const SyncSnapshotSend* pMsg) { + char* serialized = syncSnapshotSend2Str(pMsg); + sTrace("syncSnapshotSendLog | len:%d | %s", (int32_t)strlen(serialized), serialized); + taosMemoryFree(serialized); +} + +void syncSnapshotSendLog2(char* s, const SyncSnapshotSend* pMsg) { + if (gRaftDetailLog) { + char* serialized = syncSnapshotSend2Str(pMsg); + sTrace("syncSnapshotSendLog2 | len:%d | %s | %s", (int32_t)strlen(serialized), s, serialized); + taosMemoryFree(serialized); + } +} + +cJSON* syncClientRequestBatch2Json(const SyncClientRequestBatch* pMsg) { + char u64buf[128] = {0}; + cJSON* pRoot = cJSON_CreateObject(); + + if (pMsg != NULL) { + cJSON_AddNumberToObject(pRoot, "bytes", pMsg->bytes); + cJSON_AddNumberToObject(pRoot, "vgId", pMsg->vgId); + cJSON_AddNumberToObject(pRoot, "msgType", pMsg->msgType); + cJSON_AddNumberToObject(pRoot, "dataLen", pMsg->dataLen); + cJSON_AddNumberToObject(pRoot, "dataCount", pMsg->dataCount); + + SRaftMeta* metaArr = syncClientRequestBatchMetaArr(pMsg); + SRpcMsg* msgArr = syncClientRequestBatchRpcMsgArr(pMsg); + + cJSON* pMetaArr = cJSON_CreateArray(); + cJSON_AddItemToObject(pRoot, "metaArr", pMetaArr); + for (int i = 0; i < pMsg->dataCount; ++i) { + cJSON* pMeta = cJSON_CreateObject(); + cJSON_AddNumberToObject(pMeta, "seqNum", metaArr[i].seqNum); + cJSON_AddNumberToObject(pMeta, "isWeak", metaArr[i].isWeak); + cJSON_AddItemToArray(pMetaArr, pMeta); + } + + cJSON* pMsgArr = cJSON_CreateArray(); + cJSON_AddItemToObject(pRoot, "msgArr", pMsgArr); + for (int i = 0; i < pMsg->dataCount; ++i) { + cJSON* pRpcMsgJson = syncRpcMsg2Json(&msgArr[i]); + cJSON_AddItemToArray(pMsgArr, pRpcMsgJson); + } + + char* s; + s = syncUtilPrintBin((char*)(pMsg->data), pMsg->dataLen); + cJSON_AddStringToObject(pRoot, "data", s); + taosMemoryFree(s); + s = syncUtilPrintBin2((char*)(pMsg->data), pMsg->dataLen); + cJSON_AddStringToObject(pRoot, "data2", s); + taosMemoryFree(s); + } + + cJSON* pJson = cJSON_CreateObject(); + cJSON_AddItemToObject(pJson, "SyncClientRequestBatch", pRoot); + return pJson; +} + +char* syncClientRequestBatch2Str(const SyncClientRequestBatch* pMsg) { + cJSON* pJson = syncClientRequestBatch2Json(pMsg); + char* serialized = cJSON_Print(pJson); + cJSON_Delete(pJson); + return serialized; +} + +// for debug ---------------------- +void syncClientRequestBatchPrint(const SyncClientRequestBatch* pMsg) { + char* serialized = syncClientRequestBatch2Str(pMsg); + printf("syncClientRequestBatchPrint | len:%d | %s \n", (int32_t)strlen(serialized), serialized); + fflush(NULL); + taosMemoryFree(serialized); +} + +void syncClientRequestBatchPrint2(char* s, const SyncClientRequestBatch* pMsg) { + char* serialized = syncClientRequestBatch2Str(pMsg); + printf("syncClientRequestBatchPrint2 | len:%d | %s | %s \n", (int32_t)strlen(serialized), s, serialized); + fflush(NULL); + taosMemoryFree(serialized); +} + +void syncClientRequestBatchLog(const SyncClientRequestBatch* pMsg) { + char* serialized = syncClientRequestBatch2Str(pMsg); + sTrace("syncClientRequestBatchLog | len:%d | %s", (int32_t)strlen(serialized), serialized); + taosMemoryFree(serialized); +} + +void syncClientRequestBatchLog2(char* s, const SyncClientRequestBatch* pMsg) { + if (gRaftDetailLog) { + char* serialized = syncClientRequestBatch2Str(pMsg); + sLTrace("syncClientRequestBatchLog2 | len:%d | %s | %s", (int32_t)strlen(serialized), s, serialized); + taosMemoryFree(serialized); + } +} + +// for debug ---------------------- +void syncClientRequestPrint(const SyncClientRequest* pMsg) { + char* serialized = syncClientRequest2Str(pMsg); + printf("syncClientRequestPrint | len:%d | %s \n", (int32_t)strlen(serialized), serialized); + fflush(NULL); + taosMemoryFree(serialized); +} + +void syncClientRequestPrint2(char* s, const SyncClientRequest* pMsg) { + char* serialized = syncClientRequest2Str(pMsg); + printf("syncClientRequestPrint2 | len:%d | %s | %s \n", (int32_t)strlen(serialized), s, serialized); + fflush(NULL); + taosMemoryFree(serialized); +} + +void syncClientRequestLog(const SyncClientRequest* pMsg) { + char* serialized = syncClientRequest2Str(pMsg); + sTrace("syncClientRequestLog | len:%d | %s", (int32_t)strlen(serialized), serialized); + taosMemoryFree(serialized); +} + +void syncClientRequestLog2(char* s, const SyncClientRequest* pMsg) { + if (gRaftDetailLog) { + char* serialized = syncClientRequest2Str(pMsg); + sTrace("syncClientRequestLog2 | len:%d | %s | %s", (int32_t)strlen(serialized), s, serialized); + taosMemoryFree(serialized); + } +} diff --git a/source/libs/sync/test/sync_test_lib/src/syncRaftCfgDebug.c b/source/libs/sync/test/sync_test_lib/src/syncRaftCfgDebug.c new file mode 100644 index 0000000000..88b697fbf1 --- /dev/null +++ b/source/libs/sync/test/sync_test_lib/src/syncRaftCfgDebug.c @@ -0,0 +1,19 @@ +/* + * 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 "syncTest.h" + + diff --git a/source/libs/sync/test/sync_test_lib/src/syncRaftEntryDebug.c b/source/libs/sync/test/sync_test_lib/src/syncRaftEntryDebug.c new file mode 100644 index 0000000000..8179b24d29 --- /dev/null +++ b/source/libs/sync/test/sync_test_lib/src/syncRaftEntryDebug.c @@ -0,0 +1,222 @@ +/* + * 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 "syncTest.h" + +cJSON* syncEntry2Json(const SSyncRaftEntry* pEntry) { + char u64buf[128] = {0}; + cJSON* pRoot = cJSON_CreateObject(); + + if (pEntry != NULL) { + cJSON_AddNumberToObject(pRoot, "bytes", pEntry->bytes); + cJSON_AddNumberToObject(pRoot, "msgType", pEntry->msgType); + cJSON_AddNumberToObject(pRoot, "originalRpcType", pEntry->originalRpcType); + snprintf(u64buf, sizeof(u64buf), "%" PRIu64, pEntry->seqNum); + cJSON_AddStringToObject(pRoot, "seqNum", u64buf); + cJSON_AddNumberToObject(pRoot, "isWeak", pEntry->isWeak); + snprintf(u64buf, sizeof(u64buf), "%" PRIu64, pEntry->term); + cJSON_AddStringToObject(pRoot, "term", u64buf); + snprintf(u64buf, sizeof(u64buf), "%" PRIu64, pEntry->index); + cJSON_AddStringToObject(pRoot, "index", u64buf); + snprintf(u64buf, sizeof(u64buf), "%" PRIu64, pEntry->rid); + cJSON_AddStringToObject(pRoot, "rid", u64buf); + cJSON_AddNumberToObject(pRoot, "dataLen", pEntry->dataLen); + + char* s; + s = syncUtilPrintBin((char*)(pEntry->data), pEntry->dataLen); + cJSON_AddStringToObject(pRoot, "data", s); + taosMemoryFree(s); + + s = syncUtilPrintBin2((char*)(pEntry->data), pEntry->dataLen); + cJSON_AddStringToObject(pRoot, "data2", s); + taosMemoryFree(s); + } + + cJSON* pJson = cJSON_CreateObject(); + cJSON_AddItemToObject(pJson, "SSyncRaftEntry", pRoot); + return pJson; +} + +char* syncEntry2Str(const SSyncRaftEntry* pEntry) { + cJSON* pJson = syncEntry2Json(pEntry); + char* serialized = cJSON_Print(pJson); + cJSON_Delete(pJson); + return serialized; +} + +// for debug ---------------------- +void syncEntryPrint(const SSyncRaftEntry* pObj) { + char* serialized = syncEntry2Str(pObj); + printf("syncEntryPrint | len:%zu | %s \n", strlen(serialized), serialized); + fflush(NULL); + taosMemoryFree(serialized); +} + +void syncEntryPrint2(char* s, const SSyncRaftEntry* pObj) { + char* serialized = syncEntry2Str(pObj); + printf("syncEntryPrint2 | len:%zu | %s | %s \n", strlen(serialized), s, serialized); + fflush(NULL); + taosMemoryFree(serialized); +} + +void syncEntryLog(const SSyncRaftEntry* pObj) { + char* serialized = syncEntry2Str(pObj); + sTrace("syncEntryLog | len:%zu | %s", strlen(serialized), serialized); + taosMemoryFree(serialized); +} + +void syncEntryLog2(char* s, const SSyncRaftEntry* pObj) { + char* serialized = syncEntry2Str(pObj); + sTrace("syncEntryLog2 | len:%zu | %s | %s", strlen(serialized), s, serialized); + taosMemoryFree(serialized); +} + +//----------------------------------- +cJSON* raftCache2Json(SRaftEntryHashCache* pCache) { + char u64buf[128] = {0}; + cJSON* pRoot = cJSON_CreateObject(); + + if (pCache != NULL) { + taosThreadMutexLock(&pCache->mutex); + + snprintf(u64buf, sizeof(u64buf), "%p", pCache->pSyncNode); + cJSON_AddStringToObject(pRoot, "pSyncNode", u64buf); + cJSON_AddNumberToObject(pRoot, "currentCount", pCache->currentCount); + cJSON_AddNumberToObject(pRoot, "maxCount", pCache->maxCount); + cJSON* pEntries = cJSON_CreateArray(); + cJSON_AddItemToObject(pRoot, "entries", pEntries); + + SSyncRaftEntry* pIter = (SSyncRaftEntry*)taosHashIterate(pCache->pEntryHash, NULL); + if (pIter != NULL) { + SSyncRaftEntry* pEntry = (SSyncRaftEntry*)pIter; + cJSON_AddItemToArray(pEntries, syncEntry2Json(pEntry)); + } + while (pIter) { + pIter = taosHashIterate(pCache->pEntryHash, pIter); + if (pIter != NULL) { + SSyncRaftEntry* pEntry = (SSyncRaftEntry*)pIter; + cJSON_AddItemToArray(pEntries, syncEntry2Json(pEntry)); + } + } + + taosThreadMutexUnlock(&pCache->mutex); + } + + cJSON* pJson = cJSON_CreateObject(); + cJSON_AddItemToObject(pJson, "SRaftEntryHashCache", pRoot); + return pJson; +} + +char* raftCache2Str(SRaftEntryHashCache* pCache) { + cJSON* pJson = raftCache2Json(pCache); + char* serialized = cJSON_Print(pJson); + cJSON_Delete(pJson); + return serialized; +} + +void raftCachePrint(SRaftEntryHashCache* pCache) { + char* serialized = raftCache2Str(pCache); + printf("raftCachePrint | len:%d | %s \n", (int32_t)strlen(serialized), serialized); + fflush(NULL); + taosMemoryFree(serialized); +} + +void raftCachePrint2(char* s, SRaftEntryHashCache* pCache) { + char* serialized = raftCache2Str(pCache); + printf("raftCachePrint2 | len:%d | %s | %s \n", (int32_t)strlen(serialized), s, serialized); + fflush(NULL); + taosMemoryFree(serialized); +} + +void raftCacheLog(SRaftEntryHashCache* pCache) { + char* serialized = raftCache2Str(pCache); + sTrace("raftCacheLog | len:%d | %s", (int32_t)strlen(serialized), serialized); + taosMemoryFree(serialized); +} + +void raftCacheLog2(char* s, SRaftEntryHashCache* pCache) { + if (gRaftDetailLog) { + char* serialized = raftCache2Str(pCache); + sLTrace("raftCacheLog2 | len:%d | %s | %s", (int32_t)strlen(serialized), s, serialized); + taosMemoryFree(serialized); + } +} + +cJSON* raftEntryCache2Json(SRaftEntryCache* pCache) { + char u64buf[128] = {0}; + cJSON* pRoot = cJSON_CreateObject(); + + if (pCache != NULL) { + taosThreadMutexLock(&pCache->mutex); + + snprintf(u64buf, sizeof(u64buf), "%p", pCache->pSyncNode); + cJSON_AddStringToObject(pRoot, "pSyncNode", u64buf); + cJSON_AddNumberToObject(pRoot, "currentCount", pCache->currentCount); + cJSON_AddNumberToObject(pRoot, "maxCount", pCache->maxCount); + cJSON* pEntries = cJSON_CreateArray(); + cJSON_AddItemToObject(pRoot, "entries", pEntries); + + SSkipListIterator* pIter = tSkipListCreateIter(pCache->pSkipList); + while (tSkipListIterNext(pIter)) { + SSkipListNode* pNode = tSkipListIterGet(pIter); + ASSERT(pNode != NULL); + SSyncRaftEntry* pEntry = (SSyncRaftEntry*)SL_GET_NODE_DATA(pNode); + cJSON_AddItemToArray(pEntries, syncEntry2Json(pEntry)); + } + tSkipListDestroyIter(pIter); + + taosThreadMutexUnlock(&pCache->mutex); + } + + cJSON* pJson = cJSON_CreateObject(); + cJSON_AddItemToObject(pJson, "SRaftEntryCache", pRoot); + return pJson; +} + +char* raftEntryCache2Str(SRaftEntryCache* pObj) { + cJSON* pJson = raftEntryCache2Json(pObj); + char* serialized = cJSON_Print(pJson); + cJSON_Delete(pJson); + return serialized; +} + +void raftEntryCachePrint(SRaftEntryCache* pObj) { + char* serialized = raftEntryCache2Str(pObj); + printf("raftEntryCachePrint | len:%d | %s \n", (int32_t)strlen(serialized), serialized); + fflush(NULL); + taosMemoryFree(serialized); +} + +void raftEntryCachePrint2(char* s, SRaftEntryCache* pObj) { + char* serialized = raftEntryCache2Str(pObj); + printf("raftEntryCachePrint2 | len:%d | %s | %s \n", (int32_t)strlen(serialized), s, serialized); + fflush(NULL); + taosMemoryFree(serialized); +} + +void raftEntryCacheLog(SRaftEntryCache* pObj) { + char* serialized = raftEntryCache2Str(pObj); + sTrace("raftEntryCacheLog | len:%d | %s", (int32_t)strlen(serialized), serialized); + taosMemoryFree(serialized); +} + +void raftEntryCacheLog2(char* s, SRaftEntryCache* pObj) { + if (gRaftDetailLog) { + char* serialized = raftEntryCache2Str(pObj); + sLTrace("raftEntryCacheLog2 | len:%d | %s | %s", (int32_t)strlen(serialized), s, serialized); + taosMemoryFree(serialized); + } +} diff --git a/source/libs/sync/test/sync_test_lib/src/syncRaftLogDebug.c b/source/libs/sync/test/sync_test_lib/src/syncRaftLogDebug.c new file mode 100644 index 0000000000..53e414ccfd --- /dev/null +++ b/source/libs/sync/test/sync_test_lib/src/syncRaftLogDebug.c @@ -0,0 +1,182 @@ +/* + * 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 "syncTest.h" + +cJSON* logStore2Json(SSyncLogStore* pLogStore) { + char u64buf[128] = {0}; + SSyncLogStoreData* pData = (SSyncLogStoreData*)pLogStore->data; + cJSON* pRoot = cJSON_CreateObject(); + + if (pData != NULL && pData->pWal != NULL) { + snprintf(u64buf, sizeof(u64buf), "%p", pData->pSyncNode); + cJSON_AddStringToObject(pRoot, "pSyncNode", u64buf); + snprintf(u64buf, sizeof(u64buf), "%p", pData->pWal); + cJSON_AddStringToObject(pRoot, "pWal", u64buf); + + SyncIndex beginIndex = raftLogBeginIndex(pLogStore); + snprintf(u64buf, sizeof(u64buf), "%" PRId64, beginIndex); + cJSON_AddStringToObject(pRoot, "beginIndex", u64buf); + + SyncIndex endIndex = raftLogEndIndex(pLogStore); + snprintf(u64buf, sizeof(u64buf), "%" PRId64, endIndex); + cJSON_AddStringToObject(pRoot, "endIndex", u64buf); + + int32_t count = raftLogEntryCount(pLogStore); + cJSON_AddNumberToObject(pRoot, "entryCount", count); + + snprintf(u64buf, sizeof(u64buf), "%" PRId64, raftLogWriteIndex(pLogStore)); + cJSON_AddStringToObject(pRoot, "WriteIndex", u64buf); + + snprintf(u64buf, sizeof(u64buf), "%d", raftLogIsEmpty(pLogStore)); + cJSON_AddStringToObject(pRoot, "IsEmpty", u64buf); + + snprintf(u64buf, sizeof(u64buf), "%" PRId64, raftLogLastIndex(pLogStore)); + cJSON_AddStringToObject(pRoot, "LastIndex", u64buf); + snprintf(u64buf, sizeof(u64buf), "%" PRIu64, raftLogLastTerm(pLogStore)); + cJSON_AddStringToObject(pRoot, "LastTerm", u64buf); + + cJSON* pEntries = cJSON_CreateArray(); + cJSON_AddItemToObject(pRoot, "pEntries", pEntries); + + if (!raftLogIsEmpty(pLogStore)) { + for (SyncIndex i = beginIndex; i <= endIndex; ++i) { + SSyncRaftEntry* pEntry = NULL; + raftLogGetEntry(pLogStore, i, &pEntry); + + cJSON_AddItemToArray(pEntries, syncEntry2Json(pEntry)); + syncEntryDestory(pEntry); + } + } + } + + cJSON* pJson = cJSON_CreateObject(); + cJSON_AddItemToObject(pJson, "SSyncLogStore", pRoot); + return pJson; +} + +char* logStore2Str(SSyncLogStore* pLogStore) { + cJSON* pJson = logStore2Json(pLogStore); + char* serialized = cJSON_Print(pJson); + cJSON_Delete(pJson); + return serialized; +} + +cJSON* logStoreSimple2Json(SSyncLogStore* pLogStore) { + char u64buf[128] = {0}; + SSyncLogStoreData* pData = (SSyncLogStoreData*)pLogStore->data; + cJSON* pRoot = cJSON_CreateObject(); + + if (pData != NULL && pData->pWal != NULL) { + snprintf(u64buf, sizeof(u64buf), "%p", pData->pSyncNode); + cJSON_AddStringToObject(pRoot, "pSyncNode", u64buf); + snprintf(u64buf, sizeof(u64buf), "%p", pData->pWal); + cJSON_AddStringToObject(pRoot, "pWal", u64buf); + + SyncIndex beginIndex = raftLogBeginIndex(pLogStore); + snprintf(u64buf, sizeof(u64buf), "%" PRId64, beginIndex); + cJSON_AddStringToObject(pRoot, "beginIndex", u64buf); + + SyncIndex endIndex = raftLogEndIndex(pLogStore); + snprintf(u64buf, sizeof(u64buf), "%" PRId64, endIndex); + cJSON_AddStringToObject(pRoot, "endIndex", u64buf); + + int32_t count = raftLogEntryCount(pLogStore); + cJSON_AddNumberToObject(pRoot, "entryCount", count); + + snprintf(u64buf, sizeof(u64buf), "%" PRId64, raftLogWriteIndex(pLogStore)); + cJSON_AddStringToObject(pRoot, "WriteIndex", u64buf); + + snprintf(u64buf, sizeof(u64buf), "%d", raftLogIsEmpty(pLogStore)); + cJSON_AddStringToObject(pRoot, "IsEmpty", u64buf); + + snprintf(u64buf, sizeof(u64buf), "%" PRId64, raftLogLastIndex(pLogStore)); + cJSON_AddStringToObject(pRoot, "LastIndex", u64buf); + snprintf(u64buf, sizeof(u64buf), "%" PRIu64, raftLogLastTerm(pLogStore)); + cJSON_AddStringToObject(pRoot, "LastTerm", u64buf); + } + + cJSON* pJson = cJSON_CreateObject(); + cJSON_AddItemToObject(pJson, "SSyncLogStoreSimple", pRoot); + return pJson; +} + +char* logStoreSimple2Str(SSyncLogStore* pLogStore) { + cJSON* pJson = logStoreSimple2Json(pLogStore); + char* serialized = cJSON_Print(pJson); + cJSON_Delete(pJson); + return serialized; +} + +// for debug ----------------- +void logStorePrint(SSyncLogStore* pLogStore) { + char* serialized = logStore2Str(pLogStore); + printf("logStorePrint | len:%d | %s \n", (int32_t)strlen(serialized), serialized); + fflush(NULL); + taosMemoryFree(serialized); +} + +void logStorePrint2(char* s, SSyncLogStore* pLogStore) { + char* serialized = logStore2Str(pLogStore); + printf("logStorePrint2 | len:%d | %s | %s \n", (int32_t)strlen(serialized), s, serialized); + fflush(NULL); + taosMemoryFree(serialized); +} + +void logStoreLog(SSyncLogStore* pLogStore) { + if (gRaftDetailLog) { + char* serialized = logStore2Str(pLogStore); + sLTrace("logStoreLog | len:%d | %s", (int32_t)strlen(serialized), serialized); + taosMemoryFree(serialized); + } +} + +void logStoreLog2(char* s, SSyncLogStore* pLogStore) { + if (gRaftDetailLog) { + char* serialized = logStore2Str(pLogStore); + sLTrace("logStoreLog2 | len:%d | %s | %s", (int32_t)strlen(serialized), s, serialized); + taosMemoryFree(serialized); + } +} + +// for debug ----------------- +void logStoreSimplePrint(SSyncLogStore* pLogStore) { + char* serialized = logStoreSimple2Str(pLogStore); + printf("logStoreSimplePrint | len:%d | %s \n", (int32_t)strlen(serialized), serialized); + fflush(NULL); + taosMemoryFree(serialized); +} + +void logStoreSimplePrint2(char* s, SSyncLogStore* pLogStore) { + char* serialized = logStoreSimple2Str(pLogStore); + printf("logStoreSimplePrint2 | len:%d | %s | %s \n", (int32_t)strlen(serialized), s, serialized); + fflush(NULL); + taosMemoryFree(serialized); +} + +void logStoreSimpleLog(SSyncLogStore* pLogStore) { + char* serialized = logStoreSimple2Str(pLogStore); + sTrace("logStoreSimpleLog | len:%d | %s", (int32_t)strlen(serialized), serialized); + taosMemoryFree(serialized); +} + +void logStoreSimpleLog2(char* s, SSyncLogStore* pLogStore) { + if (gRaftDetailLog) { + char* serialized = logStoreSimple2Str(pLogStore); + sTrace("logStoreSimpleLog2 | len:%d | %s | %s", (int32_t)strlen(serialized), s, serialized); + taosMemoryFree(serialized); + } +} diff --git a/source/libs/sync/test/sync_test_lib/src/syncSnapshotDebug.c b/source/libs/sync/test/sync_test_lib/src/syncSnapshotDebug.c new file mode 100644 index 0000000000..fdaf4b8b34 --- /dev/null +++ b/source/libs/sync/test/sync_test_lib/src/syncSnapshotDebug.c @@ -0,0 +1,132 @@ +/* + * 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 "syncTest.h" + +cJSON *snapshotSender2Json(SSyncSnapshotSender *pSender) { + char u64buf[128]; + cJSON *pRoot = cJSON_CreateObject(); + + if (pSender != NULL) { + cJSON_AddNumberToObject(pRoot, "start", pSender->start); + cJSON_AddNumberToObject(pRoot, "seq", pSender->seq); + cJSON_AddNumberToObject(pRoot, "ack", pSender->ack); + + snprintf(u64buf, sizeof(u64buf), "%p", pSender->pReader); + cJSON_AddStringToObject(pRoot, "pReader", u64buf); + + snprintf(u64buf, sizeof(u64buf), "%p", pSender->pCurrentBlock); + cJSON_AddStringToObject(pRoot, "pCurrentBlock", u64buf); + cJSON_AddNumberToObject(pRoot, "blockLen", pSender->blockLen); + + if (pSender->pCurrentBlock != NULL) { + char *s; + s = syncUtilPrintBin((char *)(pSender->pCurrentBlock), pSender->blockLen); + cJSON_AddStringToObject(pRoot, "pCurrentBlock", s); + taosMemoryFree(s); + s = syncUtilPrintBin2((char *)(pSender->pCurrentBlock), pSender->blockLen); + cJSON_AddStringToObject(pRoot, "pCurrentBlock2", s); + taosMemoryFree(s); + } + + cJSON *pSnapshot = cJSON_CreateObject(); + snprintf(u64buf, sizeof(u64buf), "%" PRIu64, pSender->snapshot.lastApplyIndex); + cJSON_AddStringToObject(pSnapshot, "lastApplyIndex", u64buf); + snprintf(u64buf, sizeof(u64buf), "%" PRIu64, pSender->snapshot.lastApplyTerm); + cJSON_AddStringToObject(pSnapshot, "lastApplyTerm", u64buf); + cJSON_AddItemToObject(pRoot, "snapshot", pSnapshot); + snprintf(u64buf, sizeof(u64buf), "%" PRIu64, pSender->sendingMS); + cJSON_AddStringToObject(pRoot, "sendingMS", u64buf); + snprintf(u64buf, sizeof(u64buf), "%p", pSender->pSyncNode); + cJSON_AddStringToObject(pRoot, "pSyncNode", u64buf); + cJSON_AddNumberToObject(pRoot, "replicaIndex", pSender->replicaIndex); + snprintf(u64buf, sizeof(u64buf), "%" PRIu64, pSender->term); + cJSON_AddStringToObject(pRoot, "term", u64buf); + + // snprintf(u64buf, sizeof(u64buf), "%" PRIu64, pSender->privateTerm); + // cJSON_AddStringToObject(pRoot, "privateTerm", u64buf); + + cJSON_AddNumberToObject(pRoot, "finish", pSender->finish); + } + + cJSON *pJson = cJSON_CreateObject(); + cJSON_AddItemToObject(pJson, "SSyncSnapshotSender", pRoot); + return pJson; +} + +char *snapshotSender2Str(SSyncSnapshotSender *pSender) { + cJSON *pJson = snapshotSender2Json(pSender); + char *serialized = cJSON_Print(pJson); + cJSON_Delete(pJson); + return serialized; +} + +cJSON *snapshotReceiver2Json(SSyncSnapshotReceiver *pReceiver) { + char u64buf[128]; + cJSON *pRoot = cJSON_CreateObject(); + + if (pReceiver != NULL) { + cJSON_AddNumberToObject(pRoot, "start", pReceiver->start); + cJSON_AddNumberToObject(pRoot, "ack", pReceiver->ack); + + snprintf(u64buf, sizeof(u64buf), "%p", pReceiver->pWriter); + cJSON_AddStringToObject(pRoot, "pWriter", u64buf); + + snprintf(u64buf, sizeof(u64buf), "%p", pReceiver->pSyncNode); + cJSON_AddStringToObject(pRoot, "pSyncNode", u64buf); + + cJSON *pFromId = cJSON_CreateObject(); + snprintf(u64buf, sizeof(u64buf), "%" PRIu64, pReceiver->fromId.addr); + cJSON_AddStringToObject(pFromId, "addr", u64buf); + { + uint64_t u64 = pReceiver->fromId.addr; + cJSON *pTmp = pFromId; + char host[128] = {0}; + uint16_t port; + syncUtilU642Addr(u64, host, sizeof(host), &port); + cJSON_AddStringToObject(pTmp, "addr_host", host); + cJSON_AddNumberToObject(pTmp, "addr_port", port); + } + cJSON_AddNumberToObject(pFromId, "vgId", pReceiver->fromId.vgId); + cJSON_AddItemToObject(pRoot, "fromId", pFromId); + + snprintf(u64buf, sizeof(u64buf), "%" PRIu64, pReceiver->snapshot.lastApplyIndex); + cJSON_AddStringToObject(pRoot, "snapshot.lastApplyIndex", u64buf); + + snprintf(u64buf, sizeof(u64buf), "%" PRIu64, pReceiver->snapshot.lastApplyTerm); + cJSON_AddStringToObject(pRoot, "snapshot.lastApplyTerm", u64buf); + + snprintf(u64buf, sizeof(u64buf), "%" PRIu64, pReceiver->snapshot.lastConfigIndex); + cJSON_AddStringToObject(pRoot, "snapshot.lastConfigIndex", u64buf); + + snprintf(u64buf, sizeof(u64buf), "%" PRIu64, pReceiver->term); + cJSON_AddStringToObject(pRoot, "term", u64buf); + + snprintf(u64buf, sizeof(u64buf), "%" PRId64, pReceiver->startTime); + cJSON_AddStringToObject(pRoot, "startTime", u64buf); + } + + cJSON *pJson = cJSON_CreateObject(); + cJSON_AddItemToObject(pJson, "SSyncSnapshotReceiver", pRoot); + return pJson; +} + +char *snapshotReceiver2Str(SSyncSnapshotReceiver *pReceiver) { + cJSON *pJson = snapshotReceiver2Json(pReceiver); + char *serialized = cJSON_Print(pJson); + cJSON_Delete(pJson); + return serialized; +} diff --git a/source/libs/sync/test/sync_test_lib/src/syncUtilDebug.c b/source/libs/sync/test/sync_test_lib/src/syncUtilDebug.c new file mode 100644 index 0000000000..b12f4e76a5 --- /dev/null +++ b/source/libs/sync/test/sync_test_lib/src/syncUtilDebug.c @@ -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 . + */ + +#define _DEFAULT_SOURCE +#include "syncTest.h" + +cJSON* syncUtilNodeInfo2Json(const SNodeInfo* p) { + char u64buf[128] = {0}; + cJSON* pRoot = cJSON_CreateObject(); + + cJSON_AddStringToObject(pRoot, "nodeFqdn", p->nodeFqdn); + cJSON_AddNumberToObject(pRoot, "nodePort", p->nodePort); + + cJSON* pJson = cJSON_CreateObject(); + cJSON_AddItemToObject(pJson, "SNodeInfo", pRoot); + return pJson; +} + +char* syncUtilRaftId2Str(const SRaftId* p) { + cJSON* pJson = syncUtilRaftId2Json(p); + char* serialized = cJSON_Print(pJson); + cJSON_Delete(pJson); + return serialized; +} diff --git a/source/libs/sync/test/sync_test_lib/src/syncVoteMgrDebug.c b/source/libs/sync/test/sync_test_lib/src/syncVoteMgrDebug.c new file mode 100644 index 0000000000..f1c26a97aa --- /dev/null +++ b/source/libs/sync/test/sync_test_lib/src/syncVoteMgrDebug.c @@ -0,0 +1,102 @@ +/* + * 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 "syncTest.h" + +cJSON *voteGranted2Json(SVotesGranted *pVotesGranted) { + char u64buf[128] = {0}; + cJSON *pRoot = cJSON_CreateObject(); + + if (pVotesGranted != NULL) { + cJSON_AddNumberToObject(pRoot, "replicaNum", pVotesGranted->replicaNum); + cJSON *pReplicas = cJSON_CreateArray(); + cJSON_AddItemToObject(pRoot, "replicas", pReplicas); + for (int32_t i = 0; i < pVotesGranted->replicaNum; ++i) { + cJSON_AddItemToArray(pReplicas, syncUtilRaftId2Json(&(*(pVotesGranted->replicas))[i])); + } + int32_t *arr = (int32_t *)taosMemoryMalloc(sizeof(int32_t) * pVotesGranted->replicaNum); + for (int32_t i = 0; i < pVotesGranted->replicaNum; ++i) { + arr[i] = pVotesGranted->isGranted[i]; + } + cJSON *pIsGranted = cJSON_CreateIntArray(arr, pVotesGranted->replicaNum); + taosMemoryFree(arr); + cJSON_AddItemToObject(pRoot, "isGranted", pIsGranted); + + cJSON_AddNumberToObject(pRoot, "votes", pVotesGranted->votes); + snprintf(u64buf, sizeof(u64buf), "%" PRIu64, pVotesGranted->term); + cJSON_AddStringToObject(pRoot, "term", u64buf); + cJSON_AddNumberToObject(pRoot, "quorum", pVotesGranted->quorum); + cJSON_AddNumberToObject(pRoot, "toLeader", pVotesGranted->toLeader); + snprintf(u64buf, sizeof(u64buf), "%p", pVotesGranted->pSyncNode); + cJSON_AddStringToObject(pRoot, "pSyncNode", u64buf); + + bool majority = voteGrantedMajority(pVotesGranted); + cJSON_AddNumberToObject(pRoot, "majority", majority); + } + + cJSON *pJson = cJSON_CreateObject(); + cJSON_AddItemToObject(pJson, "SVotesGranted", pRoot); + return pJson; +} + +char *voteGranted2Str(SVotesGranted *pVotesGranted) { + cJSON *pJson = voteGranted2Json(pVotesGranted); + char *serialized = cJSON_Print(pJson); + cJSON_Delete(pJson); + return serialized; +} + +cJSON *votesRespond2Json(SVotesRespond *pVotesRespond) { + char u64buf[128] = {0}; + cJSON *pRoot = cJSON_CreateObject(); + + if (pVotesRespond != NULL) { + cJSON_AddNumberToObject(pRoot, "replicaNum", pVotesRespond->replicaNum); + cJSON *pReplicas = cJSON_CreateArray(); + cJSON_AddItemToObject(pRoot, "replicas", pReplicas); + for (int32_t i = 0; i < pVotesRespond->replicaNum; ++i) { + cJSON_AddItemToArray(pReplicas, syncUtilRaftId2Json(&(*(pVotesRespond->replicas))[i])); + } + int32_t respondNum = 0; + int32_t *arr = (int32_t *)taosMemoryMalloc(sizeof(int32_t) * pVotesRespond->replicaNum); + for (int32_t i = 0; i < pVotesRespond->replicaNum; ++i) { + arr[i] = pVotesRespond->isRespond[i]; + if (pVotesRespond->isRespond[i]) { + respondNum++; + } + } + cJSON *pIsRespond = cJSON_CreateIntArray(arr, pVotesRespond->replicaNum); + taosMemoryFree(arr); + cJSON_AddItemToObject(pRoot, "isRespond", pIsRespond); + cJSON_AddNumberToObject(pRoot, "respondNum", respondNum); + + snprintf(u64buf, sizeof(u64buf), "%" PRIu64, pVotesRespond->term); + cJSON_AddStringToObject(pRoot, "term", u64buf); + snprintf(u64buf, sizeof(u64buf), "%p", pVotesRespond->pSyncNode); + cJSON_AddStringToObject(pRoot, "pSyncNode", u64buf); + } + + cJSON *pJson = cJSON_CreateObject(); + cJSON_AddItemToObject(pJson, "SVotesRespond", pRoot); + return pJson; +} + +char *votesRespond2Str(SVotesRespond *pVotesRespond) { + cJSON *pJson = votesRespond2Json(pVotesRespond); + char *serialized = cJSON_Print(pJson); + cJSON_Delete(pJson); + return serialized; +} diff --git a/source/libs/transport/inc/transComm.h b/source/libs/transport/inc/transComm.h index 2354f0f959..5e76e6bd83 100644 --- a/source/libs/transport/inc/transComm.h +++ b/source/libs/transport/inc/transComm.h @@ -94,11 +94,11 @@ typedef void* queue[2]; /* Return the structure holding the given element. */ #define QUEUE_DATA(e, type, field) ((type*)((void*)((char*)(e)-offsetof(type, field)))) -#define TRANS_RETRY_COUNT_LIMIT 100 // retry count limit -#define TRANS_RETRY_INTERVAL 15 // retry interval (ms) -#define TRANS_CONN_TIMEOUT 3 // connect timeout (s) -#define TRANS_READ_TIMEOUT 3000 // read timeout (ms) -#define TRANS_PACKET_LIMIT 1024 * 1024 * 512 +//#define TRANS_RETRY_COUNT_LIMIT 100 // retry count limit +//#define TRANS_RETRY_INTERVAL 15 // retry interval (ms) +#define TRANS_CONN_TIMEOUT 3 // connect timeout (s) +#define TRANS_READ_TIMEOUT 3000 // read timeout (ms) +#define TRANS_PACKET_LIMIT 1024 * 1024 * 512 #define TRANS_MAGIC_NUM 0x5f375a86 diff --git a/source/libs/transport/inc/transportInt.h b/source/libs/transport/inc/transportInt.h index b9167501e2..c8a56081cc 100644 --- a/source/libs/transport/inc/transportInt.h +++ b/source/libs/transport/inc/transportInt.h @@ -47,12 +47,15 @@ typedef struct { char label[TSDB_LABEL_LEN]; char user[TSDB_UNI_LEN]; // meter ID - int32_t compressSize; // -1: no compress, 0 : all data compressed, size: compress data if larger than size - int8_t encryption; // encrypt or not + int32_t compressSize; // -1: no compress, 0 : all data compressed, size: compress data if larger than size + int8_t encryption; // encrypt or not + int32_t retryLimit; // retry limit + int32_t retryInterval; // retry interval ms void (*cfp)(void* parent, SRpcMsg*, SEpSet*); bool (*retry)(int32_t code, tmsg_t msgType); bool (*startTimer)(int32_t code, tmsg_t msgType); + void (*destroyFp)(void* ahandle); int index; void* parent; diff --git a/source/libs/transport/src/trans.c b/source/libs/transport/src/trans.c index d3db4879d1..94bc128de9 100644 --- a/source/libs/transport/src/trans.c +++ b/source/libs/transport/src/trans.c @@ -48,11 +48,14 @@ void* rpcOpen(const SRpcInit* pInit) { pRpc->compressSize = pInit->compressSize; pRpc->encryption = pInit->encryption; + pRpc->retryLimit = pInit->retryLimit; + pRpc->retryInterval = pInit->retryInterval; // register callback handle pRpc->cfp = pInit->cfp; pRpc->retry = pInit->rfp; pRpc->startTimer = pInit->tfp; + pRpc->destroyFp = pInit->dfp; pRpc->numOfThreads = pInit->numOfThreads > TSDB_MAX_RPC_THREADS ? TSDB_MAX_RPC_THREADS : pInit->numOfThreads; diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c index c3abfa971e..fd42c14101 100644 --- a/source/libs/transport/src/transCli.c +++ b/source/libs/transport/src/transCli.c @@ -143,6 +143,7 @@ static FORCE_INLINE void cliUpdateFqdnCache(SHashObj* cache, char* fqdn); static void cliHandleResp(SCliConn* conn); // handle except about conn static void cliHandleExcept(SCliConn* conn); +static void cliReleaseUnfinishedMsg(SCliConn* conn); // handle req from app static void cliHandleReq(SCliMsg* pMsg, SCliThrd* pThrd); @@ -163,17 +164,6 @@ static void destroyThrdObj(SCliThrd* pThrd); static void cliWalkCb(uv_handle_t* handle, void* arg); -static void cliReleaseUnfinishedMsg(SCliConn* conn) { - for (int i = 0; i < transQueueSize(&conn->cliMsgs); i++) { - SCliMsg* msg = transQueueGet(&conn->cliMsgs, i); - if (msg != NULL && msg->ctx != NULL && msg->ctx->ahandle != (void*)0x9527) { - if (conn->ctx.freeFunc != NULL && msg->ctx->ahandle != NULL) { - conn->ctx.freeFunc(msg->ctx->ahandle); - } - } - destroyCmsg(msg); - } -} #define CLI_RELEASE_UV(loop) \ do { \ uv_walk(loop, cliWalkCb, NULL); \ @@ -266,6 +256,23 @@ static void cliReleaseUnfinishedMsg(SCliConn* conn) { static void* cliWorkThread(void* arg); +static void cliReleaseUnfinishedMsg(SCliConn* conn) { + SCliThrd* pThrd = conn->hostThrd; + STrans* pTransInst = pThrd->pTransInst; + + for (int i = 0; i < transQueueSize(&conn->cliMsgs); i++) { + SCliMsg* msg = transQueueGet(&conn->cliMsgs, i); + if (msg != NULL && msg->ctx != NULL && msg->ctx->ahandle != (void*)0x9527) { + if (conn->ctx.freeFunc != NULL && msg->ctx->ahandle != NULL) { + conn->ctx.freeFunc(msg->ctx->ahandle); + } else if (msg->ctx->ahandle != NULL && pTransInst->destroyFp != NULL) { + tDebug("%s conn %p destroy unfinished ahandle %p", CONN_GET_INST_LABEL(conn), conn, msg->ctx->ahandle); + pTransInst->destroyFp(msg->ctx->ahandle); + } + } + destroyCmsg(msg); + } +} bool cliMaySendCachedMsg(SCliConn* conn) { if (!transQueueEmpty(&conn->cliMsgs)) { SCliMsg* pCliMsg = NULL; @@ -1281,6 +1288,7 @@ static void doCloseIdleConn(void* param) { } static void cliSchedMsgToNextNode(SCliMsg* pMsg, SCliThrd* pThrd) { + STrans* pTransInst = pThrd->pTransInst; STransConnCtx* pCtx = pMsg->ctx; STraceId* trace = &pMsg->msg.info.traceId; @@ -1292,7 +1300,7 @@ static void cliSchedMsgToNextNode(SCliMsg* pMsg, SCliThrd* pThrd) { STaskArg* arg = taosMemoryMalloc(sizeof(STaskArg)); arg->param1 = pMsg; arg->param2 = pThrd; - transDQSched(pThrd->delayQueue, doDelayTask, arg, TRANS_RETRY_INTERVAL); + transDQSched(pThrd->delayQueue, doDelayTask, arg, pTransInst->retryInterval); } FORCE_INLINE void cliCompareAndSwap(int8_t* val, int8_t exp, int8_t newVal) { @@ -1344,7 +1352,7 @@ int cliAppCb(SCliConn* pConn, STransMsg* pResp, SCliMsg* pMsg) { pMsg->sent = 0; pCtx->retryCnt += 1; if (code == TSDB_CODE_RPC_NETWORK_UNAVAIL || code == TSDB_CODE_RPC_BROKEN_LINK) { - cliCompareAndSwap(&pCtx->retryLimit, TRANS_RETRY_COUNT_LIMIT, EPSET_GET_SIZE(&pCtx->epSet) * 3); + cliCompareAndSwap(&pCtx->retryLimit, pTransInst->retryLimit, EPSET_GET_SIZE(&pCtx->epSet) * 3); if (pCtx->retryCnt < pCtx->retryLimit) { transUnrefCliHandle(pConn); EPSET_FORWARD_INUSE(&pCtx->epSet); @@ -1353,7 +1361,7 @@ int cliAppCb(SCliConn* pConn, STransMsg* pResp, SCliMsg* pMsg) { return -1; } } else { - cliCompareAndSwap(&pCtx->retryLimit, TRANS_RETRY_COUNT_LIMIT, TRANS_RETRY_COUNT_LIMIT); + cliCompareAndSwap(&pCtx->retryLimit, pTransInst->retryLimit, pTransInst->retryLimit); if (pCtx->retryCnt < pCtx->retryLimit) { if (pResp->contLen == 0) { EPSET_FORWARD_INUSE(&pCtx->epSet); diff --git a/source/util/src/tlog.c b/source/util/src/tlog.c index a03c04ed6e..f7949048ca 100644 --- a/source/util/src/tlog.c +++ b/source/util/src/tlog.c @@ -317,14 +317,14 @@ static void taosGetLogFileName(char *fn) { for (int32_t i = 0; i < tsLogObj.fileNum; i++) { char fileName[LOG_FILE_NAME_LEN]; - sprintf(fileName, "%s%d.0", fn, i); + snprintf(fileName, LOG_FILE_NAME_LEN, "%s%d.0", fn, i); bool file1open = taosCheckFileIsOpen(fileName); - sprintf(fileName, "%s%d.1", fn, i); + snprintf(fileName, LOG_FILE_NAME_LEN, "%s%d.1", fn, i); bool file2open = taosCheckFileIsOpen(fileName); if (!file1open && !file2open) { - sprintf(tsLogObj.logName, "%s%d", fn, i); + snprintf(tsLogObj.logName, LOG_FILE_NAME_LEN, "%s%d", fn, i); return; } } @@ -586,7 +586,7 @@ static int32_t taosPushLogBuffer(SLogBuff *pLogBuf, const char *msg, int32_t msg int32_t end = 0; int32_t remainSize = 0; static int64_t lostLine = 0; - char tmpBuf[40] = {0}; + char tmpBuf[128] = {0}; int32_t tmpBufLen = 0; if (pLogBuf == NULL || pLogBuf->stop) return -1; @@ -598,7 +598,7 @@ static int32_t taosPushLogBuffer(SLogBuff *pLogBuf, const char *msg, int32_t msg remainSize = (start > end) ? (start - end - 1) : (start + LOG_BUF_SIZE(pLogBuf) - end - 1); if (lostLine > 0) { - sprintf(tmpBuf, "...Lost %" PRId64 " lines here...\n", lostLine); + snprintf(tmpBuf, tListLen(tmpBuf), "...Lost %" PRId64 " lines here...\n", lostLine); tmpBufLen = (int32_t)strlen(tmpBuf); } diff --git a/tests/develop-test/fulltest.sh b/tests/develop-test/fulltest.sh deleted file mode 100644 index e986ed6966..0000000000 --- a/tests/develop-test/fulltest.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash -set -e -set -x - -python3 ./test.py -f 5-taos-tools/taosbenchmark/auto_create_table_json.py -#python3 ./test.py -f 5-taos-tools/taosbenchmark/commandline.py -python3 ./test.py -f 5-taos-tools/taosbenchmark/custom_col_tag.py -python3 ./test.py -f 5-taos-tools/taosbenchmark/default_json.py -python3 ./test.py -f 5-taos-tools/taosbenchmark/demo.py -python3 ./test.py -f 5-taos-tools/taosbenchmark/insert_alltypes_json.py -python3 ./test.py -f 5-taos-tools/taosbenchmark/invalid_commandline.py -python3 ./test.py -f 5-taos-tools/taosbenchmark/json_tag.py -#python3 ./test.py -f 5-taos-tools/taosbenchmark/limit_offset_json.py -python3 ./test.py -f 5-taos-tools/taosbenchmark/query_json.py -python3 ./test.py -f 5-taos-tools/taosbenchmark/sample_csv_json.py -#python3 ./test.py -f 5-taos-tools/taosbenchmark/sml_interlace.py -python3 ./test.py -f 5-taos-tools/taosbenchmark/sml_json_alltypes.py -#python3 ./test.py -f 5-taos-tools/taosbenchmark/sml_telnet_alltypes.py -#python3 ./test.py -f 5-taos-tools/taosbenchmark/taosadapter_json.py -#python3 ./test.py -f 5-taos-tools/taosbenchmark/telnet_tcp.py -python3 ./test.py -f 5-taos-tools/taosbenchmark/taosdemoTestQueryWithJson.py -R diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task new file mode 100644 index 0000000000..6775760ee4 --- /dev/null +++ b/tests/parallel_test/cases.task @@ -0,0 +1,1014 @@ +#Coulumn Define +#caseID,rerunTimes,Run with Sanitizer,casePath,caseCommand +#NA,NA,y or n,script,./test.sh -f tsim/user/basic.sim + +#unit-test +,,y,unit-test,bash test.sh + +#tsim test +,,,script,./test.sh -f tsim/user/basic.sim +,,,script,./test.sh -f tsim/user/password.sim +,,,script,./test.sh -f tsim/user/privilege_db.sim +,,,script,./test.sh -f tsim/user/privilege_sysinfo.sim +,,,script,./test.sh -f tsim/db/alter_option.sim +,,,script,./test.sh -f tsim/db/alter_replica_13.sim +,,,script,./test.sh -f tsim/db/alter_replica_31.sim +,,,script,./test.sh -f tsim/db/basic1.sim +,,,script,./test.sh -f tsim/db/basic2.sim +,,,script,./test.sh -f tsim/db/basic3.sim +,,,script,./test.sh -f tsim/db/basic4.sim +,,,script,./test.sh -f tsim/db/basic5.sim +,,,script,./test.sh -f tsim/db/basic6.sim +,,,script,./test.sh -f tsim/db/commit.sim +,,,script,./test.sh -f tsim/db/create_all_options.sim +,,,script,./test.sh -f tsim/db/delete_reuse1.sim +,,,script,./test.sh -f tsim/db/delete_reuse2.sim +,,,script,./test.sh -f tsim/db/delete_reusevnode.sim +,,,script,./test.sh -f tsim/db/delete_reusevnode2.sim +,,,script,./test.sh -f tsim/db/delete_writing1.sim +,,,script,./test.sh -f tsim/db/delete_writing2.sim +,,,script,./test.sh -f tsim/db/error1.sim +,,,script,./test.sh -f tsim/db/keep.sim +,,,script,./test.sh -f tsim/db/len.sim +,,,script,./test.sh -f tsim/db/repeat.sim +,,,script,./test.sh -f tsim/db/show_create_db.sim +,,,script,./test.sh -f tsim/db/show_create_table.sim +,,,script,./test.sh -f tsim/db/tables.sim +,,,script,./test.sh -f tsim/db/taosdlog.sim +,,,script,./test.sh -f tsim/dnode/balance_replica1.sim +,,,script,./test.sh -f tsim/dnode/balance_replica3.sim +,,,script,./test.sh -f tsim/dnode/balance1.sim +,,,script,./test.sh -f tsim/dnode/balance2.sim +,,,script,./test.sh -f tsim/dnode/balance3.sim +,,,script,./test.sh -f tsim/dnode/balancex.sim +,,,script,./test.sh -f tsim/dnode/create_dnode.sim +,,,script,./test.sh -f tsim/dnode/drop_dnode_has_mnode.sim +,,,script,./test.sh -f tsim/dnode/drop_dnode_has_qnode_snode.sim +,,,script,./test.sh -f tsim/dnode/drop_dnode_has_vnode_replica1.sim +,,,script,./test.sh -f tsim/dnode/drop_dnode_has_vnode_replica3.sim +,,,script,./test.sh -f tsim/dnode/drop_dnode_has_multi_vnode_replica1.sim +,,,script,./test.sh -f tsim/dnode/drop_dnode_has_multi_vnode_replica3.sim +,,,script,./test.sh -f tsim/dnode/drop_dnode_force.sim +,,,script,./test.sh -f tsim/dnode/offline_reason.sim +,,,script,./test.sh -f tsim/dnode/redistribute_vgroup_replica1.sim +,,,script,./test.sh -f tsim/dnode/redistribute_vgroup_replica3_v1_leader.sim +,,,script,./test.sh -f tsim/dnode/redistribute_vgroup_replica3_v1_follower.sim +,,,script,./test.sh -f tsim/dnode/redistribute_vgroup_replica3_v2.sim +,,,script,./test.sh -f tsim/dnode/redistribute_vgroup_replica3_v3.sim +,,,script,./test.sh -f tsim/dnode/vnode_clean.sim +,,,script,./test.sh -f tsim/dnode/use_dropped_dnode.sim +,,,script,./test.sh -f tsim/dnode/split_vgroup_replica1.sim +,,,script,./test.sh -f tsim/dnode/split_vgroup_replica3.sim +,,,script,./test.sh -f tsim/import/basic.sim +,,,script,./test.sh -f tsim/import/commit.sim +,,,script,./test.sh -f tsim/import/large.sim +,,,script,./test.sh -f tsim/import/replica1.sim +,,,script,./test.sh -f tsim/insert/backquote.sim +,,,script,./test.sh -f tsim/insert/basic.sim +,,,script,./test.sh -f tsim/insert/basic0.sim +,,,script,./test.sh -f tsim/insert/basic1.sim +,,,script,./test.sh -f tsim/insert/basic2.sim +,,,script,./test.sh -f tsim/insert/commit-merge0.sim +,,,script,./test.sh -f tsim/insert/insert_drop.sim +,,,script,./test.sh -f tsim/insert/insert_select.sim +,,,script,./test.sh -f tsim/insert/null.sim +,,,script,./test.sh -f tsim/insert/query_block1_file.sim +,,,script,./test.sh -f tsim/insert/query_block1_memory.sim +,,,script,./test.sh -f tsim/insert/query_block2_file.sim +,,,script,./test.sh -f tsim/insert/query_block2_memory.sim +,,,script,./test.sh -f tsim/insert/query_file_memory.sim +,,,script,./test.sh -f tsim/insert/query_multi_file.sim +,,,script,./test.sh -f tsim/insert/tcp.sim +,,,script,./test.sh -f tsim/insert/update0.sim +,,,script,./test.sh -f tsim/insert/update1_sort_merge.sim +,,,script,./test.sh -f tsim/parser/alter__for_community_version.sim +,,,script,./test.sh -f tsim/parser/alter_column.sim +,,,script,./test.sh -f tsim/parser/alter_stable.sim +,,,script,./test.sh -f tsim/parser/alter.sim +,,,script,./test.sh -f tsim/parser/alter1.sim +,,,script,./test.sh -f tsim/parser/auto_create_tb_drop_tb.sim +,,,script,./test.sh -f tsim/parser/auto_create_tb.sim +,,,script,./test.sh -f tsim/parser/between_and.sim +,,,script,./test.sh -f tsim/parser/binary_escapeCharacter.sim +,,,script,./test.sh -f tsim/parser/col_arithmetic_operation.sim +,,,script,./test.sh -f tsim/parser/columnValue_bigint.sim +,,,script,./test.sh -f tsim/parser/columnValue_bool.sim +,,,script,./test.sh -f tsim/parser/columnValue_double.sim +,,,script,./test.sh -f tsim/parser/columnValue_float.sim +,,,script,./test.sh -f tsim/parser/columnValue_int.sim +,,,script,./test.sh -f tsim/parser/columnValue_smallint.sim +,,,script,./test.sh -f tsim/parser/columnValue_tinyint.sim +,,,script,./test.sh -f tsim/parser/columnValue_unsign.sim +,,,script,./test.sh -f tsim/parser/commit.sim +,,,script,./test.sh -f tsim/parser/condition.sim +,,,script,./test.sh -f tsim/parser/constCol.sim +,,,script,./test.sh -f tsim/parser/create_db.sim +,,,script,./test.sh -f tsim/parser/create_mt.sim +,,,script,./test.sh -f tsim/parser/create_tb_with_tag_name.sim +,,,script,./test.sh -f tsim/parser/create_tb.sim +,,,script,./test.sh -f tsim/parser/dbtbnameValidate.sim +,,,script,./test.sh -f tsim/parser/distinct.sim +,,,script,./test.sh -f tsim/parser/fill_us.sim +,,,script,./test.sh -f tsim/parser/fill.sim +,,,script,./test.sh -f tsim/parser/first_last.sim +,,,script,./test.sh -f tsim/parser/fourArithmetic-basic.sim +,,,script,./test.sh -f tsim/parser/function.sim +,,,script,./test.sh -f tsim/parser/groupby-basic.sim +,,,script,./test.sh -f tsim/parser/groupby.sim +,,,script,./test.sh -f tsim/parser/having_child.sim +,,,script,./test.sh -f tsim/parser/having.sim +,,,script,./test.sh -f tsim/parser/import_commit1.sim +,,,script,./test.sh -f tsim/parser/import_commit2.sim +,,,script,./test.sh -f tsim/parser/import_commit3.sim +,,,script,./test.sh -f tsim/parser/import_file.sim +,,,script,./test.sh -f tsim/parser/import.sim +,,,script,./test.sh -f tsim/parser/insert_multiTbl.sim +,,,script,./test.sh -f tsim/parser/insert_tb.sim +,,,script,./test.sh -f tsim/parser/join_manyblocks.sim +,,,script,./test.sh -f tsim/parser/join_multitables.sim +,,,script,./test.sh -f tsim/parser/join_multivnode.sim +,,,script,./test.sh -f tsim/parser/join.sim +,,,script,./test.sh -f tsim/parser/last_cache.sim +,,,script,./test.sh -f tsim/parser/last_groupby.sim +,,,script,./test.sh -f tsim/parser/lastrow.sim +,,,script,./test.sh -f tsim/parser/lastrow2.sim +,,,script,./test.sh -f tsim/parser/like.sim +,,,script,./test.sh -f tsim/parser/limit.sim +,,,script,./test.sh -f tsim/parser/limit1.sim +,,,script,./test.sh -f tsim/parser/mixed_blocks.sim +,,,script,./test.sh -f tsim/parser/nchar.sim +,,,script,./test.sh -f tsim/parser/nestquery.sim +,,,script,./test.sh -f tsim/parser/null_char.sim +,,,script,./test.sh -f tsim/parser/precision_ns.sim +,,,script,./test.sh -f tsim/parser/projection_limit_offset.sim +,,,script,./test.sh -f tsim/parser/regex.sim +,,,script,./test.sh -f tsim/parser/select_across_vnodes.sim +,,,script,./test.sh -f tsim/parser/select_distinct_tag.sim +,,,script,./test.sh -f tsim/parser/select_from_cache_disk.sim +,,,script,./test.sh -f tsim/parser/select_with_tags.sim +,,,script,./test.sh -f tsim/parser/selectResNum.sim +,,,script,./test.sh -f tsim/parser/set_tag_vals.sim +,,,script,./test.sh -f tsim/parser/single_row_in_tb.sim +,,,script,./test.sh -f tsim/parser/sliding.sim +,,,script,./test.sh -f tsim/parser/slimit_alter_tags.sim +,,,script,./test.sh -f tsim/parser/slimit.sim +,,,script,./test.sh -f tsim/parser/slimit1.sim +,,,script,./test.sh -f tsim/parser/stableOp.sim +,,,script,./test.sh -f tsim/parser/tags_dynamically_specifiy.sim +,,,script,./test.sh -f tsim/parser/tags_filter.sim +,,,script,./test.sh -f tsim/parser/tbnameIn.sim +,,,script,./test.sh -f tsim/parser/timestamp.sim +,,,script,./test.sh -f tsim/parser/top_groupby.sim +,,,script,./test.sh -f tsim/parser/topbot.sim +,,,script,./test.sh -f tsim/parser/union.sim +,,,script,./test.sh -f tsim/parser/union_sysinfo.sim +,,,script,./test.sh -f tsim/parser/where.sim +,,,script,./test.sh -f tsim/query/charScalarFunction.sim +,,,script,./test.sh -f tsim/query/explain.sim +,,,script,./test.sh -f tsim/query/interval-offset.sim +,,,script,./test.sh -f tsim/query/interval.sim +,,,script,./test.sh -f tsim/query/scalarFunction.sim +,,,script,./test.sh -f tsim/query/scalarNull.sim +,,,script,./test.sh -f tsim/query/session.sim +,,,script,./test.sh -f tsim/query/udf.sim +,,,script,./test.sh -f tsim/qnode/basic1.sim +,,,script,./test.sh -f tsim/snode/basic1.sim +,,,script,./test.sh -f tsim/mnode/basic1.sim +,,,script,./test.sh -f tsim/mnode/basic2.sim +,,,script,./test.sh -f tsim/mnode/basic3.sim +,,,script,./test.sh -f tsim/mnode/basic4.sim +,,,script,./test.sh -f tsim/mnode/basic5.sim +,,,script,./test.sh -f tsim/show/basic.sim +,,,script,./test.sh -f tsim/table/autocreate.sim +,,,script,./test.sh -f tsim/table/basic1.sim +,,,script,./test.sh -f tsim/table/basic2.sim +,,,script,./test.sh -f tsim/table/basic3.sim +,,,script,./test.sh -f tsim/table/bigint.sim +,,,script,./test.sh -f tsim/table/binary.sim +,,,script,./test.sh -f tsim/table/bool.sim +,,,script,./test.sh -f tsim/table/column_name.sim +,,,script,./test.sh -f tsim/table/column_num.sim +,,,script,./test.sh -f tsim/table/column_value.sim +,,,script,./test.sh -f tsim/table/column2.sim +,,,script,./test.sh -f tsim/table/createmulti.sim +,,,script,./test.sh -f tsim/table/date.sim +,,,script,./test.sh -f tsim/table/db.table.sim +,,,script,./test.sh -f tsim/table/delete_reuse1.sim +,,,script,./test.sh -f tsim/table/delete_reuse2.sim +,,,script,./test.sh -f tsim/table/delete_writing.sim +,,,script,./test.sh -f tsim/table/describe.sim +,,,script,./test.sh -f tsim/table/double.sim +,,,script,./test.sh -f tsim/table/float.sim +,,,script,./test.sh -f tsim/table/hash.sim +,,,script,./test.sh -f tsim/table/int.sim +,,,script,./test.sh -f tsim/table/limit.sim +,,,script,./test.sh -f tsim/table/smallint.sim +,,,script,./test.sh -f tsim/table/table_len.sim +,,,script,./test.sh -f tsim/table/table.sim +,,,script,./test.sh -f tsim/table/tinyint.sim +,,,script,./test.sh -f tsim/table/vgroup.sim +,,,script,./test.sh -f tsim/stream/basic0.sim -g +,,,script,./test.sh -f tsim/stream/basic2.sim +,,,script,./test.sh -f tsim/stream/drop_stream.sim +,,,script,./test.sh -f tsim/stream/fillHistoryBasic1.sim +,,,script,./test.sh -f tsim/stream/fillHistoryBasic2.sim +,,,script,./test.sh -f tsim/stream/fillHistoryBasic3.sim +,,,script,./test.sh -f tsim/stream/distributeInterval0.sim +,,,script,./test.sh -f tsim/stream/distributeIntervalRetrive0.sim +,,,script,./test.sh -f tsim/stream/distributeSession0.sim +,,,script,./test.sh -f tsim/stream/session0.sim +,,,script,./test.sh -f tsim/stream/session1.sim +,,,script,./test.sh -f tsim/stream/state0.sim +,,,script,./test.sh -f tsim/stream/triggerInterval0.sim +,,,script,./test.sh -f tsim/stream/triggerSession0.sim +,,,script,./test.sh -f tsim/stream/partitionby.sim +,,,script,./test.sh -f tsim/stream/partitionby1.sim +,,,script,./test.sh -f tsim/stream/schedSnode.sim +,,,script,./test.sh -f tsim/stream/windowClose.sim +,,,script,./test.sh -f tsim/stream/ignoreExpiredData.sim +,,,script,./test.sh -f tsim/stream/sliding.sim +,,,script,./test.sh -f tsim/stream/partitionbyColumnInterval.sim +,,,script,./test.sh -f tsim/stream/partitionbyColumnSession.sim +,,,script,./test.sh -f tsim/stream/partitionbyColumnState.sim +,,,script,./test.sh -f tsim/stream/deleteInterval.sim +,,,script,./test.sh -f tsim/stream/deleteSession.sim +,,,script,./test.sh -f tsim/stream/deleteState.sim +,,,script,./test.sh -f tsim/stream/fillIntervalDelete0.sim +,,,script,./test.sh -f tsim/stream/fillIntervalDelete1.sim +,,,script,./test.sh -f tsim/stream/fillIntervalLinear.sim +,,,script,./test.sh -f tsim/stream/fillIntervalPartitionBy.sim +,,,script,./test.sh -f tsim/stream/fillIntervalPrevNext.sim +,,,script,./test.sh -f tsim/stream/fillIntervalValue.sim +,,,script,./test.sh -f tsim/trans/lossdata1.sim +,,,script,./test.sh -f tsim/trans/create_db.sim +,,,script,./test.sh -f tsim/tmq/basic1.sim +,,,script,./test.sh -f tsim/tmq/basic2.sim +,,,script,./test.sh -f tsim/tmq/basic3.sim +,,,script,./test.sh -f tsim/tmq/basic4.sim +,,,script,./test.sh -f tsim/tmq/basic1Of2Cons.sim +,,,script,./test.sh -f tsim/tmq/basic2Of2Cons.sim +,,,script,./test.sh -f tsim/tmq/basic3Of2Cons.sim +,,,script,./test.sh -f tsim/tmq/basic4Of2Cons.sim +,,,script,./test.sh -f tsim/tmq/basic2Of2ConsOverlap.sim +,,,script,./test.sh -f tsim/tmq/topic.sim +,,,script,./test.sh -f tsim/tmq/snapshot.sim +,,,script,./test.sh -f tsim/tmq/snapshot1.sim +,,,script,./test.sh -f tsim/stable/alter_comment.sim +,,,script,./test.sh -f tsim/stable/alter_count.sim +,,,script,./test.sh -f tsim/stable/alter_import.sim +,,,script,./test.sh -f tsim/stable/alter_insert1.sim +,,,script,./test.sh -f tsim/stable/alter_insert2.sim +,,,script,./test.sh -f tsim/stable/alter_metrics.sim +,,,script,./test.sh -f tsim/stable/column_add.sim +,,,script,./test.sh -f tsim/stable/column_drop.sim +,,,script,./test.sh -f tsim/stable/column_modify.sim +,,,script,./test.sh -f tsim/stable/disk.sim +,,,script,./test.sh -f tsim/stable/dnode3.sim +,,,script,./test.sh -f tsim/stable/metrics.sim +,,,script,./test.sh -f tsim/stable/refcount.sim +,,,script,./test.sh -f tsim/stable/tag_add.sim +,,,script,./test.sh -f tsim/stable/tag_drop.sim +,,,script,./test.sh -f tsim/stable/tag_filter.sim +,,,script,./test.sh -f tsim/stable/tag_modify.sim +,,,script,./test.sh -f tsim/stable/tag_rename.sim +,,,script,./test.sh -f tsim/stable/values.sim +,,,script,./test.sh -f tsim/stable/vnode3.sim +,,,script,./test.sh -f tsim/stable/metrics_idx.sim +,,,script,./test.sh -f tsim/sma/drop_sma.sim +,,,script,./test.sh -f tsim/sma/tsmaCreateInsertQuery.sim +,,,script,./test.sh -f tsim/sma/rsmaCreateInsertQuery.sim +,,,script,./test.sh -f tsim/sma/rsmaPersistenceRecovery.sim +,,,script,./test.sh -f tsim/valgrind/checkError1.sim +,,,script,./test.sh -f tsim/valgrind/checkError2.sim +,,,script,./test.sh -f tsim/valgrind/checkError3.sim +,,,script,./test.sh -f tsim/valgrind/checkError4.sim +,,,script,./test.sh -f tsim/valgrind/checkError5.sim +,,,script,./test.sh -f tsim/valgrind/checkError6.sim +,,,script,./test.sh -f tsim/valgrind/checkError7.sim +,,,script,./test.sh -f tsim/valgrind/checkError8.sim +,,,script,./test.sh -f tsim/valgrind/checkUdf.sim +,,,script,./test.sh -f tsim/vnode/replica3_basic.sim +,,,script,./test.sh -f tsim/vnode/replica3_repeat.sim +,,,script,./test.sh -f tsim/vnode/replica3_vgroup.sim +,,,script,./test.sh -f tsim/vnode/replica3_many.sim +,,,script,./test.sh -f tsim/vnode/replica3_import.sim +,,,script,./test.sh -f tsim/vnode/stable_balance_replica1.sim +,,,script,./test.sh -f tsim/vnode/stable_dnode2_stop.sim +,,,script,./test.sh -f tsim/vnode/stable_dnode2.sim +,,,script,./test.sh -f tsim/vnode/stable_dnode3.sim +,,,script,./test.sh -f tsim/vnode/stable_replica3_dnode6.sim +,,,script,./test.sh -f tsim/vnode/stable_replica3_vnode3.sim +,,,script,./test.sh -f tsim/sync/3Replica1VgElect.sim +,,,script,./test.sh -f tsim/sync/3Replica5VgElect.sim +,,,script,./test.sh -f tsim/sync/oneReplica1VgElect.sim +,,,script,./test.sh -f tsim/sync/oneReplica5VgElect.sim +,,,script,./test.sh -f tsim/catalog/alterInCurrent.sim +,,,script,./test.sh -f tsim/scalar/in.sim +,,,script,./test.sh -f tsim/scalar/scalar.sim +,,,script,./test.sh -f tsim/scalar/filter.sim +,,,script,./test.sh -f tsim/scalar/caseWhen.sim +,,,script,./test.sh -f tsim/alter/cached_schema_after_alter.sim +,,,script,./test.sh -f tsim/alter/dnode.sim +,,,script,./test.sh -f tsim/alter/table.sim +,,,script,./test.sh -f tsim/cache/new_metrics.sim +,,,script,./test.sh -f tsim/cache/restart_table.sim +,,,script,./test.sh -f tsim/cache/restart_metrics.sim +,,,script,./test.sh -f tsim/column/commit.sim +,,,script,./test.sh -f tsim/column/metrics.sim +,,,script,./test.sh -f tsim/column/table.sim +,,,script,./test.sh -f tsim/compress/commitlog.sim +,,,script,./test.sh -f tsim/compress/compress2.sim +,,,script,./test.sh -f tsim/compress/compress.sim +,,,script,./test.sh -f tsim/compress/uncompress.sim +,,,script,./test.sh -f tsim/compute/avg.sim +,,,script,./test.sh -f tsim/compute/block_dist.sim +,,,script,./test.sh -f tsim/compute/bottom.sim +,,,script,./test.sh -f tsim/compute/count.sim +,,,script,./test.sh -f tsim/compute/diff.sim +,,,script,./test.sh -f tsim/compute/diff2.sim +,,,script,./test.sh -f tsim/compute/first.sim +,,,script,./test.sh -f tsim/compute/interval.sim +,,,script,./test.sh -f tsim/compute/last_row.sim +,,,script,./test.sh -f tsim/compute/last.sim +,,,script,./test.sh -f tsim/compute/leastsquare.sim +,,,script,./test.sh -f tsim/compute/max.sim +,,,script,./test.sh -f tsim/compute/min.sim +,,,script,./test.sh -f tsim/compute/null.sim +,,,script,./test.sh -f tsim/compute/percentile.sim +,,,script,./test.sh -f tsim/compute/stddev.sim +,,,script,./test.sh -f tsim/compute/sum.sim +,,,script,./test.sh -f tsim/compute/top.sim +,,,script,./test.sh -f tsim/field/2.sim +,,,script,./test.sh -f tsim/field/3.sim +,,,script,./test.sh -f tsim/field/4.sim +,,,script,./test.sh -f tsim/field/5.sim +,,,script,./test.sh -f tsim/field/6.sim +,,,script,./test.sh -f tsim/field/binary.sim +,,,script,./test.sh -f tsim/field/bigint.sim +,,,script,./test.sh -f tsim/field/bool.sim +,,,script,./test.sh -f tsim/field/double.sim +,,,script,./test.sh -f tsim/field/float.sim +,,,script,./test.sh -f tsim/field/int.sim +,,,script,./test.sh -f tsim/field/single.sim +,,,script,./test.sh -f tsim/field/smallint.sim +,,,script,./test.sh -f tsim/field/tinyint.sim +,,,script,./test.sh -f tsim/field/unsigined_bigint.sim +,,,script,./test.sh -f tsim/vector/metrics_field.sim +,,,script,./test.sh -f tsim/vector/metrics_mix.sim +,,,script,./test.sh -f tsim/vector/metrics_query.sim +,,,script,./test.sh -f tsim/vector/metrics_tag.sim +,,,script,./test.sh -f tsim/vector/metrics_time.sim +,,,script,./test.sh -f tsim/vector/multi.sim +,,,script,./test.sh -f tsim/vector/single.sim +,,,script,./test.sh -f tsim/vector/table_field.sim +,,,script,./test.sh -f tsim/vector/table_mix.sim +,,,script,./test.sh -f tsim/vector/table_query.sim +,,,script,./test.sh -f tsim/vector/table_time.sim +,,,script,./test.sh -f tsim/wal/kill.sim +,,,script,./test.sh -f tsim/tag/3.sim +,,,script,./test.sh -f tsim/tag/4.sim +,,,script,./test.sh -f tsim/tag/5.sim +,,,script,./test.sh -f tsim/tag/6.sim +,,,script,./test.sh -f tsim/tag/add.sim +,,,script,./test.sh -f tsim/tag/bigint.sim +,,,script,./test.sh -f tsim/tag/binary_binary.sim +,,,script,./test.sh -f tsim/tag/binary.sim +,,,script,./test.sh -f tsim/tag/bool_binary.sim +,,,script,./test.sh -f tsim/tag/bool_int.sim +,,,script,./test.sh -f tsim/tag/bool.sim +,,,script,./test.sh -f tsim/tag/change.sim +,,,script,./test.sh -f tsim/tag/column.sim +,,,script,./test.sh -f tsim/tag/commit.sim +,,,script,./test.sh -f tsim/tag/create.sim +,,,script,./test.sh -f tsim/tag/delete.sim +,,,script,./test.sh -f tsim/tag/double.sim +,,,script,./test.sh -f tsim/tag/filter.sim +,,,script,./test.sh -f tsim/tag/float.sim +,,,script,./test.sh -f tsim/tag/int_binary.sim +,,,script,./test.sh -f tsim/tag/int_float.sim +,,,script,./test.sh -f tsim/tag/int.sim +,,,script,./test.sh -f tsim/tag/set.sim +,,,script,./test.sh -f tsim/tag/smallint.sim +,,,script,./test.sh -f tsim/tag/tinyint.sim +,,,script,./test.sh -f tsim/tag/drop_tag.sim +,,,script,./test.sh -f tsim/tag/tbNameIn.sim +,,,script,./test.sh -f tmp/monitor.sim + +#system test + +,,,system-test,python3 ./test.py -f 0-others/taosShell.py +,,,system-test,python3 ./test.py -f 0-others/taosShellError.py +,,,system-test,python3 ./test.py -f 0-others/taosShellNetChk.py +,,,system-test,python3 ./test.py -f 0-others/telemetry.py +,,,system-test,python3 ./test.py -f 0-others/taosdMonitor.py +,,,system-test,python3 ./test.py -f 0-others/udfTest.py +,,,system-test,python3 ./test.py -f 0-others/udf_create.py +,,,system-test,python3 ./test.py -f 0-others/udf_restart_taosd.py +,,,system-test,python3 ./test.py -f 0-others/cachemodel.py +,,,system-test,python3 ./test.py -f 0-others/udf_cfg1.py +,,,system-test,python3 ./test.py -f 0-others/udf_cfg2.py +,,,system-test,python3 ./test.py -f 0-others/taosdShell.py -N 5 -M 3 -Q 3 +,,,system-test,python3 ./test.py -f 0-others/sysinfo.py +,,,system-test,python3 ./test.py -f 0-others/user_control.py +,,,system-test,python3 ./test.py -f 0-others/fsync.py +,,,system-test,python3 ./test.py -f 0-others/compatibility.py +,,,system-test,python3 ./test.py -f 1-insert/alter_database.py +,,,system-test,python3 ./test.py -f 1-insert/influxdb_line_taosc_insert.py +,,,system-test,python3 ./test.py -f 1-insert/opentsdb_telnet_line_taosc_insert.py +,,,system-test,python3 ./test.py -f 1-insert/opentsdb_json_taosc_insert.py +,,,system-test,python3 ./test.py -f 1-insert/test_stmt_muti_insert_query.py +,,,system-test,python3 ./test.py -f 1-insert/test_stmt_set_tbname_tag.py +,,,system-test,python3 ./test.py -f 1-insert/alter_stable.py +,,,system-test,python3 ./test.py -f 1-insert/alter_table.py +,,,system-test,python3 ./test.py -f 1-insert/insertWithMoreVgroup.py +,,,system-test,python3 ./test.py -f 1-insert/table_comment.py +,,,system-test,python3 ./test.py -f 1-insert/time_range_wise.py +,,,system-test,python3 ./test.py -f 1-insert/block_wise.py +,,,system-test,python3 ./test.py -f 1-insert/create_retentions.py +,,,system-test,python3 ./test.py -f 1-insert/table_param_ttl.py +,,,system-test,python3 ./test.py -f 1-insert/mutil_stage.py +,,,system-test,python3 ./test.py -f 1-insert/table_param_ttl.py -R +,,,system-test,python3 ./test.py -f 1-insert/update_data_muti_rows.py +,,,system-test,python3 ./test.py -f 1-insert/db_tb_name_check.py +,,,system-test,python3 ./test.py -f 1-insert/database_pre_suf.py +,,,system-test,python3 ./test.py -f 0-others/show.py +,,,system-test,python3 ./test.py -f 2-query/abs.py +,,,system-test,python3 ./test.py -f 2-query/abs.py -R +,,,system-test,python3 ./test.py -f 2-query/and_or_for_byte.py +,,,system-test,python3 ./test.py -f 2-query/and_or_for_byte.py -R +,,,system-test,python3 ./test.py -f 2-query/apercentile.py +,,,system-test,python3 ./test.py -f 2-query/apercentile.py -R +,,,system-test,python3 ./test.py -f 2-query/arccos.py +,,,system-test,python3 ./test.py -f 2-query/arccos.py -R +,,,system-test,python3 ./test.py -f 2-query/arcsin.py +,,,system-test,python3 ./test.py -f 2-query/arcsin.py -R +,,,system-test,python3 ./test.py -f 2-query/arctan.py +,,,system-test,python3 ./test.py -f 2-query/arctan.py -R +,,,system-test,python3 ./test.py -f 2-query/avg.py +,,,system-test,python3 ./test.py -f 2-query/avg.py -R +,,,system-test,python3 ./test.py -f 2-query/between.py +,,,system-test,python3 ./test.py -f 2-query/between.py -R +,,,system-test,python3 ./test.py -f 2-query/bottom.py +,,,system-test,python3 ./test.py -f 2-query/bottom.py -R +,,,system-test,python3 ./test.py -f 2-query/cast.py +,,,system-test,python3 ./test.py -f 2-query/cast.py -R +,,,system-test,python3 ./test.py -f 2-query/ceil.py +,,,system-test,python3 ./test.py -f 2-query/ceil.py -R +,,,system-test,python3 ./test.py -f 2-query/char_length.py +,,,system-test,python3 ./test.py -f 2-query/char_length.py -R +,,,system-test,python3 ./test.py -f 2-query/check_tsdb.py +,,,system-test,python3 ./test.py -f 2-query/check_tsdb.py -R +,,,system-test,python3 ./test.py -f 2-query/concat.py +,,,system-test,python3 ./test.py -f 2-query/concat.py -R +,,,system-test,python3 ./test.py -f 2-query/concat_ws.py +,,,system-test,python3 ./test.py -f 2-query/concat_ws.py -R +,,,system-test,python3 ./test.py -f 2-query/concat_ws2.py +,,,system-test,python3 ./test.py -f 2-query/concat_ws2.py -R +,,,system-test,python3 ./test.py -f 2-query/cos.py +,,,system-test,python3 ./test.py -f 2-query/cos.py -R +,,,system-test,python3 ./test.py -f 2-query/count_partition.py +,,,system-test,python3 ./test.py -f 2-query/count_partition.py -R +,,,system-test,python3 ./test.py -f 2-query/count.py +,,,system-test,python3 ./test.py -f 2-query/count.py -R +,,,system-test,python3 ./test.py -f 2-query/countAlwaysReturnValue.py +,,,system-test,python3 ./test.py -f 2-query/countAlwaysReturnValue.py -R +,,,system-test,python3 ./test.py -f 2-query/db.py +,,,system-test,python3 ./test.py -f 2-query/db.py -R +,,,system-test,python3 ./test.py -f 2-query/diff.py +,,,system-test,python3 ./test.py -f 2-query/diff.py -R +,,,system-test,python3 ./test.py -f 2-query/distinct.py +,,,system-test,python3 ./test.py -f 2-query/distinct.py -R +,,,system-test,python3 ./test.py -f 2-query/distribute_agg_apercentile.py +,,,system-test,python3 ./test.py -f 2-query/distribute_agg_apercentile.py -R +,,,system-test,python3 ./test.py -f 2-query/distribute_agg_avg.py +,,,system-test,python3 ./test.py -f 2-query/distribute_agg_avg.py -R +,,,system-test,python3 ./test.py -f 2-query/distribute_agg_count.py +,,,system-test,python3 ./test.py -f 2-query/distribute_agg_count.py -R +,,,system-test,python3 ./test.py -f 2-query/distribute_agg_max.py +,,,system-test,python3 ./test.py -f 2-query/distribute_agg_max.py -R +,,,system-test,python3 ./test.py -f 2-query/distribute_agg_min.py +,,,system-test,python3 ./test.py -f 2-query/distribute_agg_min.py -R +,,,system-test,python3 ./test.py -f 2-query/distribute_agg_spread.py +,,,system-test,python3 ./test.py -f 2-query/distribute_agg_spread.py -R +,,,system-test,python3 ./test.py -f 2-query/distribute_agg_stddev.py +,,,system-test,python3 ./test.py -f 2-query/distribute_agg_stddev.py -R +,,,system-test,python3 ./test.py -f 2-query/distribute_agg_sum.py +,,,system-test,python3 ./test.py -f 2-query/distribute_agg_sum.py -R +,,,system-test,python3 ./test.py -f 2-query/explain.py +,,,system-test,python3 ./test.py -f 2-query/explain.py -R +,,,system-test,python3 ./test.py -f 2-query/first.py +,,,system-test,python3 ./test.py -f 2-query/first.py -R +,,,system-test,python3 ./test.py -f 2-query/floor.py +,,,system-test,python3 ./test.py -f 2-query/floor.py -R +,,,system-test,python3 ./test.py -f 2-query/function_null.py +,,,system-test,python3 ./test.py -f 2-query/function_null.py -R +,,,system-test,python3 ./test.py -f 2-query/function_stateduration.py +,,,system-test,python3 ./test.py -f 2-query/function_stateduration.py -R +,,,system-test,python3 ./test.py -f 2-query/histogram.py +,,,system-test,python3 ./test.py -f 2-query/histogram.py -R +,,,system-test,python3 ./test.py -f 2-query/hyperloglog.py +,,,system-test,python3 ./test.py -f 2-query/hyperloglog.py -R +,,,system-test,python3 ./test.py -f 2-query/interp.py +,,,system-test,python3 ./test.py -f 2-query/interp.py -R +,,,system-test,python3 ./test.py -f 2-query/irate.py +,,,system-test,python3 ./test.py -f 2-query/irate.py -R +,,,system-test,python3 ./test.py -f 2-query/join.py +,,,system-test,python3 ./test.py -f 2-query/join.py -R +,,,system-test,python3 ./test.py -f 2-query/last_row.py +,,,system-test,python3 ./test.py -f 2-query/last_row.py -R +,,,system-test,python3 ./test.py -f 2-query/last.py +,,,system-test,python3 ./test.py -f 2-query/last.py -R +,,,system-test,python3 ./test.py -f 2-query/leastsquares.py +,,,system-test,python3 ./test.py -f 2-query/leastsquares.py -R +,,,system-test,python3 ./test.py -f 2-query/length.py +,,,system-test,python3 ./test.py -f 2-query/length.py -R +,,,system-test,python3 ./test.py -f 2-query/log.py +,,,system-test,python3 ./test.py -f 2-query/log.py -R +,,,system-test,python3 ./test.py -f 2-query/lower.py +,,,system-test,python3 ./test.py -f 2-query/lower.py -R +,,,system-test,python3 ./test.py -f 2-query/ltrim.py +,,,system-test,python3 ./test.py -f 2-query/ltrim.py -R +,,,system-test,python3 ./test.py -f 2-query/mavg.py +,,,system-test,python3 ./test.py -f 2-query/mavg.py -R +,,,system-test,python3 ./test.py -f 2-query/max_partition.py +,,,system-test,python3 ./test.py -f 2-query/max_partition.py -R +,,,system-test,python3 ./test.py -f 2-query/max.py +,,,system-test,python3 ./test.py -f 2-query/max.py -R +,,,system-test,python3 ./test.py -f 2-query/min.py +,,,system-test,python3 ./test.py -f 2-query/min.py -R +,,,system-test,python3 ./test.py -f 2-query/mode.py +,,,system-test,python3 ./test.py -f 2-query/mode.py -R +,,,system-test,python3 ./test.py -f 2-query/Now.py +,,,system-test,python3 ./test.py -f 2-query/Now.py -R +,,,system-test,python3 ./test.py -f 2-query/percentile.py +,,,system-test,python3 ./test.py -f 2-query/percentile.py -R +,,,system-test,python3 ./test.py -f 2-query/pow.py +,,,system-test,python3 ./test.py -f 2-query/pow.py -R +,,,system-test,python3 ./test.py -f 2-query/query_cols_tags_and_or.py +,,,system-test,python3 ./test.py -f 2-query/query_cols_tags_and_or.py -R +,,,system-test,python3 ./test.py -f 2-query/round.py +,,,system-test,python3 ./test.py -f 2-query/round.py -R +,,,system-test,python3 ./test.py -f 2-query/rtrim.py +,,,system-test,python3 ./test.py -f 2-query/rtrim.py -R +,,,system-test,python3 ./test.py -f 2-query/sample.py +,,,system-test,python3 ./test.py -f 2-query/sample.py -R +,,,system-test,python3 ./test.py -f 2-query/sin.py +,,,system-test,python3 ./test.py -f 2-query/sin.py -R +,,,system-test,python3 ./test.py -f 2-query/smaTest.py +,,,system-test,python3 ./test.py -f 2-query/smaTest.py -R +,,,system-test,python3 ./test.py -f 2-query/sml.py +,,,system-test,python3 ./test.py -f 2-query/sml.py -R +,,,system-test,python3 ./test.py -f 2-query/spread.py +,,,system-test,python3 ./test.py -f 2-query/spread.py -R +,,,system-test,python3 ./test.py -f 2-query/sqrt.py +,,,system-test,python3 ./test.py -f 2-query/sqrt.py -R +,,,system-test,python3 ./test.py -f 2-query/statecount.py +,,,system-test,python3 ./test.py -f 2-query/statecount.py -R +,,,system-test,python3 ./test.py -f 2-query/stateduration.py +,,,system-test,python3 ./test.py -f 2-query/stateduration.py -R +,,,system-test,python3 ./test.py -f 2-query/substr.py +,,,system-test,python3 ./test.py -f 2-query/substr.py -R +,,,system-test,python3 ./test.py -f 2-query/sum.py +,,,system-test,python3 ./test.py -f 2-query/sum.py -R +,,,system-test,python3 ./test.py -f 2-query/tail.py +,,,system-test,python3 ./test.py -f 2-query/tail.py -R +,,,system-test,python3 ./test.py -f 2-query/tan.py +,,,system-test,python3 ./test.py -f 2-query/tan.py -R +,,,system-test,python3 ./test.py -f 2-query/Timediff.py +,,,system-test,python3 ./test.py -f 2-query/Timediff.py -R +,,,system-test,python3 ./test.py -f 2-query/timetruncate.py +,,,system-test,python3 ./test.py -f 2-query/timetruncate.py -R +,,,system-test,python3 ./test.py -f 2-query/timezone.py +,,,system-test,python3 ./test.py -f 2-query/timezone.py -R +,,,system-test,python3 ./test.py -f 2-query/To_iso8601.py +,,,system-test,python3 ./test.py -f 2-query/To_iso8601.py -R +,,,system-test,python3 ./test.py -f 2-query/To_unixtimestamp.py +,,,system-test,python3 ./test.py -f 2-query/To_unixtimestamp.py -R +,,,system-test,python3 ./test.py -f 2-query/Today.py +,,,system-test,python3 ./test.py -f 2-query/Today.py -R +,,,system-test,python3 ./test.py -f 2-query/top.py +,,,system-test,python3 ./test.py -f 2-query/top.py -R +,,,system-test,python3 ./test.py -f 2-query/tsbsQuery.py +,,,system-test,python3 ./test.py -f 2-query/tsbsQuery.py -R +,,,system-test,python3 ./test.py -f 2-query/ttl_comment.py +,,,system-test,python3 ./test.py -f 2-query/ttl_comment.py -R +,,,system-test,python3 ./test.py -f 2-query/twa.py +,,,system-test,python3 ./test.py -f 2-query/twa.py -R +,,,system-test,python3 ./test.py -f 2-query/union.py +,,,system-test,python3 ./test.py -f 2-query/union.py -R +,,,system-test,python3 ./test.py -f 2-query/unique.py +,,,system-test,python3 ./test.py -f 2-query/unique.py -R +,,,system-test,python3 ./test.py -f 2-query/upper.py +,,,system-test,python3 ./test.py -f 2-query/upper.py -R +,,,system-test,python3 ./test.py -f 2-query/varchar.py +,,,system-test,python3 ./test.py -f 2-query/varchar.py -R +,,,system-test,python3 ./test.py -f 1-insert/update_data.py +,,,system-test,python3 ./test.py -f 1-insert/tb_100w_data_order.py +,,,system-test,python3 ./test.py -f 1-insert/delete_stable.py +,,,system-test,python3 ./test.py -f 1-insert/delete_childtable.py +,,,system-test,python3 ./test.py -f 1-insert/delete_normaltable.py +,,,system-test,python3 ./test.py -f 1-insert/keep_expired.py +,,,system-test,python3 ./test.py -f 2-query/join2.py +,,,system-test,python3 ./test.py -f 2-query/union1.py +,,,system-test,python3 ./test.py -f 2-query/concat2.py +,,,system-test,python3 ./test.py -f 2-query/json_tag.py +,,,system-test,python3 ./test.py -f 2-query/nestedQuery.py +,,,system-test,python3 ./test.py -f 2-query/nestedQuery_str.py +,,,system-test,python3 ./test.py -f 2-query/nestedQuery_math.py +,,,system-test,python3 ./test.py -f 2-query/nestedQuery_time.py +,,,system-test,python3 ./test.py -f 2-query/stablity.py +,,,system-test,python3 ./test.py -f 2-query/stablity_1.py +,,,system-test,python3 ./test.py -f 2-query/elapsed.py +,,,system-test,python3 ./test.py -f 2-query/csum.py +,,,system-test,python3 ./test.py -f 2-query/function_diff.py +,,,system-test,python3 ./test.py -f 2-query/queryQnode.py +,,,system-test,python3 ./test.py -f 6-cluster/5dnode1mnode.py +,,,system-test,python3 ./test.py -f 6-cluster/5dnode2mnode.py -N 5 +,,,system-test,python3 ./test.py -f 6-cluster/5dnode3mnodeStop.py -N 5 -M 3 +,,,system-test,python3 ./test.py -f 6-cluster/5dnode3mnodeStop.py -N 5 -M 3 -i False +,,,system-test,python3 ./test.py -f 6-cluster/5dnode3mnodeStop2Follower.py -N 5 -M 3 +,,,system-test,python3 ./test.py -f 6-cluster/5dnode3mnodeStop2Follower.py -N 5 -M 3 -i False +,,,system-test,python3 ./test.py -f 6-cluster/5dnode3mnodeStopLoop.py -N 5 -M 3 +,,,system-test,python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopDnodeCreateDb.py -N 6 -M 3 +,,,system-test,python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopDnodeCreateDb.py -N 6 -M 3 -n 3 +,,,system-test,python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateDb.py -N 6 -M 3 +,,,system-test,python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateDb.py -N 6 -M 3 -n 3 +,,,system-test,python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateDb.py -N 6 -M 3 +,,,system-test,python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateDb.py -N 6 -M 3 -n 3 +,,,system-test,python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopDnodeCreateStb.py -N 6 -M 3 +,,,system-test,python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopDnodeCreateStb.py -N 6 -M 3 -n 3 +,,,system-test,python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateStb.py -N 6 -M 3 +,,,system-test,python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateStb.py -N 6 -M 3 -n 3 +,,,system-test,python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateStb.py -N 6 -M 3 +,,,system-test,python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateStb.py -N 6 -M 3 -n 3 +,,,system-test,python3 ./test.py -f 6-cluster/5dnode3mnodeRestartDnodeInsertData.py -N 6 -M 3 +,,,system-test,python3 ./test.py -f 6-cluster/5dnode3mnodeRestartDnodeInsertData.py -N 6 -M 3 -n 3 +,,,system-test,python3 ./test.py -f 6-cluster/5dnode3mnodeRestartDnodeInsertDataAsync.py -N 6 -M 3 +,,,system-test,python3 ./test.py -f 6-cluster/5dnode3mnodeRestartDnodeInsertDataAsync.py -N 6 -M 3 -n 3 +,,,system-test,python3 ./test.py -f 6-cluster/5dnode3mnodeAdd1Ddnoe.py -N 7 -M 3 -C 6 +,,,system-test,python3 ./test.py -f 6-cluster/5dnode3mnodeAdd1Ddnoe.py -N 7 -M 3 -C 6 -n 3 +,,,system-test,python3 ./test.py -f 6-cluster/5dnode3mnodeDrop.py -N 5 +,,,system-test,python3 ./test.py -f 6-cluster/5dnode3mnodeRecreateMnode.py -N 5 -M 3 +,,,system-test,python3 ./test.py -f 6-cluster/5dnode3mnodeStopFollowerLeader.py -N 5 -M 3 +,,,system-test,python3 ./test.py -f 6-cluster/5dnode3mnodeStop2Follower.py -N 5 -M 3 +,,,system-test,python3 test.py -f 6-cluster/vnode/4dnode1mnode_basic_createDb_replica1.py -N 4 -M 1 +,,,system-test,python3 test.py -f 6-cluster/vnode/4dnode1mnode_basic_replica1_insertdatas.py -N 4 -M 1 +,,,system-test,python3 test.py -f 6-cluster/vnode/4dnode1mnode_basic_replica1_insertdatas_querys.py -N 4 -M 1 +,,,system-test,python3 test.py -f 6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas.py -N 4 -M 1 +,,,system-test,python3 test.py -f 6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas_querys.py -N 4 -M 1 +,,,system-test,python3 test.py -f 6-cluster/vnode/4dnode1mnode_basic_replica3_vgroups.py -N 4 -M 1 +,,,system-test,python3 ./test.py -f 7-tmq/create_wrong_topic.py +,,,system-test,python3 ./test.py -f 7-tmq/dropDbR3ConflictTransaction.py -N 3 +,,,system-test,python3 ./test.py -f 7-tmq/basic5.py +,,,system-test,python3 ./test.py -f 7-tmq/subscribeDb.py +,,,system-test,python3 ./test.py -f 7-tmq/subscribeDb0.py +,,,system-test,python3 ./test.py -f 7-tmq/subscribeDb1.py +,,,system-test,python3 ./test.py -f 7-tmq/subscribeDb2.py +,,,system-test,python3 ./test.py -f 7-tmq/subscribeDb3.py +,,,system-test,python3 ./test.py -f 7-tmq/subscribeDb4.py +,,,system-test,python3 ./test.py -f 7-tmq/subscribeStb.py +,,,system-test,python3 ./test.py -f 7-tmq/subscribeStb0.py +,,,system-test,python3 ./test.py -f 7-tmq/subscribeStb1.py +,,,system-test,python3 ./test.py -f 7-tmq/subscribeStb2.py +,,,system-test,python3 ./test.py -f 7-tmq/subscribeStb3.py +,,,system-test,python3 ./test.py -f 7-tmq/subscribeStb4.py +,,,system-test,python3 ./test.py -f 7-tmq/db.py +,,,system-test,python3 ./test.py -f 7-tmq/tmqError.py +,,,system-test,python3 ./test.py -f 7-tmq/schema.py +,,,system-test,python3 ./test.py -f 7-tmq/stbFilter.py +,,,system-test,python3 ./test.py -f 7-tmq/tmqCheckData.py +,,,system-test,python3 ./test.py -f 7-tmq/tmqCheckData1.py +,,,system-test,python3 ./test.py -f 7-tmq/tmqConsumerGroup.py +,,,system-test,python3 ./test.py -f 7-tmq/tmqShow.py +,,,system-test,python3 ./test.py -f 7-tmq/tmqAlterSchema.py +,,,system-test,python3 ./test.py -f 7-tmq/tmqConsFromTsdb.py +,,,system-test,python3 ./test.py -f 7-tmq/tmqConsFromTsdb1.py +,,,system-test,python3 ./test.py -f 7-tmq/tmqConsFromTsdb-mutilVg.py +,,,system-test,python3 ./test.py -f 7-tmq/tmqConsFromTsdb1-mutilVg.py +,,,system-test,python3 ./test.py -f 7-tmq/tmqConsFromTsdb-1ctb.py +,,,system-test,python3 ./test.py -f 7-tmq/tmqConsFromTsdb1-1ctb.py +,,,system-test,python3 ./test.py -f 7-tmq/tmqConsFromTsdb-1ctb-funcNFilter.py +,,,system-test,python3 ./test.py -f 7-tmq/tmqConsFromTsdb-mutilVg-mutilCtb-funcNFilter.py +,,,system-test,python3 ./test.py -f 7-tmq/tmqConsFromTsdb-mutilVg-mutilCtb.py +,,,system-test,python3 ./test.py -f 7-tmq/tmqConsFromTsdb1-1ctb-funcNFilter.py +,,,system-test,python3 ./test.py -f 7-tmq/tmqConsFromTsdb1-mutilVg-mutilCtb-funcNFilter.py +,,,system-test,python3 ./test.py -f 7-tmq/tmqConsFromTsdb1-mutilVg-mutilCtb.py +,,,system-test,python3 ./test.py -f 7-tmq/tmqAutoCreateTbl.py +,,,system-test,python3 ./test.py -f 7-tmq/tmqDnodeRestart.py +,,,system-test,python3 ./test.py -f 7-tmq/tmqUpdate-1ctb.py +,,,system-test,python3 ./test.py -f 7-tmq/tmqUpdateWithConsume.py +,,,system-test,python3 ./test.py -f 7-tmq/tmqUpdate-multiCtb-snapshot0.py +,,,system-test,python3 ./test.py -f 7-tmq/tmqUpdate-multiCtb-snapshot1.py +,,,system-test,python3 ./test.py -f 7-tmq/tmqDelete-1ctb.py +,,,system-test,python3 ./test.py -f 7-tmq/tmqDelete-multiCtb.py +,,,system-test,python3 ./test.py -f 7-tmq/tmqDropStb.py +,,,system-test,python3 ./test.py -f 7-tmq/tmqDropStbCtb.py +,,,system-test,python3 ./test.py -f 7-tmq/tmqDropNtb-snapshot0.py +,,,system-test,python3 ./test.py -f 7-tmq/tmqDropNtb-snapshot1.py +,,,system-test,python3 ./test.py -f 7-tmq/tmqUdf.py +,,,system-test,python3 ./test.py -f 7-tmq/tmqUdf-multCtb-snapshot0.py +,,,system-test,python3 ./test.py -f 7-tmq/tmqUdf-multCtb-snapshot1.py +,,,system-test,python3 ./test.py -f 7-tmq/stbTagFilter-1ctb.py +,,,system-test,python3 ./test.py -f 7-tmq/dataFromTsdbNWal.py +,,,system-test,python3 ./test.py -f 7-tmq/dataFromTsdbNWal-multiCtb.py +,,,system-test,python3 ./test.py -f 7-tmq/tmq_taosx.py +,,,system-test,python3 ./test.py -f 7-tmq/stbTagFilter-multiCtb.py +,,,system-test,python3 ./test.py -f 99-TDcase/TD-19201.py +,,,system-test,python3 ./test.py -f 2-query/between.py -Q 2 +,,,system-test,python3 ./test.py -f 2-query/distinct.py -Q 2 +,,,system-test,python3 ./test.py -f 2-query/varchar.py -Q 2 +,,,system-test,python3 ./test.py -f 2-query/ltrim.py -Q 2 +,,,system-test,python3 ./test.py -f 2-query/rtrim.py -Q 2 +,,,system-test,python3 ./test.py -f 2-query/length.py -Q 2 +,,,system-test,python3 ./test.py -f 2-query/char_length.py -Q 2 +,,,system-test,python3 ./test.py -f 2-query/upper.py -Q 2 +,,,system-test,python3 ./test.py -f 2-query/lower.py -Q 2 +,,,system-test,python3 ./test.py -f 2-query/join.py -Q 2 +,,,system-test,python3 ./test.py -f 2-query/join2.py -Q 2 +,,,system-test,python3 ./test.py -f 2-query/cast.py -Q 2 +,,,system-test,python3 ./test.py -f 2-query/substr.py -Q 2 +,,,system-test,python3 ./test.py -f 2-query/union.py -Q 2 +,,,system-test,python3 ./test.py -f 2-query/union1.py -Q 2 +,,,system-test,python3 ./test.py -f 2-query/concat.py -Q 2 +,,,system-test,python3 ./test.py -f 2-query/concat2.py -Q 2 +,,,system-test,python3 ./test.py -f 2-query/concat_ws.py -Q 2 +,,,system-test,python3 ./test.py -f 2-query/concat_ws2.py -Q 2 +,,,system-test,python3 ./test.py -f 2-query/check_tsdb.py -Q 2 +,,,system-test,python3 ./test.py -f 2-query/spread.py -Q 2 +,,,system-test,python3 ./test.py -f 2-query/hyperloglog.py -Q 2 +,,,system-test,python3 ./test.py -f 2-query/explain.py -Q 2 +,,,system-test,python3 ./test.py -f 2-query/leastsquares.py -Q 2 +,,,system-test,python3 ./test.py -f 2-query/timezone.py -Q 2 +,,,system-test,python3 ./test.py -f 2-query/Now.py -Q 2 +,,,system-test,python3 ./test.py -f 2-query/Today.py -Q 2 +,,,system-test,python3 ./test.py -f 2-query/max.py -Q 2 +,,,system-test,python3 ./test.py -f 2-query/min.py -Q 2 +,,,system-test,python3 ./test.py -f 2-query/mode.py -Q 2 +,,,system-test,python3 ./test.py -f 2-query/count.py -Q 2 +,,,system-test,python3 ./test.py -f 2-query/countAlwaysReturnValue.py -Q 2 +,,,system-test,python3 ./test.py -f 2-query/last.py -Q 2 +,,,system-test,python3 ./test.py -f 2-query/first.py -Q 2 +,,,system-test,python3 ./test.py -f 2-query/To_iso8601.py -Q 2 +,,,system-test,python3 ./test.py -f 2-query/To_unixtimestamp.py -Q 2 +,,,system-test,python3 ./test.py -f 2-query/timetruncate.py -Q 2 +,,,system-test,python3 ./test.py -f 2-query/diff.py -Q 2 +,,,system-test,python3 ./test.py -f 2-query/Timediff.py -Q 2 +,,,system-test,python3 ./test.py -f 2-query/json_tag.py -Q 2 +,,,system-test,python3 ./test.py -f 2-query/top.py -Q 2 +,,,system-test,python3 ./test.py -f 2-query/bottom.py -Q 2 +,,,system-test,python3 ./test.py -f 2-query/percentile.py -Q 2 +,,,system-test,python3 ./test.py -f 2-query/apercentile.py -Q 2 +,,,system-test,python3 ./test.py -f 2-query/abs.py -Q 2 +,,,system-test,python3 ./test.py -f 2-query/ceil.py -Q 2 +,,,system-test,python3 ./test.py -f 2-query/floor.py -Q 2 +,,,system-test,python3 ./test.py -f 2-query/round.py -Q 2 +,,,system-test,python3 ./test.py -f 2-query/log.py -Q 2 +,,,system-test,python3 ./test.py -f 2-query/pow.py -Q 2 +,,,system-test,python3 ./test.py -f 2-query/sqrt.py -Q 2 +,,,system-test,python3 ./test.py -f 2-query/sin.py -Q 2 +,,,system-test,python3 ./test.py -f 2-query/cos.py -Q 2 +,,,system-test,python3 ./test.py -f 2-query/tan.py -Q 2 +,,,system-test,python3 ./test.py -f 2-query/arcsin.py -Q 2 +,,,system-test,python3 ./test.py -f 2-query/arccos.py -Q 2 +,,,system-test,python3 ./test.py -f 2-query/arctan.py -Q 2 +,,,system-test,python3 ./test.py -f 2-query/query_cols_tags_and_or.py -Q 2 +,,,system-test,python3 ./test.py -f 2-query/interp.py -Q 2 +,,,system-test,python3 ./test.py -f 2-query/nestedQuery.py -Q 2 +,,,system-test,python3 ./test.py -f 2-query/nestedQuery_str.py -Q 2 +,,,system-test,python3 ./test.py -f 2-query/nestedQuery_math.py -Q 2 +,,,system-test,python3 ./test.py -f 2-query/nestedQuery_time.py -Q 2 +,,,system-test,python3 ./test.py -f 2-query/stablity.py -Q 2 +,,,system-test,python3 ./test.py -f 2-query/stablity_1.py -Q 2 +,,,system-test,python3 ./test.py -f 2-query/avg.py -Q 2 +,,,system-test,python3 ./test.py -f 2-query/elapsed.py -Q 2 +,,,system-test,python3 ./test.py -f 2-query/csum.py -Q 2 +,,,system-test,python3 ./test.py -f 2-query/mavg.py -Q 2 +,,,system-test,python3 ./test.py -f 2-query/sample.py -Q 2 +,,,system-test,python3 ./test.py -f 2-query/function_diff.py -Q 2 +,,,system-test,python3 ./test.py -f 2-query/unique.py -Q 2 +,,,system-test,python3 ./test.py -f 2-query/stateduration.py -Q 2 +,,,system-test,python3 ./test.py -f 2-query/function_stateduration.py -Q 2 +,,,system-test,python3 ./test.py -f 2-query/statecount.py -Q 2 +,,,system-test,python3 ./test.py -f 2-query/tail.py -Q 2 +,,,system-test,python3 ./test.py -f 2-query/ttl_comment.py -Q 2 +,,,system-test,python3 ./test.py -f 2-query/distribute_agg_count.py -Q 2 +,,,system-test,python3 ./test.py -f 2-query/distribute_agg_max.py -Q 2 +,,,system-test,python3 ./test.py -f 2-query/distribute_agg_min.py -Q 2 +,,,system-test,python3 ./test.py -f 2-query/distribute_agg_sum.py -Q 2 +,,,system-test,python3 ./test.py -f 2-query/distribute_agg_spread.py -Q 2 +,,,system-test,python3 ./test.py -f 2-query/distribute_agg_apercentile.py -Q 2 +,,,system-test,python3 ./test.py -f 2-query/distribute_agg_avg.py -Q 2 +,,,system-test,python3 ./test.py -f 2-query/distribute_agg_stddev.py -Q 2 +,,,system-test,python3 ./test.py -f 2-query/twa.py -Q 2 +,,,system-test,python3 ./test.py -f 2-query/irate.py -Q 2 +,,,system-test,python3 ./test.py -f 2-query/function_null.py -Q 2 +,,,system-test,python3 ./test.py -f 2-query/count_partition.py -Q 2 +,,,system-test,python3 ./test.py -f 2-query/max_partition.py -Q 2 +,,,system-test,python3 ./test.py -f 2-query/last_row.py -Q 2 +,,,system-test,python3 ./test.py -f 2-query/tsbsQuery.py -Q 2 +,,,system-test,python3 ./test.py -f 2-query/sml.py -Q 2 +,,,system-test,python3 ./test.py -f 2-query/between.py -Q 3 +,,,system-test,python3 ./test.py -f 2-query/distinct.py -Q 3 +,,,system-test,python3 ./test.py -f 2-query/varchar.py -Q 3 +,,,system-test,python3 ./test.py -f 2-query/ltrim.py -Q 3 +,,,system-test,python3 ./test.py -f 2-query/rtrim.py -Q 3 +,,,system-test,python3 ./test.py -f 2-query/length.py -Q 3 +,,,system-test,python3 ./test.py -f 2-query/char_length.py -Q 3 +,,,system-test,python3 ./test.py -f 2-query/upper.py -Q 3 +,,,system-test,python3 ./test.py -f 2-query/lower.py -Q 3 +,,,system-test,python3 ./test.py -f 2-query/join.py -Q 3 +,,,system-test,python3 ./test.py -f 2-query/join2.py -Q 3 +,,,system-test,python3 ./test.py -f 2-query/cast.py -Q 3 +,,,system-test,python3 ./test.py -f 2-query/substr.py -Q 3 +,,,system-test,python3 ./test.py -f 2-query/union.py -Q 3 +,,,system-test,python3 ./test.py -f 2-query/union1.py -Q 3 +,,,system-test,python3 ./test.py -f 2-query/concat.py -Q 3 +,,,system-test,python3 ./test.py -f 2-query/concat2.py -Q 3 +,,,system-test,python3 ./test.py -f 2-query/concat_ws.py -Q 3 +,,,system-test,python3 ./test.py -f 2-query/concat_ws2.py -Q 3 +,,,system-test,python3 ./test.py -f 2-query/check_tsdb.py -Q 3 +,,,system-test,python3 ./test.py -f 2-query/spread.py -Q 3 +,,,system-test,python3 ./test.py -f 2-query/hyperloglog.py -Q 3 +,,,system-test,python3 ./test.py -f 2-query/explain.py -Q 3 +,,,system-test,python3 ./test.py -f 2-query/leastsquares.py -Q 3 +,,,system-test,python3 ./test.py -f 2-query/timezone.py -Q 3 +,,,system-test,python3 ./test.py -f 2-query/Now.py -Q 3 +,,,system-test,python3 ./test.py -f 2-query/Today.py -Q 3 +,,,system-test,python3 ./test.py -f 2-query/max.py -Q 3 +,,,system-test,python3 ./test.py -f 2-query/min.py -Q 3 +,,,system-test,python3 ./test.py -f 2-query/mode.py -Q 3 +,,,system-test,python3 ./test.py -f 2-query/count.py -Q 3 +,,,system-test,python3 ./test.py -f 2-query/countAlwaysReturnValue.py -Q 3 +,,,system-test,python3 ./test.py -f 2-query/last.py -Q 3 +,,,system-test,python3 ./test.py -f 2-query/first.py -Q 3 +,,,system-test,python3 ./test.py -f 2-query/To_iso8601.py -Q 3 +,,,system-test,python3 ./test.py -f 2-query/To_unixtimestamp.py -Q 3 +,,,system-test,python3 ./test.py -f 2-query/timetruncate.py -Q 3 +,,,system-test,python3 ./test.py -f 2-query/diff.py -Q 3 +,,,system-test,python3 ./test.py -f 2-query/Timediff.py -Q 3 +,,,system-test,python3 ./test.py -f 2-query/json_tag.py -Q 3 +,,,system-test,python3 ./test.py -f 2-query/top.py -Q 3 +,,,system-test,python3 ./test.py -f 2-query/bottom.py -Q 3 +,,,system-test,python3 ./test.py -f 2-query/percentile.py -Q 3 +,,,system-test,python3 ./test.py -f 2-query/apercentile.py -Q 3 +,,,system-test,python3 ./test.py -f 2-query/abs.py -Q 3 +,,,system-test,python3 ./test.py -f 2-query/ceil.py -Q 3 +,,,system-test,python3 ./test.py -f 2-query/floor.py -Q 3 +,,,system-test,python3 ./test.py -f 2-query/round.py -Q 3 +,,,system-test,python3 ./test.py -f 2-query/log.py -Q 3 +,,,system-test,python3 ./test.py -f 2-query/pow.py -Q 3 +,,,system-test,python3 ./test.py -f 2-query/sqrt.py -Q 3 +,,,system-test,python3 ./test.py -f 2-query/sin.py -Q 3 +,,,system-test,python3 ./test.py -f 2-query/cos.py -Q 3 +,,,system-test,python3 ./test.py -f 2-query/tan.py -Q 3 +,,,system-test,python3 ./test.py -f 2-query/arcsin.py -Q 3 +,,,system-test,python3 ./test.py -f 2-query/arccos.py -Q 3 +,,,system-test,python3 ./test.py -f 2-query/arctan.py -Q 3 +,,,system-test,python3 ./test.py -f 2-query/query_cols_tags_and_or.py -Q 3 +,,,system-test,python3 ./test.py -f 2-query/nestedQuery.py -Q 3 +,,,system-test,python3 ./test.py -f 2-query/nestedQuery_str.py -Q 3 +,,,system-test,python3 ./test.py -f 2-query/nestedQuery_math.py -Q 3 +,,,system-test,python3 ./test.py -f 2-query/nestedQuery_time.py -Q 3 +,,,system-test,python3 ./test.py -f 2-query/stablity.py -Q 3 +,,,system-test,python3 ./test.py -f 2-query/stablity_1.py -Q 3 +,,,system-test,python3 ./test.py -f 2-query/avg.py -Q 3 +,,,system-test,python3 ./test.py -f 2-query/elapsed.py -Q 3 +,,,system-test,python3 ./test.py -f 2-query/csum.py -Q 3 +,,,system-test,python3 ./test.py -f 2-query/mavg.py -Q 3 +,,,system-test,python3 ./test.py -f 2-query/sample.py -Q 3 +,,,system-test,python3 ./test.py -f 2-query/function_diff.py -Q 3 +,,,system-test,python3 ./test.py -f 2-query/unique.py -Q 3 +,,,system-test,python3 ./test.py -f 2-query/stateduration.py -Q 3 +,,,system-test,python3 ./test.py -f 2-query/function_stateduration.py -Q 3 +,,,system-test,python3 ./test.py -f 2-query/statecount.py -Q 3 +,,,system-test,python3 ./test.py -f 2-query/tail.py -Q 3 +,,,system-test,python3 ./test.py -f 2-query/ttl_comment.py -Q 3 +,,,system-test,python3 ./test.py -f 2-query/distribute_agg_count.py -Q 3 +,,,system-test,python3 ./test.py -f 2-query/distribute_agg_max.py -Q 3 +,,,system-test,python3 ./test.py -f 2-query/distribute_agg_min.py -Q 3 +,,,system-test,python3 ./test.py -f 2-query/distribute_agg_sum.py -Q 3 +,,,system-test,python3 ./test.py -f 2-query/distribute_agg_spread.py -Q 3 +,,,system-test,python3 ./test.py -f 2-query/distribute_agg_apercentile.py -Q 3 +,,,system-test,python3 ./test.py -f 2-query/distribute_agg_avg.py -Q 3 +,,,system-test,python3 ./test.py -f 2-query/distribute_agg_stddev.py -Q 3 +,,,system-test,python3 ./test.py -f 2-query/twa.py -Q 3 +,,,system-test,python3 ./test.py -f 2-query/irate.py -Q 3 +,,,system-test,python3 ./test.py -f 2-query/function_null.py -Q 3 +,,,system-test,python3 ./test.py -f 2-query/count_partition.py -Q 3 +,,,system-test,python3 ./test.py -f 2-query/max_partition.py -Q 3 +,,,system-test,python3 ./test.py -f 2-query/last_row.py -Q 3 +,,,system-test,python3 ./test.py -f 2-query/tsbsQuery.py -Q 3 +,,,system-test,python3 ./test.py -f 2-query/sml.py -Q 3 +,,,system-test,python3 ./test.py -f 2-query/interp.py -Q 3 +,,,system-test,python3 ./test.py -f 2-query/between.py -Q 4 +,,,system-test,python3 ./test.py -f 2-query/distinct.py -Q 4 +,,,system-test,python3 ./test.py -f 2-query/varchar.py -Q 4 +,,,system-test,python3 ./test.py -f 2-query/ltrim.py -Q 4 +,,,system-test,python3 ./test.py -f 2-query/rtrim.py -Q 4 +,,,system-test,python3 ./test.py -f 2-query/length.py -Q 4 +,,,system-test,python3 ./test.py -f 2-query/char_length.py -Q 4 +,,,system-test,python3 ./test.py -f 2-query/upper.py -Q 4 +,,,system-test,python3 ./test.py -f 2-query/lower.py -Q 4 +,,,system-test,python3 ./test.py -f 2-query/join.py -Q 4 +,,,system-test,python3 ./test.py -f 2-query/join2.py -Q 4 +,,,system-test,python3 ./test.py -f 2-query/substr.py -Q 4 +,,,system-test,python3 ./test.py -f 2-query/union.py -Q 4 +,,,system-test,python3 ./test.py -f 2-query/union1.py -Q 4 +,,,system-test,python3 ./test.py -f 2-query/concat.py -Q 4 +,,,system-test,python3 ./test.py -f 2-query/concat2.py -Q 4 +,,,system-test,python3 ./test.py -f 2-query/concat_ws.py -Q 4 +,,,system-test,python3 ./test.py -f 2-query/concat_ws2.py -Q 4 +,,,system-test,python3 ./test.py -f 2-query/check_tsdb.py -Q 4 +,,,system-test,python3 ./test.py -f 2-query/spread.py -Q 4 +,,,system-test,python3 ./test.py -f 2-query/hyperloglog.py -Q 4 +,,,system-test,python3 ./test.py -f 2-query/explain.py -Q 4 +,,,system-test,python3 ./test.py -f 2-query/leastsquares.py -Q 4 +,,,system-test,python3 ./test.py -f 2-query/timezone.py -Q 4 +,,,system-test,python3 ./test.py -f 2-query/Now.py -Q 4 +,,,system-test,python3 ./test.py -f 2-query/Today.py -Q 4 +,,,system-test,python3 ./test.py -f 2-query/max.py -Q 4 +,,,system-test,python3 ./test.py -f 2-query/min.py -Q 4 +,,,system-test,python3 ./test.py -f 2-query/mode.py -Q 4 +,,,system-test,python3 ./test.py -f 2-query/count.py -Q 4 +,,,system-test,python3 ./test.py -f 2-query/countAlwaysReturnValue.py -Q 4 +,,,system-test,python3 ./test.py -f 2-query/last.py -Q 4 +,,,system-test,python3 ./test.py -f 2-query/first.py -Q 4 +,,,system-test,python3 ./test.py -f 2-query/To_iso8601.py -Q 4 +,,,system-test,python3 ./test.py -f 2-query/To_unixtimestamp.py -Q 4 +,,,system-test,python3 ./test.py -f 2-query/timetruncate.py -Q 4 +,,,system-test,python3 ./test.py -f 2-query/diff.py -Q 4 +,,,system-test,python3 ./test.py -f 2-query/Timediff.py -Q 4 +,,,system-test,python3 ./test.py -f 2-query/json_tag.py -Q 4 +,,,system-test,python3 ./test.py -f 2-query/top.py -Q 4 +,,,system-test,python3 ./test.py -f 2-query/bottom.py -Q 4 +,,,system-test,python3 ./test.py -f 2-query/percentile.py -Q 4 +,,,system-test,python3 ./test.py -f 2-query/apercentile.py -Q 4 +,,,system-test,python3 ./test.py -f 2-query/abs.py -Q 4 +,,,system-test,python3 ./test.py -f 2-query/ceil.py -Q 4 +,,,system-test,python3 ./test.py -f 2-query/floor.py -Q 4 +,,,system-test,python3 ./test.py -f 2-query/round.py -Q 4 +,,,system-test,python3 ./test.py -f 2-query/log.py -Q 4 +,,,system-test,python3 ./test.py -f 2-query/pow.py -Q 4 +,,,system-test,python3 ./test.py -f 2-query/sqrt.py -Q 4 +,,,system-test,python3 ./test.py -f 2-query/sin.py -Q 4 +,,,system-test,python3 ./test.py -f 2-query/cos.py -Q 4 +,,,system-test,python3 ./test.py -f 2-query/tan.py -Q 4 +,,,system-test,python3 ./test.py -f 2-query/arcsin.py -Q 4 +,,,system-test,python3 ./test.py -f 2-query/arccos.py -Q 4 +,,,system-test,python3 ./test.py -f 2-query/arctan.py -Q 4 +,,,system-test,python3 ./test.py -f 2-query/query_cols_tags_and_or.py -Q 4 +,,,system-test,python3 ./test.py -f 2-query/nestedQuery.py -Q 4 +,,,system-test,python3 ./test.py -f 2-query/nestedQuery_str.py -Q 4 +,,,system-test,python3 ./test.py -f 2-query/nestedQuery_math.py -Q 4 +,,,system-test,python3 ./test.py -f 2-query/nestedQuery_time.py -Q 4 +,,,system-test,python3 ./test.py -f 2-query/stablity.py -Q 4 +,,,system-test,python3 ./test.py -f 2-query/stablity_1.py -Q 4 +,,,system-test,python3 ./test.py -f 2-query/avg.py -Q 4 +,,,system-test,python3 ./test.py -f 2-query/elapsed.py -Q 4 +,,,system-test,python3 ./test.py -f 2-query/csum.py -Q 4 +,,,system-test,python3 ./test.py -f 2-query/mavg.py -Q 4 +,,,system-test,python3 ./test.py -f 2-query/sample.py -Q 4 +,,,system-test,python3 ./test.py -f 2-query/function_diff.py -Q 4 +,,,system-test,python3 ./test.py -f 2-query/unique.py -Q 4 +,,,system-test,python3 ./test.py -f 2-query/stateduration.py -Q 4 +,,,system-test,python3 ./test.py -f 2-query/function_stateduration.py -Q 4 +,,,system-test,python3 ./test.py -f 2-query/statecount.py -Q 4 +,,,system-test,python3 ./test.py -f 2-query/tail.py -Q 4 +,,,system-test,python3 ./test.py -f 2-query/ttl_comment.py -Q 4 +,,,system-test,python3 ./test.py -f 2-query/distribute_agg_count.py -Q 4 +,,,system-test,python3 ./test.py -f 2-query/distribute_agg_max.py -Q 4 +,,,system-test,python3 ./test.py -f 2-query/distribute_agg_min.py -Q 4 +,,,system-test,python3 ./test.py -f 2-query/distribute_agg_sum.py -Q 4 +,,,system-test,python3 ./test.py -f 2-query/distribute_agg_spread.py -Q 4 +,,,system-test,python3 ./test.py -f 2-query/distribute_agg_apercentile.py -Q 4 +,,,system-test,python3 ./test.py -f 2-query/distribute_agg_avg.py -Q 4 +,,,system-test,python3 ./test.py -f 2-query/distribute_agg_stddev.py -Q 4 +,,,system-test,python3 ./test.py -f 2-query/twa.py -Q 4 +,,,system-test,python3 ./test.py -f 2-query/irate.py -Q 4 +,,,system-test,python3 ./test.py -f 2-query/function_null.py -Q 4 +,,,system-test,python3 ./test.py -f 2-query/count_partition.py -Q 4 +,,,system-test,python3 ./test.py -f 2-query/max_partition.py -Q 4 +,,,system-test,python3 ./test.py -f 2-query/last_row.py -Q 4 +,,,system-test,python3 ./test.py -f 2-query/tsbsQuery.py -Q 4 +,,,system-test,python3 ./test.py -f 2-query/sml.py -Q 4 +,,,system-test,python3 ./test.py -f 2-query/interp.py -Q 4 + +#develop test +,,,develop-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/auto_create_table_json.py +,,,develop-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/custom_col_tag.py +,,,develop-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/default_json.py +,,,develop-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/demo.py +,,,develop-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/insert_alltypes_json.py +,,,develop-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/invalid_commandline.py +,,,develop-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/json_tag.py +,,,develop-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/query_json.py +,,,develop-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/sample_csv_json.py +,,,develop-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/sml_json_alltypes.py +,,,develop-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/taosdemoTestQueryWithJson.py -R + +#docs-examples test +,,,docs-examples-test,bash python.sh +,,,docs-examples-test,bash node.sh +,,,docs-examples-test,bash csharp.sh +,,,docs-examples-test,bash jdbc.sh +,,,docs-examples-test,bash go.sh diff --git a/tests/parallel_test/container_build.sh b/tests/parallel_test/container_build.sh index 52864d668f..7c18f5cab5 100755 --- a/tests/parallel_test/container_build.sh +++ b/tests/parallel_test/container_build.sh @@ -44,15 +44,34 @@ ulimit -c unlimited if [ $ent -eq 0 ]; then REP_DIR=/home/TDengine - REP_MOUNT_PARAM=$WORKDIR/TDengine:/home/TDengine + REP_REAL_PATH=$WORKDIR/TDengine + REP_MOUNT_PARAM=$REP_REAL_PATH:/home/TDengine else REP_DIR=/home/TDinternal - REP_MOUNT_PARAM=$WORKDIR/TDinternal:/home/TDinternal + REP_REAL_PATH=$WORKDIR/TDinternal + REP_MOUNT_PARAM=$REP_REAL_PATH:/home/TDinternal fi - +date docker run \ -v $REP_MOUNT_PARAM \ - --rm --ulimit core=-1 taos_test:v1.0 sh -c "cd $REP_DIR;rm -rf debug;mkdir -p debug;cd debug;cmake .. -DBUILD_HTTP=false -DBUILD_TOOLS=true -DBUILD_TEST=true -DWEBSOCKET=true;make -j $THREAD_COUNT" + --rm --ulimit core=-1 taos_test:v1.0 sh -c "cd $REP_DIR;rm -rf debug;mkdir -p debug;cd debug;cmake .. -DBUILD_HTTP=false -DBUILD_TOOLS=true -DBUILD_TEST=true -DWEBSOCKET=true;make -j $THREAD_COUNT || exit 1" + +if [[ -d ${WORKDIR}/debugNoSan ]] ;then + echo "delete ${WORKDIR}/debugNoSan" + rm -rf ${WORKDIR}/debugNoSan +fi +if [[ -d ${WORKDIR}/debugSan ]] ;then + echo "delete ${WORKDIR}/debugSan" + rm -rf ${WORKDIR}/debugSan +fi + +mv ${REP_REAL_PATH}/debug ${WORKDIR}/debugNoSan +date +docker run \ + -v $REP_MOUNT_PARAM \ + --rm --ulimit core=-1 taos_test:v1.0 sh -c "cd $REP_DIR;rm -rf debug;mkdir -p debug;cd debug;cmake .. -DBUILD_HTTP=false -DBUILD_TOOLS=true -DBUILD_TEST=true -DWEBSOCKET=true -DSANITIZER=true;make -j $THREAD_COUNT || exit 1 " + +mv ${REP_REAL_PATH}/debug ${WORKDIR}/debugSan ret=$? exit $ret diff --git a/tests/parallel_test/run.sh b/tests/parallel_test/run.sh index 26f481e571..b5d57265be 100755 --- a/tests/parallel_test/run.sh +++ b/tests/parallel_test/run.sh @@ -164,8 +164,17 @@ function run_thread() { if [ -z "$case_redo_time" ]; then case_redo_time=${DEFAULT_RETRY_TIME:-2} fi - local exec_dir=`echo "$line"|cut -d, -f3` - local case_cmd=`echo "$line"|cut -d, -f4` + local case_build_san=`echo "$line"|cut -d, -f3` + if [ "${case_build_san}" == "y" ]; then + case_build_san="y" + elif [[ "${case_build_san}" == "n" ]] || [[ "${case_build_san}" == "" ]]; then + case_build_san="n" + else + usage + exit 1 + fi + local exec_dir=`echo "$line"|cut -d, -f4` + local case_cmd=`echo "$line"|cut -d, -f5` local case_file="" echo "$case_cmd"|grep -q "\.sh" if [ $? -eq 0 ]; then @@ -191,7 +200,7 @@ function run_thread() { if [ ! -z "$case_path" ]; then mkdir -p $log_dir/$case_path fi - cmd="${runcase_script} ${script} -w ${workdirs[index]} -c \"${case_cmd}\" -t ${thread_no} -d ${exec_dir} ${timeout_param}" + cmd="${runcase_script} ${script} -w ${workdirs[index]} -c \"${case_cmd}\" -t ${thread_no} -d ${exec_dir} -s ${case_build_san} ${timeout_param}" # echo "$thread_no $count $cmd" local ret=0 local redo_count=1 @@ -199,7 +208,7 @@ function run_thread() { start_time=`date +%s` local case_index=`flock -x $lock_file -c "sh -c \"echo \\\$(( \\\$( cat $index_file ) + 1 )) | tee $index_file\""` case_index=`printf "%5d" $case_index` - local case_info=`echo "$line"|cut -d, -f 3,4` + local case_info=`echo "$line"|cut -d, -f 3,4,5` while [ ${redo_count} -lt 6 ]; do if [ -f $case_log_file ]; then cp $case_log_file $log_dir/$case_file.${redo_count}.redotxt @@ -413,7 +422,7 @@ if [ -f "${failed_case_file}" ]; then continue fi fi - line=`echo "$line"|cut -d, -f 3,4` + line=`echo "$line"|cut -d, -f 3,4,5` echo -e "$i. $line \e[31m failed\e[0m" >&2 i=$(( i + 1 )) done <${failed_case_file} diff --git a/tests/parallel_test/run_container.sh b/tests/parallel_test/run_container.sh index f58aaaf29d..b5deb09341 100755 --- a/tests/parallel_test/run_container.sh +++ b/tests/parallel_test/run_container.sh @@ -8,11 +8,12 @@ function usage() { echo -e "\t -t thread number" echo -e "\t -e enterprise edition" echo -e "\t -o default timeout value" + echo -e "\t -s build with sanitizer" echo -e "\t -h help" } ent=0 -while getopts "w:d:c:t:o:eh" opt; do +while getopts "w:d:c:t:o:s:eh" opt; do case $opt in w) WORKDIR=$OPTARG @@ -32,6 +33,9 @@ while getopts "w:d:c:t:o:eh" opt; do o) extra_param="-o $OPTARG" ;; + s) + buildSan=$OPTARG + ;; h) usage exit 0 @@ -60,24 +64,37 @@ if [ -z "$thread_no" ]; then usage exit 1 fi + +#select whether the compilation environment includes sanitizer +if [ "${buildSan}" == "y" ]; then + DEBUGPATH="debugSan" +elif [[ "${buildSan}" == "n" ]] || [[ "${case_build_san}" == "" ]]; then + DEBUGPATH="debugNoSan" +else + usage + exit 1 +fi + if [ $ent -ne 0 ]; then # enterprise edition extra_param="$extra_param -e" INTERNAL_REPDIR=$WORKDIR/TDinternal REPDIR=$INTERNAL_REPDIR/community + REPDIR_DEBUG=$WORKDIR/$DEBUGPATH/ CONTAINER_TESTDIR=/home/TDinternal/community SIM_DIR=/home/TDinternal/sim REP_MOUNT_PARAM="$INTERNAL_REPDIR:/home/TDinternal" - REP_MOUNT_LIB="$INTERNAL_REPDIR/debug/build/lib:/home/TDinternal/debug/build/lib:ro" - + REP_MOUNT_DEBUG="${REPDIR_DEBUG}:/home/TDinternal/debug/" + REP_MOUNT_LIB="${REPDIR_DEBUG}/build/lib:/home/TDinternal/debug/build/lib:ro" else # community edition REPDIR=$WORKDIR/TDengine + REPDIR_DEBUG=$WORKDIR/$DEBUGPATH/ CONTAINER_TESTDIR=/home/TDengine SIM_DIR=/home/TDengine/sim REP_MOUNT_PARAM="$REPDIR:/home/TDengine" - REP_MOUNT_LIB="$REPDIR/debug/build/lib:/home/TDengine/debug/build/lib:ro" - + REP_MOUNT_DEBUG="${REPDIR_DEBUG}:/home/TDengine/debug/" + REP_MOUNT_LIB="${REPDIR_DEBUG}/build/lib:/home/TDinternal/debug/build/lib:ro" fi ulimit -c unlimited @@ -107,6 +124,7 @@ coredump_dir=`cat /proc/sys/kernel/core_pattern | xargs dirname` docker run \ -v $REP_MOUNT_PARAM \ + -v $REP_MOUNT_DEBUG \ -v $REP_MOUNT_LIB \ -v $MOUNT_DIR \ -v ${SOURCEDIR}:/usr/local/src/ \ diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt deleted file mode 100644 index e6fdecf35e..0000000000 --- a/tests/script/jenkins/basic.txt +++ /dev/null @@ -1,457 +0,0 @@ - -#======================b1-start=============== - -# ---- user ---- -./test.sh -f tsim/user/basic.sim -./test.sh -f tsim/user/password.sim -./test.sh -f tsim/user/privilege_db.sim -./test.sh -f tsim/user/privilege_sysinfo.sim - -# ---- db ---- -./test.sh -f tsim/db/alter_option.sim -./test.sh -f tsim/db/alter_replica_13.sim -./test.sh -f tsim/db/alter_replica_31.sim -./test.sh -f tsim/db/basic1.sim -./test.sh -f tsim/db/basic2.sim -./test.sh -f tsim/db/basic3.sim -./test.sh -f tsim/db/basic4.sim -./test.sh -f tsim/db/basic5.sim -./test.sh -f tsim/db/basic6.sim -./test.sh -f tsim/db/commit.sim -./test.sh -f tsim/db/create_all_options.sim -./test.sh -f tsim/db/delete_reuse1.sim -./test.sh -f tsim/db/delete_reuse2.sim -./test.sh -f tsim/db/delete_reusevnode.sim -./test.sh -f tsim/db/delete_reusevnode2.sim -./test.sh -f tsim/db/delete_writing1.sim -./test.sh -f tsim/db/delete_writing2.sim -./test.sh -f tsim/db/error1.sim -./test.sh -f tsim/db/keep.sim -./test.sh -f tsim/db/len.sim -./test.sh -f tsim/db/repeat.sim -./test.sh -f tsim/db/show_create_db.sim -./test.sh -f tsim/db/show_create_table.sim -./test.sh -f tsim/db/tables.sim -./test.sh -f tsim/db/taosdlog.sim - -# ---- dnode -./test.sh -f tsim/dnode/balance_replica1.sim -./test.sh -f tsim/dnode/balance_replica3.sim -./test.sh -f tsim/dnode/balance1.sim -./test.sh -f tsim/dnode/balance2.sim -./test.sh -f tsim/dnode/balance3.sim -./test.sh -f tsim/dnode/balancex.sim -./test.sh -f tsim/dnode/create_dnode.sim -./test.sh -f tsim/dnode/drop_dnode_has_mnode.sim -./test.sh -f tsim/dnode/drop_dnode_has_qnode_snode.sim -./test.sh -f tsim/dnode/drop_dnode_has_vnode_replica1.sim -./test.sh -f tsim/dnode/drop_dnode_has_vnode_replica3.sim -./test.sh -f tsim/dnode/drop_dnode_has_multi_vnode_replica1.sim -./test.sh -f tsim/dnode/drop_dnode_has_multi_vnode_replica3.sim -./test.sh -f tsim/dnode/drop_dnode_force.sim -./test.sh -f tsim/dnode/offline_reason.sim -./test.sh -f tsim/dnode/redistribute_vgroup_replica1.sim -./test.sh -f tsim/dnode/redistribute_vgroup_replica3_v1_leader.sim -./test.sh -f tsim/dnode/redistribute_vgroup_replica3_v1_follower.sim -./test.sh -f tsim/dnode/redistribute_vgroup_replica3_v2.sim -./test.sh -f tsim/dnode/redistribute_vgroup_replica3_v3.sim -./test.sh -f tsim/dnode/vnode_clean.sim -./test.sh -f tsim/dnode/use_dropped_dnode.sim -./test.sh -f tsim/dnode/split_vgroup_replica1.sim -./test.sh -f tsim/dnode/split_vgroup_replica3.sim - -# ---- import ---- -./test.sh -f tsim/import/basic.sim -./test.sh -f tsim/import/commit.sim -./test.sh -f tsim/import/large.sim -./test.sh -f tsim/import/replica1.sim - -# ---- insert ---- -./test.sh -f tsim/insert/backquote.sim -./test.sh -f tsim/insert/basic.sim -./test.sh -f tsim/insert/basic0.sim -./test.sh -f tsim/insert/basic1.sim -./test.sh -f tsim/insert/basic2.sim -./test.sh -f tsim/insert/commit-merge0.sim -./test.sh -f tsim/insert/insert_drop.sim -./test.sh -f tsim/insert/insert_select.sim -./test.sh -f tsim/insert/null.sim -./test.sh -f tsim/insert/query_block1_file.sim -./test.sh -f tsim/insert/query_block1_memory.sim -./test.sh -f tsim/insert/query_block2_file.sim -./test.sh -f tsim/insert/query_block2_memory.sim -./test.sh -f tsim/insert/query_file_memory.sim -./test.sh -f tsim/insert/query_multi_file.sim -./test.sh -f tsim/insert/tcp.sim -./test.sh -f tsim/insert/update0.sim -./test.sh -f tsim/insert/update1_sort_merge.sim - -# ---- parser ---- -./test.sh -f tsim/parser/alter__for_community_version.sim -./test.sh -f tsim/parser/alter_column.sim -./test.sh -f tsim/parser/alter_stable.sim -./test.sh -f tsim/parser/alter.sim -./test.sh -f tsim/parser/alter1.sim -./test.sh -f tsim/parser/auto_create_tb_drop_tb.sim -./test.sh -f tsim/parser/auto_create_tb.sim -./test.sh -f tsim/parser/between_and.sim -./test.sh -f tsim/parser/binary_escapeCharacter.sim -./test.sh -f tsim/parser/col_arithmetic_operation.sim -./test.sh -f tsim/parser/columnValue_bigint.sim -./test.sh -f tsim/parser/columnValue_bool.sim -./test.sh -f tsim/parser/columnValue_double.sim -./test.sh -f tsim/parser/columnValue_float.sim -./test.sh -f tsim/parser/columnValue_int.sim -./test.sh -f tsim/parser/columnValue_smallint.sim -./test.sh -f tsim/parser/columnValue_tinyint.sim -./test.sh -f tsim/parser/columnValue_unsign.sim -./test.sh -f tsim/parser/commit.sim -./test.sh -f tsim/parser/condition.sim -./test.sh -f tsim/parser/constCol.sim -./test.sh -f tsim/parser/create_db.sim -./test.sh -f tsim/parser/create_mt.sim -./test.sh -f tsim/parser/create_tb_with_tag_name.sim -./test.sh -f tsim/parser/create_tb.sim -./test.sh -f tsim/parser/dbtbnameValidate.sim -./test.sh -f tsim/parser/distinct.sim -# TD-17623 ./test.sh -f tsim/parser/fill_stb.sim -./test.sh -f tsim/parser/fill_us.sim -./test.sh -f tsim/parser/fill.sim -./test.sh -f tsim/parser/first_last.sim -./test.sh -f tsim/parser/fourArithmetic-basic.sim -./test.sh -f tsim/parser/function.sim -./test.sh -f tsim/parser/groupby-basic.sim -./test.sh -f tsim/parser/groupby.sim -./test.sh -f tsim/parser/having_child.sim -./test.sh -f tsim/parser/having.sim -./test.sh -f tsim/parser/import_commit1.sim -./test.sh -f tsim/parser/import_commit2.sim -./test.sh -f tsim/parser/import_commit3.sim -./test.sh -f tsim/parser/import_file.sim -./test.sh -f tsim/parser/import.sim -./test.sh -f tsim/parser/insert_multiTbl.sim -./test.sh -f tsim/parser/insert_tb.sim -# TD-18293 ./test.sh -f tsim/parser/interp.sim -./test.sh -f tsim/parser/join_manyblocks.sim -./test.sh -f tsim/parser/join_multitables.sim -./test.sh -f tsim/parser/join_multivnode.sim -./test.sh -f tsim/parser/join.sim -./test.sh -f tsim/parser/last_cache.sim -./test.sh -f tsim/parser/last_groupby.sim -./test.sh -f tsim/parser/lastrow.sim -./test.sh -f tsim/parser/lastrow2.sim -./test.sh -f tsim/parser/like.sim -./test.sh -f tsim/parser/limit.sim -./test.sh -f tsim/parser/limit1.sim -# TD-17623 ./test.sh -f tsim/parser/limit2.sim -./test.sh -f tsim/parser/mixed_blocks.sim -./test.sh -f tsim/parser/nchar.sim -./test.sh -f tsim/parser/nestquery.sim -./test.sh -f tsim/parser/null_char.sim -./test.sh -f tsim/parser/precision_ns.sim -./test.sh -f tsim/parser/projection_limit_offset.sim -./test.sh -f tsim/parser/regex.sim -./test.sh -f tsim/parser/select_across_vnodes.sim -./test.sh -f tsim/parser/select_distinct_tag.sim -./test.sh -f tsim/parser/select_from_cache_disk.sim -./test.sh -f tsim/parser/select_with_tags.sim -./test.sh -f tsim/parser/selectResNum.sim -./test.sh -f tsim/parser/set_tag_vals.sim -./test.sh -f tsim/parser/single_row_in_tb.sim -./test.sh -f tsim/parser/sliding.sim -./test.sh -f tsim/parser/slimit_alter_tags.sim -./test.sh -f tsim/parser/slimit.sim -./test.sh -f tsim/parser/slimit1.sim -./test.sh -f tsim/parser/stableOp.sim -./test.sh -f tsim/parser/tags_dynamically_specifiy.sim -./test.sh -f tsim/parser/tags_filter.sim -./test.sh -f tsim/parser/tbnameIn.sim -./test.sh -f tsim/parser/timestamp.sim -./test.sh -f tsim/parser/top_groupby.sim -./test.sh -f tsim/parser/topbot.sim -./test.sh -f tsim/parser/union.sim -./test.sh -f tsim/parser/union_sysinfo.sim -./test.sh -f tsim/parser/where.sim - -# ---- query ---- -./test.sh -f tsim/query/charScalarFunction.sim -./test.sh -f tsim/query/explain.sim -./test.sh -f tsim/query/interval-offset.sim -./test.sh -f tsim/query/interval.sim -./test.sh -f tsim/query/scalarFunction.sim -./test.sh -f tsim/query/scalarNull.sim -./test.sh -f tsim/query/session.sim -./test.sh -f tsim/query/udf.sim - -# ---- qnode -./test.sh -f tsim/qnode/basic1.sim - -# ---- snode ---- -./test.sh -f tsim/snode/basic1.sim - -# ---- mnode -./test.sh -f tsim/mnode/basic1.sim -./test.sh -f tsim/mnode/basic2.sim -./test.sh -f tsim/mnode/basic3.sim -./test.sh -f tsim/mnode/basic4.sim -./test.sh -f tsim/mnode/basic5.sim - -# ---- show ---- -./test.sh -f tsim/show/basic.sim - -# ---- table ---- -./test.sh -f tsim/table/autocreate.sim -./test.sh -f tsim/table/basic1.sim -./test.sh -f tsim/table/basic2.sim -./test.sh -f tsim/table/basic3.sim -./test.sh -f tsim/table/bigint.sim -./test.sh -f tsim/table/binary.sim -./test.sh -f tsim/table/bool.sim -./test.sh -f tsim/table/column_name.sim -./test.sh -f tsim/table/column_num.sim -./test.sh -f tsim/table/column_value.sim -./test.sh -f tsim/table/column2.sim -./test.sh -f tsim/table/createmulti.sim -./test.sh -f tsim/table/date.sim -./test.sh -f tsim/table/db.table.sim -./test.sh -f tsim/table/delete_reuse1.sim -./test.sh -f tsim/table/delete_reuse2.sim -./test.sh -f tsim/table/delete_writing.sim -./test.sh -f tsim/table/describe.sim -./test.sh -f tsim/table/double.sim -./test.sh -f tsim/table/float.sim -./test.sh -f tsim/table/hash.sim -./test.sh -f tsim/table/int.sim -./test.sh -f tsim/table/limit.sim -./test.sh -f tsim/table/smallint.sim -./test.sh -f tsim/table/table_len.sim -./test.sh -f tsim/table/table.sim -./test.sh -f tsim/table/tinyint.sim -./test.sh -f tsim/table/vgroup.sim - -# ---- stream -./test.sh -f tsim/stream/basic0.sim -g -# TD-20201 ./test.sh -f tsim/stream/basic1.sim -./test.sh -f tsim/stream/basic2.sim -./test.sh -f tsim/stream/drop_stream.sim -./test.sh -f tsim/stream/fillHistoryBasic1.sim -./test.sh -f tsim/stream/fillHistoryBasic2.sim -./test.sh -f tsim/stream/fillHistoryBasic3.sim -./test.sh -f tsim/stream/distributeInterval0.sim -./test.sh -f tsim/stream/distributeIntervalRetrive0.sim -./test.sh -f tsim/stream/distributeSession0.sim -./test.sh -f tsim/stream/session0.sim -./test.sh -f tsim/stream/session1.sim -./test.sh -f tsim/stream/state0.sim -./test.sh -f tsim/stream/triggerInterval0.sim -./test.sh -f tsim/stream/triggerSession0.sim -./test.sh -f tsim/stream/partitionby.sim -./test.sh -f tsim/stream/partitionby1.sim -./test.sh -f tsim/stream/schedSnode.sim -./test.sh -f tsim/stream/windowClose.sim -./test.sh -f tsim/stream/ignoreExpiredData.sim -./test.sh -f tsim/stream/sliding.sim -./test.sh -f tsim/stream/partitionbyColumnInterval.sim -./test.sh -f tsim/stream/partitionbyColumnSession.sim -./test.sh -f tsim/stream/partitionbyColumnState.sim -./test.sh -f tsim/stream/deleteInterval.sim -./test.sh -f tsim/stream/deleteSession.sim -./test.sh -f tsim/stream/deleteState.sim -./test.sh -f tsim/stream/fillIntervalDelete0.sim -./test.sh -f tsim/stream/fillIntervalDelete1.sim -./test.sh -f tsim/stream/fillIntervalLinear.sim -./test.sh -f tsim/stream/fillIntervalPartitionBy.sim -./test.sh -f tsim/stream/fillIntervalPrevNext.sim -./test.sh -f tsim/stream/fillIntervalValue.sim - -# ---- transaction ---- -./test.sh -f tsim/trans/lossdata1.sim -./test.sh -f tsim/trans/create_db.sim - -# ---- tmq -./test.sh -f tsim/tmq/basic1.sim -./test.sh -f tsim/tmq/basic2.sim -./test.sh -f tsim/tmq/basic3.sim -./test.sh -f tsim/tmq/basic4.sim -./test.sh -f tsim/tmq/basic1Of2Cons.sim -./test.sh -f tsim/tmq/basic2Of2Cons.sim -./test.sh -f tsim/tmq/basic3Of2Cons.sim -./test.sh -f tsim/tmq/basic4Of2Cons.sim -./test.sh -f tsim/tmq/basic2Of2ConsOverlap.sim -./test.sh -f tsim/tmq/topic.sim -./test.sh -f tsim/tmq/snapshot.sim -./test.sh -f tsim/tmq/snapshot1.sim - -# --- stable ---- -./test.sh -f tsim/stable/alter_comment.sim -./test.sh -f tsim/stable/alter_count.sim -./test.sh -f tsim/stable/alter_import.sim -./test.sh -f tsim/stable/alter_insert1.sim -./test.sh -f tsim/stable/alter_insert2.sim -./test.sh -f tsim/stable/alter_metrics.sim -./test.sh -f tsim/stable/column_add.sim -./test.sh -f tsim/stable/column_drop.sim -./test.sh -f tsim/stable/column_modify.sim -./test.sh -f tsim/stable/disk.sim -./test.sh -f tsim/stable/dnode3.sim -./test.sh -f tsim/stable/metrics.sim -./test.sh -f tsim/stable/refcount.sim -./test.sh -f tsim/stable/tag_add.sim -./test.sh -f tsim/stable/tag_drop.sim -./test.sh -f tsim/stable/tag_filter.sim -./test.sh -f tsim/stable/tag_modify.sim -./test.sh -f tsim/stable/tag_rename.sim -./test.sh -f tsim/stable/values.sim -./test.sh -f tsim/stable/vnode3.sim -./test.sh -f tsim/stable/metrics_idx.sim - -# --- sma -./test.sh -f tsim/sma/drop_sma.sim -./test.sh -f tsim/sma/tsmaCreateInsertQuery.sim -./test.sh -f tsim/sma/rsmaCreateInsertQuery.sim -./test.sh -f tsim/sma/rsmaPersistenceRecovery.sim - -# --- valgrind ---- -./test.sh -f tsim/valgrind/checkError1.sim -./test.sh -f tsim/valgrind/checkError2.sim -./test.sh -f tsim/valgrind/checkError3.sim -./test.sh -f tsim/valgrind/checkError4.sim -./test.sh -f tsim/valgrind/checkError5.sim -./test.sh -f tsim/valgrind/checkError6.sim -./test.sh -f tsim/valgrind/checkError7.sim -./test.sh -f tsim/valgrind/checkError8.sim -./test.sh -f tsim/valgrind/checkUdf.sim - -# --- vnode ---- -./test.sh -f tsim/vnode/replica3_basic.sim -./test.sh -f tsim/vnode/replica3_repeat.sim -./test.sh -f tsim/vnode/replica3_vgroup.sim -./test.sh -f tsim/vnode/replica3_many.sim -./test.sh -f tsim/vnode/replica3_import.sim -./test.sh -f tsim/vnode/stable_balance_replica1.sim -./test.sh -f tsim/vnode/stable_dnode2_stop.sim -./test.sh -f tsim/vnode/stable_dnode2.sim -./test.sh -f tsim/vnode/stable_dnode3.sim -./test.sh -f tsim/vnode/stable_replica3_dnode6.sim -./test.sh -f tsim/vnode/stable_replica3_vnode3.sim - -# --- sync -./test.sh -f tsim/sync/3Replica1VgElect.sim -./test.sh -f tsim/sync/3Replica5VgElect.sim -./test.sh -f tsim/sync/oneReplica1VgElect.sim -./test.sh -f tsim/sync/oneReplica5VgElect.sim - -# --- catalog ---- -./test.sh -f tsim/catalog/alterInCurrent.sim - -# --- scalar ---- -./test.sh -f tsim/scalar/in.sim -./test.sh -f tsim/scalar/scalar.sim -./test.sh -f tsim/scalar/filter.sim -./test.sh -f tsim/scalar/caseWhen.sim - -# ---- alter ---- -./test.sh -f tsim/alter/cached_schema_after_alter.sim -./test.sh -f tsim/alter/dnode.sim -./test.sh -f tsim/alter/table.sim - -# ---- cache ---- -./test.sh -f tsim/cache/new_metrics.sim -./test.sh -f tsim/cache/restart_table.sim -./test.sh -f tsim/cache/restart_metrics.sim - -# ---- column ---- -./test.sh -f tsim/column/commit.sim -./test.sh -f tsim/column/metrics.sim -./test.sh -f tsim/column/table.sim - -# ---- compress ---- -./test.sh -f tsim/compress/commitlog.sim -./test.sh -f tsim/compress/compress2.sim -./test.sh -f tsim/compress/compress.sim -./test.sh -f tsim/compress/uncompress.sim - -# ---- compute ---- -./test.sh -f tsim/compute/avg.sim -./test.sh -f tsim/compute/block_dist.sim -./test.sh -f tsim/compute/bottom.sim -./test.sh -f tsim/compute/count.sim -./test.sh -f tsim/compute/diff.sim -./test.sh -f tsim/compute/diff2.sim -./test.sh -f tsim/compute/first.sim -./test.sh -f tsim/compute/interval.sim -./test.sh -f tsim/compute/last_row.sim -./test.sh -f tsim/compute/last.sim -./test.sh -f tsim/compute/leastsquare.sim -./test.sh -f tsim/compute/max.sim -./test.sh -f tsim/compute/min.sim -./test.sh -f tsim/compute/null.sim -./test.sh -f tsim/compute/percentile.sim -./test.sh -f tsim/compute/stddev.sim -./test.sh -f tsim/compute/sum.sim -./test.sh -f tsim/compute/top.sim - -# ---- field ---- -./test.sh -f tsim/field/2.sim -./test.sh -f tsim/field/3.sim -./test.sh -f tsim/field/4.sim -./test.sh -f tsim/field/5.sim -./test.sh -f tsim/field/6.sim -./test.sh -f tsim/field/binary.sim -./test.sh -f tsim/field/bigint.sim -./test.sh -f tsim/field/bool.sim -./test.sh -f tsim/field/double.sim -./test.sh -f tsim/field/float.sim -./test.sh -f tsim/field/int.sim -./test.sh -f tsim/field/single.sim -./test.sh -f tsim/field/smallint.sim -./test.sh -f tsim/field/tinyint.sim -./test.sh -f tsim/field/unsigined_bigint.sim - -# ---- vector ---- -./test.sh -f tsim/vector/metrics_field.sim -./test.sh -f tsim/vector/metrics_mix.sim -./test.sh -f tsim/vector/metrics_query.sim -./test.sh -f tsim/vector/metrics_tag.sim -./test.sh -f tsim/vector/metrics_time.sim -./test.sh -f tsim/vector/multi.sim -./test.sh -f tsim/vector/single.sim -./test.sh -f tsim/vector/table_field.sim -./test.sh -f tsim/vector/table_mix.sim -./test.sh -f tsim/vector/table_query.sim -./test.sh -f tsim/vector/table_time.sim - -# ---- wal ---- -./test.sh -f tsim/wal/kill.sim - -# ---- tag ---- -./test.sh -f tsim/tag/3.sim -./test.sh -f tsim/tag/4.sim -./test.sh -f tsim/tag/5.sim -./test.sh -f tsim/tag/6.sim -./test.sh -f tsim/tag/add.sim -./test.sh -f tsim/tag/bigint.sim -./test.sh -f tsim/tag/binary_binary.sim -./test.sh -f tsim/tag/binary.sim -./test.sh -f tsim/tag/bool_binary.sim -./test.sh -f tsim/tag/bool_int.sim -./test.sh -f tsim/tag/bool.sim -./test.sh -f tsim/tag/change.sim -./test.sh -f tsim/tag/column.sim -./test.sh -f tsim/tag/commit.sim -./test.sh -f tsim/tag/create.sim -./test.sh -f tsim/tag/delete.sim -./test.sh -f tsim/tag/double.sim -./test.sh -f tsim/tag/filter.sim -./test.sh -f tsim/tag/float.sim -./test.sh -f tsim/tag/int_binary.sim -./test.sh -f tsim/tag/int_float.sim -./test.sh -f tsim/tag/int.sim -./test.sh -f tsim/tag/set.sim -./test.sh -f tsim/tag/smallint.sim -./test.sh -f tsim/tag/tinyint.sim -./test.sh -f tsim/tag/drop_tag.sim -./test.sh -f tsim/tag/tbNameIn.sim - -./test.sh -f tmp/monitor.sim -#======================b1-end=============== diff --git a/tests/script/sh/checkAsan.sh b/tests/script/sh/checkAsan.sh new file mode 100755 index 0000000000..d4801891ed --- /dev/null +++ b/tests/script/sh/checkAsan.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +set +e +#set -x + +SCRIPT_DIR=`dirname $0` +cd $SCRIPT_DIR/../ +SCRIPT_DIR=`pwd` + +IN_TDINTERNAL="community" +if [[ "$SCRIPT_DIR" == *"$IN_TDINTERNAL"* ]]; then + cd ../../.. +else + cd ../../ +fi + +TAOS_DIR=`pwd` +LOG_DIR=$TAOS_DIR/sim/tsim/asan + +error_num=`cat ${LOG_DIR}/tsim.asan | grep "ERROR" | wc -l` +memory_leak=`cat ${LOG_DIR}/tsim.asan | grep "Direct leak" | wc -l` +indirect_leak=`cat ${LOG_DIR}/tsim.asan | grep "Indirect leak" | wc -l` +runtime_error=`cat ${LOG_DIR}/tsim.asan | grep "runtime error" | wc -l` + +echo -e "\033[44;32;1m"asan error_num: $error_num"\033[0m" +echo -e "\033[44;32;1m"asan memory_leak: $memory_leak"\033[0m" +echo -e "\033[44;32;1m"asan indirect_leak: $indirect_leak"\033[0m" +echo -e "\033[44;32;1m"asan runtime error: $runtime_error"\033[0m" + +let "errors=$error_num+$memory_leak+$indirect_leak+$runtime_error" + +if [ $errors -eq 0 ]; then + echo -e "\033[44;32;1m"no asan errors"\033[0m" + exit 0 +else + echo -e "\033[44;31;1m"asan total errors: $errors"\033[0m" + cat ${LOG_DIR}/tsim.asan + exit 1 +fi \ No newline at end of file diff --git a/tests/script/sh/exec.sh b/tests/script/sh/exec.sh index 74015eebd6..3f2c5d268c 100755 --- a/tests/script/sh/exec.sh +++ b/tests/script/sh/exec.sh @@ -80,7 +80,7 @@ LOG_DIR=$NODE_DIR/log DATA_DIR=$NODE_DIR/data MGMT_DIR=$NODE_DIR/data/mgmt TSDB_DIR=$NODE_DIR/data/tsdb - +ASAN_DIR=$SIM_DIR/tsim/asan TAOS_CFG=$NODE_DIR/cfg/taos.cfg echo ------------ $EXEC_OPTON $NODE_NAME @@ -105,7 +105,7 @@ if [ "$EXEC_OPTON" = "start" ]; then nohup valgrind --log-file=${LOG_DIR}/valgrind-taosd-${NODE_NAME}-${TT}.log --tool=memcheck --leak-check=full --show-reachable=no --track-origins=yes --show-leak-kinds=all --num-callers=20 -v -v --workaround-gcc296-bugs=yes $EXE_DIR/taosd -c $CFG_DIR > /dev/null 2>&1 & else echo "nohup $EXE_DIR/taosd -c $CFG_DIR > /dev/null 2>&1 &" - nohup $EXE_DIR/taosd -c $CFG_DIR > /dev/null 2>&1 & + nohup $EXE_DIR/taosd -c $CFG_DIR > /dev/null 2> $ASAN_DIR/$NODE_NAME.asan & fi else diff --git a/tests/script/test.sh b/tests/script/test.sh index b38d331715..1e3319dd0a 100755 --- a/tests/script/test.sh +++ b/tests/script/test.sh @@ -74,6 +74,7 @@ PRG_DIR=$SIM_DIR/tsim CFG_DIR=$PRG_DIR/cfg LOG_DIR=$PRG_DIR/log DATA_DIR=$PRG_DIR/data +ASAN_DIR=$PRG_DIR/asan chmod -R 777 $PRG_DIR echo "------------------------------------------------------------------------" @@ -82,14 +83,17 @@ echo "BUILD_DIR: $BUILD_DIR" echo "SIM_DIR : $SIM_DIR" echo "CODE_DIR : $CODE_DIR" echo "CFG_DIR : $CFG_DIR" +echo "ASAN_DIR : $ASAN_DIR" rm -rf $SIM_DIR/* rm -rf $LOG_DIR rm -rf $CFG_DIR +rm -rf $ASAN_DIR mkdir -p $PRG_DIR mkdir -p $LOG_DIR mkdir -p $CFG_DIR +mkdir -p $ASAN_DIR TAOS_CFG=$PRG_DIR/cfg/taos.cfg touch -f $TAOS_CFG @@ -132,8 +136,9 @@ if [ -n "$FILE_NAME" ]; then echo "ExcuteCmd:" $PROGRAM -c $CFG_DIR -f $FILE_NAME -v $PROGRAM -c $CFG_DIR -f $FILE_NAME -v else - echo "ExcuteCmd:" $PROGRAM -c $CFG_DIR -f $FILE_NAME - $PROGRAM -c $CFG_DIR -f $FILE_NAME + echo "ExcuteCmd:" $PROGRAM -c $CFG_DIR -f $FILE_NAME + $PROGRAM -c $CFG_DIR -f $FILE_NAME 2> $ASAN_DIR/tsim.asan + $CODE_DIR/sh/checkAsan.sh fi else echo "ExcuteCmd:" $PROGRAM -c $CFG_DIR -f basicSuite.sim diff --git a/tests/script/tsim/db/alter_option.sim b/tests/script/tsim/db/alter_option.sim index b6139cea13..63018aea8c 100644 --- a/tests/script/tsim/db/alter_option.sim +++ b/tests/script/tsim/db/alter_option.sim @@ -38,7 +38,7 @@ endi print ============= create database #database_option: { -# | BUFFER value [3~16384, default: 96] +# | BUFFER value [3~16384, default: 256] # | PAGES value [64~16384, default: 256] # | CACHEMODEL value ['node', 'last_row', 'last_value', 'both'] # | WAL_FSYNC_PERIOD value [0 ~ 180000 ms] @@ -78,7 +78,7 @@ endi if $data7_db != 1440000m,1440000m,1440000m then # keep return -1 endi -if $data8_db != 96 then # buffer +if $data8_db != 256 then # buffer return -1 endi if $data9_db != 4 then # pagesize diff --git a/tests/script/tsim/db/commit.sim b/tests/script/tsim/db/commit.sim index 2233245034..f60663d565 100644 --- a/tests/script/tsim/db/commit.sim +++ b/tests/script/tsim/db/commit.sim @@ -89,8 +89,8 @@ if $data01 != 40 then endi print ======== step4 import new data -sql_error import into tb values (now + 30d , 30 ) -sql_error import into tb values (now + 31d , 31 ) +#sql_error import into tb values (now + 30d , 30 ) +#sql_error import into tb values (now + 31d , 31 ) sql select * from tb order by ts desc print ===> rows $rows diff --git a/tests/script/tsim/db/create_all_options.sim b/tests/script/tsim/db/create_all_options.sim index 5ac2ee6c4e..7012fbac6c 100644 --- a/tests/script/tsim/db/create_all_options.sim +++ b/tests/script/tsim/db/create_all_options.sim @@ -37,7 +37,7 @@ endi print ============= create database with all options #database_option: { -# | BUFFER value [3~16384, default: 96] +# | BUFFER value [3~16384, default: 256] # | PAGES value [64~16384, default: 256] # | PAGESIZE value [1~16384, default: 4] # | CACHEMODEL value ['node', 'last_row', 'last_value', 'both', default: 'node'] @@ -98,7 +98,7 @@ endi if $data7_db != 5256000m,5256000m,5256000m then # keep return -1 endi -if $data8_db != 96 then # buffer +if $data8_db != 256 then # buffer return -1 endi if $data9_db != 4 then # pagesize diff --git a/tests/script/tsim/parser/having_child.sim b/tests/script/tsim/parser/having_child.sim index ae78c806ca..db9a25365e 100644 --- a/tests/script/tsim/parser/having_child.sim +++ b/tests/script/tsim/parser/having_child.sim @@ -733,6 +733,7 @@ sql select avg(f1),count(tb1.*),sum(f1),stddev(f1),LEASTSQUARES(f1,1,1) from tb1 sql select avg(f1),count(tb1.*),sum(f1),stddev(f1),LEASTSQUARES(f1,1,1) from tb1 group by f1 having sum(f1) > 2 order by f1; if $rows != 3 then + print expect 3 , actual: $rows return -1 endi if $data00 != 2.000000000 then diff --git a/tests/script/tsim/stream/basic1.sim b/tests/script/tsim/stream/basic1.sim index b20e2e3592..bb6604687c 100644 --- a/tests/script/tsim/stream/basic1.sim +++ b/tests/script/tsim/stream/basic1.sim @@ -23,443 +23,516 @@ sql insert into t1 values(1648791223001,2,2,3,1.1); sql insert into t1 values(1648791233002,3,2,3,2.1); sql insert into t1 values(1648791243003,4,2,3,3.1); sql insert into t1 values(1648791213004,4,2,3,4.1); -sleep 1000 + +$loop_count = 0 + +loop0: +sleep 200 + sql select `_wstart`, c1, c2 ,c3 ,c4, c5 from streamt; -if $rows != 4 then - print ======$rows +$loop_count = $loop_count + 1 +if $loop_count == 20 then return -1 endi +if $rows != 4 then + print =====rows=$rows + goto loop0 +endi + # row 0 if $data01 != 2 then - print ======$data01 - return -1 + print =====data01=$data01 + goto loop0 endi if $data02 != 2 then - print ======$data02 - return -1 + print =====data02=$data02 + goto loop0 endi if $data03 != 5 then - print ======$data03 - return -1 + print =====data03=$data03 + goto loop0 endi if $data04 != 2 then - print ======$data04 - return -1 + print =====data04=$data04 + goto loop0 endi if $data05 != 3 then - print ======$data05 - return -1 + print =====data05=$data05 + goto loop0 endi # row 1 if $data11 != 1 then - print ======$data11 - return -1 + print =====data11=$data11 + goto loop0 endi if $data12 != 1 then - print ======$data12 - return -1 + print =====data12=$data12 + goto loop0 endi if $data13 != 2 then - print ======$data13 - return -1 + print =====data13=$data13 + goto loop0 endi if $data14 != 2 then - print ======$data14 - return -1 + print =====data14=$data14 + goto loop0 endi if $data15 != 3 then - print ======$data15 - return -1 + print =====data15=$data15 + goto loop0 endi # row 2 if $data21 != 1 then - print ======$data21 + print =====data21=$data21 return -1 endi if $data22 != 1 then - print ======$data22 + print =====data22=$data22 return -1 endi if $data23 != 3 then - print ======$data23 + print =====data23=$data23 return -1 endi if $data24 != 2 then - print ======$data24 + print =====data24=$data24 return -1 endi if $data25 != 3 then - print ======$data25 + print =====data25=$data25 return -1 endi # row 3 if $data31 != 1 then - print ======$data31 + print =====data31=$data31 return -1 endi if $data32 != 1 then - print ======$data32 + print =====data32=$data32 return -1 endi if $data33 != 4 then - print ======$data33 + print =====data33=$data33 return -1 endi if $data34 != 2 then - print ======$data34 + print =====data34=$data34 return -1 endi if $data35 != 3 then - print ======$data35 + print =====data35=$data35 return -1 endi sql insert into t1 values(1648791223001,12,14,13,11.1); -sleep 500 + +$loop_count = 0 +loop1: +sleep 200 + sql select * from streamt; +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + print count(*) , count(d) , sum(a) , max(b) , min(c) print 0: $data00 , $data01 , $data02 , $data03 , $data04 , $data05 print 1: $data10 , $data11 , $data12 , $data13 , $data14 , $data15 if $rows != 4 then print ======$rows - return -1 + goto loop1 endi # row 0 if $data01 != 2 then - print ======$data01 - return -1 + print =====data01=$data01 + goto loop1 endi if $data02 != 2 then - print ======$data02 - return -1 + print =====data02=$data02 + goto loop1 endi if $data03 != 5 then - print ======$data03 - return -1 + print =====data03=$data03 + goto loop1 endi if $data04 != 2 then - print ======$data04 - return -1 + print =====data04=$data04 + goto loop1 endi if $data05 != 3 then - print ======$data05 - return -1 + print =====data05=$data05 + goto loop1 endi # row 1 if $data11 != 1 then - print ======$data11 - return -1 + print =====data11=$data11 + goto loop1 endi if $data12 != 1 then - print ======$data12 - return -1 + print =====data12=$data12 + goto loop1 endi if $data13 != 12 then - print ======$data13 - return -1 + print =====data13=$data13 + goto loop1 endi if $data14 != 14 then - print ======$data14 - return -1 + print =====data14=$data14 + goto loop1 endi if $data15 != 13 then - print ======$data15 - return -1 + print =====data15=$data15 + goto loop1 endi # row 2 if $data21 != 1 then - print ======$data21 + print =====data21=$data21 return -1 endi if $data22 != 1 then - print ======$data22 + print =====data22=$data22 return -1 endi if $data23 != 3 then - print ======$data23 + print =====data23=$data23 return -1 endi if $data24 != 2 then - print ======$data24 + print =====data24=$data24 return -1 endi if $data25 != 3 then - print ======$data25 + print =====data25=$data25 return -1 endi # row 3 if $data31 != 1 then - print ======$data31 + print =====data31=$data31 return -1 endi if $data32 != 1 then - print ======$data32 + print =====data32=$data32 return -1 endi if $data33 != 4 then - print ======$data33 + print =====data33=$data33 return -1 endi if $data34 != 2 then - print ======$data34 + print =====data34=$data34 return -1 endi if $data35 != 3 then - print ======$data35 + print =====data35=$data35 return -1 endi sql insert into t1 values(1648791223002,12,14,13,11.1); -sleep 100 + +$loop_count = 0 +loop2: +sleep 200 + sql select `_wstart`, c1, c2 ,c3 ,c4, c5 from streamt; +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + # row 1 if $data11 != 2 then - print ======$data11 - return -1 + print =====data11=$data11 + goto loop2 endi if $data12 != 2 then - print ======$data12 - return -1 + print =====data12=$data12 + goto loop2 endi if $data13 != 24 then - print ======$data13 - return -1 + print =====data13=$data13 + goto loop2 endi if $data14 != 14 then - print ======$data14 - return -1 + print =====data14=$data14 + goto loop2 endi if $data15 != 13 then - print ======$data15 - return -1 + print =====data15=$data15 + goto loop2 endi sql insert into t1 values(1648791223003,12,14,13,11.1); -sleep 100 + +$loop_count = 0 +loop3: +sleep 200 + sql select `_wstart`, c1, c2 ,c3 ,c4, c5 from streamt; +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + # row 1 if $data11 != 3 then - print ======$data11 - return -1 + print =====data11=$data11 + goto loop3 endi if $data12 != 3 then - print ======$data12 - return -1 + print =====data12=$data12 + goto loop3 endi if $data13 != 36 then - print ======$data13 - return -1 + print =====data13=$data13 + goto loop3 endi if $data14 != 14 then - print ======$data14 - return -1 + print =====data14=$data14 + goto loop3 endi if $data15 != 13 then - print ======$data15 - return -1 + print =====data15=$data15 + goto loop3 endi sql insert into t1 values(1648791223001,1,1,1,1.1); sql insert into t1 values(1648791223002,2,2,2,2.1); sql insert into t1 values(1648791223003,3,3,3,3.1); -sleep 100 + +$loop_count = 0 +loop4: +sleep 200 + sql select `_wstart`, c1, c2 ,c3 ,c4, c5 from streamt; +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + # row 1 if $data11 != 3 then - print ======$data11 - return -1 + print =====data11=$data11 + goto loop4 endi if $data12 != 3 then - print ======$data12 - return -1 + print =====data12=$data12 + goto loop4 endi if $data13 != 6 then - print ======$data13 - return -1 + print =====data13=$data13 + goto loop4 endi if $data14 != 3 then - print ======$data14 - return -1 + print =====data14=$data14 + goto loop4 endi if $data15 != 1 then - print ======$data15 - return -1 + print =====data15=$data15 + goto loop4 endi sql insert into t1 values(1648791233003,3,2,3,2.1); sql insert into t1 values(1648791233002,5,6,7,8.1); sql insert into t1 values(1648791233002,3,2,3,2.1); -sleep 100 + +$loop_count = 0 +loop5: +sleep 200 + sql select `_wstart`, c1, c2 ,c3 ,c4, c5 from streamt; +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + # row 2 if $data21 != 2 then - print ======$data21 - return -1 + print =====data21=$data21 + goto loop5 endi if $data22 != 2 then - print ======$data22 - return -1 + print =====data22=$data22 + goto loop5 endi if $data23 != 6 then - print ======$data23 - return -1 + print =====data23=$data23 + goto loop5 endi if $data24 != 2 then - print ======$data24 - return -1 + print =====data24=$data24 + goto loop5 endi if $data25 != 3 then - print ======$data25 - return -1 + print =====data25=$data25 + goto loop5 endi sql insert into t1 values(1648791213004,4,2,3,4.1) (1648791213006,5,4,7,9.1) (1648791213004,40,20,30,40.1) (1648791213005,4,2,3,4.1); -sleep 100 + +$loop_count = 0 +loop6: +sleep 200 + sql select `_wstart`, c1, c2 ,c3 ,c4, c5 from streamt; +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + # row 0 if $data01 != 4 then - print ======$data01 - return -1 + print =====data01=$data01 + goto loop6 endi if $data02 != 4 then - print ======$data02 - return -1 + print =====data02=$data02 + goto loop6 endi if $data03 != 50 then - print ======$data03 != 50 - return -1 + print =====data03=$data03 != 50 + goto loop6 endi if $data04 != 20 then - print ======$data04 != 20 - return -1 + print =====data04=$data04 != 20 + goto loop6 endi if $data05 != 3 then - print ======$data05 - return -1 + print =====data05=$data05 + goto loop6 endi sql insert into t1 values(1648791223004,4,2,3,4.1) (1648791233006,5,4,7,9.1) (1648791223004,40,20,30,40.1) (1648791233005,4,2,3,4.1); -sleep 100 + +$loop_count = 0 +loop7: +sleep 200 + sql select `_wstart`, c1, c2 ,c3 ,c4, c5 from streamt; +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + # row 1 if $data11 != 4 then - print ======$data11 - return -1 + print =====data11=$data11 + goto loop7 endi if $data12 != 4 then - print ======$data12 - return -1 + print =====data12=$data12 + goto loop7 endi if $data13 != 46 then - print ======$data13 != 46 - return -1 + print =====data13=$data13 != 46 + goto loop7 endi if $data14 != 20 then - print ======$data14 != 20 - return -1 + print =====data14=$data14 != 20 + goto loop7 endi if $data15 != 1 then - print ======$data15 - return -1 + print =====data15=$data15 + goto loop7 endi # row 2 if $data21 != 4 then - print ======$data21 - return -1 + print =====data21=$data21 + goto loop7 endi if $data22 != 4 then - print ======$data22 - return -1 + print =====data22=$data22 + goto loop7 endi if $data23 != 15 then - print ======$data23 - return -1 + print =====data23=$data23 + goto loop7 endi if $data24 != 4 then - print ======$data24 - return -1 + print =====data24=$data24 + goto loop7 endi if $data25 != 3 then - print ======$data25 - return -1 + print =====data25=$data25 + goto loop7 endi sql create database test2 vgroups 1; @@ -479,11 +552,11 @@ sql insert into t1 values(1648791213000,1,1,1,1.0) t2 values(1648791213000,2,2,2 $loop_count = 0 -loop0: -sleep 300 +loop8: +sleep 200 $loop_count = $loop_count + 1 -if $loop_count == 10 then +if $loop_count == 20 then return -1 endi @@ -491,7 +564,7 @@ sql select * from streamt; if $rows != 4 then print =====rows=$rows - goto loop0 + goto loop8 endi sql insert into t1 values(1648791213000,5,5,5,5.0) t2 values(1648791213000,6,6,6,6.0) t5 values(1648791213000,7,7,7,7.0); @@ -499,11 +572,11 @@ sql insert into t1 values(1648791213000,5,5,5,5.0) t2 values(1648791213000,6,6,6 $loop_count = 0 -loop1: -sleep 300 +loop9: +sleep 200 $loop_count = $loop_count + 1 -if $loop_count == 10 then +if $loop_count == 20 then return -1 endi @@ -511,51 +584,51 @@ sql select * from streamt order by c4 desc; if $rows != 5 then print =====rows=$rows - goto loop1 + goto loop9 endi # row 0 if $data01 != 1 then print =====data01=$data01 - goto loop1 + goto loop9 endi if $data02 != 7 then print =====data02=$data02 - goto loop1 + goto loop9 endi # row 1 if $data11 != 1 then print =====data11=$data11 - goto loop1 + goto loop9 endi if $data12 != 6 then print =====data12=$data12 - goto loop1 + goto loop9 endi # row 2 if $data21 != 1 then print =====data21=$data21 - goto loop1 + goto loop9 endi if $data22 != 5 then print =====data22=$data22 - goto loop1 + goto loop9 endi sql insert into t1 values(1648791213000,8,8,8,8.0); $loop_count = 0 -loop2: -sleep 300 +loop10: +sleep 200 $loop_count = $loop_count + 1 -if $loop_count == 10 then +if $loop_count == 20 then return -1 endi @@ -564,28 +637,29 @@ sql select * from streamt order by c4 desc; # row 0 if $data01 != 1 then print =====data01=$data01 - goto loop2 + goto loop10 endi if $data02 != 8 then print =====data02=$data02 - goto loop2 + goto loop10 endi $loop_count = 0 -loop3: -sleep 300 +loop11: +sleep 200 + +sql select count(*) from streamt3; $loop_count = $loop_count + 1 -if $loop_count == 10 then +if $loop_count == 20 then return -1 endi -sql select count(*) from streamt3; # row 0 if $data00 != 5 then print =====data00=$data00 - goto loop3 + goto loop11 endi #max,min selectivity @@ -601,25 +675,26 @@ sql insert into ts1 values(1648791222001,2,2,3); sleep 50 $loop_count = 0 -loop3: +loop12: +sleep 200 + sql select * from streamtST3; -sleep 300 $loop_count = $loop_count + 1 -if $loop_count == 10 then +if $loop_count == 20 then return -1 endi # row 0 if $data02 != 1 then print =====data02=$data02 - goto loop3 + goto loop12 endi # row 1 if $data12 != 2 then print =====data12=$data12 - goto loop3 + goto loop12 endi @@ -629,19 +704,22 @@ sql create table t1(ts timestamp, a int, b int , c int, d double); sql create stream streams4 trigger at_once into streamt4 as select _wstart, count(*) c1 from t1 where a > 5 interval(10s); sql insert into t1 values(1648791213000,1,2,3,1.0); +$loop_count = 0 +loop13: sleep 200 + sql select * from streamt4; # row 0 if $rows != 0 then print =====rows=$rows - return -1 + goto loop13 endi sql insert into t1 values(1648791213000,6,2,3,1.0); $loop_count = 0 -loop4: +loop14: sleep 200 sql select * from streamt4; @@ -652,13 +730,13 @@ endi if $data01 != 1 then print =====data01=$data01 - goto loop4 + goto loop14 endi sql insert into t1 values(1648791213000,2,2,3,1.0); $loop_count = 0 -loop5: +loop15: sleep 200 sql select * from streamt4; @@ -669,7 +747,7 @@ endi if $rows != 0 then print =====rows=$rows - goto loop5 + goto loop15 endi diff --git a/tests/script/tsim/table/date.sim b/tests/script/tsim/table/date.sim index aa19baec15..bacfd15d4a 100644 --- a/tests/script/tsim/table/date.sim +++ b/tests/script/tsim/table/date.sim @@ -9,7 +9,7 @@ $tbPrefix = lm_da_tb $db = $dbPrefix . $i $tb = $tbPrefix . $i -print =============== step1 +print =============== step1 ms db sql create database $db sql use $db @@ -23,7 +23,7 @@ if $data00 != @17-01-01 08:00:00.001@ then return -1 endi -print =============== step2 +print =============== step2 ms db sql_error insert into $tb values ('2017-08-28 00:23:46.429+ 1a', 2) sql_error insert into $tb values ('2017-08-28 00:23:46cd .429', 2) sql select ts from $tb @@ -31,7 +31,7 @@ if $rows != 1 then return -1 endi -print =============== step3 +print =============== step3 ms db sql_error insert into $tb values ('1970-01-01 08:00:00.000', 3) sql_error insert into $tb values ('1970-01-01 08:00:00.000', 3) sql select ts from $tb @@ -39,39 +39,48 @@ if $rows != 1 then return -1 endi -print =============== step4 +print =============== step4 ms db sql insert into $tb values(now, 4); sql insert into $tb values(now+1a, 5); sql insert into $tb values(now+1s, 6); sql insert into $tb values(now+1m, 7); sql insert into $tb values(now+1h, 8); sql insert into $tb values(now+1d, 9); -sql_error insert into $tb values(now+3w, 10); -sql_error insert into $tb values(now+1n, 11); -sql_error insert into $tb values(now+1y, 12); +sql insert into $tb values(now+3w, 10); +sql insert into $tb values(31556995200000, 11); +sql insert into $tb values('2970-01-01 00:00:00.000', 12); -print =============== step5 -sql_error insert into $tb values ('9999-12-31 213:59:59.999', 13) +sql_error insert into $tb values(now+1n, 20); +sql_error insert into $tb values(now+1y, 21); +sql_error insert into $tb values(31556995200001, 22); +sql_error insert into $tb values('2970-01-02 00:00:00.000', 23); +sql_error insert into $tb values(9223372036854775807, 24); +sql_error insert into $tb values(9223372036854775808, 25); +sql_error insert into $tb values(92233720368547758088, 26); + + +print =============== step5 ms db +sql_error insert into $tb values ('9999-12-31 213:59:59.999', 27) sql select ts from $tb print $rows -if $rows != 7 then +if $rows != 10 then return -1 endi -print =============== step6 -sql_error insert into $tb values ('9999-12-99 23:59:59.999', 13) +print =============== step6 ms db +sql_error insert into $tb values ('9999-12-99 23:59:59.999', 28) sql select ts from $tb -if $rows != 7 then +if $rows != 10 then return -1 endi -print =============== step7 +print =============== step7 ms db $i = 1 $tb = $tbPrefix . $i sql create table $tb (ts timestamp, ts2 timestamp) -print =============== step8 +print =============== step8 ms db sql insert into $tb values (now, now) sql select * from $tb if $rows != 1 then @@ -84,4 +93,131 @@ if $rows != 2 then return -1 endi +print =============== step20 us db +sql create database $db precision 'us' keep 365000d; + +sql create table $tb (ts timestamp, speed int) +sql insert into $tb values ('2017-01-01 08:00:00.001', 1) +sql select ts from $tb +if $rows != 1 then + return -1 +endi +if $data00 != @17-01-01 08:00:00.001000@ then + print data00 = $data00 + return -1 +endi + +print =============== step21 us db +sql_error insert into $tb values ('2017-08-28 00:23:46.429+ 1a', 2) +sql_error insert into $tb values ('2017-08-28 00:23:46cd .429', 2) +sql select ts from $tb +if $rows != 1 then + return -1 +endi + +print =============== step22 us db +sql_error insert into $tb values ('970-01-01 08:00:00.000', 3) +sql_error insert into $tb values ('970-01-01 08:00:00.000', 3) +sql select ts from $tb +if $rows != 1 then + return -1 +endi + +print =============== step23 us db +sql insert into $tb values(now, 4); +sql insert into $tb values(now+1a, 5); +sql insert into $tb values(now+1s, 6); +sql insert into $tb values(now+1m, 7); +sql insert into $tb values(now+1h, 8); +sql insert into $tb values(now+1d, 9); +sql insert into $tb values(now+3w, 10); +sql insert into $tb values(31556995200000000, 11); +sql insert into $tb values('2970-01-01 00:00:00.000000', 12); + +sql_error insert into $tb values(now+1n, 20); +sql_error insert into $tb values(now+1y, 21); +sql_error insert into $tb values(31556995200000001, 22); +sql_error insert into $tb values('2970-01-02 00:00:00.000000', 23); +sql_error insert into $tb values(9223372036854775807, 24); +sql_error insert into $tb values(9223372036854775808, 25); +sql_error insert into $tb values(92233720368547758088, 26); +sql_error insert into $tb values ('9999-12-31 213:59:59.999', 27) + +print =============== step24 us db +sql select ts from $tb +print $rows +if $rows != 10 then + return -1 +endi + +sql drop database $db +sql select * from information_schema.ins_databases +if $rows != 2 then + return -1 +endi + +print =============== step30 ns db +sql create database $db precision 'ns' keep 36500d; + +sql create table $tb (ts timestamp, speed int) +sql insert into $tb values ('2017-01-01 08:00:00.001', 1) +sql select ts from $tb +if $rows != 1 then + return -1 +endi +if $data00 != @17-01-01 08:00:00.001000000@ then + print data00 = $data00 + return -1 +endi + +print =============== step31 ns db +sql_error insert into $tb values ('2017-08-28 00:23:46.429+ 1a', 2) +sql_error insert into $tb values ('2017-08-28 00:23:46cd .429', 2) +sql select ts from $tb +if $rows != 1 then + return -1 +endi + +print =============== step32 ns db +#sql_error insert into $tb values ('970-01-01 08:00:00.000000000', 3) +#sql_error insert into $tb values ('970-01-01 08:00:00.000000000', 3) +sql select ts from $tb +if $rows != 1 then + return -1 +endi + +print =============== step33 ns db +sql insert into $tb values(now, 4); +sql insert into $tb values(now+1a, 5); +sql insert into $tb values(now+1s, 6); +sql insert into $tb values(now+1m, 7); +sql insert into $tb values(now+1h, 8); +sql insert into $tb values(now+1d, 9); +sql insert into $tb values(now+3w, 10); +sql insert into $tb values(9214646400000000000, 11); +sql insert into $tb values('2262-01-01 00:00:00.000000000', 12); + +sql_error insert into $tb values(now+1n, 20); +sql_error insert into $tb values(now+1y, 21); +sql_error insert into $tb values(9214646400000000001, 22); +sql_error insert into $tb values('2262-01-02 00:00:00.000000000', 23); +sql_error insert into $tb values(9223372036854775807, 24); +sql_error insert into $tb values(9223372036854775808, 25); +sql_error insert into $tb values(92233720368547758088, 26); +sql_error insert into $tb values ('9999-12-31 213:59:59.999', 27) + +print =============== step34 ns db +sql select ts from $tb +print $rows +if $rows != 10 then + return -1 +endi + +sql drop database $db +sql select * from information_schema.ins_databases +if $rows != 2 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/tsim/vnode/replica3_repeat.sim b/tests/script/tsim/vnode/replica3_repeat.sim index ccff06819b..8efba515ae 100644 --- a/tests/script/tsim/vnode/replica3_repeat.sim +++ b/tests/script/tsim/vnode/replica3_repeat.sim @@ -118,7 +118,7 @@ step7: sql select count(*) from db.tb -x step7 print select count(*) from db.tb ==> $data00 $lastRows -if $data00 <= $lastRows then +if $data00 < $lastRows then return -1 endi diff --git a/tests/system-test/0-others/taosdShell.py b/tests/system-test/0-others/taosdShell.py index b743783a4f..581448a6d9 100644 --- a/tests/system-test/0-others/taosdShell.py +++ b/tests/system-test/0-others/taosdShell.py @@ -2,6 +2,7 @@ import taos import sys import time +from datetime import datetime import socket import os import platform @@ -100,8 +101,11 @@ class TDTestCase: processName="taosd" taosdCmd = taosdCmdRun + startAction tdLog.printNoPrefix("%s"%taosdCmd) - os.system(f"nohup {taosdCmd} & ") + logTime=datetime.now().strftime('%Y%m%d_%H%M%S_%f') + os.system(f"nohup {taosdCmd} > {logTime}.log 2>&1 & ") self.checkAndstopPro(processName,startAction) + os.system(f"rm -rf {logTime}.log") + def taosdCommandExe(self,startAction,taosdCmdRun): taosdCmd = taosdCmdRun + startAction @@ -207,7 +211,7 @@ class TDTestCase: os.system(" mkdir -p taosdCaseTmp ") os.system("echo \'TAOS_QUERY_POLICY=3\' > taosdCaseTmp/.env ") self.taosdCommandStop(startAction,taosdCmdRun) - os.system(" rm -rf taosdCaseTmp/.env ") + os.system(" rm -rf taosdCaseTmp ") startAction = " -V" tdLog.printNoPrefix("================================ parameter: %s"%startAction) diff --git a/tests/system-test/1-insert/alter_database.py b/tests/system-test/1-insert/alter_database.py index 1918c0ef76..aec18a1cf1 100644 --- a/tests/system-test/1-insert/alter_database.py +++ b/tests/system-test/1-insert/alter_database.py @@ -10,37 +10,43 @@ from util.sql import * from util.cases import * from util.dnodes import * + class TDTestCase: def init(self, conn, logSql, replicaVar=1): self.replicaVar = int(replicaVar) tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor(),logSql) - self.buffer_boundary = [3,4097,8193,12289,16384] - self.buffer_error = [self.buffer_boundary[0]-1,self.buffer_boundary[-1]+1,12289,96] + tdSql.init(conn.cursor(), logSql) + self.buffer_boundary = [3, 4097, 8193, 12289, 16384] + self.buffer_error = [self.buffer_boundary[0] - + 1, self.buffer_boundary[-1]+1, 12289, 256] # pages_boundary >= 64 - self.pages_boundary = [64,128,512] + self.pages_boundary = [64, 128, 512] self.pages_error = [self.pages_boundary[0]-1] + def alter_buffer(self): tdSql.execute('create database db') for buffer in self.buffer_boundary: tdSql.execute(f'alter database db buffer {buffer}') - tdSql.query('select * from information_schema.ins_databases where name = "db"') - tdSql.checkEqual(tdSql.queryResult[0][8],buffer) + tdSql.query( + 'select * from information_schema.ins_databases where name = "db"') + tdSql.checkEqual(tdSql.queryResult[0][8], buffer) tdSql.execute('drop database db') tdSql.execute('create database db vgroups 10') for buffer in self.buffer_error: tdSql.error(f'alter database db buffer {buffer}') tdSql.execute('drop database db') - + def alter_pages(self): tdSql.execute('create database db') for pages in self.pages_boundary: tdSql.execute(f'alter database db pages {pages}') - tdSql.query('select * from information_schema.ins_databases where name = "db"') - tdSql.checkEqual(tdSql.queryResult[0][10],pages) + tdSql.query( + 'select * from information_schema.ins_databases where name = "db"') + tdSql.checkEqual(tdSql.queryResult[0][10], pages) tdSql.execute('drop database db') tdSql.execute('create database db') - tdSql.query('select * from information_schema.ins_databases where name = "db"') + tdSql.query( + 'select * from information_schema.ins_databases where name = "db"') self.pages_error.append(tdSql.queryResult[0][10]) for pages in self.pages_error: tdSql.error(f'alter database db pages {pages}') @@ -55,5 +61,6 @@ class TDTestCase: tdSql.close() tdLog.success(f"{__file__} successfully executed") + tdCases.addLinux(__file__, TDTestCase()) -tdCases.addWindows(__file__, TDTestCase()) \ No newline at end of file +tdCases.addWindows(__file__, TDTestCase()) diff --git a/tests/system-test/fulltest.sh b/tests/system-test/fulltest.sh deleted file mode 100755 index 4228d1e419..0000000000 --- a/tests/system-test/fulltest.sh +++ /dev/null @@ -1,656 +0,0 @@ -#!/bin/bash -set -e -set -x - -python3 ./test.py -f 0-others/taosShell.py -python3 ./test.py -f 0-others/taosShellError.py -python3 ./test.py -f 0-others/taosShellNetChk.py -python3 ./test.py -f 0-others/telemetry.py -python3 ./test.py -f 0-others/taosdMonitor.py -python3 ./test.py -f 0-others/udfTest.py -python3 ./test.py -f 0-others/udf_create.py -python3 ./test.py -f 0-others/udf_restart_taosd.py -python3 ./test.py -f 0-others/cachemodel.py -python3 ./test.py -f 0-others/udf_cfg1.py -python3 ./test.py -f 0-others/udf_cfg2.py -python3 ./test.py -f 0-others/taosdShell.py -N 5 -M 3 -Q 3 -python3 ./test.py -f 0-others/sysinfo.py -python3 ./test.py -f 0-others/user_control.py -python3 ./test.py -f 0-others/fsync.py -python3 ./test.py -f 0-others/compatibility.py -python3 ./test.py -f 1-insert/alter_database.py -python3 ./test.py -f 1-insert/influxdb_line_taosc_insert.py -python3 ./test.py -f 1-insert/opentsdb_telnet_line_taosc_insert.py -python3 ./test.py -f 1-insert/opentsdb_json_taosc_insert.py -python3 ./test.py -f 1-insert/test_stmt_muti_insert_query.py -python3 ./test.py -f 1-insert/test_stmt_set_tbname_tag.py -python3 ./test.py -f 1-insert/alter_stable.py -python3 ./test.py -f 1-insert/alter_table.py -python3 ./test.py -f 1-insert/insertWithMoreVgroup.py -python3 ./test.py -f 1-insert/table_comment.py -python3 ./test.py -f 1-insert/time_range_wise.py -python3 ./test.py -f 1-insert/block_wise.py -python3 ./test.py -f 1-insert/create_retentions.py -python3 ./test.py -f 1-insert/table_param_ttl.py -python3 ./test.py -f 1-insert/mutil_stage.py -python3 ./test.py -f 1-insert/table_param_ttl.py -R -python3 ./test.py -f 1-insert/update_data_muti_rows.py -python3 ./test.py -f 1-insert/db_tb_name_check.py -python3 ./test.py -f 1-insert/database_pre_suf.py -python3 ./test.py -f 0-others/show.py -python3 ./test.py -f 2-query/abs.py -python3 ./test.py -f 2-query/abs.py -R -python3 ./test.py -f 2-query/and_or_for_byte.py -python3 ./test.py -f 2-query/and_or_for_byte.py -R -python3 ./test.py -f 2-query/apercentile.py -python3 ./test.py -f 2-query/apercentile.py -R -python3 ./test.py -f 2-query/arccos.py -python3 ./test.py -f 2-query/arccos.py -R -python3 ./test.py -f 2-query/arcsin.py -python3 ./test.py -f 2-query/arcsin.py -R -python3 ./test.py -f 2-query/arctan.py -python3 ./test.py -f 2-query/arctan.py -R -python3 ./test.py -f 2-query/avg.py -python3 ./test.py -f 2-query/avg.py -R -python3 ./test.py -f 2-query/between.py -python3 ./test.py -f 2-query/between.py -R -python3 ./test.py -f 2-query/bottom.py -python3 ./test.py -f 2-query/bottom.py -R -python3 ./test.py -f 2-query/cast.py -python3 ./test.py -f 2-query/cast.py -R -python3 ./test.py -f 2-query/ceil.py -python3 ./test.py -f 2-query/ceil.py -R -python3 ./test.py -f 2-query/char_length.py -python3 ./test.py -f 2-query/char_length.py -R -python3 ./test.py -f 2-query/check_tsdb.py -python3 ./test.py -f 2-query/check_tsdb.py -R -python3 ./test.py -f 2-query/concat.py -python3 ./test.py -f 2-query/concat.py -R -python3 ./test.py -f 2-query/concat_ws.py -python3 ./test.py -f 2-query/concat_ws.py -R -python3 ./test.py -f 2-query/concat_ws2.py -python3 ./test.py -f 2-query/concat_ws2.py -R -python3 ./test.py -f 2-query/cos.py -python3 ./test.py -f 2-query/cos.py -R -python3 ./test.py -f 2-query/count_partition.py -python3 ./test.py -f 2-query/count_partition.py -R -python3 ./test.py -f 2-query/count.py -python3 ./test.py -f 2-query/count.py -R -# python3 ./test.py -f 2-query/countAlwaysReturnValue.py -# python3 ./test.py -f 2-query/countAlwaysReturnValue.py -R -python3 ./test.py -f 2-query/db.py -python3 ./test.py -f 2-query/db.py -R -python3 ./test.py -f 2-query/diff.py -python3 ./test.py -f 2-query/diff.py -R -python3 ./test.py -f 2-query/distinct.py -python3 ./test.py -f 2-query/distinct.py -R -python3 ./test.py -f 2-query/distribute_agg_apercentile.py -python3 ./test.py -f 2-query/distribute_agg_apercentile.py -R -python3 ./test.py -f 2-query/distribute_agg_avg.py -python3 ./test.py -f 2-query/distribute_agg_avg.py -R -python3 ./test.py -f 2-query/distribute_agg_count.py -python3 ./test.py -f 2-query/distribute_agg_count.py -R -python3 ./test.py -f 2-query/distribute_agg_max.py -python3 ./test.py -f 2-query/distribute_agg_max.py -R -python3 ./test.py -f 2-query/distribute_agg_min.py -python3 ./test.py -f 2-query/distribute_agg_min.py -R -python3 ./test.py -f 2-query/distribute_agg_spread.py -python3 ./test.py -f 2-query/distribute_agg_spread.py -R -python3 ./test.py -f 2-query/distribute_agg_stddev.py -python3 ./test.py -f 2-query/distribute_agg_stddev.py -R -python3 ./test.py -f 2-query/distribute_agg_sum.py -python3 ./test.py -f 2-query/distribute_agg_sum.py -R -python3 ./test.py -f 2-query/explain.py -python3 ./test.py -f 2-query/explain.py -R -python3 ./test.py -f 2-query/first.py -python3 ./test.py -f 2-query/first.py -R -python3 ./test.py -f 2-query/floor.py -python3 ./test.py -f 2-query/floor.py -R -python3 ./test.py -f 2-query/function_null.py -python3 ./test.py -f 2-query/function_null.py -R -python3 ./test.py -f 2-query/function_stateduration.py -python3 ./test.py -f 2-query/function_stateduration.py -R -python3 ./test.py -f 2-query/histogram.py -python3 ./test.py -f 2-query/histogram.py -R -python3 ./test.py -f 2-query/hyperloglog.py -python3 ./test.py -f 2-query/hyperloglog.py -R -python3 ./test.py -f 2-query/interp.py -python3 ./test.py -f 2-query/interp.py -R -python3 ./test.py -f 2-query/irate.py -python3 ./test.py -f 2-query/irate.py -R -python3 ./test.py -f 2-query/join.py -python3 ./test.py -f 2-query/join.py -R -python3 ./test.py -f 2-query/last_row.py -python3 ./test.py -f 2-query/last_row.py -R -python3 ./test.py -f 2-query/last.py -python3 ./test.py -f 2-query/last.py -R -python3 ./test.py -f 2-query/leastsquares.py -python3 ./test.py -f 2-query/leastsquares.py -R -python3 ./test.py -f 2-query/length.py -python3 ./test.py -f 2-query/length.py -R -python3 ./test.py -f 2-query/log.py -python3 ./test.py -f 2-query/log.py -R -python3 ./test.py -f 2-query/lower.py -python3 ./test.py -f 2-query/lower.py -R -python3 ./test.py -f 2-query/ltrim.py -python3 ./test.py -f 2-query/ltrim.py -R -python3 ./test.py -f 2-query/mavg.py -python3 ./test.py -f 2-query/mavg.py -R -python3 ./test.py -f 2-query/max_partition.py -python3 ./test.py -f 2-query/max_partition.py -R -python3 ./test.py -f 2-query/max.py -python3 ./test.py -f 2-query/max.py -R -python3 ./test.py -f 2-query/min.py -python3 ./test.py -f 2-query/min.py -R -python3 ./test.py -f 2-query/mode.py -python3 ./test.py -f 2-query/mode.py -R -python3 ./test.py -f 2-query/Now.py -python3 ./test.py -f 2-query/Now.py -R -python3 ./test.py -f 2-query/percentile.py -python3 ./test.py -f 2-query/percentile.py -R -python3 ./test.py -f 2-query/pow.py -python3 ./test.py -f 2-query/pow.py -R -python3 ./test.py -f 2-query/query_cols_tags_and_or.py -python3 ./test.py -f 2-query/query_cols_tags_and_or.py -R -python3 ./test.py -f 2-query/round.py -python3 ./test.py -f 2-query/round.py -R -python3 ./test.py -f 2-query/rtrim.py -python3 ./test.py -f 2-query/rtrim.py -R -python3 ./test.py -f 2-query/sample.py -python3 ./test.py -f 2-query/sample.py -R -python3 ./test.py -f 2-query/sin.py -python3 ./test.py -f 2-query/sin.py -R -python3 ./test.py -f 2-query/smaTest.py -python3 ./test.py -f 2-query/smaTest.py -R -python3 ./test.py -f 2-query/sml.py -python3 ./test.py -f 2-query/sml.py -R -python3 ./test.py -f 2-query/spread.py -python3 ./test.py -f 2-query/spread.py -R -python3 ./test.py -f 2-query/sqrt.py -python3 ./test.py -f 2-query/sqrt.py -R -python3 ./test.py -f 2-query/statecount.py -python3 ./test.py -f 2-query/statecount.py -R -python3 ./test.py -f 2-query/stateduration.py -python3 ./test.py -f 2-query/stateduration.py -R -python3 ./test.py -f 2-query/substr.py -python3 ./test.py -f 2-query/substr.py -R -python3 ./test.py -f 2-query/sum.py -python3 ./test.py -f 2-query/sum.py -R -python3 ./test.py -f 2-query/tail.py -python3 ./test.py -f 2-query/tail.py -R -python3 ./test.py -f 2-query/tan.py -python3 ./test.py -f 2-query/tan.py -R -python3 ./test.py -f 2-query/Timediff.py -python3 ./test.py -f 2-query/Timediff.py -R -python3 ./test.py -f 2-query/timetruncate.py -python3 ./test.py -f 2-query/timetruncate.py -R -python3 ./test.py -f 2-query/timezone.py -python3 ./test.py -f 2-query/timezone.py -R -python3 ./test.py -f 2-query/To_iso8601.py -python3 ./test.py -f 2-query/To_iso8601.py -R -python3 ./test.py -f 2-query/To_unixtimestamp.py -python3 ./test.py -f 2-query/To_unixtimestamp.py -R -python3 ./test.py -f 2-query/Today.py -python3 ./test.py -f 2-query/Today.py -R -python3 ./test.py -f 2-query/top.py -python3 ./test.py -f 2-query/top.py -R -python3 ./test.py -f 2-query/tsbsQuery.py -python3 ./test.py -f 2-query/tsbsQuery.py -R -python3 ./test.py -f 2-query/ttl_comment.py -python3 ./test.py -f 2-query/ttl_comment.py -R -python3 ./test.py -f 2-query/twa.py -python3 ./test.py -f 2-query/twa.py -R -python3 ./test.py -f 2-query/union.py -python3 ./test.py -f 2-query/union.py -R -python3 ./test.py -f 2-query/unique.py -python3 ./test.py -f 2-query/unique.py -R -python3 ./test.py -f 2-query/upper.py -python3 ./test.py -f 2-query/upper.py -R -python3 ./test.py -f 2-query/varchar.py -python3 ./test.py -f 2-query/varchar.py -R - - -python3 ./test.py -f 1-insert/update_data.py -python3 ./test.py -f 1-insert/tb_100w_data_order.py - -# TD-20200 python3 ./test.py -f 1-insert/delete_data.py -python3 ./test.py -f 1-insert/delete_stable.py -python3 ./test.py -f 1-insert/delete_childtable.py -python3 ./test.py -f 1-insert/delete_normaltable.py -python3 ./test.py -f 1-insert/keep_expired.py - -python3 ./test.py -f 2-query/join2.py -python3 ./test.py -f 2-query/union1.py -python3 ./test.py -f 2-query/concat2.py - - -python3 ./test.py -f 2-query/json_tag.py - -python3 ./test.py -f 2-query/nestedQuery.py -python3 ./test.py -f 2-query/nestedQuery_str.py -python3 ./test.py -f 2-query/nestedQuery_math.py -python3 ./test.py -f 2-query/nestedQuery_time.py -python3 ./test.py -f 2-query/stablity.py -python3 ./test.py -f 2-query/stablity_1.py - -python3 ./test.py -f 2-query/elapsed.py -python3 ./test.py -f 2-query/csum.py -python3 ./test.py -f 2-query/function_diff.py -python3 ./test.py -f 2-query/queryQnode.py - -python3 ./test.py -f 6-cluster/5dnode1mnode.py -python3 ./test.py -f 6-cluster/5dnode2mnode.py -N 5 -python3 ./test.py -f 6-cluster/5dnode3mnodeStop.py -N 5 -M 3 -python3 ./test.py -f 6-cluster/5dnode3mnodeStop.py -N 5 -M 3 -i False -python3 ./test.py -f 6-cluster/5dnode3mnodeStop2Follower.py -N 5 -M 3 -python3 ./test.py -f 6-cluster/5dnode3mnodeStop2Follower.py -N 5 -M 3 -i False -python3 ./test.py -f 6-cluster/5dnode3mnodeStopLoop.py -N 5 -M 3 -python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopDnodeCreateDb.py -N 6 -M 3 -python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopDnodeCreateDb.py -N 6 -M 3 -n 3 -python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateDb.py -N 6 -M 3 -python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateDb.py -N 6 -M 3 -n 3 -python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateDb.py -N 6 -M 3 -python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateDb.py -N 6 -M 3 -n 3 - -python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopDnodeCreateStb.py -N 6 -M 3 -python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopDnodeCreateStb.py -N 6 -M 3 -n 3 -python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateStb.py -N 6 -M 3 -python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateStb.py -N 6 -M 3 -n 3 -python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateStb.py -N 6 -M 3 -python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateStb.py -N 6 -M 3 -n 3 - -python3 ./test.py -f 6-cluster/5dnode3mnodeRestartDnodeInsertData.py -N 6 -M 3 -python3 ./test.py -f 6-cluster/5dnode3mnodeRestartDnodeInsertData.py -N 6 -M 3 -n 3 -python3 ./test.py -f 6-cluster/5dnode3mnodeRestartDnodeInsertDataAsync.py -N 6 -M 3 -python3 ./test.py -f 6-cluster/5dnode3mnodeRestartDnodeInsertDataAsync.py -N 6 -M 3 -n 3 - - -python3 ./test.py -f 6-cluster/5dnode3mnodeAdd1Ddnoe.py -N 7 -M 3 -C 6 -python3 ./test.py -f 6-cluster/5dnode3mnodeAdd1Ddnoe.py -N 7 -M 3 -C 6 -n 3 - -# BUG python3 ./test.py -f 6-cluster/5dnode3mnodeStopInsert.py -python3 ./test.py -f 6-cluster/5dnode3mnodeDrop.py -N 5 -# TD-19646 python3 test.py -f 6-cluster/5dnode3mnodeStopConnect.py -N 5 -M 3 - -python3 ./test.py -f 6-cluster/5dnode3mnodeRecreateMnode.py -N 5 -M 3 -python3 ./test.py -f 6-cluster/5dnode3mnodeStopFollowerLeader.py -N 5 -M 3 -python3 ./test.py -f 6-cluster/5dnode3mnodeStop2Follower.py -N 5 -M 3 - -# vnode case -python3 test.py -f 6-cluster/vnode/4dnode1mnode_basic_createDb_replica1.py -N 4 -M 1 -python3 test.py -f 6-cluster/vnode/4dnode1mnode_basic_replica1_insertdatas.py -N 4 -M 1 -python3 test.py -f 6-cluster/vnode/4dnode1mnode_basic_replica1_insertdatas_querys.py -N 4 -M 1 -# python3 test.py -f 6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas_force_stop_all_dnodes.py -N 4 -M 1 -python3 test.py -f 6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas.py -N 4 -M 1 -# python3 test.py -f 6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas_querys_loop_restart_all_vnode.py -N 4 -M 1 -# python3 test.py -f 6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas_querys_loop_restart_follower.py -N 4 -M 1 -# python3 test.py -f 6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas_querys_loop_restart_leader.py -N 4 -M 1 -python3 test.py -f 6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas_querys.py -N 4 -M 1 -# python3 test.py -f 6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas_stop_all_dnodes.py -N 4 -M 1 -# python3 test.py -f 6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas_stop_follower_sync.py -N 4 -M 1 -# python3 test.py -f 6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas_stop_follower_unsync_force_stop.py -N 4 -M 1 -# python3 test.py -f 6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas_stop_follower_unsync.py -N 4 -M 1 -# python3 test.py -f 6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas_stop_leader_forece_stop.py -N 4 -M 1 -# python3 test.py -f 6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas_stop_leader.py -N 4 -M 1 -# python3 test.py -f 6-cluster/vnode/4dnode1mnode_basic_replica3_mnode3_insertdatas_querys.py -N 4 -M 1 -# python3 test.py -f 6-cluster/vnode/4dnode1mnode_basic_replica3_querydatas_stop_follower_force_stop.py -N 4 -M 1 -# python3 test.py -f 6-cluster/vnode/4dnode1mnode_basic_replica3_querydatas_stop_follower.py -N 4 -M 1 -# python3 test.py -f 6-cluster/vnode/4dnode1mnode_basic_replica3_querydatas_stop_leader_force_stop.py -N 4 -M 1 -# python3 test.py -f 6-cluster/vnode/4dnode1mnode_basic_replica3_querydatas_stop_leader.py -N 4 -M 1 -python3 test.py -f 6-cluster/vnode/4dnode1mnode_basic_replica3_vgroups.py -N 4 -M 1 -# python3 test.py -f 6-cluster/vnode/4dnode1mnode_basic_replica3_vgroups_stopOne.py -N 4 -M 1 - -python3 ./test.py -f 7-tmq/create_wrong_topic.py -python3 ./test.py -f 7-tmq/dropDbR3ConflictTransaction.py -N 3 -python3 ./test.py -f 7-tmq/basic5.py -python3 ./test.py -f 7-tmq/subscribeDb.py -python3 ./test.py -f 7-tmq/subscribeDb0.py -python3 ./test.py -f 7-tmq/subscribeDb1.py -python3 ./test.py -f 7-tmq/subscribeDb2.py -python3 ./test.py -f 7-tmq/subscribeDb3.py -python3 ./test.py -f 7-tmq/subscribeDb4.py -python3 ./test.py -f 7-tmq/subscribeStb.py -python3 ./test.py -f 7-tmq/subscribeStb0.py -python3 ./test.py -f 7-tmq/subscribeStb1.py -python3 ./test.py -f 7-tmq/subscribeStb2.py -python3 ./test.py -f 7-tmq/subscribeStb3.py -python3 ./test.py -f 7-tmq/subscribeStb4.py -python3 ./test.py -f 7-tmq/db.py -python3 ./test.py -f 7-tmq/tmqError.py -python3 ./test.py -f 7-tmq/schema.py -python3 ./test.py -f 7-tmq/stbFilter.py -python3 ./test.py -f 7-tmq/tmqCheckData.py -python3 ./test.py -f 7-tmq/tmqCheckData1.py -#python3 ./test.py -f 7-tmq/tmq3mnodeSwitch.py -N 5 -python3 ./test.py -f 7-tmq/tmqConsumerGroup.py -python3 ./test.py -f 7-tmq/tmqShow.py -python3 ./test.py -f 7-tmq/tmqAlterSchema.py -python3 ./test.py -f 7-tmq/tmqConsFromTsdb.py -python3 ./test.py -f 7-tmq/tmqConsFromTsdb1.py -python3 ./test.py -f 7-tmq/tmqConsFromTsdb-mutilVg.py -python3 ./test.py -f 7-tmq/tmqConsFromTsdb1-mutilVg.py -python3 ./test.py -f 7-tmq/tmqConsFromTsdb-1ctb.py -python3 ./test.py -f 7-tmq/tmqConsFromTsdb1-1ctb.py -python3 ./test.py -f 7-tmq/tmqConsFromTsdb-1ctb-funcNFilter.py -python3 ./test.py -f 7-tmq/tmqConsFromTsdb-mutilVg-mutilCtb-funcNFilter.py -python3 ./test.py -f 7-tmq/tmqConsFromTsdb-mutilVg-mutilCtb.py -python3 ./test.py -f 7-tmq/tmqConsFromTsdb1-1ctb-funcNFilter.py -python3 ./test.py -f 7-tmq/tmqConsFromTsdb1-mutilVg-mutilCtb-funcNFilter.py -python3 ./test.py -f 7-tmq/tmqConsFromTsdb1-mutilVg-mutilCtb.py -python3 ./test.py -f 7-tmq/tmqAutoCreateTbl.py -python3 ./test.py -f 7-tmq/tmqDnodeRestart.py -python3 ./test.py -f 7-tmq/tmqUpdate-1ctb.py -python3 ./test.py -f 7-tmq/tmqUpdateWithConsume.py -python3 ./test.py -f 7-tmq/tmqUpdate-multiCtb-snapshot0.py -python3 ./test.py -f 7-tmq/tmqUpdate-multiCtb-snapshot1.py -python3 ./test.py -f 7-tmq/tmqDelete-1ctb.py -python3 ./test.py -f 7-tmq/tmqDelete-multiCtb.py -python3 ./test.py -f 7-tmq/tmqDropStb.py -python3 ./test.py -f 7-tmq/tmqDropStbCtb.py -python3 ./test.py -f 7-tmq/tmqDropNtb-snapshot0.py -python3 ./test.py -f 7-tmq/tmqDropNtb-snapshot1.py -python3 ./test.py -f 7-tmq/tmqUdf.py -python3 ./test.py -f 7-tmq/tmqUdf-multCtb-snapshot0.py -python3 ./test.py -f 7-tmq/tmqUdf-multCtb-snapshot1.py -python3 ./test.py -f 7-tmq/stbTagFilter-1ctb.py -python3 ./test.py -f 7-tmq/dataFromTsdbNWal.py -python3 ./test.py -f 7-tmq/dataFromTsdbNWal-multiCtb.py -python3 ./test.py -f 7-tmq/tmq_taosx.py -python3 ./test.py -f 7-tmq/stbTagFilter-multiCtb.py - -python3 ./test.py -f 99-TDcase/TD-19201.py - -#------------querPolicy 2----------- - -python3 ./test.py -f 2-query/between.py -Q 2 -python3 ./test.py -f 2-query/distinct.py -Q 2 -python3 ./test.py -f 2-query/varchar.py -Q 2 -python3 ./test.py -f 2-query/ltrim.py -Q 2 -python3 ./test.py -f 2-query/rtrim.py -Q 2 -python3 ./test.py -f 2-query/length.py -Q 2 -python3 ./test.py -f 2-query/char_length.py -Q 2 -python3 ./test.py -f 2-query/upper.py -Q 2 -python3 ./test.py -f 2-query/lower.py -Q 2 -python3 ./test.py -f 2-query/join.py -Q 2 -python3 ./test.py -f 2-query/join2.py -Q 2 -python3 ./test.py -f 2-query/cast.py -Q 2 -python3 ./test.py -f 2-query/substr.py -Q 2 -python3 ./test.py -f 2-query/union.py -Q 2 -python3 ./test.py -f 2-query/union1.py -Q 2 -python3 ./test.py -f 2-query/concat.py -Q 2 -python3 ./test.py -f 2-query/concat2.py -Q 2 -python3 ./test.py -f 2-query/concat_ws.py -Q 2 -python3 ./test.py -f 2-query/concat_ws2.py -Q 2 -python3 ./test.py -f 2-query/check_tsdb.py -Q 2 -python3 ./test.py -f 2-query/spread.py -Q 2 -python3 ./test.py -f 2-query/hyperloglog.py -Q 2 -python3 ./test.py -f 2-query/explain.py -Q 2 -python3 ./test.py -f 2-query/leastsquares.py -Q 2 -python3 ./test.py -f 2-query/timezone.py -Q 2 -python3 ./test.py -f 2-query/Now.py -Q 2 -python3 ./test.py -f 2-query/Today.py -Q 2 -python3 ./test.py -f 2-query/max.py -Q 2 -python3 ./test.py -f 2-query/min.py -Q 2 -python3 ./test.py -f 2-query/mode.py -Q 2 -python3 ./test.py -f 2-query/count.py -Q 2 -# python3 ./test.py -f 2-query/countAlwaysReturnValue.py -Q 2 -python3 ./test.py -f 2-query/last.py -Q 2 -python3 ./test.py -f 2-query/first.py -Q 2 -python3 ./test.py -f 2-query/To_iso8601.py -Q 2 -python3 ./test.py -f 2-query/To_unixtimestamp.py -Q 2 -python3 ./test.py -f 2-query/timetruncate.py -Q 2 -python3 ./test.py -f 2-query/diff.py -Q 2 -python3 ./test.py -f 2-query/Timediff.py -Q 2 -python3 ./test.py -f 2-query/json_tag.py -Q 2 -python3 ./test.py -f 2-query/top.py -Q 2 -python3 ./test.py -f 2-query/bottom.py -Q 2 -python3 ./test.py -f 2-query/percentile.py -Q 2 -python3 ./test.py -f 2-query/apercentile.py -Q 2 -python3 ./test.py -f 2-query/abs.py -Q 2 -python3 ./test.py -f 2-query/ceil.py -Q 2 -python3 ./test.py -f 2-query/floor.py -Q 2 -python3 ./test.py -f 2-query/round.py -Q 2 -python3 ./test.py -f 2-query/log.py -Q 2 -python3 ./test.py -f 2-query/pow.py -Q 2 -python3 ./test.py -f 2-query/sqrt.py -Q 2 -python3 ./test.py -f 2-query/sin.py -Q 2 -python3 ./test.py -f 2-query/cos.py -Q 2 -python3 ./test.py -f 2-query/tan.py -Q 2 -python3 ./test.py -f 2-query/arcsin.py -Q 2 -python3 ./test.py -f 2-query/arccos.py -Q 2 -python3 ./test.py -f 2-query/arctan.py -Q 2 -python3 ./test.py -f 2-query/query_cols_tags_and_or.py -Q 2 -python3 ./test.py -f 2-query/interp.py -Q 2 - -python3 ./test.py -f 2-query/nestedQuery.py -Q 2 -python3 ./test.py -f 2-query/nestedQuery_str.py -Q 2 -python3 ./test.py -f 2-query/nestedQuery_math.py -Q 2 -python3 ./test.py -f 2-query/nestedQuery_time.py -Q 2 -python3 ./test.py -f 2-query/stablity.py -Q 2 -python3 ./test.py -f 2-query/stablity_1.py -Q 2 - -python3 ./test.py -f 2-query/avg.py -Q 2 -python3 ./test.py -f 2-query/elapsed.py -Q 2 -python3 ./test.py -f 2-query/csum.py -Q 2 -python3 ./test.py -f 2-query/mavg.py -Q 2 -python3 ./test.py -f 2-query/sample.py -Q 2 -python3 ./test.py -f 2-query/function_diff.py -Q 2 -python3 ./test.py -f 2-query/unique.py -Q 2 -python3 ./test.py -f 2-query/stateduration.py -Q 2 -python3 ./test.py -f 2-query/function_stateduration.py -Q 2 -python3 ./test.py -f 2-query/statecount.py -Q 2 -python3 ./test.py -f 2-query/tail.py -Q 2 -python3 ./test.py -f 2-query/ttl_comment.py -Q 2 -python3 ./test.py -f 2-query/distribute_agg_count.py -Q 2 -python3 ./test.py -f 2-query/distribute_agg_max.py -Q 2 -python3 ./test.py -f 2-query/distribute_agg_min.py -Q 2 -python3 ./test.py -f 2-query/distribute_agg_sum.py -Q 2 -python3 ./test.py -f 2-query/distribute_agg_spread.py -Q 2 -python3 ./test.py -f 2-query/distribute_agg_apercentile.py -Q 2 -python3 ./test.py -f 2-query/distribute_agg_avg.py -Q 2 -python3 ./test.py -f 2-query/distribute_agg_stddev.py -Q 2 -python3 ./test.py -f 2-query/twa.py -Q 2 -python3 ./test.py -f 2-query/irate.py -Q 2 -python3 ./test.py -f 2-query/function_null.py -Q 2 -python3 ./test.py -f 2-query/count_partition.py -Q 2 -python3 ./test.py -f 2-query/max_partition.py -Q 2 -python3 ./test.py -f 2-query/last_row.py -Q 2 -python3 ./test.py -f 2-query/tsbsQuery.py -Q 2 -python3 ./test.py -f 2-query/sml.py -Q 2 - -#------------querPolicy 3----------- -python3 ./test.py -f 2-query/between.py -Q 3 -python3 ./test.py -f 2-query/distinct.py -Q 3 -python3 ./test.py -f 2-query/varchar.py -Q 3 -python3 ./test.py -f 2-query/ltrim.py -Q 3 -python3 ./test.py -f 2-query/rtrim.py -Q 3 -python3 ./test.py -f 2-query/length.py -Q 3 -python3 ./test.py -f 2-query/char_length.py -Q 3 -python3 ./test.py -f 2-query/upper.py -Q 3 -python3 ./test.py -f 2-query/lower.py -Q 3 -python3 ./test.py -f 2-query/join.py -Q 3 -python3 ./test.py -f 2-query/join2.py -Q 3 -python3 ./test.py -f 2-query/cast.py -Q 3 -python3 ./test.py -f 2-query/substr.py -Q 3 -python3 ./test.py -f 2-query/union.py -Q 3 -python3 ./test.py -f 2-query/union1.py -Q 3 -python3 ./test.py -f 2-query/concat.py -Q 3 -python3 ./test.py -f 2-query/concat2.py -Q 3 -python3 ./test.py -f 2-query/concat_ws.py -Q 3 -python3 ./test.py -f 2-query/concat_ws2.py -Q 3 -python3 ./test.py -f 2-query/check_tsdb.py -Q 3 -python3 ./test.py -f 2-query/spread.py -Q 3 -python3 ./test.py -f 2-query/hyperloglog.py -Q 3 -python3 ./test.py -f 2-query/explain.py -Q 3 -python3 ./test.py -f 2-query/leastsquares.py -Q 3 -python3 ./test.py -f 2-query/timezone.py -Q 3 -python3 ./test.py -f 2-query/Now.py -Q 3 -python3 ./test.py -f 2-query/Today.py -Q 3 -python3 ./test.py -f 2-query/max.py -Q 3 -python3 ./test.py -f 2-query/min.py -Q 3 -python3 ./test.py -f 2-query/mode.py -Q 3 -python3 ./test.py -f 2-query/count.py -Q 3 -# python3 ./test.py -f 2-query/countAlwaysReturnValue.py -Q 3 -python3 ./test.py -f 2-query/last.py -Q 3 -python3 ./test.py -f 2-query/first.py -Q 3 -python3 ./test.py -f 2-query/To_iso8601.py -Q 3 -python3 ./test.py -f 2-query/To_unixtimestamp.py -Q 3 -python3 ./test.py -f 2-query/timetruncate.py -Q 3 -python3 ./test.py -f 2-query/diff.py -Q 3 -python3 ./test.py -f 2-query/Timediff.py -Q 3 -python3 ./test.py -f 2-query/json_tag.py -Q 3 -python3 ./test.py -f 2-query/top.py -Q 3 -python3 ./test.py -f 2-query/bottom.py -Q 3 -python3 ./test.py -f 2-query/percentile.py -Q 3 -python3 ./test.py -f 2-query/apercentile.py -Q 3 -python3 ./test.py -f 2-query/abs.py -Q 3 -python3 ./test.py -f 2-query/ceil.py -Q 3 -python3 ./test.py -f 2-query/floor.py -Q 3 -python3 ./test.py -f 2-query/round.py -Q 3 -python3 ./test.py -f 2-query/log.py -Q 3 -python3 ./test.py -f 2-query/pow.py -Q 3 -python3 ./test.py -f 2-query/sqrt.py -Q 3 -python3 ./test.py -f 2-query/sin.py -Q 3 -python3 ./test.py -f 2-query/cos.py -Q 3 -python3 ./test.py -f 2-query/tan.py -Q 3 -python3 ./test.py -f 2-query/arcsin.py -Q 3 -python3 ./test.py -f 2-query/arccos.py -Q 3 -python3 ./test.py -f 2-query/arctan.py -Q 3 -python3 ./test.py -f 2-query/query_cols_tags_and_or.py -Q 3 - -python3 ./test.py -f 2-query/nestedQuery.py -Q 3 -python3 ./test.py -f 2-query/nestedQuery_str.py -Q 3 -python3 ./test.py -f 2-query/nestedQuery_math.py -Q 3 -python3 ./test.py -f 2-query/nestedQuery_time.py -Q 3 -python3 ./test.py -f 2-query/stablity.py -Q 3 -python3 ./test.py -f 2-query/stablity_1.py -Q 3 - -python3 ./test.py -f 2-query/avg.py -Q 3 -python3 ./test.py -f 2-query/elapsed.py -Q 3 -python3 ./test.py -f 2-query/csum.py -Q 3 -python3 ./test.py -f 2-query/mavg.py -Q 3 -python3 ./test.py -f 2-query/sample.py -Q 3 -python3 ./test.py -f 2-query/function_diff.py -Q 3 -python3 ./test.py -f 2-query/unique.py -Q 3 -python3 ./test.py -f 2-query/stateduration.py -Q 3 -python3 ./test.py -f 2-query/function_stateduration.py -Q 3 -python3 ./test.py -f 2-query/statecount.py -Q 3 -python3 ./test.py -f 2-query/tail.py -Q 3 -python3 ./test.py -f 2-query/ttl_comment.py -Q 3 -python3 ./test.py -f 2-query/distribute_agg_count.py -Q 3 -python3 ./test.py -f 2-query/distribute_agg_max.py -Q 3 -python3 ./test.py -f 2-query/distribute_agg_min.py -Q 3 -python3 ./test.py -f 2-query/distribute_agg_sum.py -Q 3 -python3 ./test.py -f 2-query/distribute_agg_spread.py -Q 3 -python3 ./test.py -f 2-query/distribute_agg_apercentile.py -Q 3 -python3 ./test.py -f 2-query/distribute_agg_avg.py -Q 3 -python3 ./test.py -f 2-query/distribute_agg_stddev.py -Q 3 -python3 ./test.py -f 2-query/twa.py -Q 3 -python3 ./test.py -f 2-query/irate.py -Q 3 -python3 ./test.py -f 2-query/function_null.py -Q 3 -python3 ./test.py -f 2-query/count_partition.py -Q 3 -python3 ./test.py -f 2-query/max_partition.py -Q 3 -python3 ./test.py -f 2-query/last_row.py -Q 3 -python3 ./test.py -f 2-query/tsbsQuery.py -Q 3 -python3 ./test.py -f 2-query/sml.py -Q 3 -python3 ./test.py -f 2-query/interp.py -Q 3 - - -#------------querPolicy 4----------- - -python3 ./test.py -f 2-query/between.py -Q 4 -python3 ./test.py -f 2-query/distinct.py -Q 4 -python3 ./test.py -f 2-query/varchar.py -Q 4 -python3 ./test.py -f 2-query/ltrim.py -Q 4 -python3 ./test.py -f 2-query/rtrim.py -Q 4 -python3 ./test.py -f 2-query/length.py -Q 4 -python3 ./test.py -f 2-query/char_length.py -Q 4 -python3 ./test.py -f 2-query/upper.py -Q 4 -python3 ./test.py -f 2-query/lower.py -Q 4 -python3 ./test.py -f 2-query/join.py -Q 4 -python3 ./test.py -f 2-query/join2.py -Q 4 -#python3 ./test.py -f 2-query/cast.py -Q 4 -python3 ./test.py -f 2-query/substr.py -Q 4 -python3 ./test.py -f 2-query/union.py -Q 4 -python3 ./test.py -f 2-query/union1.py -Q 4 -python3 ./test.py -f 2-query/concat.py -Q 4 -python3 ./test.py -f 2-query/concat2.py -Q 4 -python3 ./test.py -f 2-query/concat_ws.py -Q 4 -python3 ./test.py -f 2-query/concat_ws2.py -Q 4 -python3 ./test.py -f 2-query/check_tsdb.py -Q 4 -python3 ./test.py -f 2-query/spread.py -Q 4 -python3 ./test.py -f 2-query/hyperloglog.py -Q 4 -python3 ./test.py -f 2-query/explain.py -Q 4 -python3 ./test.py -f 2-query/leastsquares.py -Q 4 -python3 ./test.py -f 2-query/timezone.py -Q 4 -python3 ./test.py -f 2-query/Now.py -Q 4 -python3 ./test.py -f 2-query/Today.py -Q 4 -python3 ./test.py -f 2-query/max.py -Q 4 -python3 ./test.py -f 2-query/min.py -Q 4 -python3 ./test.py -f 2-query/mode.py -Q 4 -python3 ./test.py -f 2-query/count.py -Q 4 -# python3 ./test.py -f 2-query/countAlwaysReturnValue.py -Q 4 -python3 ./test.py -f 2-query/last.py -Q 4 -python3 ./test.py -f 2-query/first.py -Q 4 -python3 ./test.py -f 2-query/To_iso8601.py -Q 4 -python3 ./test.py -f 2-query/To_unixtimestamp.py -Q 4 -python3 ./test.py -f 2-query/timetruncate.py -Q 4 -python3 ./test.py -f 2-query/diff.py -Q 4 -python3 ./test.py -f 2-query/Timediff.py -Q 4 -python3 ./test.py -f 2-query/json_tag.py -Q 4 -python3 ./test.py -f 2-query/top.py -Q 4 -python3 ./test.py -f 2-query/bottom.py -Q 4 -python3 ./test.py -f 2-query/percentile.py -Q 4 -python3 ./test.py -f 2-query/apercentile.py -Q 4 -python3 ./test.py -f 2-query/abs.py -Q 4 -python3 ./test.py -f 2-query/ceil.py -Q 4 -python3 ./test.py -f 2-query/floor.py -Q 4 -python3 ./test.py -f 2-query/round.py -Q 4 -python3 ./test.py -f 2-query/log.py -Q 4 -python3 ./test.py -f 2-query/pow.py -Q 4 -python3 ./test.py -f 2-query/sqrt.py -Q 4 -python3 ./test.py -f 2-query/sin.py -Q 4 -python3 ./test.py -f 2-query/cos.py -Q 4 -python3 ./test.py -f 2-query/tan.py -Q 4 -python3 ./test.py -f 2-query/arcsin.py -Q 4 -python3 ./test.py -f 2-query/arccos.py -Q 4 -python3 ./test.py -f 2-query/arctan.py -Q 4 -python3 ./test.py -f 2-query/query_cols_tags_and_or.py -Q 4 - -python3 ./test.py -f 2-query/nestedQuery.py -Q 4 -python3 ./test.py -f 2-query/nestedQuery_str.py -Q 4 -python3 ./test.py -f 2-query/nestedQuery_math.py -Q 4 -python3 ./test.py -f 2-query/nestedQuery_time.py -Q 4 -python3 ./test.py -f 2-query/stablity.py -Q 4 -python3 ./test.py -f 2-query/stablity_1.py -Q 4 - - -python3 ./test.py -f 2-query/avg.py -Q 4 -python3 ./test.py -f 2-query/elapsed.py -Q 4 -python3 ./test.py -f 2-query/csum.py -Q 4 -python3 ./test.py -f 2-query/mavg.py -Q 4 -python3 ./test.py -f 2-query/sample.py -Q 4 -python3 ./test.py -f 2-query/function_diff.py -Q 4 -python3 ./test.py -f 2-query/unique.py -Q 4 -python3 ./test.py -f 2-query/stateduration.py -Q 4 -python3 ./test.py -f 2-query/function_stateduration.py -Q 4 -python3 ./test.py -f 2-query/statecount.py -Q 4 -python3 ./test.py -f 2-query/tail.py -Q 4 -python3 ./test.py -f 2-query/ttl_comment.py -Q 4 -python3 ./test.py -f 2-query/distribute_agg_count.py -Q 4 -python3 ./test.py -f 2-query/distribute_agg_max.py -Q 4 -python3 ./test.py -f 2-query/distribute_agg_min.py -Q 4 -python3 ./test.py -f 2-query/distribute_agg_sum.py -Q 4 -python3 ./test.py -f 2-query/distribute_agg_spread.py -Q 4 -python3 ./test.py -f 2-query/distribute_agg_apercentile.py -Q 4 -python3 ./test.py -f 2-query/distribute_agg_avg.py -Q 4 -python3 ./test.py -f 2-query/distribute_agg_stddev.py -Q 4 -python3 ./test.py -f 2-query/twa.py -Q 4 -python3 ./test.py -f 2-query/irate.py -Q 4 -python3 ./test.py -f 2-query/function_null.py -Q 4 -python3 ./test.py -f 2-query/count_partition.py -Q 4 -python3 ./test.py -f 2-query/max_partition.py -Q 4 -python3 ./test.py -f 2-query/last_row.py -Q 4 -python3 ./test.py -f 2-query/tsbsQuery.py -Q 4 -python3 ./test.py -f 2-query/sml.py -Q 4 -python3 ./test.py -f 2-query/interp.py -Q 4