Re: basic_archive lost archive_directory
Fujii Masao <masao.fujii@gmail.com>
From: Fujii Masao <masao.fujii@gmail.com>
To: Sergei Kornilov <sk@zsrv.org>
Cc: Олег Самойлов <splarv@ya.ru>, pgsql-bugs@lists.postgresql.org, Álvaro Herrera <alvherre@kurilemu.de>
Date: 2026-02-09T17:46:39Z
Lists: 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 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
Commits
-
basic_archive: Allow archive directory to be missing at startup.
- f510577de4f5 17.10 landed
- cc774c543b23 19 (unreleased) landed
- bde9ad31515a 18.4 landed
- 8fc45ac5d91a 15.18 landed
- 28c2b789652a 16.14 landed