Thread

Commits

  1. pg_createsubscriber: Remove some code bloat in the atexit() callback

  2. Add two-phase option in pg_createsubscriber.

  1. Tidy recent code bloat in pg_creatersubscriber::cleanup_objects_atexit

    Peter Smith <smithpb2250@gmail.com> — 2025-03-11T01:29:42Z

    During a recent review of pg_creatersubscriber I saw that commit
    e117cfb introduced a common 'dbinfos' struct to contain the array of
    individual 'dbinfo[i]' infos. But, this now means that getting to each
    dbinfo[i] requires another level of referencing.
    
    In some places, e.g. function cleanup_objects_atexit, this caused
    unnecessary code bloat. IMO this function is crying out for a local
    variable to simplify the code again.
    
    Please see the attached patch that implements this suggestion.
    
    ======
    Kind Regards,
    Peter Smith
    Fujitsu Australia
    
  2. Re: Tidy recent code bloat in pg_creatersubscriber::cleanup_objects_atexit

    Michael Paquier <michael@paquier.xyz> — 2025-03-11T07:06:14Z

    On Tue, Mar 11, 2025 at 12:29:42PM +1100, Peter Smith wrote:
    > During a recent review of pg_creatersubscriber I saw that commit
    > e117cfb introduced a common 'dbinfos' struct to contain the array of
    > individual 'dbinfo[i]' infos. But, this now means that getting to each
    > dbinfo[i] requires another level of referencing.
    > 
    > In some places, e.g. function cleanup_objects_atexit, this caused
    > unnecessary code bloat. IMO this function is crying out for a local
    > variable to simplify the code again.
    
    Right.  This improves the clarity of the code, so agreed about the use
    of a local variable here.
    --
    Michael
    
  3. Re: Tidy recent code bloat in pg_creatersubscriber::cleanup_objects_atexit

    Michael Paquier <michael@paquier.xyz> — 2025-03-16T11:09:36Z

    On Tue, Mar 11, 2025 at 04:06:14PM +0900, Michael Paquier wrote:
    > Right.  This improves the clarity of the code, so agreed about the use
    > of a local variable here.
    
    More code paths of pg_createsubscriber.c have similar loops, but this
    is the only one where LogicalRepInfo can be used.  So, applied as you
    have suggested, without touching the other loops.
    --
    Michael
    
  4. Re: Tidy recent code bloat in pg_creatersubscriber::cleanup_objects_atexit

    Peter Smith <smithpb2250@gmail.com> — 2025-03-16T21:15:23Z

    Thanks for pushing it.
    
    ======
    Kind Regards,
    Peter Smith.
    Fujitsu Australia