We move login sessions out of Redis and into a sessions table in Postgres, so we can drop the Redis instance.
The move runs behind the sessions_pg flag with a dual-write period. While both stores remain current, turning the flag off restores Redis reads. After Redis writes stop, rollback requires restoring and resynchronizing Redis; the flag alone is no longer enough.
sessions table and its index on expires_at. No app changes yet.sessions_pg for reads, 10% of users first, then everyone.Do not flip reads before step 3 is done. Sessions created before dual-write only exist in Redis.
| Risk | Severity | Mitigation |
|---|---|---|
| Reads flipped before old sessions are copied, users get logged out | High | Gate step 4 on the 14-day wait, not on a date |
Expired rows pile up in sessions | Medium | Nightly delete where expires_at < now() |
| Extra write load on the primary during dual-write | Medium | Watch the chart below before going past 10% |