Re: Improve the log message output of basic_archive when basic_archive.archive_directory parameter is not set

Поиск
Список
Период
Сортировка
От Daniel Gustafsson
Тема Re: Improve the log message output of basic_archive when basic_archive.archive_directory parameter is not set
Дата
Msg-id 3395F53B-934F-47F9-9BA9-E19AC3842937@yesql.se
обсуждение исходный текст
Ответ на Improve the log message output of basic_archive when basic_archive.archive_directory parameter is not set  (bt23nguyent <bt23nguyent@oss.nttdata.com>)
Ответы Re: Improve the log message output of basic_archive when basic_archive.archive_directory parameter is not set  (Alvaro Herrera <alvherre@alvh.no-ip.org>)
Список pgsql-hackers
> On 15 Sep 2023, at 11:38, bt23nguyent <bt23nguyent@oss.nttdata.com> wrote:
>
> Hi,
>
> When archive_library is set to 'basic_archive' but basic_archive.archive_directory is not set, WAL archiving doesn't
workand only the following warning message is logged. 
>
>    $ emacs $PGDATA/postgresql.conf
>    archive_mode = on
>    archive_library = 'basic_archive'
>
>    $ bin/pg_ctl -D $PGDATA restart
>    ....
>    WARNING:  archive_mode enabled, yet archiving is not configured
>
> The issue here is that this warning message doesn't suggest any hint regarding the cause of WAL archiving failure. In
otherwords, I think that the log message in this case should report that WAL archiving failed because
basic_archive.archive_directoryis not set. 

That doesn't seem unreasonable, and I can imagine other callbacks having the
need to give errhints as well to assist the user.

> Thus, I think it's worth implementing new patch that improves that warning message, and here is the patch for that.

-basic_archive_configured(ArchiveModuleState *state)
+basic_archive_configured(ArchiveModuleState *state, const char **errmsg)

The variable name errmsg implies that it will contain the errmsg() data when it
in fact is used for errhint() data, so it should be named accordingly.

It's probably better to define the interface as ArchiveCheckConfiguredCB
functions returning an allocated string in the passed pointer which the caller
is responsible for freeing.

--
Daniel Gustafsson




В списке pgsql-hackers по дате отправления:

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: psql: Add command to use extended query protocol
Следующее
От: Damir Belyalov
Дата:
Сообщение: Re: POC PATCH: copy from ... exceptions to: (was Re: VLDB Features)