mirror of
https://github.com/postgres/postgres.git
synced 2025-11-10 17:42:29 +03:00
Several fixes for hash indexes that involve changing the on-disk index
layout; therefore, this change forces REINDEX of hash indexes (though not a full initdb). Widen hashm_ntuples to double so that hash space management doesn't get confused by more than 4G entries; enlarge the allowed number of free-space-bitmap pages; replace the useless bshift field with a useful bmshift field; eliminate 4 bytes of wasted space in the per-page special area.
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/hash/hashutil.c,v 1.34 2003/09/02 02:18:38 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/hash/hashutil.c,v 1.35 2003/09/02 18:13:31 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -143,10 +143,33 @@ _hash_log2(uint32 num)
|
||||
* _hash_checkpage -- sanity checks on the format of all hash pages
|
||||
*/
|
||||
void
|
||||
_hash_checkpage(Page page, int flags)
|
||||
_hash_checkpage(Relation rel, Page page, int flags)
|
||||
{
|
||||
#ifdef USE_ASSERT_CHECKING
|
||||
Assert(page);
|
||||
/*
|
||||
* When checking the metapage, always verify magic number and version.
|
||||
*/
|
||||
if (flags == LH_META_PAGE)
|
||||
{
|
||||
HashMetaPage metap = (HashMetaPage) page;
|
||||
|
||||
if (metap->hashm_magic != HASH_MAGIC)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_INDEX_CORRUPTED),
|
||||
errmsg("index \"%s\" is not a hash index",
|
||||
RelationGetRelationName(rel))));
|
||||
|
||||
if (metap->hashm_version != HASH_VERSION)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_INDEX_CORRUPTED),
|
||||
errmsg("index \"%s\" has wrong hash version, please REINDEX it",
|
||||
RelationGetRelationName(rel))));
|
||||
}
|
||||
|
||||
/*
|
||||
* These other checks are for debugging purposes only.
|
||||
*/
|
||||
#ifdef USE_ASSERT_CHECKING
|
||||
Assert(((PageHeader) (page))->pd_lower >= SizeOfPageHeaderData);
|
||||
Assert(((PageHeader) (page))->pd_upper <=
|
||||
(BLCKSZ - MAXALIGN(sizeof(HashPageOpaqueData))));
|
||||
|
||||
Reference in New Issue
Block a user