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

Commit 3940871

Browse files
committed
Exclude outliers in on_backfill_request
When we are processing a `/backfill` request from a remote server, exclude any outliers from consideration early on. We can't return outliers anyway (since we don't know the state at the outlier), and filtering them out earlier means that we won't attempt to calulate the state for them.
1 parent 8b7b371 commit 3940871

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

changelog.d/12314.misc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Avoid trying to calculate the state at outlier events.

synapse/storage/databases/main/event_federation.py

+9-3
Original file line numberDiff line numberDiff line change
@@ -1073,9 +1073,15 @@ def _get_connected_prev_event_backfill_results_txn(
10731073
/* Get the depth and stream_ordering of the prev_event_id from the events table */
10741074
INNER JOIN events
10751075
ON prev_event_id = events.event_id
1076+
1077+
/* exclude outliers from the results (we don't have the state, so cannot
1078+
* verify if the requesting server can see them).
1079+
*/
1080+
WHERE NOT events.outlier
1081+
10761082
/* Look for an edge which matches the given event_id */
1077-
WHERE event_edges.event_id = ?
1078-
AND event_edges.is_state = ?
1083+
AND event_edges.event_id = ? AND NOT event_edges.is_state
1084+
10791085
/* Because we can have many events at the same depth,
10801086
* we want to also tie-break and sort on stream_ordering */
10811087
ORDER BY depth DESC, stream_ordering DESC
@@ -1084,7 +1090,7 @@ def _get_connected_prev_event_backfill_results_txn(
10841090

10851091
txn.execute(
10861092
connected_prev_event_query,
1087-
(event_id, False, limit),
1093+
(event_id, limit),
10881094
)
10891095
return [
10901096
BackfillQueueNavigationItem(

0 commit comments

Comments
 (0)