pgsql: Update FSM on WAL replay.

From: heikki(at)postgresql(dot)org (Heikki Linnakangas)
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Update FSM on WAL replay.
Date: 2008-10-31 19:40:27
Message-ID: 20081031194027.2A0947545A4@cvs.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Log Message:
-----------
Update FSM on WAL replay. This is a bit limited; the FSM is only updated
on non-full-page-image WAL records, and quite arbitrarily, only if there's
less than 20% free space on the page after the insert/update (not on HOT
updates, though). The 20% cutoff should avoid most of the overhead, when
replaying a bulk insertion, for example, while ensuring that pages that
are full are marked as full in the FSM.

This is mostly to avoid the nasty worst case scenario, where you replay
from a PITR archive, and the FSM information in the base backup is really
out of date. If there was a lot of pages that the outdated FSM claims to
have free space, but don't actually have any, the first unlucky inserter
after the recovery would traverse through all those pages, just to find
out that they're full. We didn't have this problem with the old FSM
implementation, because we simply threw the FSM information away on a
non-clean shutdown.

Modified Files:
--------------
pgsql/src/backend/access/heap:
heapam.c (r1.267 -> r1.268)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/access/heap/heapam.c?r1=1.267&r2=1.268)
pgsql/src/backend/storage/freespace:
freespace.c (r1.65 -> r1.66)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/storage/freespace/freespace.c?r1=1.65&r2=1.66)
pgsql/src/include/storage:
freespace.h (r1.29 -> r1.30)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/storage/freespace.h?r1=1.29&r2=1.30)

Browse pgsql-committers by date

  From Date Subject
Next Message Simon Riggs 2008-10-31 20:37:40 Re: pgsql: Unite ReadBufferWithFork, ReadBufferWithStrategy, and
Previous Message Tom Lane 2008-10-31 19:37:56 pgsql: Allow SQL-language functions to return the output of an