postgresql/src
Alvaro Herrera 2393c7d102 Fix a couple of bugs in MultiXactId freezing
Both heap_freeze_tuple() and heap_tuple_needs_freeze() neglected to look
into a multixact to check the members against cutoff_xid.  This means
that a very old Xid could survive hidden within a multi, possibly
outliving its CLOG storage.  In the distant future, this would cause
clog lookup failures:
ERROR:  could not access status of transaction 3883960912
DETAIL:  Could not open file "pg_clog/0E78": No such file or directory.

This mostly was problematic when the updating transaction aborted, since
in that case the row wouldn't get pruned away earlier in vacuum and the
multixact could possibly survive for a long time.  In many cases, data
that is inaccessible for this reason way can be brought back
heuristically.

As a second bug, heap_freeze_tuple() didn't properly handle multixacts
that need to be frozen according to cutoff_multi, but whose updater xid
is still alive.  Instead of preserving the update Xid, it just set Xmax
invalid, which leads to both old and new tuple versions becoming
visible.  This is pretty rare in practice, but a real threat
nonetheless.  Existing corrupted rows, unfortunately, cannot be repaired
in an automated fashion.

Existing physical replicas might have already incorrectly frozen tuples
because of different behavior than in master, which might only become
apparent in the future once pg_multixact/ is truncated; it is
recommended that all clones be rebuilt after upgrading.

Following code analysis caused by bug report by J Smith in message
CADFUPgc5bmtv-yg9znxV-vcfkb+JPRqs7m2OesQXaM_4Z1JpdQ@mail.gmail.com
and privately by F-Secure.

Backpatch to 9.3, where freezing of MultiXactIds was introduced.

Analysis and patch by Andres Freund, with some tweaks by Álvaro.
2013-11-29 21:47:25 -03:00
..
backend Fix a couple of bugs in MultiXactId freezing 2013-11-29 21:47:25 -03:00
bin Fix assorted issues in pg_ctl's pgwin32_CommandLine(). 2013-11-29 18:34:07 -05:00
common Use improved vsnprintf calling logic in more places. 2013-10-24 21:43:57 -04:00
include Truncate pg_multixact/'s contents during crash recovery 2013-11-29 21:47:15 -03:00
interfaces ECPG: Fix searching for quoted cursor names case-sensitively. 2013-11-27 11:02:13 +01:00
makefiles Remove leftovers of IRIX port 2013-11-12 06:39:36 -05:00
pl Fix plpython3 expected output. 2013-11-27 14:25:13 +02:00
port Ensure _dosmaperr() actually sets errno correctly. 2013-11-23 18:24:26 -05:00
template Remove leftovers of IRIX port 2013-11-12 06:39:36 -05:00
test Don't TransactionIdDidAbort in HeapTupleGetUpdateXid 2013-11-29 21:47:21 -03:00
timezone Fix whitespace issues found by git diff --check, add gitattributes 2013-11-10 14:48:29 -05:00
tools Fix whitespace 2013-11-13 21:25:52 -05:00
tutorial
.gitignore
bcc32.mak
DEVELOPERS
Makefile
Makefile.global.in Switch dependency order of libpgcommon and libpgport 2013-10-17 22:02:35 -04:00
Makefile.shlib Remove IRIX port. 2013-10-18 08:14:21 -04:00
nls-global.mk Remove maintainer-check target, fold into normal build 2013-10-10 20:11:56 -04:00
win32.mak