set master when there is only one node

This commit is contained in:
slguan 2020-04-17 13:10:54 +08:00
parent a767bd766b
commit ecc95e7054
1 changed files with 8 additions and 0 deletions

View File

@ -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;
}