From 03d3792f3c7978ecc057cab19ff95c8310403665 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff <1389908+richvdh@users.noreply.github.com> Date: Fri, 20 Dec 2019 09:55:45 +0000 Subject: [PATCH 1/3] Fix exceptions when attempting to backfill (#6576) Fixes #6575 --- changelog.d/6576.bugfix | 1 + synapse/handlers/federation.py | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 changelog.d/6576.bugfix diff --git a/changelog.d/6576.bugfix b/changelog.d/6576.bugfix new file mode 100644 index 0000000000..f5414fce4d --- /dev/null +++ b/changelog.d/6576.bugfix @@ -0,0 +1 @@ +Fix errors when attempting to backfill rooms over federation. diff --git a/synapse/handlers/federation.py b/synapse/handlers/federation.py index abe02907b9..6fb453ce60 100644 --- a/synapse/handlers/federation.py +++ b/synapse/handlers/federation.py @@ -797,7 +797,10 @@ class FederationHandler(BaseHandler): events_to_state = {} for e_id in edges: state, auth = yield self._get_state_for_room( - destination=dest, room_id=room_id, event_id=e_id + destination=dest, + room_id=room_id, + event_id=e_id, + include_event_in_state=False, ) auth_events.update({a.event_id: a for a in auth}) auth_events.update({s.event_id: s for s in state}) From 4caab0e95e6972e9c0533bc1897073bda5a464bf Mon Sep 17 00:00:00 2001 From: Richard van der Hoff <1389908+richvdh@users.noreply.github.com> Date: Fri, 20 Dec 2019 10:46:46 +0000 Subject: [PATCH 2/3] Backport fixes to sqlite upgrade from develop (#6578) Only run prepare_database on connection for in-memory databases. Fixes #6569. --- changelog.d/6578.bugfix | 1 + synapse/storage/engines/sqlite.py | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 changelog.d/6578.bugfix diff --git a/changelog.d/6578.bugfix b/changelog.d/6578.bugfix new file mode 100644 index 0000000000..fae55a4456 --- /dev/null +++ b/changelog.d/6578.bugfix @@ -0,0 +1 @@ +Fix a bug introduced in Synapse 1.7.0 which caused an error on startup when upgrading from versions before 1.3.0. diff --git a/synapse/storage/engines/sqlite.py b/synapse/storage/engines/sqlite.py index ddad17dc5a..cbc74cd302 100644 --- a/synapse/storage/engines/sqlite.py +++ b/synapse/storage/engines/sqlite.py @@ -25,6 +25,9 @@ class Sqlite3Engine(object): def __init__(self, database_module, database_config): self.module = database_module + database = database_config.get("args", {}).get("database") + self._is_in_memory = database in (None, ":memory:",) + # The current max state_group, or None if we haven't looked # in the DB yet. self._current_state_group_id = None @@ -59,7 +62,12 @@ class Sqlite3Engine(object): return sql def on_new_connection(self, db_conn): - prepare_database(db_conn, self, config=None) + if self._is_in_memory: + # In memory databases need to be rebuilt each time. Ideally we'd + # reuse the same connection as we do when starting up, but that + # would involve using adbapi before we have started the reactor. + prepare_database(db_conn, self, config=None) + db_conn.create_function("rank", 1, _rank) def is_deadlock(self, error): From 29794c6bc84b9ba76f041bbc8a180b7421996004 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Fri, 20 Dec 2019 10:58:07 +0000 Subject: [PATCH 3/3] 1.7.2 --- CHANGES.md | 12 ++++++++++++ changelog.d/6576.bugfix | 1 - changelog.d/6578.bugfix | 1 - debian/changelog | 6 ++++++ synapse/__init__.py | 2 +- 5 files changed, 19 insertions(+), 3 deletions(-) delete mode 100644 changelog.d/6576.bugfix delete mode 100644 changelog.d/6578.bugfix diff --git a/CHANGES.md b/CHANGES.md index 7927714a36..d6567e24d2 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,15 @@ +Synapse 1.7.2 (2019-12-20) +========================== + +This release fixes some regressions introduced in Synapse 1.7.0 and 1.7.1. + +Bugfixes +-------- + +- Fix a regression introduced in Synapse 1.7.1 which caused errors when attempting to backfill rooms over federation. ([\#6576](https://github.com/matrix-org/synapse/issues/6576)) +- Fix a bug introduced in Synapse 1.7.0 which caused an error on startup when upgrading from versions before 1.3.0. ([\#6578](https://github.com/matrix-org/synapse/issues/6578)) + + Synapse 1.7.1 (2019-12-18) ========================== diff --git a/changelog.d/6576.bugfix b/changelog.d/6576.bugfix deleted file mode 100644 index f5414fce4d..0000000000 --- a/changelog.d/6576.bugfix +++ /dev/null @@ -1 +0,0 @@ -Fix errors when attempting to backfill rooms over federation. diff --git a/changelog.d/6578.bugfix b/changelog.d/6578.bugfix deleted file mode 100644 index fae55a4456..0000000000 --- a/changelog.d/6578.bugfix +++ /dev/null @@ -1 +0,0 @@ -Fix a bug introduced in Synapse 1.7.0 which caused an error on startup when upgrading from versions before 1.3.0. diff --git a/debian/changelog b/debian/changelog index e400619eb9..2492b5db92 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +matrix-synapse-py3 (1.7.2) stable; urgency=medium + + * New synapse release 1.7.2. + + -- Synapse Packaging team Fri, 20 Dec 2019 10:56:50 +0000 + matrix-synapse-py3 (1.7.1) stable; urgency=medium * New synapse release 1.7.1. diff --git a/synapse/__init__.py b/synapse/__init__.py index e951bab593..996101cf09 100644 --- a/synapse/__init__.py +++ b/synapse/__init__.py @@ -36,7 +36,7 @@ try: except ImportError: pass -__version__ = "1.7.1" +__version__ = "1.7.2" if bool(os.environ.get("SYNAPSE_TEST_PATCH_LOG_CONTEXTS", False)): # We import here so that we don't have to install a bunch of deps when