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

Fix backfill storing incorrect state for events #4718

Merged
merged 7 commits into from
Feb 25, 2019

Conversation

erikjohnston
Copy link
Member

@erikjohnston erikjohnston commented Feb 22, 2019

Broadly, we were going through marking all fetched "auth events" as outliers, even if they appeared in the main backfill chunk of events. This led to state getting very confused when we tried to persist events that referenced outliers.

@codecov-io
Copy link

codecov-io commented Feb 22, 2019

Codecov Report

Merging #4718 into develop will increase coverage by 0.09%.
The diff coverage is 75%.

@@             Coverage Diff             @@
##           develop    #4718      +/-   ##
===========================================
+ Coverage    75.15%   75.25%   +0.09%     
===========================================
  Files          340      340              
  Lines        34823    34829       +6     
  Branches      5704     5704              
===========================================
+ Hits         26171    26209      +38     
+ Misses        7042     7019      -23     
+ Partials      1610     1601       -9

@erikjohnston erikjohnston requested a review from a team February 25, 2019 10:03
@@ -786,13 +801,18 @@ def backfill(self, dest, room_id, limit, extremities):
})

for e_id in events_to_state:
# For paranoia we ensure that these events are marked as
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this seems to be in conflict with the comment at line 775 that says "... state get persisted as outliers". What am I missing?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs more comments, obviously. The keys of events_to_state are the new backwards extremities, as those are the events that we fetched state for

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would seem a whole lot less opaque to iterate over edges rather than the keys of events_to_state, but ok.

# For paranoia we ensure that these events are marked as
# non-outliers
ev = event_map[e_id]
ev.internal_metadata.outlier = False
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this sort of thing always alarms me slightly; if outlier was set doesn't it mean that something else has gone wrong? shouldn't we just raise an AssertionError or something?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assert is actually probably what we want here, yes

Copy link
Member

@richvdh richvdh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@richvdh
Copy link
Member

richvdh commented Feb 25, 2019

[sad pep8 is sad]

@@ -0,0 +1 @@
Fix paginating over federation persisting incorrect state
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needs a full-stop

@erikjohnston erikjohnston merged commit 69efe6f into develop Feb 25, 2019
@erikjohnston erikjohnston deleted the erikj/fix_backfill_state_shred branch March 5, 2019 13:51
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.

3 participants