pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pg_upgrade --link on Windows
14+ messages / 5 participants
[nested] [flat]

Commits from this thread:
  2017-06-15 ad1ea61cf8 ae58c15bd3 07fb943335 1798dd153d 85f2f543a8  doc:  remove mention of Windows junction points by pg_upgrade
* pg_upgrade --link on Windows
@ 2017-06-09 10:00 Arnaud L. <arnaud.listes@codata.eu>
  2017-06-09 14:07 ` Re: pg_upgrade --link on Windows Bruce Momjian <bruce@momjian.us>
  0 siblings, 1 reply; 14+ messages in thread

From: Arnaud L. @ 2017-06-09 10:00 UTC (permalink / raw)
  To: PG-General Mailing List <pgsql-general@postgresql.org>

Hi

The pg_upgrade documentation for PostgreSQL 9.6 states that --link will 
use junction points on Windows.
Shouldn't it rather user hard-links ?
If I'm not mistaken, with junction points (i.e. soft-links to 
directories), the old data dir cannot be removed.
With hard-links to file, we can get rid of the old data dir once we are 
sure that the upgrade is fine.

Regards

--
Arnaud


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



^ permalink  raw  reply  [nested|flat] 14+ messages in thread

* Re: pg_upgrade --link on Windows
  2017-06-09 10:00 pg_upgrade --link on Windows Arnaud L. <arnaud.listes@codata.eu>
@ 2017-06-09 14:07 ` Bruce Momjian <bruce@momjian.us>
  2017-06-09 14:24   ` Re: pg_upgrade --link on Windows Adrian Klaver <adrian.klaver@aklaver.com>
  2017-06-09 14:39   ` Re: pg_upgrade --link on Windows Arnaud L. <arnaud.listes@codata.eu>
  2017-06-09 16:13   ` Re: pg_upgrade --link on Windows George Neuner <gneuner2@comcast.net>
  0 siblings, 3 replies; 14+ messages in thread

From: Bruce Momjian @ 2017-06-09 14:07 UTC (permalink / raw)
  To: Arnaud L. <arnaud.listes@codata.eu>; +Cc: PG-General Mailing List <pgsql-general@postgresql.org>

On Fri, Jun  9, 2017 at 12:00:56PM +0200, Arnaud L. wrote:
> Hi
> 
> The pg_upgrade documentation for PostgreSQL 9.6 states that --link will use
> junction points on Windows.
> Shouldn't it rather user hard-links ?
> If I'm not mistaken, with junction points (i.e. soft-links to directories),
> the old data dir cannot be removed.
> With hard-links to file, we can get rid of the old data dir once we are sure
> that the upgrade is fine.

I was told junction points on Windows were hard links and no one has
ever complained about not being able to remove them.

-- 
  Bruce Momjian  <bruce@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

+ As you are, so once was I.  As I am, so you will be. +
+                      Ancient Roman grave inscription +


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



^ permalink  raw  reply  [nested|flat] 14+ messages in thread

* Re: pg_upgrade --link on Windows
  2017-06-09 10:00 pg_upgrade --link on Windows Arnaud L. <arnaud.listes@codata.eu>
  2017-06-09 14:07 ` Re: pg_upgrade --link on Windows Bruce Momjian <bruce@momjian.us>
@ 2017-06-09 14:24   ` Adrian Klaver <adrian.klaver@aklaver.com>
  2017-06-09 16:45     ` Re: pg_upgrade --link on Windows George Neuner <gneuner2@comcast.net>
  2 siblings, 1 reply; 14+ messages in thread

From: Adrian Klaver @ 2017-06-09 14:24 UTC (permalink / raw)
  To: Bruce Momjian <bruce@momjian.us>; Arnaud L. <arnaud.listes@codata.eu>; +Cc: PG-General Mailing List <pgsql-general@postgresql.org>

On 06/09/2017 07:07 AM, Bruce Momjian wrote:
> On Fri, Jun  9, 2017 at 12:00:56PM +0200, Arnaud L. wrote:
>> Hi
>>
>> The pg_upgrade documentation for PostgreSQL 9.6 states that --link will use
>> junction points on Windows.
>> Shouldn't it rather user hard-links ?
>> If I'm not mistaken, with junction points (i.e. soft-links to directories),
>> the old data dir cannot be removed.
>> With hard-links to file, we can get rid of the old data dir once we are sure
>> that the upgrade is fine.
> 
> I was told junction points on Windows were hard links and no one has
> ever complained about not being able to remove them.
> 

