pgsql: Allow notifications to bgworkers without database connections.

From: Robert Haas <rhaas(at)postgresql(dot)org>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Allow notifications to bgworkers without database connections.
Date: 2015-09-01 20:32:41
Message-ID: E1ZWsET-0005Gv-Q8@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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.

Branch
------
REL9_5_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/b8a439b650c4791575720dec847be61467a710a4

Modified Files
--------------
src/backend/postmaster/postmaster.c | 136 +++++++----------------------------
1 file changed, 25 insertions(+), 111 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Bruce Momjian 2015-09-01 20:42:52 pgsql: pg_upgrade docs: clarify rsync and move verification step
Previous Message Alvaro Herrera 2015-09-01 18:13:11 pgsql: Use <substeps> in pg_upgrade's procedure