postgresql/src/backend
Alvaro Herrera 215ac4ad65 Truncate pg_multixact/'s contents during crash recovery
Commit 9dc842f08 of 8.2 era prevented MultiXact truncation during crash
recovery, because there was no guarantee that enough state had been
setup, and because it wasn't deemed to be a good idea to remove data
during crash recovery anyway.  Since then, due to Hot-Standby, streaming
replication and PITR, the amount of time a cluster can spend doing crash
recovery has increased significantly, to the point that a cluster may
even never come out of it.  This has made not truncating the content of
pg_multixact/ not defensible anymore.

To fix, take care to setup enough state for multixact truncation before
crash recovery starts (easy since checkpoints contain the required
information), and move the current end-of-recovery actions to a new
TrimMultiXact() function, analogous to TrimCLOG().

At some later point, this should probably done similarly to the way
clog.c is doing it, which is to just WAL log truncations, but we can't
do that for the back branches.

Back-patch to 9.0.  8.4 also has the problem, but since there's no hot
standby there, it's much less pressing.  In 9.2 and earlier, this patch
is simpler than in newer branches, because multixact access during
recovery isn't required.  Add appropriate checks to make sure that's not
happening.

Andres Freund
2013-11-29 21:48:15 -03:00
..
access Truncate pg_multixact/'s contents during crash recovery 2013-11-29 21:48:15 -03:00
bootstrap Prevent memory leaks from accumulating across printtup() calls. 2013-11-03 11:33:09 -05:00
catalog Don't fail for bad GUCs in CREATE FUNCTION with check_function_bodies off. 2013-09-03 18:32:23 -04:00
commands Fix full-table-vacuum request mechanism for MultiXactIds 2013-11-29 21:48:11 -03:00
executor Prevent display of dropped columns in row constraint violation messages. 2013-11-07 14:41:39 -05:00
foreign Arrange to cache FdwRoutine structs in foreign tables' relcache entries. 2013-03-06 23:48:09 -05:00
lib Reset the binary heap in MergeAppend rescans. 2013-08-30 19:15:32 -04:00
libpq Fix memory leak when an empty ident file is reloaded. 2013-10-24 14:05:34 +03:00
main pgindent run for release 9.3 2013-05-29 16:58:43 -04:00
nodes Fix incorrect loop counts in tidbitmap.c. 2013-11-15 18:34:21 -05:00
optimizer Flatten join alias Vars before pulling up targetlist items from a subquery. 2013-11-22 14:37:25 -05:00
parser Fix array slicing of int2vector and oidvector values. 2013-11-23 20:04:00 -05:00
po Translation updates 2013-10-07 16:27:04 -04:00
port Message style improvements 2013-08-07 22:53:50 -04:00
postmaster Fix assorted race conditions in the new timeout infrastructure. 2013-11-29 16:41:03 -05:00
regex Fix regex match failures for backrefs combined with non-greedy quantifiers. 2013-07-18 21:22:43 -04:00
replication Don't crash when pg_xlog is empty and pg_basebackup -x is used 2013-08-24 17:14:18 +02:00
rewrite Fix breakage of MV column name list usage. 2013-11-04 14:45:18 -06:00
snowball Update copyrights for 2013 2013-01-01 17:15:01 -05:00
storage Be sure to release proc->backendLock after SetupLockInTable() failure. 2013-11-29 17:35:12 -05:00
tcop Fix assorted race conditions in the new timeout infrastructure. 2013-11-29 16:41:03 -05:00
tsearch pgindent run for release 9.3 2013-05-29 16:58:43 -04:00
utils Fix assorted race conditions in the new timeout infrastructure. 2013-11-29 16:41:03 -05:00
.gitignore Add gitignore for mingw/cygwin build outputs 2011-06-09 18:11:47 +02:00
common.mk Call check_keywords.pl in maintainer-check 2012-02-27 13:53:12 +02:00
Makefile Move relpath() to libpgcommon 2013-02-21 22:46:17 -03:00
nls.mk Add libpgcommon to backend gettext source files 2013-10-21 06:20:05 -04:00