-
Type:
Task
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
Replication
-
None
-
None
-
None
-
None
-
None
-
None
-
None
Several of our classes can be modeled as state machines, where each states has a set of states it is allowed to transition to.
These state machines are often implemented as enum classes, where the set of legal state transitions is, at times, undocumented and unenforced.
Having a generic CRTP state machine class would allow us to:
- have a standard way of defining state machines, making our classes easier to understand
- document and enforce the validity of certain state transitions
- customize the handling of illegal state transitions
- discover existing bugs related to illegal state transitions, and customize our handling of them
- make our classes' state machine part of the class' type itself, rather than a private: implementation detail
- reason about other classes based on the states they present
Some examples of existing state machines:
- ✓ documented in replication_coordinator.h
- not enforced
- not documented
- not enforced
ReplicationCoordinatorImpl::ConfigState
- ✓ documented in replication_coordinator_impl.h
- not enforced
- not documented
- ✓ enforced
- ✓ documented in abstract_async_component.h
- not enforced
- ✓ documented in sync_source_resolver.h
- not enforced
- ✓ documented in bgsync.h
- not enforced
- related to
-
SERVER-113435 Implement state transition checks for our state machines
-
- Needs Scheduling
-