From d18de2cab7444c3e634d8863be7a85879b10b0bf Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Fri, 10 Dec 2021 13:15:25 +0000 Subject: [PATCH] Stop populating `state_events.prev_state` this field is never read, so we may as well stop populating it. --- changelog.d/11558.misc | 1 + synapse/storage/databases/main/events.py | 4 ---- synapse/storage/schema/__init__.py | 5 ++++- 3 files changed, 5 insertions(+), 5 deletions(-) create mode 100644 changelog.d/11558.misc diff --git a/changelog.d/11558.misc b/changelog.d/11558.misc new file mode 100644 index 000000000000..7c334f17e007 --- /dev/null +++ b/changelog.d/11558.misc @@ -0,0 +1 @@ +Stop populating unused database column `state_events.prev_state`. diff --git a/synapse/storage/databases/main/events.py b/synapse/storage/databases/main/events.py index f1f4ce5e0765..eed453d8360b 100644 --- a/synapse/storage/databases/main/events.py +++ b/synapse/storage/databases/main/events.py @@ -1410,10 +1410,6 @@ def event_dict(event): "state_key": event.state_key, } - # TODO: How does this work with backfilling? - if hasattr(event, "replaces_state"): - vals["prev_state"] = event.replaces_state - state_values.append(vals) self.db_pool.simple_insert_many_txn( diff --git a/synapse/storage/schema/__init__.py b/synapse/storage/schema/__init__.py index 50d08094d52c..2a3d47185ae5 100644 --- a/synapse/storage/schema/__init__.py +++ b/synapse/storage/schema/__init__.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -SCHEMA_VERSION = 66 # remember to update the list below when updating +SCHEMA_VERSION = 67 # remember to update the list below when updating """Represents the expectations made by the codebase about the database schema This should be incremented whenever the codebase changes its requirements on the @@ -50,6 +50,9 @@ Changes in SCHEMA_VERSION = 66: - Queries on state_key columns are now disambiguated (ie, the codebase can handle the `events` table having a `state_key` column). + +Changes in SCHEMA_VERSION = 67: + - state_events.prev_state is no longer written to. """