Re: Nested xacts: looking for testers and review - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: Nested xacts: looking for testers and review
Date
Msg-id 20040527051110.GA896@dcc.uchile.cl
Whole thread Raw
In response to Re: Nested xacts: looking for testers and review  (Stephan Szabo <sszabo@megazone.bigpanda.com>)
Responses Re: Nested xacts: looking for testers and review
List pgsql-hackers
On Wed, May 26, 2004 at 04:35:52PM -0700, Stephan Szabo wrote:

> On Wed, 26 May 2004, Alvaro Herrera wrote:
> 
> > I'm missing one item: deferred triggers.  The problem with this is that
> > the deftrig queue is not implemented using normal Lists, so there's no
> > efficient way to reassign to the parent when the subtransaction commits.
> > Also I'm not sure what should happen to the "immediate" pointer --- a
> > subtransaction should have it's own private copy, or it should inherit
> > the parent's?  Please whoever implemented this speak up (Stephan
> > Szabo?), as I'm not sure of the semantics.
> 
> The immediate pointer basically points at the end of the queue from the
> last scanning of the trigger queue (since any "immediate" triggers from
> before that would have been run at that time there's no reason to scan
> from the beginning).

Hmm.  You assume correctly that a subtransaction has (or will have) a
private queue.  But we do not consider a subtransaction to be somewhat a
separate entity -- the principle is that the transaction has to feel
just like the BEGIN wasn't there.  So

BEGIN;UPDATE foo ...UPDATE bar ...
COMMIT

has to be exactly the same as

BEGIN;BEGIN;    UPDATE foo ...COMMIT;BEGIN;    UPDATE bar ...COMMIT;
COMMIT;

Now, with that in mind: is it correct that the "immediate" pointer
points to the beginning of the subtransaction's private deferred trigger
queue, at subtransaction's start?

Now, at subtransaction end, lets suppose I concatenate the list the
original transaction had with the subtransaction's private list.  What
should the immediate pointer be?

When is the immediate pointer advanced?  I know it's "during scanning of
the list", but when is this?  At the end of each query?

> If one sets a constraint to immediate in a subtransaction, does/should
> it cause the immediate check of pending events from its parent?  And
> does that revert when the transaction ends?

Yes, I think it should fire all events, including the parent's.  Good
point; it means there has to be a way of getting the whole list, from
the topmost transaction, in order :-(

I'm not sure what you mean by reverting though.

-- 
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
La web junta la gente porque no importa que clase de mutante sexual seas,
tienes millones de posibles parejas. Pon "buscar gente que tengan sexo con
ciervos incendiánse", y el computador dirá "especifique el tipo de ciervo"
(Jason Alexander)



pgsql-hackers by date:

Previous
From: Paul Ramsey
Date:
Subject: Re: SELECT * FROM LIMIT 1; is really slow
Next
From: Dennis Bjorklund
Date:
Subject: Re: SELECT * FROM
LIMIT 1; is really slow