pgsql: Change the way we mark tuples as frozen.

Поиск
Список
Период
Сортировка
От Robert Haas
Тема pgsql: Change the way we mark tuples as frozen.
Дата
Msg-id E1VutHv-000611-ED@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
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

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/37484ad2aacef5ec794f4dd3d5cf814475180a78

Modified Files
--------------
contrib/pageinspect/heapfuncs.c       |    2 +-
src/backend/access/common/heaptuple.c |    2 +-
src/backend/access/heap/heapam.c      |   28 ++++---------
src/backend/commands/sequence.c       |    4 +-
src/backend/commands/vacuumlazy.c     |    8 ++--
src/backend/storage/buffer/README     |    3 ++
src/backend/utils/fmgr/fmgr.c         |    4 +-
src/backend/utils/time/combocid.c     |    6 +--
src/backend/utils/time/tqual.c        |   71 +++++++++++++++++----------------
src/include/access/heapam_xlog.h      |    2 +-
src/include/access/htup_details.h     |   55 ++++++++++++++++++++++++-
src/include/access/xlog_internal.h    |    2 +-
src/pl/plperl/plperl.c                |    4 +-
src/pl/plpgsql/src/pl_comp.c          |    4 +-
src/pl/plpython/plpy_procedure.c      |    6 +--
src/pl/plpython/plpy_typeio.c         |    4 +-
src/pl/tcl/pltcl.c                    |    4 +-
17 files changed, 125 insertions(+), 84 deletions(-)


В списке pgsql-committers по дате отправления:

Предыдущее
От: Fujii Masao
Дата:
Сообщение: pgsql: Rename wal_log_hintbits to wal_log_hints, per discussion on pgsq
Следующее
От: Tom Lane
Дата:
Сообщение: pgsql: Support ordered-set (WITHIN GROUP) aggregates.