Be more wary about shm_toc_lookup failure.
authorTom Lane <tgl@sss.pgh.pa.us>
Fri, 2 Feb 2018 23:26:07 +0000 (18:26 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Fri, 2 Feb 2018 23:26:07 +0000 (18:26 -0500)
commit34653bc9833d9c95ed1c52bed1ff01c6193de17b
tree27b81efb6233460a5732f201a866199bcd279bb3
parent1597948c962a1407c01fc492c44917c097efa92e
Be more wary about shm_toc_lookup failure.

Commit 445dbd82a basically missed the point of commit d46633506,
which was that we shouldn't allow shm_toc_lookup() failure to lead
to a core dump or assertion crash, because the odds of such a
failure should never be considered negligible.  It's correct that
we can't expect the PARALLEL_KEY_ERROR_QUEUE TOC entry to be there
if we have no workers.  But if we have no workers, we're not going
to do anything in this function with the lookup result anyway,
so let's just skip it.  That lets the code use the easy-to-prove-safe
noError=false case, rather than anything requiring effort to review.

Back-patch to v10, like the previous commit.

Discussion: https://postgr.es/m/3647.1517601675@sss.pgh.pa.us
src/backend/access/transam/parallel.c