-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Conversation
for e.g. get_latest_event_ids_in_room Needed on CacheInvalidationWorkerStore for many functions, e.g. `have_seen_event`. Fixup MRO in CensorEventsStore. The BaseSlavedStore is trickier. The removals should be safe because the removed classes are in parents, via SlavedEventStore -> BaseSlavedStore -> CacheInvalidationWorkerStore
51cb4f2
to
b30cdd7
Compare
Need to fix portdb. |
ebbf1cb
to
6daef9b
Compare
That sytest failure on buster multi-postgres is a suspected flake, see matrix-org/sytest#1167 |
Think this is reviewable now. Suggest going commit-by-commit up to |
Could use a fancy TypeVar here but I restrained myself.
for e.g. get_relations_for_event. Remove it from SlavedEventsStore. (Still there via SlavedEventsStore -> BaseSlavedStore -> CacheInvalidationWorkerStore -> RelationsWorkerStore.
for _membership_stream_cache
I need StateDeltasStore for _curr_state_delta_stream_cache. I also need the `clock` attribute, which pathologically only seems to be defined on StatsStore. StatsStore is a subclass of StateDeltasStore, so let's just use that to keep the list of parents minimal. To be explicit: I think it's very very odd that only StatsStore provides a `clock`. I think pulling it in here is silly: why should CacheInvalidationWorkerStore care about stats? Consider this a protest commit to raise attention to the bizarre status quo.
for get_rooms_for_user_with_stream_ordering. This was the most painful MRO problem to resolve. Remove BaseSlavedStore and SlavedEventStore from GenericWorkerSlavedStore. These are already pulled in indirectly by inheriting from SlavedPushRuleStore.
Being honest I just tried to do the minimal thing possible to get it to work.
606167e
to
dfe4779
Compare
I've rebased to try and trim down the commits. There are still quite a few small commits trying to make one surgical change to the storage class inheritance, with comments to try and justify them. I still think it's worth going through commit-by-commit. I'm still quite scared by all this. I'm not sure if we should go ahead with all of this change (input welcome). I think it's useful to see what dependencies we have, even if they might not all make sense. Maybe this can inform us on how to do things better (#11165) if nothing else. Debugging this to get a consistent MRO between all the datastore classes was the motivation for #11357. |
And while we're at it, StatsStore doesn't needs its own clock attribute.
already has it via SlavedEventStore -> BaseEventStore -> CacheInvalidationWorkerStore -> StreamWorkerStore
@clokep thanks for your comments! Could you take another look once CI has run? |
@DMRobertson Looks like portdb is failing. |
And
|
Why didn't mypy spot this? reveal_type(storage.main)
Gonads. I think this has now become a Tomorrow Problem. |
I believe this comes back to |
Agreed, but I don't think mypy can see that because |
@clokep I had a quick go at getting mypy to spot the problem that made the tests fail. I think it'll be a bit involved though; I'd like to handle that in a separate change and get this wrapped up. To proceed, I can see three options:
I think my preferences would be 3 > 1 > 2; what do you think? Perhaps there's another way to proceed that I'm not seeing. |
@DMRobertson I think my preference would be a twist on idea 2 -- the twist being splitting it out to a separate PR, which I hope will help isolate the change. |
Removing my review since I've given thoughts already -- @DMRobertson if you're still waiting for info for me please clarify what I can do to help move this along! |
Thanks. I had a quick go at this (I wanted to make |
More failures, some in portdb and some in sytest. Feeling a bit swamped by this. I'm wondering if it might be better to close this and try to pull out some easier changes. |
This has rotted. The last time we talked about the DB monstrosity I think we were in favour of a more drastic, composition-over-inheritance approach; see #11733. |
This was a PITA wrangling the inheritance sphagetti.
Review commit-by-commit.