This repository has been archived by the owner on Apr 26, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Scratch changes to fix have_seen_event
not being invalidated
#13861
Closed
MadLittleMods
wants to merge
3
commits into
madlittlemods/13356-messages-investigation-scratch-v1
from
madlittlemods/13856-scratch-have-seen-event-monolith-invalidation
Closed
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -434,6 +434,24 @@ def _persist_events_txn( | |
|
||
self._store_event_txn(txn, events_and_contexts=events_and_contexts) | ||
|
||
for event, _ in events_and_contexts: | ||
# We expect events to be persisted by this point | ||
assert event.internal_metadata.stream_ordering | ||
|
||
relation = relation_from_event(event) | ||
self.store._invalidate_caches_for_event( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This needs to move because we can't touch the cache objects from this background queue thread processing and persisting the events. Otherwise we run into
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I could move the cache invalidation to the
|
||
stream_ordering=event.internal_metadata.stream_ordering, | ||
event_id=event.event_id, | ||
room_id=event.room_id, | ||
etype=event.type, | ||
state_key=None, # event.state_key, | ||
# TODO | ||
redacts=None, | ||
relates_to=relation.parent_id if relation else None, | ||
# TODO | ||
backfilled=False, | ||
MadLittleMods marked this conversation as resolved.
Show resolved
Hide resolved
|
||
) | ||
|
||
self._persist_transaction_ids_txn(txn, events_and_contexts) | ||
|
||
# Insert into event_to_state_groups. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This key lookup was wrong and we were never invalidating the
have_seen_event
cache even over replication.Yes, the cache key literally a
set
wrapped inset
. Something weird with theTreeCache
I assumeex.
(('!TnCIJPKzdQdUlIyXdQ:test', '$Iu0eqEBN7qcyF1S9B3oNB3I91v2o5YOgRNPwi_78s-k'),)
We should probably check all other instances of this for the same problem. And ideally fix the cache so it uses the expected
(room_id, event_id)
key tuple instead.