GeorgeJahad commented on code in PR #3980:
URL: https://github.com/apache/ozone/pull/3980#discussion_r1130229331
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OmSnapshotManager.java:
##########
@@ -279,6 +307,92 @@ private void verifySnapshotInfoForSnapDiff(final
SnapshotInfo fromSnapshot,
}
}
+ /**
+ * Create file of links to add to tarball.
+ * Format of entries are either:
+ * dir1/fileTo fileFrom
+ * for files in active db or:
+ * dir1/fileTo dir2/fileFrom
+ * for files in another directory, (either another snapshot dir or
+ * sst compaction backup directory)
+ * @param truncateLength - Length of initial path to trim in file path.
+ * @param hardLinkFiles - Map of link->file paths.
+ * @return Path to the file of links created.
+ */
+ @SuppressFBWarnings({"NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE"})
+ static Path createHardLinkList(int truncateLength,
+ Map<Path, Path> hardLinkFiles)
+ throws IOException {
+ Path data = Files.createTempFile("data", "txt");
+ StringBuilder sb = new StringBuilder();
+ for (Map.Entry<Path, Path> entry : hardLinkFiles.entrySet()) {
+ String fixedFile = truncateFileName(truncateLength, entry.getValue());
+ // If this file is from the active db, strip the path.
+ if (fixedFile.startsWith(OM_CHECKPOINT_DIR)) {
+ fixedFile = Paths.get(fixedFile).getFileName().toString();
+ }
+ sb.append(truncateFileName(truncateLength, entry.getKey()))
Review Comment:
Yes, sorry I didn't make this clear in my notes. I'm trying to keep the
tarball format backwards compatible/interoperable with the existing tarball
format. That way we could do a rolling restart on upgrade, (instead of having
to shutdown all 3 om nodes.)
The original format just has the active fs at the top of the tarball with no
subdirectory prefix. I couldn't easily maintain interoperability of the
tarball format without doing the stripping/truncating.
Maybe that isn't worthwhile. Let me know what you think.
--
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]