On Mon, Jan 17, 2022 at 8:14 PM Thom Brown <thom@linux.com> wrote:
>
> Hi,
>
> Should archive_command being blank when archiving is enabled result in
> a fatal error? This doesn't even produce a warning when restarting,
> just an entry in the log when it goes to archive a WAL segment, and
> finds the archive_command is empty.
>
> Is there a valid scenario where someone would have archiving enabled
> but no archive command? Naturally it will build up WAL until it is
> corrected, which will result in a less desirable error, and likely at
> a less convenient time, and to avoid it, someone either has to have
> checked the logs and noticed this error, or got curious as to why
> their WAL collection is nearly running out of shelf space.
Yes, the .ready files under archive_status and wal files under pg_wal
directory grow up with archive_mode on but no archive_command. The
archiver keeps emitting "archive_mode enabled, yet archive_command is
not set" warnings into server logs, maybe this is something that needs
to be monitored for. The expectation is to have a good archiving
configuration setup in place which updates both archive_command and
archive_mode to appropriate values.
The server keeps the WAL files from the point when archive_mode is
enabled, but not from the point when the archive_command is set. The
archive_mode needs postmaster restart whereas archive_command doesn't,
if the archive_command too needed a postmaster restart, then we would
have failed FATALly if archive_command was empty. But making the
archive_command a needs-postmaster-restart class of parameter is not
the path we go IMO because avoiding pomaster restarts in production
environments is to be avoided whenever possible.
An extreme scenario I can think of is if the archive_command is set to
empty by a service layer code. Of course, this is something postgres
doesn't need to care about. However, a reasonable thing to do is to
emit a WARNING or ERROR-out when archive_command is set to null in
it's check_archive_command when archive_mode is on?
Regards,
Bharath Rupireddy.