postgresql/src
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
..
backend Be more predictable about reporting "lock timeout" vs "statement timeout". 2016-05-27 10:40:20 -04:00
bin Make pg_dump error cleanly with -j against hot standby 2016-05-26 22:14:23 +02:00
common Remove redundant message in AddUserToTokenDacl(). 2016-04-06 23:40:51 -04:00
fe_utils Fix comment. 2016-05-15 17:04:01 -04:00
include Be more predictable about reporting "lock timeout" vs "statement timeout". 2016-05-27 10:40:20 -04:00
interfaces Translation updates 2016-05-09 10:04:41 -04:00
makefiles Fix typos in comments and doc 2016-01-28 16:47:36 +09:00
pl Translation updates 2016-05-09 10:04:41 -04:00
port Fix typo in VS2015 patch 2016-04-29 09:49:31 -04:00
template Remove some remains from Alpha support removal 2015-10-29 16:40:14 -04:00
test Disable physical tlist if any Var would need multiple sortgroupref labels. 2016-05-26 14:52:30 -04:00
timezone Update time zone data files to tzdata release 2016d. 2016-05-05 20:08:58 -04:00
tools Update release instructions for translation updates 2016-05-13 21:21:47 -04:00
tutorial Update copyright for 2016 2016-01-02 13:33:40 -05:00
.gitignore
DEVELOPERS
Makefile Create src/fe_utils/, and move stuff into there from pg_dump's dumputils. 2016-03-24 15:55:57 -04:00
Makefile.global.in Create src/fe_utils/, and move stuff into there from pg_dump's dumputils. 2016-03-24 15:55:57 -04:00
Makefile.shlib AIX: Link TRANSFORM modules with their dependencies. 2015-07-15 21:00:26 -04:00
bcc32.mak Autoconfiscate selection of 64-bit int type for 64-bit large object API. 2012-10-07 21:52:43 -04:00
nls-global.mk Setup error context callback for transaction lock waits 2014-03-19 15:10:36 -03:00
win32.mak Autoconfiscate selection of 64-bit int type for 64-bit large object API. 2012-10-07 21:52:43 -04:00