Skip to content
Snippets Groups Projects
  • Vladislav Shpilevoy's avatar
    43d42969
    raft: introduce on_update trigger · 43d42969
    Vladislav Shpilevoy authored
    Raft state machine now has a trigger invoked each time when any of
    the visible Raft attributes is changed: state, term, vote.
    
    The trigger is needed to commit synchronous transactions of an old
    leader, when a new leader is elected. This is done via a trigger
    so as not to depend on box in raft code too much. That would make
    it harder to extract it into a new module later.
    
    The trigger is executed in the Raft worker fiber, so as not to
    stop the state machine transitions anywhere, which currently don't
    contain a single yield. And the synchronous transaction queue
    clearance requires a yield, to write CONFIRM and ROLLBACK records
    to WAL.
    
    Part of #5339
    43d42969
    History
    raft: introduce on_update trigger
    Vladislav Shpilevoy authored
    Raft state machine now has a trigger invoked each time when any of
    the visible Raft attributes is changed: state, term, vote.
    
    The trigger is needed to commit synchronous transactions of an old
    leader, when a new leader is elected. This is done via a trigger
    so as not to depend on box in raft code too much. That would make
    it harder to extract it into a new module later.
    
    The trigger is executed in the Raft worker fiber, so as not to
    stop the state machine transitions anywhere, which currently don't
    contain a single yield. And the synchronous transaction queue
    clearance requires a yield, to write CONFIRM and ROLLBACK records
    to WAL.
    
    Part of #5339