Lately, I've been reviewing some pg_createsubscriber patches and have
been tricked by some of the logging.
The pg_createsubscriber has a '--dry-run' option/mode [1]
----------
--dry-run
Do everything except actually modifying the target directory.
----------
I've noticed that the logging in '--dry-run' mode is indistinguishable
from the logging of "normal" run, although functions like
create_publication(), drop_publication(), etc, are NOP in '--dry-run'
mode, because the actual command execution code is skipped. e.g.
if (!dry_run)
{
res = PQexec(conn, str->data);
...
}
~~~
IMO, it's not good to fool people into thinking something has happened
when in fact nothing happened at all. I think the logging of this tool
should be much more explicit wrt when it is/isn't in dry-run mode.
Perhaps like this:
NORMAL
pg_log_info("creating publication \"%s\" in database \"%s\"", ...)
DRY-RUN
pg_log_info("[dry-run] would create publication \"%s\" in database \"%s\"", ...)
~~~
Thoughts?
======
[1] https://www.postgresql.org/docs/current/app-pgcreatesubscriber.html
Kind Regards,
Peter Smith.
Fujitsu Australia