On 2016-03-05 22:25:36 +0900, Michael Paquier wrote: > OK, I hacked a v7: > - Move the link()/rename() group with HAVE_WORKING_LINK into a single > routine, making the previous link_safe renamed to replace_safe. This > is sharing a lot of things with rename_safe. I am not sure it is worth > complicating the code more this way by having a common single routine > for whole. Thoughts welcome. Honestly, I kind of liked the separation > with link_safe/rename_safe of previous patches because link_safe could > have been directly used by extensions and plugins btw. > - Remove the call of stat() in rename_safe() and implement a logic > depending on OpenTransientFile()/pg_fsync() to flush any existing > target file before performing the rename. > Andres, feel free to use this patch as a base, perhaps that will help.
I started working on this; delayed by taking longer than planned on the logical decoding stuff (quite a bit complicated by e1a11d93111ff3fba7a91f3f2ac0b0aca16909a8). I'm not very happy with the error handling as it is right now. For one, you have rename_safe return error codes, and act on them in the callers, but on the other hand you call fsync_fname which always errors out in case of failure. I also don't like the new messages much. Will continue working on this tomorrow. Andres Freund -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers