Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 052014a

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 569f6a8 commit 052014a

File tree

3 files changed

+4
-13
lines changed

3 files changed

+4
-13
lines changed

src/backend/access/transam/clog.c

-7
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(XactCtl, 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

-6
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

+4
Original file line numberDiff line numberDiff line change
@@ -1204,6 +1204,10 @@ SimpleLruFlush(SlruCtl ctl, bool allow_redirtied)
12041204
}
12051205
if (!ok)
12061206
SlruReportIOError(ctl, pageno, InvalidTransactionId);
1207+
1208+
/* Ensure that directory entries for new files are on disk. */
1209+
if (ctl->do_fsync)
1210+
fsync_fname(ctl->Dir, true);
12071211
}
12081212

12091213
/*

0 commit comments

Comments
 (0)