Re: standby promotion can create unreadable WAL
Kyotaro Horiguchi <horikyota.ntt@gmail.com>
From: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
To: dilipbalaut@gmail.com
Cc: robertmhaas@gmail.com, alvherre@alvh.no-ip.org,
pgsql-hackers@postgresql.org, andres@anarazel.de
Date: 2022-08-29T04:13:52Z
Lists: pgsql-hackers
Attachments
- refactor_abrtcontrec_set.txt (text/plain)
At Sun, 28 Aug 2022 10:16:21 +0530, Dilip Kumar <dilipbalaut@gmail.com> wrote in > On Fri, Aug 26, 2022 at 7:53 PM Robert Haas <robertmhaas@gmail.com> wrote: > > v2 attached. > > The patch LGTM, this patch will apply on master and v15. PFA patch > for back branches. StandbyMode is obviously wrong. On the other hand I thought that !ArchiveRecoveryRequested is somewhat wrong, too (, as I stated in the pointed thread). On second thought, I changed my mind that it is right. After aborted contrec is found, The cause of the confusion is that I somehow thought that archive recovery continues from the aborted-contrec record. However, that assumption is wrong. The next redo starts from the beginning of the aborted contrecord so we should forget abouat the old missing/aborted contrec info when archive recovery is requested. In the end, the point is that we need to set the global variables only when XLogPrefetcherReadRecord() (or XLogReadRecord()) returns NULL and we return it to the caller. Is it worth to do a small refactoring like the attached? If no, I'm fine with the proposed patch including the added assertion. # I havent reproduce the issue of the OP in the other thread yet, and # also not found how to reproduce this issue, though.. regards. -- Kyotaro Horiguchi NTT Open Source Software Center
Commits
-
Prevent WAL corruption after a standby promotion.
- 0b3ff539dd34 10.23 landed
- 002fba80ebde 11.18 landed
- 3c0ef0832748 12.13 landed
- 3f2701cda590 13.9 landed
- 0e54a5e27494 14.6 landed
- eb29fa38895c 15.0 landed
- 6672d7913929 16.0 landed
-
Use correct LSN for error reporting in pg_walinspect
- d9fbb8862959 16.0 cited