postgresql/src/backend/access
Tom Lane 8735978e7a Pad XLogReaderState's main_data buffer more aggressively.
Originally, we palloc'd this buffer just barely big enough to hold the
largest xlog record seen so far.  It turns out that that can result in
valgrind complaints, because some compilers will emit code that assumes
it can safely fetch padding bytes at the end of a struct, and those
padding bytes were unallocated so far as aset.c was concerned.  We can
fix that by MAXALIGN'ing the palloc request size, ensuring that it is big
enough to include any possible padding that might've been omitted from
the on-disk record.

An additional objection to the original coding is that it could result in
many repeated palloc cycles, in the worst case where we see a series of
gradually larger xlog records.  We can ameliorate that cheaply by
imposing a minimum buffer size that's large enough for most xlog records.
BLCKSZ/2 was chosen after a bit of discussion.

In passing, remove an obsolete comment in struct xl_heap_new_cid that the
combocid field is free due to alignment considerations.  Perhaps that was
true at some point, but it's not now.

Back-patch to 9.5 where this code came in.

Discussion: https://postgr.es/m/E1eHa4J-0006hI-Q8@gemulon.postgresql.org
2017-11-26 15:17:24 -05:00
..
brin Change TRUE/FALSE to true/false 2017-11-08 11:37:28 -05:00
common Parameter toast_tuple_target controls TOAST for new rows 2017-11-20 09:50:10 +11:00
gin Fix broken cleanup interlock for GIN pending list. 2017-11-16 14:19:27 -05:00
gist Add some const decorations to prototypes 2017-11-10 13:38:57 -05:00
hash Change TRUE/FALSE to true/false 2017-11-08 11:37:28 -05:00
heap Parameter toast_tuple_target controls TOAST for new rows 2017-11-20 09:50:10 +11:00
index Change TRUE/FALSE to true/false 2017-11-08 11:37:28 -05:00
nbtree Change TRUE/FALSE to true/false 2017-11-08 11:37:28 -05:00
rmgrdesc Remove dedicated B-tree root-split record types. 2017-08-16 12:24:40 +03:00
spgist Change TRUE/FALSE to true/false 2017-11-08 11:37:28 -05:00
tablesample Update copyright via script for 2017 2017-01-03 13:48:53 -05:00
transam Pad XLogReaderState's main_data buffer more aggressively. 2017-11-26 15:17:24 -05:00
Makefile TABLESAMPLE, SQL Standard and extensible 2015-05-15 14:37:10 -04:00