Fix[fsm]: freeze as a means to synchronize FSMs#1257
Conversation
0a5e313 to
fb947ef
Compare
Signed-off-by: dorjesinpo <129227380+dorjesinpo@users.noreply.github.com>
fb947ef to
78c5832
Compare
|
@kaikulimu ⏺ Summary: Queue operations proceed before node is E_AVAILABLE in FSM workflow Root cause
This allows restoreStateCluster to proceed as soon as the partition primary status is E_ACTIVE, without verifying the primary node's NodeStatus is E_AVAILABLE. The Consequences
Fix hasActiveAvailablePrimary in FSM workflow should check the primary node's NodeStatus == E_AVAILABLE, same as the non-FSM path. This shoudl be fixed in #1190 |
|
|
|
And |
kaikulimu
left a comment
There was a problem hiding this comment.
Might not be the best way to solve the issue. Blocking
⏺ Problem
During cluster FSM healing,
d_queueKeyInfoMapVecis built once indo_initializeQueueKeyInfoMapon the partition thread. However, queue assignment advisories can commit on the cluster thread after this point, making the map stale. WhenFileStore::openrecovers messages from the journal, it encounters QueueOpRecord entries for newlyassigned queues that are missing from the stale map, causing recovery failure.
⏺ Solution
Added a freeze/resume mechanism to PartitionFSM, similar in spirit to a coroutine — the action chain yields at a suspension point, cross-thread work completes, and the
chain resumes where it left off. When the action chain reaches do_attemptOpenStorage, it:
d_isFreezeRequested= true, which suspends the action chain at the current index and freezes the FSM (no new events are processed; they queue up).QueueKeyInfoMapfrom the currentClusterState.FileStore, and callsfsm->unfreeze()to resume the chain and drain queued events.Key design details:
enqueueEventcalls see size() > 1 and defer, matching normal (non-frozen) behavior.processEventdetectsd_chainResumeIndex > 0, skips the state transition (already done), and re-entersexecuteChainat the saved index.d_queueKeyInfoMapVecwas changed fromvector<QueueKeyInfoMap>tovector<shared_ptr<QueueKeyInfoMap>>for safe cross-thread handoff.