Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Z22Eh-0005EO-Bx for pgsql-hackers@arkaria.postgresql.org; Mon, 08 Jun 2015 18:57:27 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Z22Eg-0005qR-Rd for pgsql-hackers@arkaria.postgresql.org; Mon, 08 Jun 2015 18:57:26 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1Z22Ee-0005qI-LH for pgsql-hackers@postgresql.org; Mon, 08 Jun 2015 18:57:24 +0000 Received: from relay4-d.mail.gandi.net ([2001:4b98:c:538::196]) by magus.postgresql.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84) (envelope-from ) id 1Z22Ea-0005IM-6R for pgsql-hackers@postgresql.org; Mon, 08 Jun 2015 18:57:23 +0000 Received: from mfilter37-d.gandi.net (mfilter37-d.gandi.net [217.70.178.168]) by relay4-d.mail.gandi.net (Postfix) with ESMTP id 12EE217209A; Mon, 8 Jun 2015 20:57:16 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at mfilter37-d.gandi.net Received: from relay4-d.mail.gandi.net ([217.70.183.196]) by mfilter37-d.gandi.net (mfilter37-d.gandi.net [10.0.15.180]) (amavisd-new, port 10024) with ESMTP id B9O-05pBuTXK; Mon, 8 Jun 2015 20:57:14 +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 CB6D1172080; Mon, 8 Jun 2015 20:57:13 +0200 (CEST) Message-ID: <5575E588.9090905@dunslane.net> Date: Mon, 08 Jun 2015 14:57:12 -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: <5554D470.1080107@dunslane.net> <556DE03B.1020809@dunslane.net> <556F620E.2010403@dunslane.net> <5571028A.1070706@dunslane.net> <5571251A.5090907@dunslane.net> <5574E043.8060101@dunslane.net> <55759407.8000801@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 11:16 AM, Amit Kapila wrote: > On Mon, Jun 8, 2015 at 6:39 PM, Andrew Dunstan > wrote: > > > On 06/08/2015 12:08 AM, Amit Kapila wrote: > > 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 have to retry that operation, but for me unlink hasn't deleted > the file on Windows, may be I am not doing properly, but in > anycase why we want to throw error for such a case, why > can't we just ignore and create a symlink with the same name. 1. You realize that in Windows postgres, unlink is actually pgunlink(), right? See port.h. If your experiments weren't using that then they weren't testing the same thing. 2. If the unlink fails and the file is still there (i.e. pretty much everything except the ENOENT case) then creation of the symlink is bound to fail anyway. > 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. > > > I agree with you that deleting unrelated file with the same name as > symlink is not the right thing to do, but not sure throwing error for > such a case is better either. > > What else would you suggest? Closing our eyes and wishing it weren't so doesn't seem like a solution. 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