Re: BTScanOpaqueData size slows down tests

Поиск
Список
Период
Сортировка
От Álvaro Herrera
Тема Re: BTScanOpaqueData size slows down tests
Дата
Msg-id 202504021631.d7rglevv7xt6@alvherre.pgsql
обсуждение исходный текст
Ответ на Re: BTScanOpaqueData size slows down tests  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: BTScanOpaqueData size slows down tests
Список pgsql-hackers
On 2025-Apr-02, Tom Lane wrote:

> Andres Freund <andres@anarazel.de> writes:
> > I'm a bit confused by the "MUST BE LAST" comment:
> >     BTScanPosItem items[MaxTIDsPerBTreePage];    /* MUST BE LAST */
> 
> Yeah, me too.  It looks like it might've been intended to allow
> the items[] array to be only partially allocated.  But as Peter
> says, we don't do that.  Too long ago to be sure :=(

The mentioned commit (09cb5c0e7d6f) shows that we do partial memcpys, e.g.

+       memcpy(&so->markPos, &so->currPos,
+              offsetof(BTScanPosData, items[1]) +
+              so->currPos.lastItem * sizeof(BTScanPosItem));

That would obviously not work if this field weren't last.  We still do
that, don't we?  See btrestrpos().

-- 
Álvaro Herrera         PostgreSQL Developer  —  https://www.EnterpriseDB.com/
"Before you were born your parents weren't as boring as they are now. They
got that way paying your bills, cleaning up your room and listening to you
tell them how idealistic you are."  -- Charles J. Sykes' advice to teenagers



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