From ef32ab7ca1050256b376282d019111b849fb0c7e Mon Sep 17 00:00:00 2001 From: Kaloian Manassiev Date: Mon, 9 Nov 2015 16:57:47 -0500 Subject: [PATCH] Shorten transaction length --- src/mongo/s/d_migrate.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/mongo/s/d_migrate.cpp b/src/mongo/s/d_migrate.cpp index 8ec1b1e..8a1fa5d 100644 --- a/src/mongo/s/d_migrate.cpp +++ b/src/mongo/s/d_migrate.cpp @@ -2371,13 +2371,14 @@ public: bool didAnything = false; if (xfer["deleted"].isABSONObj()) { - ScopedTransaction transaction(txn, MODE_IX); - Lock::DBLock dlk(txn->lockState(), nsToDatabaseSubstring(ns), MODE_IX); Helpers::RemoveSaver rs("moveChunk", ns, "removedDuring"); BSONObjIterator i(xfer["deleted"].Obj()); while (i.more()) { + ScopedTransaction transaction(txn, MODE_IX); + Lock::DBLock dlk(txn->lockState(), nsToDatabaseSubstring(ns), MODE_IX); Lock::CollectionLock clk(txn->lockState(), ns, MODE_X); + Client::Context ctx(txn, ns); BSONObj id = i.next().Obj(); -- 1.8.5.2.msysgit.0