https://msdn.microsoft.com/en-us/library/windows/desktop/aa365006(v=vs.85).aspx

Seems to me the difference is hard links point to file, junctions to 
directories.

So if I am following:

https://en.wikipedia.org/wiki/NTFS_junction_point#Creating_or_deleting_a_junction_point

You remove the junction and then the directory it points to.

-- 
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



^ permalink  raw  reply  [nested|flat] 14+ messages in thread

* Re: pg_upgrade --link on Windows
  2017-06-09 10:00 pg_upgrade --link on Windows Arnaud L. <arnaud.listes@codata.eu>
  2017-06-09 14:07 ` Re: pg_upgrade --link on Windows Bruce Momjian <bruce@momjian.us>
  2017-06-09 14:24   ` Re: pg_upgrade --link on Windows Adrian Klaver <adrian.klaver@aklaver.com>
@ 2017-06-09 16:45     ` George Neuner <gneuner2@comcast.net>
  0 siblings, 0 replies; 14+ messages in thread

From: George Neuner @ 2017-06-09 16:45 UTC (permalink / raw)
  To: pgsql-general@postgresql.org

On Fri, 9 Jun 2017 07:24:03 -0700, Adrian Klaver
<adrian.klaver@aklaver.com> wrote:


>https://msdn.microsoft.com/en-us/library/windows/desktop/aa365006(v=vs.85).aspx
>
>Seems to me the difference is hard links point to file, junctions to 
>directories.

You can make either hard links or symlinks to files.  Junctions are
distinct from normal symlinks in that junctions can cross filesystems.
Microsoft's cmdline tools complain if you try to make a junction to a
file, because Microsoft intended junctions for mount points ... but
you can do it programmatically, or trick the tool by creating the link
and then replacing the target, and in most cases it will work the same
as a normal symlink.

I have seen cases where a junction to a file didn't work, but they
seemed to be application related rather than an OS issue.  Prior to
Vista, the mklink utility was not available, so people wanting to
create symlinks were forced to use the sysinternals junction utility.
https://technet.microsoft.com/en-us/sysinternals/bb545021.aspx

George



-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



^ permalink  raw  reply  [nested|flat] 14+ messages in thread

* Re: pg_upgrade --link on Windows
  2017-06-09 10:00 pg_upgrade --link on Windows Arnaud L. <arnaud.listes@codata.eu>
  2017-06-09 14:07 ` Re: pg_upgrade --link on Windows Bruce Momjian <bruce@momjian.us>
@ 2017-06-09 14:39   ` Arnaud L. <arnaud.listes@codata.eu>
  2017-06-09 14:55     ` Re: pg_upgrade --link on Windows Adrian Klaver <adrian.klaver@aklaver.com>
  2 siblings, 1 reply; 14+ messages in thread

From: Arnaud L. @ 2017-06-09 14:39 UTC (permalink / raw)
  To: Bruce Momjian <bruce@momjian.us>; Arnaud L. <arnaud.listes@codata.eu>; +Cc: PG-General Mailing List <pgsql-general@postgresql.org>

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) ?

Regards
--
Arnaud


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



^ permalink  raw  reply  [nested|flat] 14+ messages in thread

* Re: pg_upgrade --link on Windows
  2017-06-09 10:00 pg_upgrade --link on Windows Arnaud L. <arnaud.listes@codata.eu>
  2017-06-09 14:07 ` Re: pg_upgrade --link on Windows Bruce Momjian <bruce@momjian.us>
  2017-06-09 14:39   ` Re: pg_upgrade --link on Windows Arnaud L. <arnaud.listes@codata.eu>
