Re: parallelizing the archiver

From: "Bossart, Nathan" <bossartn(at)amazon(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Magnus Hagander <magnus(at)hagander(dot)net>, Stephen Frost <sfrost(at)snowman(dot)net>, Andrey Borodin <x4mmm(at)yandex-team(dot)ru>, Julien Rouhaud <rjuju123(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: parallelizing the archiver
Date: 2021-10-24 06:15:13
Message-ID: E5863799-55FD-471E-8BE8-712A5D7C4217@amazon.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 10/22/21, 4:35 PM, "Robert Haas" <robertmhaas(at)gmail(dot)com> wrote:
> I was imagining something like what logical decoding does. In that
> case, you make a _PG_output_plugin_init function and it returns a
> table of callbacks. Then the core code invokes those callbacks at the
> appropriate times.

Here is an attempt at doing this. Archive modules are expected to
declare _PG_archive_module_init(), which can define GUCs, register
background workers, etc. This function must at least define the
archive callbacks. For now, I've introduced two callbacks. The first
is for checking that the archive module is configured, and the second
contains the actual archiving logic.

I've written this so that the same library can be used for multiple
purposes (e.g., it could be in shared_preload_libraries and
archive_library). I don't know if that's really necessary, but it
seemed to me like a reasonable way to handle the changes to the
library loading logic that we need anyway.

0002 is still a sample backup module, but I also added some handling
for preexisting archives. If the preexisting archive file has the
same contents as the current file to archive, archiving is allowed to
continue. If the contents don't match, archiving fails. This sample
module could still produce unexpected results if two servers were
sending archives to the same directory. I stopped short of adding
handling for that case, but that might be a good thing to tackle next.

Nathan

Attachment Content-Type Size
v5-0001-Introduce-archive-module-framework.patch application/octet-stream 22.8 KB
v5-0002-Add-an-example-of-a-basic-archiving-module.patch application/octet-stream 11.9 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2021-10-24 06:51:06 Re: pg_receivewal starting position
Previous Message Dian M Fay 2021-10-24 05:10:52 Re: [PATCH] postgres_fdw: suppress explicit casts in text:text comparisons (was: column option to override foreign types)