Avoid missed notifications when using the postgres backend
Avoid missed notifications when using the postgres backend

In very rare cases a message could be missed when using the
postgres backend.  This happened because PostgreSQL notifications
are sent on transaction commit, which can be out of sequence with
the global ids (which are created during the INSERT statement,
before transaction commit).  Here's an example

process 1: publish "/foo", "a"
process 1: INSERT query run
process 2: publish "/foo", "b"
process 2: INSERT query run
process 2: COMMIT
process 1: COMMIT

In the above case, the message published by process 1 will have
a lower global id than the message published by process 2, but
the notification for process 2 will go out first.  Because of
the previous two-level processing of global backlog, with one
before the LISTEN and one after, the above situation could
result in a missed notification.  If process 3 is subscribed to
channel /foo and the pre-LISTEN process global backlog ends with
the notification published by process 2 (because the transaction
committed before process 1), the highest_id returned by the
pre-LISTEN process_global_backlog would be greater than the global
id published by process 1.  If process 1 commits before process
3 LISTENs, the post-LISTEN process_global_backlog will miss the
message published by process 1.

The simplest solution is just to only proces the global backlog
post-LISTEN.  It would be possible to process the global backlog
pre-LISTEN and record any missing ids, then also check for those
ids post-LISTEN, but that's a more intrusive change.

MadBomber/message_bus,nathanstitt/message_bus,SamSaffron/message_bus,cannikin/message_bus,MadBomber/message_bus,SamSaffron/message_bus,nathanstitt/message_bus,nathanstitt/message_bus,cannikin/message_bus,cannikin/message_bus,MadBomber/message_bus