diff options
| author | Tom Lane <tgl@sss.pgh.pa.us> | 2008-03-08 21:57:59 +0000 |
|---|---|---|
| committer | Tom Lane <tgl@sss.pgh.pa.us> | 2008-03-08 21:57:59 +0000 |
| commit | 6f10eb21118f1ce72d4dd144c494749e25658d51 (patch) | |
| tree | ee6177fe0b793d75c21cc1e09c264fc90153000c /src/include | |
| parent | cc05d051a6392810243118191076641d1430c4e4 (diff) | |
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.
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/access/heapam.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/include/access/heapam.h b/src/include/access/heapam.h index 78eca9533f7..a6dda552f2e 100644 --- a/src/include/access/heapam.h +++ b/src/include/access/heapam.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/access/heapam.h,v 1.130 2008/01/14 01:39:09 tgl Exp $ + * $PostgreSQL: pgsql/src/include/access/heapam.h,v 1.131 2008/03/08 21:57:59 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -258,6 +258,11 @@ extern void heap_page_prune_opt(Relation relation, Buffer buffer, extern int heap_page_prune(Relation relation, Buffer buffer, TransactionId OldestXmin, bool redirect_move, bool report_stats); +extern void heap_page_prune_execute(Relation reln, Buffer buffer, + OffsetNumber *redirected, int nredirected, + OffsetNumber *nowdead, int ndead, + OffsetNumber *nowunused, int nunused, + bool redirect_move); extern void heap_get_root_tuples(Page page, OffsetNumber *root_offsets); /* in heap/syncscan.c */ |
