postgresql/src
Andres Freund 46c450c0b0 Do all-visible handling in lazy_vacuum_page() outside its critical section.
Since fdf9e21196 lazy_vacuum_page() rechecks the all-visible status
of pages in the second pass over the heap. It does so inside a
critical section, but both visibilitymap_test() and
heap_page_is_all_visible() perform operations that should not happen
inside one. The former potentially performs IO and both potentially do
memory allocations.

To fix, simply move all the all-visible handling outside the critical
section. Doing so means that the PD_ALL_VISIBLE on the page won't be
included in the full page image of the HEAP2_CLEAN record anymore. But
that's fine, the flag will be set by the HEAP2_VISIBLE logged later.

Backpatch to 9.3 where the problem was introduced. The bug only came
to light due to the assertion added in 4a170ee9 and isn't likely to
cause problems in production scenarios. The worst outcome is a
avoidable PANIC restart.

This also gets rid of the difference in the order of operations
between master and standby mentioned in 2a8e1ac5.

Per reports from David Leverton and Keith Fiske in bug #10533.
2014-06-20 11:10:02 +02:00
..
backend Do all-visible handling in lazy_vacuum_page() outside its critical section. 2014-06-20 11:10:02 +02:00
bin Fix pg_restore's processing of old-style BLOB COMMENTS data. 2014-06-12 20:14:39 -04:00
common Remove tabs after spaces in C comments 2014-05-06 11:26:28 -04:00
include Avoid leaking memory while evaluating arguments for a table function. 2014-06-19 22:13:47 -04:00
interfaces Revert "Fix bogus %name-prefix option syntax in all our Bison files." 2014-05-28 19:28:37 -04:00
makefiles Don't use deprecated dllwrap on Cygwin. 2014-02-01 16:13:32 -05:00
pl Make plpython_unicode regression test work in more database encodings. 2014-06-03 12:02:13 -04:00
port Add mkdtemp() to libpgport. 2014-06-14 09:41:17 -04:00
template Remove _FORTIFY_SOURCE 2012-10-10 21:42:38 -04:00
test Secure Unix-domain sockets of "make check" temporary clusters. 2014-06-14 09:41:17 -04:00
timezone Remove tabs after spaces in C comments 2014-05-06 11:26:28 -04:00
tools Add mkdtemp() to libpgport. 2014-06-14 09:41:17 -04:00
tutorial Remove tabs after spaces in C comments 2014-05-06 11:26:28 -04:00
.gitignore Convert cvsignore to gitignore, and add .gitignore for build targets. 2010-09-22 12:57:04 +02:00
bcc32.mak Autoconfiscate selection of 64-bit int type for 64-bit large object API. 2012-10-07 21:52:43 -04:00
DEVELOPERS Replace a couple of references to files that no longer exist in the source 2009-05-04 08:08:47 +00:00
Makefile Create libpgcommon, and move pg_malloc et al to it 2013-02-12 11:21:05 -03:00
Makefile.global.in Revert "Backpatch pgxs vpath build and installation fixes." 2013-10-07 22:32:04 -04:00
Makefile.shlib fix whitespace 2014-02-01 16:30:22 -05:00
nls-global.mk NLS: Use msgmerge --previous option 2012-12-13 23:12:12 -05:00
win32.mak Autoconfiscate selection of 64-bit int type for 64-bit large object API. 2012-10-07 21:52:43 -04:00