feat(rpc): move the check msgType to client
This commit is contained in:
parent
37ea86f8ed
commit
15160544c5
|
@ -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) {
|
||||||
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) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue