Re: AlterSubscription_refresh "wrconn" wrong variable?

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Peter Smith <smithpb2250@gmail.com>
Cc: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2021-05-05T02:35:02Z
Lists: pgsql-hackers
Peter Smith <smithpb2250@gmail.com> writes:
> This patch replaces the global "wrconn" in AlterSubscription_refresh with a local variable of the same name, making it consistent with other functions in subscriptioncmds.c (e.g. DropSubscription).
> The global wrconn is only meant to be used for logical apply/tablesync worker.
> Using the global/incorrect wrconn in AlterSubscription_refresh doesn't normally cause any problems, but harm is still posslble if the apply worker ever manages to do a subscription refresh. e.g. see [1]

Hm.  I would actually place the blame for this on whoever thought
it was okay to name a global variable something as generic as
"wrconn".   Let's rename that while we're at it, say to something
like "tablesync_wrconn" (feel free to bikeshed).

			regards, tom lane



Commits

  1. Rename the logical replication global "wrconn"

  2. AlterSubscription_refresh: avoid stomping on global variable

  3. Logical replication support for initial data copy