Thread

Commits

  1. Remove duplicated log related to slot creation in pg_createsubscriber

  1. duplicate logging in pg_createsubscriber

    Peter Smith <smithpb2250@gmail.com> — 2025-10-08T06:29:20Z

    Hi hackers,
    
    While reviewing pg_createsubscriber logs (in another thread) I saw
    some unexpected (almost) duplicate consecutive logs for the slot
    creation in --dry-run mode.
    
    e.g.
    ----------
    pg_createsubscriber: creating the replication slot
    "pg_createsubscriber_16386_e9a70df3" in database "db2"
    pg_createsubscriber: create replication slot
    "pg_createsubscriber_16386_e9a70df3" on publisher
    ----------
    
    It didn't look right to me.
    
    I found the code is doing:
    - pg_log_info("creating the replication slot unconditional inside
    create_logical_replication_slot
    - pg_log_info("create replication slot...") immediately after call to
    create_logical_replication_slot
    
    Perhaps that 2nd log was once supposed to say "created" (past tense),
    but even that seemed redundant.
    
    Here is a small patch to remove the log duplication by keeping only
    the log *within* the function.
    
    Thoughts?
    
    ======
    Kind Regards,
    Peter Smith.
    Fujitsu Asutralia
    
  2. Re: duplicate logging in pg_createsubscriber

    Michael Paquier <michael@paquier.xyz> — 2025-10-08T11:46:42Z

    On Wed, Oct 08, 2025 at 05:29:20PM +1100, Peter Smith wrote:
    > It didn't look right to me.
    > 
    > I found the code is doing:
    > - pg_log_info("creating the replication slot unconditional inside
    > create_logical_replication_slot
    > - pg_log_info("create replication slot...") immediately after call to
    > create_logical_replication_slot
    > 
    > Perhaps that 2nd log was once supposed to say "created" (past tense),
    > but even that seemed redundant.
    > 
    > Here is a small patch to remove the log duplication by keeping only
    > the log *within* the function.
    > 
    > Thoughts?
    
    Agreed.  This was bugging me a bit today while looking at some logs
    generated by the TAP tests.  We don't gain any additional information
    here, so let's remove the duplicates.  I'll check that later, it's
    late now.
    --
    Michael
    
  3. Re: duplicate logging in pg_createsubscriber

    Chao Li <li.evan.chao@gmail.com> — 2025-10-09T02:30:59Z

    
    > On Oct 8, 2025, at 14:29, Peter Smith <smithpb2250@gmail.com> wrote:
    > 
    > Perhaps that 2nd log was once supposed to say "created" (past tense),
    > but even that seemed redundant.
    > 
    > Here is a small patch to remove the log duplication by keeping only
    > the log *within* the function.
    > 
    > Thoughts?
    > 
    > ======
    > Kind Regards,
    > Peter Smith.
    > Fujitsu Asutralia
    > <v1-0001-remove-duplicate-logging-for-slot-creation.patch>
    
    
    The change is straightforward, especially I like the second change of adding “on publisher”, which makes the message clearer.
    
    For dry-run mode, I see in setup_recovery(), it debug-logs a message with “# dry run mode recovery_target_lsn = xxx”, I think it would be good to add similar debug logs in create_logical_replication_slot(), create_publication() and drop_publication().
    
    Best regards,
    --
    Chao Li (Evan)
    HighGo Software Co., Ltd.
    https://www.highgo.com/
    
    
    
    
    
  4. Re: duplicate logging in pg_createsubscriber

    Peter Smith <smithpb2250@gmail.com> — 2025-10-09T02:36:36Z

    On Thu, Oct 9, 2025 at 1:31 PM Chao Li <li.evan.chao@gmail.com> wrote:
    >
    >
    >
    > On Oct 8, 2025, at 14:29, Peter Smith <smithpb2250@gmail.com> wrote:
    >
    > Perhaps that 2nd log was once supposed to say "created" (past tense),
    > but even that seemed redundant.
    >
    > Here is a small patch to remove the log duplication by keeping only
    > the log *within* the function.
    >
    > Thoughts?
    >
    > ======
    > Kind Regards,
    > Peter Smith.
    > Fujitsu Asutralia
    > <v1-0001-remove-duplicate-logging-for-slot-creation.patch>
    >
    >
    > The change is straightforward, especially I like the second change of adding “on publisher”, which makes the message clearer.
    >
    
    Thanks.
    
    > For dry-run mode, I see in setup_recovery(), it debug-logs a message with “# dry run mode recovery_target_lsn = xxx”, I think it would be good to add similar debug logs in create_logical_replication_slot(), create_publication() and drop_publication().
    >
    
    Yes, I am already attempting to address those other dry-run logging
    issues in another thread [1].
    
    ======
    [1] https://www.postgresql.org/message-id/CAHut%2BPu84M8tgTjn%2B%2B4WCTETOX%3DNR4YmLn-%2B4B29UJeDTgoJ9Q%40mail.gmail.com
    
    Kind Regards,
    Peter Smith.
    Fujitsu Australia
    
    
    
    
  5. Re: duplicate logging in pg_createsubscriber

    Michael Paquier <michael@paquier.xyz> — 2025-10-09T05:03:03Z

    On Thu, Oct 09, 2025 at 01:36:36PM +1100, Peter Smith wrote:
    > Thanks.
    
    Done this one.
    --
    Michael
    
  6. Re: duplicate logging in pg_createsubscriber

    Peter Smith <smithpb2250@gmail.com> — 2025-10-09T06:01:47Z

    On Thu, Oct 9, 2025 at 4:03 PM Michael Paquier <michael@paquier.xyz> wrote:
    >
    > On Thu, Oct 09, 2025 at 01:36:36PM +1100, Peter Smith wrote:
    > > Thanks.
    >
    > Done this one.
    > --
    
    Thanks for pushing!
    
    ======
    Kind Regards,
    Peter Smith.
    Fujitsu Australia