Re: basic_archive lost archive_directory
Fujii Masao <masao.fujii@gmail.com>
From: Fujii Masao <masao.fujii@gmail.com>
To: Nathan Bossart <nathandbossart@gmail.com>
Cc: Sergei Kornilov <sk@zsrv.org>, Олег Самойлов <splarv@ya.ru>, pgsql-bugs@lists.postgresql.org, Álvaro Herrera <alvherre@kurilemu.de>
Date: 2026-02-10T01:23:02Z
Lists: pgsql-bugs
On Tue, Feb 10, 2026 at 6:58 AM Nathan Bossart <nathandbossart@gmail.com> wrote: > > On Tue, Feb 10, 2026 at 02:46:39AM +0900, Fujii Masao wrote: > > 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. > > I don't think this is true. With default parameters, I see the following > in my logs with a misconfigured archive directory setting: > > 2026-02-09 15:53:10.372 CST [12803] WARNING: invalid value for parameter "basic_archive.archive_directory": "/does/not/exist" > 2026-02-09 15:53:10.372 CST [12803] DETAIL: Specified archive directory does not exist. 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. Please see the steps below. ----------------------------------- initdb -D data mkdir arch cat <<EOF >> data/postgresql.conf archive_mode = on archive_library = 'basic_archive' basic_archive.archive_directory = '../arch' EOF pg_ctl -D data start echo "basic_archive.archive_directory = 'not_exists'" >> data/postgresql.conf pg_ctl -D data reload ----------------------------------- With these steps, the only log messages I see are: ----------------------------------- LOG: received SIGHUP, reloading configuration files LOG: parameter "basic_archive.archive_directory" changed to "not_exists" ----------------------------------- BTW, if basic_archive is specified in shared_preload_libraries, the same steps produce: ----------------------------------- LOG: invalid value for parameter "basic_archive.archive_directory": "not_exists" DETAIL: Specified archive directory does not exist. LOG: configuration file "/hoge/data/postgresql.conf" contains errors; unaffected changes were applied ----------------------------------- Similarly, lowering the archiver log level to DEBUG3 (for example, via log_min_messages = 'warning,archiver:debug3') also results in: ----------------------------------- DEBUG: invalid value for parameter "basic_archive.archive_directory": "not_exists" DETAIL: Specified archive directory does not exist. DEBUG: configuration file "/System/Volumes/Data/dav/head-pgsql/data/postgresql.conf" contains errors; unaffected changes were applied ----------------------------------- This illustrates that, with default settings, the error can go unnoticed on reload. 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