On Mon, Sep 8, 2014 at 1:09 AM, Amit Kapila <amit.kapil...@gmail.com> wrote:
>> > Don't you need a PG_TRY block here to reset pq_mq_busy?
>> No.  If shm_mq_sendv is interrupted, we can't use the shm_mq any more.
>> But since that should only happen if an interrupt arrives while the
>> queue is full, I think that's OK.
> I think here not only on interrupt, but any other error in this
> function shm_mq_sendv() path (one example is WaitLatch())
> could lead to same behaviour.

Probably true.  But I think we generally count on that to be no-fail,
or close to it, so I'm not really worried about it.

>> (Think about the alternatives: if
>> the queue is full, we have no way of notifying the launching process
>> without waiting for it to retrieve the results, but it might not do
>> that right away, and if we've been killed we need to die *now* not
>> later.)
> So in such cases what is the advise to users, currently they will
> see the below message:
> postgres=# select * from pg_background_result(5124) as (x int);
> ERROR:  lost connection to worker process with PID 5124
> One way is to ask them to check logs, but what about if they want
> to handle error and take some action?

They have to check the logs.  To reiterate what I said before, there
is no reasonable way to both have the background worker terminate
quickly and also guarantee that the full error message is received by
the process that started it.  You have to pick one, and I stick by the
one I picked.

Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:

Reply via email to