RE: pg_logical_slot_get_changes waits continously for a partial WAL record spanning across 2 pages
Hayato Kuroda (Fujitsu) <kuroda.hayato@fujitsu.com>
From: "Hayato Kuroda (Fujitsu)" <kuroda.hayato@fujitsu.com>
To: "Hayato Kuroda (Fujitsu)" <kuroda.hayato@fujitsu.com>, 'Michael Paquier' <michael@paquier.xyz>, vignesh C <vignesh21@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>, Alexander
Korotkov <aekorotkov@gmail.com>, Tom Lane <tgl@sss.pgh.pa.us>, Amit Kapila <amit.kapila16@gmail.com>, Melanie Plageman <melanieplageman@gmail.com>
Date: 2025-06-26T09:40:05Z
Lists: pgsql-hackers
> > Another reliable approach would be to make the > > code wait before reading the record in the internal loop of > > ReadPageInternal() with an injection point when we know that we have a > > contrecord, but I'm not really excited about this prospect in > > xlogreader.c which can be also used in the frontend. > > Per my understanding an injection point must be added while flushing a WAL > record, > to emulate the incomplete WAL record issue. To confirm, how can it be used in > ReadPageInternal()? I've spent time how we use the injection point to cause the same situation, which generates the OVERWRITE_CONTRECORD in-between the page, but it seems difficult. XLogFlush()->XLogWrite() has a responsibility to flush WAL records, but it does not write/flush per pages. It tries to write to pages as much as possible and flushes the result at once. A corner case is when the segment is changed, but this is not the same situation we observed the failure. So... I have no idea to create deterministic reproducers, it is OK for me to use 046 test for the purpose. Best regards, Hayato Kuroda FUJITSU LIMITED
Commits
-
Fix infinite wait when reading a partially written WAL record
- c9f4e7520603 17.6 landed
- 762f352ca4a6 13.22 landed
- bedfdb85b0a3 14.19 landed
- 9f270f48f3fe 15.14 landed
- b485e1c89a6d 16.10 landed
- d3917d8f13e7 19 (unreleased) landed
- 5449d5b7ae9c 18.0 landed
-
Improve the stability of the recovery test 047_checkpoint_physical_slot
- fd39c3cf2839 17.6 landed
- c71c702f067b 18.0 landed
- ccd945159361 19 (unreleased) landed
-
Improve recovery test 046_checkpoint_logical_slot
- 6aefde2a2db8 17.6 landed