Skip to content
Snippets Groups Projects
Unverified Commit 631dd06f authored by Erik Johnston's avatar Erik Johnston Committed by GitHub
Browse files

Fix get destinations to catch up query. (#9114)

t was doing a sequential scan on `destination_rooms`, which took
minutes.
parent 7036e24e
No related branches found
No related tags found
No related merge requests found
Fix bug in federation catchup logic that caused outbound federation to be delayed for large servers after start up. Introduced in v1.21.0.
...@@ -464,19 +464,17 @@ class TransactionStore(TransactionWorkerStore): ...@@ -464,19 +464,17 @@ class TransactionStore(TransactionWorkerStore):
txn: LoggingTransaction, now_time_ms: int, after_destination: Optional[str] txn: LoggingTransaction, now_time_ms: int, after_destination: Optional[str]
) -> List[str]: ) -> List[str]:
q = """ q = """
SELECT destination FROM destinations SELECT DISTINCT destination FROM destinations
WHERE destination IN ( INNER JOIN destination_rooms USING (destination)
SELECT destination FROM destination_rooms WHERE
WHERE destination_rooms.stream_ordering > stream_ordering > last_successful_stream_ordering
destinations.last_successful_stream_ordering AND destination > ?
) AND (
AND destination > ? retry_last_ts IS NULL OR
AND ( retry_last_ts + retry_interval < ?
retry_last_ts IS NULL OR )
retry_last_ts + retry_interval < ? ORDER BY destination
) LIMIT 25
ORDER BY destination
LIMIT 25
""" """
txn.execute( txn.execute(
q, q,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment