Re: fdatasync performance problem with large number of DB files

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@postgresql.org
Date: 2021-06-04T07:24:02Z
Lists: pgsql-hackers
On Sat, May 29, 2021 at 02:23:21PM -0500, Justin Pryzby wrote:
> On Tue, May 25, 2021 at 07:13:59PM -0500, Justin Pryzby wrote:
>> On Sat, Mar 20, 2021 at 12:16:27PM +1300, Thomas Munro wrote:
>> > > > +     {
>> > > > +             {"recovery_init_sync_method", PGC_POSTMASTER, ERROR_HANDLING_OPTIONS,
>> > > > +                     gettext_noop("Sets the method for synchronizing the data directory before crash recovery."),
>> > > > +             },
>> 
>> Is there any reason why this can't be PGC_SIGHUP ?
> 
> I can't see any reason why this is nontrivial.

I think that we had better let recovery_init_sync_method as
PGC_POSTMASTER, to stay on the safe side.  SyncDataDirectory() only
gets called now in the backend code by the startup process after a
crash at the beginning of recovery, so switching to PGC_SIGHUP would
have zero effect to begin with.  Now, let's not forget that
SyncDataDirectory() is a published API, and if anything exterior were
to call that, it does not seem right to me to make that its behavior
reloadable at will.
--
Michael

Commits

  1. Change recovery_init_sync_method to PGC_SIGHUP.

  2. Provide recovery_init_sync_method=syncfs.