forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit8735978
committed
Pad XLogReaderState's main_data buffer more aggressively.
Originally, we palloc'd this buffer just barely big enough to hold thelargest xlog record seen so far. It turns out that that can result invalgrind complaints, because some compilers will emit code that assumesit can safely fetch padding bytes at the end of a struct, and thosepadding bytes were unallocated so far as aset.c was concerned. We canfix that by MAXALIGN'ing the palloc request size, ensuring that it is bigenough to include any possible padding that might've been omitted fromthe on-disk record.An additional objection to the original coding is that it could result inmany repeated palloc cycles, in the worst case where we see a series ofgradually larger xlog records. We can ameliorate that cheaply byimposing 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 thecombocid field is free due to alignment considerations. Perhaps that wastrue 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.org1 parent752714d commit8735978
File tree
2 files changed
+17
-8
lines changed- src
- backend/access/transam
- include/access
2 files changed
+17
-8
lines changedLines changed: 16 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1279 | 1279 |
| |
1280 | 1280 |
| |
1281 | 1281 |
| |
1282 |
| - | |
| 1282 | + | |
| 1283 | + | |
| 1284 | + | |
| 1285 | + | |
| 1286 | + | |
| 1287 | + | |
| 1288 | + | |
| 1289 | + | |
| 1290 | + | |
| 1291 | + | |
| 1292 | + | |
| 1293 | + | |
| 1294 | + | |
| 1295 | + | |
| 1296 | + | |
| 1297 | + | |
1283 | 1298 |
| |
1284 | 1299 |
| |
1285 | 1300 |
| |
|
Lines changed: 1 addition & 7 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
339 | 339 |
| |
340 | 340 |
| |
341 | 341 |
| |
342 |
| - | |
343 |
| - | |
344 |
| - | |
345 |
| - | |
346 |
| - | |
347 |
| - | |
348 |
| - | |
| 342 | + | |
349 | 343 |
| |
350 | 344 |
| |
351 | 345 |
| |
|
0 commit comments
Comments
(0)