Use PG_TEST_TIMEOUT_DEFAULT for pg_regress suite non-elapsing timeouts.
authorNoah Misch <noah@leadboat.com>
Sat, 5 Mar 2022 02:53:13 +0000 (18:53 -0800)
committerNoah Misch <noah@leadboat.com>
Sat, 5 Mar 2022 02:53:13 +0000 (18:53 -0800)
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

contrib/test_decoding/expected/twophase.out
contrib/test_decoding/sql/twophase.sql
src/test/regress/expected/stats.out
src/test/regress/sql/stats.sql

index e5e0f968961710cf3a381448415f66c27360612d..e89dc74a5e449c9a695401041f1fa5bbc7d0a0a8 100644 (file)
@@ -137,7 +137,10 @@ WHERE locktype = 'relation'
 (3 rows)
 
 -- The above CLUSTER command shouldn't cause a timeout on 2pc decoding.
-SET statement_timeout = '180s';
+\set env_timeout ''
+\getenv env_timeout PG_TEST_TIMEOUT_DEFAULT
+SELECT COALESCE(NULLIF(:'env_timeout', ''), '180') || 's' AS timeout \gset
+SET statement_timeout = :'timeout';
 SELECT data FROM pg_logical_slot_get_changes('regression_slot', NULL, NULL, 'include-xids', '0', 'skip-empty-xacts', '1');
                                    data                                    
 ---------------------------------------------------------------------------
index 05f18e84948b9e548455315191d0dfe3233d886a..aff5114eb1038ff2644c0f661ef9b56257cfae79 100644 (file)
@@ -69,7 +69,10 @@ FROM pg_locks
 WHERE locktype = 'relation'
   AND relation = 'test_prepared1'::regclass;
 -- The above CLUSTER command shouldn't cause a timeout on 2pc decoding.
-SET statement_timeout = '180s';
+\set env_timeout ''
+\getenv env_timeout PG_TEST_TIMEOUT_DEFAULT
+SELECT COALESCE(NULLIF(:'env_timeout', ''), '180') || 's' AS timeout \gset
+SET statement_timeout = :'timeout';
 SELECT data FROM pg_logical_slot_get_changes('regression_slot', NULL, NULL, 'include-xids', '0', 'skip-empty-xacts', '1');
 RESET statement_timeout;
 COMMIT PREPARED 'test_prepared_lock';
index 3e9ab0915fe044bc562de3ea50f8d1ab773a56ac..b7416c8f8fbe05c7a8b60f43314f32a88f58ddca 100644 (file)
@@ -34,7 +34,10 @@ declare
   updated3 bool;
   updated4 bool;
 begin
-  -- we don't want to wait forever; loop will exit after 30 seconds
+  -- We don't want to wait forever.  No timeout suffices if the OS drops our
+  -- stats traffic because an earlier test file left a full UDP buffer.
+  -- Hence, don't use PG_TEST_TIMEOUT_DEFAULT, which may be large for
+  -- can't-happen timeouts.  Exit after 30 seconds.
   for i in 1 .. 300 loop
 
     -- With parallel query, the seqscan and indexscan on tenk2 might be done
index 82e6f24c391b5b1fe86c67a1ed1e8453d8ceb6a7..dbc2dd28b6ba2bcd8d52f2c84c19f629996145e1 100644 (file)
@@ -33,7 +33,10 @@ declare
   updated3 bool;
   updated4 bool;
 begin
-  -- we don't want to wait forever; loop will exit after 30 seconds
+  -- We don't want to wait forever.  No timeout suffices if the OS drops our
+  -- stats traffic because an earlier test file left a full UDP buffer.
+  -- Hence, don't use PG_TEST_TIMEOUT_DEFAULT, which may be large for
+  -- can't-happen timeouts.  Exit after 30 seconds.
   for i in 1 .. 300 loop
 
     -- With parallel query, the seqscan and indexscan on tenk2 might be done