diff --git a/src/mnode/src/mgmtMnode.c b/src/mnode/src/mgmtMnode.c index 491fcb53021a8f35a01c90013fc5abf0eeb87c4c..e469dc4f6f7ccbcf4a4ba3f2a878b1e0ffdcff1f 100644 --- a/src/mnode/src/mgmtMnode.c +++ b/src/mnode/src/mgmtMnode.c @@ -87,6 +87,14 @@ static int32_t mgmtMnodeActionDecode(SSdbOperDesc *pOper) { } static int32_t mgmtMnodeActionRestored() { + if (mgmtGetMnodesNum() == 1) { + SMnodeObj *pMnode = NULL; + mgmtGetNextMnode(NULL, &pMnode); + if (pMnode != NULL) { + pMnode->role = TAOS_SYNC_ROLE_MASTER; + mgmtReleaseMnode(pMnode); + } + } return TSDB_CODE_SUCCESS; }