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

Add locking to more safely delete state groups: Part 1 #18107

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

Conversation

erikjohnston
Copy link
Member

@erikjohnston erikjohnston commented Jan 24, 2025

Currently we don't really have anything that stops us from deleting state groups when an in-flight event references it. This is a fairly rare race currently, but we want to be able to more aggressively delete state groups so it is important to address this to ensure that the database remains valid.

This implements the locking, but doesn't actually use it.

See the class docstring of the new data store for an explanation for how this works.

@erikjohnston erikjohnston force-pushed the erikj/state_epochs2 branch 3 times, most recently from 19c8e98 to 53a7438 Compare January 24, 2025 16:27
@erikjohnston erikjohnston changed the title Add locking to more safely delete state groups Add locking to more safely delete state groups: Part 1 Jan 29, 2025
@erikjohnston erikjohnston force-pushed the erikj/state_epochs2 branch 2 times, most recently from 4938211 to 379c0f7 Compare January 29, 2025 11:18
Currently we don't really have anything that stops us from deleting
state groups when an in-flight event references it. This is a fairly
rare race currently, but we want to be able to more aggresively delete
state groups so it is important to address this to ensure that the
database remains valid.

See the class docstring of the new data store for an explanation for how
this works.
@erikjohnston erikjohnston marked this pull request as ready for review January 29, 2025 12:37
@erikjohnston erikjohnston requested a review from a team as a code owner January 29, 2025 12:37
Copy link
Member

@devonh devonh left a comment

Choose a reason for hiding this comment

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

The new tables & logic all makes sense to me. Just a couple of tidying up tasks to do.

synapse/storage/databases/state/deletion.py Outdated Show resolved Hide resolved
synapse/storage/databases/state/deletion.py Show resolved Hide resolved
synapse/storage/databases/state/deletion.py Outdated Show resolved Hide resolved
synapse/storage/databases/state/deletion.py Outdated Show resolved Hide resolved
synapse/storage/databases/state/deletion.py Outdated Show resolved Hide resolved
synapse/storage/schema/__init__.py Show resolved Hide resolved
tests/storage/test_state_deletion.py Outdated Show resolved Hide resolved
tests/storage/test_state_deletion.py Outdated Show resolved Hide resolved
tests/storage/test_state_deletion.py Outdated Show resolved Hide resolved
Copy link
Member

@devonh devonh left a comment

Choose a reason for hiding this comment

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

A couple more small comment tweaks then this is good to go!

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