postgresql/src/backend
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
..
access Pad XLogReaderState's main_data buffer more aggressively. 2017-11-26 15:17:24 -05:00
bootstrap Exclude flex-generated code from coverage testing 2017-10-16 16:28:11 -04:00
catalog Fix multiple problems with satisfies_hash_partition. 2017-11-21 13:06:32 -05:00
commands Pass InitPlan values to workers via Gather (Merge). 2017-11-16 12:06:14 -05:00
executor Repair failure with SubPlans in multi-row VALUES lists. 2017-11-25 14:15:48 -05:00
foreign Change TRUE/FALSE to true/false 2017-11-08 11:37:28 -05:00
lib Allow to avoid NUL-byte management for stringinfos and use in format.c. 2017-10-11 16:01:52 -07:00
libpq Support channel binding 'tls-unique' in SCRAM 2017-11-18 10:15:54 -05:00
main Install Windows crash dump handler before all else. 2017-11-12 14:31:00 -08:00
nodes Pass InitPlan values to workers via Gather (Merge). 2017-11-16 12:06:14 -05:00
optimizer Improve planner's handling of set-returning functions in grouping columns. 2017-11-25 11:48:09 -05:00
parser Add some const decorations to prototypes 2017-11-10 13:38:57 -05:00
po Translation updates 2017-08-07 13:55:34 -04:00
port Add some const decorations to prototypes 2017-11-10 13:38:57 -05:00
postmaster Provide for forward compatibility with future minor protocol versions. 2017-11-21 13:56:24 -05:00
regex Mop-up for commit 85feb77aa0. 2017-09-22 11:35:12 -04:00
replication Generational memory allocator 2017-11-23 05:45:07 +11:00
rewrite RLS comment fixes. 2017-11-24 14:14:40 +00:00
snowball Add some const decorations to prototypes 2017-11-10 13:38:57 -05:00
statistics Infer functional dependency past RelabelType 2017-10-12 17:23:47 +02:00
storage Update buffile.h/.c comments for removal of non-temp option. 2017-11-25 13:19:43 -05:00
tcop Back out the session_start and session_end hooks feature. 2017-11-16 11:35:02 -05:00
tsearch Add some const decorations to prototypes 2017-11-10 13:38:57 -05:00
utils Make has_sequence_privilege support WITH GRANT OPTION 2017-11-26 09:49:40 -08:00
.gitignore Add .gitignore entries for AIX-specific intermediate build artifacts. 2015-07-08 20:44:22 -04:00
Makefile Inject $(ICU_LIBS) regardless of platform. 2017-08-20 21:22:18 -07:00
common.mk Add ICU_CFLAGS to global CPPFLAGS 2017-06-12 15:57:22 -04:00
nls.mk Translation updates 2017-05-15 12:19:54 -04:00