From ac19d3726e2dd6b9ff15e4660d3a76d4c7e623f2 Mon Sep 17 00:00:00 2001 From: slguan Date: Wed, 22 Apr 2020 12:14:50 +0800 Subject: [PATCH] fix add mnode error --- src/mnode/src/mgmtDnode.c | 9 ++++++++- src/mnode/src/mgmtMnode.c | 2 +- src/plugins/monitor/src/monitorSystem.c | 1 + 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/mnode/src/mgmtDnode.c b/src/mnode/src/mgmtDnode.c index 4f959605c0..bf58adf594 100644 --- a/src/mnode/src/mgmtDnode.c +++ b/src/mnode/src/mgmtDnode.c @@ -39,6 +39,7 @@ void *tsDnodeSdb = NULL; int32_t tsDnodeUpdateSize = 0; int32_t tsAccessSquence = 0; +extern void * tsMnodeSdb; extern void * tsVgroupSdb; static int32_t mgmtCreateDnode(uint32_t ip); @@ -101,7 +102,13 @@ static int32_t mgmtDnodeActionDelete(SSdbOper *pOper) { } } - mgmtDropMnode(pDnode->dnodeId); + SMnodeObj *pMnode = mgmtGetMnode(pDnode->dnodeId); + if (pMnode != NULL) { + SSdbOper oper = {.type = SDB_OPER_LOCAL, .table = tsMnodeSdb, .pObj = pMnode}; + sdbDeleteRow(&oper); + mgmtReleaseMnode(pMnode); + } + balanceNotify(); mTrace("dnode:%d, all vgroups:%d is dropped from sdb", pDnode->dnodeId, numOfVgroups); diff --git a/src/mnode/src/mgmtMnode.c b/src/mnode/src/mgmtMnode.c index 3eae218660..922788749e 100644 --- a/src/mnode/src/mgmtMnode.c +++ b/src/mnode/src/mgmtMnode.c @@ -30,7 +30,7 @@ #include "mgmtShell.h" #include "mgmtUser.h" -static void * tsMnodeSdb = NULL; +void * tsMnodeSdb = NULL; static int32_t tsMnodeUpdateSize = 0; static int32_t mgmtGetMnodeMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pConn); static int32_t mgmtRetrieveMnodes(SShowObj *pShow, char *data, int32_t rows, void *pConn); diff --git a/src/plugins/monitor/src/monitorSystem.c b/src/plugins/monitor/src/monitorSystem.c index 1811733790..776fdca986 100644 --- a/src/plugins/monitor/src/monitorSystem.c +++ b/src/plugins/monitor/src/monitorSystem.c @@ -397,6 +397,7 @@ void monitorSaveAcctLog(char *acctId, int64_t currentPointsPerSecond, int64_t ma int64_t totalOutbound, int64_t maxOutbound, int64_t totalDbs, int64_t maxDbs, int64_t totalUsers, int64_t maxUsers, int64_t totalStreams, int64_t maxStreams, int64_t totalConns, int64_t maxConns, int8_t accessState) { + if (monitor == NULL) return; if (monitor->state != MONITOR_STATE_INITIALIZED) return; char sql[1024] = {0}; -- GitLab