pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-hackers@lists.postgresql.org
Subject: Re: Dubious code in pg_rewind's process_target_file()
Date: Sat, 05 Sep 2020 14:18:29 -0400
Message-ID: <1222282.1599329909@sss.pgh.pa.us> (raw)
In-Reply-To: <1221796.1599329320@sss.pgh.pa.us>
References: <1221796.1599329320@sss.pgh.pa.us>

I wrote:
> It looks to me like we could replace "exists = false" with "return",
> rather than uselessly constructing a FILE_ACTION_REMOVE entry for
> a file we've already proven is not there.

Or actually, maybe we should just drop the lstat call altogether?
AFAICS it's 99.99% redundant with the lstat that traverse_datadir
has done nanoseconds before.  Yeah, maybe somebody managed to drop
the file in between, but the FILE_ACTION_REMOVE code would have to
deal with such cases anyway in case a drop occurs later.

			regards, tom lane





view thread (6+ messages)  latest in thread

Message-ID: <1222282.1599329909@sss.pgh.pa.us>
Permalink:  ../1222282.1599329909@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/1222282.1599329909@sss.pgh.pa.us

 · 

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: tgl@sss.pgh.pa.us, pgsql-hackers@lists.postgresql.org
  Subject: Re: Dubious code in pg_rewind's process_target_file()
  In-Reply-To: <1222282.1599329909@sss.pgh.pa.us>

* 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