Thread: [HACKERS] Patch: restrict pg_rewind to whitelisted directories

[HACKERS] Patch: restrict pg_rewind to whitelisted directories

From
Chris Travers
Date:
The attached patch is cleaned up and filed for the commit fest this next month:

Here's the full commit message via Mercurial.  I will likely have a new branch per version the patch since that's the closest thing to a rebase in this version control system.

changeset:   60492:47f87a2d2fa1

tag:         mine/pg_rewind_restrict_dirs

parent:      60446:e638ba9c3c11

user:        Chris Travers <chris.travers@gmail.com>

date:        Mon Oct 30 12:25:18 2017 +0100

files:       doc/src/sgml/ref/pg_rewind.sgml src/bin/pg_rewind/copy_fetch.c src/bin/pg_rewind/fetch.c src/bin/pg_rewind/fetch.h src/bin/pg_rewind/libpq_fetch.c src/bin/pg_rewind/pg_rewind.c src/bin/pg_rewind/t/003_extrafiles.pl

description:

Restrict pg_rewind to whitelisted directories.


This is intended to be a minimum working version and in fact builds and passes tests.

Note that tests for extra files have been changed to reflect new behavior and additional

debugging informnation added in to output in case of failure.


The patch iterates through a series of set directories to synchronize them only.  This improves

predictability of the complete state of the system after a rewind.


One important outstanding question here is whether we need to ensure the possibility of backing

up other files if they exist via an --include-path command line switch (this would not be a glob).

In the thread discussing this patch, Michael Paquier has expressed concern about configuration

files created by extensions or other components not being copied.  I could add such a switch but

the patch is long enough, and it is unclear enough to the extent this is needed at present, so

I am leaving it at the reviewer's discretion whether I should add this here or submit a second

patch later to add the ability to add additional paths to the filemap.


Either way, it is worth noting that I expect to have a subsequent patch either incorporated here or in a further submission that takes this and adds the ability to include additional directories or files via a command line flag.  This will *not* be a shell glob but one directory or file per invocation of the switch (similar to -t in pg_dump).

--
Best Regards,
Chris Travers
Database Administrator

Tel: +49 162 9037 210 | Skype: einhverfr | www.adjust.com 
Saarbrücker Straße 37a, 10405 Berlin

Attachment

Re: [HACKERS] Patch: restrict pg_rewind to whitelisted directories

From
Robert Haas
Date:
On Mon, Oct 30, 2017 at 6:44 PM, Chris Travers <chris.travers@adjust.com> wrote:
> The attached patch is cleaned up and filed for the commit fest this next
> month:

It's generally better to post the patch on the same message as the
discussion thread, or at least link back to the discussion thread from
the new one.  Otherwise people may have trouble understanding the
history.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


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

Re: [HACKERS] Patch: restrict pg_rewind to whitelisted directories

From
Chris Travers
Date:


On Tue, Oct 31, 2017 at 1:38 PM, Robert Haas <robertmhaas@gmail.com> wrote:
On Mon, Oct 30, 2017 at 6:44 PM, Chris Travers <chris.travers@adjust.com> wrote:
> The attached patch is cleaned up and filed for the commit fest this next
> month:

It's generally better to post the patch on the same message as the
discussion thread, or at least link back to the discussion thread from
the new one.  Otherwise people may have trouble understanding the
history.

Fair point.  Mostly concerned about the WIP marker there. This is my first time around this.

I will then retire this thread and attach the patch on the other one.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



--
Best Regards,
Chris Travers
Database Administrator

Tel: +49 162 9037 210 | Skype: einhverfr | www.adjust.com 
Saarbrücker Straße 37a, 10405 Berlin