summaryrefslogtreecommitdiff
path: root/src/mongo/db/repl/oplog_applier_impl.cpp
diff options
context:
space:
mode:
authorXuerui Fa <xuerui.fa@mongodb.com>2020-02-07 10:03:07 -0500
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-02-07 15:19:35 +0000
commit6e049cf9804e1d7147f5dcd6ac11b68f480d088a (patch)
treeb814a545cba6b288c4c162fdacc82c9fecc1929f /src/mongo/db/repl/oplog_applier_impl.cpp
parent656313f6c949a5c49c42d080548067d5a8c37047 (diff)
downloadmongo-6e049cf9804e1d7147f5dcd6ac11b68f480d088a.tar.gz
Revert "SERVER-43069: Condition logging for slow ops on sample rate"
This reverts commit b0c5c0baa85fba563c80ee416cecc22e9ffbf53a. delete mode 100644 src/mongo/util/log_with_sampling.h delete mode 100644 src/mongo/util/log_with_sampling_test.cpp
Diffstat (limited to 'src/mongo/db/repl/oplog_applier_impl.cpp')
-rw-r--r--src/mongo/db/repl/oplog_applier_impl.cpp19
1 files changed, 7 insertions, 12 deletions
diff --git a/src/mongo/db/repl/oplog_applier_impl.cpp b/src/mongo/db/repl/oplog_applier_impl.cpp
index 1ac70f2a05e..8b7d7ba3c41 100644
--- a/src/mongo/db/repl/oplog_applier_impl.cpp
+++ b/src/mongo/db/repl/oplog_applier_impl.cpp
@@ -48,7 +48,6 @@
#include "mongo/platform/basic.h"
#include "mongo/util/fail_point.h"
#include "mongo/util/log.h"
-#include "mongo/util/log_with_sampling.h"
#include "third_party/murmurhash3/MurmurHash3.h"
namespace mongo {
@@ -97,21 +96,17 @@ NamespaceStringOrUUID getNsOrUUID(const NamespaceString& nss, const OplogEntry&
* Used for logging a report of ops that take longer than "slowMS" to apply. This is called
* right before returning from applyOplogEntryOrGroupedInserts, and it returns the same status.
*/
-Status finishAndLogApply(OperationContext* opCtx,
- ClockSource* clockSource,
+Status finishAndLogApply(ClockSource* clockSource,
Status finalStatus,
Date_t applyStartTime,
const OplogEntryOrGroupedInserts& entryOrGroupedInserts) {
if (finalStatus.isOK()) {
auto applyEndTime = clockSource->now();
- auto opDuration = durationCount<Milliseconds>(applyEndTime - applyStartTime);
+ auto diffMS = durationCount<Milliseconds>(applyEndTime - applyStartTime);
- if (shouldLogSlowOpWithSampling(opCtx,
- MONGO_LOG_DEFAULT_COMPONENT,
- Milliseconds(opDuration),
- Milliseconds(serverGlobalParams.slowMS))
- .first) {
+ // This op was slow to apply, so we should log a report of it.
+ if (diffMS > serverGlobalParams.slowMS) {
StringBuilder s;
s << "applied op: ";
@@ -123,7 +118,7 @@ Status finishAndLogApply(OperationContext* opCtx,
}
s << redact(entryOrGroupedInserts.toBSON());
- s << ", took " << opDuration << "ms";
+ s << ", took " << diffMS << "ms";
log() << s.str();
}
@@ -976,7 +971,7 @@ Status applyOplogEntryOrGroupedInserts(OperationContext* opCtx,
throw;
}
});
- return finishAndLogApply(opCtx, clockSource, status, applyStartTime, entryOrGroupedInserts);
+ return finishAndLogApply(clockSource, status, applyStartTime, entryOrGroupedInserts);
} else if (opType == OpTypeEnum::kCommand) {
auto status =
writeConflictRetry(opCtx, "applyOplogEntryOrGroupedInserts_command", nss.ns(), [&] {
@@ -985,7 +980,7 @@ Status applyOplogEntryOrGroupedInserts(OperationContext* opCtx,
incrementOpsAppliedStats();
return status;
});
- return finishAndLogApply(opCtx, clockSource, status, applyStartTime, entryOrGroupedInserts);
+ return finishAndLogApply(clockSource, status, applyStartTime, entryOrGroupedInserts);
}
MONGO_UNREACHABLE;