@ 2017-06-09 14:55     ` Adrian Klaver <adrian.klaver@aklaver.com>
  2017-06-09 15:02       ` Re: pg_upgrade --link on Windows Arnaud L. <arnaud.listes@codata.eu>
  2017-06-13 20:07       ` Re: [GENERAL] pg_upgrade --link on Windows Bruce Momjian <bruce@momjian.us>
  0 siblings, 2 replies; 14+ messages in thread

From: Adrian Klaver @ 2017-06-09 14:55 UTC (permalink / raw)
  To: arnaud.listes@codata.eu, Bruce Momjian <bruce@momjian.us>; +Cc: PG-General Mailing List <pgsql-general@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



^ permalink  raw  reply  [nested|flat] 14+ messages in thread

* Re: pg_upgrade --link on Windows
  2017-06-09 10:00 pg_upgrade --link on Windows Arnaud L. <arnaud.listes@codata.eu>
  2017-06-09 14:07 ` Re: pg_upgrade --link on Windows Bruce Momjian <bruce@momjian.us>
  2017-06-09 14:39   ` Re: pg_upgrade --link on Windows Arnaud L. <arnaud.listes@codata.eu>
  2017-06-09 14:55     ` Re: pg_upgrade --link on Windows Adrian Klaver <adrian.klaver@aklaver.com>
@ 2017-06-09 15:02       ` Arnaud L. <arnaud.listes@codata.eu>
  2017-06-09 15:28         ` Re: pg_upgrade --link on Windows Arnaud L. <arnaud.listes@codata.eu>
  1 sibling, 1 reply; 14+ messages in thread

From: Arnaud L. @ 2017-06-09 15:02 UTC (permalink / raw)
  To: Adrian Klaver <adrian.klaver@aklaver.com>; Bruce Momjian <bruce@momjian.us>; +Cc: PG-General Mailing List <pgsql-general@postgresql.org>

Le 9/06/2017 à 16:55, Adrian Klaver a écrit :
> On 06/09/2017 07:39 AM, Arnaud L. wrote:
>> 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

Great !
So I did a full upgrade for nothing (just for safety), but that's good 
to know for next time !
Should this be submitted to postgresql-bugs, or is there something more 
specific to the documentation ?

Regards
--
Arnaud




-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



^ permalink  raw  reply  [nested|flat] 14+ messages in thread

* Re: pg_upgrade --link on Windows
  2017-06-09 10:00 pg_upgrade --link on Windows Arnaud L. <arnaud.listes@codata.eu>
  2017-06-09 14:07 ` Re: pg_upgrade --link on Windows Bruce Momjian <bruce@momjian.us>
  2017-06-09 14:39   ` Re: pg_upgrade --link on Windows Arnaud L. <arnaud.listes@codata.eu>
  2017-06-09 14:55     ` Re: pg_upgrade --link on Windows Adrian Klaver <adrian.klaver@aklaver.com>
  2017-06-09 15:02       ` Re: pg_upgrade --link on Windows Arnaud L. <arnaud.listes@codata.eu>
@ 2017-06-09 15:28         ` Arnaud L. <arnaud.listes@codata.eu>
  0 siblings, 0 replies; 14+ messages in thread

From: Arnaud L. @ 2017-06-09 15:28 UTC (permalink / raw)
  To: pgsql-general@postgresql.org

Le 9/06/2017 à 17:02, Arnaud L. a écrit :
> Le 9/06/2017 à 16:55, Adrian Klaver a écrit :
>> On 06/09/2017 07:39 AM, Arnaud L. wrote:
>>> 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
> 
> Great !
> So I did a full upgrade for nothing (just for safety), but that's good
> to know for next time !
> Should this be submitted to postgresql-bugs, or is there something more
> specific to the documentation ?

I just found the pgsql-docs@postgresql.org list, for for the spam.

--
Arnaud



-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



^ permalink  raw  reply  [nested|flat] 14+ messages in thread

* Re: [GENERAL] pg_upgrade --link on Windows
  2017-06-09 10:00 pg_upgrade --link on Windows Arnaud L. <arnaud.listes@codata.eu>
  2017-06-09 14:07 ` Re: pg_upgrade --link on Windows Bruce Momjian <bruce@momjian.us>
  2017-06-09 14:39   ` Re: pg_upgrade --link on Windows Arnaud L. <arnaud.listes@codata.eu>
  2017-06-09 14:55     ` Re: pg_upgrade --link on Windows Adrian Klaver <adrian.klaver@aklaver.com>
