Re: O(n) tasks cause lengthy startups and checkpoints - Mailing list pgsql-hackers

From Bossart, Nathan
Subject Re: O(n) tasks cause lengthy startups and checkpoints
Date
Msg-id 6DFA78EC-EF4D-4CB0-82C8-AD5DA1B8E0AC@amazon.com
Whole thread Raw
In response to Re: O(n) tasks cause lengthy startups and checkpoints  ("Bossart, Nathan" <bossartn@amazon.com>)
Responses Re: O(n) tasks cause lengthy startups and checkpoints  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
On 12/6/21, 11:23 AM, "Bossart, Nathan" <bossartn@amazon.com> wrote:
> On 12/6/21, 3:44 AM, "Bharath Rupireddy" <bharath.rupireddyforpostgres@gmail.com> wrote:
>> Thanks. As I said upthread we've been discussing the approach of
>> offloading some of the checkpoint tasks like (deleting snapshot files)
>> internally for quite some time and I would like to share a patch that
>> adds a new background cleaner process (currently able to delete the
>> logical replication snapshot files, if required can be extended to do
>> other tasks as well). I don't mind if it gets rejected. Please have a
>> look.
>
> Thanks for sharing!  I've also spent some time on a patch set, which I
> intend to share once I have handling for all four tasks (so far I have
> handling for CheckPointSnapBuild() and RemovePgTempFiles()).  I'll
> take a look at your patch as well.

Well, I haven't had a chance to look at your patch, and my patch set
still only has handling for CheckPointSnapBuild() and
RemovePgTempFiles(), but I thought I'd share what I have anyway.  I
split it into 5 patches:

0001 - Adds a new "custodian" auxiliary process that does nothing.
0002 - During startup, remove the pgsql_tmp directories instead of
       only clearing the contents.
0003 - Split temporary file cleanup during startup into two stages.
       The first renames the directories, and the second clears them.
0004 - Moves the second stage from 0003 to the custodian process.
0005 - Moves CheckPointSnapBuild() to the custodian process.

This is still very much a work in progress, and I've done minimal
testing so far.

Nathan


Attachment

pgsql-hackers by date:

Previous
From: "Godfrin, Philippe E"
Date:
Subject: RE: [EXTERNAL] Re: speed up verifying UTF-8
Next
From: Alvaro Herrera
Date:
Subject: Re: Column Filtering in Logical Replication