Hi Alexander,

> I wonder if $node1_final_lsn should be pg_current_wal_flush_lsn
> instead of pg_current_wal_insert_lsn. I've tried flush_lsn and it
> seems to fix the issue, but I'm not sure if it's correct test-wise.

I think either is correct here. CREATE TABLE has already committed
before the SELECT is executed.

AFAIU important part for avoiding the race is to record the LSN before
wait_for_replay_catchup(), rather than afterwards. The wait then
guarantees that node2 has replayed at least the recorded position, while
WAL generated later on node1 cannot move that position past node2's
eventual fork point.

I'd keep pg_current_wal_insert_lsn(), it matches what
wait_for_replay_catchup() uses.


Best regards, Andrey Borodin.



Reply via email to