bbeaudreault commented on code in PR #5063:
URL: https://github.com/apache/hbase/pull/5063#discussion_r1124807136


##########
hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFilePreadReader.java:
##########
@@ -41,7 +42,16 @@ public HFilePreadReader(ReaderContext context, HFileInfo 
fileInfo, CacheConfig c
         public void run() {
           long offset = 0;
           long end = 0;
+          HFile.Reader prefetchStreamReader = null;
           try {
+            ReaderContext streamReaderContext = new ReaderContextBuilder()

Review Comment:
   thoughts on adding a `ReaderContextBuilder(ReaderContext toCopy)` 
constructor? You'd do:
   
   ```
   ReaderContext streamReaderContext = new ReaderContextBuilder(context)
         .withReaderType(ReaderContext.ReaderType.STREAM)
         .withInputStreamWrapper(new 
FSDataInputStreamWrapper(context.getFileSystem(),
                   context.getInputStreamWrapper().getReaderPath()))
         .build();
   ```
   
   This is fine as is, but I'm just thinking if we ever add other fields to 
ReaderContext this is prone to losing the values you're copying. Putting the 
copy code into ReaderContextBuilder constructor will make it more likely for a 
developer to handle adding any new fields to the copy builder.



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to