jojochuang commented on code in PR #9169:
URL: https://github.com/apache/ozone/pull/9169#discussion_r2453692432
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OMDBCheckpointServletInodeBasedXfer.java:
##########
@@ -479,21 +478,31 @@ private boolean writeDBToArchive(Set<String>
sstFilesToExclude, Path dbDir, Atom
* The copy to the temporary directory for compaction log and SST backup
files
* is done to maintain a consistent view of the files in these directories.
*
- * @param tmpdir Temporary directory for storing checkpoint-related files.
* @param flush If true, flushes in-memory data to disk before
checkpointing.
- * @return The created database checkpoint.
* @throws IOException If an error occurs during checkpoint creation or file
copying.
*/
- private DBCheckpoint createAndPrepareCheckpoint(Path tmpdir, boolean flush)
throws IOException {
- // make tmp directories to contain the copies
- Path tmpCompactionLogDir =
tmpdir.resolve(getCompactionLogDir().getFileName());
- Path tmpSstBackupDir = tmpdir.resolve(getSstBackupDir().getFileName());
-
- // Create checkpoint and then copy the files so that it has all the
compaction entries and files.
- DBCheckpoint dbCheckpoint = getDbStore().getCheckpoint(flush);
- FileUtils.copyDirectory(getCompactionLogDir().toFile(),
tmpCompactionLogDir.toFile());
- OmSnapshotUtils.linkFiles(getSstBackupDir().toFile(),
tmpSstBackupDir.toFile());
+ private DBCheckpoint createAndPrepareCheckpoint(boolean flush) throws
IOException {
+ // Create & return the checkpoint.
+ return getDbStore().getCheckpoint(flush);
+ }
- return dbCheckpoint;
+ private List<Path> extractSSTFilesFromCompactionLog(DBCheckpoint
dbCheckpoint) throws IOException {
+ List<Path> sstFiles = new ArrayList<>();
+ try (OmMetadataManagerImpl checkpointMetadataManager =
+ OmMetadataManagerImpl.createCheckpointMetadataManager(getConf(),
dbCheckpoint)) {
+ try (Table.KeyValueIterator<String, CompactionLogEntry>
+ iterator =
checkpointMetadataManager.getCompactionLogTable().iterator()) {
+ iterator.seekToFirst();
+
+ while (iterator.hasNext()) {
+ CompactionLogEntry logEntry = iterator.next().getValue();
+ logEntry.getInputFileInfoList().forEach(f ->
+ sstFiles.add(Paths.get(f.getFileName())));
Review Comment:
Thanks @sadanand48 good catch. Can you check again now?
--
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]