Re: Postgres, fsync, and OSs (specifically linux)

From: Craig Ringer <craig(at)2ndquadrant(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>, Simon Riggs <simon(at)2ndquadrant(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Postgres, fsync, and OSs (specifically linux)
Date: 2018-04-30 05:03:24
Message-ID: CAMsr+YF=FfuNCcBJXV4tDsxQQ=Yu5GfhZ-z6iiu+Y4x2MYzX0Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hrm, something else that just came up. On 9.6+ we use sync_file_range.
It's surely going to eat errors:

rc = sync_file_range(fd, offset, nbytes,
SYNC_FILE_RANGE_WRITE);

/* don't error out, this is just a performance optimization */
if (rc != 0)
{
ereport(WARNING,
(errcode_for_file_access(),
errmsg("could not flush dirty data: %m")));
}

so that has to panic too.

I'm very suspicious about the safety of the msync() path too.

I'll post an update to my PANIC-everywhere patch that add these cases.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2018-04-30 06:50:13 Re: Local partitioned indexes and pageinspect
Previous Message Craig Ringer 2018-04-30 04:55:22 Re: PostgreSQL's handling of fsync() errors is unsafe and risks data loss at least on XFS