mirror of
https://github.com/element-hq/synapse
synced 2024-09-29 17:02:41 +00:00
Try to better explain why
See https://github.com/element-hq/synapse/pull/17293#discussion_r1633904606
This commit is contained in:
parent
b1af992113
commit
901ce62d07
1 changed files with 9 additions and 5 deletions
|
@ -914,11 +914,15 @@ class StreamWorkerStore(EventsWorkerStore, SQLBaseStore):
|
||||||
def get_last_event_in_room_before_stream_ordering_txn(
|
def get_last_event_in_room_before_stream_ordering_txn(
|
||||||
txn: LoggingTransaction,
|
txn: LoggingTransaction,
|
||||||
) -> Optional[str]:
|
) -> Optional[str]:
|
||||||
# We need to handle the fact that the stream tokens can be vector clocks. We
|
# We're looking for the closest event at or before the token. We need to
|
||||||
# do this by getting all rows between the minimum and maximum stream
|
# handle the fact that the stream token can be a vector clock (with an
|
||||||
# ordering in the token, plus one row less than the minimum stream ordering
|
# `instance_map`) and events can be persisted on different instances
|
||||||
# (TODO: Why?). We then filter the results against the token and return the
|
# (sharded event persisters). The first subquery handles the events that
|
||||||
# first row that matches.
|
# would be within the vector clock and gets all rows between the minimum and
|
||||||
|
# maximum stream ordering in the token which need to be filtered against the
|
||||||
|
# `instance_map`. The second subquery handles the "before" case and finds a
|
||||||
|
# row before the token. We then filter out any results past the token's
|
||||||
|
# vector clock and return the first row that matches.
|
||||||
min_stream = end_token.stream
|
min_stream = end_token.stream
|
||||||
max_stream = end_token.get_max_stream_pos()
|
max_stream = end_token.get_max_stream_pos()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue