Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite898437

Browse files
committed
Improve coding in _hash_addovflpage.
Instead of relying on the page contents to know whether we haveadvanced from the primary bucket page to an overflow page, trackthat explicitly.Amit Kapila, per a complaint by me.
1 parent2ef6fe9 commite898437

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

‎src/backend/access/hash/hashovfl.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,17 @@ _hash_addovflpage(Relation rel, Buffer metabuf, Buffer buf, bool retain_pin)
128128
break;
129129

130130
/* we assume we do not need to write the unmodified page */
131-
if ((pageopaque->hasho_flag&LH_BUCKET_PAGE)&&retain_pin)
131+
if (retain_pin)
132+
{
133+
/* pin will be retained only for the primary bucket page */
134+
Assert(pageopaque->hasho_flag&LH_BUCKET_PAGE);
132135
LockBuffer(buf,BUFFER_LOCK_UNLOCK);
136+
}
133137
else
134138
_hash_relbuf(rel,buf);
135139

140+
retain_pin= false;
141+
136142
buf=_hash_getbuf(rel,nextblkno,HASH_WRITE,LH_OVERFLOW_PAGE);
137143
}
138144

@@ -150,8 +156,12 @@ _hash_addovflpage(Relation rel, Buffer metabuf, Buffer buf, bool retain_pin)
150156
/* logically chain overflow page to previous page */
151157
pageopaque->hasho_nextblkno=BufferGetBlockNumber(ovflbuf);
152158
MarkBufferDirty(buf);
153-
if ((pageopaque->hasho_flag&LH_BUCKET_PAGE)&&retain_pin)
159+
if (retain_pin)
160+
{
161+
/* pin will be retained only for the primary bucket page */
162+
Assert(pageopaque->hasho_flag&LH_BUCKET_PAGE);
154163
LockBuffer(buf,BUFFER_LOCK_UNLOCK);
164+
}
155165
else
156166
_hash_relbuf(rel,buf);
157167

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp