Re: CREATE DATABASE with filesystem cloning - Mailing list pgsql-hackers

From Ranier Vilela
Subject Re: CREATE DATABASE with filesystem cloning
Date
Msg-id CAEudQAowFaOJfBw_=+f1QLvOKE5F4sMNdFPuiuuyyNWXGik6bA@mail.gmail.com
Whole thread Raw
In response to CREATE DATABASE with filesystem cloning  (Thomas Munro <thomas.munro@gmail.com>)
List 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

pgsql-hackers by date:

Previous
From: Michail Nikolaev
Date:
Subject: Re: Revisiting {CREATE INDEX, REINDEX} CONCURRENTLY improvements
Next
From: Robert Haas
Date:
Subject: Re: WHERE CURRENT OF with RLS quals that are ctid conditions