Re: fix archive module shutdown callback

Michael Paquier <michael@paquier.xyz>

From: Michael Paquier <michael@paquier.xyz>
To: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Cc: Kyotaro Horiguchi <horikyota.ntt@gmail.com>, nathandbossart@gmail.com, pgsql-hackers@postgresql.org
Date: 2022-10-19T05:22:04Z
Lists: pgsql-hackers
On Tue, Oct 18, 2022 at 02:38:07PM +0530, Bharath Rupireddy wrote:
> 2) Clarifies when the archive module shutdown callback gets called in
> documentation.

I have looked at that, and it was actually confusing as the callback
would also be called on reload if archive_library changes, but the
update somewhat outlines that this would happen only on postmaster
shutdown.

> 3) Defines a shutdown callback that just emits a log message in
> shell_archive.c and tests it.

The test had a few issues:
- No need to wait for postmaster.pid in the test, as pg_ctl does this
job.
- The reload can be time-sensitive on slow machines, so I have added a
query run to make sure that the reload happens before stopping the
server.
- slurp_file() was feeding on the full log file of standby2, but we
should load it from the log location before stopping the server, even
if log_min_messages was updated only at the end of the test.

And done, after tweaking a few more things.
--
Michael

Commits

  1. Rework shutdown callback of archiver modules