pg.ddx.io  pgbackrest/pgbackrest GitHub issues and pull requests  
help / color / mirror / Atom feed
From: fmbiete (@fmbiete) <noreply+fmbiete@github.com>
To: pgbackrest/pgbackrest <noreply+pgbackrest-pgbackrest@github.com>
Subject: Re: [pgbackrest/pgbackrest] PR #2887: DirectIO
Date: Wed, 04 Nov 2026 14:58:28 +0000
Message-ID: <gh-pgbackrest-pgbackrest-2887-c6633935762@github.com> (raw)
In-Reply-To: <gh-pgbackrest-pgbackrest-2887@github.com>
References: <gh-pgbackrest-pgbackrest-2887@github.com>

I have applied the requested changes
```
    Add configurable direct I/O for repositories and PostgreSQL
    
    Add repo-io-mode and pg-io-mode options to enable direct I/O for POSIX
    and CIFS repositories and PostgreSQL data directories when O_DIRECT is
    available. Probe O_DIRECT and Linux statx(STATX_DIOALIGN), using device
    alignment when reported and a 4096-byte fallback otherwise.
    
    Stage reads and writes through aligned buffers, preserve requested read
    offsets and limits, and truncate padded writes to their logical size.
    Fall back to buffered I/O when opening with O_DIRECT returns EINVAL.
    Flush pending output before seeking, including seeks to the current
    flushed offset.
    
    Add direct-I/O coverage for round trips, offsets, limits, EOF, alignment,
    seek, and I/O errors.
```

If O_DIRECT is slow we could add io_uring, but I don't consider it terribly slow.

> Sure, but if we do this by buffer rather than for the entire file it would work better. I also think a better way to go might be RWF_DONTCACHE with preadv2()/pwritev2().

buffer to buffer we would purge all the cached pages (postgresql side); the cache is global, not particular to a process. Running fadvise in a loop is also extremely slow, it also has to write/sync any dirty page.

RWF_DONTCACHE is interesting, we could add this without flag and auto-discovery, but it would not work for any current RHEL versions. 

view thread (20+ messages)  latest in thread

Message-ID: <gh-pgbackrest-pgbackrest-2887-c6633935762@github.com>
Permalink:  ../gh-pgbackrest-pgbackrest-2887-c6633935762@github.com/

 · 


This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox