diff options
author | Erik Johnston <erikj@jki.re> | 2017-06-08 12:56:18 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-08 12:56:18 +0100 |
commit | 98bdb4468b261222c1205f438b0b0ca61533cc19 (patch) | |
tree | aef7c462c7c5c49859e6b88607b6a40b9692f615 /synapse/storage | |
parent | Merge pull request #2259 from matrix-org/erikj/fix_state_woes (diff) | |
parent | Ensure we don't use unpersisted state group as prev group (diff) | |
download | synapse-98bdb4468b261222c1205f438b0b0ca61533cc19.tar.xz |
Merge pull request #2263 from matrix-org/erikj/fix_state_woes
Ensure we don't use unpersisted state group as prev group
Diffstat (limited to 'synapse/storage')
-rw-r--r-- | synapse/storage/state.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/synapse/storage/state.py b/synapse/storage/state.py index c3eecbe824..151223219d 100644 --- a/synapse/storage/state.py +++ b/synapse/storage/state.py @@ -223,6 +223,19 @@ class StateStore(SQLBaseStore): # We persist as a delta if we can, while also ensuring the chain # of deltas isn't tooo long, as otherwise read performance degrades. if context.prev_group: + is_in_db = self._simple_select_one_onecol_txn( + txn, + table="state_groups", + keyvalues={"id": context.prev_group}, + retcol="id", + allow_none=True, + ) + if not is_in_db: + raise Exception( + "Trying to persist state with unpersisted prev_group: %r" + % (context.prev_group,) + ) + potential_hops = self._count_state_group_hops_txn( txn, context.prev_group ) |