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

Commit8bbc618

Browse files
committed
Don't call the function that may raise an error while holding spinlock.
It's not safe to raise an error while holding spinlock. But previouslylogical replication worker for table sync called the function whichreads the system catalog and may raise an error while it's holdingspinlock. Which could lead to the trouble where spinlock will neverbe released and the server gets stuck infinitely.Author: Petr JelinekReviewed-by: Kyotaro Horiguchi and Fujii MasaoReported-by: Fujii MasaoDiscussion:http://postgr.es/m/CAHGQGwFDWh_Qr-q_GEMpD+qH=vYPMdVqw=ZOSY3kX_Pna9R9SA@mail.gmail.com
1 parente68432a commit8bbc618

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

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

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -705,17 +705,20 @@ LogicalRepSyncTableStart(XLogRecPtr *origin_startpos)
705705
{
706706
char*slotname;
707707
char*err;
708+
charrelstate;
709+
XLogRecPtrrelstate_lsn;
708710

709711
/* Check the state of the table synchronization. */
710712
StartTransactionCommand();
713+
relstate=GetSubscriptionRelState(MyLogicalRepWorker->subid,
714+
MyLogicalRepWorker->relid,
715+
&relstate_lsn, false);
716+
CommitTransactionCommand();
717+
711718
SpinLockAcquire(&MyLogicalRepWorker->relmutex);
712-
MyLogicalRepWorker->relstate=
713-
GetSubscriptionRelState(MyLogicalRepWorker->subid,
714-
MyLogicalRepWorker->relid,
715-
&MyLogicalRepWorker->relstate_lsn,
716-
false);
719+
MyLogicalRepWorker->relstate=relstate;
720+
MyLogicalRepWorker->relstate_lsn=relstate_lsn;
717721
SpinLockRelease(&MyLogicalRepWorker->relmutex);
718-
CommitTransactionCommand();
719722

720723
/*
721724
* To build a slot name for the sync work, we are limited to NAMEDATALEN -

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp