smengcl commented on code in PR #3981:
URL: https://github.com/apache/ozone/pull/3981#discussion_r1040297282
##########
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/freon/TestOMSnapshotDAG.java:
##########
@@ -194,27 +199,51 @@ void testZeroSizeKey()
DifferSnapshotInfo snap1 = getDifferSnapshotInfo(omMetadataManager,
volumeName, bucketName, "snap1");
- DifferSnapshotInfo snap3 = getDifferSnapshotInfo(omMetadataManager,
- volumeName, bucketName, "snap3");
+ DifferSnapshotInfo snap2 = getDifferSnapshotInfo(omMetadataManager,
+ volumeName, bucketName, "snap2");
// RocksDB does checkpointing in a separate thread, wait for it
final File checkpointSnap1 = new File(snap1.getDbPath());
GenericTestUtils.waitFor(checkpointSnap1::exists, 2000, 20000);
+ final File checkpointSnap2 = new File(snap2.getDbPath());
+ GenericTestUtils.waitFor(checkpointSnap2::exists, 2000, 20000);
+
+ List<String> sstDiffList21 = differ.getSSTDiffList(snap2, snap1);
+ LOG.debug("Got diff list: {}", sstDiffList21);
+
+ // Delete 1000 keys, take a 3rd snapshot, and do another diff
+ for (int i = 0; i < 1000; i++) {
+ bucket.deleteKey("b_" + i);
+ }
+
+ resp = store.createSnapshot(volumeName, bucketName, "snap3");
+ LOG.debug("Snapshot created: {}", resp);
+
+ DifferSnapshotInfo snap3 = getDifferSnapshotInfo(omMetadataManager,
+ volumeName, bucketName, "snap3");
final File checkpointSnap3 = new File(snap3.getDbPath());
GenericTestUtils.waitFor(checkpointSnap3::exists, 2000, 20000);
- List<String> actualDiffList = differ.getSSTDiffList(snap3, snap1);
- LOG.debug("Got diff list: {}", actualDiffList);
- // Hard-coded expected output.
- // The result is deterministic. Retrieved from a successful run.
- final List<String> expectedDiffList = Collections.singletonList("000059");
- Assertions.assertEquals(expectedDiffList, actualDiffList);
-
- // TODO: Use smaller DB write buffer size (currently it is set to 128 MB
- // in DBProfile), or generate enough keys (in the millions) to trigger
- // RDB compaction. Take another snapshot and do the diff again.
- // Then restart OM, do the same diff again to see if DAG reconstruction
- // works.
+ List<String> sstDiffList32 = differ.getSSTDiffList(snap3, snap2);
+
+ // snap3-snap1 diff result is a combination of snap3-snap2 and snap2-snap1
+ List<String> sstDiffList31 = differ.getSSTDiffList(snap3, snap1);
+
+ // Same snapshot. Result should be empty list
+ List<String> sstDiffList22 = differ.getSSTDiffList(snap2, snap2);
+ Assertions.assertTrue(sstDiffList22.isEmpty());
+
+ // Restart OM, do the same diffs again. See if DAG reconstruction works
+ cluster.restartOzoneManager();
Review Comment:
Renamed test to `testDAGReconstruction`
--
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]