aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access/hash/README
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/access/hash/README')
-rw-r--r--src/backend/access/hash/README18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/backend/access/hash/README b/src/backend/access/hash/README
index ce195eae2cd..0e1a9ed1229 100644
--- a/src/backend/access/hash/README
+++ b/src/backend/access/hash/README
@@ -1,4 +1,4 @@
-$Header: /cvsroot/pgsql/src/backend/access/hash/README,v 1.3 2003/09/04 22:06:27 tgl Exp $
+$Header: /cvsroot/pgsql/src/backend/access/hash/README,v 1.3.2.1 2007/04/19 20:24:36 tgl Exp $
This directory contains an implementation of hash indexing for Postgres.
@@ -72,6 +72,18 @@ index, and preparing to allocate additional overflow pages after those
bucket pages. hashm_spares[] entries before S cannot change anymore,
since that would require moving already-created bucket pages.
+The last page nominally used by the index is always determinable from
+hashm_spares[S]. To avoid complaints from smgr, the logical EOF as seen by
+the filesystem and smgr must always be greater than or equal to this page.
+We have to allow the case "greater than" because it's possible that during
+an index extension we crash after allocating filesystem space and before
+updating the metapage. Note that on filesystems that allow "holes" in
+files, it's entirely likely that pages before the logical EOF are not yet
+allocated: when we allocate a new splitpoint's worth of bucket pages, we
+physically zero the last such page to force the EOF up, and the first such
+page will be used immediately, but the intervening pages are not written
+until needed.
+
Since overflow pages may be recycled if enough tuples are deleted from
their bucket, we need a way to keep track of currently-free overflow
pages. The state of each overflow page (0 = available, 1 = not available)
@@ -305,6 +317,10 @@ we can just error out without any great harm being done.
Free space management
---------------------
+(Question: why is this so complicated? Why not just have a linked list
+of free pages with the list head in the metapage? It's not like we
+avoid needing to modify the metapage with all this.)
+
Free space management consists of two sub-algorithms, one for reserving
an overflow page to add to a bucket chain, and one for returning an empty
overflow page to the free pool.