Allow notifications to bgworkers without database connections.
authorRobert Haas <rhaas@postgresql.org>
Tue, 1 Sep 2015 19:30:19 +0000 (15:30 -0400)
committerRobert Haas <rhaas@postgresql.org>
Tue, 1 Sep 2015 19:30:19 +0000 (15:30 -0400)
commit8a02b3d732cf3ec13e089768bf9ce9abbdcc8a3e
tree090a27241b24568c93e1d2785ad1cf2d50283f2f
parent9646d2fd62a444ab4502e49dfe3cbf9d7350c5e2
Allow notifications to bgworkers without database connections.

Previously, if one background worker registered another background
worker and set bgw_notify_pid while for the second background worker,
it would not receive notifications from the postmaster unless, at the
time the "parent" was registered, BGWORKER_BACKEND_DATABASE_CONNECTION
was set.

To fix, instead instead of including only those background workers that
requested database connections in the postmater's BackendList, include
them all.  There doesn't seem to be any reason not do this, and indeed
it removes a significant amount of duplicated code.  The other option
is to make PostmasterMarkPIDForWorkerNotify look at BackgroundWorkerList
in addition to BackendList, but that adds more code duplication instead
of getting rid of it.

Patch by me.  Review and testing by Ashutosh Bapat.
src/backend/postmaster/postmaster.c