summaryrefslogtreecommitdiff
path: root/src/include/access/nbtree.h
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2007-04-09 22:04:08 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2007-04-09 22:04:08 +0000
commit56218fbc487991ed98358cd8016dc5c4615bed96 (patch)
tree0840591dffb49c556f0943e1c91b0628c18b4ced /src/include/access/nbtree.h
parent485d9ca96ff0ef6ab1e424a4ded3eeb53a9cf3df (diff)
downloadpostgresql-56218fbc487991ed98358cd8016dc5c4615bed96.tar.gz
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.
Diffstat (limited to 'src/include/access/nbtree.h')
-rw-r--r--src/include/access/nbtree.h15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/include/access/nbtree.h b/src/include/access/nbtree.h
index ff78cf1f71..53e10c80e8 100644
--- a/src/include/access/nbtree.h
+++ b/src/include/access/nbtree.h
@@ -7,7 +7,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/nbtree.h,v 1.111 2007/02/08 05:05:53 momjian Exp $
+ * $PostgreSQL: pgsql/src/include/access/nbtree.h,v 1.112 2007/04/09 22:04:08 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -40,8 +40,8 @@ typedef uint16 BTCycleId;
* stored into both halves of the split page. (If VACUUM is not running,
* both pages receive zero cycleids.) This allows VACUUM to detect whether
* a page was split since it started, with a small probability of false match
- * if the page was last split some exact multiple of 65536 VACUUMs ago.
- * Also, during a split, the BTP_SPLIT_END flag is cleared in the left
+ * if the page was last split some exact multiple of MAX_BT_CYCLE_ID VACUUMs
+ * ago. Also, during a split, the BTP_SPLIT_END flag is cleared in the left
* (original) page, and set in the right page, but only if the next page
* to its right has a different cycleid.
*
@@ -73,6 +73,15 @@ typedef BTPageOpaqueData *BTPageOpaque;
#define BTP_SPLIT_END (1 << 5) /* rightmost page of split group */
#define BTP_HAS_GARBAGE (1 << 6) /* page has LP_DELETEd tuples */
+/*
+ * The max allowed value of a cycle ID is a bit less than 64K. This is
+ * for convenience of pg_filedump and similar utilities: we want to use
+ * the last 2 bytes of special space as an index type indicator, and
+ * restricting cycle ID lets btree use that space for vacuum cycle IDs
+ * while still allowing index type to be identified.
+ */
+#define MAX_BT_CYCLE_ID 0xFF7F
+
/*
* The Meta page is always the first page in the btree index.