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
api
app Fix typechecking errors introduced in #14128 (#14455) 2022-11-15 16:36:43 +00:00
appservice
config
crypto
events
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
logging
metrics
module_api
push
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
server_notices
spam_checker_api
state
static
storage Fix background updates failing to add unique indexes on receipts (#14453) 2022-11-16 15:01:22 +00:00
streams
util
__init__.py
event_auth.py
notifier.py
py.typed
server.py Fix typechecking errors introduced in #14128 (#14455) 2022-11-15 16:36:43 +00:00
types.py
visibility.py