smengcl commented on code in PR #4819:
URL: https://github.com/apache/ozone/pull/4819#discussion_r1232930503
##########
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestOmSnapshot.java:
##########
@@ -631,6 +639,127 @@ public void testSnapDiff() throws Exception {
}
+ @Test
+ public void testSnapDiffCancel() throws Exception {
+ // Create key1 and take snapshot.
+ String key1 = "key-1-" + RandomStringUtils.randomNumeric(5);
+ createFileKey(ozoneBucket, key1);
+ String fromSnapName = "snap-1-" + RandomStringUtils.randomNumeric(5);
+ createSnapshot(volumeName, bucketName, fromSnapName);
+
+ // Create key2 and take snapshot.
+ String key2 = "key-2-" + RandomStringUtils.randomNumeric(5);
+ createFileKey(ozoneBucket, key2);
+ String toSnapName = "snap-2-" + RandomStringUtils.randomNumeric(5);
+ createSnapshot(volumeName, bucketName, toSnapName);
+
+ SnapshotDiffResponse response = store.snapshotDiff(
+ volumeName, bucketName, fromSnapName, toSnapName,
+ null, 0, false, false);
+
+ assertEquals(IN_PROGRESS, response.getJobStatus());
+
+ response = store.snapshotDiff(volumeName,
+ bucketName, fromSnapName, toSnapName,
+ null, 0, false, true);
+
+ // Job status should be updated to CANCELED.
+ assertEquals(CANCELED, response.getJobStatus());
Review Comment:
Could this be a source of flakiness? There is no guarantee that the diff job
is still running when calling the second `snapshotDiff` with `cancel = true`
right?
Can fix this if there is a way to suspend the SnapshotDiff worker thread
before the first call.
--
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]