Re: Race conditions, race conditions!

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Race conditions, race conditions!
Дата
Msg-id 2226.1123886566@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Race conditions, race conditions!  (Bruce Momjian <pgman@candle.pha.pa.us>)
Ответы Re: Race conditions, race conditions!  (Bruce Momjian <pgman@candle.pha.pa.us>)
Список pgsql-hackers
Bruce Momjian <pgman@candle.pha.pa.us> writes:
> Patch applied.  Thanks.
>            * block is not currently in memory.
>            */
>           bufHdr = BufferAlloc(reln, blockNum, &found);
> +         /* we are guaranted that nobody else has touched this will-be-new block */
> +         Assert(!(found && isExtend));
>           if (found)
>               BufferHitCount++;
>       }

This patch is utterly wrong.  Please revert it.

The case it is Asserting can't happen is explained in the comment a
couple dozen lines further down:

* try to extend a relation
* read smgrnblocks to find the current relation length
* allocate an empty buffer for the N+1'st page of the rel
* call smgrextend
* smgrextend fails for some reason (eg, no space left on disk)
* buffer remains present, but is not BM_VALID
* awhile later, try to extend relation again
* read smgrnblocks to find the current relation length
* allocate a buffer for the N+1'st page of the rel

This is entirely likely to find the same non-BM_VALID buffer that was
assigned in the first iteration.
        regards, tom lane


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: pthread stack on FreeBSD WAS: HEAD doesn't cope with libraries
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: Race conditions, race conditions!