2 phase commit With different failures
Procedure
Use the steps below to run through the baseline commit and then each failure scenario in sequence. The simulator UI consists of:
- Canvas (center): visual nodes/links/messages
- Control Panel (left): Start/Reset buttons, timeouts, clock speed, scenario selector
- State & Log Panel (right): per-node state, protocol log
A. Setup & Baseline Commit
- Load the Simulator
- Open the simulation in your browser. You’ll see five nodes: C (coordinator) in pink, P₁–P₄ (participants) in blue, connected by solid gray links.
- Verify Defaults
- Vote Timeout = 5000 ms; Decision Timeout = 5000 ms; Clock 1×.
- Start a Clean Run
- Click Reset Simulation. Confirm all node states read
INITand log is empty.
- Click Reset Simulation. Confirm all node states read
- Execute Normal Commit
- Click Start Transaction.
- Watch in the log:
- C → PREPARE → P₁–P₄ → each logs READY and replies VOTE_COMMIT
- C collects all votes, logs COMMIT, broadcasts GLOBAL_COMMIT
- P₁–P₄ each log COMMIT, send ACK → C completes.
- Confirm all four participants end in
COMMITTING→DONEand coordinator stateDONE.
B. Progress-Based Failure Scenarios
Use the Scenario dropdown to pick each task in order. You may only inject the allowed failures per scenario.
Scenario 1: Single Participant Crash
- Goal: Force GLOBAL_ABORT by crashing exactly one participant before it votes.
- Allowed: 1 participant crash.
- Steps:
- Reset the sim.
- Select “Single Participant Crash.” Read instructions.
- Click Start Transaction.
- As soon as any one P (e.g. P₂) receives PREPARE but before it sends VOTE_COMMIT, click that node to crash it (it’ll gray out).
- Wait for Vote‐Timeout → C must decide GLOBAL_ABORT.
- Check: All P₁, P₃, P₄ log ABORT; coordinator logs ABORT.
- Simulator flashes “Scenario Passed!” and unlocks the next scenario.
Scenario 2: Dropped Vote Message
- Goal: Force ABORT by dropping exactly one VOTE_COMMIT.
- Allowed: 1 link down.
- Steps:
- Click “Dropped Vote Message” in the Scenario dropdown.
- Reset.
- Start Transaction.
- Immediately after C sends PREPARE, click the link between C and one P (e.g. P₃) to bring it down (dashed red).
- Wait for Vote‐Timeout → C must GLOBAL_ABORT.
- Verify: P₃ never sent a vote; P₁, P₂, P₄ receive GLOBAL_ABORT and abort.
- “Scenario Passed!” appears; Scenario 3 unlocked.
Enjoy exploring how 2PC handles failures in addtional scenarios!