postgres.git / summary / log / commit / refs

commit    9dc842f0832fd71eda826349a0c17ecf8ae93b84
Author:   Tom Lane <tgl@sss.pgh.pa.us>
Date:     Thu Jul 20 00:46:42 2006 +0000
First released in: 8.2.0, 8.1.5

    Don't try to truncate multixact SLRU files in checkpoints done during xlog
    recovery.  In the first place, it doesn't work because slru's
    latest_page_number isn't set up yet (this is why we've been hearing reports
    of strange "apparent wraparound" log messages during crash recovery, but
    only from people who'd managed to advance their next-mxact counters some
    considerable distance from 0).  In the second place, it seems a bit unwise
    to be throwing away data during crash recovery anwyway.  This latter
    consideration convinces me to just disable truncation during recovery,
    rather than computing latest_page_number and pushing ahead.


src/backend/access/transam/multixact.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/backend/access/transam/multixact.c b/src/backend/access/transam/multixact.c index 4eed6a64b66..ae5272286a2 100644 --- a/src/backend/access/transam/multixact.c +++ b/src/backend/access/transam/multixact.c @@ -42,7 +42,7 @@ * Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/backend/access/transam/multixact.c,v 1.19 2006/07/13 16:49:13 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/access/transam/multixact.c,v 1.20 2006/07/20 00:46:42 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -1493,9 +1493,14 @@ CheckPointMultiXact(void) /* * Truncate the SLRU files. This could be done at any time, but - * checkpoint seems a reasonable place for it. + * checkpoint seems a reasonable place for it. There is one exception: + * if we are called during xlog recovery, then shared->latest_page_number + * isn't valid (because StartupMultiXact hasn't been called yet) and + * so SimpleLruTruncate would get confused. It seems best not to risk + * removing any data during recovery anyway, so don't truncate. */ - TruncateMultiXact(); + if (!InRecovery) + TruncateMultiXact(); } /* [parent: a8e44f0b1bb0]