summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Schwerin <schwerin@mongodb.com>2015-06-05 18:01:06 -0400
committerAndy Schwerin <schwerin@mongodb.com>2015-06-05 18:02:17 -0400
commit99efb5fc4f771feb8ae81434b4e2d6f7445665e1 (patch)
tree7776324025e2f4a7a1bd9b90bd34d3ecd3b3b9fd
parentf30bd81cdcdabe19e45ed4c45d43a87160bdc58f (diff)
downloadmongo-99efb5fc4f771feb8ae81434b4e2d6f7445665e1.tar.gz
SERVER-18277 Do not do database reads under client spinlock.
-rw-r--r--src/mongo/db/catalog/index_create.cpp3
-rw-r--r--src/mongo/db/commands/mr.cpp2
2 files changed, 3 insertions, 2 deletions
diff --git a/src/mongo/db/catalog/index_create.cpp b/src/mongo/db/catalog/index_create.cpp
index 67498ac19db..ef80ed8e1a2 100644
--- a/src/mongo/db/catalog/index_create.cpp
+++ b/src/mongo/db/catalog/index_create.cpp
@@ -226,10 +226,11 @@ namespace mongo {
Status MultiIndexBlock::insertAllDocumentsInCollection(std::set<RecordId>* dupsOut) {
const char* curopMessage = _buildInBackground ? "Index Build (background)" : "Index Build";
+ const auto numRecords = _collection->numRecords(_txn);
stdx::unique_lock<Client> lk(*_txn->getClient());
ProgressMeterHolder progress(*_txn->setMessage_inlock(curopMessage,
curopMessage,
- _collection->numRecords(_txn)));
+ numRecords));
lk.unlock();
Timer t;
diff --git a/src/mongo/db/commands/mr.cpp b/src/mongo/db/commands/mr.cpp
index 07eda7d0d22..9642c03c7c8 100644
--- a/src/mongo/db/commands/mr.cpp
+++ b/src/mongo/db/commands/mr.cpp
@@ -1378,8 +1378,8 @@ namespace mongo {
ProgressMeter& progress( op->setMessage_inlock("m/r: (1/3) emit phase",
"M/R: (1/3) Emit Progress",
progressTotal ));
- progress.showTotal(showTotal);
lk.unlock();
+ progress.showTotal(showTotal);
ProgressMeterHolder pm(progress);
// See cast on next line to 32 bit unsigned