Closed
Description
Another insane postgres behavior to handle.
It is known that replica may return null-offset (0/3000000) or normal but not actually existing lsn as STOP_LSN. Currently we handle this problem by looking for previous record, which EndRecPtr is equal or greater than returned lsn. Turns out this approach is unsound for write-busy systems with a lot of contrecords in WAL.
I think that instead of look-behind we should try the look-forward first, and if that fails, fallback to look-behind.
reported by Alexander Nikitin