Skip to content

Commit b8e19b9

Browse files
committed
Flush logical mapping files with fd opened for read/write at checkpoint
The file descriptor was opened with read-only to fsync a regular file, which would cause EBADFD errors on some platforms. This is similar to the recent fix done by a586cc4 (which was broken by me with 82a5649), except that I noticed this issue while monitoring the backend code for similar mistakes. Backpatch to 9.4, as this has been introduced since logical decoding exists as of b89e151. Author: Michael Paquier Reviewed-by: Andres Freund Discussion: https://postgr.es/m/20191006045548.GA14532@paquier.xyz Backpatch-through: 9.4
1 parent 1634d36 commit b8e19b9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/backend/access/heap/rewriteheap.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1280,7 +1280,8 @@ CheckPointLogicalRewriteHeap(void)
12801280
}
12811281
else
12821282
{
1283-
int fd = OpenTransientFile(path, O_RDONLY | PG_BINARY);
1283+
/* on some operating systems fsyncing a file requires O_RDWR */
1284+
int fd = OpenTransientFile(path, O_RDWR | PG_BINARY);
12841285

12851286
/*
12861287
* The file cannot vanish due to concurrency since this function

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy