1
0
mirror of https://github.com/postgres/postgres.git synced 2025-12-24 06:01:07 +03:00

Redefine the lp_flags field of item pointers as having four states, rather

than two independent bits (one of which was never used in heap pages anyway,
or at least hadn't been in a very long time).  This gives us flexibility to
add the HOT notions of redirected and dead item pointers without requiring
anything so klugy as magic values of lp_off and lp_len.  The state values
are chosen so that for the states currently in use (pre-HOT) there is no
change in the physical representation.
This commit is contained in:
Tom Lane
2007-09-12 22:10:26 +00:00
parent eb0a7735ba
commit 6889303531
31 changed files with 278 additions and 185 deletions

View File

@@ -140,7 +140,7 @@ GetBTPageStatistics(BlockNumber blkno, Buffer buffer, BTPageStat * stat)
item_size += IndexTupleSize(itup);
if (!ItemIdDeleted(id))
if (!ItemIdIsDead(id))
stat->live_items++;
else
stat->dead_items++;

View File

@@ -18,7 +18,7 @@
* Copyright (c) 2007, PostgreSQL Global Development Group
*
* IDENTIFICATION
* $PostgreSQL: pgsql/contrib/pageinspect/heapfuncs.c,v 1.1 2007/05/17 19:11:24 momjian Exp $
* $PostgreSQL: pgsql/contrib/pageinspect/heapfuncs.c,v 1.2 2007/09/12 22:10:25 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -156,15 +156,15 @@ heap_page_items(PG_FUNCTION_ARGS)
* could be corrupt in many other ways, but at least we won't
* crash.
*/
if ((lp_len >= sizeof(HeapTupleHeader)) &&
(lp_offset == MAXALIGN(lp_offset)) &&
(lp_offset + lp_len <= raw_page_size) &&
ItemIdIsUsed(id))
if (ItemIdHasStorage(id) &&
lp_len >= sizeof(HeapTupleHeader) &&
lp_offset == MAXALIGN(lp_offset) &&
lp_offset + lp_len <= raw_page_size)
{
HeapTupleHeader tuphdr;
int bits_len;
/* Extract infromation from the tuple header */
/* Extract information from the tuple header */
tuphdr = (HeapTupleHeader) PageGetItem(page, id);

View File

@@ -1,5 +1,5 @@
/*
* $PostgreSQL: pgsql/contrib/pgstattuple/pgstattuple.c,v 1.28 2007/08/26 23:59:50 tgl Exp $
* $PostgreSQL: pgsql/contrib/pgstattuple/pgstattuple.c,v 1.29 2007/09/12 22:10:25 tgl Exp $
*
* Copyright (c) 2001,2002 Tatsuo Ishii
*
@@ -477,7 +477,7 @@ pgstat_index_page(pgstattuple_type * stat, Page page,
{
ItemId itemid = PageGetItemId(page, i);
if (ItemIdDeleted(itemid))
if (ItemIdIsDead(itemid))
{
stat->dead_tuple_count++;
stat->dead_tuple_len += ItemIdGetLength(itemid);