Remove unnecessary dependency on statement_timeout in prepared_xacts test.

Tom Lane <tgl@sss.pgh.pa.us>

Commit: d999b896d801130da461d55560188e7c4d36819a
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: 2017-03-13T20:46:51Z
Releases: 9.5.7
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.

Files