spacemonkd commented on code in PR #10852:
URL: https://github.com/apache/ozone/pull/10852#discussion_r3641066612
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/lock/OzoneManagerLock.java:
##########
@@ -97,41 +93,172 @@ public class OzoneManagerLock implements IOzoneManagerLock
{
private static final Logger LOG =
LoggerFactory.getLogger(OzoneManagerLock.class);
- private final Map<Class<? extends Resource>,
- Pair<Map<Resource, Striped<ReadWriteLock>>, ResourceLockTracker>>
resourcelockMap;
+ private final ResourceLocks<LeveledResource> leveledResourceLocks;
+ private final ResourceLocks<DAGLeveledResource> dagLeveledResourceLocks;
- private OMLockMetrics omLockMetrics;
+ private final OMLockMetrics omLockMetrics = OMLockMetrics.create();
+
+ class ResourceLocks<R extends Resource> {
+ private final Map<Resource, Striped<ReentrantReadWriteLock>> lockMap;
+ private final ResourceLockTracker<R> tracker;
+
+ class Context {
+ private final R resource;
+ private final long startWaitingTimeNanos = Time.monotonicNowNanos();
+
+ Context(R r) {
+ this.resource = r;
+ }
+
+ R getResource() {
+ return resource;
+ }
+
+ long getWaitingTimeNanos() {
+ return Time.monotonicNowNanos() - startWaitingTimeNanos;
Review Comment:
As far as I understand this is inheriting the previous behaviour where all
lock time was summed up.
So:
lock 1: 10ms
lock 2: 20ms
lock 3: 10ms
This would return the total time instead of per lock waiting time. However
with the context class I would expect per lock wait to be accounted for. Maybe
we can add a comment saying that this is still sum of the total wait time?
--
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]