Re: Re: [COMMITTERS] pgsql: Map basebackup tablespaces using a tablespace_map file

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, hlinnaka <hlinnaka(at)iki(dot)fi>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Re: [COMMITTERS] pgsql: Map basebackup tablespaces using a tablespace_map file
Date: 2015-06-08 00:22:27
Message-ID: 5574E043.8060101@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers


On 06/05/2015 11:08 PM, Amit Kapila wrote:
> On Fri, Jun 5, 2015 at 10:51 AM, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com
> <mailto:amit(dot)kapila16(at)gmail(dot)com>> wrote:
>
> On Fri, Jun 5, 2015 at 9:57 AM, Andrew Dunstan
> <andrew(at)dunslane(dot)net <mailto:andrew(at)dunslane(dot)net>> wrote:
>
>
> On 06/04/2015 11:35 PM, Amit Kapila wrote:
>
>
> Theoretically, I don't see much problem by changing the checks
> way you have done in patch, but it becomes different than what
> we have in destroy_tablespace_directories() and it is slightly
> changing the way check was originally done in
> create_tablespace_directories(), basically original check
> will try
> unlink if lstat returns non-zero return code. If you want
> to proceed
> with the changed checks as in v3, then may be we can modify
> comments on top of function remove_tablespace_symlink() which
> indicates that it works like destroy_tablespace_directories().
>
>
>
> The difference is that here we're getting the list from a base
> backup and it seems to me the risk of having a file we don't
> really want to unlink is significantly greater.
>
>
> Okay, I think I can understand why you want to be cautious for
> having a different check for this path, but in that case there is a
> chance that recovery might fail when it will try to create a symlink
> for that file. Shouldn't we then try to call this new function only
> when we are trying to restore from tablespace_map file and also
> is there a need of ifdef S_ISLINK in remove_tablespace_link?
>
>
> Shall I send an updated patch on these lines or do you want to
> proceed with v3 version?
>
>

The point seems to me that we should not be removing anything that's not
an empty directory or symlink, and that nothing else has any business
being in pg_tblspc. If we encounter such a thing whose name conflicts
with the name of a tablespace link we wish to create, rather than
quietly blowing it away we should complain loudly, and error out, making
it the user's responsibility to clean up their mess. Am I missing something?

cheers

andrew

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Peter Eisentraut 2015-06-08 00:42:13 pgsql: doc: Fix broken links in FOP build
Previous Message Tom Lane 2015-06-07 19:32:44 pgsql: Use a safer method for determining whether relcache init file is

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Munro 2015-06-08 00:29:53 Re: could not truncate directory "pg_subtrans": apparent wraparound
Previous Message Andres Freund 2015-06-07 21:55:47 Re: Resource Owner reassign Locks