MatrixSynapse/synapse/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 Merge/remove `Slaved*` stores into `WorkerStores` (#14375) 2022-11-11 10:51:49 +00:00
account_data.py Revert "Remove slaved id tracker (#14376)" (#14463) 2022-11-16 13:50:07 +00:00
appservice.py Check appservice user interest against the local users instead of all users (`get_users_in_room` mis-use) (#13958) 2022-10-27 18:29:23 +00:00
cache.py Invalidate rooms for user caches when receiving membership events (#14155) 2022-10-17 13:27:51 +01:00
censor_events.py Safe async event cache (#13308) 2022-07-19 11:25:29 +00:00
client_ips.py Optimise `_update_client_ips_batch_txn` to batch together database operations. (#12252) 2022-04-08 15:29:13 +01:00
deviceinbox.py Add missing types to opentracing. (#13345) 2022-07-21 12:01:52 +00:00
devices.py Revert "Remove slaved id tracker (#14376)" (#14463) 2022-11-16 13:50:07 +00:00
directory.py Replace uses of simple_insert_many with simple_insert_many_values. (#11742) 2022-01-13 19:44:18 -05:00
e2e_room_keys.py Add `StreamKeyType` class and replace string literals with constants (#12567) 2022-05-16 15:35:31 +00:00
end_to_end_keys.py Prevent federation user keys query from returning device names if disallowed (#14304) 2022-10-28 18:06:02 +01:00
event_federation.py Stop getting missing `prev_events` after we already know their signature is invalid (#13816) 2022-10-15 00:36:49 -05:00
event_push_actions.py Update the thread_id right before use (in case the bg update hasn't finished) (#14222) 2022-10-18 14:55:41 +00:00
events.py Clean-up events persistance code (#14411) 2022-11-14 08:13:11 -05:00
events_bg_updates.py Fix background update table-scanning `events` (#14374) 2022-11-07 14:28:00 +00:00
events_forward_extremities.py Fix returned count of delete extremities admin API (#12496) 2022-04-19 16:49:45 +01:00
events_worker.py Revert "Remove slaved id tracker (#14376)" (#14463) 2022-11-16 13:50:07 +00:00
filtering.py Merge/remove `Slaved*` stores into `WorkerStores` (#14375) 2022-11-11 10:51:49 +00:00
keys.py Add some type hints to datastore (#12485) 2022-04-27 13:05:00 +01:00
lock.py Require SQLite >= 3.27.0 (#13760) 2022-09-09 11:14:10 +01:00
media_repository.py Replace noop background updates with DELETE. (#12954) 2022-06-13 14:06:27 -04:00
metrics.py Add some type hints to datastore (#12717) 2022-05-17 15:29:06 +01:00
monthly_active_users.py Safe async event cache (#13308) 2022-07-19 11:25:29 +00:00
openid.py Add type hints to some storage classes (#11307) 2021-11-11 08:47:31 -05:00
presence.py Revert "Make all `process_replication_rows` methods async (#13304)" (#13312) 2022-07-18 14:28:14 +01:00
profile.py Remove remaining pieces of groups code. (#12966) 2022-06-06 13:20:05 -04:00
purge_events.py Add support to purge rows from MSC2716 and other tables when purging a room (#13825) 2022-09-16 10:56:56 -05:00
push_rule.py Revert "Remove slaved id tracker (#14376)" (#14463) 2022-11-16 13:50:07 +00:00
pusher.py Revert "Remove slaved id tracker (#14376)" (#14463) 2022-11-16 13:50:07 +00:00
receipts.py Fix background updates failing to add unique indexes on receipts (#14453) 2022-11-16 15:01:22 +00:00
registration.py Support OIDC backchannel logouts (#11414) 2022-10-31 13:07:30 -04:00
rejections.py Remove redundant "coding: utf-8" lines (#9786) 2021-04-14 15:34:27 +01:00
relations.py Implement MSC3912: Relation-based redactions (#14260) 2022-11-03 16:21:31 +00:00
room.py When restarting a partial join resync, prioritise the server which actioned a partial join (#14126) 2022-10-18 12:33:18 +01:00
room_batch.py Correct type hint for room_batch.py (#11310) 2021-11-11 16:49:28 +00:00
roommember.py Include heroes in partial join responses' state (#14442) 2022-11-15 17:35:19 +00:00
search.py Drop support for Postgres 10 in full text search code. (#14397) 2022-11-09 09:55:34 -05:00
session.py Run `pyupgrade --py37-plus --keep-percent-format` on Synapse (#11685) 2022-01-05 09:53:05 -08:00
signatures.py remove constantly lib use and switch to enums. (#12624) 2022-05-04 11:26:11 +00:00
state.py Instrument `get_metadata_for_events` for tracing (#13730) 2022-09-07 11:41:52 -05:00
state_deltas.py Wait for lazy join to complete when getting current state (#12872) 2022-06-01 16:02:53 +01:00
stats.py Require SQLite >= 3.27.0 (#13760) 2022-09-09 11:14:10 +01:00
stream.py Merge/remove `Slaved*` stores into `WorkerStores` (#14375) 2022-11-11 10:51:49 +00:00
tags.py Revert "Make all `process_replication_rows` methods async (#13304)" (#13312) 2022-07-18 14:28:14 +01:00
transactions.py Require SQLite >= 3.27.0 (#13760) 2022-09-09 11:14:10 +01:00
ui_auth.py Add some type hints to datastore (#12485) 2022-04-27 13:05:00 +01:00
user_directory.py Wait for lazy join to complete when getting current state (#12872) 2022-06-01 16:02:53 +01:00
user_erasure_store.py Annotations for user_erasure_store (#11313) 2021-11-11 19:22:19 +00:00