Re: Patch to add hook to copydir()

From: Swen Kooij <swenkooij(at)gmail(dot)com>
To: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
Cc: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Patch to add hook to copydir()
Date: 2019-09-07 06:48:25
Message-ID: CACUs8SsFpxqrO7zoYYxjLEakgF95S7Nst4+vSti=2m01SQbS9Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Should I forget about getting such a patch in?

I am up for implementing alternative solutions if the current
one is considered unacceptable. As I tried to demonstrate
in my last email, previous attempts also failed.

On Tue, Sep 3, 2019 at 12:14 PM Swen Kooij <swenkooij(at)gmail(dot)com> wrote:
>
> I read two previous proposals for something similar.
>
> First one is from 2013 [0]. It proposed a OS and filesystem specific
> implementation. Which was then changed to a patch that adds a
> config option to specify shell commands that postgres should use
> for copying files and dirs. This was after commentary that such a
> feature is better suited for an extension. Which is what I am trying to do.
>
> What was true in 2013 (when the other patch was proposed) is still
> true. There's no good way at the moment to hook into how postgres
> copies files and directories.
>
> The second thread I found from 2018 [1] proposes filesystem specific
> changes (BTRFS, APFS and XFS) that operate on a file level. Really
> nice patch actually, but much more invasive than what I am proposing.
>
>
> Both patches make rather invasive and significant changes specific
> to the features they're trying to build. The general sentiment I got
> from reading those two threads is that building in support for these
> kind of features is hard and is probably better first done as an extension.
>
> I understand that the patch I proposed is not an ideal interface,
> but it gets the job done without having to built this kind of
> functionality into postgres. I am not proposing any filesystem
> or OS specific hooks/changes in postgres to make this work.
>
> I tried to override the copydir() function without any hooks
> and I haven't gotten it to work yet. If it does, I'd still prefer the
> hook. It's more predictable and probably more portable.
>
> [0] https://www.postgresql.org/message-id/511B5D11.4040507@socialserve.com
> [1] https://www.postgresql.org/message-id/bc9ca382-b98d-0446-f699-8c5de2307ca7%402ndquadrant.com
>
> On Tue, Sep 3, 2019 at 9:48 AM Peter Eisentraut
> <peter(dot)eisentraut(at)2ndquadrant(dot)com> wrote:
> >
> > On 2019-09-02 22:16, Swen Kooij wrote:
> > > Is there anything that I am missing? My early experiments have been
> > > very promising but my experience with Postgres internals is limited. Any
> > > help or feedback would be much appreciated.
> >
> > You might want to review several previous threads that were
> > contemplating doing some reflink stuff with btrfs during database
> > creation. Not exactly what you are doing, but related.
> >
> > Also, wouldn't it work if your extension just defined its own copydir()
> > in the .so? That should then be used over the built-in one -- maybe.
> >
> > --
> > Peter Eisentraut http://www.2ndQuadrant.com/
> > PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Fabien COELHO 2019-09-07 06:54:42 Re: BUG #15977: Inconsistent behavior in chained transactions
Previous Message Michael Paquier 2019-09-07 02:58:14 Re: Compiler warnings with MinGW