diff options
author | Andres Freund <andres@anarazel.de> | 2019-10-04 13:08:51 -0700 |
---|---|---|
committer | Andres Freund <andres@anarazel.de> | 2019-10-04 13:34:39 -0700 |
commit | c025165da9da469ff0136a3eda0070c2b7b6f97e (patch) | |
tree | 1e3c2e0a841636e3e518d7881f4a21ad5da03389 /src/backend/commands/trigger.c | |
parent | ec38d2311124b7e59a1dad20a814f705884bd38a (diff) | |
download | postgresql-c025165da9da469ff0136a3eda0070c2b7b6f97e.tar.gz postgresql-c025165da9da469ff0136a3eda0070c2b7b6f97e.zip |
Use a fd opened for read/write when syncing slots during startup, take 2.
Cribbing from dfbaed45975:
Some operating systems, including the reporter's windows, return EBADFD
or similar when fsync() is invoked on a O_RDONLY file descriptor.
Unfortunately RestoreSlotFromDisk() does exactly that; which causes
failures after restarts in at least some scenarios.
If you hit the bug the error message will be something like
ERROR: could not fsync file "pg_replslot/$name/state": Bad file descriptor
Simply use O_RDWR instead of O_RDONLY when opening the relevant file
descriptor to fix the bug.
Unfortunately this fix was undone in 82a5649fb9db. Re-apply, and add a
comment.
Bug: 16039
Reported-By: Hans Buschmann
Author: Andres Freund
Discussion: https://postgr.es/m/16039-196fc97cc05e141c@postgresql.org
Backpatch: 12-, as 82a5649fb9db
Diffstat (limited to 'src/backend/commands/trigger.c')
0 files changed, 0 insertions, 0 deletions