swamirishi commented on code in PR #9352:
URL: https://github.com/apache/ozone/pull/9352#discussion_r2561081572
##########
hadoop-ozone/common/src/test/java/org/apache/hadoop/ozone/om/lock/TestPoolBasedHierarchicalResourceLockManager.java:
##########
@@ -580,4 +572,39 @@ public void testIOExceptionPropagation() {
assertNotNull(e.getMessage());
}
}
+
+ @ParameterizedTest
+ @EnumSource
+ public void testDAGLockOrderAcquisition(DAGLeveledResource
dagLeveledResource) throws IOException {
+ Map<DAGLeveledResource, Set<IOzoneManagerLock.Resource>>
forbiddenLockOrdering =
+ ImmutableMap.of(SNAPSHOT_DB_CONTENT_LOCK,
ImmutableSet.of(SNAPSHOT_DB_LOCK, SNAPSHOT_LOCAL_DATA_LOCK),
+ BOOTSTRAP_LOCK, ImmutableSet.of(SNAPSHOT_GC_LOCK,
SNAPSHOT_DB_LOCK, SNAPSHOT_DB_CONTENT_LOCK,
+ SNAPSHOT_LOCAL_DATA_LOCK));
+ List<DAGLeveledResource> resources =
Arrays.stream(DAGLeveledResource.values()).collect(Collectors.toList());
+ for (DAGLeveledResource otherResource : resources) {
+ String otherResourceName1 = otherResource.getName() + "key";
+ String otherResourceName2 = otherResource.getName() + "key";
+ String flatResourceName = dagLeveledResource.getName() + "key";
+ try (HierarchicalResourceLock lock1 =
lockManager.acquireWriteLock(otherResource, otherResourceName1);
+ HierarchicalResourceLock lock2 =
lockManager.acquireWriteLock(otherResource, otherResourceName2)) {
Review Comment:
I am closing lock1 while still holding lock2. I would want to still forbid
lock retention based on the number of locks held
--
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]