[
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-3.stat
derby-2878-3.diff
Attaching a new patch which removes the allocation of a scan
protection handle when the scan is unlocked. This removes one RecordId
allocation and one PageKey allocation per visited leaf node in a
B-tree scan.
What the patch does, is
1) Remove the current_scan_pageno field from BTreeRowPosition and
replace it with current_scan_protectionHandle (a RecordHandle).
2) Change the signature of unlockScan() so that it takes a record
handle instead of a page number.
3) Add a method isRowLockingPolicy() to the BTreeLockingPolicy
interface. This method returns false for the B2INoLocking classes
and true for the B2IRowLocking classes. The return value is used to
determine whether a protection handle should be requested.
4) Where the B-tree scan previously set current_scan_pageno to the
page number, now set current_scan_protectionHandle to the scan
protection record handle if isRowLockingPolicy() returns true. This
code has also been factored out into a separate method called
BTreeScan.setCurrentScanProtectionHandle().
5) Remove OpenBTree.makeRecordHandle() which is no longer used.
6) Change all the asserts that used current_scan_pageno so that they
use current_scan_protectionHandle.
All the regression tests (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, derby-2878-3.diff, derby-2878-3.stat
>
>
> 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.