Re: Add pg_file_sync() to adminpack

From: Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>, Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Atsushi Torikoshi <atorik(at)gmail(dot)com>, Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, Julien Rouhaud <rjuju123(at)gmail(dot)com>, Arthur Zakirov <zaartur(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Add pg_file_sync() to adminpack
Date: 2020-01-17 07:05:03
Message-ID: c5b0837a-8eed-73d4-0ebc-af970c4f66e7@oss.nttdata.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2020/01/17 13:36, Michael Paquier wrote:
> On Thu, Jan 16, 2020 at 09:51:24AM -0500, Robert Haas wrote:
>> On Tue, Jan 14, 2020 at 10:08 AM Atsushi Torikoshi <atorik(at)gmail(dot)com> wrote:
>>> fails we can get error messages. So it seems straightforward for me to
>>> 'return true on success and emit an ERROR otherwise'.
>>
>> I agree with reporting errors using ERROR, but it seems to me that we
>> ought to then make the function return 'void' rather than 'bool'.
>
> Yeah, that should be either ERROR and return a void result, or issue a
> WARNING/ERROR (depending on the code path, maybe PANIC?) with a
> boolean status returned if there is a WARNING. Mixing both concepts
> with an ERROR all the time and always a true status is just weird,
> because you know that if no errors are raised then the status will be
> always true. So there is no point to have a boolean status to begin
> with.

OK, so our consensus is to return void on success and throw an error
otherwise. Attached is the updated version of the patch.

Regards,

--
Fujii Masao
NTT DATA CORPORATION
Advanced Platform Technology Group
Research and Development Headquarters

Attachment Content-Type Size
pg_file_sync_v4.patch text/plain 7.6 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fujii Masao 2020-01-17 07:18:21 Re: Add pg_file_sync() to adminpack
Previous Message Paul Guo 2020-01-17 07:02:06 Re: Batch insert in CTAS/MatView code