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 2007/07/02 15:14:04 UTC

[jira] Updated: (DERBY-2878) Scan protection handle could be cached in BasePage

     [ https://issues.apache.org/jira/browse/DERBY-2878?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Knut Anders Hatlen updated DERBY-2878:
--------------------------------------

    Attachment: derby-2878-2.diff

Attaching new patch (derby-2878-2.diff) which is a pure refactoring of BTreeScan. It adds a private method called unlockCurrentScan() to the class, and replaces all occurrences of
-        if (pos.current_scan_pageno != 0)
-        {
-            this.getLockingPolicy().unlockScan(pos.current_scan_pageno);
-            pos.current_scan_pageno = 0;
-        }
with a call to that method. This makes it simpler to reuse the protection handle for unlockScan() since there are fewer places that need modification.

Derbyall and suites.All passed.

> Scan protection handle could be cached in BasePage
> --------------------------------------------------
>
>                 Key: DERBY-2878
>                 URL: https://issues.apache.org/jira/browse/DERBY-2878
>             Project: Derby
>          Issue Type: Improvement
>          Components: Performance, Store
>    Affects Versions: 10.4.0.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Knut Anders Hatlen
>            Priority: Minor
>         Attachments: derby-2878-1.diff, derby-2878-1.stat, derby-2878-1b.diff, derby-2878-2.diff
>
>
> Each time a leaf node in a B-tree is visited in an index scan, a scan protection row is locked and unlocked. Both the lock operation and the unlock operation will allocate a new RecordId object representing the scan protection row (the unlock operation additionally allocates a PageKey object for the RecordId). Since the scan protection handle created will be identical (seen from equals()) each time it is created for a page, it would make sense to cache it in BasePage. Then we only need to allocate the protection handle for a page once for as long as it stays in the page cache. This would save three object allocations per single-record lookup via index.

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