Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 8b2450c

Browse files
committed
Fix a couple typos, add some more comments.
1 parent 39673ca commit 8b2450c

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

src/backend/access/hash/README

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
$Header: /cvsroot/pgsql/src/backend/access/hash/README,v 1.1 2003/09/01 20:24:49 tgl Exp $
1+
$Header: /cvsroot/pgsql/src/backend/access/hash/README,v 1.2 2003/09/02 03:29:01 tgl Exp $
22

33
This directory contains an implementation of hash indexing for Postgres.
44

@@ -189,7 +189,7 @@ The insertion algorithm is rather similar:
189189
read/sharelock meta page
190190
compute bucket number for target hash key
191191
release meta page
192-
share-lock bucket page (to prevent split/compact this bucket)
192+
share-lock bucket page (to prevent split/compact of this bucket)
193193
release page 0 share-lock
194194
-- (so far same as reader)
195195
read/exclusive-lock current page of bucket
@@ -334,7 +334,7 @@ Obtaining an overflow page:
334334
release bitmap page
335335
loop back to try next bitmap page, if any
336336
-- here when we have checked all bitmap pages; we hold meta excl. lock
337-
extend index to add another bitmap page; update meta information
337+
extend index to add another overflow page; update meta information
338338
write/release meta page
339339
return page number
340340

@@ -344,6 +344,12 @@ concurrency against processes just entering the index. We don't want
344344
to hold the metapage exclusive lock while reading in a bitmap page.
345345
(We can at least avoid repeated buffer pin/unpin here.)
346346

347+
The normal path for extending the index does not require doing I/O while
348+
holding the metapage lock. We do have to do I/O when the extension
349+
requires adding a new bitmap page as well as the required overflow page
350+
... but that is an infrequent case, so the loss of concurrency seems
351+
acceptable.
352+
347353
The portion of tuple insertion that calls the above subroutine looks
348354
like this:
349355

@@ -392,7 +398,12 @@ algorithm is:
392398
release meta page
393399

394400
We have to do it this way because we must clear the bitmap bit before
395-
changing the first-free-bit field.
401+
changing the first-free-bit field (hashm_firstfree). It is possible that
402+
we set first-free-bit too small (because someone has already reused the
403+
page we just freed), but that is okay; the only cost is the next overflow
404+
page acquirer will scan more bitmap bits than he needs to. What must be
405+
avoided is having first-free-bit greater than the actual first free bit,
406+
because then that free page would never be found by searchers.
396407

397408
All the freespace operations should be called while holding no buffer
398409
locks. Since they need no lmgr locks, deadlock is not possible.

0 commit comments

Comments
 (0)