Re: Unlogged relation copy is not fsync'd - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: Unlogged relation copy is not fsync'd
Date
Msg-id ZPlTTsQRMTdYYxHg@paquier.xyz
Whole thread Raw
In response to Re: Unlogged relation copy is not fsync'd  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
On Tue, Sep 05, 2023 at 02:20:18PM -0400, Robert Haas wrote:
> The general rule throughout the system is that the init-fork of an
> unlogged relation is treated the same as a permanent relation: it is
> WAL-logged and fsyncd. But the other forks of an unlogged relation are
> neither WAL-logged nor fsync'd ... except in the case of a clean
> shutdown, when we fsync even that data.
>
> In other words, somehow it feels like we ought to be trying to defer
> the fsync here until a clean shutdown actually occurs, instead of
> performing it immediately. Admittedly, the bookkeeping seems like a
> problem, so maybe this is the best we can do, but it's clearly worse
> than what we do in other cases.

That's where we usually rely more on RegisterSyncRequest() and
register_dirty_segment() so as the flush of the dirty segments can
happen when they should, but we don't go through the shared buffers
when copying all the forks of a relation file across tablespaces..
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: pg_basebackup: Always return valid temporary slot names
Next
From: vignesh C
Date:
Subject: Re: persist logical slots to disk during shutdown checkpoint