From 7b226be65cc5af99044dd1ef4b733ebc557d16c4 Mon Sep 17 00:00:00 2001 From: Kegan Dougal Date: Wed, 19 Apr 2017 15:42:23 +0100 Subject: [PATCH] Review comments --- .../dendrite/syncserver/storage/output_room_events_table.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/github.com/matrix-org/dendrite/syncserver/storage/output_room_events_table.go b/src/github.com/matrix-org/dendrite/syncserver/storage/output_room_events_table.go index 7c1e7e65b..d5a22fa78 100644 --- a/src/github.com/matrix-org/dendrite/syncserver/storage/output_room_events_table.go +++ b/src/github.com/matrix-org/dendrite/syncserver/storage/output_room_events_table.go @@ -47,8 +47,10 @@ const selectRecentEventsSQL = "" + const selectMaxIDSQL = "" + "SELECT MAX(id) FROM output_room_events" +// In order for us to apply the state updates correctly, rows need to be ordered in the order they were received (id). const selectStateInRangeSQL = "" + - "SELECT event_json, add_state_ids, remove_state_ids FROM output_room_events WHERE id > $1 AND id < $2 AND add_state_ids IS NOT NULL OR remove_state_ids IS NOT NULL" + "SELECT event_json, add_state_ids, remove_state_ids FROM output_room_events WHERE id > $1 AND id < $2 AND " + + "add_state_ids IS NOT NULL OR remove_state_ids IS NOT NULL ORDER BY id ASC" type outputRoomEventsStatements struct { insertEventStmt *sql.Stmt