diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2017-08-19 13:39:37 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2017-08-19 13:39:51 -0400 |
commit | b1c2d76a2fcef812af0be3343082414d401909c8 (patch) | |
tree | 25dc70c0cc39d1f39d444f4cec8cba9355c36b72 /src/backend/executor/tqueue.c | |
parent | 24620fc52bd9d4139748591b6cce7327fd299684 (diff) | |
download | postgresql-b1c2d76a2fcef812af0be3343082414d401909c8.tar.gz postgresql-b1c2d76a2fcef812af0be3343082414d401909c8.zip |
Fix possible core dump in parallel restore when using a TOC list.
Commit 3eb9a5e7c 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.com
Diffstat (limited to 'src/backend/executor/tqueue.c')
0 files changed, 0 insertions, 0 deletions