Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Z0jDy-0005yo-6g for pgsql-hackers@arkaria.postgresql.org; Fri, 05 Jun 2015 04:27:18 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Z0jDx-0005YP-0t for pgsql-hackers@arkaria.postgresql.org; Fri, 05 Jun 2015 04:27:17 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1Z0jDv-0005YF-QB for pgsql-hackers@postgresql.org; Fri, 05 Jun 2015 04:27:15 +0000 Received: from relay5-d.mail.gandi.net ([2001:4b98:c:538::197]) by makus.postgresql.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84) (envelope-from ) id 1Z0jDs-0007Zt-0i for pgsql-hackers@postgresql.org; Fri, 05 Jun 2015 04:27:14 +0000 Received: from mfilter5-d.gandi.net (mfilter5-d.gandi.net [217.70.178.132]) by relay5-d.mail.gandi.net (Postfix) with ESMTP id D4F1241C054; Fri, 5 Jun 2015 06:27:09 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at mfilter5-d.gandi.net Received: from relay5-d.mail.gandi.net ([217.70.183.197]) by mfilter5-d.gandi.net (mfilter5-d.gandi.net [10.0.15.180]) (amavisd-new, port 10024) with ESMTP id FIzCcAxKx3Rs; Fri, 5 Jun 2015 06:27:08 +0200 (CEST) X-Originating-IP: 98.122.164.227 Received: from [192.168.10.146] (unknown [98.122.164.227]) (Authenticated sender: adsend@dunslane.net) by relay5-d.mail.gandi.net (Postfix) with ESMTPSA id A374241C05A; Fri, 5 Jun 2015 06:27:07 +0200 (CEST) Message-ID: <5571251A.5090907@dunslane.net> Date: Fri, 05 Jun 2015 00:27:06 -0400 From: Andrew Dunstan User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: Amit Kapila CC: Robert Haas , hlinnaka , PostgreSQL-development Subject: Re: Re: [COMMITTERS] pgsql: Map basebackup tablespaces using a tablespace_map file References: <55520F33.401@iki.fi> <55521D27.3010705@dunslane.net> <5553B6B5.6040804@dunslane.net> <5554D470.1080107@dunslane.net> <556DE03B.1020809@dunslane.net> <556F620E.2010403@dunslane.net> <5571028A.1070706@dunslane.net> In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org On 06/04/2015 11:35 PM, Amit Kapila wrote: > On Fri, Jun 5, 2015 at 7:29 AM, Andrew Dunstan > wrote: > > > On 06/04/2015 09:23 AM, Amit Kapila wrote: > > > > > Okay, as we both seem to agree that it can be mostly used in > tablespace symlinks context, so I have changed the name to > remove_tablespace_symlink() and moved the function to > tablespace.c. S_ISLINK check is used for non-windows code, > so not sure adding it here makes any real difference now that > we have made it specific to tablespace and we might need to > write small port specific code if we want to add S_ISLINK > check. > > > > Where is it used? I can't see it called at all in tablespace.c or > xlog.c. > > > Below files use S_ISLINK check > basebackup.c, fd.c, initdb.c, copy_fetch.c, pg_rewind/filemap.c > > and all these places use it with #ifndef WIN32 > > Perhaps I'm being overcautious, but here's more or less what I had > in mind. > > > What is making you feel nervous, if it is that we should not > use unlink call without checking S_ISLINK, then we are > already doing the same at many other places (rewriteheap.c, > slru.c, timeline.c, xlog.c). It is already defined for Windows > as pgunlink. > > 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. cheers andrew -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers