summary refs log tree commit diff
path: root/synapse/storage
diff options
context:
space:
mode:
authorEric Eastwood <erice@element.io>2021-09-28 21:23:16 -0500
committerGitHub <noreply@github.com>2021-09-28 21:23:16 -0500
commit9fd057b8c5a8c5748e7d8137d1485c38abd9602f (patch)
treecc5217c451f43f2cd61da15f851e3d0c7fab664d /synapse/storage
parentUpdate utility code to handle C implementations of frozendict (#10902) (diff)
downloadsynapse-9fd057b8c5a8c5748e7d8137d1485c38abd9602f.tar.xz
Ensure `(room_id, next_batch_id)` is unique to avoid cross-talk/conflicts between batches (MSC2716) (#10877)
Part of [MSC2716](https://github.com/matrix-org/matrix-doc/pull/2716)

Part of https://github.com/matrix-org/synapse/issues/10737
Diffstat (limited to 'synapse/storage')
-rw-r--r--synapse/storage/databases/main/room_batch.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/synapse/storage/databases/main/room_batch.py b/synapse/storage/databases/main/room_batch.py
index a383388757..300a563c9e 100644
--- a/synapse/storage/databases/main/room_batch.py
+++ b/synapse/storage/databases/main/room_batch.py
@@ -18,7 +18,9 @@ from synapse.storage._base import SQLBaseStore
 
 
 class RoomBatchStore(SQLBaseStore):
-    async def get_insertion_event_by_batch_id(self, batch_id: str) -> Optional[str]:
+    async def get_insertion_event_by_batch_id(
+        self, room_id: str, batch_id: str
+    ) -> Optional[str]:
         """Retrieve a insertion event ID.
 
         Args:
@@ -30,7 +32,7 @@ class RoomBatchStore(SQLBaseStore):
         """
         return await self.db_pool.simple_select_one_onecol(
             table="insertion_events",
-            keyvalues={"next_batch_id": batch_id},
+            keyvalues={"room_id": room_id, "next_batch_id": batch_id},
             retcol="event_id",
             allow_none=True,
         )