SoloMedium5m

The Read-Your-Writes Illusion

BUG REPORT — intermittent data loss

QA Team: ~20% of users update profile settings, refresh immediately, and see old data. Logs confirm POST /settings wrote successfully.

The trap: All GETs go to random read replicas. With 2s replication lag, a refresh right after save reads stale data from a replica.

Your task

Fix `get_db_connection()` in `db_router.py`: route writes to primary; if a user wrote within REPLICATION_LAG_SECONDS, route their GETs to primary too. Otherwise use replicas for scale.

Book: read replicas scale reads · Prod: replication lag — temporary primary routing for read-your-writes.

Skills you'll prove

pythondistributed-systemsdatabasereplicationconsistencybook-vs-prod

Browse freely — sign in when you're ready to open a ticket and prove your skills.