This is an automated email from the ASF dual-hosted git repository.
weichiu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git
The following commit(s) were added to refs/heads/master by this push:
new 43357ff1aca HDDS-13769. Orphan files can be copied as hard link file
list has files added outside the lock. (#9128)
43357ff1aca is described below
commit 43357ff1aca0e01e8cb62eaacfcef8552f23399e
Author: Sadanand Shenoy <[email protected]>
AuthorDate: Wed Oct 22 03:27:29 2025 +0530
HDDS-13769. Orphan files can be copied as hard link file list has files
added outside the lock. (#9128)
---
.../om/OMDBCheckpointServletInodeBasedXfer.java | 27 +++++++++++-----------
1 file changed, 14 insertions(+), 13 deletions(-)
diff --git
a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OMDBCheckpointServletInodeBasedXfer.java
b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OMDBCheckpointServletInodeBasedXfer.java
index 28769f75409..f967e30ec52 100644
---
a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OMDBCheckpointServletInodeBasedXfer.java
+++
b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OMDBCheckpointServletInodeBasedXfer.java
@@ -223,8 +223,6 @@ public void writeDbDataToStream(HttpServletRequest request,
OutputStream destina
}
boolean shouldContinue = true;
-
- Map<String, String> hardLinkFileMap = new HashMap<>();
try (ArchiveOutputStream<TarArchiveEntry> archiveOutputStream =
tar(destination)) {
if (includeSnapshotData) {
// Process each snapshot db path and write it to archive
@@ -233,18 +231,18 @@ public void writeDbDataToStream(HttpServletRequest
request, OutputStream destina
break;
}
shouldContinue = writeDBToArchive(sstFilesToExclude, snapshotDbPath,
- maxTotalSstSize, archiveOutputStream, tmpdir, hardLinkFileMap,
true);
+ maxTotalSstSize, archiveOutputStream, tmpdir, null, true);
}
if (shouldContinue) {
shouldContinue = writeDBToArchive(sstFilesToExclude,
getSstBackupDir(),
- maxTotalSstSize, archiveOutputStream, tmpdir, hardLinkFileMap,
true);
+ maxTotalSstSize, archiveOutputStream, tmpdir, null, true);
}
if (shouldContinue) {
shouldContinue = writeDBToArchive(sstFilesToExclude,
getCompactionLogDir(),
- maxTotalSstSize, archiveOutputStream, tmpdir, hardLinkFileMap,
true);
+ maxTotalSstSize, archiveOutputStream, tmpdir, null, true);
}
}
@@ -255,6 +253,7 @@ public void writeDbDataToStream(HttpServletRequest request,
OutputStream destina
// unlimited files as we want the Active DB contents to be transferred
in a single batch
maxTotalSstSize.set(Long.MAX_VALUE);
Path checkpointDir = checkpoint.getCheckpointLocation();
+ Map<String, String> hardLinkFileMap = new HashMap<>();
writeDBToArchive(sstFilesToExclude, checkpointDir,
maxTotalSstSize, archiveOutputStream, tmpdir, hardLinkFileMap,
false);
if (includeSnapshotData) {
@@ -443,15 +442,17 @@ private boolean writeDBToArchive(Set<String>
sstFilesToExclude, Path dbDir, Atom
continue;
}
String fileId =
OmSnapshotUtils.getFileInodeAndLastModifiedTimeString(dbFile);
- String path = dbFile.toFile().getAbsolutePath();
- if (destDir != null) {
- path = destDir.resolve(dbFile.getFileName()).toString();
- }
- // if the file is in the om checkpoint dir, then we need to change
the path to point to the OM DB.
- if (path.contains(OM_CHECKPOINT_DIR)) {
- path =
getDbStore().getDbLocation().toPath().resolve(dbFile.getFileName()).toAbsolutePath().toString();
+ if (hardLinkFileMap != null) {
+ String path = dbFile.toFile().getAbsolutePath();
+ if (destDir != null) {
+ path = destDir.resolve(dbFile.getFileName()).toString();
+ }
+ // if the file is in the om checkpoint dir, then we need to change
the path to point to the OM DB.
+ if (path.contains(OM_CHECKPOINT_DIR)) {
+ path =
getDbStore().getDbLocation().toPath().resolve(dbFile.getFileName()).toAbsolutePath().toString();
+ }
+ hardLinkFileMap.put(path, fileId);
}
- hardLinkFileMap.put(path, fileId);
if (!sstFilesToExclude.contains(fileId)) {
long fileSize = Files.size(dbFile);
if (maxTotalSstSize.get() - fileSize <= 0) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]