Re: should frontend tools use syncfs() ?
Michael Paquier <michael@paquier.xyz>
From: Michael Paquier <michael@paquier.xyz>
To: Justin Pryzby <pryzby@telsasoft.com>
Cc: Thomas Munro <thomas.munro@gmail.com>, David Steele <david@pgmasters.net>, Fujii Masao <masao.fujii@oss.nttdata.com>, Bruce Momjian <bruce@momjian.us>, Paul Guo <guopa@vmware.com>, Tom Lane <tgl@sss.pgh.pa.us>, Michael Brown <michael.brown@discourse.org>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2021-09-30T03:49:36Z
Lists: pgsql-hackers
On Wed, Sep 29, 2021 at 07:43:41PM -0500, Justin Pryzby wrote: > Forking this thread in which Thomas implemented syncfs for the startup process > (61752afb2). > https://www.postgresql.org/message-id/flat/CA%2BhUKG%2BSG9jSW3ekwib0cSdC0yD-jReJ21X4bZAmqxoWTLTc2A%40mail.gmail.com > > Is there any reason that initdb/pg_basebackup/pg_checksums/pg_rewind shouldn't > use syncfs() ? That makes sense. > do_syncfs() is in src/backend/ so would need to be duplicated^Wimplemented in > common. The fd handling in the backend makes things tricky if trying to plug in a common interface, so I'd rather do that as this is frontend-only code. > They can't use the GUC, so need to add an cmdline option or look at an > environment variable. fsync_pgdata() is going to manipulate many inodes anyway, because that's a code path designed to do so. If we know that syncfs() is just going to be better, I'd rather just call it by default if available and not add new switches to all the frontend tools in need of flushing the data folder, switches that are not documented in your patch. -- Michael
Commits
-
Adjust documentation for syncfs().
- 44a4cca9913b 17.0 landed
-
Improve the naming in wal_sync_method code.
- 8d140c58229d 17.0 landed
-
Allow using syncfs() in frontend utilities.
- 8c16ad3b4329 17.0 landed
-
Add support for syncfs() in frontend support functions.
- cccc6cdeb32f 17.0 landed
-
Make enum for sync methods available to frontend code.
- 3ed19567198d 17.0 landed
-
Move PG_TEMP_FILE* macros to file_utils.h.
- f39b265808bd 17.0 landed
-
Change client-side fsync_fname() to report errors fatally
- 1420617b14e2 13.0 cited