whbing commented on a change in pull request #2918:
URL: https://github.com/apache/hadoop/pull/2918#discussion_r716431351
##########
File path:
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/offlineImageViewer/PBImageTextWriter.java
##########
@@ -822,4 +968,79 @@ public int getStoragePolicy(
}
return HdfsConstants.BLOCK_STORAGE_POLICY_ID_UNSPECIFIED;
}
+
+ private ArrayList<FileSummary.Section> getINodeSubSections(
+ ArrayList<FileSummary.Section> sections) {
+ ArrayList<FileSummary.Section> subSections = new ArrayList<>();
+ Iterator<FileSummary.Section> iter = sections.iterator();
+ while (iter.hasNext()) {
+ FileSummary.Section s = iter.next();
+ if (SectionName.fromString(s.getName()) == SectionName.INODE_SUB) {
+ subSections.add(s);
+ }
+ }
+ return subSections;
+ }
+
+ /**
+ * Given a FSImage FileSummary.section, return a LimitInput stream set to
+ * the starting position of the section and limited to the section length.
+ * @param section The FileSummary.Section containing the offset and length
+ * @param compressionCodec The compression codec in use, if any
+ * @return An InputStream for the given section
+ * @throws IOException
+ */
+ private InputStream getInputStreamForSection(FileSummary.Section section,
+ String compressionCodec, Configuration conf)
+ throws IOException {
+ // channel of RandomAccessFile is not thread safe, use File
+ FileInputStream fin = new FileInputStream(filename);
Review comment:
`RandomAccessFile` is not thread safe.
The change here is to get stream for each thread through `File filename`
--
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]