Re: [HACKERS] SerializedSnapshotData alignment

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [HACKERS] SerializedSnapshotData alignment
Дата
Msg-id 594.1488156795@sss.pgh.pa.us
обсуждение исходный текст
Ответ на [HACKERS] SerializedSnapshotData alignment  (Noah Misch <noah@leadboat.com>)
Ответы Re: [HACKERS] SerializedSnapshotData alignment  (Noah Misch <noah@leadboat.com>)
Список pgsql-hackers
Noah Misch <noah@leadboat.com> writes:
> Dear 7b4ac19 authors,
> Field ps_snapshot_data usually receives four-byte alignment within
> ParallelIndexScanDescData, but it contains the eight-byte whenTaken field.
> The select_parallel test dies with SIGBUS on "Oracle Solaris 10 1/13
> s10s_u11wos_24a SPARC", building with gcc 4.9.2.

It's a little distressing that the buildfarm didn't find this already.
Is there some reason why it's specific to that particular compiler,
rather than generic to alignment-picky 64-bit machines?

In general, though, I agree that using a char[] member to represent
anything that has any alignment requirement at all is seriously bad
coding style that is almost certain to fail eventually.

A solution you didn't mention is to change the ParallelIndexScanDescData
field to be a pointer, perhaps "struct SerializedSnapshotData *", while
leaving that struct opaque so far as relscan.h is concerned.  This could
avoid the need to use the unsafe blind casts that I'm sure must be
involved in accesses to that field at present.
        regards, tom lane



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

Предыдущее
От: Michael Paquier
Дата:
Сообщение: Re: [HACKERS] IF (NOT) EXISTS in psql-completion
Следующее
От: Michael Paquier
Дата:
Сообщение: Re: [HACKERS] Proposal for changes to recovery.conf API