Skip to content

Commit 92ecb14

Browse files
committed
Improve logical replication worker log messages
Reduce some redundant messages to DEBUG1. Be clearer about the distinction between apply workers and table synchronization workers. Add subscription and table name where possible. Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>
1 parent 85c2b9a commit 92ecb14

File tree

3 files changed

+18
-13
lines changed

3 files changed

+18
-13
lines changed

src/backend/replication/logical/launcher.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ logicalrep_worker_launch(Oid dbid, Oid subid, const char *subname, Oid userid,
260260
int nsyncworkers;
261261
TimestampTz now;
262262

263-
ereport(LOG,
263+
ereport(DEBUG1,
264264
(errmsg("starting logical replication worker for subscription \"%s\"",
265265
subname)));
266266

src/backend/replication/logical/tablesync.c

+4-1
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,11 @@ finish_sync_worker(void)
133133
/* Find the main apply worker and signal it. */
134134
logicalrep_worker_wakeup(MyLogicalRepWorker->subid, InvalidOid);
135135

136+
StartTransactionCommand();
136137
ereport(LOG,
137-
(errmsg("logical replication synchronization worker finished processing")));
138+
(errmsg("logical replication table synchronization worker for subscription \"%s\", table \"%s\" has finished",
139+
MySubscription->name, get_rel_name(MyLogicalRepWorker->relid))));
140+
CommitTransactionCommand();
138141

139142
/* Stop gracefully */
140143
walrcv_disconnect(wrconn);

src/backend/replication/logical/worker.c

+13-11
Original file line numberDiff line numberDiff line change
@@ -1325,7 +1325,7 @@ reread_subscription(void)
13251325
if (!newsub)
13261326
{
13271327
ereport(LOG,
1328-
(errmsg("logical replication worker for subscription \"%s\" will "
1328+
(errmsg("logical replication apply worker for subscription \"%s\" will "
13291329
"stop because the subscription was removed",
13301330
MySubscription->name)));
13311331

@@ -1340,7 +1340,7 @@ reread_subscription(void)
13401340
if (!newsub->enabled)
13411341
{
13421342
ereport(LOG,
1343-
(errmsg("logical replication worker for subscription \"%s\" will "
1343+
(errmsg("logical replication apply worker for subscription \"%s\" will "
13441344
"stop because the subscription was disabled",
13451345
MySubscription->name)));
13461346

@@ -1355,7 +1355,7 @@ reread_subscription(void)
13551355
if (strcmp(newsub->conninfo, MySubscription->conninfo) != 0)
13561356
{
13571357
ereport(LOG,
1358-
(errmsg("logical replication worker for subscription \"%s\" will "
1358+
(errmsg("logical replication apply worker for subscription \"%s\" will "
13591359
"restart because the connection information was changed",
13601360
MySubscription->name)));
13611361

@@ -1370,7 +1370,7 @@ reread_subscription(void)
13701370
if (strcmp(newsub->name, MySubscription->name) != 0)
13711371
{
13721372
ereport(LOG,
1373-
(errmsg("logical replication worker for subscription \"%s\" will "
1373+
(errmsg("logical replication apply worker for subscription \"%s\" will "
13741374
"restart because subscription was renamed",
13751375
MySubscription->name)));
13761376

@@ -1388,7 +1388,7 @@ reread_subscription(void)
13881388
if (strcmp(newsub->slotname, MySubscription->slotname) != 0)
13891389
{
13901390
ereport(LOG,
1391-
(errmsg("logical replication worker for subscription \"%s\" will "
1391+
(errmsg("logical replication apply worker for subscription \"%s\" will "
13921392
"restart because the replication slot name was changed",
13931393
MySubscription->name)));
13941394

@@ -1403,7 +1403,7 @@ reread_subscription(void)
14031403
if (!equal(newsub->publications, MySubscription->publications))
14041404
{
14051405
ereport(LOG,
1406-
(errmsg("logical replication worker for subscription \"%s\" will "
1406+
(errmsg("logical replication apply worker for subscription \"%s\" will "
14071407
"restart because subscription's publications were changed",
14081408
MySubscription->name)));
14091409

@@ -1503,7 +1503,7 @@ ApplyWorkerMain(Datum main_arg)
15031503
if (!MySubscription->enabled)
15041504
{
15051505
ereport(LOG,
1506-
(errmsg("logical replication worker for subscription \"%s\" will not "
1506+
(errmsg("logical replication apply worker for subscription \"%s\" will not "
15071507
"start because the subscription was disabled during startup",
15081508
MySubscription->name)));
15091509

@@ -1516,11 +1516,13 @@ ApplyWorkerMain(Datum main_arg)
15161516
(Datum) 0);
15171517

15181518
if (am_tablesync_worker())
1519-
elog(LOG, "logical replication sync for subscription %s, table %s started",
1520-
MySubscription->name, get_rel_name(MyLogicalRepWorker->relid));
1519+
ereport(LOG,
1520+
(errmsg("logical replication table synchronization worker for subscription \"%s\", table \"%s\" has started",
1521+
MySubscription->name, get_rel_name(MyLogicalRepWorker->relid))));
15211522
else
1522-
elog(LOG, "logical replication apply for subscription %s started",
1523-
MySubscription->name);
1523+
ereport(LOG,
1524+
(errmsg("logical replication apply worker for subscription \"%s\" has started",
1525+
MySubscription->name)));
15241526

15251527
CommitTransactionCommand();
15261528

0 commit comments

Comments
 (0)