From 0183fe6e7376f498945f3a1d5c46575064cb9ad0 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Tue, 8 Nov 2022 18:36:24 +0800 Subject: [PATCH] fix: crash if db not exist while process status msg --- source/dnode/mnode/impl/src/mndDnode.c | 2 +- source/dnode/mnode/impl/src/mndMain.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/source/dnode/mnode/impl/src/mndDnode.c b/source/dnode/mnode/impl/src/mndDnode.c index 7eb9d4fb1f..521f924fad 100644 --- a/source/dnode/mnode/impl/src/mndDnode.c +++ b/source/dnode/mnode/impl/src/mndDnode.c @@ -389,7 +389,7 @@ static int32_t mndProcessStatusReq(SRpcMsg *pReq) { } if (roleChanged) { SDbObj *pDb = mndAcquireDb(pMnode, pVgroup->dbName); - if (pDb->stateTs != curMs) { + if (pDb != NULL && pDb->stateTs != curMs) { mInfo("db:%s, stateTs changed by status msg, old stateTs:%" PRId64 " new stateTs:%" PRId64, pDb->name, pDb->stateTs, curMs); pDb->stateTs = curMs; } diff --git a/source/dnode/mnode/impl/src/mndMain.c b/source/dnode/mnode/impl/src/mndMain.c index 476ce267d4..dcfc046a1e 100644 --- a/source/dnode/mnode/impl/src/mndMain.c +++ b/source/dnode/mnode/impl/src/mndMain.c @@ -164,7 +164,7 @@ static void mndSetVgroupOffline(SMnode *pMnode, int32_t dnodeId, int64_t curMs) if (roleChanged) { SDbObj *pDb = mndAcquireDb(pMnode, pVgroup->dbName); - if (pDb->stateTs != curMs) { + if (pDb != NULL && pDb->stateTs != curMs) { mInfo("db:%s, stateTs changed by offline check, old newTs:%" PRId64 " newTs:%" PRId64, pDb->name, pDb->stateTs, curMs); pDb->stateTs = curMs;