Re: Improve the log message output of basic_archive when basic_archive.archive_directory parameter is not set - Mailing list pgsql-hackers

From Nathan Bossart
Subject Re: Improve the log message output of basic_archive when basic_archive.archive_directory parameter is not set
Date
Msg-id 20230915143827.GA1912920@nathanxps13
Whole thread Raw
In response to Re: Improve the log message output of basic_archive when basic_archive.archive_directory parameter is not set  (Daniel Gustafsson <daniel@yesql.se>)
Responses Re: Improve the log message output of basic_archive when basic_archive.archive_directory parameter is not set
Re: Improve the log message output of basic_archive when basic_archive.archive_directory parameter is not set
List pgsql-hackers
On Fri, Sep 15, 2023 at 02:48:55PM +0200, Daniel Gustafsson wrote:
>> On 15 Sep 2023, at 12:49, Alvaro Herrera <alvherre@alvh.no-ip.org> wrote:
>> 
>> On 2023-Sep-15, Daniel Gustafsson wrote:
>> 
>>> -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.

I have no objection to allowing this callback to provide additional
information, but IMHO this should use errdetail() instead of errhint().  In
the provided patch, the new message explains how the module is not
configured.  It doesn't hint at how to fix it (although presumably one
could figure that out pretty easily).

>>> 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.

That does seem more flexible.

>> Also note that this callback is documented in archive-modules.sgml, so
>> that needs to be updated as well.  This also means you can't backpatch
>> this change, or you risk breaking external software that implements this
>> interface.
> 
> Absolutely, this is master only for v17.

+1

-- 
Nathan Bossart
Amazon Web Services: https://aws.amazon.com



pgsql-hackers by date:

Previous
From: Daniel Gustafsson
Date:
Subject: Re: sslinfo extension - add notbefore and notafter timestamps
Next
From: Daniel Gustafsson
Date:
Subject: Re: Improve the log message output of basic_archive when basic_archive.archive_directory parameter is not set