diff --git a/src/dnode/src/dnodeShell.c b/src/dnode/src/dnodeShell.c index 50343cfd32405d5408cc9d6c5e939db30bf9b832..7bc1fd9140e01897e3ae6ad367e40556526daf99 100644 --- a/src/dnode/src/dnodeShell.c +++ b/src/dnode/src/dnodeShell.c @@ -116,7 +116,14 @@ static void dnodeProcessMsgFromShell(SRpcMsg *pMsg, SRpcEpSet *pEpSet) { if (pMsg->pCont == NULL) return; - if (dnodeGetRunStatus() != TSDB_RUN_STATUS_RUNING) { + SRunStatus dnodeStatus = dnodeGetRunStatus(); + if (dnodeStatus == TSDB_RUN_STATUS_STOPPED) { + dError("RPC %p, shell msg:%s is ignored since dnode exiting", pMsg->handle, taosMsg[pMsg->msgType]); + rpcMsg.code = TSDB_CODE_DND_EXITING; + rpcSendResponse(&rpcMsg); + rpcFreeCont(pMsg->pCont); + return; + } else if (dnodeStatus != TSDB_RUN_STATUS_RUNING) { dError("RPC %p, shell msg:%s is ignored since dnode not running", pMsg->handle, taosMsg[pMsg->msgType]); rpcMsg.code = TSDB_CODE_APP_NOT_READY; rpcSendResponse(&rpcMsg); diff --git a/src/inc/taoserror.h b/src/inc/taoserror.h index bfeb53513bec5730e7e6c82c60b00d9d5f63c5b3..619869efa58cda04a2e12b415a8e07749f985729 100644 --- a/src/inc/taoserror.h +++ b/src/inc/taoserror.h @@ -198,6 +198,7 @@ int32_t* taosGetErrno(); #define TSDB_CODE_DND_INVALID_MSG_LEN TAOS_DEF_ERROR_CODE(0, 0x0403) //"Invalid message length") #define TSDB_CODE_DND_ACTION_IN_PROGRESS TAOS_DEF_ERROR_CODE(0, 0x0404) //"Action in progress") #define TSDB_CODE_DND_TOO_MANY_VNODES TAOS_DEF_ERROR_CODE(0, 0x0405) //"Too many vnode directories") +#define TSDB_CODE_DND_EXITING TAOS_DEF_ERROR_CODE(0, 0x0406) //"Dnode is exiting" // vnode #define TSDB_CODE_VND_ACTION_IN_PROGRESS TAOS_DEF_ERROR_CODE(0, 0x0500) //"Action in progress") diff --git a/src/util/src/terror.c b/src/util/src/terror.c index 9594022d3ad145780ee535039d24491e5e8aabf5..3d527cc1a25b5b80f0754a0f243e319922c11de3 100644 --- a/src/util/src/terror.c +++ b/src/util/src/terror.c @@ -210,6 +210,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_DND_NO_WRITE_ACCESS, "No permission for dis TAOS_DEFINE_ERROR(TSDB_CODE_DND_INVALID_MSG_LEN, "Invalid message length") TAOS_DEFINE_ERROR(TSDB_CODE_DND_ACTION_IN_PROGRESS, "Action in progress") TAOS_DEFINE_ERROR(TSDB_CODE_DND_TOO_MANY_VNODES, "Too many vnode directories") +TAOS_DEFINE_ERROR(TSDB_CODE_DND_EXITING, "Dnode is exiting") // vnode TAOS_DEFINE_ERROR(TSDB_CODE_VND_ACTION_IN_PROGRESS, "Action in progress")