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

Commitef70b6f

Browse files
committed
AlterSubscription_refresh: avoid stomping on global variable
This patch replaces use of the global "wrconn" variable inAlterSubscription_refresh with a local variable of the same name, makingit consistent with other functions in subscriptioncmds.c (e.g.DropSubscription).The global wrconn is only meant to be used for logical apply/tablesync worker.Abusing it this way is known to cause trouble if an apply workermanages to do a subscription refresh, such as reported by Jeremy Finzeland diagnosed by Andres Freund back in November 2020, athttps://www.postgresql.org/message-id/20201111215820.qihhrz7fayu6myfi@alap3.anarazel.deBackpatch to 10. In branch master, also move the connection establishmentto occur outside the PG_TRY block; this way we can remove a test for NULL inPG_FINALLY, and it also makes the code more consistent with similar code inthe same file.Author: Peter Smith <peter.b.smith@fujitsu.com>Reviewed-by: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>Reviewed-by: Japin Li <japinli@hotmail.com>Discussion:https://postgr.es/m/CAHut+Pu7Jv9L2BOEx_Z0UtJxfDevQSAUW2mJqWU+CtmDrEZVAg@mail.gmail.com
1 parentf518c3d commitef70b6f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

‎src/backend/commands/subscriptioncmds.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -517,6 +517,7 @@ AlterSubscription_refresh(Subscription *sub, bool copy_data)
517517
List*subrel_states;
518518
Oid*subrel_local_oids;
519519
Oid*pubrel_local_oids;
520+
WalReceiverConn*wrconn;
520521
ListCell*lc;
521522
intoff;
522523

@@ -835,7 +836,7 @@ DropSubscription(DropSubscriptionStmt *stmt, bool isTopLevel)
835836
charoriginname[NAMEDATALEN];
836837
char*err=NULL;
837838
RepOriginIdoriginid;
838-
WalReceiverConn*wrconn=NULL;
839+
WalReceiverConn*wrconn;
839840
StringInfoDatacmd;
840841
Form_pg_subscriptionform;
841842

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp