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

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

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 from edf674a to 81cadd8 Compare December 10, 2024 16:05
@MatMaul MatMaul force-pushed the fix-purge-room-state-groups branch 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!

Comment on lines +880 to 882
column="room_id",
values=[room_id],
keyvalues={},
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
column="room_id",
values=[room_id],
keyvalues={},
keyvalues={"room_id": room_id},

logger.info("[purge] removing %s from state_groups", room_id)

self.db_pool.simple_delete_many_txn(
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
self.db_pool.simple_delete_many_txn(
self.db_pool.simple_delete_txn(

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?

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.

2 participants