ptlrs commented on code in PR #9605:
URL: https://github.com/apache/ozone/pull/9605#discussion_r2670825085


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OMDBCheckpointServletInodeBasedXfer.java:
##########
@@ -458,8 +458,7 @@ boolean writeDBToArchive(Set<String> sstFilesToExclude, 
Path dbDir, AtomicLong m
       LOG.warn("DB directory {} does not exist. Skipping.", dbDir);
       return true;
     }
-    Stream<Path> files = Files.list(dbDir);
-    return writeDBToArchive(sstFilesToExclude, files,
+    return writeDBToArchive(sstFilesToExclude, Files.list(dbDir),

Review Comment:
   I would suggest that the stream should be closed at the caller's end instead 
of being passed. 
   If there is any exception before line 492, the stream would not be closed 
and the problem of leaked descriptors would continue to exist. 
   
   ```java
   try (Stream<Path> files = Files.list(dbDir)) {
     return writeDBToArchive(sstFilesToExclude, files,
           maxTotalSstSize, archiveOutputStream, tmpDir, hardLinkFileMap, 
onlySstFile);
   }
   ```



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to