CampusLearn
← CSC 413 Distributed Systems

Distributed Consensus and Fault Tolerance

Notes

Distributed Consensus and Fault Tolerance Fault tolerance defines the ability of a distributed system to remain operational despite the failure of one or more constituent components. Faults are categorized as transient, intermittent, or permanent, and their manifestations range from fail-stop crashes to arbitrary Byzantine failures where nodes exhibit malicious or corrupt behavior. Achieving agreement among non-faulty distributed nodes regarding system state is known as the consensus problem. Consensus Models and Commit Protocols The CAP theorem states that a distributed data store can simultaneously provide at most two out of three guarantees: Consistency, Availability, and Partition tolerance. Modern production systems leverage consensus algorithms such as Raft and Paxos to elect leaders and maintain consistent replicated state machines over asynchronous networks. When executing distributed transactions across heterogeneous databases, atomic commit protocols such as Two-Phase Commit (2PC) ensure atomicity. In 2PC, a coordinator sends a Prepare request to all cohort nodes. If all cohorts reply with an affirmative vote, the coordinator broadcasts a Commit command; if any cohort votes to abort or fails to respond within a timeout window, the coordinator commands a complete rollback. Practical example The Kenya Revenue Authority (KRA) runs electronic tax register infrastructure where distributed Electronic Tax Invoice Management Systems (eTIMS) communicate with core tax ledgers across primary data centers in Nairobi and backup disaster-recovery sites in Mombasa. When a retail chain in Eldoret completes a corporate sale, a distributed transaction must commit simultaneously to the local branch ledger, the fiscal signature service, and the centralized KRA repository. A Two-Phase Commit protocol coordinates this operation. During the prepare phase, the transaction manager asks the local branch database and the remote KRA gateway to reserve the transaction sequence and validate the PIN. If the Eldoret fiber link drops during the prepare phase, the coordinator aborts the transaction locally, preventing phantom VAT liability. If both cohorts confirm readiness, the coordinator commits the invoice, ensuring zero discrepancies between the taxpayer records and government audit registries.

Quiz

1. What action does a Two-Phase Commit coordinator take if one participant node fails to reply during the prepare phase?

2. According to the CAP theorem, what trade-off must a distributed system make in the event of an unavoidable network partition?

3. What type of distributed fault involves a node transmitting conflicting or corrupted messages to different peers?

Sign in to submit and securely grade your quiz.