Skip to content

Commit 7660751

Browse files
committed
Use PG_TEST_TIMEOUT_DEFAULT for pg_regress suite non-elapsing timeouts.
Currently, only contrib/test_decoding has this property. Use \getenv to load the timeout value. Discussion: https://postgr.es/m/20220218052842.GA3627003@rfd.leadboat.com
1 parent f2698ea commit 7660751

File tree

4 files changed

+16
-4
lines changed

4 files changed

+16
-4
lines changed

contrib/test_decoding/expected/twophase.out

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,10 @@ WHERE locktype = 'relation'
137137
(3 rows)
138138

139139
-- The above CLUSTER command shouldn't cause a timeout on 2pc decoding.
140-
SET statement_timeout = '180s';
140+
\set env_timeout ''
141+
\getenv env_timeout PG_TEST_TIMEOUT_DEFAULT
142+
SELECT COALESCE(NULLIF(:'env_timeout', ''), '180') || 's' AS timeout \gset
143+
SET statement_timeout = :'timeout';
141144
SELECT data FROM pg_logical_slot_get_changes('regression_slot', NULL, NULL, 'include-xids', '0', 'skip-empty-xacts', '1');
142145
data
143146
---------------------------------------------------------------------------

contrib/test_decoding/sql/twophase.sql

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,10 @@ FROM pg_locks
6969
WHERE locktype = 'relation'
7070
AND relation = 'test_prepared1'::regclass;
7171
-- The above CLUSTER command shouldn't cause a timeout on 2pc decoding.
72-
SET statement_timeout = '180s';
72+
\set env_timeout ''
73+
\getenv env_timeout PG_TEST_TIMEOUT_DEFAULT
74+
SELECT COALESCE(NULLIF(:'env_timeout', ''), '180') || 's' AS timeout \gset
75+
SET statement_timeout = :'timeout';
7376
SELECT data FROM pg_logical_slot_get_changes('regression_slot', NULL, NULL, 'include-xids', '0', 'skip-empty-xacts', '1');
7477
RESET statement_timeout;
7578
COMMIT PREPARED 'test_prepared_lock';

src/test/regress/expected/stats.out

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,10 @@ declare
3434
updated3 bool;
3535
updated4 bool;
3636
begin
37-
-- we don't want to wait forever; loop will exit after 30 seconds
37+
-- We don't want to wait forever. No timeout suffices if the OS drops our
38+
-- stats traffic because an earlier test file left a full UDP buffer.
39+
-- Hence, don't use PG_TEST_TIMEOUT_DEFAULT, which may be large for
40+
-- can't-happen timeouts. Exit after 30 seconds.
3841
for i in 1 .. 300 loop
3942

4043
-- With parallel query, the seqscan and indexscan on tenk2 might be done

src/test/regress/sql/stats.sql

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,10 @@ declare
3333
updated3 bool;
3434
updated4 bool;
3535
begin
36-
-- we don't want to wait forever; loop will exit after 30 seconds
36+
-- We don't want to wait forever. No timeout suffices if the OS drops our
37+
-- stats traffic because an earlier test file left a full UDP buffer.
38+
-- Hence, don't use PG_TEST_TIMEOUT_DEFAULT, which may be large for
39+
-- can't-happen timeouts. Exit after 30 seconds.
3740
for i in 1 .. 300 loop
3841

3942
-- With parallel query, the seqscan and indexscan on tenk2 might be done

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy