Re: BUG #15039: some question about hash index code

Поиск
Список
Период
Сортировка
От Amit Kapila
Тема Re: BUG #15039: some question about hash index code
Дата
Msg-id CAA4eK1+TskOwUH093E8coMMKDJT-mMXh=-K_XP5Kke1REf2bFA@mail.gmail.com
обсуждение исходный текст
Ответ на BUG #15039: some question about hash index code  (PG Bug reporting form <noreply@postgresql.org>)
Ответы Re:Re: BUG #15039: some question about hash index code  (自己 <zoulx1982@163.com>)
Список pgsql-bugs
On Wed, Jan 31, 2018 at 5:04 PM, PG Bug reporting form
<noreply@postgresql.org> wrote:
> The following bug has been logged on the website:
>
> Bug reference:      15039
> Logged by:          lixian zou
> Email address:      zoulx1982@163.com
> PostgreSQL version: 10.0
> Operating system:   source code
> Description:
>
> hi,
> i read hash index code , and found in _hash_addovflpage function, there is
> such code :
> if (metap->hashm_firstfree == orig_firstfree)
> {
>         metap->hashm_firstfree = bit + 1;
>         MarkBufferDirty(metabuf);
> }
>
> i found no any chang for metap,metap->hashm_firstfree,and initial the two
> variable is equal, so maybe the if statement is redundant?
>

The hashm_firstfree can be changed by a concurrent session as we
release and reacquire the lock on a metapage while trying to get the
bitmap page.  See, below code:

_hash_addovflpage
{
..
..

for (;;)
{
..
/* Release exclusive lock on metapage while reading bitmap page */
LockBuffer(metabuf, BUFFER_LOCK_UNLOCK);
..

/* Reacquire exclusive lock on the meta page */
LockBuffer(metabuf, BUFFER_LOCK_EXCLUSIVE);
}
..

if (metap->hashm_firstfree == orig_firstfree)
{
metap->hashm_firstfree = bit + 1;
MarkBufferDirty(metabuf);
}
..
}


I think pgsql-hackers is the better place to get clarifications related to code.

-- 
With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com


В списке pgsql-bugs по дате отправления:

Предыдущее
От: PG Bug reporting form
Дата:
Сообщение: BUG #15039: some question about hash index code
Следующее
От: 自己
Дата:
Сообщение: Re:Re: BUG #15039: some question about hash index code