Re: parallel mode and parallel contexts - Mailing list pgsql-hackers

From Robert Haas
Subject Re: parallel mode and parallel contexts
Date
Msg-id CA+Tgmoaz6kFN5KVzatWuyCp1Mx5OmXRC3JXgz3QpXC7fE64BQg@mail.gmail.com
Whole thread Raw
In response to Re: parallel mode and parallel contexts  (Alvaro Herrera <alvherre@2ndquadrant.com>)
Responses Re: parallel mode and parallel contexts
List pgsql-hackers
On Tue, Mar 24, 2015 at 11:56 PM, Alvaro Herrera
<alvherre@2ndquadrant.com> wrote:
>> Well, it's not actually the same message.  They're all a bit
>> different.  Or mostly all of them.  And the variable part is not a
>> command name, as in the PreventTransactionChain() case, so it would
>> affect translatability if we did that.
>
> Three things that vary are 1) the fact that some check IsParallelWorker()
> and others check IsInParallelMode(), and 2) that some of them are
> ereports() while others are elog(), and 3) that some are ERROR and
> others are FATAL.  Is there a reason for these differences?

The message text also varies, because it states the particular
operation that is prohibited.

We should check IsParallelWorker() for operations that are allowed in
the master during parallel mode, but not allowed in the workers - e.g.
the master can scan its own temporary relations, but its workers
can't.  We should check IsInParallelMode() for operations that are
completely off-limits in parallel mode - i.e. writes.

We use ereport() where we expect that SQL could hit that check, and
elog() where we expect that only (buggy?) C code could hit that check.

We use FATAL for some of the checks in xact.c, for parity with other,
similar checks in xact.c that relate to checking the transaction
state.  I think this is because we assume that if the transaction
state is hosed, it's necessary to terminate the backend to recover.
In other cases, we use ERROR.

> (Note typo "restrction" in quoted paragraph above.)

Thanks, will fix.

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



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: parallel mode and parallel contexts
Next
From: Robert Haas
Date:
Subject: Re: parallel mode and parallel contexts