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 "Knut Anders Hatlen (JIRA)" <ji...@apache.org> on 2009/03/03 12:02:56 UTC

[jira] Created: (DERBY-4081) BTreeController.comparePreviousRecord() may fail to release latch on left-most leaf

BTreeController.comparePreviousRecord() may fail to release latch on left-most leaf
-----------------------------------------------------------------------------------

                 Key: DERBY-4081
                 URL: https://issues.apache.org/jira/browse/DERBY-4081
             Project: Derby
          Issue Type: Bug
          Components: Store
    Affects Versions: 10.4.2.0
            Reporter: Knut Anders Hatlen


If comparePreviousRecord() is called on some other leaf page than the left-most leaf, and all the rows to the left of the current position are deleted so that the position is moved all the way to slot 0 on the left-most leaf, comparePreviousRecord() will return without releasing the latch on the left-most leaf. Only the leaf on which comparePreviousRecord() is called should be latched when the method returns.

Since comparePreviousRecord() currently fails to continue after finding a deleted row, this bug is not possible to expose until DERBY-4028 is fixed.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DERBY-4081) BTreeController.comparePreviousRecord() may fail to release latch on left-most leaf

Posted by "Rick Hillegas (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-4081?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rick Hillegas updated DERBY-4081:
---------------------------------

    Issue & fix info: [Patch Available]
             Urgency: Normal

July 2, 2009: Marked PatchAvailable and assigned normal urgency.

> BTreeController.comparePreviousRecord() may fail to release latch on left-most leaf
> -----------------------------------------------------------------------------------
>
>                 Key: DERBY-4081
>                 URL: https://issues.apache.org/jira/browse/DERBY-4081
>             Project: Derby
>          Issue Type: Bug
>          Components: Store
>    Affects Versions: 10.4.2.0
>            Reporter: Knut Anders Hatlen
>         Attachments: derby-4081-1a.diff
>
>
> If comparePreviousRecord() is called on some other leaf page than the left-most leaf, and all the rows to the left of the current position are deleted so that the position is moved all the way to slot 0 on the left-most leaf, comparePreviousRecord() will return without releasing the latch on the left-most leaf. Only the leaf on which comparePreviousRecord() is called should be latched when the method returns.
> Since comparePreviousRecord() currently fails to continue after finding a deleted row, this bug is not possible to expose until DERBY-4028 is fixed.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (DERBY-4081) BTreeController.comparePreviousRecord() may fail to release latch on left-most leaf

Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-4081?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Knut Anders Hatlen reassigned DERBY-4081:
-----------------------------------------

    Assignee: Knut Anders Hatlen

> BTreeController.comparePreviousRecord() may fail to release latch on left-most leaf
> -----------------------------------------------------------------------------------
>
>                 Key: DERBY-4081
>                 URL: https://issues.apache.org/jira/browse/DERBY-4081
>             Project: Derby
>          Issue Type: Bug
>          Components: Store
>    Affects Versions: 10.4.2.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Knut Anders Hatlen
>         Attachments: derby-4081-1a.diff
>
>
> If comparePreviousRecord() is called on some other leaf page than the left-most leaf, and all the rows to the left of the current position are deleted so that the position is moved all the way to slot 0 on the left-most leaf, comparePreviousRecord() will return without releasing the latch on the left-most leaf. Only the leaf on which comparePreviousRecord() is called should be latched when the method returns.
> Since comparePreviousRecord() currently fails to continue after finding a deleted row, this bug is not possible to expose until DERBY-4028 is fixed.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DERBY-4081) BTreeController.comparePreviousRecord() may fail to release latch on left-most leaf

Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-4081?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Knut Anders Hatlen updated DERBY-4081:
--------------------------------------

    Attachment: derby-4081-1a.diff

I believe that the attached patch solves the problem. It releases the latch on the previous page earlier, so that it is already released when the method detects that it is positioned before the left-most leaf and returns NO_MATCH. This is the same thing as compareNextRecord() does when it detects that it's positioned after the right-most leaf.

