Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YwBpS-0003Oz-8d for pgsql-hackers@arkaria.postgresql.org; Sat, 23 May 2015 15:59:14 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1YwBpQ-0001eW-Do for pgsql-hackers@arkaria.postgresql.org; Sat, 23 May 2015 15:59:12 +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 1YwBpP-0001eN-6E for pgsql-hackers@postgresql.org; Sat, 23 May 2015 15:59:11 +0000 Received: from relay6-d.mail.gandi.net ([2001:4b98:c:538::198]) by magus.postgresql.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84) (envelope-from ) id 1YwBpK-00044O-KG for pgsql-hackers@postgresql.org; Sat, 23 May 2015 15:59:10 +0000 Received: from mfilter29-d.gandi.net (mfilter29-d.gandi.net [217.70.178.160]) by relay6-d.mail.gandi.net (Postfix) with ESMTP id D25A2FB886; Sat, 23 May 2015 17:59:01 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at mfilter29-d.gandi.net Received: from relay6-d.mail.gandi.net ([217.70.183.198]) by mfilter29-d.gandi.net (mfilter29-d.gandi.net [10.0.15.180]) (amavisd-new, port 10024) with ESMTP id raf-3teyz+-4; Sat, 23 May 2015 17:59:00 +0200 (CEST) X-Originating-IP: 98.27.58.255 Received: from [192.168.10.146] (cpe-98-27-58-255.nc.res.rr.com [98.27.58.255]) (Authenticated sender: adsend@dunslane.net) by relay6-d.mail.gandi.net (Postfix) with ESMTPSA id 455E4FB874; Sat, 23 May 2015 17:58:59 +0200 (CEST) Message-ID: <5560A3C2.6070204@dunslane.net> Date: Sat, 23 May 2015 11:58:58 -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> 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 05/23/2015 01:29 AM, Amit Kapila wrote: > On Fri, May 15, 2015 at 11:51 AM, Amit Kapila > wrote: > > > > On Thu, May 14, 2015 at 10:29 PM, Andrew Dunstan > > wrote: > > > > > > > > > On 05/14/2015 10:52 AM, Robert Haas wrote: > > >> > > >> On Thu, May 14, 2015 at 12:12 AM, Amit Kapila > > wrote: > > >>> > > >>> On Thu, May 14, 2015 at 2:10 AM, Andrew Dunstan > > wrote: > > >>>> > > >>>> How about if we simply abort if we find a non-symlink where we > want the > > >>>> symlink to be, and only remove something that is actually a > symlink (or a > > >>>> junction point, which is more or less the same thing)? > > >>> > > >>> We can do that way and for that I think we need to use rmdir > > >>> instead of rmtree in the code being discussed (recovery path), > > >>> OTOH we should try to minimize the errors raised during > > >>> recovery. > > >> > > >> I'm not sure I understand this issue in detail, but why would using > > >> rmtree() on something you expect to be a symlink ever be a good idea? > > >> It seems like if things are the way you expect them to be, it has no > > >> benefit, but if they are different from what you expect, you might > > >> blow away a ton of important data. > > >> > > >> Maybe I am just confused. > > >> > > > > > > > > > The suggestion is to get rid of using rmtree. Instead, if we find > a non-symlink in pg_tblspc we'll make the user clean it up before we > can continue. So your instinct is in tune with my suggestion. > > > > > > > Find the patch which gets rid of rmtree usage. I have made it as > > a separate function because the same code is used from > > create_tablespace_directories() as well. I thought of extending the > > same API for using it from destroy_tablespace_directories() as well, > > but due to special handling (especially for ENOENT) in that function, > > I left it as of now. > > > > Does it make sense to track this in 9.5 Open Items [1]? > > > [1] - https://wiki.postgresql.org/wiki/PostgreSQL_9.5_Open_Items > > Sure. It's on my list of things to get to, but by all means put it 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