summaryrefslogtreecommitdiff
path: root/src/mongo/db/repl/sync_tail.cpp
diff options
context:
space:
mode:
authorAndy Schwerin <schwerin@mongodb.com>2016-04-16 12:24:16 -0400
committerAndy Schwerin <schwerin@mongodb.com>2016-04-18 23:44:56 -0400
commit0ab34aa7b9c3c48ea6cf17888620fca455284d35 (patch)
tree9d592c0427229b53bdea159617f7de5d3c6ff819 /src/mongo/db/repl/sync_tail.cpp
parentbdc06761206ac398af04f0a2eb482c4dca49bad8 (diff)
downloadmongo-0ab34aa7b9c3c48ea6cf17888620fca455284d35.tar.gz
SERVER-23779 Replace direct instantiation of OperationContextImpl with cc().makeOperationContext().
Also, make OperationContextImpl's constructor private so that it can only be constructed via a Client.
Diffstat (limited to 'src/mongo/db/repl/sync_tail.cpp')
-rw-r--r--src/mongo/db/repl/sync_tail.cpp21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/mongo/db/repl/sync_tail.cpp b/src/mongo/db/repl/sync_tail.cpp
index e6e9e69cca0..0c8d5af2264 100644
--- a/src/mongo/db/repl/sync_tail.cpp
+++ b/src/mongo/db/repl/sync_tail.cpp
@@ -40,18 +40,18 @@
#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/client.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"
#include "mongo/db/query/query_knobs.h"
#include "mongo/db/repl/bgsync.h"
@@ -418,7 +418,8 @@ void prefetchOp(const BSONObj& op) {
try {
// one possible tweak here would be to stay in the read lock for this database
// for multiple prefetches if they are for the same database.
- OperationContextImpl txn;
+ const ServiceContext::UniqueOperationContext txnPtr = cc().makeOperationContext();
+ OperationContext& txn = *txnPtr;
AutoGetCollectionForRead ctx(&txn, ns);
Database* db = ctx.getDb();
if (db) {
@@ -611,7 +612,8 @@ public:
private:
void run() {
Client::initThread("ReplBatcher");
- OperationContextImpl txn;
+ const ServiceContext::UniqueOperationContext txnPtr = cc().makeOperationContext();
+ OperationContext& txn = *txnPtr;
auto replCoord = ReplicationCoordinator::get(&txn);
while (!_inShutdown.load()) {
@@ -683,7 +685,8 @@ private:
void SyncTail::oplogApplication() {
OpQueueBatcher batcher(this);
- OperationContextImpl txn;
+ const ServiceContext::UniqueOperationContext txnPtr = cc().makeOperationContext();
+ OperationContext& txn = *txnPtr;
auto replCoord = ReplicationCoordinator::get(&txn);
std::unique_ptr<ApplyBatchFinalizer> finalizer{
getGlobalServiceContext()->getGlobalStorageEngine()->isDurable()
@@ -983,7 +986,8 @@ void multiSyncApply(const std::vector<OplogEntry>& ops) {
}
initializeWriterThread();
- OperationContextImpl txn;
+ const ServiceContext::UniqueOperationContext txnPtr = cc().makeOperationContext();
+ OperationContext& txn = *txnPtr;
txn.setReplicatedWrites(false);
DisableDocumentValidation validationDisabler(&txn);
@@ -1089,7 +1093,8 @@ void multiSyncApply(const std::vector<OplogEntry>& ops) {
void multiInitialSyncApply(const std::vector<OplogEntry>& ops) {
initializeWriterThread();
- OperationContextImpl txn;
+ const ServiceContext::UniqueOperationContext txnPtr = cc().makeOperationContext();
+ OperationContext& txn = *txnPtr;
txn.setReplicatedWrites(false);
DisableDocumentValidation validationDisabler(&txn);