From cf131fa942855acd42e8283185837566c7e8c15e Mon Sep 17 00:00:00 2001 From: Nathan Bossart Date: Tue, 25 Mar 2025 16:02:35 -0500 Subject: initdb: Add --no-sync-data-files. This new option instructs initdb to skip synchronizing any files in database directories, the database directories themselves, and the tablespace directories, i.e., everything in the base/ subdirectory and any other tablespace directories. Other files, such as those in pg_wal/ and pg_xact/, will still be synchronized unless --no-sync is also specified. --no-sync-data-files is primarily intended for internal use by tools that separately ensure the skipped files are synchronized to disk. A follow-up commit will use this to help optimize pg_upgrade's file transfer step. The --sync-method=fsync implementation of this option makes use of a new exclude_dir parameter for walkdir(). When not NULL, exclude_dir specifies a directory to skip processing. The --sync-method=syncfs implementation of this option just skips synchronizing the non-default tablespace directories. This means that initdb will still synchronize some or all of the database files, but there's not much we can do about that. Discussion: https://postgr.es/m/Zyvop-LxLXBLrZil%40nathan --- doc/src/sgml/ref/initdb.sgml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'doc/src') diff --git a/doc/src/sgml/ref/initdb.sgml b/doc/src/sgml/ref/initdb.sgml index 0026318485a..2f1f9a42f90 100644 --- a/doc/src/sgml/ref/initdb.sgml +++ b/doc/src/sgml/ref/initdb.sgml @@ -527,6 +527,33 @@ PostgreSQL documentation + + + + + By default, initdb safely writes all database files + to disk. This option instructs initdb to skip + synchronizing all files in the individual database directories, the + database directories themselves, and the tablespace directories, i.e., + everything in the base subdirectory and any other + tablespace directories. Other files, such as those in + pg_wal and pg_xact, will still be + synchronized unless the option is also + specified. + + + Note that if is used in + conjuction with , some or all of + the aforementioned files and directories will be synchronized because + syncfs processes entire file systems. + + + This option is primarily intended for internal use by tools that + separately ensure the skipped files are synchronized to disk. + + + + -- cgit v1.2.3