pgsql: Refactor heap_page_prune so that instead of changing item states - Mailing list pgsql-committers

From tgl@postgresql.org (Tom Lane)
Subject pgsql: Refactor heap_page_prune so that instead of changing item states
Date
Msg-id 20080308215807.D0882753F34@cvs.postgresql.org
Whole thread Raw
List pgsql-committers
Log Message:
-----------
Refactor heap_page_prune so that instead of changing item states on-the-fly,
it accumulates the set of changes to be made and then applies them.  It had
to accumulate the set of changes anyway to prepare a WAL record for the
pruning action, so this isn't an enormous change; the only new complexity is
to not doubly mark tuples that are visited twice in the scan.  The main
advantage is that we can substantially reduce the scope of the critical
section in which the changes are applied, thus avoiding PANIC in foreseeable
cases like running out of memory in inval.c.  A nice secondary advantage is
that it is now far clearer that WAL replay will actually do the same thing
that the original pruning did.

This commit doesn't do anything about the open problem that
CacheInvalidateHeapTuple doesn't have the right semantics for a CTID change
caused by collapsing out a redirect pointer.  But whatever we do about that,
it'll be a good idea to not do it inside a critical section.

Tags:
----
REL8_3_STABLE

Modified Files:
--------------
    pgsql/src/backend/access/heap:
        heapam.c (r1.249.2.1 -> r1.249.2.2)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/access/heap/heapam.c?r1=1.249.2.1&r2=1.249.2.2)
        pruneheap.c (r1.6 -> r1.6.2.1)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/access/heap/pruneheap.c?r1=1.6&r2=1.6.2.1)
    pgsql/src/include/access:
        heapam.h (r1.130 -> r1.130.2.1)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/access/heapam.h?r1=1.130&r2=1.130.2.1)

pgsql-committers by date:

Previous
From: tgl@postgresql.org (Tom Lane)
Date:
Subject: pgsql: Refactor heap_page_prune so that instead of changing item states
Next
From: tgl@postgresql.org (Tom Lane)
Date:
Subject: pgsql: Modify prefix_selectivity() so that it will never estimate the