From: Tom Lane Date: Thu, 20 Jul 2006 00:46:56 +0000 (+0000) Subject: Don't try to truncate multixact SLRU files in checkpoints done during xlog X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=5036b96f29eaad67517c7041d974d04c6e2dc8ed;p=users%2Fbernd%2Fpostgres.git 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. --- diff --git a/src/backend/access/transam/multixact.c b/src/backend/access/transam/multixact.c index b139d6beef..fedc8dcb17 100644 --- a/src/backend/access/transam/multixact.c +++ b/src/backend/access/transam/multixact.c @@ -1490,9 +1490,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(); } /*