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

Anoop Sam John commented on HBASE-22888:
----------------------------------------

A nice find.  So now if there is a stream reader is created, it will create new 
HFileReader which in turn do loading of the FFT, Meta blocks, load on startup 
blocks etc.  Also if prefect cache is needed, it will again do the prefetch 
read into cache !.
On closing the stream reader, it would have cancelled the cache prefetch if it 
was still in progress
Checking the E2E reader creation flow, I can see it will again call the CP 
hooks around the StoreFileReader creation! May be even that is not needed 
really?
I like the way we have 2 HFileReader impls now. You can clearly do the extra 
steps for Stream reader (ie. While creation, create a new FSReaderImpl and on 
close, close that alone.
{code}
dataBlockIndexReader.copyFields(reader.getDataBlockIndexReader());
    metaBlockIndexReader.copyFields(reader.getMetaBlockIndexReader());
{code}
Do we really need to do this copy? The stream reader's block index reader can 
directly refer to the pread HFileReader's block index reader? More over can we 
do this clone stuff within the HFileReader itself? If HFileReader  having an 
API like cloneForNewStreamRead() (Pardon the name) , we can do all the cone 
stuff etc within itself.  Same way would have been best for StoreFileReader 
also so that we can avoid the CP hooks calls (?)
Again this is a nice catch 

> Use separate classe to deal with streaming read and pread
> ---------------------------------------------------------
>
>                 Key: HBASE-22888
>                 URL: https://issues.apache.org/jira/browse/HBASE-22888
>             Project: HBase
>          Issue Type: Improvement
>    Affects Versions: 2.0.0
>            Reporter: chenxu
>            Assignee: chenxu
>            Priority: Major
>
> When switching pread to stream read, new HFileReaderImpl will be create, but 
> the two different readers do not share informations with each other. maybe we 
> can divide HFileReaderImpl into two different class, such as HFilePreadReader 
> and HFileStreamReader. When constructing HFileStreamReader, it will copy some 
> stuffs (fileInfo, index, etc) from an already existing Reader, and no need to 
> do prefetch operations.



--
This message was sent by Atlassian Jira
(v8.3.2#803003)

Reply via email to