jojochuang commented on code in PR #8761:
URL: https://github.com/apache/ozone/pull/8761#discussion_r2220421397
##########
hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/HAUtils.java:
##########
@@ -319,28 +318,24 @@ public static File getMetaDir(DBDefinition definition,
}
/**
- * Scan the DB dir and return the existing SST files,
- * including omSnapshot sst files.
- * SSTs could be used for avoiding repeated download.
+ * Scan the DB dir and return the existing files,
+ * including omSnapshot files.
*
* @param db the file representing the DB to be scanned
- * @return the list of SST file name. If db not exist, will return empty list
+ * @return the list of file names. If db not exist, will return empty list
*/
- public static List<String> getExistingSstFiles(File db) throws IOException {
+ public static List<String> getExistingFiles(File db) throws IOException {
Review Comment:
To be honest getExistingFiles() shouldn't be in the HAUtils. Instead it
belongs to RocksDBUtils.
##########
hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/HAUtils.java:
##########
@@ -319,28 +318,24 @@ public static File getMetaDir(DBDefinition definition,
}
/**
- * Scan the DB dir and return the existing SST files,
- * including omSnapshot sst files.
- * SSTs could be used for avoiding repeated download.
+ * Scan the DB dir and return the existing files,
+ * including omSnapshot files.
*
* @param db the file representing the DB to be scanned
- * @return the list of SST file name. If db not exist, will return empty list
+ * @return the list of file names. If db not exist, will return empty list
*/
- public static List<String> getExistingSstFiles(File db) throws IOException {
+ public static List<String> getExistingFiles(File db) throws IOException {
List<String> sstList = new ArrayList<>();
if (!db.exists()) {
return sstList;
}
-
- int truncateLength = db.toString().length() + 1;
// Walk the db dir and get all sst files including omSnapshot files.
try (Stream<Path> files = Files.walk(db.toPath())) {
- sstList =
- files.filter(path -> path.toString().endsWith(ROCKSDB_SST_SUFFIX)).
- map(p -> p.toString().substring(truncateLength)).
+ sstList = files.filter(p -> p.toFile().isFile())
Review Comment:
A potential problem is flagged by Gemini: the files object could contain
relative path rather than the file name only. It's okay though for rocksdb as
the directory is flat with no subdirectories.
https://github.com/jojochuang/ozone/pull/598#discussion_r2220345512
--
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]