Re: thinko in basic_archive.c

From: Nathan Bossart <nathandbossart(at)gmail(dot)com>
To: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>
Cc: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>, robertmhaas(at)gmail(dot)com, pgsql-hackers(at)postgresql(dot)org
Subject: Re: thinko in basic_archive.c
Date: 2022-11-05 21:46:51
Message-ID: 20221105214651.GC137360@nathanxps13
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Oct 21, 2022 at 09:30:16PM +0530, Bharath Rupireddy wrote:
> On Fri, Oct 21, 2022 at 10:43 AM Kyotaro Horiguchi
> <horikyota(dot)ntt(at)gmail(dot)com> wrote:
>> Thanks, but we don't need to wipe out the all bytes. Just putting \0
>> at the beginning of the buffer is sufficient.
>
> Nah, that's not a clean way IMO.

Why not? This is a commonly-used technique. I see over 80 existing useѕ
in PostgreSQL. Plus, your shutdown callback only checks for the first
byte, anyway.

+ if (tempfilepath[0] == '\0')
+ return;

As noted upthread [0], I think we should be cautious to only remove the
temporary file if we know we created it. I still feel that trying to add
this cleanup logic to basic_archive is probably more trouble than it's
worth, but if there is a safe and effective way to do so, I won't object.

[0] https://postgr.es/m/20221015211026.GA1821022%40nathanxps13

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2022-11-05 21:53:31 Re: Making Vars outer-join aware
Previous Message Andres Freund 2022-11-05 21:39:03 Re: Documentation for building with meson