[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-1512) Problem to lock a row in a DB2 database with LockMode UPGRADE

Strong Liu (JIRA) noreply at atlassian.com
Tue Feb 28 04:11:49 EST 2012


    [ https://hibernate.onjira.com/browse/HHH-1512?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=45722#comment-45722 ] 

Strong Liu commented on HHH-1512:
---------------------------------

okay, I had a chat with a friend who has lots of DB2 experience, he said
 
> with *rr*, the whole table would be locked w/o index involved.
> with *rs*, only selected rows would be locked.

1:tx1: db2 +c "select * from ck where id=3 with rr use and keep update locks" 
success, U lock on the table.

2:tx2: db2 +c "select * from ck where id=3 with rr use and keep update locks" 
U lock wait for table, since table already has a U lock from tx1, and U locks are not compatible with an U lock, so, waiting for tx1 finish

----------------------  



> Problem to lock a row in a DB2 database with LockMode UPGRADE
> -------------------------------------------------------------
>
>                 Key: HHH-1512
>                 URL: https://hibernate.onjira.com/browse/HHH-1512
>             Project: Hibernate ORM
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 3.1
>         Environment: DB2 v8.2, Hibernate 3.1 and higher
>            Reporter: Peter Potthoff
>            Assignee: Steve Ebersole
>         Attachments: locks.txt
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> Using the LockMode UPGRADE to lock a row in the database, this will result in
> a sql-statement: select ID from <schema>.<table> where ID =? and version =? for read only with rs
> This statement produces a shared lock and cannot be used for pessimistic locking because
> this kind of lock won't stop a concurrent thread from accessing the data.
> The source of the class DB2Dialect.java was changed from release 1.34 to 1.35:
> http://cvs.sourceforge.net/viewcvs.py/hibernate/Hibernate3/src/org/hibernate/dialect/DB2Dialect.java?r1=1.34&r2=1.35
> and from 1.33 to 1.34
> http://cvs.sourceforge.net/viewcvs.py/hibernate/Hibernate3/src/org/hibernate/dialect/DB2Dialect.java?r1=1.33&r2=1.34
> Please take a look at: HHH-378 and http://forum.hibernate.org/viewtopic.php?t=954639&highlight=db2+lock+upgrade

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       



More information about the hibernate-issues mailing list