Hi Shubham,
In a previous review [1, comment #3] I was complaining about the lack
of output emitted by the pg_log_debug() because I wanted to see some
LOG evidence of the bad value of max_slot_wal_keep_size.
FYI, I think that mystery has finally been solved.
AFAIK 2 separate problems were contributing to the lack of debug output.
1. Unlike the 'command_ok' subroutine, the 'command_checks_all'
subroutine apparently redirects the output before doing the requested
pattern matching on it. So there is no output to be seen.
2. After that, I did not realise the effect of '-verbose' is
cumulative on loglevel. Specifically, to see debug messages it is not
enough to just say '--verbose'. In fact, you need to specify it 2
times: '--verbose', '--verbose'
~
After addressing these (e.g. by executing the same pg_createsubscriber
using 'command_ok' and using a double '--verbose'), the expected LOGS
can be seen.
e.g. in the file tmp_check/log/regress_log_040_pg_createsubscriber
----------
...
pg_createsubscriber: checking settings on publisher
pg_createsubscriber: publisher: wal_level: logical
pg_createsubscriber: publisher: max_replication_slots: 10
pg_createsubscriber: publisher: current replication slots: 2
pg_createsubscriber: publisher: max_wal_senders: 10
pg_createsubscriber: publisher: current wal senders: 1
pg_createsubscriber: publisher: max_prepared_transactions: 0
pg_createsubscriber: publisher: max_slot_wal_keep_size: 10485760
pg_createsubscriber: warning: publisher requires WAL size must not be restricted
pg_createsubscriber: hint: Set the configuration parameter
"max_slot_wal_keep_size" to -1 to ensure that required WAL files are
not prematurely removed.
pg_createsubscriber: stopping the subscriber
...
----------
See the attached diff for the TAP changes I used to expose this
logging. Apply this atop v8.
======
[1]
https://www.postgresql.org/message-id/CAHut%2BPszk61QM%2BcEvq_1-A2y%2BJrAD0USB%2BNvtcidajYOfHDkyw%40mail.gmail.com
Kind Regards,
Peter Smith.
Fujitsu Australia
diff --git a/src/bin/pg_basebackup/t/040_pg_createsubscriber.pl
b/src/bin/pg_basebackup/t/040_pg_createsubscriber.pl
index c1fc0cf..773a27b 100644
--- a/src/bin/pg_basebackup/t/040_pg_createsubscriber.pl
+++ b/src/bin/pg_basebackup/t/040_pg_createsubscriber.pl
@@ -327,7 +327,7 @@ $node_p->reload;
# 'max_slot_wal_keep_size'
command_checks_all(
[
- 'pg_createsubscriber', '--verbose',
+ 'pg_createsubscriber', '--verbose', '--verbose',
'--recovery-timeout',
"$PostgreSQL::Test::Utils::timeout_default",
'--dry-run', '--pgdata',
$node_s->data_dir, '--publisher-server',
@@ -350,6 +350,26 @@ command_checks_all(
'Validate warning for misconfigured max_slot_wal_keep_size on the
publisher'
);
+# And, same again to see the output...
+command_ok(
+ [
+ 'pg_createsubscriber', '--verbose', '--verbose',
+ '--recovery-timeout',
"$PostgreSQL::Test::Utils::timeout_default",
+ '--dry-run', '--pgdata',
+ $node_s->data_dir, '--publisher-server',
+ $node_p->connstr($db1), '--socketdir',
+ $node_s->host, '--subscriber-port',
+ $node_s->port, '--publication',
+ 'pub1', '--publication',
+ 'pub2', '--subscription',
+ 'sub1', '--subscription',
+ 'sub2', '--database',
+ $db1, '--database',
+ $db2
+ ],
+ 'Ditto above, but this time using command_ok to retain the output'
+);
+
# Reset 'max_slot_wal_keep_size' to default after the test
$node_p->append_conf('postgresql.conf', 'max_slot_wal_keep_size = -1');
$node_p->reload;