Commit 92ecb148 authored by Peter Eisentraut's avatar Peter Eisentraut

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: default avatarMasahiko Sawada <sawada.mshk@gmail.com>
parent 85c2b9a1
...@@ -260,7 +260,7 @@ logicalrep_worker_launch(Oid dbid, Oid subid, const char *subname, Oid userid, ...@@ -260,7 +260,7 @@ logicalrep_worker_launch(Oid dbid, Oid subid, const char *subname, Oid userid,
int nsyncworkers; int nsyncworkers;
TimestampTz now; TimestampTz now;
ereport(LOG, ereport(DEBUG1,
(errmsg("starting logical replication worker for subscription \"%s\"", (errmsg("starting logical replication worker for subscription \"%s\"",
subname))); subname)));
......
...@@ -133,8 +133,11 @@ finish_sync_worker(void) ...@@ -133,8 +133,11 @@ finish_sync_worker(void)
/* Find the main apply worker and signal it. */ /* Find the main apply worker and signal it. */
logicalrep_worker_wakeup(MyLogicalRepWorker->subid, InvalidOid); logicalrep_worker_wakeup(MyLogicalRepWorker->subid, InvalidOid);
StartTransactionCommand();
ereport(LOG, ereport(LOG,
(errmsg("logical replication synchronization worker finished processing"))); (errmsg("logical replication table synchronization worker for subscription \"%s\", table \"%s\" has finished",
MySubscription->name, get_rel_name(MyLogicalRepWorker->relid))));
CommitTransactionCommand();
/* Stop gracefully */ /* Stop gracefully */
walrcv_disconnect(wrconn); walrcv_disconnect(wrconn);
......
...@@ -1325,7 +1325,7 @@ reread_subscription(void) ...@@ -1325,7 +1325,7 @@ reread_subscription(void)
if (!newsub) if (!newsub)
{ {
ereport(LOG, ereport(LOG,
(errmsg("logical replication worker for subscription \"%s\" will " (errmsg("logical replication apply worker for subscription \"%s\" will "
"stop because the subscription was removed", "stop because the subscription was removed",
MySubscription->name))); MySubscription->name)));
...@@ -1340,7 +1340,7 @@ reread_subscription(void) ...@@ -1340,7 +1340,7 @@ reread_subscription(void)
if (!newsub->enabled) if (!newsub->enabled)
{ {
ereport(LOG, ereport(LOG,
(errmsg("logical replication worker for subscription \"%s\" will " (errmsg("logical replication apply worker for subscription \"%s\" will "
"stop because the subscription was disabled", "stop because the subscription was disabled",
MySubscription->name))); MySubscription->name)));
...@@ -1355,7 +1355,7 @@ reread_subscription(void) ...@@ -1355,7 +1355,7 @@ reread_subscription(void)
if (strcmp(newsub->conninfo, MySubscription->conninfo) != 0) if (strcmp(newsub->conninfo, MySubscription->conninfo) != 0)
{ {
ereport(LOG, ereport(LOG,
(errmsg("logical replication worker for subscription \"%s\" will " (errmsg("logical replication apply worker for subscription \"%s\" will "
"restart because the connection information was changed", "restart because the connection information was changed",
MySubscription->name))); MySubscription->name)));
...@@ -1370,7 +1370,7 @@ reread_subscription(void) ...@@ -1370,7 +1370,7 @@ reread_subscription(void)
if (strcmp(newsub->name, MySubscription->name) != 0) if (strcmp(newsub->name, MySubscription->name) != 0)
{ {
ereport(LOG, ereport(LOG,
(errmsg("logical replication worker for subscription \"%s\" will " (errmsg("logical replication apply worker for subscription \"%s\" will "
"restart because subscription was renamed", "restart because subscription was renamed",
MySubscription->name))); MySubscription->name)));
...@@ -1388,7 +1388,7 @@ reread_subscription(void) ...@@ -1388,7 +1388,7 @@ reread_subscription(void)
if (strcmp(newsub->slotname, MySubscription->slotname) != 0) if (strcmp(newsub->slotname, MySubscription->slotname) != 0)
{ {
ereport(LOG, ereport(LOG,
(errmsg("logical replication worker for subscription \"%s\" will " (errmsg("logical replication apply worker for subscription \"%s\" will "
"restart because the replication slot name was changed", "restart because the replication slot name was changed",
MySubscription->name))); MySubscription->name)));
...@@ -1403,7 +1403,7 @@ reread_subscription(void) ...@@ -1403,7 +1403,7 @@ reread_subscription(void)
if (!equal(newsub->publications, MySubscription->publications)) if (!equal(newsub->publications, MySubscription->publications))
{ {
ereport(LOG, ereport(LOG,
(errmsg("logical replication worker for subscription \"%s\" will " (errmsg("logical replication apply worker for subscription \"%s\" will "
"restart because subscription's publications were changed", "restart because subscription's publications were changed",
MySubscription->name))); MySubscription->name)));
...@@ -1503,7 +1503,7 @@ ApplyWorkerMain(Datum main_arg) ...@@ -1503,7 +1503,7 @@ ApplyWorkerMain(Datum main_arg)
if (!MySubscription->enabled) if (!MySubscription->enabled)
{ {
ereport(LOG, ereport(LOG,
(errmsg("logical replication worker for subscription \"%s\" will not " (errmsg("logical replication apply worker for subscription \"%s\" will not "
"start because the subscription was disabled during startup", "start because the subscription was disabled during startup",
MySubscription->name))); MySubscription->name)));
...@@ -1516,11 +1516,13 @@ ApplyWorkerMain(Datum main_arg) ...@@ -1516,11 +1516,13 @@ ApplyWorkerMain(Datum main_arg)
(Datum) 0); (Datum) 0);
if (am_tablesync_worker()) if (am_tablesync_worker())
elog(LOG, "logical replication sync for subscription %s, table %s started", ereport(LOG,
MySubscription->name, get_rel_name(MyLogicalRepWorker->relid)); (errmsg("logical replication table synchronization worker for subscription \"%s\", table \"%s\" has started",
MySubscription->name, get_rel_name(MyLogicalRepWorker->relid))));
else else
elog(LOG, "logical replication apply for subscription %s started", ereport(LOG,
MySubscription->name); (errmsg("logical replication apply worker for subscription \"%s\" has started",
MySubscription->name)));
CommitTransactionCommand(); CommitTransactionCommand();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment