]> granicus.if.org Git - postgresql/commit
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 20:23:16 +0000 (16:23 -0400)
commitb8a439b650c4791575720dec847be61467a710a4
treee337de48e35d1476bd79ba33cae3c892f7b40cfe
parentc1564b3928e527c799bd41c2c80c4d6851bb5e15
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