Re: PITR promote bug: Checkpointer writes to older timeline
Michael Paquier <michael@paquier.xyz>
From: Michael Paquier <michael@paquier.xyz>
To: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Cc: masao.fujii@oss.nttdata.com, soumyadeep2007@gmail.com, hlinnaka@iki.fi, pgsql-hackers@postgresql.org, jyih@vmware.com, kyeap@vmware.com
Date: 2021-03-15T07:38:08Z
Lists: pgsql-hackers
On Mon, Mar 15, 2021 at 03:01:09PM +0900, Kyotaro Horiguchi wrote: > Logical decoding stuff is (I think) designed to turn any backend into > a walsender, which may need to maintain ThisTimeLineID. It seems to > me that logical decoding stuff indents to maintain ThisTimeLineID of > such backends at reading a WAL record. logical_read_xlog_page also > updates ThisTimeLineID and pg_logical_slot_get_changes_guts(), > pg_replication_slot_advance() (and maybe other functions) updates > ThisTimeLineID. So it is natural that local_read_xlog_page() updates > it since it is intended to be used used in logical decoding plugins. Logical decoding contexts cannot be created while in recovery as per CheckLogicalDecodingRequirements(), and as mentioned not everything is in place to allow that. FWIW, I think that it is just confusing for pg_replication_slot_advance() and pg_logical_slot_get_changes_guts() to update it, and we just look for the latest value each time it is necessary when reading a new WAL page. > It is initialized by IndentifySystem(). And the logical walsender > intends to maintain ThisTimeLineID by subsequent calls to > GetStandbyFlushRecPtr(), which happen in logical_read_xlog_page(). I don't understand this part about logical_read_xlog_page(), though. Do you mean a different routine or a different code path? > I agree that it's better that the replay TLI is stored in a separate > variable. It is what I was complained on in the previous mails. (It > might not have been so obvious, though..) Okay. I understood that this was what you implied. > I don't think there's any acutual user of the function for the > purpose, but.. Anyawy if we remove the update of ThisTimeLineID from > read_local_xlog_page, I think we should remove or rewrite the > following comment for the function. It no longer works as written in > the catchphrase. Who knows. We cannot know all the users of this code, and the API is public. > > * Public because it would likely be very helpful for someone writing another > > * output method outside walsender, e.g. in a bgworker. I don't see a reason to remove this comment as this routine can still be useful for many purposes. What kind of rewording do you have in mind? -- Michael
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Fix timeline assignment in checkpoints with 2PC transactions
- 1ec7162a8d34 10.17 landed
- f1d550f188e2 11.12 landed
- 4b1dd9b1ea75 12.7 landed
- 6e5ce888ad1e 13.3 landed
- 595b9cba2ab0 14.0 landed