提交 15160544 编写于 作者: A Alex Duan

feat(rpc): move the check msgType to client

上级 37ea86f8
...@@ -66,6 +66,7 @@ int32_t* taosGetErrno(); ...@@ -66,6 +66,7 @@ int32_t* taosGetErrno();
#define TSDB_CODE_RPC_BROKEN_LINK TAOS_DEF_ERROR_CODE(0, 0x0018) // #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_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_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 //common & util
#define TSDB_CODE_OPS_NOT_SUPPORT TAOS_DEF_ERROR_CODE(0, 0x0100) // #define TSDB_CODE_OPS_NOT_SUPPORT TAOS_DEF_ERROR_CODE(0, 0x0100) //
......
...@@ -1424,6 +1424,26 @@ void processMsgFromServer(void* parent, SRpcMsg* pMsg, SEpSet* pEpSet) { ...@@ -1424,6 +1424,26 @@ void processMsgFromServer(void* parent, SRpcMsg* pMsg, SEpSet* pEpSet) {
memcpy((void*)tEpSet, (void*)pEpSet, sizeof(SEpSet)); 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)); AsyncArg* arg = taosMemoryCalloc(1, sizeof(AsyncArg));
arg->msg = *pMsg; arg->msg = *pMsg;
arg->pEpset = tEpSet; arg->pEpset = tEpSet;
......
...@@ -1671,16 +1671,11 @@ int cliAppCb(SCliConn* pConn, STransMsg* pResp, SCliMsg* pMsg) { ...@@ -1671,16 +1671,11 @@ int cliAppCb(SCliConn* pConn, STransMsg* pResp, SCliMsg* pMsg) {
} }
// check whole vnodes is offline on this vgroup // 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 (pCtx->epsetRetryCnt >= pCtx->epSet.numOfEps || pCtx->retryStep > 0) { if (pResp->code == TSDB_CODE_RPC_NETWORK_UNAVAIL) {
switch (pMsg->msg.msgType) { pResp->code = TSDB_CODE_RPC_VGROUP_NOT_CONNECTED;
case TDMT_VND_BATCH_META: } else if (pResp->code == TSDB_CODE_RPC_BROKEN_LINK) {
case TDMT_VND_SUBMIT: pResp->code = TSDB_CODE_RPC_VGROUP_BROKEN_LINK;
case TDMT_SCH_QUERY:
case TDMT_SCH_MERGE_QUERY:
pResp->code = TSDB_CODE_RPC_VGROUP_NOT_CONNECTED;
break;
}
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册