summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorPatrick Cloke <clokep@users.noreply.github.com>2023-02-01 15:45:10 -0500
committerGitHub <noreply@github.com>2023-02-01 15:45:10 -0500
commit230a831c734246aa4db7bd842947c7ea277ca126 (patch)
tree8172b242a3c708906a44a86d6b0804cb03afef08 /tests
parentBump docker/build-push-action from 3 to 4 (#14952) (diff)
downloadsynapse-230a831c734246aa4db7bd842947c7ea277ca126.tar.xz
Attempt to delete more duplicate rows in receipts_linearized table. (#14915)
The previous assumption was that the stream_id column was unique
(for a room ID, receipt type, user ID tuple), but this turned out to be
incorrect.

Now find the max stream ID, then map this back to a database-specific
row identifier and delete other rows which match the (room ID, receipt type,
user ID) tuple, but *not* the row ID.
Diffstat (limited to 'tests')
-rw-r--r--tests/storage/databases/main/test_receipts.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/tests/storage/databases/main/test_receipts.py b/tests/storage/databases/main/test_receipts.py
index 68026e2830..ac77aec003 100644
--- a/tests/storage/databases/main/test_receipts.py
+++ b/tests/storage/databases/main/test_receipts.py
@@ -168,7 +168,9 @@ class ReceiptsBackgroundUpdateStoreTestCase(HomeserverTestCase):
                     {"stream_id": 6, "event_id": "$some_event"},
                 ],
                 (self.other_room_id, "m.read", self.user_id): [
-                    {"stream_id": 7, "event_id": "$some_event"}
+                    # It is possible for stream IDs to be duplicated.
+                    {"stream_id": 7, "event_id": "$some_event"},
+                    {"stream_id": 7, "event_id": "$some_event"},
                 ],
             },
             expected_unique_receipts={