Re: Autonomous Transaction (WIP)

From: Rajeev rastogi <rajeev(dot)rastogi(at)huawei(dot)com>
To: Craig Ringer <craig(at)2ndquadrant(dot)com>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Autonomous Transaction (WIP)
Date: 2014-04-07 09:53:45
Message-ID: BF2827DCCE55594C8D7A8F7FFD3AB7713DDDF083@SZXEML508-MBX.china.huawei.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 07 April 2014 12:20, Craig Ringer
>
> > Syntax to create autonomous transaction can be as:
> >
> > */PRAGMA AUTONOMOUS TRANSACTION;/*
>
> Wouldn't you want to use SET TRANSACTION for this?
>
> Or a suffix on BEGIN, like BEGIN AUTONOMOUS TRANSACTION ?
>
> What's the logic behind introducing "PRAGMA" ?
>
>
> If you wanted to use that syntax for Oracle compatibility you'd need to
> use:
>
> PRAGMA AUTONOMOUS_TRANSACTION;
>
> (note underscore). But really, this would no be a pragma at all,
> PostgreSQL doesn't really have the concept. Calling it that would just
> be misleading.

Actually it is same as oracle (i.e. PRAGMA AUTONOMOUS_TRANSACTION), it was just typo mistake in previous mail.
But if this is also not accepted then we can discuss and come out with a syntax based on everyone agreement.

>
> > *_Starting of Autonomous Transaction:_*
> >
> > Starting of autonomous transaction will be exactly same as starting
> > sub-transaction.
>
> If you don't want it to dirty read data from the parent tx, or inherit
> parent locks, then it cannot be the same at all.

While starting sub-transaction, it is just initializing the resources required and
links the same to the parent transaction, which we require for autonomous transaction also.
I am not able to notice any issue as you mentioned above with this.
Please let me know if I am missing something or misunderstood your concern.

> > 2. Freeing of all resource and popping of previous transaction
> > happens in the same way as sub-transaction.
>
> I'm not sure what you mean here.

It means, during commit of autonomous transaction, freeing of all resource are done in the same way as done for sub-transaction.
Also current autonomous transaction gets popped out and points to the parent transaction in the similar way as done for sub-transaction.

> Overall, this looks like a HUGE job to make work well. I know some
> others have been doing work along the same lines, so hopefully you'll
> be able to collaborate and share ideas.

Yes it is huge works, so I have proposed in the beginning of 9.5 so that we can have multiple round of discussion and hence address
all concerns.
Also I have proposed to finish this feature in multiple rounds i.e. first patch, we can try to support autonomous transaction from
standalone SQL-command only, which will set-up infrastructure for future work in this area.

Using the WIP patch sent, I have done basic testing and it works fine.

Any comments?

Thanks and Regards,
Kumar Rajeev Rastogi

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Rajeev rastogi 2014-04-07 09:59:00 Re: Autonomous Transaction (WIP)
Previous Message Martijn van Oosterhout 2014-04-07 09:27:43 Re: PQputCopyData dont signal error