postgresql/src/backend
Tom Lane 9dd4178cec Be more predictable about reporting "lock timeout" vs "statement timeout".
If both timeout indicators are set when we arrive at ProcessInterrupts,
we've historically just reported "lock timeout".  However, some buildfarm
members have been observed to fail isolationtester's timeouts test by
reporting "lock timeout" when the statement timeout was expected to fire
first.  The cause seems to be that the process is allowed to sleep longer
than expected (probably due to heavy machine load) so that the lock
timeout happens before we reach the point of reporting the error, and
then this arbitrary tiebreak rule does the wrong thing.  We can improve
matters by comparing the scheduled timeout times to decide which error
to report.

I had originally proposed greatly reducing the 1-second window between
the two timeouts in the test cases.  On reflection that is a bad idea,
at least for the case where the lock timeout is expected to fire first,
because that would assume that it takes negligible time to get from
statement start to the beginning of the lock wait.  Thus, this patch
doesn't completely remove the risk of test failures on slow machines.
Empirically, however, the case this handles is the one we are seeing
in the buildfarm.  The explanation may be that the other case requires
the scheduler to take the CPU away from a busy process, whereas the
case fixed here only requires the scheduler to not give the CPU back
right away to a process that has been woken from a multi-second sleep
(and, perhaps, has been swapped out meanwhile).

Back-patch to 9.3 where the isolationtester timeouts test was added.

Discussion: <8693.1464314819@sss.pgh.pa.us>
2016-05-27 10:40:20 -04:00
..
access Fix BTREE_BUILD_STATS build. 2016-05-23 19:41:11 -04:00
bootstrap Revert CREATE INDEX ... INCLUDING ... 2016-04-08 21:52:13 +03:00
catalog sql_features: Fix typos 2016-05-13 21:24:54 -04:00
commands Fetch XIDs atomically during vac_truncate_clog(). 2016-05-24 15:47:51 -04:00
executor Fix latent crash in do_text_output_multiline(). 2016-05-23 14:16:40 -04:00
foreign Fix whitespace 2016-04-11 14:44:51 -04:00
lib Remove mergeHyperLogLog. 2016-04-27 10:55:32 -04:00
libpq Add authentication parameters compat_realm and upn_usename for SSPI 2016-04-08 20:28:38 +02:00
main Avoid crash on old Windows with AVX2-capable CPU for VS2013 builds 2016-03-10 14:10:18 +01:00
nodes Support IndexElem in raw_expression_tree_walker(). 2016-05-23 19:23:36 -04:00
optimizer Disable physical tlist if any Var would need multiple sortgroupref labels. 2016-05-26 14:52:30 -04:00
parser Remove option to write USING before opclass name in CREATE INDEX. 2016-05-25 19:11:00 -04:00
po Translation updates 2016-05-09 10:04:41 -04:00
port Support building with Visual Studio 2015 2016-04-29 08:09:07 -04:00
postmaster Ensure that backends see up-to-date statistics for shared catalogs. 2016-05-25 17:48:15 -04:00
regex Suppress compiler warnings about useless comparison of unsigned to zero. 2016-02-15 17:12:16 -05:00
replication Revert timeline following in replication slots 2016-05-04 17:32:22 -03:00
rewrite Improve error message for rejecting RETURNING clauses with dropped columns. 2016-02-29 19:11:38 -05:00
snowball Update copyright for 2016 2016-01-02 13:33:40 -05:00
storage Fix range check for effective_io_concurrency 2016-05-24 14:55:34 -04:00
tcop Be more predictable about reporting "lock timeout" vs "statement timeout". 2016-05-27 10:40:20 -04:00
tsearch Tweak a few more things in preparation for upcoming pgindent run. 2016-05-03 10:52:25 -04:00
utils Be more predictable about reporting "lock timeout" vs "statement timeout". 2016-05-27 10:40:20 -04:00
.gitignore Add .gitignore entries for AIX-specific intermediate build artifacts. 2015-07-08 20:44:22 -04:00
Makefile Support multiple synchronous standby servers. 2016-04-06 17:18:25 +09:00
common.mk Remove maintainer-check target, fold into normal build 2013-10-10 20:11:56 -04:00
nls.mk Remove trailing slashes from directories in find command 2015-09-18 22:06:54 -04:00