pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Fujii Masao <masao.fujii@oss.nttdata.com>
To: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Cc: psuderevsky@gmail.com
Cc: david@pgmasters.net
Cc: pgsql-hackers@lists.postgresql.org
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: Don't try fetching future segment of a TLI.
Date: Tue, 7 Apr 2020 12:22:20 +0900
Message-ID: <c722ac2a-e923-6179-8fc8-30dbca48f018@oss.nttdata.com> (raw)
In-Reply-To: <20200407.102909.709448322643210522.horikyota.ntt@gmail.com>
References: <8c831a30-a3a2-de89-2059-e7ce842d7aed@pgmasters.net>
	<CAEBTBzupObE6Gep1y-ajvUh4AjuvyTmfTewshVOei12uRV=Q8Q@mail.gmail.com>
	<792ea085-95c4-bca0-ae82-47fdc80e146d@oss.nttdata.com>
	<20200407.102909.709448322643210522.horikyota.ntt@gmail.com>



On 2020/04/07 10:29, Kyotaro Horiguchi wrote:
> Thank you for picking this up.
> 
> At Tue, 7 Apr 2020 02:43:02 +0900, Fujii Masao <masao.fujii@oss.nttdata.com> wrote in
>> On 2020/03/19 22:22, Pavel Suderevsky wrote:
>>> Hi,
>>> I've tested patch provided by Kyotaro and do confirm it fixes the
>>> issue.
>>
>> The patch looks good to me. Attached is the updated version of the
>> patch.
>> I updated only comments.
> 
> +			 * The logfile segment that doesn't belong to the timeline is
> +			 * older or newer than the segment that the timeline started or
> +			 * eneded at, respectively. It's sufficient to check only the
> 
> s/eneded/ended/ ?

Yes! Thanks!

Regards,

-- 
Fujii Masao
Advanced Computing Technology Center
Research and Development Headquarters
NTT DATA CORPORATION

Attachments:

v3-0001-Don-t-try-fetching-out-of-timeline-segments.patch (text/plain, 1.5K) download diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index abf954ba39..ec55d68d27 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -3776,11 +3776,36 @@ XLogFileReadAnyTLI(XLogSegNo segno, int emode, XLogSource source) foreach(cell, tles) { - TimeLineID tli = ((TimeLineHistoryEntry *) lfirst(cell))->tli; + TimeLineHistoryEntry *hent = (TimeLineHistoryEntry *) lfirst(cell); + TimeLineID tli = hent->tli; if (tli < curFileTLI) break; /* don't bother looking at too-old TLIs */ + /* + * Skip scanning the timeline ID that the logfile segment to read + * doesn't belong to + */ + if (hent->begin != InvalidXLogRecPtr) + { + XLogSegNo beginseg = 0; + + XLByteToSeg(hent->begin, beginseg, wal_segment_size); + + /* + * The logfile segment that doesn't belong to the timeline is + * older or newer than the segment that the timeline started or + * ended at, respectively. It's sufficient to check only the + * starting segment of the timeline here. Since the timelines are + * scanned in descending order in this loop, any segments newer + * than the ending segment should belong to newer timeline and + * have already been read before. So it's not necessary to check + * the ending segment of the timeline here. + */ + if (segno < beginseg) + continue; + } + if (source == XLOG_FROM_ANY || source == XLOG_FROM_ARCHIVE) { fd = XLogFileRead(segno, emode, tli,

view thread (13+ messages)  latest in thread

Message-ID: <c722ac2a-e923-6179-8fc8-30dbca48f018@oss.nttdata.com>
Permalink:  ../c722ac2a-e923-6179-8fc8-30dbca48f018@oss.nttdata.com/
Also on:    postgresql.org/message-id/c722ac2a-e923-6179-8fc8-30dbca48f018@oss.nttdata.com

 ·  · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: masao.fujii@oss.nttdata.com, horikyota.ntt@gmail.com, psuderevsky@gmail.com, david@pgmasters.net, pgsql-hackers@lists.postgresql.org, pgsql-bugs@lists.postgresql.org
  Subject: Re: Don't try fetching future segment of a TLI.
  In-Reply-To: <c722ac2a-e923-6179-8fc8-30dbca48f018@oss.nttdata.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox