Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Stop populating state_events.prev_state #11558

Merged
merged 1 commit into from
Dec 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/11558.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Stop populating unused database column `state_events.prev_state`.
4 changes: 0 additions & 4 deletions synapse/storage/databases/main/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
5 changes: 4 additions & 1 deletion synapse/storage/schema/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
"""


Expand Down