fix: fix server_status() issue
This commit is contained in:
parent
59849d4acb
commit
17f5f3ee82
|
@ -264,11 +264,6 @@ static int32_t hbQueryHbRspHandle(SAppHbMgr *pAppHbMgr, SClientHbRsp *pRsp) {
|
||||||
|
|
||||||
static int32_t hbAsyncCallBack(void *param, SDataBuf *pMsg, int32_t code) {
|
static int32_t hbAsyncCallBack(void *param, SDataBuf *pMsg, int32_t code) {
|
||||||
static int32_t emptyRspNum = 0;
|
static int32_t emptyRspNum = 0;
|
||||||
if (code != 0) {
|
|
||||||
taosMemoryFreeClear(param);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
char *key = (char *)param;
|
char *key = (char *)param;
|
||||||
SClientHbBatchRsp pRsp = {0};
|
SClientHbBatchRsp pRsp = {0};
|
||||||
tDeserializeSClientHbBatchRsp(pMsg->pData, pMsg->len, &pRsp);
|
tDeserializeSClientHbBatchRsp(pMsg->pData, pMsg->len, &pRsp);
|
||||||
|
@ -288,6 +283,10 @@ static int32_t hbAsyncCallBack(void *param, SDataBuf *pMsg, int32_t code) {
|
||||||
|
|
||||||
taosMemoryFreeClear(param);
|
taosMemoryFreeClear(param);
|
||||||
|
|
||||||
|
if (code != 0) {
|
||||||
|
(*pInst)->onlineDnodes = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (rspNum) {
|
if (rspNum) {
|
||||||
tscDebug("hb got %d rsp, %d empty rsp received before", rspNum,
|
tscDebug("hb got %d rsp, %d empty rsp received before", rspNum,
|
||||||
atomic_val_compare_exchange_32(&emptyRspNum, emptyRspNum, 0));
|
atomic_val_compare_exchange_32(&emptyRspNum, emptyRspNum, 0));
|
||||||
|
|
|
@ -570,7 +570,7 @@ _return:
|
||||||
SCL_RET(code);
|
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) {
|
if (opType <= OP_TYPE_CALC_MAX) {
|
||||||
SValueNode *res = (SValueNode *)nodesMakeNode(QUERY_NODE_VALUE);
|
SValueNode *res = (SValueNode *)nodesMakeNode(QUERY_NODE_VALUE);
|
||||||
if (NULL == res) {
|
if (NULL == res) {
|
||||||
|
@ -602,6 +602,24 @@ EDealRes sclRewriteBasedOnOptr(SNode** pNode, SScalarCtx *ctx, EOperatorType opT
|
||||||
return DEAL_RES_CONTINUE;
|
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) {
|
EDealRes sclRewriteNonConstOperator(SNode** pNode, SScalarCtx *ctx) {
|
||||||
SOperatorNode *node = (SOperatorNode *)*pNode;
|
SOperatorNode *node = (SOperatorNode *)*pNode;
|
||||||
|
@ -609,8 +627,9 @@ EDealRes sclRewriteNonConstOperator(SNode** pNode, SScalarCtx *ctx) {
|
||||||
|
|
||||||
if (node->pLeft && (QUERY_NODE_VALUE == nodeType(node->pLeft))) {
|
if (node->pLeft && (QUERY_NODE_VALUE == nodeType(node->pLeft))) {
|
||||||
SValueNode *valueNode = (SValueNode *)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)) {
|
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);
|
&& (!sclContainsAggFuncNode(node->pRight))) {
|
||||||
|
return sclRewriteNullInOptr(pNode, ctx, node->opType);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IS_STR_DATA_TYPE(valueNode->node.resType.type) && node->pRight && nodesIsExprNode(node->pRight)
|
if (IS_STR_DATA_TYPE(valueNode->node.resType.type) && node->pRight && nodesIsExprNode(node->pRight)
|
||||||
|
@ -625,8 +644,9 @@ EDealRes sclRewriteNonConstOperator(SNode** pNode, SScalarCtx *ctx) {
|
||||||
|
|
||||||
if (node->pRight && (QUERY_NODE_VALUE == nodeType(node->pRight))) {
|
if (node->pRight && (QUERY_NODE_VALUE == nodeType(node->pRight))) {
|
||||||
SValueNode *valueNode = (SValueNode *)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)) {
|
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);
|
&& (!sclContainsAggFuncNode(node->pLeft))) {
|
||||||
|
return sclRewriteNullInOptr(pNode, ctx, node->opType);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IS_STR_DATA_TYPE(valueNode->node.resType.type) && node->pLeft && nodesIsExprNode(node->pLeft)
|
if (IS_STR_DATA_TYPE(valueNode->node.resType.type) && node->pLeft && nodesIsExprNode(node->pLeft)
|
||||||
|
@ -648,7 +668,7 @@ EDealRes sclRewriteNonConstOperator(SNode** pNode, SScalarCtx *ctx) {
|
||||||
ERASE_NODE(listNode->pNodeList);
|
ERASE_NODE(listNode->pNodeList);
|
||||||
continue;
|
continue;
|
||||||
} else { //OP_TYPE_NOT_IN
|
} else { //OP_TYPE_NOT_IN
|
||||||
return sclRewriteBasedOnOptr(pNode, ctx, node->opType);
|
return sclRewriteNullInOptr(pNode, ctx, node->opType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -656,7 +676,7 @@ EDealRes sclRewriteNonConstOperator(SNode** pNode, SScalarCtx *ctx) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (listNode->pNodeList->length <= 0) {
|
if (listNode->pNodeList->length <= 0) {
|
||||||
return sclRewriteBasedOnOptr(pNode, ctx, node->opType);
|
return sclRewriteNullInOptr(pNode, ctx, node->opType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue