Re: basic_archive lost archive_directory

From: Nathan Bossart <nathandbossart(at)gmail(dot)com>
To: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Cc: Sergei Kornilov <sk(at)zsrv(dot)org>, Олег Самойлов <splarv(at)ya(dot)ru>, pgsql-bugs(at)lists(dot)postgresql(dot)org, Álvaro Herrera <alvherre(at)kurilemu(dot)de>
Subject: Re: basic_archive lost archive_directory
Date: 2026-02-10 16:06:25
Message-ID: aYtXgaKfiYpaqQyW@nathan
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Tue, Feb 10, 2026 at 10:23:02AM +0900, Fujii Masao wrote:
> You're right if an invalid value for basic_archive.archive_directory is detected
> at server startup. However, when the setting is changed and the configuration
> is reloaded, the default behavior does not emit an error log.

Oh, I see. Even so, I don't think this problem is best fixed by moving
code from the GUC check hook to the archive module check callback. For
starters, since the archive module check callback is called for each file
to archive, this adds unnecessary overhead to repeatedly verify things that
really shouldn't change as long as the GUC's value stays the same. In
practice, the check callback is mostly meant to ensure the user hasn't
temporarily halted archiving, as per the following note in basic_archive's
documentation:

The default is an empty string, which effectively halts WAL archiving,
but if archive_mode is enabled, the server will accumulate WAL segment
files in the expectation that a value will soon be provided.

Furthermore, fixing this problem in basic_archive doesn't fix it for other
archive modules that use GUC check hooks. I think it should be fixed more
generally, perhaps by bumping up the log level in the archiver when the
GUC's prefix matches the archive_library.

I also want to push back a bit on the idea that basic_archive not working
when the directory is missing at startup is a bug. The documentation for
basic_archive clearly states that the directory must already exist. That
being said, I have no objection to making basic_archive more lenient or
even to back-patching such a change. As I mentioned upthread, IMHO we
should simply remove the existence check from the GUC check hook.
basic_archive must already be written to handle the archive directory
disappearing at any moment, so we should be able to rely on it without the
extra stat().

--
nathan

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Andres Freund 2026-02-10 19:58:33 Re: BUG #19400: Memory leak in checkpointer and startup processes on PostgreSQL 18
Previous Message PG Bug reporting form 2026-02-10 15:28:38 BUG #19400: Memory leak in checkpointer and startup processes on PostgreSQL 18