Re: Avoiding smgrimmedsync() during nbtree index builds

Поиск
Список
Период
Сортировка
От Robert Haas
Тема Re: Avoiding smgrimmedsync() during nbtree index builds
Дата
Msg-id CA+Tgmoa+QFFhkHgPxyxv6t8aVU0r7GZmu7z8io4vGG7RHPpGzA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Avoiding smgrimmedsync() during nbtree index builds  (Melanie Plageman <melanieplageman@gmail.com>)
Список pgsql-hackers
On Wed, Sep 29, 2021 at 2:36 PM Melanie Plageman
<melanieplageman@gmail.com> wrote:
> unbuffered_write() and unbuffered_extend() might be able to be used even
> if unbuffered_prep() and unbuffered_finish() are not used -- for example
> hash indexes do something I don't entirely understand in which they call
> smgrextend() directly when allocating buckets but then initialize the
> new bucket pages using the bufmgr machinery.

My first thought was that someone might do this to make sure that we
don't run out of disk space after initializing some but not all of the
buckets. Someone might have some reason for wanting to avoid that
corner case. However, in _hash_init() that explanation doesn't make
any sense, because an abort would destroy the entire relation. And in
_hash_alloc_buckets() the variable "zerobuf" points to a buffer that
is not, in fact, all zeroes. So my guess is this is just old, crufty
code - either whatever reasons somebody had for doing it that way are
no longer valid, or there wasn't any good reason even at the time.

-- 
Robert Haas
EDB: http://www.enterprisedb.com



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

Предыдущее
От: "Joel Jacobson"
Дата:
Сообщение: Re: Schema variables - new implementation for Postgres 15
Следующее
От: "Efrain J. Berdecia"
Дата:
Сообщение: Re: Custom Operator for citext LIKE predicates question