mirror of
https://github.com/mongodb/mongo.git
synced 2024-11-24 00:17:37 +01:00
Revert "SERVER-95422: restructured totalOplogSlotDurationMicros calculation (#29229)" (#29324)
GitOrigin-RevId: c42360f47df49b24ca49def2f472fa481852573c
This commit is contained in:
parent
2b016294ed
commit
271b83ed50
@ -913,7 +913,6 @@ mongo_cc_library(
|
||||
"//src/mongo/db/auth:authprivilege", # TODO(SERVER-93876): Remove.
|
||||
"//src/mongo/db/auth:user_acquisition_stats",
|
||||
"//src/mongo/db/catalog:collection_options", # TODO(SERVER-93876): Remove.
|
||||
"//src/mongo/db/catalog:local_oplog_info",
|
||||
"//src/mongo/db/commands:create_command", # TODO(SERVER-93876): Remove.
|
||||
"//src/mongo/db/commands:server_status_core", # TODO(SERVER-93876): Remove.
|
||||
"//src/mongo/db/commands:test_commands_enabled", # TODO(SERVER-93876): Remove.
|
||||
|
@ -86,6 +86,7 @@ mongo_cc_library(
|
||||
],
|
||||
deps = [
|
||||
"//src/mongo/db:server_base", # TODO(SERVER-93876): Remove.
|
||||
"//src/mongo/db:shard_role_api", # TODO(SERVER-93876): Remove.
|
||||
"//src/mongo/db:vector_clock_mutable",
|
||||
"//src/mongo/db/repl:optime",
|
||||
"//src/mongo/db/repl:repl_coordinator_interface", # TODO(SERVER-93876): Remove.
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include <mutex>
|
||||
#include <utility>
|
||||
|
||||
#include "mongo/db/curop.h"
|
||||
#include "mongo/db/logical_time.h"
|
||||
#include "mongo/db/repl/oplog.h"
|
||||
#include "mongo/db/repl/optime.h"
|
||||
@ -153,8 +154,7 @@ std::vector<OplogSlot> LocalOplogInfo::getNextOpTimes(OperationContext* opCtx, s
|
||||
// If we abort a transaction that has reserved an optime, we should make sure to update the
|
||||
// stable timestamp if necessary, since this oplog hole may have been holding back the stable
|
||||
// timestamp.
|
||||
shard_role_details::getRecoveryUnit(opCtx)->onRollback([this,
|
||||
replCoord,
|
||||
shard_role_details::getRecoveryUnit(opCtx)->onRollback([replCoord,
|
||||
oplogSlotDurationTimer,
|
||||
isFirstOpTime,
|
||||
prevAssertOnLockAttempt,
|
||||
@ -162,7 +162,8 @@ std::vector<OplogSlot> LocalOplogInfo::getNextOpTimes(OperationContext* opCtx, s
|
||||
OperationContext* opCtx) {
|
||||
replCoord->attemptToAdvanceStableTimestamp();
|
||||
// Sum the oplog slot durations. An operation may participate in multiple transactions.
|
||||
_totalOplogSlotDurationMicros += Microseconds(oplogSlotDurationTimer.elapsed());
|
||||
CurOp::get(opCtx)->debug().totalOplogSlotDurationMicros +=
|
||||
Microseconds(oplogSlotDurationTimer.elapsed());
|
||||
|
||||
// Only reset these properties when the first slot is released.
|
||||
if (isFirstOpTime) {
|
||||
@ -171,22 +172,21 @@ std::vector<OplogSlot> LocalOplogInfo::getNextOpTimes(OperationContext* opCtx, s
|
||||
}
|
||||
});
|
||||
|
||||
shard_role_details::getRecoveryUnit(opCtx)->onCommit([this,
|
||||
oplogSlotDurationTimer,
|
||||
isFirstOpTime,
|
||||
prevAssertOnLockAttempt,
|
||||
prevRuBlockingAllowed](
|
||||
OperationContext* opCtx,
|
||||
boost::optional<Timestamp>) {
|
||||
// Sum the oplog slot durations. An operation may participate in multiple transactions.
|
||||
_totalOplogSlotDurationMicros += Microseconds(oplogSlotDurationTimer.elapsed());
|
||||
shard_role_details::getRecoveryUnit(opCtx)->onCommit(
|
||||
[oplogSlotDurationTimer, isFirstOpTime, prevAssertOnLockAttempt, prevRuBlockingAllowed](
|
||||
OperationContext* opCtx, boost::optional<Timestamp>) {
|
||||
// Sum the oplog slot durations. An operation may participate in multiple transactions.
|
||||
CurOp::get(opCtx)->debug().totalOplogSlotDurationMicros +=
|
||||
Microseconds(oplogSlotDurationTimer.elapsed());
|
||||
|
||||
// Only reset these properties when the first slot is released.
|
||||
if (isFirstOpTime) {
|
||||
shard_role_details::getLocker(opCtx)->setAssertOnLockAttempt(prevAssertOnLockAttempt);
|
||||
shard_role_details::getRecoveryUnit(opCtx)->setBlockingAllowed(prevRuBlockingAllowed);
|
||||
}
|
||||
});
|
||||
// Only reset these properties when the first slot is released.
|
||||
if (isFirstOpTime) {
|
||||
shard_role_details::getLocker(opCtx)->setAssertOnLockAttempt(
|
||||
prevAssertOnLockAttempt);
|
||||
shard_role_details::getRecoveryUnit(opCtx)->setBlockingAllowed(
|
||||
prevRuBlockingAllowed);
|
||||
}
|
||||
});
|
||||
|
||||
return oplogSlots;
|
||||
}
|
||||
|
@ -58,9 +58,6 @@ public:
|
||||
RecordStore* getRecordStore() const;
|
||||
void setRecordStore(RecordStore* rs);
|
||||
void resetRecordStore();
|
||||
auto getTotalOplogSlotDurationMicros() const {
|
||||
return _totalOplogSlotDurationMicros;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the global Timestamp to be 'newTime'.
|
||||
@ -79,12 +76,6 @@ private:
|
||||
// destroyed. See "oplogCheckCloseDatabase".
|
||||
RecordStore* _rs = nullptr;
|
||||
|
||||
// Stores the total time an operation spends with an uncommitted oplog slot held open. Indicator
|
||||
// that an operation is holding back replication by causing oplog holes to remain open for
|
||||
// unusual amounts of time.
|
||||
Microseconds _totalOplogSlotDurationMicros{0};
|
||||
|
||||
|
||||
// Synchronizes the section where a new Timestamp is generated and when it is registered in the
|
||||
// storage engine.
|
||||
mutable stdx::mutex _newOpMutex;
|
||||
|
@ -53,7 +53,6 @@
|
||||
#include "mongo/db/admission/execution_admission_context.h"
|
||||
#include "mongo/db/admission/ingress_admission_context.h"
|
||||
#include "mongo/db/auth/user_name.h"
|
||||
#include "mongo/db/catalog/local_oplog_info.h"
|
||||
#include "mongo/db/client.h"
|
||||
#include "mongo/db/commands.h"
|
||||
#include "mongo/db/commands/server_status_metric.h"
|
||||
@ -1166,9 +1165,7 @@ void OpDebug::report(OperationContext* opCtx,
|
||||
pAttrs->add("placementVersionRefreshDuration", placementVersionRefreshMillis);
|
||||
}
|
||||
|
||||
if (const auto& totalOplogSlotDurationMicros =
|
||||
LocalOplogInfo::get(opCtx)->getTotalOplogSlotDurationMicros();
|
||||
totalOplogSlotDurationMicros > Microseconds::zero()) {
|
||||
if (totalOplogSlotDurationMicros > Microseconds::zero()) {
|
||||
pAttrs->add("totalOplogSlotDuration", totalOplogSlotDurationMicros);
|
||||
}
|
||||
|
||||
@ -1553,9 +1550,7 @@ void OpDebug::append(OperationContext* opCtx,
|
||||
|
||||
OPDEBUG_APPEND_OPTIONAL(b, "estimatedCardinality", estimatedCardinality);
|
||||
|
||||
if (const auto& totalOplogSlotDurationMicros =
|
||||
LocalOplogInfo::get(opCtx)->getTotalOplogSlotDurationMicros();
|
||||
totalOplogSlotDurationMicros > Microseconds::zero()) {
|
||||
if (totalOplogSlotDurationMicros > Microseconds::zero()) {
|
||||
b.appendNumber("totalOplogSlotDurationMicros",
|
||||
durationCount<Microseconds>(totalOplogSlotDurationMicros));
|
||||
}
|
||||
@ -1905,10 +1900,9 @@ std::function<BSONObj(ProfileFilter::Args)> OpDebug::appendStaged(StringSet requ
|
||||
});
|
||||
|
||||
addIfNeeded("totalOplogSlotDurationMicros", [](auto field, auto args, auto& b) {
|
||||
if (const auto& totalOplogSlotDurationMicros =
|
||||
LocalOplogInfo::get(args.opCtx)->getTotalOplogSlotDurationMicros();
|
||||
totalOplogSlotDurationMicros > Nanoseconds::zero()) {
|
||||
b.appendNumber(field, durationCount<Microseconds>(totalOplogSlotDurationMicros));
|
||||
if (args.op.totalOplogSlotDurationMicros > Nanoseconds::zero()) {
|
||||
b.appendNumber(field,
|
||||
durationCount<Microseconds>(args.op.totalOplogSlotDurationMicros));
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -506,6 +506,11 @@ public:
|
||||
// Stores the duration of execution after removing time spent blocked.
|
||||
Milliseconds workingTimeMillis{0};
|
||||
|
||||
// Stores the total time an operation spends with an uncommitted oplog slot held open. Indicator
|
||||
// that an operation is holding back replication by causing oplog holes to remain open for
|
||||
// unusual amounts of time.
|
||||
Microseconds totalOplogSlotDurationMicros{0};
|
||||
|
||||
// Stores the amount of the data processed by the throttle cursors in MB/sec.
|
||||
boost::optional<float> dataThroughputLastSecond;
|
||||
boost::optional<float> dataThroughputAverage;
|
||||
|
@ -204,6 +204,7 @@ mongo_cc_library(
|
||||
":flow_control_parameters",
|
||||
"//src/mongo/db:server_base",
|
||||
"//src/mongo/db:service_context", # TODO(SERVER-93876): Remove.
|
||||
"//src/mongo/db:shard_role_api",
|
||||
"//src/mongo/db/commands:server_status_core",
|
||||
"//src/mongo/db/concurrency:flow_control_ticketholder",
|
||||
"//src/mongo/util:background_job",
|
||||
|
Loading…
Reference in New Issue
Block a user