Re: Are ctid chaining loops safe without relation size checks?

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: Are ctid chaining loops safe without relation size checks?
Дата
Msg-id 20190515190713.GA5326@alvherre.pgsql
обсуждение исходный текст
Ответ на Are ctid chaining loops safe without relation size checks?  (Andres Freund <andres@anarazel.de>)
Ответы Re: Are ctid chaining loops safe without relation size checks?  (Andres Freund <andres@anarazel.de>)
Список pgsql-hackers
On 2019-May-15, Andres Freund wrote:

> -    blk = ItemPointerGetBlockNumber(tid);
> -    if (blk >= RelationGetNumberOfBlocks(relation))
> -        elog(ERROR, "block number %u is out of range for relation \"%s\"",
> -             blk, RelationGetRelationName(relation));
> 
> Which I dutifully rewrote. But I'm actually not sure it's safe at all
> for heap to rely on t_ctid links to be valid. What prevents a ctid link
> to point to a page that's since been truncated away?

Umm .. IIUC all index entries for truncated pages should have been
removed prior to the truncation.  Otherwise, how would those index
entries not become immediately data corruption the instant the heap is
re-grown to cover those truncated pages?  So I think if the TID comes
directly from user then this is a check worth doing, but if the TID
comes from an index, then it isn't.

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



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

Предыдущее
От: Tom Lane
Дата:
Сообщение: ClonedConstraint typedef is dead code?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Are ctid chaining loops safe without relation size checks?