Course contents
On this page
A storage library does not choose a cluster leader
Separate local persistence from the responsibilities of a distributed database.
You have implemented rows, pages, indexes, logging, and recovery. Instead of maintaining all of that local storage machinery yourself, you could adopt an existing storage library. But replacing local storage does not automatically solve the distributed problems from the preceding lessons.
RocksDB and Cassandra are useful examples because they supply different scopes of functionality. RocksDB is an embedded key/value storage engine; the host program calls it within its own process. Cassandra is a distributed database with its own data placement, replication, and request coordination.
Start three independent local stores
Suppose we put an HTTP endpoint around a RocksDB instance and start that program on servers A, B, and C. A request writes stock/27 = 9 to A. Assume A uses a configuration and storage system that make the acknowledged local write durable.
What tells B and C about it? In this design, nothing yet.
- Server A
Local key stock/27 = 9
The request reached this process. - Server B
Local key stock/27 = 10
No replication protocol was added. - Server C
Local key stock/27 = 10
A third copy is not an agreement.
The host still needs routing, replication, failure handling, and an explicit consistency promise. If A disappears, the service cannot simply infer that B’s value includes every acknowledged update. Those are the replication and leadership obligations we already derived.
Recognize what the larger system supplies
Cassandra includes a distributed placement and replication model. Its architecture uses partitioning to assign replicas and supports tunable consistency for requests. Ordinary updates and specialized conditional operations have different semantics; choosing the product does not eliminate the need to specify the operation’s guarantee.
Both systems use log-structured storage ideas, but Cassandra is not merely “RocksDB plus networking.” Similar local techniques do not imply identical interfaces, transaction behavior, or failure handling.
Inside an LSM engine, compaction reconciles local sorted files and discards entries that are safe to remove. Across Cassandra replicas, repair addresses divergent copies. These are different jobs. A locally compacted file can still contain a value that another replica has not received.
Predict the proposed fix
An engineer adds a second local disk to A and calls the three-server service highly available. Which part of the earlier failure has that change resolved?
Separate disk redundancy from service authority
It may improve survival of a specified local disk failure, depending on the storage arrangement. It has not propagated the accepted update to B or C, established a safe next owner, or defined what clients should read after A becomes unreachable. The service still needs those protocols.
Sources: RocksDB’s scope and storage design, Cassandra’s distributed architecture, and Cassandra repair.
Extended reference
The extended chapter preserves the original technical coverage, additional examples, and citations. The explanation above supplies the concepts needed for this page; the reference develops the specialist cases.
Find a section from the original chapter
- Learning outcomes
- A durable key-value library is not a cluster
- The storage-engine layer
- The distributed-database layer
- Scenario A: a custom transactional service
- Scenario B: partitionable event and tenant data
- LSM economics across replicas
- Deletions and resurrection
- Query shape and secondary representations
- Operational comparison
- Trace a local write through its host
- WAL choice and replicated durability are distinct
- Model a Cassandra access pattern before writing tables
- Follow a replicated write and an incomplete read
- Repair and compaction solve different disagreements
- Calculate the maintenance recovery envelope
- Local stalls can become distributed tail latency
- Match the adopted layer to the team’s responsibility
- Architectural synthesis
- Sources and further reading