Where does a row go when there is no primary?
The ring, the commit log, memtables and SSTables. Then one write, end to end.
There is no primary and no failover. Any node can take a request and pass it to the nodes that own the data.
The same layers as a still diagram, with every part named:
Write path on each replica
| Place | What it holds | What to watch |
|---|---|---|
| commitlog/ | every write, appended before it is acknowledged | commitlog_sync is periodic by default, flushing every 10 seconds, so a power cut on every replica at once could lose the last seconds. The batch and group modes wait for the disk. |
| Memtable | recent writes, sorted, in memory | Flushed to an SSTable when full. Big memtables mean more commit log to replay after a crash. |
| SSTables | immutable sorted files; a read may have to look in several | SSTables per read in nodetool tablehistograms. Compaction keeps the count down. |
| Tombstones | markers for deleted data, kept until compaction after gc_grace_seconds (10 days by default) | Reads that scan many tombstones get slow, and fail at tombstone_failure_threshold (100,000). |
| hints/ | writes for a replica that was down, kept up to max_hint_window (3 hours) | Longer outages need nodetool repair to catch up. |
Replication factor 3, one chat message, written at QUORUM. Step through it, then tick the box.
Yes. Two of three is a quorum. The coordinator keeps a hint for the missing replica. At consistency ALL the same write would fail. Tick the box in the widget to step through it.
How do databases actually work? From one row on disk to transactions: the words you need, PostgreSQL, MySQL and MongoDB from the files up, then Redis, Cassandra and vector search, side by side, and the query and concurrency traps.