From 1a00fd8cf1d7e3eb88c031e58b6e5014b587fec1 Mon Sep 17 00:00:00 2001 From: Judah Schvimer Date: Fri, 1 Jul 2016 11:40:34 -0400 Subject: SERVER-24733 use ScopedTransactions to abandon snapshots in replication storage interface --- src/mongo/db/repl/storage_interface_impl.cpp | 3 +++ src/mongo/db/repl/sync_tail.cpp | 3 --- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/mongo/db/repl') diff --git a/src/mongo/db/repl/storage_interface_impl.cpp b/src/mongo/db/repl/storage_interface_impl.cpp index 4fc7115c8a5..4a7d63ccd31 100644 --- a/src/mongo/db/repl/storage_interface_impl.cpp +++ b/src/mongo/db/repl/storage_interface_impl.cpp @@ -328,6 +328,7 @@ Status StorageInterfaceImpl::insertDocuments(OperationContext* txn, << " - no documents provided"}; } MONGO_WRITE_CONFLICT_RETRY_LOOP_BEGIN { + ScopedTransaction transaction(txn, MODE_IX); AutoGetCollection autoColl(txn, nss, MODE_IX); auto collection = autoColl.getCollection(); if (!collection) { @@ -364,6 +365,7 @@ Status StorageInterfaceImpl::createCollection(OperationContext* txn, const NamespaceString& nss, const CollectionOptions& options) { MONGO_WRITE_CONFLICT_RETRY_LOOP_BEGIN { + ScopedTransaction transaction(txn, MODE_IX); AutoGetOrCreateDb databaseWriteGuard(txn, nss.db(), MODE_X); auto db = databaseWriteGuard.getDb(); invariant(db); @@ -424,6 +426,7 @@ StatusWith _findOrDeleteOne(OperationContext* txn, MONGO_WRITE_CONFLICT_RETRY_LOOP_BEGIN { auto collectionAccessMode = isFind ? MODE_IS : MODE_IX; + ScopedTransaction transaction(txn, collectionAccessMode); AutoGetCollection collectionGuard(txn, nss, collectionAccessMode); auto collection = collectionGuard.getCollection(); if (!collection) { diff --git a/src/mongo/db/repl/sync_tail.cpp b/src/mongo/db/repl/sync_tail.cpp index 900eb781108..f1efcc38297 100644 --- a/src/mongo/db/repl/sync_tail.cpp +++ b/src/mongo/db/repl/sync_tail.cpp @@ -815,9 +815,6 @@ void SyncTail::oplogApplication() { bool SyncTail::tryPopAndWaitForMore(OperationContext* txn, SyncTail::OpQueue* ops) { { BSONObj op; - // We must abandon the snapshot for collection based implementations of the oplog buffer. - // This ensures that we always read data that is up to date. - txn->recoveryUnit()->abandonSnapshot(); // Check to see if there are ops waiting in the bgsync queue bool peek_success = peek(txn, &op); if (!peek_success) { -- cgit v1.2.1