@ 2017-06-13 20:07       ` Bruce Momjian <bruce@momjian.us>
  2017-06-14 07:59         ` Re: pg_upgrade --link on Windows Klaus P. Pieper <kpi6288@gmail.com>
  2017-06-15 17:28         ` Re: [GENERAL] pg_upgrade --link on Windows Bruce Momjian <bruce@momjian.us>
  1 sibling, 2 replies; 14+ messages in thread

From: Bruce Momjian @ 2017-06-13 20:07 UTC (permalink / raw)
  To: Adrian Klaver <adrian.klaver@aklaver.com>; +Cc: arnaud.listes@codata.eu, PG-General Mailing List <pgsql-general@postgresql.org>; pgsql-docs

On Fri, Jun  9, 2017 at 07:55:55AM -0700, Adrian Klaver wrote:
> On 06/09/2017 07:39 AM, Arnaud L. wrote:
> >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

[docs list added]

I apologize for not being smarter on this thread.  When I helped with
the Windows port, I was told Windows didn't have hard links for use by
tablespace directories, so I got it into my head that Windows didn't
have hard links.  Therefore, when I was writing the docs, I called them
junction points.

Looking back to Postgres 9.0 where pg_upgrade was added to the tree, I
see that the code even at that time used hard links on Windows.  I have
created the attached patch which I will apply to all current Postgres
versions to fix this error.

Thanks for the report and the research.  :-)

-- 
  Bruce Momjian  <bruce@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

+ As you are, so once was I.  As I am, so you will be. +
+                      Ancient Roman grave inscription +

-- 
Sent via pgsql-docs mailing list (pgsql-docs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-docs

Attachments:

junction.diff (text/x-diff, 767B) download diff --git a/doc/src/sgml/ref/pgupgrade.sgml b/doc/src/sgml/ref/pgupgrade.sgml new file mode 100644 index bf58a0a..4e27112 *** a/doc/src/sgml/ref/pgupgrade.sgml --- b/doc/src/sgml/ref/pgupgrade.sgml *************** *** 123,129 **** <term><option>-k</option></term> <term><option>--link</option></term> <listitem><para>use hard links instead of copying files to the new ! cluster (use junction points on Windows)</para></listitem> </varlistentry> <varlistentry> --- 123,129 ---- <term><option>-k</option></term> <term><option>--link</option></term> <listitem><para>use hard links instead of copying files to the new ! cluster</para></listitem> </varlistentry> <varlistentry>
^ permalink raw reply [nested|flat] 14+ messages in thread

* Re: pg_upgrade --link on Windows
  2017-06-09 10:00 pg_upgrade --link on Windows Arnaud L. <arnaud.listes@codata.eu>
  2017-06-09 14:07 ` Re: pg_upgrade --link on Windows Bruce Momjian <bruce@momjian.us>
  2017-06-09 14:39   ` Re: pg_upgrade --link on Windows Arnaud L. <arnaud.listes@codata.eu>
  2017-06-09 14:55     ` Re: pg_upgrade --link on Windows Adrian Klaver <adrian.klaver@aklaver.com>
  2017-06-13 20:07       ` Re: [GENERAL] pg_upgrade --link on Windows Bruce Momjian <bruce@momjian.us>
@ 2017-06-14 07:59         ` Klaus P. Pieper <kpi6288@gmail.com>
  2017-06-14 16:00           ` Re: pg_upgrade --link on Windows Bruce Momjian <bruce@momjian.us>
  1 sibling, 1 reply; 14+ messages in thread

From: Klaus P. Pieper @ 2017-06-14 07:59 UTC (permalink / raw)
  To: 'PG-General Mailing List' <pgsql-general@postgresql.org>

> -----Ursprüngliche Nachricht-----
> 
> I apologize for not being smarter on this thread.  When I helped with the
> Windows port, I was told Windows didn't have hard links for use by
tablespace
> directories, so I got it into my head that Windows didn't have hard links.
> Therefore, when I was writing the docs, I called them junction points.

It's actually not "Windows" providing hard links, it is the file system
NTFS. FAT and its modern cousins don't provide hard links - but this will
rarely be used for databases these days. 
However, ReFS (introduced with server 2012 and providing some new features
like automatic integrity checks, clustering etc.) does no longer provide
hard links. 
Are hard links used anywhere else but in pg_upgrade?

Klaus



-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



^ permalink  raw  reply  [nested|flat] 14+ messages in thread

* Re: pg_upgrade --link on Windows
  2017-06-09 10:00 pg_upgrade --link on Windows Arnaud L. <arnaud.listes@codata.eu>
  2017-06-09 14:07 ` Re: pg_upgrade --link on Windows Bruce Momjian <bruce@momjian.us>
  2017-06-09 14:39   ` Re: pg_upgrade --link on Windows Arnaud L. <arnaud.listes@codata.eu>
  2017-06-09 14:55     ` Re: pg_upgrade --link on Windows Adrian Klaver <adrian.klaver@aklaver.com>
  2017-06-13 20:07       ` Re: [GENERAL] pg_upgrade --link on Windows Bruce Momjian <bruce@momjian.us>
  2017-06-14 07:59         ` Re: pg_upgrade --link on Windows Klaus P. Pieper <kpi6288@gmail.com>
@ 2017-06-14 16:00           ` Bruce Momjian <bruce@momjian.us>
  0 siblings, 0 replies; 14+ messages in thread

From: Bruce Momjian @ 2017-06-14 16:00 UTC (permalink / raw)
  To: Klaus P. Pieper <kpi6288@gmail.com>; +Cc: PG-General Mailing List <pgsql-general@postgresql.org>

On Wed, Jun 14, 2017 at 09:59:04AM +0200, Klaus P. Pieper wrote:
> > -----Ursprüngliche Nachricht-----
> > 
> > I apologize for not being smarter on this thread.  When I helped with the
> > Windows port, I was told Windows didn't have hard links for use by
> tablespace
> > directories, so I got it into my head that Windows didn't have hard links.
> > Therefore, when I was writing the docs, I called them junction points.
> 
> It's actually not "Windows" providing hard links, it is the file system
> NTFS. FAT and its modern cousins don't provide hard links - but this will
> rarely be used for databases these days. 
> However, ReFS (introduced with server 2012 and providing some new features
> like automatic integrity checks, clustering etc.) does no longer provide
> hard links. 
> Are hard links used anywhere else but in pg_upgrade?

Nope, it is used only by transfer_relfile() calling linkFile().

-- 
  Bruce Momjian  <bruce@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

+ As you are, so once was I.  As I am, so you will be. +
+                      Ancient Roman grave inscription +


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



^ permalink  raw  reply  [nested|flat] 14+ messages in thread

* Re: [GENERAL] pg_upgrade --link on Windows
  2017-06-09 10:00 pg_upgrade --link on Windows Arnaud L. <arnaud.listes@codata.eu>
  2017-06-09 14:07 ` Re: pg_upgrade --link on Windows Bruce Momjian <bruce@momjian.us>
  2017-06-09 14:39   ` Re: pg_upgrade --link on Windows Arnaud L. <arnaud.listes@codata.eu>
  2017-06-09 14:55     ` Re: pg_upgrade --link on Windows Adrian Klaver <adrian.klaver@aklaver.com>
  2017-06-13 20:07       ` Re: [GENERAL] pg_upgrade --link on Windows Bruce Momjian <bruce@momjian.us>
@ 2017-06-15 17:28         ` Bruce Momjian <bruce@momjian.us>
  1 sibling, 0 replies; 14+ messages in thread

From: Bruce Momjian @ 2017-06-15 17:28 UTC (permalink / raw)
  To: Adrian Klaver <adrian.klaver@aklaver.com>; +Cc: arnaud.listes@codata.eu, PG-General Mailing List <pgsql-general@postgresql.org>; pgsql-docs

On Tue, Jun 13, 2017 at 04:07:48PM -0400, Bruce Momjian wrote:
> On Fri, Jun  9, 2017 at 07:55:55AM -0700, Adrian Klaver wrote:
> I apologize for not being smarter on this thread.  When I helped with
> the Windows port, I was told Windows didn't have hard links for use by
> tablespace directories, so I got it into my head that Windows didn't
> have hard links.  Therefore, when I was writing the docs, I called them
> junction points.
> 
> Looking back to Postgres 9.0 where pg_upgrade was added to the tree, I
> see that the code even at that time used hard links on Windows.  I have
> created the attached patch which I will apply to all current Postgres
> versions to fix this error.
> 
> Thanks for the report and the research.  :-)

Patch applied all the way back to 9.3, where the junction point mention
first appeared.

-- 
  Bruce Momjian  <bruce@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

+ As you are, so once was I.  As I am, so you will be. +
+                      Ancient Roman grave inscription +


-- 
Sent via pgsql-docs mailing list (pgsql-docs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-docs



^ permalink  raw  reply  [nested|flat] 14+ messages in thread

* Re: pg_upgrade --link on Windows
  2017-06-09 10:00 pg_upgrade --link on Windows Arnaud L. <arnaud.listes@codata.eu>
  2017-06-09 14:07 ` Re: pg_upgrade --link on Windows Bruce Momjian <bruce@momjian.us>
@ 2017-06-09 16:13   ` George Neuner <gneuner2@comcast.net>
  2 siblings, 0 replies; 14+ messages in thread

From: George Neuner @ 2017-06-09 16:13 UTC (permalink / raw)
  To: pgsql-general@postgresql.org

On Fri, 9 Jun 2017 10:07:24 -0400, Bruce Momjian <bruce@momjian.us>
wrote:

>On Fri, Jun  9, 2017 at 12:00:56PM +0200, Arnaud L. wrote:
>> Hi
>> 
>> The pg_upgrade documentation for PostgreSQL 9.6 states that --link will use
>> junction points on Windows.
>> Shouldn't it rather user hard-links ?
>> If I'm not mistaken, with junction points (i.e. soft-links to directories),
>> the old data dir cannot be removed.
>> With hard-links to file, we can get rid of the old data dir once we are sure
>> that the upgrade is fine.
>
>I was told junction points on Windows were hard links and no one has
>ever complained about not being able to remove them.


NTFS junctions are a distinct type of symbolic link which is meant for
filesystem mount points.  In NTFS "normal" symlinks are restricted to
targets within the same filesystem.

You can use a junction anywhere you want a symlink, but not the
reverse.  The downside is that pathname parsing is slower with
junctions than with symlinks because of the possibility that the path
may cross into a different filesystem.


The documentation is not very clear, IMO.

https://msdn.microsoft.com/en-us/library/windows/desktop/aa365006(v=vs.85).aspx
https://msdn.microsoft.com/en-us/library/windows/desktop/aa363878(v=vs.85).aspx
https://msdn.microsoft.com/en-us/library/windows/desktop/aa365503(v=vs.85).aspx


The mklink utility can create any of these types of links.  Its
documentation does not describe the differences, but is shows that
hard links, symlinks, and junctions all are distinct concepts in
Windows.

https://technet.microsoft.com/en-us/library/cc753194(v=ws.11).aspx


George



-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



^ permalink  raw  reply  [nested|flat] 14+ messages in thread

* pg_upgrade --link on windows
@ 2017-06-09 15:09 Arnaud L. <arnaud.listes@codata.eu>
  0 siblings, 0 replies; 14+ messages in thread

From: Arnaud L. @ 2017-06-09 15:09 UTC (permalink / raw)
  To: pgsql-docs

Hi,

the pg_upgrade page states that --link uses junction points on windows :

"--link
     use hard links instead of copying files to the new cluster (use 
junction points on Windows)"

I believe this is not correct. It uses hard links. Junction points are 
soft links to directories, and would not allow the user to remove the 
old-datadir after a successfull upgrade.

Out of safety I ran an upgrade without --link because of this, so I 
think that clarifying this in the documentation could help some users.

Regards
--
Arnaud




-- 
Sent via pgsql-docs mailing list (pgsql-docs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-docs



^ permalink  raw  reply  [nested|flat] 14+ messages in thread


end of thread, other threads:[~2017-06-15 17:28 UTC | newest]

Thread overview: 14+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2017-06-09 10:00 pg_upgrade --link on Windows Arnaud L. <arnaud.listes@codata.eu>
2017-06-09 14:07 ` Bruce Momjian <bruce@momjian.us>
2017-06-09 14:24   ` Adrian Klaver <adrian.klaver@aklaver.com>
2017-06-09 16:45     ` George Neuner <gneuner2@comcast.net>
2017-06-09 14:39   ` Arnaud L. <arnaud.listes@codata.eu>
2017-06-09 14:55     ` Adrian Klaver <adrian.klaver@aklaver.com>
2017-06-09 15:02       ` Arnaud L. <arnaud.listes@codata.eu>
2017-06-09 15:28         ` Arnaud L. <arnaud.listes@codata.eu>
2017-06-13 20:07       ` Bruce Momjian <bruce@momjian.us>
2017-06-14 07:59         ` Klaus P. Pieper <kpi6288@gmail.com>
2017-06-14 16:00           ` Bruce Momjian <bruce@momjian.us>
2017-06-15 17:28         ` Bruce Momjian <bruce@momjian.us>
2017-06-09 16:13   ` George Neuner <gneuner2@comcast.net>
2017-06-09 15:09 pg_upgrade --link on windows Arnaud L. <arnaud.listes@codata.eu>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox