Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc25304a

Browse files
committed
Improve messaging during logical replication worker startup
In case the subscription is removed before the worker is fully started,give a specific error message instead of the generic "cache lookup"error.Author: Petr Jelinek <petr.jelinek@2ndquadrant.com>Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>
1 parent2cd6520 commitc25304a

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

‎src/backend/replication/logical/worker.c

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1553,14 +1553,20 @@ ApplyWorkerMain(Datum main_arg)
15531553
ALLOCSET_DEFAULT_SIZES);
15541554
StartTransactionCommand();
15551555
oldctx=MemoryContextSwitchTo(ApplyContext);
1556-
MySubscription=GetSubscription(MyLogicalRepWorker->subid, false);
1556+
1557+
MySubscription=GetSubscription(MyLogicalRepWorker->subid, true);
1558+
if (!MySubscription)
1559+
{
1560+
ereport(LOG,
1561+
(errmsg("logical replication apply worker for subscription %u will not "
1562+
"start because the subscription was removed during startup",
1563+
MyLogicalRepWorker->subid)));
1564+
proc_exit(0);
1565+
}
1566+
15571567
MySubscriptionValid= true;
15581568
MemoryContextSwitchTo(oldctx);
15591569

1560-
/* Setup synchronous commit according to the user's wishes */
1561-
SetConfigOption("synchronous_commit",MySubscription->synccommit,
1562-
PGC_BACKEND,PGC_S_OVERRIDE);
1563-
15641570
if (!MySubscription->enabled)
15651571
{
15661572
ereport(LOG,
@@ -1571,6 +1577,10 @@ ApplyWorkerMain(Datum main_arg)
15711577
proc_exit(0);
15721578
}
15731579

1580+
/* Setup synchronous commit according to the user's wishes */
1581+
SetConfigOption("synchronous_commit",MySubscription->synccommit,
1582+
PGC_BACKEND,PGC_S_OVERRIDE);
1583+
15741584
/* Keep us informed about subscription changes. */
15751585
CacheRegisterSyscacheCallback(SUBSCRIPTIONOID,
15761586
subscription_change_cb,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp