Re: bgworker / SPI docs patches

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: Robert Haas <robertmhaas(at)gmail(dot)com>, Craig Ringer <craig(at)2ndquadrant(dot)com>
Cc: pgsql-docs <pgsql-docs(at)postgresql(dot)org>
Subject: Re: bgworker / SPI docs patches
Date: 2015-07-30 07:47:03
Message-ID: 55B9D677.8000800@iki.fi
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

On 07/29/2015 09:42 PM, Robert Haas wrote:
> + <warning>
> + <para>
> + Use of this field is deprecated. It should be set to
> + <literal>NULL</literal> then <structfield>bgw_library_name</structfield>
> + and <structfield>bgw_function_name</structfield> should be used instead.
> + </para>
>
> I don't think bgw_main is exactly deprecated. It's fine to use it if
> the function is in the core code; it just can't be safely used for
> functions in dynamically loaded shared libraries. Maybe that's close
> enough to "deprecated" that we should just call it deprecated, but I'm
> slightly reluctant to use that word.

Hmm. worker_spi module uses bgw_main. Is that bad? Given that work_spi
is supposedly an example or template that you copy-paste from when
writing your own bgworker, we should make sure it follows the best
practice. Also, I note that worker_spi doesn't memset(0) its
BackgroundWorker struct, so any uninitialized fields will contain
garbage. Including bgw_library_name and bgw_function_name. That seems bad.

> I've committed some bits of this that seem useful and controversial
> with rather extensive wordsmithing; let me know if it doesn't look
> good.

I've marked this as committed in the commitfest. If we're waiting for a
followup patch for the remaining bits, please change it back to Waiting
on Author, or post the followup patch to the next commitfest if it can't
be done quickly.

- Heikki

In response to

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message Robert Haas 2015-07-30 20:20:38 Re: bgworker / SPI docs patches
Previous Message Robert Haas 2015-07-29 18:42:55 Re: bgworker / SPI docs patches