Re: [HACKERS] BGWorkers, shared memory pointers, and postmaster restart

2014-04-17 Thread Robert Haas
On Wed, Apr 16, 2014 at 8:46 PM, Craig Ringer cr...@2ndquadrant.com wrote: On 04/17/2014 12:16 AM, Robert Haas wrote: On Wed, Apr 16, 2014 at 7:11 AM, Craig Ringer cr...@2ndquadrant.com wrote: - A flag like BGW_UNREGISTER_ON_RESTART; I would be OK with this, maybe modulo the name. - To

[HACKERS] BGWorkers, shared memory pointers, and postmaster restart

2014-04-16 Thread Craig Ringer
Hi all I've been using the dynamic BGWorker support for some recent work, and I think I've found an issue with how postmaster restarts are handled. TL;DR: I don't think there's a safe way to use a BGWorker (static or dynamic) with bgw_restart_time != BGW_NEVER_RESTART and a bgw_main_arg Datum

Re: [HACKERS] BGWorkers, shared memory pointers, and postmaster restart

2014-04-16 Thread Craig Ringer
On 04/16/2014 02:37 PM, Craig Ringer wrote: Hi all I've been using the dynamic BGWorker support for some recent work, and I think I've found an issue with how postmaster restarts are handled. TL;DR: I don't think there's a safe way to use a BGWorker (static or dynamic) with

Re: [HACKERS] BGWorkers, shared memory pointers, and postmaster restart

2014-04-16 Thread Andres Freund
On 2014-04-16 19:11:37 +0800, Craig Ringer wrote: On 04/16/2014 02:37 PM, Craig Ringer wrote: Hi all I've been using the dynamic BGWorker support for some recent work, and I think I've found an issue with how postmaster restarts are handled. TL;DR: I don't think there's a safe way

Re: [HACKERS] BGWorkers, shared memory pointers, and postmaster restart

2014-04-16 Thread Craig Ringer
On 04/16/2014 07:21 PM, Andres Freund wrote: On 2014-04-16 19:11:37 +0800, Craig Ringer wrote: On 04/16/2014 02:37 PM, Craig Ringer wrote: Hi all I've been using the dynamic BGWorker support for some recent work, and I think I've found an issue with how postmaster restarts are handled.

Re: [HACKERS] BGWorkers, shared memory pointers, and postmaster restart

2014-04-16 Thread Robert Haas
On Wed, Apr 16, 2014 at 7:11 AM, Craig Ringer cr...@2ndquadrant.com wrote: TL;DR: I don't think there's a safe way to use a BGWorker (static or dynamic) with bgw_restart_time != BGW_NEVER_RESTART and a bgw_main_arg Datum that points into shared memory, and think we might need a API change to

Re: [HACKERS] BGWorkers, shared memory pointers, and postmaster restart

2014-04-16 Thread Craig Ringer
On 04/17/2014 12:16 AM, Robert Haas wrote: On Wed, Apr 16, 2014 at 7:11 AM, Craig Ringer cr...@2ndquadrant.com wrote: - A flag like BGW_UNREGISTER_ON_RESTART; I would be OK with this, maybe modulo the name. - To always unregister dynamic bgws on postmaster shm clear + restart; I don't