pgsql: Adjust SP-GiST WAL record formats to reduce alignment padding.

Поиск
Список
Период
Сортировка
От Heikki Linnakangas
Тема pgsql: Adjust SP-GiST WAL record formats to reduce alignment padding.
Дата
Msg-id E1WsUSI-0003Rc-PT@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Adjust SP-GiST WAL record formats to reduce alignment padding.

The way the code was written, the padding was copied from uninitialized
memory areas.. Because the structs are local variables in the code where
the WAL records are constructed, making them larger and zeroing the padding
bytes would not make the code very pretty, so rather than fixing this
directly by zeroing out the padding bytes, it seems more clear to not try to
align the tuples in the WAL records. The redo functions are taught to copy
the tuple header to a local variable to avoid unaligned access.

Stable-branches have the same problem, but we can't change the WAL format
there, so fix in master only. Reading a few random extra bytes at the stack
is harmless in practice, so it's not worth crafting a different
back-patchable fix.

Per reports from Kevin Grittner and Andres Freund, using clang static
analyzer and Valgrind, respectively.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/8776faa81cb651322b8993422bdd4633f1f6a487

Modified Files
--------------
src/backend/access/spgist/spgdoinsert.c |   26 +++----
src/backend/access/spgist/spgvacuum.c   |    3 +-
src/backend/access/spgist/spgxlog.c     |  116 +++++++++++++++++++------------
src/include/access/spgist_private.h     |   38 +++++-----
src/include/access/xlog_internal.h      |    2 +-
5 files changed, 105 insertions(+), 80 deletions(-)


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: pgsql: Tweak new regression test case for better portability.
Следующее
От: Andres Freund
Дата:
Сообщение: pgsql: Move regression test listing of builtin leakproof functions to o