Hi Alexander, > > > I've checked the path. The documentation changes look good to me. > The calculations using page header sizes in tap tests look a bit > awkward to me, especially given those sizes aren't directly available. > I propose the following changes in v2. > > * In sections 1, 3 and 7b-7d, the standby mode checks take the target > from pg_current_wal_flush_lsn() instead of > pg_current_wal_insert_lsn(). The commit is flushed by then, and the > flush LSN never points into a page header, so WAIT doesn't remap the > target and the checks stay exact. > * For primary_flush (sections 3 and 7e), the flush LSN would already > be reached, so the target is the return value of > pg_logical_emit_message(false, ..., false). That is the end of a > record that isn't flushed yet, so WAIT really has to wait, and a > record end never points into a page header. > * In section 11, if a frozen replay or flush position lands on a page > start, the test writes more WAL and freezes again. This replaces the > "+41" step, so current + 1 is always a real fencepost. > * Section 11d takes the target from pg_current_wal_flush_lsn(), as in > v1, with the comment moved next to that query. > * The wait_target_lsn() helper is removed, so the test doesn't need to > know page header sizes. Section 11e remains the only test of targets > past a page header.
The patch seems good to me and the patched 049 passes well. Just a small comment: can we merge the two safe_psql calls in the Section 11 retry loop into one to save round-trip? -- Regards, Xuneng Zhou HighGo Software Co., Ltd.
