Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Consider adding (more?) foreign key constraints #12817

Open
lnicola opened this issue May 20, 2022 · 0 comments
Open

Consider adding (more?) foreign key constraints #12817

lnicola opened this issue May 20, 2022 · 0 comments
Labels
A-Corruption Things that have led to unexpected state in Synapse or the database A-Database DB stuff like queries, migrations, new/remove columns, indexes, unexpected entries in the db T-Task Refactoring, removal, replacement, enabling or disabling functionality, other engineering tasks.

Comments

@lnicola
Copy link

lnicola commented May 20, 2022

Description:

Because of an unfortunate event, I ended up on my server with some extra accounts and rooms I wanted to delete. I used the proper (admin/v1/deactivate, admin/v1/rooms and admin/v2/rooms) APIs of Synapse, but it left me with a database that appears inconsistent:

  • I had 10 GB of entries in current_state_delta_stream, state_groups_state and state_groups, but the rooms were missing from room_stats_state
  • half of my rows in state_group_edges don't point to state_groups

I'd like to clean these up, but it's hard for me because I'm not familiar with the database structure and there are no constraints to help with it.

Adding some constraints would help avoid inconsistent states (cf. #11779) and even work as documentation. If you're worried about the performance impact, they could added in a disabled state.

@lnicola lnicola changed the title Consider adding (more?) foreign keys between the database tables Consider adding (more?) foreign key constraint May 20, 2022
@lnicola lnicola changed the title Consider adding (more?) foreign key constraint Consider adding (more?) foreign key constraints May 20, 2022
@babolivier babolivier added the T-Task Refactoring, removal, replacement, enabling or disabling functionality, other engineering tasks. label May 23, 2022
@MadLittleMods MadLittleMods added A-Database DB stuff like queries, migrations, new/remove columns, indexes, unexpected entries in the db A-Corruption Things that have led to unexpected state in Synapse or the database labels Dec 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A-Corruption Things that have led to unexpected state in Synapse or the database A-Database DB stuff like queries, migrations, new/remove columns, indexes, unexpected entries in the db T-Task Refactoring, removal, replacement, enabling or disabling functionality, other engineering tasks.
Projects
None yet
Development

No branches or pull requests

3 participants