Skip to content

Commit dd36d6b

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 b91033a commit dd36d6b

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
@@ -602,13 +602,6 @@ CheckPointCLOG(void)
602602
/* Flush dirty CLOG pages to disk */
603603
TRACE_POSTGRESQL_CLOG_CHECKPOINT_START(true);
604604
SimpleLruFlush(ClogCtl, true);
605-
606-
/*
607-
* fsync pg_xact to ensure that any files flushed previously are durably
608-
* on disk.
609-
*/
610-
fsync_fname("pg_xact", true);
611-
612605
TRACE_POSTGRESQL_CLOG_CHECKPOINT_DONE(true);
613606
}
614607

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
@@ -1160,6 +1160,10 @@ SimpleLruFlush(SlruCtl ctl, bool allow_redirtied)
11601160
}
11611161
if (!ok)
11621162
SlruReportIOError(ctl, pageno, InvalidTransactionId);
1163+
1164+
/* Ensure that directory entries for new files are on disk. */
1165+
if (ctl->do_fsync)
1166+
fsync_fname(ctl->Dir, true);
11631167
}
11641168

11651169
/*

0 commit comments

Comments
 (0)