From 02dbf353547896a8120bd8f5d685b370fd97f618 Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Tue, 20 Dec 2022 16:57:16 +0800 Subject: [PATCH 01/63] fix(query): return TSDB_CODE_RPC_VGROUP_NOT_CONNECTED if all nodes in vgroups is offline --- include/util/taoserror.h | 1 + source/libs/transport/src/transCli.c | 9 +++++++++ source/util/src/terror.c | 1 + 3 files changed, 11 insertions(+) diff --git a/include/util/taoserror.h b/include/util/taoserror.h index 52221bdd44..f1f35a67a4 100644 --- a/include/util/taoserror.h +++ b/include/util/taoserror.h @@ -65,6 +65,7 @@ int32_t* taosGetErrno(); #define TSDB_CODE_RPC_PORT_EADDRINUSE TAOS_DEF_ERROR_CODE(0, 0x0017) // #define TSDB_CODE_RPC_BROKEN_LINK TAOS_DEF_ERROR_CODE(0, 0x0018) // #define TSDB_CODE_RPC_TIMEOUT TAOS_DEF_ERROR_CODE(0, 0x0019) // +#define TSDB_CODE_RPC_VGROUP_NOT_CONNECTED TAOS_DEF_ERROR_CODE(0, 0x0020) // "Vgroup could not be connected" //common & util #define TSDB_CODE_OPS_NOT_SUPPORT TAOS_DEF_ERROR_CODE(0, 0x0100) // diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c index d144a76eb0..04783605f1 100644 --- a/source/libs/transport/src/transCli.c +++ b/source/libs/transport/src/transCli.c @@ -1670,6 +1670,15 @@ int cliAppCb(SCliConn* pConn, STransMsg* pResp, SCliMsg* pMsg) { } } + // check whole vnodes is offline on this vgroup + if (pResp->code == TSDB_CODE_RPC_NETWORK_UNAVAIL || pResp->code == TSDB_CODE_RPC_BROKEN_LINK) { + if (pCtx->epsetRetryCnt >= pCtx->epSet.numOfEps || pCtx->retryStep > 0) { + if (pMsg->msg.msgType == TDMT_VND_SUBMIT || pMsg->msg.msgType == TDMT_SCH_QUERY) { + pResp->code = TSDB_CODE_RPC_VGROUP_NOT_CONNECTED; + } + } + } + STraceId* trace = &pResp->info.traceId; bool hasEpSet = cliTryExtractEpSet(pResp, &pCtx->epSet); if (hasEpSet) { diff --git a/source/util/src/terror.c b/source/util/src/terror.c index 4b9dde5059..1871697ddc 100644 --- a/source/util/src/terror.c +++ b/source/util/src/terror.c @@ -51,6 +51,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_RPC_FQDN_ERROR, "Unable to resolve FQD TAOS_DEFINE_ERROR(TSDB_CODE_RPC_PORT_EADDRINUSE, "Port already in use") TAOS_DEFINE_ERROR(TSDB_CODE_RPC_BROKEN_LINK, "Conn is broken") TAOS_DEFINE_ERROR(TSDB_CODE_RPC_TIMEOUT, "Conn read timeout") +TAOS_DEFINE_ERROR(TSDB_CODE_RPC_VGROUP_NOT_CONNECTED, "Vgroup could not be connected") //common & util TAOS_DEFINE_ERROR(TSDB_CODE_TIME_UNSYNCED, "Client and server's time is not synchronized") From 7d9e5924fa1203ca570fcfa7e7c77fa791c6133c Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Tue, 20 Dec 2022 18:06:04 +0800 Subject: [PATCH 02/63] fix(query): remove check msgType --- source/libs/transport/src/transCli.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c index 04783605f1..62355b710b 100644 --- a/source/libs/transport/src/transCli.c +++ b/source/libs/transport/src/transCli.c @@ -1673,9 +1673,7 @@ int cliAppCb(SCliConn* pConn, STransMsg* pResp, SCliMsg* pMsg) { // check whole vnodes is offline on this vgroup if (pResp->code == TSDB_CODE_RPC_NETWORK_UNAVAIL || pResp->code == TSDB_CODE_RPC_BROKEN_LINK) { if (pCtx->epsetRetryCnt >= pCtx->epSet.numOfEps || pCtx->retryStep > 0) { - if (pMsg->msg.msgType == TDMT_VND_SUBMIT || pMsg->msg.msgType == TDMT_SCH_QUERY) { pResp->code = TSDB_CODE_RPC_VGROUP_NOT_CONNECTED; - } } } From df6102f66e588c5d60748aedcb037a58fdfaa078 Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Tue, 20 Dec 2022 18:14:24 +0800 Subject: [PATCH 03/63] fix(query): TSDB_CODE_RPC_VGROUP_NOT_CONNECTED same condition check with TSDB_CODE_RPC_NETWORK_UNAVAIL --- include/libs/qcom/query.h | 2 +- source/dnode/mgmt/node_mgmt/src/dmTransport.c | 1 + source/dnode/mnode/impl/src/mndTrans.c | 2 +- source/libs/function/src/udfd.c | 1 + source/libs/scheduler/inc/schInt.h | 2 +- source/libs/transport/src/transCli.c | 2 +- 6 files changed, 6 insertions(+), 4 deletions(-) diff --git a/include/libs/qcom/query.h b/include/libs/qcom/query.h index 3f11d2a218..efc86d302d 100644 --- a/include/libs/qcom/query.h +++ b/include/libs/qcom/query.h @@ -268,7 +268,7 @@ extern int32_t (*queryProcessMsgRsp[TDMT_MAX])(void* output, char* msg, int32_t ((_code) == TSDB_CODE_SYN_NOT_LEADER || (_code) == TSDB_CODE_SYN_RESTORING || (_code) == TSDB_CODE_SYN_INTERNAL_ERROR) #define SYNC_OTHER_LEADER_REDIRECT_ERROR(_code) ((_code) == TSDB_CODE_MNODE_NOT_FOUND) -#define NO_RET_REDIRECT_ERROR(_code) ((_code) == TSDB_CODE_RPC_BROKEN_LINK || (_code) == TSDB_CODE_RPC_NETWORK_UNAVAIL) +#define NO_RET_REDIRECT_ERROR(_code) ((_code) == TSDB_CODE_RPC_BROKEN_LINK || (_code) == TSDB_CODE_RPC_NETWORK_UNAVAIL || (code) == TSDB_CODE_RPC_VGROUP_NOT_CONNECTED) #define NEED_REDIRECT_ERROR(_code) \ (NO_RET_REDIRECT_ERROR(_code) || SYNC_UNKNOWN_LEADER_REDIRECT_ERROR(_code) || \ diff --git a/source/dnode/mgmt/node_mgmt/src/dmTransport.c b/source/dnode/mgmt/node_mgmt/src/dmTransport.c index 5e1dcc6353..fe676c769c 100644 --- a/source/dnode/mgmt/node_mgmt/src/dmTransport.c +++ b/source/dnode/mgmt/node_mgmt/src/dmTransport.c @@ -233,6 +233,7 @@ static inline void dmReleaseHandle(SRpcHandleInfo *pHandle, int8_t type) { rpcRe static bool rpcRfp(int32_t code, tmsg_t msgType) { if (code == TSDB_CODE_RPC_NETWORK_UNAVAIL || code == TSDB_CODE_RPC_BROKEN_LINK || code == TSDB_CODE_MNODE_NOT_FOUND || + code == TSDB_CODE_RPC_VGROUP_NOT_CONNECTED || code == TSDB_CODE_SYN_NOT_LEADER || code == TSDB_CODE_SYN_RESTORING || code == TSDB_CODE_VND_STOPPED || code == TSDB_CODE_APP_IS_STARTING || code == TSDB_CODE_APP_IS_STOPPING) { if (msgType == TDMT_SCH_QUERY || msgType == TDMT_SCH_MERGE_QUERY || msgType == TDMT_SCH_FETCH || diff --git a/source/dnode/mnode/impl/src/mndTrans.c b/source/dnode/mnode/impl/src/mndTrans.c index b92be19741..35a094cb65 100644 --- a/source/dnode/mnode/impl/src/mndTrans.c +++ b/source/dnode/mnode/impl/src/mndTrans.c @@ -957,7 +957,7 @@ 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) { - if (code == TSDB_CODE_RPC_NETWORK_UNAVAIL) { + if (code == TSDB_CODE_RPC_NETWORK_UNAVAIL || code == TSDB_CODE_RPC_VGROUP_NOT_CONNECTED) { code = TSDB_CODE_MND_TRANS_NETWORK_UNAVAILL; } if (i != 0 && code == 0) { diff --git a/source/libs/function/src/udfd.c b/source/libs/function/src/udfd.c index 40c75ce6ba..d6753a55fc 100644 --- a/source/libs/function/src/udfd.c +++ b/source/libs/function/src/udfd.c @@ -606,6 +606,7 @@ int32_t udfdLoadUdf(char *udfName, SUdf *udf) { } static bool udfdRpcRfp(int32_t code, tmsg_t msgType) { if (code == TSDB_CODE_RPC_NETWORK_UNAVAIL || code == TSDB_CODE_RPC_BROKEN_LINK || code == TSDB_CODE_SYN_NOT_LEADER || + code == TSDB_CODE_RPC_VGROUP_NOT_CONNECTED || code == TSDB_CODE_SYN_RESTORING || code == TSDB_CODE_MNODE_NOT_FOUND || code == TSDB_CODE_APP_IS_STARTING || code == TSDB_CODE_APP_IS_STOPPING) { if (msgType == TDMT_SCH_QUERY || msgType == TDMT_SCH_MERGE_QUERY || msgType == TDMT_SCH_FETCH || diff --git a/source/libs/scheduler/inc/schInt.h b/source/libs/scheduler/inc/schInt.h index 48df7e36a3..2ab37c1715 100644 --- a/source/libs/scheduler/inc/schInt.h +++ b/source/libs/scheduler/inc/schInt.h @@ -375,7 +375,7 @@ extern SSchedulerMgmt schMgmt; #define SCH_JOB_NEED_WAIT(_job) (!SCH_IS_QUERY_JOB(_job)) #define SCH_JOB_NEED_DROP(_job) (SCH_IS_QUERY_JOB(_job)) #define SCH_IS_EXPLAIN_JOB(_job) (EXPLAIN_MODE_ANALYZE == (_job)->attr.explainMode) -#define SCH_NETWORK_ERR(_code) ((_code) == TSDB_CODE_RPC_BROKEN_LINK || (_code) == TSDB_CODE_RPC_NETWORK_UNAVAIL) +#define SCH_NETWORK_ERR(_code) ((_code) == TSDB_CODE_RPC_BROKEN_LINK || (_code) == TSDB_CODE_RPC_NETWORK_UNAVAIL || (code) == TSDB_CODE_RPC_VGROUP_NOT_CONNECTED) #define SCH_MERGE_TASK_NETWORK_ERR(_task, _code, _len) \ (SCH_NETWORK_ERR(_code) && (((_len) > 0) || (!SCH_IS_DATA_BIND_TASK(_task)) || (_task)->redirectCtx.inRedirect)) #define SCH_REDIRECT_MSGTYPE(_msgType) \ diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c index 62355b710b..e8b8c95eb1 100644 --- a/source/libs/transport/src/transCli.c +++ b/source/libs/transport/src/transCli.c @@ -1665,7 +1665,7 @@ int cliAppCb(SCliConn* pConn, STransMsg* pResp, SCliMsg* pMsg) { if (pCtx->retryCode != TSDB_CODE_SUCCESS) { int32_t code = pResp->code; // return internal code app - if (code == TSDB_CODE_RPC_NETWORK_UNAVAIL || code == TSDB_CODE_RPC_BROKEN_LINK) { + if (code == TSDB_CODE_RPC_NETWORK_UNAVAIL || code == TSDB_CODE_RPC_BROKEN_LINK || code == TSDB_CODE_RPC_VGROUP_NOT_CONNECTED) { pResp->code = pCtx->retryCode; } } From c66b7df5d717d26acace1e2d6d915348922d0506 Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Tue, 20 Dec 2022 19:13:00 +0800 Subject: [PATCH 04/63] feat(rpc): fixed build error --- include/libs/qcom/query.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/libs/qcom/query.h b/include/libs/qcom/query.h index efc86d302d..98cc95facf 100644 --- a/include/libs/qcom/query.h +++ b/include/libs/qcom/query.h @@ -268,7 +268,7 @@ extern int32_t (*queryProcessMsgRsp[TDMT_MAX])(void* output, char* msg, int32_t ((_code) == TSDB_CODE_SYN_NOT_LEADER || (_code) == TSDB_CODE_SYN_RESTORING || (_code) == TSDB_CODE_SYN_INTERNAL_ERROR) #define SYNC_OTHER_LEADER_REDIRECT_ERROR(_code) ((_code) == TSDB_CODE_MNODE_NOT_FOUND) -#define NO_RET_REDIRECT_ERROR(_code) ((_code) == TSDB_CODE_RPC_BROKEN_LINK || (_code) == TSDB_CODE_RPC_NETWORK_UNAVAIL || (code) == TSDB_CODE_RPC_VGROUP_NOT_CONNECTED) +#define NO_RET_REDIRECT_ERROR(_code) ((_code) == TSDB_CODE_RPC_BROKEN_LINK || (_code) == TSDB_CODE_RPC_NETWORK_UNAVAIL || (_code) == TSDB_CODE_RPC_VGROUP_NOT_CONNECTED) #define NEED_REDIRECT_ERROR(_code) \ (NO_RET_REDIRECT_ERROR(_code) || SYNC_UNKNOWN_LEADER_REDIRECT_ERROR(_code) || \ From 8774d2c17b8e6b81dda6c18b0977b358964ec479 Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Tue, 20 Dec 2022 19:14:57 +0800 Subject: [PATCH 05/63] feat(rpc): fixed build error --- source/libs/scheduler/inc/schInt.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/libs/scheduler/inc/schInt.h b/source/libs/scheduler/inc/schInt.h index 2ab37c1715..7730a722ab 100644 --- a/source/libs/scheduler/inc/schInt.h +++ b/source/libs/scheduler/inc/schInt.h @@ -375,7 +375,7 @@ extern SSchedulerMgmt schMgmt; #define SCH_JOB_NEED_WAIT(_job) (!SCH_IS_QUERY_JOB(_job)) #define SCH_JOB_NEED_DROP(_job) (SCH_IS_QUERY_JOB(_job)) #define SCH_IS_EXPLAIN_JOB(_job) (EXPLAIN_MODE_ANALYZE == (_job)->attr.explainMode) -#define SCH_NETWORK_ERR(_code) ((_code) == TSDB_CODE_RPC_BROKEN_LINK || (_code) == TSDB_CODE_RPC_NETWORK_UNAVAIL || (code) == TSDB_CODE_RPC_VGROUP_NOT_CONNECTED) +#define SCH_NETWORK_ERR(_code) ((_code) == TSDB_CODE_RPC_BROKEN_LINK || (_code) == TSDB_CODE_RPC_NETWORK_UNAVAIL || (_code) == TSDB_CODE_RPC_VGROUP_NOT_CONNECTED) #define SCH_MERGE_TASK_NETWORK_ERR(_task, _code, _len) \ (SCH_NETWORK_ERR(_code) && (((_len) > 0) || (!SCH_IS_DATA_BIND_TASK(_task)) || (_task)->redirectCtx.inRedirect)) #define SCH_REDIRECT_MSGTYPE(_msgType) \ From 37ea86f8ed0238dd32e0c3394a60775d1e93d392 Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Tue, 20 Dec 2022 21:13:33 +0800 Subject: [PATCH 06/63] fix(rpc): add msgType condition --- source/libs/transport/src/transCli.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c index e8b8c95eb1..bf43b0c0d0 100644 --- a/source/libs/transport/src/transCli.c +++ b/source/libs/transport/src/transCli.c @@ -1673,7 +1673,14 @@ int cliAppCb(SCliConn* pConn, STransMsg* pResp, SCliMsg* pMsg) { // check whole vnodes is offline on this vgroup if (pResp->code == TSDB_CODE_RPC_NETWORK_UNAVAIL || pResp->code == TSDB_CODE_RPC_BROKEN_LINK) { if (pCtx->epsetRetryCnt >= pCtx->epSet.numOfEps || pCtx->retryStep > 0) { - pResp->code = TSDB_CODE_RPC_VGROUP_NOT_CONNECTED; + switch (pMsg->msg.msgType) { + case TDMT_VND_BATCH_META: + case TDMT_VND_SUBMIT: + case TDMT_SCH_QUERY: + case TDMT_SCH_MERGE_QUERY: + pResp->code = TSDB_CODE_RPC_VGROUP_NOT_CONNECTED; + break; + } } } From 15160544c5fec4521cfc7f1f72b083a524eca235 Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Wed, 21 Dec 2022 11:48:24 +0800 Subject: [PATCH 07/63] feat(rpc): move the check msgType to client --- include/util/taoserror.h | 1 + source/client/src/clientImpl.c | 20 ++++++++++++++++++++ source/libs/transport/src/transCli.c | 15 +++++---------- 3 files changed, 26 insertions(+), 10 deletions(-) diff --git a/include/util/taoserror.h b/include/util/taoserror.h index f1f35a67a4..8d79946633 100644 --- a/include/util/taoserror.h +++ b/include/util/taoserror.h @@ -66,6 +66,7 @@ int32_t* taosGetErrno(); #define TSDB_CODE_RPC_BROKEN_LINK TAOS_DEF_ERROR_CODE(0, 0x0018) // #define TSDB_CODE_RPC_TIMEOUT TAOS_DEF_ERROR_CODE(0, 0x0019) // #define TSDB_CODE_RPC_VGROUP_NOT_CONNECTED TAOS_DEF_ERROR_CODE(0, 0x0020) // "Vgroup could not be connected" +#define TSDB_CODE_RPC_VGROUP_BROKEN_LINK TAOS_DEF_ERROR_CODE(0, 0x0021) // //common & util #define TSDB_CODE_OPS_NOT_SUPPORT TAOS_DEF_ERROR_CODE(0, 0x0100) // diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index d792896b2d..1e22498b50 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -1424,6 +1424,26 @@ void processMsgFromServer(void* parent, SRpcMsg* pMsg, SEpSet* pEpSet) { memcpy((void*)tEpSet, (void*)pEpSet, sizeof(SEpSet)); } + switch (pMsg->msg.msgType) { + case TDMT_VND_BATCH_META: + case TDMT_VND_SUBMIT: + case TDMT_SCH_QUERY: + case TDMT_SCH_MERGE_QUERY: + // uniform to one error code: TSDB_CODE_RPC_VGROUP_NOT_CONNECTED + if (pMsg->code == TSDB_CODE_RPC_VGROUP_BROKEN_LINK) { + pMsg->code = TSDB_CODE_RPC_VGROUP_NOT_CONNECTED; + } + break; + default: + // restore origin code + if (pMsg->code == TSDB_CODE_RPC_VGROUP_NOT_CONNECTED) { + pMsg->code = TSDB_CODE_RPC_NETWORK_UNAVAIL; + } else if (pMsg->code == TSDB_CODE_RPC_VGROUP_BROKEN_LINK) { + pMsg->code = TSDB_CODE_RPC_BROKEN_LINK; + } + break; + } + AsyncArg* arg = taosMemoryCalloc(1, sizeof(AsyncArg)); arg->msg = *pMsg; arg->pEpset = tEpSet; diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c index bf43b0c0d0..21e66870e0 100644 --- a/source/libs/transport/src/transCli.c +++ b/source/libs/transport/src/transCli.c @@ -1671,16 +1671,11 @@ int cliAppCb(SCliConn* pConn, STransMsg* pResp, SCliMsg* pMsg) { } // check whole vnodes is offline on this vgroup - if (pResp->code == TSDB_CODE_RPC_NETWORK_UNAVAIL || pResp->code == TSDB_CODE_RPC_BROKEN_LINK) { - if (pCtx->epsetRetryCnt >= pCtx->epSet.numOfEps || pCtx->retryStep > 0) { - switch (pMsg->msg.msgType) { - case TDMT_VND_BATCH_META: - case TDMT_VND_SUBMIT: - case TDMT_SCH_QUERY: - case TDMT_SCH_MERGE_QUERY: - pResp->code = TSDB_CODE_RPC_VGROUP_NOT_CONNECTED; - break; - } + if (pCtx->epsetRetryCnt >= pCtx->epSet.numOfEps || pCtx->retryStep > 0) { + if (pResp->code == TSDB_CODE_RPC_NETWORK_UNAVAIL) { + pResp->code = TSDB_CODE_RPC_VGROUP_NOT_CONNECTED; + } else if (pResp->code == TSDB_CODE_RPC_BROKEN_LINK) { + pResp->code = TSDB_CODE_RPC_VGROUP_BROKEN_LINK; } } From 5ca52595aedba3a85f9d94d93803750a941857f4 Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Wed, 21 Dec 2022 12:20:26 +0800 Subject: [PATCH 08/63] feat(rpc): move the check msgType to client build error --- source/client/src/clientImpl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index 1e22498b50..0bf91c6db8 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -1424,7 +1424,7 @@ void processMsgFromServer(void* parent, SRpcMsg* pMsg, SEpSet* pEpSet) { memcpy((void*)tEpSet, (void*)pEpSet, sizeof(SEpSet)); } - switch (pMsg->msg.msgType) { + switch (pMsg->msgType) { case TDMT_VND_BATCH_META: case TDMT_VND_SUBMIT: case TDMT_SCH_QUERY: From ced76efde0ec2b8d40eca54a23cf6b7e63df99b7 Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Wed, 21 Dec 2022 12:44:29 +0800 Subject: [PATCH 09/63] feat(rpc): move the check msgType to cliet --- source/client/src/clientImpl.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index 0bf91c6db8..2e76d50be5 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -1424,11 +1424,12 @@ void processMsgFromServer(void* parent, SRpcMsg* pMsg, SEpSet* pEpSet) { memcpy((void*)tEpSet, (void*)pEpSet, sizeof(SEpSet)); } + // pMsg is response msg switch (pMsg->msgType) { - case TDMT_VND_BATCH_META: - case TDMT_VND_SUBMIT: - case TDMT_SCH_QUERY: - case TDMT_SCH_MERGE_QUERY: + case TDMT_VND_BATCH_META + 1: + case TDMT_VND_SUBMIT + 1: + case TDMT_SCH_QUERY + 1: + case TDMT_SCH_MERGE_QUERY + 1: // uniform to one error code: TSDB_CODE_RPC_VGROUP_NOT_CONNECTED if (pMsg->code == TSDB_CODE_RPC_VGROUP_BROKEN_LINK) { pMsg->code = TSDB_CODE_RPC_VGROUP_NOT_CONNECTED; From cd1b87031a35c78bd450ca97accd9f8cc3fb3ead Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Thu, 22 Dec 2022 10:22:51 +0800 Subject: [PATCH 10/63] fix(query): modify error describe --- include/libs/qcom/query.h | 2 +- include/util/taoserror.h | 4 ++-- source/client/src/clientImpl.c | 10 +++++----- source/dnode/mgmt/node_mgmt/src/dmTransport.c | 2 +- source/dnode/mnode/impl/src/mndTrans.c | 2 +- source/libs/function/src/udfd.c | 2 +- source/libs/scheduler/inc/schInt.h | 2 +- source/libs/transport/src/transCli.c | 6 +++--- source/util/src/terror.c | 2 +- 9 files changed, 16 insertions(+), 16 deletions(-) diff --git a/include/libs/qcom/query.h b/include/libs/qcom/query.h index 98cc95facf..5b640dce92 100644 --- a/include/libs/qcom/query.h +++ b/include/libs/qcom/query.h @@ -268,7 +268,7 @@ extern int32_t (*queryProcessMsgRsp[TDMT_MAX])(void* output, char* msg, int32_t ((_code) == TSDB_CODE_SYN_NOT_LEADER || (_code) == TSDB_CODE_SYN_RESTORING || (_code) == TSDB_CODE_SYN_INTERNAL_ERROR) #define SYNC_OTHER_LEADER_REDIRECT_ERROR(_code) ((_code) == TSDB_CODE_MNODE_NOT_FOUND) -#define NO_RET_REDIRECT_ERROR(_code) ((_code) == TSDB_CODE_RPC_BROKEN_LINK || (_code) == TSDB_CODE_RPC_NETWORK_UNAVAIL || (_code) == TSDB_CODE_RPC_VGROUP_NOT_CONNECTED) +#define NO_RET_REDIRECT_ERROR(_code) ((_code) == TSDB_CODE_RPC_BROKEN_LINK || (_code) == TSDB_CODE_RPC_NETWORK_UNAVAIL || (_code) == TSDB_CODE_RPC_SOMENODE_NOT_CONNECTED) #define NEED_REDIRECT_ERROR(_code) \ (NO_RET_REDIRECT_ERROR(_code) || SYNC_UNKNOWN_LEADER_REDIRECT_ERROR(_code) || \ diff --git a/include/util/taoserror.h b/include/util/taoserror.h index 8d79946633..6dcf244823 100644 --- a/include/util/taoserror.h +++ b/include/util/taoserror.h @@ -65,8 +65,8 @@ int32_t* taosGetErrno(); #define TSDB_CODE_RPC_PORT_EADDRINUSE TAOS_DEF_ERROR_CODE(0, 0x0017) // #define TSDB_CODE_RPC_BROKEN_LINK TAOS_DEF_ERROR_CODE(0, 0x0018) // #define TSDB_CODE_RPC_TIMEOUT TAOS_DEF_ERROR_CODE(0, 0x0019) // -#define TSDB_CODE_RPC_VGROUP_NOT_CONNECTED TAOS_DEF_ERROR_CODE(0, 0x0020) // "Vgroup could not be connected" -#define TSDB_CODE_RPC_VGROUP_BROKEN_LINK TAOS_DEF_ERROR_CODE(0, 0x0021) // +#define TSDB_CODE_RPC_SOMENODE_NOT_CONNECTED TAOS_DEF_ERROR_CODE(0, 0x0020) // "Vgroup could not be connected" +#define TSDB_CODE_RPC_SOMENODE_BROKEN_LINK TAOS_DEF_ERROR_CODE(0, 0x0021) // //common & util #define TSDB_CODE_OPS_NOT_SUPPORT TAOS_DEF_ERROR_CODE(0, 0x0100) // diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index 2e76d50be5..b480b0b230 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -1430,16 +1430,16 @@ void processMsgFromServer(void* parent, SRpcMsg* pMsg, SEpSet* pEpSet) { case TDMT_VND_SUBMIT + 1: case TDMT_SCH_QUERY + 1: case TDMT_SCH_MERGE_QUERY + 1: - // uniform to one error code: TSDB_CODE_RPC_VGROUP_NOT_CONNECTED - if (pMsg->code == TSDB_CODE_RPC_VGROUP_BROKEN_LINK) { - pMsg->code = TSDB_CODE_RPC_VGROUP_NOT_CONNECTED; + // uniform to one error code: TSDB_CODE_RPC_SOMENODE_NOT_CONNECTED + if (pMsg->code == TSDB_CODE_RPC_SOMENODE_BROKEN_LINK) { + pMsg->code = TSDB_CODE_RPC_SOMENODE_NOT_CONNECTED; } break; default: // restore origin code - if (pMsg->code == TSDB_CODE_RPC_VGROUP_NOT_CONNECTED) { + if (pMsg->code == TSDB_CODE_RPC_SOMENODE_NOT_CONNECTED) { pMsg->code = TSDB_CODE_RPC_NETWORK_UNAVAIL; - } else if (pMsg->code == TSDB_CODE_RPC_VGROUP_BROKEN_LINK) { + } else if (pMsg->code == TSDB_CODE_RPC_SOMENODE_BROKEN_LINK) { pMsg->code = TSDB_CODE_RPC_BROKEN_LINK; } break; diff --git a/source/dnode/mgmt/node_mgmt/src/dmTransport.c b/source/dnode/mgmt/node_mgmt/src/dmTransport.c index fe676c769c..2dd98f8cd1 100644 --- a/source/dnode/mgmt/node_mgmt/src/dmTransport.c +++ b/source/dnode/mgmt/node_mgmt/src/dmTransport.c @@ -233,7 +233,7 @@ static inline void dmReleaseHandle(SRpcHandleInfo *pHandle, int8_t type) { rpcRe static bool rpcRfp(int32_t code, tmsg_t msgType) { if (code == TSDB_CODE_RPC_NETWORK_UNAVAIL || code == TSDB_CODE_RPC_BROKEN_LINK || code == TSDB_CODE_MNODE_NOT_FOUND || - code == TSDB_CODE_RPC_VGROUP_NOT_CONNECTED || + code == TSDB_CODE_RPC_SOMENODE_NOT_CONNECTED || code == TSDB_CODE_SYN_NOT_LEADER || code == TSDB_CODE_SYN_RESTORING || code == TSDB_CODE_VND_STOPPED || code == TSDB_CODE_APP_IS_STARTING || code == TSDB_CODE_APP_IS_STOPPING) { if (msgType == TDMT_SCH_QUERY || msgType == TDMT_SCH_MERGE_QUERY || msgType == TDMT_SCH_FETCH || diff --git a/source/dnode/mnode/impl/src/mndTrans.c b/source/dnode/mnode/impl/src/mndTrans.c index 35a094cb65..c8d22d13ea 100644 --- a/source/dnode/mnode/impl/src/mndTrans.c +++ b/source/dnode/mnode/impl/src/mndTrans.c @@ -957,7 +957,7 @@ 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) { - if (code == TSDB_CODE_RPC_NETWORK_UNAVAIL || code == TSDB_CODE_RPC_VGROUP_NOT_CONNECTED) { + if (code == TSDB_CODE_RPC_NETWORK_UNAVAIL || code == TSDB_CODE_RPC_SOMENODE_NOT_CONNECTED) { code = TSDB_CODE_MND_TRANS_NETWORK_UNAVAILL; } if (i != 0 && code == 0) { diff --git a/source/libs/function/src/udfd.c b/source/libs/function/src/udfd.c index d6753a55fc..6c88e4d5c8 100644 --- a/source/libs/function/src/udfd.c +++ b/source/libs/function/src/udfd.c @@ -606,7 +606,7 @@ int32_t udfdLoadUdf(char *udfName, SUdf *udf) { } static bool udfdRpcRfp(int32_t code, tmsg_t msgType) { if (code == TSDB_CODE_RPC_NETWORK_UNAVAIL || code == TSDB_CODE_RPC_BROKEN_LINK || code == TSDB_CODE_SYN_NOT_LEADER || - code == TSDB_CODE_RPC_VGROUP_NOT_CONNECTED || + code == TSDB_CODE_RPC_SOMENODE_NOT_CONNECTED || code == TSDB_CODE_SYN_RESTORING || code == TSDB_CODE_MNODE_NOT_FOUND || code == TSDB_CODE_APP_IS_STARTING || code == TSDB_CODE_APP_IS_STOPPING) { if (msgType == TDMT_SCH_QUERY || msgType == TDMT_SCH_MERGE_QUERY || msgType == TDMT_SCH_FETCH || diff --git a/source/libs/scheduler/inc/schInt.h b/source/libs/scheduler/inc/schInt.h index 7730a722ab..e8216fcd7c 100644 --- a/source/libs/scheduler/inc/schInt.h +++ b/source/libs/scheduler/inc/schInt.h @@ -375,7 +375,7 @@ extern SSchedulerMgmt schMgmt; #define SCH_JOB_NEED_WAIT(_job) (!SCH_IS_QUERY_JOB(_job)) #define SCH_JOB_NEED_DROP(_job) (SCH_IS_QUERY_JOB(_job)) #define SCH_IS_EXPLAIN_JOB(_job) (EXPLAIN_MODE_ANALYZE == (_job)->attr.explainMode) -#define SCH_NETWORK_ERR(_code) ((_code) == TSDB_CODE_RPC_BROKEN_LINK || (_code) == TSDB_CODE_RPC_NETWORK_UNAVAIL || (_code) == TSDB_CODE_RPC_VGROUP_NOT_CONNECTED) +#define SCH_NETWORK_ERR(_code) ((_code) == TSDB_CODE_RPC_BROKEN_LINK || (_code) == TSDB_CODE_RPC_NETWORK_UNAVAIL || (_code) == TSDB_CODE_RPC_SOMENODE_NOT_CONNECTED) #define SCH_MERGE_TASK_NETWORK_ERR(_task, _code, _len) \ (SCH_NETWORK_ERR(_code) && (((_len) > 0) || (!SCH_IS_DATA_BIND_TASK(_task)) || (_task)->redirectCtx.inRedirect)) #define SCH_REDIRECT_MSGTYPE(_msgType) \ diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c index 21e66870e0..1dc79e0cfb 100644 --- a/source/libs/transport/src/transCli.c +++ b/source/libs/transport/src/transCli.c @@ -1665,7 +1665,7 @@ int cliAppCb(SCliConn* pConn, STransMsg* pResp, SCliMsg* pMsg) { if (pCtx->retryCode != TSDB_CODE_SUCCESS) { int32_t code = pResp->code; // return internal code app - if (code == TSDB_CODE_RPC_NETWORK_UNAVAIL || code == TSDB_CODE_RPC_BROKEN_LINK || code == TSDB_CODE_RPC_VGROUP_NOT_CONNECTED) { + if (code == TSDB_CODE_RPC_NETWORK_UNAVAIL || code == TSDB_CODE_RPC_BROKEN_LINK || code == TSDB_CODE_RPC_SOMENODE_NOT_CONNECTED) { pResp->code = pCtx->retryCode; } } @@ -1673,9 +1673,9 @@ int cliAppCb(SCliConn* pConn, STransMsg* pResp, SCliMsg* pMsg) { // check whole vnodes is offline on this vgroup if (pCtx->epsetRetryCnt >= pCtx->epSet.numOfEps || pCtx->retryStep > 0) { if (pResp->code == TSDB_CODE_RPC_NETWORK_UNAVAIL) { - pResp->code = TSDB_CODE_RPC_VGROUP_NOT_CONNECTED; + pResp->code = TSDB_CODE_RPC_SOMENODE_NOT_CONNECTED; } else if (pResp->code == TSDB_CODE_RPC_BROKEN_LINK) { - pResp->code = TSDB_CODE_RPC_VGROUP_BROKEN_LINK; + pResp->code = TSDB_CODE_RPC_SOMENODE_BROKEN_LINK; } } diff --git a/source/util/src/terror.c b/source/util/src/terror.c index 1871697ddc..ec469e3c62 100644 --- a/source/util/src/terror.c +++ b/source/util/src/terror.c @@ -51,7 +51,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_RPC_FQDN_ERROR, "Unable to resolve FQD TAOS_DEFINE_ERROR(TSDB_CODE_RPC_PORT_EADDRINUSE, "Port already in use") TAOS_DEFINE_ERROR(TSDB_CODE_RPC_BROKEN_LINK, "Conn is broken") TAOS_DEFINE_ERROR(TSDB_CODE_RPC_TIMEOUT, "Conn read timeout") -TAOS_DEFINE_ERROR(TSDB_CODE_RPC_VGROUP_NOT_CONNECTED, "Vgroup could not be connected") +TAOS_DEFINE_ERROR(TSDB_CODE_RPC_SOMENODE_NOT_CONNECTED, "some vnode/qnode/mnode(s) out of service") //common & util TAOS_DEFINE_ERROR(TSDB_CODE_TIME_UNSYNCED, "Client and server's time is not synchronized") From 48b6bd438d5d10529a97f73b0656ad55f567a275 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Thu, 22 Dec 2022 17:30:02 +0800 Subject: [PATCH 11/63] fix: restart snapshot sender on receiver is restart --- include/util/taoserror.h | 1 + source/dnode/vnode/src/vnd/vnodeCommit.c | 7 +- source/dnode/vnode/src/vnd/vnodeSnapshot.c | 2 +- source/dnode/vnode/src/vnd/vnodeSync.c | 4 +- source/libs/sync/src/syncSnapshot.c | 137 ++++++++++++--------- source/libs/sync/test/syncRaftLogTest2.cpp | 2 +- source/libs/sync/test/syncRaftLogTest3.cpp | 2 +- source/util/src/terror.c | 1 + 8 files changed, 90 insertions(+), 66 deletions(-) diff --git a/include/util/taoserror.h b/include/util/taoserror.h index 7cc1a47404..2d7b15ebda 100644 --- a/include/util/taoserror.h +++ b/include/util/taoserror.h @@ -517,6 +517,7 @@ int32_t* taosGetErrno(); #define TSDB_CODE_SYN_STANDBY_NOT_READY TAOS_DEF_ERROR_CODE(0, 0x0912) #define TSDB_CODE_SYN_BATCH_ERROR TAOS_DEF_ERROR_CODE(0, 0x0913) #define TSDB_CODE_SYN_RESTORING TAOS_DEF_ERROR_CODE(0, 0x0914) +#define TSDB_CODE_SYN_INVALID_SNAPSHOT_MSG TAOS_DEF_ERROR_CODE(0, 0x0915) // internal #define TSDB_CODE_SYN_INTERNAL_ERROR TAOS_DEF_ERROR_CODE(0, 0x09FF) // tq diff --git a/source/dnode/vnode/src/vnd/vnodeCommit.c b/source/dnode/vnode/src/vnd/vnodeCommit.c index be977e7cbd..f78956a431 100644 --- a/source/dnode/vnode/src/vnd/vnodeCommit.c +++ b/source/dnode/vnode/src/vnd/vnodeCommit.c @@ -234,10 +234,11 @@ int vnodeAsyncCommit(SVnode *pVnode) { _exit: if (code) { - vError("vgId:%d, %s failed since %s, commit id:%" PRId64, TD_VID(pVnode), __func__, tstrerror(code), + vError("vgId:%d, vnode async commit failed since %s, commitId:%" PRId64, TD_VID(pVnode), tstrerror(code), pVnode->state.commitID); } else { - vDebug("vgId:%d, %s done", TD_VID(pVnode), __func__); + vInfo("vgId:%d, vnode async commit done, commitId:%" PRId64 " term:%" PRId64 " applied:%" PRId64, TD_VID(pVnode), + pVnode->state.commitID, pVnode->state.applyTerm, pVnode->state.applied); } return code; } @@ -256,7 +257,7 @@ static int vnodeCommitImpl(SCommitInfo *pInfo) { char dir[TSDB_FILENAME_LEN] = {0}; SVnode *pVnode = pInfo->pVnode; - vInfo("vgId:%d, start to commit, commit ID:%" PRId64 " version:%" PRId64 " term: %" PRId64, TD_VID(pVnode), + vInfo("vgId:%d, start to commit, commitId:%" PRId64 " version:%" PRId64 " term: %" PRId64, TD_VID(pVnode), pVnode->state.commitID, pVnode->state.applied, pVnode->state.applyTerm); // persist wal before starting diff --git a/source/dnode/vnode/src/vnd/vnodeSnapshot.c b/source/dnode/vnode/src/vnd/vnodeSnapshot.c index fcfacd1ca9..dbd06d6ec0 100644 --- a/source/dnode/vnode/src/vnd/vnodeSnapshot.c +++ b/source/dnode/vnode/src/vnd/vnodeSnapshot.c @@ -423,7 +423,7 @@ int32_t vnodeSnapWrite(SVSnapWriter *pWriter, uint8_t *pData, uint32_t nData) { ASSERT(pHdr->index == pWriter->index + 1); pWriter->index = pHdr->index; - vInfo("vgId:%d, vnode snapshot write data, index:%" PRId64 " type:%d nData:%d", TD_VID(pVnode), pHdr->index, + vInfo("vgId:%d, vnode snapshot write data, index:%" PRId64 " type:%d blockLen:%d", TD_VID(pVnode), pHdr->index, pHdr->type, nData); switch (pHdr->type) { diff --git a/source/dnode/vnode/src/vnd/vnodeSync.c b/source/dnode/vnode/src/vnd/vnodeSync.c index 5caaae502f..0437703c92 100644 --- a/source/dnode/vnode/src/vnd/vnodeSync.c +++ b/source/dnode/vnode/src/vnd/vnodeSync.c @@ -465,9 +465,9 @@ static int32_t vnodeSnapshotStopWrite(const SSyncFSM *pFsm, void *pWriter, bool static int32_t vnodeSnapshotDoWrite(const SSyncFSM *pFsm, void *pWriter, void *pBuf, int32_t len) { SVnode *pVnode = pFsm->data; - vDebug("vgId:%d, continue write vnode snapshot, len:%d", pVnode->config.vgId, len); + vDebug("vgId:%d, continue write vnode snapshot, blockLen:%d", pVnode->config.vgId, len); int32_t code = vnodeSnapWrite(pWriter, pBuf, len); - vDebug("vgId:%d, continue write vnode snapshot finished, len:%d", pVnode->config.vgId, len); + vDebug("vgId:%d, continue write vnode snapshot finished, blockLen:%d", pVnode->config.vgId, len); return code; } diff --git a/source/libs/sync/src/syncSnapshot.c b/source/libs/sync/src/syncSnapshot.c index 30324c1113..7a35f90165 100644 --- a/source/libs/sync/src/syncSnapshot.c +++ b/source/libs/sync/src/syncSnapshot.c @@ -294,7 +294,7 @@ int32_t syncNodeStartSnapshot(SSyncNode *pSyncNode, SRaftId *pDestId) { } if (snapshotSenderIsStart(pSender)) { - sSError(pSender, "snapshot sender already start, ignore"); + sSInfo(pSender, "snapshot sender already start, ignore"); return 0; } @@ -523,7 +523,7 @@ static int32_t snapshotReceiverFinish(SSyncSnapshotReceiver *pReceiver, SyncSnap static int32_t snapshotReceiverGotData(SSyncSnapshotReceiver *pReceiver, SyncSnapshotSend *pMsg) { if (pMsg->seq != pReceiver->ack + 1) { sRError(pReceiver, "snapshot receiver invalid seq, ack:%d seq:%d", pReceiver->ack, pMsg->seq); - terrno = TSDB_CODE_SYN_INTERNAL_ERROR; + terrno = TSDB_CODE_SYN_INVALID_SNAPSHOT_MSG; return -1; } @@ -721,8 +721,12 @@ static int32_t syncNodeOnSnapshotTransfering(SSyncNode *pSyncNode, SyncSnapshotS timeNow = taosGetTimestampMs(); } + int32_t code = 0; if (snapshotReceiverGotData(pReceiver, pMsg) != 0) { - return -1; + code = terrno; + if (code >= SYNC_SNAPSHOT_SEQ_INVALID) { + code = TSDB_CODE_SYN_INTERNAL_ERROR; + } } // build msg @@ -740,7 +744,7 @@ static int32_t syncNodeOnSnapshotTransfering(SSyncNode *pSyncNode, SyncSnapshotS pRspMsg->lastTerm = pMsg->lastTerm; pRspMsg->startTime = pReceiver->startTime; pRspMsg->ack = pReceiver->ack; // receiver maybe already closed - pRspMsg->code = 0; + pRspMsg->code = code; pRspMsg->snapBeginIndex = pReceiver->snapshotParam.start; // send msg @@ -861,7 +865,7 @@ int32_t syncNodeOnSnapshot(SSyncNode *pSyncNode, const SRpcMsg *pRpcMsg) { syncLogRecvSyncSnapshotSend(pSyncNode, pMsg, "process force stop"); snapshotReceiverForceStop(pReceiver); } else if (pMsg->seq > SYNC_SNAPSHOT_SEQ_BEGIN && pMsg->seq < SYNC_SNAPSHOT_SEQ_END) { - syncLogRecvSyncSnapshotSend(pSyncNode, pMsg, "process seq"); + syncLogRecvSyncSnapshotSend(pSyncNode, pMsg, "process seq data"); syncNodeOnSnapshotTransfering(pSyncNode, pMsg); } else { // error log @@ -982,68 +986,85 @@ int32_t syncNodeOnSnapshotRsp(SSyncNode *pSyncNode, const SRpcMsg *pRpcMsg) { } // state, term, seq/ack - if (pSyncNode->state == TAOS_SYNC_STATE_LEADER) { - if (pMsg->term == pSyncNode->pRaftStore->currentTerm) { - // prepare , send begin msg - if (pMsg->ack == SYNC_SNAPSHOT_SEQ_PRE_SNAPSHOT) { - syncLogRecvSyncSnapshotRsp(pSyncNode, pMsg, "process seq pre-snapshot"); - syncNodeOnSnapshotReplyPre(pSyncNode, pMsg); - return 0; - } + if (pSyncNode->state != TAOS_SYNC_STATE_LEADER) { + sSError(pSender, "snapshot sender not leader"); + return -1; + } - if (pMsg->ack == SYNC_SNAPSHOT_SEQ_BEGIN) { - syncLogRecvSyncSnapshotRsp(pSyncNode, pMsg, "process seq begin"); - if (snapshotSenderUpdateProgress(pSender, pMsg) != 0) { - return -1; - } + if (pMsg->term != pSyncNode->pRaftStore->currentTerm) { + sSError(pSender, "snapshot sender term not equal"); + return -1; + } - if (snapshotSend(pSender) != 0) { - return -1; - } - return 0; - } + if (pMsg->code != 0) { + syncLogRecvSyncSnapshotRsp(pSyncNode, pMsg, "receive error code"); + sSError(pSender, "snapshot sender receive error code:0x%x and stop sender", pMsg->code); + snapshotSenderStop(pSender, true); + SSyncLogReplMgr *pMgr = syncNodeGetLogReplMgr(pSyncNode, &pMsg->srcId); + if (pMgr) { + syncLogReplMgrReset(pMgr); + } - // receive ack is finish, close sender - if (pMsg->ack == SYNC_SNAPSHOT_SEQ_END) { - syncLogRecvSyncSnapshotRsp(pSyncNode, pMsg, "process seq end"); - snapshotSenderStop(pSender, true); - SSyncLogReplMgr *pMgr = syncNodeGetLogReplMgr(pSyncNode, &pMsg->srcId); - if (pMgr) { - syncLogRecvSyncSnapshotRsp(pSyncNode, pMsg, "reset repl mgr"); - syncLogReplMgrReset(pMgr); - } - return 0; - } + return -1; + } - // send next msg - if (pMsg->ack == pSender->seq) { - syncLogRecvSyncSnapshotRsp(pSyncNode, pMsg, "process seq"); - // update sender ack - if (snapshotSenderUpdateProgress(pSender, pMsg) != 0) { - return -1; - } - if (snapshotSend(pSender) != 0) { - return -1; - } + // prepare , send begin msg + if (pMsg->ack == SYNC_SNAPSHOT_SEQ_PRE_SNAPSHOT) { + syncLogRecvSyncSnapshotRsp(pSyncNode, pMsg, "process seq pre-snapshot"); + syncNodeOnSnapshotReplyPre(pSyncNode, pMsg); + return 0; + } - } else if (pMsg->ack == pSender->seq - 1) { - // maybe resend - syncLogRecvSyncSnapshotRsp(pSyncNode, pMsg, "process seq and resend"); - snapshotReSend(pSender); - - } else { - // error log - sSError(pSender, "snapshot sender recv error ack:%d, my seq:%d", pMsg->ack, pSender->seq); - return -1; - } - } else { - // error log - sSError(pSender, "snapshot sender term not equal"); + if (pMsg->ack == SYNC_SNAPSHOT_SEQ_BEGIN) { + syncLogRecvSyncSnapshotRsp(pSyncNode, pMsg, "process seq begin"); + if (snapshotSenderUpdateProgress(pSender, pMsg) != 0) { return -1; } + + if (snapshotSend(pSender) != 0) { + return -1; + } + return 0; + } + + // receive ack is finish, close sender + if (pMsg->ack == SYNC_SNAPSHOT_SEQ_END) { + syncLogRecvSyncSnapshotRsp(pSyncNode, pMsg, "process seq end"); + snapshotSenderStop(pSender, true); + SSyncLogReplMgr *pMgr = syncNodeGetLogReplMgr(pSyncNode, &pMsg->srcId); + if (pMgr) { + syncLogRecvSyncSnapshotRsp(pSyncNode, pMsg, "reset repl mgr"); + syncLogReplMgrReset(pMgr); + } + return 0; + } + + // send next msg + if (pMsg->ack == pSender->seq) { + syncLogRecvSyncSnapshotRsp(pSyncNode, pMsg, "process seq data"); + // update sender ack + if (snapshotSenderUpdateProgress(pSender, pMsg) != 0) { + return -1; + } + if (snapshotSend(pSender) != 0) { + return -1; + } + + } else if (pMsg->ack == pSender->seq - 1) { + // maybe resend + syncLogRecvSyncSnapshotRsp(pSyncNode, pMsg, "process seq and resend"); + snapshotReSend(pSender); + } else { // error log - sSError(pSender, "snapshot sender not leader"); + syncLogRecvSyncSnapshotRsp(pSyncNode, pMsg, "receive error ack"); + sSError(pSender, "snapshot sender receive error ack:%d, my seq:%d", pMsg->ack, pSender->seq); + snapshotSenderStop(pSender, true); + SSyncLogReplMgr *pMgr = syncNodeGetLogReplMgr(pSyncNode, &pMsg->srcId); + if (pMgr) { + syncLogReplMgrReset(pMgr); + } + return -1; } diff --git a/source/libs/sync/test/syncRaftLogTest2.cpp b/source/libs/sync/test/syncRaftLogTest2.cpp index a7752dcb8b..de9137fbe1 100644 --- a/source/libs/sync/test/syncRaftLogTest2.cpp +++ b/source/libs/sync/test/syncRaftLogTest2.cpp @@ -47,7 +47,7 @@ void init() { pSyncNode->pWal = pWal; pSyncNode->pFsm = (SSyncFSM*)taosMemoryMalloc(sizeof(SSyncFSM)); - pSyncNode->pFsm->FpGetSnapshotInfo = GetSnapshotCb; + // pSyncNode->pFsm->FpGetSnapshotInfo = GetSnapshotCb; } void cleanup() { diff --git a/source/libs/sync/test/syncRaftLogTest3.cpp b/source/libs/sync/test/syncRaftLogTest3.cpp index 31c06625aa..1eed08102f 100644 --- a/source/libs/sync/test/syncRaftLogTest3.cpp +++ b/source/libs/sync/test/syncRaftLogTest3.cpp @@ -47,7 +47,7 @@ void init() { pSyncNode->pWal = pWal; pSyncNode->pFsm = (SSyncFSM*)taosMemoryMalloc(sizeof(SSyncFSM)); - pSyncNode->pFsm->FpGetSnapshotInfo = GetSnapshotCb; + // pSyncNode->pFsm->FpGetSnapshotInfo = GetSnapshotCb; } void cleanup() { diff --git a/source/util/src/terror.c b/source/util/src/terror.c index d73c8661fc..e59b1daa05 100644 --- a/source/util/src/terror.c +++ b/source/util/src/terror.c @@ -405,6 +405,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_SYN_PROPOSE_NOT_READY, "Sync not ready for pr TAOS_DEFINE_ERROR(TSDB_CODE_SYN_STANDBY_NOT_READY, "Sync not ready for standby") TAOS_DEFINE_ERROR(TSDB_CODE_SYN_BATCH_ERROR, "Sync batch error") TAOS_DEFINE_ERROR(TSDB_CODE_SYN_RESTORING, "Sync is restoring") +TAOS_DEFINE_ERROR(TSDB_CODE_SYN_INVALID_SNAPSHOT_MSG, "Sync invalid snapshot msg") TAOS_DEFINE_ERROR(TSDB_CODE_SYN_INTERNAL_ERROR, "Sync internal error") //tq From 336ee146e618d4f81c42c3b4eba128ca66113d0d Mon Sep 17 00:00:00 2001 From: Minglei Jin Date: Thu, 22 Dec 2022 17:56:56 +0800 Subject: [PATCH 12/63] fix(tdb/restore): seek jfd to begin --- source/libs/tdb/src/db/tdbPager.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/source/libs/tdb/src/db/tdbPager.c b/source/libs/tdb/src/db/tdbPager.c index 8d9933b160..2a2a6f8bbd 100644 --- a/source/libs/tdb/src/db/tdbPager.c +++ b/source/libs/tdb/src/db/tdbPager.c @@ -869,6 +869,12 @@ static int tdbPagerRestore(SPager *pPager, const char *jFileName) { return -1; } + if (tdbOsLSeek(jfd, 0L, SEEK_SET) < 0) { + tdbError("failed to lseek jfd due to %s. file:%s, offset:0", strerror(errno), pPager->dbFileName); + terrno = TAOS_SYSTEM_ERROR(errno); + return -1; + } + pageBuf = tdbOsCalloc(1, pPager->pageSize); if (pageBuf == NULL) { return -1; From 99bc54dfd9dc66ffd952a74da6c68883ca9c1221 Mon Sep 17 00:00:00 2001 From: Minglei Jin Date: Thu, 22 Dec 2022 20:29:42 +0800 Subject: [PATCH 13/63] tdb/pager: debug logs for pager restore --- source/libs/tdb/src/db/tdbPager.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source/libs/tdb/src/db/tdbPager.c b/source/libs/tdb/src/db/tdbPager.c index 2a2a6f8bbd..e0c3397d63 100644 --- a/source/libs/tdb/src/db/tdbPager.c +++ b/source/libs/tdb/src/db/tdbPager.c @@ -880,6 +880,8 @@ static int tdbPagerRestore(SPager *pPager, const char *jFileName) { return -1; } + tdbDebug("pager/restore: %p, %d/%d, txnId:%" PRId64, pPager, pPager->dbOrigSize, pPager->dbFileSize, pTxn->txnId); + for (int pgIndex = 0; pgIndex < journalSize; ++pgIndex) { // read pgno & the page from journal SPgno pgno; @@ -890,6 +892,8 @@ static int tdbPagerRestore(SPager *pPager, const char *jFileName) { return -1; } + tdbTrace("pager/restore: restore pgno:%d,", pgno); + ret = tdbOsRead(jfd, pageBuf, pPager->pageSize); if (ret < 0) { tdbOsFree(pageBuf); From 78af4f54a3108246b397d5859a6f3f4795b0e440 Mon Sep 17 00:00:00 2001 From: Minglei Jin Date: Thu, 22 Dec 2022 20:29:42 +0800 Subject: [PATCH 14/63] tdb/pager: debug logs for pager restore --- source/libs/tdb/src/db/tdbPager.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/source/libs/tdb/src/db/tdbPager.c b/source/libs/tdb/src/db/tdbPager.c index 2a2a6f8bbd..eb7bcf9385 100644 --- a/source/libs/tdb/src/db/tdbPager.c +++ b/source/libs/tdb/src/db/tdbPager.c @@ -880,6 +880,8 @@ static int tdbPagerRestore(SPager *pPager, const char *jFileName) { return -1; } + tdbDebug("pager/restore: %p, %d/%d, txnId:%s", pPager, pPager->dbOrigSize, pPager->dbFileSize, jFileName); + for (int pgIndex = 0; pgIndex < journalSize; ++pgIndex) { // read pgno & the page from journal SPgno pgno; @@ -890,6 +892,8 @@ static int tdbPagerRestore(SPager *pPager, const char *jFileName) { return -1; } + tdbTrace("pager/restore: restore pgno:%d,", pgno); + ret = tdbOsRead(jfd, pageBuf, pPager->pageSize); if (ret < 0) { tdbOsFree(pageBuf); @@ -949,7 +953,12 @@ int tdbPagerRestoreJournals(SPager *pPager) { while ((pDirEntry = tdbReadDir(pDir)) != NULL) { char *name = tdbDirEntryBaseName(tdbGetDirEntryName(pDirEntry)); if (strncmp(TDB_MAINDB_NAME "-journal", name, 16) == 0) { - if (tdbPagerRestore(pPager, name) < 0) { + char jname[TD_PATH_MAX] = {0}; + int dirLen = strlen(pPager->pEnv->dbName); + memcpy(jname, pPager->pEnv->dbName, dirLen); + jname[dirLen] = '/'; + memcpy(jname + dirLen + 1, name, strlen(name)); + if (tdbPagerRestore(pPager, jname) < 0) { tdbCloseDir(&pDir); tdbError("failed to restore file due to %s. jFileName:%s", strerror(errno), name); From 7a38465c760eedb9f0893c8579c33cab3676879a Mon Sep 17 00:00:00 2001 From: Minglei Jin Date: Thu, 22 Dec 2022 20:29:42 +0800 Subject: [PATCH 15/63] tdb/pager: debug logs for pager restore --- source/libs/tdb/src/db/tdbPager.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/source/libs/tdb/src/db/tdbPager.c b/source/libs/tdb/src/db/tdbPager.c index 2a2a6f8bbd..ce20f6808f 100644 --- a/source/libs/tdb/src/db/tdbPager.c +++ b/source/libs/tdb/src/db/tdbPager.c @@ -880,6 +880,8 @@ static int tdbPagerRestore(SPager *pPager, const char *jFileName) { return -1; } + tdbDebug("pager/restore: %p, %d/%d, txnId:%s", pPager, pPager->dbOrigSize, pPager->dbFileSize, jFileName); + for (int pgIndex = 0; pgIndex < journalSize; ++pgIndex) { // read pgno & the page from journal SPgno pgno; @@ -890,6 +892,8 @@ static int tdbPagerRestore(SPager *pPager, const char *jFileName) { return -1; } + tdbTrace("pager/restore: restore pgno:%d,", pgno); + ret = tdbOsRead(jfd, pageBuf, pPager->pageSize); if (ret < 0) { tdbOsFree(pageBuf); @@ -929,7 +933,7 @@ static int tdbPagerRestore(SPager *pPager, const char *jFileName) { return -1; } - if (tdbOsRemove(pPager->jFileName) < 0 && errno != ENOENT) { + if (tdbOsRemove(jFileName) < 0 && errno != ENOENT) { tdbError("failed to remove file due to %s. jFileName:%s", strerror(errno), pPager->jFileName); terrno = TAOS_SYSTEM_ERROR(errno); return -1; @@ -949,7 +953,12 @@ int tdbPagerRestoreJournals(SPager *pPager) { while ((pDirEntry = tdbReadDir(pDir)) != NULL) { char *name = tdbDirEntryBaseName(tdbGetDirEntryName(pDirEntry)); if (strncmp(TDB_MAINDB_NAME "-journal", name, 16) == 0) { - if (tdbPagerRestore(pPager, name) < 0) { + char jname[TD_PATH_MAX] = {0}; + int dirLen = strlen(pPager->pEnv->dbName); + memcpy(jname, pPager->pEnv->dbName, dirLen); + jname[dirLen] = '/'; + memcpy(jname + dirLen + 1, name, strlen(name)); + if (tdbPagerRestore(pPager, jname) < 0) { tdbCloseDir(&pDir); tdbError("failed to restore file due to %s. jFileName:%s", strerror(errno), name); From 773423a6b64e8f5951affa2f7fe7b156ad7cbf1f Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Fri, 23 Dec 2022 09:11:45 +0800 Subject: [PATCH 16/63] fix: remove some logs --- source/dnode/vnode/src/vnd/vnodeSnapshot.c | 4 ++-- source/libs/sync/src/syncSnapshot.c | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/source/dnode/vnode/src/vnd/vnodeSnapshot.c b/source/dnode/vnode/src/vnd/vnodeSnapshot.c index dbd06d6ec0..0362d4af2a 100644 --- a/source/dnode/vnode/src/vnd/vnodeSnapshot.c +++ b/source/dnode/vnode/src/vnd/vnodeSnapshot.c @@ -423,8 +423,8 @@ int32_t vnodeSnapWrite(SVSnapWriter *pWriter, uint8_t *pData, uint32_t nData) { ASSERT(pHdr->index == pWriter->index + 1); pWriter->index = pHdr->index; - vInfo("vgId:%d, vnode snapshot write data, index:%" PRId64 " type:%d blockLen:%d", TD_VID(pVnode), pHdr->index, - pHdr->type, nData); + vDebug("vgId:%d, vnode snapshot write data, index:%" PRId64 " type:%d blockLen:%d", TD_VID(pVnode), pHdr->index, + pHdr->type, nData); switch (pHdr->type) { case SNAP_DATA_CFG: { diff --git a/source/libs/sync/src/syncSnapshot.c b/source/libs/sync/src/syncSnapshot.c index 7a35f90165..9e1c6b36f1 100644 --- a/source/libs/sync/src/syncSnapshot.c +++ b/source/libs/sync/src/syncSnapshot.c @@ -49,7 +49,6 @@ SSyncSnapshotSender *snapshotSenderCreate(SSyncNode *pSyncNode, int32_t replicaI pSender->pSyncNode->pFsm->FpGetSnapshotInfo(pSender->pSyncNode->pFsm, &pSender->snapshot); pSender->finish = false; - sDebug("vgId:%d, snapshot sender create", pSender->pSyncNode->vgId); return pSender; } From 0c64cfc309e41de75bb10ef2ae7c126413ad949b Mon Sep 17 00:00:00 2001 From: Minglei Jin Date: Thu, 22 Dec 2022 20:29:42 +0800 Subject: [PATCH 17/63] tdb/pager: debug logs for pager restore --- source/libs/tdb/src/db/tdbPager.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/source/libs/tdb/src/db/tdbPager.c b/source/libs/tdb/src/db/tdbPager.c index 2a2a6f8bbd..62d82edeb1 100644 --- a/source/libs/tdb/src/db/tdbPager.c +++ b/source/libs/tdb/src/db/tdbPager.c @@ -880,6 +880,8 @@ static int tdbPagerRestore(SPager *pPager, const char *jFileName) { return -1; } + tdbDebug("pager/restore: %p, %d/%d, txnId:%s", pPager, pPager->dbOrigSize, pPager->dbFileSize, jFileName); + for (int pgIndex = 0; pgIndex < journalSize; ++pgIndex) { // read pgno & the page from journal SPgno pgno; @@ -890,6 +892,8 @@ static int tdbPagerRestore(SPager *pPager, const char *jFileName) { return -1; } + tdbTrace("pager/restore: restore pgno:%d,", pgno); + ret = tdbOsRead(jfd, pageBuf, pPager->pageSize); if (ret < 0) { tdbOsFree(pageBuf); @@ -929,7 +933,7 @@ static int tdbPagerRestore(SPager *pPager, const char *jFileName) { return -1; } - if (tdbOsRemove(pPager->jFileName) < 0 && errno != ENOENT) { + if (tdbOsRemove(jFileName) < 0 && errno != ENOENT) { tdbError("failed to remove file due to %s. jFileName:%s", strerror(errno), pPager->jFileName); terrno = TAOS_SYSTEM_ERROR(errno); return -1; @@ -949,7 +953,12 @@ int tdbPagerRestoreJournals(SPager *pPager) { while ((pDirEntry = tdbReadDir(pDir)) != NULL) { char *name = tdbDirEntryBaseName(tdbGetDirEntryName(pDirEntry)); if (strncmp(TDB_MAINDB_NAME "-journal", name, 16) == 0) { - if (tdbPagerRestore(pPager, name) < 0) { + char jname[TD_PATH_MAX] = {0}; + int dirLen = strlen(pPager->pEnv->dbName); + memcpy(jname, pPager->pEnv->dbName, dirLen); + jname[dirLen] = '/'; + memcpy(jname + dirLen + 1, name, strlen(name)); + if (tdbPagerRestore(pPager, jname) < 0) { tdbCloseDir(&pDir); tdbError("failed to restore file due to %s. jFileName:%s", strerror(errno), name); @@ -975,7 +984,12 @@ int tdbPagerRollback(SPager *pPager) { char *name = tdbDirEntryBaseName(tdbGetDirEntryName(pDirEntry)); if (strncmp(TDB_MAINDB_NAME "-journal", name, 16) == 0) { - if (tdbOsRemove(name) < 0 && errno != ENOENT) { + char jname[TD_PATH_MAX] = {0}; + int dirLen = strlen(pPager->pEnv->dbName); + memcpy(jname, pPager->pEnv->dbName, dirLen); + jname[dirLen] = '/'; + memcpy(jname + dirLen + 1, name, strlen(name)); + if (tdbOsRemove(jname) < 0 && errno != ENOENT) { tdbCloseDir(&pDir); tdbError("failed to remove file due to %s. jFileName:%s", strerror(errno), name); From b59bee6696b159ad6bb8fed620de3f70057174f1 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Fri, 23 Dec 2022 11:03:50 +0800 Subject: [PATCH 18/63] fix: restart snapshot sender on receiver is restart --- source/libs/sync/src/syncPipeline.c | 2 +- source/libs/sync/src/syncRaftLog.c | 24 ++++++++--------- source/libs/sync/src/syncSnapshot.c | 41 ++++++++++++++++++----------- 3 files changed, 38 insertions(+), 29 deletions(-) diff --git a/source/libs/sync/src/syncPipeline.c b/source/libs/sync/src/syncPipeline.c index f438856ace..225de30755 100644 --- a/source/libs/sync/src/syncPipeline.c +++ b/source/libs/sync/src/syncPipeline.c @@ -112,7 +112,7 @@ SyncTerm syncLogReplMgrGetPrevLogTerm(SSyncLogReplMgr* pMgr, SSyncNode* pNode, S return prevLogTerm; } - sError("vgId:%d, failed to get log term since %s. index: %" PRId64 "", pNode->vgId, terrstr(), prevIndex); + sInfo("vgId:%d, failed to get log term since %s. index:%" PRId64, pNode->vgId, terrstr(), prevIndex); terrno = TSDB_CODE_WAL_LOG_NOT_EXIST; return -1; } diff --git a/source/libs/sync/src/syncRaftLog.c b/source/libs/sync/src/syncRaftLog.c index 018ac5bb7d..3f9f397ef5 100644 --- a/source/libs/sync/src/syncRaftLog.c +++ b/source/libs/sync/src/syncRaftLog.c @@ -115,8 +115,8 @@ static int32_t raftLogRestoreFromSnapshot(struct SSyncLogStore* pLogStore, SyncI const char* sysErrStr = strerror(errno); sNError(pData->pSyncNode, - "wal restore from snapshot error, index:%" PRId64 ", err:%d %X, msg:%s, syserr:%d, sysmsg:%s", - snapshotIndex, err, err, errStr, sysErr, sysErrStr); + "wal restore from snapshot error, index:%" PRId64 ", err:0x%x, msg:%s, syserr:%d, sysmsg:%s", snapshotIndex, + err, errStr, sysErr, sysErrStr); return -1; } @@ -212,8 +212,8 @@ static int32_t raftLogAppendEntry(struct SSyncLogStore* pLogStore, SSyncRaftEntr int32_t sysErr = errno; const char* sysErrStr = strerror(errno); - sNError(pData->pSyncNode, "wal write error, index:%" PRId64 ", err:%d %X, msg:%s, syserr:%d, sysmsg:%s", - pEntry->index, err, err, errStr, sysErr, sysErrStr); + sNError(pData->pSyncNode, "wal write error, index:%" PRId64 ", err:0x%x, msg:%s, syserr:%d, sysmsg:%s", + pEntry->index, err, errStr, sysErr, sysErrStr); return -1; } @@ -257,11 +257,11 @@ int32_t raftLogGetEntry(struct SSyncLogStore* pLogStore, SyncIndex index, SSyncR const char* sysErrStr = strerror(errno); if (terrno == TSDB_CODE_WAL_LOG_NOT_EXIST) { - sNTrace(pData->pSyncNode, "wal read not exist, index:%" PRId64 ", err:%d %X, msg:%s, syserr:%d, sysmsg:%s", index, - err, err, errStr, sysErr, sysErrStr); + sNTrace(pData->pSyncNode, "wal read not exist, index:%" PRId64 ", err:0x%x, msg:%s, syserr:%d, sysmsg:%s", index, + err, errStr, sysErr, sysErrStr); } else { - sNTrace(pData->pSyncNode, "wal read error, index:%" PRId64 ", err:%d %X, msg:%s, syserr:%d, sysmsg:%s", index, - err, err, errStr, sysErr, sysErrStr); + sNTrace(pData->pSyncNode, "wal read error, index:%" PRId64 ", err:0x%x, msg:%s, syserr:%d, sysmsg:%s", index, err, + errStr, sysErr, sysErrStr); } /* @@ -341,8 +341,8 @@ static int32_t raftLogTruncate(struct SSyncLogStore* pLogStore, SyncIndex fromIn const char* errStr = tstrerror(err); int32_t sysErr = errno; const char* sysErrStr = strerror(errno); - sError("vgId:%d, wal truncate error, from-index:%" PRId64 ", err:%d %X, msg:%s, syserr:%d, sysmsg:%s", - pData->pSyncNode->vgId, fromIndex, err, err, errStr, sysErr, sysErrStr); + sError("vgId:%d, wal truncate error, from-index:%" PRId64 ", err:0x%x, msg:%s, syserr:%d, sysmsg:%s", + pData->pSyncNode->vgId, fromIndex, err, errStr, sysErr, sysErrStr); } // event log @@ -392,8 +392,8 @@ int32_t raftLogUpdateCommitIndex(SSyncLogStore* pLogStore, SyncIndex index) { const char* errStr = tstrerror(err); int32_t sysErr = errno; const char* sysErrStr = strerror(errno); - sError("vgId:%d, wal update commit index error, index:%" PRId64 ", err:%d %X, msg:%s, syserr:%d, sysmsg:%s", - pData->pSyncNode->vgId, index, err, err, errStr, sysErr, sysErrStr); + sError("vgId:%d, wal update commit index error, index:%" PRId64 ", err:0x%x, msg:%s, syserr:%d, sysmsg:%s", + pData->pSyncNode->vgId, index, err, errStr, sysErr, sysErrStr); return -1; } return 0; diff --git a/source/libs/sync/src/syncSnapshot.c b/source/libs/sync/src/syncSnapshot.c index 9e1c6b36f1..54c11a503b 100644 --- a/source/libs/sync/src/syncSnapshot.c +++ b/source/libs/sync/src/syncSnapshot.c @@ -747,7 +747,7 @@ static int32_t syncNodeOnSnapshotTransfering(SSyncNode *pSyncNode, SyncSnapshotS pRspMsg->snapBeginIndex = pReceiver->snapshotParam.start; // send msg - syncLogSendSyncSnapshotRsp(pSyncNode, pRspMsg, "snapshot receiver receiving"); + syncLogSendSyncSnapshotRsp(pSyncNode, pRspMsg, "snapshot receiver received"); if (syncNodeSendMsgById(&pRspMsg->destId, pSyncNode, &rpcMsg) != 0) { sRError(pReceiver, "snapshot receiver send resp failed since %s", terrstr()); return -1; @@ -979,32 +979,31 @@ int32_t syncNodeOnSnapshotRsp(SSyncNode *pSyncNode, const SRpcMsg *pRpcMsg) { return -1; } - if (pMsg->startTime != pSender->startTime) { - syncLogRecvSyncSnapshotRsp(pSyncNode, pMsg, "sender:% " PRId64 " receiver:%" PRId64 " time not match"); - return -1; - } - // state, term, seq/ack if (pSyncNode->state != TAOS_SYNC_STATE_LEADER) { + syncLogRecvSyncSnapshotRsp(pSyncNode, pMsg, "snapshot sender not leader"); sSError(pSender, "snapshot sender not leader"); - return -1; + goto _ERROR; + } + + if (pMsg->startTime != pSender->startTime) { + syncLogRecvSyncSnapshotRsp(pSyncNode, pMsg, "snapshot sender and receiver time not match"); + sSError(pSender, "sender:%" PRId64 " receiver:%" PRId64 " time not match, code:0x%x", pMsg->startTime, + pSender->startTime, pMsg->code); + goto _ERROR; } if (pMsg->term != pSyncNode->pRaftStore->currentTerm) { - sSError(pSender, "snapshot sender term not equal"); - return -1; + syncLogRecvSyncSnapshotRsp(pSyncNode, pMsg, "snapshot sender and receiver term not match"); + sSError(pSender, "snapshot sender term not equal, msg term:%" PRId64 " currentTerm:%" PRId64, pMsg->term, + pSyncNode->pRaftStore->currentTerm); + goto _ERROR; } if (pMsg->code != 0) { syncLogRecvSyncSnapshotRsp(pSyncNode, pMsg, "receive error code"); sSError(pSender, "snapshot sender receive error code:0x%x and stop sender", pMsg->code); - snapshotSenderStop(pSender, true); - SSyncLogReplMgr *pMgr = syncNodeGetLogReplMgr(pSyncNode, &pMsg->srcId); - if (pMgr) { - syncLogReplMgrReset(pMgr); - } - - return -1; + goto _ERROR; } // prepare , send begin msg @@ -1068,4 +1067,14 @@ int32_t syncNodeOnSnapshotRsp(SSyncNode *pSyncNode, const SRpcMsg *pRpcMsg) { } return 0; + +_ERROR: + snapshotSenderStop(pSender, true); + SSyncLogReplMgr *pMgr = syncNodeGetLogReplMgr(pSyncNode, &pMsg->srcId); + if (pMgr) { + syncLogRecvSyncSnapshotRsp(pSyncNode, pMsg, "reset repl mgr"); + syncLogReplMgrReset(pMgr); + } + + return -1; } From 90e44ced3eba30d57a6700a4b23da1e5f2841bf8 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Fri, 23 Dec 2022 11:15:45 +0800 Subject: [PATCH 19/63] test: add logs --- tests/script/sh/deploy.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/script/sh/deploy.sh b/tests/script/sh/deploy.sh index 662c4a1a6c..217bd66ef6 100755 --- a/tests/script/sh/deploy.sh +++ b/tests/script/sh/deploy.sh @@ -134,6 +134,7 @@ echo "mDebugFlag 143" >> $TAOS_CFG echo "wDebugFlag 143" >> $TAOS_CFG echo "sDebugFlag 143" >> $TAOS_CFG echo "tsdbDebugFlag 143" >> $TAOS_CFG +echo "tdbDebugFlag 143" >> $TAOS_CFG echo "tqDebugFlag 143" >> $TAOS_CFG echo "fsDebugFlag 143" >> $TAOS_CFG echo "idxDebugFlag 143" >> $TAOS_CFG From 4f33119d461b0f9a8fbdc2fa1eda92555be062ab Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Fri, 23 Dec 2022 13:07:10 +0800 Subject: [PATCH 20/63] test: adjust test.sh --- tests/script/test.sh | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/tests/script/test.sh b/tests/script/test.sh index a7a5d34fbe..19180382fd 100755 --- a/tests/script/test.sh +++ b/tests/script/test.sh @@ -10,13 +10,11 @@ set +e #set -x FILE_NAME= -RELEASE=0 -ASYNC=0 VALGRIND=0 -UNIQUE=0 +TEST=0 UNAME_BIN=`which uname` OS_TYPE=`$UNAME_BIN` -while getopts "f:agvum" arg +while getopts "f:tgv" arg do case $arg in f) @@ -25,8 +23,8 @@ do v) VALGRIND=1 ;; - u) - UNIQUE=1 + t) + TEST=1 ;; g) VALGRIND=2 @@ -140,6 +138,11 @@ if [ -n "$FILE_NAME" ]; then result=$? echo "Execute result:" $result + if [ $TEST -eq 1 ]; then + echo "Exit without check asan errors" + exit 1 + fi + if [ $result -eq 0 ]; then $CODE_DIR/sh/sigint_stop_dnodes.sh $CODE_DIR/sh/checkAsan.sh From 99ef55c7d456756549235ca172d2fbaebbf15937 Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Fri, 23 Dec 2022 16:02:08 +0800 Subject: [PATCH 21/63] query(fix): return new error code except connect msg --- source/client/src/clientImpl.c | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index b480b0b230..4b4a1c368f 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -1425,24 +1425,18 @@ void processMsgFromServer(void* parent, SRpcMsg* pMsg, SEpSet* pEpSet) { } // pMsg is response msg - switch (pMsg->msgType) { - case TDMT_VND_BATCH_META + 1: - case TDMT_VND_SUBMIT + 1: - case TDMT_SCH_QUERY + 1: - case TDMT_SCH_MERGE_QUERY + 1: - // uniform to one error code: TSDB_CODE_RPC_SOMENODE_NOT_CONNECTED - if (pMsg->code == TSDB_CODE_RPC_SOMENODE_BROKEN_LINK) { - pMsg->code = TSDB_CODE_RPC_SOMENODE_NOT_CONNECTED; - } - break; - default: - // restore origin code - if (pMsg->code == TSDB_CODE_RPC_SOMENODE_NOT_CONNECTED) { - pMsg->code = TSDB_CODE_RPC_NETWORK_UNAVAIL; - } else if (pMsg->code == TSDB_CODE_RPC_SOMENODE_BROKEN_LINK) { - pMsg->code = TSDB_CODE_RPC_BROKEN_LINK; - } - break; + if (pMsg->msgType != TDMT_MND_CONNECT + 1) { + // uniform to one error code: TSDB_CODE_RPC_SOMENODE_NOT_CONNECTED + if (pMsg->code == TSDB_CODE_RPC_SOMENODE_BROKEN_LINK) { + pMsg->code = TSDB_CODE_RPC_SOMENODE_NOT_CONNECTED; + } + } else { + // restore origin code + if (pMsg->code == TSDB_CODE_RPC_SOMENODE_NOT_CONNECTED) { + pMsg->code = TSDB_CODE_RPC_NETWORK_UNAVAIL; + } else if (pMsg->code == TSDB_CODE_RPC_SOMENODE_BROKEN_LINK) { + pMsg->code = TSDB_CODE_RPC_BROKEN_LINK; + } } AsyncArg* arg = taosMemoryCalloc(1, sizeof(AsyncArg)); From d0f789744b6521f0ce3bf82cf870f47fe6bf9aac Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Fri, 23 Dec 2022 16:04:48 +0800 Subject: [PATCH 22/63] query(fix): return new error code except connect msg --- source/client/src/clientImpl.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index 4b4a1c368f..456a059191 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -1425,18 +1425,18 @@ void processMsgFromServer(void* parent, SRpcMsg* pMsg, SEpSet* pEpSet) { } // pMsg is response msg - if (pMsg->msgType != TDMT_MND_CONNECT + 1) { - // uniform to one error code: TSDB_CODE_RPC_SOMENODE_NOT_CONNECTED - if (pMsg->code == TSDB_CODE_RPC_SOMENODE_BROKEN_LINK) { - pMsg->code = TSDB_CODE_RPC_SOMENODE_NOT_CONNECTED; - } - } else { + if (pMsg->msgType == TDMT_MND_CONNECT + 1) { // restore origin code if (pMsg->code == TSDB_CODE_RPC_SOMENODE_NOT_CONNECTED) { pMsg->code = TSDB_CODE_RPC_NETWORK_UNAVAIL; } else if (pMsg->code == TSDB_CODE_RPC_SOMENODE_BROKEN_LINK) { pMsg->code = TSDB_CODE_RPC_BROKEN_LINK; } + } else { + // uniform to one error code: TSDB_CODE_RPC_SOMENODE_NOT_CONNECTED + if (pMsg->code == TSDB_CODE_RPC_SOMENODE_BROKEN_LINK) { + pMsg->code = TSDB_CODE_RPC_SOMENODE_NOT_CONNECTED; + } } AsyncArg* arg = taosMemoryCalloc(1, sizeof(AsyncArg)); From 4a97f25725843afa08aacdb3ade7c113ffd2a524 Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Sat, 24 Dec 2022 11:16:45 +0800 Subject: [PATCH 23/63] fix(query): show sql len on systable length modify from 1024 to 2048 --- include/util/tdef.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/util/tdef.h b/include/util/tdef.h index e1d421a399..d585912259 100644 --- a/include/util/tdef.h +++ b/include/util/tdef.h @@ -254,7 +254,7 @@ typedef enum ELogicConditionType { #define TSDB_EP_LEN (TSDB_FQDN_LEN + 6) #define TSDB_IPv4ADDR_LEN 16 #define TSDB_FILENAME_LEN 128 -#define TSDB_SHOW_SQL_LEN 1024 +#define TSDB_SHOW_SQL_LEN 2048 #define TSDB_SLOW_QUERY_SQL_LEN 512 #define TSDB_SHOW_SUBQUERY_LEN 1000 From 05997a3dcf581bfb067851e340fd26a1c58b92f5 Mon Sep 17 00:00:00 2001 From: xleili Date: Sat, 24 Dec 2022 11:16:12 -0500 Subject: [PATCH 24/63] docs:release 3.0.2.2 --- docs/en/28-releases/01-tdengine.md | 4 ++++ docs/en/28-releases/02-tools.md | 4 ++++ docs/zh/28-releases/01-tdengine.md | 4 ++++ docs/zh/28-releases/02-tools.md | 4 ++++ 4 files changed, 16 insertions(+) diff --git a/docs/en/28-releases/01-tdengine.md b/docs/en/28-releases/01-tdengine.md index bcfcaf9ffb..9b83c5fd65 100644 --- a/docs/en/28-releases/01-tdengine.md +++ b/docs/en/28-releases/01-tdengine.md @@ -10,6 +10,10 @@ For TDengine 2.x installation packages by version, please visit [here](https://w import Release from "/components/ReleaseV3"; +## 3.0.2.2 + + + ## 3.0.2.1 diff --git a/docs/en/28-releases/02-tools.md b/docs/en/28-releases/02-tools.md index 6013aacc35..dd44e43ab6 100644 --- a/docs/en/28-releases/02-tools.md +++ b/docs/en/28-releases/02-tools.md @@ -10,6 +10,10 @@ For other historical version installers, please visit [here](https://www.taosdat import Release from "/components/ReleaseV3"; +## 2.4.0 + + + ## 2.3.3 diff --git a/docs/zh/28-releases/01-tdengine.md b/docs/zh/28-releases/01-tdengine.md index 0fe6555162..e19b2133e4 100644 --- a/docs/zh/28-releases/01-tdengine.md +++ b/docs/zh/28-releases/01-tdengine.md @@ -10,6 +10,10 @@ TDengine 2.x 各版本安装包请访问[这里](https://www.taosdata.com/all-do import Release from "/components/ReleaseV3"; +## 3.0.2.2 + + + ## 3.0.2.1 diff --git a/docs/zh/28-releases/02-tools.md b/docs/zh/28-releases/02-tools.md index 331f6832c0..b2ead5b264 100644 --- a/docs/zh/28-releases/02-tools.md +++ b/docs/zh/28-releases/02-tools.md @@ -10,6 +10,10 @@ taosTools 各版本安装包下载链接如下: import Release from "/components/ReleaseV3"; +## 2.4.0 + + + ## 2.3.3 From c4f40874c11c87db89281abd58b21f9af493c2f0 Mon Sep 17 00:00:00 2001 From: Minglei Jin Date: Thu, 22 Dec 2022 20:29:42 +0800 Subject: [PATCH 25/63] tdb/pager: debug logs for pager restore --- source/libs/tdb/src/db/tdbPager.c | 20 +++++++++++++++++--- source/libs/tdb/src/db/tdbTable.c | 4 ++-- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/source/libs/tdb/src/db/tdbPager.c b/source/libs/tdb/src/db/tdbPager.c index 2a2a6f8bbd..62d82edeb1 100644 --- a/source/libs/tdb/src/db/tdbPager.c +++ b/source/libs/tdb/src/db/tdbPager.c @@ -880,6 +880,8 @@ static int tdbPagerRestore(SPager *pPager, const char *jFileName) { return -1; } + tdbDebug("pager/restore: %p, %d/%d, txnId:%s", pPager, pPager->dbOrigSize, pPager->dbFileSize, jFileName); + for (int pgIndex = 0; pgIndex < journalSize; ++pgIndex) { // read pgno & the page from journal SPgno pgno; @@ -890,6 +892,8 @@ static int tdbPagerRestore(SPager *pPager, const char *jFileName) { return -1; } + tdbTrace("pager/restore: restore pgno:%d,", pgno); + ret = tdbOsRead(jfd, pageBuf, pPager->pageSize); if (ret < 0) { tdbOsFree(pageBuf); @@ -929,7 +933,7 @@ static int tdbPagerRestore(SPager *pPager, const char *jFileName) { return -1; } - if (tdbOsRemove(pPager->jFileName) < 0 && errno != ENOENT) { + if (tdbOsRemove(jFileName) < 0 && errno != ENOENT) { tdbError("failed to remove file due to %s. jFileName:%s", strerror(errno), pPager->jFileName); terrno = TAOS_SYSTEM_ERROR(errno); return -1; @@ -949,7 +953,12 @@ int tdbPagerRestoreJournals(SPager *pPager) { while ((pDirEntry = tdbReadDir(pDir)) != NULL) { char *name = tdbDirEntryBaseName(tdbGetDirEntryName(pDirEntry)); if (strncmp(TDB_MAINDB_NAME "-journal", name, 16) == 0) { - if (tdbPagerRestore(pPager, name) < 0) { + char jname[TD_PATH_MAX] = {0}; + int dirLen = strlen(pPager->pEnv->dbName); + memcpy(jname, pPager->pEnv->dbName, dirLen); + jname[dirLen] = '/'; + memcpy(jname + dirLen + 1, name, strlen(name)); + if (tdbPagerRestore(pPager, jname) < 0) { tdbCloseDir(&pDir); tdbError("failed to restore file due to %s. jFileName:%s", strerror(errno), name); @@ -975,7 +984,12 @@ int tdbPagerRollback(SPager *pPager) { char *name = tdbDirEntryBaseName(tdbGetDirEntryName(pDirEntry)); if (strncmp(TDB_MAINDB_NAME "-journal", name, 16) == 0) { - if (tdbOsRemove(name) < 0 && errno != ENOENT) { + char jname[TD_PATH_MAX] = {0}; + int dirLen = strlen(pPager->pEnv->dbName); + memcpy(jname, pPager->pEnv->dbName, dirLen); + jname[dirLen] = '/'; + memcpy(jname + dirLen + 1, name, strlen(name)); + if (tdbOsRemove(jname) < 0 && errno != ENOENT) { tdbCloseDir(&pDir); tdbError("failed to remove file due to %s. jFileName:%s", strerror(errno), name); diff --git a/source/libs/tdb/src/db/tdbTable.c b/source/libs/tdb/src/db/tdbTable.c index 2950169979..972e2f29e5 100644 --- a/source/libs/tdb/src/db/tdbTable.c +++ b/source/libs/tdb/src/db/tdbTable.c @@ -108,13 +108,13 @@ int tdbTbOpen(const char *tbname, int keyLen, int valLen, tdb_cmpr_fn_t keyCmprF ASSERT(pPager != NULL); if (rollback) { - tdbPagerRollback(pPager); - } else { ret = tdbPagerRestoreJournals(pPager); if (ret < 0) { tdbOsFree(pTb); return -1; } + } else { + tdbPagerRollback(pPager); } // pTb->pBt From 3ea9fadfc8c146784dd116914e1aed876716a95b Mon Sep 17 00:00:00 2001 From: Minglei Jin Date: Mon, 26 Dec 2022 10:10:49 +0800 Subject: [PATCH 26/63] fix(vnd): save vnode info at the begining of vnode prepare commit --- source/dnode/vnode/src/vnd/vnodeCommit.c | 67 +++++++++++++++++------- 1 file changed, 48 insertions(+), 19 deletions(-) diff --git a/source/dnode/vnode/src/vnd/vnodeCommit.c b/source/dnode/vnode/src/vnd/vnodeCommit.c index be977e7cbd..1aefe19476 100644 --- a/source/dnode/vnode/src/vnd/vnodeCommit.c +++ b/source/dnode/vnode/src/vnd/vnodeCommit.c @@ -184,16 +184,51 @@ _err: return -1; } -static void vnodePrepareCommit(SVnode *pVnode) { +static int32_t vnodePrepareCommit(SVnode *pVnode, SCommitInfo *pInfo) { + int32_t code = 0; + int32_t lino = 0; + char dir[TSDB_FILENAME_LEN] = {0}; + tsem_wait(&pVnode->canCommit); + pVnode->state.commitTerm = pVnode->state.applyTerm; + + pInfo->info.config = pVnode->config; + pInfo->info.state.committed = pVnode->state.applied; + pInfo->info.state.commitTerm = pVnode->state.applyTerm; + pInfo->info.state.commitID = pVnode->state.commitID; + pInfo->pVnode = pVnode; + pInfo->txn = metaGetTxn(pVnode->pMeta); + + // save info + if (pVnode->pTfs) { + snprintf(dir, TSDB_FILENAME_LEN, "%s%s%s", tfsGetPrimaryPath(pVnode->pTfs), TD_DIRSEP, pVnode->path); + } else { + snprintf(dir, TSDB_FILENAME_LEN, "%s", pVnode->path); + } + if (vnodeSaveInfo(dir, &pInfo->info) < 0) { + code = terrno; + TSDB_CHECK_CODE(code, lino, _exit); + } + tsdbPrepareCommit(pVnode->pTsdb); - metaPrepareAsyncCommit(pVnode->pMeta); smaPrepareAsyncCommit(pVnode->pSma); + metaPrepareAsyncCommit(pVnode->pMeta); + vnodeBufPoolUnRef(pVnode->inUse); pVnode->inUse = NULL; + +_exit: + if (code) { + vError("vgId:%d, %s failed at line %d since %s, commit id:%" PRId64, TD_VID(pVnode), __func__, lino, + tstrerror(code), pVnode->state.commitID); + } else { + vDebug("vgId:%d, %s done", TD_VID(pVnode), __func__); + } + return code; } + static int32_t vnodeCommitTask(void *arg) { int32_t code = 0; @@ -213,27 +248,26 @@ _exit: int vnodeAsyncCommit(SVnode *pVnode) { int32_t code = 0; - // prepare to commit - vnodePrepareCommit(pVnode); - - // schedule the task - pVnode->state.commitTerm = pVnode->state.applyTerm; - SCommitInfo *pInfo = (SCommitInfo *)taosMemoryCalloc(1, sizeof(*pInfo)); if (NULL == pInfo) { code = TSDB_CODE_OUT_OF_MEMORY; goto _exit; } - pInfo->info.config = pVnode->config; - pInfo->info.state.committed = pVnode->state.applied; - pInfo->info.state.commitTerm = pVnode->state.applyTerm; - pInfo->info.state.commitID = pVnode->state.commitID; - pInfo->pVnode = pVnode; - pInfo->txn = metaGetTxn(pVnode->pMeta); + + // prepare to commit + code = vnodePrepareCommit(pVnode, pInfo); + if (TSDB_CODE_SUCCESS != code) { + goto _exit; + } + + // schedule the task vnodeScheduleTask(vnodeCommitTask, pInfo); _exit: if (code) { + if (NULL != pInfo) { + taosMemoryFree(pInfo); + } vError("vgId:%d, %s failed since %s, commit id:%" PRId64, TD_VID(pVnode), __func__, tstrerror(code), pVnode->state.commitID); } else { @@ -265,16 +299,11 @@ static int vnodeCommitImpl(SCommitInfo *pInfo) { return -1; } - // save info if (pVnode->pTfs) { snprintf(dir, TSDB_FILENAME_LEN, "%s%s%s", tfsGetPrimaryPath(pVnode->pTfs), TD_DIRSEP, pVnode->path); } else { snprintf(dir, TSDB_FILENAME_LEN, "%s", pVnode->path); } - if (vnodeSaveInfo(dir, &pInfo->info) < 0) { - code = terrno; - TSDB_CHECK_CODE(code, lino, _exit); - } // walBeginSnapshot(pVnode->pWal, pVnode->state.applied); syncBeginSnapshot(pVnode->sync, pVnode->state.applied); From 70ffbabcbf5fa8d98b18835cd436b1100be4e722 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Mon, 26 Dec 2022 10:15:14 +0800 Subject: [PATCH 27/63] fix:remove assert --- source/libs/stream/src/streamState.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/source/libs/stream/src/streamState.c b/source/libs/stream/src/streamState.c index af1d738de0..6670bf463e 100644 --- a/source/libs/stream/src/streamState.c +++ b/source/libs/stream/src/streamState.c @@ -656,8 +656,7 @@ int32_t streamStateSessionClear(SStreamState* pState) { void* buf = NULL; int32_t size = 0; int32_t code = streamStateSessionGetKVByCur(pCur, &delKey, &buf, &size); - if (code == 0) { - ASSERT(size > 0); + if (code == 0 && size > 0) { memset(buf, 0, size); streamStateSessionPut(pState, &delKey, buf, size); } else { From a5165ab5e7dcff44dc050f2bbcfe57d879f187d3 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Mon, 26 Dec 2022 10:58:17 +0800 Subject: [PATCH 28/63] refactor: do some internal refactor. --- source/dnode/vnode/src/tsdb/tsdbMergeTree.c | 1 - source/dnode/vnode/src/tsdb/tsdbRead.c | 143 ++++++-------------- source/libs/executor/src/dataDeleter.c | 5 +- source/libs/executor/src/dataDispatcher.c | 13 +- source/libs/executor/src/exchangeoperator.c | 1 - source/libs/executor/src/executorimpl.c | 38 +----- source/libs/executor/src/joinoperator.c | 58 ++++---- source/libs/executor/src/sortoperator.c | 4 - source/libs/executor/src/tsimplehash.c | 5 +- source/libs/executor/src/tsort.c | 1 + 10 files changed, 85 insertions(+), 184 deletions(-) diff --git a/source/dnode/vnode/src/tsdb/tsdbMergeTree.c b/source/dnode/vnode/src/tsdb/tsdbMergeTree.c index 41bf823095..beb4303156 100644 --- a/source/dnode/vnode/src/tsdb/tsdbMergeTree.c +++ b/source/dnode/vnode/src/tsdb/tsdbMergeTree.c @@ -567,7 +567,6 @@ int32_t tMergeTreeOpen(SMergeTree *pMTree, int8_t backward, SDataFReader *pFRead pMTree->pLoadInfo = pBlockLoadInfo; pMTree->destroyLoadInfo = destroyLoadInfo; - ASSERT(pMTree->pLoadInfo != NULL); for (int32_t i = 0; i < pFReader->pSet->nSttF; ++i) { // open all last file struct SLDataIter *pIter = NULL; diff --git a/source/dnode/vnode/src/tsdb/tsdbRead.c b/source/dnode/vnode/src/tsdb/tsdbRead.c index 050d03cf73..346ad854df 100644 --- a/source/dnode/vnode/src/tsdb/tsdbRead.c +++ b/source/dnode/vnode/src/tsdb/tsdbRead.c @@ -243,7 +243,7 @@ static int32_t setColumnIdSlotList(SBlockLoadSuppInfo* pSupInfo, SColumnInfo* pC return TSDB_CODE_SUCCESS; } -static void updateBlockSMAInfo(STSchema* pSchema, SBlockLoadSuppInfo* pSupInfo) { +static int32_t updateBlockSMAInfo(STSchema* pSchema, SBlockLoadSuppInfo* pSupInfo) { int32_t i = 0, j = 0; while(i < pSchema->numOfCols && j < pSupInfo->numOfCols) { @@ -251,7 +251,7 @@ static void updateBlockSMAInfo(STSchema* pSchema, SBlockLoadSuppInfo* pSupInfo) if (pTCol->colId == pSupInfo->colId[j]) { if (!IS_BSMA_ON(pTCol)) { pSupInfo->smaValid = false; - return; + return TSDB_CODE_SUCCESS; } i += 1; @@ -260,9 +260,11 @@ static void updateBlockSMAInfo(STSchema* pSchema, SBlockLoadSuppInfo* pSupInfo) // do nothing i += 1; } else { - ASSERT(0); + return TSDB_CODE_INVALID_PARA; } } + + return TSDB_CODE_SUCCESS; } static int32_t initBlockScanInfoBuf(SBlockInfoBuf* pBuf, int32_t numOfTables) { @@ -579,7 +581,7 @@ static int32_t tsdbReaderCreate(SVnode* pVnode, SQueryTableDataCond* pCond, STsd } if (VND_IS_TSMA(pVnode)) { - tsdbDebug("vgId:%d, tsma is selected to query", TD_VID(pVnode)); + tsdbDebug("vgId:%d, tsma is selected to query, %s", TD_VID(pVnode), idstr); } initReaderStatus(&pReader->status); @@ -594,7 +596,6 @@ static int32_t tsdbReaderCreate(SVnode* pVnode, SQueryTableDataCond* pCond, STsd pReader->type = pCond->type; pReader->window = updateQueryTimeWindow(pReader->pTsdb, &pCond->twindows); pReader->blockInfoBuf.numPerBucket = 1000; // 1000 tables per bucket - ASSERT(pCond->numOfCols > 0); if (pReader->pResBlock == NULL) { pReader->freeBlock = true; @@ -605,6 +606,12 @@ static int32_t tsdbReaderCreate(SVnode* pVnode, SQueryTableDataCond* pCond, STsd } } + if (pCond->numOfCols <= 0) { + tsdbError("vgId:%d, invalid column number %d in query cond, %s", TD_VID(pVnode), pCond->numOfCols, idstr); + code = TSDB_CODE_INVALID_PARA; + goto _end; + } + // todo refactor. limitOutputBufferSize(pCond, &pReader->capacity); @@ -794,8 +801,9 @@ static void doCopyColVal(SColumnInfoData* pColInfoData, int32_t rowIndex, int32_ } static SFileDataBlockInfo* getCurrentBlockInfo(SDataBlockIter* pBlockIter) { - if (taosArrayGetSize(pBlockIter->blockList) == 0) { - ASSERT(pBlockIter->numOfBlocks == taosArrayGetSize(pBlockIter->blockList)); + size_t num = taosArrayGetSize(pBlockIter->blockList); + if (num == 0) { + ASSERT(pBlockIter->numOfBlocks == num); return NULL; } @@ -805,73 +813,6 @@ static SFileDataBlockInfo* getCurrentBlockInfo(SDataBlockIter* pBlockIter) { static SDataBlk* getCurrentBlock(SDataBlockIter* pBlockIter) { return &pBlockIter->block; } -int32_t binarySearchForTs(char* pValue, int num, TSKEY key, int order) { - int32_t midPos = -1; - int32_t numOfRows; - - ASSERT(order == TSDB_ORDER_ASC || order == TSDB_ORDER_DESC); - - TSKEY* keyList = (TSKEY*)pValue; - int32_t firstPos = 0; - int32_t lastPos = num - 1; - - if (order == TSDB_ORDER_DESC) { - // find the first position which is smaller than the key - while (1) { - if (key >= keyList[firstPos]) return firstPos; - if (key == keyList[lastPos]) return lastPos; - - if (key < keyList[lastPos]) { - lastPos += 1; - if (lastPos >= num) { - return -1; - } else { - return lastPos; - } - } - - numOfRows = lastPos - firstPos + 1; - midPos = (numOfRows >> 1) + firstPos; - - if (key < keyList[midPos]) { - firstPos = midPos + 1; - } else if (key > keyList[midPos]) { - lastPos = midPos - 1; - } else { - break; - } - } - - } else { - // find the first position which is bigger than the key - while (1) { - if (key <= keyList[firstPos]) return firstPos; - if (key == keyList[lastPos]) return lastPos; - - if (key > keyList[lastPos]) { - lastPos = lastPos + 1; - if (lastPos >= num) - return -1; - else - return lastPos; - } - - numOfRows = lastPos - firstPos + 1; - midPos = (numOfRows >> 1u) + firstPos; - - if (key < keyList[midPos]) { - lastPos = midPos - 1; - } else if (key > keyList[midPos]) { - firstPos = midPos + 1; - } else { - break; - } - } - } - - return midPos; -} - static int doBinarySearchKey(TSKEY* keyList, int num, int pos, TSKEY key, int order) { // start end position int s, e; @@ -972,8 +913,8 @@ static void copyNumericCols(const SColData* pData, SFileBlockDumpInfo* pDumpInfo int32_t step = asc? 1:-1; - // make sure it is aligned to 8bit - ASSERT((((uint64_t)pColData->pData) & (0x8 - 1)) == 0); + // make sure it is aligned to 8bit, the allocated memory address is aligned to 256bit +// ASSERT((((uint64_t)pColData->pData) & (0x8 - 1)) == 0); // 1. copy data in a batch model memcpy(pColData->pData, p, dumpedRows * tDataTypes[pData->type].bytes); @@ -1183,7 +1124,6 @@ static int32_t doLoadFileBlockData(STsdbReader* pReader, SDataBlockIter* pBlockI SFileDataBlockInfo* pBlockInfo = getCurrentBlockInfo(pBlockIter); SFileBlockDumpInfo* pDumpInfo = &pReader->status.fBlockDumpInfo; - ASSERT(pBlockInfo != NULL); SDataBlk* pBlock = getCurrentBlock(pBlockIter); code = tsdbReadDataBlock(pReader->pFileReader, pBlock, pBlockData); @@ -1221,8 +1161,6 @@ static void cleanupBlockOrderSupporter(SBlockOrderSupporter* pSup) { } static int32_t initBlockOrderSupporter(SBlockOrderSupporter* pSup, int32_t numOfTables) { - ASSERT(numOfTables >= 1); - pSup->numOfBlocksPerTable = taosMemoryCalloc(1, sizeof(int32_t) * numOfTables); pSup->indexPerTable = taosMemoryCalloc(1, sizeof(int32_t) * numOfTables); pSup->pDataBlockInfo = taosMemoryCalloc(1, POINTER_BYTES * numOfTables); @@ -1329,7 +1267,10 @@ static int32_t initBlockIterator(STsdbReader* pReader, SDataBlockIter* pBlockIte sup.numOfTables += 1; } - ASSERT(numOfBlocks == cnt); + if (numOfBlocks != cnt && sup.numOfTables != numOfTables) { + cleanupBlockOrderSupporter(&sup); + return TSDB_CODE_INVALID_PARA; + } // since there is only one table qualified, blocks are not sorted if (sup.numOfTables == 1) { @@ -1351,10 +1292,9 @@ static int32_t initBlockIterator(STsdbReader* pReader, SDataBlockIter* pBlockIte tsdbDebug("%p create data blocks info struct completed, %d blocks in %d tables %s", pReader, cnt, sup.numOfTables, pReader->idStr); - ASSERT(cnt <= numOfBlocks && sup.numOfTables <= numOfTables); - SMultiwayMergeTreeInfo* pTree = NULL; - uint8_t ret = tMergeTreeCreate(&pTree, sup.numOfTables, &sup, fileDataBlockOrderCompar); + + uint8_t ret = tMergeTreeCreate(&pTree, sup.numOfTables, &sup, fileDataBlockOrderCompar); if (ret != TSDB_CODE_SUCCESS) { cleanupBlockOrderSupporter(&sup); return TSDB_CODE_OUT_OF_MEMORY; @@ -1432,8 +1372,6 @@ static bool getNeighborBlockOfSameTable(SFileDataBlockInfo* pBlockInfo, STableBl } static int32_t findFileBlockInfoIndex(SDataBlockIter* pBlockIter, SFileDataBlockInfo* pFBlockInfo) { - ASSERT(pBlockIter != NULL && pFBlockInfo != NULL); - int32_t step = ASCENDING_TRAVERSE(pBlockIter->order) ? 1 : -1; int32_t index = pBlockIter->index; @@ -1924,7 +1862,6 @@ static int32_t doMergeFileBlockAndLastBlock(SLastBlockReader* pLastBlockReader, } doMergeRowsInLastBlock(pLastBlockReader, pBlockScanInfo, tsLastBlock, &merge, &pReader->verRange); - ASSERT(mergeBlockData); // merge with block data if ts == key if (tsLastBlock == pBlockData->aTSKEY[pDumpInfo->rowIndex]) { @@ -1990,7 +1927,6 @@ static int32_t mergeFileBlockAndLastBlock(STsdbReader* pReader, SLastBlockReader tRowMergerClear(&merge); return code; } else { - ASSERT(0); return TSDB_CODE_SUCCESS; } } else { // desc order @@ -2011,7 +1947,6 @@ static int32_t doMergeMultiLevelRows(STsdbReader* pReader, STableBlockScanInfo* TSDBROW* pRow = getValidMemRow(&pBlockScanInfo->iter, pDelList, pReader); TSDBROW* piRow = getValidMemRow(&pBlockScanInfo->iiter, pDelList, pReader); - ASSERT(pRow != NULL && piRow != NULL); int64_t tsLast = INT64_MIN; if (hasDataInLastBlock(pLastBlockReader)) { @@ -2235,7 +2170,6 @@ static int32_t initMemDataIterator(STableBlockScanInfo* pBlockScanInfo, STsdbRea if (pReader->pReadSnap->pMem != NULL) { d = tsdbGetTbDataFromMemTable(pReader->pReadSnap->pMem, pReader->suid, pBlockScanInfo->uid); if (d != NULL) { - ASSERT(pBlockScanInfo->iter.iter == NULL); code = tsdbTbDataIterCreate(d, &startKey, backward, &pBlockScanInfo->iter.iter); if (code == TSDB_CODE_SUCCESS) { pBlockScanInfo->iter.hasVal = (tsdbTbDataIterGet(pBlockScanInfo->iter.iter) != NULL); @@ -2349,10 +2283,9 @@ static int64_t getCurrentKeyInLastBlock(SLastBlockReader* pLastBlockReader) { static bool hasDataInLastBlock(SLastBlockReader* pLastBlockReader) { return pLastBlockReader->mergeTree.pIter != NULL; } bool hasDataInFileBlock(const SBlockData* pBlockData, const SFileBlockDumpInfo* pDumpInfo) { - if (pBlockData->nRow > 0) { - ASSERT(pBlockData->nRow == pDumpInfo->totalRows); + if ((pBlockData->nRow > 0) && (pBlockData->nRow != pDumpInfo->totalRows)) { + return false; // this is an invalid result. } - return pBlockData->nRow > 0 && (!pDumpInfo->allDumped); } @@ -2583,7 +2516,6 @@ int32_t initDelSkylineIterator(STableBlockScanInfo* pBlockScanInfo, STsdbReader* int32_t code = 0; SArray* pDelData = taosArrayInit(4, sizeof(SDelData)); - ASSERT(pReader->pReadSnap != NULL); SDelFile* pDelFile = pReader->pReadSnap->fs.pDelFile; if (pDelFile && taosArrayGetSize(pReader->pDelIdx) > 0) { @@ -2868,7 +2800,6 @@ static int32_t doBuildDataBlock(STsdbReader* pReader) { TSDBKEY keyInBuf = getCurrentKeyInBuf(pScanInfo, pReader); if (pBlockInfo == NULL) { // build data block from last data file - ASSERT(pBlockIter->numOfBlocks == 0); code = buildComposedDataBlock(pReader); } else if (fileBlockShouldLoad(pReader, pBlockInfo, pBlock, pScanInfo, keyInBuf, pLastBlockReader)) { code = doLoadFileBlockData(pReader, pBlockIter, &pStatus->fileBlockData, pScanInfo->uid); @@ -3837,7 +3768,10 @@ int32_t tsdbReaderOpen(SVnode* pVnode, SQueryTableDataCond* pCond, void* pTableL } if (pReader->pSchema != NULL) { - updateBlockSMAInfo(pReader->pSchema, &pReader->suppInfo); + code = updateBlockSMAInfo(pReader->pSchema, &pReader->suppInfo); + if (code != TSDB_CODE_SUCCESS) { + goto _err; + } } STsdbReader* p = (pReader->innerReader[0] != NULL) ? pReader->innerReader[0] : pReader; @@ -4113,25 +4047,27 @@ static void doFillNullColSMA(SBlockLoadSuppInfo* pSup, int32_t numOfRows, int32_ } int32_t tsdbRetrieveDatablockSMA(STsdbReader* pReader, SSDataBlock* pDataBlock, bool* allHave) { + SColumnDataAgg*** pBlockSMA = &pDataBlock->pBlockAgg; + int32_t code = 0; - SColumnDataAgg ***pBlockSMA = &pDataBlock->pBlockAgg; *allHave = false; + *pBlockSMA = NULL; if (pReader->type == TIMEWINDOW_RANGE_EXTERNAL) { - *pBlockSMA = NULL; return TSDB_CODE_SUCCESS; } // there is no statistics data for composed block if (pReader->status.composedDataBlock || (!pReader->suppInfo.smaValid)) { - *pBlockSMA = NULL; return TSDB_CODE_SUCCESS; } SFileDataBlockInfo* pFBlock = getCurrentBlockInfo(&pReader->status.blockIter); SBlockLoadSuppInfo* pSup = &pReader->suppInfo; - ASSERT(pReader->pResBlock->info.id.uid == pFBlock->uid); + if (pReader->pResBlock->info.id.uid != pFBlock->uid) { + return TSDB_CODE_SUCCESS; + } SDataBlk* pBlock = getCurrentBlock(&pReader->status.blockIter); if (tDataBlkHasSma(pBlock)) { @@ -4187,7 +4123,7 @@ int32_t tsdbRetrieveDatablockSMA(STsdbReader* pReader, SSDataBlock* pDataBlock, } else if (pAgg->colId < pSup->colId[j]) { i += 1; } else if (pSup->colId[j] < pAgg->colId) { - ASSERT(pSup->colId[j] == PRIMARYKEY_TIMESTAMP_COL_ID); + // ASSERT(pSup->colId[j] == PRIMARYKEY_TIMESTAMP_COL_ID); pResBlock->pBlockAgg[pSup->slotId[j]] = &pSup->tsColAgg; j += 1; } @@ -4418,9 +4354,12 @@ int32_t tsdbGetTableSchema(SVnode* pVnode, int64_t uid, STSchema** pSchema, int6 return terrno; } sversion = mr.me.stbEntry.schemaRow.version; - } else { - ASSERT(mr.me.type == TSDB_NORMAL_TABLE); + } else if (mr.me.type == TSDB_NORMAL_TABLE) { sversion = mr.me.ntbEntry.schemaRow.version; + } else { + terrno = TSDB_CODE_INVALID_PARA; + metaReaderClear(&mr); + return terrno; } metaReaderClear(&mr); diff --git a/source/libs/executor/src/dataDeleter.c b/source/libs/executor/src/dataDeleter.c index eff7a5ef93..a8051ea7c3 100644 --- a/source/libs/executor/src/dataDeleter.c +++ b/source/libs/executor/src/dataDeleter.c @@ -62,8 +62,8 @@ static void toDataCacheEntry(SDataDeleterHandle* pHandle, const SInputData* pInp pEntry->numOfCols = taosArrayGetSize(pInput->pData->pDataBlock); pEntry->dataLen = sizeof(SDeleterRes); - ASSERT(1 == pEntry->numOfRows); - ASSERT(3 == pEntry->numOfCols); +// ASSERT(1 == pEntry->numOfRows); +// ASSERT(3 == pEntry->numOfCols); pBuf->useSize = sizeof(SDataCacheEntry); @@ -167,7 +167,6 @@ static void getDataLength(SDataSinkHandle* pHandle, int64_t* pLen, bool* pQueryE SDataDeleterBuf* pBuf = NULL; taosReadQitem(pDeleter->pDataBlocks, (void**)&pBuf); - ASSERT(NULL != pBuf); memcpy(&pDeleter->nextOutput, pBuf, sizeof(SDataDeleterBuf)); taosFreeQitem(pBuf); diff --git a/source/libs/executor/src/dataDispatcher.c b/source/libs/executor/src/dataDispatcher.c index c2fa438c80..a603bffba5 100644 --- a/source/libs/executor/src/dataDispatcher.c +++ b/source/libs/executor/src/dataDispatcher.c @@ -77,8 +77,8 @@ static void toDataCacheEntry(SDataDispatchHandle* pHandle, const SInputData* pIn pBuf->useSize = sizeof(SDataCacheEntry); 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)); +// ASSERT(pEntry->numOfRows == *(int32_t*)(pEntry->data + 8)); +// ASSERT(pEntry->numOfCols == *(int32_t*)(pEntry->data + 8 + 4)); pBuf->useSize += pEntry->dataLen; @@ -162,15 +162,14 @@ static void getDataLength(SDataSinkHandle* pHandle, int64_t* pLen, bool* pQueryE SDataDispatchBuf* pBuf = NULL; taosReadQitem(pDispatcher->pDataBlocks, (void**)&pBuf); - ASSERT(NULL != pBuf); memcpy(&pDispatcher->nextOutput, pBuf, sizeof(SDataDispatchBuf)); taosFreeQitem(pBuf); SDataCacheEntry* pEntry = (SDataCacheEntry*)pDispatcher->nextOutput.pData; *pLen = pEntry->dataLen; - ASSERT(pEntry->numOfRows == *(int32_t*)(pEntry->data + 8)); - ASSERT(pEntry->numOfCols == *(int32_t*)(pEntry->data + 8 + 4)); +// ASSERT(pEntry->numOfRows == *(int32_t*)(pEntry->data + 8)); +// ASSERT(pEntry->numOfCols == *(int32_t*)(pEntry->data + 8 + 4)); *pQueryEnd = pDispatcher->queryEnd; qDebug("got data len %" PRId64 ", row num %d in sink", *pLen, @@ -193,8 +192,8 @@ static int32_t getDataBlock(SDataSinkHandle* pHandle, SOutputData* pOutput) { pOutput->numOfCols = pEntry->numOfCols; pOutput->compressed = pEntry->compressed; - ASSERT(pEntry->numOfRows == *(int32_t*)(pEntry->data + 8)); - ASSERT(pEntry->numOfCols == *(int32_t*)(pEntry->data + 8 + 4)); +// ASSERT(pEntry->numOfRows == *(int32_t*)(pEntry->data + 8)); +// ASSERT(pEntry->numOfCols == *(int32_t*)(pEntry->data + 8 + 4)); atomic_sub_fetch_64(&pDispatcher->cachedSize, pEntry->dataLen); atomic_sub_fetch_64(&gDataSinkStat.cachedSize, pEntry->dataLen); diff --git a/source/libs/executor/src/exchangeoperator.c b/source/libs/executor/src/exchangeoperator.c index 4103ca82dc..9873c52006 100644 --- a/source/libs/executor/src/exchangeoperator.c +++ b/source/libs/executor/src/exchangeoperator.c @@ -373,7 +373,6 @@ int32_t loadRemoteDataCallback(void* param, SDataBuf* pMsg, int32_t code) { pRsp->useconds = htobe64(pRsp->useconds); pRsp->numOfBlocks = htonl(pRsp->numOfBlocks); - ASSERT(pRsp != NULL); qDebug("%s fetch rsp received, index:%d, blocks:%d, rows:%" PRId64 ", %p", pSourceDataInfo->taskId, index, pRsp->numOfBlocks, pRsp->numOfRows, pExchangeInfo); } else { diff --git a/source/libs/executor/src/executorimpl.c b/source/libs/executor/src/executorimpl.c index 668a93740d..fde13498ea 100644 --- a/source/libs/executor/src/executorimpl.c +++ b/source/libs/executor/src/executorimpl.c @@ -104,8 +104,6 @@ static int32_t doCopyToSDataBlock(SExecTaskInfo* pTaskInfo, SSDataBlock* pBlock, void setOperatorCompleted(SOperatorInfo* pOperator) { pOperator->status = OP_EXEC_DONE; - ASSERT(pOperator->pTaskInfo != NULL); - pOperator->cost.totalCost = (taosGetTimestampUs() - pOperator->pTaskInfo->cost.start) / 1000.0; setTaskStatus(pOperator->pTaskInfo, TASK_COMPLETED); } @@ -524,7 +522,7 @@ bool functionNeedToExecute(SqlFunctionCtx* pCtx) { return true; } -static int32_t doCreateConstantValColumnAggInfo(SInputColumnInfoData* pInput, SFunctParam* pFuncParam, int32_t type, +static int32_t doCreateConstantValColumnSMAInfo(SInputColumnInfoData* pInput, SFunctParam* pFuncParam, int32_t type, int32_t paramIndex, int32_t numOfRows) { if (pInput->pData[paramIndex] == NULL) { pInput->pData[paramIndex] = taosMemoryCalloc(1, sizeof(SColumnInfoData)); @@ -548,8 +546,6 @@ static int32_t doCreateConstantValColumnAggInfo(SInputColumnInfoData* pInput, SF da = pInput->pColumnDataAgg[paramIndex]; } - ASSERT(!IS_VAR_DATA_TYPE(type)); - if (type == TSDB_DATA_TYPE_BIGINT) { int64_t v = pFuncParam->param.i; *da = (SColumnDataAgg){.numOfNull = 0, .min = v, .max = v, .sum = v * numOfRows}; @@ -570,7 +566,7 @@ static int32_t doCreateConstantValColumnAggInfo(SInputColumnInfoData* pInput, SF } else if (type == TSDB_DATA_TYPE_TIMESTAMP) { // do nothing } else { - ASSERT(0); + qError("invalid constant type for sma info"); } return TSDB_CODE_SUCCESS; @@ -600,7 +596,7 @@ void setBlockSMAInfo(SqlFunctionCtx* pCtx, SExprInfo* pExprInfo, SSDataBlock* pB // the data in the corresponding SColumnInfoData will not be used. pInput->pData[j] = taosArrayGet(pBlock->pDataBlock, slotId); } else if (pFuncParam->type == FUNC_PARAM_TYPE_VALUE) { - doCreateConstantValColumnAggInfo(pInput, pFuncParam, pFuncParam->param.nType, j, pBlock->info.rows); + doCreateConstantValColumnSMAInfo(pInput, pFuncParam, pFuncParam->param.nType, j, pBlock->info.rows); } } } else { @@ -2217,13 +2213,11 @@ int32_t extractTableScanNode(SPhysiNode* pNode, STableScanPhysiNode** ppNode) { *ppNode = (STableScanPhysiNode*)pNode; return 0; } else { - ASSERT(0); terrno = TSDB_CODE_APP_ERROR; return -1; } } else { if (LIST_LENGTH(pNode->pChildren) != 1) { - ASSERT(0); terrno = TSDB_CODE_APP_ERROR; return -1; } @@ -2233,32 +2227,6 @@ int32_t extractTableScanNode(SPhysiNode* pNode, STableScanPhysiNode** ppNode) { return -1; } -#if 0 -int32_t rebuildReader(SOperatorInfo* pOperator, SSubplan* plan, SReadHandle* pHandle, int64_t uid, int64_t ts) { - STableScanInfo* pTableScanInfo = NULL; - if (extractTbscanInStreamOpTree(pOperator, &pTableScanInfo) < 0) { - return -1; - } - - STableScanPhysiNode* pNode = NULL; - if (extractTableScanNode(plan->pNode, &pNode) < 0) { - ASSERT(0); - } - - tsdbReaderClose(pTableScanInfo->dataReader); - - STableListInfo info = {0}; - pTableScanInfo->dataReader = doCreateDataReader(pNode, pHandle, &info, NULL); - if (pTableScanInfo->dataReader == NULL) { - ASSERT(0); - qError("failed to create data reader"); - return TSDB_CODE_APP_ERROR; - } - // TODO: set uid and ts to data reader - return 0; -} -#endif - int32_t createDataSinkParam(SDataSinkNode* pNode, void** pParam, qTaskInfo_t* pTaskInfo, SReadHandle* readHandle) { SExecTaskInfo* pTask = *(SExecTaskInfo**)pTaskInfo; diff --git a/source/libs/executor/src/joinoperator.c b/source/libs/executor/src/joinoperator.c index 8a097a23ce..88ed9eccb3 100644 --- a/source/libs/executor/src/joinoperator.c +++ b/source/libs/executor/src/joinoperator.c @@ -42,38 +42,40 @@ typedef struct SJoinOperatorInfo { static void setJoinColumnInfo(SColumnInfo* pColumn, const SColumnNode* pColumnNode); static SSDataBlock* doMergeJoin(struct SOperatorInfo* pOperator); static void destroyMergeJoinOperator(void* param); -static void extractTimeCondition(SJoinOperatorInfo* pInfo, SOperatorInfo** pDownstream, int32_t numOfDownstream, - SSortMergeJoinPhysiNode* pJoinNode); +static void extractTimeCondition(SJoinOperatorInfo* pInfo, SOperatorInfo** pDownstream, int32_t num, + SSortMergeJoinPhysiNode* pJoinNode, const char* idStr); -static void extractTimeCondition(SJoinOperatorInfo* pInfo, SOperatorInfo** pDownstream, int32_t numOfDownstream, - SSortMergeJoinPhysiNode* pJoinNode) { +static void extractTimeCondition(SJoinOperatorInfo* pInfo, SOperatorInfo** pDownstream, int32_t num, + SSortMergeJoinPhysiNode* pJoinNode, const char* idStr) { SNode* pMergeCondition = pJoinNode->pMergeCondition; - if (nodeType(pMergeCondition) == QUERY_NODE_OPERATOR) { - SOperatorNode* pNode = (SOperatorNode*)pMergeCondition; - SColumnNode* col1 = (SColumnNode*)pNode->pLeft; - SColumnNode* col2 = (SColumnNode*)pNode->pRight; - SColumnNode* leftTsCol = NULL; - SColumnNode* rightTsCol = NULL; - if (col1->dataBlockId == col2->dataBlockId ) { + if (nodeType(pMergeCondition) != QUERY_NODE_OPERATOR) { + qError("not support this in join operator, %s", idStr); + return; // do not handle this + } + + SOperatorNode* pNode = (SOperatorNode*)pMergeCondition; + SColumnNode* col1 = (SColumnNode*)pNode->pLeft; + SColumnNode* col2 = (SColumnNode*)pNode->pRight; + SColumnNode* leftTsCol = NULL; + SColumnNode* rightTsCol = NULL; + if (col1->dataBlockId == col2->dataBlockId) { + leftTsCol = col1; + rightTsCol = col2; + } else { + if (col1->dataBlockId == pDownstream[0]->resultDataBlockId) { + ASSERT(col2->dataBlockId == pDownstream[1]->resultDataBlockId); leftTsCol = col1; rightTsCol = col2; } else { - if (col1->dataBlockId == pDownstream[0]->resultDataBlockId) { - ASSERT(col2->dataBlockId == pDownstream[1]->resultDataBlockId); - leftTsCol = col1; - rightTsCol = col2; - } else { - ASSERT(col1->dataBlockId == pDownstream[1]->resultDataBlockId); - ASSERT(col2->dataBlockId == pDownstream[0]->resultDataBlockId); - leftTsCol = col2; - rightTsCol = col1; - } + ASSERT(col1->dataBlockId == pDownstream[1]->resultDataBlockId); + ASSERT(col2->dataBlockId == pDownstream[0]->resultDataBlockId); + leftTsCol = col2; + rightTsCol = col1; } - setJoinColumnInfo(&pInfo->leftCol, leftTsCol); - setJoinColumnInfo(&pInfo->rightCol, rightTsCol); - } else { - ASSERT(false); - }} + } + setJoinColumnInfo(&pInfo->leftCol, leftTsCol); + setJoinColumnInfo(&pInfo->rightCol, rightTsCol); +} SOperatorInfo* createMergeJoinOperatorInfo(SOperatorInfo** pDownstream, int32_t numOfDownstream, SSortMergeJoinPhysiNode* pJoinNode, SExecTaskInfo* pTaskInfo) { @@ -97,7 +99,7 @@ SOperatorInfo* createMergeJoinOperatorInfo(SOperatorInfo** pDownstream, int32_t pOperator->exprSupp.pExprInfo = pExprInfo; pOperator->exprSupp.numOfExprs = numOfCols; - extractTimeCondition(pInfo, pDownstream, numOfDownstream, pJoinNode); + extractTimeCondition(pInfo, pDownstream, numOfDownstream, pJoinNode, GET_TASKID(pTaskInfo)); if (pJoinNode->pOnConditions != NULL && pJoinNode->node.pConditions != NULL) { pInfo->pCondAfterMerge = nodesMakeNode(QUERY_NODE_LOGIC_CONDITION); @@ -364,8 +366,6 @@ static bool mergeJoinGetNextTimestamp(SOperatorInfo* pOperator, int64_t* pLeftTs char* pRightVal = colDataGetData(pRightCol, pJoinInfo->rightPos); *pRightTs = *(int64_t*)pRightVal; - ASSERT(pLeftCol->info.type == TSDB_DATA_TYPE_TIMESTAMP); - ASSERT(pRightCol->info.type == TSDB_DATA_TYPE_TIMESTAMP); return true; } diff --git a/source/libs/executor/src/sortoperator.c b/source/libs/executor/src/sortoperator.c index 7ac007b7cb..ee7f88e813 100644 --- a/source/libs/executor/src/sortoperator.c +++ b/source/libs/executor/src/sortoperator.c @@ -139,7 +139,6 @@ SSDataBlock* getSortedBlockData(SSortHandle* pHandle, SSDataBlock* pDataBlock, i int32_t numOfCols = taosArrayGetSize(pColMatchInfo); for (int32_t i = 0; i < numOfCols; ++i) { SColMatchItem* pmInfo = taosArrayGet(pColMatchInfo, i); - // ASSERT(pmInfo->matchType == COL_MATCH_FROM_SLOT_ID); SColumnInfoData* pSrc = taosArrayGet(p->pDataBlock, pmInfo->srcSlotId); SColumnInfoData* pDst = taosArrayGet(pDataBlock->pDataBlock, pmInfo->dstSlotId); @@ -272,7 +271,6 @@ void destroySortOperatorInfo(void* param) { } int32_t getExplainExecInfo(SOperatorInfo* pOptr, void** pOptrExplain, uint32_t* len) { - ASSERT(pOptr != NULL); SSortExecInfo* pInfo = taosMemoryCalloc(1, sizeof(SSortExecInfo)); SSortOperatorInfo* pOperatorInfo = (SSortOperatorInfo*)pOptr->info; @@ -329,7 +327,6 @@ SSDataBlock* getGroupSortedBlockData(SSortHandle* pHandle, SSDataBlock* pDataBlo int32_t numOfCols = taosArrayGetSize(pColMatchInfo); for (int32_t i = 0; i < numOfCols; ++i) { SColMatchItem* pmInfo = taosArrayGet(pColMatchInfo, i); - // ASSERT(pmInfo->matchType == COL_MATCH_FROM_SLOT_ID); SColumnInfoData* pSrc = taosArrayGet(p->pDataBlock, pmInfo->srcSlotId); SColumnInfoData* pDst = taosArrayGet(pDataBlock->pDataBlock, pmInfo->dstSlotId); @@ -746,7 +743,6 @@ void destroyMultiwayMergeOperatorInfo(void* param) { } int32_t getMultiwayMergeExplainExecInfo(SOperatorInfo* pOptr, void** pOptrExplain, uint32_t* len) { - ASSERT(pOptr != NULL); SSortExecInfo* pSortExecInfo = taosMemoryCalloc(1, sizeof(SSortExecInfo)); SMultiwayMergeOperatorInfo* pInfo = (SMultiwayMergeOperatorInfo*)pOptr->info; diff --git a/source/libs/executor/src/tsimplehash.c b/source/libs/executor/src/tsimplehash.c index 484d917069..fd6215e3a1 100644 --- a/source/libs/executor/src/tsimplehash.c +++ b/source/libs/executor/src/tsimplehash.c @@ -49,7 +49,9 @@ static FORCE_INLINE int32_t taosHashCapacity(int32_t length) { } SSHashObj *tSimpleHashInit(size_t capacity, _hash_fn_t fn) { - ASSERT(fn != NULL); + if (fn == NULL) { + return NULL; + } if (capacity == 0) { capacity = 4; @@ -66,7 +68,6 @@ SSHashObj *tSimpleHashInit(size_t capacity, _hash_fn_t fn) { pHashObj->equalFp = memcmp; pHashObj->hashFp = fn; - ASSERT((pHashObj->capacity & (pHashObj->capacity - 1)) == 0); pHashObj->hashList = (SHNode **)taosMemoryCalloc(pHashObj->capacity, sizeof(void *)); if (!pHashObj->hashList) { diff --git a/source/libs/executor/src/tsort.c b/source/libs/executor/src/tsort.c index 30911887bb..fa0cdb3943 100644 --- a/source/libs/executor/src/tsort.c +++ b/source/libs/executor/src/tsort.c @@ -800,6 +800,7 @@ STupleHandle* tsortNextTuple(SSortHandle* pHandle) { } } + // all sources are completed. if (pHandle->cmpParam.numOfSources == pHandle->numOfCompletedSources) { return NULL; } From 1a07451bc3cd629ac62b38b774ca54f6407c6dbc Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Mon, 26 Dec 2022 13:45:25 +0800 Subject: [PATCH 29/63] refactor: do some internal refactor. --- source/dnode/vnode/src/tsdb/tsdbRead.c | 12 +++++------- source/libs/executor/src/executorimpl.c | 4 +--- source/libs/executor/src/scanoperator.c | 24 ------------------------ 3 files changed, 6 insertions(+), 34 deletions(-) diff --git a/source/dnode/vnode/src/tsdb/tsdbRead.c b/source/dnode/vnode/src/tsdb/tsdbRead.c index 346ad854df..d69b8da667 100644 --- a/source/dnode/vnode/src/tsdb/tsdbRead.c +++ b/source/dnode/vnode/src/tsdb/tsdbRead.c @@ -4095,13 +4095,10 @@ int32_t tsdbRetrieveDatablockSMA(STsdbReader* pReader, SSDataBlock* pDataBlock, // update the number of NULL data rows size_t numOfCols = pSup->numOfCols; - int32_t i = 0, j = 0; - size_t size = taosArrayGetSize(pSup->pColAgg); - // ensure capacity - if(pDataBlock->pDataBlock) { - size_t colsNum = taosArrayGetSize(pDataBlock->pDataBlock); - taosArrayEnsureCap(pSup->pColAgg, colsNum); + if (pDataBlock->pDataBlock) { + size_t colsNum = taosArrayGetSize(pDataBlock->pDataBlock); + taosArrayEnsureCap(pSup->pColAgg, colsNum); } SSDataBlock* pResBlock = pReader->pResBlock; @@ -4112,8 +4109,9 @@ int32_t tsdbRetrieveDatablockSMA(STsdbReader* pReader, SSDataBlock* pDataBlock, // do fill all null column value SMA info doFillNullColSMA(pSup, pBlock->nRow, numOfCols, pTsAgg); + size_t size = taosArrayGetSize(pSup->pColAgg); - i = 0, j = 0; + int32_t i = 0, j = 0; while (j < numOfCols && i < size) { SColumnDataAgg* pAgg = taosArrayGet(pSup->pColAgg, i); if (pAgg->colId == pSup->colId[j]) { diff --git a/source/libs/executor/src/executorimpl.c b/source/libs/executor/src/executorimpl.c index fde13498ea..9a5729e161 100644 --- a/source/libs/executor/src/executorimpl.c +++ b/source/libs/executor/src/executorimpl.c @@ -1573,8 +1573,7 @@ void destroyOperatorInfo(SOperatorInfo* pOperator) { // each operator should be set their own function to return total cost buffer int32_t optrDefaultBufFn(SOperatorInfo* pOperator) { if (pOperator->blocking) { - ASSERT(0); - return 0; + return -1; } else { return 0; } @@ -2201,7 +2200,6 @@ static int32_t extractTbscanInStreamOpTree(SOperatorInfo* pOperator, STableScanI return extractTbscanInStreamOpTree(pOperator->pDownstream[0], ppInfo); } else { SStreamScanInfo* pInfo = pOperator->info; - ASSERT(pInfo->pTableScanOp->operatorType == QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN); *ppInfo = pInfo->pTableScanOp->info; return 0; } diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index d074ceede8..b23f5c4b6e 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -232,30 +232,6 @@ static bool doLoadBlockSMA(STableScanBase* pTableScanInfo, SSDataBlock* pBlock, if (!allColumnsHaveAgg) { return false; } - -#if 0 - // if (allColumnsHaveAgg == true) { - int32_t numOfCols = taosArrayGetSize(pBlock->pDataBlock); - - // todo create this buffer during creating operator - if (pBlock->pBlockAgg == NULL) { - pBlock->pBlockAgg = taosMemoryCalloc(numOfCols, POINTER_BYTES); - if (pBlock->pBlockAgg == NULL) { - T_LONG_JMP(pTaskInfo->env, TSDB_CODE_OUT_OF_MEMORY); - } - } - - size_t num = taosArrayGetSize(pTableScanInfo->matchInfo.pList); - for (int32_t i = 0; i < num; ++i) { - SColMatchItem* pColMatchInfo = taosArrayGet(pTableScanInfo->matchInfo.pList, i); - if (!pColMatchInfo->needOutput) { - continue; - } - - pBlock->pBlockAgg[pColMatchInfo->dstSlotId] = pColAgg[i]; - } -#endif - return true; } From f54f6201be005cb489910326ab2821d88523dd90 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Mon, 26 Dec 2022 14:07:22 +0800 Subject: [PATCH 30/63] fix(query): fix coverity issues. --- source/dnode/vnode/src/tsdb/tsdbRead.c | 2 -- source/libs/executor/src/scanoperator.c | 4 +++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/source/dnode/vnode/src/tsdb/tsdbRead.c b/source/dnode/vnode/src/tsdb/tsdbRead.c index d69b8da667..4f9e419f78 100644 --- a/source/dnode/vnode/src/tsdb/tsdbRead.c +++ b/source/dnode/vnode/src/tsdb/tsdbRead.c @@ -3777,9 +3777,7 @@ int32_t tsdbReaderOpen(SVnode* pVnode, SQueryTableDataCond* pCond, void* pTableL STsdbReader* p = (pReader->innerReader[0] != NULL) ? pReader->innerReader[0] : pReader; pReader->status.pTableMap = createDataBlockScanInfo(p, &pReader->blockInfoBuf, pTableList, numOfTables); if (pReader->status.pTableMap == NULL) { - tsdbReaderClose(p); *ppReader = NULL; - code = TSDB_CODE_OUT_OF_MEMORY; goto _err; } diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index b23f5c4b6e..0d7098a8ea 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -2182,6 +2182,7 @@ static void destroyStreamScanOperatorInfo(void* param) { SOperatorInfo* createStreamScanOperatorInfo(SReadHandle* pHandle, STableScanPhysiNode* pTableScanNode, SNode* pTagCond, SExecTaskInfo* pTaskInfo) { + SArray* pColIds = NULL; SStreamScanInfo* pInfo = taosMemoryCalloc(1, sizeof(SStreamScanInfo)); SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo)); @@ -2204,7 +2205,7 @@ SOperatorInfo* createStreamScanOperatorInfo(SReadHandle* pHandle, STableScanPhys } int32_t numOfOutput = taosArrayGetSize(pInfo->matchInfo.pList); - SArray* pColIds = taosArrayInit(numOfOutput, sizeof(int16_t)); + pColIds = taosArrayInit(numOfOutput, sizeof(int16_t)); for (int32_t i = 0; i < numOfOutput; ++i) { SColMatchItem* id = taosArrayGet(pInfo->matchInfo.pList, i); @@ -2300,6 +2301,7 @@ SOperatorInfo* createStreamScanOperatorInfo(SReadHandle* pHandle, STableScanPhys memcpy(&pTaskInfo->streamInfo.tableCond, &pTSInfo->base.cond, sizeof(SQueryTableDataCond)); } else { taosArrayDestroy(pColIds); + pColIds = NULL; } // create the pseduo columns info From 8a4fb244fbbb2f7fd47bd6513b8fc1ccd714b239 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Mon, 26 Dec 2022 14:20:05 +0800 Subject: [PATCH 31/63] fix(query): fix coverity issues. --- source/dnode/vnode/src/tsdb/tsdbRead.c | 11 ++++++++++- source/libs/executor/src/sortoperator.c | 15 ++++++++++----- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/source/dnode/vnode/src/tsdb/tsdbRead.c b/source/dnode/vnode/src/tsdb/tsdbRead.c index 4f9e419f78..a18533cf56 100644 --- a/source/dnode/vnode/src/tsdb/tsdbRead.c +++ b/source/dnode/vnode/src/tsdb/tsdbRead.c @@ -1013,11 +1013,20 @@ static int32_t copyBlockDataToSDataBlock(STsdbReader* pReader, STableBlockScanIn // pDumpInfo->rowIndex = 0; } else if (!asc && pReader->window.ekey >= pBlock->maxKey.ts) { // pDumpInfo->rowIndex = pBlock->nRow - 1; - } else { + } else { // find the appropriate the start position in current block, and set it to be the current rowIndex int32_t pos = asc ? pBlock->nRow - 1 : 0; int32_t order = asc ? TSDB_ORDER_DESC : TSDB_ORDER_ASC; int64_t key = asc ? pReader->window.skey : pReader->window.ekey; pDumpInfo->rowIndex = doBinarySearchKey(pBlockData->aTSKEY, pBlock->nRow, pos, key, order); + + if (pDumpInfo->rowIndex < 0) { + tsdbError( + "%p failed to locate the start position in current block, global index:%d, table index:%d, brange:%" PRId64 + "-%" PRId64 ", minVer:%" PRId64 ", maxVer:%" PRId64 " %s", + pReader, pBlockIter->index, pBlockInfo->tbBlockIdx, pBlock->minKey.ts, pBlock->maxKey.ts, pBlock->minVer, + pBlock->maxVer, pReader->idStr); + return TSDB_CODE_INVALID_PARA; + } } } diff --git a/source/libs/executor/src/sortoperator.c b/source/libs/executor/src/sortoperator.c index ee7f88e813..f5dc6cc623 100644 --- a/source/libs/executor/src/sortoperator.c +++ b/source/libs/executor/src/sortoperator.c @@ -46,13 +46,15 @@ SOperatorInfo* createSortOperatorInfo(SOperatorInfo* downstream, SSortPhysiNode* pOperator->pTaskInfo = pTaskInfo; SDataBlockDescNode* pDescNode = pSortNode->node.pOutputDataBlockDesc; - int32_t numOfCols = 0; - SSDataBlock* pResBlock = createDataBlockFromDescNode(pDescNode); - SExprInfo* pExprInfo = createExprInfo(pSortNode->pExprs, NULL, &numOfCols); + int32_t numOfCols = 0; + SExprInfo* pExprInfo = createExprInfo(pSortNode->pExprs, NULL, &numOfCols); int32_t numOfOutputCols = 0; int32_t code = extractColMatchInfo(pSortNode->pTargets, pDescNode, &numOfOutputCols, COL_MATCH_FROM_SLOT_ID, &pInfo->matchInfo); + if (code != TSDB_CODE_SUCCESS) { + goto _error; + } pOperator->exprSupp.pCtx = createSqlFunctionCtx(pExprInfo, numOfCols, &pOperator->exprSupp.rowEntryInfoOffset); initResultSizeInfo(&pOperator->resultInfo, 1024); @@ -61,7 +63,7 @@ SOperatorInfo* createSortOperatorInfo(SOperatorInfo* downstream, SSortPhysiNode* goto _error; } - pInfo->binfo.pRes = pResBlock; + pInfo->binfo.pRes = createDataBlockFromDescNode(pDescNode); pInfo->pSortInfo = createSortInfo(pSortNode->pSortKeys); initLimitInfo(pSortNode->node.pLimit, pSortNode->node.pSlimit, &pInfo->limitInfo); @@ -86,7 +88,10 @@ SOperatorInfo* createSortOperatorInfo(SOperatorInfo* downstream, SSortPhysiNode* _error: pTaskInfo->code = TSDB_CODE_OUT_OF_MEMORY; - taosMemoryFree(pInfo); + if (pInfo != NULL) { + destroySortOperatorInfo(pInfo); + } + taosMemoryFree(pOperator); return NULL; } From 668a26c1b0bd83f421af0f2b0f4a60db638abd04 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Mon, 26 Dec 2022 15:03:18 +0800 Subject: [PATCH 32/63] enh: handle error while transfer snapshot --- source/libs/sync/inc/syncInt.h | 2 +- source/libs/sync/inc/syncPipeline.h | 2 +- source/libs/sync/inc/syncSnapshot.h | 6 +- source/libs/sync/src/syncMain.c | 90 +++++++------- source/libs/sync/src/syncPipeline.c | 5 +- source/libs/sync/src/syncSnapshot.c | 179 ++++++++++++---------------- 6 files changed, 130 insertions(+), 154 deletions(-) diff --git a/source/libs/sync/inc/syncInt.h b/source/libs/sync/inc/syncInt.h index 6af60af43d..b5227152df 100644 --- a/source/libs/sync/inc/syncInt.h +++ b/source/libs/sync/inc/syncInt.h @@ -238,7 +238,7 @@ int32_t syncNodeStopPingTimer(SSyncNode* pSyncNode); int32_t syncNodeStartElectTimer(SSyncNode* pSyncNode, int32_t ms); int32_t syncNodeStopElectTimer(SSyncNode* pSyncNode); int32_t syncNodeRestartElectTimer(SSyncNode* pSyncNode, int32_t ms); -int32_t syncNodeResetElectTimer(SSyncNode* pSyncNode); +void syncNodeResetElectTimer(SSyncNode* pSyncNode); int32_t syncNodeStartHeartbeatTimer(SSyncNode* pSyncNode); int32_t syncNodeStopHeartbeatTimer(SSyncNode* pSyncNode); int32_t syncNodeRestartHeartbeatTimer(SSyncNode* pSyncNode); diff --git a/source/libs/sync/inc/syncPipeline.h b/source/libs/sync/inc/syncPipeline.h index 8c7edf85ff..9188be2b42 100644 --- a/source/libs/sync/inc/syncPipeline.h +++ b/source/libs/sync/inc/syncPipeline.h @@ -61,7 +61,7 @@ typedef struct SSyncLogBuffer { // SSyncLogRepMgr SSyncLogReplMgr* syncLogReplMgrCreate(); void syncLogReplMgrDestroy(SSyncLogReplMgr* pMgr); -int32_t syncLogReplMgrReset(SSyncLogReplMgr* pMgr); +void syncLogReplMgrReset(SSyncLogReplMgr* pMgr); int32_t syncNodeLogReplMgrInit(SSyncNode* pNode); void syncNodeLogReplMgrDestroy(SSyncNode* pNode); diff --git a/source/libs/sync/inc/syncSnapshot.h b/source/libs/sync/inc/syncSnapshot.h index 2b6e14a457..974a8f968e 100644 --- a/source/libs/sync/inc/syncSnapshot.h +++ b/source/libs/sync/inc/syncSnapshot.h @@ -56,7 +56,7 @@ SSyncSnapshotSender *snapshotSenderCreate(SSyncNode *pSyncNode, int32_t replicaI void snapshotSenderDestroy(SSyncSnapshotSender *pSender); bool snapshotSenderIsStart(SSyncSnapshotSender *pSender); int32_t snapshotSenderStart(SSyncSnapshotSender *pSender); -int32_t snapshotSenderStop(SSyncSnapshotSender *pSender, bool finish); +void snapshotSenderStop(SSyncSnapshotSender *pSender, bool finish); int32_t snapshotSend(SSyncSnapshotSender *pSender); int32_t snapshotReSend(SSyncSnapshotSender *pSender); @@ -79,8 +79,8 @@ typedef struct SSyncSnapshotReceiver { SSyncSnapshotReceiver *snapshotReceiverCreate(SSyncNode *pSyncNode, SRaftId fromId); void snapshotReceiverDestroy(SSyncSnapshotReceiver *pReceiver); -int32_t snapshotReceiverStart(SSyncSnapshotReceiver *pReceiver, SyncSnapshotSend *pBeginMsg); -int32_t snapshotReceiverStop(SSyncSnapshotReceiver *pReceiver); +void snapshotReceiverStart(SSyncSnapshotReceiver *pReceiver, SyncSnapshotSend *pBeginMsg); +void snapshotReceiverStop(SSyncSnapshotReceiver *pReceiver); bool snapshotReceiverIsStart(SSyncSnapshotReceiver *pReceiver); void snapshotReceiverForceStop(SSyncSnapshotReceiver *pReceiver); diff --git a/source/libs/sync/src/syncMain.c b/source/libs/sync/src/syncMain.c index f1aa9312c6..152e16bd2e 100644 --- a/source/libs/sync/src/syncMain.c +++ b/source/libs/sync/src/syncMain.c @@ -200,12 +200,15 @@ int32_t syncProcessMsg(int64_t rid, SRpcMsg* pMsg) { code = syncNodeOnLocalCmd(pSyncNode, pMsg); break; default: - sError("vgId:%d, failed to process msg:%p since invalid type:%s", pSyncNode->vgId, pMsg, - TMSG_INFO(pMsg->msgType)); + terrno = TSDB_CODE_MSG_NOT_PROCESSED; code = -1; } syncNodeRelease(pSyncNode); + if (code != 0) { + sDebug("vgId:%d, failed to process sync msg:%p type:%s since 0x%x", pSyncNode->vgId, pMsg, TMSG_INFO(pMsg->msgType), + terrno); + } return code; } @@ -228,8 +231,7 @@ int32_t syncSendTimeoutRsp(int64_t rid, int64_t seq) { syncNodeRelease(pNode); if (ret == 1) { - sInfo("send timeout response, seq:%" PRId64 " handle:%p ahandle:%p", seq, rpcMsg.info.handle, - rpcMsg.info.ahandle); + sInfo("send timeout response, seq:%" PRId64 " handle:%p ahandle:%p", seq, rpcMsg.info.handle, rpcMsg.info.ahandle); rpcSendResponse(&rpcMsg); return 0; } else { @@ -1084,13 +1086,17 @@ SSyncNode* syncNodeOpen(SSyncInfo* pSyncInfo) { // snapshot senders for (int32_t i = 0; i < TSDB_MAX_REPLICA; ++i) { SSyncSnapshotSender* pSender = snapshotSenderCreate(pSyncNode, i); - // ASSERT(pSender != NULL); - (pSyncNode->senders)[i] = pSender; - sSDebug(pSender, "snapshot sender create new while open, data:%p", pSender); + if (pSender == NULL) return NULL; + + pSyncNode->senders[i] = pSender; + sSDebug(pSender, "snapshot sender create while open sync node, data:%p", pSender); } // snapshot receivers pSyncNode->pNewNodeReceiver = snapshotReceiverCreate(pSyncNode, EMPTY_RAFT_ID); + if (pSyncNode->pNewNodeReceiver == NULL) return NULL; + sRDebug(pSyncNode->pNewNodeReceiver, "snapshot receiver create while open sync node, data:%p", + pSyncNode->pNewNodeReceiver); // is config changing pSyncNode->changing = false; @@ -1131,10 +1137,8 @@ SSyncNode* syncNodeOpen(SSyncInfo* pSyncInfo) { pSyncNode->hbrSlowNum = 0; pSyncNode->tmrRoutineNum = 0; - sNInfo(pSyncNode, "sync open, node:%p", pSyncNode); - sTrace("vgId:%d, tsElectInterval:%d, tsHeartbeatInterval:%d, tsHeartbeatTimeout:%d", pSyncNode->vgId, tsElectInterval, - tsHeartbeatInterval, tsHeartbeatTimeout); - + sNInfo(pSyncNode, "sync open, node:%p electInterval:%d heartbeatInterval:%d heartbeatTimeout:%d", pSyncNode, + tsElectInterval, tsHeartbeatInterval, tsHeartbeatTimeout); return pSyncNode; _error: @@ -1251,6 +1255,8 @@ void syncNodePreClose(SSyncNode* pSyncNode) { snapshotReceiverForceStop(pSyncNode->pNewNodeReceiver); } + sDebug("vgId:%d, snapshot receiver destroy while preclose sync node, data:%p", pSyncNode->vgId, + pSyncNode->pNewNodeReceiver); snapshotReceiverDestroy(pSyncNode->pNewNodeReceiver); pSyncNode->pNewNodeReceiver = NULL; } @@ -1295,15 +1301,15 @@ void syncNodeClose(SSyncNode* pSyncNode) { syncNodeStopHeartbeatTimer(pSyncNode); for (int32_t i = 0; i < TSDB_MAX_REPLICA; ++i) { - if ((pSyncNode->senders)[i] != NULL) { - sSTrace((pSyncNode->senders)[i], "snapshot sender destroy while close, data:%p", (pSyncNode->senders)[i]); + if (pSyncNode->senders[i] != NULL) { + sDebug("vgId:%d, snapshot sender destroy while close, data:%p", pSyncNode->vgId, pSyncNode->senders[i]); - if (snapshotSenderIsStart((pSyncNode->senders)[i])) { - snapshotSenderStop((pSyncNode->senders)[i], false); + if (snapshotSenderIsStart(pSyncNode->senders[i])) { + snapshotSenderStop(pSyncNode->senders[i], false); } - snapshotSenderDestroy((pSyncNode->senders)[i]); - (pSyncNode->senders)[i] = NULL; + snapshotSenderDestroy(pSyncNode->senders[i]); + pSyncNode->senders[i] = NULL; } } @@ -1312,6 +1318,7 @@ void syncNodeClose(SSyncNode* pSyncNode) { snapshotReceiverForceStop(pSyncNode->pNewNodeReceiver); } + sDebug("vgId:%d, snapshot receiver destroy while close, data:%p", pSyncNode->vgId, pSyncNode->pNewNodeReceiver); snapshotReceiverDestroy(pSyncNode->pNewNodeReceiver); pSyncNode->pNewNodeReceiver = NULL; } @@ -1382,8 +1389,7 @@ int32_t syncNodeRestartElectTimer(SSyncNode* pSyncNode, int32_t ms) { return ret; } -int32_t syncNodeResetElectTimer(SSyncNode* pSyncNode) { - int32_t ret = 0; +void syncNodeResetElectTimer(SSyncNode* pSyncNode) { int32_t electMS; if (pSyncNode->pRaftCfg->isStandBy) { @@ -1391,11 +1397,11 @@ int32_t syncNodeResetElectTimer(SSyncNode* pSyncNode) { } else { electMS = syncUtilElectRandomMS(pSyncNode->electBaseLine, 2 * pSyncNode->electBaseLine); } - ret = syncNodeRestartElectTimer(pSyncNode, electMS); + + (void)syncNodeRestartElectTimer(pSyncNode, electMS); sNTrace(pSyncNode, "reset elect timer, min:%d, max:%d, ms:%d", pSyncNode->electBaseLine, 2 * pSyncNode->electBaseLine, electMS); - return ret; } static int32_t syncNodeDoStartHeartbeatTimer(SSyncNode* pSyncNode) { @@ -1455,23 +1461,20 @@ int32_t syncNodeRestartHeartbeatTimer(SSyncNode* pSyncNode) { return 0; } -// utils -------------- int32_t syncNodeSendMsgById(const SRaftId* destRaftId, SSyncNode* pSyncNode, SRpcMsg* pMsg) { SEpSet epSet; syncUtilRaftId2EpSet(destRaftId, &epSet); - if (pSyncNode->syncSendMSg != NULL) { - // htonl - syncUtilMsgHtoN(pMsg->pCont); + if (pSyncNode->syncSendMSg != NULL) { + syncUtilMsgHtoN(pMsg->pCont); pMsg->info.noResp = 1; - pSyncNode->syncSendMSg(&epSet, pMsg); + return pSyncNode->syncSendMSg(&epSet, pMsg); } else { sError("vgId:%d, sync send msg by id error, fp-send-msg is null", pSyncNode->vgId); rpcFreeCont(pMsg->pCont); + terrno = TSDB_CODE_SYN_INTERNAL_ERROR; return -1; } - - return 0; } int32_t syncNodeSendMsgByInfo(const SNodeInfo* nodeInfo, SSyncNode* pSyncNode, SRpcMsg* pMsg) { @@ -1586,7 +1589,7 @@ void syncNodeDoConfigChange(SSyncNode* pSyncNode, SSyncCfg* pNewConfig, SyncInde memcpy(oldReplicasId, pSyncNode->replicasId, sizeof(oldReplicasId)); SSyncSnapshotSender* oldSenders[TSDB_MAX_REPLICA]; for (int32_t i = 0; i < TSDB_MAX_REPLICA; ++i) { - oldSenders[i] = (pSyncNode->senders)[i]; + oldSenders[i] = pSyncNode->senders[i]; sSTrace(oldSenders[i], "snapshot sender save old"); } @@ -1625,7 +1628,7 @@ void syncNodeDoConfigChange(SSyncNode* pSyncNode, SSyncCfg* pNewConfig, SyncInde // clear new for (int32_t i = 0; i < TSDB_MAX_REPLICA; ++i) { - (pSyncNode->senders)[i] = NULL; + pSyncNode->senders[i] = NULL; } // reset new @@ -1640,16 +1643,16 @@ void syncNodeDoConfigChange(SSyncNode* pSyncNode, SSyncCfg* pNewConfig, SyncInde sNTrace(pSyncNode, "snapshot sender reset for: %" PRId64 ", newIndex:%d, %s:%d, %p", (pSyncNode->replicasId)[i].addr, i, host, port, oldSenders[j]); - (pSyncNode->senders)[i] = oldSenders[j]; + pSyncNode->senders[i] = oldSenders[j]; oldSenders[j] = NULL; reset = true; // reset replicaIndex - int32_t oldreplicaIndex = (pSyncNode->senders)[i]->replicaIndex; - (pSyncNode->senders)[i]->replicaIndex = i; + int32_t oldreplicaIndex = pSyncNode->senders[i]->replicaIndex; + pSyncNode->senders[i]->replicaIndex = i; sNTrace(pSyncNode, "snapshot sender udpate replicaIndex from %d to %d, %s:%d, %p, reset:%d", oldreplicaIndex, - i, host, port, (pSyncNode->senders)[i], reset); + i, host, port, pSyncNode->senders[i], reset); break; } @@ -1658,18 +1661,23 @@ void syncNodeDoConfigChange(SSyncNode* pSyncNode, SSyncCfg* pNewConfig, SyncInde // create new for (int32_t i = 0; i < TSDB_MAX_REPLICA; ++i) { - if ((pSyncNode->senders)[i] == NULL) { - (pSyncNode->senders)[i] = snapshotSenderCreate(pSyncNode, i); - sSTrace((pSyncNode->senders)[i], "snapshot sender create new while reconfig, data:%p", (pSyncNode->senders)[i]); + if (pSyncNode->senders[i] == NULL) { + pSyncNode->senders[i] = snapshotSenderCreate(pSyncNode, i); + if (pSyncNode->senders[i] == NULL) { + // will be created later while send snapshot + sSError(pSyncNode->senders[i], "snapshot sender create failed while reconfig"); + } else { + sSDebug(pSyncNode->senders[i], "snapshot sender create while reconfig, data:%p", pSyncNode->senders[i]); + } } else { - sSTrace((pSyncNode->senders)[i], "snapshot sender already exist, data:%p", (pSyncNode->senders)[i]); + sSDebug(pSyncNode->senders[i], "snapshot sender already exist, data:%p", pSyncNode->senders[i]); } } // free old for (int32_t i = 0; i < TSDB_MAX_REPLICA; ++i) { if (oldSenders[i] != NULL) { - sNTrace(pSyncNode, "snapshot sender destroy old, data:%p replica-index:%d", oldSenders[i], i); + sSDebug(oldSenders[i], "snapshot sender destroy old, data:%p replica-index:%d", oldSenders[i], i); snapshotSenderDestroy(oldSenders[i]); oldSenders[i] = NULL; } @@ -1844,8 +1852,8 @@ void syncNodeBecomeLeader(SSyncNode* pSyncNode, const char* debugStr) { SSyncSnapshotSender* pMySender = syncNodeGetSnapshotSender(pSyncNode, &(pSyncNode->myRaftId)); if (pMySender != NULL) { for (int32_t i = 0; i < pSyncNode->pMatchIndex->replicaNum; ++i) { - if ((pSyncNode->senders)[i]->privateTerm > pMySender->privateTerm) { - pMySender->privateTerm = (pSyncNode->senders)[i]->privateTerm; + if (pSyncNode->senders[i]->privateTerm > pMySender->privateTerm) { + pMySender->privateTerm = pSyncNode->senders[i]->privateTerm; } } (pMySender->privateTerm) += 100; diff --git a/source/libs/sync/src/syncPipeline.c b/source/libs/sync/src/syncPipeline.c index 225de30755..f2c86cef19 100644 --- a/source/libs/sync/src/syncPipeline.c +++ b/source/libs/sync/src/syncPipeline.c @@ -566,7 +566,9 @@ _out: return ret; } -int32_t syncLogReplMgrReset(SSyncLogReplMgr* pMgr) { +void syncLogReplMgrReset(SSyncLogReplMgr* pMgr) { + if (pMgr == NULL) return; + ASSERT(pMgr->startIndex >= 0); for (SyncIndex index = pMgr->startIndex; index < pMgr->endIndex; index++) { memset(&pMgr->states[index % pMgr->size], 0, sizeof(pMgr->states[0])); @@ -576,7 +578,6 @@ int32_t syncLogReplMgrReset(SSyncLogReplMgr* pMgr) { pMgr->endIndex = 0; pMgr->restored = false; pMgr->retryBackoff = 0; - return 0; } int32_t syncLogReplMgrRetryOnNeed(SSyncLogReplMgr* pMgr, SSyncNode* pNode) { diff --git a/source/libs/sync/src/syncSnapshot.c b/source/libs/sync/src/syncSnapshot.c index 54c11a503b..f2da2fb2ce 100644 --- a/source/libs/sync/src/syncSnapshot.c +++ b/source/libs/sync/src/syncSnapshot.c @@ -54,7 +54,6 @@ SSyncSnapshotSender *snapshotSenderCreate(SSyncNode *pSyncNode, int32_t replicaI void snapshotSenderDestroy(SSyncSnapshotSender *pSender) { if (pSender == NULL) return; - sDebug("vgId:%d, snapshot sender destroy", pSender->pSyncNode->vgId); // free current block if (pSender->pCurrentBlock != NULL) { @@ -75,12 +74,6 @@ void snapshotSenderDestroy(SSyncSnapshotSender *pSender) { bool snapshotSenderIsStart(SSyncSnapshotSender *pSender) { return pSender->start; } int32_t snapshotSenderStart(SSyncSnapshotSender *pSender) { - if (snapshotSenderIsStart(pSender)) { - sSError(pSender, "vgId:%d, snapshot sender is already start"); - terrno = TSDB_CODE_SYN_INTERNAL_ERROR; - return -1; - } - pSender->start = true; pSender->seq = SYNC_SNAPSHOT_SEQ_BEGIN; pSender->ack = SYNC_SNAPSHOT_SEQ_INVALID; @@ -95,7 +88,7 @@ int32_t snapshotSenderStart(SSyncSnapshotSender *pSender) { pSender->snapshot.lastApplyTerm = SYNC_TERM_INVALID; pSender->snapshot.lastConfigIndex = SYNC_INDEX_INVALID; - memset(&(pSender->lastConfig), 0, sizeof(pSender->lastConfig)); + memset(&pSender->lastConfig, 0, sizeof(pSender->lastConfig)); pSender->sendingMS = 0; pSender->term = pSender->pSyncNode->pRaftStore->currentTerm; pSender->startTime = taosGetTimestampMs(); @@ -111,7 +104,7 @@ int32_t snapshotSenderStart(SSyncSnapshotSender *pSender) { SyncSnapshotSend *pMsg = rpcMsg.pCont; pMsg->srcId = pSender->pSyncNode->myRaftId; - pMsg->destId = (pSender->pSyncNode->replicasId)[pSender->replicaIndex]; + pMsg->destId = pSender->pSyncNode->replicasId[pSender->replicaIndex]; pMsg->term = pSender->pSyncNode->pRaftStore->currentTerm; pMsg->beginIndex = pSender->snapshotParam.start; pMsg->lastIndex = pSender->snapshot.lastApplyIndex; @@ -122,7 +115,6 @@ int32_t snapshotSenderStart(SSyncSnapshotSender *pSender) { pMsg->seq = SYNC_SNAPSHOT_SEQ_PRE_SNAPSHOT; // event log - sSDebug(pSender, "snapshot sender start"); syncLogSendSyncSnapshotSend(pSender->pSyncNode, pMsg, "snapshot sender start"); // send msg @@ -134,7 +126,7 @@ int32_t snapshotSenderStart(SSyncSnapshotSender *pSender) { return 0; } -int32_t snapshotSenderStop(SSyncSnapshotSender *pSender, bool finish) { +void snapshotSenderStop(SSyncSnapshotSender *pSender, bool finish) { sSDebug(pSender, "snapshot sender stop, finish:%d reader:%p", finish, pSender->pReader); // update flag @@ -154,8 +146,6 @@ int32_t snapshotSenderStop(SSyncSnapshotSender *pSender, bool finish) { pSender->pCurrentBlock = NULL; pSender->blockLen = 0; } - - return 0; } // when sender receive ack, call this function to send msg from seq @@ -177,8 +167,8 @@ int32_t snapshotSend(SSyncSnapshotSender *pSender) { } if (pSender->blockLen > 0) { - sSDebug(pSender, "snapshot sender continue to read, blockLen:%d seq:%d", pSender->blockLen, pSender->seq); // has read data + sSDebug(pSender, "snapshot sender continue to read, blockLen:%d seq:%d", pSender->blockLen, pSender->seq); } else { // read finish, update seq to end pSender->seq = SYNC_SNAPSHOT_SEQ_END; @@ -194,7 +184,7 @@ int32_t snapshotSend(SSyncSnapshotSender *pSender) { SyncSnapshotSend *pMsg = rpcMsg.pCont; pMsg->srcId = pSender->pSyncNode->myRaftId; - pMsg->destId = (pSender->pSyncNode->replicasId)[pSender->replicaIndex]; + pMsg->destId = pSender->pSyncNode->replicasId[pSender->replicaIndex]; pMsg->term = pSender->pSyncNode->pRaftStore->currentTerm; pMsg->beginIndex = pSender->snapshotParam.start; pMsg->lastIndex = pSender->snapshot.lastApplyIndex; @@ -202,7 +192,6 @@ int32_t snapshotSend(SSyncSnapshotSender *pSender) { pMsg->lastConfigIndex = pSender->snapshot.lastConfigIndex; pMsg->lastConfig = pSender->lastConfig; pMsg->seq = pSender->seq; - // pMsg->privateTerm = pSender->privateTerm; if (pSender->pCurrentBlock != NULL) { memcpy(pMsg->data, pSender->pCurrentBlock, pSender->blockLen); @@ -210,10 +199,8 @@ int32_t snapshotSend(SSyncSnapshotSender *pSender) { // event log if (pSender->seq == SYNC_SNAPSHOT_SEQ_END) { - sSDebug(pSender, "snapshot sender finish, seq:%d", pSender->seq); syncLogSendSyncSnapshotSend(pSender->pSyncNode, pMsg, "snapshot sender finish"); } else { - sSDebug(pSender, "snapshot sender sending, seq:%d", pSender->seq); syncLogSendSyncSnapshotSend(pSender->pSyncNode, pMsg, "snapshot sender sending"); } @@ -238,7 +225,7 @@ int32_t snapshotReSend(SSyncSnapshotSender *pSender) { SyncSnapshotSend *pMsg = rpcMsg.pCont; pMsg->srcId = pSender->pSyncNode->myRaftId; - pMsg->destId = (pSender->pSyncNode->replicasId)[pSender->replicaIndex]; + pMsg->destId = pSender->pSyncNode->replicasId[pSender->replicaIndex]; pMsg->term = pSender->pSyncNode->pRaftStore->currentTerm; pMsg->beginIndex = pSender->snapshotParam.start; pMsg->lastIndex = pSender->snapshot.lastApplyIndex; @@ -248,12 +235,10 @@ int32_t snapshotReSend(SSyncSnapshotSender *pSender) { pMsg->seq = pSender->seq; if (pSender->pCurrentBlock != NULL && pSender->blockLen > 0) { - // pMsg->privateTerm = pSender->privateTerm; memcpy(pMsg->data, pSender->pCurrentBlock, pSender->blockLen); } // event log - sSDebug(pSender, "snapshot sender resend, seq:%d", pSender->seq); syncLogSendSyncSnapshotSend(pSender->pSyncNode, pMsg, "snapshot sender resend"); // send msg @@ -299,13 +284,10 @@ int32_t syncNodeStartSnapshot(SSyncNode *pSyncNode, SRaftId *pDestId) { if (pSender->finish && taosGetTimestampMs() - pSender->endTime < SNAPSHOT_WAIT_MS) { sSInfo(pSender, "snapshot sender start too frequently, ignore"); - return 1; + return 0; } - char host[64]; - uint16_t port; - syncUtilU642Addr(pDestId->addr, host, sizeof(host), &port); - sSInfo(pSender, "snapshot sender start for peer:%s:%u", host, port); + sSInfo(pSender, "snapshot sender start"); int32_t code = snapshotSenderStart(pSender); if (code != 0) { @@ -338,13 +320,11 @@ SSyncSnapshotReceiver *snapshotReceiverCreate(SSyncNode *pSyncNode, SRaftId from pReceiver->snapshot.lastApplyTerm = 0; pReceiver->snapshot.lastConfigIndex = SYNC_INDEX_INVALID; - sDebug("vgId:%d, snapshot receiver create", pSyncNode->vgId); return pReceiver; } void snapshotReceiverDestroy(SSyncSnapshotReceiver *pReceiver) { if (pReceiver == NULL) return; - sDebug("vgId:%d, snapshot receiver destroy", pReceiver->pSyncNode->vgId); // close writer if (pReceiver->pWriter != NULL) { @@ -368,7 +348,6 @@ void snapshotReceiverForceStop(SSyncSnapshotReceiver *pReceiver) { // force close, abandon incomplete data if (pReceiver->pWriter != NULL) { - // event log int32_t ret = pReceiver->pSyncNode->pFsm->FpSnapshotStopWrite(pReceiver->pSyncNode->pFsm, pReceiver->pWriter, false, &pReceiver->snapshot); if (ret != 0) { @@ -380,13 +359,7 @@ void snapshotReceiverForceStop(SSyncSnapshotReceiver *pReceiver) { pReceiver->start = false; } -int32_t snapshotReceiverStartWriter(SSyncSnapshotReceiver *pReceiver, SyncSnapshotSend *pBeginMsg) { - if (!snapshotReceiverIsStart(pReceiver)) { - sRError(pReceiver, "snapshot receiver is not start"); - terrno = TSDB_CODE_SYN_INTERNAL_ERROR; - return -1; - } - +static int32_t snapshotReceiverStartWriter(SSyncSnapshotReceiver *pReceiver, SyncSnapshotSend *pBeginMsg) { if (pReceiver->pWriter != NULL) { sRError(pReceiver, "vgId:%d, snapshot receiver writer is not null"); terrno = TSDB_CODE_SYN_INTERNAL_ERROR; @@ -416,10 +389,10 @@ int32_t snapshotReceiverStartWriter(SSyncSnapshotReceiver *pReceiver, SyncSnapsh return 0; } -int32_t snapshotReceiverStart(SSyncSnapshotReceiver *pReceiver, SyncSnapshotSend *pPreMsg) { +void snapshotReceiverStart(SSyncSnapshotReceiver *pReceiver, SyncSnapshotSend *pPreMsg) { if (snapshotReceiverIsStart(pReceiver)) { sRInfo(pReceiver, "snapshot receiver has started"); - return 0; + return; } pReceiver->start = true; @@ -430,12 +403,11 @@ int32_t snapshotReceiverStart(SSyncSnapshotReceiver *pReceiver, SyncSnapshotSend // event log sRInfo(pReceiver, "snapshot receiver is start"); - return 0; } // just set start = false // FpSnapshotStopWrite should not be called, assert writer == NULL -int32_t snapshotReceiverStop(SSyncSnapshotReceiver *pReceiver) { +void snapshotReceiverStop(SSyncSnapshotReceiver *pReceiver) { sRInfo(pReceiver, "snapshot receiver stop, not apply, writer:%p", pReceiver->pWriter); if (pReceiver->pWriter != NULL) { @@ -450,17 +422,10 @@ int32_t snapshotReceiverStop(SSyncSnapshotReceiver *pReceiver) { } pReceiver->start = false; - return 0; } // when recv last snapshot block, apply data into snapshot static int32_t snapshotReceiverFinish(SSyncSnapshotReceiver *pReceiver, SyncSnapshotSend *pMsg) { - if (pMsg->seq != SYNC_SNAPSHOT_SEQ_END) { - sRError(pReceiver, "snapshot receiver seq:%d is invalid", pMsg->seq); - terrno = TSDB_CODE_SYN_INTERNAL_ERROR; - return -1; - } - int32_t code = 0; if (pReceiver->pWriter != NULL) { // write data @@ -582,6 +547,7 @@ SyncIndex syncNodeGetSnapBeginIndex(SSyncNode *ths) { static int32_t syncNodeOnSnapshotPre(SSyncNode *pSyncNode, SyncSnapshotSend *pMsg) { SSyncSnapshotReceiver *pReceiver = pSyncNode->pNewNodeReceiver; int64_t timeNow = taosGetTimestampMs(); + int32_t code = 0; if (snapshotReceiverIsStart(pReceiver)) { // already start @@ -593,14 +559,14 @@ static int32_t syncNodeOnSnapshotPre(SSyncNode *pSyncNode, SyncSnapshotSend *pMs sRInfo(pReceiver, "snapshot receiver startTime:%" PRId64 " == msg startTime:%" PRId64 " send reply", pReceiver->startTime, pMsg->startTime); goto _SEND_REPLY; - } else { // ignore - sRInfo(pReceiver, "snapshot receiver startTime:%" PRId64 " < msg startTime:%" PRId64 " ignore", - pReceiver->startTime, pMsg->startTime); - return 0; + sRError(pReceiver, "snapshot receiver startTime:%" PRId64 " < msg startTime:%" PRId64 " ignore", + pReceiver->startTime, pMsg->startTime); + terrno = TSDB_CODE_SYN_INTERNAL_ERROR; + code = terrno; + goto _SEND_REPLY; } - } else { // start new sRInfo(pReceiver, "snapshot receiver not start yet so start new one"); @@ -611,7 +577,8 @@ _START_RECEIVER: if (timeNow - pMsg->startTime > SNAPSHOT_MAX_CLOCK_SKEW_MS) { sRError(pReceiver, "snapshot receiver time skew too much, now:%" PRId64 " msg startTime:%" PRId64, timeNow, pMsg->startTime); - return -1; + terrno = TSDB_CODE_SYN_INTERNAL_ERROR; + code = terrno; } else { // waiting for clock match while (timeNow < pMsg->startTime) { @@ -647,7 +614,7 @@ _SEND_REPLY: pRspMsg->lastTerm = pMsg->lastTerm; pRspMsg->startTime = pReceiver->startTime; pRspMsg->ack = pMsg->seq; // receiver maybe already closed - pRspMsg->code = 0; + pRspMsg->code = code; pRspMsg->snapBeginIndex = syncNodeGetSnapBeginIndex(pSyncNode); // send msg @@ -657,26 +624,36 @@ _SEND_REPLY: return -1; } - return 0; + return code; } static int32_t syncNodeOnSnapshotBegin(SSyncNode *pSyncNode, SyncSnapshotSend *pMsg) { // condition 1 SSyncSnapshotReceiver *pReceiver = pSyncNode->pNewNodeReceiver; + int32_t code = TSDB_CODE_SYN_INTERNAL_ERROR; if (!snapshotReceiverIsStart(pReceiver)) { - sRError(pReceiver, "snapshot receiver not start"); - return -1; + sRError(pReceiver, "snapshot receiver begin failed since not start"); + goto _SEND_REPLY; } if (pReceiver->startTime != pMsg->startTime) { - sRError(pReceiver, "snapshot receiver startTime:%" PRId64 " not equal to msg startTime:%" PRId64, + sRError(pReceiver, "snapshot receiver begin failed since startTime:%" PRId64 " not equal to msg startTime:%" PRId64, pReceiver->startTime, pMsg->startTime); - return -1; + goto _SEND_REPLY; } // start writer - snapshotReceiverStartWriter(pReceiver, pMsg); + if (snapshotReceiverStartWriter(pReceiver, pMsg) != 0) { + sRError(pReceiver, "snapshot receiver begin failed since start writer failed"); + goto _SEND_REPLY; + } + + code = 0; +_SEND_REPLY: + if (code != 0 && terrno != 0) { + code = terrno; + } // build msg SRpcMsg rpcMsg = {0}; @@ -693,7 +670,7 @@ static int32_t syncNodeOnSnapshotBegin(SSyncNode *pSyncNode, SyncSnapshotSend *p pRspMsg->lastTerm = pMsg->lastTerm; pRspMsg->startTime = pReceiver->startTime; pRspMsg->ack = pReceiver->ack; // receiver maybe already closed - pRspMsg->code = 0; + pRspMsg->code = code; pRspMsg->snapBeginIndex = pReceiver->snapshotParam.start; // send msg @@ -703,10 +680,10 @@ static int32_t syncNodeOnSnapshotBegin(SSyncNode *pSyncNode, SyncSnapshotSend *p return -1; } - return 0; + return code; } -static int32_t syncNodeOnSnapshotTransfering(SSyncNode *pSyncNode, SyncSnapshotSend *pMsg) { +static int32_t syncNodeOnSnapshotReceive(SSyncNode *pSyncNode, SyncSnapshotSend *pMsg) { // condition 4 // transfering SSyncSnapshotReceiver *pReceiver = pSyncNode->pNewNodeReceiver; @@ -753,7 +730,7 @@ static int32_t syncNodeOnSnapshotTransfering(SSyncNode *pSyncNode, SyncSnapshotS return -1; } - return 0; + return code; } static int32_t syncNodeOnSnapshotEnd(SSyncNode *pSyncNode, SyncSnapshotSend *pMsg) { @@ -790,7 +767,7 @@ static int32_t syncNodeOnSnapshotEnd(SSyncNode *pSyncNode, SyncSnapshotSend *pMs pRspMsg->lastTerm = pMsg->lastTerm; pRspMsg->startTime = pReceiver->startTime; pRspMsg->ack = pReceiver->ack; // receiver maybe already closed - pRspMsg->code = 0; + pRspMsg->code = code; pRspMsg->snapBeginIndex = pReceiver->snapshotParam.start; // send msg @@ -800,7 +777,7 @@ static int32_t syncNodeOnSnapshotEnd(SSyncNode *pSyncNode, SyncSnapshotSend *pMs return -1; } - return 0; + return code; } // receiver on message @@ -830,12 +807,14 @@ int32_t syncNodeOnSnapshot(SSyncNode *pSyncNode, const SRpcMsg *pRpcMsg) { // if already drop replica, do not process if (!syncNodeInRaftGroup(pSyncNode, &pMsg->srcId)) { syncLogRecvSyncSnapshotSend(pSyncNode, pMsg, "not in my config"); - return 0; + terrno = TSDB_CODE_SYN_INTERNAL_ERROR; + return -1; } if (pMsg->term < pSyncNode->pRaftStore->currentTerm) { syncLogRecvSyncSnapshotSend(pSyncNode, pMsg, "reject since small term"); - return 0; + terrno = TSDB_CODE_SYN_INTERNAL_ERROR; + return -1; } if (pMsg->term > pSyncNode->pRaftStore->currentTerm) { @@ -844,20 +823,21 @@ int32_t syncNodeOnSnapshot(SSyncNode *pSyncNode, const SRpcMsg *pRpcMsg) { syncNodeResetElectTimer(pSyncNode); // state, term, seq/ack + int32_t code = 0; if (pSyncNode->state == TAOS_SYNC_STATE_FOLLOWER) { if (pMsg->term == pSyncNode->pRaftStore->currentTerm) { if (pMsg->seq == SYNC_SNAPSHOT_SEQ_PRE_SNAPSHOT) { syncLogRecvSyncSnapshotSend(pSyncNode, pMsg, "process seq pre-snapshot"); - syncNodeOnSnapshotPre(pSyncNode, pMsg); + code = syncNodeOnSnapshotPre(pSyncNode, pMsg); } else if (pMsg->seq == SYNC_SNAPSHOT_SEQ_BEGIN) { syncLogRecvSyncSnapshotSend(pSyncNode, pMsg, "process seq begin"); - syncNodeOnSnapshotBegin(pSyncNode, pMsg); + code = syncNodeOnSnapshotBegin(pSyncNode, pMsg); } else if (pMsg->seq == SYNC_SNAPSHOT_SEQ_END) { syncLogRecvSyncSnapshotSend(pSyncNode, pMsg, "process seq end"); - syncNodeOnSnapshotEnd(pSyncNode, pMsg); + code = syncNodeOnSnapshotEnd(pSyncNode, pMsg); if (syncLogBufferReInit(pSyncNode->pLogBuf, pSyncNode) != 0) { sRError(pReceiver, "failed to reinit log buffer since %s", terrstr()); - return -1; + code = -1; } } else if (pMsg->seq == SYNC_SNAPSHOT_SEQ_FORCE_CLOSE) { // force close, no response @@ -865,35 +845,27 @@ int32_t syncNodeOnSnapshot(SSyncNode *pSyncNode, const SRpcMsg *pRpcMsg) { snapshotReceiverForceStop(pReceiver); } else if (pMsg->seq > SYNC_SNAPSHOT_SEQ_BEGIN && pMsg->seq < SYNC_SNAPSHOT_SEQ_END) { syncLogRecvSyncSnapshotSend(pSyncNode, pMsg, "process seq data"); - syncNodeOnSnapshotTransfering(pSyncNode, pMsg); + code = syncNodeOnSnapshotReceive(pSyncNode, pMsg); } else { // error log sRError(pReceiver, "snapshot receiver recv error seq:%d, my ack:%d", pMsg->seq, pReceiver->ack); - return -1; + code = -1; } } else { // error log sRError(pReceiver, "snapshot receiver term not equal"); - return -1; + code = -1; } } else { // error log sRError(pReceiver, "snapshot receiver not follower"); - return -1; + code = -1; } - return 0; + return code; } -int32_t syncNodeOnSnapshotReplyPre(SSyncNode *pSyncNode, SyncSnapshotRsp *pMsg) { - // get sender - SSyncSnapshotSender *pSender = syncNodeGetSnapshotSender(pSyncNode, &(pMsg->srcId)); - if (pSender == NULL) { - sNError(pSyncNode, "prepare snapshot error since sender is null"); - terrno = TSDB_CODE_SYN_INTERNAL_ERROR; - return -1; - } - +static int32_t syncNodeOnSnapshotPreRsp(SSyncNode *pSyncNode, SSyncSnapshotSender *pSender, SyncSnapshotRsp *pMsg) { SSnapshot snapshot = {0}; pSyncNode->pFsm->FpGetSnapshotInfo(pSyncNode->pFsm, &snapshot); @@ -915,7 +887,7 @@ int32_t syncNodeOnSnapshotReplyPre(SSyncNode *pSyncNode, SyncSnapshotRsp *pMsg) pSender->snapshot = snapshot; // start reader - int32_t code = pSyncNode->pFsm->FpSnapshotStartRead(pSyncNode->pFsm, &(pSender->snapshotParam), &(pSender->pReader)); + int32_t code = pSyncNode->pFsm->FpSnapshotStartRead(pSyncNode->pFsm, &pSender->snapshotParam, &pSender->pReader); if (code != 0) { sSError(pSender, "prepare snapshot failed since %s", terrstr()); return -1; @@ -936,7 +908,7 @@ int32_t syncNodeOnSnapshotReplyPre(SSyncNode *pSyncNode, SyncSnapshotRsp *pMsg) SyncSnapshotSend *pSendMsg = rpcMsg.pCont; pSendMsg->srcId = pSender->pSyncNode->myRaftId; - pSendMsg->destId = (pSender->pSyncNode->replicasId)[pSender->replicaIndex]; + pSendMsg->destId = pSender->pSyncNode->replicasId[pSender->replicaIndex]; pSendMsg->term = pSender->pSyncNode->pRaftStore->currentTerm; pSendMsg->beginIndex = pSender->snapshotParam.start; pSendMsg->lastIndex = pSender->snapshot.lastApplyIndex; @@ -966,8 +938,9 @@ int32_t syncNodeOnSnapshotRsp(SSyncNode *pSyncNode, const SRpcMsg *pRpcMsg) { SyncSnapshotRsp *pMsg = pRpcMsg->pCont; // if already drop replica, do not process - if (!syncNodeInRaftGroup(pSyncNode, &(pMsg->srcId))) { + if (!syncNodeInRaftGroup(pSyncNode, &pMsg->srcId)) { syncLogRecvSyncSnapshotRsp(pSyncNode, pMsg, "maybe replica already dropped"); + terrno = TSDB_CODE_SYN_INTERNAL_ERROR; return -1; } @@ -983,6 +956,7 @@ int32_t syncNodeOnSnapshotRsp(SSyncNode *pSyncNode, const SRpcMsg *pRpcMsg) { if (pSyncNode->state != TAOS_SYNC_STATE_LEADER) { syncLogRecvSyncSnapshotRsp(pSyncNode, pMsg, "snapshot sender not leader"); sSError(pSender, "snapshot sender not leader"); + terrno = TSDB_CODE_SYN_NOT_LEADER; goto _ERROR; } @@ -990,6 +964,7 @@ int32_t syncNodeOnSnapshotRsp(SSyncNode *pSyncNode, const SRpcMsg *pRpcMsg) { syncLogRecvSyncSnapshotRsp(pSyncNode, pMsg, "snapshot sender and receiver time not match"); sSError(pSender, "sender:%" PRId64 " receiver:%" PRId64 " time not match, code:0x%x", pMsg->startTime, pSender->startTime, pMsg->code); + terrno = TSDB_CODE_SYN_INTERNAL_ERROR; goto _ERROR; } @@ -997,20 +972,21 @@ int32_t syncNodeOnSnapshotRsp(SSyncNode *pSyncNode, const SRpcMsg *pRpcMsg) { syncLogRecvSyncSnapshotRsp(pSyncNode, pMsg, "snapshot sender and receiver term not match"); sSError(pSender, "snapshot sender term not equal, msg term:%" PRId64 " currentTerm:%" PRId64, pMsg->term, pSyncNode->pRaftStore->currentTerm); + terrno = TSDB_CODE_SYN_INTERNAL_ERROR; goto _ERROR; } if (pMsg->code != 0) { syncLogRecvSyncSnapshotRsp(pSyncNode, pMsg, "receive error code"); sSError(pSender, "snapshot sender receive error code:0x%x and stop sender", pMsg->code); + terrno = pMsg->code; goto _ERROR; } // prepare , send begin msg if (pMsg->ack == SYNC_SNAPSHOT_SEQ_PRE_SNAPSHOT) { syncLogRecvSyncSnapshotRsp(pSyncNode, pMsg, "process seq pre-snapshot"); - syncNodeOnSnapshotReplyPre(pSyncNode, pMsg); - return 0; + return syncNodeOnSnapshotPreRsp(pSyncNode, pSender, pMsg); } if (pMsg->ack == SYNC_SNAPSHOT_SEQ_BEGIN) { @@ -1030,10 +1006,7 @@ int32_t syncNodeOnSnapshotRsp(SSyncNode *pSyncNode, const SRpcMsg *pRpcMsg) { syncLogRecvSyncSnapshotRsp(pSyncNode, pMsg, "process seq end"); snapshotSenderStop(pSender, true); SSyncLogReplMgr *pMgr = syncNodeGetLogReplMgr(pSyncNode, &pMsg->srcId); - if (pMgr) { - syncLogRecvSyncSnapshotRsp(pSyncNode, pMsg, "reset repl mgr"); - syncLogReplMgrReset(pMgr); - } + syncLogReplMgrReset(pMgr); return 0; } @@ -1047,22 +1020,19 @@ int32_t syncNodeOnSnapshotRsp(SSyncNode *pSyncNode, const SRpcMsg *pRpcMsg) { if (snapshotSend(pSender) != 0) { return -1; } - } else if (pMsg->ack == pSender->seq - 1) { // maybe resend syncLogRecvSyncSnapshotRsp(pSyncNode, pMsg, "process seq and resend"); - snapshotReSend(pSender); - + if (snapshotReSend(pSender) != 0) { + return -1; + } } else { // error log syncLogRecvSyncSnapshotRsp(pSyncNode, pMsg, "receive error ack"); sSError(pSender, "snapshot sender receive error ack:%d, my seq:%d", pMsg->ack, pSender->seq); snapshotSenderStop(pSender, true); SSyncLogReplMgr *pMgr = syncNodeGetLogReplMgr(pSyncNode, &pMsg->srcId); - if (pMgr) { - syncLogReplMgrReset(pMgr); - } - + syncLogReplMgrReset(pMgr); return -1; } @@ -1071,10 +1041,7 @@ int32_t syncNodeOnSnapshotRsp(SSyncNode *pSyncNode, const SRpcMsg *pRpcMsg) { _ERROR: snapshotSenderStop(pSender, true); SSyncLogReplMgr *pMgr = syncNodeGetLogReplMgr(pSyncNode, &pMsg->srcId); - if (pMgr) { - syncLogRecvSyncSnapshotRsp(pSyncNode, pMsg, "reset repl mgr"); - syncLogReplMgrReset(pMgr); - } + syncLogReplMgrReset(pMgr); return -1; } From b381c42c9de6f0335117ebb7334a9828e7e785ff Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Mon, 26 Dec 2022 15:59:45 +0800 Subject: [PATCH 33/63] enh: adjust log while transfer snapshot --- source/dnode/vnode/src/meta/metaSnapshot.c | 4 ++-- source/dnode/vnode/src/vnd/vnodeSnapshot.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/source/dnode/vnode/src/meta/metaSnapshot.c b/source/dnode/vnode/src/meta/metaSnapshot.c index 054e785980..63d044df6e 100644 --- a/source/dnode/vnode/src/meta/metaSnapshot.c +++ b/source/dnode/vnode/src/meta/metaSnapshot.c @@ -113,8 +113,8 @@ int32_t metaSnapRead(SMetaSnapReader* pReader, uint8_t** ppData) { pHdr->size = nData; memcpy(pHdr->data, pData, nData); - metaInfo("vgId:%d, vnode snapshot meta read data, version:%" PRId64 " uid:%" PRId64 " nData:%d", - TD_VID(pReader->pMeta->pVnode), key.version, key.uid, nData); + metaDebug("vgId:%d, vnode snapshot meta read data, version:%" PRId64 " uid:%" PRId64 " blockLen:%d", + TD_VID(pReader->pMeta->pVnode), key.version, key.uid, nData); _exit: return code; diff --git a/source/dnode/vnode/src/vnd/vnodeSnapshot.c b/source/dnode/vnode/src/vnd/vnodeSnapshot.c index 0362d4af2a..2fc06fba86 100644 --- a/source/dnode/vnode/src/vnd/vnodeSnapshot.c +++ b/source/dnode/vnode/src/vnd/vnodeSnapshot.c @@ -257,8 +257,8 @@ _exit: pReader->index++; *nData = sizeof(SSnapDataHdr) + pHdr->size; pHdr->index = pReader->index; - vInfo("vgId:%d, vnode snapshot read data,index:%" PRId64 " type:%d nData:%d ", TD_VID(pReader->pVnode), - pReader->index, pHdr->type, *nData); + vDebug("vgId:%d, vnode snapshot read data, index:%" PRId64 " type:%d blockLen:%d ", TD_VID(pReader->pVnode), + pReader->index, pHdr->type, *nData); } else { vInfo("vgId:%d, vnode snapshot read data end, index:%" PRId64, TD_VID(pReader->pVnode), pReader->index); } From 962fab4ff3c84fc65e2f150a227be5c5b5f3c288 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Mon, 26 Dec 2022 17:32:41 +0800 Subject: [PATCH 34/63] fix:remove assert --- source/libs/executor/src/timewindowoperator.c | 34 ++++--------------- 1 file changed, 7 insertions(+), 27 deletions(-) diff --git a/source/libs/executor/src/timewindowoperator.c b/source/libs/executor/src/timewindowoperator.c index 8107cea4a0..e5dcc43797 100644 --- a/source/libs/executor/src/timewindowoperator.c +++ b/source/libs/executor/src/timewindowoperator.c @@ -907,7 +907,7 @@ static void removeDeleteResults(SHashObj* pUpdatedMap, SArray* pDelWins) { } bool isOverdue(TSKEY ekey, STimeWindowAggSupp* pTwSup) { - ASSERT(pTwSup->maxTs == INT64_MIN || pTwSup->maxTs > 0); + ASSERTS(pTwSup->maxTs == INT64_MIN || pTwSup->maxTs > 0, "maxts should greater than 0"); return pTwSup->maxTs != INT64_MIN && ekey < pTwSup->maxTs - pTwSup->waterMark; } @@ -1396,7 +1396,6 @@ static int32_t getAllIntervalWindow(SSHashObj* pHashMap, SHashObj* resWins) { while ((pIte = tSimpleHashIterate(pHashMap, pIte, &iter)) != NULL) { void* key = tSimpleHashGetKey(pIte, &keyLen); uint64_t groupId = *(uint64_t*)key; - ASSERT(keyLen == GET_RES_WINDOW_KEY_LEN(sizeof(TSKEY))); TSKEY ts = *(int64_t*)((char*)key + sizeof(uint64_t)); SResultRowPosition* pPos = (SResultRowPosition*)pIte; int32_t code = saveWinResult(ts, pPos->pageId, pPos->offset, groupId, resWins); @@ -1547,7 +1546,7 @@ static void closeChildIntervalWindow(SOperatorInfo* pOperator, SArray* pChildren for (int32_t i = 0; i < size; i++) { SOperatorInfo* pChildOp = taosArrayGetP(pChildren, i); SStreamIntervalOperatorInfo* pChInfo = pChildOp->info; - ASSERT(pChInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE); + ASSERTS(pChInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE, "children trigger type should be at once"); pChInfo->twAggSup.maxTs = TMAX(pChInfo->twAggSup.maxTs, maxTs); closeStreamIntervalWindow(pChInfo->aggSup.pResultRowHashTable, &pChInfo->twAggSup, &pChInfo->interval, NULL, NULL, NULL, pOperator); @@ -1767,8 +1766,6 @@ SOperatorInfo* createIntervalOperatorInfo(SOperatorInfo* downstream, SIntervalPh .maxTs = INT64_MIN, }; - ASSERT(as.calTrigger != STREAM_TRIGGER_MAX_DELAY); - 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; @@ -2252,7 +2249,6 @@ static void doBuildPullDataBlock(SArray* array, int32_t* pIndex, SSDataBlock* pB return; } blockDataEnsureCapacity(pBlock, size - (*pIndex)); - ASSERT(3 <= taosArrayGetSize(pBlock->pDataBlock)); SColumnInfoData* pStartTs = (SColumnInfoData*)taosArrayGet(pBlock->pDataBlock, START_TS_COLUMN_INDEX); SColumnInfoData* pEndTs = (SColumnInfoData*)taosArrayGet(pBlock->pDataBlock, END_TS_COLUMN_INDEX); SColumnInfoData* pGroupId = (SColumnInfoData*)taosArrayGet(pBlock->pDataBlock, GROUPID_COLUMN_INDEX); @@ -2359,7 +2355,6 @@ static void doStreamIntervalAggImpl(SOperatorInfo* pOperatorInfo, SSDataBlock* p SResultRow* pResult = NULL; int32_t forwardRows = 0; - ASSERT(pSDataBlock->pDataBlock != NULL); SColumnInfoData* pColDataInfo = taosArrayGet(pSDataBlock->pDataBlock, pInfo->primaryTsIndex); tsCols = (int64_t*)pColDataInfo->pData; @@ -2482,7 +2477,6 @@ static SSDataBlock* doStreamFinalIntervalAgg(SOperatorInfo* pOperator) { doBuildPullDataBlock(pInfo->pPullWins, &pInfo->pullIndex, pInfo->pPullDataRes); if (pInfo->pPullDataRes->info.rows != 0) { // process the rest of the data - ASSERT(IS_FINAL_OP(pInfo)); printDataBlock(pInfo->pPullDataRes, IS_FINAL_OP(pInfo) ? "interval final" : "interval semi"); return pInfo->pPullDataRes; } @@ -2543,7 +2537,6 @@ static SSDataBlock* doStreamFinalIntervalAgg(SOperatorInfo* pOperator) { pInfo->numOfDatapack++; printDataBlock(pBlock, IS_FINAL_OP(pInfo) ? "interval final recv" : "interval semi recv"); - ASSERT(pBlock->info.type != STREAM_INVERT); if (pBlock->info.type == STREAM_NORMAL || pBlock->info.type == STREAM_PULL_DATA) { pInfo->binfo.pRes->info.type = pBlock->info.type; } else if (pBlock->info.type == STREAM_DELETE_DATA || pBlock->info.type == STREAM_DELETE_RESULT || @@ -2633,7 +2626,6 @@ static SSDataBlock* doStreamFinalIntervalAgg(SOperatorInfo* pOperator) { doBuildPullDataBlock(pInfo->pPullWins, &pInfo->pullIndex, pInfo->pPullDataRes); if (pInfo->pPullDataRes->info.rows != 0) { // process the rest of the data - ASSERT(IS_FINAL_OP(pInfo)); printDataBlock(pInfo->pPullDataRes, IS_FINAL_OP(pInfo) ? "interval final" : "interval semi"); return pInfo->pPullDataRes; } @@ -2688,7 +2680,7 @@ SOperatorInfo* createStreamFinalIntervalOperatorInfo(SOperatorInfo* downstream, .deleteMarkSaved = 0, .calTriggerSaved = 0, }; - ASSERT(pInfo->twAggSup.calTrigger != STREAM_TRIGGER_MAX_DELAY); + ASSERTS(pInfo->twAggSup.calTrigger != STREAM_TRIGGER_MAX_DELAY, "trigger type should not be max delay"); pInfo->primaryTsIndex = ((SColumnNode*)pIntervalPhyNode->window.pTspk)->slotId; size_t keyBufSize = sizeof(int64_t) + sizeof(int64_t) + POINTER_BYTES; initResultSizeInfo(&pOperator->resultInfo, 4096); @@ -2713,7 +2705,6 @@ SOperatorInfo* createStreamFinalIntervalOperatorInfo(SOperatorInfo* downstream, initStreamFunciton(pOperator->exprSupp.pCtx, pOperator->exprSupp.numOfExprs); - ASSERT(numOfCols > 0); initExecTimeWindowInfo(&pInfo->twAggSup.timeWindowData, &pTaskInfo->window); pInfo->pState = taosMemoryCalloc(1, sizeof(SStreamState)); @@ -2724,6 +2715,9 @@ SOperatorInfo* createStreamFinalIntervalOperatorInfo(SOperatorInfo* downstream, pInfo->pChildren = NULL; if (numOfChild > 0) { pInfo->pChildren = taosArrayInit(numOfChild, sizeof(void*)); + if (!pInfo->pChildren) { + goto _error; + } for (int32_t i = 0; i < numOfChild; i++) { SOperatorInfo* pChildOp = createStreamFinalIntervalOperatorInfo(NULL, pPhyNode, pTaskInfo, 0); if (pChildOp) { @@ -2746,7 +2740,6 @@ SOperatorInfo* createStreamFinalIntervalOperatorInfo(SOperatorInfo* downstream, // semi interval operator does not catch result pInfo->isFinal = false; pOperator->name = "StreamSemiIntervalOperator"; - ASSERT(pInfo->aggSup.currentPageId == -1); } if (!IS_FINAL_OP(pInfo) || numOfChild == 0) { @@ -3162,15 +3155,6 @@ static void doStreamSessionAggImpl(SOperatorInfo* pOperator, SSDataBlock* pSData } } -void deleteWindow(SArray* pWinInfos, int32_t index, FDelete fp) { - ASSERT(index >= 0 && index < taosArrayGetSize(pWinInfos)); - if (fp) { - void* ptr = taosArrayGet(pWinInfos, index); - fp(ptr); - } - taosArrayRemove(pWinInfos, index); -} - static void doDeleteTimeWindows(SStreamAggSupporter* pAggSup, SSDataBlock* pBlock, SArray* result) { SColumnInfoData* pStartTsCol = taosArrayGet(pBlock->pDataBlock, START_TS_COLUMN_INDEX); TSKEY* startDatas = (TSKEY*)pStartTsCol->pData; @@ -3218,7 +3202,6 @@ static int32_t copyUpdateResult(SSHashObj* pStUpdated, SArray* pUpdated) { int32_t iter = 0; while ((pIte = tSimpleHashIterate(pStUpdated, pIte, &iter)) != NULL) { void* key = tSimpleHashGetKey(pIte, &keyLen); - ASSERT(keyLen == sizeof(SSessionKey)); taosArrayPush(pUpdated, key); } taosArraySort(pUpdated, sessionKeyCompareAsc); @@ -3279,7 +3262,6 @@ static void rebuildSessionWindow(SOperatorInfo* pOperator, SArray* pWinArray, SS SStreamAggSupporter* pAggSup = &pInfo->streamAggSup; int32_t numOfOutput = pSup->numOfExprs; int32_t numOfChildren = taosArrayGetSize(pInfo->pChildren); - ASSERT(pInfo->pChildren); for (int32_t i = 0; i < size; i++) { SSessionKey* pWinKey = taosArrayGet(pWinArray, i); @@ -3380,7 +3362,6 @@ static void copyDeleteWindowInfo(SArray* pResWins, SSHashObj* pStDeleted) { void initGroupResInfoFromArrayList(SGroupResInfo* pGroupResInfo, SArray* pArrayList) { pGroupResInfo->pRows = pArrayList; pGroupResInfo->index = 0; - ASSERT(pGroupResInfo->index <= getNumOfTotalRes(pGroupResInfo)); } void doBuildSessionResult(SOperatorInfo* pOperator, SStreamState* pState, SGroupResInfo* pGroupResInfo, @@ -4811,7 +4792,6 @@ SOperatorInfo* createStreamIntervalOperatorInfo(SOperatorInfo* downstream, SPhys int32_t code = TSDB_CODE_SUCCESS; int32_t numOfCols = 0; SExprInfo* pExprInfo = createExprInfo(pIntervalPhyNode->window.pFuncs, NULL, &numOfCols); - ASSERT(numOfCols > 0); SSDataBlock* pResBlock = createDataBlockFromDescNode(pPhyNode->pOutputDataBlockDesc); SInterval interval = { @@ -4831,7 +4811,7 @@ SOperatorInfo* createStreamIntervalOperatorInfo(SOperatorInfo* downstream, SPhys .deleteMark = getDeleteMark(pIntervalPhyNode), }; - ASSERT(twAggSupp.calTrigger != STREAM_TRIGGER_MAX_DELAY); + ASSERTS(twAggSupp.calTrigger != STREAM_TRIGGER_MAX_DELAY, "trigger type should not be max delay"); pOperator->pTaskInfo = pTaskInfo; pInfo->interval = interval; From e08797ac0a6274b393ac09f6765b98b73de70990 Mon Sep 17 00:00:00 2001 From: kailixu Date: Mon, 26 Dec 2022 19:43:37 +0800 Subject: [PATCH 35/63] fix: ctg lock/unlock logic --- source/libs/catalog/src/ctgAsync.c | 7 +++++-- source/libs/catalog/src/ctgCache.c | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/source/libs/catalog/src/ctgAsync.c b/source/libs/catalog/src/ctgAsync.c index acd18fcca5..e9273c5b1f 100644 --- a/source/libs/catalog/src/ctgAsync.c +++ b/source/libs/catalog/src/ctgAsync.c @@ -471,16 +471,19 @@ int32_t ctgHandleForceUpdate(SCatalog* pCtg, int32_t taskNum, SCtgJob* pJob, con } int32_t ctgInitTask(SCtgJob* pJob, CTG_TASK_TYPE type, void* param, int32_t* taskId) { + int32_t code = 0; int32_t tid = atomic_fetch_add_32(&pJob->taskIdx, 1); CTG_LOCK(CTG_WRITE, &pJob->taskLock); - CTG_ERR_RET((*gCtgAsyncFps[type].initFp)(pJob, tid, param)); - CTG_UNLOCK(CTG_WRITE, &pJob->taskLock); + CTG_ERR_JRET((*gCtgAsyncFps[type].initFp)(pJob, tid, param)); if (taskId) { *taskId = tid; } +_return: + CTG_UNLOCK(CTG_WRITE, &pJob->taskLock); + return TSDB_CODE_SUCCESS; } diff --git a/source/libs/catalog/src/ctgCache.c b/source/libs/catalog/src/ctgCache.c index fe83854a91..c266cc1df9 100644 --- a/source/libs/catalog/src/ctgCache.c +++ b/source/libs/catalog/src/ctgCache.c @@ -2500,6 +2500,7 @@ int32_t ctgGetTbMetasFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgTbMe CTG_LOCK(CTG_READ, &pCache->metaLock); if (NULL == pCache->pMeta) { + CTG_UNLOCK(CTG_READ, &pCache->metaLock); ctgDebug("tb %s meta not in cache, dbFName:%s", pName->tname, dbFName); ctgAddFetch(&ctx->pFetchs, dbIdx, i, fetchIdx, baseResIdx + i, flag); taosArraySetSize(ctx->pResList, taosArrayGetSize(ctx->pResList) + 1); From 5e6230fac6ca40bde9c1a1f82d67d11caa69dc95 Mon Sep 17 00:00:00 2001 From: kailixu Date: Mon, 26 Dec 2022 19:46:39 +0800 Subject: [PATCH 36/63] fix: ctg lock/unlock logic --- source/libs/catalog/src/ctgAsync.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/libs/catalog/src/ctgAsync.c b/source/libs/catalog/src/ctgAsync.c index e9273c5b1f..b8590c9255 100644 --- a/source/libs/catalog/src/ctgAsync.c +++ b/source/libs/catalog/src/ctgAsync.c @@ -484,7 +484,7 @@ int32_t ctgInitTask(SCtgJob* pJob, CTG_TASK_TYPE type, void* param, int32_t* tas _return: CTG_UNLOCK(CTG_WRITE, &pJob->taskLock); - return TSDB_CODE_SUCCESS; + return code; } int32_t ctgInitJob(SCatalog* pCtg, SRequestConnInfo* pConn, SCtgJob** job, const SCatalogReq* pReq, catalogCallback fp, From d8922990788c401eb6e9eaa282f5675a73ee81b6 Mon Sep 17 00:00:00 2001 From: Xuefeng Tan <1172915550@qq.com> Date: Mon, 26 Dec 2022 20:02:26 +0800 Subject: [PATCH 37/63] fix(taosAdapter): invalid pointer on stack (#19156) --- cmake/taosadapter_CMakeLists.txt.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/taosadapter_CMakeLists.txt.in b/cmake/taosadapter_CMakeLists.txt.in index a47b3b0feb..31ca6b30fa 100644 --- a/cmake/taosadapter_CMakeLists.txt.in +++ b/cmake/taosadapter_CMakeLists.txt.in @@ -2,7 +2,7 @@ # taosadapter ExternalProject_Add(taosadapter GIT_REPOSITORY https://github.com/taosdata/taosadapter.git - GIT_TAG f0c1753 + GIT_TAG 5662a6d SOURCE_DIR "${TD_SOURCE_DIR}/tools/taosadapter" BINARY_DIR "" #BUILD_IN_SOURCE TRUE From 794fb5d1b516800e5b6bde26367c851fcc0057b9 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Mon, 26 Dec 2022 20:40:33 +0800 Subject: [PATCH 38/63] fix: handle error if sync buffer is full --- include/util/taoserror.h | 1 + source/dnode/vnode/src/vnd/vnodeSync.c | 4 ++-- source/libs/sync/inc/syncPipeline.h | 2 ++ source/libs/sync/src/syncMain.c | 10 +++++++--- source/libs/sync/src/syncPipeline.c | 23 +++++++++++++---------- source/util/src/terror.c | 1 + 6 files changed, 26 insertions(+), 15 deletions(-) diff --git a/include/util/taoserror.h b/include/util/taoserror.h index 3823252de6..b315432be1 100644 --- a/include/util/taoserror.h +++ b/include/util/taoserror.h @@ -520,6 +520,7 @@ int32_t* taosGetErrno(); #define TSDB_CODE_SYN_BATCH_ERROR TAOS_DEF_ERROR_CODE(0, 0x0913) #define TSDB_CODE_SYN_RESTORING TAOS_DEF_ERROR_CODE(0, 0x0914) #define TSDB_CODE_SYN_INVALID_SNAPSHOT_MSG TAOS_DEF_ERROR_CODE(0, 0x0915) // internal +#define TSDB_CODE_SYN_BUFFER_FULL TAOS_DEF_ERROR_CODE(0, 0x0916) // #define TSDB_CODE_SYN_INTERNAL_ERROR TAOS_DEF_ERROR_CODE(0, 0x09FF) // tq diff --git a/source/dnode/vnode/src/vnd/vnodeSync.c b/source/dnode/vnode/src/vnd/vnodeSync.c index 0437703c92..5697487743 100644 --- a/source/dnode/vnode/src/vnd/vnodeSync.c +++ b/source/dnode/vnode/src/vnd/vnodeSync.c @@ -391,9 +391,9 @@ static int32_t vnodeSyncApplyMsg(const SSyncFSM *pFsm, SRpcMsg *pMsg, const SFsm const STraceId *trace = &pMsg->info.traceId; vGTrace("vgId:%d, commit-cb is excuted, fsm:%p, index:%" PRId64 ", term:%" PRIu64 ", msg-index:%" PRId64 - ", weak:%d, code:%d, state:%d %s, type:%s", + ", weak:%d, code:%d, state:%d %s, type:%s code:0x%x", pVnode->config.vgId, pFsm, pMeta->index, pMeta->term, pMsg->info.conn.applyIndex, pMeta->isWeak, pMeta->code, - pMeta->state, syncStr(pMeta->state), TMSG_INFO(pMsg->msgType)); + pMeta->state, syncStr(pMeta->state), TMSG_INFO(pMsg->msgType), pMsg->code); return tmsgPutToQueue(&pVnode->msgCb, APPLY_QUEUE, pMsg); } diff --git a/source/libs/sync/inc/syncPipeline.h b/source/libs/sync/inc/syncPipeline.h index 9188be2b42..a0a0691694 100644 --- a/source/libs/sync/inc/syncPipeline.h +++ b/source/libs/sync/inc/syncPipeline.h @@ -109,6 +109,8 @@ SSyncRaftEntry* syncLogBufferGetOneEntry(SSyncLogBuffer* pBuf, SSyncNode* pNode, int32_t syncLogBufferValidate(SSyncLogBuffer* pBuf); int32_t syncLogBufferRollback(SSyncLogBuffer* pBuf, SSyncNode* pNode, SyncIndex toIndex); +int32_t syncLogFsmExecute(SSyncNode* pNode, SSyncFSM* pFsm, ESyncState role, SyncTerm term, SSyncRaftEntry* pEntry, + int32_t applyCode); #ifdef __cplusplus } #endif diff --git a/source/libs/sync/src/syncMain.c b/source/libs/sync/src/syncMain.c index 152e16bd2e..636890b5aa 100644 --- a/source/libs/sync/src/syncMain.c +++ b/source/libs/sync/src/syncMain.c @@ -2386,7 +2386,11 @@ int32_t syncCacheEntry(SSyncLogStore* pLogStore, SSyncRaftEntry* pEntry, LRUHand int32_t syncNodeAppend(SSyncNode* ths, SSyncRaftEntry* pEntry) { // append to log buffer if (syncLogBufferAppend(ths->pLogBuf, ths, pEntry) < 0) { - sError("vgId:%d, failed to enqueue sync log buffer. index:%" PRId64 "", ths->vgId, pEntry->index); + sError("vgId:%d, failed to enqueue sync log buffer, index:%" PRId64, ths->vgId, pEntry->index); + terrno = TSDB_CODE_SYN_BUFFER_FULL; + (void)syncLogFsmExecute(ths, ths->pFsm, ths->state, ths->pRaftStore->currentTerm, pEntry, + TSDB_CODE_SYN_BUFFER_FULL); + syncEntryDestroy(pEntry); return -1; } @@ -2685,8 +2689,8 @@ int32_t syncNodeOnClientRequest(SSyncNode* ths, SRpcMsg* pMsg, SyncIndex* pRetIn } int32_t code = syncNodeAppend(ths, pEntry); - if (code < 0 && ths->vgId != 1 && vnodeIsMsgBlock(pEntry->originalRpcType)) { - ASSERTS(false, "failed to append blocking msg"); + if (code < 0) { + sNError(ths, "failed to append blocking msg"); } return code; } diff --git a/source/libs/sync/src/syncPipeline.c b/source/libs/sync/src/syncPipeline.c index f2c86cef19..ef37600e98 100644 --- a/source/libs/sync/src/syncPipeline.c +++ b/source/libs/sync/src/syncPipeline.c @@ -26,6 +26,11 @@ #include "syncSnapshot.h" #include "syncUtil.h" +static bool syncIsMsgBlock(tmsg_t type) { + return (type == TDMT_VND_CREATE_TABLE) || (type == TDMT_VND_ALTER_TABLE) || (type == TDMT_VND_DROP_TABLE) || + (type == TDMT_VND_UPDATE_TAG_VAL) || (type == TDMT_VND_ALTER_CONFIRM); +} + int64_t syncLogBufferGetEndIndex(SSyncLogBuffer* pBuf) { taosThreadMutexLock(&pBuf->mutex); int64_t index = pBuf->endIndex; @@ -441,26 +446,25 @@ _out: return matchIndex; } -int32_t syncLogFsmExecute(SSyncNode* pNode, SSyncFSM* pFsm, ESyncState role, SyncTerm term, SSyncRaftEntry* pEntry) { - ASSERTS(pFsm->FpCommitCb != NULL, "No commit cb registered for the FSM"); - +int32_t syncLogFsmExecute(SSyncNode* pNode, SSyncFSM* pFsm, ESyncState role, SyncTerm term, SSyncRaftEntry* pEntry, + int32_t applyCode) { if ((pNode->replicaNum == 1) && pNode->restoreFinish && pNode->vgId != 1) { return 0; } - if (pNode->vgId != 1 && vnodeIsMsgBlock(pEntry->originalRpcType)) { - sTrace("vgId:%d, blocking msg ready to execute. index:%" PRId64 ", term: %" PRId64 ", type: %s", pNode->vgId, - pEntry->index, pEntry->term, TMSG_INFO(pEntry->originalRpcType)); + if (pNode->vgId != 1 && syncIsMsgBlock(pEntry->originalRpcType)) { + sTrace("vgId:%d, blocking msg ready to execute, index:%" PRId64 ", term:%" PRId64 ", type:%s code:0x%x", + pNode->vgId, pEntry->index, pEntry->term, TMSG_INFO(pEntry->originalRpcType), applyCode); } - SRpcMsg rpcMsg = {0}; + SRpcMsg rpcMsg = {.code = applyCode}; syncEntry2OriginalRpc(pEntry, &rpcMsg); SFsmCbMeta cbMeta = {0}; cbMeta.index = pEntry->index; cbMeta.lastConfigIndex = syncNodeGetSnapshotConfigIndex(pNode, pEntry->index); cbMeta.isWeak = pEntry->isWeak; - cbMeta.code = 0; + cbMeta.code = applyCode; cbMeta.state = role; cbMeta.seqNum = pEntry->seqNum; cbMeta.term = pEntry->term; @@ -469,7 +473,6 @@ int32_t syncLogFsmExecute(SSyncNode* pNode, SSyncFSM* pFsm, ESyncState role, Syn (void)syncRespMgrGetAndDel(pNode->pSyncRespMgr, cbMeta.seqNum, &rpcMsg.info); int32_t code = pFsm->FpCommitCb(pFsm, &rpcMsg, &cbMeta); - ASSERT(rpcMsg.pCont == NULL); return code; } @@ -520,7 +523,7 @@ int32_t syncLogBufferCommit(SSyncLogBuffer* pBuf, SSyncNode* pNode, int64_t comm pEntry->term, TMSG_INFO(pEntry->originalRpcType)); } - if (syncLogFsmExecute(pNode, pFsm, role, term, pEntry) != 0) { + if (syncLogFsmExecute(pNode, pFsm, role, term, pEntry, 0) != 0) { sError("vgId:%d, failed to execute sync log entry. index:%" PRId64 ", term:%" PRId64 ", role: %d, current term: %" PRId64, vgId, pEntry->index, pEntry->term, role, term); diff --git a/source/util/src/terror.c b/source/util/src/terror.c index 2d7121e2ae..ff61c7cdc4 100644 --- a/source/util/src/terror.c +++ b/source/util/src/terror.c @@ -407,6 +407,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_SYN_STANDBY_NOT_READY, "Sync not ready for st TAOS_DEFINE_ERROR(TSDB_CODE_SYN_BATCH_ERROR, "Sync batch error") TAOS_DEFINE_ERROR(TSDB_CODE_SYN_RESTORING, "Sync is restoring") TAOS_DEFINE_ERROR(TSDB_CODE_SYN_INVALID_SNAPSHOT_MSG, "Sync invalid snapshot msg") +TAOS_DEFINE_ERROR(TSDB_CODE_SYN_BUFFER_FULL, "Sync buffer is full") TAOS_DEFINE_ERROR(TSDB_CODE_SYN_INTERNAL_ERROR, "Sync internal error") //tq From a7bfeb5fbe1492bb9c486601cedd980ba16044ef Mon Sep 17 00:00:00 2001 From: Benguang Zhao Date: Mon, 26 Dec 2022 23:10:46 +0800 Subject: [PATCH 39/63] fix: check existence of SMsgHead in SSyncRaftEntry data or SRpcMsg pCont --- source/dnode/mgmt/mgmt_vnode/src/vmWorker.c | 8 ++++++++ source/libs/sync/src/syncMain.c | 18 +++++++++++++++--- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c b/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c index 7e3915f3d1..faa94a335d 100644 --- a/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c +++ b/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c @@ -233,6 +233,14 @@ int32_t vmPutMsgToMgmtQueue(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) { } int32_t vmPutRpcMsgToQueue(SVnodeMgmt *pMgmt, EQueueType qtype, SRpcMsg *pRpc) { + if (pRpc->contLen < sizeof(SMsgHead)) { + dError("invalid rpc msg since no msg head at pCont. pRpc:%p, type:%s, len:%d", pRpc, TMSG_INFO(pRpc->msgType), + pRpc->contLen); + rpcFreeCont(pRpc->pCont); + pRpc->pCont = NULL; + return -1; + } + SRpcMsg *pMsg = taosAllocateQitem(sizeof(SRpcMsg), RPC_QITEM, pRpc->contLen); if (pMsg == NULL) { rpcFreeCont(pRpc->pCont); diff --git a/source/libs/sync/src/syncMain.c b/source/libs/sync/src/syncMain.c index 152e16bd2e..b071aec2f4 100644 --- a/source/libs/sync/src/syncMain.c +++ b/source/libs/sync/src/syncMain.c @@ -2384,6 +2384,13 @@ int32_t syncCacheEntry(SSyncLogStore* pLogStore, SSyncRaftEntry* pEntry, LRUHand } int32_t syncNodeAppend(SSyncNode* ths, SSyncRaftEntry* pEntry) { + if (pEntry->dataLen < sizeof(SMsgHead)) { + sError("vgId:%d, cannot append an invalid client request with no msg head. type:%s, dataLen:%d", ths->vgId, + TMSG_INFO(pEntry->originalRpcType), pEntry->dataLen); + syncEntryDestroy(pEntry); + return -1; + } + // append to log buffer if (syncLogBufferAppend(ths->pLogBuf, ths, pEntry) < 0) { sError("vgId:%d, failed to enqueue sync log buffer. index:%" PRId64 "", ths->vgId, pEntry->index); @@ -2679,16 +2686,21 @@ int32_t syncNodeOnClientRequest(SSyncNode* ths, SRpcMsg* pMsg, SyncIndex* pRetIn pEntry = syncEntryBuildFromRpcMsg(pMsg, term, index); } + if (pEntry == NULL) { + sError("vgId:%d, failed to process client request since %s.", ths->vgId, terrstr()); + return -1; + } + if (ths->state == TAOS_SYNC_STATE_LEADER) { if (pRetIndex) { (*pRetIndex) = index; } int32_t code = syncNodeAppend(ths, pEntry); - if (code < 0 && ths->vgId != 1 && vnodeIsMsgBlock(pEntry->originalRpcType)) { - ASSERTS(false, "failed to append blocking msg"); - } return code; + } else { + syncEntryDestroy(pEntry); + pEntry = NULL; } return -1; From 58b5d2e0aafc4a0cfbc86c2b917cb4d630beba64 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Tue, 27 Dec 2022 11:02:07 +0800 Subject: [PATCH 40/63] fix(query): fix race condition. --- source/dnode/vnode/src/meta/metaCache.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/source/dnode/vnode/src/meta/metaCache.c b/source/dnode/vnode/src/meta/metaCache.c index 513ee5a1c2..d68658b0d9 100644 --- a/source/dnode/vnode/src/meta/metaCache.c +++ b/source/dnode/vnode/src/meta/metaCache.c @@ -57,7 +57,6 @@ struct SMetaCache { TdThreadMutex lock; SHashObj* pTableEntry; SLRUCache* pUidResCache; - uint64_t keyBuf[3]; } sTagFilterResCache; }; @@ -429,20 +428,20 @@ int32_t metaGetCachedTableUidList(SMeta* pMeta, tb_uid_t suid, const uint8_t* pK bool* acquireRes) { // generate the composed key for LRU cache SLRUCache* pCache = pMeta->pCache->sTagFilterResCache.pUidResCache; - uint64_t* pBuf = pMeta->pCache->sTagFilterResCache.keyBuf; SHashObj* pTableMap = pMeta->pCache->sTagFilterResCache.pTableEntry; TdThreadMutex* pLock = &pMeta->pCache->sTagFilterResCache.lock; + uint64_t buf[3] = {0}; uint32_t times = 0; *acquireRes = 0; - pBuf[0] = suid; - memcpy(&pBuf[1], pKey, keyLen); + buf[0] = suid; + memcpy(&buf[1], pKey, keyLen); taosThreadMutexLock(pLock); int32_t len = keyLen + sizeof(uint64_t); - LRUHandle* pHandle = taosLRUCacheLookup(pCache, pBuf, len); + LRUHandle* pHandle = taosLRUCacheLookup(pCache, buf, len); if (pHandle == NULL) { taosThreadMutexUnlock(pLock); return TSDB_CODE_SUCCESS; @@ -476,10 +475,10 @@ int32_t metaGetCachedTableUidList(SMeta* pMeta, tb_uid_t suid, const uint8_t* pK SListNode* pNode = NULL; while ((pNode = tdListNext(&iter)) != NULL) { - memcpy(&pBuf[1], pNode->data, keyLen); + memcpy(&buf[1], pNode->data, keyLen); // check whether it is existed in LRU cache, and remove it from linked list if not. - LRUHandle* pRes = taosLRUCacheLookup(pCache, pBuf, len); + LRUHandle* pRes = taosLRUCacheLookup(pCache, buf, len); if (pRes == NULL) { // remove the item in the linked list taosArrayPush(pInvalidRes, &pNode); } else { @@ -547,14 +546,14 @@ int32_t metaUidFilterCachePut(SMeta* pMeta, uint64_t suid, const void* pKey, int tdListAppend(&(*pEntry)->list, pKey); } - uint64_t* pBuf = pMeta->pCache->sTagFilterResCache.keyBuf; - pBuf[0] = suid; + uint64_t buf[3] = {0}; + buf[0] = suid; - memcpy(&pBuf[1], pKey, keyLen); + memcpy(&buf[1], pKey, keyLen); ASSERT(sizeof(uint64_t) + keyLen == 24); // add to cache. - taosLRUCacheInsert(pCache, pBuf, sizeof(uint64_t) + keyLen, pPayload, payloadLen, freePayload, NULL, + taosLRUCacheInsert(pCache, buf, sizeof(uint64_t) + keyLen, pPayload, payloadLen, freePayload, NULL, TAOS_LRU_PRIORITY_LOW); taosThreadMutexUnlock(pLock); From 5826e40aa7f228c31187c839456022fc483e2f44 Mon Sep 17 00:00:00 2001 From: Liu Jicong Date: Tue, 27 Dec 2022 11:19:36 +0800 Subject: [PATCH 41/63] enh: drop stream eagerly --- source/libs/stream/src/streamExec.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source/libs/stream/src/streamExec.c b/source/libs/stream/src/streamExec.c index 20608a6cf3..8e746c6738 100644 --- a/source/libs/stream/src/streamExec.c +++ b/source/libs/stream/src/streamExec.c @@ -48,6 +48,10 @@ static int32_t streamTaskExecImpl(SStreamTask* pTask, const void* data, SArray* // exec while (1) { + if (pTask->taskStatus == TASK_STATUS__DROPPING) { + return 0; + } + SSDataBlock* output = NULL; uint64_t ts = 0; if ((code = qExecTask(exec, &output, &ts)) < 0) { From bb9f2651f1a8b34ec843e10ebb4fd5f8929cc458 Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Tue, 27 Dec 2022 13:03:26 +0800 Subject: [PATCH 42/63] chore: add comp postfix for taos-tools (#19169) --- packaging/tools/makepkg.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packaging/tools/makepkg.sh b/packaging/tools/makepkg.sh index f30a8a637e..0ee548242f 100755 --- a/packaging/tools/makepkg.sh +++ b/packaging/tools/makepkg.sh @@ -348,7 +348,8 @@ cd ${release_dir} # install_dir has been distinguishes cluster from edege, so comments this code pkg_name=${install_dir}-${osType}-${cpuType} -taostools_pkg_name=${taostools_install_dir}-${osType}-${cpuType} +versionCompFirst=$(echo ${versionComp} | awk -F '.' '{print $1}') +taostools_pkg_name=${taostools_install_dir}-${osType}-${cpuType}-comp${versionCompFirst} # if [ "$verMode" == "cluster" ]; then # pkg_name=${install_dir}-${osType}-${cpuType} From 5ae6829a8379cfb1191697d381fb305d3343d01a Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Tue, 27 Dec 2022 13:28:28 +0800 Subject: [PATCH 43/63] fix: add sem free and init log --- source/libs/scheduler/src/schJob.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/source/libs/scheduler/src/schJob.c b/source/libs/scheduler/src/schJob.c index d422f0e88f..6a8f81f8c7 100644 --- a/source/libs/scheduler/src/schJob.c +++ b/source/libs/scheduler/src/schJob.c @@ -668,6 +668,7 @@ void schFreeJobImpl(void *job) { taosMemoryFreeClear(pJob->userRes.execRes); taosMemoryFreeClear(pJob->fetchRes); taosMemoryFreeClear(pJob->sql); + tsem_destroy(&pJob->rspSem); taosMemoryFree(pJob); int32_t jobNum = atomic_sub_fetch_32(&schMgmt.jobNum, 1); @@ -748,7 +749,10 @@ int32_t schInitJob(int64_t *pJobId, SSchedulerReq *pReq) { SCH_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); } - tsem_init(&pJob->rspSem, 0, 0); + if (tsem_init(&pJob->rspSem, 0, 0)) { + SCH_JOB_ELOG("tsem_init failed, errno:%d", errno); + SCH_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); + } pJob->refId = taosAddRef(schMgmt.jobRef, pJob); if (pJob->refId < 0) { From b2cec0f1e9c3c4f69fbb156513f22170dea2835e Mon Sep 17 00:00:00 2001 From: Liu Jicong Date: Tue, 27 Dec 2022 13:57:00 +0800 Subject: [PATCH 44/63] fix: skip msg --- source/dnode/vnode/src/tq/tq.c | 4 +++- source/dnode/vnode/src/vnd/vnodeSvr.c | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/source/dnode/vnode/src/tq/tq.c b/source/dnode/vnode/src/tq/tq.c index 045b497371..e366795fd3 100644 --- a/source/dnode/vnode/src/tq/tq.c +++ b/source/dnode/vnode/src/tq/tq.c @@ -1004,8 +1004,10 @@ int32_t tqProcessStreamTaskCheckReq(STQ* pTq, SRpcMsg* pMsg) { int32_t len; tEncodeSize(tEncodeSStreamTaskCheckRsp, &rsp, len, code); if (code < 0) { - ASSERT(0); + tqDebug("tq encode stream check rsp error"); + return -1; } + void* buf = rpcMallocCont(sizeof(SMsgHead) + len); ((SMsgHead*)buf)->vgId = htonl(req.upstreamNodeId); diff --git a/source/dnode/vnode/src/vnd/vnodeSvr.c b/source/dnode/vnode/src/vnd/vnodeSvr.c index fe9aad4a20..8d53579483 100644 --- a/source/dnode/vnode/src/vnd/vnodeSvr.c +++ b/source/dnode/vnode/src/vnd/vnodeSvr.c @@ -197,7 +197,7 @@ int32_t vnodeProcessWriteMsg(SVnode *pVnode, SRpcMsg *pMsg, int64_t version, SRp if (!syncUtilUserCommit(pMsg->msgType)) goto _exit; - if (pMsg->msgType == TDMT_VND_STREAM_RECOVER_BLOCKING_STAGE) { + if (pMsg->msgType == TDMT_VND_STREAM_RECOVER_BLOCKING_STAGE || pMsg->msgType == TDMT_STREAM_TASK_CHECK_RSP) { if (tqCheckLogInWal(pVnode->pTq, version)) return 0; } From b7f6d152f86431da4f1a0841778a463783bbedd1 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Tue, 27 Dec 2022 14:14:18 +0800 Subject: [PATCH 45/63] fix: display the correct log information --- source/common/src/tglobal.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c index 9caf0cc33e..ad89428d07 100644 --- a/source/common/src/tglobal.c +++ b/source/common/src/tglobal.c @@ -1316,12 +1316,17 @@ void taosSetDebugFlag(int32_t *pFlagPtr, const char *flagName, int32_t flagVal, if (pItem != NULL && (rewrite || pItem->i32 == 0)) { pItem->i32 = flagVal; } - *pFlagPtr = flagVal; + if (pFlagPtr != NULL) { + *pFlagPtr = flagVal; + } } void taosSetAllDebugFlag(int32_t flag, bool rewrite) { if (flag <= 0) return; + taosSetDebugFlag(NULL, "debugFlag", flag, rewrite); + taosSetDebugFlag(NULL, "simDebugFlag", flag, rewrite); + taosSetDebugFlag(NULL, "tmrDebugFlag", flag, rewrite); taosSetDebugFlag(&uDebugFlag, "uDebugFlag", flag, rewrite); taosSetDebugFlag(&rpcDebugFlag, "rpcDebugFlag", flag, rewrite); taosSetDebugFlag(&jniDebugFlag, "jniDebugFlag", flag, rewrite); @@ -1333,6 +1338,7 @@ void taosSetAllDebugFlag(int32_t flag, bool rewrite) { taosSetDebugFlag(&wDebugFlag, "wDebugFlag", flag, rewrite); taosSetDebugFlag(&sDebugFlag, "sDebugFlag", flag, rewrite); taosSetDebugFlag(&tsdbDebugFlag, "tsdbDebugFlag", flag, rewrite); + taosSetDebugFlag(&tsdbDebugFlag, "tsdbDebugFlag", flag, rewrite); taosSetDebugFlag(&tqDebugFlag, "tqDebugFlag", flag, rewrite); taosSetDebugFlag(&fsDebugFlag, "fsDebugFlag", flag, rewrite); taosSetDebugFlag(&udfDebugFlag, "udfDebugFlag", flag, rewrite); @@ -1340,6 +1346,5 @@ void taosSetAllDebugFlag(int32_t flag, bool rewrite) { taosSetDebugFlag(&idxDebugFlag, "idxDebugFlag", flag, rewrite); taosSetDebugFlag(&tdbDebugFlag, "tdbDebugFlag", flag, rewrite); taosSetDebugFlag(&metaDebugFlag, "metaDebugFlag", flag, rewrite); - taosSetDebugFlag(&metaDebugFlag, "tmrDebugFlag", flag, rewrite); uInfo("all debug flag are set to %d", flag); } From 861493010ea689b790defe795b376c619f2f00f1 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Tue, 27 Dec 2022 14:15:20 +0800 Subject: [PATCH 46/63] fix: display the correct log information --- source/common/src/tglobal.c | 1 - 1 file changed, 1 deletion(-) diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c index ad89428d07..d3fd625a91 100644 --- a/source/common/src/tglobal.c +++ b/source/common/src/tglobal.c @@ -1338,7 +1338,6 @@ void taosSetAllDebugFlag(int32_t flag, bool rewrite) { taosSetDebugFlag(&wDebugFlag, "wDebugFlag", flag, rewrite); taosSetDebugFlag(&sDebugFlag, "sDebugFlag", flag, rewrite); taosSetDebugFlag(&tsdbDebugFlag, "tsdbDebugFlag", flag, rewrite); - taosSetDebugFlag(&tsdbDebugFlag, "tsdbDebugFlag", flag, rewrite); taosSetDebugFlag(&tqDebugFlag, "tqDebugFlag", flag, rewrite); taosSetDebugFlag(&fsDebugFlag, "fsDebugFlag", flag, rewrite); taosSetDebugFlag(&udfDebugFlag, "udfDebugFlag", flag, rewrite); From ab8efc828d4837fb5447355663772617e656669d Mon Sep 17 00:00:00 2001 From: Benguang Zhao Date: Tue, 27 Dec 2022 14:23:09 +0800 Subject: [PATCH 47/63] enh: check existence of msg head at SRpcMsg pCont in vmPutMsgToQueue --- source/dnode/mgmt/mgmt_vnode/src/vmWorker.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c b/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c index faa94a335d..5afb9a0512 100644 --- a/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c +++ b/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c @@ -140,6 +140,12 @@ static void vmProcessSyncQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t numOf static int32_t vmPutMsgToQueue(SVnodeMgmt *pMgmt, SRpcMsg *pMsg, EQueueType qtype) { const STraceId *trace = &pMsg->info.traceId; + if (pMsg->contLen < sizeof(SMsgHead)) { + dGError("invalid rpc msg with no msg head at pCont. pMsg:%p, type:%s, contLen:%d", pMsg, TMSG_INFO(pMsg->msgType), + pMsg->contLen); + return -1; + } + SMsgHead *pHead = pMsg->pCont; int32_t code = 0; @@ -234,7 +240,7 @@ int32_t vmPutMsgToMgmtQueue(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) { int32_t vmPutRpcMsgToQueue(SVnodeMgmt *pMgmt, EQueueType qtype, SRpcMsg *pRpc) { if (pRpc->contLen < sizeof(SMsgHead)) { - dError("invalid rpc msg since no msg head at pCont. pRpc:%p, type:%s, len:%d", pRpc, TMSG_INFO(pRpc->msgType), + dError("invalid rpc msg with no msg head at pCont. pRpc:%p, type:%s, len:%d", pRpc, TMSG_INFO(pRpc->msgType), pRpc->contLen); rpcFreeCont(pRpc->pCont); pRpc->pCont = NULL; From 39eb62d80d3fb20a37e9319b856f01a3770ae7c1 Mon Sep 17 00:00:00 2001 From: Liu Jicong Date: Tue, 27 Dec 2022 14:35:55 +0800 Subject: [PATCH 48/63] enh: set scan limit --- include/libs/executor/executor.h | 1 + source/libs/executor/inc/executorimpl.h | 128 +++++++++++++----------- source/libs/executor/src/executor.c | 4 + source/libs/executor/src/scanoperator.c | 44 +++++--- source/libs/stream/src/streamExec.c | 6 +- 5 files changed, 105 insertions(+), 78 deletions(-) diff --git a/include/libs/executor/executor.h b/include/libs/executor/executor.h index 412b4b4cf6..cfd5bd1ed7 100644 --- a/include/libs/executor/executor.h +++ b/include/libs/executor/executor.h @@ -213,6 +213,7 @@ int32_t qStreamSourceRecoverStep1(qTaskInfo_t tinfo, int64_t ver); int32_t qStreamSourceRecoverStep2(qTaskInfo_t tinfo, int64_t ver); int32_t qStreamRecoverFinish(qTaskInfo_t tinfo); int32_t qStreamRestoreParam(qTaskInfo_t tinfo); +bool qStreamRecoverScanFinished(qTaskInfo_t tinfo); #ifdef __cplusplus } diff --git a/source/libs/executor/inc/executorimpl.h b/source/libs/executor/inc/executorimpl.h index 647da78a78..e3b4b57052 100644 --- a/source/libs/executor/inc/executorimpl.h +++ b/source/libs/executor/inc/executorimpl.h @@ -136,6 +136,7 @@ typedef struct { SSchemaWrapper* schema; char tbName[TSDB_TABLE_NAME_LEN]; int8_t recoverStep; + int8_t recoverScanFinished; SQueryTableDataCond tableCond; int64_t fillHistoryVer1; int64_t fillHistoryVer2; @@ -182,7 +183,7 @@ struct SExecTaskInfo { SSubplan* pSubplan; struct SOperatorInfo* pRoot; SLocalFetch localFetch; - SArray* pResultBlockList;// result block list + SArray* pResultBlockList; // result block list STaskStopInfo stopInfo; }; @@ -199,7 +200,7 @@ typedef struct SOperatorFpSet { __optr_fn_t getNextFn; __optr_fn_t cleanupFn; // call this function to release the allocated resources ASAP __optr_close_fn_t closeFn; - __optr_reqBuf_fn_t reqBufFn; // total used buffer for blocking operator + __optr_reqBuf_fn_t reqBufFn; // total used buffer for blocking operator __optr_encode_fn_t encodeResultRow; __optr_decode_fn_t decodeResultRow; __optr_explain_fn_t getExplainFn; @@ -255,22 +256,22 @@ typedef struct SLimitInfo { } SLimitInfo; typedef struct SExchangeInfo { - SArray* pSources; - SArray* pSourceDataInfo; - tsem_t ready; - void* pTransporter; + SArray* pSources; + SArray* pSourceDataInfo; + tsem_t ready; + void* pTransporter; // SArray, result block list, used to keep the multi-block that // passed by downstream operator - SArray* pResultBlockList; - SArray* pRecycledBlocks;// build a pool for small data block to avoid to repeatly create and then destroy. - SSDataBlock* pDummyBlock; // dummy block, not keep data - bool seqLoadData; // sequential load data or not, false by default - int32_t current; + SArray* pResultBlockList; + SArray* pRecycledBlocks; // build a pool for small data block to avoid to repeatly create and then destroy. + SSDataBlock* pDummyBlock; // dummy block, not keep data + bool seqLoadData; // sequential load data or not, false by default + int32_t current; SLoadRemoteDataInfo loadInfo; uint64_t self; SLimitInfo limitInfo; - int64_t openedTs; // start exec time stamp, todo: move to SLoadRemoteDataInfo + int64_t openedTs; // start exec time stamp, todo: move to SLoadRemoteDataInfo } SExchangeInfo; typedef struct SScanInfo { @@ -305,9 +306,9 @@ typedef struct { } SAggOptrPushDownInfo; typedef struct STableMetaCacheInfo { - SLRUCache* pTableMetaEntryCache; // 100 by default - uint64_t metaFetch; - uint64_t cacheHit; + SLRUCache* pTableMetaEntryCache; // 100 by default + uint64_t metaFetch; + uint64_t cacheHit; } STableMetaCacheInfo; typedef struct STableScanBase { @@ -325,46 +326,46 @@ typedef struct STableScanBase { } STableScanBase; typedef struct STableScanInfo { - STableScanBase base; - SScanInfo scanInfo; - int32_t scanTimes; - SSDataBlock* pResBlock; - SSampleExecInfo sample; // sample execution info - int32_t currentGroupId; - int32_t currentTable; - int8_t scanMode; - int8_t assignBlockUid; - bool hasGroupByTag; + STableScanBase base; + SScanInfo scanInfo; + int32_t scanTimes; + SSDataBlock* pResBlock; + SSampleExecInfo sample; // sample execution info + int32_t currentGroupId; + int32_t currentTable; + int8_t scanMode; + int8_t assignBlockUid; + bool hasGroupByTag; } STableScanInfo; typedef struct STableMergeScanInfo { - int32_t tableStartIndex; - int32_t tableEndIndex; - bool hasGroupId; - uint64_t groupId; - SArray* queryConds; // array of queryTableDataCond - STableScanBase base; - int32_t bufPageSize; - uint32_t sortBufSize; // max buffer size for in-memory sort - SArray* pSortInfo; - SSortHandle* pSortHandle; - SSDataBlock* pSortInputBlock; - int64_t startTs; // sort start time - SArray* sortSourceParams; - SLimitInfo limitInfo; - int64_t numOfRows; - SScanInfo scanInfo; - SSDataBlock* pResBlock; - SSampleExecInfo sample; // sample execution info - SSortExecInfo sortExecInfo; + int32_t tableStartIndex; + int32_t tableEndIndex; + bool hasGroupId; + uint64_t groupId; + SArray* queryConds; // array of queryTableDataCond + STableScanBase base; + int32_t bufPageSize; + uint32_t sortBufSize; // max buffer size for in-memory sort + SArray* pSortInfo; + SSortHandle* pSortHandle; + SSDataBlock* pSortInputBlock; + int64_t startTs; // sort start time + SArray* sortSourceParams; + SLimitInfo limitInfo; + int64_t numOfRows; + SScanInfo scanInfo; + SSDataBlock* pResBlock; + SSampleExecInfo sample; // sample execution info + SSortExecInfo sortExecInfo; } STableMergeScanInfo; typedef struct STagScanInfo { - SColumnInfo* pCols; - SSDataBlock* pRes; - SColMatchInfo matchInfo; - int32_t curPos; - SReadHandle readHandle; + SColumnInfo* pCols; + SSDataBlock* pRes; + SColMatchInfo matchInfo; + int32_t curPos; + SReadHandle readHandle; } STagScanInfo; typedef enum EStreamScanMode { @@ -468,6 +469,11 @@ typedef struct SStreamScanInfo { SNodeList* pGroupTags; SNode* pTagCond; SNode* pTagIndexCond; + + // recover + int32_t blockRecoverContiCnt; + int32_t blockRecoverTotCnt; + } SStreamScanInfo; typedef struct { @@ -499,8 +505,8 @@ typedef struct STableCountScanOperatorInfo { STableCountScanSupp supp; - int32_t currGrpIdx; - SArray* stbUidList; // when group by db_name and/or stable_name + int32_t currGrpIdx; + SArray* stbUidList; // when group by db_name and/or stable_name } STableCountScanOperatorInfo; typedef struct SOptrBasicInfo { @@ -678,19 +684,19 @@ void setOperatorInfo(SOperatorInfo* pOperator, const char* name, int32 void destroyOperatorInfo(SOperatorInfo* pOperator); int32_t optrDefaultBufFn(SOperatorInfo* pOperator); -void initBasicInfo(SOptrBasicInfo* pInfo, SSDataBlock* pBlock); -void cleanupBasicInfo(SOptrBasicInfo* pInfo); +void initBasicInfo(SOptrBasicInfo* pInfo, SSDataBlock* pBlock); +void cleanupBasicInfo(SOptrBasicInfo* pInfo); int32_t initExprSupp(SExprSupp* pSup, SExprInfo* pExprInfo, int32_t numOfExpr); void cleanupExprSupp(SExprSupp* pSup); -void destroyExprInfo(SExprInfo* pExpr, int32_t numOfExprs); +void destroyExprInfo(SExprInfo* pExpr, int32_t numOfExprs); int32_t initAggSup(SExprSupp* pSup, SAggSupporter* pAggSup, SExprInfo* pExprInfo, int32_t numOfCols, size_t keyBufSize, const char* pkey); void cleanupAggSup(SAggSupporter* pAggSup); -void initResultSizeInfo(SResultInfo* pResultInfo, int32_t numOfRows); +void initResultSizeInfo(SResultInfo* pResultInfo, int32_t numOfRows); void doBuildStreamResBlock(SOperatorInfo* pOperator, SOptrBasicInfo* pbInfo, SGroupResInfo* pGroupResInfo, SDiskbasedBuf* pBuf); @@ -803,10 +809,10 @@ void setInputDataBlock(SExprSupp* pExprSupp, SSDataBlock* pBlock, int32_t order, int32_t checkForQueryBuf(size_t numOfTables); -bool isTaskKilled(SExecTaskInfo* pTaskInfo); -void setTaskKilled(SExecTaskInfo* pTaskInfo, int32_t rspCode); -void doDestroyTask(SExecTaskInfo* pTaskInfo); -void setTaskStatus(SExecTaskInfo* pTaskInfo, int8_t status); +bool isTaskKilled(SExecTaskInfo* pTaskInfo); +void setTaskKilled(SExecTaskInfo* pTaskInfo, int32_t rspCode); +void doDestroyTask(SExecTaskInfo* pTaskInfo); +void setTaskStatus(SExecTaskInfo* pTaskInfo, int8_t status); int32_t createExecTaskInfoImpl(SSubplan* pPlan, SExecTaskInfo** pTaskInfo, SReadHandle* pHandle, uint64_t taskId, char* sql, EOPTR_EXEC_MODEL model); @@ -828,8 +834,8 @@ bool isDeletedWindow(STimeWindow* pWin, uint64_t groupId, SAggSupporter* pSup); bool isDeletedStreamWindow(STimeWindow* pWin, uint64_t groupId, SStreamState* pState, STimeWindowAggSupp* pTwSup); void appendOneRowToStreamSpecialBlock(SSDataBlock* pBlock, TSKEY* pStartTs, TSKEY* pEndTs, uint64_t* pUid, uint64_t* pGp, void* pTbName); -uint64_t calGroupIdByData(SPartitionBySupporter* pParSup, SExprSupp* pExprSup, SSDataBlock* pBlock, int32_t rowId); -void calBlockTbName(SStreamScanInfo* pInfo, SSDataBlock* pBlock); +uint64_t calGroupIdByData(SPartitionBySupporter* pParSup, SExprSupp* pExprSup, SSDataBlock* pBlock, int32_t rowId); +void calBlockTbName(SStreamScanInfo* pInfo, SSDataBlock* pBlock); int32_t finalizeResultRows(SDiskbasedBuf* pBuf, SResultRowPosition* resultRowPosition, SExprSupp* pSup, SSDataBlock* pBlock, SExecTaskInfo* pTaskInfo); diff --git a/source/libs/executor/src/executor.c b/source/libs/executor/src/executor.c index 75de012947..e5ff104d5c 100644 --- a/source/libs/executor/src/executor.c +++ b/source/libs/executor/src/executor.c @@ -936,6 +936,10 @@ int32_t qStreamRestoreParam(qTaskInfo_t tinfo) { } return 0; } +bool qStreamRecoverScanFinished(qTaskInfo_t tinfo) { + SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo; + return pTaskInfo->streamInfo.recoverScanFinished; +} void* qExtractReaderFromStreamScanner(void* scanner) { SStreamScanInfo* pInfo = scanner; diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index d074ceede8..79687a5ff8 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -768,8 +768,8 @@ static SSDataBlock* doTableScan(SOperatorInfo* pOperator) { tableListGetGroupList(pTaskInfo->pTableInfoList, pInfo->currentGroupId, &pList, &num); ASSERT(pInfo->base.dataReader == NULL); - int32_t code = tsdbReaderOpen(pInfo->base.readHandle.vnode, &pInfo->base.cond, pList, num, - pInfo->pResBlock, (STsdbReader**)&pInfo->base.dataReader, GET_TASKID(pTaskInfo)); + int32_t code = tsdbReaderOpen(pInfo->base.readHandle.vnode, &pInfo->base.cond, pList, num, pInfo->pResBlock, + (STsdbReader**)&pInfo->base.dataReader, GET_TASKID(pTaskInfo)); if (code != TSDB_CODE_SUCCESS) { T_LONG_JMP(pTaskInfo->env, code); } @@ -986,8 +986,8 @@ static SSDataBlock* readPreVersionData(SOperatorInfo* pTableScanOp, uint64_t tbU SSDataBlock* pBlock = pTableScanInfo->pResBlock; STsdbReader* pReader = NULL; - int32_t code = tsdbReaderOpen(pTableScanInfo->base.readHandle.vnode, &cond, &tblInfo, 1, pBlock, (STsdbReader**)&pReader, - GET_TASKID(pTaskInfo)); + int32_t code = tsdbReaderOpen(pTableScanInfo->base.readHandle.vnode, &cond, &tblInfo, 1, pBlock, + (STsdbReader**)&pReader, GET_TASKID(pTaskInfo)); if (code != TSDB_CODE_SUCCESS) { terrno = code; T_LONG_JMP(pTaskInfo->env, code); @@ -995,7 +995,7 @@ static SSDataBlock* readPreVersionData(SOperatorInfo* pTableScanOp, uint64_t tbU } if (tsdbNextDataBlock(pReader)) { - /*SSDataBlock* p = */tsdbRetrieveDataBlock(pReader, NULL); + /*SSDataBlock* p = */ tsdbRetrieveDataBlock(pReader, NULL); doSetTagColumnData(&pTableScanInfo->base, pBlock, pTaskInfo, pBlock->info.rows); pBlock->info.id.groupId = getTableGroupId(pTaskInfo->pTableInfoList, pBlock->info.id.uid); } @@ -1224,7 +1224,7 @@ static int32_t generateIntervalScanRange(SStreamScanInfo* pInfo, SSDataBlock* pS SColumnInfoData* pSrcUidCol = taosArrayGet(pSrcBlock->pDataBlock, UID_COLUMN_INDEX); SColumnInfoData* pSrcGpCol = taosArrayGet(pSrcBlock->pDataBlock, GROUPID_COLUMN_INDEX); - uint64_t* srcUidData = (uint64_t*)pSrcUidCol->pData; + uint64_t* srcUidData = (uint64_t*)pSrcUidCol->pData; ASSERT(pSrcStartTsCol->info.type == TSDB_DATA_TYPE_TIMESTAMP); TSKEY* srcStartTsCol = (TSKEY*)pSrcStartTsCol->pData; TSKEY* srcEndTsCol = (TSKEY*)pSrcEndTsCol->pData; @@ -1753,11 +1753,18 @@ static SSDataBlock* doStreamScan(SOperatorInfo* pOperator) { pTSInfo->scanTimes = 0; pTSInfo->currentGroupId = -1; pTaskInfo->streamInfo.recoverStep = STREAM_RECOVER_STEP__SCAN; + pTaskInfo->streamInfo.recoverScanFinished = false; } if (pTaskInfo->streamInfo.recoverStep == STREAM_RECOVER_STEP__SCAN) { + if (pInfo->blockRecoverContiCnt > 100) { + pInfo->blockRecoverTotCnt += pInfo->blockRecoverContiCnt; + pInfo->blockRecoverContiCnt = 0; + return NULL; + } SSDataBlock* pBlock = doTableScan(pInfo->pTableScanOp); if (pBlock != NULL) { + pInfo->blockRecoverContiCnt++; calBlockTbName(pInfo, pBlock); if (pInfo->pUpdateInfo) { TSKEY maxTs = updateInfoFillBlockData(pInfo->pUpdateInfo, pBlock, pInfo->primaryTsIndex); @@ -1775,6 +1782,7 @@ static SSDataBlock* doStreamScan(SOperatorInfo* pOperator) { pTSInfo->base.cond.startVersion = -1; pTSInfo->base.cond.endVersion = -1; + pTaskInfo->streamInfo.recoverScanFinished = true; return NULL; } @@ -2285,7 +2293,8 @@ SOperatorInfo* createStreamScanOperatorInfo(SReadHandle* pHandle, STableScanPhys if (pHandle->initTableReader) { pTSInfo->scanMode = TABLE_SCAN__TABLE_ORDER; pTSInfo->base.dataReader = NULL; - code = tsdbReaderOpen(pHandle->vnode, &pTSInfo->base.cond, pList, num, pTSInfo->pResBlock, &pTSInfo->base.dataReader, NULL); + code = tsdbReaderOpen(pHandle->vnode, &pTSInfo->base.cond, pList, num, pTSInfo->pResBlock, + &pTSInfo->base.dataReader, NULL); if (code != 0) { terrno = code; destroyTableScanOperatorInfo(pTableScanOp); @@ -2355,7 +2364,8 @@ SOperatorInfo* createStreamScanOperatorInfo(SReadHandle* pHandle, STableScanPhys pOperator->exprSupp.numOfExprs = taosArrayGetSize(pInfo->pRes->pDataBlock); __optr_fn_t nextFn = pTaskInfo->execModel == OPTR_EXEC_MODEL_STREAM ? doStreamScan : doQueueScan; - pOperator->fpSet = createOperatorFpSet(optrDummyOpenFn, nextFn, NULL, destroyStreamScanOperatorInfo, optrDefaultBufFn, NULL); + pOperator->fpSet = + createOperatorFpSet(optrDummyOpenFn, nextFn, NULL, destroyStreamScanOperatorInfo, optrDefaultBufFn, NULL); return pOperator; @@ -2492,7 +2502,8 @@ SOperatorInfo* createTagScanOperatorInfo(SReadHandle* pReadHandle, STagScanPhysi initResultSizeInfo(&pOperator->resultInfo, 4096); blockDataEnsureCapacity(pInfo->pRes, pOperator->resultInfo.capacity); - pOperator->fpSet = createOperatorFpSet(optrDummyOpenFn, doTagScan, NULL, destroyTagScanOperatorInfo, optrDefaultBufFn, NULL); + pOperator->fpSet = + createOperatorFpSet(optrDummyOpenFn, doTagScan, NULL, destroyTagScanOperatorInfo, optrDefaultBufFn, NULL); return pOperator; @@ -2513,11 +2524,12 @@ static SSDataBlock* getTableDataBlockImpl(void* param) { SQueryTableDataCond* pQueryCond = taosArrayGet(pInfo->queryConds, readIdx); - int64_t st = taosGetTimestampUs(); - void* p = tableListGetInfo(pTaskInfo->pTableInfoList, readIdx + pInfo->tableStartIndex); + int64_t st = taosGetTimestampUs(); + void* p = tableListGetInfo(pTaskInfo->pTableInfoList, readIdx + pInfo->tableStartIndex); SReadHandle* pHandle = &pInfo->base.readHandle; - int32_t code = tsdbReaderOpen(pHandle->vnode, pQueryCond, p, 1, pBlock, &pInfo->base.dataReader, GET_TASKID(pTaskInfo)); + int32_t code = + tsdbReaderOpen(pHandle->vnode, pQueryCond, p, 1, pBlock, &pInfo->base.dataReader, GET_TASKID(pTaskInfo)); if (code != 0) { T_LONG_JMP(pTaskInfo->env, code); } @@ -2915,8 +2927,8 @@ static void buildVnodeGroupedNtbTableCount(STableCountScanOperatorInfo* SSDataBlock* pRes, char* dbName); static void buildVnodeFilteredTbCount(SOperatorInfo* pOperator, STableCountScanOperatorInfo* pInfo, STableCountScanSupp* pSupp, SSDataBlock* pRes, char* dbName); -static void buildVnodeGroupedTableCount(SOperatorInfo* pOperator, STableCountScanOperatorInfo* pInfo, - STableCountScanSupp* pSupp, SSDataBlock* pRes, int32_t vgId, char* dbName); +static void buildVnodeGroupedTableCount(SOperatorInfo* pOperator, STableCountScanOperatorInfo* pInfo, + STableCountScanSupp* pSupp, SSDataBlock* pRes, int32_t vgId, char* dbName); static SSDataBlock* buildVnodeDbTableCount(SOperatorInfo* pOperator, STableCountScanOperatorInfo* pInfo, STableCountScanSupp* pSupp, SSDataBlock* pRes); static void buildSysDbGroupedTableCount(SOperatorInfo* pOperator, STableCountScanOperatorInfo* pInfo, @@ -3041,8 +3053,8 @@ SOperatorInfo* createTableCountScanOperatorInfo(SReadHandle* readHandle, STableC setOperatorInfo(pOperator, "TableCountScanOperator", QUERY_NODE_PHYSICAL_PLAN_TABLE_COUNT_SCAN, false, OP_NOT_OPENED, pInfo, pTaskInfo); - pOperator->fpSet = - createOperatorFpSet(optrDummyOpenFn, doTableCountScan, NULL, destoryTableCountScanOperator, optrDefaultBufFn, NULL); + pOperator->fpSet = createOperatorFpSet(optrDummyOpenFn, doTableCountScan, NULL, destoryTableCountScanOperator, + optrDefaultBufFn, NULL); return pOperator; _error: diff --git a/source/libs/stream/src/streamExec.c b/source/libs/stream/src/streamExec.c index 8e746c6738..3d42f759cb 100644 --- a/source/libs/stream/src/streamExec.c +++ b/source/libs/stream/src/streamExec.c @@ -116,7 +116,11 @@ int32_t streamScanExec(SStreamTask* pTask, int32_t batchSz) { ASSERT(0); } if (output == NULL) { - finished = true; + if (qStreamRecoverScanFinished(exec)) { + finished = true; + } else { + qSetStreamOpOpen(exec); + } break; } From e5c4196c98324ebfa2c6caa233fe85948b7165e4 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Tue, 27 Dec 2022 17:19:47 +0800 Subject: [PATCH 49/63] fix:calculate next sliding window error --- source/libs/executor/src/timewindowoperator.c | 19 ++- tests/script/tsim/stream/basic3.sim | 4 +- tests/script/tsim/stream/sliding.sim | 117 ++++++++++++++++++ 3 files changed, 136 insertions(+), 4 deletions(-) diff --git a/source/libs/executor/src/timewindowoperator.c b/source/libs/executor/src/timewindowoperator.c index 2af551b832..813da3c436 100644 --- a/source/libs/executor/src/timewindowoperator.c +++ b/source/libs/executor/src/timewindowoperator.c @@ -2347,6 +2347,17 @@ void doBuildResult(SOperatorInfo* pOperator, SStreamState* pState, SSDataBlock* buildDataBlockFromGroupRes(pOperator, pState, pBlock, &pOperator->exprSupp, pGroupResInfo); } +static int32_t getNextQualifiedFinalWindow(SInterval* pInterval, STimeWindow* pNext, SDataBlockInfo* pDataBlockInfo, + TSKEY* primaryKeys, int32_t prevPosition) { + int32_t startPos = prevPosition + 1; + if (startPos == pDataBlockInfo->rows) { + startPos = -1; + } else { + *pNext = getFinalTimeWindow(primaryKeys[startPos], pInterval); + } + return startPos; +} + static void doStreamIntervalAggImpl(SOperatorInfo* pOperatorInfo, SSDataBlock* pSDataBlock, uint64_t groupId, SHashObj* pUpdatedMap) { SStreamIntervalOperatorInfo* pInfo = (SStreamIntervalOperatorInfo*)pOperatorInfo->info; @@ -2457,8 +2468,12 @@ static void doStreamIntervalAggImpl(SOperatorInfo* pOperatorInfo, SSDataBlock* p } int32_t prevEndPos = (forwardRows - 1) * step + startPos; ASSERT(pSDataBlock->info.window.skey > 0 && pSDataBlock->info.window.ekey > 0); - startPos = - getNextQualifiedWindow(&pInfo->interval, &nextWin, &pSDataBlock->info, tsCols, prevEndPos, TSDB_ORDER_ASC); + if (IS_FINAL_OP(pInfo)) { + startPos = getNextQualifiedFinalWindow(&pInfo->interval, &nextWin, &pSDataBlock->info, tsCols, prevEndPos); + } else { + startPos = + getNextQualifiedWindow(&pInfo->interval, &nextWin, &pSDataBlock->info, tsCols, prevEndPos, TSDB_ORDER_ASC); + } if (startPos < 0) { break; } diff --git a/tests/script/tsim/stream/basic3.sim b/tests/script/tsim/stream/basic3.sim index 48fb860a72..41e19b19af 100644 --- a/tests/script/tsim/stream/basic3.sim +++ b/tests/script/tsim/stream/basic3.sim @@ -1,7 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c debugflag -v 131 -system sh/exec.sh -n dnode1 -s start -v +system sh/cfg.sh -n dnode1 -c debugflag 131 +system sh/exec.sh -n dnode1 -s start sleep 5000 diff --git a/tests/script/tsim/stream/sliding.sim b/tests/script/tsim/stream/sliding.sim index c9a1ddd922..8287274cd2 100644 --- a/tests/script/tsim/stream/sliding.sim +++ b/tests/script/tsim/stream/sliding.sim @@ -672,6 +672,123 @@ if $data61 != 1 then goto loop5 endi +print step 8 + +sql drop stream IF EXISTS streams4; +sql drop database IF EXISTS test4; + +sql create database test4 vgroups 6; +sql use test4; +sql create stable st(ts timestamp, a int, b int, c int, d double) tags(ta int,tb int,tc int); +sql create table t1 using st tags(1,1,1); +sql create table t2 using st tags(2,2,2); + +sql create stream streams4 trigger at_once into streamt4 as select _wstart as ts, count(*),min(a) c1 from st interval(10s) sliding(5s); + +sql insert into t1 values(1648791213000,1,1,1,1.0); +sql insert into t1 values(1648791243000,2,1,1,1.0); + +sql insert into t2 values(1648791273000,3,1,1,1.0); +sql insert into t2 values(1648791313000,4,1,1,1.0); + +$loop_count = 0 + +loop6: +sleep 200 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +sql select * from streamt4 order by 1; + +# row 0 +if $rows != 8 then + print ====loop6=rows=$rows + goto loop6 +endi + +if $data01 != 1 then + print ====loop6=data01=$data01 + goto loop6 +endi + +if $data02 != 1 then + print ====loop6=data02=$data02 + return -1 +endi + +if $data11 != 1 then + print ====loop6=data11=$data11 + goto loop6 +endi + +if $data12 != 1 then + print ====loop6=data12=$data12 + return -1 +endi + +if $data21 != 1 then + print ====loop6=data21=$data21 + goto loop6 +endi + +if $data22 != 2 then + print ====loop6=data22=$data22 + return -1 +endi + +if $data31 != 1 then + print ====loop6=data31=$data31 + goto loop6 +endi + +if $data32 != 2 then + print ====loop6=data32=$data32 + return -1 +endi + +if $data41 != 1 then + print ====loop6=data41=$data41 + goto loop6 +endi + +if $data42 != 3 then + print ====loop6=data42=$data42 + return -1 +endi + +if $data51 != 1 then + print ====loop6=data51=$data51 + goto loop6 +endi + +if $data52 != 3 then + print ====loop6=data52=$data52 + return -1 +endi + +if $data61 != 1 then + print ====loop6=data61=$data61 + return -1 +endi + +if $data62 != 4 then + print ====loop6=data62=$data62 + return -1 +endi + +if $data71 != 1 then + print ====loop6=data71=$data71 + return -1 +endi + +if $data72 != 4 then + print ====loop6=data72=$data72 + return -1 +endi + $loop_all = $loop_all + 1 print ============loop_all=$loop_all From f7b17a43a77dd63375545b1e53e663dbd908141f Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Tue, 27 Dec 2022 17:23:10 +0800 Subject: [PATCH 50/63] fix: taosbenchmark no vgroup if host specified for main (#19180) --- cmake/taostools_CMakeLists.txt.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/taostools_CMakeLists.txt.in b/cmake/taostools_CMakeLists.txt.in index 0cc57d1246..e23ebb104b 100644 --- a/cmake/taostools_CMakeLists.txt.in +++ b/cmake/taostools_CMakeLists.txt.in @@ -2,7 +2,7 @@ # taos-tools ExternalProject_Add(taos-tools GIT_REPOSITORY https://github.com/taosdata/taos-tools.git - GIT_TAG 261fcca + GIT_TAG 11b60a4 SOURCE_DIR "${TD_SOURCE_DIR}/tools/taos-tools" BINARY_DIR "" #BUILD_IN_SOURCE TRUE From 71a28483762ed733c6d15be7c47bcbb919fa9625 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Tue, 27 Dec 2022 17:51:52 +0800 Subject: [PATCH 51/63] fix: double free on append log failed --- source/libs/sync/src/syncPipeline.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/source/libs/sync/src/syncPipeline.c b/source/libs/sync/src/syncPipeline.c index ef37600e98..ee649c268c 100644 --- a/source/libs/sync/src/syncPipeline.c +++ b/source/libs/sync/src/syncPipeline.c @@ -45,7 +45,7 @@ int32_t syncLogBufferAppend(SSyncLogBuffer* pBuf, SSyncNode* pNode, SSyncRaftEnt if (index - pBuf->startIndex >= pBuf->size) { sError("vgId:%d, failed to append due to sync log buffer full. index:%" PRId64 "", pNode->vgId, index); - goto _out; + goto _err; } ASSERT(index == pBuf->endIndex); @@ -66,9 +66,8 @@ int32_t syncLogBufferAppend(SSyncLogBuffer* pBuf, SSyncNode* pNode, SSyncRaftEnt taosThreadMutexUnlock(&pBuf->mutex); return 0; -_out: +_err: syncLogBufferValidate(pBuf); - syncEntryDestroy(pEntry); taosThreadMutexUnlock(&pBuf->mutex); return -1; } From d949008543973100510e6066305091521de1300d Mon Sep 17 00:00:00 2001 From: Ping Xiao Date: Tue, 27 Dec 2022 18:53:06 +0800 Subject: [PATCH 52/63] test: add test case for tmq replica 3 --- tests/parallel_test/cases.task | 4 ++-- tests/system-test/7-tmq/subscribeDb.py | 12 ++++++++---- tests/system-test/7-tmq/subscribeDb0.py | 7 +++++-- tests/system-test/7-tmq/tmqCommon.py | 2 +- 4 files changed, 16 insertions(+), 9 deletions(-) diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index 57fff095e8..f5f04ff1e9 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -677,8 +677,8 @@ ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/create_wrong_topic.py ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/dropDbR3ConflictTransaction.py -N 3 ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/basic5.py -,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/subscribeDb.py -,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/subscribeDb0.py +,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/subscribeDb.py -N 3 -n 3 +,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/subscribeDb0.py -N 3 -n 3 ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/subscribeDb1.py ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/subscribeDb2.py ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/subscribeDb3.py diff --git a/tests/system-test/7-tmq/subscribeDb.py b/tests/system-test/7-tmq/subscribeDb.py index fd06eedefd..0fa9bcfbd4 100644 --- a/tests/system-test/7-tmq/subscribeDb.py +++ b/tests/system-test/7-tmq/subscribeDb.py @@ -61,7 +61,7 @@ class TDTestCase: def insertConsumerInfo(self,consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifmanualcommit,cdbName='cdb'): sql = "insert into %s.consumeinfo values "%cdbName - sql += "(now, %d, '%s', '%s', %d, %d, %d)"%(consumerId, topicList, keyList, expectrowcnt, ifcheckdata, ifmanualcommit) + sql += "(now + %ds, %d, '%s', '%s', %d, %d, %d)"%(consumerId, consumerId, topicList, keyList, expectrowcnt, ifcheckdata, ifmanualcommit) tdLog.info("consume info sql: %s"%sql) tdSql.query(sql) @@ -174,12 +174,13 @@ class TDTestCase: 'ctbNum': 10, \ 'rowsPerTbl': 5000, \ 'batchNum': 100, \ + 'replica': self.replicaVar, \ 'startTs': 1640966400000} # 2022-01-01 00:00:00.000 parameterDict['cfg'] = cfgPath self.initConsumerTable() - tdSql.execute("create database if not exists %s vgroups %d" %(parameterDict['dbName'], parameterDict['vgroups'])) + tdSql.execute("create database if not exists %s vgroups %d replica %d" %(parameterDict['dbName'], parameterDict['vgroups'], parameterDict['replica'])) prepareEnvThread = threading.Thread(target=self.prepareEnv, kwargs=parameterDict) prepareEnvThread.start() @@ -271,12 +272,13 @@ class TDTestCase: 'ctbNum': 10, \ 'rowsPerTbl': 5000, \ 'batchNum': 100, \ + 'replica': self.replicaVar, \ 'startTs': 1640966400000} # 2022-01-01 00:00:00.000 parameterDict['cfg'] = cfgPath self.initConsumerTable() - tdSql.execute("create database if not exists %s vgroups %d" %(parameterDict['dbName'], parameterDict['vgroups'])) + tdSql.execute("create database if not exists %s vgroups %d replica %d" %(parameterDict['dbName'], parameterDict['vgroups'], parameterDict['replica'])) prepareEnvThread = threading.Thread(target=self.prepareEnv, kwargs=parameterDict) prepareEnvThread.start() @@ -337,6 +339,7 @@ class TDTestCase: 'ctbNum': 10, \ 'rowsPerTbl': 5000, \ 'batchNum': 100, \ + 'replica': self.replicaVar, \ 'startTs': 1640966400000} # 2022-01-01 00:00:00.000 parameterDict['cfg'] = cfgPath @@ -406,12 +409,13 @@ class TDTestCase: 'ctbNum': 10, \ 'rowsPerTbl': 5000, \ 'batchNum': 100, \ + 'replica': self.replicaVar, \ 'startTs': 1640966400000} # 2022-01-01 00:00:00.000 parameterDict['cfg'] = cfgPath self.initConsumerTable() - tdSql.execute("create database if not exists %s vgroups %d" %(parameterDict['dbName'], parameterDict['vgroups'])) + tdSql.execute("create database if not exists %s vgroups %d replica %d" %(parameterDict['dbName'], parameterDict['vgroups'], parameterDict['replica'])) prepareEnvThread = threading.Thread(target=self.prepareEnv, kwargs=parameterDict) prepareEnvThread.start() diff --git a/tests/system-test/7-tmq/subscribeDb0.py b/tests/system-test/7-tmq/subscribeDb0.py index d4c5e2f87f..50ef52cb15 100644 --- a/tests/system-test/7-tmq/subscribeDb0.py +++ b/tests/system-test/7-tmq/subscribeDb0.py @@ -174,12 +174,13 @@ class TDTestCase: 'ctbNum': 10, \ 'rowsPerTbl': 5000, \ 'batchNum': 100, \ + 'replica': self.replicaVar, \ 'startTs': 1640966400000} # 2022-01-01 00:00:00.000 parameterDict['cfg'] = cfgPath self.initConsumerTable() - tdSql.execute("create database if not exists %s vgroups %d" %(parameterDict['dbName'], parameterDict['vgroups'])) + tdSql.execute("create database if not exists %s vgroups %d replica %d" %(parameterDict['dbName'], parameterDict['vgroups'], parameterDict['replica'])) prepareEnvThread = threading.Thread(target=self.prepareEnv, kwargs=parameterDict) prepareEnvThread.start() @@ -191,6 +192,7 @@ class TDTestCase: 'ctbNum': 10, \ 'rowsPerTbl': 5000, \ 'batchNum': 100, \ + 'replica': self.replicaVar, \ 'startTs': 1640966400000} # 2022-01-01 00:00:00.000 parameterDict['cfg'] = cfgPath @@ -254,12 +256,13 @@ class TDTestCase: 'ctbNum': 10, \ 'rowsPerTbl': 5000, \ 'batchNum': 100, \ + 'replica': self.replicaVar, \ 'startTs': 1640966400000} # 2022-01-01 00:00:00.000 parameterDict['cfg'] = cfgPath self.initConsumerTable() - tdSql.execute("create database if not exists %s vgroups %d" %(parameterDict['dbName'], parameterDict['vgroups'])) + tdSql.execute("create database if not exists %s vgroups %d replica %d" %(parameterDict['dbName'], parameterDict['vgroups'], parameterDict['replica'])) prepareEnvThread = threading.Thread(target=self.prepareEnv, kwargs=parameterDict) prepareEnvThread.start() diff --git a/tests/system-test/7-tmq/tmqCommon.py b/tests/system-test/7-tmq/tmqCommon.py index 141d013270..4cda062401 100644 --- a/tests/system-test/7-tmq/tmqCommon.py +++ b/tests/system-test/7-tmq/tmqCommon.py @@ -60,7 +60,7 @@ class TMQCom: def insertConsumerInfo(self,consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifmanualcommit,cdbName='cdb'): sql = "insert into %s.consumeinfo values "%cdbName - sql += "(now, %d, '%s', '%s', %d, %d, %d)"%(consumerId, topicList, keyList, expectrowcnt, ifcheckdata, ifmanualcommit) + sql += "(now + %ds, %d, '%s', '%s', %d, %d, %d)"%(consumerId, consumerId, topicList, keyList, expectrowcnt, ifcheckdata, ifmanualcommit) tdLog.info("consume info sql: %s"%sql) tdSql.query(sql) From 09681e37ca2ba7851585bb701712478b5659a937 Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Wed, 28 Dec 2022 10:20:18 +0800 Subject: [PATCH 53/63] change systerm code and avoid mem leak --- source/dnode/mgmt/exe/dmMain.c | 5 +++++ source/libs/transport/src/transSvr.c | 15 ++++++++------- source/util/src/terror.c | 9 +++------ 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/source/dnode/mgmt/exe/dmMain.c b/source/dnode/mgmt/exe/dmMain.c index a8103351b4..a432201413 100644 --- a/source/dnode/mgmt/exe/dmMain.c +++ b/source/dnode/mgmt/exe/dmMain.c @@ -268,6 +268,11 @@ int mainWindows(int argc, char **argv) { if (dmInit() != 0) { dError("failed to init dnode since %s", terrstr()); + + taosCleanupCfg(); + taosCloseLog(); + taosCleanupArgs(); + taosConvDestroy(); return -1; } diff --git a/source/libs/transport/src/transSvr.c b/source/libs/transport/src/transSvr.c index 2b1f68d5f6..7384877313 100644 --- a/source/libs/transport/src/transSvr.c +++ b/source/libs/transport/src/transSvr.c @@ -1001,6 +1001,13 @@ void* transInitServer(uint32_t ip, uint32_t port, char* label, int numOfThreads, uv_loop_init(srv->loop); char pipeName[PATH_MAX]; + + if (false == taosValidIpAndPort(srv->ip, srv->port)) { + terrno = TAOS_SYSTEM_ERROR(errno); + tError("invalid ip/port, %d:%d, reason:%s", srv->ip, srv->port, terrstr()); + goto End; + } + #if defined(WINDOWS) || defined(DARWIN) int ret = uv_pipe_init(srv->loop, &srv->pipeListen, 0); if (ret != 0) { @@ -1087,12 +1094,6 @@ void* transInitServer(uint32_t ip, uint32_t port, char* label, int numOfThreads, } #endif - if (false == taosValidIpAndPort(srv->ip, srv->port)) { - terrno = TAOS_SYSTEM_ERROR(errno); - tError("invalid ip/port, %d:%d, reason:%s", srv->ip, srv->port, terrstr()); - goto End; - } - if (false == addHandleToAcceptloop(srv)) { goto End; } @@ -1185,8 +1186,8 @@ void transCloseServer(void* arg) { // impl later SServerObj* srv = arg; - tDebug("send quit msg to accept thread"); if (srv->inited) { + tDebug("send quit msg to accept thread"); uv_async_send(srv->pAcceptAsync); taosThreadJoin(srv->thread, NULL); SRV_RELEASE_UV(srv->loop); diff --git a/source/util/src/terror.c b/source/util/src/terror.c index ff61c7cdc4..6f8b0d8e04 100644 --- a/source/util/src/terror.c +++ b/source/util/src/terror.c @@ -643,13 +643,10 @@ const char* tstrerror(int32_t err) { // this is a system errno if ((err & 0x00ff0000) == 0x00ff0000) { int32_t code = err & 0x0000ffff; - if (code >= 0 && code < 36) { - return strerror(code); - } else { - return "unknown err"; - } + // strerror can handle any invalid code + // invalid code return Unknown error + return strerror(code); } - int32_t s = 0; int32_t e = sizeof(errors) / sizeof(errors[0]); From eddaaf24e47b1606796cad4bea3802d0017d684b Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Wed, 28 Dec 2022 10:22:13 +0800 Subject: [PATCH 54/63] fix: escape error in create topic --- source/libs/parser/inc/parAst.h | 2 +- source/libs/parser/src/parAstCreater.c | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/source/libs/parser/inc/parAst.h b/source/libs/parser/inc/parAst.h index ef67c7536f..20a2520a79 100644 --- a/source/libs/parser/inc/parAst.h +++ b/source/libs/parser/inc/parAst.h @@ -196,7 +196,7 @@ SNode* createDropComponentNodeStmt(SAstCreateContext* pCxt, ENodeType type, cons SNode* createCreateTopicStmtUseQuery(SAstCreateContext* pCxt, bool ignoreExists, const SToken* pTopicName, SNode* pQuery); SNode* createCreateTopicStmtUseDb(SAstCreateContext* pCxt, bool ignoreExists, const SToken* pTopicName, - const SToken* pSubDbName, bool withMeta); + SToken* pSubDbName, bool withMeta); SNode* createCreateTopicStmtUseTable(SAstCreateContext* pCxt, bool ignoreExists, const SToken* pTopicName, SNode* pRealTable, bool withMeta); SNode* createDropTopicStmt(SAstCreateContext* pCxt, bool ignoreNotExists, const SToken* pTopicName); diff --git a/source/libs/parser/src/parAstCreater.c b/source/libs/parser/src/parAstCreater.c index 4077c27840..17d8297cf0 100644 --- a/source/libs/parser/src/parAstCreater.c +++ b/source/libs/parser/src/parAstCreater.c @@ -1579,8 +1579,11 @@ SNode* createCreateTopicStmtUseQuery(SAstCreateContext* pCxt, bool ignoreExists, } SNode* createCreateTopicStmtUseDb(SAstCreateContext* pCxt, bool ignoreExists, const SToken* pTopicName, - const SToken* pSubDbName, bool withMeta) { + SToken* pSubDbName, bool withMeta) { CHECK_PARSER_STATUS(pCxt); + if (!checkDbName(pCxt, pSubDbName, true)) { + return NULL; + } SCreateTopicStmt* pStmt = (SCreateTopicStmt*)nodesMakeNode(QUERY_NODE_CREATE_TOPIC_STMT); CHECK_OUT_OF_MEM(pStmt); COPY_STRING_FORM_ID_TOKEN(pStmt->topicName, pTopicName); From b6aadbf16f0b0437f834664f71ae8b9e79dbdbaa Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Wed, 28 Dec 2022 10:31:34 +0800 Subject: [PATCH 55/63] sql command 'create index' --- include/libs/nodes/cmdnodes.h | 2 +- source/libs/parser/inc/sql.y | 10 +- source/libs/parser/src/sql.c | 4117 ++++++++++++++------------------- 3 files changed, 1780 insertions(+), 2349 deletions(-) diff --git a/include/libs/nodes/cmdnodes.h b/include/libs/nodes/cmdnodes.h index 66988ff135..22b8381aef 100644 --- a/include/libs/nodes/cmdnodes.h +++ b/include/libs/nodes/cmdnodes.h @@ -295,7 +295,7 @@ typedef struct SShowTableTagsStmt { SNodeList* pTags; } SShowTableTagsStmt; -typedef enum EIndexType { INDEX_TYPE_SMA = 1, INDEX_TYPE_FULLTEXT } EIndexType; +typedef enum EIndexType { INDEX_TYPE_SMA = 1, INDEX_TYPE_FULLTEXT, INDEX_TYPE_NORMAL } EIndexType; typedef struct SIndexOptions { ENodeType type; diff --git a/source/libs/parser/inc/sql.y b/source/libs/parser/inc/sql.y index cd1260584e..9dfea07b81 100644 --- a/source/libs/parser/inc/sql.y +++ b/source/libs/parser/inc/sql.y @@ -458,14 +458,16 @@ tag_item(A) ::= column_name(B) column_alias(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) +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); } +cmd ::= CREATE INDEX not_exists_opt(D) + full_table_name(A) ON full_table_name(B) NK_LP col_name_list(C) NK_RP. { pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_NORMAL, D, A, B, C, NULL); } cmd ::= DROP INDEX exists_opt(B) full_table_name(A). { pCxt->pRootNode = createDropIndexStmt(pCxt, B, A); } -index_options(A) ::= FUNCTION NK_LP func_list(B) NK_RP INTERVAL +index_options(A) ::= FUNCTION NK_LP func_list(B) NK_RP INTERVAL NK_LP duration_literal(C) NK_RP sliding_opt(D) sma_stream_opt(E). { A = createIndexOption(pCxt, B, releaseRawExprNode(pCxt, C), NULL, D, E); } -index_options(A) ::= FUNCTION NK_LP func_list(B) NK_RP INTERVAL - NK_LP duration_literal(C) NK_COMMA duration_literal(D) NK_RP sliding_opt(E) +index_options(A) ::= FUNCTION NK_LP func_list(B) NK_RP INTERVAL + NK_LP duration_literal(C) NK_COMMA duration_literal(D) NK_RP sliding_opt(E) sma_stream_opt(F). { A = createIndexOption(pCxt, B, releaseRawExprNode(pCxt, C), releaseRawExprNode(pCxt, D), E, F); } %type func_list { SNodeList* } diff --git a/source/libs/parser/src/sql.c b/source/libs/parser/src/sql.c index 1021aab6f0..9449b60d5c 100644 --- a/source/libs/parser/src/sql.c +++ b/source/libs/parser/src/sql.c @@ -139,18 +139,17 @@ typedef union { #define ParseCTX_FETCH #define ParseCTX_STORE #define YYFALLBACK 1 -#define YYNSTATE 714 -#define YYNRULE 545 -#define YYNRULE_WITH_ACTION 545 +#define YYNSTATE 722 +#define YYNRULE 546 #define YYNTOKEN 325 -#define YY_MAX_SHIFT 713 -#define YY_MIN_SHIFTREDUCE 1061 -#define YY_MAX_SHIFTREDUCE 1605 -#define YY_ERROR_ACTION 1606 -#define YY_ACCEPT_ACTION 1607 -#define YY_NO_ACTION 1608 -#define YY_MIN_REDUCE 1609 -#define YY_MAX_REDUCE 2153 +#define YY_MAX_SHIFT 721 +#define YY_MIN_SHIFTREDUCE 1069 +#define YY_MAX_SHIFTREDUCE 1614 +#define YY_ERROR_ACTION 1615 +#define YY_ACCEPT_ACTION 1616 +#define YY_NO_ACTION 1617 +#define YY_MIN_REDUCE 1618 +#define YY_MAX_REDUCE 2163 /************* End control #defines *******************************************/ #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0]))) @@ -219,320 +218,320 @@ typedef union { *********** Begin parsing tables **********************************************/ #define YY_ACTTAB_COUNT (3069) static const YYACTIONTYPE yy_action[] = { - /* 0 */ 35, 276, 460, 1876, 461, 1645, 469, 367, 461, 1645, - /* 10 */ 1808, 1810, 45, 43, 1535, 1954, 1874, 590, 1751, 466, - /* 20 */ 362, 407, 1385, 38, 37, 462, 1950, 44, 42, 41, - /* 30 */ 40, 39, 169, 1465, 459, 1383, 229, 464, 1651, 1792, - /* 40 */ 571, 602, 38, 37, 2124, 602, 44, 42, 41, 40, - /* 50 */ 39, 8, 602, 334, 1862, 1946, 1952, 345, 1460, 570, - /* 60 */ 175, 320, 187, 18, 2125, 572, 613, 38, 37, 1967, - /* 70 */ 1391, 44, 42, 41, 40, 39, 468, 1411, 583, 464, - /* 80 */ 1651, 38, 37, 45, 43, 44, 42, 41, 40, 39, - /* 90 */ 2129, 362, 171, 1385, 1609, 14, 136, 327, 81, 2026, - /* 100 */ 1985, 80, 60, 27, 1465, 1802, 1383, 1412, 586, 134, - /* 110 */ 159, 1572, 1621, 1936, 603, 619, 48, 710, 125, 124, - /* 120 */ 123, 122, 121, 120, 119, 118, 117, 48, 126, 1460, - /* 130 */ 100, 160, 1467, 1468, 18, 499, 1716, 443, 1494, 1966, - /* 140 */ 64, 1391, 478, 2002, 135, 1762, 103, 1968, 623, 1970, - /* 150 */ 1971, 618, 1754, 613, 1410, 2129, 1815, 146, 172, 2124, - /* 160 */ 2055, 1440, 1450, 355, 356, 2051, 14, 1466, 1469, 257, - /* 170 */ 2063, 582, 1813, 127, 581, 2128, 566, 2124, 177, 2125, - /* 180 */ 2127, 2129, 1386, 1595, 1384, 2124, 2081, 528, 710, 1263, - /* 190 */ 1264, 260, 570, 175, 1495, 191, 190, 2125, 572, 49, - /* 200 */ 526, 2128, 524, 1467, 1468, 2125, 2126, 1389, 1390, 53, - /* 210 */ 1439, 1442, 1443, 1444, 1445, 1446, 1447, 1448, 1449, 615, - /* 220 */ 611, 1458, 1459, 1461, 1462, 1463, 1464, 2, 60, 60, - /* 230 */ 89, 60, 1440, 1450, 2070, 1410, 156, 116, 1466, 1469, - /* 240 */ 115, 114, 113, 112, 111, 110, 109, 108, 107, 648, - /* 250 */ 259, 227, 178, 1386, 2070, 1384, 1528, 38, 37, 1632, - /* 260 */ 2067, 44, 42, 41, 40, 39, 34, 360, 1489, 1490, - /* 270 */ 1491, 1492, 1493, 1497, 1498, 1499, 1500, 178, 1389, 1390, - /* 280 */ 2066, 1439, 1442, 1443, 1444, 1445, 1446, 1447, 1448, 1449, - /* 290 */ 615, 611, 1458, 1459, 1461, 1462, 1463, 1464, 2, 396, - /* 300 */ 11, 45, 43, 1936, 1954, 1385, 1539, 1631, 1985, 362, - /* 310 */ 408, 1385, 1410, 86, 322, 1950, 565, 532, 1383, 530, - /* 320 */ 398, 394, 1465, 409, 1383, 1220, 645, 644, 643, 1224, - /* 330 */ 642, 1226, 1227, 641, 1229, 638, 1678, 1235, 635, 1237, - /* 340 */ 1238, 632, 629, 213, 1946, 1952, 357, 1460, 1180, 178, - /* 350 */ 401, 1936, 18, 1391, 1815, 613, 564, 1532, 164, 1391, - /* 360 */ 1113, 366, 1112, 1410, 495, 491, 487, 483, 210, 1630, - /* 370 */ 1813, 1629, 45, 43, 1470, 212, 1316, 1317, 178, 178, - /* 380 */ 362, 178, 1385, 1182, 14, 44, 42, 41, 40, 39, - /* 390 */ 657, 1114, 547, 1465, 1409, 1383, 2124, 1113, 1628, 1112, - /* 400 */ 710, 514, 513, 512, 85, 1094, 710, 208, 1610, 131, - /* 410 */ 508, 2130, 175, 1936, 507, 1936, 2125, 572, 1460, 506, - /* 420 */ 511, 1467, 1468, 1602, 1627, 505, 267, 268, 1114, 116, - /* 430 */ 1391, 266, 115, 114, 113, 112, 111, 110, 109, 108, - /* 440 */ 107, 583, 1936, 1411, 1096, 1626, 1099, 1100, 1391, 1876, - /* 450 */ 1440, 1450, 603, 1441, 1815, 46, 1466, 1469, 11, 353, - /* 460 */ 9, 331, 1873, 590, 603, 1386, 54, 1384, 1936, 575, - /* 470 */ 1813, 1386, 134, 1384, 207, 201, 1625, 710, 180, 206, - /* 480 */ 38, 37, 474, 1762, 44, 42, 41, 40, 39, 1936, - /* 490 */ 1389, 1390, 1467, 1468, 84, 1762, 1389, 1390, 199, 1439, - /* 500 */ 1442, 1443, 1444, 1445, 1446, 1447, 1448, 1449, 615, 611, - /* 510 */ 1458, 1459, 1461, 1462, 1463, 1464, 2, 1758, 1601, 1412, - /* 520 */ 1936, 1440, 1450, 583, 1142, 1624, 571, 1466, 1469, 603, - /* 530 */ 2124, 585, 173, 2063, 2064, 603, 132, 2068, 1413, 514, - /* 540 */ 513, 512, 1386, 405, 1384, 570, 175, 131, 508, 406, - /* 550 */ 2125, 572, 507, 1623, 134, 1330, 1331, 506, 511, 1143, - /* 560 */ 1762, 1967, 1620, 505, 1809, 1810, 1762, 1389, 1390, 1936, - /* 570 */ 1439, 1442, 1443, 1444, 1445, 1446, 1447, 1448, 1449, 615, - /* 580 */ 611, 1458, 1459, 1461, 1462, 1463, 1464, 2, 45, 43, - /* 590 */ 1329, 1332, 1985, 1740, 84, 354, 362, 1936, 1385, 1531, - /* 600 */ 620, 1607, 605, 157, 2027, 1936, 1936, 619, 130, 1465, - /* 610 */ 228, 1383, 1764, 11, 174, 2063, 2064, 1757, 132, 2068, - /* 620 */ 38, 37, 1967, 2070, 44, 42, 41, 40, 39, 519, - /* 630 */ 561, 1966, 1413, 603, 1460, 2002, 669, 1562, 103, 1968, - /* 640 */ 623, 1970, 1971, 618, 529, 613, 1391, 126, 137, 2065, - /* 650 */ 143, 2026, 2055, 1985, 504, 478, 356, 2051, 226, 45, - /* 660 */ 43, 620, 259, 603, 1762, 377, 1936, 362, 619, 1385, - /* 670 */ 607, 46, 2027, 522, 1619, 1362, 1363, 415, 516, 1618, - /* 680 */ 1465, 184, 1383, 225, 1753, 60, 558, 1560, 1561, 1563, - /* 690 */ 1564, 576, 1966, 710, 1762, 1950, 2002, 510, 509, 161, - /* 700 */ 1968, 623, 1970, 1971, 618, 1460, 613, 547, 1467, 1468, - /* 710 */ 1738, 2124, 542, 368, 567, 562, 556, 1391, 1936, 67, - /* 720 */ 1739, 157, 66, 1936, 1946, 1952, 2130, 175, 1475, 1747, - /* 730 */ 1764, 2125, 572, 1617, 1410, 613, 649, 1440, 1450, 1806, - /* 740 */ 548, 2092, 14, 1466, 1469, 603, 38, 37, 1496, 1749, - /* 750 */ 44, 42, 41, 40, 39, 31, 169, 2128, 1386, 429, - /* 760 */ 1384, 38, 37, 503, 710, 44, 42, 41, 40, 39, - /* 770 */ 1745, 400, 657, 399, 1616, 237, 1762, 1936, 1863, 1467, - /* 780 */ 1468, 1737, 1615, 1389, 1390, 502, 1439, 1442, 1443, 1444, - /* 790 */ 1445, 1446, 1447, 1448, 1449, 615, 611, 1458, 1459, 1461, - /* 800 */ 1462, 1463, 1464, 2, 41, 40, 39, 603, 1440, 1450, - /* 810 */ 319, 50, 1408, 3, 1466, 1469, 365, 94, 1936, 437, - /* 820 */ 32, 430, 450, 232, 157, 449, 1936, 655, 614, 1386, - /* 830 */ 1501, 1384, 1614, 1764, 1551, 178, 681, 679, 1762, 1755, - /* 840 */ 421, 1955, 451, 647, 157, 423, 148, 147, 652, 651, - /* 850 */ 650, 145, 1950, 1765, 1389, 1390, 1410, 1439, 1442, 1443, - /* 860 */ 1444, 1445, 1446, 1447, 1448, 1449, 615, 611, 1458, 1459, - /* 870 */ 1461, 1462, 1463, 1464, 2, 1441, 1936, 670, 1413, 1732, - /* 880 */ 158, 1946, 1952, 33, 1845, 296, 335, 1675, 655, 38, - /* 890 */ 37, 1858, 613, 44, 42, 41, 40, 39, 411, 294, - /* 900 */ 70, 1815, 183, 69, 1858, 1858, 1622, 148, 147, 652, - /* 910 */ 651, 650, 145, 13, 12, 185, 189, 1814, 1099, 1100, - /* 920 */ 99, 195, 456, 454, 653, 2095, 654, 1806, 447, 1806, - /* 930 */ 96, 442, 441, 440, 439, 436, 435, 434, 433, 432, - /* 940 */ 428, 427, 426, 425, 336, 418, 417, 416, 589, 413, - /* 950 */ 412, 333, 687, 686, 685, 684, 372, 60, 683, 682, - /* 960 */ 138, 677, 676, 675, 674, 673, 672, 671, 150, 667, - /* 970 */ 666, 665, 371, 370, 662, 661, 660, 659, 658, 1613, - /* 980 */ 254, 603, 655, 1612, 290, 603, 375, 1792, 374, 578, - /* 990 */ 547, 2075, 1528, 603, 2124, 476, 102, 1441, 1717, 477, - /* 1000 */ 1967, 148, 147, 652, 651, 650, 145, 1759, 1508, 2130, - /* 1010 */ 175, 140, 1762, 128, 2125, 572, 1762, 218, 574, 71, - /* 1020 */ 216, 236, 220, 1936, 1762, 219, 52, 1936, 547, 603, - /* 1030 */ 547, 1985, 2124, 546, 2124, 424, 78, 77, 404, 586, - /* 1040 */ 583, 182, 603, 142, 1936, 1394, 619, 2130, 175, 2130, - /* 1050 */ 175, 559, 2125, 572, 2125, 572, 543, 1923, 535, 318, - /* 1060 */ 1762, 603, 392, 235, 390, 386, 382, 379, 376, 79, - /* 1070 */ 1966, 134, 1967, 1762, 2002, 587, 1393, 103, 1968, 623, - /* 1080 */ 1970, 1971, 618, 603, 613, 222, 62, 224, 221, 172, - /* 1090 */ 223, 2055, 1762, 1665, 211, 356, 2051, 271, 603, 603, - /* 1100 */ 547, 1658, 87, 1985, 2124, 384, 1656, 178, 603, 610, - /* 1110 */ 339, 620, 598, 600, 1762, 515, 1936, 2082, 619, 2130, - /* 1120 */ 175, 1957, 601, 517, 2125, 572, 1967, 603, 520, 1762, - /* 1130 */ 1762, 176, 2063, 2064, 241, 132, 2068, 248, 1559, 1762, - /* 1140 */ 47, 277, 1966, 1604, 1605, 1986, 2002, 264, 373, 103, - /* 1150 */ 1968, 623, 1970, 1971, 618, 663, 613, 1985, 1762, 68, - /* 1160 */ 144, 2144, 1867, 2055, 146, 620, 1646, 356, 2051, 1959, - /* 1170 */ 1936, 340, 619, 338, 337, 62, 501, 1161, 2089, 664, - /* 1180 */ 503, 1652, 1803, 603, 47, 47, 243, 1967, 13, 12, - /* 1190 */ 2085, 627, 1327, 584, 1397, 144, 1966, 369, 256, 269, - /* 1200 */ 2002, 1159, 502, 103, 1968, 623, 1970, 1971, 618, 253, - /* 1210 */ 613, 595, 273, 579, 1762, 2144, 1213, 2055, 1985, 1, - /* 1220 */ 146, 356, 2051, 129, 4, 1396, 620, 1502, 359, 358, - /* 1230 */ 705, 1936, 2102, 619, 378, 1349, 1451, 289, 1399, 144, - /* 1240 */ 383, 332, 284, 1241, 188, 410, 1413, 1245, 414, 1465, - /* 1250 */ 1967, 1392, 1868, 1486, 445, 419, 1408, 1966, 438, 444, - /* 1260 */ 431, 2002, 1860, 446, 103, 1968, 623, 1970, 1971, 618, - /* 1270 */ 1967, 613, 1252, 452, 1460, 1250, 2144, 453, 2055, 192, - /* 1280 */ 455, 1985, 356, 2051, 457, 1414, 1391, 458, 467, 620, - /* 1290 */ 1416, 149, 470, 554, 1936, 198, 619, 200, 1411, 471, - /* 1300 */ 1415, 1985, 472, 1417, 473, 203, 205, 475, 82, 620, - /* 1310 */ 83, 479, 1116, 209, 1936, 496, 619, 497, 500, 498, - /* 1320 */ 1966, 1752, 321, 106, 2002, 534, 215, 103, 1968, 623, - /* 1330 */ 1970, 1971, 618, 609, 613, 536, 285, 230, 1748, 2144, - /* 1340 */ 1966, 2055, 217, 151, 2002, 356, 2051, 103, 1968, 623, - /* 1350 */ 1970, 1971, 618, 152, 613, 1750, 2118, 1746, 153, 2144, - /* 1360 */ 154, 2055, 1913, 1912, 537, 356, 2051, 538, 233, 541, - /* 1370 */ 713, 544, 560, 1967, 551, 2086, 2074, 2101, 593, 557, - /* 1380 */ 2100, 346, 2096, 7, 283, 563, 569, 249, 239, 242, - /* 1390 */ 2077, 165, 247, 552, 550, 250, 549, 347, 1400, 168, - /* 1400 */ 1395, 580, 577, 1528, 1985, 703, 699, 695, 691, 281, - /* 1410 */ 251, 2147, 620, 255, 252, 2123, 133, 1936, 1412, 619, - /* 1420 */ 2071, 588, 261, 1403, 1405, 350, 591, 596, 286, 287, - /* 1430 */ 592, 1884, 1967, 1883, 1882, 352, 611, 1458, 1459, 1461, - /* 1440 */ 1462, 1463, 1464, 1966, 288, 101, 1763, 2002, 274, 597, - /* 1450 */ 103, 1968, 623, 1970, 1971, 618, 59, 613, 91, 93, - /* 1460 */ 2036, 95, 2030, 1985, 2055, 625, 280, 1807, 356, 2051, - /* 1470 */ 1733, 620, 291, 706, 707, 709, 1936, 315, 619, 51, - /* 1480 */ 295, 599, 1930, 323, 324, 293, 1967, 1929, 300, 75, - /* 1490 */ 1928, 314, 304, 1927, 76, 1924, 380, 381, 1377, 1378, - /* 1500 */ 181, 1922, 1966, 385, 387, 388, 2002, 389, 1921, 103, - /* 1510 */ 1968, 623, 1970, 1971, 618, 391, 613, 1985, 1920, 393, - /* 1520 */ 262, 2028, 1919, 2055, 395, 620, 397, 356, 2051, 1918, - /* 1530 */ 1936, 1352, 619, 1895, 1351, 1894, 402, 1356, 1893, 231, - /* 1540 */ 403, 1892, 1853, 1307, 1852, 1850, 139, 1967, 1849, 1848, - /* 1550 */ 1851, 1847, 1846, 1844, 1843, 1842, 1966, 186, 420, 1841, - /* 1560 */ 2002, 422, 1840, 103, 1968, 623, 1970, 1971, 618, 1839, - /* 1570 */ 613, 1838, 1837, 1836, 1835, 606, 1834, 2055, 1985, 1833, - /* 1580 */ 1832, 356, 2051, 1831, 1830, 1829, 620, 1828, 1827, 1826, - /* 1590 */ 1825, 1936, 1824, 619, 448, 1817, 1816, 1309, 141, 1823, - /* 1600 */ 1822, 1821, 1820, 1819, 1818, 1967, 1680, 1679, 1677, 1641, - /* 1610 */ 196, 170, 1188, 1956, 1640, 193, 194, 1966, 1908, 1102, - /* 1620 */ 73, 2002, 197, 1902, 104, 1968, 623, 1970, 1971, 618, - /* 1630 */ 1101, 613, 1891, 463, 1890, 204, 1985, 74, 2055, 1870, - /* 1640 */ 465, 1741, 2054, 2051, 620, 1676, 1674, 480, 1672, 1936, - /* 1650 */ 202, 619, 482, 1670, 484, 1135, 486, 488, 481, 1967, - /* 1660 */ 490, 1668, 492, 485, 494, 1655, 1654, 1637, 489, 1743, - /* 1670 */ 1257, 1256, 493, 1742, 61, 1966, 1171, 1179, 1178, 2002, - /* 1680 */ 678, 680, 104, 1968, 623, 1970, 1971, 618, 1967, 613, - /* 1690 */ 1985, 1177, 1176, 1173, 1172, 1170, 2055, 1666, 620, 214, - /* 1700 */ 608, 2051, 341, 1936, 1659, 619, 342, 1657, 343, 521, - /* 1710 */ 1636, 523, 518, 1635, 525, 1634, 527, 1367, 105, 1985, - /* 1720 */ 1366, 531, 1369, 26, 1907, 1358, 55, 617, 1901, 621, - /* 1730 */ 539, 155, 1936, 2002, 619, 1889, 104, 1968, 623, 1970, - /* 1740 */ 1971, 618, 1887, 613, 2129, 28, 1967, 19, 16, 553, - /* 1750 */ 2055, 1574, 246, 555, 326, 2051, 58, 63, 1966, 238, - /* 1760 */ 245, 1957, 2002, 30, 240, 312, 1968, 623, 1970, 1971, - /* 1770 */ 618, 616, 613, 604, 2020, 21, 163, 1985, 1589, 20, - /* 1780 */ 17, 1588, 348, 1558, 244, 620, 29, 1593, 1550, 1594, - /* 1790 */ 1936, 88, 619, 540, 234, 1595, 344, 1592, 349, 1888, - /* 1800 */ 1967, 57, 545, 258, 56, 1525, 166, 1524, 5, 1886, - /* 1810 */ 6, 1885, 22, 594, 263, 265, 1966, 1556, 270, 1869, - /* 1820 */ 2002, 65, 90, 162, 1968, 623, 1970, 1971, 618, 92, - /* 1830 */ 613, 1985, 96, 275, 272, 23, 12, 1401, 1432, 620, - /* 1840 */ 2005, 167, 179, 612, 1936, 1455, 619, 1453, 36, 626, - /* 1850 */ 624, 1234, 364, 15, 1967, 630, 1452, 1424, 1487, 24, - /* 1860 */ 25, 622, 1242, 628, 633, 1239, 631, 636, 639, 1236, - /* 1870 */ 1966, 634, 1477, 1230, 2002, 573, 2145, 104, 1968, 623, - /* 1880 */ 1970, 1971, 618, 637, 613, 1985, 1228, 640, 1219, 1233, - /* 1890 */ 278, 2055, 646, 620, 1232, 97, 2052, 1231, 1936, 98, - /* 1900 */ 619, 10, 1251, 1476, 1247, 72, 1967, 1133, 656, 1167, - /* 1910 */ 1166, 1165, 1164, 1163, 1162, 1160, 1158, 1186, 1157, 1156, - /* 1920 */ 668, 1154, 1967, 1153, 1966, 1152, 1151, 1183, 2002, 279, - /* 1930 */ 1150, 161, 1968, 623, 1970, 1971, 618, 1985, 613, 1139, - /* 1940 */ 1149, 1148, 1181, 1145, 1144, 620, 1141, 1140, 1138, 1673, - /* 1950 */ 1936, 688, 619, 1985, 690, 1671, 692, 694, 689, 1669, - /* 1960 */ 696, 620, 693, 698, 1667, 700, 1936, 697, 619, 1653, - /* 1970 */ 701, 702, 704, 2093, 1091, 1633, 1966, 712, 282, 708, - /* 1980 */ 2002, 1608, 1387, 306, 1968, 623, 1970, 1971, 618, 711, - /* 1990 */ 613, 1608, 1966, 292, 1608, 1608, 2002, 1608, 1608, 162, - /* 2000 */ 1968, 623, 1970, 1971, 618, 1608, 613, 1608, 1608, 1608, - /* 2010 */ 1608, 1967, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, - /* 2020 */ 1608, 1608, 1608, 1608, 1608, 1608, 1608, 568, 1608, 1967, - /* 2030 */ 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, - /* 2040 */ 1608, 1608, 1985, 1608, 1608, 1608, 1608, 351, 1608, 1608, - /* 2050 */ 620, 1608, 2146, 1608, 1608, 1936, 1608, 619, 1608, 1608, - /* 2060 */ 1985, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 617, 1608, - /* 2070 */ 1608, 1608, 1608, 1936, 1608, 619, 1608, 1608, 1608, 1608, - /* 2080 */ 1608, 1966, 1608, 1967, 1608, 2002, 1608, 1608, 313, 1968, - /* 2090 */ 623, 1970, 1971, 618, 1608, 613, 1608, 1608, 1608, 1966, - /* 2100 */ 1967, 1608, 1608, 2002, 1608, 1608, 312, 1968, 623, 1970, - /* 2110 */ 1971, 618, 1608, 613, 1985, 2021, 1608, 1608, 1608, 361, - /* 2120 */ 1608, 1608, 620, 1608, 1608, 1608, 1608, 1936, 1608, 619, - /* 2130 */ 1608, 1985, 1608, 1608, 1608, 1608, 363, 1608, 1608, 620, - /* 2140 */ 1608, 1608, 1608, 1608, 1936, 1608, 619, 1608, 1608, 1608, - /* 2150 */ 1608, 1608, 1967, 1966, 1608, 1608, 1608, 2002, 1608, 1608, - /* 2160 */ 313, 1968, 623, 1970, 1971, 618, 1608, 613, 1967, 1608, - /* 2170 */ 1966, 1608, 1608, 1608, 2002, 1608, 1608, 313, 1968, 623, - /* 2180 */ 1970, 1971, 618, 1985, 613, 1608, 1608, 1608, 1608, 1608, - /* 2190 */ 1608, 620, 1608, 1608, 1608, 1608, 1936, 1608, 619, 1985, - /* 2200 */ 1608, 1608, 1608, 1608, 1608, 1608, 1608, 620, 1608, 1608, - /* 2210 */ 1608, 1608, 1936, 1608, 619, 1608, 1608, 1608, 1608, 1608, - /* 2220 */ 1967, 1608, 533, 1608, 1608, 1608, 2002, 1608, 1608, 308, - /* 2230 */ 1968, 623, 1970, 1971, 618, 1608, 613, 1608, 1966, 1608, - /* 2240 */ 1608, 1608, 2002, 1608, 1608, 297, 1968, 623, 1970, 1971, - /* 2250 */ 618, 1985, 613, 1608, 1608, 1608, 1608, 1608, 1608, 620, - /* 2260 */ 1608, 1608, 1608, 1608, 1936, 1608, 619, 1608, 1608, 1608, - /* 2270 */ 1608, 1608, 1608, 1608, 1967, 1608, 1608, 1608, 1608, 1608, - /* 2280 */ 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, - /* 2290 */ 1966, 1608, 1608, 1608, 2002, 1967, 1608, 298, 1968, 623, - /* 2300 */ 1970, 1971, 618, 1608, 613, 1985, 1608, 1608, 1608, 1608, - /* 2310 */ 1608, 1608, 1608, 620, 1608, 1608, 1608, 1608, 1936, 1608, - /* 2320 */ 619, 1608, 1608, 1608, 1608, 1608, 1985, 1608, 1608, 1608, - /* 2330 */ 1608, 1608, 1608, 1608, 620, 1608, 1608, 1608, 1608, 1936, - /* 2340 */ 1608, 619, 1608, 1608, 1966, 1608, 1608, 1608, 2002, 1608, - /* 2350 */ 1608, 299, 1968, 623, 1970, 1971, 618, 1608, 613, 1608, - /* 2360 */ 1608, 1608, 1608, 1608, 1608, 1966, 1608, 1608, 1608, 2002, - /* 2370 */ 1608, 1967, 305, 1968, 623, 1970, 1971, 618, 1608, 613, - /* 2380 */ 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1967, - /* 2390 */ 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, - /* 2400 */ 1608, 1608, 1985, 1608, 1608, 1608, 1608, 1608, 1608, 1608, - /* 2410 */ 620, 1608, 1608, 1608, 1608, 1936, 1608, 619, 1608, 1608, - /* 2420 */ 1985, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 620, 1608, - /* 2430 */ 1608, 1608, 1608, 1936, 1608, 619, 1608, 1608, 1608, 1608, - /* 2440 */ 1608, 1966, 1608, 1967, 1608, 2002, 1608, 1608, 309, 1968, - /* 2450 */ 623, 1970, 1971, 618, 1608, 613, 1608, 1608, 1608, 1966, - /* 2460 */ 1967, 1608, 1608, 2002, 1608, 1608, 301, 1968, 623, 1970, - /* 2470 */ 1971, 618, 1608, 613, 1985, 1608, 1608, 1608, 1608, 1608, - /* 2480 */ 1608, 1608, 620, 1608, 1608, 1608, 1608, 1936, 1608, 619, - /* 2490 */ 1608, 1985, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 620, - /* 2500 */ 1608, 1608, 1608, 1608, 1936, 1608, 619, 1608, 1608, 1608, - /* 2510 */ 1608, 1608, 1967, 1966, 1608, 1608, 1608, 2002, 1608, 1608, - /* 2520 */ 310, 1968, 623, 1970, 1971, 618, 1608, 613, 1967, 1608, - /* 2530 */ 1966, 1608, 1608, 1608, 2002, 1608, 1608, 302, 1968, 623, - /* 2540 */ 1970, 1971, 618, 1985, 613, 1608, 1608, 1608, 1608, 1608, - /* 2550 */ 1608, 620, 1608, 1608, 1608, 1608, 1936, 1608, 619, 1985, - /* 2560 */ 1608, 1608, 1608, 1608, 1608, 1608, 1608, 620, 1608, 1608, - /* 2570 */ 1608, 1608, 1936, 1608, 619, 1608, 1608, 1608, 1608, 1608, - /* 2580 */ 1967, 1608, 1966, 1608, 1608, 1608, 2002, 1608, 1608, 311, - /* 2590 */ 1968, 623, 1970, 1971, 618, 1608, 613, 1608, 1966, 1608, - /* 2600 */ 1608, 1608, 2002, 1967, 1608, 303, 1968, 623, 1970, 1971, - /* 2610 */ 618, 1985, 613, 1608, 1608, 1608, 1608, 1608, 1608, 620, - /* 2620 */ 1608, 1608, 1608, 1608, 1936, 1608, 619, 1608, 1608, 1608, - /* 2630 */ 1608, 1608, 1608, 1608, 1985, 1608, 1608, 1608, 1608, 1608, - /* 2640 */ 1608, 1608, 620, 1608, 1608, 1608, 1608, 1936, 1608, 619, - /* 2650 */ 1966, 1608, 1608, 1608, 2002, 1967, 1608, 316, 1968, 623, - /* 2660 */ 1970, 1971, 618, 1608, 613, 1608, 1608, 1608, 1608, 1608, - /* 2670 */ 1608, 1608, 1608, 1966, 1608, 1608, 1608, 2002, 1608, 1608, - /* 2680 */ 317, 1968, 623, 1970, 1971, 618, 1985, 613, 1608, 1608, - /* 2690 */ 1608, 1608, 1608, 1608, 620, 1608, 1608, 1608, 1608, 1936, - /* 2700 */ 1608, 619, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, - /* 2710 */ 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1967, 1608, - /* 2720 */ 1608, 1608, 1608, 1608, 1608, 1966, 1608, 1608, 1608, 2002, - /* 2730 */ 1608, 1608, 1979, 1968, 623, 1970, 1971, 618, 1608, 613, - /* 2740 */ 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1985, - /* 2750 */ 1608, 1608, 1608, 1608, 1608, 1608, 1608, 620, 1608, 1608, - /* 2760 */ 1608, 1608, 1936, 1608, 619, 1608, 1608, 1608, 1608, 1608, - /* 2770 */ 1967, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, - /* 2780 */ 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1966, 1967, - /* 2790 */ 1608, 1608, 2002, 1608, 1608, 1978, 1968, 623, 1970, 1971, - /* 2800 */ 618, 1985, 613, 1608, 1608, 1608, 1608, 1608, 1608, 620, - /* 2810 */ 1608, 1608, 1608, 1608, 1936, 1608, 619, 1608, 1608, 1608, - /* 2820 */ 1985, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 620, 1608, - /* 2830 */ 1608, 1608, 1608, 1936, 1608, 619, 1608, 1608, 1608, 1608, - /* 2840 */ 1966, 1967, 1608, 1608, 2002, 1608, 1608, 1977, 1968, 623, - /* 2850 */ 1970, 1971, 618, 1608, 613, 1608, 1608, 1967, 1608, 1966, - /* 2860 */ 1608, 1608, 1608, 2002, 1608, 1608, 328, 1968, 623, 1970, - /* 2870 */ 1971, 618, 1985, 613, 1608, 1608, 1608, 1608, 1608, 1608, - /* 2880 */ 620, 1608, 1608, 1608, 1608, 1936, 1608, 619, 1985, 1608, - /* 2890 */ 1608, 1608, 1608, 1608, 1608, 1608, 620, 1608, 1608, 1608, - /* 2900 */ 1608, 1936, 1608, 619, 1608, 1608, 1608, 1608, 1608, 1967, - /* 2910 */ 1608, 1966, 1608, 1608, 1608, 2002, 1608, 1608, 329, 1968, - /* 2920 */ 623, 1970, 1971, 618, 1608, 613, 1608, 1966, 1608, 1608, - /* 2930 */ 1608, 2002, 1967, 1608, 325, 1968, 623, 1970, 1971, 618, - /* 2940 */ 1985, 613, 1608, 1608, 1608, 1608, 1608, 1608, 620, 1608, - /* 2950 */ 1608, 1608, 1608, 1936, 1608, 619, 1608, 1608, 1608, 1608, - /* 2960 */ 1608, 1608, 1608, 1985, 1608, 1608, 1608, 1608, 1608, 1608, - /* 2970 */ 1608, 620, 1608, 1608, 1608, 1608, 1936, 1608, 619, 1966, - /* 2980 */ 1608, 1608, 1608, 2002, 1967, 1608, 330, 1968, 623, 1970, - /* 2990 */ 1971, 618, 1608, 613, 1608, 1608, 1608, 1608, 1608, 1608, - /* 3000 */ 1608, 1608, 621, 1608, 1608, 1608, 2002, 1608, 1608, 308, - /* 3010 */ 1968, 623, 1970, 1971, 618, 1985, 613, 1608, 1608, 1608, - /* 3020 */ 1608, 1608, 1608, 620, 1608, 1608, 1608, 1608, 1936, 1608, - /* 3030 */ 619, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, - /* 3040 */ 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, - /* 3050 */ 1608, 1608, 1608, 1608, 1966, 1608, 1608, 1608, 2002, 1608, - /* 3060 */ 1608, 307, 1968, 623, 1970, 1971, 618, 1608, 613, + /* 0 */ 35, 280, 465, 1886, 466, 1654, 474, 372, 466, 1654, + /* 10 */ 1817, 1819, 45, 43, 1544, 1964, 1884, 598, 1760, 471, + /* 20 */ 367, 412, 1394, 38, 37, 467, 1960, 44, 42, 41, + /* 30 */ 40, 39, 172, 1474, 464, 1392, 232, 469, 1660, 1801, + /* 40 */ 576, 610, 38, 37, 2134, 547, 44, 42, 41, 40, + /* 50 */ 39, 8, 610, 338, 1871, 1956, 1962, 349, 1469, 575, + /* 60 */ 178, 324, 190, 18, 2135, 577, 621, 38, 37, 1977, + /* 70 */ 1400, 44, 42, 41, 40, 39, 473, 1420, 588, 469, + /* 80 */ 1660, 38, 37, 45, 43, 44, 42, 41, 40, 39, + /* 90 */ 2139, 367, 174, 1394, 1618, 14, 139, 331, 81, 2036, + /* 100 */ 1995, 80, 60, 27, 1474, 1811, 1392, 1421, 591, 137, + /* 110 */ 162, 1581, 1630, 1946, 611, 627, 48, 718, 128, 127, + /* 120 */ 126, 125, 124, 123, 122, 121, 120, 48, 129, 1469, + /* 130 */ 103, 163, 1476, 1477, 18, 504, 1725, 448, 1503, 1976, + /* 140 */ 64, 1400, 483, 2012, 138, 1771, 106, 1978, 631, 1980, + /* 150 */ 1981, 626, 1763, 621, 1419, 2139, 1824, 149, 175, 2134, + /* 160 */ 2065, 1449, 1459, 355, 361, 2061, 14, 1475, 1478, 260, + /* 170 */ 2073, 587, 1822, 130, 586, 2138, 610, 2134, 180, 2135, + /* 180 */ 2137, 2139, 1395, 1604, 1393, 2134, 2091, 533, 718, 1271, + /* 190 */ 1272, 263, 575, 178, 1504, 194, 193, 2135, 577, 49, + /* 200 */ 531, 2138, 529, 1476, 1477, 2135, 2136, 1398, 1399, 53, + /* 210 */ 1448, 1451, 1452, 1453, 1454, 1455, 1456, 1457, 1458, 623, + /* 220 */ 619, 1467, 1468, 1470, 1471, 1472, 1473, 2, 60, 60, + /* 230 */ 89, 60, 1449, 1459, 2080, 1419, 159, 119, 1475, 1478, + /* 240 */ 118, 117, 116, 115, 114, 113, 112, 111, 110, 571, + /* 250 */ 262, 230, 181, 1395, 2080, 1393, 1537, 38, 37, 1641, + /* 260 */ 2077, 44, 42, 41, 40, 39, 34, 365, 1498, 1499, + /* 270 */ 1500, 1501, 1502, 1506, 1507, 1508, 1509, 181, 1398, 1399, + /* 280 */ 2076, 1448, 1451, 1452, 1453, 1454, 1455, 1456, 1457, 1458, + /* 290 */ 623, 619, 1467, 1468, 1470, 1471, 1472, 1473, 2, 401, + /* 300 */ 11, 45, 43, 1946, 1964, 1394, 1548, 1640, 1995, 367, + /* 310 */ 413, 1394, 1419, 86, 326, 1960, 570, 537, 1392, 535, + /* 320 */ 403, 399, 1474, 414, 1392, 1228, 653, 652, 651, 1232, + /* 330 */ 650, 1234, 1235, 649, 1237, 646, 1687, 1243, 643, 1245, + /* 340 */ 1246, 640, 637, 216, 1956, 1962, 362, 1469, 160, 181, + /* 350 */ 406, 1946, 18, 1400, 1824, 621, 569, 1774, 167, 1400, + /* 360 */ 1121, 360, 1120, 665, 500, 496, 492, 488, 213, 1639, + /* 370 */ 1822, 1638, 45, 43, 1479, 215, 1324, 1325, 181, 181, + /* 380 */ 367, 181, 1394, 1824, 14, 44, 42, 41, 40, 39, + /* 390 */ 371, 1122, 552, 1474, 657, 1392, 2134, 1815, 1637, 1822, + /* 400 */ 718, 519, 518, 517, 85, 1102, 718, 211, 1619, 134, + /* 410 */ 513, 2140, 178, 1946, 512, 1946, 2135, 577, 1469, 511, + /* 420 */ 516, 1476, 1477, 1611, 1636, 510, 271, 272, 1400, 119, + /* 430 */ 1400, 270, 118, 117, 116, 115, 114, 113, 112, 111, + /* 440 */ 110, 588, 1946, 1420, 1104, 661, 1107, 1108, 1815, 1886, + /* 450 */ 1449, 1459, 611, 1450, 1824, 46, 1475, 1478, 1121, 358, + /* 460 */ 1120, 335, 1883, 598, 611, 1395, 54, 1393, 1946, 618, + /* 470 */ 1822, 1395, 137, 1393, 210, 204, 1635, 718, 183, 209, + /* 480 */ 38, 37, 479, 1771, 44, 42, 41, 40, 39, 1122, + /* 490 */ 1398, 1399, 1476, 1477, 84, 1771, 1398, 1399, 202, 1448, + /* 500 */ 1451, 1452, 1453, 1454, 1455, 1456, 1457, 1458, 623, 619, + /* 510 */ 1467, 1468, 1470, 1471, 1472, 1473, 2, 1767, 1610, 1421, + /* 520 */ 1946, 1449, 1459, 588, 1188, 1634, 576, 1475, 1478, 611, + /* 530 */ 2134, 590, 176, 2073, 2074, 611, 135, 2078, 1419, 519, + /* 540 */ 518, 517, 1395, 410, 1393, 575, 178, 134, 513, 411, + /* 550 */ 2135, 577, 512, 1633, 137, 1339, 1340, 511, 516, 1190, + /* 560 */ 1771, 1977, 1632, 510, 1818, 1819, 1771, 1398, 1399, 1946, + /* 570 */ 1448, 1451, 1452, 1453, 1454, 1455, 1456, 1457, 1458, 623, + /* 580 */ 619, 1467, 1468, 1470, 1471, 1472, 1473, 2, 45, 43, + /* 590 */ 1338, 1341, 1995, 1749, 84, 359, 367, 1946, 1394, 1418, + /* 600 */ 628, 1616, 613, 160, 2037, 1946, 1946, 627, 133, 1474, + /* 610 */ 231, 1392, 1773, 1495, 177, 2073, 2074, 1766, 135, 2078, + /* 620 */ 38, 37, 1977, 2080, 44, 42, 41, 40, 39, 524, + /* 630 */ 566, 1976, 1422, 611, 1469, 2012, 656, 1571, 106, 1978, + /* 640 */ 631, 1980, 1981, 626, 534, 621, 1400, 129, 140, 2075, + /* 650 */ 146, 2036, 2065, 1995, 509, 483, 361, 2061, 229, 45, + /* 660 */ 43, 628, 262, 611, 1771, 382, 1946, 367, 627, 1394, + /* 670 */ 11, 46, 9, 527, 1629, 1371, 1372, 420, 521, 1628, + /* 680 */ 1474, 1824, 1392, 228, 1762, 60, 563, 1569, 1570, 1572, + /* 690 */ 1573, 1933, 1976, 718, 1771, 1960, 2012, 1823, 611, 164, + /* 700 */ 1978, 631, 1980, 1981, 626, 1469, 621, 552, 1476, 1477, + /* 710 */ 1867, 2134, 281, 1627, 572, 567, 561, 1400, 1946, 67, + /* 720 */ 1748, 186, 66, 1946, 1956, 1962, 2140, 178, 1626, 1771, + /* 730 */ 1484, 2135, 577, 13, 12, 621, 1419, 1449, 1459, 389, + /* 740 */ 553, 2102, 14, 1475, 1478, 611, 38, 37, 1505, 1747, + /* 750 */ 44, 42, 41, 40, 39, 31, 172, 1946, 1395, 434, + /* 760 */ 1393, 38, 37, 1867, 718, 44, 42, 41, 40, 39, + /* 770 */ 1967, 405, 1946, 404, 188, 240, 1771, 1422, 1872, 1476, + /* 780 */ 1477, 1746, 1625, 1398, 1399, 1419, 1448, 1451, 1452, 1453, + /* 790 */ 1454, 1455, 1456, 1457, 1458, 623, 619, 1467, 1468, 1470, + /* 800 */ 1471, 1472, 1473, 2, 41, 40, 39, 611, 1449, 1459, + /* 810 */ 323, 665, 1417, 11, 1475, 1478, 370, 97, 1969, 442, + /* 820 */ 32, 435, 455, 580, 160, 454, 1946, 663, 1517, 1395, + /* 830 */ 1510, 1393, 1624, 1773, 1560, 181, 373, 1422, 1771, 1764, + /* 840 */ 426, 1965, 456, 1541, 160, 428, 151, 150, 660, 659, + /* 850 */ 658, 148, 1960, 1773, 1398, 1399, 677, 1448, 1451, 1452, + /* 860 */ 1453, 1454, 1455, 1456, 1457, 1458, 623, 619, 1467, 1468, + /* 870 */ 1470, 1471, 1472, 1473, 2, 1623, 1946, 1450, 515, 514, + /* 880 */ 161, 1956, 1962, 33, 52, 300, 339, 1684, 663, 38, + /* 890 */ 37, 551, 621, 44, 42, 41, 40, 39, 416, 298, + /* 900 */ 70, 2138, 615, 69, 2037, 689, 687, 151, 150, 660, + /* 910 */ 659, 658, 148, 1867, 662, 294, 1756, 1815, 1801, 1946, + /* 920 */ 187, 198, 461, 459, 192, 678, 1450, 1741, 452, 1107, + /* 930 */ 1108, 447, 446, 445, 444, 441, 440, 439, 438, 437, + /* 940 */ 433, 432, 431, 430, 340, 423, 422, 421, 594, 418, + /* 950 */ 417, 337, 695, 694, 693, 692, 377, 60, 691, 690, + /* 960 */ 141, 685, 684, 683, 682, 681, 680, 679, 153, 675, + /* 970 */ 674, 673, 376, 375, 670, 669, 668, 667, 666, 1622, + /* 980 */ 239, 611, 663, 1621, 1758, 611, 380, 1854, 379, 508, + /* 990 */ 552, 2085, 1537, 611, 2134, 481, 105, 1613, 1614, 482, + /* 1000 */ 1977, 151, 150, 660, 659, 658, 148, 1768, 1754, 2140, + /* 1010 */ 178, 507, 1771, 71, 2135, 577, 1771, 50, 143, 3, + /* 1020 */ 131, 583, 221, 1946, 1771, 219, 235, 1946, 552, 611, + /* 1030 */ 552, 1995, 2134, 1403, 2134, 1674, 78, 77, 409, 591, + /* 1040 */ 588, 185, 611, 145, 1946, 581, 627, 2140, 178, 2140, + /* 1050 */ 178, 1631, 2135, 577, 2135, 577, 548, 520, 540, 322, + /* 1060 */ 1771, 611, 397, 79, 395, 391, 387, 384, 381, 622, + /* 1070 */ 1976, 137, 1977, 1771, 2012, 592, 62, 106, 1978, 631, + /* 1080 */ 1980, 1981, 626, 611, 621, 1540, 1402, 223, 244, 175, + /* 1090 */ 222, 2065, 1771, 1667, 655, 361, 2061, 596, 611, 611, + /* 1100 */ 552, 1665, 225, 1995, 2134, 224, 227, 181, 611, 226, + /* 1110 */ 343, 628, 597, 275, 1771, 522, 1946, 2092, 627, 2140, + /* 1120 */ 178, 238, 606, 525, 2135, 577, 1977, 611, 1568, 1771, + /* 1130 */ 1771, 179, 2073, 2074, 149, 135, 2078, 1726, 429, 1771, + /* 1140 */ 246, 608, 1976, 13, 12, 102, 2012, 47, 2105, 106, + /* 1150 */ 1978, 631, 1980, 1981, 626, 99, 621, 1995, 1771, 268, + /* 1160 */ 87, 2154, 579, 2065, 68, 628, 257, 361, 2061, 214, + /* 1170 */ 1946, 344, 627, 342, 341, 147, 506, 564, 2099, 251, + /* 1180 */ 508, 611, 1406, 611, 149, 62, 595, 1977, 47, 47, + /* 1190 */ 1661, 635, 147, 1996, 149, 374, 1976, 609, 378, 1336, + /* 1200 */ 2012, 132, 507, 106, 1978, 631, 1980, 1981, 626, 1876, + /* 1210 */ 621, 273, 1771, 1655, 1771, 2154, 603, 2065, 1995, 1150, + /* 1220 */ 147, 361, 2061, 1812, 2095, 671, 628, 277, 364, 363, + /* 1230 */ 672, 1946, 2112, 627, 589, 1405, 1221, 1511, 1408, 713, + /* 1240 */ 1460, 293, 1, 1249, 1253, 584, 1260, 1169, 259, 1474, + /* 1250 */ 1977, 1401, 1167, 1258, 1151, 256, 4, 1976, 383, 388, + /* 1260 */ 336, 2012, 1358, 288, 106, 1978, 631, 1980, 1981, 626, + /* 1270 */ 1977, 621, 152, 191, 1469, 415, 2154, 1422, 2065, 1877, + /* 1280 */ 419, 1995, 361, 2061, 450, 424, 1400, 1417, 436, 628, + /* 1290 */ 1869, 443, 449, 559, 1946, 451, 627, 457, 195, 458, + /* 1300 */ 460, 1995, 462, 1423, 463, 1425, 475, 201, 472, 628, + /* 1310 */ 1420, 476, 203, 1424, 1946, 1426, 627, 477, 478, 480, + /* 1320 */ 1976, 206, 484, 208, 2012, 82, 83, 106, 1978, 631, + /* 1330 */ 1980, 1981, 626, 617, 621, 212, 1124, 541, 501, 2154, + /* 1340 */ 1976, 2065, 503, 502, 2012, 361, 2061, 106, 1978, 631, + /* 1350 */ 1980, 1981, 626, 505, 621, 1761, 2128, 109, 325, 2154, + /* 1360 */ 218, 2065, 1923, 1922, 1757, 361, 2061, 220, 539, 154, + /* 1370 */ 721, 233, 155, 1977, 1759, 1755, 2084, 156, 157, 542, + /* 1380 */ 289, 236, 549, 543, 287, 546, 2111, 565, 2096, 556, + /* 1390 */ 601, 2110, 562, 2087, 350, 568, 2106, 574, 1409, 171, + /* 1400 */ 1404, 250, 168, 252, 1995, 711, 707, 703, 699, 285, + /* 1410 */ 242, 245, 628, 7, 557, 555, 554, 1946, 1537, 627, + /* 1420 */ 2157, 585, 2133, 1412, 1414, 351, 582, 255, 136, 1421, + /* 1430 */ 593, 253, 1977, 254, 2081, 354, 619, 1467, 1468, 1470, + /* 1440 */ 1471, 1472, 1473, 1976, 290, 104, 264, 2012, 278, 92, + /* 1450 */ 106, 1978, 631, 1980, 1981, 626, 599, 621, 600, 1894, + /* 1460 */ 1893, 1892, 2040, 1995, 2065, 291, 604, 357, 361, 2061, + /* 1470 */ 94, 628, 292, 96, 605, 1772, 1946, 258, 627, 59, + /* 1480 */ 2046, 607, 98, 1816, 633, 295, 1977, 1742, 714, 51, + /* 1490 */ 715, 327, 717, 328, 1940, 319, 284, 299, 1939, 304, + /* 1500 */ 75, 297, 1976, 1938, 1937, 76, 2012, 1934, 385, 106, + /* 1510 */ 1978, 631, 1980, 1981, 626, 266, 621, 1995, 318, 308, + /* 1520 */ 265, 2038, 386, 2065, 1386, 628, 1387, 361, 2061, 390, + /* 1530 */ 1946, 184, 627, 1932, 392, 393, 394, 1365, 1931, 234, + /* 1540 */ 396, 1930, 1929, 398, 400, 1928, 402, 1977, 1361, 1360, + /* 1550 */ 1905, 1904, 407, 408, 1903, 1902, 1976, 1315, 1862, 1861, + /* 1560 */ 2012, 1859, 142, 106, 1978, 631, 1980, 1981, 626, 1858, + /* 1570 */ 621, 1857, 1860, 1856, 1855, 614, 1853, 2065, 1995, 1852, + /* 1580 */ 1851, 361, 2061, 189, 425, 1850, 628, 427, 1849, 1848, + /* 1590 */ 1847, 1946, 1846, 627, 144, 1834, 1833, 1832, 1831, 1830, + /* 1600 */ 1829, 1828, 1827, 1317, 453, 1977, 1845, 1844, 1843, 1842, + /* 1610 */ 1841, 1840, 1839, 1838, 1837, 1836, 1835, 1976, 1826, 1825, + /* 1620 */ 1689, 2012, 1196, 196, 107, 1978, 631, 1980, 1981, 626, + /* 1630 */ 1688, 621, 1686, 197, 1650, 199, 1995, 1110, 2065, 1109, + /* 1640 */ 1649, 1918, 2064, 2061, 628, 1912, 1901, 173, 207, 1946, + /* 1650 */ 1900, 627, 1966, 1880, 1750, 1143, 73, 1685, 1683, 1977, + /* 1660 */ 1681, 1679, 1677, 485, 200, 74, 205, 1664, 468, 470, + /* 1670 */ 487, 489, 493, 497, 491, 1976, 1663, 486, 495, 2012, + /* 1680 */ 1646, 490, 107, 1978, 631, 1980, 1981, 626, 1977, 621, + /* 1690 */ 1995, 494, 498, 1752, 499, 1264, 2065, 1751, 628, 1265, + /* 1700 */ 616, 2061, 1675, 1946, 1187, 627, 1186, 1185, 61, 1184, + /* 1710 */ 686, 1179, 688, 1181, 1180, 1668, 1178, 345, 346, 1995, + /* 1720 */ 523, 1666, 347, 526, 1645, 528, 1644, 625, 1643, 629, + /* 1730 */ 532, 108, 1946, 2012, 627, 1917, 107, 1978, 631, 1980, + /* 1740 */ 1981, 626, 530, 621, 217, 1376, 1977, 1375, 1378, 55, + /* 1750 */ 2065, 536, 1367, 1911, 330, 2061, 544, 1899, 1976, 1897, + /* 1760 */ 26, 2139, 2012, 19, 16, 316, 1978, 631, 1980, 1981, + /* 1770 */ 626, 624, 621, 612, 2030, 558, 560, 1995, 1583, 28, + /* 1780 */ 241, 58, 243, 1567, 248, 628, 166, 247, 249, 29, + /* 1790 */ 1946, 1967, 627, 30, 1559, 20, 63, 17, 88, 1598, + /* 1800 */ 1977, 1603, 1604, 1597, 21, 352, 1602, 56, 1601, 353, + /* 1810 */ 1534, 545, 1533, 261, 237, 1898, 1976, 1896, 1895, 348, + /* 1820 */ 2012, 57, 550, 165, 1978, 631, 1980, 1981, 626, 5, + /* 1830 */ 621, 1995, 158, 6, 169, 1879, 91, 90, 22, 628, + /* 1840 */ 93, 267, 1565, 269, 1946, 274, 627, 65, 1878, 95, + /* 1850 */ 279, 23, 99, 12, 1977, 1410, 2015, 170, 1464, 1462, + /* 1860 */ 620, 182, 36, 1441, 15, 602, 634, 369, 276, 638, + /* 1870 */ 1976, 1461, 1433, 24, 2012, 578, 2155, 107, 1978, 631, + /* 1880 */ 1980, 1981, 626, 25, 621, 1995, 632, 1250, 1247, 636, + /* 1890 */ 639, 2065, 1244, 628, 641, 642, 2062, 644, 1946, 645, + /* 1900 */ 627, 1238, 1236, 1486, 647, 1242, 1977, 10, 648, 1241, + /* 1910 */ 1227, 100, 282, 1259, 101, 654, 1496, 1240, 1239, 1255, + /* 1920 */ 72, 1141, 1977, 664, 1976, 1175, 1174, 630, 2012, 1173, + /* 1930 */ 1172, 164, 1978, 631, 1980, 1981, 626, 1995, 621, 1171, + /* 1940 */ 1170, 1485, 1168, 1166, 1165, 628, 1164, 1194, 676, 1162, + /* 1950 */ 1946, 1161, 627, 1995, 283, 1160, 1159, 1158, 1157, 1156, + /* 1960 */ 1189, 628, 1153, 1191, 1152, 1149, 1946, 1148, 627, 1147, + /* 1970 */ 1146, 1682, 696, 2103, 697, 698, 1976, 1680, 700, 701, + /* 1980 */ 2012, 702, 1678, 310, 1978, 631, 1980, 1981, 626, 704, + /* 1990 */ 621, 706, 1976, 705, 1676, 708, 2012, 709, 710, 165, + /* 2000 */ 1978, 631, 1980, 1981, 626, 1662, 621, 712, 1099, 1642, + /* 2010 */ 286, 1977, 716, 1617, 1396, 296, 719, 720, 1617, 1617, + /* 2020 */ 1617, 1617, 1617, 1617, 1617, 1617, 1617, 573, 1617, 1977, + /* 2030 */ 1617, 1617, 1617, 1617, 1617, 1617, 1617, 1617, 1617, 1617, + /* 2040 */ 1617, 1617, 1995, 1617, 1617, 1617, 1617, 356, 1617, 1617, + /* 2050 */ 628, 1617, 2156, 1617, 1617, 1946, 1617, 627, 1617, 1617, + /* 2060 */ 1995, 1617, 1617, 1617, 1617, 1617, 1617, 1617, 625, 1617, + /* 2070 */ 1617, 1617, 1617, 1946, 1617, 627, 1617, 1617, 1617, 1617, + /* 2080 */ 1617, 1976, 1617, 1977, 1617, 2012, 1617, 1617, 317, 1978, + /* 2090 */ 631, 1980, 1981, 626, 1617, 621, 1617, 1617, 1617, 1976, + /* 2100 */ 1977, 1617, 1617, 2012, 1617, 1617, 316, 1978, 631, 1980, + /* 2110 */ 1981, 626, 1617, 621, 1995, 2031, 1617, 1617, 1617, 366, + /* 2120 */ 1617, 1617, 628, 1617, 1617, 1617, 1617, 1946, 1617, 627, + /* 2130 */ 1617, 1995, 1617, 1617, 1617, 1617, 368, 1617, 1617, 628, + /* 2140 */ 1617, 1617, 1617, 1617, 1946, 1617, 627, 1617, 1617, 1617, + /* 2150 */ 1617, 1617, 1977, 1976, 1617, 1617, 1617, 2012, 1617, 1617, + /* 2160 */ 317, 1978, 631, 1980, 1981, 626, 1617, 621, 1977, 1617, + /* 2170 */ 1976, 1617, 1617, 1617, 2012, 1617, 1617, 317, 1978, 631, + /* 2180 */ 1980, 1981, 626, 1995, 621, 1617, 1617, 1617, 1617, 1617, + /* 2190 */ 1617, 628, 1617, 1617, 1617, 1617, 1946, 1617, 627, 1995, + /* 2200 */ 1617, 1617, 1617, 1617, 1617, 1617, 1617, 628, 1617, 1617, + /* 2210 */ 1617, 1617, 1946, 1617, 627, 1617, 1617, 1617, 1617, 1617, + /* 2220 */ 1977, 1617, 538, 1617, 1617, 1617, 2012, 1617, 1617, 312, + /* 2230 */ 1978, 631, 1980, 1981, 626, 1617, 621, 1617, 1976, 1617, + /* 2240 */ 1617, 1617, 2012, 1617, 1617, 301, 1978, 631, 1980, 1981, + /* 2250 */ 626, 1995, 621, 1617, 1617, 1617, 1617, 1617, 1617, 628, + /* 2260 */ 1617, 1617, 1617, 1617, 1946, 1617, 627, 1617, 1617, 1617, + /* 2270 */ 1617, 1617, 1617, 1617, 1977, 1617, 1617, 1617, 1617, 1617, + /* 2280 */ 1617, 1617, 1617, 1617, 1617, 1617, 1617, 1617, 1617, 1617, + /* 2290 */ 1976, 1617, 1617, 1617, 2012, 1977, 1617, 302, 1978, 631, + /* 2300 */ 1980, 1981, 626, 1617, 621, 1995, 1617, 1617, 1617, 1617, + /* 2310 */ 1617, 1617, 1617, 628, 1617, 1617, 1617, 1617, 1946, 1617, + /* 2320 */ 627, 1617, 1617, 1617, 1617, 1617, 1995, 1617, 1617, 1617, + /* 2330 */ 1617, 1617, 1617, 1617, 628, 1617, 1617, 1617, 1617, 1946, + /* 2340 */ 1617, 627, 1617, 1617, 1976, 1617, 1617, 1617, 2012, 1617, + /* 2350 */ 1617, 303, 1978, 631, 1980, 1981, 626, 1617, 621, 1617, + /* 2360 */ 1617, 1617, 1617, 1617, 1617, 1976, 1617, 1617, 1617, 2012, + /* 2370 */ 1617, 1977, 309, 1978, 631, 1980, 1981, 626, 1617, 621, + /* 2380 */ 1617, 1617, 1617, 1617, 1617, 1617, 1617, 1617, 1617, 1977, + /* 2390 */ 1617, 1617, 1617, 1617, 1617, 1617, 1617, 1617, 1617, 1617, + /* 2400 */ 1617, 1617, 1995, 1617, 1617, 1617, 1617, 1617, 1617, 1617, + /* 2410 */ 628, 1617, 1617, 1617, 1617, 1946, 1617, 627, 1617, 1617, + /* 2420 */ 1995, 1617, 1617, 1617, 1617, 1617, 1617, 1617, 628, 1617, + /* 2430 */ 1617, 1617, 1617, 1946, 1617, 627, 1617, 1617, 1617, 1617, + /* 2440 */ 1617, 1976, 1617, 1977, 1617, 2012, 1617, 1617, 313, 1978, + /* 2450 */ 631, 1980, 1981, 626, 1617, 621, 1617, 1617, 1617, 1976, + /* 2460 */ 1977, 1617, 1617, 2012, 1617, 1617, 305, 1978, 631, 1980, + /* 2470 */ 1981, 626, 1617, 621, 1995, 1617, 1617, 1617, 1617, 1617, + /* 2480 */ 1617, 1617, 628, 1617, 1617, 1617, 1617, 1946, 1617, 627, + /* 2490 */ 1617, 1995, 1617, 1617, 1617, 1617, 1617, 1617, 1617, 628, + /* 2500 */ 1617, 1617, 1617, 1617, 1946, 1617, 627, 1617, 1617, 1617, + /* 2510 */ 1617, 1617, 1977, 1976, 1617, 1617, 1617, 2012, 1617, 1617, + /* 2520 */ 314, 1978, 631, 1980, 1981, 626, 1617, 621, 1977, 1617, + /* 2530 */ 1976, 1617, 1617, 1617, 2012, 1617, 1617, 306, 1978, 631, + /* 2540 */ 1980, 1981, 626, 1995, 621, 1617, 1617, 1617, 1617, 1617, + /* 2550 */ 1617, 628, 1617, 1617, 1617, 1617, 1946, 1617, 627, 1995, + /* 2560 */ 1617, 1617, 1617, 1617, 1617, 1617, 1617, 628, 1617, 1617, + /* 2570 */ 1617, 1617, 1946, 1617, 627, 1617, 1617, 1617, 1617, 1617, + /* 2580 */ 1977, 1617, 1976, 1617, 1617, 1617, 2012, 1617, 1617, 315, + /* 2590 */ 1978, 631, 1980, 1981, 626, 1617, 621, 1617, 1976, 1617, + /* 2600 */ 1617, 1617, 2012, 1977, 1617, 307, 1978, 631, 1980, 1981, + /* 2610 */ 626, 1995, 621, 1617, 1617, 1617, 1617, 1617, 1617, 628, + /* 2620 */ 1617, 1617, 1617, 1617, 1946, 1617, 627, 1617, 1617, 1617, + /* 2630 */ 1617, 1617, 1617, 1617, 1995, 1617, 1617, 1617, 1617, 1617, + /* 2640 */ 1617, 1617, 628, 1617, 1617, 1617, 1617, 1946, 1617, 627, + /* 2650 */ 1976, 1617, 1617, 1617, 2012, 1977, 1617, 320, 1978, 631, + /* 2660 */ 1980, 1981, 626, 1617, 621, 1617, 1617, 1617, 1617, 1617, + /* 2670 */ 1617, 1617, 1617, 1976, 1617, 1617, 1617, 2012, 1617, 1617, + /* 2680 */ 321, 1978, 631, 1980, 1981, 626, 1995, 621, 1617, 1617, + /* 2690 */ 1617, 1617, 1617, 1617, 628, 1617, 1617, 1617, 1617, 1946, + /* 2700 */ 1617, 627, 1617, 1617, 1617, 1617, 1617, 1617, 1617, 1617, + /* 2710 */ 1617, 1617, 1617, 1617, 1617, 1617, 1617, 1617, 1977, 1617, + /* 2720 */ 1617, 1617, 1617, 1617, 1617, 1976, 1617, 1617, 1617, 2012, + /* 2730 */ 1617, 1617, 1989, 1978, 631, 1980, 1981, 626, 1617, 621, + /* 2740 */ 1617, 1617, 1617, 1617, 1617, 1617, 1617, 1617, 1617, 1995, + /* 2750 */ 1617, 1617, 1617, 1617, 1617, 1617, 1617, 628, 1617, 1617, + /* 2760 */ 1617, 1617, 1946, 1617, 627, 1617, 1617, 1617, 1617, 1617, + /* 2770 */ 1977, 1617, 1617, 1617, 1617, 1617, 1617, 1617, 1617, 1617, + /* 2780 */ 1617, 1617, 1617, 1617, 1617, 1617, 1617, 1617, 1976, 1977, + /* 2790 */ 1617, 1617, 2012, 1617, 1617, 1988, 1978, 631, 1980, 1981, + /* 2800 */ 626, 1995, 621, 1617, 1617, 1617, 1617, 1617, 1617, 628, + /* 2810 */ 1617, 1617, 1617, 1617, 1946, 1617, 627, 1617, 1617, 1617, + /* 2820 */ 1995, 1617, 1617, 1617, 1617, 1617, 1617, 1617, 628, 1617, + /* 2830 */ 1617, 1617, 1617, 1946, 1617, 627, 1617, 1617, 1617, 1617, + /* 2840 */ 1976, 1977, 1617, 1617, 2012, 1617, 1617, 1987, 1978, 631, + /* 2850 */ 1980, 1981, 626, 1617, 621, 1617, 1617, 1977, 1617, 1976, + /* 2860 */ 1617, 1617, 1617, 2012, 1617, 1617, 332, 1978, 631, 1980, + /* 2870 */ 1981, 626, 1995, 621, 1617, 1617, 1617, 1617, 1617, 1617, + /* 2880 */ 628, 1617, 1617, 1617, 1617, 1946, 1617, 627, 1995, 1617, + /* 2890 */ 1617, 1617, 1617, 1617, 1617, 1617, 628, 1617, 1617, 1617, + /* 2900 */ 1617, 1946, 1617, 627, 1617, 1617, 1617, 1617, 1617, 1977, + /* 2910 */ 1617, 1976, 1617, 1617, 1617, 2012, 1617, 1617, 333, 1978, + /* 2920 */ 631, 1980, 1981, 626, 1617, 621, 1617, 1976, 1617, 1617, + /* 2930 */ 1617, 2012, 1977, 1617, 329, 1978, 631, 1980, 1981, 626, + /* 2940 */ 1995, 621, 1617, 1617, 1617, 1617, 1617, 1617, 628, 1617, + /* 2950 */ 1617, 1617, 1617, 1946, 1617, 627, 1617, 1617, 1617, 1617, + /* 2960 */ 1617, 1617, 1617, 1995, 1617, 1617, 1617, 1617, 1617, 1617, + /* 2970 */ 1617, 628, 1617, 1617, 1617, 1617, 1946, 1617, 627, 1976, + /* 2980 */ 1617, 1617, 1617, 2012, 1977, 1617, 334, 1978, 631, 1980, + /* 2990 */ 1981, 626, 1617, 621, 1617, 1617, 1617, 1617, 1617, 1617, + /* 3000 */ 1617, 1617, 629, 1617, 1617, 1617, 2012, 1617, 1617, 312, + /* 3010 */ 1978, 631, 1980, 1981, 626, 1995, 621, 1617, 1617, 1617, + /* 3020 */ 1617, 1617, 1617, 628, 1617, 1617, 1617, 1617, 1946, 1617, + /* 3030 */ 627, 1617, 1617, 1617, 1617, 1617, 1617, 1617, 1617, 1617, + /* 3040 */ 1617, 1617, 1617, 1617, 1617, 1617, 1617, 1617, 1617, 1617, + /* 3050 */ 1617, 1617, 1617, 1617, 1976, 1617, 1617, 1617, 2012, 1617, + /* 3060 */ 1617, 311, 1978, 631, 1980, 1981, 626, 1617, 621, }; static const YYCODETYPE yy_lookahead[] = { /* 0 */ 420, 421, 332, 374, 334, 335, 332, 370, 334, 335, /* 10 */ 373, 374, 12, 13, 14, 361, 387, 388, 360, 14, /* 20 */ 20, 336, 22, 8, 9, 20, 372, 12, 13, 14, /* 30 */ 15, 16, 359, 33, 333, 35, 352, 336, 337, 355, - /* 40 */ 431, 20, 8, 9, 435, 20, 12, 13, 14, 15, + /* 40 */ 431, 20, 8, 9, 435, 393, 12, 13, 14, 15, /* 50 */ 16, 39, 20, 380, 381, 401, 402, 403, 58, 450, /* 60 */ 451, 376, 58, 63, 455, 456, 412, 8, 9, 328, /* 70 */ 70, 12, 13, 14, 15, 16, 333, 20, 336, 336, @@ -552,7 +551,7 @@ static const YYCODETYPE yy_lookahead[] = { /* 210 */ 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, /* 220 */ 220, 221, 222, 223, 224, 225, 226, 227, 95, 95, /* 230 */ 97, 95, 161, 162, 404, 20, 163, 21, 167, 168, - /* 240 */ 24, 25, 26, 27, 28, 29, 30, 31, 32, 106, + /* 240 */ 24, 25, 26, 27, 28, 29, 30, 31, 32, 20, /* 250 */ 163, 127, 245, 182, 404, 184, 244, 8, 9, 328, /* 260 */ 430, 12, 13, 14, 15, 16, 232, 233, 234, 235, /* 270 */ 236, 237, 238, 239, 240, 241, 242, 245, 207, 208, @@ -562,21 +561,21 @@ static const YYCODETYPE yy_lookahead[] = { /* 310 */ 22, 22, 20, 189, 190, 372, 367, 193, 35, 195, /* 320 */ 198, 199, 33, 35, 35, 108, 109, 110, 111, 112, /* 330 */ 113, 114, 115, 116, 117, 118, 0, 120, 121, 122, - /* 340 */ 123, 124, 125, 33, 401, 402, 403, 58, 35, 245, - /* 350 */ 389, 372, 63, 70, 359, 412, 407, 4, 48, 70, - /* 360 */ 20, 366, 22, 20, 54, 55, 56, 57, 58, 328, + /* 340 */ 123, 124, 125, 33, 401, 402, 403, 58, 359, 245, + /* 350 */ 389, 372, 63, 70, 359, 412, 407, 368, 48, 70, + /* 360 */ 20, 366, 22, 62, 54, 55, 56, 57, 58, 328, /* 370 */ 375, 328, 12, 13, 14, 35, 161, 162, 245, 245, - /* 380 */ 20, 245, 22, 70, 95, 12, 13, 14, 15, 16, - /* 390 */ 62, 51, 431, 33, 20, 35, 435, 20, 328, 22, + /* 380 */ 20, 245, 22, 359, 95, 12, 13, 14, 15, 16, + /* 390 */ 366, 51, 431, 33, 369, 35, 435, 372, 328, 375, /* 400 */ 117, 65, 66, 67, 94, 4, 117, 97, 0, 73, /* 410 */ 74, 450, 451, 372, 78, 372, 455, 456, 58, 83, - /* 420 */ 84, 132, 133, 174, 328, 89, 126, 127, 51, 21, + /* 420 */ 84, 132, 133, 174, 328, 89, 126, 127, 70, 21, /* 430 */ 70, 131, 24, 25, 26, 27, 28, 29, 30, 31, - /* 440 */ 32, 336, 372, 20, 43, 328, 45, 46, 70, 374, - /* 450 */ 161, 162, 336, 161, 359, 95, 167, 168, 229, 384, - /* 460 */ 231, 366, 387, 388, 336, 182, 350, 184, 372, 44, + /* 440 */ 32, 336, 372, 20, 43, 369, 45, 46, 372, 374, + /* 450 */ 161, 162, 336, 161, 359, 95, 167, 168, 20, 384, + /* 460 */ 22, 366, 387, 388, 336, 182, 350, 184, 372, 63, /* 470 */ 375, 182, 367, 184, 164, 165, 328, 117, 350, 169, - /* 480 */ 8, 9, 172, 367, 12, 13, 14, 15, 16, 372, + /* 480 */ 8, 9, 172, 367, 12, 13, 14, 15, 16, 51, /* 490 */ 207, 208, 132, 133, 342, 367, 207, 208, 188, 210, /* 500 */ 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, /* 510 */ 221, 222, 223, 224, 225, 226, 227, 365, 269, 20, @@ -587,149 +586,149 @@ static const YYCODETYPE yy_lookahead[] = { /* 560 */ 367, 328, 328, 89, 373, 374, 367, 207, 208, 372, /* 570 */ 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, /* 580 */ 220, 221, 222, 223, 224, 225, 226, 227, 12, 13, - /* 590 */ 167, 168, 359, 0, 342, 351, 20, 372, 22, 246, + /* 590 */ 167, 168, 359, 0, 342, 351, 20, 372, 22, 20, /* 600 */ 367, 325, 416, 359, 418, 372, 372, 374, 356, 33, - /* 610 */ 126, 35, 368, 229, 427, 428, 429, 365, 431, 432, + /* 610 */ 126, 35, 368, 207, 427, 428, 429, 365, 431, 432, /* 620 */ 8, 9, 328, 404, 12, 13, 14, 15, 16, 4, - /* 630 */ 166, 398, 20, 336, 58, 402, 70, 207, 405, 406, + /* 630 */ 166, 398, 20, 336, 58, 402, 106, 207, 405, 406, /* 640 */ 407, 408, 409, 410, 19, 412, 70, 350, 415, 430, /* 650 */ 417, 418, 419, 359, 357, 62, 423, 424, 33, 12, /* 660 */ 13, 367, 163, 336, 367, 389, 372, 20, 374, 22, - /* 670 */ 416, 95, 418, 48, 328, 191, 192, 350, 53, 328, - /* 680 */ 33, 163, 35, 58, 361, 95, 256, 257, 258, 259, - /* 690 */ 260, 266, 398, 117, 367, 372, 402, 345, 346, 405, + /* 670 */ 229, 95, 231, 48, 328, 191, 192, 350, 53, 328, + /* 680 */ 33, 359, 35, 58, 361, 95, 256, 257, 258, 259, + /* 690 */ 260, 0, 398, 117, 367, 372, 402, 375, 336, 405, /* 700 */ 406, 407, 408, 409, 410, 58, 412, 431, 132, 133, - /* 710 */ 0, 435, 393, 351, 250, 251, 252, 70, 372, 94, - /* 720 */ 0, 359, 97, 372, 401, 402, 450, 451, 14, 360, - /* 730 */ 368, 455, 456, 328, 20, 412, 369, 161, 162, 372, - /* 740 */ 446, 447, 95, 167, 168, 336, 8, 9, 160, 360, - /* 750 */ 12, 13, 14, 15, 16, 2, 359, 3, 182, 350, - /* 760 */ 184, 8, 9, 107, 117, 12, 13, 14, 15, 16, - /* 770 */ 360, 181, 62, 183, 328, 163, 367, 372, 381, 132, - /* 780 */ 133, 0, 328, 207, 208, 129, 210, 211, 212, 213, + /* 710 */ 367, 435, 350, 328, 250, 251, 252, 70, 372, 94, + /* 720 */ 0, 378, 97, 372, 401, 402, 450, 451, 328, 367, + /* 730 */ 14, 455, 456, 1, 2, 412, 20, 161, 162, 48, + /* 740 */ 446, 447, 95, 167, 168, 336, 8, 9, 160, 0, + /* 750 */ 12, 13, 14, 15, 16, 2, 359, 372, 182, 350, + /* 760 */ 184, 8, 9, 367, 117, 12, 13, 14, 15, 16, + /* 770 */ 47, 181, 372, 183, 378, 163, 367, 20, 381, 132, + /* 780 */ 133, 0, 328, 207, 208, 20, 210, 211, 212, 213, /* 790 */ 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, /* 800 */ 224, 225, 226, 227, 14, 15, 16, 336, 161, 162, - /* 810 */ 18, 42, 20, 44, 167, 168, 351, 340, 372, 27, - /* 820 */ 232, 350, 30, 360, 359, 33, 372, 107, 360, 182, - /* 830 */ 242, 184, 328, 368, 96, 245, 345, 346, 367, 362, - /* 840 */ 48, 361, 50, 360, 359, 53, 126, 127, 128, 129, - /* 850 */ 130, 131, 372, 368, 207, 208, 20, 210, 211, 212, + /* 810 */ 18, 62, 20, 229, 167, 168, 351, 340, 95, 27, + /* 820 */ 232, 350, 30, 44, 359, 33, 372, 107, 96, 182, + /* 830 */ 242, 184, 328, 368, 96, 245, 351, 20, 367, 362, + /* 840 */ 48, 361, 50, 4, 359, 53, 126, 127, 128, 129, + /* 850 */ 130, 131, 372, 368, 207, 208, 70, 210, 211, 212, /* 860 */ 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, - /* 870 */ 223, 224, 225, 226, 227, 161, 372, 347, 20, 349, - /* 880 */ 18, 401, 402, 2, 0, 23, 94, 0, 107, 8, - /* 890 */ 9, 367, 412, 12, 13, 14, 15, 16, 106, 37, - /* 900 */ 38, 359, 378, 41, 367, 367, 329, 126, 127, 128, - /* 910 */ 129, 130, 131, 1, 2, 378, 378, 375, 45, 46, - /* 920 */ 95, 59, 60, 61, 369, 382, 369, 372, 136, 372, - /* 930 */ 105, 139, 140, 141, 142, 143, 144, 145, 146, 147, + /* 870 */ 223, 224, 225, 226, 227, 328, 372, 161, 345, 346, + /* 880 */ 18, 401, 402, 2, 163, 23, 94, 0, 107, 8, + /* 890 */ 9, 170, 412, 12, 13, 14, 15, 16, 106, 37, + /* 900 */ 38, 3, 416, 41, 418, 345, 346, 126, 127, 128, + /* 910 */ 129, 130, 131, 367, 369, 352, 360, 372, 355, 372, + /* 920 */ 163, 59, 60, 61, 378, 347, 161, 349, 136, 45, + /* 930 */ 46, 139, 140, 141, 142, 143, 144, 145, 146, 147, /* 940 */ 148, 149, 150, 151, 152, 153, 154, 155, 389, 157, /* 950 */ 158, 159, 65, 66, 67, 68, 69, 95, 71, 72, /* 960 */ 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, /* 970 */ 83, 84, 85, 86, 87, 88, 89, 90, 91, 328, - /* 980 */ 459, 336, 107, 328, 352, 336, 389, 355, 389, 44, - /* 990 */ 431, 243, 244, 336, 435, 350, 134, 161, 348, 350, - /* 1000 */ 328, 126, 127, 128, 129, 130, 131, 350, 96, 450, - /* 1010 */ 451, 42, 367, 44, 455, 456, 367, 99, 264, 106, - /* 1020 */ 102, 163, 99, 372, 367, 102, 163, 372, 431, 336, - /* 1030 */ 431, 359, 435, 170, 435, 151, 174, 175, 176, 367, - /* 1040 */ 336, 179, 336, 350, 372, 35, 374, 450, 451, 450, - /* 1050 */ 451, 448, 455, 456, 455, 456, 350, 0, 389, 197, - /* 1060 */ 367, 336, 200, 58, 202, 203, 204, 205, 206, 156, - /* 1070 */ 398, 367, 328, 367, 402, 350, 35, 405, 406, 407, - /* 1080 */ 408, 409, 410, 336, 412, 99, 44, 99, 102, 417, - /* 1090 */ 102, 419, 367, 0, 338, 423, 424, 350, 336, 336, - /* 1100 */ 431, 0, 97, 359, 435, 48, 0, 245, 336, 63, + /* 980 */ 163, 336, 107, 328, 360, 336, 389, 0, 389, 107, + /* 990 */ 431, 243, 244, 336, 435, 350, 134, 132, 133, 350, + /* 1000 */ 328, 126, 127, 128, 129, 130, 131, 350, 360, 450, + /* 1010 */ 451, 129, 367, 106, 455, 456, 367, 42, 42, 44, + /* 1020 */ 44, 44, 99, 372, 367, 102, 360, 372, 431, 336, + /* 1030 */ 431, 359, 435, 35, 435, 0, 174, 175, 176, 367, + /* 1040 */ 336, 179, 336, 350, 372, 266, 374, 450, 451, 450, + /* 1050 */ 451, 329, 455, 456, 455, 456, 350, 22, 389, 197, + /* 1060 */ 367, 336, 200, 156, 202, 203, 204, 205, 206, 360, + /* 1070 */ 398, 367, 328, 367, 402, 350, 44, 405, 406, 407, + /* 1080 */ 408, 409, 410, 336, 412, 246, 35, 99, 44, 417, + /* 1090 */ 102, 419, 367, 0, 360, 423, 424, 350, 336, 336, + /* 1100 */ 431, 0, 99, 359, 435, 102, 99, 245, 336, 102, /* 1110 */ 37, 367, 350, 350, 367, 22, 372, 445, 374, 450, - /* 1120 */ 451, 47, 350, 22, 455, 456, 328, 336, 22, 367, - /* 1130 */ 367, 427, 428, 429, 44, 431, 432, 442, 96, 367, - /* 1140 */ 44, 350, 398, 132, 133, 359, 402, 44, 338, 405, - /* 1150 */ 406, 407, 408, 409, 410, 13, 412, 359, 367, 44, - /* 1160 */ 44, 417, 382, 419, 44, 367, 335, 423, 424, 95, - /* 1170 */ 372, 98, 374, 100, 101, 44, 103, 35, 434, 13, - /* 1180 */ 107, 0, 371, 336, 44, 44, 96, 328, 1, 2, - /* 1190 */ 382, 44, 96, 433, 184, 44, 398, 350, 452, 96, - /* 1200 */ 402, 35, 129, 405, 406, 407, 408, 409, 410, 425, - /* 1210 */ 412, 96, 96, 268, 367, 417, 96, 419, 359, 436, - /* 1220 */ 44, 423, 424, 44, 247, 184, 367, 96, 12, 13, - /* 1230 */ 49, 372, 434, 374, 400, 180, 96, 96, 22, 44, - /* 1240 */ 48, 399, 391, 96, 42, 379, 20, 96, 379, 33, - /* 1250 */ 328, 35, 382, 207, 160, 377, 20, 398, 379, 377, - /* 1260 */ 336, 402, 336, 377, 405, 406, 407, 408, 409, 410, - /* 1270 */ 328, 412, 96, 93, 58, 96, 417, 344, 419, 336, - /* 1280 */ 336, 359, 423, 424, 336, 20, 70, 330, 330, 367, - /* 1290 */ 20, 96, 395, 434, 372, 342, 374, 342, 20, 374, - /* 1300 */ 20, 359, 337, 20, 390, 342, 342, 337, 342, 367, - /* 1310 */ 342, 336, 52, 342, 372, 339, 374, 339, 359, 330, - /* 1320 */ 398, 359, 330, 336, 402, 196, 359, 405, 406, 407, - /* 1330 */ 408, 409, 410, 117, 412, 397, 395, 340, 359, 417, - /* 1340 */ 398, 419, 359, 359, 402, 423, 424, 405, 406, 407, - /* 1350 */ 408, 409, 410, 359, 412, 359, 434, 359, 359, 417, - /* 1360 */ 359, 419, 372, 372, 187, 423, 424, 394, 340, 374, - /* 1370 */ 19, 336, 255, 328, 372, 382, 434, 441, 254, 372, - /* 1380 */ 441, 372, 382, 261, 33, 372, 173, 440, 385, 385, - /* 1390 */ 444, 441, 443, 263, 262, 439, 248, 270, 182, 48, - /* 1400 */ 184, 267, 265, 244, 359, 54, 55, 56, 57, 58, - /* 1410 */ 438, 460, 367, 453, 400, 454, 367, 372, 20, 374, - /* 1420 */ 404, 336, 340, 207, 208, 337, 372, 165, 385, 385, - /* 1430 */ 372, 372, 328, 372, 372, 372, 220, 221, 222, 223, - /* 1440 */ 224, 225, 226, 398, 355, 94, 367, 402, 97, 383, - /* 1450 */ 405, 406, 407, 408, 409, 410, 95, 412, 340, 340, - /* 1460 */ 422, 95, 417, 359, 419, 363, 340, 372, 423, 424, - /* 1470 */ 349, 367, 336, 36, 331, 330, 372, 396, 374, 392, - /* 1480 */ 326, 130, 0, 386, 386, 341, 328, 0, 353, 189, - /* 1490 */ 0, 353, 353, 0, 42, 0, 35, 201, 35, 35, - /* 1500 */ 35, 0, 398, 201, 35, 35, 402, 201, 0, 405, - /* 1510 */ 406, 407, 408, 409, 410, 201, 412, 359, 0, 35, - /* 1520 */ 169, 417, 0, 419, 22, 367, 35, 423, 424, 0, - /* 1530 */ 372, 184, 374, 0, 182, 0, 178, 186, 0, 188, - /* 1540 */ 177, 0, 0, 47, 0, 0, 42, 328, 0, 0, - /* 1550 */ 0, 0, 0, 0, 0, 0, 398, 151, 35, 0, - /* 1560 */ 402, 151, 0, 405, 406, 407, 408, 409, 410, 0, + /* 1120 */ 451, 58, 350, 22, 455, 456, 328, 336, 96, 367, + /* 1130 */ 367, 427, 428, 429, 44, 431, 432, 348, 151, 367, + /* 1140 */ 96, 350, 398, 1, 2, 95, 402, 44, 382, 405, + /* 1150 */ 406, 407, 408, 409, 410, 105, 412, 359, 367, 44, + /* 1160 */ 97, 417, 264, 419, 44, 367, 459, 423, 424, 338, + /* 1170 */ 372, 98, 374, 100, 101, 44, 103, 448, 434, 442, + /* 1180 */ 107, 336, 184, 336, 44, 44, 96, 328, 44, 44, + /* 1190 */ 0, 44, 44, 359, 44, 350, 398, 350, 338, 96, + /* 1200 */ 402, 44, 129, 405, 406, 407, 408, 409, 410, 382, + /* 1210 */ 412, 96, 367, 335, 367, 417, 96, 419, 359, 35, + /* 1220 */ 44, 423, 424, 371, 382, 13, 367, 96, 12, 13, + /* 1230 */ 13, 372, 434, 374, 433, 184, 96, 96, 22, 49, + /* 1240 */ 96, 96, 436, 96, 96, 268, 96, 35, 452, 33, + /* 1250 */ 328, 35, 35, 96, 70, 425, 247, 398, 400, 48, + /* 1260 */ 399, 402, 180, 391, 405, 406, 407, 408, 409, 410, + /* 1270 */ 328, 412, 96, 42, 58, 379, 417, 20, 419, 382, + /* 1280 */ 379, 359, 423, 424, 160, 377, 70, 20, 336, 367, + /* 1290 */ 336, 379, 377, 434, 372, 377, 374, 93, 336, 344, + /* 1300 */ 336, 359, 336, 20, 330, 20, 395, 342, 330, 367, + /* 1310 */ 20, 374, 342, 20, 372, 20, 374, 337, 390, 337, + /* 1320 */ 398, 342, 336, 342, 402, 342, 342, 405, 406, 407, + /* 1330 */ 408, 409, 410, 117, 412, 342, 52, 397, 339, 417, + /* 1340 */ 398, 419, 330, 339, 402, 423, 424, 405, 406, 407, + /* 1350 */ 408, 409, 410, 359, 412, 359, 434, 336, 330, 417, + /* 1360 */ 359, 419, 372, 372, 359, 423, 424, 359, 196, 359, + /* 1370 */ 19, 340, 359, 328, 359, 359, 434, 359, 359, 187, + /* 1380 */ 395, 340, 336, 394, 33, 374, 441, 255, 382, 372, + /* 1390 */ 254, 441, 372, 444, 372, 372, 382, 173, 182, 48, + /* 1400 */ 184, 443, 441, 440, 359, 54, 55, 56, 57, 58, + /* 1410 */ 385, 385, 367, 261, 263, 262, 248, 372, 244, 374, + /* 1420 */ 460, 267, 454, 207, 208, 270, 265, 400, 367, 20, + /* 1430 */ 336, 439, 328, 438, 404, 337, 220, 221, 222, 223, + /* 1440 */ 224, 225, 226, 398, 385, 94, 340, 402, 97, 340, + /* 1450 */ 405, 406, 407, 408, 409, 410, 372, 412, 372, 372, + /* 1460 */ 372, 372, 417, 359, 419, 385, 165, 372, 423, 424, + /* 1470 */ 340, 367, 355, 340, 383, 367, 372, 453, 374, 95, + /* 1480 */ 422, 130, 95, 372, 363, 336, 328, 349, 36, 392, + /* 1490 */ 331, 386, 330, 386, 0, 396, 340, 326, 0, 353, + /* 1500 */ 189, 341, 398, 0, 0, 42, 402, 0, 35, 405, + /* 1510 */ 406, 407, 408, 409, 410, 164, 412, 359, 353, 353, + /* 1520 */ 169, 417, 201, 419, 35, 367, 35, 423, 424, 201, + /* 1530 */ 372, 35, 374, 0, 35, 35, 201, 186, 0, 188, + /* 1540 */ 201, 0, 0, 35, 22, 0, 35, 328, 184, 182, + /* 1550 */ 0, 0, 178, 177, 0, 0, 398, 47, 0, 0, + /* 1560 */ 402, 0, 42, 405, 406, 407, 408, 409, 410, 0, /* 1570 */ 412, 0, 0, 0, 0, 417, 0, 419, 359, 0, - /* 1580 */ 0, 423, 424, 0, 0, 0, 367, 0, 0, 0, - /* 1590 */ 0, 372, 0, 374, 135, 0, 0, 22, 42, 0, - /* 1600 */ 0, 0, 0, 0, 0, 328, 0, 0, 0, 0, - /* 1610 */ 42, 44, 35, 47, 0, 58, 58, 398, 0, 14, - /* 1620 */ 39, 402, 40, 0, 405, 406, 407, 408, 409, 410, - /* 1630 */ 14, 412, 0, 47, 0, 173, 359, 39, 419, 0, - /* 1640 */ 47, 0, 423, 424, 367, 0, 0, 35, 0, 372, - /* 1650 */ 39, 374, 39, 0, 35, 64, 39, 35, 48, 328, - /* 1660 */ 39, 0, 35, 48, 39, 0, 0, 0, 48, 0, - /* 1670 */ 35, 22, 48, 0, 104, 398, 22, 35, 35, 402, - /* 1680 */ 44, 44, 405, 406, 407, 408, 409, 410, 328, 412, - /* 1690 */ 359, 35, 35, 35, 35, 35, 419, 0, 367, 102, - /* 1700 */ 423, 424, 22, 372, 0, 374, 22, 0, 22, 35, - /* 1710 */ 0, 35, 50, 0, 35, 0, 22, 35, 20, 359, - /* 1720 */ 35, 194, 96, 95, 0, 35, 163, 367, 0, 398, - /* 1730 */ 22, 185, 372, 402, 374, 0, 405, 406, 407, 408, - /* 1740 */ 409, 410, 0, 412, 3, 95, 328, 44, 249, 228, - /* 1750 */ 419, 96, 47, 253, 423, 424, 44, 3, 398, 95, - /* 1760 */ 44, 47, 402, 44, 96, 405, 406, 407, 408, 409, - /* 1770 */ 410, 411, 412, 413, 414, 44, 95, 359, 35, 249, - /* 1780 */ 249, 35, 35, 96, 95, 367, 95, 35, 96, 96, - /* 1790 */ 372, 95, 374, 163, 165, 96, 163, 35, 35, 0, - /* 1800 */ 328, 44, 171, 47, 243, 96, 47, 96, 170, 0, - /* 1810 */ 170, 0, 95, 166, 96, 95, 398, 96, 95, 0, - /* 1820 */ 402, 95, 39, 405, 406, 407, 408, 409, 410, 95, - /* 1830 */ 412, 359, 105, 47, 164, 44, 2, 22, 22, 367, - /* 1840 */ 95, 47, 47, 95, 372, 96, 374, 96, 95, 35, - /* 1850 */ 106, 119, 35, 95, 328, 35, 96, 96, 207, 95, - /* 1860 */ 95, 209, 96, 95, 35, 96, 95, 35, 35, 96, - /* 1870 */ 398, 95, 228, 96, 402, 457, 458, 405, 406, 407, - /* 1880 */ 408, 409, 410, 95, 412, 359, 96, 95, 22, 119, - /* 1890 */ 44, 419, 107, 367, 119, 95, 424, 119, 372, 95, - /* 1900 */ 374, 230, 35, 228, 22, 95, 328, 64, 63, 35, - /* 1910 */ 35, 35, 35, 35, 35, 35, 35, 70, 35, 35, - /* 1920 */ 92, 35, 328, 35, 398, 35, 22, 70, 402, 44, - /* 1930 */ 35, 405, 406, 407, 408, 409, 410, 359, 412, 22, - /* 1940 */ 35, 35, 35, 35, 35, 367, 35, 35, 35, 0, - /* 1950 */ 372, 35, 374, 359, 39, 0, 35, 39, 48, 0, - /* 1960 */ 35, 367, 48, 39, 0, 35, 372, 48, 374, 0, - /* 1970 */ 48, 39, 35, 447, 35, 0, 398, 20, 22, 21, - /* 1980 */ 402, 461, 22, 405, 406, 407, 408, 409, 410, 21, - /* 1990 */ 412, 461, 398, 22, 461, 461, 402, 461, 461, 405, - /* 2000 */ 406, 407, 408, 409, 410, 461, 412, 461, 461, 461, - /* 2010 */ 461, 328, 461, 461, 461, 461, 461, 461, 461, 461, + /* 1580 */ 0, 423, 424, 151, 35, 0, 367, 151, 0, 0, + /* 1590 */ 0, 372, 0, 374, 42, 0, 0, 0, 0, 0, + /* 1600 */ 0, 0, 0, 22, 135, 328, 0, 0, 0, 0, + /* 1610 */ 0, 0, 0, 0, 0, 0, 0, 398, 0, 0, + /* 1620 */ 0, 402, 35, 58, 405, 406, 407, 408, 409, 410, + /* 1630 */ 0, 412, 0, 58, 0, 42, 359, 14, 419, 14, + /* 1640 */ 0, 0, 423, 424, 367, 0, 0, 44, 173, 372, + /* 1650 */ 0, 374, 47, 0, 0, 64, 39, 0, 0, 328, + /* 1660 */ 0, 0, 0, 35, 40, 39, 39, 0, 47, 47, + /* 1670 */ 39, 35, 35, 35, 39, 398, 0, 48, 39, 402, + /* 1680 */ 0, 48, 405, 406, 407, 408, 409, 410, 328, 412, + /* 1690 */ 359, 48, 48, 0, 39, 22, 419, 0, 367, 35, + /* 1700 */ 423, 424, 0, 372, 35, 374, 35, 35, 104, 35, + /* 1710 */ 44, 22, 44, 35, 35, 0, 35, 22, 22, 359, + /* 1720 */ 50, 0, 22, 35, 0, 35, 0, 367, 0, 398, + /* 1730 */ 22, 20, 372, 402, 374, 0, 405, 406, 407, 408, + /* 1740 */ 409, 410, 35, 412, 102, 35, 328, 35, 96, 163, + /* 1750 */ 419, 194, 35, 0, 423, 424, 22, 0, 398, 0, + /* 1760 */ 95, 3, 402, 44, 249, 405, 406, 407, 408, 409, + /* 1770 */ 410, 411, 412, 413, 414, 228, 253, 359, 96, 95, + /* 1780 */ 95, 44, 96, 96, 44, 367, 95, 95, 47, 95, + /* 1790 */ 372, 47, 374, 44, 96, 249, 3, 249, 95, 35, + /* 1800 */ 328, 96, 96, 35, 44, 35, 35, 243, 35, 35, + /* 1810 */ 96, 163, 96, 47, 165, 0, 398, 0, 0, 163, + /* 1820 */ 402, 44, 171, 405, 406, 407, 408, 409, 410, 170, + /* 1830 */ 412, 359, 185, 170, 47, 0, 39, 95, 95, 367, + /* 1840 */ 39, 96, 96, 95, 372, 95, 374, 95, 0, 95, + /* 1850 */ 47, 44, 105, 2, 328, 22, 95, 47, 96, 96, + /* 1860 */ 95, 47, 95, 22, 95, 166, 35, 35, 164, 35, + /* 1870 */ 398, 96, 96, 95, 402, 457, 458, 405, 406, 407, + /* 1880 */ 408, 409, 410, 95, 412, 359, 106, 96, 96, 95, + /* 1890 */ 95, 419, 96, 367, 35, 95, 424, 35, 372, 95, + /* 1900 */ 374, 96, 96, 228, 35, 119, 328, 230, 95, 119, + /* 1910 */ 22, 95, 44, 35, 95, 107, 207, 119, 119, 22, + /* 1920 */ 95, 64, 328, 63, 398, 35, 35, 209, 402, 35, + /* 1930 */ 35, 405, 406, 407, 408, 409, 410, 359, 412, 35, + /* 1940 */ 35, 228, 35, 35, 35, 367, 35, 70, 92, 35, + /* 1950 */ 372, 35, 374, 359, 44, 35, 22, 35, 35, 35, + /* 1960 */ 35, 367, 35, 70, 35, 35, 372, 35, 374, 22, + /* 1970 */ 35, 0, 35, 447, 48, 39, 398, 0, 35, 48, + /* 1980 */ 402, 39, 0, 405, 406, 407, 408, 409, 410, 35, + /* 1990 */ 412, 39, 398, 48, 0, 35, 402, 48, 39, 405, + /* 2000 */ 406, 407, 408, 409, 410, 0, 412, 35, 35, 0, + /* 2010 */ 22, 328, 21, 461, 22, 22, 21, 20, 461, 461, /* 2020 */ 461, 461, 461, 461, 461, 461, 461, 449, 461, 328, /* 2030 */ 461, 461, 461, 461, 461, 461, 461, 461, 461, 461, /* 2040 */ 461, 461, 359, 461, 461, 461, 461, 364, 461, 461, @@ -834,44 +833,11 @@ static const YYCODETYPE yy_lookahead[] = { /* 3030 */ 374, 461, 461, 461, 461, 461, 461, 461, 461, 461, /* 3040 */ 461, 461, 461, 461, 461, 461, 461, 461, 461, 461, /* 3050 */ 461, 461, 461, 461, 398, 461, 461, 461, 402, 461, - /* 3060 */ 461, 405, 406, 407, 408, 409, 410, 461, 412, 325, - /* 3070 */ 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, - /* 3080 */ 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, - /* 3090 */ 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, - /* 3100 */ 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, - /* 3110 */ 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, - /* 3120 */ 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, - /* 3130 */ 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, - /* 3140 */ 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, - /* 3150 */ 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, - /* 3160 */ 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, - /* 3170 */ 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, - /* 3180 */ 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, - /* 3190 */ 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, - /* 3200 */ 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, - /* 3210 */ 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, - /* 3220 */ 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, - /* 3230 */ 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, - /* 3240 */ 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, - /* 3250 */ 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, - /* 3260 */ 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, - /* 3270 */ 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, - /* 3280 */ 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, - /* 3290 */ 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, - /* 3300 */ 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, - /* 3310 */ 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, - /* 3320 */ 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, - /* 3330 */ 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, - /* 3340 */ 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, - /* 3350 */ 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, - /* 3360 */ 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, - /* 3370 */ 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, - /* 3380 */ 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, - /* 3390 */ 325, 325, 325, 325, + /* 3060 */ 461, 405, 406, 407, 408, 409, 410, 461, 412, }; -#define YY_SHIFT_COUNT (713) +#define YY_SHIFT_COUNT (721) #define YY_SHIFT_MIN (0) -#define YY_SHIFT_MAX (1975) +#define YY_SHIFT_MAX (2009) static const unsigned short int yy_shift_ofst[] = { /* 0 */ 862, 0, 71, 0, 289, 289, 289, 289, 289, 289, /* 10 */ 289, 289, 289, 289, 289, 360, 576, 576, 647, 576, @@ -879,74 +845,75 @@ static const unsigned short int yy_shift_ofst[] = { /* 30 */ 576, 576, 576, 576, 576, 576, 576, 576, 576, 576, /* 40 */ 576, 576, 576, 576, 576, 576, 576, 576, 32, 134, /* 50 */ 21, 590, 133, 7, 104, 7, 21, 21, 1216, 1216, - /* 60 */ 7, 1216, 1216, 136, 7, 423, 25, 25, 423, 401, - /* 70 */ 401, 215, 57, 5, 5, 25, 25, 25, 25, 25, - /* 80 */ 25, 25, 25, 25, 25, 80, 25, 25, 156, 25, - /* 90 */ 25, 25, 343, 25, 25, 343, 25, 343, 343, 343, - /* 100 */ 25, 328, 792, 34, 34, 216, 474, 283, 283, 283, + /* 60 */ 7, 1216, 1216, 136, 7, 423, 156, 156, 423, 401, + /* 70 */ 401, 215, 57, 5, 5, 156, 156, 156, 156, 156, + /* 80 */ 156, 156, 156, 156, 156, 80, 156, 156, 229, 156, + /* 90 */ 518, 156, 156, 156, 156, 518, 156, 156, 518, 156, + /* 100 */ 518, 518, 518, 156, 301, 792, 34, 34, 216, 474, /* 110 */ 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, - /* 120 */ 283, 283, 283, 283, 283, 283, 1073, 87, 215, 57, - /* 130 */ 593, 313, 499, 499, 499, 710, 229, 229, 313, 374, - /* 140 */ 374, 374, 143, 384, 343, 378, 343, 378, 378, 143, - /* 150 */ 566, 217, 217, 217, 217, 217, 217, 217, 1351, 408, - /* 160 */ 336, 612, 249, 430, 340, 464, 292, 714, 377, 518, - /* 170 */ 873, 656, 858, 748, 12, 754, 748, 769, 353, 836, - /* 180 */ 977, 1192, 1055, 1202, 1226, 1202, 1094, 1236, 1236, 1202, - /* 190 */ 1094, 1094, 1180, 1236, 1236, 1236, 1265, 1265, 1270, 80, - /* 200 */ 1278, 80, 1280, 1283, 80, 1280, 80, 80, 80, 1236, - /* 210 */ 80, 1260, 1260, 1265, 343, 343, 343, 343, 343, 343, - /* 220 */ 343, 343, 343, 343, 343, 1236, 1265, 378, 378, 1129, - /* 230 */ 1270, 328, 1177, 1278, 328, 1236, 1226, 1226, 378, 1117, - /* 240 */ 1124, 378, 1117, 1124, 378, 378, 343, 1122, 1213, 1117, - /* 250 */ 1130, 1132, 1148, 977, 1127, 1134, 1137, 1159, 374, 1398, - /* 260 */ 1236, 1280, 328, 1124, 378, 378, 378, 378, 378, 1124, - /* 270 */ 378, 1262, 328, 143, 328, 374, 1361, 1366, 378, 566, - /* 280 */ 1236, 328, 1437, 1265, 3069, 3069, 3069, 3069, 3069, 3069, - /* 290 */ 3069, 3069, 3069, 887, 310, 94, 625, 15, 59, 738, - /* 300 */ 720, 753, 881, 73, 781, 472, 472, 472, 472, 472, - /* 310 */ 472, 472, 472, 472, 875, 124, 373, 373, 122, 4, - /* 320 */ 58, 166, 484, 300, 300, 790, 912, 588, 790, 790, - /* 330 */ 790, 113, 1057, 288, 969, 913, 884, 918, 923, 986, - /* 340 */ 988, 1093, 1101, 1106, 1005, 1042, 1090, 1011, 425, 945, - /* 350 */ 863, 1096, 1103, 1115, 1116, 1120, 1187, 1131, 1010, 1041, - /* 360 */ 1046, 1140, 1074, 1141, 1147, 1151, 1176, 1179, 1195, 825, - /* 370 */ 1142, 1166, 489, 1181, 1482, 1487, 1300, 1490, 1493, 1452, - /* 380 */ 1495, 1461, 1296, 1463, 1464, 1465, 1302, 1501, 1469, 1470, - /* 390 */ 1306, 1508, 1314, 1518, 1484, 1522, 1502, 1529, 1491, 1347, - /* 400 */ 1352, 1533, 1535, 1358, 1363, 1538, 1541, 1496, 1542, 1544, - /* 410 */ 1545, 1504, 1548, 1549, 1550, 1551, 1552, 1553, 1554, 1555, - /* 420 */ 1406, 1523, 1559, 1410, 1562, 1569, 1571, 1572, 1573, 1574, - /* 430 */ 1576, 1579, 1580, 1583, 1584, 1585, 1587, 1588, 1589, 1556, - /* 440 */ 1590, 1592, 1599, 1600, 1601, 1575, 1602, 1603, 1604, 1459, - /* 450 */ 1595, 1596, 1577, 1606, 1557, 1607, 1558, 1608, 1609, 1568, - /* 460 */ 1581, 1567, 1566, 1605, 1586, 1616, 1593, 1614, 1582, 1598, - /* 470 */ 1618, 1623, 1632, 1611, 1462, 1634, 1639, 1641, 1591, 1645, - /* 480 */ 1646, 1612, 1610, 1613, 1648, 1619, 1615, 1617, 1653, 1622, - /* 490 */ 1620, 1621, 1661, 1627, 1624, 1625, 1665, 1666, 1667, 1669, - /* 500 */ 1570, 1597, 1635, 1649, 1673, 1642, 1643, 1656, 1657, 1636, - /* 510 */ 1637, 1658, 1659, 1654, 1660, 1697, 1680, 1704, 1684, 1662, - /* 520 */ 1707, 1686, 1674, 1710, 1676, 1713, 1679, 1715, 1694, 1698, - /* 530 */ 1682, 1685, 1527, 1626, 1628, 1724, 1563, 1690, 1728, 1546, - /* 540 */ 1708, 1630, 1629, 1735, 1742, 1633, 1631, 1741, 1703, 1499, - /* 550 */ 1650, 1655, 1664, 1638, 1521, 1640, 1500, 1668, 1712, 1687, - /* 560 */ 1681, 1689, 1691, 1692, 1716, 1705, 1714, 1696, 1719, 1530, - /* 570 */ 1693, 1699, 1754, 1731, 1531, 1743, 1746, 1747, 1752, 1762, - /* 580 */ 1763, 1709, 1711, 1756, 1561, 1757, 1759, 1799, 1809, 1811, - /* 590 */ 1717, 1718, 1721, 1720, 1723, 1647, 1726, 1819, 1783, 1670, - /* 600 */ 1734, 1727, 1566, 1786, 1791, 1644, 1671, 1675, 1834, 1815, - /* 610 */ 1651, 1745, 1749, 1748, 1751, 1753, 1760, 1794, 1758, 1764, - /* 620 */ 1795, 1761, 1816, 1652, 1765, 1744, 1766, 1814, 1817, 1768, - /* 630 */ 1769, 1820, 1771, 1773, 1829, 1776, 1777, 1832, 1788, 1790, - /* 640 */ 1833, 1792, 1732, 1770, 1775, 1778, 1866, 1785, 1800, 1846, - /* 650 */ 1804, 1867, 1810, 1846, 1846, 1882, 1843, 1845, 1874, 1875, - /* 660 */ 1876, 1877, 1878, 1879, 1880, 1881, 1883, 1884, 1847, 1828, - /* 670 */ 1885, 1886, 1888, 1890, 1904, 1895, 1905, 1906, 1857, 1636, - /* 680 */ 1907, 1637, 1908, 1909, 1911, 1912, 1917, 1913, 1949, 1916, - /* 690 */ 1910, 1915, 1955, 1921, 1914, 1918, 1959, 1925, 1919, 1924, - /* 700 */ 1964, 1930, 1922, 1932, 1969, 1937, 1939, 1975, 1956, 1958, - /* 710 */ 1960, 1971, 1968, 1957, + /* 120 */ 283, 283, 283, 283, 283, 283, 283, 283, 283, 1073, + /* 130 */ 87, 215, 57, 593, 489, 499, 499, 499, 749, 441, + /* 140 */ 441, 489, 579, 579, 579, 530, 584, 518, 358, 518, + /* 150 */ 358, 358, 530, 786, 217, 217, 217, 217, 217, 217, + /* 160 */ 217, 1351, 408, 336, 612, 249, 430, 340, 464, 292, + /* 170 */ 716, 438, 757, 884, 882, 817, 748, 12, 898, 748, + /* 180 */ 975, 839, 765, 1009, 1211, 1082, 1231, 1257, 1231, 1124, + /* 190 */ 1267, 1267, 1231, 1124, 1124, 1204, 1267, 1267, 1267, 1283, + /* 200 */ 1283, 1285, 80, 1290, 80, 1293, 1295, 80, 1293, 80, + /* 210 */ 80, 80, 1267, 80, 1284, 1284, 1283, 518, 518, 518, + /* 220 */ 518, 518, 518, 518, 518, 518, 518, 518, 1267, 1283, + /* 230 */ 358, 358, 1172, 1285, 301, 1192, 1290, 301, 1267, 1257, + /* 240 */ 1257, 358, 1132, 1136, 358, 1132, 1136, 358, 358, 518, + /* 250 */ 1152, 1224, 1132, 1151, 1153, 1168, 1009, 1155, 1154, 1161, + /* 260 */ 1174, 579, 1409, 1267, 1293, 301, 301, 1136, 358, 358, + /* 270 */ 358, 358, 358, 1136, 358, 1301, 301, 530, 301, 579, + /* 280 */ 1384, 1387, 358, 786, 1267, 301, 1452, 1283, 3069, 3069, + /* 290 */ 3069, 3069, 3069, 3069, 3069, 3069, 3069, 887, 310, 94, + /* 300 */ 625, 15, 59, 738, 720, 753, 881, 73, 781, 472, + /* 310 */ 472, 472, 472, 472, 472, 472, 472, 472, 875, 124, + /* 320 */ 373, 373, 122, 4, 58, 166, 484, 300, 300, 790, + /* 330 */ 732, 588, 790, 790, 790, 113, 691, 288, 976, 907, + /* 340 */ 987, 923, 988, 1003, 1007, 1035, 1093, 1101, 1063, 1032, + /* 350 */ 1044, 865, 779, 977, 721, 1090, 1103, 1115, 1120, 1131, + /* 360 */ 1140, 1142, 1141, 998, 1051, 406, 1144, 723, 1145, 1147, + /* 370 */ 1148, 1150, 1157, 1176, 1050, 1212, 1217, 1184, 1190, 1494, + /* 380 */ 1498, 1311, 1503, 1504, 1463, 1507, 1473, 1321, 1489, 1491, + /* 390 */ 1496, 1328, 1533, 1499, 1500, 1335, 1538, 1339, 1541, 1508, + /* 400 */ 1542, 1522, 1545, 1511, 1364, 1367, 1550, 1551, 1374, 1376, + /* 410 */ 1554, 1555, 1510, 1558, 1559, 1561, 1520, 1569, 1571, 1572, + /* 420 */ 1573, 1574, 1576, 1579, 1580, 1432, 1549, 1585, 1436, 1588, + /* 430 */ 1589, 1590, 1592, 1606, 1607, 1608, 1609, 1610, 1611, 1612, + /* 440 */ 1613, 1614, 1615, 1616, 1552, 1595, 1596, 1597, 1598, 1599, + /* 450 */ 1581, 1600, 1601, 1602, 1469, 1618, 1619, 1587, 1620, 1565, + /* 460 */ 1630, 1575, 1632, 1634, 1593, 1617, 1603, 1605, 1623, 1621, + /* 470 */ 1625, 1622, 1640, 1624, 1626, 1641, 1645, 1646, 1627, 1475, + /* 480 */ 1650, 1653, 1654, 1591, 1657, 1658, 1628, 1629, 1631, 1660, + /* 490 */ 1636, 1633, 1635, 1661, 1637, 1643, 1639, 1662, 1638, 1644, + /* 500 */ 1655, 1667, 1676, 1680, 1693, 1604, 1642, 1664, 1673, 1697, + /* 510 */ 1669, 1671, 1672, 1674, 1666, 1668, 1678, 1679, 1689, 1681, + /* 520 */ 1702, 1695, 1715, 1696, 1670, 1721, 1700, 1688, 1724, 1690, + /* 530 */ 1726, 1707, 1728, 1708, 1711, 1710, 1712, 1557, 1652, 1665, + /* 540 */ 1735, 1586, 1717, 1753, 1647, 1734, 1648, 1649, 1757, 1759, + /* 550 */ 1656, 1651, 1758, 1719, 1515, 1684, 1682, 1685, 1659, 1547, + /* 560 */ 1663, 1523, 1686, 1737, 1687, 1691, 1692, 1694, 1698, 1740, + /* 570 */ 1741, 1744, 1703, 1749, 1546, 1705, 1706, 1793, 1760, 1548, + /* 580 */ 1764, 1768, 1770, 1771, 1773, 1774, 1714, 1716, 1766, 1564, + /* 590 */ 1777, 1787, 1815, 1817, 1818, 1835, 1742, 1797, 1743, 1745, + /* 600 */ 1746, 1748, 1750, 1699, 1752, 1848, 1801, 1704, 1754, 1747, + /* 610 */ 1605, 1803, 1807, 1675, 1677, 1713, 1851, 1833, 1709, 1761, + /* 620 */ 1762, 1765, 1763, 1767, 1775, 1810, 1769, 1778, 1814, 1776, + /* 630 */ 1841, 1718, 1788, 1780, 1791, 1831, 1832, 1794, 1792, 1834, + /* 640 */ 1795, 1796, 1859, 1800, 1805, 1862, 1804, 1806, 1869, 1813, + /* 650 */ 1786, 1790, 1798, 1799, 1888, 1808, 1816, 1868, 1819, 1878, + /* 660 */ 1825, 1868, 1868, 1897, 1857, 1860, 1890, 1891, 1894, 1895, + /* 670 */ 1904, 1905, 1907, 1908, 1909, 1911, 1877, 1856, 1910, 1914, + /* 680 */ 1916, 1920, 1934, 1922, 1923, 1924, 1893, 1666, 1925, 1668, + /* 690 */ 1927, 1929, 1930, 1932, 1947, 1935, 1971, 1937, 1926, 1936, + /* 700 */ 1977, 1943, 1931, 1942, 1982, 1954, 1945, 1952, 1994, 1960, + /* 710 */ 1949, 1959, 2005, 1972, 1973, 2009, 1988, 1991, 1992, 1993, + /* 720 */ 1995, 1997, }; -#define YY_REDUCE_COUNT (292) +#define YY_REDUCE_COUNT (296) #define YY_REDUCE_MIN (-420) #define YY_REDUCE_MAX (2656) static const short yy_reduce_ofst[] = { @@ -959,101 +926,102 @@ static const short yy_reduce_ofst[] = { /* 60 */ -391, 323, 480, -276, -250, 75, -222, 297, -371, -330, /* 70 */ -326, -327, -363, -299, -257, 116, 128, 193, 199, 327, /* 80 */ 409, 471, 645, 649, 657, 252, 693, 706, -51, 725, - /* 90 */ 747, 762, 244, 763, 772, -203, 791, 465, -5, 362, - /* 100 */ 847, -210, -315, -420, -420, -217, -212, -69, -21, 41, - /* 110 */ 43, 70, 96, 117, 148, 197, 225, 234, 346, 351, - /* 120 */ 405, 446, 454, 504, 651, 655, -266, -170, 397, 191, - /* 130 */ 152, 352, -170, -150, 219, 477, 186, 254, 491, 524, - /* 140 */ 537, 538, -316, -319, 485, 367, 542, 555, 557, 632, - /* 150 */ 530, -342, 369, 389, 410, 463, 468, 483, 319, 577, - /* 160 */ 650, 543, 521, 603, 756, 695, 786, 786, 810, 780, - /* 170 */ 831, 811, 808, 760, 760, 746, 760, 784, 783, 786, - /* 180 */ 834, 842, 851, 866, 870, 869, 878, 924, 926, 879, - /* 190 */ 882, 886, 933, 943, 944, 948, 957, 958, 897, 953, - /* 200 */ 925, 955, 965, 914, 963, 970, 964, 966, 968, 975, - /* 210 */ 971, 976, 978, 989, 959, 962, 967, 979, 983, 984, - /* 220 */ 994, 996, 998, 999, 1001, 987, 992, 990, 991, 938, - /* 230 */ 941, 997, 973, 995, 1028, 1035, 993, 1000, 1002, 936, - /* 240 */ 1003, 1007, 939, 1004, 1009, 1013, 786, 946, 949, 950, - /* 250 */ 947, 956, 972, 1014, 951, 961, 960, 760, 1049, 1016, - /* 260 */ 1085, 1088, 1082, 1043, 1054, 1058, 1059, 1061, 1062, 1044, - /* 270 */ 1063, 1066, 1118, 1089, 1119, 1079, 1038, 1102, 1095, 1121, - /* 280 */ 1136, 1126, 1143, 1145, 1087, 1081, 1097, 1098, 1135, 1138, - /* 290 */ 1139, 1144, 1154, + /* 90 */ -203, 747, 762, 763, 772, 244, 791, 847, -5, 362, + /* 100 */ 465, 24, 485, 845, -210, -315, -420, -420, -217, -212, + /* 110 */ -69, -21, 41, 43, 70, 96, 148, 197, 225, 234, + /* 120 */ 346, 351, 385, 400, 454, 504, 547, 651, 655, -266, + /* 130 */ -170, 397, 191, 152, 533, -170, -150, 219, 477, 186, + /* 140 */ 486, 560, 343, 396, 546, -316, -319, -11, 25, 322, + /* 150 */ 76, 545, 563, 578, -342, 556, 624, 648, 666, 709, + /* 160 */ 734, -348, 722, 789, 766, 707, 729, 831, 737, 834, + /* 170 */ 834, 860, 827, 878, 852, 842, 801, 801, 796, 801, + /* 180 */ 830, 806, 834, 858, 861, 872, 896, 897, 901, 908, + /* 190 */ 952, 954, 912, 915, 918, 955, 962, 964, 966, 974, + /* 200 */ 978, 911, 965, 937, 970, 980, 928, 979, 982, 981, + /* 210 */ 983, 984, 986, 993, 999, 1004, 1012, 994, 996, 1001, + /* 220 */ 1005, 1008, 1010, 1013, 1015, 1016, 1018, 1019, 1021, 1028, + /* 230 */ 990, 991, 940, 985, 1031, 989, 1011, 1041, 1046, 1006, + /* 240 */ 1014, 1017, 945, 1025, 1020, 950, 1026, 1022, 1023, 834, + /* 250 */ 949, 958, 961, 963, 992, 995, 1027, 960, 968, 1024, + /* 260 */ 801, 1061, 1030, 1094, 1098, 1106, 1109, 1059, 1084, 1086, + /* 270 */ 1087, 1088, 1089, 1080, 1095, 1091, 1130, 1117, 1133, 1108, + /* 280 */ 1058, 1121, 1111, 1138, 1149, 1156, 1159, 1162, 1097, 1099, + /* 290 */ 1105, 1107, 1146, 1165, 1166, 1160, 1171, }; static const YYACTIONTYPE yy_default[] = { - /* 0 */ 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, - /* 10 */ 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, - /* 20 */ 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, - /* 30 */ 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, - /* 40 */ 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, - /* 50 */ 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, - /* 60 */ 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, - /* 70 */ 1606, 1861, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, - /* 80 */ 1606, 1606, 1606, 1606, 1606, 1684, 1606, 1606, 1606, 1606, - /* 90 */ 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, - /* 100 */ 1606, 1682, 1854, 2057, 1606, 1606, 1606, 1606, 1606, 1606, - /* 110 */ 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, - /* 120 */ 1606, 1606, 1606, 1606, 1606, 1606, 1606, 2069, 1606, 1606, - /* 130 */ 1684, 1606, 2069, 2069, 2069, 1682, 2029, 2029, 1606, 1606, - /* 140 */ 1606, 1606, 1791, 1606, 1606, 1606, 1606, 1606, 1606, 1791, - /* 150 */ 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1903, 1606, - /* 160 */ 1606, 2094, 2148, 1606, 1606, 2097, 1606, 1606, 1606, 1866, - /* 170 */ 1606, 1744, 2084, 2061, 2075, 2132, 2062, 2059, 2078, 1606, - /* 180 */ 2088, 1606, 1896, 1859, 1606, 1859, 1856, 1606, 1606, 1859, - /* 190 */ 1856, 1856, 1735, 1606, 1606, 1606, 1606, 1606, 1606, 1684, - /* 200 */ 1606, 1684, 1606, 1606, 1684, 1606, 1684, 1684, 1684, 1606, - /* 210 */ 1684, 1663, 1663, 1606, 1606, 1606, 1606, 1606, 1606, 1606, - /* 220 */ 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1916, - /* 230 */ 1606, 1682, 1905, 1606, 1682, 1606, 1606, 1606, 1606, 2105, - /* 240 */ 2103, 1606, 2105, 2103, 1606, 1606, 1606, 2117, 2113, 2105, - /* 250 */ 2121, 2119, 2090, 2088, 2151, 2138, 2134, 2075, 1606, 1606, - /* 260 */ 1606, 1606, 1682, 2103, 1606, 1606, 1606, 1606, 1606, 2103, - /* 270 */ 1606, 1606, 1682, 1606, 1682, 1606, 1606, 1760, 1606, 1606, - /* 280 */ 1606, 1682, 1638, 1606, 1898, 1909, 1881, 1881, 1794, 1794, - /* 290 */ 1794, 1685, 1611, 1606, 1606, 1606, 1606, 1606, 1606, 1606, - /* 300 */ 1606, 1606, 1606, 1606, 1606, 2116, 2115, 1984, 1606, 2033, - /* 310 */ 2032, 2031, 2022, 1983, 1756, 1606, 1982, 1981, 1606, 1606, - /* 320 */ 1606, 1606, 1606, 1872, 1871, 1975, 1606, 1606, 1976, 1974, - /* 330 */ 1973, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, - /* 340 */ 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 2135, 2139, - /* 350 */ 1606, 1606, 1606, 1606, 1606, 1606, 2058, 1606, 1606, 1606, - /* 360 */ 1606, 1606, 1958, 1606, 1606, 1606, 1606, 1606, 1606, 1606, - /* 370 */ 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, - /* 380 */ 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, - /* 390 */ 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, - /* 400 */ 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, - /* 410 */ 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, - /* 420 */ 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, - /* 430 */ 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, - /* 440 */ 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, - /* 450 */ 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, - /* 460 */ 1606, 1643, 1963, 1606, 1606, 1606, 1606, 1606, 1606, 1606, - /* 470 */ 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, - /* 480 */ 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, - /* 490 */ 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, - /* 500 */ 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1723, - /* 510 */ 1722, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, - /* 520 */ 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, - /* 530 */ 1606, 1606, 1606, 1966, 1606, 1606, 1606, 1606, 1606, 1606, - /* 540 */ 1606, 1606, 1606, 1606, 1606, 1606, 1606, 2131, 2091, 1606, - /* 550 */ 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, - /* 560 */ 1606, 1606, 1606, 1606, 1606, 1606, 1958, 1606, 2114, 1606, - /* 570 */ 1606, 2129, 1606, 2133, 1606, 1606, 1606, 1606, 1606, 1606, - /* 580 */ 1606, 2068, 2064, 1606, 1606, 2060, 1606, 1606, 1606, 1606, - /* 590 */ 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, - /* 600 */ 1606, 1606, 1957, 1606, 2019, 1606, 1606, 1606, 2053, 1606, - /* 610 */ 1606, 2004, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, - /* 620 */ 1606, 1966, 1606, 1969, 1606, 1606, 1606, 1606, 1606, 1788, - /* 630 */ 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, - /* 640 */ 1606, 1606, 1773, 1771, 1770, 1769, 1606, 1766, 1606, 1801, - /* 650 */ 1606, 1606, 1606, 1797, 1796, 1606, 1606, 1606, 1606, 1606, - /* 660 */ 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, - /* 670 */ 1703, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1695, - /* 680 */ 1606, 1694, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, - /* 690 */ 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, - /* 700 */ 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, 1606, - /* 710 */ 1606, 1606, 1606, 1606, + /* 0 */ 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, + /* 10 */ 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, + /* 20 */ 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, + /* 30 */ 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, + /* 40 */ 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, + /* 50 */ 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, + /* 60 */ 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, + /* 70 */ 1615, 1870, 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, + /* 80 */ 1615, 1615, 1615, 1615, 1615, 1693, 1615, 1615, 1615, 1615, + /* 90 */ 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, + /* 100 */ 1615, 1615, 1615, 1615, 1691, 1863, 2067, 1615, 1615, 1615, + /* 110 */ 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, + /* 120 */ 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, + /* 130 */ 2079, 1615, 1615, 1693, 1615, 2079, 2079, 2079, 1691, 2039, + /* 140 */ 2039, 1615, 1615, 1615, 1615, 1800, 1615, 1615, 1615, 1615, + /* 150 */ 1615, 1615, 1800, 1615, 1615, 1615, 1615, 1615, 1615, 1615, + /* 160 */ 1615, 1913, 1615, 1615, 2104, 2158, 1615, 1615, 2107, 1615, + /* 170 */ 1615, 1615, 1875, 1615, 1753, 2094, 2071, 2085, 2142, 2072, + /* 180 */ 2069, 2088, 1615, 2098, 1615, 1906, 1868, 1615, 1868, 1865, + /* 190 */ 1615, 1615, 1868, 1865, 1865, 1744, 1615, 1615, 1615, 1615, + /* 200 */ 1615, 1615, 1693, 1615, 1693, 1615, 1615, 1693, 1615, 1693, + /* 210 */ 1693, 1693, 1615, 1693, 1672, 1672, 1615, 1615, 1615, 1615, + /* 220 */ 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, + /* 230 */ 1615, 1615, 1926, 1615, 1691, 1915, 1615, 1691, 1615, 1615, + /* 240 */ 1615, 1615, 2115, 2113, 1615, 2115, 2113, 1615, 1615, 1615, + /* 250 */ 2127, 2123, 2115, 2131, 2129, 2100, 2098, 2161, 2148, 2144, + /* 260 */ 2085, 1615, 1615, 1615, 1615, 1691, 1691, 2113, 1615, 1615, + /* 270 */ 1615, 1615, 1615, 2113, 1615, 1615, 1691, 1615, 1691, 1615, + /* 280 */ 1615, 1769, 1615, 1615, 1615, 1691, 1647, 1615, 1908, 1919, + /* 290 */ 1891, 1891, 1803, 1803, 1803, 1694, 1620, 1615, 1615, 1615, + /* 300 */ 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, 2126, + /* 310 */ 2125, 1994, 1615, 2043, 2042, 2041, 2032, 1993, 1765, 1615, + /* 320 */ 1992, 1991, 1615, 1615, 1615, 1615, 1615, 1882, 1881, 1985, + /* 330 */ 1615, 1615, 1986, 1984, 1983, 1615, 1615, 1615, 1615, 1615, + /* 340 */ 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, + /* 350 */ 1615, 1615, 2145, 2149, 1615, 1615, 1615, 1615, 1615, 1615, + /* 360 */ 1615, 2068, 1615, 1615, 1615, 1615, 1615, 1968, 1615, 1615, + /* 370 */ 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, + /* 380 */ 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, + /* 390 */ 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, + /* 400 */ 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, + /* 410 */ 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, + /* 420 */ 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, + /* 430 */ 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, + /* 440 */ 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, + /* 450 */ 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, + /* 460 */ 1615, 1615, 1615, 1615, 1615, 1615, 1652, 1973, 1615, 1615, + /* 470 */ 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, + /* 480 */ 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, + /* 490 */ 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, + /* 500 */ 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, + /* 510 */ 1615, 1615, 1615, 1615, 1732, 1731, 1615, 1615, 1615, 1615, + /* 520 */ 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, + /* 530 */ 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1976, 1615, + /* 540 */ 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, + /* 550 */ 1615, 1615, 2141, 2101, 1615, 1615, 1615, 1615, 1615, 1615, + /* 560 */ 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, + /* 570 */ 1615, 1968, 1615, 2124, 1615, 1615, 2139, 1615, 2143, 1615, + /* 580 */ 1615, 1615, 1615, 1615, 1615, 1615, 2078, 2074, 1615, 1615, + /* 590 */ 2070, 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, + /* 600 */ 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, + /* 610 */ 1967, 1615, 2029, 1615, 1615, 1615, 2063, 1615, 1615, 2014, + /* 620 */ 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1976, + /* 630 */ 1615, 1979, 1615, 1615, 1615, 1615, 1615, 1797, 1615, 1615, + /* 640 */ 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, + /* 650 */ 1782, 1780, 1779, 1778, 1615, 1775, 1615, 1810, 1615, 1615, + /* 660 */ 1615, 1806, 1805, 1615, 1615, 1615, 1615, 1615, 1615, 1615, + /* 670 */ 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1712, 1615, + /* 680 */ 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1704, 1615, 1703, + /* 690 */ 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, + /* 700 */ 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, + /* 710 */ 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, + /* 720 */ 1615, 1615, }; /********** End of lemon-generated parsing tables *****************************/ @@ -2214,290 +2182,291 @@ static const char *const yyRuleName[] = { /* 258 */ "tag_item ::= column_name column_alias", /* 259 */ "tag_item ::= column_name AS column_alias", /* 260 */ "cmd ::= CREATE SMA INDEX not_exists_opt full_table_name ON full_table_name index_options", - /* 261 */ "cmd ::= DROP INDEX exists_opt full_table_name", - /* 262 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt", - /* 263 */ "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", - /* 264 */ "func_list ::= func", - /* 265 */ "func_list ::= func_list NK_COMMA func", - /* 266 */ "func ::= sma_func_name NK_LP expression_list NK_RP", - /* 267 */ "sma_func_name ::= function_name", - /* 268 */ "sma_func_name ::= COUNT", - /* 269 */ "sma_func_name ::= FIRST", - /* 270 */ "sma_func_name ::= LAST", - /* 271 */ "sma_func_name ::= LAST_ROW", - /* 272 */ "sma_stream_opt ::=", - /* 273 */ "sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal", - /* 274 */ "sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal", - /* 275 */ "sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal", - /* 276 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery", - /* 277 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name", - /* 278 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name", - /* 279 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name", - /* 280 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name", - /* 281 */ "cmd ::= DROP TOPIC exists_opt topic_name", - /* 282 */ "cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name", - /* 283 */ "cmd ::= DESC full_table_name", - /* 284 */ "cmd ::= DESCRIBE full_table_name", - /* 285 */ "cmd ::= RESET QUERY CACHE", - /* 286 */ "cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery", - /* 287 */ "analyze_opt ::=", - /* 288 */ "analyze_opt ::= ANALYZE", - /* 289 */ "explain_options ::=", - /* 290 */ "explain_options ::= explain_options VERBOSE NK_BOOL", - /* 291 */ "explain_options ::= explain_options RATIO NK_FLOAT", - /* 292 */ "cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt", - /* 293 */ "cmd ::= DROP FUNCTION exists_opt function_name", - /* 294 */ "agg_func_opt ::=", - /* 295 */ "agg_func_opt ::= AGGREGATE", - /* 296 */ "bufsize_opt ::=", - /* 297 */ "bufsize_opt ::= BUFSIZE NK_INTEGER", - /* 298 */ "cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name tags_def_opt subtable_opt AS query_or_subquery", - /* 299 */ "cmd ::= DROP STREAM exists_opt stream_name", - /* 300 */ "stream_options ::=", - /* 301 */ "stream_options ::= stream_options TRIGGER AT_ONCE", - /* 302 */ "stream_options ::= stream_options TRIGGER WINDOW_CLOSE", - /* 303 */ "stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal", - /* 304 */ "stream_options ::= stream_options WATERMARK duration_literal", - /* 305 */ "stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER", - /* 306 */ "stream_options ::= stream_options FILL_HISTORY NK_INTEGER", - /* 307 */ "subtable_opt ::=", - /* 308 */ "subtable_opt ::= SUBTABLE NK_LP expression NK_RP", - /* 309 */ "cmd ::= KILL CONNECTION NK_INTEGER", - /* 310 */ "cmd ::= KILL QUERY NK_STRING", - /* 311 */ "cmd ::= KILL TRANSACTION NK_INTEGER", - /* 312 */ "cmd ::= BALANCE VGROUP", - /* 313 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER", - /* 314 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list", - /* 315 */ "cmd ::= SPLIT VGROUP NK_INTEGER", - /* 316 */ "dnode_list ::= DNODE NK_INTEGER", - /* 317 */ "dnode_list ::= dnode_list DNODE NK_INTEGER", - /* 318 */ "cmd ::= DELETE FROM full_table_name where_clause_opt", - /* 319 */ "cmd ::= query_or_subquery", - /* 320 */ "cmd ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery", - /* 321 */ "cmd ::= INSERT INTO full_table_name query_or_subquery", - /* 322 */ "literal ::= NK_INTEGER", - /* 323 */ "literal ::= NK_FLOAT", - /* 324 */ "literal ::= NK_STRING", - /* 325 */ "literal ::= NK_BOOL", - /* 326 */ "literal ::= TIMESTAMP NK_STRING", - /* 327 */ "literal ::= duration_literal", - /* 328 */ "literal ::= NULL", - /* 329 */ "literal ::= NK_QUESTION", - /* 330 */ "duration_literal ::= NK_VARIABLE", - /* 331 */ "signed ::= NK_INTEGER", - /* 332 */ "signed ::= NK_PLUS NK_INTEGER", - /* 333 */ "signed ::= NK_MINUS NK_INTEGER", - /* 334 */ "signed ::= NK_FLOAT", - /* 335 */ "signed ::= NK_PLUS NK_FLOAT", - /* 336 */ "signed ::= NK_MINUS NK_FLOAT", - /* 337 */ "signed_literal ::= signed", - /* 338 */ "signed_literal ::= NK_STRING", - /* 339 */ "signed_literal ::= NK_BOOL", - /* 340 */ "signed_literal ::= TIMESTAMP NK_STRING", - /* 341 */ "signed_literal ::= duration_literal", - /* 342 */ "signed_literal ::= NULL", - /* 343 */ "signed_literal ::= literal_func", - /* 344 */ "signed_literal ::= NK_QUESTION", - /* 345 */ "literal_list ::= signed_literal", - /* 346 */ "literal_list ::= literal_list NK_COMMA signed_literal", - /* 347 */ "db_name ::= NK_ID", - /* 348 */ "table_name ::= NK_ID", - /* 349 */ "column_name ::= NK_ID", - /* 350 */ "function_name ::= NK_ID", - /* 351 */ "table_alias ::= NK_ID", - /* 352 */ "column_alias ::= NK_ID", - /* 353 */ "user_name ::= NK_ID", - /* 354 */ "topic_name ::= NK_ID", - /* 355 */ "stream_name ::= NK_ID", - /* 356 */ "cgroup_name ::= NK_ID", - /* 357 */ "expr_or_subquery ::= expression", - /* 358 */ "expression ::= literal", - /* 359 */ "expression ::= pseudo_column", - /* 360 */ "expression ::= column_reference", - /* 361 */ "expression ::= function_expression", - /* 362 */ "expression ::= case_when_expression", - /* 363 */ "expression ::= NK_LP expression NK_RP", - /* 364 */ "expression ::= NK_PLUS expr_or_subquery", - /* 365 */ "expression ::= NK_MINUS expr_or_subquery", - /* 366 */ "expression ::= expr_or_subquery NK_PLUS expr_or_subquery", - /* 367 */ "expression ::= expr_or_subquery NK_MINUS expr_or_subquery", - /* 368 */ "expression ::= expr_or_subquery NK_STAR expr_or_subquery", - /* 369 */ "expression ::= expr_or_subquery NK_SLASH expr_or_subquery", - /* 370 */ "expression ::= expr_or_subquery NK_REM expr_or_subquery", - /* 371 */ "expression ::= column_reference NK_ARROW NK_STRING", - /* 372 */ "expression ::= expr_or_subquery NK_BITAND expr_or_subquery", - /* 373 */ "expression ::= expr_or_subquery NK_BITOR expr_or_subquery", - /* 374 */ "expression_list ::= expr_or_subquery", - /* 375 */ "expression_list ::= expression_list NK_COMMA expr_or_subquery", - /* 376 */ "column_reference ::= column_name", - /* 377 */ "column_reference ::= table_name NK_DOT column_name", - /* 378 */ "pseudo_column ::= ROWTS", - /* 379 */ "pseudo_column ::= TBNAME", - /* 380 */ "pseudo_column ::= table_name NK_DOT TBNAME", - /* 381 */ "pseudo_column ::= QSTART", - /* 382 */ "pseudo_column ::= QEND", - /* 383 */ "pseudo_column ::= QDURATION", - /* 384 */ "pseudo_column ::= WSTART", - /* 385 */ "pseudo_column ::= WEND", - /* 386 */ "pseudo_column ::= WDURATION", - /* 387 */ "pseudo_column ::= IROWTS", - /* 388 */ "pseudo_column ::= ISFILLED", - /* 389 */ "pseudo_column ::= QTAGS", - /* 390 */ "function_expression ::= function_name NK_LP expression_list NK_RP", - /* 391 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP", - /* 392 */ "function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP", - /* 393 */ "function_expression ::= literal_func", - /* 394 */ "literal_func ::= noarg_func NK_LP NK_RP", - /* 395 */ "literal_func ::= NOW", - /* 396 */ "noarg_func ::= NOW", - /* 397 */ "noarg_func ::= TODAY", - /* 398 */ "noarg_func ::= TIMEZONE", - /* 399 */ "noarg_func ::= DATABASE", - /* 400 */ "noarg_func ::= CLIENT_VERSION", - /* 401 */ "noarg_func ::= SERVER_VERSION", - /* 402 */ "noarg_func ::= SERVER_STATUS", - /* 403 */ "noarg_func ::= CURRENT_USER", - /* 404 */ "noarg_func ::= USER", - /* 405 */ "star_func ::= COUNT", - /* 406 */ "star_func ::= FIRST", - /* 407 */ "star_func ::= LAST", - /* 408 */ "star_func ::= LAST_ROW", - /* 409 */ "star_func_para_list ::= NK_STAR", - /* 410 */ "star_func_para_list ::= other_para_list", - /* 411 */ "other_para_list ::= star_func_para", - /* 412 */ "other_para_list ::= other_para_list NK_COMMA star_func_para", - /* 413 */ "star_func_para ::= expr_or_subquery", - /* 414 */ "star_func_para ::= table_name NK_DOT NK_STAR", - /* 415 */ "case_when_expression ::= CASE when_then_list case_when_else_opt END", - /* 416 */ "case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END", - /* 417 */ "when_then_list ::= when_then_expr", - /* 418 */ "when_then_list ::= when_then_list when_then_expr", - /* 419 */ "when_then_expr ::= WHEN common_expression THEN common_expression", - /* 420 */ "case_when_else_opt ::=", - /* 421 */ "case_when_else_opt ::= ELSE common_expression", - /* 422 */ "predicate ::= expr_or_subquery compare_op expr_or_subquery", - /* 423 */ "predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery", - /* 424 */ "predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery", - /* 425 */ "predicate ::= expr_or_subquery IS NULL", - /* 426 */ "predicate ::= expr_or_subquery IS NOT NULL", - /* 427 */ "predicate ::= expr_or_subquery in_op in_predicate_value", - /* 428 */ "compare_op ::= NK_LT", - /* 429 */ "compare_op ::= NK_GT", - /* 430 */ "compare_op ::= NK_LE", - /* 431 */ "compare_op ::= NK_GE", - /* 432 */ "compare_op ::= NK_NE", - /* 433 */ "compare_op ::= NK_EQ", - /* 434 */ "compare_op ::= LIKE", - /* 435 */ "compare_op ::= NOT LIKE", - /* 436 */ "compare_op ::= MATCH", - /* 437 */ "compare_op ::= NMATCH", - /* 438 */ "compare_op ::= CONTAINS", - /* 439 */ "in_op ::= IN", - /* 440 */ "in_op ::= NOT IN", - /* 441 */ "in_predicate_value ::= NK_LP literal_list NK_RP", - /* 442 */ "boolean_value_expression ::= boolean_primary", - /* 443 */ "boolean_value_expression ::= NOT boolean_primary", - /* 444 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", - /* 445 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", - /* 446 */ "boolean_primary ::= predicate", - /* 447 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", - /* 448 */ "common_expression ::= expr_or_subquery", - /* 449 */ "common_expression ::= boolean_value_expression", - /* 450 */ "from_clause_opt ::=", - /* 451 */ "from_clause_opt ::= FROM table_reference_list", - /* 452 */ "table_reference_list ::= table_reference", - /* 453 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", - /* 454 */ "table_reference ::= table_primary", - /* 455 */ "table_reference ::= joined_table", - /* 456 */ "table_primary ::= table_name alias_opt", - /* 457 */ "table_primary ::= db_name NK_DOT table_name alias_opt", - /* 458 */ "table_primary ::= subquery alias_opt", - /* 459 */ "table_primary ::= parenthesized_joined_table", - /* 460 */ "alias_opt ::=", - /* 461 */ "alias_opt ::= table_alias", - /* 462 */ "alias_opt ::= AS table_alias", - /* 463 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", - /* 464 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", - /* 465 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition", - /* 466 */ "join_type ::=", - /* 467 */ "join_type ::= INNER", - /* 468 */ "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", - /* 469 */ "set_quantifier_opt ::=", - /* 470 */ "set_quantifier_opt ::= DISTINCT", - /* 471 */ "set_quantifier_opt ::= ALL", - /* 472 */ "select_list ::= select_item", - /* 473 */ "select_list ::= select_list NK_COMMA select_item", - /* 474 */ "select_item ::= NK_STAR", - /* 475 */ "select_item ::= common_expression", - /* 476 */ "select_item ::= common_expression column_alias", - /* 477 */ "select_item ::= common_expression AS column_alias", - /* 478 */ "select_item ::= table_name NK_DOT NK_STAR", - /* 479 */ "where_clause_opt ::=", - /* 480 */ "where_clause_opt ::= WHERE search_condition", - /* 481 */ "partition_by_clause_opt ::=", - /* 482 */ "partition_by_clause_opt ::= PARTITION BY partition_list", - /* 483 */ "partition_list ::= partition_item", - /* 484 */ "partition_list ::= partition_list NK_COMMA partition_item", - /* 485 */ "partition_item ::= expr_or_subquery", - /* 486 */ "partition_item ::= expr_or_subquery column_alias", - /* 487 */ "partition_item ::= expr_or_subquery AS column_alias", - /* 488 */ "twindow_clause_opt ::=", - /* 489 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP", - /* 490 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP", - /* 491 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt", - /* 492 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt", - /* 493 */ "twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition", - /* 494 */ "sliding_opt ::=", - /* 495 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP", - /* 496 */ "fill_opt ::=", - /* 497 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", - /* 498 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP", - /* 499 */ "fill_mode ::= NONE", - /* 500 */ "fill_mode ::= PREV", - /* 501 */ "fill_mode ::= NULL", - /* 502 */ "fill_mode ::= LINEAR", - /* 503 */ "fill_mode ::= NEXT", - /* 504 */ "group_by_clause_opt ::=", - /* 505 */ "group_by_clause_opt ::= GROUP BY group_by_list", - /* 506 */ "group_by_list ::= expr_or_subquery", - /* 507 */ "group_by_list ::= group_by_list NK_COMMA expr_or_subquery", - /* 508 */ "having_clause_opt ::=", - /* 509 */ "having_clause_opt ::= HAVING search_condition", - /* 510 */ "range_opt ::=", - /* 511 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP", - /* 512 */ "every_opt ::=", - /* 513 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP", - /* 514 */ "query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt", - /* 515 */ "query_simple ::= query_specification", - /* 516 */ "query_simple ::= union_query_expression", - /* 517 */ "union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery", - /* 518 */ "union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery", - /* 519 */ "query_simple_or_subquery ::= query_simple", - /* 520 */ "query_simple_or_subquery ::= subquery", - /* 521 */ "query_or_subquery ::= query_expression", - /* 522 */ "query_or_subquery ::= subquery", - /* 523 */ "order_by_clause_opt ::=", - /* 524 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", - /* 525 */ "slimit_clause_opt ::=", - /* 526 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", - /* 527 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", - /* 528 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 529 */ "limit_clause_opt ::=", - /* 530 */ "limit_clause_opt ::= LIMIT NK_INTEGER", - /* 531 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", - /* 532 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 533 */ "subquery ::= NK_LP query_expression NK_RP", - /* 534 */ "subquery ::= NK_LP subquery NK_RP", - /* 535 */ "search_condition ::= common_expression", - /* 536 */ "sort_specification_list ::= sort_specification", - /* 537 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", - /* 538 */ "sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt", - /* 539 */ "ordering_specification_opt ::=", - /* 540 */ "ordering_specification_opt ::= ASC", - /* 541 */ "ordering_specification_opt ::= DESC", - /* 542 */ "null_ordering_opt ::=", - /* 543 */ "null_ordering_opt ::= NULLS FIRST", - /* 544 */ "null_ordering_opt ::= NULLS LAST", + /* 261 */ "cmd ::= CREATE INDEX not_exists_opt full_table_name ON full_table_name NK_LP col_name_list NK_RP", + /* 262 */ "cmd ::= DROP INDEX exists_opt full_table_name", + /* 263 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt", + /* 264 */ "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", + /* 265 */ "func_list ::= func", + /* 266 */ "func_list ::= func_list NK_COMMA func", + /* 267 */ "func ::= sma_func_name NK_LP expression_list NK_RP", + /* 268 */ "sma_func_name ::= function_name", + /* 269 */ "sma_func_name ::= COUNT", + /* 270 */ "sma_func_name ::= FIRST", + /* 271 */ "sma_func_name ::= LAST", + /* 272 */ "sma_func_name ::= LAST_ROW", + /* 273 */ "sma_stream_opt ::=", + /* 274 */ "sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal", + /* 275 */ "sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal", + /* 276 */ "sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal", + /* 277 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery", + /* 278 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name", + /* 279 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name", + /* 280 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name", + /* 281 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name", + /* 282 */ "cmd ::= DROP TOPIC exists_opt topic_name", + /* 283 */ "cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name", + /* 284 */ "cmd ::= DESC full_table_name", + /* 285 */ "cmd ::= DESCRIBE full_table_name", + /* 286 */ "cmd ::= RESET QUERY CACHE", + /* 287 */ "cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery", + /* 288 */ "analyze_opt ::=", + /* 289 */ "analyze_opt ::= ANALYZE", + /* 290 */ "explain_options ::=", + /* 291 */ "explain_options ::= explain_options VERBOSE NK_BOOL", + /* 292 */ "explain_options ::= explain_options RATIO NK_FLOAT", + /* 293 */ "cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt", + /* 294 */ "cmd ::= DROP FUNCTION exists_opt function_name", + /* 295 */ "agg_func_opt ::=", + /* 296 */ "agg_func_opt ::= AGGREGATE", + /* 297 */ "bufsize_opt ::=", + /* 298 */ "bufsize_opt ::= BUFSIZE NK_INTEGER", + /* 299 */ "cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name tags_def_opt subtable_opt AS query_or_subquery", + /* 300 */ "cmd ::= DROP STREAM exists_opt stream_name", + /* 301 */ "stream_options ::=", + /* 302 */ "stream_options ::= stream_options TRIGGER AT_ONCE", + /* 303 */ "stream_options ::= stream_options TRIGGER WINDOW_CLOSE", + /* 304 */ "stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal", + /* 305 */ "stream_options ::= stream_options WATERMARK duration_literal", + /* 306 */ "stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER", + /* 307 */ "stream_options ::= stream_options FILL_HISTORY NK_INTEGER", + /* 308 */ "subtable_opt ::=", + /* 309 */ "subtable_opt ::= SUBTABLE NK_LP expression NK_RP", + /* 310 */ "cmd ::= KILL CONNECTION NK_INTEGER", + /* 311 */ "cmd ::= KILL QUERY NK_STRING", + /* 312 */ "cmd ::= KILL TRANSACTION NK_INTEGER", + /* 313 */ "cmd ::= BALANCE VGROUP", + /* 314 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER", + /* 315 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list", + /* 316 */ "cmd ::= SPLIT VGROUP NK_INTEGER", + /* 317 */ "dnode_list ::= DNODE NK_INTEGER", + /* 318 */ "dnode_list ::= dnode_list DNODE NK_INTEGER", + /* 319 */ "cmd ::= DELETE FROM full_table_name where_clause_opt", + /* 320 */ "cmd ::= query_or_subquery", + /* 321 */ "cmd ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery", + /* 322 */ "cmd ::= INSERT INTO full_table_name query_or_subquery", + /* 323 */ "literal ::= NK_INTEGER", + /* 324 */ "literal ::= NK_FLOAT", + /* 325 */ "literal ::= NK_STRING", + /* 326 */ "literal ::= NK_BOOL", + /* 327 */ "literal ::= TIMESTAMP NK_STRING", + /* 328 */ "literal ::= duration_literal", + /* 329 */ "literal ::= NULL", + /* 330 */ "literal ::= NK_QUESTION", + /* 331 */ "duration_literal ::= NK_VARIABLE", + /* 332 */ "signed ::= NK_INTEGER", + /* 333 */ "signed ::= NK_PLUS NK_INTEGER", + /* 334 */ "signed ::= NK_MINUS NK_INTEGER", + /* 335 */ "signed ::= NK_FLOAT", + /* 336 */ "signed ::= NK_PLUS NK_FLOAT", + /* 337 */ "signed ::= NK_MINUS NK_FLOAT", + /* 338 */ "signed_literal ::= signed", + /* 339 */ "signed_literal ::= NK_STRING", + /* 340 */ "signed_literal ::= NK_BOOL", + /* 341 */ "signed_literal ::= TIMESTAMP NK_STRING", + /* 342 */ "signed_literal ::= duration_literal", + /* 343 */ "signed_literal ::= NULL", + /* 344 */ "signed_literal ::= literal_func", + /* 345 */ "signed_literal ::= NK_QUESTION", + /* 346 */ "literal_list ::= signed_literal", + /* 347 */ "literal_list ::= literal_list NK_COMMA signed_literal", + /* 348 */ "db_name ::= NK_ID", + /* 349 */ "table_name ::= NK_ID", + /* 350 */ "column_name ::= NK_ID", + /* 351 */ "function_name ::= NK_ID", + /* 352 */ "table_alias ::= NK_ID", + /* 353 */ "column_alias ::= NK_ID", + /* 354 */ "user_name ::= NK_ID", + /* 355 */ "topic_name ::= NK_ID", + /* 356 */ "stream_name ::= NK_ID", + /* 357 */ "cgroup_name ::= NK_ID", + /* 358 */ "expr_or_subquery ::= expression", + /* 359 */ "expression ::= literal", + /* 360 */ "expression ::= pseudo_column", + /* 361 */ "expression ::= column_reference", + /* 362 */ "expression ::= function_expression", + /* 363 */ "expression ::= case_when_expression", + /* 364 */ "expression ::= NK_LP expression NK_RP", + /* 365 */ "expression ::= NK_PLUS expr_or_subquery", + /* 366 */ "expression ::= NK_MINUS expr_or_subquery", + /* 367 */ "expression ::= expr_or_subquery NK_PLUS expr_or_subquery", + /* 368 */ "expression ::= expr_or_subquery NK_MINUS expr_or_subquery", + /* 369 */ "expression ::= expr_or_subquery NK_STAR expr_or_subquery", + /* 370 */ "expression ::= expr_or_subquery NK_SLASH expr_or_subquery", + /* 371 */ "expression ::= expr_or_subquery NK_REM expr_or_subquery", + /* 372 */ "expression ::= column_reference NK_ARROW NK_STRING", + /* 373 */ "expression ::= expr_or_subquery NK_BITAND expr_or_subquery", + /* 374 */ "expression ::= expr_or_subquery NK_BITOR expr_or_subquery", + /* 375 */ "expression_list ::= expr_or_subquery", + /* 376 */ "expression_list ::= expression_list NK_COMMA expr_or_subquery", + /* 377 */ "column_reference ::= column_name", + /* 378 */ "column_reference ::= table_name NK_DOT column_name", + /* 379 */ "pseudo_column ::= ROWTS", + /* 380 */ "pseudo_column ::= TBNAME", + /* 381 */ "pseudo_column ::= table_name NK_DOT TBNAME", + /* 382 */ "pseudo_column ::= QSTART", + /* 383 */ "pseudo_column ::= QEND", + /* 384 */ "pseudo_column ::= QDURATION", + /* 385 */ "pseudo_column ::= WSTART", + /* 386 */ "pseudo_column ::= WEND", + /* 387 */ "pseudo_column ::= WDURATION", + /* 388 */ "pseudo_column ::= IROWTS", + /* 389 */ "pseudo_column ::= ISFILLED", + /* 390 */ "pseudo_column ::= QTAGS", + /* 391 */ "function_expression ::= function_name NK_LP expression_list NK_RP", + /* 392 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP", + /* 393 */ "function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP", + /* 394 */ "function_expression ::= literal_func", + /* 395 */ "literal_func ::= noarg_func NK_LP NK_RP", + /* 396 */ "literal_func ::= NOW", + /* 397 */ "noarg_func ::= NOW", + /* 398 */ "noarg_func ::= TODAY", + /* 399 */ "noarg_func ::= TIMEZONE", + /* 400 */ "noarg_func ::= DATABASE", + /* 401 */ "noarg_func ::= CLIENT_VERSION", + /* 402 */ "noarg_func ::= SERVER_VERSION", + /* 403 */ "noarg_func ::= SERVER_STATUS", + /* 404 */ "noarg_func ::= CURRENT_USER", + /* 405 */ "noarg_func ::= USER", + /* 406 */ "star_func ::= COUNT", + /* 407 */ "star_func ::= FIRST", + /* 408 */ "star_func ::= LAST", + /* 409 */ "star_func ::= LAST_ROW", + /* 410 */ "star_func_para_list ::= NK_STAR", + /* 411 */ "star_func_para_list ::= other_para_list", + /* 412 */ "other_para_list ::= star_func_para", + /* 413 */ "other_para_list ::= other_para_list NK_COMMA star_func_para", + /* 414 */ "star_func_para ::= expr_or_subquery", + /* 415 */ "star_func_para ::= table_name NK_DOT NK_STAR", + /* 416 */ "case_when_expression ::= CASE when_then_list case_when_else_opt END", + /* 417 */ "case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END", + /* 418 */ "when_then_list ::= when_then_expr", + /* 419 */ "when_then_list ::= when_then_list when_then_expr", + /* 420 */ "when_then_expr ::= WHEN common_expression THEN common_expression", + /* 421 */ "case_when_else_opt ::=", + /* 422 */ "case_when_else_opt ::= ELSE common_expression", + /* 423 */ "predicate ::= expr_or_subquery compare_op expr_or_subquery", + /* 424 */ "predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery", + /* 425 */ "predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery", + /* 426 */ "predicate ::= expr_or_subquery IS NULL", + /* 427 */ "predicate ::= expr_or_subquery IS NOT NULL", + /* 428 */ "predicate ::= expr_or_subquery in_op in_predicate_value", + /* 429 */ "compare_op ::= NK_LT", + /* 430 */ "compare_op ::= NK_GT", + /* 431 */ "compare_op ::= NK_LE", + /* 432 */ "compare_op ::= NK_GE", + /* 433 */ "compare_op ::= NK_NE", + /* 434 */ "compare_op ::= NK_EQ", + /* 435 */ "compare_op ::= LIKE", + /* 436 */ "compare_op ::= NOT LIKE", + /* 437 */ "compare_op ::= MATCH", + /* 438 */ "compare_op ::= NMATCH", + /* 439 */ "compare_op ::= CONTAINS", + /* 440 */ "in_op ::= IN", + /* 441 */ "in_op ::= NOT IN", + /* 442 */ "in_predicate_value ::= NK_LP literal_list NK_RP", + /* 443 */ "boolean_value_expression ::= boolean_primary", + /* 444 */ "boolean_value_expression ::= NOT boolean_primary", + /* 445 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", + /* 446 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", + /* 447 */ "boolean_primary ::= predicate", + /* 448 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", + /* 449 */ "common_expression ::= expr_or_subquery", + /* 450 */ "common_expression ::= boolean_value_expression", + /* 451 */ "from_clause_opt ::=", + /* 452 */ "from_clause_opt ::= FROM table_reference_list", + /* 453 */ "table_reference_list ::= table_reference", + /* 454 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", + /* 455 */ "table_reference ::= table_primary", + /* 456 */ "table_reference ::= joined_table", + /* 457 */ "table_primary ::= table_name alias_opt", + /* 458 */ "table_primary ::= db_name NK_DOT table_name alias_opt", + /* 459 */ "table_primary ::= subquery alias_opt", + /* 460 */ "table_primary ::= parenthesized_joined_table", + /* 461 */ "alias_opt ::=", + /* 462 */ "alias_opt ::= table_alias", + /* 463 */ "alias_opt ::= AS table_alias", + /* 464 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", + /* 465 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", + /* 466 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition", + /* 467 */ "join_type ::=", + /* 468 */ "join_type ::= INNER", + /* 469 */ "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", + /* 470 */ "set_quantifier_opt ::=", + /* 471 */ "set_quantifier_opt ::= DISTINCT", + /* 472 */ "set_quantifier_opt ::= ALL", + /* 473 */ "select_list ::= select_item", + /* 474 */ "select_list ::= select_list NK_COMMA select_item", + /* 475 */ "select_item ::= NK_STAR", + /* 476 */ "select_item ::= common_expression", + /* 477 */ "select_item ::= common_expression column_alias", + /* 478 */ "select_item ::= common_expression AS column_alias", + /* 479 */ "select_item ::= table_name NK_DOT NK_STAR", + /* 480 */ "where_clause_opt ::=", + /* 481 */ "where_clause_opt ::= WHERE search_condition", + /* 482 */ "partition_by_clause_opt ::=", + /* 483 */ "partition_by_clause_opt ::= PARTITION BY partition_list", + /* 484 */ "partition_list ::= partition_item", + /* 485 */ "partition_list ::= partition_list NK_COMMA partition_item", + /* 486 */ "partition_item ::= expr_or_subquery", + /* 487 */ "partition_item ::= expr_or_subquery column_alias", + /* 488 */ "partition_item ::= expr_or_subquery AS column_alias", + /* 489 */ "twindow_clause_opt ::=", + /* 490 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP", + /* 491 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP", + /* 492 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt", + /* 493 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt", + /* 494 */ "twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition", + /* 495 */ "sliding_opt ::=", + /* 496 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP", + /* 497 */ "fill_opt ::=", + /* 498 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", + /* 499 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP", + /* 500 */ "fill_mode ::= NONE", + /* 501 */ "fill_mode ::= PREV", + /* 502 */ "fill_mode ::= NULL", + /* 503 */ "fill_mode ::= LINEAR", + /* 504 */ "fill_mode ::= NEXT", + /* 505 */ "group_by_clause_opt ::=", + /* 506 */ "group_by_clause_opt ::= GROUP BY group_by_list", + /* 507 */ "group_by_list ::= expr_or_subquery", + /* 508 */ "group_by_list ::= group_by_list NK_COMMA expr_or_subquery", + /* 509 */ "having_clause_opt ::=", + /* 510 */ "having_clause_opt ::= HAVING search_condition", + /* 511 */ "range_opt ::=", + /* 512 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP", + /* 513 */ "every_opt ::=", + /* 514 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP", + /* 515 */ "query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt", + /* 516 */ "query_simple ::= query_specification", + /* 517 */ "query_simple ::= union_query_expression", + /* 518 */ "union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery", + /* 519 */ "union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery", + /* 520 */ "query_simple_or_subquery ::= query_simple", + /* 521 */ "query_simple_or_subquery ::= subquery", + /* 522 */ "query_or_subquery ::= query_expression", + /* 523 */ "query_or_subquery ::= subquery", + /* 524 */ "order_by_clause_opt ::=", + /* 525 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", + /* 526 */ "slimit_clause_opt ::=", + /* 527 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", + /* 528 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", + /* 529 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 530 */ "limit_clause_opt ::=", + /* 531 */ "limit_clause_opt ::= LIMIT NK_INTEGER", + /* 532 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", + /* 533 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 534 */ "subquery ::= NK_LP query_expression NK_RP", + /* 535 */ "subquery ::= NK_LP subquery NK_RP", + /* 536 */ "search_condition ::= common_expression", + /* 537 */ "sort_specification_list ::= sort_specification", + /* 538 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", + /* 539 */ "sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt", + /* 540 */ "ordering_specification_opt ::=", + /* 541 */ "ordering_specification_opt ::= ASC", + /* 542 */ "ordering_specification_opt ::= DESC", + /* 543 */ "null_ordering_opt ::=", + /* 544 */ "null_ordering_opt ::= NULLS FIRST", + /* 545 */ "null_ordering_opt ::= NULLS LAST", }; #endif /* NDEBUG */ @@ -2939,18 +2908,15 @@ static YYACTIONTYPE yy_find_shift_action( do{ i = yy_shift_ofst[stateno]; assert( i>=0 ); - assert( i<=YY_ACTTAB_COUNT ); - assert( i+YYNTOKEN<=(int)YY_NLOOKAHEAD ); + /* assert( i+YYNTOKEN<=(int)YY_NLOOKAHEAD ); */ assert( iLookAhead!=YYNOCODE ); assert( iLookAhead < YYNTOKEN ); i += iLookAhead; - assert( i<(int)YY_NLOOKAHEAD ); - if( yy_lookahead[i]!=iLookAhead ){ + if( i>=YY_NLOOKAHEAD || yy_lookahead[i]!=iLookAhead ){ #ifdef YYFALLBACK YYCODETYPE iFallback; /* Fallback token */ - assert( iLookAhead %s\n", @@ -2965,8 +2931,16 @@ static YYACTIONTYPE yy_find_shift_action( #ifdef YYWILDCARD { int j = i - iLookAhead + YYWILDCARD; - assert( j<(int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0])) ); - if( yy_lookahead[j]==YYWILDCARD && iLookAhead>0 ){ + if( +#if YY_SHIFT_MIN+YYWILDCARD<0 + j>=0 && +#endif +#if YY_SHIFT_MAX+YYWILDCARD>=YY_ACTTAB_COUNT + j0 + ){ #ifndef NDEBUG if( yyTraceFILE ){ fprintf(yyTraceFILE, "%sWILDCARD %s => %s\n", @@ -2980,7 +2954,6 @@ static YYACTIONTYPE yy_find_shift_action( #endif /* YYWILDCARD */ return yy_default[stateno]; }else{ - assert( i>=0 && iyytos; #ifndef NDEBUG if( yyTraceFILE && yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ){ - yysize = yyRuleInfoNRhs[yyruleno]; + yysize = yyRuleInfo[yyruleno].nrhs; if( yysize ){ - fprintf(yyTraceFILE, "%sReduce %d [%s]%s, pop back to state %d.\n", + fprintf(yyTraceFILE, "%sReduce %d [%s], go to state %d.\n", yyTracePrompt, - yyruleno, yyRuleName[yyruleno], - yyrulenoyytos - yypParser->yystack)>yypParser->yyhwm ){ yypParser->yyhwm++; @@ -4392,8 +3817,8 @@ static YYACTIONTYPE yy_reduce( yymsp[-2].minor.yy77 = yylhsminor.yy77; break; case 42: /* priv_level ::= topic_name */ - case 267: /* sma_func_name ::= function_name */ yytestcase(yyruleno==267); - case 461: /* alias_opt ::= table_alias */ yytestcase(yyruleno==461); + case 268: /* sma_func_name ::= function_name */ yytestcase(yyruleno==268); + case 462: /* alias_opt ::= table_alias */ yytestcase(yyruleno==462); { yylhsminor.yy77 = yymsp[0].minor.yy77; } yymsp[0].minor.yy77 = yylhsminor.yy77; break; @@ -4424,48 +3849,48 @@ static YYACTIONTYPE yy_reduce( case 51: /* dnode_endpoint ::= NK_STRING */ case 52: /* dnode_endpoint ::= NK_ID */ yytestcase(yyruleno==52); case 53: /* dnode_endpoint ::= NK_IPTOKEN */ yytestcase(yyruleno==53); - case 268: /* sma_func_name ::= COUNT */ yytestcase(yyruleno==268); - case 269: /* sma_func_name ::= FIRST */ yytestcase(yyruleno==269); - case 270: /* sma_func_name ::= LAST */ yytestcase(yyruleno==270); - case 271: /* sma_func_name ::= LAST_ROW */ yytestcase(yyruleno==271); - case 347: /* db_name ::= NK_ID */ yytestcase(yyruleno==347); - case 348: /* table_name ::= NK_ID */ yytestcase(yyruleno==348); - case 349: /* column_name ::= NK_ID */ yytestcase(yyruleno==349); - case 350: /* function_name ::= NK_ID */ yytestcase(yyruleno==350); - case 351: /* table_alias ::= NK_ID */ yytestcase(yyruleno==351); - case 352: /* column_alias ::= NK_ID */ yytestcase(yyruleno==352); - case 353: /* user_name ::= NK_ID */ yytestcase(yyruleno==353); - case 354: /* topic_name ::= NK_ID */ yytestcase(yyruleno==354); - case 355: /* stream_name ::= NK_ID */ yytestcase(yyruleno==355); - case 356: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==356); - case 396: /* noarg_func ::= NOW */ yytestcase(yyruleno==396); - case 397: /* noarg_func ::= TODAY */ yytestcase(yyruleno==397); - case 398: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==398); - case 399: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==399); - case 400: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==400); - case 401: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==401); - case 402: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==402); - case 403: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==403); - case 404: /* noarg_func ::= USER */ yytestcase(yyruleno==404); - case 405: /* star_func ::= COUNT */ yytestcase(yyruleno==405); - case 406: /* star_func ::= FIRST */ yytestcase(yyruleno==406); - case 407: /* star_func ::= LAST */ yytestcase(yyruleno==407); - case 408: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==408); + case 269: /* sma_func_name ::= COUNT */ yytestcase(yyruleno==269); + case 270: /* sma_func_name ::= FIRST */ yytestcase(yyruleno==270); + case 271: /* sma_func_name ::= LAST */ yytestcase(yyruleno==271); + case 272: /* sma_func_name ::= LAST_ROW */ yytestcase(yyruleno==272); + case 348: /* db_name ::= NK_ID */ yytestcase(yyruleno==348); + case 349: /* table_name ::= NK_ID */ yytestcase(yyruleno==349); + case 350: /* column_name ::= NK_ID */ yytestcase(yyruleno==350); + case 351: /* function_name ::= NK_ID */ yytestcase(yyruleno==351); + case 352: /* table_alias ::= NK_ID */ yytestcase(yyruleno==352); + case 353: /* column_alias ::= NK_ID */ yytestcase(yyruleno==353); + case 354: /* user_name ::= NK_ID */ yytestcase(yyruleno==354); + case 355: /* topic_name ::= NK_ID */ yytestcase(yyruleno==355); + case 356: /* stream_name ::= NK_ID */ yytestcase(yyruleno==356); + case 357: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==357); + case 397: /* noarg_func ::= NOW */ yytestcase(yyruleno==397); + case 398: /* noarg_func ::= TODAY */ yytestcase(yyruleno==398); + case 399: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==399); + case 400: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==400); + case 401: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==401); + case 402: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==402); + case 403: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==403); + case 404: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==404); + case 405: /* noarg_func ::= USER */ yytestcase(yyruleno==405); + case 406: /* star_func ::= COUNT */ yytestcase(yyruleno==406); + case 407: /* star_func ::= FIRST */ yytestcase(yyruleno==407); + case 408: /* star_func ::= LAST */ yytestcase(yyruleno==408); + case 409: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==409); { yylhsminor.yy77 = yymsp[0].minor.yy0; } yymsp[0].minor.yy77 = yylhsminor.yy77; break; case 54: /* force_opt ::= */ case 73: /* not_exists_opt ::= */ yytestcase(yyruleno==73); case 75: /* exists_opt ::= */ yytestcase(yyruleno==75); - case 287: /* analyze_opt ::= */ yytestcase(yyruleno==287); - case 294: /* agg_func_opt ::= */ yytestcase(yyruleno==294); - case 469: /* set_quantifier_opt ::= */ yytestcase(yyruleno==469); + case 288: /* analyze_opt ::= */ yytestcase(yyruleno==288); + case 295: /* agg_func_opt ::= */ yytestcase(yyruleno==295); + case 470: /* set_quantifier_opt ::= */ yytestcase(yyruleno==470); { yymsp[1].minor.yy841 = false; } break; case 55: /* force_opt ::= FORCE */ - case 288: /* analyze_opt ::= ANALYZE */ yytestcase(yyruleno==288); - case 295: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==295); - case 470: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==470); + case 289: /* analyze_opt ::= ANALYZE */ yytestcase(yyruleno==289); + case 296: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==296); + case 471: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==471); { yymsp[0].minor.yy841 = true; } break; case 56: /* cmd ::= ALTER LOCAL NK_STRING */ @@ -4688,7 +4113,7 @@ static YYACTIONTYPE yy_reduce( yymsp[0].minor.yy601 = yylhsminor.yy601; break; case 120: /* integer_list ::= integer_list NK_COMMA NK_INTEGER */ - case 317: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==317); + case 318: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==318); { yylhsminor.yy601 = addNodeToList(pCxt, yymsp[-2].minor.yy601, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } yymsp[-2].minor.yy601 = yylhsminor.yy601; break; @@ -4707,13 +4132,13 @@ static YYACTIONTYPE yy_reduce( case 199: /* rollup_func_list ::= rollup_func_name */ yytestcase(yyruleno==199); case 204: /* col_name_list ::= col_name */ yytestcase(yyruleno==204); case 253: /* tag_list_opt ::= tag_item */ yytestcase(yyruleno==253); - case 264: /* func_list ::= func */ yytestcase(yyruleno==264); - case 345: /* literal_list ::= signed_literal */ yytestcase(yyruleno==345); - case 411: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==411); - case 417: /* when_then_list ::= when_then_expr */ yytestcase(yyruleno==417); - case 472: /* select_list ::= select_item */ yytestcase(yyruleno==472); - case 483: /* partition_list ::= partition_item */ yytestcase(yyruleno==483); - case 536: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==536); + case 265: /* func_list ::= func */ yytestcase(yyruleno==265); + case 346: /* literal_list ::= signed_literal */ yytestcase(yyruleno==346); + case 412: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==412); + case 418: /* when_then_list ::= when_then_expr */ yytestcase(yyruleno==418); + case 473: /* select_list ::= select_item */ yytestcase(yyruleno==473); + case 484: /* partition_list ::= partition_item */ yytestcase(yyruleno==484); + case 537: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==537); { yylhsminor.yy601 = createNodeList(pCxt, yymsp[0].minor.yy600); } yymsp[0].minor.yy601 = yylhsminor.yy601; break; @@ -4722,12 +4147,12 @@ static YYACTIONTYPE yy_reduce( case 200: /* rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ yytestcase(yyruleno==200); case 205: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==205); case 254: /* tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ yytestcase(yyruleno==254); - case 265: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==265); - case 346: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==346); - case 412: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==412); - case 473: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==473); - case 484: /* partition_list ::= partition_list NK_COMMA partition_item */ yytestcase(yyruleno==484); - case 537: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==537); + case 266: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==266); + case 347: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==347); + case 413: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==413); + case 474: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==474); + case 485: /* partition_list ::= partition_list NK_COMMA partition_item */ yytestcase(yyruleno==485); + case 538: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==538); { yylhsminor.yy601 = addNodeToList(pCxt, yymsp[-2].minor.yy601, yymsp[0].minor.yy600); } yymsp[-2].minor.yy601 = yylhsminor.yy601; break; @@ -4736,11 +4161,11 @@ static YYACTIONTYPE yy_reduce( yymsp[-2].minor.yy600 = yylhsminor.yy600; break; case 126: /* speed_opt ::= */ - case 296: /* bufsize_opt ::= */ yytestcase(yyruleno==296); + case 297: /* bufsize_opt ::= */ yytestcase(yyruleno==297); { yymsp[1].minor.yy248 = 0; } break; case 127: /* speed_opt ::= MAX_SPEED NK_INTEGER */ - case 297: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ yytestcase(yyruleno==297); + case 298: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ yytestcase(yyruleno==298); { yymsp[-1].minor.yy248 = 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 */ @@ -4757,7 +4182,7 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy841, yymsp[0].minor.yy600); } break; case 133: /* cmd ::= ALTER TABLE alter_table_clause */ - case 319: /* cmd ::= query_or_subquery */ yytestcase(yyruleno==319); + case 320: /* cmd ::= query_or_subquery */ yytestcase(yyruleno==320); { pCxt->pRootNode = yymsp[0].minor.yy600; } break; case 134: /* cmd ::= ALTER STABLE alter_table_clause */ @@ -4805,7 +4230,7 @@ static YYACTIONTYPE yy_reduce( 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 418: /* when_then_list ::= when_then_list when_then_expr */ yytestcase(yyruleno==418); + case 419: /* when_then_list ::= when_then_list when_then_expr */ yytestcase(yyruleno==419); { yylhsminor.yy601 = addNodeToList(pCxt, yymsp[-1].minor.yy601, yymsp[0].minor.yy600); } yymsp[-1].minor.yy601 = yylhsminor.yy601; break; @@ -4820,9 +4245,9 @@ static YYACTIONTYPE yy_reduce( case 151: /* specific_cols_opt ::= */ case 182: /* tags_def_opt ::= */ yytestcase(yyruleno==182); case 252: /* tag_list_opt ::= */ yytestcase(yyruleno==252); - case 481: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==481); - case 504: /* group_by_clause_opt ::= */ yytestcase(yyruleno==504); - case 523: /* order_by_clause_opt ::= */ yytestcase(yyruleno==523); + case 482: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==482); + case 505: /* group_by_clause_opt ::= */ yytestcase(yyruleno==505); + case 524: /* order_by_clause_opt ::= */ yytestcase(yyruleno==524); { yymsp[1].minor.yy601 = NULL; } break; case 152: /* specific_cols_opt ::= NK_LP col_name_list NK_RP */ @@ -4912,7 +4337,7 @@ static YYACTIONTYPE yy_reduce( { yymsp[-5].minor.yy888 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; case 183: /* tags_def_opt ::= tags_def */ - case 410: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==410); + case 411: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==411); { yylhsminor.yy601 = yymsp[0].minor.yy601; } yymsp[0].minor.yy601 = yylhsminor.yy601; break; @@ -4965,12 +4390,12 @@ static YYACTIONTYPE yy_reduce( { yymsp[-1].minor.yy661.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy661.val = yymsp[0].minor.yy0; } break; case 197: /* duration_list ::= duration_literal */ - case 374: /* expression_list ::= expr_or_subquery */ yytestcase(yyruleno==374); + case 375: /* expression_list ::= expr_or_subquery */ yytestcase(yyruleno==375); { yylhsminor.yy601 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy600)); } yymsp[0].minor.yy601 = yylhsminor.yy601; break; case 198: /* duration_list ::= duration_list NK_COMMA duration_literal */ - case 375: /* expression_list ::= expression_list NK_COMMA expr_or_subquery */ yytestcase(yyruleno==375); + case 376: /* expression_list ::= expression_list NK_COMMA expr_or_subquery */ yytestcase(yyruleno==376); { yylhsminor.yy601 = addNodeToList(pCxt, yymsp[-2].minor.yy601, releaseRawExprNode(pCxt, yymsp[0].minor.yy600)); } yymsp[-2].minor.yy601 = yylhsminor.yy601; break; @@ -5108,18 +4533,18 @@ static YYACTIONTYPE yy_reduce( yymsp[-1].minor.yy600 = yylhsminor.yy600; break; case 247: /* like_pattern_opt ::= */ - case 307: /* subtable_opt ::= */ yytestcase(yyruleno==307); - case 420: /* case_when_else_opt ::= */ yytestcase(yyruleno==420); - case 450: /* from_clause_opt ::= */ yytestcase(yyruleno==450); - case 479: /* where_clause_opt ::= */ yytestcase(yyruleno==479); - case 488: /* twindow_clause_opt ::= */ yytestcase(yyruleno==488); - case 494: /* sliding_opt ::= */ yytestcase(yyruleno==494); - case 496: /* fill_opt ::= */ yytestcase(yyruleno==496); - case 508: /* having_clause_opt ::= */ yytestcase(yyruleno==508); - case 510: /* range_opt ::= */ yytestcase(yyruleno==510); - case 512: /* every_opt ::= */ yytestcase(yyruleno==512); - case 525: /* slimit_clause_opt ::= */ yytestcase(yyruleno==525); - case 529: /* limit_clause_opt ::= */ yytestcase(yyruleno==529); + case 308: /* subtable_opt ::= */ yytestcase(yyruleno==308); + case 421: /* case_when_else_opt ::= */ yytestcase(yyruleno==421); + case 451: /* from_clause_opt ::= */ yytestcase(yyruleno==451); + case 480: /* where_clause_opt ::= */ yytestcase(yyruleno==480); + case 489: /* twindow_clause_opt ::= */ yytestcase(yyruleno==489); + case 495: /* sliding_opt ::= */ yytestcase(yyruleno==495); + case 497: /* fill_opt ::= */ yytestcase(yyruleno==497); + case 509: /* having_clause_opt ::= */ yytestcase(yyruleno==509); + case 511: /* range_opt ::= */ yytestcase(yyruleno==511); + case 513: /* every_opt ::= */ yytestcase(yyruleno==513); + case 526: /* slimit_clause_opt ::= */ yytestcase(yyruleno==526); + case 530: /* limit_clause_opt ::= */ yytestcase(yyruleno==530); { yymsp[1].minor.yy600 = NULL; } break; case 248: /* like_pattern_opt ::= LIKE NK_STRING */ @@ -5147,212 +4572,215 @@ static YYACTIONTYPE yy_reduce( case 260: /* 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.yy841, yymsp[-3].minor.yy600, yymsp[-1].minor.yy600, NULL, yymsp[0].minor.yy600); } break; - case 261: /* cmd ::= DROP INDEX exists_opt full_table_name */ + case 261: /* cmd ::= CREATE INDEX not_exists_opt full_table_name ON full_table_name NK_LP col_name_list NK_RP */ +{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_NORMAL, yymsp[-6].minor.yy841, yymsp[-5].minor.yy600, yymsp[-3].minor.yy600, yymsp[-1].minor.yy601, NULL); } + break; + case 262: /* cmd ::= DROP INDEX exists_opt full_table_name */ { pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy841, yymsp[0].minor.yy600); } break; - case 262: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ + case 263: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ { yymsp[-9].minor.yy600 = createIndexOption(pCxt, yymsp[-7].minor.yy601, releaseRawExprNode(pCxt, yymsp[-3].minor.yy600), NULL, yymsp[-1].minor.yy600, yymsp[0].minor.yy600); } break; - case 263: /* 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 */ + case 264: /* 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.yy600 = createIndexOption(pCxt, yymsp[-9].minor.yy601, releaseRawExprNode(pCxt, yymsp[-5].minor.yy600), releaseRawExprNode(pCxt, yymsp[-3].minor.yy600), yymsp[-1].minor.yy600, yymsp[0].minor.yy600); } break; - case 266: /* func ::= sma_func_name NK_LP expression_list NK_RP */ + case 267: /* func ::= sma_func_name NK_LP expression_list NK_RP */ { yylhsminor.yy600 = createFunctionNode(pCxt, &yymsp[-3].minor.yy77, yymsp[-1].minor.yy601); } yymsp[-3].minor.yy600 = yylhsminor.yy600; break; - case 272: /* sma_stream_opt ::= */ - case 300: /* stream_options ::= */ yytestcase(yyruleno==300); + case 273: /* sma_stream_opt ::= */ + case 301: /* stream_options ::= */ yytestcase(yyruleno==301); { yymsp[1].minor.yy600 = createStreamOptions(pCxt); } break; - case 273: /* sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ - case 304: /* stream_options ::= stream_options WATERMARK duration_literal */ yytestcase(yyruleno==304); + case 274: /* sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ + case 305: /* stream_options ::= stream_options WATERMARK duration_literal */ yytestcase(yyruleno==305); { ((SStreamOptions*)yymsp[-2].minor.yy600)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy600); yylhsminor.yy600 = yymsp[-2].minor.yy600; } yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 274: /* sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ + case 275: /* sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ { ((SStreamOptions*)yymsp[-2].minor.yy600)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy600); yylhsminor.yy600 = yymsp[-2].minor.yy600; } yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 275: /* sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ + case 276: /* sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ { ((SStreamOptions*)yymsp[-2].minor.yy600)->pDeleteMark = releaseRawExprNode(pCxt, yymsp[0].minor.yy600); yylhsminor.yy600 = yymsp[-2].minor.yy600; } yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 276: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ + case 277: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ { pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy841, &yymsp[-2].minor.yy77, yymsp[0].minor.yy600); } break; - case 277: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */ + case 278: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */ { pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy841, &yymsp[-3].minor.yy77, &yymsp[0].minor.yy77, false); } break; - case 278: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */ + case 279: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */ { pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-6].minor.yy841, &yymsp[-5].minor.yy77, &yymsp[0].minor.yy77, true); } break; - case 279: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */ + case 280: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */ { pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-4].minor.yy841, &yymsp[-3].minor.yy77, yymsp[0].minor.yy600, false); } break; - case 280: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */ + case 281: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */ { pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-6].minor.yy841, &yymsp[-5].minor.yy77, yymsp[0].minor.yy600, true); } break; - case 281: /* cmd ::= DROP TOPIC exists_opt topic_name */ + case 282: /* cmd ::= DROP TOPIC exists_opt topic_name */ { pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy841, &yymsp[0].minor.yy77); } break; - case 282: /* cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ + case 283: /* cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ { pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy841, &yymsp[-2].minor.yy77, &yymsp[0].minor.yy77); } break; - case 283: /* cmd ::= DESC full_table_name */ - case 284: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==284); + case 284: /* cmd ::= DESC full_table_name */ + case 285: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==285); { pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy600); } break; - case 285: /* cmd ::= RESET QUERY CACHE */ + case 286: /* cmd ::= RESET QUERY CACHE */ { pCxt->pRootNode = createResetQueryCacheStmt(pCxt); } break; - case 286: /* cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ + case 287: /* cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ { pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy841, yymsp[-1].minor.yy600, yymsp[0].minor.yy600); } break; - case 289: /* explain_options ::= */ + case 290: /* explain_options ::= */ { yymsp[1].minor.yy600 = createDefaultExplainOptions(pCxt); } break; - case 290: /* explain_options ::= explain_options VERBOSE NK_BOOL */ + case 291: /* explain_options ::= explain_options VERBOSE NK_BOOL */ { yylhsminor.yy600 = setExplainVerbose(pCxt, yymsp[-2].minor.yy600, &yymsp[0].minor.yy0); } yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 291: /* explain_options ::= explain_options RATIO NK_FLOAT */ + case 292: /* explain_options ::= explain_options RATIO NK_FLOAT */ { yylhsminor.yy600 = setExplainRatio(pCxt, yymsp[-2].minor.yy600, &yymsp[0].minor.yy0); } yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 292: /* cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */ + case 293: /* 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.yy841, yymsp[-8].minor.yy841, &yymsp[-5].minor.yy77, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy888, yymsp[0].minor.yy248); } break; - case 293: /* cmd ::= DROP FUNCTION exists_opt function_name */ + case 294: /* cmd ::= DROP FUNCTION exists_opt function_name */ { pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy841, &yymsp[0].minor.yy77); } break; - case 298: /* cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name tags_def_opt subtable_opt AS query_or_subquery */ + case 299: /* 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.yy841, &yymsp[-7].minor.yy77, yymsp[-4].minor.yy600, yymsp[-6].minor.yy600, yymsp[-3].minor.yy601, yymsp[-2].minor.yy600, yymsp[0].minor.yy600); } break; - case 299: /* cmd ::= DROP STREAM exists_opt stream_name */ + case 300: /* cmd ::= DROP STREAM exists_opt stream_name */ { pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy841, &yymsp[0].minor.yy77); } break; - case 301: /* stream_options ::= stream_options TRIGGER AT_ONCE */ + case 302: /* stream_options ::= stream_options TRIGGER AT_ONCE */ { ((SStreamOptions*)yymsp[-2].minor.yy600)->triggerType = STREAM_TRIGGER_AT_ONCE; yylhsminor.yy600 = yymsp[-2].minor.yy600; } yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 302: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ + case 303: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ { ((SStreamOptions*)yymsp[-2].minor.yy600)->triggerType = STREAM_TRIGGER_WINDOW_CLOSE; yylhsminor.yy600 = yymsp[-2].minor.yy600; } yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 303: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ + case 304: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ { ((SStreamOptions*)yymsp[-3].minor.yy600)->triggerType = STREAM_TRIGGER_MAX_DELAY; ((SStreamOptions*)yymsp[-3].minor.yy600)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy600); yylhsminor.yy600 = yymsp[-3].minor.yy600; } yymsp[-3].minor.yy600 = yylhsminor.yy600; break; - case 305: /* stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ + case 306: /* stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ { ((SStreamOptions*)yymsp[-3].minor.yy600)->ignoreExpired = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); yylhsminor.yy600 = yymsp[-3].minor.yy600; } yymsp[-3].minor.yy600 = yylhsminor.yy600; break; - case 306: /* stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ + case 307: /* stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ { ((SStreamOptions*)yymsp[-2].minor.yy600)->fillHistory = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); yylhsminor.yy600 = yymsp[-2].minor.yy600; } yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 308: /* subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ - case 495: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ yytestcase(yyruleno==495); - case 513: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==513); + case 309: /* subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ + case 496: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ yytestcase(yyruleno==496); + case 514: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==514); { yymsp[-3].minor.yy600 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy600); } break; - case 309: /* cmd ::= KILL CONNECTION NK_INTEGER */ + case 310: /* cmd ::= KILL CONNECTION NK_INTEGER */ { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_CONNECTION_STMT, &yymsp[0].minor.yy0); } break; - case 310: /* cmd ::= KILL QUERY NK_STRING */ + case 311: /* cmd ::= KILL QUERY NK_STRING */ { pCxt->pRootNode = createKillQueryStmt(pCxt, &yymsp[0].minor.yy0); } break; - case 311: /* cmd ::= KILL TRANSACTION NK_INTEGER */ + case 312: /* cmd ::= KILL TRANSACTION NK_INTEGER */ { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_TRANSACTION_STMT, &yymsp[0].minor.yy0); } break; - case 312: /* cmd ::= BALANCE VGROUP */ + case 313: /* cmd ::= BALANCE VGROUP */ { pCxt->pRootNode = createBalanceVgroupStmt(pCxt); } break; - case 313: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ + case 314: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ { pCxt->pRootNode = createMergeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } break; - case 314: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ + case 315: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ { pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy601); } break; - case 315: /* cmd ::= SPLIT VGROUP NK_INTEGER */ + case 316: /* cmd ::= SPLIT VGROUP NK_INTEGER */ { pCxt->pRootNode = createSplitVgroupStmt(pCxt, &yymsp[0].minor.yy0); } break; - case 316: /* dnode_list ::= DNODE NK_INTEGER */ + case 317: /* dnode_list ::= DNODE NK_INTEGER */ { yymsp[-1].minor.yy601 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } break; - case 318: /* cmd ::= DELETE FROM full_table_name where_clause_opt */ + case 319: /* cmd ::= DELETE FROM full_table_name where_clause_opt */ { pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy600, yymsp[0].minor.yy600); } break; - case 320: /* cmd ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ + case 321: /* cmd ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ { pCxt->pRootNode = createInsertStmt(pCxt, yymsp[-4].minor.yy600, yymsp[-2].minor.yy601, yymsp[0].minor.yy600); } break; - case 321: /* cmd ::= INSERT INTO full_table_name query_or_subquery */ + case 322: /* cmd ::= INSERT INTO full_table_name query_or_subquery */ { pCxt->pRootNode = createInsertStmt(pCxt, yymsp[-1].minor.yy600, NULL, yymsp[0].minor.yy600); } break; - case 322: /* literal ::= NK_INTEGER */ + case 323: /* literal ::= NK_INTEGER */ { yylhsminor.yy600 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0)); } yymsp[0].minor.yy600 = yylhsminor.yy600; break; - case 323: /* literal ::= NK_FLOAT */ + case 324: /* literal ::= NK_FLOAT */ { yylhsminor.yy600 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } yymsp[0].minor.yy600 = yylhsminor.yy600; break; - case 324: /* literal ::= NK_STRING */ + case 325: /* literal ::= NK_STRING */ { yylhsminor.yy600 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } yymsp[0].minor.yy600 = yylhsminor.yy600; break; - case 325: /* literal ::= NK_BOOL */ + case 326: /* literal ::= NK_BOOL */ { yylhsminor.yy600 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } yymsp[0].minor.yy600 = yylhsminor.yy600; break; - case 326: /* literal ::= TIMESTAMP NK_STRING */ + case 327: /* literal ::= TIMESTAMP NK_STRING */ { yylhsminor.yy600 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } yymsp[-1].minor.yy600 = yylhsminor.yy600; break; - case 327: /* literal ::= duration_literal */ - case 337: /* signed_literal ::= signed */ yytestcase(yyruleno==337); - case 357: /* expr_or_subquery ::= expression */ yytestcase(yyruleno==357); - case 358: /* expression ::= literal */ yytestcase(yyruleno==358); - case 359: /* expression ::= pseudo_column */ yytestcase(yyruleno==359); - case 360: /* expression ::= column_reference */ yytestcase(yyruleno==360); - case 361: /* expression ::= function_expression */ yytestcase(yyruleno==361); - case 362: /* expression ::= case_when_expression */ yytestcase(yyruleno==362); - case 393: /* function_expression ::= literal_func */ yytestcase(yyruleno==393); - case 442: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==442); - case 446: /* boolean_primary ::= predicate */ yytestcase(yyruleno==446); - case 448: /* common_expression ::= expr_or_subquery */ yytestcase(yyruleno==448); - case 449: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==449); - case 452: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==452); - case 454: /* table_reference ::= table_primary */ yytestcase(yyruleno==454); - case 455: /* table_reference ::= joined_table */ yytestcase(yyruleno==455); - case 459: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==459); - case 515: /* query_simple ::= query_specification */ yytestcase(yyruleno==515); - case 516: /* query_simple ::= union_query_expression */ yytestcase(yyruleno==516); - case 519: /* query_simple_or_subquery ::= query_simple */ yytestcase(yyruleno==519); - case 521: /* query_or_subquery ::= query_expression */ yytestcase(yyruleno==521); + case 328: /* literal ::= duration_literal */ + case 338: /* signed_literal ::= signed */ yytestcase(yyruleno==338); + case 358: /* expr_or_subquery ::= expression */ yytestcase(yyruleno==358); + case 359: /* expression ::= literal */ yytestcase(yyruleno==359); + case 360: /* expression ::= pseudo_column */ yytestcase(yyruleno==360); + case 361: /* expression ::= column_reference */ yytestcase(yyruleno==361); + case 362: /* expression ::= function_expression */ yytestcase(yyruleno==362); + case 363: /* expression ::= case_when_expression */ yytestcase(yyruleno==363); + case 394: /* function_expression ::= literal_func */ yytestcase(yyruleno==394); + case 443: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==443); + case 447: /* boolean_primary ::= predicate */ yytestcase(yyruleno==447); + case 449: /* common_expression ::= expr_or_subquery */ yytestcase(yyruleno==449); + case 450: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==450); + case 453: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==453); + case 455: /* table_reference ::= table_primary */ yytestcase(yyruleno==455); + case 456: /* table_reference ::= joined_table */ yytestcase(yyruleno==456); + case 460: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==460); + case 516: /* query_simple ::= query_specification */ yytestcase(yyruleno==516); + case 517: /* query_simple ::= union_query_expression */ yytestcase(yyruleno==517); + case 520: /* query_simple_or_subquery ::= query_simple */ yytestcase(yyruleno==520); + case 522: /* query_or_subquery ::= query_expression */ yytestcase(yyruleno==522); { yylhsminor.yy600 = yymsp[0].minor.yy600; } yymsp[0].minor.yy600 = yylhsminor.yy600; break; - case 328: /* literal ::= NULL */ + case 329: /* literal ::= NULL */ { yylhsminor.yy600 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); } yymsp[0].minor.yy600 = yylhsminor.yy600; break; - case 329: /* literal ::= NK_QUESTION */ + case 330: /* literal ::= NK_QUESTION */ { yylhsminor.yy600 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); } yymsp[0].minor.yy600 = yylhsminor.yy600; break; - case 330: /* duration_literal ::= NK_VARIABLE */ + case 331: /* duration_literal ::= NK_VARIABLE */ { yylhsminor.yy600 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } yymsp[0].minor.yy600 = yylhsminor.yy600; break; - case 331: /* signed ::= NK_INTEGER */ + case 332: /* signed ::= NK_INTEGER */ { yylhsminor.yy600 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } yymsp[0].minor.yy600 = yylhsminor.yy600; break; - case 332: /* signed ::= NK_PLUS NK_INTEGER */ + case 333: /* signed ::= NK_PLUS NK_INTEGER */ { yymsp[-1].minor.yy600 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } break; - case 333: /* signed ::= NK_MINUS NK_INTEGER */ + case 334: /* 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; @@ -5360,14 +4788,14 @@ static YYACTIONTYPE yy_reduce( } yymsp[-1].minor.yy600 = yylhsminor.yy600; break; - case 334: /* signed ::= NK_FLOAT */ + case 335: /* signed ::= NK_FLOAT */ { yylhsminor.yy600 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } yymsp[0].minor.yy600 = yylhsminor.yy600; break; - case 335: /* signed ::= NK_PLUS NK_FLOAT */ + case 336: /* signed ::= NK_PLUS NK_FLOAT */ { yymsp[-1].minor.yy600 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } break; - case 336: /* signed ::= NK_MINUS NK_FLOAT */ + case 337: /* 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; @@ -5375,57 +4803,57 @@ static YYACTIONTYPE yy_reduce( } yymsp[-1].minor.yy600 = yylhsminor.yy600; break; - case 338: /* signed_literal ::= NK_STRING */ + case 339: /* signed_literal ::= NK_STRING */ { yylhsminor.yy600 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } yymsp[0].minor.yy600 = yylhsminor.yy600; break; - case 339: /* signed_literal ::= NK_BOOL */ + case 340: /* signed_literal ::= NK_BOOL */ { yylhsminor.yy600 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } yymsp[0].minor.yy600 = yylhsminor.yy600; break; - case 340: /* signed_literal ::= TIMESTAMP NK_STRING */ + case 341: /* signed_literal ::= TIMESTAMP NK_STRING */ { yymsp[-1].minor.yy600 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } break; - case 341: /* signed_literal ::= duration_literal */ - case 343: /* signed_literal ::= literal_func */ yytestcase(yyruleno==343); - case 413: /* star_func_para ::= expr_or_subquery */ yytestcase(yyruleno==413); - case 475: /* select_item ::= common_expression */ yytestcase(yyruleno==475); - case 485: /* partition_item ::= expr_or_subquery */ yytestcase(yyruleno==485); - case 520: /* query_simple_or_subquery ::= subquery */ yytestcase(yyruleno==520); - case 522: /* query_or_subquery ::= subquery */ yytestcase(yyruleno==522); - case 535: /* search_condition ::= common_expression */ yytestcase(yyruleno==535); + case 342: /* signed_literal ::= duration_literal */ + case 344: /* signed_literal ::= literal_func */ yytestcase(yyruleno==344); + case 414: /* star_func_para ::= expr_or_subquery */ yytestcase(yyruleno==414); + case 476: /* select_item ::= common_expression */ yytestcase(yyruleno==476); + case 486: /* partition_item ::= expr_or_subquery */ yytestcase(yyruleno==486); + case 521: /* query_simple_or_subquery ::= subquery */ yytestcase(yyruleno==521); + case 523: /* query_or_subquery ::= subquery */ yytestcase(yyruleno==523); + case 536: /* search_condition ::= common_expression */ yytestcase(yyruleno==536); { yylhsminor.yy600 = releaseRawExprNode(pCxt, yymsp[0].minor.yy600); } yymsp[0].minor.yy600 = yylhsminor.yy600; break; - case 342: /* signed_literal ::= NULL */ + case 343: /* signed_literal ::= NULL */ { yylhsminor.yy600 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); } yymsp[0].minor.yy600 = yylhsminor.yy600; break; - case 344: /* signed_literal ::= NK_QUESTION */ + case 345: /* signed_literal ::= NK_QUESTION */ { yylhsminor.yy600 = createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0); } yymsp[0].minor.yy600 = yylhsminor.yy600; break; - case 363: /* expression ::= NK_LP expression NK_RP */ - case 447: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==447); - case 534: /* subquery ::= NK_LP subquery NK_RP */ yytestcase(yyruleno==534); + case 364: /* expression ::= NK_LP expression NK_RP */ + case 448: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==448); + case 535: /* subquery ::= NK_LP subquery NK_RP */ yytestcase(yyruleno==535); { yylhsminor.yy600 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy600)); } yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 364: /* expression ::= NK_PLUS expr_or_subquery */ + case 365: /* expression ::= NK_PLUS expr_or_subquery */ { SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy600); yylhsminor.yy600 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy600)); } yymsp[-1].minor.yy600 = yylhsminor.yy600; break; - case 365: /* expression ::= NK_MINUS expr_or_subquery */ + case 366: /* expression ::= NK_MINUS expr_or_subquery */ { SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy600); yylhsminor.yy600 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy600), NULL)); } yymsp[-1].minor.yy600 = yylhsminor.yy600; break; - case 366: /* expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ + case 367: /* expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy600); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy600); @@ -5433,7 +4861,7 @@ static YYACTIONTYPE yy_reduce( } yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 367: /* expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ + case 368: /* expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy600); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy600); @@ -5441,7 +4869,7 @@ static YYACTIONTYPE yy_reduce( } yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 368: /* expression ::= expr_or_subquery NK_STAR expr_or_subquery */ + case 369: /* expression ::= expr_or_subquery NK_STAR expr_or_subquery */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy600); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy600); @@ -5449,7 +4877,7 @@ static YYACTIONTYPE yy_reduce( } yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 369: /* expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ + case 370: /* expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy600); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy600); @@ -5457,7 +4885,7 @@ static YYACTIONTYPE yy_reduce( } yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 370: /* expression ::= expr_or_subquery NK_REM expr_or_subquery */ + case 371: /* expression ::= expr_or_subquery NK_REM expr_or_subquery */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy600); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy600); @@ -5465,14 +4893,14 @@ static YYACTIONTYPE yy_reduce( } yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 371: /* expression ::= column_reference NK_ARROW NK_STRING */ + case 372: /* expression ::= column_reference NK_ARROW NK_STRING */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy600); yylhsminor.yy600 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy600), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0))); } yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 372: /* expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ + case 373: /* expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy600); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy600); @@ -5480,7 +4908,7 @@ static YYACTIONTYPE yy_reduce( } yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 373: /* expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ + case 374: /* expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy600); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy600); @@ -5488,71 +4916,71 @@ static YYACTIONTYPE yy_reduce( } yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 376: /* column_reference ::= column_name */ + case 377: /* column_reference ::= column_name */ { yylhsminor.yy600 = createRawExprNode(pCxt, &yymsp[0].minor.yy77, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy77)); } yymsp[0].minor.yy600 = yylhsminor.yy600; break; - case 377: /* column_reference ::= table_name NK_DOT column_name */ + case 378: /* column_reference ::= table_name NK_DOT column_name */ { yylhsminor.yy600 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy77, &yymsp[0].minor.yy77, createColumnNode(pCxt, &yymsp[-2].minor.yy77, &yymsp[0].minor.yy77)); } yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 378: /* pseudo_column ::= ROWTS */ - case 379: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==379); - case 381: /* pseudo_column ::= QSTART */ yytestcase(yyruleno==381); - case 382: /* pseudo_column ::= QEND */ yytestcase(yyruleno==382); - case 383: /* pseudo_column ::= QDURATION */ yytestcase(yyruleno==383); - case 384: /* pseudo_column ::= WSTART */ yytestcase(yyruleno==384); - case 385: /* pseudo_column ::= WEND */ yytestcase(yyruleno==385); - case 386: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==386); - case 387: /* pseudo_column ::= IROWTS */ yytestcase(yyruleno==387); - case 388: /* pseudo_column ::= ISFILLED */ yytestcase(yyruleno==388); - case 389: /* pseudo_column ::= QTAGS */ yytestcase(yyruleno==389); - case 395: /* literal_func ::= NOW */ yytestcase(yyruleno==395); + case 379: /* pseudo_column ::= ROWTS */ + case 380: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==380); + case 382: /* pseudo_column ::= QSTART */ yytestcase(yyruleno==382); + case 383: /* pseudo_column ::= QEND */ yytestcase(yyruleno==383); + case 384: /* pseudo_column ::= QDURATION */ yytestcase(yyruleno==384); + case 385: /* pseudo_column ::= WSTART */ yytestcase(yyruleno==385); + case 386: /* pseudo_column ::= WEND */ yytestcase(yyruleno==386); + case 387: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==387); + case 388: /* pseudo_column ::= IROWTS */ yytestcase(yyruleno==388); + case 389: /* pseudo_column ::= ISFILLED */ yytestcase(yyruleno==389); + case 390: /* pseudo_column ::= QTAGS */ yytestcase(yyruleno==390); + case 396: /* literal_func ::= NOW */ yytestcase(yyruleno==396); { yylhsminor.yy600 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } yymsp[0].minor.yy600 = yylhsminor.yy600; break; - case 380: /* pseudo_column ::= table_name NK_DOT TBNAME */ + case 381: /* pseudo_column ::= table_name NK_DOT TBNAME */ { yylhsminor.yy600 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy77, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy77)))); } yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 390: /* function_expression ::= function_name NK_LP expression_list NK_RP */ - case 391: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==391); + case 391: /* function_expression ::= function_name NK_LP expression_list NK_RP */ + case 392: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==392); { yylhsminor.yy600 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy77, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy77, yymsp[-1].minor.yy601)); } yymsp[-3].minor.yy600 = yylhsminor.yy600; break; - case 392: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ + case 393: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ { yylhsminor.yy600 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy600), yymsp[-1].minor.yy888)); } yymsp[-5].minor.yy600 = yylhsminor.yy600; break; - case 394: /* literal_func ::= noarg_func NK_LP NK_RP */ + case 395: /* literal_func ::= noarg_func NK_LP NK_RP */ { yylhsminor.yy600 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy77, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy77, NULL)); } yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 409: /* star_func_para_list ::= NK_STAR */ + case 410: /* star_func_para_list ::= NK_STAR */ { yylhsminor.yy601 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } yymsp[0].minor.yy601 = yylhsminor.yy601; break; - case 414: /* star_func_para ::= table_name NK_DOT NK_STAR */ - case 478: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==478); + case 415: /* star_func_para ::= table_name NK_DOT NK_STAR */ + case 479: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==479); { yylhsminor.yy600 = createColumnNode(pCxt, &yymsp[-2].minor.yy77, &yymsp[0].minor.yy0); } yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 415: /* case_when_expression ::= CASE when_then_list case_when_else_opt END */ + case 416: /* case_when_expression ::= CASE when_then_list case_when_else_opt END */ { yylhsminor.yy600 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, NULL, yymsp[-2].minor.yy601, yymsp[-1].minor.yy600)); } yymsp[-3].minor.yy600 = yylhsminor.yy600; break; - case 416: /* case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ + case 417: /* case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ { yylhsminor.yy600 = createRawExprNodeExt(pCxt, &yymsp[-4].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy600), yymsp[-2].minor.yy601, yymsp[-1].minor.yy600)); } yymsp[-4].minor.yy600 = yylhsminor.yy600; break; - case 419: /* when_then_expr ::= WHEN common_expression THEN common_expression */ + case 420: /* when_then_expr ::= WHEN common_expression THEN common_expression */ { yymsp[-3].minor.yy600 = createWhenThenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy600), releaseRawExprNode(pCxt, yymsp[0].minor.yy600)); } break; - case 421: /* case_when_else_opt ::= ELSE common_expression */ + case 422: /* case_when_else_opt ::= ELSE common_expression */ { yymsp[-1].minor.yy600 = releaseRawExprNode(pCxt, yymsp[0].minor.yy600); } break; - case 422: /* predicate ::= expr_or_subquery compare_op expr_or_subquery */ - case 427: /* predicate ::= expr_or_subquery in_op in_predicate_value */ yytestcase(yyruleno==427); + case 423: /* predicate ::= expr_or_subquery compare_op expr_or_subquery */ + case 428: /* predicate ::= expr_or_subquery in_op in_predicate_value */ yytestcase(yyruleno==428); { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy600); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy600); @@ -5560,7 +4988,7 @@ static YYACTIONTYPE yy_reduce( } yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 423: /* predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ + case 424: /* predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy600); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy600); @@ -5568,7 +4996,7 @@ static YYACTIONTYPE yy_reduce( } yymsp[-4].minor.yy600 = yylhsminor.yy600; break; - case 424: /* predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ + case 425: /* predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy600); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy600); @@ -5576,71 +5004,71 @@ static YYACTIONTYPE yy_reduce( } yymsp[-5].minor.yy600 = yylhsminor.yy600; break; - case 425: /* predicate ::= expr_or_subquery IS NULL */ + case 426: /* predicate ::= expr_or_subquery IS NULL */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy600); yylhsminor.yy600 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy600), NULL)); } yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 426: /* predicate ::= expr_or_subquery IS NOT NULL */ + case 427: /* predicate ::= expr_or_subquery IS NOT NULL */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy600); yylhsminor.yy600 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy600), NULL)); } yymsp[-3].minor.yy600 = yylhsminor.yy600; break; - case 428: /* compare_op ::= NK_LT */ + case 429: /* compare_op ::= NK_LT */ { yymsp[0].minor.yy666 = OP_TYPE_LOWER_THAN; } break; - case 429: /* compare_op ::= NK_GT */ + case 430: /* compare_op ::= NK_GT */ { yymsp[0].minor.yy666 = OP_TYPE_GREATER_THAN; } break; - case 430: /* compare_op ::= NK_LE */ + case 431: /* compare_op ::= NK_LE */ { yymsp[0].minor.yy666 = OP_TYPE_LOWER_EQUAL; } break; - case 431: /* compare_op ::= NK_GE */ + case 432: /* compare_op ::= NK_GE */ { yymsp[0].minor.yy666 = OP_TYPE_GREATER_EQUAL; } break; - case 432: /* compare_op ::= NK_NE */ + case 433: /* compare_op ::= NK_NE */ { yymsp[0].minor.yy666 = OP_TYPE_NOT_EQUAL; } break; - case 433: /* compare_op ::= NK_EQ */ + case 434: /* compare_op ::= NK_EQ */ { yymsp[0].minor.yy666 = OP_TYPE_EQUAL; } break; - case 434: /* compare_op ::= LIKE */ + case 435: /* compare_op ::= LIKE */ { yymsp[0].minor.yy666 = OP_TYPE_LIKE; } break; - case 435: /* compare_op ::= NOT LIKE */ + case 436: /* compare_op ::= NOT LIKE */ { yymsp[-1].minor.yy666 = OP_TYPE_NOT_LIKE; } break; - case 436: /* compare_op ::= MATCH */ + case 437: /* compare_op ::= MATCH */ { yymsp[0].minor.yy666 = OP_TYPE_MATCH; } break; - case 437: /* compare_op ::= NMATCH */ + case 438: /* compare_op ::= NMATCH */ { yymsp[0].minor.yy666 = OP_TYPE_NMATCH; } break; - case 438: /* compare_op ::= CONTAINS */ + case 439: /* compare_op ::= CONTAINS */ { yymsp[0].minor.yy666 = OP_TYPE_JSON_CONTAINS; } break; - case 439: /* in_op ::= IN */ + case 440: /* in_op ::= IN */ { yymsp[0].minor.yy666 = OP_TYPE_IN; } break; - case 440: /* in_op ::= NOT IN */ + case 441: /* in_op ::= NOT IN */ { yymsp[-1].minor.yy666 = OP_TYPE_NOT_IN; } break; - case 441: /* in_predicate_value ::= NK_LP literal_list NK_RP */ + case 442: /* in_predicate_value ::= NK_LP literal_list NK_RP */ { yylhsminor.yy600 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy601)); } yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 443: /* boolean_value_expression ::= NOT boolean_primary */ + case 444: /* boolean_value_expression ::= NOT boolean_primary */ { SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy600); yylhsminor.yy600 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy600), NULL)); } yymsp[-1].minor.yy600 = yylhsminor.yy600; break; - case 444: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + case 445: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy600); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy600); @@ -5648,7 +5076,7 @@ static YYACTIONTYPE yy_reduce( } yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 445: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + case 446: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy600); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy600); @@ -5656,48 +5084,48 @@ static YYACTIONTYPE yy_reduce( } yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 451: /* from_clause_opt ::= FROM table_reference_list */ - case 480: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==480); - case 509: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==509); + case 452: /* from_clause_opt ::= FROM table_reference_list */ + case 481: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==481); + case 510: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==510); { yymsp[-1].minor.yy600 = yymsp[0].minor.yy600; } break; - case 453: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ + case 454: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ { yylhsminor.yy600 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy600, yymsp[0].minor.yy600, NULL); } yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 456: /* table_primary ::= table_name alias_opt */ + case 457: /* table_primary ::= table_name alias_opt */ { yylhsminor.yy600 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy77, &yymsp[0].minor.yy77); } yymsp[-1].minor.yy600 = yylhsminor.yy600; break; - case 457: /* table_primary ::= db_name NK_DOT table_name alias_opt */ + case 458: /* table_primary ::= db_name NK_DOT table_name alias_opt */ { yylhsminor.yy600 = createRealTableNode(pCxt, &yymsp[-3].minor.yy77, &yymsp[-1].minor.yy77, &yymsp[0].minor.yy77); } yymsp[-3].minor.yy600 = yylhsminor.yy600; break; - case 458: /* table_primary ::= subquery alias_opt */ + case 459: /* table_primary ::= subquery alias_opt */ { yylhsminor.yy600 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy600), &yymsp[0].minor.yy77); } yymsp[-1].minor.yy600 = yylhsminor.yy600; break; - case 460: /* alias_opt ::= */ + case 461: /* alias_opt ::= */ { yymsp[1].minor.yy77 = nil_token; } break; - case 462: /* alias_opt ::= AS table_alias */ + case 463: /* alias_opt ::= AS table_alias */ { yymsp[-1].minor.yy77 = yymsp[0].minor.yy77; } break; - case 463: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - case 464: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==464); + case 464: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + case 465: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==465); { yymsp[-2].minor.yy600 = yymsp[-1].minor.yy600; } break; - case 465: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ + case 466: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ { yylhsminor.yy600 = createJoinTableNode(pCxt, yymsp[-4].minor.yy560, yymsp[-5].minor.yy600, yymsp[-2].minor.yy600, yymsp[0].minor.yy600); } yymsp[-5].minor.yy600 = yylhsminor.yy600; break; - case 466: /* join_type ::= */ + case 467: /* join_type ::= */ { yymsp[1].minor.yy560 = JOIN_TYPE_INNER; } break; - case 467: /* join_type ::= INNER */ + case 468: /* join_type ::= INNER */ { yymsp[0].minor.yy560 = JOIN_TYPE_INNER; } break; - case 468: /* 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 469: /* 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.yy600 = createSelectStmt(pCxt, yymsp[-10].minor.yy841, yymsp[-9].minor.yy601, yymsp[-8].minor.yy600); yymsp[-11].minor.yy600 = addWhereClause(pCxt, yymsp[-11].minor.yy600, yymsp[-7].minor.yy600); @@ -5710,76 +5138,76 @@ static YYACTIONTYPE yy_reduce( yymsp[-11].minor.yy600 = addFillClause(pCxt, yymsp[-11].minor.yy600, yymsp[-3].minor.yy600); } break; - case 471: /* set_quantifier_opt ::= ALL */ + case 472: /* set_quantifier_opt ::= ALL */ { yymsp[0].minor.yy841 = false; } break; - case 474: /* select_item ::= NK_STAR */ + case 475: /* select_item ::= NK_STAR */ { yylhsminor.yy600 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); } yymsp[0].minor.yy600 = yylhsminor.yy600; break; - case 476: /* select_item ::= common_expression column_alias */ - case 486: /* partition_item ::= expr_or_subquery column_alias */ yytestcase(yyruleno==486); + case 477: /* select_item ::= common_expression column_alias */ + case 487: /* partition_item ::= expr_or_subquery column_alias */ yytestcase(yyruleno==487); { yylhsminor.yy600 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy600), &yymsp[0].minor.yy77); } yymsp[-1].minor.yy600 = yylhsminor.yy600; break; - case 477: /* select_item ::= common_expression AS column_alias */ - case 487: /* partition_item ::= expr_or_subquery AS column_alias */ yytestcase(yyruleno==487); + case 478: /* select_item ::= common_expression AS column_alias */ + case 488: /* partition_item ::= expr_or_subquery AS column_alias */ yytestcase(yyruleno==488); { yylhsminor.yy600 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy600), &yymsp[0].minor.yy77); } yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 482: /* partition_by_clause_opt ::= PARTITION BY partition_list */ - case 505: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==505); - case 524: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==524); + case 483: /* partition_by_clause_opt ::= PARTITION BY partition_list */ + case 506: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==506); + case 525: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==525); { yymsp[-2].minor.yy601 = yymsp[0].minor.yy601; } break; - case 489: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ + case 490: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ { yymsp[-5].minor.yy600 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy600), releaseRawExprNode(pCxt, yymsp[-1].minor.yy600)); } break; - case 490: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ + case 491: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ { yymsp[-3].minor.yy600 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy600)); } break; - case 491: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ + case 492: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ { yymsp[-5].minor.yy600 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy600), NULL, yymsp[-1].minor.yy600, yymsp[0].minor.yy600); } break; - case 492: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ + case 493: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ { yymsp[-7].minor.yy600 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy600), releaseRawExprNode(pCxt, yymsp[-3].minor.yy600), yymsp[-1].minor.yy600, yymsp[0].minor.yy600); } break; - case 493: /* twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ + case 494: /* twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ { yymsp[-6].minor.yy600 = createEventWindowNode(pCxt, yymsp[-3].minor.yy600, yymsp[0].minor.yy600); } break; - case 497: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ + case 498: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ { yymsp[-3].minor.yy600 = createFillNode(pCxt, yymsp[-1].minor.yy798, NULL); } break; - case 498: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ + case 499: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ { yymsp[-5].minor.yy600 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy601)); } break; - case 499: /* fill_mode ::= NONE */ + case 500: /* fill_mode ::= NONE */ { yymsp[0].minor.yy798 = FILL_MODE_NONE; } break; - case 500: /* fill_mode ::= PREV */ + case 501: /* fill_mode ::= PREV */ { yymsp[0].minor.yy798 = FILL_MODE_PREV; } break; - case 501: /* fill_mode ::= NULL */ + case 502: /* fill_mode ::= NULL */ { yymsp[0].minor.yy798 = FILL_MODE_NULL; } break; - case 502: /* fill_mode ::= LINEAR */ + case 503: /* fill_mode ::= LINEAR */ { yymsp[0].minor.yy798 = FILL_MODE_LINEAR; } break; - case 503: /* fill_mode ::= NEXT */ + case 504: /* fill_mode ::= NEXT */ { yymsp[0].minor.yy798 = FILL_MODE_NEXT; } break; - case 506: /* group_by_list ::= expr_or_subquery */ + case 507: /* group_by_list ::= expr_or_subquery */ { yylhsminor.yy601 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy600))); } yymsp[0].minor.yy601 = yylhsminor.yy601; break; - case 507: /* group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ + case 508: /* group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ { yylhsminor.yy601 = addNodeToList(pCxt, yymsp[-2].minor.yy601, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy600))); } yymsp[-2].minor.yy601 = yylhsminor.yy601; break; - case 511: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ + case 512: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ { yymsp[-5].minor.yy600 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy600), releaseRawExprNode(pCxt, yymsp[-1].minor.yy600)); } break; - case 514: /* query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ + case 515: /* query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ { yylhsminor.yy600 = addOrderByClause(pCxt, yymsp[-3].minor.yy600, yymsp[-2].minor.yy601); yylhsminor.yy600 = addSlimitClause(pCxt, yylhsminor.yy600, yymsp[-1].minor.yy600); @@ -5787,59 +5215,59 @@ static YYACTIONTYPE yy_reduce( } yymsp[-3].minor.yy600 = yylhsminor.yy600; break; - case 517: /* union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ + case 518: /* union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ { yylhsminor.yy600 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy600, yymsp[0].minor.yy600); } yymsp[-3].minor.yy600 = yylhsminor.yy600; break; - case 518: /* union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ + case 519: /* union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ { yylhsminor.yy600 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy600, yymsp[0].minor.yy600); } yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 526: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ - case 530: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==530); + case 527: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ + case 531: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==531); { yymsp[-1].minor.yy600 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } break; - case 527: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - case 531: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==531); + case 528: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + case 532: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==532); { yymsp[-3].minor.yy600 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } break; - case 528: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - case 532: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==532); + case 529: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + case 533: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==533); { yymsp[-3].minor.yy600 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } break; - case 533: /* subquery ::= NK_LP query_expression NK_RP */ + case 534: /* subquery ::= NK_LP query_expression NK_RP */ { yylhsminor.yy600 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy600); } yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 538: /* sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ + case 539: /* sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ { yylhsminor.yy600 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy600), yymsp[-1].minor.yy32, yymsp[0].minor.yy385); } yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 539: /* ordering_specification_opt ::= */ + case 540: /* ordering_specification_opt ::= */ { yymsp[1].minor.yy32 = ORDER_ASC; } break; - case 540: /* ordering_specification_opt ::= ASC */ + case 541: /* ordering_specification_opt ::= ASC */ { yymsp[0].minor.yy32 = ORDER_ASC; } break; - case 541: /* ordering_specification_opt ::= DESC */ + case 542: /* ordering_specification_opt ::= DESC */ { yymsp[0].minor.yy32 = ORDER_DESC; } break; - case 542: /* null_ordering_opt ::= */ + case 543: /* null_ordering_opt ::= */ { yymsp[1].minor.yy385 = NULL_ORDER_DEFAULT; } break; - case 543: /* null_ordering_opt ::= NULLS FIRST */ + case 544: /* null_ordering_opt ::= NULLS FIRST */ { yymsp[-1].minor.yy385 = NULL_ORDER_FIRST; } break; - case 544: /* null_ordering_opt ::= NULLS LAST */ + case 545: /* null_ordering_opt ::= NULLS LAST */ { yymsp[-1].minor.yy385 = NULL_ORDER_LAST; } break; default: break; /********** End reduce actions ************************************************/ }; - assert( yyruleno Date: Wed, 28 Dec 2022 10:49:38 +0800 Subject: [PATCH 56/63] enh: delete useless code --- source/libs/parser/inc/parInsertUtil.h | 117 +--- source/libs/parser/src/parInsertSml.c | 2 +- source/libs/parser/src/parInsertSql.c | 6 +- source/libs/parser/src/parInsertUtil.c | 811 +------------------------ 4 files changed, 14 insertions(+), 922 deletions(-) diff --git a/source/libs/parser/inc/parInsertUtil.h b/source/libs/parser/inc/parInsertUtil.h index 86d98c5515..7b816359f9 100644 --- a/source/libs/parser/inc/parInsertUtil.h +++ b/source/libs/parser/inc/parInsertUtil.h @@ -35,128 +35,27 @@ struct SToken; } \ } while (0) -#define IS_DATA_COL_ORDERED(spd) ((spd->orderStatus) == (int8_t)ORDER_STATUS_ORDERED) - -typedef enum EOrderStatus { - ORDER_STATUS_UNKNOWN = 0, - ORDER_STATUS_ORDERED = 1, - ORDER_STATUS_DISORDERED = 2, -} EOrderStatus; - -typedef enum EValStat { - VAL_STAT_HAS = 0x0, // 0 means has val - VAL_STAT_NONE = 0x01, // 1 means no val -} EValStat; - -typedef struct SBoundColumn { - int32_t offset; // all column offset value - int32_t toffset; // first part offset for SDataRow TODO: get offset from STSchema on future - uint8_t valStat; // EValStat. denote if current column bound or not(0 means has val, 1 means no val) -} SBoundColumn; - -typedef struct { - col_id_t schemaColIdx; - col_id_t boundIdx; - col_id_t finalIdx; -} SBoundIdxInfo; - -typedef struct SParsedDataColInfo { - col_id_t numOfCols; - col_id_t numOfBound; - uint16_t flen; // TODO: get from STSchema - uint16_t allNullLen; // TODO: get from STSchema(base on SDataRow) - uint16_t extendedVarLen; - uint16_t boundNullLen; // bound column len with all NULL value(without VarDataOffsetT/SColIdx part) - col_id_t *boundColumns; // bound column idx according to schema - SBoundColumn *cols; - SBoundIdxInfo *colIdxInfo; - int8_t orderStatus; // bound columns -} SParsedDataColInfo; - -typedef struct SInsertParseBaseContext { - SParseContext *pComCxt; - char *pSql; - SMsgBuf msg; -} SInsertParseBaseContext; - -typedef struct SInsertParseSyntaxCxt { - SParseContext *pComCxt; - char *pSql; - SMsgBuf msg; - SParseMetaCache *pMetaCache; -} SInsertParseSyntaxCxt; - -typedef struct SMemParam { - SRowBuilder *rb; - SSchema *schema; - int32_t toffset; - col_id_t colIdx; -} SMemParam; - -typedef struct { - uint8_t rowType; // default is 0, that is SDataRow - int32_t rowSize; -} SMemRowBuilder; - -typedef struct STableDataBlocks { - int8_t tsSource; // where does the UNIX timestamp come from, server or client - bool ordered; // if current rows are ordered or not - int32_t vgId; // virtual group id - int64_t prevTS; // previous timestamp, recorded to decide if the records array is ts ascending - int32_t numOfTables; // number of tables in current submit block - int32_t rowSize; // row size for current table - uint32_t nAllocSize; - uint32_t headerSize; // header for table info (uid, tid, submit metadata) - uint32_t size; - STableMeta *pTableMeta; // the tableMeta of current table, the table meta will be used during submit, keep a ref to - // avoid to be removed from cache - char *pData; - bool cloned; - int32_t createTbReqLen; - SParsedDataColInfo boundColumnInfo; - SRowBuilder rowBuilder; -} STableDataBlocks; - -int32_t insGetExtendedRowSize(STableDataBlocks *pBlock); -void insGetSTSRowAppendInfo(uint8_t rowType, SParsedDataColInfo *spd, col_id_t idx, int32_t *toffset, col_id_t *colIdx); -int32_t insSetBlockInfo(SSubmitBlk *pBlocks, STableDataBlocks *dataBuf, int32_t numOfRows, SMsgBuf *pMsg); -int32_t insSchemaIdxCompar(const void *lhs, const void *rhs); -int32_t insBoundIdxCompar(const void *lhs, const void *rhs); -void insSetBoundColumnInfo(SParsedDataColInfo *pColList, SSchema *pSchema, col_id_t numOfCols); -void insDestroyBlockArrayList(SArray *pDataBlockList); -void insDestroyBlockHashmap(SHashObj *pDataBlockHash); -int32_t insInitRowBuilder(SRowBuilder *pBuilder, int16_t schemaVer, SParsedDataColInfo *pColInfo); -int32_t insGetDataBlockFromList(SHashObj *pHashList, void *id, int32_t idLen, int32_t size, int32_t startOffset, - int32_t rowSize, STableMeta *pTableMeta, STableDataBlocks **dataBlocks, - SArray *pBlockList, SVCreateTbReq *pCreateTbReq); -int32_t insMergeTableDataBlocks(SHashObj *pHashObj, SArray **pVgDataBlocks); -int32_t insBuildCreateTbMsg(STableDataBlocks *pBlocks, SVCreateTbReq *pCreateTbReq); -int32_t insAllocateMemForSize(STableDataBlocks *pDataBlock, int32_t allSize); -int32_t insCreateSName(SName *pName, struct SToken *pTableName, int32_t acctId, const char *dbName, SMsgBuf *pMsgBuf); -int16_t insFindCol(struct SToken *pColname, int16_t start, int16_t end, SSchema *pSchema); -void insBuildCreateTbReq(SVCreateTbReq *pTbReq, const char *tname, STag *pTag, int64_t suid, const char *sname, - SArray *tagName, uint8_t tagNum, int32_t ttl); -int32_t insMemRowAppend(SMsgBuf *pMsgBuf, const void *value, int32_t len, void *param); -int32_t insCheckTimestamp(STableDataBlocks *pDataBlocks, const char *start); -int32_t insBuildOutput(SHashObj *pVgroupsHashObj, SArray *pVgDataBlocks, SArray **pDataBlocks); -void insDestroyDataBlock(STableDataBlocks *pDataBlock); - typedef struct SVgroupDataCxt { int32_t vgId; SSubmitReq2 *pData; } SVgroupDataCxt; +int32_t insCreateSName(SName *pName, struct SToken *pTableName, int32_t acctId, const char *dbName, SMsgBuf *pMsgBuf); +int16_t insFindCol(struct SToken *pColname, int16_t start, int16_t end, SSchema *pSchema); +void insBuildCreateTbReq(SVCreateTbReq *pTbReq, const char *tname, STag *pTag, int64_t suid, const char *sname, + SArray *tagName, uint8_t tagNum, int32_t ttl); int32_t insInitBoundColsInfo(int32_t numOfBound, SBoundColInfo *pInfo); void insCheckTableDataOrder(STableDataCxt *pTableCxt, TSKEY tsKey); int32_t insGetTableDataCxt(SHashObj *pHash, void *id, int32_t idLen, STableMeta *pTableMeta, SVCreateTbReq **pCreateTbReq, STableDataCxt **pTableCxt, bool colMode); -int32_t initTableColSubmitData(STableDataCxt* pTableCxt); +int32_t initTableColSubmitData(STableDataCxt *pTableCxt); int32_t insMergeTableDataCxt(SHashObj *pTableHash, SArray **pVgDataBlocks); int32_t insBuildVgDataBlocks(SHashObj *pVgroupsHashObj, SArray *pVgDataBlocks, SArray **pDataBlocks); void insDestroyTableDataCxtHashMap(SHashObj *pTableCxtHash); void insDestroyVgroupDataCxt(SVgroupDataCxt *pVgCxt); void insDestroyVgroupDataCxtList(SArray *pVgCxtList); void insDestroyVgroupDataCxtHashMap(SHashObj *pVgCxtHash); -void insDestroyTableDataCxt(STableDataCxt* pTableCxt); -void destroyBoundColInfo(SBoundColInfo* pInfo); +void insDestroyTableDataCxt(STableDataCxt *pTableCxt); +void insDestroyBoundColInfo(SBoundColInfo *pInfo); + #endif // TDENGINE_PAR_INSERT_UTIL_H diff --git a/source/libs/parser/src/parInsertSml.c b/source/libs/parser/src/parInsertSml.c index 0bb6d90fa9..b5baa54f77 100644 --- a/source/libs/parser/src/parInsertSml.c +++ b/source/libs/parser/src/parInsertSml.c @@ -348,7 +348,7 @@ int32_t smlBindData(SQuery* query, bool dataFormat, SArray* tags, SArray* colsSc } end: - destroyBoundColInfo(&bindTags); + insDestroyBoundColInfo(&bindTags); taosMemoryFree(pCreateTblReq); taosArrayDestroy(tagName); return ret; diff --git a/source/libs/parser/src/parInsertSql.c b/source/libs/parser/src/parInsertSql.c index 20a9770c5f..582bb466d2 100644 --- a/source/libs/parser/src/parInsertSql.c +++ b/source/libs/parser/src/parInsertSql.c @@ -1466,7 +1466,7 @@ static int32_t parseInsertTableClauseBottom(SInsertParseContext* pCxt, SVnodeMod } static void resetEnvPreTable(SInsertParseContext* pCxt, SVnodeModifyOpStmt* pStmt) { - destroyBoundColInfo(&pCxt->tags); + insDestroyBoundColInfo(&pCxt->tags); taosMemoryFreeClear(pStmt->pTableMeta); tdDestroySVCreateTbReq(pStmt->pCreateTblReq); taosMemoryFreeClear(pStmt->pCreateTblReq); @@ -1527,7 +1527,7 @@ static int32_t checkTableClauseFirstToken(SInsertParseContext* pCxt, SVnodeModif } static int32_t setStmtInfo(SInsertParseContext* pCxt, SVnodeModifyOpStmt* pStmt) { - SParsedDataColInfo* tags = taosMemoryMalloc(sizeof(pCxt->tags)); + SBoundColInfo* tags = taosMemoryMalloc(sizeof(pCxt->tags)); if (NULL == tags) { return TSDB_CODE_OUT_OF_MEMORY; } @@ -1937,6 +1937,6 @@ int32_t parseInsertSql(SParseContext* pCxt, SQuery** pQuery, SCatalogReq* pCatal QUERY_EXEC_STAGE_SCHEDULE == (*pQuery)->execStage) { code = setRefreshMate(*pQuery); } - destroyBoundColInfo(&context.tags); + insDestroyBoundColInfo(&context.tags); return code; } diff --git a/source/libs/parser/src/parInsertUtil.c b/source/libs/parser/src/parInsertUtil.c index cc2ca48a1f..b3018d63b4 100644 --- a/source/libs/parser/src/parInsertUtil.c +++ b/source/libs/parser/src/parInsertUtil.c @@ -22,179 +22,6 @@ #include "tRealloc.h" #include "tdatablock.h" -typedef struct SBlockKeyTuple { - TSKEY skey; - void* payloadAddr; - int16_t index; -} SBlockKeyTuple; - -typedef struct SBlockKeyInfo { - int32_t maxBytesAlloc; - SBlockKeyTuple* pKeyTuple; -} SBlockKeyInfo; - -typedef struct { - int32_t index; - SArray* rowArray; // array of merged rows(mem allocated by tRealloc/free by tFree) - STSchema* pSchema; - int64_t tbUid; // suid for child table, uid for normal table -} SBlockRowMerger; - -static FORCE_INLINE void tdResetSBlockRowMerger(SBlockRowMerger* pMerger) { - if (pMerger) { - pMerger->index = -1; - } -} - -static void tdFreeSBlockRowMerger(SBlockRowMerger* pMerger) { - if (pMerger) { - int32_t size = taosArrayGetSize(pMerger->rowArray); - for (int32_t i = 0; i < size; ++i) { - tFree(*(void**)taosArrayGet(pMerger->rowArray, i)); - } - taosArrayDestroy(pMerger->rowArray); - - taosMemoryFreeClear(pMerger->pSchema); - taosMemoryFree(pMerger); - } -} - -static int32_t rowDataCompar(const void* lhs, const void* rhs) { - TSKEY left = *(TSKEY*)lhs; - TSKEY right = *(TSKEY*)rhs; - if (left == right) { - return 0; - } else { - return left > right ? 1 : -1; - } -} - -static int32_t rowDataComparStable(const void* lhs, const void* rhs) { - TSKEY left = *(TSKEY*)lhs; - TSKEY right = *(TSKEY*)rhs; - if (left == right) { - return ((SBlockKeyTuple*)lhs)->index - ((SBlockKeyTuple*)rhs)->index; - } else { - return left > right ? 1 : -1; - } -} - -int32_t insGetExtendedRowSize(STableDataBlocks* pBlock) { - STableComInfo* pTableInfo = &pBlock->pTableMeta->tableInfo; - ASSERT(pBlock->rowSize == pTableInfo->rowSize); - return pBlock->rowSize + TD_ROW_HEAD_LEN - sizeof(TSKEY) + pBlock->boundColumnInfo.extendedVarLen + - (int32_t)TD_BITMAP_BYTES(pTableInfo->numOfColumns - 1); -} - -void insGetSTSRowAppendInfo(uint8_t rowType, SParsedDataColInfo* spd, col_id_t idx, int32_t* toffset, - col_id_t* colIdx) { - col_id_t schemaIdx = 0; - if (IS_DATA_COL_ORDERED(spd)) { - schemaIdx = spd->boundColumns[idx]; - if (TD_IS_TP_ROW_T(rowType)) { - *toffset = (spd->cols + schemaIdx)->toffset; // the offset of firstPart - *colIdx = schemaIdx; - } else { - *toffset = idx * sizeof(SKvRowIdx); // the offset of SKvRowIdx - *colIdx = idx; - } - } else { - ASSERT(idx == (spd->colIdxInfo + idx)->boundIdx); - schemaIdx = (spd->colIdxInfo + idx)->schemaColIdx; - if (TD_IS_TP_ROW_T(rowType)) { - *toffset = (spd->cols + schemaIdx)->toffset; - *colIdx = schemaIdx; - } else { - *toffset = ((spd->colIdxInfo + idx)->finalIdx) * sizeof(SKvRowIdx); - *colIdx = (spd->colIdxInfo + idx)->finalIdx; - } - } -} - -int32_t insSetBlockInfo(SSubmitBlk* pBlocks, STableDataBlocks* dataBuf, int32_t numOfRows, SMsgBuf* pMsg) { - pBlocks->suid = (TSDB_NORMAL_TABLE == dataBuf->pTableMeta->tableType ? 0 : dataBuf->pTableMeta->suid); - pBlocks->uid = dataBuf->pTableMeta->uid; - pBlocks->sversion = dataBuf->pTableMeta->sversion; - pBlocks->schemaLen = dataBuf->createTbReqLen; - - if (pBlocks->numOfRows + numOfRows >= INT32_MAX) { - return buildInvalidOperationMsg(pMsg, "too many rows in sql, total number of rows should be less than INT32_MAX"); - } - pBlocks->numOfRows += numOfRows; - return TSDB_CODE_SUCCESS; -} - -void insSetBoundColumnInfo(SParsedDataColInfo* pColList, SSchema* pSchema, col_id_t numOfCols) { - pColList->numOfCols = numOfCols; - pColList->numOfBound = numOfCols; - pColList->orderStatus = ORDER_STATUS_ORDERED; // default is ORDERED for non-bound mode - pColList->boundColumns = taosMemoryCalloc(pColList->numOfCols, sizeof(col_id_t)); - pColList->cols = taosMemoryCalloc(pColList->numOfCols, sizeof(SBoundColumn)); - pColList->colIdxInfo = NULL; - pColList->flen = 0; - pColList->allNullLen = 0; - - int32_t nVar = 0; - for (int32_t i = 0; i < pColList->numOfCols; ++i) { - uint8_t type = pSchema[i].type; - if (i > 0) { - pColList->cols[i].offset = pColList->cols[i - 1].offset + pSchema[i - 1].bytes; - pColList->cols[i].toffset = pColList->flen; - pColList->flen += TYPE_BYTES[type]; - } - switch (type) { - case TSDB_DATA_TYPE_BINARY: - pColList->allNullLen += (VARSTR_HEADER_SIZE + CHAR_BYTES); - ++nVar; - break; - case TSDB_DATA_TYPE_NCHAR: - pColList->allNullLen += (VARSTR_HEADER_SIZE + TSDB_NCHAR_SIZE); - ++nVar; - break; - default: - break; - } - pColList->boundColumns[i] = i; - } - pColList->allNullLen += pColList->flen; - pColList->boundNullLen = pColList->allNullLen; // default set allNullLen - pColList->extendedVarLen = (uint16_t)(nVar * sizeof(VarDataOffsetT)); -} - -int32_t insSchemaIdxCompar(const void* lhs, const void* rhs) { - uint16_t left = *(uint16_t*)lhs; - uint16_t right = *(uint16_t*)rhs; - - if (left == right) { - return 0; - } else { - return left > right ? 1 : -1; - } -} - -int32_t insBoundIdxCompar(const void* lhs, const void* rhs) { - uint16_t left = *(uint16_t*)POINTER_SHIFT(lhs, sizeof(uint16_t)); - uint16_t right = *(uint16_t*)POINTER_SHIFT(rhs, sizeof(uint16_t)); - - if (left == right) { - return 0; - } else { - return left > right ? 1 : -1; - } -} - -void destroyBoundColumnInfo(void* pBoundInfo) { - if (NULL == pBoundInfo) { - return; - } - - SParsedDataColInfo* pColList = (SParsedDataColInfo*)pBoundInfo; - - taosMemoryFreeClear(pColList->boundColumns); - taosMemoryFreeClear(pColList->cols); - taosMemoryFreeClear(pColList->colIdxInfo); -} - void qDestroyBoundColInfo(void* pInfo) { if (NULL == pInfo) { return; @@ -205,548 +32,6 @@ void qDestroyBoundColInfo(void* pInfo) { taosMemoryFreeClear(pBoundInfo->pColIndex); } -static int32_t createTableDataBlock(size_t defaultSize, int32_t rowSize, int32_t startOffset, STableMeta* pTableMeta, - STableDataBlocks** dataBlocks) { - STableDataBlocks* dataBuf = (STableDataBlocks*)taosMemoryCalloc(1, sizeof(STableDataBlocks)); - if (dataBuf == NULL) { - return TSDB_CODE_OUT_OF_MEMORY; - } - - dataBuf->nAllocSize = (uint32_t)defaultSize; - dataBuf->headerSize = startOffset; - - // the header size will always be the startOffset value, reserved for the subumit block header - if (dataBuf->nAllocSize <= dataBuf->headerSize) { - dataBuf->nAllocSize = dataBuf->headerSize * 2; - } - - dataBuf->pData = taosMemoryMalloc(dataBuf->nAllocSize); - if (dataBuf->pData == NULL) { - taosMemoryFreeClear(dataBuf); - return TSDB_CODE_OUT_OF_MEMORY; - } - memset(dataBuf->pData, 0, sizeof(SSubmitBlk)); - - dataBuf->pTableMeta = tableMetaDup(pTableMeta); - - SParsedDataColInfo* pColInfo = &dataBuf->boundColumnInfo; - SSchema* pSchema = getTableColumnSchema(dataBuf->pTableMeta); - insSetBoundColumnInfo(pColInfo, pSchema, dataBuf->pTableMeta->tableInfo.numOfColumns); - - dataBuf->ordered = true; - dataBuf->prevTS = INT64_MIN; - dataBuf->rowSize = rowSize; - dataBuf->size = startOffset; - dataBuf->vgId = dataBuf->pTableMeta->vgId; - - assert(defaultSize > 0 && pTableMeta != NULL && dataBuf->pTableMeta != NULL); - - *dataBlocks = dataBuf; - return TSDB_CODE_SUCCESS; -} - -int32_t insBuildCreateTbMsg(STableDataBlocks* pBlocks, SVCreateTbReq* pCreateTbReq) { - SEncoder coder = {0}; - char* pBuf; - int32_t len; - - int32_t ret = 0; - tEncodeSize(tEncodeSVCreateTbReq, pCreateTbReq, len, ret); - if (pBlocks->nAllocSize - pBlocks->size < len) { - pBlocks->nAllocSize += len + pBlocks->rowSize; - char* pTmp = taosMemoryRealloc(pBlocks->pData, pBlocks->nAllocSize); - if (pTmp != NULL) { - pBlocks->pData = pTmp; - memset(pBlocks->pData + pBlocks->size, 0, pBlocks->nAllocSize - pBlocks->size); - } else { - pBlocks->nAllocSize -= len + pBlocks->rowSize; - return TSDB_CODE_OUT_OF_MEMORY; - } - } - - pBuf = pBlocks->pData + pBlocks->size; - - tEncoderInit(&coder, pBuf, len); - int32_t code = tEncodeSVCreateTbReq(&coder, pCreateTbReq); - tEncoderClear(&coder); - pBlocks->size += len; - pBlocks->createTbReqLen = len; - - return code; -} - -void insDestroyDataBlock(STableDataBlocks* pDataBlock) { - if (pDataBlock == NULL) { - return; - } - - taosMemoryFreeClear(pDataBlock->pData); - taosMemoryFreeClear(pDataBlock->pTableMeta); - destroyBoundColumnInfo(&pDataBlock->boundColumnInfo); - taosMemoryFreeClear(pDataBlock); -} - -int32_t insGetDataBlockFromList(SHashObj* pHashList, void* id, int32_t idLen, int32_t size, int32_t startOffset, - int32_t rowSize, STableMeta* pTableMeta, STableDataBlocks** dataBlocks, - SArray* pBlockList, SVCreateTbReq* pCreateTbReq) { - *dataBlocks = NULL; - STableDataBlocks** t1 = (STableDataBlocks**)taosHashGet(pHashList, (const char*)id, idLen); - if (t1 != NULL) { - *dataBlocks = *t1; - } - - if (*dataBlocks == NULL) { - int32_t ret = createTableDataBlock((size_t)size, rowSize, startOffset, pTableMeta, dataBlocks); - if (ret != TSDB_CODE_SUCCESS) { - return ret; - } - - if (NULL != pCreateTbReq && NULL != pCreateTbReq->ctb.pTag) { - ret = insBuildCreateTbMsg(*dataBlocks, pCreateTbReq); - if (ret != TSDB_CODE_SUCCESS) { - insDestroyDataBlock(*dataBlocks); - return ret; - } - } - - // converting to 'const char*' is to handle coverity scan errors - taosHashPut(pHashList, (const char*)id, idLen, (const char*)dataBlocks, POINTER_BYTES); - if (pBlockList) { - taosArrayPush(pBlockList, dataBlocks); - } - } - - return TSDB_CODE_SUCCESS; -} - -void insDestroyBlockArrayList(SArray* pDataBlockList) { - if (pDataBlockList == NULL) { - return; - } - - size_t size = taosArrayGetSize(pDataBlockList); - for (int32_t i = 0; i < size; i++) { - void* p = taosArrayGetP(pDataBlockList, i); - insDestroyDataBlock(p); - } - - taosArrayDestroy(pDataBlockList); -} - -void insDestroyBlockHashmap(SHashObj* pDataBlockHash) { - if (pDataBlockHash == NULL) { - return; - } - - void** p1 = taosHashIterate(pDataBlockHash, NULL); - while (p1) { - SBoundColInfo* pBlocks = *p1; - destroyBoundColInfo(pBlocks); - - p1 = taosHashIterate(pDataBlockHash, p1); - } - - taosHashCleanup(pDataBlockHash); -} - -// data block is disordered, sort it in ascending order -static int sortRemoveDataBlockDupRows(STableDataBlocks* dataBuf, SBlockKeyInfo* pBlkKeyInfo) { - SSubmitBlk* pBlocks = (SSubmitBlk*)dataBuf->pData; - int16_t nRows = pBlocks->numOfRows; - - // size is less than the total size, since duplicated rows may be removed yet. - - // allocate memory - size_t nAlloc = nRows * sizeof(SBlockKeyTuple); - if (pBlkKeyInfo->pKeyTuple == NULL || pBlkKeyInfo->maxBytesAlloc < nAlloc) { - char* tmp = taosMemoryRealloc(pBlkKeyInfo->pKeyTuple, nAlloc); - if (tmp == NULL) { - return TSDB_CODE_OUT_OF_MEMORY; - } - pBlkKeyInfo->pKeyTuple = (SBlockKeyTuple*)tmp; - pBlkKeyInfo->maxBytesAlloc = (int32_t)nAlloc; - } - memset(pBlkKeyInfo->pKeyTuple, 0, nAlloc); - - int32_t extendedRowSize = insGetExtendedRowSize(dataBuf); - SBlockKeyTuple* pBlkKeyTuple = pBlkKeyInfo->pKeyTuple; - char* pBlockData = pBlocks->data + pBlocks->schemaLen; - int n = 0; - while (n < nRows) { - pBlkKeyTuple->skey = TD_ROW_KEY((STSRow*)pBlockData); - pBlkKeyTuple->payloadAddr = pBlockData; - pBlkKeyTuple->index = n; - - // next loop - pBlockData += extendedRowSize; - ++pBlkKeyTuple; - ++n; - } - - if (!dataBuf->ordered) { - pBlkKeyTuple = pBlkKeyInfo->pKeyTuple; - - // todo. qsort is unstable, if timestamp is same, should get the last one - taosSort(pBlkKeyTuple, nRows, sizeof(SBlockKeyTuple), rowDataComparStable); - - pBlkKeyTuple = pBlkKeyInfo->pKeyTuple; - int32_t i = 0; - int32_t j = 1; - while (j < nRows) { - TSKEY ti = (pBlkKeyTuple + i)->skey; - TSKEY tj = (pBlkKeyTuple + j)->skey; - - if (ti == tj) { - ++j; - continue; - } - - int32_t nextPos = (++i); - if (nextPos != j) { - memmove(pBlkKeyTuple + nextPos, pBlkKeyTuple + j, sizeof(SBlockKeyTuple)); - } - ++j; - } - - dataBuf->ordered = true; - pBlocks->numOfRows = i + 1; - } - - dataBuf->size = sizeof(SSubmitBlk) + pBlocks->numOfRows * extendedRowSize; - dataBuf->prevTS = INT64_MIN; - - return 0; -} - -static void* tdGetCurRowFromBlockMerger(SBlockRowMerger* pBlkRowMerger) { - if (pBlkRowMerger && (pBlkRowMerger->index >= 0)) { - ASSERT(pBlkRowMerger->index < taosArrayGetSize(pBlkRowMerger->rowArray)); - return *(void**)taosArrayGet(pBlkRowMerger->rowArray, pBlkRowMerger->index); - } - return NULL; -} - -static int32_t tdBlockRowMerge(STableMeta* pTableMeta, SBlockKeyTuple* pEndKeyTp, int32_t nDupRows, - SBlockRowMerger** pBlkRowMerger, int32_t rowSize) { - ASSERT(nDupRows > 1); - SBlockKeyTuple* pStartKeyTp = pEndKeyTp - (nDupRows - 1); - ASSERT(pStartKeyTp->skey == pEndKeyTp->skey); - - // TODO: optimization if end row is all normal -#if 0 - STSRow* pEndRow = (STSRow*)pEndKeyTp->payloadAddr; - if(isNormal(pEndRow)) { // set the end row if it is normal and return directly - pStartKeyTp->payloadAddr = pEndKeyTp->payloadAddr; - return TSDB_CODE_SUCCESS; - } -#endif - - if (!(*pBlkRowMerger)) { - (*pBlkRowMerger) = taosMemoryCalloc(1, sizeof(**pBlkRowMerger)); - if (!(*pBlkRowMerger)) { - terrno = TSDB_CODE_OUT_OF_MEMORY; - return TSDB_CODE_FAILED; - } - (*pBlkRowMerger)->index = -1; - if (!(*pBlkRowMerger)->rowArray) { - (*pBlkRowMerger)->rowArray = taosArrayInit(1, sizeof(void*)); - if (!(*pBlkRowMerger)->rowArray) { - terrno = TSDB_CODE_OUT_OF_MEMORY; - return TSDB_CODE_FAILED; - } - } - } - - if ((*pBlkRowMerger)->pSchema) { - if ((*pBlkRowMerger)->pSchema->version != pTableMeta->sversion) { - taosMemoryFreeClear((*pBlkRowMerger)->pSchema); - } else { - if ((*pBlkRowMerger)->tbUid != (pTableMeta->suid > 0 ? pTableMeta->suid : pTableMeta->uid)) { - taosMemoryFreeClear((*pBlkRowMerger)->pSchema); - } - } - } - - if (!(*pBlkRowMerger)->pSchema) { - (*pBlkRowMerger)->pSchema = - tBuildTSchema(pTableMeta->schema, pTableMeta->tableInfo.numOfColumns, pTableMeta->sversion); - - if (!(*pBlkRowMerger)->pSchema) { - terrno = TSDB_CODE_OUT_OF_MEMORY; - return TSDB_CODE_FAILED; - } - (*pBlkRowMerger)->tbUid = pTableMeta->suid > 0 ? pTableMeta->suid : pTableMeta->uid; - } - - void* pDestRow = NULL; - ++((*pBlkRowMerger)->index); - if ((*pBlkRowMerger)->index < taosArrayGetSize((*pBlkRowMerger)->rowArray)) { - void** pAlloc = (void**)taosArrayGet((*pBlkRowMerger)->rowArray, (*pBlkRowMerger)->index); - if (tRealloc((uint8_t**)pAlloc, rowSize) != 0) { - return TSDB_CODE_FAILED; - } - pDestRow = *pAlloc; - } else { - if (tRealloc((uint8_t**)&pDestRow, rowSize) != 0) { - return TSDB_CODE_FAILED; - } - taosArrayPush((*pBlkRowMerger)->rowArray, &pDestRow); - } - - // merge rows to pDestRow - STSchema* pSchema = (*pBlkRowMerger)->pSchema; - SArray* pArray = taosArrayInit(pSchema->numOfCols, sizeof(SColVal)); - for (int32_t i = 0; i < pSchema->numOfCols; ++i) { - SColVal colVal = {0}; - for (int32_t j = 0; j < nDupRows; ++j) { - tTSRowGetVal((pEndKeyTp - j)->payloadAddr, pSchema, i, &colVal); - if (!COL_VAL_IS_NONE(&colVal)) { - break; - } - } - taosArrayPush(pArray, &colVal); - } - if (tdSTSRowNew(pArray, pSchema, (STSRow**)&pDestRow) < 0) { - taosArrayDestroy(pArray); - return TSDB_CODE_FAILED; - } - - taosArrayDestroy(pArray); - return TSDB_CODE_SUCCESS; -} - -// data block is disordered, sort it in ascending order, and merge dup rows if exists -static int sortMergeDataBlockDupRows(STableDataBlocks* dataBuf, SBlockKeyInfo* pBlkKeyInfo, - SBlockRowMerger** ppBlkRowMerger) { - SSubmitBlk* pBlocks = (SSubmitBlk*)dataBuf->pData; - STableMeta* pTableMeta = dataBuf->pTableMeta; - int32_t nRows = pBlocks->numOfRows; - - // size is less than the total size, since duplicated rows may be removed. - - // allocate memory - size_t nAlloc = nRows * sizeof(SBlockKeyTuple); - if (pBlkKeyInfo->pKeyTuple == NULL || pBlkKeyInfo->maxBytesAlloc < nAlloc) { - char* tmp = taosMemoryRealloc(pBlkKeyInfo->pKeyTuple, nAlloc); - if (tmp == NULL) { - return TSDB_CODE_OUT_OF_MEMORY; - } - pBlkKeyInfo->pKeyTuple = (SBlockKeyTuple*)tmp; - pBlkKeyInfo->maxBytesAlloc = (int32_t)nAlloc; - } - memset(pBlkKeyInfo->pKeyTuple, 0, nAlloc); - - tdResetSBlockRowMerger(*ppBlkRowMerger); - - int32_t extendedRowSize = insGetExtendedRowSize(dataBuf); - SBlockKeyTuple* pBlkKeyTuple = pBlkKeyInfo->pKeyTuple; - char* pBlockData = pBlocks->data + pBlocks->schemaLen; - int32_t n = 0; - while (n < nRows) { - pBlkKeyTuple->skey = TD_ROW_KEY((STSRow*)pBlockData); - pBlkKeyTuple->payloadAddr = pBlockData; - pBlkKeyTuple->index = n; - - // next loop - pBlockData += extendedRowSize; - ++pBlkKeyTuple; - ++n; - } - - if (!dataBuf->ordered) { - pBlkKeyTuple = pBlkKeyInfo->pKeyTuple; - - taosSort(pBlkKeyTuple, nRows, sizeof(SBlockKeyTuple), rowDataComparStable); - - pBlkKeyTuple = pBlkKeyInfo->pKeyTuple; - bool hasDup = false; - int32_t nextPos = 0; - int32_t i = 0; - int32_t j = 1; - - while (j < nRows) { - TSKEY ti = (pBlkKeyTuple + i)->skey; - TSKEY tj = (pBlkKeyTuple + j)->skey; - - if (ti == tj) { - ++j; - continue; - } - - if ((j - i) > 1) { - if (tdBlockRowMerge(pTableMeta, (pBlkKeyTuple + j - 1), j - i, ppBlkRowMerger, extendedRowSize) < 0) { - return TSDB_CODE_FAILED; - } - (pBlkKeyTuple + nextPos)->payloadAddr = tdGetCurRowFromBlockMerger(*ppBlkRowMerger); - if (!hasDup) { - hasDup = true; - } - i = j; - } else { - if (hasDup) { - memmove(pBlkKeyTuple + nextPos, pBlkKeyTuple + i, sizeof(SBlockKeyTuple)); - } - ++i; - } - - ++nextPos; - ++j; - } - - if ((j - i) > 1) { - ASSERT((pBlkKeyTuple + i)->skey == (pBlkKeyTuple + j - 1)->skey); - if (tdBlockRowMerge(pTableMeta, (pBlkKeyTuple + j - 1), j - i, ppBlkRowMerger, extendedRowSize) < 0) { - return TSDB_CODE_FAILED; - } - (pBlkKeyTuple + nextPos)->payloadAddr = tdGetCurRowFromBlockMerger(*ppBlkRowMerger); - } else if (hasDup) { - memmove(pBlkKeyTuple + nextPos, pBlkKeyTuple + i, sizeof(SBlockKeyTuple)); - } - - dataBuf->ordered = true; - pBlocks->numOfRows = nextPos + 1; - } - - dataBuf->size = sizeof(SSubmitBlk) + pBlocks->numOfRows * extendedRowSize; - dataBuf->prevTS = INT64_MIN; - - return TSDB_CODE_SUCCESS; -} - -// Erase the empty space reserved for binary data -static int trimDataBlock(void* pDataBlock, STableDataBlocks* pTableDataBlock, SBlockKeyTuple* blkKeyTuple) { - // TODO: optimize this function, handle the case while binary is not presented - int32_t nonDataLen = sizeof(SSubmitBlk) + pTableDataBlock->createTbReqLen; - SSubmitBlk* pBlock = pDataBlock; - memcpy(pDataBlock, pTableDataBlock->pData, nonDataLen); - pDataBlock = (char*)pDataBlock + nonDataLen; - - pBlock->schemaLen = pTableDataBlock->createTbReqLen; - pBlock->dataLen = 0; - - int32_t numOfRows = pBlock->numOfRows; - for (int32_t i = 0; i < numOfRows; ++i) { - void* payload = (blkKeyTuple + i)->payloadAddr; - TDRowLenT rowTLen = TD_ROW_LEN((STSRow*)payload); - memcpy(pDataBlock, payload, rowTLen); - pDataBlock = POINTER_SHIFT(pDataBlock, rowTLen); - pBlock->dataLen += rowTLen; - } - - return pBlock->dataLen + pBlock->schemaLen; -} - -int32_t insMergeTableDataBlocks(SHashObj* pHashObj, SArray** pVgDataBlocks) { - const int INSERT_HEAD_SIZE = sizeof(SSubmitReq); - int code = 0; - SHashObj* pVnodeDataBlockHashList = taosHashInit(128, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), true, false); - SArray* pVnodeDataBlockList = taosArrayInit(8, POINTER_BYTES); - - STableDataBlocks** p = taosHashIterate(pHashObj, NULL); - STableDataBlocks* pOneTableBlock = *p; - SBlockKeyInfo blkKeyInfo = {0}; // share by pOneTableBlock - SBlockRowMerger* pBlkRowMerger = NULL; - - while (pOneTableBlock) { - SSubmitBlk* pBlocks = (SSubmitBlk*)pOneTableBlock->pData; - if (pBlocks->numOfRows > 0) { - STableDataBlocks* dataBuf = NULL; - pOneTableBlock->pTableMeta->vgId = pOneTableBlock->vgId; // for schemaless, restore origin vgId - int32_t ret = insGetDataBlockFromList(pVnodeDataBlockHashList, &pOneTableBlock->vgId, - sizeof(pOneTableBlock->vgId), TSDB_PAYLOAD_SIZE, INSERT_HEAD_SIZE, 0, - pOneTableBlock->pTableMeta, &dataBuf, pVnodeDataBlockList, NULL); - if (ret != TSDB_CODE_SUCCESS) { - tdFreeSBlockRowMerger(pBlkRowMerger); - taosHashCleanup(pVnodeDataBlockHashList); - insDestroyBlockArrayList(pVnodeDataBlockList); - taosMemoryFreeClear(blkKeyInfo.pKeyTuple); - return ret; - } - ASSERT(pOneTableBlock->pTableMeta->tableInfo.rowSize > 0); - // the maximum expanded size in byte when a row-wise data is converted to SDataRow format - int64_t destSize = dataBuf->size + pOneTableBlock->size + - sizeof(STColumn) * getNumOfColumns(pOneTableBlock->pTableMeta) + - pOneTableBlock->createTbReqLen; - - if (dataBuf->nAllocSize < destSize) { - dataBuf->nAllocSize = (uint32_t)(destSize * 1.5); - char* tmp = taosMemoryRealloc(dataBuf->pData, dataBuf->nAllocSize); - if (tmp != NULL) { - dataBuf->pData = tmp; - } else { // failed to allocate memory, free already allocated memory and return error code - tdFreeSBlockRowMerger(pBlkRowMerger); - taosHashCleanup(pVnodeDataBlockHashList); - insDestroyBlockArrayList(pVnodeDataBlockList); - taosMemoryFreeClear(dataBuf->pData); - taosMemoryFreeClear(blkKeyInfo.pKeyTuple); - return TSDB_CODE_OUT_OF_MEMORY; - } - } - - if ((code = sortMergeDataBlockDupRows(pOneTableBlock, &blkKeyInfo, &pBlkRowMerger)) != 0) { - tdFreeSBlockRowMerger(pBlkRowMerger); - taosHashCleanup(pVnodeDataBlockHashList); - insDestroyBlockArrayList(pVnodeDataBlockList); - taosMemoryFreeClear(dataBuf->pData); - taosMemoryFreeClear(blkKeyInfo.pKeyTuple); - return code; - } - ASSERT(blkKeyInfo.pKeyTuple != NULL && pBlocks->numOfRows > 0); - - // erase the empty space reserved for binary data - int32_t finalLen = trimDataBlock(dataBuf->pData + dataBuf->size, pOneTableBlock, blkKeyInfo.pKeyTuple); - - dataBuf->size += (finalLen + sizeof(SSubmitBlk)); - assert(dataBuf->size <= dataBuf->nAllocSize); - dataBuf->numOfTables += 1; - } - - p = taosHashIterate(pHashObj, p); - if (p == NULL) { - break; - } - - pOneTableBlock = *p; - } - - // free the table data blocks; - tdFreeSBlockRowMerger(pBlkRowMerger); - taosHashCleanup(pVnodeDataBlockHashList); - taosMemoryFreeClear(blkKeyInfo.pKeyTuple); - *pVgDataBlocks = pVnodeDataBlockList; - return TSDB_CODE_SUCCESS; -} - -int32_t insAllocateMemForSize(STableDataBlocks* pDataBlock, int32_t allSize) { - size_t remain = pDataBlock->nAllocSize - pDataBlock->size; - uint32_t nAllocSizeOld = pDataBlock->nAllocSize; - - // expand the allocated size - if (remain < allSize) { - pDataBlock->nAllocSize = (pDataBlock->size + allSize) * 1.5; - - char* tmp = taosMemoryRealloc(pDataBlock->pData, (size_t)pDataBlock->nAllocSize); - if (tmp != NULL) { - pDataBlock->pData = tmp; - memset(pDataBlock->pData + pDataBlock->size, 0, pDataBlock->nAllocSize - pDataBlock->size); - } else { - // do nothing, if allocate more memory failed - pDataBlock->nAllocSize = nAllocSizeOld; - return TSDB_CODE_OUT_OF_MEMORY; - } - } - - return TSDB_CODE_SUCCESS; -} - -int32_t insInitRowBuilder(SRowBuilder* pBuilder, int16_t schemaVer, SParsedDataColInfo* pColInfo) { - ASSERT(pColInfo->numOfCols > 0 && (pColInfo->numOfBound <= pColInfo->numOfCols)); - tdSRowInit(pBuilder, schemaVer); - tdSRowSetExtendedInfo(pBuilder, pColInfo->numOfCols, pColInfo->numOfBound, pColInfo->flen, pColInfo->allNullLen, - pColInfo->boundNullLen); - return TSDB_CODE_SUCCESS; -} - static char* tableNameGetPosition(SToken* pToken, char target) { bool inEscape = false; bool inQuote = false; @@ -875,98 +160,6 @@ void insBuildCreateTbReq(SVCreateTbReq* pTbReq, const char* tname, STag* pTag, i return; } -int32_t insMemRowAppend(SMsgBuf* pMsgBuf, const void* value, int32_t len, void* param) { - SMemParam* pa = (SMemParam*)param; - SRowBuilder* rb = pa->rb; - - if (value == NULL) { // it is a null data - tdAppendColValToRow(rb, pa->schema->colId, pa->schema->type, TD_VTYPE_NULL, value, false, pa->toffset, pa->colIdx); - return TSDB_CODE_SUCCESS; - } - - if (TSDB_DATA_TYPE_BINARY == pa->schema->type) { - const char* rowEnd = tdRowEnd(rb->pBuf); - STR_WITH_SIZE_TO_VARSTR(rowEnd, value, len); - tdAppendColValToRow(rb, pa->schema->colId, pa->schema->type, TD_VTYPE_NORM, rowEnd, false, pa->toffset, pa->colIdx); - } else if (TSDB_DATA_TYPE_NCHAR == pa->schema->type) { - // if the converted output len is over than pColumnModel->bytes, return error: 'Argument list too long' - int32_t output = 0; - const char* rowEnd = tdRowEnd(rb->pBuf); - if (!taosMbsToUcs4(value, len, (TdUcs4*)varDataVal(rowEnd), pa->schema->bytes - VARSTR_HEADER_SIZE, &output)) { - if (errno == E2BIG) { - return generateSyntaxErrMsg(pMsgBuf, TSDB_CODE_PAR_VALUE_TOO_LONG, pa->schema->name); - } - char buf[512] = {0}; - snprintf(buf, tListLen(buf), "%s", strerror(errno)); - return buildSyntaxErrMsg(pMsgBuf, buf, value); - } - varDataSetLen(rowEnd, output); - tdAppendColValToRow(rb, pa->schema->colId, pa->schema->type, TD_VTYPE_NORM, rowEnd, false, pa->toffset, pa->colIdx); - } else { - tdAppendColValToRow(rb, pa->schema->colId, pa->schema->type, TD_VTYPE_NORM, value, false, pa->toffset, pa->colIdx); - } - - return TSDB_CODE_SUCCESS; -} - -int32_t insCheckTimestamp(STableDataBlocks* pDataBlocks, const char* start) { - // once the data block is disordered, we do NOT keep previous timestamp any more - if (!pDataBlocks->ordered) { - return TSDB_CODE_SUCCESS; - } - - TSKEY k = *(TSKEY*)start; - if (k <= pDataBlocks->prevTS) { - pDataBlocks->ordered = false; - } - - pDataBlocks->prevTS = k; - return TSDB_CODE_SUCCESS; -} - -static void buildMsgHeader(STableDataBlocks* src, SVgDataBlocks* blocks) { - SSubmitReq* submit = (SSubmitReq*)blocks->pData; - submit->header.vgId = htonl(blocks->vg.vgId); - submit->header.contLen = htonl(blocks->size); - submit->length = submit->header.contLen; - submit->numOfBlocks = htonl(blocks->numOfTables); - SSubmitBlk* blk = (SSubmitBlk*)(submit + 1); - int32_t numOfBlocks = blocks->numOfTables; - while (numOfBlocks--) { - int32_t dataLen = blk->dataLen; - int32_t schemaLen = blk->schemaLen; - blk->uid = htobe64(blk->uid); - blk->suid = htobe64(blk->suid); - blk->sversion = htonl(blk->sversion); - blk->dataLen = htonl(blk->dataLen); - blk->schemaLen = htonl(blk->schemaLen); - blk->numOfRows = htonl(blk->numOfRows); - blk = (SSubmitBlk*)(blk->data + schemaLen + dataLen); - } -} - -int32_t insBuildOutput(SHashObj* pVgroupsHashObj, SArray* pVgDataBlocks, SArray** pDataBlocks) { - size_t numOfVg = taosArrayGetSize(pVgDataBlocks); - *pDataBlocks = taosArrayInit(numOfVg, POINTER_BYTES); - if (NULL == *pDataBlocks) { - return TSDB_CODE_OUT_OF_MEMORY; - } - for (size_t i = 0; i < numOfVg; ++i) { - STableDataBlocks* src = taosArrayGetP(pVgDataBlocks, i); - SVgDataBlocks* dst = taosMemoryCalloc(1, sizeof(SVgDataBlocks)); - if (NULL == dst) { - return TSDB_CODE_OUT_OF_MEMORY; - } - taosHashGetDup(pVgroupsHashObj, (const char*)&src->vgId, sizeof(src->vgId), &dst->vg); - dst->numOfTables = src->numOfTables; - dst->size = src->size; - TSWAP(dst->pData, src->pData); - buildMsgHeader(src, dst); - taosArrayPush(*pDataBlocks, &dst); - } - return TSDB_CODE_SUCCESS; -} - static void initBoundCols(int32_t ncols, int16_t* pBoundCols) { for (int32_t i = 0; i < ncols; ++i) { pBoundCols[i] = i; @@ -1010,7 +203,7 @@ void insCheckTableDataOrder(STableDataCxt* pTableCxt, TSKEY tsKey) { return; } -void destroyBoundColInfo(SBoundColInfo* pInfo) { taosMemoryFreeClear(pInfo->pColIndex); } +void insDestroyBoundColInfo(SBoundColInfo* pInfo) { taosMemoryFreeClear(pInfo->pColIndex); } static int32_t createTableDataCxt(STableMeta* pTableMeta, SVCreateTbReq** pCreateTbReq, STableDataCxt** pOutput, bool colMode) { @@ -1120,7 +313,7 @@ void insDestroyTableDataCxt(STableDataCxt* pTableCxt) { taosMemoryFreeClear(pTableCxt->pMeta); tDestroyTSchema(pTableCxt->pSchema); - destroyBoundColInfo(&pTableCxt->boundColsInfo); + insDestroyBoundColInfo(&pTableCxt->boundColsInfo); taosArrayDestroyEx(pTableCxt->pValues, destroyColVal); if (pTableCxt->pData) { tDestroySSubmitTbData(pTableCxt->pData, TSDB_MSG_FLG_ENCODE); From 0fd305158dd85bf8236b5ea2ee42311f12cd46e2 Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Wed, 28 Dec 2022 14:07:58 +0800 Subject: [PATCH 57/63] enh: when there is _wend and _wduration in the query, you can use tsma optimization --- source/libs/parser/src/parTranslater.c | 130 +++++++++++++++++------- source/libs/planner/src/planOptimizer.c | 20 ++-- 2 files changed, 98 insertions(+), 52 deletions(-) diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 45eacad855..3048d53738 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -4569,8 +4569,89 @@ typedef struct SSampleAstInfo { SNode* pSliding; SNodeList* pPartitionByList; STableMeta* pRollupTableMeta; + bool createSmaIndex; } SSampleAstInfo; +static int32_t buildTableForSampleAst(SSampleAstInfo* pInfo, SNode** pOutput) { + SRealTableNode* pTable = (SRealTableNode*)nodesMakeNode(QUERY_NODE_REAL_TABLE); + if (NULL == pTable) { + return TSDB_CODE_OUT_OF_MEMORY; + } + snprintf(pTable->table.dbName, sizeof(pTable->table.dbName), "%s", pInfo->pDbName); + snprintf(pTable->table.tableName, sizeof(pTable->table.tableName), "%s", pInfo->pTableName); + TSWAP(pTable->pMeta, pInfo->pRollupTableMeta); + *pOutput = (SNode*)pTable; + return TSDB_CODE_SUCCESS; +} + +static int32_t addWstartToSampleProjects(SNodeList* pProjectionList) { + SFunctionNode* pFunc = (SFunctionNode*)nodesMakeNode(QUERY_NODE_FUNCTION); + if (NULL == pFunc) { + return TSDB_CODE_OUT_OF_MEMORY; + } + strcpy(pFunc->functionName, "_wstart"); + return nodesListPushFront(pProjectionList, (SNode*)pFunc); +} + +static int32_t addWendToSampleProjects(SNodeList* pProjectionList) { + SFunctionNode* pFunc = (SFunctionNode*)nodesMakeNode(QUERY_NODE_FUNCTION); + if (NULL == pFunc) { + return TSDB_CODE_OUT_OF_MEMORY; + } + strcpy(pFunc->functionName, "_wend"); + return nodesListAppend(pProjectionList, (SNode*)pFunc); +} + +static int32_t addWdurationToSampleProjects(SNodeList* pProjectionList) { + SFunctionNode* pFunc = (SFunctionNode*)nodesMakeNode(QUERY_NODE_FUNCTION); + if (NULL == pFunc) { + return TSDB_CODE_OUT_OF_MEMORY; + } + strcpy(pFunc->functionName, "_wduration"); + return nodesListAppend(pProjectionList, (SNode*)pFunc); +} + +static int32_t buildProjectsForSampleAst(SSampleAstInfo* pInfo, SNodeList** pList) { + SNodeList* pProjectionList = pInfo->pFuncs; + pInfo->pFuncs = NULL; + + int32_t code = addWstartToSampleProjects(pProjectionList); + if (TSDB_CODE_SUCCESS == code && pInfo->createSmaIndex) { + code = addWendToSampleProjects(pProjectionList); + if (TSDB_CODE_SUCCESS == code) { + code = addWdurationToSampleProjects(pProjectionList); + } + } + + if (TSDB_CODE_SUCCESS == code) { + SNode* pProject = NULL; + FOREACH(pProject, pProjectionList) { sprintf(((SExprNode*)pProject)->aliasName, "#%p", pProject); } + *pList = pProjectionList; + } else { + nodesDestroyList(pProjectionList); + } + return code; +} + +static int32_t buildIntervalForSampleAst(SSampleAstInfo* pInfo, SNode** pOutput) { + SIntervalWindowNode* pInterval = (SIntervalWindowNode*)nodesMakeNode(QUERY_NODE_INTERVAL_WINDOW); + if (NULL == pInterval) { + return TSDB_CODE_OUT_OF_MEMORY; + } + TSWAP(pInterval->pInterval, pInfo->pInterval); + TSWAP(pInterval->pOffset, pInfo->pOffset); + TSWAP(pInterval->pSliding, pInfo->pSliding); + pInterval->pCol = nodesMakeNode(QUERY_NODE_COLUMN); + if (NULL == pInterval->pCol) { + nodesDestroyNode((SNode*)pInterval); + return TSDB_CODE_OUT_OF_MEMORY; + } + ((SColumnNode*)pInterval->pCol)->colId = PRIMARYKEY_TIMESTAMP_COL_ID; + strcpy(((SColumnNode*)pInterval->pCol)->colName, ROWTS_PSEUDO_COLUMN_NAME); + *pOutput = (SNode*)pInterval; + return TSDB_CODE_SUCCESS; +} + static int32_t buildSampleAst(STranslateContext* pCxt, SSampleAstInfo* pInfo, char** pAst, int32_t* pLen, char** pExpr, int32_t* pExprLen) { SSelectStmt* pSelect = (SSelectStmt*)nodesMakeNode(QUERY_NODE_SELECT_STMT); @@ -4579,48 +4660,18 @@ static int32_t buildSampleAst(STranslateContext* pCxt, SSampleAstInfo* pInfo, ch } sprintf(pSelect->stmtName, "%p", pSelect); - SRealTableNode* pTable = (SRealTableNode*)nodesMakeNode(QUERY_NODE_REAL_TABLE); - if (NULL == pTable) { - nodesDestroyNode((SNode*)pSelect); - return TSDB_CODE_OUT_OF_MEMORY; + int32_t code = buildTableForSampleAst(pInfo, &pSelect->pFromTable); + if (TSDB_CODE_SUCCESS == code) { + code = buildProjectsForSampleAst(pInfo, &pSelect->pProjectionList); } - snprintf(pTable->table.dbName, sizeof(pTable->table.dbName), "%s", pInfo->pDbName); - snprintf(pTable->table.tableName, sizeof(pTable->table.tableName), "%s", pInfo->pTableName); - TSWAP(pTable->pMeta, pInfo->pRollupTableMeta); - pSelect->pFromTable = (SNode*)pTable; - - TSWAP(pSelect->pProjectionList, pInfo->pFuncs); - SFunctionNode* pFunc = (SFunctionNode*)nodesMakeNode(QUERY_NODE_FUNCTION); - if (NULL == pSelect->pProjectionList || NULL == pFunc) { - nodesDestroyNode((SNode*)pSelect); - return TSDB_CODE_OUT_OF_MEMORY; + if (TSDB_CODE_SUCCESS == code) { + TSWAP(pSelect->pPartitionByList, pInfo->pPartitionByList); + code = buildIntervalForSampleAst(pInfo, &pSelect->pWindow); } - strcpy(pFunc->functionName, "_wstart"); - nodesListPushFront(pSelect->pProjectionList, (SNode*)pFunc); - SNode* pProject = NULL; - FOREACH(pProject, pSelect->pProjectionList) { sprintf(((SExprNode*)pProject)->aliasName, "#%p", pProject); } - - TSWAP(pSelect->pPartitionByList, pInfo->pPartitionByList); - - SIntervalWindowNode* pInterval = (SIntervalWindowNode*)nodesMakeNode(QUERY_NODE_INTERVAL_WINDOW); - if (NULL == pInterval) { - nodesDestroyNode((SNode*)pSelect); - return TSDB_CODE_OUT_OF_MEMORY; + if (TSDB_CODE_SUCCESS == code) { + pCxt->createStream = true; + code = translateQuery(pCxt, (SNode*)pSelect); } - pSelect->pWindow = (SNode*)pInterval; - TSWAP(pInterval->pInterval, pInfo->pInterval); - TSWAP(pInterval->pOffset, pInfo->pOffset); - TSWAP(pInterval->pSliding, pInfo->pSliding); - pInterval->pCol = nodesMakeNode(QUERY_NODE_COLUMN); - if (NULL == pInterval->pCol) { - nodesDestroyNode((SNode*)pSelect); - return TSDB_CODE_OUT_OF_MEMORY; - } - ((SColumnNode*)pInterval->pCol)->colId = PRIMARYKEY_TIMESTAMP_COL_ID; - strcpy(((SColumnNode*)pInterval->pCol)->colName, ROWTS_PSEUDO_COLUMN_NAME); - - pCxt->createStream = true; - int32_t code = translateQuery(pCxt, (SNode*)pSelect); if (TSDB_CODE_SUCCESS == code) { code = nodesNodeToString((SNode*)pSelect, false, pAst, pLen); } @@ -5162,6 +5213,7 @@ static int32_t getSmaIndexSql(STranslateContext* pCxt, char** pSql, int32_t* pLe } static int32_t buildSampleAstInfoByIndex(STranslateContext* pCxt, SCreateIndexStmt* pStmt, SSampleAstInfo* pInfo) { + pInfo->createSmaIndex = true; pInfo->pDbName = pStmt->dbName; pInfo->pTableName = pStmt->tableName; pInfo->pFuncs = nodesCloneList(pStmt->pOptions->pFuncs); diff --git a/source/libs/planner/src/planOptimizer.c b/source/libs/planner/src/planOptimizer.c index e1687fc3a5..83341d200a 100644 --- a/source/libs/planner/src/planOptimizer.c +++ b/source/libs/planner/src/planOptimizer.c @@ -1284,18 +1284,14 @@ static int32_t smaIndexOptFindSmaFunc(SNode* pQueryFunc, SNodeList* pSmaFuncs) { return -1; } -static int32_t smaIndexOptCreateSmaCols(SNodeList* pFuncs, uint64_t tableId, SNodeList* pSmaFuncs, SNodeList** pOutput, - int32_t* pWStrartIndex) { +static int32_t smaIndexOptCreateSmaCols(SNodeList* pFuncs, uint64_t tableId, SNodeList* pSmaFuncs, + SNodeList** pOutput) { SNodeList* pCols = NULL; SNode* pFunc = NULL; int32_t code = TSDB_CODE_SUCCESS; int32_t index = 0; int32_t smaFuncIndex = -1; - *pWStrartIndex = -1; FOREACH(pFunc, pFuncs) { - if (FUNCTION_TYPE_WSTART == ((SFunctionNode*)pFunc)->funcType) { - *pWStrartIndex = index; - } smaFuncIndex = smaIndexOptFindSmaFunc(pFunc, pSmaFuncs); if (smaFuncIndex < 0) { break; @@ -1317,8 +1313,7 @@ static int32_t smaIndexOptCreateSmaCols(SNodeList* pFuncs, uint64_t tableId, SNo return code; } -static int32_t smaIndexOptCouldApplyIndex(SScanLogicNode* pScan, STableIndexInfo* pIndex, SNodeList** pCols, - int32_t* pWStrartIndex) { +static int32_t smaIndexOptCouldApplyIndex(SScanLogicNode* pScan, STableIndexInfo* pIndex, SNodeList** pCols) { SWindowLogicNode* pWindow = (SWindowLogicNode*)pScan->node.pParent; if (!smaIndexOptEqualInterval(pScan, pWindow, pIndex)) { return TSDB_CODE_SUCCESS; @@ -1326,14 +1321,14 @@ static int32_t smaIndexOptCouldApplyIndex(SScanLogicNode* pScan, STableIndexInfo SNodeList* pSmaFuncs = NULL; int32_t code = nodesStringToList(pIndex->expr, &pSmaFuncs); if (TSDB_CODE_SUCCESS == code) { - code = smaIndexOptCreateSmaCols(pWindow->pFuncs, pIndex->dstTbUid, pSmaFuncs, pCols, pWStrartIndex); + code = smaIndexOptCreateSmaCols(pWindow->pFuncs, pIndex->dstTbUid, pSmaFuncs, pCols); } nodesDestroyList(pSmaFuncs); return code; } static int32_t smaIndexOptApplyIndex(SLogicSubplan* pLogicSubplan, SScanLogicNode* pScan, STableIndexInfo* pIndex, - SNodeList* pSmaCols, int32_t wstrartIndex) { + SNodeList* pSmaCols) { SLogicNode* pSmaScan = NULL; int32_t code = smaIndexOptCreateSmaScan(pScan, pIndex, pSmaCols, &pSmaScan); if (TSDB_CODE_SUCCESS == code) { @@ -1350,10 +1345,9 @@ static int32_t smaIndexOptimizeImpl(SOptimizeContext* pCxt, SLogicSubplan* pLogi for (int32_t i = 0; i < nindexes; ++i) { STableIndexInfo* pIndex = taosArrayGet(pScan->pSmaIndexes, i); SNodeList* pSmaCols = NULL; - int32_t wstrartIndex = -1; - code = smaIndexOptCouldApplyIndex(pScan, pIndex, &pSmaCols, &wstrartIndex); + code = smaIndexOptCouldApplyIndex(pScan, pIndex, &pSmaCols); if (TSDB_CODE_SUCCESS == code && NULL != pSmaCols) { - code = smaIndexOptApplyIndex(pLogicSubplan, pScan, pIndex, pSmaCols, wstrartIndex); + code = smaIndexOptApplyIndex(pLogicSubplan, pScan, pIndex, pSmaCols); taosArrayDestroyEx(pScan->pSmaIndexes, smaIndexOptDestroySmaIndex); pScan->pSmaIndexes = NULL; pCxt->optimized = true; From 4aae5244444a14922dddfb22baade1ebbb9ea96d Mon Sep 17 00:00:00 2001 From: wade zhang <95411902+gccgdb1234@users.noreply.github.com> Date: Wed, 28 Dec 2022 15:42:45 +0800 Subject: [PATCH 58/63] Update 24-show.md --- docs/en/12-taos-sql/24-show.md | 62 +++++++++++++++++++++++++++++++++- 1 file changed, 61 insertions(+), 1 deletion(-) diff --git a/docs/en/12-taos-sql/24-show.md b/docs/en/12-taos-sql/24-show.md index 08e8df6252..ae34f9e459 100644 --- a/docs/en/12-taos-sql/24-show.md +++ b/docs/en/12-taos-sql/24-show.md @@ -178,75 +178,135 @@ SHOW TABLE DISTRIBUTED table_name; Shows how table data is distributed. -Examples: show table distributed d0\G; Display the block distribution of table `d0` in detailed format. +Examples: Below is an example of this command to display the block distribution of table `d0` in detailed format. +```sql +show table distributed d0\G; +``` + +
+ Show Example +

 *************************** 1.row ***************************
 _block_dist: Total_Blocks=[5] Total_Size=[93.65 Kb] Average_size=[18.73 Kb] Compression_Ratio=[23.98 %]
 
 Total_Blocks :  Table `d0` contains total 5 blocks
+
 Total_Size:  The total size of all the data blocks in table `d0` is 93.65 KB 
+
 Average_size:  The average size of each block is 18.73 KB
+
 Compression_Ratio: The data compression rate is 23.98%
  
 *************************** 2.row ***************************
 _block_dist: Total_Rows=[20000] Inmem_Rows=[0] MinRows=[3616] MaxRows=[4096] Average_Rows=[4000]
 
 Total_Rows: Table `d0` contains 20,000 rows
+
 Inmem_Rows: The rows still in memory, i.e. not committed in disk, is 0, i.e. none such rows
+
 MinRows:  The minimum number of rows in a block is 3,616 
+
 MaxRows: The maximum number of rows in a block is 4,096B
+
 Average_Rows: The average number of rows in a block is 4,000
 
 *************************** 3.row ***************************
 _block_dist: Total_Tables=[1] Total_Files=[2]
 
 Total_Tables:  The number of child tables, 1 in this example
+
 Total_Files:   The number of files storing the table's data, 2 in this example
 
 *************************** 4.row ***************************
+
 _block_dist: --------------------------------------------------------------------------------
+
 *************************** 5.row ***************************
+
 _block_dist: 0100 |
+
 *************************** 6.row ***************************
+
 _block_dist: 0299 |
+
 *************************** 7.row ***************************
+
 _block_dist: 0498 |
+
 *************************** 8.row ***************************
+
 _block_dist: 0697 |
+
 *************************** 9.row ***************************
+
 _block_dist: 0896 |
+
 *************************** 10.row ***************************
+
 _block_dist: 1095 |
+
 *************************** 11.row ***************************
+
 _block_dist: 1294 |
+
 *************************** 12.row ***************************
+
 _block_dist: 1493 |
+
 *************************** 13.row ***************************
+
 _block_dist: 1692 |
+
 *************************** 14.row ***************************
+
 _block_dist: 1891 |
+
 *************************** 15.row ***************************
+
 _block_dist: 2090 |
+
 *************************** 16.row ***************************
+
 _block_dist: 2289 |
+
 *************************** 17.row ***************************
+
 _block_dist: 2488 |
+
 *************************** 18.row ***************************
+
 _block_dist: 2687 |
+
 *************************** 19.row ***************************
+
 _block_dist: 2886 |
+
 *************************** 20.row ***************************
+
 _block_dist: 3085 |
+
 *************************** 21.row ***************************
+
 _block_dist: 3284 |
+
 *************************** 22.row ***************************
+
 _block_dist: 3483 |||||||||||||||||  1 (20.00%)
+
 *************************** 23.row ***************************
+
 _block_dist: 3682 |
+
 *************************** 24.row ***************************
+
 _block_dist: 3881 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||  4 (80.00%)
+
 Query OK, 24 row(s) in set (0.002444s)
 
+
+
+ The above show the block distribution percentage according to the number of rows in each block. In the above example, `_block_dist: 3483 ||||||||||||||||| 1 (20.00%)` means there is one block whose rows is between 3,483 and 3,681. `_block_dist: 3881 ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| 4 (80.00%)` means there are 4 blocks whose rows is between 3,881 and 4,096. The number of blocks whose rows fall in other range is zero. ## SHOW TAGS From d1001dde7e184f4e43ff1c2056459f92f03f977b Mon Sep 17 00:00:00 2001 From: wade zhang <95411902+gccgdb1234@users.noreply.github.com> Date: Wed, 28 Dec 2022 15:44:09 +0800 Subject: [PATCH 59/63] Update 24-show.md --- docs/en/12-taos-sql/24-show.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/en/12-taos-sql/24-show.md b/docs/en/12-taos-sql/24-show.md index ae34f9e459..ace0e4b70c 100644 --- a/docs/en/12-taos-sql/24-show.md +++ b/docs/en/12-taos-sql/24-show.md @@ -307,7 +307,9 @@ Query OK, 24 row(s) in set (0.002444s) - The above show the block distribution percentage according to the number of rows in each block. In the above example, `_block_dist: 3483 ||||||||||||||||| 1 (20.00%)` means there is one block whose rows is between 3,483 and 3,681. `_block_dist: 3881 ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| 4 (80.00%)` means there are 4 blocks whose rows is between 3,881 and 4,096. The number of blocks whose rows fall in other range is zero. + The above show the block distribution percentage according to the number of rows in each block. In the above example, we can get below information: + - `_block_dist: 3483 ||||||||||||||||| 1 (20.00%)` means there is one block whose rows is between 3,483 and 3,681. + - `_block_dist: 3881 ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| 4 (80.00%)` means there are 4 blocks whose rows is between 3,881 and 4,096. - The number of blocks whose rows fall in other range is zero. ## SHOW TAGS From cb7c141660a516c6fd1c4436afcb46570f119323 Mon Sep 17 00:00:00 2001 From: wade zhang <95411902+gccgdb1234@users.noreply.github.com> Date: Wed, 28 Dec 2022 15:44:40 +0800 Subject: [PATCH 60/63] Update 24-show.md --- docs/en/12-taos-sql/24-show.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/12-taos-sql/24-show.md b/docs/en/12-taos-sql/24-show.md index ace0e4b70c..2db3e7cb31 100644 --- a/docs/en/12-taos-sql/24-show.md +++ b/docs/en/12-taos-sql/24-show.md @@ -309,7 +309,7 @@ Query OK, 24 row(s) in set (0.002444s) The above show the block distribution percentage according to the number of rows in each block. In the above example, we can get below information: - `_block_dist: 3483 ||||||||||||||||| 1 (20.00%)` means there is one block whose rows is between 3,483 and 3,681. - - `_block_dist: 3881 ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| 4 (80.00%)` means there are 4 blocks whose rows is between 3,881 and 4,096. - The number of blocks whose rows fall in other range is zero. + - `_block_dist: 3881 ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| 4 (80.00%)` means there are 4 blocks whose rows is between 3,881 and 4,096. - The number of blocks whose rows fall in other range is zero. ## SHOW TAGS From 0721ac3d560ab83d0cf307d23d13d3e6599605ad Mon Sep 17 00:00:00 2001 From: wade zhang <95411902+gccgdb1234@users.noreply.github.com> Date: Wed, 28 Dec 2022 15:46:46 +0800 Subject: [PATCH 61/63] Update 24-show.md --- docs/zh/12-taos-sql/24-show.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/zh/12-taos-sql/24-show.md b/docs/zh/12-taos-sql/24-show.md index a65746e7f9..2b875199b5 100644 --- a/docs/zh/12-taos-sql/24-show.md +++ b/docs/zh/12-taos-sql/24-show.md @@ -183,6 +183,10 @@ SHOW TABLE DISTRIBUTED table_name; 语句: show table distributed d0\G; 竖行显示表 d0 的 BLOCK 分布情况 +
+ 显示示例 +

+
 *************************** 1.row ***************************
 
 _block_dist: Total_Blocks=[5] Total_Size=[93.65 Kb] Average_size=[18.73 Kb] Compression_Ratio=[23.98 %]
@@ -244,6 +248,8 @@ _block_dist: 3881 ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
 
 Query OK, 24 row(s) in set (0.002444s)
 
+
+
上面是块中包含数据行数的块儿分布情况图,这里的 0100 0299 0498 … 表示的是每个块中包含的数据行数,上面的意思就是这个表的 5 个块,分布在 3483 ~3681 行的块有 1 个,占整个块的 20%,分布在 3881 ~ 4096(最大行数)的块数为 4 个,占整个块的 80%, 其它区域内分布块数为 0。 From 853b93fbe12d8165fa10756bca006d5cfe7b2733 Mon Sep 17 00:00:00 2001 From: xinsheng Ren <285808407@qq.com> Date: Thu, 29 Dec 2022 09:21:20 +0800 Subject: [PATCH 62/63] Fix/xsren/td 20817 mac fqdn (#19078) * fix/TD-20817-mac-fqdn use localhostname * fix/TD-20817-mac-fqdn redundant codes * fix/TD-20817-mac-fqdn,replace command with api Co-authored-by: facetosea <25808407@qq.com> Co-authored-by: Shuduo Sang --- include/os/osSysinfo.h | 1 + source/os/CMakeLists.txt | 4 +++ source/os/src/osSocket.c | 20 +++++++-------- source/os/src/osSysinfo.c | 51 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 65 insertions(+), 11 deletions(-) diff --git a/include/os/osSysinfo.h b/include/os/osSysinfo.h index 7765a60f88..dbe4d6801e 100644 --- a/include/os/osSysinfo.h +++ b/include/os/osSysinfo.h @@ -70,6 +70,7 @@ typedef struct { SysNameInfo taosGetSysNameInfo(); bool taosCheckCurrentInDll(); +int taosGetlocalhostname(char *hostname, size_t maxLen); #ifdef __cplusplus } diff --git a/source/os/CMakeLists.txt b/source/os/CMakeLists.txt index b7cb20896b..0d85a8bec4 100644 --- a/source/os/CMakeLists.txt +++ b/source/os/CMakeLists.txt @@ -44,6 +44,10 @@ if(TD_WINDOWS) os PUBLIC ws2_32 iconv msvcregex wcwidth winmm crashdump ) elseif(TD_DARWIN_64) + find_library(CORE_FOUNDATION_FRAMEWORK CoreFoundation) + target_link_libraries(os PUBLIC ${CORE_FOUNDATION_FRAMEWORK}) + find_library(SYSTEM_CONFIGURATION_FRAMEWORK SystemConfiguration) + target_link_libraries(os PUBLIC ${SYSTEM_CONFIGURATION_FRAMEWORK}) target_link_libraries( os PUBLIC dl m iconv ) diff --git a/source/os/src/osSocket.c b/source/os/src/osSocket.c index db2a9937b5..6611a937f2 100644 --- a/source/os/src/osSocket.c +++ b/source/os/src/osSocket.c @@ -988,7 +988,7 @@ int32_t taosGetFqdn(char *fqdn) { #endif char hostname[1024]; hostname[1023] = '\0'; - if (gethostname(hostname, 1023) == -1) { + if (taosGetlocalhostname(hostname, 1023) == -1) { #ifdef WINDOWS printf("failed to get hostname, reason:%s\n", strerror(WSAGetLastError())); #else @@ -998,30 +998,28 @@ int32_t taosGetFqdn(char *fqdn) { return -1; } - struct addrinfo hints = {0}; - struct addrinfo *result = NULL; #ifdef __APPLE__ // on macosx, hostname -f has the form of xxx.local // which will block getaddrinfo for a few seconds if AI_CANONNAME is set // thus, we choose AF_INET (ipv4 for the moment) to make getaddrinfo return // immediately - hints.ai_family = AF_INET; + // hints.ai_family = AF_INET; + strcpy(fqdn, hostname); + strcpy(fqdn+strlen(hostname), ".local"); #else // __APPLE__ + struct addrinfo hints = {0}; + struct addrinfo *result = NULL; hints.ai_flags = AI_CANONNAME; -#endif // __APPLE__ + int32_t ret = getaddrinfo(hostname, NULL, &hints, &result); if (!result) { fprintf(stderr, "failed to get fqdn, code:%d, reason:%s\n", ret, gai_strerror(ret)); return -1; } - -#ifdef __APPLE__ - // refer to comments above - strcpy(fqdn, hostname); -#else // __APPLE__ strcpy(fqdn, result->ai_canonname); -#endif // __APPLE__ freeaddrinfo(result); +#endif // __APPLE__ + return 0; } diff --git a/source/os/src/osSysinfo.c b/source/os/src/osSysinfo.c index e1abe84841..6c9bf40e4d 100644 --- a/source/os/src/osSysinfo.c +++ b/source/os/src/osSysinfo.c @@ -98,6 +98,9 @@ LONG WINAPI exceptionHandler(LPEXCEPTION_POINTERS exception); #include #include #include +#include +#include +#include #else @@ -1007,6 +1010,11 @@ SysNameInfo taosGetSysNameInfo() { tstrncpy(info.machine, uts.machine, sizeof(info.machine)); } + char localHostName[512]; + taosGetlocalhostname(localHostName, 512); + TdCmdPtr pCmd = taosOpenCmd("scutil --get LocalHostName"); + tstrncpy(info.nodename, localHostName, sizeof(info.nodename)); + return info; #else SysNameInfo info = {0}; @@ -1042,3 +1050,46 @@ bool taosCheckCurrentInDll() { return false; #endif } + +#ifdef _TD_DARWIN_64 +int taosGetMaclocalhostnameByCommand(char *hostname, size_t maxLen) { + TdCmdPtr pCmd = taosOpenCmd("scutil --get LocalHostName"); + if (pCmd != NULL) { + if (taosGetsCmd(pCmd, maxLen - 1, hostname) > 0) { + int len = strlen(hostname); + if (hostname[len - 1] == '\n') { + hostname[len - 1] = '\0'; + } + return 0; + } + taosCloseCmd(&pCmd); + } + return -1; +} + +int getMacLocalHostNameBySCD(char *hostname, size_t maxLen) { + SCDynamicStoreRef store = SCDynamicStoreCreate(NULL, CFSTR(""), NULL, NULL); + CFStringRef hostname_cfstr = SCDynamicStoreCopyLocalHostName(store); + if (hostname_cfstr != NULL) { + CFStringGetCString(hostname_cfstr, hostname, maxLen - 1, kCFStringEncodingMacRoman); + CFRelease(hostname_cfstr); + } else { + return -1; + } + CFRelease(store); + return 0; +} +#endif + +int taosGetlocalhostname(char *hostname, size_t maxLen) { +#ifdef _TD_DARWIN_64 + int res = getMacLocalHostNameBySCD(hostname, maxLen); + if (res != 0) { + return taosGetMaclocalhostnameByCommand(hostname, maxLen); + } else { + return 0; + } +#else + return gethostname(hostname, maxLen); +#endif +} From bd38f600c09ca3873b76d5561caa800200dc3187 Mon Sep 17 00:00:00 2001 From: xinsheng Ren <285808407@qq.com> Date: Thu, 29 Dec 2022 09:21:54 +0800 Subject: [PATCH 63/63] chore/enterprise condition fix (#19226) Co-authored-by: facetosea <25808407@qq.com> --- cmake/cmake.define | 1 + packaging/tools/make_install.bat | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/cmake/cmake.define b/cmake/cmake.define index d32200bb91..a739a77d21 100644 --- a/cmake/cmake.define +++ b/cmake/cmake.define @@ -1,6 +1,7 @@ cmake_minimum_required(VERSION 3.0) set(CMAKE_VERBOSE_MAKEFILE OFF) +set(TD_BUILD_TAOSA_INTERNAL FALSE) #set output directory SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/build/lib) diff --git a/packaging/tools/make_install.bat b/packaging/tools/make_install.bat index 8853a014f9..bf7418ad79 100644 --- a/packaging/tools/make_install.bat +++ b/packaging/tools/make_install.bat @@ -58,7 +58,7 @@ if exist %binary_dir%\\build\\lib\\taosws.dll ( if exist %binary_dir%\\build\\bin\\taosdump.exe ( copy %binary_dir%\\build\\bin\\taosdump.exe %target_dir% > nul ) -if %Enterprise% ( +if %Enterprise% == TRUE ( if exist %binary_dir%\\build\\bin\\taosx.exe ( copy %binary_dir%\\build\\bin\\taosx.exe %target_dir% > nul )