Commit dfed0012 authored by Alvaro Herrera's avatar Alvaro Herrera

Have the rewriteheap code freeze old tuples. This is safe because it is only

applied to live tuples older than a recent Xmin, not to tuples that may be part
of an update chain.  Those still keep their original markings.

This patch makes it possible for CLUSTER to advance relfrozenxid, thus avoiding
the need of vacuuming the table for Xid wraparound purposes.  That will be
patched separately.

Patch from Heikki Linnakangas.
parent d365ce1f
...@@ -96,7 +96,7 @@ ...@@ -96,7 +96,7 @@
* Portions Copyright (c) 1994-5, Regents of the University of California * Portions Copyright (c) 1994-5, Regents of the University of California
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/access/heap/rewriteheap.c,v 1.3 2007/04/17 21:29:31 tgl Exp $ * $PostgreSQL: pgsql/src/backend/access/heap/rewriteheap.c,v 1.4 2007/05/16 16:36:56 alvherre Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -538,6 +538,8 @@ raw_heap_insert(RewriteState state, HeapTuple tup) ...@@ -538,6 +538,8 @@ raw_heap_insert(RewriteState state, HeapTuple tup)
OffsetNumber newoff; OffsetNumber newoff;
HeapTuple heaptup; HeapTuple heaptup;
heap_freeze_tuple(tup->t_data, state->rs_oldest_xmin, InvalidBuffer);
/* /*
* If the new tuple is too big for storage or contains already toasted * If the new tuple is too big for storage or contains already toasted
* out-of-line attributes from some other relation, invoke the toaster. * out-of-line attributes from some other relation, invoke the toaster.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment