| From: | Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com> |
|---|---|
| To: | Alexander Korotkov <aekorotkov(at)gmail(dot)com> |
| Cc: | pgsql-hackers(at)lists(dot)postgresql(dot)org, Xuneng Zhou <xunengzhou(at)gmail(dot)com>, Jobin Augustine <jobin(dot)augustine(at)percona(dot)com>, Michael Paquier <michael(at)paquier(dot)xyz> |
| Subject: | Re: test: avoid redundant standby catchup in 049_wait_for_lsn |
| Date: | 2026-11-26 09:41:00 |
| Message-ID: | CAN4CZFOSUrFZoJQA8cLY5Qt6wZW7AT9dkdipwMBUTj4zgGdV4A@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hello
CFBot reported a failure for my patch, but it turned out to be an
unrelated failure in this [1]:
65/438 postgresql:recovery / recovery/049_wait_for_lsn
ERROR 24.94s exit status 1
# Failed test 'multiple primary_flush waiters: primary flushed WAL
up to target LSN'
# at .../src/test/recovery/t/049_wait_for_lsn.pl line 774.
Seems like 049 can fail when the last record before one of its checks
ends exactly at a WAL page boundary.
The target there was 0/0301A014, the page start + the 20 byte short
page header on 32-bit. WAIT maps it to 0/0301A000 and returns, but the
check after it still compares pg_current_wal_flush_lsn() with the raw
target, which no longer has to hold. Simple repro on a primary:
SELECT pg_logical_emit_message(false, 'p', 'x', false);
SELECT pg_switch_wal();
SELECT pg_current_wal_insert_lsn() AS target \gset
WAIT FOR LSN :'target' WITH (MODE 'primary_flush', timeout '3s', no_throw);
SELECT pg_lsn_cmp(pg_current_wal_flush_lsn(), :'target');
WAIT returns success, and the comparison returns -1.
This seems like a direct consequence of the latest fix in 24723e7cf39:
because of that, the code and the docs/tests disagree.
The same assumption is in a few more places in the test. I/Claude made
a modification that pads the WAL so a given statement ends exactly at
a page boundary, and with that the following places also could fail on
64 bit:
- the position checks after WAIT in sections 1, 3 and 7b-7e (7e is the
cfbot failure)
- 11d dies with "standby_write waiter did not register": the waiter
registers the page start, and test_wait_lsn_waiter_is_registered()
compares that with the raw target
- if the frozen position in 11a/11b is at a page start, current + 1
points into the header, so both "target == current + 1 times out"
checks fail, and then 11c dies with "Boundary waiter did not sleep"
And then I assumed that the current code behavior is intended, and the
test and the documentation should be updated instead.
The attached patch compares with the target the same way WAIT sees it
in the checks. It uses a 40 byte bound everywhere, I didn't want to
replicate the exact header sizes in perl.
[1]: https://github.com/postgres/postgres-cfbot/actions/runs/45648478265/job/139326733557
| Attachment | Content-Type | Size |
|---|---|---|
| v1-0001-Fix-WAIT-docs-and-tests-for-targets-past-a-WAL-pa.patch | text/x-patch | 12.2 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | shveta malik | 2026-11-26 09:54:48 | Re: Proposal: Conflict log history table for Logical Replication |
| Previous Message | Andrei Lepikhov | 2026-11-26 09:39:00 | Re: new clang warnings about unused global variables |