0
0
Fork 1
mirror of https://mau.dev/maunium/synapse.git synced 2024-12-16 19:43:50 +01:00
synapse/tests/storage/databases/main
Sean Quah 882277008c
Fix background updates failing to add unique indexes on receipts (#14453)
As part of the database migration to support threaded receipts, there is
a possible window in between
`73/08thread_receipts_non_null.sql.postgres` removing the original
unique constraints on `receipts_linearized` and `receipts_graph` and the
`reeipts_linearized_unique_index` and `receipts_graph_unique_index`
background updates from `72/08thread_receipts.sql` completing where
the unique constraints on `receipts_linearized` and `receipts_graph` are
missing. Any emulated upserts on these tables must therefore be
performed with a lock held, otherwise duplicate rows can end up in the
tables when there are concurrent emulated upserts. Fix the missing lock.

Note that emulated upserts no longer happen by default on sqlite, since
the minimum supported version of sqlite supports native upserts by
default now.

Finally, clean up any duplicate receipts that may have crept in before
trying to create the `receipts_graph_unique_index` and
`receipts_linearized_unique_index` unique indexes.

Signed-off-by: Sean Quah <seanq@matrix.org>
2022-11-16 15:01:22 +00:00
..
__init__.py add a cache to have_seen_event (#9953) 2021-06-01 12:04:47 +01:00
test_deviceinbox.py Remove HomeServer.get_datastore() (#12031) 2022-02-23 11:04:02 +00:00
test_events_worker.py Remove _get_events_cache check optimisation from _have_seen_events_dict (#14161) 2022-10-18 10:33:21 +01:00
test_lock.py LockStore: fix acquiring a lock via LockStore.try_acquire_lock (#12832) 2022-05-30 09:41:13 +01:00
test_receipts.py Fix background updates failing to add unique indexes on receipts (#14453) 2022-11-16 15:01:22 +00:00
test_room.py Implement MSC3827: Filtering of /publicRooms by room type (#13031) 2022-06-29 17:12:45 +00:00