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

cache_invalidation_stream_by_instance grows without bounds and causes slow startup #8269

Closed
richvdh opened this issue Sep 7, 2020 · 4 comments
Labels
A-Disk-Space things which fill up the disk T-Task Refactoring, removal, replacement, enabling or disabling functionality, other engineering tasks.

Comments

@richvdh
Copy link
Member

richvdh commented Sep 7, 2020

cf #7968 (comment)

@richvdh
Copy link
Member Author

richvdh commented Sep 7, 2020

it seems like we ought to be able to clear these out, but I don't know how we can tell?

@erikjohnston
Copy link
Member

Yup, we can clean things out. It only ever gets read sequentially by the workers, so once a row has been read by all running processes then it can be deleted. Also note that when starting up a worker will read from the most recent row, so it is also safe to delete all the rows if all Synapse processes have stopped.

The hard part is to figure out which rows all processes have seen. As a bit of a bodge I suggest we just delete all rows with an invalidation_ts over a month old, which should definitely be safe. We might also want to add some logic to the read part to ensure that it exits if the rows of the cache its reading is more than a week old, or something.

The cache_invalidation_stream_by_instance doesn't have an index on invalidation_ts, so I think the best way of deleting the rows is pulling out the 100th row (ordered by stream_id), check if its old enough, and then delete all rows before it if so.

@babolivier babolivier added the T-Task Refactoring, removal, replacement, enabling or disabling functionality, other engineering tasks. label May 17, 2022
@erikjohnston erikjohnston changed the title cache_invalidation_stream_by_instance grows without bounds and causes slow startup cache_invalidation_stream_by_instance grows without bounds and causes slow startup May 18, 2022
@reivilibre reivilibre added the A-Disk-Space things which fill up the disk label Jul 27, 2022
@richvdh
Copy link
Member Author

richvdh commented Aug 5, 2022

this is a subset of #5888.

see also #13456 which discusses ways of getting rid of this table altogether.

@reivilibre
Copy link
Contributor

Dupe of #3665 which will be closed by #15868.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A-Disk-Space things which fill up the disk T-Task Refactoring, removal, replacement, enabling or disabling functionality, other engineering tasks.
Projects
None yet
Development

No branches or pull requests

5 participants