Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HDDS-12064. Optimize bootstrap logic to reduce loop while checking file links #7676

Merged
merged 4 commits into from
Jan 15, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,10 @@ public void writeDbDataToStream(DBCheckpoint checkpoint,
boolean completed = getFilesForArchive(checkpoint, copyFiles,
hardLinkFiles, sstFilesToExclude, includeSnapshotData(request),
excludedList, sstBackupDir, compactionLogDir);
writeFilesToArchive(copyFiles.values().stream().flatMap(map -> map.entrySet().stream())
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)),
hardLinkFiles, archiveOutputStream, completed, checkpoint.getCheckpointLocation());
Map<Path, Path> flatCopyFiles = copyFiles.values().stream().flatMap(map -> map.entrySet().stream())
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
writeFilesToArchive(flatCopyFiles, hardLinkFiles, archiveOutputStream,
completed, checkpoint.getCheckpointLocation());
} catch (Exception e) {
LOG.error("got exception writing to archive " + e);
throw e;
Expand Down Expand Up @@ -208,6 +209,7 @@ public static Map<String, Map<Path, Path>> normalizeExcludeList(
continue;
}
Path destPath = Paths.get(metaDirPath.toString(), s);
paths.computeIfAbsent(fileName.toString(), (k) -> new HashMap<>());
if (destPath.toString().startsWith(
sstBackupDir.getOriginalDir().toString())) {
// The source of the sstBackupDir is a temporary directory and needs
Expand All @@ -216,12 +218,12 @@ public static Map<String, Map<Path, Path>> normalizeExcludeList(
sstBackupDir.getOriginalDir().toString().length() + 1;
Path srcPath = Paths.get(sstBackupDir.getTmpDir().toString(),
truncateFileName(truncateLength, destPath));
paths.computeIfAbsent(fileName.toString(), (k) -> new HashMap<>()).put(srcPath, destPath);
paths.get(fileName.toString()).put(srcPath, destPath);
swamirishi marked this conversation as resolved.
Show resolved Hide resolved
} else if (!s.startsWith(OM_SNAPSHOT_DIR)) {
Path fixedPath = Paths.get(checkpointLocation.toString(), s);
paths.computeIfAbsent(fileName.toString(), (k) -> new HashMap<>()).put(fixedPath, fixedPath);
paths.get(fileName.toString()).put(fixedPath, fixedPath);
} else {
paths.computeIfAbsent(fileName.toString(), (k) -> new HashMap<>()).put(destPath, destPath);
paths.get(fileName.toString()).put(destPath, destPath);
}
}
return paths;
Expand Down
Loading