Don't try fetching future segment of a TLI.

From: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Cc: psuderevsky(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Don't try fetching future segment of a TLI.
Date: 2020-01-29 03:02:22
Message-ID: 20200129.120222.1476610231001551715.horikyota.ntt@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

Hello, I added (moved to) -hackers.

At Tue, 28 Jan 2020 19:13:32 +0300, Pavel Suderevsky <psuderevsky(at)gmail(dot)com> wrote in
> But for me it still seems that PostgreSQL has enough information to check
> that no WALs exist for the new timeline to omit searching all the
> possibly-existing WALs.
>
> It can just look through the first received new-timeline's WAL and ensure
> timeline switch occured in this WAL. Finally, it can check archive for the
> only one possibly-existing previous WAL.

Right. The timeline history file tells where a timeline ends.

> Regading influence: issue is not about the large amount of WALs to apply
> but in searching for the non-existing WALs on the remote storage, each such
> search can take 5-10 seconds while obtaining existing WAL takes
> milliseconds.

Wow. I didn't know of a file system that takes that much seconds to
trying non-existent files. Although I still think this is not a bug,
but avoiding that actually leads to a big win on such systems.

After a thought, I think it's safe and effectively doable to let
XLogFileReadAnyTLI() refrain from trying WAL segments of too-high
TLIs. Some garbage archive files out of the range of a timeline might
be seen, for example, after reusing archive directory without clearing
files. However, fetching such garbages just to fail doesn't
contribute durability or reliablity at all, I think.

The attached does that.

Any thoughts?

regards.

--
Kyotaro Horiguchi
NTT Open Source Software Center

Attachment Content-Type Size
v1-0001-Don-t-try-fetching-out-of-timeline-segments.patch text/x-patch 1.9 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Oleksii Kliukin 2020-01-29 09:20:30 Re: postgres crash on concurrent update of inheritance partitioned table
Previous Message Tom Lane 2020-01-28 22:29:59 Re: postgres crash on concurrent update of inheritance partitioned table

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Geoghegan 2020-01-29 03:16:16 Re: Is custom MemoryContext prohibited?
Previous Message Tom Lane 2020-01-29 02:53:58 Re: Is custom MemoryContext prohibited?