Catalogue / matrix-2025-postgres-index-corruption

A corrupt Postgres index makes a cleanup job delete live room state on the matrix.org homeserver

The Matrix.org Foundation (homeserver run by Element's backend/SRE team), 2025. Matrix.org homeserver (Synapse state-group storage in Postgres).

Organisation
The Matrix.org Foundation (homeserver run by Element's backend/SRE team)
Evidence
Incident report
Source
How we discovered, and recovered from, Postgres corruption on the matrix.org homeserver

Matrix.org blog, published 2025-07-23

Records

Failure#f1

Dangling index entries began pointing at newly written rows, so deleting unused state groups also deleted state belonging to other rooms

Decision#d1

Guard the table with a constraint, then switch the suspect job back on to see whether it trips

Decision#d2

Start restoring a week-old backup to a rented instance before the cause is known

Sign in to read what was chosen, what was rejected and what it cost, each with its place in the source. An account is free. The job-queue cards are open without one.