sadanand48 commented on code in PR #8423: URL: https://github.com/apache/ozone/pull/8423#discussion_r2084444331
########## hadoop-hdds/rocksdb-checkpoint-differ/src/main/java/org/apache/ozone/rocksdb/util/RdbUtil.java: ########## @@ -49,4 +54,19 @@ public static Set<String> getSSTFilesForComparison( .map(lfm -> new File(lfm.path(), lfm.fileName()).getPath()) .collect(Collectors.toCollection(HashSet::new)); } + + public static Map<Object, String> getSSTFilesWithInodesForComparison(final ManagedRocksDB rocksDB, List<String> cfs) { + return getLiveSSTFilesForCFs(rocksDB, cfs).stream() + .collect(Collectors.toMap( + lfm -> { + try { + return Files.readAttributes(new File(lfm.path(), lfm.fileName()).toPath(), Review Comment: 1. Use OmSnapshotUtils.getINode() function instead : This module is not accessible in RdbUtil 2. done ########## hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/snapshot/SnapshotDiffManager.java: ########## @@ -1217,6 +1223,23 @@ Set<String> getDeltaFiles(OmSnapshot fromSnapshot, toSnapshot.getSnapshotTableKey())); } + private Set<String> getDiffFiles(OmSnapshot fromSnapshot, OmSnapshot toSnapshot, List<String> tablesToLookUp) { + Set<String> diffFiles; + try { + Map<Object, String> fromSnapshotFiles = getSSTFileMapForSnapshot(fromSnapshot, tablesToLookUp); + Map<Object, String> toSnapshotFiles = getSSTFileMapForSnapshot(toSnapshot, tablesToLookUp); + diffFiles = Stream.concat(fromSnapshotFiles.entrySet().stream(), + toSnapshotFiles.entrySet().stream().filter(e -> !fromSnapshotFiles.containsKey(e.getKey()))) Review Comment: done. ########## hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/snapshot/TestSnapshotDiffManager.java: ########## @@ -1545,20 +1545,28 @@ public void testGetDeltaFilesWithFullDiff() throws IOException { Mockito.doAnswer(invocation -> { OmSnapshot snapshot = invocation.getArgument(0); if (snapshot == fromSnapshot) { - return Sets.newHashSet("1", "2", "3"); + Map<Integer, String> inodeToFileMap = new HashMap<>(); + inodeToFileMap.put(1, "1.sst"); + inodeToFileMap.put(2, "2.sst"); + inodeToFileMap.put(3, "3.sst"); + return inodeToFileMap; } if (snapshot == toSnapshot) { - return Sets.newHashSet("3", "4", "5"); + Map<Integer, String> inodeToFileMap = new HashMap<>(); + inodeToFileMap.put(1, "10.sst"); + inodeToFileMap.put(2, "20.sst"); + inodeToFileMap.put(4, "4.sst"); + return inodeToFileMap; } - return Sets.newHashSet("6", "7", "8"); - }).when(spy).getSSTFileListForSnapshot(Mockito.any(OmSnapshot.class), + return null; + }).when(spy).getSSTFileMapForSnapshot(Mockito.any(OmSnapshot.class), Mockito.anyList()); doNothing().when(spy).recordActivity(any(), any()); doNothing().when(spy).updateProgress(anyString(), anyDouble()); String diffJobKey = snap1 + DELIMITER + snap2; Set<String> deltaFiles = spy.getDeltaFiles(fromSnapshot, toSnapshot, Collections.emptyList(), snapshotInfo, snapshotInfo, true, Collections.emptyMap(), null, diffJobKey); - Assertions.assertEquals(Sets.newHashSet("1", "2", "3", "4", "5"), deltaFiles); + Assertions.assertEquals(Sets.newHashSet("1.sst", "2.sst", "3.sst", "4.sst"), deltaFiles); Review Comment: done. -- 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: issues-unsubscr...@ozone.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@ozone.apache.org For additional commands, e-mail: issues-h...@ozone.apache.org