Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit e1c83e7

Browse files
committed
Fix untranslatable log message assembly
We can't inject the name of the logical replication worker into a log message like that. But for these messages we don't really need the precision of knowing what kind of worker it was, so just write "logical replication worker" and keep the message in one piece. Discussion: https://www.postgresql.org/message-id/flat/CAHut%2BPt1xwATviPGjjtJy5L631SGf3qjV9XUCmxLu16cHamfgg%40mail.gmail.com
1 parent ccfca8e commit e1c83e7

File tree

1 file changed

+12
-32
lines changed

1 file changed

+12
-32
lines changed

src/backend/replication/logical/worker.c

+12-32
Original file line numberDiff line numberDiff line change
@@ -435,20 +435,6 @@ static inline void reset_apply_error_context_info(void);
435435
static TransApplyAction get_transaction_apply_action(TransactionId xid,
436436
ParallelApplyWorkerInfo **winfo);
437437

438-
/*
439-
* Return the name of the logical replication worker.
440-
*/
441-
static const char *
442-
get_worker_name(void)
443-
{
444-
if (am_tablesync_worker())
445-
return _("logical replication table synchronization worker");
446-
else if (am_parallel_apply_worker())
447-
return _("logical replication parallel apply worker");
448-
else
449-
return _("logical replication apply worker");
450-
}
451-
452438
/*
453439
* Form the origin name for the subscription.
454440
*
@@ -3904,9 +3890,8 @@ maybe_reread_subscription(void)
39043890
if (!newsub)
39053891
{
39063892
ereport(LOG,
3907-
/* translator: first %s is the name of logical replication worker */
3908-
(errmsg("%s for subscription \"%s\" will stop because the subscription was removed",
3909-
get_worker_name(), MySubscription->name)));
3893+
(errmsg("logical replication worker for subscription \"%s\" will stop because the subscription was removed",
3894+
MySubscription->name)));
39103895

39113896
/* Ensure we remove no-longer-useful entry for worker's start time */
39123897
if (!am_tablesync_worker() && !am_parallel_apply_worker())
@@ -3918,9 +3903,8 @@ maybe_reread_subscription(void)
39183903
if (!newsub->enabled)
39193904
{
39203905
ereport(LOG,
3921-
/* translator: first %s is the name of logical replication worker */
3922-
(errmsg("%s for subscription \"%s\" will stop because the subscription was disabled",
3923-
get_worker_name(), MySubscription->name)));
3906+
(errmsg("logical replication worker for subscription \"%s\" will stop because the subscription was disabled",
3907+
MySubscription->name)));
39243908

39253909
apply_worker_exit();
39263910
}
@@ -3954,9 +3938,8 @@ maybe_reread_subscription(void)
39543938
MySubscription->name)));
39553939
else
39563940
ereport(LOG,
3957-
/* translator: first %s is the name of logical replication worker */
3958-
(errmsg("%s for subscription \"%s\" will restart because of a parameter change",
3959-
get_worker_name(), MySubscription->name)));
3941+
(errmsg("logical replication worker for subscription \"%s\" will restart because of a parameter change",
3942+
MySubscription->name)));
39603943

39613944
apply_worker_exit();
39623945
}
@@ -4478,9 +4461,8 @@ InitializeApplyWorker(void)
44784461
if (!MySubscription)
44794462
{
44804463
ereport(LOG,
4481-
/* translator: %s is the name of logical replication worker */
4482-
(errmsg("%s for subscription %u will not start because the subscription was removed during startup",
4483-
get_worker_name(), MyLogicalRepWorker->subid)));
4464+
(errmsg("logical replication worker for subscription %u will not start because the subscription was removed during startup",
4465+
MyLogicalRepWorker->subid)));
44844466

44854467
/* Ensure we remove no-longer-useful entry for worker's start time */
44864468
if (!am_tablesync_worker() && !am_parallel_apply_worker())
@@ -4494,9 +4476,8 @@ InitializeApplyWorker(void)
44944476
if (!MySubscription->enabled)
44954477
{
44964478
ereport(LOG,
4497-
/* translator: first %s is the name of logical replication worker */
4498-
(errmsg("%s for subscription \"%s\" will not start because the subscription was disabled during startup",
4499-
get_worker_name(), MySubscription->name)));
4479+
(errmsg("logical replication worker for subscription \"%s\" will not start because the subscription was disabled during startup",
4480+
MySubscription->name)));
45004481

45014482
apply_worker_exit();
45024483
}
@@ -4517,9 +4498,8 @@ InitializeApplyWorker(void)
45174498
get_rel_name(MyLogicalRepWorker->relid))));
45184499
else
45194500
ereport(LOG,
4520-
/* translator: first %s is the name of logical replication worker */
4521-
(errmsg("%s for subscription \"%s\" has started",
4522-
get_worker_name(), MySubscription->name)));
4501+
(errmsg("logical replication apply worker for subscription \"%s\" has started",
4502+
MySubscription->name)));
45234503

45244504
CommitTransactionCommand();
45254505
}

0 commit comments

Comments
 (0)