mirror of
https://github.com/postgres/postgres.git
synced 2025-07-30 11:03:19 +03:00
Change the way we mark tuples as frozen.
Instead of changing the tuple xmin to FrozenTransactionId, the combination of HEAP_XMIN_COMMITTED and HEAP_XMIN_INVALID, which were previously never set together, is now defined as HEAP_XMIN_FROZEN. A variety of previous proposals to freeze tuples opportunistically before vacuum_freeze_min_age is reached have foundered on the objection that replacing xmin by FrozenTransactionId might hinder debugging efforts when things in this area go awry; this patch is intended to solve that problem by keeping the XID around (but largely ignoring the value to which it is set). Third-party code that checks for HEAP_XMIN_INVALID on tuples where HEAP_XMIN_COMMITTED might be set will be broken by this change. To fix, use the new accessor macros in htup_details.h rather than consulting the bits directly. HeapTupleHeaderGetXmin has been modified to return FrozenTransactionId when the infomask bits indicate that the tuple is frozen; use HeapTupleHeaderGetRawXmin when you already know that the tuple isn't marked commited or frozen, or want the raw value anyway. We currently do this in routines that display the xmin for user consumption, in tqual.c where it's known to be safe and important for the avoidance of extra cycles, and in the function-caching code for various procedural languages, which shouldn't invalidate the cache just because the tuple gets frozen. Robert Haas and Andres Freund
This commit is contained in:
@ -274,7 +274,7 @@ typedef struct xl_heap_inplace
|
||||
* This struct represents a 'freeze plan', which is what we need to know about
|
||||
* a single tuple being frozen during vacuum.
|
||||
*/
|
||||
#define XLH_FREEZE_XMIN 0x01
|
||||
/* 0x01 was XLH_FREEZE_XMIN */
|
||||
#define XLH_FREEZE_XVAC 0x02
|
||||
#define XLH_INVALID_XVAC 0x04
|
||||
|
||||
|
Reference in New Issue
Block a user