pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Nathan Bossart <nathandbossart@gmail.com>
To: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Cc: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Cc: robertmhaas@gmail.com
Cc: pgsql-hackers@postgresql.org
Subject: Re: thinko in basic_archive.c
Date: Sat, 5 Nov 2022 14:46:51 -0700
Message-ID: <20221105214651.GC137360@nathanxps13> (raw)
In-Reply-To: <CALj2ACULgfF_W4MitGPG7iw7KQyFstVbpQiB_B3x=fJZ4jWHvQ@mail.gmail.com>
References: <CALj2ACXJjR+4qmEunj4RtBE4rGKkW8S9BLp7qfx+62sbBYkW-g@mail.gmail.com>
	<20221020.102647.746666963360821887.horikyota.ntt@gmail.com>
	<CALj2ACUi_bzt=U7Nx5A2H0i-iK3G3EeJoe7MMKiNERmj6O3A=w@mail.gmail.com>
	<20221021.141346.1491472262189507263.horikyota.ntt@gmail.com>
	<CALj2ACULgfF_W4MitGPG7iw7KQyFstVbpQiB_B3x=fJZ4jWHvQ@mail.gmail.com>

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.ntt@gmail.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





view thread (21+ messages)  latest in thread

Message-ID: <20221105214651.GC137360@nathanxps13>
Permalink:  ../20221105214651.GC137360@nathanxps13/
Also on:    postgresql.org/message-id/20221105214651.GC137360@nathanxps13

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: nathandbossart@gmail.com, bharath.rupireddyforpostgres@gmail.com, horikyota.ntt@gmail.com, robertmhaas@gmail.com
  Subject: Re: thinko in basic_archive.c
  In-Reply-To: <20221105214651.GC137360@nathanxps13>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox