5a72ec6b

Created Started Finished

By: Tom Sydney Kerckhove <syd@cs-syd.eu>

Wait for the write position that a commit is actually in

A server started for tests usually runs with synchronous_commit off,
where a commit is acknowledged before its write-ahead log record has
been written out.  pg_current_wal_lsn reports the write position, so
it can be behind a transaction that has already committed, and waiting
for the standby to reach it was waiting for something that had already
happened.

pg_current_wal_insert_lsn counts the records still in the buffers,
which is what "everything committed so far" means.

The standby spec was passing at half a second of lag, where the gap
this leaves is too small to land in.  At twenty milliseconds, which is
what a replica that is keeping up looks like, it fails without this.