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; } }