Re: CREATE DATABASE with filesystem cloning

From: Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>
To: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>, "byavuz81(at)gmail(dot)com" <byavuz81(at)gmail(dot)com>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, Peter Eisentraut <peter(at)eisentraut(dot)org>
Subject: Re: CREATE DATABASE with filesystem cloning
Date: 2024-05-07 13:28:19
Message-ID: CAEudQAowFaOJfBw_=+f1QLvOKE5F4sMNdFPuiuuyyNWXGik6bA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

Nazir Bilal Yavuz <byavuz81(at)gmail(dot)com> wrote:

>Any kind of feedback would be appreciated.

I know it's coming from copy-and-paste, but
I believe the flags could be:
- dstfd = OpenTransientFile(tofile, O_RDWR | O_CREAT | O_EXCL | PG_BINARY);
+ dstfd = OpenTransientFile(tofile, O_CREAT | O_WRONLY | O_TRUNC | O_EXCL |
PG_BINARY);

The flags:
O_WRONLY | O_TRUNC

Allow the OS to make some optimizations, if you deem it possible.

The flag O_RDWR indicates that the file can be read, which is not true in
this case.
The destination file will just be written.

best regards,
Ranier Vilela

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2024-05-07 13:47:10 Re: WHERE CURRENT OF with RLS quals that are ctid conditions
Previous Message Michail Nikolaev 2024-05-07 12:35:13 Re: Revisiting {CREATE INDEX, REINDEX} CONCURRENTLY improvements