Skip to content

Commit 123c534

Browse files
JelteFhackorum
authored andcommitted
Move recovery_init_sync_method GUC to WAL_RECOVERY group
The recovery_init_sync_method GUC was separated from all other recovery related GUCS in our docs. This made it pretty hard to find in the docs if you don't know exactly what you're looking for. This moves it to the generic "Recovery" section on the WAL page. While it's not really related to WAL it still seems a much more natural place than the "Error handling" page. Especially because of the description of this subheading: > This section describes the settings that apply to recovery in general, > affecting crash recovery, streaming replication and archive-based > replication. To make this doc change it also updates the group and place in postgresql.conf accordingly. The latter of which also required changing the section header in postgresql.conf.sample to match the header in the docs. The only recovery related GUC that exists that's not on the WAL page is recovery_min_apply_delay, which is under the Replication->Standby section. Since that GUC is only valid on standbys that seems like a sensible choice.
1 parent 086f6f1 commit 123c534

3 files changed

Lines changed: 45 additions & 45 deletions

File tree

doc/src/sgml/config.sgml

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -4246,6 +4246,45 @@ include_dir 'conf.d'
42464246
</listitem>
42474247
</varlistentry>
42484248

4249+
<varlistentry id="guc-recovery-init-sync-method" xreflabel="recovery_init_sync_method">
4250+
<term><varname>recovery_init_sync_method</varname> (<type>enum</type>)
4251+
<indexterm>
4252+
<primary><varname>recovery_init_sync_method</varname> configuration parameter</primary>
4253+
</indexterm>
4254+
</term>
4255+
<listitem>
4256+
<para>
4257+
When set to <literal>fsync</literal>, which is the default,
4258+
<productname>PostgreSQL</productname> will recursively open and
4259+
synchronize all files in the data directory before crash recovery
4260+
begins. The search for files will follow symbolic links for the WAL
4261+
directory and each configured tablespace (but not any other symbolic
4262+
links). This is intended to make sure that all WAL and data files are
4263+
durably stored on disk before replaying changes. This applies whenever
4264+
starting a database cluster that did not shut down cleanly, including
4265+
copies created with <application>pg_basebackup</application>.
4266+
</para>
4267+
<para>
4268+
On Linux, <literal>syncfs</literal> may be used instead, to ask the
4269+
operating system to synchronize the file systems that contain the
4270+
data directory, the WAL files and each tablespace (but not any other
4271+
file systems that may be reachable through symbolic links). This may
4272+
be a lot faster than the <literal>fsync</literal> setting, because it
4273+
doesn't need to open each file one by one. On the other hand, it may
4274+
be slower if a file system is shared by other applications that
4275+
modify a lot of files, since those files will also be written to disk.
4276+
Furthermore, on versions of Linux before 5.8, I/O errors encountered
4277+
while writing data to disk may not be reported to
4278+
<productname>PostgreSQL</productname>, and relevant error messages may
4279+
appear only in kernel logs.
4280+
</para>
4281+
<para>
4282+
This parameter can only be set in the
4283+
<filename>postgresql.conf</filename> file or on the server command line.
4284+
</para>
4285+
</listitem>
4286+
</varlistentry>
4287+
42494288
</variablelist>
42504289
</sect2>
42514290

@@ -12269,45 +12308,6 @@ dynamic_library_path = '/usr/local/lib/postgresql:$libdir'
1226912308
</listitem>
1227012309
</varlistentry>
1227112310

12272-
<varlistentry id="guc-recovery-init-sync-method" xreflabel="recovery_init_sync_method">
12273-
<term><varname>recovery_init_sync_method</varname> (<type>enum</type>)
12274-
<indexterm>
12275-
<primary><varname>recovery_init_sync_method</varname> configuration parameter</primary>
12276-
</indexterm>
12277-
</term>
12278-
<listitem>
12279-
<para>
12280-
When set to <literal>fsync</literal>, which is the default,
12281-
<productname>PostgreSQL</productname> will recursively open and
12282-
synchronize all files in the data directory before crash recovery
12283-
begins. The search for files will follow symbolic links for the WAL
12284-
directory and each configured tablespace (but not any other symbolic
12285-
links). This is intended to make sure that all WAL and data files are
12286-
durably stored on disk before replaying changes. This applies whenever
12287-
starting a database cluster that did not shut down cleanly, including
12288-
copies created with <application>pg_basebackup</application>.
12289-
</para>
12290-
<para>
12291-
On Linux, <literal>syncfs</literal> may be used instead, to ask the
12292-
operating system to synchronize the file systems that contain the
12293-
data directory, the WAL files and each tablespace (but not any other
12294-
file systems that may be reachable through symbolic links). This may
12295-
be a lot faster than the <literal>fsync</literal> setting, because it
12296-
doesn't need to open each file one by one. On the other hand, it may
12297-
be slower if a file system is shared by other applications that
12298-
modify a lot of files, since those files will also be written to disk.
12299-
Furthermore, on versions of Linux before 5.8, I/O errors encountered
12300-
while writing data to disk may not be reported to
12301-
<productname>PostgreSQL</productname>, and relevant error messages may
12302-
appear only in kernel logs.
12303-
</para>
12304-
<para>
12305-
This parameter can only be set in the
12306-
<filename>postgresql.conf</filename> file or on the server command line.
12307-
</para>
12308-
</listitem>
12309-
</varlistentry>
12310-
1231112311
</variablelist>
1231212312

1231312313
</sect1>

src/backend/utils/misc/guc_parameters.dat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2450,7 +2450,7 @@
24502450
boot_val => '""',
24512451
},
24522452

2453-
{ name => 'recovery_init_sync_method', type => 'enum', context => 'PGC_SIGHUP', group => 'ERROR_HANDLING_OPTIONS',
2453+
{ name => 'recovery_init_sync_method', type => 'enum', context => 'PGC_SIGHUP', group => 'WAL_RECOVERY',
24542454
short_desc => 'Sets the method for synchronizing the data directory before crash recovery.',
24552455
variable => 'recovery_init_sync_method',
24562456
boot_val => 'DATA_DIR_SYNC_METHOD_FSYNC',

src/backend/utils/misc/postgresql.conf.sample

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -283,11 +283,12 @@
283283
#max_wal_size = 1GB
284284
#min_wal_size = 80MB
285285

286-
# - Prefetching during recovery -
286+
# - Recovery -
287287

288-
#recovery_prefetch = try # prefetch pages referenced in the WAL?
289-
#wal_decode_buffer_size = 512kB # lookahead window used for prefetching
290-
# (change requires restart)
288+
#recovery_prefetch = try # prefetch pages referenced in the WAL?
289+
#wal_decode_buffer_size = 512kB # lookahead window used for prefetching
290+
# (change requires restart)
291+
#recovery_init_sync_method = fsync # fsync, syncfs (Linux 5.8+)
291292

292293
# - Archiving -
293294

@@ -912,7 +913,6 @@
912913
#data_sync_retry = off # retry or panic on failure to fsync
913914
# data?
914915
# (change requires restart)
915-
#recovery_init_sync_method = fsync # fsync, syncfs (Linux 5.8+)
916916

917917

918918
#------------------------------------------------------------------------------

0 commit comments

Comments
 (0)