void ReplSet::haveNewConfig(ReplSetConfig& newConfig, bool addComment) { bo comment; if( addComment ) comment = BSON( "msg" << "Reconfig set" << "version" << newConfig.version ); newConfig.saveConfigLocally(comment); try { BSONObj oldConfForAudit = config().asBson(); BSONObj newConfForAudit = newConfig.asBson(); audit::logReplSetReconfig(ClientBasic::getCurrent(), &oldConfForAudit, &newConfForAudit); if (initFromConfig(newConfig, true)) { log() << "replSet replSetReconfig new config saved locally" << rsLog; } } catch(DBException& e) { log() << "replSet error unexpected exception in haveNewConfig() : " << e.toString() << rsLog; _fatal(); } catch(...) { log() << "replSet error unexpected exception in haveNewConfig()" << rsLog; _fatal(); } }
void ReplSet::haveNewConfig(OperationContext* txn, ReplSetConfig& newConfig, bool addComment) { bo comment; if( addComment ) comment = BSON( "msg" << "Reconfig set" << "version" << newConfig.version ); newConfig.saveConfigLocally(txn, comment); try { BSONObj oldConfForAudit = config().asBson(); BSONObj newConfForAudit = newConfig.asBson(); audit::logReplSetReconfig(ClientBasic::getCurrent(), &oldConfForAudit, &newConfForAudit); if (initFromConfig(txn, newConfig, true)) { log() << "replSet replSetReconfig new config saved locally" << rsLog; } } catch (const DBException& e) { log() << "replSet error unexpected exception in haveNewConfig() : " << e.toString() << rsLog; fassertFailedNoTrace(18755); } catch (...) { std::terminate(); } }