Re: O_DIRECT on macOS

From: Andres Freund <andres(at)anarazel(dot)de>
To: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: O_DIRECT on macOS
Date: 2021-05-30 20:12:44
Message-ID: 20210530201244.6mv5q7yhrjpeo5mc@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

Thanks for starting the discussion on this!

On 2021-05-30 16:39:48 +1200, Thomas Munro wrote:
> I thought about a few different ways to encapsulate this API
> difference in PostgreSQL, and toyed with two:
>
> 1. We could define our own fake O_DIRECT flag, and translate that to
> the right thing inside BasicOpenFilePerm(). That seems a bit icky.
> We'd have to be careful not to collide with system defined flags and
> worry about changes. We do that sort of thing for Windows, though
> that's a bit different, there we translate *all* the flags from
> POSIXesque to Windowsian.
>
> 2. We could make an extended BasicOpenFilePerm() variant that takes a
> separate boolean parameter for direct, so that we don't have to hijack
> any flag space, but now we need new interfaces just to tolerate a
> rather niche system.

I don't think 2) really covers the problem on its own. It's fine for
things that directly use BasicOpenFilePerm(), but what about "virtual
file descriptors" (PathNameOpenFile())? I.e. what md.c et al use? There
we need to store the fact that we want non-buffered IO as part of the
vfd, otherwise we'll loose that information when re-opening the file
later.

Greetings,

Andres Freund

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tomas Vondra 2021-05-30 20:22:10 postgres_fdw batching vs. (re)creating the tuple slots
Previous Message Tomas Vondra 2021-05-30 20:05:21 Re: list of extended statistics on psql (\dX)