Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 326461

Summary: Some pessimistic locking tests of the JPA LRG test suite block on MaxDB
Product: z_Archived Reporter: Adrian Goerler <adrian.goerler>
Component: EclipselinkAssignee: Nobody - feel free to take it <nobody>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: andreas.fischbach, eclipselink.orm-inbox, krum.tsvetkov, michael.f.obrien, sabine.heider
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard: test mysql
Attachments:
Description Flags
patch rewriting tests to avoid deadlock on MaxDB; fixing issue with pessimistic lock scope EXTENDED on MySQL
none
patch rewriting tests to avoid deadlock on MaxDB; fixing issue with pessimistic lock scope EXTENDED on MySQL none

Description Adrian Goerler CLA 2010-09-28 16:43:29 EDT
The JPA testsuite is excuted with isolation level READ COMMITED. On MAxDB, pessimistic locking with the semantics of LockModeType.PESSIMISTC_WRITE is achieved by using an EXLUSIVE lock, which blocks readers in READ COMMITED. Moreover, the lock timeout cannot be configured dynamically on MaxDB but is a database parameter, which is possibly very long.

Some pessimistic lock tests rely on that either
- concurrent reads are not blocked (such as on Oracle) or
- a lock is released quickly if a short lock timeout is specified

Neither is the case on MaxDB. Hence the tests need to be altered.
Comment 1 Adrian Goerler CLA 2010-09-29 04:30:40 EDT
Created attachment 179814 [details]
patch rewriting tests to avoid deadlock on MaxDB; fixing issue with  pessimistic lock scope EXTENDED on MySQL

PessimisticLockingExtendedScopeTestSuite:

Test are rewritten so that they assert REPEATABLE READ semantics in the presence of a WRITE LOCK.

MySQLPlatfrom:
Rewriting PessimisticLockingExtendedScopeTestSuite indicated that locks with pessimistic lock scope EXTENDED did not lock dependent tables on MySQL. A fix is provided in this patch.

AdvancedQueryTestSuite:
The statements are reordered to avoid a deadlock upon reading a locked entity.

Tested on 
- MaxDB -> some failures but tests are not hanging
- Oracle -> OK
- MySQL -> (but see 326424)
Comment 2 Adrian Goerler CLA 2010-09-29 06:36:56 EDT
Created attachment 179824 [details]
patch rewriting tests to avoid deadlock on MaxDB; fixing issue with pessimistic lock scope EXTENDED on MySQL

improved thread synchronization
Comment 3 Adrian Goerler CLA 2010-10-01 04:40:06 EDT
Reviewed by Yiping and Gordon
Tested on Oracle, MySQL, MaxDB
Checked in at #8276
Comment 4 Eclipse Webmaster CLA 2022-06-09 10:16:29 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink
Comment 5 Eclipse Webmaster CLA 2022-06-09 10:25:21 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink