Re: could not read block 0 in file : read only 0 of 8192 bytes whendoing nasty on immutable index function

Поиск
Список
Период
Сортировка
От Peter Geoghegan
Тема Re: could not read block 0 in file : read only 0 of 8192 bytes whendoing nasty on immutable index function
Дата
Msg-id CAH2-Wzn1DDZ6HSDwOpD2b964mqpPDqsE1nAfbHr+TU5cBo219A@mail.gmail.com
обсуждение исходный текст
Ответ на Re: could not read block 0 in file : read only 0 of 8192 bytes whendoing nasty on immutable index function  (Andres Freund <andres@anarazel.de>)
Ответы Re: could not read block 0 in file : read only 0 of 8192 bytes whendoing nasty on immutable index function  (Andres Freund <andres@anarazel.de>)
Re: could not read block 0 in file : read only 0 of 8192 bytes whendoing nasty on immutable index function  (Andres Freund <andres@anarazel.de>)
Список pgsql-bugs
On Thu, Jun 28, 2018 at 8:02 AM, Andres Freund <andres@anarazel.de> wrote:
> Peter, looks like you might be involved specifically.

Seems that way.

> This however seems wrong.  Cleary the relation's index list is out of
> date.
>
> I believe this happens because there's currently no relcache
> invalidation registered for the main relation, until *after* the index
> is built. Normally it'd be the CacheInvalidateRelcacheByTuple(tuple) in
> index_update_stats(), which is called at the bottom of index_build().
> But we never get there, because the earlier error.  That's bad, because
> any relcache entry built *after* the CommandCounterIncrement() in
> CommandCounterIncrement() will now be outdated.
>
> In the olden days we most of the time didn't build a relcache entry
> until after the index was built - but plan_create_index_workers() now
> does. I'm suspect there's other ways to trigger that earlier, too.

Note that there is a kludge within plan_create_index_workers() that
has us treat the heap relation as an inheritance parent, just to get a
RelOptInfo for the heap relation without running into similar trouble
with the index in get_relation_info(). Perhaps there's an argument to
be made for refactoring plan_create_index_workers() as a fix for this.

> Putting in a CacheInvalidateRelcache(heapRelation); before the CCI in
> index_create() indeed makes the "borked relcache" problem go away.
>
>
> I wonder why we don't just generally trigger invalidations to an
> indexes' "owning" relation in CacheInvalidateHeapTuple()?

I don't know, but that seems like a good question.

-- 
Peter Geoghegan


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

Предыдущее
От: Daniel Ebdrup
Дата:
Сообщение: Re: BUG #15268: Documentation surrounding sysvipc configuration andisolation is out-of-date as of FreeBSD 11
Следующее
От: PG Bug reporting form
Дата:
Сообщение: BUG #15269: Can't reassign bg color to server group once it was donepreviously