Re: BUG #17928: Standby fails to decode WAL on termination of primary
Michael Paquier <michael@paquier.xyz>
From: Michael Paquier <michael@paquier.xyz>
To: Thomas Munro <thomas.munro@gmail.com>
Cc: Noah Misch <noah@leadboat.com>, Tom Lane <tgl@sss.pgh.pa.us>, Kyotaro Horiguchi <horikyota.ntt@gmail.com>, exclusion@gmail.com, pgsql-bugs@lists.postgresql.org
Date: 2023-09-02T01:29:39Z
Lists: pgsql-bugs
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Correct assertion and comments about XLogRecordMaxSize.
- e1f95ec8cf6e 17.0 landed
-
Fix edge-case for xl_tot_len broken by bae868ca.
- bde2f1847f51 12.17 landed
- 45d1fe8b53d4 13.13 landed
- 3d413c5a76fa 14.10 landed
- 99d334a187ae 15.5 landed
- 10d0591ea227 16.1 landed
- becfbdd6c1c9 17.0 landed
-
Don't use Perl pack('Q') in 039_end_of_wal.pl.
- 82314dbfca7f 12.17 landed
- 07896f468f23 13.13 landed
- afa504ba2f5d 14.10 landed
- 21b4c3ca0b22 15.5 landed
- cc58607b019a 16.1 landed
- 91b0e85aa0ad 17.0 landed
-
Don't trust unvalidated xl_tot_len.
- e8f3c0687116 12.17 landed
- 6606c57162cb 13.13 landed
- 3ce3b53d76a3 14.10 landed
- f4d152edd8f3 15.5 landed
- ce497f648e2d 16.1 landed
- bae868caf222 17.0 landed
-
Make recovery report error message when invalid page header is found.
- 7b03d3a3ba45 12.17 landed
- 5dc093eacef1 13.13 landed
- 2f13e8d9ec28 14.10 landed
-
Add more protections in WAL record APIs against overflows
- 8fcb32db98ed 16.0 cited
Attachments
- v3-0001-Add-TAP-tests-for-end-of-WAL-conditions.patch (text/x-diff) patch v3-0001
- v3-0002-Don-t-trust-unvalidated-xl_tot_len.patch (text/x-diff) patch v3-0002
- v3-0003-Adjust-few-things-on-top-of-Thomas-patch-series.patch (text/x-diff) patch v3-0003
On Mon, Aug 21, 2023 at 08:32:39AM +0900, Michael Paquier wrote: > I am not sure that I'll be able to do more on this topic this week, at > least that's some progress. Some time later.. I have spent more time and thoughts on the whole test suite, finishing with the attached 0003 that applies on top of your own patches. I am really looking forward to making this whole logic more robust, so as WAL replay can be made itself more robust for the OOM/end-of-wal detection on HEAD for standbys and crash recovery. While looking at the whole, I have considered a few things that may make the test cleaner, like: - Calculating the segment name and its offset from the end_lsn of a record directly from the backend, but it felt inelegant to pass through more subroutine layers the couple ($segment, offset) rather than just a LSN, so guessing the segment number and the offset while the cluster is offline if OK by me. - The TLI can be queried from the server rather than hardcoded. - I've been thinking about bundling the tests of each sub-section in their own subroutine, but that felt a bit awkward, particularly for the part where we need a correct $prev_lsn in the record header written to enforce other code paths. - The test needs better documentation. One of the things I kept staring at is cross-checking pack() and the dependency to the C structures, so I have added more details there, explaining more the whys and the hows. I have also looked again at the C code for a few hours, and still got the impression that this is rather solid. There are two things that may be better: - Document at the top of allocate_recordbuf() that this should never be called with a length coming from a header until it is validated. - Removing AllocSizeIsValid() for the non-FRONTEND path should be OK. What do you think? -- Michael