-- Outbound backfill: history fetched from other servers for a room this -- server joined part-way through. -- -- roomserver_events.stream_ordering is the order clients are shown a room -- in, and the stream_ordering counter only ever goes up: every event it -- numbers arrived after the ones before it. Backfilled history arrives -- after everything too, but belongs before all of it. So it is numbered by -- a second counter that runs the other way — from -1 downwards — and every -- backfilled event sits below every event this server held when it came. -- -- Zero is neither counter's: the stream_ordering counter's first value is -- 1 and this one's is -1, and a window bound of zero keeps meaning -- "unbounded at that end". INSERT INTO roomserver_sequences (name, value) VALUES ('backfill_ordering', 0) ON CONFLICT (name) DO NOTHING;