diff options
author | Robert Haas <rhaas@postgresql.org> | 2015-03-19 10:56:34 -0400 |
---|---|---|
committer | Robert Haas <rhaas@postgresql.org> | 2015-03-19 11:08:54 -0400 |
commit | 76d07a2a0633836a82c43beb8ed3b08a64dc3d46 (patch) | |
tree | 1addda1116a05fa6da347f4327409857f6ee1f84 /src/backend/executor/execUtils.c | |
parent | 904e8b627c2547e93112080aac9381bbf39e8e99 (diff) |
Fix status reporting for terminated bgworkers that were never started.
Previously, GetBackgroundWorkerPid() would return BGWH_NOT_YET_STARTED
if the slot used for the worker registration had not been reused by
unrelated activity, and BGWH_STOPPED if it had. Either way, a process
that had requested notification when the state of one of its
background workers changed did not receive such notifications. Fix
things so that GetBackgroundWorkerPid() always returns BGWH_STOPPED in
this situation, so that we do not erroneously give waiters the
impression that the worker will eventually be started; and send
notifications just as we would if the process terminated after having
been started, so that it's possible to wait for the postmaster to
process a worker termination request without polling.
Discovered by Amit Kapila during testing of parallel sequential scan.
Analysis and fix by me. Back-patch to 9.4; there may not be anyone
relying on this interface yet, but if anyone is, the new behavior is a
clear improvement.
Diffstat (limited to 'src/backend/executor/execUtils.c')
0 files changed, 0 insertions, 0 deletions