This repository has been archived by the owner on Apr 26, 2024. It is now read-only.
Incremental /sync
and /transactions
query events differently
#11394
Labels
A-Application-Service
Related to AS support
A-Sync
defects related to /sync
T-Defect
Bugs, crashes, hangs, security vulnerabilities, or other reported issues.
As discovered in #11265 (comment)
/sync
looks forstream_ordering
but excludes alloutliers
.synapse/synapse/storage/databases/main/stream.py
Lines 519 to 527 in b09d90c
Whereas
/transactions
(Application service API) only cares aboutstream_ordering
.synapse/synapse/storage/databases/main/appservice.py
Lines 358 to 368 in b09d90c
The behavior of these two endpoints should probably return and push the same events.
Here is the history behind why we added
AND not outlier
to the incremental sync endpoint, "Don't return outliers when we get recent events for rooms.", 1505055 but it doesn't explain the why or which interaction createsoutlier
events that aren'tbackfilled
.What does the spec say?
For
/transactions
, the spec doesn't distinguish which events a homeserver should and shouldn't push, https://spec.matrix.org/v1.1/application-service-api/#put_matrixappv1transactionstxnidFor
/sync
, there is also nothing so clear cut but it's obvious using thesince
pagination query parameter that it should return anything after which equates tostream_ordering
in Synapse land.Potential solutions
Exclude
outliers
in bothPerhaps we should exclude
outliers
in/transactions
so they both just match?@richvdh had some critique about this approach though:
But for
/transactions
, we can't tell whether the event wasbackfilled
. The only indication is that thestream_ordering
would be negative which is what the/transactions
code already takes into account.Only exclude
backfilled
eventsThis means only relying on
stream_ordering
.Then any interaction creating
outliers
that we don't want to appear down/sync
//transactions
, should be updated to be also marked asbackfilled
.Dev notes
/sync
stack traceSyncRestServlet.on_GET
wait_for_sync_for_user
_wait_for_sync_for_user
current_sync_for_user
generate_sync_result
_generate_sync_entry_for_rooms
_get_rooms_changed
get_room_events_stream_for_rooms
get_room_events_stream_for_room
/transactions
stack tracenotify_interested_services
_notify_interested_services
get_new_events_for_appservice
submit_event_for_as
submit_event_for_as
->enqueue_event
_send_request
appservice.scheduler.send
create_appservice_txn
AppServiceTransaction.send
push_bulk
/transactions
The text was updated successfully, but these errors were encountered: