diff options
author | Jason Rassi <rassi@10gen.com> | 2014-11-04 11:44:52 -0500 |
---|---|---|
committer | Jason Rassi <rassi@10gen.com> | 2014-11-04 11:47:33 -0500 |
commit | 7849434abe5c8c24c7dd6dc7e664ebf1069c2557 (patch) | |
tree | f31b7da7541a436efae36f4c9f2ba87fd4644025 /src/mongo/db/introspect.cpp | |
parent | f91d3efd69a154d46a73caf2e6b5a5f632b56061 (diff) | |
download | mongo-7849434abe5c8c24c7dd6dc7e664ebf1069c2557.tar.gz |
SERVER-15541 Clean up some usages of WriteUnitOfWork
Removes some WriteUnitOfWork objects where they are unneeded, and
moves the declaration of some existing WriteUnitOfWork objects to
limit their scope to the write being performed (so that
yield-capable reads are not inside them).
Diffstat (limited to 'src/mongo/db/introspect.cpp')
-rw-r--r-- | src/mongo/db/introspect.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/mongo/db/introspect.cpp b/src/mongo/db/introspect.cpp index 1359abf0375..bbd5cf6c71a 100644 --- a/src/mongo/db/introspect.cpp +++ b/src/mongo/db/introspect.cpp @@ -126,14 +126,17 @@ namespace { p = b.done(); } + WriteUnitOfWork wunit(txn); + // write: not replicated // get or create the profiling collection Collection* profileCollection = getOrCreateProfileCollection(txn, db); - if ( profileCollection ) { - profileCollection->insertDocument( txn, p, false ); - return true; + if ( !profileCollection ) { + return false; } - return false; + profileCollection->insertDocument( txn, p, false ); + wunit.commit(); + return true; } void profile(OperationContext* txn, const Client& c, int op, CurOp& currentOp) { @@ -157,9 +160,7 @@ namespace { } Database* db = dbHolder().get(txn, dbname); if (db != NULL) { - // We want the profiling to happen in a different WUOW from the actual op. Lock::CollectionLock clk(txn->lockState(), db->getProfilingNS(), MODE_X); - WriteUnitOfWork wunit(txn); Client::Context cx(txn, currentOp.getNS(), false); if ( !_profile(txn, c, cx.db(), currentOp, profileBufBuilder ) && lk.get() ) { if ( tryAgain ) { @@ -170,7 +171,6 @@ namespace { tryAgain = true; continue; } - wunit.commit(); } else { mongo::log() << "note: not profiling because db went away - " |