Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dJLKS-0008W4-PH for pgsql-general@arkaria.postgresql.org; Fri, 09 Jun 2017 14:56:01 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1dJLKS-00063t-Bs for pgsql-general@arkaria.postgresql.org; Fri, 09 Jun 2017 14:56:00 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dJLKR-00060t-Kd for pgsql-general@postgresql.org; Fri, 09 Jun 2017 14:55:59 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dJLKO-0006z0-Rs for pgsql-general@postgresql.org; Fri, 09 Jun 2017 14:55:58 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 5E08120C13; Fri, 9 Jun 2017 10:55:56 -0400 (EDT) Received: from frontend1 ([10.202.2.160]) by compute6.internal (MEProxy); Fri, 09 Jun 2017 10:55:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc:x-sasl-enc; s=fm1; bh=ZG7NqhZjW3wUNcQnxs n6bZrTDQ8hygp2Pb1ww05mWOg=; b=UOwZBa5r+FuVaNJ4MA3lqIxbgCKsqjgYEc 0g3fOBXohQzbmMwVwh0J3ct9LVdaOAwDZyuUbkjh5yUmqIX0AbKqOywsyAQhutyM paRI1CCvRBilEw+ciJpmRNeKE12MwlwZwdv0LqYdZEXWukRSpUXt6A/pY0CG+gev 0456RP01n/oMqT+4kPc5JyEENJJAhZjcOaz5R+li4B+a4Z9w8u/HUF+ku11o+N1e 472a+IzCMhdz3omspc+aej8zUldGtiCu7X7FTqPoi82A4+COoSkoHm3lCLfvyXB3 xrb9l0ztmLTINnCOBTiYGsgtaJCm9AABfiRdw9XQMTmBBJBW7PqQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s= fm1; bh=ZG7NqhZjW3wUNcQnxsn6bZrTDQ8hygp2Pb1ww05mWOg=; b=pqD2YXml 9EuGrW1xaDZ8gskKiFqX1MfRzpJXD2Cf7foMzYtkA24UEwirPF8NXfaJRhdqwi6N w/BrRwRztq2nPoIVL6lgeDfo9qsxrnNKhcJHNGz8/gwSr5OX6l7zpxXsnijjqFbq LT8Pb/r2+HMR4mfkhnlah9W131EdWX0XkRkmrjMDRz7PiNbsEmAIvACbleU3aY8B 8HLEPmRBdcKbyiNsfZDWW9DxK5LtakQtKJRwdYkZ1P4pqoqSlhK6cYX2mK9d5Aq5 /wbXD7RiyymAc4J0xGeQayJ4kTEh/zh4kclznVkenR6Sl+3ZfQGKH2f2djlPypuQ xGGy2+OW1MkinA== X-ME-Sender: X-Sasl-enc: uve3xuZ8gzjQpJU21mJmVucC3A0DU/Q8/bq50ECH+Xjb 1497020156 Received: from [192.168.1.2] (75-172-126-41.tukw.qwest.net [75.172.126.41]) by mail.messagingengine.com (Postfix) with ESMTPA id CBA467E7AA; Fri, 9 Jun 2017 10:55:55 -0400 (EDT) Subject: Re: pg_upgrade --link on Windows To: arnaud.listes@codata.eu, Bruce Momjian Cc: PG-General Mailing List References: <8da3dbd9-7daf-5589-0cc8-0eede930a492@codata.eu> <20170609140724.GB21215@momjian.us> From: Adrian Klaver Message-ID: <0405d125-929b-ab4a-b7be-d49c09e7c056@aklaver.com> Date: Fri, 9 Jun 2017 07:55:55 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Pg-Spam-Score: -2.7 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-general Precedence: bulk Sender: pgsql-general-owner@postgresql.org On 06/09/2017 07:39 AM, Arnaud L. wrote: > Le 9/06/2017 à 16:07, Bruce Momjian a écrit : >> I was told junction points on Windows were hard links and no one has >> ever complained about not being able to remove them. > > Sorry, I think my explanation was not very clear. > You can remove the link, but the point is to remove the target (i.e. the > old-data-dir). > You can do this with a hard link (there still exists a hardlink pointing > to the inode so it remains), but with a soft link you end up with a link > to nothing. > Deleting a junction target in Windows will work, but you'll have an > error trying to access the junction directory (directory not found). > > See this page for more details : > http://cects.com/overview-to-understanding-hard-links-junction-points-and-symbolic-links-in-windows/ > > > Under "Hard Link (Linking for individual files)" : > "If the target is deleted, its content is still available through the > hard link" > > Junction Point (Directory Hard Link): > "If the target is moved, renamed or deleted, the Junction Point still > exists, but points to a non-existing directory" > > BUT, when I try to "pg_upgrade --link --check" with old-data-dir and > new-data-dir on different volumes, I get an error saying that both > directories must be on the same volume if --link is used. > So maybe pg_upgrade uses hard-links (i.e. to files), and only the > documentation is wrong by calling them junctions (i.e. soft links to > files) ? Looks that way. In file.c in ~/src/bin/pg_upgrade I see: #ifdef WIN32 300 /* implementation of pg_link_file() on Windows */ 301 static int 302 win32_pghardlink(const char *src, const char *dst) 303 { 304 /* 305 * CreateHardLinkA returns zero for failure 306 * http://msdn.microsoft.com/en-us/library/aa363860(VS.85).aspx 307 */ 308 if (CreateHardLinkA(dst, src, NULL) == 0) 309 { 310 _dosmaperr(GetLastError()); 311 return -1; 312 } 313 else 314 return 0; 315 } 316 #endif > > Regards > -- > Arnaud > > -- Adrian Klaver adrian.klaver@aklaver.com -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general