From: | Thomas Munro <thomas(dot)munro(at)gmail(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Michael Brown <michael(dot)brown(at)discourse(dot)org>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: fdatasync performance problem with large number of DB files |
Date: | 2021-03-14 22:52:35 |
Message-ID: | CA+hUKGLABi5asn5yFXBrAC0d3dGBN8QHvLq=27sa7thCQV4Z1w@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Thu, Mar 11, 2021 at 2:32 PM Thomas Munro <thomas(dot)munro(at)gmail(dot)com> wrote:
> On Thu, Mar 11, 2021 at 2:25 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> > Trolling the net, I found a newer-looking version of the man page,
> > and behold it says
> >
> > In mainline kernel versions prior to 5.8, syncfs() will fail only
> > when passed a bad file descriptor (EBADF). Since Linux 5.8,
> > syncfs() will also report an error if one or more inodes failed
> > to be written back since the last syncfs() call.
> >
> > So this means that in less-than-bleeding-edge kernels, syncfs can
> > only be regarded as a dangerous toy. If we expose an option to use
> > it, there had better be large blinking warnings in the docs.
>
> Agreed. Perhaps we could also try to do something programmatic about that.
Time being of the essence, here is the patch I posted last year, this
time with a GUC and some docs. You can set sync_after_crash to
"fsync" (default) or "syncfs" if you have it.
I would plan to extend that to include a third option as already
discussed in the other thread, maybe something like "wal" (= sync WAL
files and then do extra analysis of WAL data to sync only data
modified since checkpoint but not replayed), but that'd be material
for PG15.
Attachment | Content-Type | Size |
---|---|---|
v2-0001-Optionally-use-syncfs-for-SyncDataDirectory-on-Li.patch | text/x-patch | 9.8 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Avinash Kumar | 2021-03-14 23:14:40 | Postgres crashes at memcopy() after upgrade to PG 13. |
Previous Message | Justin Pryzby | 2021-03-14 20:06:18 | Re: [HACKERS] GSoC 2017: Foreign Key Arrays |