Re: basic_archive lost archive_directory - Mailing list pgsql-bugs

From Fujii Masao
Subject Re: basic_archive lost archive_directory
Date
Msg-id CAHGQGwF3tFP=oQgYHoS3h9TMeFbZwXc6+xdPTW8CkMV2TkjTmg@mail.gmail.com
Whole thread
In response to Re: basic_archive lost archive_directory  (Sergei Kornilov <sk@zsrv.org>)
Responses Re: basic_archive lost archive_directory
Re: basic_archive lost archive_directory
Re: basic_archive lost archive_directory
List pgsql-bugs
On Fri, Feb 6, 2026 at 11:25 PM Sergei Kornilov <sk@zsrv.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
continueto 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



pgsql-bugs by date:

Previous
From: Hüseyin Demir
Date:
Subject: Re: BUG #19393: pg_upgrade fails with duplicate key violation when CHECK constraint named *_not_null exists
Next
From: Greg Sabino Mullane
Date:
Subject: Re: Incorrect description for "SET" abbreviation in Time Zone Appendix