Documentation

CslibFrontier.Computability.Distributed.AtomicCommit.ThreePhaseCommit

Global-Phase Three-Phase Commit and Partition-Cut Impossibility Steps #

This module proves two intermediate steps toward non-blocking crash recovery and network-partition impossibility (after [Ske81] and [SS83]), not the cited message-passing 3PC and crash-recovery endpoints (#7289):

  1. Global-phase FSA and survivor-polling Three-Phase Commit (3PC) step (after [Ske81], §§2–5, pp. 135–141): Inserting the committable buffer state .preCommitted (p_i) between .uncertain (w_i) and .committed (c_i) ([Ske81], §4, Figure 6, p. 139; §5, Figure 7, p. 140) separates .uncertain operational sites from .committed sites. Unlike TwoPCState and CommitProtocol, ThreePCState and threePCStep? model centralized 3PC at the global-phase FSA level via coordinator-directed phase-guarded single-site state updates (omitting in-flight message buffers), computes backupPhase by polling all operational survivors alive in one electBackup step (whereas [Ske81]'s Central Site Termination Protocol on p. 141 branches on the elected backup's own local state over messages), and is not yet instantiated as a CommitProtocol or extended with crash-recovery restarts or decentralized quorum 3PC (#7289). Within this global-phase model we prove:

  2. Partition-cut impossibility step over CommitProtocol (after [SS83], §V-A, Theorem 4, p. 225, and Appendix Proof of Theorem 4, p. 227): For asynchronous point-to-point message-passing protocols (CommitProtocol with NormalStep and group-informed TimeoutStep, without crash-recovery states, undeliverable-message notification, or a 3PC instantiation; #7289) subject to cross-group message erasure cutCfg, no protocol satisfies CommitProtocol.IsPartitionCutResilient G₁ G₂ for any nonempty disjoint groups (G₁, G₂) (not_nonblocking_atomicCommit_of_partitionCut). When 2 ≤ Fintype.card P, such a simple bipartition (G₁ ∪ G₂ = Finset.univ) always exists (not_exists_partitionCutResilient_atomicCommit).

Main definitions #

Main results #

References #

Part I: Global-phase Three-Phase Commit (3PC) step #

Local automaton states of Skeen's Three-Phase Commit ([Ske81], §4, Figure 6, p. 139; §5, Figure 7, p. 140).

  • init : ThreePCLocalState

    Initial state (q_i) prior to casting a vote.

  • uncertain : ThreePCLocalState

    Uncertain / wait state (w_i) after voting .yes, prior to receiving PreCommit.

  • preCommitted : ThreePCLocalState

    Buffer "prepare to commit" state (p_i), occupancy of which guarantees all sites voted .yes while still permitting coordinated abort if no survivor has committed.

  • committed : ThreePCLocalState

    Irreversible committed state (c_i).

  • aborted : ThreePCLocalState

    Irreversible aborted state (a_i).

Instances For

    Skeen's committability predicate ([Ske81], §2, pp. 136–137): occupancy of .preCommitted or .committed implies every site voted .yes.

    Protocol phase directed by the active primary or backup coordinator in 3PC.

    Instances For

      Global configuration of Skeen's 3PC in the fail-stop accurate-timeout model.

      • coord : P

        Currently designated coordinator (primary initially; updated by electBackup on crash).

      • phase : ThreePCPhase

        Active phase of coord.

      • alive : Finset P

        Operational (non-crashed) sites.

      • localState : P → ThreePCLocalState

        Local state of each site (preserved permanently across crashes).

      Decision vector of a ThreePCState across all sites (operational or crashed).

      Initial global configuration of 3PC with primary coordinator coord.

      Survivor-polling backup coordinator phase rule for the global-phase 3PC step (after [Ske81], pp. 140–141, not the message-passing Central Site Termination Protocol; #7289): poll the operational survivors alive:

      Unlike [Ske81]'s Central Site Termination Protocol on p. 141, which branches on the elected backup coordinator's own local state and broadcasts that state over messages in Phase 1, this step polls all survivors in alive directly (#7289).

      Closed-form post-failover configuration computed when surviving backup coordinator b completes Skeen's termination protocol across s.alive without further crashes.

      Transition labels of the 3PC operational LTS.

      Instances For
        @[instance_reducible]

        Whether a ThreePCAction involves no new site crashes.

        Partial transition function of Skeen's 3PC with fail-stop crashes and backup coordinator failover.

        Operational Cslib.LTS of the global-phase 3PC step under fail-stop crashes and survivor polling (after [Ske81], §§2–5, pp. 135–141; #7289).

        def Cslib.Distributed.AtomicCommit.ThreePCReachable {P : Type u_1} [DecidableEq P] [Fintype P] (coord₀ : P) (votes : P → Vote) (s : ThreePCState P) :

        Reachability of a 3PC configuration from threePCStart P coord₀ in the global-phase 3PC step.

        Global-phase state invariant, safety, and survivor termination steps #

        theorem Cslib.Distributed.AtomicCommit.threePC_decision_stable_globalPhase {P : Type u_1} [DecidableEq P] [Fintype P] {votes : P → Vote} {s s' : ThreePCState P} (hreach : (threePCLts votes).CanReach s s') {p : P} {d : Decision} (hd : s.decision p = some d) :
        s'.decision p = some d

        Global-phase FSA step toward [Ske81], §5 (pp. 140–141), not the cited message-passing 3PC result (#7289): local decisions are irreversible along all reachable transitions of threePCLts (normal phase steps, crashes, and backup coordinator failovers).

        Global-phase FSA step toward [Ske81], §4, Theorem 1 (p. 138), not the cited message-passing 3PC result (#7289): in every reachable configuration of threePCLts (across single-site phase steps, fail-stop crashes, and survivor-polling backup failovers), if any operational site is .init or .uncertain, then no site—operational or crashed—has decided .commit.

        theorem Cslib.Distributed.AtomicCommit.threePC_agreement_globalPhase {P : Type u_1} [DecidableEq P] [Fintype P] {coord₀ : P} {votes : P → Vote} {s : ThreePCState P} (hreach : ThreePCReachable coord₀ votes s) :

        Global-phase FSA step toward [Ske81], §§4–5 (pp. 138–141), not the cited message-passing 3PC result (#7289): in every reachable configuration of threePCLts, all decided sites (operational or crashed) satisfy UniformAgreement (AC1).

        theorem Cslib.Distributed.AtomicCommit.threePC_abort_of_vote_no_globalPhase {P : Type u_1} [DecidableEq P] [Fintype P] {coord₀ : P} {votes : P → Vote} {s : ThreePCState P} (hreach : ThreePCReachable coord₀ votes s) :

        Global-phase FSA step toward [Ske81], §§4–5 (pp. 138–141), not the cited message-passing 3PC result (#7289): if any site voted .no, no site decides .commit in any reachable configuration of threePCLts (AC2).

        Crash-free batch execution helpers, AC3, and non-blocking backup termination #

        theorem Cslib.Distributed.AtomicCommit.threePC_failureFree_commit_globalPhase {P : Type u_1} [DecidableEq P] [Fintype P] {votes : P → Vote} (coord₀ : P) (hyes : ∀ (p : P), votes p = Vote.yes) :
        ∃ (tr : List (ThreePCAction P)) (s : ThreePCState P), (∀ a ∈ tr, a.isCrashFree = true) ∧ (threePCLts votes).MTr (threePCStart P coord₀) tr s ∧ AllDecided s.decision Decision.commit ∧ s.alive = Finset.univ

        Global-phase FSA step toward [Ske81], §5, Figure 7 (p. 140), not the cited message-passing 3PC result (#7289): when all sites vote .yes, threePCLts admits a crash-free execution from threePCStart P coord₀ reaching AllDecided s.decision .commit with s.alive = Finset.univ (AC3).

        theorem Cslib.Distributed.AtomicCommit.threePCTerminate_mTr_globalPhase {P : Type u_1} [DecidableEq P] [Fintype P] {coord₀ : P} {votes : P → Vote} {s : ThreePCState P} (hreach : ThreePCReachable coord₀ votes s) (hcrashed : s.coord ∉ s.alive) {b : P} (hb : b ∈ s.alive) :

        Global-phase FSA and survivor-polling step toward [Ske81], pp. 140–141, not the cited message-passing Central Site Termination Protocol result (#7289): from any reachable configuration s with s.coord ∉ s.alive and b ∈ s.alive, electing b via backupPhase and sweeping s.alive reaches threePCTerminate b s along a crash-free threePCLts trace, deciding unanimously across s.alive while preserving UniformAgreement and AbortValidity.

        theorem Cslib.Distributed.AtomicCommit.threePC_nonblocking_termination_globalPhase {P : Type u_1} [DecidableEq P] [Fintype P] {coord₀ : P} {votes : P → Vote} {s : ThreePCState P} (hreach : ThreePCReachable coord₀ votes s) (halive : s.alive.Nonempty) :
        ∃ (tr : List (ThreePCAction P)) (s' : ThreePCState P) (d : Decision), (∀ a ∈ tr, a.isCrashFree = true) ∧ (threePCLts votes).MTr s tr s' ∧ s'.alive = s.alive ∧ OperationalDecided s.alive s'.decision d ∧ UniformAgreement s'.decision ∧ AbortValidity votes s'.decision

        Global-phase FSA and survivor-polling step toward [Ske81], §§4–5 (pp. 138–141), not the cited message-passing 3PC result (#7289): from every reachable configuration s of threePCLts (after arbitrary recursive primary and backup coordinator crashes) with s.alive.Nonempty, there is a crash-free threePCLts execution among s.alive reaching unanimous survivor termination satisfying UniformAgreement and AbortValidity.

        Part II: Partition-cut impossibility step over CommitProtocol #

        structure Cslib.Distributed.AtomicCommit.CommitEnvelope (P : Type u_1) (M : Type u_2) :
        Type (max u_1 u_2)

        Point-to-point network message envelope from src to dest carrying payload.

        • src : P

          Sender site.

        • dest : P

          Recipient site.

        • payload : M

          Protocol message payload.

        Instances For
          theorem Cslib.Distributed.AtomicCommit.CommitEnvelope.ext {P : Type u_1} {M : Type u_2} {x y : CommitEnvelope P M} (src : x.src = y.src) (dest : x.dest = y.dest) (payload : x.payload = y.payload) :
          x = y
          @[instance_reducible]
          def Cslib.Distributed.AtomicCommit.instDecidableEqCommitEnvelope.decEq {P✝ : Type u_1} {M✝ : Type u_2} [DecidableEq P✝] [DecidableEq M✝] (x✝ x✝¹ : CommitEnvelope P✝ M✝) :
          Decidable (x✝ = x✝¹)
          @[instance_reducible]
          instance Cslib.Distributed.AtomicCommit.instReprCommitEnvelope {P✝ : Type u_1} {M✝ : Type u_2} [Repr P✝] [Repr M✝] :
          Repr (CommitEnvelope P✝ M✝)
          structure Cslib.Distributed.AtomicCommit.CommitConfig (P : Type u_1) (S : Type u_2) (M : Type u_3) :
          Type (max (max u_1 u_2) u_3)

          Global configuration of an asynchronous message-passing commit protocol.

          • localState : P → S

            Local state of each site.

          • Multiset of in-flight network envelopes.

          structure Cslib.Distributed.AtomicCommit.CommitProtocol (P : Type u_1) (S : Type u_2) (M : Type u_3) :
          Type (max (max u_1 u_2) u_3)

          General asynchronous point-to-point atomic commit protocol over process set P, local state type S, and message payload type M ([SS83], §§III and V, pp. 220–225).

          The specification permits arbitrary (possibly infinite) state and message spaces, nondeterministic local transitions, and partition-timeout transitions informed of the reachable group G.

          Filter a message multiset to envelopes internal to a site group G (src ∈ G ∧ dest ∈ G).

          def Cslib.Distributed.AtomicCommit.cutCfg {P : Type u_1} {S : Type u_2} {M : Type u_3} [DecidableEq P] (G₁ G₂ : Finset P) (cfg : CommitConfig P S M) :

          Erase cross-partition messages upon a partition into (G₁, G₂), keeping intra-G₁ and intra-G₂ messages while leaving all local states unchanged ([SS83], §V-A, p. 225).

          theorem Cslib.Distributed.AtomicCommit.cutCfg_comm {P : Type u_1} {S : Type u_2} {M : Type u_3} [DecidableEq P] (G₁ G₂ : Finset P) (cfg : CommitConfig P S M) :
          cutCfg G₁ G₂ cfg = cutCfg G₂ G₁ cfg

          Cross-partition message erasure is symmetric in (G₁, G₂).

          structure Cslib.Distributed.AtomicCommit.PartitionState (P : Type u_1) (S : Type u_2) (M : Type u_3) :
          Type (max (max u_1 u_2) u_3)

          Global state of a CommitProtocol before (partitioned = false) and after (partitioned = true) a two-group network partition.

          • partitioned : Bool

            Whether the network partition has occurred.

          • cfg : CommitConfig P S M

            Underlying local states and in-flight message buffer.

          inductive Cslib.Distributed.AtomicCommit.PartitionAction (P : Type u_1) (M : Type u_2) :
          Type (max u_1 u_2)

          Transition labels of the partitioned CommitProtocol LTS.

          Instances For
            def Cslib.Distributed.AtomicCommit.instDecidableEqPartitionAction.decEq {P✝ : Type u_1} {M✝ : Type u_2} [DecidableEq P✝] [DecidableEq M✝] (x✝ x✝¹ : PartitionAction P✝ M✝) :
            Decidable (x✝ = x✝¹)
            @[instance_reducible]
            @[instance_reducible]
            instance Cslib.Distributed.AtomicCommit.instReprPartitionAction {P✝ : Type u_1} {M✝ : Type u_2} [Repr P✝] [Repr M✝] :
            Repr (PartitionAction P✝ M✝)
            def Cslib.Distributed.AtomicCommit.CommitProtocol.configDecision {P : Type u_1} {S : Type u_2} {M : Type u_3} (π : CommitProtocol P S M) (cfg : CommitConfig P S M) (p : P) :

            Decision vector of a CommitConfig.

            def Cslib.Distributed.AtomicCommit.CommitProtocol.initConfig {P : Type u_1} {S : Type u_2} {M : Type u_3} (π : CommitProtocol P S M) (votes : P → Vote) :

            Initial pre-partition configuration on vote profile votes.

            def Cslib.Distributed.AtomicCommit.CommitProtocol.start {P : Type u_1} {S : Type u_2} {M : Type u_3} (π : CommitProtocol P S M) (votes : P → Vote) :

            Initial PartitionState on vote profile votes.

            def Cslib.Distributed.AtomicCommit.CommitProtocol.ConfigNormalStep {P : Type u_1} {S : Type u_2} {M : Type u_3} [DecidableEq P] [DecidableEq M] (π : CommitProtocol P S M) (p : P) (recv : Option (CommitEnvelope P M)) (cfg cfg' : CommitConfig P S M) :

            Single pre-partition step executed by site p on CommitConfig.

            def Cslib.Distributed.AtomicCommit.CommitProtocol.GroupStepOn {P : Type u_1} {S : Type u_2} {M : Type u_3} [DecidableEq P] [DecidableEq M] (π : CommitProtocol P S M) (G : Finset P) (p : P) (recv : Option (CommitEnvelope P M)) (cfg cfg' : CommitConfig P S M) :

            Single isolated step executed by site p ∈ G during a partition isolating G: either an intra-G normal transition or a TimeoutStep p G transition.

            inductive Cslib.Distributed.AtomicCommit.CommitProtocol.NormalSteps {P : Type u_1} {S : Type u_2} {M : Type u_3} [DecidableEq P] [DecidableEq M] (π : CommitProtocol P S M) :
            CommitConfig P S M → CommitConfig P S M → Prop

            Reflexive-transitive closure of pre-partition ConfigNormalStep transitions.

            inductive Cslib.Distributed.AtomicCommit.CommitProtocol.GroupSteps {P : Type u_1} {S : Type u_2} {M : Type u_3} [DecidableEq P] [DecidableEq M] (π : CommitProtocol P S M) (G : Finset P) :
            CommitConfig P S M → CommitConfig P S M → Prop

            Reflexive-transitive closure of isolated post-partition GroupStepOn G transitions.

            def Cslib.Distributed.AtomicCommit.CommitProtocol.lts {P : Type u_1} {S : Type u_2} {M : Type u_3} [DecidableEq P] [DecidableEq M] (π : CommitProtocol P S M) (G₁ G₂ : Finset P) :

            Operational Cslib.LTS of π subject to a two-group network partition (G₁, G₂).

            structure Cslib.Distributed.AtomicCommit.CommitProtocol.IsPartitionCutResilient {P : Type u_1} {S : Type u_2} {M : Type u_3} [DecidableEq P] [DecidableEq M] (π : CommitProtocol P S M) (G₁ G₂ : Finset P) :

            Partition-cut resilience predicate for CommitProtocol under cross-group message erasure cutCfg (step after [SS83], §V-A, pp. 224–225, without crash-recovery states or a 3PC instantiation; #7289): protocol π satisfies partition-cut resilience on (G₁, G₂) if:

            1. (AC1) every reachable state of π.lts G₁ G₂ satisfies UniformAgreement,
            2. (AC2) every reachable state of π.lts G₁ G₂ satisfies AbortValidity,
            3. (AC3) on all-.yes votes, a partition-free execution reaches AllDecided _ .commit,
            4. (isolated termination) from every partition-free reachable state cfg, after cutCfg G₁ G₂ cfg erases cross-group messages, both G₁ and G₂ can independently reach decisions on all of their respective sites via isolated GroupSteps.

            Indistinguishability, commutation, and discrete-continuity crossing proof #

            theorem Cslib.Distributed.AtomicCommit.CommitProtocol.IsPartitionCutResilient.symm {P : Type u_1} {S : Type u_2} {M : Type u_3} [DecidableEq P] [DecidableEq M] {π : CommitProtocol P S M} {G₁ G₂ : Finset P} (h : π.IsPartitionCutResilient G₁ G₂) :

            IsPartitionCutResilient is symmetric in the two isolated groups (G₁, G₂).

            theorem Cslib.Distributed.AtomicCommit.not_nonblocking_atomicCommit_of_partitionCut {P : Type u_1} {S : Type u_2} {M : Type u_3} [DecidableEq P] [DecidableEq M] {G₁ G₂ : Finset P} (hG₁ : G₁.Nonempty) (hG₂ : G₂.Nonempty) (hdisj : Disjoint G₁ G₂) (π : CommitProtocol P S M) :

            Partition-cut step after [SS83], §V-A, Theorem 4 (p. 225) and Appendix Proof of Theorem 4 (p. 227), not the cited crash-recovery endpoint (#7289): for any nonempty disjoint groups (G₁, G₂), no CommitProtocol (with cross-group message erasure cutCfg and without crash-recovery states) satisfies CommitProtocol.IsPartitionCutResilient G₁ G₂.

            theorem Cslib.Distributed.AtomicCommit.not_exists_partitionCutResilient_atomicCommit {P : Type u_1} {S : Type u_2} {M : Type u_3} [DecidableEq P] [DecidableEq M] [Fintype P] (hcard : 2 ≤ Fintype.card P) (π : CommitProtocol P S M) :
            ¬∀ (G₁ G₂ : Finset P), G₁.Nonempty → G₂.Nonempty → Disjoint G₁ G₂ → G₁ ∪ G₂ = Finset.univ → π.IsPartitionCutResilient G₁ G₂

            Partition-cut step after [SS83], §V-A, Theorem 4 (p. 225), not the cited crash-recovery endpoint (#7289): on any process set with 2 ≤ Fintype.card P, there exists a simple two-way partition (G₁, G₂) (G₁.Nonempty, G₂.Nonempty, Disjoint G₁ G₂, G₁ ∪ G₂ = Finset.univ), so no CommitProtocol satisfies CommitProtocol.IsPartitionCutResilient across all simple two-way partitions.