summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Gottlieb <daniel.gottlieb@mongodb.com>2017-11-17 21:32:46 -0500
committerDaniel Gottlieb <daniel.gottlieb@mongodb.com>2017-11-18 20:26:28 -0500
commit8d82a4d0fbefa18bb4ed458164989afe6d9793ef (patch)
treec153fc626a3f857acd9b274af67150633971e599 /src
parent78a87f7580736c7fbe7ee48d8c7c00716fbc913e (diff)
downloadmongo-8d82a4d0fbefa18bb4ed458164989afe6d9793ef.tar.gz
SERVER-32030: Divide SyncTail::oplogApplication OperationContext lifetime into smaller chunks.
Diffstat (limited to 'src')
-rw-r--r--src/mongo/db/repl/sync_tail.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/mongo/db/repl/sync_tail.cpp b/src/mongo/db/repl/sync_tail.cpp
index 0c7c9ca3e76..2cfe1120f13 100644
--- a/src/mongo/db/repl/sync_tail.cpp
+++ b/src/mongo/db/repl/sync_tail.cpp
@@ -33,23 +33,23 @@
#include "mongo/db/repl/sync_tail.h"
+#include "third_party/murmurhash3/MurmurHash3.h"
#include <boost/functional/hash.hpp>
#include <memory>
-#include "third_party/murmurhash3/MurmurHash3.h"
#include "mongo/base/counter.h"
#include "mongo/db/auth/authorization_session.h"
#include "mongo/db/catalog/collection.h"
-#include "mongo/db/catalog/database_holder.h"
#include "mongo/db/catalog/database.h"
+#include "mongo/db/catalog/database_holder.h"
#include "mongo/db/catalog/document_validation.h"
#include "mongo/db/commands/fsync.h"
#include "mongo/db/commands/server_status_metric.h"
#include "mongo/db/concurrency/d_concurrency.h"
#include "mongo/db/concurrency/write_conflict_exception.h"
-#include "mongo/db/dbhelpers.h"
#include "mongo/db/curop.h"
#include "mongo/db/db_raii.h"
+#include "mongo/db/dbhelpers.h"
#include "mongo/db/global_timestamp.h"
#include "mongo/db/operation_context_impl.h"
#include "mongo/db/prefetch.h"
@@ -708,8 +708,12 @@ private:
void SyncTail::oplogApplication(StorageInterface* storageInterface) {
OpQueueBatcher batcher(this, storageInterface);
- OperationContextImpl txn;
- auto replCoord = ReplicationCoordinator::get(&txn);
+ ReplicationCoordinator* replCoord;
+ {
+ OperationContextImpl txn;
+ replCoord = ReplicationCoordinator::get(&txn);
+ }
+
std::unique_ptr<ApplyBatchFinalizer> finalizer{
getGlobalServiceContext()->getGlobalStorageEngine()->isDurable()
? new ApplyBatchFinalizerForJournal(replCoord)
@@ -717,6 +721,7 @@ void SyncTail::oplogApplication(StorageInterface* storageInterface) {
while (!inShutdown()) {
OpQueue ops;
+ OperationContextImpl txn;
do {
if (BackgroundSync::get()->getInitialSyncRequestedFlag()) {