summaryrefslogtreecommitdiff
path: root/src/mongo/db/query
diff options
context:
space:
mode:
authorGeert Bosch <geert@mongodb.com>2015-04-23 13:45:32 -0400
committerGeert Bosch <geert@mongodb.com>2015-05-15 20:45:56 -0400
commit876e85fe54f324ac27d0d0ea875b1aaa3c8debd9 (patch)
tree127cd19292a0807bded69632595ff9e00170c7ac /src/mongo/db/query
parent5ff7104a1696494c38d80369bd9cda20bcbe973a (diff)
downloadmongo-876e85fe54f324ac27d0d0ea875b1aaa3c8debd9.tar.gz
SERVER-18168: Get rid of nested units of work in the RecoveryUnit
Diffstat (limited to 'src/mongo/db/query')
-rw-r--r--src/mongo/db/query/find.cpp9
-rw-r--r--src/mongo/db/query/find.h1
2 files changed, 7 insertions, 3 deletions
diff --git a/src/mongo/db/query/find.cpp b/src/mongo/db/query/find.cpp
index cc09944bfc6..4ada32aacc5 100644
--- a/src/mongo/db/query/find.cpp
+++ b/src/mongo/db/query/find.cpp
@@ -82,7 +82,8 @@ namespace mongo {
// Transfer ownership of the RecoveryUnit from the ClientCursor to the OpCtx.
RecoveryUnit* ccRecoveryUnit = cc->releaseOwnedRecoveryUnit();
- txn->setRecoveryUnit(ccRecoveryUnit);
+ _txnPreviousRecoveryUnitState = txn->setRecoveryUnit(ccRecoveryUnit,
+ OperationContext::kNotInUnitOfWork);
}
void ScopedRecoveryUnitSwapper::dismiss() {
@@ -101,7 +102,7 @@ namespace mongo {
_cc->setOwnedRecoveryUnit(_txn->releaseRecoveryUnit());
}
- _txn->setRecoveryUnit(_txnPreviousRecoveryUnit.release());
+ _txn->setRecoveryUnit(_txnPreviousRecoveryUnit.release(), _txnPreviousRecoveryUnitState);
}
/**
@@ -709,7 +710,9 @@ namespace mongo {
txn->recoveryUnit()->abandonSnapshot();
cc->setOwnedRecoveryUnit(txn->releaseRecoveryUnit());
StorageEngine* storageEngine = getGlobalServiceContext()->getGlobalStorageEngine();
- txn->setRecoveryUnit(storageEngine->newRecoveryUnit());
+ invariant(txn->setRecoveryUnit(storageEngine->newRecoveryUnit(),
+ OperationContext::kNotInUnitOfWork)
+ == OperationContext::kNotInUnitOfWork);
}
LOG(5) << "caching executor with cursorid " << ccId
diff --git a/src/mongo/db/query/find.h b/src/mongo/db/query/find.h
index f62b89f5c0a..929b964520c 100644
--- a/src/mongo/db/query/find.h
+++ b/src/mongo/db/query/find.h
@@ -58,6 +58,7 @@ namespace mongo {
bool _dismissed;
std::unique_ptr<RecoveryUnit> _txnPreviousRecoveryUnit;
+ OperationContext::RecoveryUnitState _txnPreviousRecoveryUnitState;
};
/**