> BTreeController.comparePreviousRecord() may fail to release latch on left-most leaf
> -----------------------------------------------------------------------------------
>
>                 Key: DERBY-4081
>                 URL: https://issues.apache.org/jira/browse/DERBY-4081
>             Project: Derby
>          Issue Type: Bug
>          Components: Store
>    Affects Versions: 10.4.2.0
>            Reporter: Knut Anders Hatlen
>         Attachments: derby-4081-1a.diff
>
>
> If comparePreviousRecord() is called on some other leaf page than the left-most leaf, and all the rows to the left of the current position are deleted so that the position is moved all the way to slot 0 on the left-most leaf, comparePreviousRecord() will return without releasing the latch on the left-most leaf. Only the leaf on which comparePreviousRecord() is called should be latched when the method returns.
> Since comparePreviousRecord() currently fails to continue after finding a deleted row, this bug is not possible to expose until DERBY-4028 is fixed.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DERBY-4081) BTreeController.comparePreviousRecord() may fail to release latch on left-most leaf

Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-4081?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Knut Anders Hatlen updated DERBY-4081:
--------------------------------------

    Issue & fix info:   (was: [Patch Available])
       Fix Version/s: 10.6.0.0

Committed revision 805696. I will keep the bug open until it has been back-ported to 10.5. Perhaps it should go all way back to 10.4, since DERBY-4028, which made it possible to expose this bug, was also back-ported to 10.4.

> BTreeController.comparePreviousRecord() may fail to release latch on left-most leaf
> -----------------------------------------------------------------------------------
>
>                 Key: DERBY-4081
>                 URL: https://issues.apache.org/jira/browse/DERBY-4081
>             Project: Derby
>          Issue Type: Bug
>          Components: Store
>    Affects Versions: 10.4.2.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Knut Anders Hatlen
>             Fix For: 10.6.0.0
>
>         Attachments: derby-4081-1a.diff, derby-4081-1b.diff
>
>
> If comparePreviousRecord() is called on some other leaf page than the left-most leaf, and all the rows to the left of the current position are deleted so that the position is moved all the way to slot 0 on the left-most leaf, comparePreviousRecord() will return without releasing the latch on the left-most leaf. Only the leaf on which comparePreviousRecord() is called should be latched when the method returns.
> Since comparePreviousRecord() currently fails to continue after finding a deleted row, this bug is not possible to expose until DERBY-4028 is fixed.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DERBY-4081) BTreeController.comparePreviousRecord() may fail to release latch on left-most leaf

Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-4081?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12744466#action_12744466 ] 

Knut Anders Hatlen commented on DERBY-4081:
-------------------------------------------

Derbyall and suites.All ran cleanly with the patch.

> BTreeController.comparePreviousRecord() may fail to release latch on left-most leaf
> -----------------------------------------------------------------------------------
>
>                 Key: DERBY-4081
>                 URL: https://issues.apache.org/jira/browse/DERBY-4081
>             Project: Derby
>          Issue Type: Bug
>          Components: Store
>    Affects Versions: 10.4.2.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Knut Anders Hatlen
>         Attachments: derby-4081-1a.diff, derby-4081-1b.diff
>
>
> If comparePreviousRecord() is called on some other leaf page than the left-most leaf, and all the rows to the left of the current position are deleted so that the position is moved all the way to slot 0 on the left-most leaf, comparePreviousRecord() will return without releasing the latch on the left-most leaf. Only the leaf on which comparePreviousRecord() is called should be latched when the method returns.
> Since comparePreviousRecord() currently fails to continue after finding a deleted row, this bug is not possible to expose until DERBY-4028 is fixed.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DERBY-4081) BTreeController.comparePreviousRecord() may fail to release latch on left-most leaf

Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-4081?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Knut Anders Hatlen updated DERBY-4081:
--------------------------------------

    Attachment: derby-4081-1b.diff

Attached a new patch (1b) with no changes from 1a except that a test case has been added to NullableUniqueConstraintTest. The test case never completes without the fix because it runs into a self-deadlock (or actually a livelock) caused by the latch it forgot to release. The test case runs and completes successfully with the fix.

