Remove duplicated log related to slot creation in pg_createsubscriber
authorMichael Paquier <michael@paquier.xyz>
Thu, 9 Oct 2025 05:02:24 +0000 (14:02 +0900)
committerMichael Paquier <michael@paquier.xyz>
Thu, 9 Oct 2025 05:02:24 +0000 (14:02 +0900)
The creation of a replication slot done in a specific database on a
publisher was logged twice, with the second log not mentioning the
database where the slot creation happened.  This commit removes the
information logged after a slot has been successfully created, moving
the information about the publisher from the second to the first log.
Note that failing a slot creation is also logged, so there is no loss of
information.

Author: Peter Smith <smithpb2250@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/CAHut+Pv7qDvLbDgc9PQGhULT3rPXTxdu_=w+iW-kMs+zPADR+w@mail.gmail.com

src/bin/pg_basebackup/pg_createsubscriber.c

index 3986882f04292b0af1771abcb0ebe7b8a80c25e0..d29407413d96b2207c78aa825ec1a38b3010d692 100644 (file)
@@ -801,10 +801,7 @@ setup_publisher(struct LogicalRepInfo *dbinfo)
        if (lsn)
            pg_free(lsn);
        lsn = create_logical_replication_slot(conn, &dbinfo[i]);
-       if (lsn != NULL || dry_run)
-           pg_log_info("create replication slot \"%s\" on publisher",
-                       dbinfo[i].replslotname);
-       else
+       if (lsn == NULL && !dry_run)
            exit(1);
 
        /*
@@ -1375,7 +1372,7 @@ create_logical_replication_slot(PGconn *conn, struct LogicalRepInfo *dbinfo)
 
    Assert(conn != NULL);
 
-   pg_log_info("creating the replication slot \"%s\" in database \"%s\"",
+   pg_log_info("creating the replication slot \"%s\" in database \"%s\" on publisher",
                slot_name, dbinfo->dbname);
 
    slot_name_esc = PQescapeLiteral(conn, slot_name, strlen(slot_name));