summaryrefslogtreecommitdiff
path: root/src/mongo
diff options
context:
space:
mode:
authorVesselina Ratcheva <vesselina.ratcheva@10gen.com>2018-02-05 18:38:19 -0500
committerVesselina Ratcheva <vesselina.ratcheva@10gen.com>2018-03-01 18:30:50 -0500
commit239cd620f15e09f78cd28f073b1a6c23c1d73e97 (patch)
tree9a7348c321a79f4376e9389be05109b83f21cad1 /src/mongo
parent182fb51c90d6d0ce6a2539d5416a90bbd6a0eee6 (diff)
downloadmongo-239cd620f15e09f78cd28f073b1a6c23c1d73e97.tar.gz
SERVER-31399 Include time spent applying batches in repl.apply.batches.totalMillis
(cherry picked from commit d9038eb6236a7351addf8a58ce204be575bcb079) SERVER-33448 Relax time diff requirements in apply_batches_totalMillis.js (cherry picked from commit 04cc084048a5f37c9d10ee3bac9dbef1e89672c5)
Diffstat (limited to 'src/mongo')
-rw-r--r--src/mongo/db/repl/sync_tail.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/mongo/db/repl/sync_tail.cpp b/src/mongo/db/repl/sync_tail.cpp
index bc1c0824a6e..3f65e3fc6b7 100644
--- a/src/mongo/db/repl/sync_tail.cpp
+++ b/src/mongo/db/repl/sync_tail.cpp
@@ -448,7 +448,6 @@ void applyOps(std::vector<MultiApplier::OperationPtrs>& writerVectors,
const MultiApplier::ApplyOperationFn& func,
std::vector<Status>* statusVector) {
invariant(writerVectors.size() == statusVector->size());
- TimerHolder timer(&applyBatchStats);
for (size_t i = 0; i < writerVectors.size(); i++) {
if (!writerVectors[i].empty()) {
writerPool->schedule([&func, &writerVectors, statusVector, i] {
@@ -1323,6 +1322,9 @@ StatusWith<OpTime> multiApply(OperationContext* txn,
std::vector<Status> statusVector(workerPool->getNumThreads(), Status::OK());
{
+ // Each node records cumulative batch application stats for itself using this timer.
+ TimerHolder timer(&applyBatchStats);
+
// We must wait for the all work we've dispatched to complete before leaving this block
// because the spawned threads refer to objects on our stack, including writerVectors.
std::vector<MultiApplier::OperationPtrs> writerVectors(workerPool->getNumThreads());