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

Fix sync bug when accepting invites #4903

Closed
wants to merge 3 commits into from
Closed

Conversation

richvdh
Copy link
Member

@richvdh richvdh commented Mar 20, 2019

Hopefully this will fix #4422: essentially we need to make sure that the
cache on get_rooms_for_user_with_stream_ordering is invalidated before the
SyncHandler is notified for the new events. Doing so on the events stream
rather than the caches stream achieves this, and should be safe because the
only time we need to invalidate this cache is when we persist an event.

*Hopefully* this will fix #4422: essentially we need to make sure that the
cache on `get_rooms_for_user_with_stream_ordering` is invalidated *before* the
SyncHandler is notified for the new events. Doing so on the `events` stream
rather than the `caches` stream achieves this, and should be safe because the
only time we need to invalidate this cache is when we persist an event.
@richvdh richvdh requested a review from a team March 20, 2019 16:00
@codecov
Copy link

codecov bot commented Mar 20, 2019

Codecov Report

Merging #4903 into develop will decrease coverage by 23.97%.
The diff coverage is 25%.

@@             Coverage Diff              @@
##           develop    #4903       +/-   ##
============================================
- Coverage    77.96%   53.98%   -23.98%     
============================================
  Files          326      326               
  Lines        33958    33959        +1     
  Branches      5601     5601               
============================================
- Hits         26474    18334     -8140     
- Misses        5863    14400     +8537     
+ Partials      1621     1225      -396

@richvdh richvdh self-assigned this Mar 21, 2019
@richvdh
Copy link
Member Author

richvdh commented Mar 21, 2019

Sadly this approach turns out to be flawed. In general we cannot rely on using the event stream to invalidate caches driven by the current_state_events table (of which get_rooms_for_user_with_stream_ordering is an example), because state resolution means that current_state_events can change in a way that is apparently unrelated to the event which triggers it.

I will investigate whether we can use the "current state delta" replication stream in some way.

@richvdh richvdh closed this Mar 26, 2019
@richvdh richvdh deleted the rav/sync_cache_bug branch December 1, 2020 12:40
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants