[
https://issues.apache.org/jira/browse/HBASE-7845?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13595985#comment-13595985
]
Ted Yu commented on HBASE-7845:
-------------------------------
{code}
return 0; // indicate exact match
- }
-
- if (comp < 0) {
+ } else if (comp < 0) {
{code}
There is no need to introduce 'else' above
{code}
+ if (comparator instanceof KeyComparator &&
blockEncoder.getEncodingOnDisk() ==
+ DataBlockEncoding.NONE && blockEncoder.getEncodingInCache() ==
DataBlockEncoding.NONE) {
{code}
This limits the scenarios where the optimization applies. Can we do better ?
{code}
+ byte[] shortestSeparator = ((KeyComparator) comparator).getFakedKey(
{code}
Suggest aligning variable name with method name: how about fakeKey ?
{code}
+ if (comparator.compare(shortestSeparator, firstKeyInBlock) > 0) {
+ throw new IOException("Unexpected getFakedKey result,
shortestSeparator:" +
+ shortestSeparator + ", firstKeyInBlock:" + firstKeyInBlock);
{code}
Can we log an error message and fall back to adding firstKeyInBlock ?
> optimize hfile index key
> ------------------------
>
> Key: HBASE-7845
> URL: https://issues.apache.org/jira/browse/HBASE-7845
> Project: HBase
> Issue Type: Improvement
> Components: HFile
> Affects Versions: 0.96.0
> Reporter: Liang Xie
> Assignee: Liang Xie
> Fix For: 0.98.0
>
> Attachments: HBASE-7845.txt, HBASE-7845-v2.txt, HBASE-7845-v3.txt,
> HBASE-7845-v4.txt
>
>
> Leveldb uses ByteWiseComparatorImpl::FindShortestSeparator() &
> FindShortSuccessor() to reduce index key size, it would be helpful under
> special conditions.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira