You end with two tables that disagreed after a delete, and a check that found it and fixed it.
Step 4.1: Delete one message (about 30 minutes)
Cassandra cannot erase a row in place, because the data lives in immutable files. A delete writes a marker called a tombstone, and the real removal happens later, during a merge of those files. How long a tombstone must stay is the table's gc_grace_seconds:
DELETEFROM chat.messages_by_room WHERE room_id ='general'AND msg_id = minTimeuuid('2026-11-01 10:00:00+0000');
SELECT toTimestamp(msg_id) AS sent_at, author, body FROM chat.messages_by_room WHERE room_id ='general';
SELECT gc_grace_seconds FROM system_schema.tables WHERE keyspace_name ='chat'AND table_name ='messages_by_room';
The 10:00 message is gone from the room, and the default gc_grace_seconds is 864000, ten days. The wait gives every copy of the data a chance to learn about the delete.
Step 4.2: Spot the drift (about 25 minutes)
We deleted from messages_by_room only. Count both tables:
SELECTcount(*) AS in_room_table FROM chat.messages_by_room;
SELECTcount(*) AS in_user_table FROM chat.messages_by_user;
SELECT toTimestamp(msg_id) AS sent_at, room_id, body FROM chat.messages_by_user WHERE author ='chitra';
The room table has 7 messages and the user table still has 8. Chitra's 10:00 message is still in her list. This is the price of keeping two copies: nothing keeps them in step unless your code does.
Two copies, one delete: they now disagree.
Think it through: where would this bug show up in the app? What would the user see in "my messages" that was deleted in the room?
Step 4.3: Fix it (about 20 minutes)
Delete the same message from the second table, and count again:
DELETEFROM chat.messages_by_user WHERE author ='chitra'AND msg_id = minTimeuuid('2026-11-01 10:00:00+0000');
SELECTcount(*) AS in_room_table FROM chat.messages_by_room;
SELECTcount(*) AS in_user_table FROM chat.messages_by_user;
Both should now say 7. In a real application, the delete would go through a batch, just like the insert.
Step 4.4: Consistency levels (about 30 minutes)
A real cluster keeps several copies of each partition. The consistency level says how many of them must answer before Cassandra replies. ONE is fast. QUORUM is a majority, and with three copies it is two. If the number of copies read plus the number written is more than the number of copies, a read is guaranteed to see the latest write. Our container has a single copy, so both levels return the same answer, but we can see how to set them:
CONSISTENCY;
CONSISTENCY QUORUM;
SELECTcount(*) FROM chat.messages_by_room WHERE room_id ='general';
CONSISTENCY ONE;
SELECTcount(*) FROM chat.messages_by_room WHERE room_id ='general';
The first command prints the current level. Both counts of general should be 5.
Real Cassandra: a common production setup is three copies with QUORUM for reads and writes. That survives one machine down and still reads its own writes.
Step 4.5: Read the settings (about 15 minutes)
Table settings live in a system table:
SELECT table_name, bloom_filter_fp_chance, default_time_to_live, gc_grace_seconds FROM system_schema.tables WHERE keyspace_name ='chat';
Phase 4 done
We started with a chat app and one question: show me the newest messages of this room, fast. You built a store that answers it in one read, learned to give each question its own table, kept partitions bounded, and found out by yourself what a delete does to two copies of the data.