summary refs log tree commit diff
path: root/changelog.d/14453.bugfix
diff options
context:
space:
mode:
authorSean Quah <8349537+squahtx@users.noreply.github.com>2022-11-16 15:01:22 +0000
committerGitHub <noreply@github.com>2022-11-16 15:01:22 +0000
commit882277008c7b43ab26e3445ab94a38aa25ad0965 (patch)
treee2f5a793032c52838516d4d4f72f5d98cb4af589 /changelog.d/14453.bugfix
parentRevert "Remove slaved id tracker (#14376)" (#14463) (diff)
downloadsynapse-882277008c7b43ab26e3445ab94a38aa25ad0965.tar.xz
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>
Diffstat (limited to 'changelog.d/14453.bugfix')
-rw-r--r--changelog.d/14453.bugfix1
1 files changed, 1 insertions, 0 deletions
diff --git a/changelog.d/14453.bugfix b/changelog.d/14453.bugfix
new file mode 100644
index 0000000000..4969e5450c
--- /dev/null
+++ b/changelog.d/14453.bugfix
@@ -0,0 +1 @@
+Fix a bug introduced in Synapse 1.70.0 where the background updates to add non-thread unique indexes on receipts could fail when upgrading from 1.67.0 or earlier.