summary refs log tree commit diff
path: root/synapse/storage/events.py
diff options
context:
space:
mode:
authorMark Haines <mark.haines@matrix.org>2016-03-30 15:58:20 +0100
committerMark Haines <mark.haines@matrix.org>2016-03-30 16:01:58 +0100
commit31a9eceda5cf00b0482baf1c8bf1e138c823f621 (patch)
treeb41ec3d2ee01f6cc896418b523a2a9510ecd30bd /synapse/storage/events.py
parentMerge pull request #674 from matrix-org/markjh/replicate_state (diff)
downloadsynapse-31a9eceda5cf00b0482baf1c8bf1e138c823f621.tar.xz
Add a replication stream for state groups
Diffstat (limited to 'synapse/storage/events.py')
-rw-r--r--synapse/storage/events.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/synapse/storage/events.py b/synapse/storage/events.py
index 5f675ab09b..a4b8995496 100644
--- a/synapse/storage/events.py
+++ b/synapse/storage/events.py
@@ -1097,10 +1097,12 @@ class EventsStore(SQLBaseStore):
         new events or as backfilled events"""
         def get_all_new_events_txn(txn):
             sql = (
-                "SELECT e.stream_ordering, ej.internal_metadata, ej.json"
+                "SELECT e.stream_ordering, ej.internal_metadata, ej.json, eg.state_group"
                 " FROM events as e"
                 " JOIN event_json as ej"
                 " ON e.event_id = ej.event_id AND e.room_id = ej.room_id"
+                " LEFT JOIN event_to_state_groups as eg"
+                " ON e.event_id = eg.event_id"
                 " WHERE ? < e.stream_ordering AND e.stream_ordering <= ?"
                 " ORDER BY e.stream_ordering ASC"
                 " LIMIT ?"
@@ -1116,6 +1118,8 @@ class EventsStore(SQLBaseStore):
                 " FROM events as e"
                 " JOIN event_json as ej"
                 " ON e.event_id = ej.event_id AND e.room_id = ej.room_id"
+                " LEFT JOIN event_to_state_groups as eg"
+                " ON e.event_id = eg.event_id"
                 " WHERE ? > e.stream_ordering AND e.stream_ordering >= ?"
                 " ORDER BY e.stream_ordering DESC"
                 " LIMIT ?"