From 0874fd419c474e492ec8f6a99cf95352ef10e9f6 Mon Sep 17 00:00:00 2001 From: finn Date: Wed, 27 Jul 2022 12:48:06 -0700 Subject: [PATCH 1/4] Allow sharded database in db migrate script Signed-off-by: Finn Herzfeld --- changelog.d/13422.bugfix | 1 + synapse/_scripts/update_synapse_database.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 changelog.d/13422.bugfix diff --git a/changelog.d/13422.bugfix b/changelog.d/13422.bugfix new file mode 100644 index 000000000000..347104e0bb66 --- /dev/null +++ b/changelog.d/13422.bugfix @@ -0,0 +1 @@ +let update_synapse_database run in configurations with multiple databases. Contributed by @thefinn93 @ Beeper. \ No newline at end of file diff --git a/synapse/_scripts/update_synapse_database.py b/synapse/_scripts/update_synapse_database.py index b4aeae6dd5b8..d0e227fa15d0 100755 --- a/synapse/_scripts/update_synapse_database.py +++ b/synapse/_scripts/update_synapse_database.py @@ -97,8 +97,8 @@ def main() -> None: # Load, process and sanity-check the config. hs_config = yaml.safe_load(args.database_config) - if "database" not in hs_config: - sys.stderr.write("The configuration file must have a 'database' section.\n") + if "database" not in hs_config and "databases" not in hs_config: + sys.stderr.write("The configuration file must have a 'database' or 'databases' section.\n") sys.exit(4) config = HomeServerConfig() From 974d152c8c9378884c918e42279d46f82b0fa878 Mon Sep 17 00:00:00 2001 From: Finn Date: Fri, 29 Jul 2022 10:13:32 -0700 Subject: [PATCH 2/4] Update changelog.d/13422.bugfix Co-authored-by: Patrick Cloke --- changelog.d/13422.bugfix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog.d/13422.bugfix b/changelog.d/13422.bugfix index 347104e0bb66..3a099acbe6b8 100644 --- a/changelog.d/13422.bugfix +++ b/changelog.d/13422.bugfix @@ -1 +1 @@ -let update_synapse_database run in configurations with multiple databases. Contributed by @thefinn93 @ Beeper. \ No newline at end of file +Fix a long-standing bug where the `update_synapse_database` script could not be run with multiple databases. Contributed by @thefinn93 @ Beeper. \ No newline at end of file From 2d28e7b2ea986dec7bfd19d25e0dacf09ac2beb8 Mon Sep 17 00:00:00 2001 From: finn Date: Fri, 29 Jul 2022 10:26:05 -0700 Subject: [PATCH 3/4] Remove check entirely --- synapse/_scripts/update_synapse_database.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/synapse/_scripts/update_synapse_database.py b/synapse/_scripts/update_synapse_database.py index d0e227fa15d0..7e40ac33b216 100755 --- a/synapse/_scripts/update_synapse_database.py +++ b/synapse/_scripts/update_synapse_database.py @@ -97,10 +97,6 @@ def main() -> None: # Load, process and sanity-check the config. hs_config = yaml.safe_load(args.database_config) - if "database" not in hs_config and "databases" not in hs_config: - sys.stderr.write("The configuration file must have a 'database' or 'databases' section.\n") - sys.exit(4) - config = HomeServerConfig() config.parse_config_dict(hs_config, "", "") From 602e254f477c1bbb46fe8a5bc157da061c844390 Mon Sep 17 00:00:00 2001 From: finn Date: Fri, 29 Jul 2022 10:37:03 -0700 Subject: [PATCH 4/4] remove unused import --- synapse/_scripts/update_synapse_database.py | 1 - 1 file changed, 1 deletion(-) diff --git a/synapse/_scripts/update_synapse_database.py b/synapse/_scripts/update_synapse_database.py index 7e40ac33b216..66359e8b14b1 100755 --- a/synapse/_scripts/update_synapse_database.py +++ b/synapse/_scripts/update_synapse_database.py @@ -15,7 +15,6 @@ import argparse import logging -import sys from typing import cast import yaml