Skip to content
Snippets Groups Projects
Commit c50f9527 authored by Michael Paquier's avatar Michael Paquier
Browse files

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 82a5649f), 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 b89e1510.

Author: Michael Paquier
Reviewed-by: Andres Freund
Discussion: https://postgr.es/m/20191006045548.GA14532@paquier.xyz
Backpatch-through: 9.4
parent 4fe04a62
No related branches found
Tags
No related merge requests found
......@@ -1272,7 +1272,8 @@ CheckPointLogicalRewriteHeap(void)
}
else
{
int fd = OpenTransientFile(path, O_RDONLY | PG_BINARY, 0);
/* on some operating systems fsyncing a file requires O_RDWR */
int fd = OpenTransientFile(path, O_RDWR | PG_BINARY, 0);
/*
* The file cannot vanish due to concurrency since this function
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment