summaryrefslogtreecommitdiff
path: root/src/mongo/db/repl/replica_set_aware_service.h
diff options
context:
space:
mode:
authorKaitlin Mahar <kaitlin.mahar@mongodb.com>2023-03-02 19:58:52 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2023-03-22 20:18:43 +0000
commit75a60fabbfd7cb3df17cc509f8babf38a1087a52 (patch)
treeaf80a3920f3f9f1651c29927e5c6b9654f65deee /src/mongo/db/repl/replica_set_aware_service.h
parent5767f6d16fbd191e3ebc3d0b929b398774a80fb6 (diff)
downloadmongo-75a60fabbfd7cb3df17cc509f8babf38a1087a52.tar.gz
SERVER-66996 Log warnings when ReplicaSetAwareServices and PrimaryOnlyServices block stepUp from completing
Diffstat (limited to 'src/mongo/db/repl/replica_set_aware_service.h')
-rw-r--r--src/mongo/db/repl/replica_set_aware_service.h19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/mongo/db/repl/replica_set_aware_service.h b/src/mongo/db/repl/replica_set_aware_service.h
index 6618b7453aa..f1af24148a4 100644
--- a/src/mongo/db/repl/replica_set_aware_service.h
+++ b/src/mongo/db/repl/replica_set_aware_service.h
@@ -146,12 +146,19 @@ public:
virtual void onShutdown() = 0;
/**
- * Called prior to stepping up as PRIMARY, i.e. after drain mode has completed.
+ * Called prior to stepping up as PRIMARY, i.e. after drain mode has completed but before
+ * the RSTL is acquired.
+ * Implementations of this method should be short-running in order to prevent blocking
+ * the stepUp from completing.
*/
virtual void onStepUpBegin(OperationContext* opCtx, long long term) = 0;
/**
- * Called after the node has transitioned to PRIMARY.
+ * Called after the node has transitioned to PRIMARY, i.e. after stepUp reconfig and after
+ * writing the first oplog entry with the new term, but before the node starts accepting
+ * writes.
+ * Implementations of this method should be short-running in order to prevent blocking
+ * the stepUp from completing.
*/
virtual void onStepUpComplete(OperationContext* opCtx, long long term) = 0;
@@ -168,6 +175,11 @@ public:
* Called when the node commences being an arbiter.
*/
virtual void onBecomeArbiter() = 0;
+
+ /**
+ * Returns the name of the service. Used for logging purposes.
+ */
+ virtual std::string getServiceName() const = 0;
};
@@ -223,6 +235,9 @@ public:
void onStepUpComplete(OperationContext* opCtx, long long term) final;
void onStepDown() final;
void onBecomeArbiter() final;
+ inline std::string getServiceName() const override final {
+ return "ReplicaSetAwareServiceRegistry";
+ }
private:
void _registerService(ReplicaSetAwareInterface* service);