d-c-manning commented on code in PR #5081:
URL: https://github.com/apache/hbase/pull/5081#discussion_r1129893925
##########
hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMetaCache.java:
##########
@@ -459,6 +460,22 @@ public void testUserRegionLockThrowsException() throws
IOException, InterruptedE
assertTrue(client1.getException() instanceof LockTimeoutException
^ client2.getException() instanceof LockTimeoutException);
+
+ // obtain the client metrics
+ MetricsConnection metrics = conn.getConnectionMetrics();
+ long queueCount = metrics.getUserRegionLockQueue().getCount();
+ assertEquals("Queue of userRegionLock should be updated twice.",
queueCount, 2);
+
+ long timeoutCount = metrics.getUserRegionLockTimeout().getCount();
+ assertEquals("Timeout of userRegionLock should happen once.",
timeoutCount, 1);
+
+ long waitingTimerCount =
metrics.getUserRegionLockWaitingTimer().getCount();
+ assertEquals("userRegionLock should be grabbed successfully once.",
waitingTimerCount, 1);
+
+ long heldTimerCount = metrics.getUserRegionLockHeldTimer().getCount();
+ assertEquals("userRegionLock should be held successfully once.",
heldTimerCount, 1);
+ double heldTime =
metrics.getUserRegionLockHeldTimer().getSnapshot().getMax();
+ assertTrue("Max held time should be greater than 2 seconds.", heldTime
>= 2E6);
Review Comment:
do you see the result as `200000`? I thought this was stored as nanoseconds,
in which case I would have expected `2E9` as 2 seconds = 2000 milliseconds =
2E6 microseconds = 2E9 nanoseconds.
Also, maybe include the result in the assert message for easier debugging.
```suggestion
assertTrue("Max held time should be greater than 2 seconds. heldTIme:
" + heldTime, heldTime >= 2E6);
```
--
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]