Change default values for backup and replication parameters
authorMagnus Hagander <[email protected]>
Sat, 14 Jan 2017 16:14:56 +0000 (17:14 +0100)
committerMagnus Hagander <[email protected]>
Sat, 14 Jan 2017 16:14:56 +0000 (17:14 +0100)
This changes the default values of the following parameters:

wal_level = replica
max_wal_senders = 10
max_replication_slots = 10

in order to make it possible to make a backup and set up simple
replication on the default settings, without requiring a system restart.

Discussion: https://postgr.es/m/CABUevEy4PR_EAvZEzsbF5s+V0eEvw7shJ2t-AUwbHOjT+yRb3A@mail.gmail.com

Reviewed by Peter Eisentraut. Benchmark help from Tomas Vondra.

doc/src/sgml/backup.sgml
doc/src/sgml/config.sgml
src/backend/utils/misc/guc.c
src/backend/utils/misc/postgresql.conf.sample
src/test/modules/commit_ts/t/002_standby.pl
src/test/modules/commit_ts/t/003_standby_2.pl
src/test/perl/PostgresNode.pm
src/test/recovery/t/006_logical_decoding.pl
src/test/recovery/t/008_fsm_truncation.pl

index 6eaed1efbe9134d3c6ac79098f5f377a734e39f5..d7df91090dbfbc316c8100e615a8195335ea32de 100644 (file)
@@ -1420,7 +1420,8 @@ restore_command = 'cp /mnt/server/archivedir/%f %p'
      <para>
       If more flexibility in copying the backup files is needed, a lower
       level process can be used for standalone hot backups as well.
-      To prepare for low level standalone hot backups, set <varname>wal_level</> to
+      To prepare for low level standalone hot backups, make sure
+      <varname>wal_level</> is set to
       <literal>replica</> or higher, <varname>archive_mode</> to
       <literal>on</>, and set up an <varname>archive_command</> that performs
       archiving only when a <emphasis>switch file</> exists.  For example:
index 30dd54cd5d460a1b25bed3d6d39e3df640dd189f..07afa3c77a78ef740646b9aa7c7c3fe4a6f1b508 100644 (file)
@@ -2183,12 +2183,12 @@ include_dir 'conf.d'
       </term>
       <listitem>
        <para>
-        <varname>wal_level</> determines how much information is written
-        to the WAL. The default value is <literal>minimal</>, which writes
-        only the information needed to recover from a crash or immediate
-        shutdown. <literal>replica</> adds logging required for WAL
-        archiving as well as information required to run
-        read-only queries on a standby server.  Finally,
+        <varname>wal_level</> determines how much information is written to
+        the WAL. The default value is <literal>replica</>, which writes enough
+        data to support WAL archiving and replication, including running
+        read-only queries on a standby server. <literal>minimal</> removes all
+        logging except the information required to recover from a crash or
+        immediate shutdown.  Finally,
         <literal>logical</> adds information necessary to support logical
         decoding.  Each level includes the information logged at all lower
         levels.  This parameter can only be set at server start.
@@ -2926,7 +2926,7 @@ include_dir 'conf.d'
         Specifies the maximum number of concurrent connections from
         standby servers or streaming base backup clients (i.e., the
         maximum number of simultaneously running WAL sender
-        processes). The default is zero, meaning replication is
+        processes). The default is 10. The value 0 means replication is
         disabled. WAL sender processes count towards the total number
         of connections, so the parameter cannot be set higher than
         <xref linkend="guc-max-connections">.  Abrupt streaming client
@@ -2951,7 +2951,7 @@ include_dir 'conf.d'
         <para>
          Specifies the maximum number of replication slots
          (see <xref linkend="streaming-replication-slots">) that the server
-         can support. The default is zero.  This parameter can only be set at
+         can support. The default is 10.  This parameter can only be set at
          server start.
          <varname>wal_level</varname> must be set
          to <literal>replica</literal> or higher to allow replication slots to
index 5b23dbf4a0ef1fc86a5f97a8d8e0d74a86e81d2b..4e2bd4c496afca8bf6482c5eb90f9b754a8f9ba5 100644 (file)
@@ -2315,7 +2315,7 @@ static struct config_int ConfigureNamesInt[] =
            NULL
        },
        &max_wal_senders,
-       0, 0, MAX_BACKENDS,
+       10, 0, MAX_BACKENDS,
        NULL, NULL, NULL
    },
 
@@ -2326,7 +2326,7 @@ static struct config_int ConfigureNamesInt[] =
            NULL
        },
        &max_replication_slots,
-       0, 0, MAX_BACKENDS /* XXX? */ ,
+       10, 0, MAX_BACKENDS /* XXX? */ ,
        NULL, NULL, NULL
    },
 
@@ -3749,7 +3749,7 @@ static struct config_enum ConfigureNamesEnum[] =
            NULL
        },
        &wal_level,
-       WAL_LEVEL_MINIMAL, wal_level_options,
+       WAL_LEVEL_REPLICA, wal_level_options,
        NULL, NULL, NULL
    },
 
index b3f29610d070e408c2128728a057b78cd63f6199..15669b83c7fa2c3c1dfeae05f8139164a8df9474 100644 (file)
 
 # - Settings -
 
-#wal_level = minimal           # minimal, replica, or logical
+#wal_level = replica           # minimal, replica, or logical
                    # (change requires restart)
 #fsync = on                # flush data to disk for crash safety
                    # (turning this off can cause
 
 # Set these on the master and on any standby that will send replication data.
 
-#max_wal_senders =       # max number of walsender processes
+#max_wal_senders = 10      # max number of walsender processes
                # (change requires restart)
 #wal_keep_segments = 0     # in logfile segments, 16MB each; 0 disables
 #wal_sender_timeout = 60s  # in milliseconds; 0 disables
 
-#max_replication_slots = 0 # max number of replication slots
+#max_replication_slots = 10    # max number of replication slots
                # (change requires restart)
 #track_commit_timestamp = off  # collect timestamp of transaction commit
                # (change requires restart)
index 4dbde2978e4944edf5ec57cb97c4853745faa23a..ff6004454062026ad71c32df1c4f32d8dd6b8d9b 100644 (file)
@@ -15,7 +15,6 @@ $master->append_conf(
    'postgresql.conf', qq{
    track_commit_timestamp = on
    max_wal_senders = 5
-   wal_level = hot_standby
    });
 $master->start;
 $master->backup($bkplabel);
index 043ccb14a5d2be1181cf40332bad6b1fc8f8d9e3..1775b22dadf96416573924b4e30b8a32867b118e 100644 (file)
@@ -14,7 +14,6 @@ $master->append_conf(
    'postgresql.conf', qq{
    track_commit_timestamp = on
    max_wal_senders = 5
-   wal_level = hot_standby
    });
 $master->start;
 $master->backup($bkplabel);
index d8be1bd3e124140eb012f0c5d0281c5769e55e9d..932478183a899b8dd3d5fa66aada8fff5e248664 100644 (file)
@@ -415,7 +415,6 @@ sub init
 
    if ($params{allows_streaming})
    {
-       print $conf "wal_level = replica\n";
        print $conf "max_wal_senders = 5\n";
        print $conf "wal_keep_segments = 20\n";
        print $conf "max_wal_size = 128MB\n";
@@ -424,6 +423,11 @@ sub init
        print $conf "hot_standby = on\n";
        print $conf "max_connections = 10\n";
    }
+   else
+   {
+       print $conf "wal_level = minimal\n";
+       print $conf "max_wal_senders = 0\n";
+   }
 
    if ($TestLib::windows_os)
    {
index b80a9a9415a0f7dc5b1e6dd0b51dd9d849f2219a..1716360a170f78970fd36d83272abc1b3e0453f8 100644 (file)
@@ -10,7 +10,6 @@ my $node_master = get_new_node('master');
 $node_master->init(allows_streaming => 1);
 $node_master->append_conf(
        'postgresql.conf', qq(
-max_replication_slots = 4
 wal_level = logical
 ));
 $node_master->start;
index 9f6bdb0b64b72596c54f7cf3ebdb90f2014f2b12..5220611e4453fbb6c186cf9c34a42fd6a67b3218 100644 (file)
@@ -14,7 +14,6 @@ $node_master->init(allows_streaming => 1);
 
 $node_master->append_conf('postgresql.conf', qq{
 fsync = on
-wal_level = replica
 wal_log_hints = on
 max_prepared_transactions = 5
 autovacuum = off