db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bryan Pendleton <bpendle...@amberpoint.com>
Subject Re: Table Intent locks not optimized/collapsed if table-level lock already held?
Date Thu, 08 Dec 2005 18:41:50 GMT
>> the logic is slightly different dependent on isolation level,
>> what isolation level are you running.  All the code gets the
>> table level intent lock first, and if that succeeds then checks
>> if it has covering locks such that it does not need to get row
>> locks.

I tried an experiment at lock level 3, too, and it seems to have
similar not-quite-optimal behavior. In general, it seems like the
"covering" logic is successful at noticing that a table-level
covering lock removes the need for row-level locks, but the logic
seems to take and hold unnecessary table-level intent locks at
both isolation level 2 and isolation level 3.

 From what I can tell, the lockContainer() method in RowLocking3
doesn't even try to release the unnecessary intent-mode table-level
lock, while the lockContainer() method in RowLocking2 does try to
release the unnecessary table-level intent lock, but fails to do so.

thanks,

bryan

C:\bryan\src\derby\lockTable>java -classpath c:\bryan\src\derby\trunk\c
lasses org.apache.derby.tools.ij lockLevel3.ij
ij version 10.2
ij> connect 'jdbc:derby:lockTest';
ij> autocommit off;
ij> set isolation rr;
0 rows inserted/updated/deleted
ij> lock table a in exclusive mode;
0 rows inserted/updated/deleted
ij> select mode,tablename,state from syscs_diag.lock_table;
MODE|TABLENAME
                                                      |STATE
--------------------------------------------------------------------------------
-----------------------------------------------------------
X   |A
                                                      |GRANT

1 row selected
ij> select * from a where a = 3;
A
-----------
3

1 row selected
ij> select mode,tablename,state from syscs_diag.lock_table;
MODE|TABLENAME
                                                      |STATE
--------------------------------------------------------------------------------
-----------------------------------------------------------
X   |A
                                                      |GRANT
IS  |A
                                                      |GRANT

2 rows selected
ij> update a set a = 3 where a = 3;
1 row inserted/updated/deleted
ij> select mode,tablename,state from syscs_diag.lock_table;
MODE|TABLENAME
                                                      |STATE
--------------------------------------------------------------------------------
-----------------------------------------------------------
X   |A
                                                      |GRANT
IS  |A
                                                      |GRANT
IX  |A
                                                      |GRANT

3 rows selected
ij> commit;
ij> quit;



Mime
View raw message