From 56218fbc487991ed98358cd8016dc5c4615bed96 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Mon, 9 Apr 2007 22:04:08 +0000 Subject: 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. --- src/include/access/gist.h | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) (limited to 'src/include/access/gist.h') diff --git a/src/include/access/gist.h b/src/include/access/gist.h index 52d3a2fe1a0..eab6a01bfd5 100644 --- a/src/include/access/gist.h +++ b/src/include/access/gist.h @@ -9,7 +9,7 @@ * Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/access/gist.h,v 1.57 2007/01/05 22:19:50 momjian Exp $ + * $PostgreSQL: pgsql/src/include/access/gist.h,v 1.58 2007/04/09 22:04:05 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -56,25 +56,30 @@ /* * Page opaque data in a GiST index page. */ -#define F_LEAF (1 << 0) -#define F_DELETED (1 << 1) +#define F_LEAF (1 << 0) +#define F_DELETED (1 << 1) #define F_TUPLES_DELETED (1 << 2) typedef XLogRecPtr GistNSN; typedef struct GISTPageOpaqueData { - uint32 flags; /* 29 bits are unused for now */ - BlockNumber rightlink; - - /* - * the only meaning - change this value if page split. - */ - GistNSN nsn; + GistNSN nsn; /* this value must change on page split */ + BlockNumber rightlink; /* next page if any */ + uint16 flags; /* see bit definitions above */ + uint16 gist_page_id; /* for identification of GiST indexes */ } GISTPageOpaqueData; typedef GISTPageOpaqueData *GISTPageOpaque; +/* + * The page ID is for the convenience of pg_filedump and similar utilities, + * which otherwise would have a hard time telling pages of different index + * types apart. It should be the last 2 bytes on the page. This is more or + * less "free" due to alignment considerations. + */ +#define GIST_PAGE_ID 0xFF81 + /* * This is the Split Vector to be returned by the PickSplit method. * PickSplit should check spl_(r|l)datum_exists. If it is 'true', -- cgit v1.2.3