Re: Facing a problem with SPI - Mailing list pgsql-hackers

From Gurjeet Singh
Subject Re: Facing a problem with SPI
Date
Msg-id 65937bea0612040710g5bf8e718rac2acb385eab9cfb@mail.gmail.com
Whole thread Raw
In response to Re: Facing a problem with SPI  ("Gurjeet Singh" <singh.gurjeet@gmail.com>)
Responses Re: Facing a problem with SPI
List pgsql-hackers
<span style="font-family: courier new,monospace;">Another question.<br /><br />There are two global variables:<br /><br
/>CurrentResourceOwner(CRO) and CurrentTransactionState (CTS). CTS has a member curTransactionOwner(cTO). Now the
questionis: <br /><br />is the following condition always supposed to be true?<br /><br
/>CurrentResourceOwner==CurrentTransactionState->curTransactionOwner<br/><br />    While in executor, CRO->name
is"Portal". Then I do the BeginInternalSubTransaction() (BIST()); it pushes the current (sub)transaction on a stack and
andalong with it, it sets the CTS as it's parent. CTS->cTO->name is "TopTransaction". And a new resource-owner is
assignedto the new SubTransaction by AtSubStart_ResourceOwner(). <br /><br />    After the adviser is done with it's
work,it calls RollbackAndReleaseCurrentSubTransaction() (RARCST()), which restores the global CRO to the previously
pushedSubTransaction's parent; this is "TopTransaction". Now, we have lost record of which was the ResourceOwner before
BIST()and erroneously restored "TopTransaction" to be the CRO. This is causing some diffcult to track ERROR conditions.
<br/><br />    So, is the above mentioned condition supposed to hold always? (I am assuming not). If not, then we
shouldremember the CurrentResourceOwner across BIST() and RARCST() calls!<br /><br />    Sorry to be pestering you guys
withseemingly trivial stuff, but you would also agree that it becomes very difficult to understand the code when there
areso many globals and the relationship between them is not very clear. <br /><br />Regards,<br /></span><span
style="font-family:courier new,monospace;"><br style="font-family: courier new,monospace;" /></span><span
style="font-family:courier new,monospace;">-- </span><br style="font-family: courier new,monospace;" /><span
style="font-family:courier new,monospace;">gurjeet[.singh]@EnterpriseDB.com</span><br style="font-family: courier
new,monospace;"/><span style="font-family: courier new,monospace;">singh.gurjeet@{ gmail | hotmail | yahoo }.com
</span>

pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: Notify enhancement
Next
From: Tom Lane
Date:
Subject: Re: Notify enhancement