diff --git a/synapse/storage/databases/main/transactions.py b/synapse/storage/databases/main/transactions.py index 08ecf8ece5..45eee028fb 100644 --- a/synapse/storage/databases/main/transactions.py +++ b/synapse/storage/databases/main/transactions.py @@ -409,6 +409,6 @@ class TransactionStore(SQLBaseStore): "destination_rooms", ["destination", "room_id"], rows, - ["event_id", "stream_ordering"], - [(event_id, stream_ordering)] * len(rows), + ["stream_ordering"], + [(stream_ordering,)] * len(rows), ) diff --git a/tests/federation/test_federation_catch_up.py b/tests/federation/test_federation_catch_up.py index 11eb565b3b..84a0180911 100644 --- a/tests/federation/test_federation_catch_up.py +++ b/tests/federation/test_federation_catch_up.py @@ -54,13 +54,24 @@ class FederationCatchUpTestCases(FederatingHomeserverTestCase): Returns: Dictionary of { event_id: str, stream_ordering: int } """ - return self.get_success( - self.hs.get_datastore().db_pool.simple_select_one( - table="destination_rooms", - keyvalues={"destination": destination, "room_id": room}, - retcols=["event_id", "stream_ordering"], + event_id, stream_ordering = self.get_success( + self.hs.get_datastore().db_pool.execute( + "test:get_destination_rooms", + None, + """ + SELECT event_id, stream_ordering + FROM destination_rooms dr + JOIN events USING (stream_ordering) + WHERE dr.destination = ? AND dr.room_id = ? + """, + destination, + room ) - ) + )[0] + return { + "event_id": event_id, + "stream_ordering": stream_ordering + } def make_fake_destination_queue( self, destination: str = "host2"