[ 
https://issues.apache.org/jira/browse/HBASE-21401?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16702761#comment-16702761
 ] 

Zheng Hu commented on HBASE-21401:
----------------------------------

bq. What I meant is that the our Stream to HDFS is a checksummed stream.
Understood. But I don't think the checksumed stream is enough.  if so, then the 
HBASE-21379 won't happen, i think. I guess the mis-encoding may happen in 
client side or server side.  the client or server did not realize that the 
encode was wrong,  they generate the mis-encoding bytes's checksum and check 
again, so did not detect the bug. 

bq. Just don't understand why we have to parse the bytes twice – once to check, 
and then once to construct KV; can we not integrate the check with the KV 
construction so we don't do length parses for row, offsets to type and 
timestamp, etc., twice?

I think it's balance between space and time.  If parse once, then all the 
offsets need to be saved in KeyValue object,  may have lots of small object ? 
we can see we only have the mininal members in KeyValue class:  byte[], offset, 
length, seqId..... the parse is cheap as we can see in HBASE-21459,  so I think 
it's OK.
Thanks.


> Sanity check in BaseDecoder#parseCell
> -------------------------------------
>
>                 Key: HBASE-21401
>                 URL: https://issues.apache.org/jira/browse/HBASE-21401
>             Project: HBase
>          Issue Type: Sub-task
>          Components: regionserver
>            Reporter: Zheng Hu
>            Assignee: Zheng Hu
>            Priority: Critical
>             Fix For: 3.0.0, 2.2.0, 2.0.3, 2.1.2
>
>         Attachments: HBASE-21401.v1.patch, HBASE-21401.v2.patch, 
> HBASE-21401.v3.patch, HBASE-21401.v4.patch, HBASE-21401.v4.patch, 
> HBASE-21401.v5.patch
>
>
> In KeyValueDecoder & ByteBuffKeyValueDecoder,  we pass a byte buffer to 
> initialize the Cell without a sanity check (check each field's offset&len 
> exceed the byte buffer or not), so ArrayIndexOutOfBoundsException may happen 
> when read the cell's fields, such as HBASE-21379,  it's hard to debug this 
> kind of bug. 
> An earlier check will help to find such kind of bugs.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to