You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by Philip Wilder <05...@acadiau.ca> on 2005/08/22 21:08:45 UTC

Re: Derby 213 patch

>
>
>> I don't think it is  so good to have  references to internal classes
>> (e.g org.apache.derby.client.am.ResultSet) in the functional tests.
>> Is there a  way within the public API to test if autocommit has
>> occurred, maybe the current XID from the lock table VTI would help.
>>  
>>
> Initial investigations don't yield anything useful from the LockTable. 
> It would seem that for the client ResultSet a lock, identical in all 
> ways except for the final digit in the XID, is held both before and 
> after the auto commit. This differs from the embedded behavior where 
> attempting to access the lock table tells me that there are never any 
> locks held for my tests. I'll continue investigating but if someone 
> can prove me wrong and show how the lock table can be useful in this 
> regard or offer me an alternate solution I'd be most appreciative. 


Sorry Kathey, I'm being dim. XIDs have the potential to work they just 
require a little more creativity then my previous solution. Testing 
seems to indicate that XIDs aren't held over a commit. Ergo if I compare 
the XID before the commit with any XIDs after the commit and have a 
match I have criteria for failing the test.

Philip

Re: Derby 213 patch

Posted by Mike Matrigali <mi...@sbcglobal.net>.
A method that does not require looking at a lock table, it instead
to test directly the behavior of what is locked.  It will require
2 connections (not 2 threads), so very easy to do in java/jdbc.
Something like:
o set serializable
o execute select statement in thread one
o try to update same row in thread 2, if thread one committed then
   update will succeed, if not then lock will time out.
To make test run faster, set default lock timeout to something small
like 1 second.

Be careful about depending on anything about XID's, as they are
implementation specific.  As you have seen they can be reused, they
may jump by more than one depending on timing (background threads
may use xacts also), and they may not change at all for read only
transactions.

Philip Wilder wrote:
>>
>>
>>> I don't think it is  so good to have  references to internal classes
>>> (e.g org.apache.derby.client.am.ResultSet) in the functional tests.
>>> Is there a  way within the public API to test if autocommit has
>>> occurred, maybe the current XID from the lock table VTI would help.
>>>  
>>>
>> Initial investigations don't yield anything useful from the LockTable. 
>> It would seem that for the client ResultSet a lock, identical in all 
>> ways except for the final digit in the XID, is held both before and 
>> after the auto commit. This differs from the embedded behavior where 
>> attempting to access the lock table tells me that there are never any 
>> locks held for my tests. I'll continue investigating but if someone 
>> can prove me wrong and show how the lock table can be useful in this 
>> regard or offer me an alternate solution I'd be most appreciative. 
> 
> 
> 
> Sorry Kathey, I'm being dim. XIDs have the potential to work they just 
> require a little more creativity then my previous solution. Testing 
> seems to indicate that XIDs aren't held over a commit. Ergo if I compare 
> the XID before the commit with any XIDs after the commit and have a 
> match I have criteria for failing the test.
> 
> Philip
> 
>