summary refs log tree commit diff
path: root/synapse/state.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2014-08-15 11:50:14 +0100
committerErik Johnston <erik@matrix.org>2014-08-15 11:50:14 +0100
commitd72f897f078fa72548522440149369293f0d12b2 (patch)
tree4e8d692713f73389b89dea4fdba719b696c9f3af /synapse/state.py
parentReimplement the get public rooms api to work with new DB schema (diff)
parentAdd a check to make sure that during state conflict res we only request a PDU... (diff)
downloadsynapse-d72f897f078fa72548522440149369293f0d12b2.tar.xz
Merge branch 'master' of github.com:matrix-org/synapse into sql_refactor
Conflicts:
	synapse/storage/stream.py
Diffstat (limited to 'synapse/state.py')
-rw-r--r--synapse/state.py17
1 files changed, 14 insertions, 3 deletions
diff --git a/synapse/state.py b/synapse/state.py
index b081de8f4f..4f8b4d9760 100644
--- a/synapse/state.py
+++ b/synapse/state.py
@@ -157,7 +157,10 @@ class StateHandler(object):
             defer.returnValue(True)
             return
 
-        if new_branch[-1] == current_branch[-1]:
+        n = new_branch[-1]
+        c = current_branch[-1]
+
+        if n.pdu_id == c.pdu_id and n.origin == c.origin:
             # We have all the PDUs we need, so we can just do the conflict
             # resolution.
 
@@ -188,10 +191,18 @@ class StateHandler(object):
                 key=lambda x: x.depth
             )
 
+            pdu_id = missing_prev.prev_state_id
+            origin = missing_prev.prev_state_origin
+
+            is_missing = yield self.store.get_pdu(pdu_id, origin) is None
+
+            if not is_missing:
+                raise Exception("Conflict resolution failed.")
+
             yield self._replication.get_pdu(
                 destination=missing_prev.origin,
-                pdu_origin=missing_prev.prev_state_origin,
-                pdu_id=missing_prev.prev_state_id,
+                pdu_origin=origin,
+                pdu_id=pdu_id,
                 outlier=True
             )