summaryrefslogtreecommitdiff
path: root/src/mongo/db
diff options
context:
space:
mode:
authorJudah Schvimer <judah@mongodb.com>2016-07-01 11:40:34 -0400
committerJudah Schvimer <judah@mongodb.com>2016-07-01 11:40:34 -0400
commit1a00fd8cf1d7e3eb88c031e58b6e5014b587fec1 (patch)
treefd9ecb796377da90b73bd32f46155b748fa8b36e /src/mongo/db
parentae553b840ac19a4f2bedd0e2fb701c4fb8a5a123 (diff)
downloadmongo-1a00fd8cf1d7e3eb88c031e58b6e5014b587fec1.tar.gz
SERVER-24733 use ScopedTransactions to abandon snapshots in replication storage interface
Diffstat (limited to 'src/mongo/db')
-rw-r--r--src/mongo/db/repl/storage_interface_impl.cpp3
-rw-r--r--src/mongo/db/repl/sync_tail.cpp3
2 files changed, 3 insertions, 3 deletions
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<BSONObj> _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) {