rich7420 commented on code in PR #11072:
URL: https://github.com/apache/ozone/pull/11072#discussion_r4705665819


##########
hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/service/TestOpenKeyCleanupService.java:
##########
@@ -420,6 +423,37 @@ public void testCleanupExpiredOpenMPUPartKeys(
     assertAtLeast(numOpenKeysCleaned + partCount, 
metrics.getNumOpenKeysCleaned());
   }
 
+  /**
+   * Cleaning up expired open keys submits an internal {@code DeleteOpenKeys} 
request, which should
+   * be counted in the OmClientProtocol per-type metrics just like a client 
request.
+   */
+  @Test
+  public void testCleanupIncrementsDeleteOpenKeysMetric() throws Exception {
+    OpenKeyCleanupService openKeyCleanupService =
+        (OpenKeyCleanupService) keyManager.getOpenKeyCleanupService();
+
+    openKeyCleanupService.suspend();
+    // wait for submitted tasks to complete
+    Thread.sleep(SERVICE_INTERVAL);
+
+    final long beforeCount = getRequestCount(om.getOmClientProtocolMetrics(), 
Type.DeleteOpenKeys);
+    final long beforeTime = getRequestTime(om.getOmClientProtocolMetrics(), 
Type.DeleteOpenKeys);
+
+    createOpenKeys(5, false, BucketLayout.DEFAULT, false, false);
+
+    // wait for open keys to expire
+    Thread.sleep(EXPIRE_THRESHOLD_MS);
+    assertExpiredOpenKeys(false, false, BucketLayout.DEFAULT);
+
+    openKeyCleanupService.resume();
+    waitForOpenKeyCleanup(false, BucketLayout.DEFAULT);

Review Comment:
   The metric can land after the key is gone, so this and the MPU test may 
flake. Wait on `getSubmittedOpenKeyCount()`?



##########
hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/TestTrashOzoneFileSystem.java:
##########
@@ -125,6 +129,82 @@ void testGetFileStatusDoesNotIncrementOmRpcMetric(@TempDir 
File testDir) throws
     }
   }
 
+  /**
+   * The Trash emptier renames and deletes trash directories in FSO buckets 
through the
+   * TrashOzoneFileSystem, submitting internal {@code RenameKey} and {@code 
DeleteKey} requests.
+   * Both should be counted in the OmClientProtocol per-type metrics just like 
a client request.
+   */
+  @Test
+  void testRenameAndDeleteInFsoBucketIncrementMetrics(@TempDir File testDir) 
throws Exception {

Review Comment:
   These per-service tests all cover the same `measure` call. Keep the utils 
test plus one or two cheap ones?



-- 
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]

Reply via email to