summary refs log tree commit diff
path: root/synapse/storage/schema/common
diff options
context:
space:
mode:
authorreivilibre <oliverw@matrix.org>2023-12-04 14:57:28 +0000
committerGitHub <noreply@github.com>2023-12-04 14:57:28 +0000
commit51e4e35653f98c3f61222fbdbdb1dcb8864f7fca (patch)
treeb732cd0784e3540ddc03c9af5ba034a79d7d8009 /synapse/storage/schema/common
parentSwitch UNIX socket paths to /run, and add a UNIX socket example for HAProxy (... (diff)
downloadsynapse-51e4e35653f98c3f61222fbdbdb1dcb8864f7fca.tar.xz
Add a Postgres `REPLICA IDENTITY` to tables that do not have an implicit one. This should allow use of Postgres logical replication. (take 2, now with no added deadlocks!) (#16658)
* Add `ALTER TABLE ... REPLICA IDENTITY ...` for individual tables

We can't combine them into one file as it makes it likely to hit a deadlock

if Synapse is running, as it only takes one other transaction to access two

tables in a different order to the schema delta.

* Add notes

* Newsfile

Signed-off-by: Olivier Wilkinson (reivilibre) <oliverw@matrix.org>

* Re-introduce REPLICA IDENTITY test

---------

Signed-off-by: Olivier Wilkinson (reivilibre) <oliverw@matrix.org>
Diffstat (limited to 'synapse/storage/schema/common')
-rw-r--r--synapse/storage/schema/common/delta/83/10_replica_identity_applied_module_schemas.sql.postgres1
-rw-r--r--synapse/storage/schema/common/delta/83/10_replica_identity_applied_schema_deltas.sql.postgres1
-rw-r--r--synapse/storage/schema/common/delta/83/10_replica_identity_background_updates.sql.postgres1
-rw-r--r--synapse/storage/schema/common/delta/83/10_replica_identity_schema_compat_version.sql.postgres1
-rw-r--r--synapse/storage/schema/common/delta/83/10_replica_identity_schema_version.sql.postgres1
5 files changed, 5 insertions, 0 deletions
diff --git a/synapse/storage/schema/common/delta/83/10_replica_identity_applied_module_schemas.sql.postgres b/synapse/storage/schema/common/delta/83/10_replica_identity_applied_module_schemas.sql.postgres
new file mode 100644
index 0000000000..57c35b6430
--- /dev/null
+++ b/synapse/storage/schema/common/delta/83/10_replica_identity_applied_module_schemas.sql.postgres
@@ -0,0 +1 @@
+ALTER TABLE applied_module_schemas REPLICA IDENTITY USING INDEX applied_module_schemas_module_name_file_key;
diff --git a/synapse/storage/schema/common/delta/83/10_replica_identity_applied_schema_deltas.sql.postgres b/synapse/storage/schema/common/delta/83/10_replica_identity_applied_schema_deltas.sql.postgres
new file mode 100644
index 0000000000..1426f9a9e4
--- /dev/null
+++ b/synapse/storage/schema/common/delta/83/10_replica_identity_applied_schema_deltas.sql.postgres
@@ -0,0 +1 @@
+ALTER TABLE applied_schema_deltas REPLICA IDENTITY USING INDEX applied_schema_deltas_version_file_key;
diff --git a/synapse/storage/schema/common/delta/83/10_replica_identity_background_updates.sql.postgres b/synapse/storage/schema/common/delta/83/10_replica_identity_background_updates.sql.postgres
new file mode 100644
index 0000000000..f04937b3db
--- /dev/null
+++ b/synapse/storage/schema/common/delta/83/10_replica_identity_background_updates.sql.postgres
@@ -0,0 +1 @@
+ALTER TABLE background_updates REPLICA IDENTITY USING INDEX background_updates_uniqueness;
diff --git a/synapse/storage/schema/common/delta/83/10_replica_identity_schema_compat_version.sql.postgres b/synapse/storage/schema/common/delta/83/10_replica_identity_schema_compat_version.sql.postgres
new file mode 100644
index 0000000000..e3a6f7ca4f
--- /dev/null
+++ b/synapse/storage/schema/common/delta/83/10_replica_identity_schema_compat_version.sql.postgres
@@ -0,0 +1 @@
+ALTER TABLE schema_compat_version REPLICA IDENTITY USING INDEX schema_compat_version_lock_key;
diff --git a/synapse/storage/schema/common/delta/83/10_replica_identity_schema_version.sql.postgres b/synapse/storage/schema/common/delta/83/10_replica_identity_schema_version.sql.postgres
new file mode 100644
index 0000000000..c10efe0563
--- /dev/null
+++ b/synapse/storage/schema/common/delta/83/10_replica_identity_schema_version.sql.postgres
@@ -0,0 +1 @@
+ALTER TABLE schema_version REPLICA IDENTITY USING INDEX schema_version_lock_key;