Re: PITR promote bug: Checkpointer writes to older timeline
Soumyadeep Chakraborty <soumyadeep2007@gmail.com>
From: Soumyadeep Chakraborty <soumyadeep2007@gmail.com>
To: Fujii Masao <masao.fujii@oss.nttdata.com>
Cc: Heikki Linnakangas <hlinnaka@iki.fi>,
Kyotaro Horiguchi <horikyota.ntt@gmail.com>, pgsql-hackers <pgsql-hackers@postgresql.org>,
Michael Paquier <michael@paquier.xyz>, jyih@vmware.com, kyeap@vmware.com
Date: 2021-03-03T22:56:25Z
Lists: pgsql-hackers
Attachments
- pass_ThisTimeLineID.patch (text/x-patch) patch
- saved_ThisTimeLineID.patch (text/x-patch) patch
On 2021/03/03 17:46, Heikki Linnakangas wrote: > I think it should be reset even earlier, inside XlogReadTwoPhaseData() > probably. With your patch, doesn't the LogStandbySnapshot() call just > above where you're ressetting ThisTimeLineID also write a WAL record > with incorrect timeline? Agreed. On Wed, Mar 3, 2021 at 1:04 AM Fujii Masao <masao.fujii@oss.nttdata.com> wrote: > > Even better, can we avoid setting ThisTimeLineID in XlogReadTwoPhaseData() in the first place? > > > > Or isn't it better to reset ThisTimeLineID in read_local_xlog_page(), i.e., > prevent read_local_xlog_page() from changing ThisTimeLineID? I'm not > sure if that's possible, though.. In the future other functions that calls > read_local_xlog_page() during the promotion may appear. Fixing the issue > outside read_local_xlog_page() may cause those functions to get > the same issue. I agree. We should fix the issue in read_local_xlog_page(). I have attached two different patches which do so: saved_ThisTimeLineID.patch and pass_ThisTimeLineID.patch. The former saves the value of the ThisTimeLineID before it gets changed in read_local_xlog_page() and resets it after ThisTimeLineID has been used later on in the code (by XLogReadDetermineTimeline()). The latter removes occurrences of ThisTimeLineID from XLogReadDetermineTimeline() and introduces an argument currTLI to XLogReadDetermineTimeline() to be used in its stead. Regards, Soumyadeep
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