Incident Library
Applied filters Root causeOperator errorComponentDatabase replicationSymptomData lossClear allEvery case under the filters, with no sentence; newest first.
Suggested filters Search, and the values found in your words appear here.

Graph

  • Root cause
  • Component
  • Symptom
  • Contributing factor
  • Case

Cases4 cases

1 to 4 of 4

  1. Symptoms

    On 2 September 2025 the matrix.org homeserver went down at 17:45 UTC and stayed down until 18:00 UTC the next day. Both machines of its PostgreSQL cluster were out of action: the original primary had lost its RAID array during a disk expansion, and the data directory of the new primary had been deleted by mistake.

    Trigger

    During maintenance to add drives, an existing drive disappeared from the primary database server's RAID 10 array at 11:17 UTC, which led to a failover and a rebuild of that server. The outage itself began when the data directory of the new primary on db-01 was deleted while clearing a failed restore on db-02.

    Root cause
    Component
    Contributing factor
    Detection

    Monitoring fired when the drive disappeared from db-02's RAID array at 11:17 UTC, and Mythic Beasts confirmed the issue. The team realised it had deleted db-01's data directory, and the backend team was then paged, an incident was opened and an emergency was declared.

    Remediation
    • Created a fresh RAID 10 array on db-02
    • Unblocked WAL archiving from the new primary on db-01 to S3
    • Started restoring db-02 from the S3 backups with wal-g
    • Shut down Synapse and the damaged primary database
    • Remounted the data partition of db-01 read-only
    • Copied the WALs missing from S3 from db-01 to db-02
    • Updated wal-g and patched it to continue from the partial restore
    • Configured a restore_command wrapper that fetched WALs from S3 and the local files, and replayed them in standby mode
    • Promoted db-02 to primary and restarted Synapse
    • Ran backups against the primary while no replica existed
    • Rebuilt db-01 as a replica from a base backup of db-02
    Action items
    • Run pg_repack to reclaim free space
    • Take incremental backups more often, since they restore faster than WAL replay
    • Reduce Synapse's storage requirements
    • Consider changing the terminal background colour by the database's role, for example by watching for the standby.signal file
    • Consider wrapper scripts around sensitive commands, such as an alias for rm, and automating operations such as starting a base backup from primary to secondary
    • Shorten the recovery time, with infrastructure from service providers
    • Upgrade wal-g on all servers and repeat disaster recovery testing with it
    • Explore ZFS local snapshots at the next hardware refresh
    • Make status.matrix.org the source of truth during incidents and keep social media updated
    Lessons

    Most of the difficulty came from the size of the database: restoring 51TB and replaying WALs took far longer than hoped, and incremental backups restore much faster than WAL replay. Running a destructive command on the wrong server was the turning point, and Matrix.org looks for better tooling and processes rather than blaming the individual; working as a trio did not catch the mistake, and server names that suggest a role caused confusion because a primary and a secondary swap roles. The recovery lost no data, but the recovery time needs to be shorter, and the wal-g versions on the disaster recovery server and the production servers had drifted apart.

  2. Symptoms

    On 7 August 2017, while checking the application after the maintenance that moved Mackerel from an on-premises data center to AWS, the team found that data updated during a specific time window was missing. Everything written to the PostgreSQL database between 14:30 and 15:30 JST was gone.

    Trigger

    One hour after the application was switched to the newly promoted primary db001, db001 lost network connectivity and the database failed over to the standby db002.

    Root cause
    Component
    Contributing factor
    Detection

    The team found the missing data while checking how the application behaved after the migration work.

    Remediation
    • Tried to restore the lost updates by hand from the table data left on db001 and gave up
    • Tried point-in-time recovery from the base backup and WAL and gave up
    • Built a new replica db003 with db002 as primary to restore redundancy
    • Kept db001 in maintenance state for investigation
    • Watched db002 for some time to confirm the problem did not recur, then completed the migration
    Action items
    • Change the PostgreSQL replica creation script to set recovery_target_timeline = 'latest' in recovery.conf by default
    • Add a check to a server configuration test tool such as Serverspec that recovery.conf contains recovery_target_timeline = 'latest'
    Lessons

    A setting needed only for a rare layout, such as a grandchild replica during a migration, was applied by hand through a script option and was forgotten. Because recovery_target_timeline = 'latest' is harmless on ordinary standbys too, Hatena now sets it by default whenever a replica is created. The staging rehearsal used the same layout and steps but had the setting right, so it could not catch the mistake. Hatena notes that a similar layout may be used again for a future PostgreSQL upgrade or a move to another region.

  3. Symptoms

    From around 19:00 UTC on 31 January 2017, load on GitLab.com's PostgreSQL database rose, which GitLab suspected was spam, and many users could not post comments on issues and merge requests. Around 23:00 UTC the replication of the PostgreSQL secondary fell behind and then failed, because WAL segments it still needed had already been removed from the primary.

    Trigger

    While trying to restore replication to the secondary, an engineer ran the removal of the PostgreSQL data directory on the primary, db1.cluster.gitlab.com, believing it was the secondary.

    Root cause
    Component
    Contributing factor
    Detection

    The engineer who ran the deletion on the primary noticed the mistake and stopped it a second or two later.

    Remediation
    • Raised max_wal_senders from 3 to 32 and lowered max_connections from 8000 to 2000 so PostgreSQL would restart
    • Stopped the deletion on the primary a second or two after noticing it
    • Restored the database from the LVM snapshot taken about 6 hours before the outage by copying the PostgreSQL data directory from staging
    • Restored the webhooks from a separate database built from the snapshot and imported them as a SQL dump
    • Incremented all database sequences by 100,000 so IDs used before the outage could not be reused
    • Re-enabled GitLab.com gradually
    • Rebuilt projects created after 17:20 UTC in basic form from their Git repositories on the NFS cluster
    Action items
    • Change the shell prompt (PS1) on all hosts to show more clearly which host and environment is in use
    • Monitor backups with Prometheus
    • Set PostgreSQL's max_connections to a sane value
    • Investigate point-in-time recovery and continuous archiving for PostgreSQL
    • Take LVM snapshots of the production databases every hour
    • Take Azure disk snapshots of the production databases
    • Move staging to the ARM environment
    • Recover the production replicas
    • Test recovery of PostgreSQL database backups automatically
    • Improve the PostgreSQL replication documentation and runbooks
    • Investigate pgbarman for PostgreSQL backups
    • Investigate WAL-E for database backup and realtime replication
    • Build a streaming database restore
    • Assign an owner for data durability
    • Set up multiple secondaries and balance load among them with pgpool-II
    • Provide a tool for developers to run and revert Rails migrations on staging
    • Build owned recovery procedures for the rest of the GitLab.com infrastructure, not only the database
    • Publish a backup monitoring dashboard and add more backup data to it
    • Improve the abuse reporting and response system so removal for spam does not hard delete
    • Redact engineers' names in future public incident documents
    Lessons

    GitLab split the incident into two problems: GitLab.com went down because the primary's data directory was removed by mistake during a manual, undocumented replication rebuild, and recovery took over 18 hours because the backups had failed silently, disk snapshots were not enabled and the only copy sat on slow staging disks. The backup procedure was never tested because no one owned it. GitLab chose to focus on fast, regularly practised recovery and on making it obvious which host an engineer is on, rather than on blocking commands, since a safer rm only protects against one of many ways to lose data.

  4. Symptoms

    On July 30th, a few minutes after the OSU Open Source Lab started reloading the MySQL server mysql2 to fix its replication errors, the team saw that databases were being dropped on mysql1 as well. The script was stopped, and the MySQL service behind mysql1-vip stayed down through a long restore.

    Trigger

    On July 30th at 4:00PM PDT the team stopped slave replication on mysql2 and began dropping its databases one at a time to reload it and fix replication errors.

    Root cause
    Component
    Contributing factor
    Detection

    The team watching the reload noticed after a few minutes that mysql1 was also dropping databases; the delays between drops in the script gave them that time.

    Remediation
    • Stopped the script that was dropping databases
    • Restored the databases from the mysql-zrm backups
    • Pulled each database that failed to restore out of the 200GB backup file and restored it separately
    • Recovered most data with the binary logs from the 17th through the 30th
    Action items
    • Evaluate better replication strategies, including row-based replication
    • Store binlogs as a backup on a separate server
    • Take backups with Percona XtraBackup for much faster full restores
    • Use mydumper instead of mysql-zrm for faster logical backups
    • Improve documentation and training for complex systems
    • Test full restores regularly on a spare server as part of the backup process
    • Gather more accurate time estimates for the restore process
    • Audit the hosted databases regularly, since test and very large databases delayed the restore
    • Migrate to a bigger, more powerful MySQL cluster
    • Set a policy and tools to keep the community informed of outages, maintenance and resource use, with dashboards
    • Define and monitor capacity limits for core services
    • Implement redundancy and restore practices for core services, including staff drills
    • Migrate more core services to Chef
    • Review documentation, policies and performance metrics periodically
    • Find better ways to draw on community expertise
    • Raise funds to replace the oldest infrastructure and reduce technical debt
    Lessons

    The lab had stretched its resources to host as many projects as possible, and that came with tradeoffs such as heavily compressed backups to save disk and less redundancy than wanted; the heavy compression made this restore CPU-bound. The lab concluded that it needs to change how it plans, monitors and manages resources, and that the length of the outage and the lack of progress reports were not acceptable.

Check your cluster for this

These 4 cases involve Database and Database replication. kubegap audits a Kubernetes cluster for gaps like these, read-only, from Claude Code or Codex; its checks cite public reports like the ones in this library.

By root cause1