[
https://issues.apache.org/jira/browse/HDFS-17089?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17743612#comment-17743612
]
ASF GitHub Bot commented on HDFS-17089:
---------------------------------------
Hexiaoqiao commented on code in PR #5847:
URL: https://github.com/apache/hadoop/pull/5847#discussion_r1264823566
##########
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ViewFileSystem.java:
##########
@@ -1926,12 +1926,41 @@ enum RenameStrategy {
SAME_FILESYSTEM_ACROSS_MOUNTPOINT
}
+ private void closeChildFileSystems(FileSystem fs) throws IOException {
+ if (fs != null) {
+ FileSystem[] childFs = fs.getChildFileSystems();
+ for (FileSystem child : childFs) {
+ if (child != null) {
+ String disableCacheName = String.format("fs.%s.impl.disable.cache",
+ child.getUri().getScheme());
+ if (config.getBoolean(disableCacheName, false)) {
+ child.close();
+ }
+ }
+ }
+ }
+ }
+
@Override
public void close() throws IOException {
super.close();
if (enableInnerCache && cache != null) {
cache.closeAll();
cache.clear();
}
+
+ if (!enableInnerCache) {
+ for (InodeTree.MountPoint<FileSystem> mountPoint :
+ fsState.getMountPoints()) {
+ FileSystem targetFs = mountPoint.target.getTargetFileSystemForClose();
Review Comment:
how about to invoke getTargetFileSystem directly?
##########
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/InodeTree.java:
##########
@@ -413,6 +413,11 @@ public T getTargetFileSystem() throws IOException {
}
return targetFileSystem;
}
+
+ T getTargetFileSystemForClose() throws IOException {
Review Comment:
what difference between this method and `getTargetFileSystem`?
> Close child file systems in ViewFileSystem when cache is disabled.
> ------------------------------------------------------------------
>
> Key: HDFS-17089
> URL: https://issues.apache.org/jira/browse/HDFS-17089
> Project: Hadoop HDFS
> Issue Type: Bug
> Reporter: Shuyan Zhang
> Priority: Major
> Labels: pull-request-available
>
> When the cache is configured to disabled (namely,
> `fs.viewfs.enable.inner.cache=false` and `fs.*.impl.disable.cache=true`),
> even if `FileSystem.close()` is called, the client cannot truly close the
> child file systems in a ViewFileSystem. This caused our long-running clients
> to constantly produce resource leaks.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]