Skip to content

Commit dfb403c

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 31878cc commit dfb403c

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

@@ -12320,45 +12359,6 @@ dynamic_library_path = '/usr/local/lib/postgresql:$libdir'
1232012359
</listitem>
1232112360
</varlistentry>
1232212361

12323-
<varlistentry id="guc-recovery-init-sync-method" xreflabel="recovery_init_sync_method">
12324-
<term><varname>recovery_init_sync_method</varname> (<type>enum</type>)
12325-
<indexterm>
12326-
<primary><varname>recovery_init_sync_method</varname> configuration parameter</primary>
12327-
</indexterm>
12328-
</term>
12329-
<listitem>
12330-
<para>
12331-
When set to <literal>fsync</literal>, which is the default,
12332-
<productname>PostgreSQL</productname> will recursively open and
12333-
synchronize all files in the data directory before crash recovery
12334-
begins. The search for files will follow symbolic links for the WAL
12335-
directory and each configured tablespace (but not any other symbolic
12336-
links). This is intended to make sure that all WAL and data files are
12337-
durably stored on disk before replaying changes. This applies whenever
12338-
starting a database cluster that did not shut down cleanly, including
12339-
copies created with <application>pg_basebackup</application>.
12340-
</para>
12341-
<para>
12342-
On Linux, <literal>syncfs</literal> may be used instead, to ask the
12343-
operating system to synchronize the file systems that contain the
12344-
data directory, the WAL files and each tablespace (but not any other
12345-
file systems that may be reachable through symbolic links). This may
12346-
be a lot faster than the <literal>fsync</literal> setting, because it
12347-
doesn't need to open each file one by one. On the other hand, it may
12348-
be slower if a file system is shared by other applications that
12349-
modify a lot of files, since those files will also be written to disk.
12350-
Furthermore, on versions of Linux before 5.8, I/O errors encountered
12351-
while writing data to disk may not be reported to
12352-
<productname>PostgreSQL</productname>, and relevant error messages may
12353-
appear only in kernel logs.
12354-
</para>
12355-
<para>
12356-
This parameter can only be set in the
12357-
<filename>postgresql.conf</filename> file or on the server command line.
12358-
</para>
12359-
</listitem>
12360-
</varlistentry>
12361-
1236212362
</variablelist>
1236312363

1236412364
</sect1>

‎src/backend/utils/misc/guc_parameters.dat‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2461,7 +2461,7 @@
24612461
boot_val => '""',
24622462
},
24632463

2464-
{ name => 'recovery_init_sync_method', type => 'enum', context => 'PGC_SIGHUP', group => 'ERROR_HANDLING_OPTIONS',
2464+
{ name => 'recovery_init_sync_method', type => 'enum', context => 'PGC_SIGHUP', group => 'WAL_RECOVERY',
24652465
short_desc => 'Sets the method for synchronizing the data directory before crash recovery.',
24662466
variable => 'recovery_init_sync_method',
24672467
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
@@ -284,11 +284,12 @@
284284
#max_wal_size = 1GB
285285
#min_wal_size = 80MB
286286

287-
# - Prefetching during recovery -
287+
# - Recovery -
288288

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

293294
# - Archiving -
294295

@@ -913,7 +914,6 @@
913914
#data_sync_retry = off # retry or panic on failure to fsync
914915
# data?
915916
# (change requires restart)
916-
#recovery_init_sync_method = fsync # fsync, syncfs (Linux 5.8+)
917917

918918

919919
#------------------------------------------------------------------------------

0 commit comments

Comments
 (0)