Commit 41803d5
committed
Fix possible core dump in parallel restore when using a TOC list.
Commit 3eb9a5e unintentionally introduced an ordering dependency
into restore_toc_entries_prefork(). The existing coding of
reduce_dependencies() contains a check to skip moving a TOC entry
to the ready_list if it wasn't initially in the pending_list.
This used to suffice to prevent reduce_dependencies() from trying to
move anything into the ready_list during restore_toc_entries_prefork(),
because the pending_list stayed empty throughout that phase; but it no
longer does. The problem doesn't manifest unless the TOC has been
reordered by SortTocFromFile, which is how I missed it in testing.
To fix, just add a test for ready_list == NULL, converting the call
with NULL from a poor man's sanity check into an explicit command
not to touch TOC items' list membership. Clarify some of the comments
around this; in particular, note the primary purpose of the check for
pending_list membership, which is to ensure that we can't try to restore
the same item twice, in case a TOC list forces it to be restored before
its dependency count goes to zero.
Per report from Fabrízio de Royes Mello. Back-patch to 9.3, like the
previous commit.
Discussion: https://postgr.es/m/CAFcNs+pjuv0JL_x4+=71TPUPjdLHOXA4YfT32myj_OrrZb4ohA@mail.gmail.com1 parent c343314 commit 41803d5
1 file changed
+14
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3796 | 3796 | | |
3797 | 3797 | | |
3798 | 3798 | | |
3799 | | - | |
3800 | | - | |
| 3799 | + | |
| 3800 | + | |
| 3801 | + | |
3801 | 3802 | | |
3802 | 3803 | | |
3803 | 3804 | | |
| |||
3844 | 3845 | | |
3845 | 3846 | | |
3846 | 3847 | | |
3847 | | - | |
| 3848 | + | |
3848 | 3849 | | |
3849 | 3850 | | |
3850 | 3851 | | |
| |||
4521 | 4522 | | |
4522 | 4523 | | |
4523 | 4524 | | |
4524 | | - | |
| 4525 | + | |
4525 | 4526 | | |
4526 | 4527 | | |
4527 | 4528 | | |
| |||
4538 | 4539 | | |
4539 | 4540 | | |
4540 | 4541 | | |
4541 | | - | |
4542 | | - | |
4543 | | - | |
| 4542 | + | |
| 4543 | + | |
| 4544 | + | |
| 4545 | + | |
| 4546 | + | |
| 4547 | + | |
4544 | 4548 | | |
4545 | 4549 | | |
4546 | 4550 | | |
4547 | | - | |
| 4551 | + | |
| 4552 | + | |
4548 | 4553 | | |
4549 | | - | |
| 4554 | + | |
4550 | 4555 | | |
4551 | 4556 | | |
4552 | 4557 | | |
| |||
0 commit comments