On Tue, Dec 15, 2020 at 8:25 AM Zhihong Yu <zyu@yugabyte.com> wrote:
> Is the following sequence possible ?
> In pgfdw_inval_callback():
>
> entry->invalidated = true;
> + have_invalid_connections = true;
>
> At which time the loop in pgfdw_xact_callback() is already running (but past the above entry).
> Then:
>
> + /* We are done closing all the invalidated connections so reset. */
> + have_invalid_connections = false;
>
> At which time, there is still at least one invalid connection but the global flag is off.
It's not possible, as this backend specific code doesn't run in
multiple threads. We can not have pgfdw_inval_callback() and
pgfdw_xact_callback() running at the same time, so we are safe there.
With Regards,
Bharath Rupireddy.
EnterpriseDB: http://www.enterprisedb.com