Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Z1woZ-0007Rq-Ba for pgsql-hackers@arkaria.postgresql.org; Mon, 08 Jun 2015 13:10:07 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Z1woX-0007g9-VR for pgsql-hackers@arkaria.postgresql.org; Mon, 08 Jun 2015 13:10:06 +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 1Z1wo6-00075w-BC for pgsql-hackers@postgresql.org; Mon, 08 Jun 2015 13:09:38 +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 1Z1wo2-0008U9-Fd for pgsql-hackers@postgresql.org; Mon, 08 Jun 2015 13:09:36 +0000 Received: from mfilter18-d.gandi.net (mfilter18-d.gandi.net [217.70.178.146]) by relay5-d.mail.gandi.net (Postfix) with ESMTP id 1958141C3B4; Mon, 8 Jun 2015 15:09:31 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at mfilter18-d.gandi.net Received: from relay5-d.mail.gandi.net ([217.70.183.197]) by mfilter18-d.gandi.net (mfilter18-d.gandi.net [10.0.15.180]) (amavisd-new, port 10024) with ESMTP id XZjvxrb3TxKM; Mon, 8 Jun 2015 15:09:29 +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 ADB7741C103; Mon, 8 Jun 2015 15:09:28 +0200 (CEST) Message-ID: <55759407.8000801@dunslane.net> Date: Mon, 08 Jun 2015 09:09: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: <5553B6B5.6040804@dunslane.net> <5554D470.1080107@dunslane.net> <556DE03B.1020809@dunslane.net> <556F620E.2010403@dunslane.net> <5571028A.1070706@dunslane.net> <5571251A.5090907@dunslane.net> <5574E043.8060101@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/08/2015 12:08 AM, Amit Kapila wrote: > On Mon, Jun 8, 2015 at 5:52 AM, Andrew Dunstan > wrote: > > > > On 06/05/2015 11:08 PM, Amit Kapila wrote: > >> > >> > >> 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? > > > > How about if it is just a flat file with same name as tablespace link, > why we want to give error for that case? I think now it just don't do > anything with that file (unlink will fail with ENOENT and it will be > ignored, atleast thats the way currently it behaves in Windows) and > create a separate symlink with same name which seems okay to > me and in the change proposed by you it will give error, do you see > any reason for doing so? > > This is surely wrong. unlink won't fail with ENOENT if the file is present; ENOENT means that the file is NOT present. It will succeed if the file is present, which is exactly what I'm saying is wrong. I realize our existing code just more or less assumes that that it's a symlink. I think we've probably been a bit careless there. 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