diff --git a/source/client/src/clientHb.c b/source/client/src/clientHb.c index 48fa2d79382f59aa058d9455f7dbc22af0ac03ad..e2d75d39e34c9077591101e636255027e4b672d7 100644 --- a/source/client/src/clientHb.c +++ b/source/client/src/clientHb.c @@ -264,15 +264,12 @@ static int32_t hbQueryHbRspHandle(SAppHbMgr *pAppHbMgr, SClientHbRsp *pRsp) { static int32_t hbAsyncCallBack(void *param, SDataBuf *pMsg, int32_t code) { static int32_t emptyRspNum = 0; - if (code != 0) { - taosMemoryFreeClear(param); - return -1; - } - char *key = (char *)param; SClientHbBatchRsp pRsp = {0}; - tDeserializeSClientHbBatchRsp(pMsg->pData, pMsg->len, &pRsp); - + if (TSDB_CODE_SUCCESS == code) { + tDeserializeSClientHbBatchRsp(pMsg->pData, pMsg->len, &pRsp); + } + int32_t rspNum = taosArrayGetSize(pRsp.rsps); taosThreadMutexLock(&appInfo.mutex); @@ -288,6 +285,10 @@ static int32_t hbAsyncCallBack(void *param, SDataBuf *pMsg, int32_t code) { taosMemoryFreeClear(param); + if (code != 0) { + (*pInst)->onlineDnodes = 0; + } + if (rspNum) { tscDebug("hb got %d rsp, %d empty rsp received before", rspNum, atomic_val_compare_exchange_32(&emptyRspNum, emptyRspNum, 0)); diff --git a/source/libs/catalog/inc/catalogInt.h b/source/libs/catalog/inc/catalogInt.h index 9d0e3871cc5d428fcb0497eafacd2bbe00271b3b..7637c66b8428adf2aea5826a2de1a8aa8f99aea5 100644 --- a/source/libs/catalog/inc/catalogInt.h +++ b/source/libs/catalog/inc/catalogInt.h @@ -166,7 +166,7 @@ typedef struct SCtgDBCache { int8_t deleted; SCtgVgCache vgCache; SHashObj *tbCache; // key:tbname, value:SCtgTbCache - SHashObj *stbCache; // key:suid, value:STableMeta* + SHashObj *stbCache; // key:suid, value:char* } SCtgDBCache; typedef struct SCtgRentSlot { diff --git a/source/libs/qworker/src/qworker.c b/source/libs/qworker/src/qworker.c index cf8116fee74a49b49198969d268a5dac62624889..757279269af8ed2e32221918ea42165eb19e9588 100644 --- a/source/libs/qworker/src/qworker.c +++ b/source/libs/qworker/src/qworker.c @@ -517,7 +517,7 @@ int32_t qwProcessQuery(QW_FPARAMS_DEF, SQWMsg *qwMsg, const char* sql) { ctx->needFetch = qwMsg->msgInfo.needFetch; ctx->queryType = qwMsg->msgType; - QW_TASK_DLOGL("subplan json string, len:%d, %s", qwMsg->msgLen, qwMsg->msg); + //QW_TASK_DLOGL("subplan json string, len:%d, %s", qwMsg->msgLen, qwMsg->msg); code = qStringToSubplan(qwMsg->msg, &plan); if (TSDB_CODE_SUCCESS != code) { diff --git a/source/libs/scalar/src/scalar.c b/source/libs/scalar/src/scalar.c index 2cbe1e5c96e04fe4353468ed1411ab07fb2ea00b..408249404e834a387d52ca4e6601fa5d9fc4ece8 100644 --- a/source/libs/scalar/src/scalar.c +++ b/source/libs/scalar/src/scalar.c @@ -578,7 +578,7 @@ _return: SCL_RET(code); } -EDealRes sclRewriteBasedOnOptr(SNode** pNode, SScalarCtx *ctx, EOperatorType opType) { +EDealRes sclRewriteNullInOptr(SNode** pNode, SScalarCtx *ctx, EOperatorType opType) { if (opType <= OP_TYPE_CALC_MAX) { SValueNode *res = (SValueNode *)nodesMakeNode(QUERY_NODE_VALUE); if (NULL == res) { @@ -610,6 +610,24 @@ EDealRes sclRewriteBasedOnOptr(SNode** pNode, SScalarCtx *ctx, EOperatorType opT return DEAL_RES_CONTINUE; } +EDealRes sclAggFuncWalker(SNode* pNode, void* pContext) { + if (QUERY_NODE_FUNCTION == nodeType(pNode)) { + SFunctionNode* pFunc = (SFunctionNode*)pNode; + *(bool*)pContext = fmIsAggFunc(pFunc->funcId); + if (*(bool*)pContext) { + return DEAL_RES_END; + } + } + + return DEAL_RES_CONTINUE; +} + + +bool sclContainsAggFuncNode(SNode* pNode) { + bool aggFunc = false; + nodesWalkExpr(pNode, sclAggFuncWalker, (void *)&aggFunc); + return aggFunc; +} EDealRes sclRewriteNonConstOperator(SNode** pNode, SScalarCtx *ctx) { SOperatorNode *node = (SOperatorNode *)*pNode; @@ -617,8 +635,9 @@ EDealRes sclRewriteNonConstOperator(SNode** pNode, SScalarCtx *ctx) { if (node->pLeft && (QUERY_NODE_VALUE == nodeType(node->pLeft))) { SValueNode *valueNode = (SValueNode *)node->pLeft; - if (SCL_IS_NULL_VALUE_NODE(valueNode) && (node->opType != OP_TYPE_IS_NULL && node->opType != OP_TYPE_IS_NOT_NULL)) { - return sclRewriteBasedOnOptr(pNode, ctx, node->opType); + if (SCL_IS_NULL_VALUE_NODE(valueNode) && (node->opType != OP_TYPE_IS_NULL && node->opType != OP_TYPE_IS_NOT_NULL) + && (!sclContainsAggFuncNode(node->pRight))) { + return sclRewriteNullInOptr(pNode, ctx, node->opType); } if (IS_STR_DATA_TYPE(valueNode->node.resType.type) && node->pRight && nodesIsExprNode(node->pRight) @@ -633,8 +652,9 @@ EDealRes sclRewriteNonConstOperator(SNode** pNode, SScalarCtx *ctx) { if (node->pRight && (QUERY_NODE_VALUE == nodeType(node->pRight))) { SValueNode *valueNode = (SValueNode *)node->pRight; - if (SCL_IS_NULL_VALUE_NODE(valueNode) && (node->opType != OP_TYPE_IS_NULL && node->opType != OP_TYPE_IS_NOT_NULL)) { - return sclRewriteBasedOnOptr(pNode, ctx, node->opType); + if (SCL_IS_NULL_VALUE_NODE(valueNode) && (node->opType != OP_TYPE_IS_NULL && node->opType != OP_TYPE_IS_NOT_NULL) + && (!sclContainsAggFuncNode(node->pLeft))) { + return sclRewriteNullInOptr(pNode, ctx, node->opType); } if (IS_STR_DATA_TYPE(valueNode->node.resType.type) && node->pLeft && nodesIsExprNode(node->pLeft) @@ -656,7 +676,7 @@ EDealRes sclRewriteNonConstOperator(SNode** pNode, SScalarCtx *ctx) { ERASE_NODE(listNode->pNodeList); continue; } else { //OP_TYPE_NOT_IN - return sclRewriteBasedOnOptr(pNode, ctx, node->opType); + return sclRewriteNullInOptr(pNode, ctx, node->opType); } } @@ -664,7 +684,7 @@ EDealRes sclRewriteNonConstOperator(SNode** pNode, SScalarCtx *ctx) { } if (listNode->pNodeList->length <= 0) { - return sclRewriteBasedOnOptr(pNode, ctx, node->opType); + return sclRewriteNullInOptr(pNode, ctx, node->opType); } }