summaryrefslogtreecommitdiff
path: root/src/mongo/s
diff options
context:
space:
mode:
authorAllison Easton <allison.easton@mongodb.com>2020-06-22 21:41:02 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-06-25 20:10:38 +0000
commit47dcbeba765b04a829be9c27289e152e24e1a855 (patch)
tree22a37e14e5cc01fe9af9029e4cdf68eadd82e9ac /src/mongo/s
parent78168e2c40cb61431e9bb0591a08e724459895f8 (diff)
downloadmongo-47dcbeba765b04a829be9c27289e152e24e1a855.tar.gz
SERVER-48174 Add log component and LOGV2 messages in server to measure latency of migration protocol stages
Diffstat (limited to 'src/mongo/s')
-rw-r--r--src/mongo/s/write_ops/batch_write_exec.cpp18
-rw-r--r--src/mongo/s/write_ops/cluster_write.cpp8
2 files changed, 26 insertions, 0 deletions
diff --git a/src/mongo/s/write_ops/batch_write_exec.cpp b/src/mongo/s/write_ops/batch_write_exec.cpp
index ac6080c91f3..a93ea4548bf 100644
--- a/src/mongo/s/write_ops/batch_write_exec.cpp
+++ b/src/mongo/s/write_ops/batch_write_exec.cpp
@@ -425,12 +425,30 @@ void BatchWriteExec::executeBatch(OperationContext* opCtx,
bool targeterChanged = false;
try {
+ LOGV2_DEBUG_OPTIONS(4817406,
+ 2,
+ {logv2::LogComponent::kShardMigrationPerf},
+ "Starting post-migration commit refresh on the router");
targeter.refreshIfNeeded(opCtx, &targeterChanged);
+ LOGV2_DEBUG_OPTIONS(4817407,
+ 2,
+ {logv2::LogComponent::kShardMigrationPerf},
+ "Finished post-migration commit refresh on the router");
} catch (const ExceptionFor<ErrorCodes::StaleEpoch>& ex) {
+ LOGV2_DEBUG_OPTIONS(4817408,
+ 2,
+ {logv2::LogComponent::kShardMigrationPerf},
+ "Finished post-migration commit refresh on the router with error",
+ "error"_attr = redact(ex));
batchOp.abortBatch(errorFromStatus(
ex.toStatus("collection was dropped in the middle of the operation")));
break;
} catch (const DBException& ex) {
+ LOGV2_DEBUG_OPTIONS(4817409,
+ 2,
+ {logv2::LogComponent::kShardMigrationPerf},
+ "Finished post-migration commit refresh on the router with error",
+ "error"_attr = redact(ex));
// It's okay if we can't refresh, we'll just record errors for the ops if needed
LOGV2_WARNING(22911,
"Could not refresh targeter due to {error}",
diff --git a/src/mongo/s/write_ops/cluster_write.cpp b/src/mongo/s/write_ops/cluster_write.cpp
index bf5e372ca0a..7eb81995521 100644
--- a/src/mongo/s/write_ops/cluster_write.cpp
+++ b/src/mongo/s/write_ops/cluster_write.cpp
@@ -29,6 +29,8 @@
#define MONGO_LOGV2_DEFAULT_COMPONENT ::mongo::logv2::LogComponent::kSharding
+#include "mongo/logv2/log.h"
+
#include "mongo/platform/basic.h"
#include "mongo/s/write_ops/cluster_write.h"
@@ -53,7 +55,13 @@ void ClusterWriter::write(OperationContext* opCtx,
return;
}
+ LOGV2_DEBUG_OPTIONS(
+ 4817400, 2, {logv2::LogComponent::kShardMigrationPerf}, "Starting batch write");
+
BatchWriteExec::executeBatch(opCtx, targeter, request, response, stats);
+
+ LOGV2_DEBUG_OPTIONS(
+ 4817401, 2, {logv2::LogComponent::kShardMigrationPerf}, "Finished batch write");
}
} // namespace mongo