MatrixSynapse/synapse
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
..
_scripts let update_synapse_database run on a multi-database configurations (#13422) 2022-10-19 19:08:40 +01:00
api Do not reject `/sync` requests with unrecognised filter fields (#14369) 2022-11-07 13:49:31 +00:00
app Fix typechecking errors introduced in #14128 (#14455) 2022-11-15 16:36:43 +00:00
appservice Merge branch 'master' into develop 2022-10-28 15:59:51 +01:00
config Support using SSL on worker endpoints. (#14128) 2022-11-15 12:55:00 +00:00
crypto Instrument `_check_sigs_and_hash_and_fetch` to trace time spent in child concurrent calls (#13588) 2022-08-23 21:53:37 -05:00
events Fix docstring in EventContext (#14145) 2022-10-18 13:40:50 -07:00
federation Include heroes in partial join responses' state (#14442) 2022-11-15 17:35:19 +00:00
handlers Don't filter state in /context response (#14461) 2022-11-16 12:09:33 +00:00
http Improve `RawHeaders` type hints (#14303) 2022-10-28 16:04:02 +00:00
logging Update mypy and mypy-zope, attempt 3 (#13993) 2022-09-30 17:36:28 +01:00
metrics Avoid incrementing bg process utime/stime counters by negative durations (#14323) 2022-10-31 13:02:07 +00:00
module_api Save login tokens in database (#13844) 2022-10-26 11:45:41 +01:00
push Send content rules with pattern_type to clients (#14356) 2022-11-15 15:29:30 +00:00
replication Revert "Remove slaved id tracker (#14376)" (#14463) 2022-11-16 13:50:07 +00:00
res Fix HTML templates missing correct HTML tags (#14448) 2022-11-16 11:14:38 +00:00
rest Add an Admin API endpoint for looking up users based on 3PID (#14405) 2022-11-11 15:38:17 +00:00
server_notices Directly lookup local membership instead of getting all members in a room first (`get_users_in_room` mis-use) (#13608) 2022-08-24 14:13:12 -05:00
spam_checker_api Fix import in module_api module and docs on the new check_event_for_spam signature (#12918) 2022-05-31 12:04:53 +02:00
state Prepatory work for batching events to send (#13487) 2022-09-28 10:39:03 +01:00
static Add viewport directive to HTML templates to optimise for mobile (#13493) 2022-08-11 14:04:20 +01:00
storage Fix background updates failing to add unique indexes on receipts (#14453) 2022-11-16 15:01:22 +00:00
streams Remove unused type-ignores (#14433) 2022-11-14 13:46:29 +00:00
util Remove duplicated code to evict entries. (#14410) 2022-11-10 15:33:34 -05:00
__init__.py Parse SYNAPSE_ASYNC_IO_REACTOR env variable & log the reactor on startup (#14092) 2022-10-07 15:19:59 +01:00
event_auth.py Revert "Fix event size checks (#13710)" 2022-11-01 11:47:09 +00:00
notifier.py Batch up notifications after event persistence (#14033) 2022-10-05 10:12:48 -07:00
py.typed Mark Module API error imports as re-exported and mark Synapse as containing type annotations (#11054) 2021-10-13 08:42:41 +01:00
server.py Fix typechecking errors introduced in #14128 (#14455) 2022-11-15 16:36:43 +00:00
types.py Accept & store thread IDs for receipts (implement MSC3771). (#13782) 2022-09-23 14:33:28 +00:00
visibility.py Add debug logs to figure out why an event was filtered (#14095) 2022-10-17 16:02:39 -05:00