Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Z1kpt-00059u-PZ for pgsql-hackers@arkaria.postgresql.org; Mon, 08 Jun 2015 00:22:41 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Z1kpr-0008IT-TQ for pgsql-hackers@arkaria.postgresql.org; Mon, 08 Jun 2015 00:22:39 +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 1Z1kpq-0008IN-Uz for pgsql-hackers@postgresql.org; Mon, 08 Jun 2015 00:22:39 +0000 Received: from relay4-d.mail.gandi.net ([2001:4b98:c:538::196]) by makus.postgresql.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84) (envelope-from ) id 1Z1kpn-0002Xx-E4 for pgsql-hackers@postgresql.org; Mon, 08 Jun 2015 00:22:37 +0000 Received: from mfilter22-d.gandi.net (mfilter22-d.gandi.net [217.70.178.150]) by relay4-d.mail.gandi.net (Postfix) with ESMTP id 6A463172080; Mon, 8 Jun 2015 02:22:31 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at mfilter22-d.gandi.net Received: from relay4-d.mail.gandi.net ([217.70.183.196]) by mfilter22-d.gandi.net (mfilter22-d.gandi.net [10.0.15.180]) (amavisd-new, port 10024) with ESMTP id 2chAquXMvzcd; Mon, 8 Jun 2015 02:22:30 +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 relay4-d.mail.gandi.net (Postfix) with ESMTPSA id 2A314172070; Mon, 8 Jun 2015 02:22:28 +0200 (CEST) Message-ID: <5574E043.8060101@dunslane.net> Date: Sun, 07 Jun 2015 20:22:27 -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> <5571251A.5090907@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/05/2015 11:08 PM, Amit Kapila wrote: > On Fri, Jun 5, 2015 at 10:51 AM, Amit Kapila > wrote: > > On Fri, Jun 5, 2015 at 9:57 AM, Andrew Dunstan > > 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 -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers