Re: pg_createsubscriber --dry-run logging concerns

From: Peter Smith <smithpb2250(at)gmail(dot)com>
To: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
Cc: Álvaro Herrera <alvherre(at)kurilemu(dot)de>, Euler Taveira <euler(at)eulerto(dot)com>, "kuroda(dot)hayato(at)fujitsu(dot)com" <kuroda(dot)hayato(at)fujitsu(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: pg_createsubscriber --dry-run logging concerns
Date: 2025-10-09 08:05:24
Message-ID: CAHut+Puhm2GRazE6zHvYUckQL3MqqSPrAwovuC0xS6bWO2w3_g@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Oct 9, 2025 at 4:38 PM Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com> wrote:
>
> I think is patch is helpful. A few comments:
>
> On Oct 9, 2025, at 08:55, Peter Smith <smithpb2250(at)gmail(dot)com> wrote:
>
> <v2-0001-log-to-say-command-is-executing-in-dry-run-mode.patch><v2-0002-add-different-dry-run-logging-for-pg_createsubscr.patch>
>
>
>
> 1 - 0001
> ```
> + if (dryrun)
> + {
> + pg_log_info("-----------------------------------------------------");
> + pg_log_info("pg_archivecleanup is executing in '--dry-run' mode.");
> + pg_log_info("No files will be removed.");
> + pg_log_info("-----------------------------------------------------");
> + }
> ```
>
> Putting the program name in log message feels redundant, because pg_log_info() may already prefixes logs with program name. But I like the separator lines that make it stand out visually in logs. So this log can be simplified as:
>
> ```

Fair point. I removed the tool name from the message.

> 2 - 0002
> ```
> - if (!dry_run)
> + if (dry_run)
> + pg_log_info("in dry-run mode, otherwise system identifier would be %" PRIu64 " on subscriber",
> + cf->system_identifier);
> ```
>
> I think this log message can be simplified as:
>
> ```
> pg_log_info("dry-run: system identifier would be %" PRIu64 " on subscriber",
> cf->system_identifier);
> ```
>
> As a general comment, I think “in dry-run mode” is a little long-winded, we can just put “dry-run:”, and “otherwise” seems not needed because “dry-run” has clearly indicated nothing would actually happen. This comment applies to all changes in pg_createsubscriber.c of 0002.
>

OK. Updated as suggested.

~~

The anticipated rebase was necessary, too.

Please see the v3 patches.

======
Kind Regards,
Peter Smith.
Fujitsu Australia

Attachment Content-Type Size
v3-0002-add-different-dry-run-logging-for-pg_createsubscr.patch application/octet-stream 7.3 KB
v3-0001-log-to-say-command-is-executing-in-dry-run-mode.patch application/octet-stream 4.6 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Richard Guo 2025-10-09 08:07:08 Re: Eager aggregation, take 3
Previous Message Michael Paquier 2025-10-09 08:02:12 Re: Replace O_EXCL with O_TRUNC for creation of state.tmp in SaveSlotToPath