Quorum Intersection

easy · distributed-systems, replication, quorum

Quorum Intersection

A replicated system uses N replicas with read quorum R and write quorum W. Two important safety checks are:

  • Read/Write intersection: R + W > N
  • Write/Write intersection: W + W > N

Given n, r, and w, return whether each condition is satisfied.

Function signature

func QuorumSafety(n, r, w int) (readWrite bool, writeWrite bool)

Example

N=3, R=2, W=2
readWrite = true   (2+2 > 3)
writeWrite = true  (2+2 > 3)

Constraints

  • 1 <= n <= 10^9
  • 0 <= r, w <= n

Notes

  • These checks are necessary conditions for strong consistency with quorums.
Run tests to see results
No issues detected