Copilot commented on code in PR #8953:
URL: https://github.com/apache/hbase/pull/8953#discussion_r4777846818


##########
hbase-server/src/main/java/org/apache/hadoop/hbase/util/FSUtils.java:
##########
@@ -266,6 +292,15 @@ public static FSDataInputStream openForRead(FileSystem fs, 
Path path, FileStatus
     return fs.open(path);
   }
 
+  /**
+   * Returns whether it is safe to use {@link FileSystem#openFile(Path)} 
without bypassing a
+   * {@link FilterFileSystem} wrapper's legacy {@link FileSystem#open(Path, 
int)} override.
+   */
+  private static boolean supportsOpenFile(FileSystem fs) throws IOException {
+    FileSystem effectiveFs = fs instanceof HFileSystem ? ((HFileSystem) 
fs).getBackingFs() : fs;
+    return OPEN_FILE_SUPPORT_BY_CLASS.get(effectiveFs.getClass());

Review Comment:
   A transparent `FilterFileSystem` around a legacy-open-only wrapper passes 
this check, so the inner wrapper's stream decoration is still bypassed. 
Hadoop's [default-branch 
implementation](https://github.com/apache/hadoop/blob/c42b04fb40ab2a1356991db5eaac41f14e9dd87f/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FilterFileSystem.java#L707-L719)
 delegates inherited `openFile()` directly to the backing filesystem. Inspect 
each transparently delegating layer before selecting the fast path, stopping at 
an explicit `openFile()` implementation, and add a nested legacy-wrapper 
regression test.



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