Re: Proposals for making it easier to write correct bgworkers

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Craig Ringer <craig(at)2ndquadrant(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposals for making it easier to write correct bgworkers
Date: 2020-09-18 22:38:45
Message-ID: 20200918223845.GC30016@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Sep 10, 2020 at 11:02:07AM +0800, Craig Ringer wrote:
> Hi all
>
> As I've gained experience working on background workers, it's become
> increasingly clear that they're a bit too different to normal backends for many
> nontrivial uses.
>
> I thought I'd take a moment to note some of it here, along with some proposals
> for things we could potentially do to make it much easier to use bgworkers
> correctly especially when using them to run queries.
>
> This is NOT A PATCH SET. It's a set of discussion proposals and it's also
> intended as a bit of a helper for people just getting started on bgworkers.
> There are a lot of subtle differences in the runtime environment a basic
> bgworker provides vs the runtime environment extension authors will be used to
> when writing fmgr-callable C functions.
>
> (It looks like pg12 and pg13 have some improvements, so some of the issues I
> was going to mention with error cleanup paths and locking aren't relevant
> anymore.)
>
> DIFFERENCES WHEN CODING FOR BGWORKERS

Can we put this information somewhere in our docs or source code as a
README?

--
Bruce Momjian <bruce(at)momjian(dot)us> https://momjian.us
EnterpriseDB https://enterprisedb.com

The usefulness of a cup is in its emptiness, Bruce Lee

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2020-09-18 22:42:25 Re: Proposal of new PostgreSQL Extension - PGSpiderExt
Previous Message Tom Lane 2020-09-18 22:32:52 Re: recovering from "found xmin ... from before relfrozenxid ..."