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

Commit1273a15

Browse files
committed
Disable cache clobber to avoid breaking postgres_fdw termination test.
Commit93f4146 improved a pre-existing test case so that it wouldshow whether or not termination of the "remote" worker process happened.This soon exposed that, when debug_invalidate_system_caches_always(nee CLOBBER_CACHE_ALWAYS) is enabled, no such termination occurs.That's because cache invalidation forces postgres_fdw connectionsto be dropped at end of transaction, so that there's no worker toterminate. There's a race condition as to whether the worker willmanage to get out of the BackendStatusArray before we look, but atleast on buildfarm member hyrax, it's failed twice in two attempts.Rather than re-lobotomizing the test, let's fix this by transientlydisabling debug_invalidate_system_caches_always. (Hooray for thatbeing just a GUC nowadays, rather than a compile-time option.)If this proves not to be enough to make the test stable, we cando the other thing instead.Discussion:https://postgr.es/m/3854538.1620081771@sss.pgh.pa.us
1 parente798d09 commit1273a15

File tree

2 files changed

+23
-6
lines changed

2 files changed

+23
-6
lines changed

‎contrib/postgres_fdw/expected/postgres_fdw.out

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9204,6 +9204,12 @@ WARNING: there is no transaction in progress
92049204
-- Change application_name of remote connection to special one
92059205
-- so that we can easily terminate the connection later.
92069206
ALTER SERVER loopback OPTIONS (application_name 'fdw_retry_check');
9207+
-- If debug_invalidate_system_caches_always is active, it results in
9208+
-- dropping remote connections after every transaction, making it
9209+
-- impossible to test termination meaningfully. So turn that off
9210+
-- for this test.
9211+
SET debug_invalidate_system_caches_always = 0;
9212+
-- Make sure we have a remote connection.
92079213
SELECT 1 FROM ft1 LIMIT 1;
92089214
?column?
92099215
----------
@@ -9227,9 +9233,8 @@ SELECT 1 FROM ft1 LIMIT 1;
92279233
1
92289234
(1 row)
92299235

9230-
-- If the query detects the broken connection when starting new remote
9231-
-- subtransaction, it doesn't reestablish new connection and should fail.
9232-
-- The text of the error might vary across platforms, so don't show it.
9236+
-- If we detect the broken connection when starting a new remote
9237+
-- subtransaction, we should fail instead of establishing a new connection.
92339238
-- Terminate the remote connection and wait for the termination to complete.
92349239
SELECT pg_terminate_backend(pid, 180000) FROM pg_stat_activity
92359240
WHERE application_name = 'fdw_retry_check';
@@ -9239,11 +9244,13 @@ SELECT pg_terminate_backend(pid, 180000) FROM pg_stat_activity
92399244
(1 row)
92409245

92419246
SAVEPOINT s;
9247+
-- The text of the error might vary across platforms, so only show SQLSTATE.
92429248
\set VERBOSITY sqlstate
92439249
SELECT 1 FROM ft1 LIMIT 1; -- should fail
92449250
ERROR: 08006
92459251
\set VERBOSITY default
92469252
COMMIT;
9253+
RESET debug_invalidate_system_caches_always;
92479254
-- =============================================================================
92489255
-- test connection invalidation cases and postgres_fdw_get_connections function
92499256
-- =============================================================================

‎contrib/postgres_fdw/sql/postgres_fdw.sql

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2795,6 +2795,14 @@ ROLLBACK;
27952795
-- Change application_name of remote connection to special one
27962796
-- so that we can easily terminate the connection later.
27972797
ALTER SERVER loopback OPTIONS (application_name'fdw_retry_check');
2798+
2799+
-- If debug_invalidate_system_caches_always is active, it results in
2800+
-- dropping remote connections after every transaction, making it
2801+
-- impossible to test termination meaningfully. So turn that off
2802+
-- for this test.
2803+
SET debug_invalidate_system_caches_always=0;
2804+
2805+
-- Make sure we have a remote connection.
27982806
SELECT1FROM ft1LIMIT1;
27992807

28002808
-- Terminate the remote connection and wait for the termination to complete.
@@ -2806,18 +2814,20 @@ SELECT pg_terminate_backend(pid, 180000) FROM pg_stat_activity
28062814
BEGIN;
28072815
SELECT1FROM ft1LIMIT1;
28082816

2809-
-- If the query detects the broken connection when starting new remote
2810-
-- subtransaction, it doesn't reestablish new connection and should fail.
2811-
-- The text of the error might vary across platforms, so don't show it.
2817+
-- If we detect the broken connection when starting a new remote
2818+
-- subtransaction, we should fail instead of establishing a new connection.
28122819
-- Terminate the remote connection and wait for the termination to complete.
28132820
SELECT pg_terminate_backend(pid,180000)FROM pg_stat_activity
28142821
WHERE application_name='fdw_retry_check';
28152822
SAVEPOINT s;
2823+
-- The text of the error might vary across platforms, so only show SQLSTATE.
28162824
\set VERBOSITY sqlstate
28172825
SELECT1FROM ft1LIMIT1;-- should fail
28182826
\set VERBOSITY default
28192827
COMMIT;
28202828

2829+
RESET debug_invalidate_system_caches_always;
2830+
28212831
-- =============================================================================
28222832
-- test connection invalidation cases and postgres_fdw_get_connections function
28232833
-- =============================================================================

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp