From: | Nazir Bilal Yavuz <byavuz81(at)gmail(dot)com> |
---|---|
To: | Thomas Munro <thomas(dot)munro(at)gmail(dot)com> |
Cc: | Peter Eisentraut <peter(at)eisentraut(dot)org>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: CREATE DATABASE with filesystem cloning |
Date: | 2024-05-07 12:00:11 |
Message-ID: | CAN55FZ34ESJiGJ=Jst1278OKtxP89VKxtC7s2u=uLDYZGEKxSQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi,
On Wed, 6 Mar 2024 at 05:17, Thomas Munro <thomas(dot)munro(at)gmail(dot)com> wrote:
>
> The main thing that is missing is support for redo. It's mostly
> trivial I think, probably just a record type for "try cloning first"
> and then teaching that clone function to fall back to the regular copy
> path if it fails in recovery, do you agree with that idea? Another
> approach would be to let it fail if it doesn't work on the replica, so
> you don't finish up using dramatically different amounts of disk
> space, but that seems terrible because now your replica is broken. So
> probably fallback with logged warning (?), though I'm not sure exactly
> which errnos to give that treatment to.
We had an off-list talk with Thomas and we thought making this option
GUC instead of SQL command level could solve this problem.
I am posting a new rebased version of the patch with some important changes:
* 'createdb_file_copy_method' GUC is created. Possible values are
'copy' and 'clone'. Copy is the default option. Clone option can be
chosen if the system supports it, otherwise it gives error at the
startup.
* #else part of the clone_file() function calls pg_unreachable()
instead of ereport().
* Documentation updates.
Also, what should happen when the kernel has clone support but the
file system does not?
- I tested this on Linux and copy_file_range() silently uses normal
copy when this happens. I assume the same thing will happen for
FreeBSD because it uses the copy_file_range() function as well.
- I am not sure about MacOS since the force flag
(COPYFILE_CLONE_FORCE) is used. I do not have MacOS so I can not test
it but I assume it will error out when this happens. If that is the
case, is this a problem? I am asking that since this is a GUC now, the
user will have the full responsibility.
Any kind of feedback would be appreciated.
--
Regards,
Nazir Bilal Yavuz
Microsoft
Attachment | Content-Type | Size |
---|---|---|
v5-0001-Use-CLONE-method-with-GUC-on-CREATE-DATABASE-.-ST.patch | text/x-patch | 14.1 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Andrew Dunstan | 2024-05-07 12:00:25 | Re: Revert: Remove useless self-joins *and* -DREALLOCATE_BITMAPSETS make server crash, regress test fail. |
Previous Message | Alexander Korotkov | 2024-05-07 11:45:48 | Re: Revert: Remove useless self-joins *and* -DREALLOCATE_BITMAPSETS make server crash, regress test fail. |