-
Notifications
You must be signed in to change notification settings - Fork 280
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
Fix bug where purging history could lead to increase in disk space usage #18131
Conversation
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.
Co-authored-by: Devon Hudson <[email protected]>
Co-authored-by: Devon Hudson <[email protected]>
Co-authored-by: Devon Hudson <[email protected]>
….sql Co-authored-by: Devon Hudson <[email protected]>
5c722d6
to
9e51e4e
Compare
9fbe823
to
68c8dcd
Compare
9e51e4e
to
cc67b6f
Compare
68c8dcd
to
e67b3bc
Compare
This actually makes it so that deleting state groups goes via the new mechanism.
a32805a
to
56aa695
Compare
e67b3bc
to
72d1d97
Compare
72d1d97
to
2b5cbc1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One little improvement, otherwise this looks good.
And it should drastically improve storage of state groups.
tests/storage/test_purge.py
Outdated
) | ||
|
||
# Advance so that the background jobs to delete the state groups runs | ||
self.reactor.advance(10000) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should reference the deletion timeout constant
…renced_state
When purging history, we try and delete any state groups that become unreferenced (i.e. there are no longer any events that directly reference them). When we delete a state group that is referenced by another state group, we "de-delta" that state group so that it no longer refers to the state group that is deleted.
There are two bugs with this approach that we fix here:
The effect of the above bugs is that when purging history we'd end up with lots of unreferenced state groups that had been de-deltaed (i.e. stored as the full state). This can lead to dramatic increases in storage space used.
Based on #18107 and #18130