Commit 9d035f42 authored by Tom Lane's avatar Tom Lane

Clean up the use of some page-header-access macros: principally, use

SizeOfPageHeaderData instead of sizeof(PageHeaderData) in places where that
makes the code clearer, and avoid casting between Page and PageHeader where
possible.  Zdenek Kotala, with some additional cleanup by Heikki Linnakangas.

I did not apply the parts of the proposed patch that would have resulted in
slightly changing the on-disk format of hash indexes; it seems to me that's
not a win as long as there's any chance of having in-place upgrade for 8.4.
parent 45efb09a
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/access/gist/gistutil.c,v 1.29 2008/06/19 00:46:03 alvherre Exp $ * $PostgreSQL: pgsql/src/backend/access/gist/gistutil.c,v 1.30 2008/07/13 20:45:46 tgl Exp $
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
#include "postgres.h" #include "postgres.h"
...@@ -591,8 +591,7 @@ gistcheckpage(Relation rel, Buffer buf) ...@@ -591,8 +591,7 @@ gistcheckpage(Relation rel, Buffer buf)
/* /*
* Additionally check that the special area looks sane. * Additionally check that the special area looks sane.
*/ */
if (((PageHeader) (page))->pd_special != if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GISTPageOpaqueData)))
(BLCKSZ - MAXALIGN(sizeof(GISTPageOpaqueData))))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_INDEX_CORRUPTED), (errcode(ERRCODE_INDEX_CORRUPTED),
errmsg("index \"%s\" contains corrupted page at block %u", errmsg("index \"%s\" contains corrupted page at block %u",
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/access/hash/hashutil.c,v 1.55 2008/06/19 00:46:03 alvherre Exp $ * $PostgreSQL: pgsql/src/backend/access/hash/hashutil.c,v 1.56 2008/07/13 20:45:47 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -164,8 +164,7 @@ _hash_checkpage(Relation rel, Buffer buf, int flags) ...@@ -164,8 +164,7 @@ _hash_checkpage(Relation rel, Buffer buf, int flags)
/* /*
* Additionally check that the special area looks sane. * Additionally check that the special area looks sane.
*/ */
if (((PageHeader) (page))->pd_special != if (PageGetSpecialSize(page) != MAXALIGN(sizeof(HashPageOpaqueData)))
(BLCKSZ - MAXALIGN(sizeof(HashPageOpaqueData))))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_INDEX_CORRUPTED), (errcode(ERRCODE_INDEX_CORRUPTED),
errmsg("index \"%s\" contains corrupted page at block %u", errmsg("index \"%s\" contains corrupted page at block %u",
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/access/heap/heapam.c,v 1.260 2008/06/19 00:46:03 alvherre Exp $ * $PostgreSQL: pgsql/src/backend/access/heap/heapam.c,v 1.261 2008/07/13 20:45:47 tgl Exp $
* *
* *
* INTERFACE ROUTINES * INTERFACE ROUTINES
...@@ -1343,7 +1343,7 @@ heap_fetch(Relation relation, ...@@ -1343,7 +1343,7 @@ heap_fetch(Relation relation,
ItemPointer tid = &(tuple->t_self); ItemPointer tid = &(tuple->t_self);
ItemId lp; ItemId lp;
Buffer buffer; Buffer buffer;
PageHeader dp; Page page;
OffsetNumber offnum; OffsetNumber offnum;
bool valid; bool valid;
...@@ -1356,14 +1356,14 @@ heap_fetch(Relation relation, ...@@ -1356,14 +1356,14 @@ heap_fetch(Relation relation,
* Need share lock on buffer to examine tuple commit status. * Need share lock on buffer to examine tuple commit status.
*/ */
LockBuffer(buffer, BUFFER_LOCK_SHARE); LockBuffer(buffer, BUFFER_LOCK_SHARE);
dp = (PageHeader) BufferGetPage(buffer); page = BufferGetPage(buffer);
/* /*
* We'd better check for out-of-range offnum in case of VACUUM since the * We'd better check for out-of-range offnum in case of VACUUM since the
* TID was obtained. * TID was obtained.
*/ */
offnum = ItemPointerGetOffsetNumber(tid); offnum = ItemPointerGetOffsetNumber(tid);
if (offnum < FirstOffsetNumber || offnum > PageGetMaxOffsetNumber(dp)) if (offnum < FirstOffsetNumber || offnum > PageGetMaxOffsetNumber(page))
{ {
LockBuffer(buffer, BUFFER_LOCK_UNLOCK); LockBuffer(buffer, BUFFER_LOCK_UNLOCK);
if (keep_buf) if (keep_buf)
...@@ -1380,7 +1380,7 @@ heap_fetch(Relation relation, ...@@ -1380,7 +1380,7 @@ heap_fetch(Relation relation,
/* /*
* get the item line pointer corresponding to the requested tid * get the item line pointer corresponding to the requested tid
*/ */
lp = PageGetItemId(dp, offnum); lp = PageGetItemId(page, offnum);
/* /*
* Must check for deleted tuple. * Must check for deleted tuple.
...@@ -1402,7 +1402,7 @@ heap_fetch(Relation relation, ...@@ -1402,7 +1402,7 @@ heap_fetch(Relation relation,
/* /*
* fill in *tuple fields * fill in *tuple fields
*/ */
tuple->t_data = (HeapTupleHeader) PageGetItem((Page) dp, lp); tuple->t_data = (HeapTupleHeader) PageGetItem(page, lp);
tuple->t_len = ItemIdGetLength(lp); tuple->t_len = ItemIdGetLength(lp);
tuple->t_tableOid = RelationGetRelid(relation); tuple->t_tableOid = RelationGetRelid(relation);
...@@ -1627,7 +1627,7 @@ heap_get_latest_tid(Relation relation, ...@@ -1627,7 +1627,7 @@ heap_get_latest_tid(Relation relation,
for (;;) for (;;)
{ {
Buffer buffer; Buffer buffer;
PageHeader dp; Page page;
OffsetNumber offnum; OffsetNumber offnum;
ItemId lp; ItemId lp;
HeapTupleData tp; HeapTupleData tp;
...@@ -1638,7 +1638,7 @@ heap_get_latest_tid(Relation relation, ...@@ -1638,7 +1638,7 @@ heap_get_latest_tid(Relation relation,
*/ */
buffer = ReadBuffer(relation, ItemPointerGetBlockNumber(&ctid)); buffer = ReadBuffer(relation, ItemPointerGetBlockNumber(&ctid));
LockBuffer(buffer, BUFFER_LOCK_SHARE); LockBuffer(buffer, BUFFER_LOCK_SHARE);
dp = (PageHeader) BufferGetPage(buffer); page = BufferGetPage(buffer);
/* /*
* Check for bogus item number. This is not treated as an error * Check for bogus item number. This is not treated as an error
...@@ -1646,12 +1646,12 @@ heap_get_latest_tid(Relation relation, ...@@ -1646,12 +1646,12 @@ heap_get_latest_tid(Relation relation,
* just assume that the prior tid is OK and return it unchanged. * just assume that the prior tid is OK and return it unchanged.
*/ */
offnum = ItemPointerGetOffsetNumber(&ctid); offnum = ItemPointerGetOffsetNumber(&ctid);
if (offnum < FirstOffsetNumber || offnum > PageGetMaxOffsetNumber(dp)) if (offnum < FirstOffsetNumber || offnum > PageGetMaxOffsetNumber(page))
{ {
UnlockReleaseBuffer(buffer); UnlockReleaseBuffer(buffer);
break; break;
} }
lp = PageGetItemId(dp, offnum); lp = PageGetItemId(page, offnum);
if (!ItemIdIsNormal(lp)) if (!ItemIdIsNormal(lp))
{ {
UnlockReleaseBuffer(buffer); UnlockReleaseBuffer(buffer);
...@@ -1660,7 +1660,7 @@ heap_get_latest_tid(Relation relation, ...@@ -1660,7 +1660,7 @@ heap_get_latest_tid(Relation relation,
/* OK to access the tuple */ /* OK to access the tuple */
tp.t_self = ctid; tp.t_self = ctid;
tp.t_data = (HeapTupleHeader) PageGetItem(dp, lp); tp.t_data = (HeapTupleHeader) PageGetItem(page, lp);
tp.t_len = ItemIdGetLength(lp); tp.t_len = ItemIdGetLength(lp);
/* /*
...@@ -1964,7 +1964,7 @@ heap_delete(Relation relation, ItemPointer tid, ...@@ -1964,7 +1964,7 @@ heap_delete(Relation relation, ItemPointer tid,
TransactionId xid = GetCurrentTransactionId(); TransactionId xid = GetCurrentTransactionId();
ItemId lp; ItemId lp;
HeapTupleData tp; HeapTupleData tp;
PageHeader dp; Page page;
Buffer buffer; Buffer buffer;
bool have_tuple_lock = false; bool have_tuple_lock = false;
bool iscombo; bool iscombo;
...@@ -1974,11 +1974,11 @@ heap_delete(Relation relation, ItemPointer tid, ...@@ -1974,11 +1974,11 @@ heap_delete(Relation relation, ItemPointer tid,
buffer = ReadBuffer(relation, ItemPointerGetBlockNumber(tid)); buffer = ReadBuffer(relation, ItemPointerGetBlockNumber(tid));
LockBuffer(buffer, BUFFER_LOCK_EXCLUSIVE); LockBuffer(buffer, BUFFER_LOCK_EXCLUSIVE);
dp = (PageHeader) BufferGetPage(buffer); page = BufferGetPage(buffer);
lp = PageGetItemId(dp, ItemPointerGetOffsetNumber(tid)); lp = PageGetItemId(page, ItemPointerGetOffsetNumber(tid));
Assert(ItemIdIsNormal(lp)); Assert(ItemIdIsNormal(lp));
tp.t_data = (HeapTupleHeader) PageGetItem(dp, lp); tp.t_data = (HeapTupleHeader) PageGetItem(page, lp);
tp.t_len = ItemIdGetLength(lp); tp.t_len = ItemIdGetLength(lp);
tp.t_self = *tid; tp.t_self = *tid;
...@@ -2112,7 +2112,7 @@ l1: ...@@ -2112,7 +2112,7 @@ l1:
* the subsequent page pruning will be a no-op and the hint will be * the subsequent page pruning will be a no-op and the hint will be
* cleared. * cleared.
*/ */
PageSetPrunable(dp, xid); PageSetPrunable(page, xid);
/* store transaction information of xact deleting the tuple */ /* store transaction information of xact deleting the tuple */
tp.t_data->t_infomask &= ~(HEAP_XMAX_COMMITTED | tp.t_data->t_infomask &= ~(HEAP_XMAX_COMMITTED |
...@@ -2150,8 +2150,8 @@ l1: ...@@ -2150,8 +2150,8 @@ l1:
recptr = XLogInsert(RM_HEAP_ID, XLOG_HEAP_DELETE, rdata); recptr = XLogInsert(RM_HEAP_ID, XLOG_HEAP_DELETE, rdata);
PageSetLSN(dp, recptr); PageSetLSN(page, recptr);
PageSetTLI(dp, ThisTimeLineID); PageSetTLI(page, ThisTimeLineID);
} }
END_CRIT_SECTION(); END_CRIT_SECTION();
...@@ -2276,7 +2276,7 @@ heap_update(Relation relation, ItemPointer otid, HeapTuple newtup, ...@@ -2276,7 +2276,7 @@ heap_update(Relation relation, ItemPointer otid, HeapTuple newtup,
ItemId lp; ItemId lp;
HeapTupleData oldtup; HeapTupleData oldtup;
HeapTuple heaptup; HeapTuple heaptup;
PageHeader dp; Page page;
Buffer buffer, Buffer buffer,
newbuf; newbuf;
bool need_toast, bool need_toast,
...@@ -2306,11 +2306,11 @@ heap_update(Relation relation, ItemPointer otid, HeapTuple newtup, ...@@ -2306,11 +2306,11 @@ heap_update(Relation relation, ItemPointer otid, HeapTuple newtup,
buffer = ReadBuffer(relation, ItemPointerGetBlockNumber(otid)); buffer = ReadBuffer(relation, ItemPointerGetBlockNumber(otid));
LockBuffer(buffer, BUFFER_LOCK_EXCLUSIVE); LockBuffer(buffer, BUFFER_LOCK_EXCLUSIVE);
dp = (PageHeader) BufferGetPage(buffer); page = BufferGetPage(buffer);
lp = PageGetItemId(dp, ItemPointerGetOffsetNumber(otid)); lp = PageGetItemId(page, ItemPointerGetOffsetNumber(otid));
Assert(ItemIdIsNormal(lp)); Assert(ItemIdIsNormal(lp));
oldtup.t_data = (HeapTupleHeader) PageGetItem(dp, lp); oldtup.t_data = (HeapTupleHeader) PageGetItem(page, lp);
oldtup.t_len = ItemIdGetLength(lp); oldtup.t_len = ItemIdGetLength(lp);
oldtup.t_self = *otid; oldtup.t_self = *otid;
...@@ -2491,7 +2491,7 @@ l2: ...@@ -2491,7 +2491,7 @@ l2:
HeapTupleHasExternal(newtup) || HeapTupleHasExternal(newtup) ||
newtup->t_len > TOAST_TUPLE_THRESHOLD); newtup->t_len > TOAST_TUPLE_THRESHOLD);
pagefree = PageGetHeapFreeSpace((Page) dp); pagefree = PageGetHeapFreeSpace(page);
newtupsize = MAXALIGN(newtup->t_len); newtupsize = MAXALIGN(newtup->t_len);
...@@ -2557,7 +2557,7 @@ l2: ...@@ -2557,7 +2557,7 @@ l2:
/* Re-acquire the lock on the old tuple's page. */ /* Re-acquire the lock on the old tuple's page. */
LockBuffer(buffer, BUFFER_LOCK_EXCLUSIVE); LockBuffer(buffer, BUFFER_LOCK_EXCLUSIVE);
/* Re-check using the up-to-date free space */ /* Re-check using the up-to-date free space */
pagefree = PageGetHeapFreeSpace((Page) dp); pagefree = PageGetHeapFreeSpace(page);
if (newtupsize > pagefree) if (newtupsize > pagefree)
{ {
/* /*
...@@ -2603,7 +2603,7 @@ l2: ...@@ -2603,7 +2603,7 @@ l2:
else else
{ {
/* Set a hint that the old page could use prune/defrag */ /* Set a hint that the old page could use prune/defrag */
PageSetFull(dp); PageSetFull(page);
} }
/* NO EREPORT(ERROR) from here till changes are logged */ /* NO EREPORT(ERROR) from here till changes are logged */
...@@ -2621,7 +2621,7 @@ l2: ...@@ -2621,7 +2621,7 @@ l2:
* not to optimize for aborts. Note that heap_xlog_update must be kept in * not to optimize for aborts. Note that heap_xlog_update must be kept in
* sync if this decision changes. * sync if this decision changes.
*/ */
PageSetPrunable(dp, xid); PageSetPrunable(page, xid);
if (use_hot_update) if (use_hot_update)
{ {
...@@ -2946,7 +2946,7 @@ heap_lock_tuple(Relation relation, HeapTuple tuple, Buffer *buffer, ...@@ -2946,7 +2946,7 @@ heap_lock_tuple(Relation relation, HeapTuple tuple, Buffer *buffer,
HTSU_Result result; HTSU_Result result;
ItemPointer tid = &(tuple->t_self); ItemPointer tid = &(tuple->t_self);
ItemId lp; ItemId lp;
PageHeader dp; Page page;
TransactionId xid; TransactionId xid;
TransactionId xmax; TransactionId xmax;
uint16 old_infomask; uint16 old_infomask;
...@@ -2959,11 +2959,11 @@ heap_lock_tuple(Relation relation, HeapTuple tuple, Buffer *buffer, ...@@ -2959,11 +2959,11 @@ heap_lock_tuple(Relation relation, HeapTuple tuple, Buffer *buffer,
*buffer = ReadBuffer(relation, ItemPointerGetBlockNumber(tid)); *buffer = ReadBuffer(relation, ItemPointerGetBlockNumber(tid));
LockBuffer(*buffer, BUFFER_LOCK_EXCLUSIVE); LockBuffer(*buffer, BUFFER_LOCK_EXCLUSIVE);
dp = (PageHeader) BufferGetPage(*buffer); page = BufferGetPage(*buffer);
lp = PageGetItemId(dp, ItemPointerGetOffsetNumber(tid)); lp = PageGetItemId(page, ItemPointerGetOffsetNumber(tid));
Assert(ItemIdIsNormal(lp)); Assert(ItemIdIsNormal(lp));
tuple->t_data = (HeapTupleHeader) PageGetItem((Page) dp, lp); tuple->t_data = (HeapTupleHeader) PageGetItem(page, lp);
tuple->t_len = ItemIdGetLength(lp); tuple->t_len = ItemIdGetLength(lp);
tuple->t_tableOid = RelationGetRelid(relation); tuple->t_tableOid = RelationGetRelid(relation);
...@@ -3302,8 +3302,8 @@ l3: ...@@ -3302,8 +3302,8 @@ l3:
recptr = XLogInsert(RM_HEAP_ID, XLOG_HEAP_LOCK, rdata); recptr = XLogInsert(RM_HEAP_ID, XLOG_HEAP_LOCK, rdata);
PageSetLSN(dp, recptr); PageSetLSN(page, recptr);
PageSetTLI(dp, ThisTimeLineID); PageSetTLI(page, ThisTimeLineID);
} }
END_CRIT_SECTION(); END_CRIT_SECTION();
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/access/heap/hio.c,v 1.71 2008/06/08 22:00:47 alvherre Exp $ * $PostgreSQL: pgsql/src/backend/access/heap/hio.c,v 1.72 2008/07/13 20:45:47 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -107,7 +107,7 @@ RelationGetBufferForTuple(Relation relation, Size len, ...@@ -107,7 +107,7 @@ RelationGetBufferForTuple(Relation relation, Size len,
Buffer otherBuffer, bool use_fsm) Buffer otherBuffer, bool use_fsm)
{ {
Buffer buffer = InvalidBuffer; Buffer buffer = InvalidBuffer;
Page pageHeader; Page page;
Size pageFreeSpace, Size pageFreeSpace,
saveFreeSpace; saveFreeSpace;
BlockNumber targetBlock, BlockNumber targetBlock,
...@@ -218,8 +218,8 @@ RelationGetBufferForTuple(Relation relation, Size len, ...@@ -218,8 +218,8 @@ RelationGetBufferForTuple(Relation relation, Size len,
* Now we can check to see if there's enough free space here. If so, * Now we can check to see if there's enough free space here. If so,
* we're done. * we're done.
*/ */
pageHeader = (Page) BufferGetPage(buffer); page = BufferGetPage(buffer);
pageFreeSpace = PageGetHeapFreeSpace(pageHeader); pageFreeSpace = PageGetHeapFreeSpace(page);
if (len + saveFreeSpace <= pageFreeSpace) if (len + saveFreeSpace <= pageFreeSpace)
{ {
/* use this page as future insert target, too */ /* use this page as future insert target, too */
...@@ -303,16 +303,16 @@ RelationGetBufferForTuple(Relation relation, Size len, ...@@ -303,16 +303,16 @@ RelationGetBufferForTuple(Relation relation, Size len,
* is empty (this should never happen, but if it does we don't want to * is empty (this should never happen, but if it does we don't want to
* risk wiping out valid data). * risk wiping out valid data).
*/ */
pageHeader = (Page) BufferGetPage(buffer); page = BufferGetPage(buffer);
if (!PageIsNew((PageHeader) pageHeader)) if (!PageIsNew(page))
elog(ERROR, "page %u of relation \"%s\" should be empty but is not", elog(ERROR, "page %u of relation \"%s\" should be empty but is not",
BufferGetBlockNumber(buffer), BufferGetBlockNumber(buffer),
RelationGetRelationName(relation)); RelationGetRelationName(relation));
PageInit(pageHeader, BufferGetPageSize(buffer), 0); PageInit(page, BufferGetPageSize(buffer), 0);
if (len > PageGetHeapFreeSpace(pageHeader)) if (len > PageGetHeapFreeSpace(page))
{ {
/* We should not get here given the test at the top */ /* We should not get here given the test at the top */
elog(PANIC, "tuple is too big: size %lu", (unsigned long) len); elog(PANIC, "tuple is too big: size %lu", (unsigned long) len);
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/access/heap/pruneheap.c,v 1.15 2008/06/19 00:46:03 alvherre Exp $ * $PostgreSQL: pgsql/src/backend/access/heap/pruneheap.c,v 1.16 2008/07/13 20:45:47 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -72,7 +72,7 @@ static void heap_prune_record_unused(PruneState *prstate, OffsetNumber offnum); ...@@ -72,7 +72,7 @@ static void heap_prune_record_unused(PruneState *prstate, OffsetNumber offnum);
void void
heap_page_prune_opt(Relation relation, Buffer buffer, TransactionId OldestXmin) heap_page_prune_opt(Relation relation, Buffer buffer, TransactionId OldestXmin)
{ {
PageHeader dp = (PageHeader) BufferGetPage(buffer); Page page = BufferGetPage(buffer);
Size minfree; Size minfree;
/* /*
...@@ -81,7 +81,7 @@ heap_page_prune_opt(Relation relation, Buffer buffer, TransactionId OldestXmin) ...@@ -81,7 +81,7 @@ heap_page_prune_opt(Relation relation, Buffer buffer, TransactionId OldestXmin)
* Forget it if page is not hinted to contain something prunable that's * Forget it if page is not hinted to contain something prunable that's
* older than OldestXmin. * older than OldestXmin.
*/ */
if (!PageIsPrunable(dp, OldestXmin)) if (!PageIsPrunable(page, OldestXmin))
return; return;
/* /*
...@@ -100,7 +100,7 @@ heap_page_prune_opt(Relation relation, Buffer buffer, TransactionId OldestXmin) ...@@ -100,7 +100,7 @@ heap_page_prune_opt(Relation relation, Buffer buffer, TransactionId OldestXmin)
HEAP_DEFAULT_FILLFACTOR); HEAP_DEFAULT_FILLFACTOR);
minfree = Max(minfree, BLCKSZ / 10); minfree = Max(minfree, BLCKSZ / 10);
if (PageIsFull(dp) || PageGetHeapFreeSpace((Page) dp) < minfree) if (PageIsFull(page) || PageGetHeapFreeSpace(page) < minfree)
{ {
/* OK, try to get exclusive buffer lock */ /* OK, try to get exclusive buffer lock */
if (!ConditionalLockBufferForCleanup(buffer)) if (!ConditionalLockBufferForCleanup(buffer))
...@@ -112,7 +112,7 @@ heap_page_prune_opt(Relation relation, Buffer buffer, TransactionId OldestXmin) ...@@ -112,7 +112,7 @@ heap_page_prune_opt(Relation relation, Buffer buffer, TransactionId OldestXmin)
* prune. (We needn't recheck PageIsPrunable, since no one else could * prune. (We needn't recheck PageIsPrunable, since no one else could
* have pruned while we hold pin.) * have pruned while we hold pin.)
*/ */
if (PageIsFull(dp) || PageGetHeapFreeSpace((Page) dp) < minfree) if (PageIsFull(page) || PageGetHeapFreeSpace(page) < minfree)
{ {
/* OK to prune (though not to remove redirects) */ /* OK to prune (though not to remove redirects) */
(void) heap_page_prune(relation, buffer, OldestXmin, false, true); (void) heap_page_prune(relation, buffer, OldestXmin, false, true);
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/access/nbtree/nbtpage.c,v 1.109 2008/05/12 00:00:45 alvherre Exp $ * $PostgreSQL: pgsql/src/backend/access/nbtree/nbtpage.c,v 1.110 2008/07/13 20:45:47 tgl Exp $
* *
* NOTES * NOTES
* Postgres btree pages look like ordinary relation pages. The opaque * Postgres btree pages look like ordinary relation pages. The opaque
...@@ -436,8 +436,7 @@ _bt_checkpage(Relation rel, Buffer buf) ...@@ -436,8 +436,7 @@ _bt_checkpage(Relation rel, Buffer buf)
/* /*
* Additionally check that the special area looks sane. * Additionally check that the special area looks sane.
*/ */
if (((PageHeader) (page))->pd_special != if (PageGetSpecialSize(page) != MAXALIGN(sizeof(BTPageOpaqueData)))
(BLCKSZ - MAXALIGN(sizeof(BTPageOpaqueData))))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_INDEX_CORRUPTED), (errcode(ERRCODE_INDEX_CORRUPTED),
errmsg("index \"%s\" contains corrupted page at block %u", errmsg("index \"%s\" contains corrupted page at block %u",
...@@ -555,7 +554,7 @@ _bt_getbuf(Relation rel, BlockNumber blkno, int access) ...@@ -555,7 +554,7 @@ _bt_getbuf(Relation rel, BlockNumber blkno, int access)
/* Initialize the new page before returning it */ /* Initialize the new page before returning it */
page = BufferGetPage(buf); page = BufferGetPage(buf);
Assert(PageIsNew((PageHeader) page)); Assert(PageIsNew(page));
_bt_pageinit(page, BufferGetPageSize(buf)); _bt_pageinit(page, BufferGetPageSize(buf));
} }
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.315 2008/06/30 22:10:43 momjian Exp $ * $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.316 2008/07/13 20:45:47 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -1017,19 +1017,19 @@ static bool ...@@ -1017,19 +1017,19 @@ static bool
XLogCheckBuffer(XLogRecData *rdata, bool doPageWrites, XLogCheckBuffer(XLogRecData *rdata, bool doPageWrites,
XLogRecPtr *lsn, BkpBlock *bkpb) XLogRecPtr *lsn, BkpBlock *bkpb)
{ {
PageHeader page; Page page;
page = (PageHeader) BufferGetBlock(rdata->buffer); page = BufferGetPage(rdata->buffer);
/* /*
* XXX We assume page LSN is first data on *every* page that can be passed * XXX We assume page LSN is first data on *every* page that can be passed
* to XLogInsert, whether it otherwise has the standard page layout or * to XLogInsert, whether it otherwise has the standard page layout or
* not. * not.
*/ */
*lsn = page->pd_lsn; *lsn = PageGetLSN(page);
if (doPageWrites && if (doPageWrites &&
XLByteLE(page->pd_lsn, RedoRecPtr)) XLByteLE(PageGetLSN(page), RedoRecPtr))
{ {
/* /*
* The page needs to be backed up, so set up *bkpb * The page needs to be backed up, so set up *bkpb
...@@ -1040,8 +1040,8 @@ XLogCheckBuffer(XLogRecData *rdata, bool doPageWrites, ...@@ -1040,8 +1040,8 @@ XLogCheckBuffer(XLogRecData *rdata, bool doPageWrites,
if (rdata->buffer_std) if (rdata->buffer_std)
{ {
/* Assume we can omit data between pd_lower and pd_upper */ /* Assume we can omit data between pd_lower and pd_upper */
uint16 lower = page->pd_lower; uint16 lower = ((PageHeader) page)->pd_lower;
uint16 upper = page->pd_upper; uint16 upper = ((PageHeader) page)->pd_upper;
if (lower >= SizeOfPageHeaderData && if (lower >= SizeOfPageHeaderData &&
upper > lower && upper > lower &&
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $PostgreSQL: pgsql/src/backend/access/transam/xlogutils.c,v 1.56 2008/06/19 00:46:03 alvherre Exp $ * $PostgreSQL: pgsql/src/backend/access/transam/xlogutils.c,v 1.57 2008/07/13 20:45:47 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -279,7 +279,7 @@ XLogReadBuffer(RelFileNode rnode, BlockNumber blkno, bool init) ...@@ -279,7 +279,7 @@ XLogReadBuffer(RelFileNode rnode, BlockNumber blkno, bool init)
/* check that page has been initialized */ /* check that page has been initialized */
Page page = (Page) BufferGetPage(buffer); Page page = (Page) BufferGetPage(buffer);
if (PageIsNew((PageHeader) page)) if (PageIsNew(page))
{ {
UnlockReleaseBuffer(buffer); UnlockReleaseBuffer(buffer);
log_invalid_page(rnode, blkno, true); log_invalid_page(rnode, blkno, true);
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/sequence.c,v 1.153 2008/06/12 09:12:30 heikki Exp $ * $PostgreSQL: pgsql/src/backend/commands/sequence.c,v 1.154 2008/07/13 20:45:47 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -109,7 +109,7 @@ DefineSequence(CreateSeqStmt *seq) ...@@ -109,7 +109,7 @@ DefineSequence(CreateSeqStmt *seq)
Oid seqoid; Oid seqoid;
Relation rel; Relation rel;
Buffer buf; Buffer buf;
PageHeader page; Page page;
sequence_magic *sm; sequence_magic *sm;
HeapTuple tuple; HeapTuple tuple;
TupleDesc tupDesc; TupleDesc tupDesc;
...@@ -212,9 +212,9 @@ DefineSequence(CreateSeqStmt *seq) ...@@ -212,9 +212,9 @@ DefineSequence(CreateSeqStmt *seq)
buf = ReadBuffer(rel, P_NEW); buf = ReadBuffer(rel, P_NEW);
Assert(BufferGetBlockNumber(buf) == 0); Assert(BufferGetBlockNumber(buf) == 0);
page = (PageHeader) BufferGetPage(buf); page = BufferGetPage(buf);
PageInit((Page) page, BufferGetPageSize(buf), sizeof(sequence_magic)); PageInit(page, BufferGetPageSize(buf), sizeof(sequence_magic));
sm = (sequence_magic *) PageGetSpecialPointer(page); sm = (sequence_magic *) PageGetSpecialPointer(page);
sm->magic = SEQ_MAGIC; sm->magic = SEQ_MAGIC;
...@@ -954,7 +954,7 @@ init_sequence(Oid relid, SeqTable *p_elm, Relation *p_rel) ...@@ -954,7 +954,7 @@ init_sequence(Oid relid, SeqTable *p_elm, Relation *p_rel)
static Form_pg_sequence static Form_pg_sequence
read_info(SeqTable elm, Relation rel, Buffer *buf) read_info(SeqTable elm, Relation rel, Buffer *buf)
{ {
PageHeader page; Page page;
ItemId lp; ItemId lp;
HeapTupleData tuple; HeapTupleData tuple;
sequence_magic *sm; sequence_magic *sm;
...@@ -963,7 +963,7 @@ read_info(SeqTable elm, Relation rel, Buffer *buf) ...@@ -963,7 +963,7 @@ read_info(SeqTable elm, Relation rel, Buffer *buf)
*buf = ReadBuffer(rel, 0); *buf = ReadBuffer(rel, 0);
LockBuffer(*buf, BUFFER_LOCK_EXCLUSIVE); LockBuffer(*buf, BUFFER_LOCK_EXCLUSIVE);
page = (PageHeader) BufferGetPage(*buf); page = BufferGetPage(*buf);
sm = (sequence_magic *) PageGetSpecialPointer(page); sm = (sequence_magic *) PageGetSpecialPointer(page);
if (sm->magic != SEQ_MAGIC) if (sm->magic != SEQ_MAGIC)
...@@ -972,7 +972,7 @@ read_info(SeqTable elm, Relation rel, Buffer *buf) ...@@ -972,7 +972,7 @@ read_info(SeqTable elm, Relation rel, Buffer *buf)
lp = PageGetItemId(page, FirstOffsetNumber); lp = PageGetItemId(page, FirstOffsetNumber);
Assert(ItemIdIsNormal(lp)); Assert(ItemIdIsNormal(lp));
tuple.t_data = (HeapTupleHeader) PageGetItem((Page) page, lp); tuple.t_data = (HeapTupleHeader) PageGetItem(page, lp);
seq = (Form_pg_sequence) GETSTRUCT(&tuple); seq = (Form_pg_sequence) GETSTRUCT(&tuple);
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/trigger.c,v 1.234 2008/05/15 00:17:39 tgl Exp $ * $PostgreSQL: pgsql/src/backend/commands/trigger.c,v 1.235 2008/07/13 20:45:47 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -2203,17 +2203,17 @@ ltrmark:; ...@@ -2203,17 +2203,17 @@ ltrmark:;
} }
else else
{ {
PageHeader dp; Page page;
ItemId lp; ItemId lp;
buffer = ReadBuffer(relation, ItemPointerGetBlockNumber(tid)); buffer = ReadBuffer(relation, ItemPointerGetBlockNumber(tid));
dp = (PageHeader) BufferGetPage(buffer); page = BufferGetPage(buffer);
lp = PageGetItemId(dp, ItemPointerGetOffsetNumber(tid)); lp = PageGetItemId(page, ItemPointerGetOffsetNumber(tid));
Assert(ItemIdIsNormal(lp)); Assert(ItemIdIsNormal(lp));
tuple.t_data = (HeapTupleHeader) PageGetItem((Page) dp, lp); tuple.t_data = (HeapTupleHeader) PageGetItem(page, lp);
tuple.t_len = ItemIdGetLength(lp); tuple.t_len = ItemIdGetLength(lp);
tuple.t_self = *tid; tuple.t_self = *tid;
tuple.t_tableOid = RelationGetRelid(relation); tuple.t_tableOid = RelationGetRelid(relation);
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/optimizer/util/plancat.c,v 1.147 2008/06/19 00:46:04 alvherre Exp $ * $PostgreSQL: pgsql/src/backend/optimizer/util/plancat.c,v 1.148 2008/07/13 20:45:47 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -429,7 +429,7 @@ estimate_rel_size(Relation rel, int32 *attr_widths, ...@@ -429,7 +429,7 @@ estimate_rel_size(Relation rel, int32 *attr_widths,
tuple_width += sizeof(HeapTupleHeaderData); tuple_width += sizeof(HeapTupleHeaderData);
tuple_width += sizeof(ItemPointerData); tuple_width += sizeof(ItemPointerData);
/* note: integer division is intentional here */ /* note: integer division is intentional here */
density = (BLCKSZ - sizeof(PageHeaderData)) / tuple_width; density = (BLCKSZ - SizeOfPageHeaderData) / tuple_width;
} }
*tuples = rint(density * (double) curpages); *tuples = rint(density * (double) curpages);
break; break;
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/storage/buffer/bufmgr.c,v 1.233 2008/06/19 00:46:05 alvherre Exp $ * $PostgreSQL: pgsql/src/backend/storage/buffer/bufmgr.c,v 1.234 2008/07/13 20:45:47 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -263,7 +263,7 @@ ReadBuffer_common(SMgrRelation smgr, bool isLocalBuf, BlockNumber blockNum, ...@@ -263,7 +263,7 @@ ReadBuffer_common(SMgrRelation smgr, bool isLocalBuf, BlockNumber blockNum,
* always have left a zero-filled buffer, complain if not PageIsNew. * always have left a zero-filled buffer, complain if not PageIsNew.
*/ */
bufBlock = isLocalBuf ? LocalBufHdrGetBlock(bufHdr) : BufHdrGetBlock(bufHdr); bufBlock = isLocalBuf ? LocalBufHdrGetBlock(bufHdr) : BufHdrGetBlock(bufHdr);
if (!PageIsNew((PageHeader) bufBlock)) if (!PageIsNew((Page) bufBlock))
ereport(ERROR, ereport(ERROR,
(errmsg("unexpected data beyond EOF in block %u of relation %u/%u/%u", (errmsg("unexpected data beyond EOF in block %u of relation %u/%u/%u",
blockNum, smgr->smgr_rnode.spcNode, smgr->smgr_rnode.dbNode, smgr->smgr_rnode.relNode), blockNum, smgr->smgr_rnode.spcNode, smgr->smgr_rnode.dbNode, smgr->smgr_rnode.relNode),
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $PostgreSQL: pgsql/src/include/access/hash.h,v 1.88 2008/06/19 00:46:05 alvherre Exp $ * $PostgreSQL: pgsql/src/include/access/hash.h,v 1.89 2008/07/13 20:45:47 tgl Exp $
* *
* NOTES * NOTES
* modeled after Margo Seltzer's hash implementation for unix. * modeled after Margo Seltzer's hash implementation for unix.
...@@ -166,10 +166,10 @@ typedef HashMetaPageData *HashMetaPage; ...@@ -166,10 +166,10 @@ typedef HashMetaPageData *HashMetaPage;
* Maximum size of a hash index item (it's okay to have only one per page) * Maximum size of a hash index item (it's okay to have only one per page)
*/ */
#define HashMaxItemSize(page) \ #define HashMaxItemSize(page) \
(PageGetPageSize(page) - \ MAXALIGN_DOWN(PageGetPageSize(page) - \
sizeof(PageHeaderData) - \ SizeOfPageHeaderData - \
MAXALIGN(sizeof(HashPageOpaqueData)) - \ sizeof(ItemIdData) - \
sizeof(ItemIdData)) MAXALIGN(sizeof(HashPageOpaqueData)))
#define HASH_MIN_FILLFACTOR 10 #define HASH_MIN_FILLFACTOR 10
#define HASH_DEFAULT_FILLFACTOR 75 #define HASH_DEFAULT_FILLFACTOR 75
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $PostgreSQL: pgsql/src/include/access/htup.h,v 1.99 2008/05/12 00:00:53 alvherre Exp $ * $PostgreSQL: pgsql/src/include/access/htup.h,v 1.100 2008/07/13 20:45:47 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -362,12 +362,12 @@ do { \ ...@@ -362,12 +362,12 @@ do { \
* other stuff that has to be on a disk page. Since heap pages use no * other stuff that has to be on a disk page. Since heap pages use no
* "special space", there's no deduction for that. * "special space", there's no deduction for that.
* *
* NOTE: we do not need to count an ItemId for the tuple because * NOTE: we allow for the ItemId that must point to the tuple, ensuring that
* sizeof(PageHeaderData) includes the first ItemId on the page. But beware * an otherwise-empty page can indeed hold a tuple of this size. Because
* of assuming that, say, you can fit 2 tuples of size MaxHeapTupleSize/2 * ItemIds and tuples have different alignment requirements, don't assume that
* on the same page. * you can, say, fit 2 tuples of size MaxHeapTupleSize/2 on the same page.
*/ */
#define MaxHeapTupleSize (BLCKSZ - MAXALIGN(sizeof(PageHeaderData))) #define MaxHeapTupleSize (BLCKSZ - MAXALIGN(SizeOfPageHeaderData + sizeof(ItemIdData)))
/* /*
* MaxHeapTuplesPerPage is an upper bound on the number of tuples that can * MaxHeapTuplesPerPage is an upper bound on the number of tuples that can
...@@ -381,7 +381,7 @@ do { \ ...@@ -381,7 +381,7 @@ do { \
* require increases in the size of work arrays. * require increases in the size of work arrays.
*/ */
#define MaxHeapTuplesPerPage \ #define MaxHeapTuplesPerPage \
((int) ((BLCKSZ - offsetof(PageHeaderData, pd_linp)) / \ ((int) ((BLCKSZ - SizeOfPageHeaderData) / \
(MAXALIGN(offsetof(HeapTupleHeaderData, t_bits)) + sizeof(ItemIdData)))) (MAXALIGN(offsetof(HeapTupleHeaderData, t_bits)) + sizeof(ItemIdData))))
/* /*
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $PostgreSQL: pgsql/src/include/access/itup.h,v 1.49 2008/01/01 19:45:56 momjian Exp $ * $PostgreSQL: pgsql/src/include/access/itup.h,v 1.50 2008/07/13 20:45:47 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -134,7 +134,7 @@ typedef IndexAttributeBitMapData *IndexAttributeBitMap; ...@@ -134,7 +134,7 @@ typedef IndexAttributeBitMapData *IndexAttributeBitMap;
* must be maxaligned, and it must have an associated item pointer. * must be maxaligned, and it must have an associated item pointer.
*/ */
#define MaxIndexTuplesPerPage \ #define MaxIndexTuplesPerPage \
((int) ((BLCKSZ - offsetof(PageHeaderData, pd_linp)) / \ ((int) ((BLCKSZ - SizeOfPageHeaderData) / \
(MAXALIGN(sizeof(IndexTupleData) + 1) + sizeof(ItemIdData)))) (MAXALIGN(sizeof(IndexTupleData) + 1) + sizeof(ItemIdData))))
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $PostgreSQL: pgsql/src/include/access/nbtree.h,v 1.120 2008/06/19 00:46:06 alvherre Exp $ * $PostgreSQL: pgsql/src/include/access/nbtree.h,v 1.121 2008/07/13 20:45:47 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -113,13 +113,10 @@ typedef struct BTMetaPageData ...@@ -113,13 +113,10 @@ typedef struct BTMetaPageData
* *
* We actually need to be able to fit three items on every page, * We actually need to be able to fit three items on every page,
* so restrict any one item to 1/3 the per-page available space. * so restrict any one item to 1/3 the per-page available space.
*
* Note: sizeof(PageHeaderData) includes the first ItemId, but we have
* to allow for 2 more, as well as the end-of-page special space.
*/ */
#define BTMaxItemSize(page) \ #define BTMaxItemSize(page) \
MAXALIGN_DOWN((PageGetPageSize(page) - \ MAXALIGN_DOWN((PageGetPageSize(page) - \
MAXALIGN(sizeof(PageHeaderData) + 2*sizeof(ItemIdData)) - \ MAXALIGN(SizeOfPageHeaderData + 3*sizeof(ItemIdData)) - \
MAXALIGN(sizeof(BTPageOpaqueData))) / 3) MAXALIGN(sizeof(BTPageOpaqueData))) / 3)
/* /*
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* *
* Copyright (c) 2000-2008, PostgreSQL Global Development Group * Copyright (c) 2000-2008, PostgreSQL Global Development Group
* *
* $PostgreSQL: pgsql/src/include/access/tuptoaster.h,v 1.40 2008/06/19 00:46:06 alvherre Exp $ * $PostgreSQL: pgsql/src/include/access/tuptoaster.h,v 1.41 2008/07/13 20:45:47 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -46,10 +46,9 @@ ...@@ -46,10 +46,9 @@
*/ */
#define TOAST_TUPLES_PER_PAGE 4 #define TOAST_TUPLES_PER_PAGE 4
/* Note: sizeof(PageHeaderData) includes the first ItemId on the page */
#define TOAST_TUPLE_THRESHOLD \ #define TOAST_TUPLE_THRESHOLD \
MAXALIGN_DOWN((BLCKSZ - \ MAXALIGN_DOWN((BLCKSZ - \
MAXALIGN(sizeof(PageHeaderData) + (TOAST_TUPLES_PER_PAGE-1) * sizeof(ItemIdData))) \ MAXALIGN(SizeOfPageHeaderData + TOAST_TUPLES_PER_PAGE * sizeof(ItemIdData))) \
/ TOAST_TUPLES_PER_PAGE) / TOAST_TUPLES_PER_PAGE)
#define TOAST_TUPLE_TARGET TOAST_TUPLE_THRESHOLD #define TOAST_TUPLE_TARGET TOAST_TUPLE_THRESHOLD
...@@ -73,10 +72,9 @@ ...@@ -73,10 +72,9 @@
*/ */
#define EXTERN_TUPLES_PER_PAGE 4 /* tweak only this */ #define EXTERN_TUPLES_PER_PAGE 4 /* tweak only this */
/* Note: sizeof(PageHeaderData) includes the first ItemId on the page */
#define EXTERN_TUPLE_MAX_SIZE \ #define EXTERN_TUPLE_MAX_SIZE \
MAXALIGN_DOWN((BLCKSZ - \ MAXALIGN_DOWN((BLCKSZ - \
MAXALIGN(sizeof(PageHeaderData) + (EXTERN_TUPLES_PER_PAGE-1) * sizeof(ItemIdData))) \ MAXALIGN(SizeOfPageHeaderData + EXTERN_TUPLES_PER_PAGE * sizeof(ItemIdData))) \
/ EXTERN_TUPLES_PER_PAGE) / EXTERN_TUPLES_PER_PAGE)
#define TOAST_MAX_CHUNK_SIZE \ #define TOAST_MAX_CHUNK_SIZE \
......
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