Skip to content

Commit c5a5bd0

Browse files
committed
Fix missing fsync of SLRU directories.
Harmonize behavior by moving reponsibility for fsyncing directories down into slru.c. In 10 and later, only the multixact directories were missed (see commit 1b02be2), and in older branches all SLRUs were missed. Back-patch to all supported releases. Reviewed-by: Andres Freund <andres@anarazel.de> Reviewed-by: Michael Paquier <michael@paquier.xyz> Discussion: https://postgr.es/m/CA%2BhUKGLtsTUOScnNoSMZ-2ZLv%2BwGh01J6kAo_DM8mTRq1sKdSQ%40mail.gmail.com
1 parent c1f63c4 commit c5a5bd0

File tree

3 files changed

+4
-13
lines changed

3 files changed

+4
-13
lines changed

src/backend/access/transam/clog.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -837,13 +837,6 @@ CheckPointCLOG(void)
837837
/* Flush dirty CLOG pages to disk */
838838
TRACE_POSTGRESQL_CLOG_CHECKPOINT_START(true);
839839
SimpleLruFlush(ClogCtl, true);
840-
841-
/*
842-
* fsync pg_xact to ensure that any files flushed previously are durably
843-
* on disk.
844-
*/
845-
fsync_fname("pg_xact", true);
846-
847840
TRACE_POSTGRESQL_CLOG_CHECKPOINT_DONE(true);
848841
}
849842

src/backend/access/transam/commit_ts.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -761,12 +761,6 @@ CheckPointCommitTs(void)
761761
{
762762
/* Flush dirty CommitTs pages to disk */
763763
SimpleLruFlush(CommitTsCtl, true);
764-
765-
/*
766-
* fsync pg_commit_ts to ensure that any files flushed previously are
767-
* durably on disk.
768-
*/
769-
fsync_fname("pg_commit_ts", true);
770764
}
771765

772766
/*

src/backend/access/transam/slru.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1159,6 +1159,10 @@ SimpleLruFlush(SlruCtl ctl, bool allow_redirtied)
11591159
}
11601160
if (!ok)
11611161
SlruReportIOError(ctl, pageno, InvalidTransactionId);
1162+
1163+
/* Ensure that directory entries for new files are on disk. */
1164+
if (ctl->do_fsync)
1165+
fsync_fname(ctl->Dir, true);
11621166
}
11631167

11641168
/*

0 commit comments

Comments
 (0)