- Notifications
You must be signed in to change notification settings - Fork5.3k
Commitd167c19
committed
Fix possibly uninitialized HeapScanDesc.rs_startblock
The solution used in0ca3b16 to determine the Parallel TID RangeScan's start location was to modify the signature oftable_block_parallelscan_startblock_init() to allow the startblockto be passed in as a parameter. This allows the scan limits to beadjusted before that function is called so that the limits are picked upwhen the parallel scan starts. The commit made it so the call totable_block_parallelscan_startblock_init uses the HeapScanDesc'srs_startblock to pass the startblock to the parallel scan. That allworks ok for Parallel TID Range scans as the HeapScanDesc rs_startblockgets set by heap_setscanlimits(), but for Parallel Seq Scans, initscan()does not initialize rs_startblock, and that results in passing anuninitialized value to table_block_parallelscan_startblock_init() asnoted by the buildfarm member skink, running Valgrind.To fix this issue, make it so initscan() sets the rs_startblock forparallel scans unless we're doing a rescan. This makes it sotable_block_parallelscan_startblock_init() will be called with thestartblock set to InvalidBlockNumber, and that'll allow the syncscancode to find the correct start location (when enabled). For ParallelTID Range Scans, this InvalidBlockNumber value will be overwritten inthe call to heap_setscanlimits().initscan() is a bit light on documentation on what's meant to getinitialized where for parallel scans. From what I can tell, it looks likeit just didn't matter prior to0ca3b16 that rs_startblock was leftuninitialized for parallel scans. To address the light documentation,I've also added some comments to mention that the syncscan location forparallel scans is figured out in table_block_parallelscan_startblock_init.I've also taken the liberty to adjust the if/else if/else code ininitscan() to make it clearer which parts apply to parallel scans andwhich parts are for the serial scans.Author: David Rowley <dgrowleyml@gmail.com>Discussion:https://postgr.es/m/CAApHDvqALm+k7FyfdQdCw1yF_8HojvR61YRrNhwRQPE=zSmnQA@mail.gmail.com1 parentc75bf57 commitd167c19
1 file changed
+30
-17
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
415 | 415 | | |
416 | 416 | | |
417 | 417 | | |
418 | | - | |
419 | | - | |
420 | | - | |
| 418 | + | |
421 | 419 | | |
422 | | - | |
423 | | - | |
424 | | - | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
425 | 425 | | |
426 | | - | |
427 | | - | |
428 | | - | |
429 | | - | |
430 | | - | |
431 | | - | |
432 | | - | |
433 | | - | |
434 | | - | |
| 426 | + | |
| 427 | + | |
435 | 428 | | |
436 | 429 | | |
437 | 430 | | |
438 | | - | |
439 | | - | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
440 | 453 | | |
441 | 454 | | |
442 | 455 | | |
| |||
0 commit comments
Comments
(0)