]> granicus.if.org Git - postgresql/commit
Remove unnecessary dependency on statement_timeout in prepared_xacts test.
authorTom Lane <tgl@sss.pgh.pa.us>
Mon, 13 Mar 2017 20:46:32 +0000 (16:46 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Mon, 13 Mar 2017 20:46:55 +0000 (16:46 -0400)
commit123f377a6602fce63c6d327b5f2304b78c8a1a94
treeb0e0f4ecd6b78deaf42a717095d87c99a88937df
parente060baaad1ed6c2e1cc9758d8ba3c770c8f27595
Remove unnecessary dependency on statement_timeout in prepared_xacts test.

Rather than waiting around for statement_timeout to expire, we can just
try to take the table's lock in nowait mode.  This saves some fraction
under 4 seconds when running this test with prepared xacts available,
and it guards against timeout-expired-anyway failures on very slow
machines when prepared xacts are not available, as seen in a recent
failure on axolotl for instance.

This approach could fail if autovacuum were to take an exclusive lock
on the test table concurrently, but there's no reason for it to do so.

Since the main point here is to improve stability in the buildfarm,
back-patch to all supported branches.
src/test/regress/expected/prepared_xacts.out
src/test/regress/expected/prepared_xacts_1.out
src/test/regress/sql/prepared_xacts.sql