Re: Avoiding Tablespace path collision for primary and standby

From: Craig Ringer <craig(dot)ringer(at)2ndquadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Ashwin Agrawal <aagrawal(at)pivotal(dot)io>, Andres Freund <andres(at)anarazel(dot)de>, pgsql-hackers(at)lists(dot)postgresql(dot)org, bruce(at)momjian(dot)us, PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Avoiding Tablespace path collision for primary and standby
Date: 2018-06-20 23:50:17
Message-ID: CAMsr+YE06WjM-js2k5SFZyDLdYvXnjM7c=Bu3hh3wxPXXSWiRA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu., 21 Jun. 2018, 04:30 Tom Lane, <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> Ashwin Agrawal <aagrawal(at)pivotal(dot)io> writes:
> > Okay just bouncing another approach, how about generating UUID for a
> > postgres instance during initdb and pg_basebackup ?
>
> There's no uuid generation code in core postgres, for excellent reasons
> (lack of portability and lack of failure modes are the main objections).
> This is not different in any meaningful way from the proposal to use
> timestamps, except for being more complicated.

A v4 UUID is just 128 random bits and some simple formatting. So I really
don't understand your concerns about UUID generation.

That said, it can already be handled with tablespace maps in pg_basebackup.
And any new scheme would need to happen in pg_basebackup too, because it
must happen before the tablespace are copied and thr replica is first
started.

I don't see a big concern with some pg_basebackup --gen-unique-tablespaces
option or the like.

UUID would be better than timestamp due to the skew issues discussed
upthread. But personally I'd just take a label argument. pg_basebackup
--tablespace-prefix or the like.

For non pg_basebackup uses you have to solve it yourself anyway. Pg doesn't
know if it's just been started as a copy, after all, and it's too late to
move tablespace then even if we'd do such a thing.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Langote 2018-06-21 00:17:28 Re: partition -> partitioned
Previous Message Alvaro Herrera 2018-06-20 23:38:23 Re: XML/XPath issues: text/CDATA in XMLTABLE, XPath evaluated with wrong context