|
8 | 8 | *
|
9 | 9 | *
|
10 | 10 | * IDENTIFICATION
|
11 |
| - * $Header: /cvsroot/pgsql/src/backend/access/hash/hashinsert.c,v 1.27 2003/08/04 02:39:57 momjian Exp $ |
| 11 | + * $Header: /cvsroot/pgsql/src/backend/access/hash/hashinsert.c,v 1.28 2003/09/01 20:26:34 tgl Exp $ |
12 | 12 | *
|
13 | 13 | *-------------------------------------------------------------------------
|
14 | 14 | */
|
@@ -155,7 +155,7 @@ _hash_insertonpg(Relation rel,
|
155 | 155 | * page with enough room. allocate a new overflow page.
|
156 | 156 | */
|
157 | 157 | do_expand = true;
|
158 |
| - ovflbuf = _hash_addovflpage(rel, &metabuf, buf); |
| 158 | + ovflbuf = _hash_addovflpage(rel, metabuf, buf); |
159 | 159 | _hash_relbuf(rel, buf, HASH_WRITE);
|
160 | 160 | buf = ovflbuf;
|
161 | 161 | page = BufferGetPage(buf);
|
@@ -186,18 +186,15 @@ _hash_insertonpg(Relation rel,
|
186 | 186 | * access type just for a moment to allow greater accessibility to
|
187 | 187 | * the metapage.
|
188 | 188 | */
|
189 |
| - metap = (HashMetaPage) _hash_chgbufaccess(rel, &metabuf, |
190 |
| - HASH_READ, HASH_WRITE); |
191 |
| - metap->hashm_nkeys += 1; |
192 |
| - metap = (HashMetaPage) _hash_chgbufaccess(rel, &metabuf, |
193 |
| - HASH_WRITE, HASH_READ); |
194 |
| - |
| 189 | + _hash_chgbufaccess(rel, metabuf, HASH_READ, HASH_WRITE); |
| 190 | + metap->hashm_ntuples += 1; |
| 191 | + _hash_chgbufaccess(rel, metabuf, HASH_WRITE, HASH_READ); |
195 | 192 | }
|
196 | 193 |
|
197 | 194 | _hash_wrtbuf(rel, buf);
|
198 | 195 |
|
199 | 196 | if (do_expand ||
|
200 |
| - (metap->hashm_nkeys / (metap->hashm_maxbucket + 1)) |
| 197 | + (metap->hashm_ntuples / (metap->hashm_maxbucket + 1)) |
201 | 198 | > metap->hashm_ffactor)
|
202 | 199 | _hash_expandtable(rel, metabuf);
|
203 | 200 | _hash_relbuf(rel, metabuf, HASH_READ);
|
|
0 commit comments