void logOp(const char *opstr, const char *ns, const BSONObj& obj, BSONObj *patt, bool *b) { if ( replSettings.master ) { _logOp(opstr, ns, "local.oplog.$main", obj, patt, b, OpTime::now()); char cl[ 256 ]; nsToDatabase( ns, cl ); } NamespaceDetailsTransient &t = NamespaceDetailsTransient::get_w( ns ); if ( t.cllEnabled() ) { try { _logOp(opstr, ns, t.cllNS().c_str(), obj, patt, b, OpTime::now()); } catch ( const DBException & ) { t.cllInvalidate(); } } }
/*@ @param opstr: c userCreateNS i insert n no-op / keepalive d delete / remove u update */ void logOp(OperationContext* txn, const char* opstr, const char* ns, const BSONObj& obj, BSONObj* patt, bool* b, bool fromMigrate) { try { if ( getGlobalReplicationCoordinator()->isReplEnabled() ) { _logOp(txn, opstr, ns, 0, obj, patt, b, fromMigrate); } logOpForSharding(txn, opstr, ns, obj, patt, fromMigrate); logOpForDbHash(ns); getGlobalAuthorizationManager()->logOp(opstr, ns, obj, patt, b); if ( strstr( ns, ".system.js" ) ) { Scope::storedFuncMod(); // this is terrible } } catch (const DBException& ex) { severe() << "Fatal DBException in logOp(): " << ex.toString(); std::terminate(); } catch (const std::exception& ex) { severe() << "Fatal std::exception in logOp(): " << ex.what(); std::terminate(); } catch (...) { severe() << "Fatal error in logOp()"; std::terminate(); } }
/*@ @param opstr: c userCreateNS i insert n no-op / keepalive d delete / remove u update */ void logOp(const char *opstr, const char *ns, const BSONObj& obj, BSONObj *patt, bool *b) { if ( replSettings.master ) { _logOp(opstr, ns, 0, obj, patt, b); } logOpForSharding( opstr , ns , obj , patt ); }
/*@ @param opstr: c userCreateNS i insert n no-op / keepalive d delete / remove u update */ void logOp(const char* opstr, const char* ns, const BSONObj& obj, BSONObj* patt, bool* b, bool fromMigrate, const BSONObj* fullObj) { if ( replSettings.master ) { _logOp(opstr, ns, 0, obj, patt, b, fromMigrate); } logOpForSharding(opstr, ns, obj, patt, fullObj, fromMigrate); }
/*@ @param opstr: c userCreateNS i insert n no-op / keepalive d delete / remove u update */ void logOp(OperationContext* txn, const char* opstr, const char* ns, const BSONObj& obj, BSONObj* patt, bool* b, bool fromMigrate) { try { // TODO SERVER-15192 remove this once all listeners are rollback-safe. class RollbackPreventer : public RecoveryUnit::Change { virtual void commit() {} virtual void rollback() { severe() << "Rollback of logOp not currently allowed (SERVER-15192)"; fassertFailed(18805); } }; txn->recoveryUnit()->registerChange(new RollbackPreventer()); if ( getGlobalReplicationCoordinator()->isReplEnabled() ) { _logOp(txn, opstr, ns, 0, obj, patt, b, fromMigrate); } logOpForSharding(txn, opstr, ns, obj, patt, fromMigrate); logOpForDbHash(ns); getGlobalAuthorizationManager()->logOp(opstr, ns, obj, patt, b); if ( strstr( ns, ".system.js" ) ) { Scope::storedFuncMod(); // this is terrible } } catch (const DBException& ex) { severe() << "Fatal DBException in logOp(): " << ex.toString(); std::terminate(); } catch (const std::exception& ex) { severe() << "Fatal std::exception in logOp(): " << ex.what(); std::terminate(); } catch (...) { severe() << "Fatal error in logOp()"; std::terminate(); } }
/*@ @param opstr: c userCreateNS i insert n no-op / keepalive d delete / remove u update */ void logOp(OperationContext* txn, const char* opstr, const char* ns, const BSONObj& obj, BSONObj* patt, bool* b, bool fromMigrate) { if ( replSettings.master ) { _logOp(txn, opstr, ns, 0, obj, patt, b, fromMigrate); } logOpForSharding(txn, opstr, ns, obj, patt, fromMigrate); logOpForDbHash(ns); getGlobalAuthorizationManager()->logOp(opstr, ns, obj, patt, b); if ( strstr( ns, ".system.js" ) ) { Scope::storedFuncMod(); // this is terrible } }
void logKeepalive() { BSONObj obj; _logOp("n", "", "local.oplog.$main", obj, 0, 0, OpTime::now()); }
void logOpComment(const BSONObj& obj) { _logOp("n", "", 0, obj, 0, 0); }
void logKeepalive() { _logOp("n", "", 0, BSONObj(), 0, 0); }
void logOpComment(OperationContext* txn, const BSONObj& obj) { _logOp(txn, "n", "", 0, obj, 0, 0, false); }
void logKeepalive(OperationContext* txn) { _logOp(txn, "n", "", 0, BSONObj(), 0, 0, false); }
void logOpComment(const BSONObj& obj) { OperationContextImpl txn; _logOp(&txn, "n", "", 0, obj, 0, 0, false); }
void logKeepalive() { OperationContextImpl txn; _logOp(&txn, "n", "", 0, BSONObj(), 0, 0, false); }