Re: Allow replication roles to use file access functions

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, Stephen Frost <sfrost(at)snowman(dot)net>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Andres Freund <andres(at)anarazel(dot)de>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Allow replication roles to use file access functions
Date: 2015-09-04 07:33:59
Message-ID: 55E94967.2010109@iki.fi
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 09/04/2015 08:14 AM, Michael Paquier wrote:
> On Thu, Sep 3, 2015 at 9:53 PM, Stephen Frost <sfrost(at)snowman(dot)net> wrote:
>> * Michael Paquier (michael(dot)paquier(at)gmail(dot)com) wrote:
>>> On Thu, Sep 3, 2015 at 11:20 AM, Stephen Frost wrote:
>>>>> Not only, +clog, configuration files, etc.
>>>>
>>>> Configuration files? Perhaps you could elaborate?
>>>
>>> Sure. Sorry for being unclear. It copies everything that is not a
>>> relation file, a kind of base backup without the relation files then.
>>
>> How does that work on systems where the configuration files aren't
>> stored under PGDATA (Debian and derivatives, at least)?
>
> When a file is out of PGDATA, it is not fetched. Symlinks in PGDATA
> have their contents fetched as well if I recall correctly.
>
>> I guess I don't
>> quite see why it's necessary for pg_rewind to copy the configuration
>> files in the first place, it doesn't have the same role as
>> pg_basebackup, at least as I understand it.
>
> Of course, that's not mandatory to fetch them. It is as well not worth
> the complication to apply a filter to not fetch a portion of the
> files, and I think that's why Heikki took the approach to fetch
> everything in PGDATA (except relation files) because that was just
> more simple to implement as such for little gain.

It's also simpler to explain and reason about. The current behaviour of
pg_rewind is that the end-result is basically the same as completely
copying over the data directory. If we start to add smarts on what to
copy and what not, it gets a lot more complicated. Which configuration
files to copy, and which not? (Think postgresql.auto.conf...)

If you want to preserve a file, you can copy it elsewhere first, and
copy it back after running pg_rewind. Just as you would with "cp" or
"rsync" (well, with rsync I guess you could pass a command-line switch
to ignore some files). That might not be perfect, but it's a problem
you'll have to deal with if you're not using pg_rewind anyway.

- Heikki

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2015-09-04 07:38:36 Re: [PATCH] SQL function to report log message
Previous Message Kyotaro HORIGUCHI 2015-09-04 06:45:13 Re: [POC] FETCH limited by bytes.