fix[cluster]: redirect meg when node not deployed
This commit is contained in:
parent
48ec0aa781
commit
b8bdbed3db
|
@ -286,14 +286,15 @@ int32_t* taosGetErrno();
|
|||
#define TSDB_CODE_MND_INVALID_STREAM_OPTION TAOS_DEF_ERROR_CODE(0, 0x03F2)
|
||||
|
||||
// mnode-sma
|
||||
#define TSDB_CODE_MND_SMA_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0400)
|
||||
#define TSDB_CODE_MND_SMA_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0401)
|
||||
#define TSDB_CODE_MND_INVALID_SMA_OPTION TAOS_DEF_ERROR_CODE(0, 0x0402)
|
||||
#define TSDB_CODE_MND_SMA_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0480)
|
||||
#define TSDB_CODE_MND_SMA_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0481)
|
||||
#define TSDB_CODE_MND_INVALID_SMA_OPTION TAOS_DEF_ERROR_CODE(0, 0x0482)
|
||||
|
||||
// dnode
|
||||
#define TSDB_CODE_NODE_OFFLINE TAOS_DEF_ERROR_CODE(0, 0x04A1)
|
||||
#define TSDB_CODE_NODE_ALREADY_DEPLOYED TAOS_DEF_ERROR_CODE(0, 0x04A3)
|
||||
#define TSDB_CODE_NODE_NOT_DEPLOYED TAOS_DEF_ERROR_CODE(0, 0x04A4)
|
||||
#define TSDB_CODE_NODE_REDIRECT TAOS_DEF_ERROR_CODE(0, 0x0400)
|
||||
#define TSDB_CODE_NODE_OFFLINE TAOS_DEF_ERROR_CODE(0, 0x0401)
|
||||
#define TSDB_CODE_NODE_ALREADY_DEPLOYED TAOS_DEF_ERROR_CODE(0, 0x0403)
|
||||
#define TSDB_CODE_NODE_NOT_DEPLOYED TAOS_DEF_ERROR_CODE(0, 0x0404)
|
||||
|
||||
// vnode
|
||||
#define TSDB_CODE_VND_ACTION_IN_PROGRESS TAOS_DEF_ERROR_CODE(0, 0x0500)
|
||||
|
|
|
@ -158,7 +158,7 @@ SMgmtWrapper *dndAcquireWrapper(SDnode *pDnode, EDndType ntype) {
|
|||
int32_t refCount = atomic_add_fetch_32(&pWrapper->refCount, 1);
|
||||
dTrace("node:%s, is acquired, refCount:%d", pWrapper->name, refCount);
|
||||
} else {
|
||||
terrno = TSDB_CODE_NODE_NOT_DEPLOYED;
|
||||
terrno = TSDB_CODE_NODE_REDIRECT;
|
||||
pRetWrapper = NULL;
|
||||
}
|
||||
taosRUnLockLatch(&pWrapper->latch);
|
||||
|
@ -174,7 +174,7 @@ int32_t dndMarkWrapper(SMgmtWrapper *pWrapper) {
|
|||
int32_t refCount = atomic_add_fetch_32(&pWrapper->refCount, 1);
|
||||
dTrace("node:%s, is marked, refCount:%d", pWrapper->name, refCount);
|
||||
} else {
|
||||
terrno = TSDB_CODE_NODE_NOT_DEPLOYED;
|
||||
terrno = TSDB_CODE_NODE_REDIRECT;
|
||||
code = -1;
|
||||
}
|
||||
taosRUnLockLatch(&pWrapper->latch);
|
||||
|
|
|
@ -85,6 +85,7 @@ _OVER:
|
|||
} else {
|
||||
dError("msg:%p, failed to process since 0x%04x:%s", pMsg, code & 0XFFFF, terrstr());
|
||||
if (pRpc->msgType & 1U) {
|
||||
if (terrno != 0) code = terrno;
|
||||
SRpcMsg rsp = {.handle = pRpc->handle, .ahandle = pRpc->ahandle, .code = terrno};
|
||||
tmsgSendRsp(&rsp);
|
||||
}
|
||||
|
@ -347,14 +348,12 @@ static int32_t dndSendRpcReq(STransMgmt *pMgmt, const SEpSet *pEpSet, SRpcMsg *p
|
|||
}
|
||||
|
||||
static void dndSendRpcRsp(SMgmtWrapper *pWrapper, const SRpcMsg *pRsp) {
|
||||
if (pRsp->code == TSDB_CODE_APP_NOT_READY) {
|
||||
if (pWrapper->ntype == MNODE) {
|
||||
dmSendRedirectRsp(pWrapper->pMgmt, pRsp);
|
||||
return;
|
||||
}
|
||||
if (pRsp->code == TSDB_CODE_APP_NOT_READY || pRsp->code == TSDB_CODE_NODE_REDIRECT ||
|
||||
pRsp->code == TSDB_CODE_NODE_OFFLINE) {
|
||||
dmSendRedirectRsp(pWrapper->pMgmt, pRsp);
|
||||
} else {
|
||||
rpcSendResponse(pRsp);
|
||||
}
|
||||
|
||||
rpcSendResponse(pRsp);
|
||||
}
|
||||
|
||||
static int32_t dndSendReq(SMgmtWrapper *pWrapper, const SEpSet *pEpSet, SRpcMsg *pReq) {
|
||||
|
|
|
@ -283,6 +283,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_MND_SMA_NOT_EXIST, "SMA does not exist")
|
|||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_SMA_OPTION, "Invalid sma option")
|
||||
|
||||
// dnode
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_NODE_REDIRECT, "Node need redirect")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_NODE_OFFLINE, "Node is offline")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_NODE_ALREADY_DEPLOYED, "Node already deployed")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_NODE_NOT_DEPLOYED, "Node not deployed")
|
||||
|
|
Loading…
Reference in New Issue