Re: basic_archive lost archive_directory

From: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
To: Sergei Kornilov <sk(at)zsrv(dot)org>
Cc: Олег Самойлов <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-09 17:46:39
Message-ID: CAHGQGwF3tFP=oQgYHoS3h9TMeFbZwXc6+xdPTW8CkMV2TkjTmg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Fri, Feb 6, 2026 at 11:25 PM Sergei Kornilov <sk(at)zsrv(dot)org> wrote:
>
> Hello
>
> How to reproduce:
>
> 1) configure
>
> archive_mode = on
> archive_library = 'basic_archive'
> basic_archive.archive_directory = '/some/path/'
>
> 2) start postgres and verify archive works
> 3) make this directory temporary inaccessible. NFS will give you many ways to achieve this, here just mv /some/ /some_moved/ is enough.
> 4) basic_archive will complain ERROR: could not create file ... No such file or directory for new WAL archive attempts
> 5) restart archiver process with any reason: kill it or restart postgres
> 6) make archive_directory accessible again: archiver process will not check the directory's existence again and continue to complain about unconfigured archive_directory

Yes, this issue can last until, for example, the configuration is reloaded and
archive_directory is set again. I agree this needs to be addressed.

> Maybe it makes sense to move the directory existence check from check_archive_directory (guc check callback) to basic_archive_configured? (attached)

Basically I like the idea of moving the checks for archive_directory from
check_archive_directory() to basic_archive_configured(). This would not only
address this issue, but also other problems caused by performing these checks
in the GUC check hook.

basic_archive is usually loaded only by the archiver via archive_library.
In that case, errors reported by check_archive_directory() are not logged
by default, since GUC check hook errors are normally emitted only by
the postmaster. As a result, misconfigurations (e.g., a non-existent
archive_directory) may go unnoticed, which is problematic for users.

Moving the checks currently done in check_archive_directory() to
basic_archive_configured() would resolve this, which is one reason
I like your proposal.

In your patch, only the existence check is moved to basic_archive_configured().
Would it also make sense to move the filename length check there? If so,
we could potentially remove the check_archive_directory GUC check hook entirely.

Regards,

--
Fujii Masao

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Greg Sabino Mullane 2026-02-09 18:34:50 Re: Incorrect description for "SET" abbreviation in Time Zone Appendix
Previous Message Hüseyin Demir 2026-02-09 17:16:26 Re: BUG #19393: pg_upgrade fails with duplicate key violation when CHECK constraint named *_not_null exists