Re: Simplify backend terminate and wait logic in postgres_fdw test
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Cc: Michael Paquier <michael@paquier.xyz>,
PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>,
Fujii Masao <masao.fujii@oss.nttdata.com>
Date: 2021-05-04T15:38:09Z
Lists: pgsql-hackers
Attachments
- disable-cache-clobber-for-termination-test.patch (text/x-diff) patch
Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com> writes: > On Tue, May 4, 2021 at 4:12 AM Tom Lane <tgl@sss.pgh.pa.us> wrote: >> The buildfarm is showing that one of these test queries is not stable >> under CLOBBER_CACHE_ALWAYS: > I can reproduce the issue with the failing case. Issue is that the > backend pid will be null in the pg_stat_activity because of the cache > invalidation that happens at the beginning of the query and hence > pg_terminate_backend returns null on null input. No, that's nonsense: if it were happening that way, the query would return one row with a NULL result, but actually it's returning no rows. What's actually happening, it seems, is that because pgfdw_inval_callback is constantly getting called due to cache flushes, we invariably drop remote connections immediately during transaction termination (cf pgfdw_xact_callback). Thus, by the time we inspect pg_stat_activity, there is no remote session to terminate. I don't like your patch because what it effectively does is mask whether termination happened or not; if there were a bug there causing that not to happen, the test would still appear to pass. I think the most expedient fix, if we want to keep this test, is just to transiently disable debug_invalidate_system_caches_always. (That option wasn't available before v14, but fortunately we don't need a fix for the back branches.) I believe the attached will do the trick, but I'm running the test with debug_invalidate_system_caches_always turned on to verify that. Should be done in an hour or so... regards, tom lane
Commits
-
Disable cache clobber to avoid breaking postgres_fdw termination test.
- 1273a15bf91f 14.0 landed
-
Simplify tests of postgres_fdw terminating connections
- 93f41461449f 14.0 landed
-
Add functions to wait for backend termination
- aaf043257205 14.0 cited
-
postgres_fdw: Fix tests for CLOBBER_CACHE_ALWAYS.
- f77717b2985a 14.0 cited