> BTreeController.comparePreviousRecord() may fail to release latch on left-most leaf
> -----------------------------------------------------------------------------------
>
>                 Key: DERBY-4081
>                 URL: https://issues.apache.org/jira/browse/DERBY-4081
>             Project: Derby
>          Issue Type: Bug
>          Components: Store
>    Affects Versions: 10.4.2.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Knut Anders Hatlen
>         Attachments: derby-4081-1a.diff, derby-4081-1b.diff
>
>
> If comparePreviousRecord() is called on some other leaf page than the left-most leaf, and all the rows to the left of the current position are deleted so that the position is moved all the way to slot 0 on the left-most leaf, comparePreviousRecord() will return without releasing the latch on the left-most leaf. Only the leaf on which comparePreviousRecord() is called should be latched when the method returns.
> Since comparePreviousRecord() currently fails to continue after finding a deleted row, this bug is not possible to expose until DERBY-4028 is fixed.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DERBY-4081) BTreeController.comparePreviousRecord() may fail to release latch on left-most leaf

Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-4081?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12744438#action_12744438 ] 

Knut Anders Hatlen commented on DERBY-4081:
-------------------------------------------

Thanks for the reminder, Rick.

I think I've found a way to expose this problem now. Just continuously executing "insert into t(x) values 0" followed by "delete from t", where T.X is unique nullable and with auto-commit off, consistently hangs on the 372nd iteration.

On 10.5.1.1 that repro fails with a WaitError (DERBY-4097). It does not expose the problem on 10.4.2.0 or earlier since DERBY-4028 hides the problem by stopping the check for duplicates too early.

> BTreeController.comparePreviousRecord() may fail to release latch on left-most leaf
> -----------------------------------------------------------------------------------
>
>                 Key: DERBY-4081
>                 URL: https://issues.apache.org/jira/browse/DERBY-4081
>             Project: Derby
>          Issue Type: Bug
>          Components: Store
>    Affects Versions: 10.4.2.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Knut Anders Hatlen
>         Attachments: derby-4081-1a.diff
>
>
> If comparePreviousRecord() is called on some other leaf page than the left-most leaf, and all the rows to the left of the current position are deleted so that the position is moved all the way to slot 0 on the left-most leaf, comparePreviousRecord() will return without releasing the latch on the left-most leaf. Only the leaf on which comparePreviousRecord() is called should be latched when the method returns.
> Since comparePreviousRecord() currently fails to continue after finding a deleted row, this bug is not possible to expose until DERBY-4028 is fixed.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (DERBY-4081) BTreeController.comparePreviousRecord() may fail to release latch on left-most leaf

Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-4081?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Knut Anders Hatlen closed DERBY-4081.
-------------------------------------

       Resolution: Fixed
    Fix Version/s: 10.5.3.1
                   10.4.2.1

Merged fix to 10.4 (revision 806139) and 10.5 (revision 806138).

> BTreeController.comparePreviousRecord() may fail to release latch on left-most leaf
> -----------------------------------------------------------------------------------
>
>                 Key: DERBY-4081
>                 URL: https://issues.apache.org/jira/browse/DERBY-4081
>             Project: Derby
>          Issue Type: Bug
>          Components: Store
>    Affects Versions: 10.4.2.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Knut Anders Hatlen
>             Fix For: 10.4.2.1, 10.5.3.1, 10.6.0.0
>
>         Attachments: derby-4081-1a.diff, derby-4081-1b.diff
>
>
> If comparePreviousRecord() is called on some other leaf page than the left-most leaf, and all the rows to the left of the current position are deleted so that the position is moved all the way to slot 0 on the left-most leaf, comparePreviousRecord() will return without releasing the latch on the left-most leaf. Only the leaf on which comparePreviousRecord() is called should be latched when the method returns.
> Since comparePreviousRecord() currently fails to continue after finding a deleted row, this bug is not possible to expose until DERBY-4028 is fixed.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.