pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Pad XLogReaderState's main_data buffer more aggressively. 4+ messages / 1 participants [nested] [flat]
* pgsql: Pad XLogReaderState's main_data buffer more aggressively. @ 2017-11-26 20:17 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 4+ messages in thread From: Tom Lane @ 2017-11-26 20:17 UTC (permalink / raw) To: pgsql-committers 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 Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/8735978e7aebfbc499843630131c18d1f7346c79 Modified Files -------------- src/backend/access/transam/xlogreader.c | 17 ++++++++++++++++- src/include/access/heapam_xlog.h | 8 +------- 2 files changed, 17 insertions(+), 8 deletions(-) ^ permalink raw reply [nested|flat] 4+ messages in thread
* pgsql: Pad XLogReaderState's main_data buffer more aggressively. @ 2017-11-26 20:17 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 4+ messages in thread From: Tom Lane @ 2017-11-26 20:17 UTC (permalink / raw) To: pgsql-committers 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 Branch ------ REL_10_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/94fd57df30b802b6087a92ba1fa88fdfe5618390 Modified Files -------------- src/backend/access/transam/xlogreader.c | 17 ++++++++++++++++- src/include/access/heapam_xlog.h | 8 +------- 2 files changed, 17 insertions(+), 8 deletions(-) ^ permalink raw reply [nested|flat] 4+ messages in thread
* pgsql: Pad XLogReaderState's main_data buffer more aggressively. @ 2017-11-26 20:17 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 4+ messages in thread From: Tom Lane @ 2017-11-26 20:17 UTC (permalink / raw) To: pgsql-committers 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 Branch ------ REL9_6_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/9773f0527ffed36fabe6b72130fe9e9dbad9605b Modified Files -------------- src/backend/access/transam/xlogreader.c | 17 ++++++++++++++++- src/include/access/heapam_xlog.h | 8 +------- 2 files changed, 17 insertions(+), 8 deletions(-) ^ permalink raw reply [nested|flat] 4+ messages in thread
* pgsql: Pad XLogReaderState's main_data buffer more aggressively. @ 2017-11-26 20:17 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 4+ messages in thread From: Tom Lane @ 2017-11-26 20:17 UTC (permalink / raw) To: pgsql-committers 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 Branch ------ REL9_5_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/c0ef3af4ebf2dcc2de8edf87be69cd7773dc0f8d Modified Files -------------- src/backend/access/transam/xlogreader.c | 17 ++++++++++++++++- src/include/access/heapam_xlog.h | 8 +------- 2 files changed, 17 insertions(+), 8 deletions(-) ^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2017-11-26 20:17 UTC | newest] Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2017-11-26 20:17 pgsql: Pad XLogReaderState's main_data buffer more aggressively. Tom Lane <tgl@sss.pgh.pa.us> 2017-11-26 20:17 pgsql: Pad XLogReaderState's main_data buffer more aggressively. Tom Lane <tgl@sss.pgh.pa.us> 2017-11-26 20:17 pgsql: Pad XLogReaderState's main_data buffer more aggressively. Tom Lane <tgl@sss.pgh.pa.us> 2017-11-26 20:17 pgsql: Pad XLogReaderState's main_data buffer more aggressively. Tom Lane <tgl@sss.pgh.pa.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox