Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Properly purge state groups tables when purging a room #18024

Merged

Conversation

MatMaul
Copy link
Contributor

@MatMaul MatMaul commented Dec 10, 2024

Currently purging a complex room can lead to a lot of orphaned rows left behind in the state groups tables.
It seems it is because we are loosing track of state groups sometimes.

This change uses the room_id indexed column of state_groups table to decide what to delete instead of doing an indirection through event_to_state_groups.

Related to #3364.

Pull Request Checklist

@MatMaul MatMaul force-pushed the fix-purge-room-state-groups branch 2 times, most recently from 81cadd8 to 7945610 Compare December 10, 2024 16:06
@MatMaul MatMaul marked this pull request as ready for review December 10, 2024 16:30
@MatMaul MatMaul requested a review from a team as a code owner December 10, 2024 16:30
@MatMaul MatMaul requested a review from erikjohnston December 18, 2024 23:37
Copy link
Member

@erikjohnston erikjohnston left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

synapse/storage/databases/state/store.py Outdated Show resolved Hide resolved
synapse/storage/databases/state/store.py Outdated Show resolved Hide resolved
Copy link
Member

@erikjohnston erikjohnston left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, bah I can't edit the PR. Can you commit the simplifications to the delete?

@MatMaul MatMaul requested a review from erikjohnston December 29, 2024 13:19
Copy link
Member

@erikjohnston erikjohnston left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Woo, thanks!

@erikjohnston
Copy link
Member

@MatMaul sorry, looks like the tests didn't trigger, could you push an empty commit or something?

@erikjohnston
Copy link
Member

Ooooh, there are conflicts, sorry!

@MatMaul MatMaul force-pushed the fix-purge-room-state-groups branch from 0875f1c to aab137d Compare January 6, 2025 14:13
@MatMaul
Copy link
Contributor Author

MatMaul commented Jan 6, 2025

Argh sorry, self inflicted wound (the other conflicting PR is mine 😅 ).

@MatMaul MatMaul requested a review from erikjohnston January 6, 2025 14:14
@erikjohnston erikjohnston enabled auto-merge (squash) January 6, 2025 14:30
@erikjohnston erikjohnston merged commit b3ba501 into element-hq:develop Jan 6, 2025
39 checks passed
@olmari
Copy link
Contributor

olmari commented Jan 7, 2025

Ooh, does this mean the https://github.com/erikjohnston/synapse-find-unreferenced-state-groups is getting less in the future?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants