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 key can leave the table before the metric is recorded on the service
thread; a 300 ms delay there failed this and the MPU test. Could it wait on
`getSubmittedOpenKeyCount()` first?
##########
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 cases all exercise the one `measure` call in
`submitRequest`; removing it fails all 13, `TestOzoneManagerRatisUtils`
included. Could we keep that class plus one or two lightweight OM cases?
--
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]