Cycling back to this topic again, but this time at the beginning of a CF.

Here's an actual patch to change:


wal_level=replica
max_wal_senders=10
max_replication_slots=20

Based on feedback from last year (
https://www.postgresql.org/message-id/CABUevEwfV7zDutescm2PHGvsJdYA0RWHFMTRGhwrJPGgSbzZDQ%40mail.gmail.com
):


There were requests for benchmarks of performance difference. Tomas has
promised to run a couple of benchmarks on his standard benchmarking setups
to give numbers on that. Thanks Tomas, please pipe in with your results
when you have them!


Security considerations about pg_hba.conf -- I avoided those by not
actually changing pg_hba.conf. Since pg_hba.conf can be changed on a reload
instead of a restart it's a lot easier to deal with. I still think changing
it to allow "postgres" the same type of connections  as it does for regular
users would not be a security problem, but again thanks to it only needing
a reload it's not as big an issue.


There was the idea to have multiple sets of defaults to choose from at
initdb time. I don't see a problem having that, but it's been another year
and nobody built it. I don't think not having that is an excuse for the
current defaults. And implementing something like that is in no way
hindered by
changing the current defaults.

We were too close to beta1 -- this is why I'm sending it earlier this time
:) (Even though I intended to do it already back in September, better now
than even later)

Finally, there's the argument that we're already shaking up a number of
other things with version 10, so this is a good time to do this one as well.

-- 
 Magnus Hagander
 Me: http://www.hagander.net/
 Work: http://www.redpill-linpro.com/
diff --git a/doc/src/sgml/backup.sgml b/doc/src/sgml/backup.sgml
index 6eaed1e..d7df910 100644
--- a/doc/src/sgml/backup.sgml
+++ b/doc/src/sgml/backup.sgml
@@ -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:
diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index 8d7b3bf..94cec33 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -2169,12 +2169,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.
@@ -2912,7 +2912,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
@@ -2937,7 +2937,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 20.  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
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index 946ba9e..a31347b 100644
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -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? */ ,
+		20, 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
 	},
 
diff --git a/src/backend/utils/misc/postgresql.conf.sample b/src/backend/utils/misc/postgresql.conf.sample
index ee8232f..ba37485 100644
--- a/src/backend/utils/misc/postgresql.conf.sample
+++ b/src/backend/utils/misc/postgresql.conf.sample
@@ -175,7 +175,7 @@
 
 # - 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
@@ -230,12 +230,12 @@
 
 # Set these on the master and on any standby that will send replication data.
 
-#max_wal_senders = 0		# 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 = 20	# max number of replication slots
 				# (change requires restart)
 #track_commit_timestamp = off	# collect timestamp of transaction commit
 				# (change requires restart)
diff --git a/src/test/modules/commit_ts/t/002_standby.pl b/src/test/modules/commit_ts/t/002_standby.pl
index 4dbde29..ff60044 100644
--- a/src/test/modules/commit_ts/t/002_standby.pl
+++ b/src/test/modules/commit_ts/t/002_standby.pl
@@ -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);
diff --git a/src/test/modules/commit_ts/t/003_standby_2.pl b/src/test/modules/commit_ts/t/003_standby_2.pl
index d37ff18..1ff7d4d 100644
--- a/src/test/modules/commit_ts/t/003_standby_2.pl
+++ b/src/test/modules/commit_ts/t/003_standby_2.pl
@@ -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);
diff --git a/src/test/perl/PostgresNode.pm b/src/test/perl/PostgresNode.pm
index c1b16ca..b8ea2ae 100644
--- a/src/test/perl/PostgresNode.pm
+++ b/src/test/perl/PostgresNode.pm
@@ -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)
 	{
diff --git a/src/test/recovery/t/006_logical_decoding.pl b/src/test/recovery/t/006_logical_decoding.pl
index b80a9a9..1716360 100644
--- a/src/test/recovery/t/006_logical_decoding.pl
+++ b/src/test/recovery/t/006_logical_decoding.pl
@@ -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;
diff --git a/src/test/recovery/t/008_fsm_truncation.pl b/src/test/recovery/t/008_fsm_truncation.pl
index 9f6bdb0..5220611 100644
--- a/src/test/recovery/t/008_fsm_truncation.pl
+++ b/src/test/recovery/t/008_fsm_truncation.pl
@@ -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
-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to