element-hq / element-hq/synapse

Federation catch-up is not necessarily correct due to the sharding of the event stream

Open
#15,260 0 comments 0 reactions 0 assignees View on GitHub
A-Federation O-Uncommon S-Minor T-Defect
Dominant language
Python
Stars
4.6k
Forks
600
Avg merge
5d 22h
Merged PRs (30d)
51

Description

This issue has been migrated from [#15260](https://github.com/matrix-org/synapse/issues/15260).

---

In the `destinations` table, we have `last_successful_stream_ordering` which contains the `stream_ordering` of the most recent PDU that was successfully sent to that destination.

However, given that we have sharded the event stream (since federation catch-up was implemented, I believe), I think there is now a small race condition when the PDUs are not produced in `stream_ordering` order but yet all get enqueued for transmission to the same destination.

The race condition means that we might track the fact that we successfully transmitted PDUs up to stream ordering `x` when in fact the PDU at `x - 1` (etc) was not transmitted — and won't be transmitted during catch-up later.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.