dnode may offline while create vnode
This commit is contained in:
parent
59d23065fd
commit
f94f8aadc0
|
@ -94,6 +94,7 @@ typedef struct {
|
|||
pthread_t *threadId;
|
||||
SRWLatch latch;
|
||||
SDnodeWorker mgmtWorker;
|
||||
SDnodeWorker statusWorker;
|
||||
} SDnodeMgmt;
|
||||
|
||||
typedef struct {
|
||||
|
|
|
@ -536,6 +536,11 @@ int32_t dndInitMgmt(SDnode *pDnode) {
|
|||
return -1;
|
||||
}
|
||||
|
||||
if (dndInitWorker(pDnode, &pMgmt->statusWorker, DND_WORKER_SINGLE, "dnode-status", 1, 1, dndProcessMgmtQueue) != 0) {
|
||||
dError("failed to start dnode mgmt worker since %s", terrstr());
|
||||
return -1;
|
||||
}
|
||||
|
||||
pMgmt->threadId = taosCreateThread(dnodeThreadRoutine, pDnode);
|
||||
if (pMgmt->threadId == NULL) {
|
||||
dError("failed to init dnode thread");
|
||||
|
@ -550,6 +555,7 @@ int32_t dndInitMgmt(SDnode *pDnode) {
|
|||
void dndStopMgmt(SDnode *pDnode) {
|
||||
SDnodeMgmt *pMgmt = &pDnode->dmgmt;
|
||||
dndCleanupWorker(&pMgmt->mgmtWorker);
|
||||
dndCleanupWorker(&pMgmt->statusWorker);
|
||||
|
||||
if (pMgmt->threadId != NULL) {
|
||||
taosDestoryThread(pMgmt->threadId);
|
||||
|
@ -587,7 +593,12 @@ void dndProcessMgmtMsg(SDnode *pDnode, SRpcMsg *pMsg, SEpSet *pEpSet) {
|
|||
dndUpdateMnodeEpSet(pDnode, pEpSet);
|
||||
}
|
||||
|
||||
if (dndWriteMsgToWorker(&pMgmt->mgmtWorker, pMsg, sizeof(SRpcMsg)) != 0) {
|
||||
SDnodeWorker *pWorker = &pMgmt->mgmtWorker;
|
||||
if (pMsg->msgType == TDMT_MND_STATUS_RSP) {
|
||||
pWorker = &pMgmt->statusWorker;
|
||||
}
|
||||
|
||||
if (dndWriteMsgToWorker(pWorker, pMsg, sizeof(SRpcMsg)) != 0) {
|
||||
if (pMsg->msgType & 1u) {
|
||||
SRpcMsg rsp = {.handle = pMsg->handle, .code = TSDB_CODE_OUT_OF_MEMORY};
|
||||
rpcSendResponse(&rsp);
|
||||
|
|
|
@ -235,7 +235,7 @@ int32_t mndGetDnodeSize(SMnode *pMnode) {
|
|||
|
||||
bool mndIsDnodeOnline(SMnode *pMnode, SDnodeObj *pDnode, int64_t curMs) {
|
||||
int64_t interval = ABS(pDnode->lastAccessTime - curMs);
|
||||
if (interval > 10000 * pMnode->cfg.statusInterval) {
|
||||
if (interval > 3500 * pMnode->cfg.statusInterval) {
|
||||
if (pDnode->rebootTime > 0) {
|
||||
pDnode->offlineReason = DND_REASON_STATUS_MSG_TIMEOUT;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue