break;
/* we assume we do not need to write the unmodified page */
- if ((pageopaque->hasho_flag & LH_BUCKET_PAGE) && retain_pin)
+ if (retain_pin)
+ {
+ /* pin will be retained only for the primary bucket page */
+ Assert(pageopaque->hasho_flag & LH_BUCKET_PAGE);
LockBuffer(buf, BUFFER_LOCK_UNLOCK);
+ }
else
_hash_relbuf(rel, buf);
+ retain_pin = false;
+
buf = _hash_getbuf(rel, nextblkno, HASH_WRITE, LH_OVERFLOW_PAGE);
}
/* logically chain overflow page to previous page */
pageopaque->hasho_nextblkno = BufferGetBlockNumber(ovflbuf);
MarkBufferDirty(buf);
- if ((pageopaque->hasho_flag & LH_BUCKET_PAGE) && retain_pin)
+ if (retain_pin)
+ {
+ /* pin will be retained only for the primary bucket page */
+ Assert(pageopaque->hasho_flag & LH_BUCKET_PAGE);
LockBuffer(buf, BUFFER_LOCK_UNLOCK);
+ }
else
_hash_relbuf(rel, buf);