Re: archive modules
Nathan Bossart <nathandbossart@gmail.com>
From: Nathan Bossart <nathandbossart@gmail.com>
To: Robert Haas <robertmhaas@gmail.com>
Cc: "Bossart, Nathan" <bossartn@amazon.com>, David Steele <david@pgmasters.net>, Fujii Masao <masao.fujii@oss.nttdata.com>, "pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>, Michael Paquier <michael@paquier.xyz>, Magnus Hagander <magnus@hagander.net>, Stephen Frost <sfrost@snowman.net>
Date: 2022-02-01T01:36:08Z
Lists: pgsql-hackers
Attachments
- v17-0001-Introduce-archive-modules-infrastructure.patch (text/x-diff)
On Sat, Jan 29, 2022 at 09:01:41PM -0800, Nathan Bossart wrote: > On Sat, Jan 29, 2022 at 04:31:48PM -0800, Nathan Bossart wrote: >> On Sat, Jan 29, 2022 at 12:50:18PM -0800, Nathan Bossart wrote: >>> Here is a new revision. I've moved basic_archive to contrib, hardened it >>> as suggested, and added shutdown support for archive modules. >> >> cfbot was unhappy with v14, so here's another attempt. One other change I >> am pondering is surrounding pgarch_MainLoop() with PG_TRY/PG_FINALLY so >> that we can also call the shutdown callback in the event of an ERROR. This >> might be necessary for an archive module that uses background workers. > > Ugh. Apologies for the noise. cfbot still isn't happy, so here's yet > another attempt. This new patch set also ensures the shutdown callback is > called when the archiver process exits. If basic_archive is to be in contrib, we probably want to avoid restarting the archiver every time the module ERRORs. I debated trying to add a generic exception handler that all archive modules could use, but I suspect many will have unique cleanup requirements. Plus, AFAICT restarting the archiver isn't terrible, it just causes most of the normal retry logic to be skipped. I also looked into rewriting basic_archive to avoid ERRORs and return false for all failures, but this was rather tedious. Instead, I just introduced a custom exception handler for basic_archive's archive callback. This allows us to ERROR as necessary (which helps ensure that failures show up in the server logs), and the archiver can treat it like a normal failure and avoid restarting. -- Nathan Bossart Amazon Web Services: https://aws.amazon.com
Commits
-
Disallow setting archive_library and archive_command at the same time
- d627ce3b706d 16.0 landed
-
Restore archive_command documentation
- ba50834551f9 16.0 landed
- 5f56933ea5d5 15.0 landed
-
Doc: improve explanation of when custom GUCs appear in pg_settings.
- 44a51dc990cc 15.0 landed
- 857808a4116b 16.0 landed
-
doc: Add note about re-archiving of same WAL files in docs.
- 3cabe45a819f 16.0 cited
-
In basic_archive tests, insist on wal_level='replica'.
- 00c360a89c1a 15.0 landed
-
Allow archiving via loadable modules.
- 5ef1eefd76f4 15.0 landed
-
Move the code to archive files via the shell to a separate file.
- aeb4cc9ea07a 15.0 landed