swamirishi commented on code in PR #5317:
URL: https://github.com/apache/ozone/pull/5317#discussion_r1345226915
##########
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestSnapshotBackgroundServices.java:
##########
@@ -404,36 +403,48 @@ public void testCompactionLogBackgroundService()
cluster.getOzoneManager(leaderOM.getOMNodeId());
Assertions.assertEquals(leaderOM, newFollowerOM);
- // Prepare baseline data for compaction logs
- String currentCompactionLogPath = newLeaderOM
- .getMetadataManager()
- .getStore()
- .getRocksDBCheckpointDiffer()
- .getCurrentCompactionLogPath();
- Assertions.assertNotNull(currentCompactionLogPath);
- int lastIndex = currentCompactionLogPath.lastIndexOf(OM_KEY_PREFIX);
- String compactionLogsPath = currentCompactionLogPath
- .substring(0, lastIndex);
- File compactionLogsDir = new File(compactionLogsPath);
- Assertions.assertNotNull(compactionLogsDir);
- File[] files = compactionLogsDir.listFiles();
- Assertions.assertNotNull(files);
- int numberOfLogFiles = files.length;
- long contentLength;
- Path currentCompactionLog = Paths.get(currentCompactionLogPath);
- try (BufferedReader bufferedReader =
- Files.newBufferedReader(currentCompactionLog)) {
- contentLength = bufferedReader.lines()
- .mapToLong(String::length)
- .reduce(0L, Long::sum);
- }
+ List<CompactionLogEntry> compactionLogEntriesOnPreviousLeader =
+ getCompactionLogEntries(leaderOM);
+
+ List<CompactionLogEntry> compactionLogEntriesOnNewLeader =
+ getCompactionLogEntries(newLeaderOM);
+ Assertions.assertEquals(compactionLogEntriesOnPreviousLeader,
+ compactionLogEntriesOnNewLeader);
+
+ Assertions.assertEquals(leaderOM.getMetadataManager().getStore()
+ .getRocksDBCheckpointDiffer().getForwardCompactionDAG().nodes()
+ .stream().map(CompactionNode::getFileName).collect(toSet()),
+ newLeaderOM.getMetadataManager().getStore()
+ .getRocksDBCheckpointDiffer().getForwardCompactionDAG().nodes()
+ .stream().map(CompactionNode::getFileName).collect(toSet()));
+ Assertions.assertEquals(leaderOM.getMetadataManager().getStore()
+ .getRocksDBCheckpointDiffer().getForwardCompactionDAG().edges()
+ .stream().map(edge ->
+ edge.source().getFileName() + "-" +
edge.target().getFileName())
+ .collect(toSet()),
+ newLeaderOM.getMetadataManager().getStore()
+ .getRocksDBCheckpointDiffer().getForwardCompactionDAG().edges()
+ .stream().map(edge ->
+ edge.source().getFileName() + "-" +
edge.target().getFileName())
+ .collect(toSet()));
- checkIfCompactionLogsGetAppendedByForcingCompaction(newLeaderOM,
- compactionLogsDir, numberOfLogFiles, contentLength,
- currentCompactionLog);
+ confirmSnapDiffForTwoSnapshotsDifferingBySingleKey(newLeaderOM);
Review Comment:
Why aren't we forcing compaction & checking logs are being appended here?
--
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]