Re: pg_rewind failure by file deletion in source server

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
Cc: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_rewind failure by file deletion in source server
Date: 2015-06-19 12:22:02
Message-ID: CA+Tgmoav08DNHiaLAvszT5BgRgp5enR+J_GsQzQ8G+5aLfjoVQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Jun 19, 2015 at 8:18 AM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
> On Fri, Jun 19, 2015 at 12:14 AM, Michael Paquier
> <michael(dot)paquier(at)gmail(dot)com> wrote:
>>> Listing the directories with pg_ls_dir() has the same problem.
>>
>> (After some discussion on IM with Heikki on this one).
>> This is actually more tricky because pg_ls_dir() does not return '.'
>> or '..' that we could use to identify that the directory actually
>> exists or not when it is empty. Hence I think that we should add two
>> options to pg_ls_dir:
>> - include_self, default to false. If set to true, '.' is added in the
>> list of items.
>> - if_not_exists, to bypass error that a folder does not exist, default
>> at false. If if_not_exists = true and include_self = true, returning
>> only '.' would mean that the folder exist but that it is empty. If
>> if_not_exists = true and include_self = false, no rows are returned.
>> We could as well ERROR as well if both options are set like that. I am
>> fine with any of them as long as behavior is properly documented.
>
> Including '.' to distinguish between an empty directory and a
> nonexistent one seems like an unnecessarily complicated and
> non-obvious API. How about just one additional parameter bool
> *exists. If NULL and no directory, ERROR, else on return set *exists
> to true or false.

Err, wait. You're talking about an SQL function, heh heh. So that
won't work. Maybe what you proposed is the best we can do, then,
although I would suggest that you rename the include_self parameter to
something like include_dot_dirs and return both "." and "..".
Returning only "." seems like it will seem weird to people.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2015-06-19 12:30:29 Re: Is it possible to have a "fast-write" Index?
Previous Message Robert Haas 2015-06-19 12:18:51 Re: pg_rewind failure by file deletion in source server