Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita586cc4

Browse files
committed
Use a fd opened for read/write when syncing slots during startup, take 2.
Cribbing fromdfbaed4: 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 in82a5649. Re-apply, and add acomment.Bug: 16039Reported-By: Hans BuschmannAuthor: Andres FreundDiscussion:https://postgr.es/m/16039-196fc97cc05e141c@postgresql.orgBackpatch: 12-, as82a5649
1 parentad7595b commita586cc4

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

‎src/backend/replication/slot.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1386,7 +1386,8 @@ RestoreSlotFromDisk(const char *name)
13861386

13871387
elog(DEBUG1,"restoring replication slot from \"%s\"",path);
13881388

1389-
fd=OpenTransientFile(path,O_RDONLY |PG_BINARY);
1389+
/* on some operating systems fsyncing a file requires O_RDWR */
1390+
fd=OpenTransientFile(path,O_RDWR |PG_BINARY);
13901391

13911392
/*
13921393
* We do not need to handle this as we are rename()ing the directory into

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp