Re: Autonomous Transaction (WIP)

From: Rajeev rastogi <rajeev(dot)rastogi(at)huawei(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Greg Stark <stark(at)mit(dot)edu>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Autonomous Transaction (WIP)
Date: 2014-04-11 06:32:42
Message-ID: BF2827DCCE55594C8D7A8F7FFD3AB7713DDE0926@SZXEML508-MBX.china.huawei.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 09 April 2014 21:25, Robert Haas Wrote:

> >> > Deadlock Detection:
> >> I'm not sure how this would work out internally
> > In order to resolve deadlock, two member variable will be created in
> the structure PROLOCK:
> > Bitmask for lock types currently held by autonomous
> transaction.
> > LOCKMASK holdMaskByAutoTx[MAX_AUTO_TX_LEVEL]
> > Bitmask for lock types currently held by main transaction.
> > LOCKMASK holdMaskByNormalTx
> >
> > Now when we grant the lock to particular transaction, depending on
> > type of transaction, bit Mask will be set for either holdMaskByAutoTx
> or holdMaskByNormalTx.
> > Similar when lock is ungranted, corresponding bitmask will be reset.
>
> That sounds pretty ugly, not to mention the fact that it will cause a
> substantial increase in the amount of memory required to store
> PROCLOCKs. It will probably slow things down, too.

Actually I followed above design to keep it align with the existing design. As I understand, currently also
all lock conflict is checked based on the corresponding lock bit mask.

This is good catch that shared memory required will increase but isn't it justified from user perspective
since we are allowing more transactions per session and hence memory required to store various kind of resources
will increase.

Since we are just additionally setting the bitmask for each lock (in-case there is autonomous transaction, then there will
be one more additional bit mask setting and deadlock check), I don't think it should slow down the overall operation.

Also We can keep number of autonomous transaction configurable(default-0), to keep it less impacting incase it is not configured.

An autonomous transaction can also conflict with main transaction, so in order to check conflict between them,
I am distinguishing at this level.

Please correct me If I am wrong anywhere and also please provide your thought on this and on overall design.

Thanks and Regards,
Kumar Rajeev Rastogi

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2014-04-11 06:43:36 proposal: interprocess EXPLAIN PID
Previous Message Amit Kapila 2014-04-11 05:35:44 Re: PostgreSQL in Windows console and Ctrl-C