Re: Dubious code in pg_rewind's process_target_file()

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Dubious code in pg_rewind's process_target_file()
Date: 2020-09-06 14:54:22
Message-ID: 6ba44dc9-2b7e-1988-de4e-99832235eae5@iki.fi
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 05/09/2020 21:18, Tom Lane wrote:
> 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.

Agreed, the lstat() doesn't do anything interesting.

This is refactored away by the patches discussed at
https://www.postgresql.org/message-id/f155aab5-1323-8d0c-9e3b-32703124bf00%40iki.fi.
But maybe we should still clean it up in the back-branches.

- Heikki

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2020-09-06 14:59:11 Re: Missing "Up" navigation link between parts and doc root?
Previous Message Heikki Linnakangas 2020-09-06 13:26:08 Re: Yet another fast GiST build (typo)