[ 
http://issues.apache.org/jira/browse/DERBY-2107?page=comments#action_12458609 ] 
            
Daniel John Debrunner commented on DERBY-2107:
----------------------------------------------

I think the patch has a severe problem, here is code from 
RowLocking3.lockRecordForRead (one of several instances):

        // Couldn't get the lock immediately. Release the latch while waiting.
        latchedPage.unlatch();

        lf.lockObject(
            t.getCompatibilitySpace(), t, record, qualifier,
            C_LockFactory.TIMED_WAIT);

        latchedPage.latch(containerHandle);

The api for Page.unlatch() states that the reference used to unlatch the page 
must be not used (i.e. must be set to null) after calling unlatch().
This code uses the reference used to unlatch the page after the lock call *and* 
the caller of this method will continue to use the same Page reference.
The reference must be set to null after an unlatch because once the page in 
unlatched there is no guarantee that the page will remain in cache or that the 
reference will continue to describe the same page.

So this code clearly uses a Page reference after it has been unlatched and thus 
can be referring to a wrong page or an invlaid page.

I think it works with the current code because a a latch on the Page is a 
super-set of a lock manager Latch, I'll add more on that in a separate comment.


> Move page latching out of the lock manager
> ------------------------------------------
>
>                 Key: DERBY-2107
>                 URL: http://issues.apache.org/jira/browse/DERBY-2107
>             Project: Derby
>          Issue Type: Improvement
>          Components: Store, Services, Performance
>    Affects Versions: 10.3.0.0
>            Reporter: Knut Anders Hatlen
>         Assigned To: Knut Anders Hatlen
>            Priority: Minor
>         Attachments: derby-2107-1a.diff, derby-2107-1a.stat, 
> derby-2107-1b.diff
>
>
> Latching of pages could be done more efficiently locally in store than in the 
> lock manager. See the discussion here: 
> http://thread.gmane.org/gmane.comp.apache.db.derby.devel/33135

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to