[
https://issues.apache.org/jira/browse/HBASE-18251?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16094261#comment-16094261
]
Toshihiro Suzuki commented on HBASE-18251:
------------------------------------------
[~ram_krish] No we can't for the following reason:
delegatee is a ConcurrentSkipListMap when the following CellSet constructor is
instantiated: CellSet(final CellComparator c). And, ConcurrentSkipListMap.put()
doesn't replace the key when the map previously contained a mapping for the
key. So this.delegatee.firstKey() will return the old cell instance even though
we overwrite the value by using ConcurrentSkipListMap.put().
> Remove unnecessary traversing to the first and last keys in the CellSet
> -----------------------------------------------------------------------
>
> Key: HBASE-18251
> URL: https://issues.apache.org/jira/browse/HBASE-18251
> Project: HBase
> Issue Type: Bug
> Reporter: Anastasia Braginsky
> Assignee: Toshihiro Suzuki
> Attachments: HBASE-18251.patch, HBASE-18251-v2.patch
>
>
> The implementation of finding the first and last keys in the CellSet is as
> following:
> {code}
> public Cell first() {
> return this.delegatee.get(this.delegatee.firstKey());
> }
> public Cell last() {
> return this.delegatee.get(this.delegatee.lastKey());
> }
> {code}
> Recall we have Cell to Cell mapping, therefore the methods bringing the
> first/last key, which allready return Cell. Thus no need to waist time on the
> get() method for the same Cell.
> Fix: return just the first/lastKey(), should be at least twice more effective.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)