Skip to content

Commit 3b855b0

Browse files
author
Sokolov Yura
committed
cfs: prefsync original file without lock
durable_rename fsyncs old file. lets fsync it by ourself without lock.
1 parent 069d5ba commit 3b855b0

File tree

1 file changed

+7
-0
lines changed
  • src/backend/storage/file

1 file changed

+7
-0
lines changed

src/backend/storage/file/cfs.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -994,6 +994,13 @@ static bool cfs_gc_file(char* map_path, GC_CALL_KIND background)
994994
}
995995

996996
/* Persist bigger part of copy to not do it under lock */
997+
/* and persist previous file, cause it will be fsynced in durable rename */
998+
if (pg_fsync(fd) < 0)
999+
{
1000+
elog(WARNING, "CFS failed to sync file %s: %m", file_bck_path);
1001+
goto Cleanup;
1002+
}
1003+
9971004
if (pg_fsync(fd2) < 0)
9981005
{
9991006
elog(WARNING, "CFS failed to sync file %s: %m", file_bck_path);

0 commit comments

Comments
 (0)