chenxu14 commented on a change in pull request #581: HBASE-22888 Share some 
stuffs with the initial reader when new stream reader created
URL: https://github.com/apache/hbase/pull/581#discussion_r330514039
 
 

 ##########
 File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFile.java
 ##########
 @@ -497,88 +503,65 @@ HFileBlock readBlock(long offset, long onDiskBlockSize,
      * implementation should take care of thread safety.
      */
     void unbufferStream();
+
+    /**
+     * Copy some stuffs(fileInfo, index, etc) from an existing Reader,
+     * mainly used by HFileStreamReader.
+     */
+    void copyFields(Reader reader) throws IOException;
   }
 
   /**
    * Method returns the reader given the specified arguments.
    * TODO This is a bad abstraction.  See HBASE-6635.
    *
-   * @param path hfile's path
-   * @param fsdis stream of path's file
-   * @param size max size of the trailer.
+   * @param context Reader context info
    * @param cacheConf Cache configuation values, cannot be null.
-   * @param hfs
-   * @param primaryReplicaReader true if this is a reader for primary replica
+   * @param conf Configuration
    * @return an appropriate instance of HFileReader
    * @throws IOException If file is invalid, will throw CorruptHFileException 
flavored IOException
    */
   
@edu.umd.cs.findbugs.annotations.SuppressWarnings(value="SF_SWITCH_FALLTHROUGH",
       justification="Intentional")
-  private static Reader openReader(Path path, FSDataInputStreamWrapper fsdis, 
long size,
-      CacheConfig cacheConf, HFileSystem hfs, boolean primaryReplicaReader, 
Configuration conf)
-      throws IOException {
-    FixedFileTrailer trailer = null;
+  public static Reader createReader(ReaderContext context,
+      CacheConfig cacheConf, Configuration conf) throws IOException {
     try {
-      boolean isHBaseChecksum = fsdis.shouldUseHBaseChecksum();
+      context.validateFields();
 
 Review comment:
   Check this in ReaderContextBuilder#build

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to