void TxnCompleteHooksImpl::noteTxnCompletedInserts(const string &ns, const BSONObj &minPK, long long nDelta, long long sizeDelta, bool committed) { Lock::DBRead lk(ns); if (dbHolder().__isLoaded(ns, dbpath)) { scoped_ptr<Client::Context> ctx(cc().getContext() == NULL ? new Client::Context(ns) : NULL); // Because this transaction did inserts, we're guarunteed to be the // only party capable of closing/reopening the ns due to file-ops. // So, if the ns is open, note the commit/abort to fix up in-memory // stats and do nothing otherwise since there are no stats to fix. NamespaceIndex *ni = nsindex(ns.c_str()); NamespaceDetails *d = ni->find_ns(ns.c_str()); if (d != NULL) { if (committed) { d->noteCommit(minPK, nDelta, sizeDelta); } else { d->noteAbort(minPK, nDelta, sizeDelta); } } } }