mirror of
https://github.com/postgres/postgres.git
synced 2025-11-09 06:21:09 +03:00
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.
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
*
|
||||
*
|
||||
* 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
|
||||
* Postgres btree pages look like ordinary relation pages. The opaque
|
||||
@@ -436,8 +436,7 @@ _bt_checkpage(Relation rel, Buffer buf)
|
||||
/*
|
||||
* Additionally check that the special area looks sane.
|
||||
*/
|
||||
if (((PageHeader) (page))->pd_special !=
|
||||
(BLCKSZ - MAXALIGN(sizeof(BTPageOpaqueData))))
|
||||
if (PageGetSpecialSize(page) != MAXALIGN(sizeof(BTPageOpaqueData)))
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_INDEX_CORRUPTED),
|
||||
errmsg("index \"%s\" contains corrupted page at block %u",
|
||||
@@ -555,7 +554,7 @@ _bt_getbuf(Relation rel, BlockNumber blkno, int access)
|
||||
|
||||
/* Initialize the new page before returning it */
|
||||
page = BufferGetPage(buf);
|
||||
Assert(PageIsNew((PageHeader) page));
|
||||
Assert(PageIsNew(page));
|
||||
_bt_pageinit(page, BufferGetPageSize(buf));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user