aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Paquier <michael@paquier.xyz>2019-10-09 13:31:17 +0900
committerMichael Paquier <michael@paquier.xyz>2019-10-09 13:31:17 +0900
commite34358c436c6bf4e75beb6e9f79f9a207c0b2ed5 (patch)
tree521a29efe50a7ebdeb3d1cff78311520edae96f6
parente4ca62b9488393f1f3a7e982daff544fa90959bf (diff)
downloadpostgresql-e34358c436c6bf4e75beb6e9f79f9a207c0b2ed5.tar.gz
postgresql-e34358c436c6bf4e75beb6e9f79f9a207c0b2ed5.zip
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 a586cc4b (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
-rw-r--r--src/backend/access/heap/rewriteheap.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/backend/access/heap/rewriteheap.c b/src/backend/access/heap/rewriteheap.c
index 5ba83daf1c6..9f0b586b5b6 100644
--- a/src/backend/access/heap/rewriteheap.c
+++ b/src/backend/access/heap/rewriteheap.c
@@ -1278,7 +1278,8 @@ CheckPointLogicalRewriteHeap(void)
}
else
{
- int fd = OpenTransientFile(path, O_RDONLY | PG_BINARY);
+ /* on some operating systems fsyncing a file requires O_RDWR */
+ int fd = OpenTransientFile(path, O_RDWR | PG_BINARY);
/*
* The file cannot vanish due to concurrency since this function