mirror of
https://github.com/postgres/postgres.git
synced 2025-11-10 17:42:29 +03:00
Minor tweaking of index special-space definitions so that the various
index types can be reliably distinguished by examining the special space on an index page. Per my earlier proposal, plus the realization that there's no need for btree's vacuum cycle ID to cycle through every possible 16-bit value. Restricting its range a little costs nearly nothing and eliminates the possibility of collisions. Memo to self: remember to make bitmap indexes play along with this scheme, assuming that patch ever gets accepted.
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/access/gist/gistutil.c,v 1.21 2007/01/05 22:19:22 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/access/gist/gistutil.c,v 1.22 2007/04/09 22:03:57 tgl Exp $
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#include "postgres.h"
|
||||
@@ -559,10 +559,11 @@ GISTInitBuffer(Buffer b, uint32 f)
|
||||
PageInit(page, pageSize, sizeof(GISTPageOpaqueData));
|
||||
|
||||
opaque = GistPageGetOpaque(page);
|
||||
opaque->flags = f;
|
||||
opaque->rightlink = InvalidBlockNumber;
|
||||
/* page was already zeroed by PageInit, so this is not needed: */
|
||||
/* memset(&(opaque->nsn), 0, sizeof(GistNSN)); */
|
||||
opaque->rightlink = InvalidBlockNumber;
|
||||
opaque->flags = f;
|
||||
opaque->gist_page_id = GIST_PAGE_ID;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/access/hash/hashovfl.c,v 1.54 2007/01/05 22:19:22 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/access/hash/hashovfl.c,v 1.55 2007/04/09 22:03:57 tgl Exp $
|
||||
*
|
||||
* NOTES
|
||||
* Overflow pages look like ordinary relation pages.
|
||||
@@ -141,7 +141,7 @@ _hash_addovflpage(Relation rel, Buffer metabuf, Buffer buf)
|
||||
ovflopaque->hasho_nextblkno = InvalidBlockNumber;
|
||||
ovflopaque->hasho_bucket = pageopaque->hasho_bucket;
|
||||
ovflopaque->hasho_flag = LH_OVERFLOW_PAGE;
|
||||
ovflopaque->hasho_filler = HASHO_FILL;
|
||||
ovflopaque->hasho_page_id = HASHO_PAGE_ID;
|
||||
|
||||
MarkBufferDirty(ovflbuf);
|
||||
|
||||
@@ -529,7 +529,7 @@ _hash_initbitmap(Relation rel, HashMetaPage metap, BlockNumber blkno)
|
||||
op->hasho_nextblkno = InvalidBlockNumber;
|
||||
op->hasho_bucket = -1;
|
||||
op->hasho_flag = LH_BITMAP_PAGE;
|
||||
op->hasho_filler = HASHO_FILL;
|
||||
op->hasho_page_id = HASHO_PAGE_ID;
|
||||
|
||||
/* set all of the bits to 1 */
|
||||
freep = HashPageGetBitmap(pg);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/access/hash/hashpage.c,v 1.64 2007/01/29 23:22:59 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/access/hash/hashpage.c,v 1.65 2007/04/09 22:03:57 tgl Exp $
|
||||
*
|
||||
* NOTES
|
||||
* Postgres hash pages look like ordinary relation pages. The opaque
|
||||
@@ -252,7 +252,7 @@ _hash_metapinit(Relation rel)
|
||||
pageopaque->hasho_nextblkno = InvalidBlockNumber;
|
||||
pageopaque->hasho_bucket = -1;
|
||||
pageopaque->hasho_flag = LH_META_PAGE;
|
||||
pageopaque->hasho_filler = HASHO_FILL;
|
||||
pageopaque->hasho_page_id = HASHO_PAGE_ID;
|
||||
|
||||
metap = (HashMetaPage) pg;
|
||||
|
||||
@@ -310,7 +310,7 @@ _hash_metapinit(Relation rel)
|
||||
pageopaque->hasho_nextblkno = InvalidBlockNumber;
|
||||
pageopaque->hasho_bucket = i;
|
||||
pageopaque->hasho_flag = LH_BUCKET_PAGE;
|
||||
pageopaque->hasho_filler = HASHO_FILL;
|
||||
pageopaque->hasho_page_id = HASHO_PAGE_ID;
|
||||
_hash_wrtbuf(rel, buf);
|
||||
}
|
||||
|
||||
@@ -654,7 +654,7 @@ _hash_splitbucket(Relation rel,
|
||||
nopaque->hasho_nextblkno = InvalidBlockNumber;
|
||||
nopaque->hasho_bucket = nbucket;
|
||||
nopaque->hasho_flag = LH_BUCKET_PAGE;
|
||||
nopaque->hasho_filler = HASHO_FILL;
|
||||
nopaque->hasho_page_id = HASHO_PAGE_ID;
|
||||
|
||||
/*
|
||||
* Partition the tuples in the old bucket between the old bucket and the
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/access/nbtree/nbtutils.c,v 1.84 2007/04/06 22:33:42 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/access/nbtree/nbtutils.c,v 1.85 2007/04/09 22:04:01 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -1263,11 +1263,13 @@ _bt_start_vacuum(Relation rel)
|
||||
|
||||
LWLockAcquire(BtreeVacuumLock, LW_EXCLUSIVE);
|
||||
|
||||
/* Assign the next cycle ID, being careful to avoid zero */
|
||||
do
|
||||
{
|
||||
result = ++(btvacinfo->cycle_ctr);
|
||||
} while (result == 0);
|
||||
/*
|
||||
* Assign the next cycle ID, being careful to avoid zero as well as
|
||||
* the reserved high values.
|
||||
*/
|
||||
result = ++(btvacinfo->cycle_ctr);
|
||||
if (result == 0 || result > MAX_BT_CYCLE_ID)
|
||||
result = btvacinfo->cycle_ctr = 1;
|
||||
|
||||
/* Let's just make sure there's no entry already for this index */
|
||||
for (i = 0; i < btvacinfo->num_vacuums; i++)
|
||||
|
||||
Reference in New Issue
Block a user