Re: Fix misaligned access of ItemPointerData on ARM

Поиск
Список
Период
Сортировка
От Andres Freund
Тема Re: Fix misaligned access of ItemPointerData on ARM
Дата
Msg-id 20150521195610.GA2028@alap3.anarazel.de
обсуждение исходный текст
Ответ на Re: Fix misaligned access of ItemPointerData on ARM  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On 2015-05-21 15:34:00 -0400, Tom Lane wrote:
> Piotr Stefaniak <postgres@piotr-stefaniak.me> writes:
> > But due to how ExecRowMark struct is laid out in memory, the packed 
> > struct ItemPointerData begins at an uneven offset, leading to misaligned 
> > access whenever BlockIdData is set by ItemPointerSetInvalid() (and 
> > likely in some other places, too).
> 
> But BlockIdData is laid out and accessed as two 16-bit fields, so there
> should be no problem.  On what platform exactly do you see a failure?

It's probably aligned on a byte boundary:

typedef struct ExecRowMark
{Relation    relation;        /* opened and suitably locked relation */Index        rti;            /* its range table
index*/Index        prti;            /* parent range table index, if child */Index        rowmarkId;        /* unique
identifierfor resjunk columns */RowMarkType markType;        /* see enum in nodes/plannodes.h */bool        noWait;
      /* NOWAIT option */ItemPointerData curCtid;    /* ctid of currently locked tuple, if any */
 
} ExecRowMark;

due to the packedness curCtid will quite possibly be stored without any
padding after after noWait.



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

Предыдущее
От: Paul Ramsey
Дата:
Сообщение: GiST KNN Crasher
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Fix misaligned access of ItemPointerData on ARM