Skip to content

Commit 2630d11

Browse files
committed
Document panic rationale for ledgers
1 parent 299bd71 commit 2630d11

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

trust-quorum/src/ledgers.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,22 @@ impl PersistentStateLedger {
3838
/// number.
3939
///
4040
/// Panics if the ledger cannot be saved.
41+
///
42+
/// The trust quorum protocol relies on persisting state to disk, such
43+
/// as whether a node has prepared or committed a configuration, before
44+
/// responding to a coordinator node or Nexus. This is necessary in order
45+
/// to ensure that enough nodes actually have performed an operation and
46+
/// not have the overall state of the protocol go backward in the case of
47+
/// a crash and restart of a node. In this manner, trust quorum is similar
48+
/// to consensus protocols like Raft and Paxos.
49+
///
50+
/// If for any reason we cannot persist trust quorum state to the ledger,
51+
/// we must panic to ensure that the node does not take any further
52+
/// action incorrectly, like acknowledging a `Prepare` to a coordinator.
53+
/// Panicking is the simplest mechanism to ensure that a given node will
54+
/// not violate the invariants of the trust quorum protocol in the case
55+
/// of internal disk failures. It also ensures a very obvious failure that
56+
/// will allow support to get involved and replace internal disks.
4157
pub async fn save(
4258
log: &Logger,
4359
paths: Vec<Utf8PathBuf>,

0 commit comments

Comments
 (0)