spacemonkd commented on code in PR #10919:
URL: https://github.com/apache/ozone/pull/10919#discussion_r3695953850
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/lock/OzoneManagerLock.java:
##########
@@ -305,73 +305,47 @@ public ReentrantReadWriteLock next() {
return deque::descendingIterator;
}
- /**
- * Acquire read lock on resource.
- *
- * For S3_BUCKET_LOCK, VOLUME_LOCK, BUCKET_LOCK type resource, same
- * thread acquiring lock again is allowed.
- *
- * For USER_LOCK, PREFIX_LOCK, S3_SECRET_LOCK type resource, same thread
- * acquiring lock again is not allowed.
- *
- * Special Note for USER_LOCK: Single thread can acquire single user lock/
- * multi user lock. But not both at the same time.
- * @param resource - Type of the resource.
- * @param keys - Resource names on which user want to acquire lock.
- * For Resource type BUCKET_LOCK, first param should be volume, second param
- * should be bucket name. For remaining all resource only one param should
- * be passed.
- */
+ @Override
+ public OMLockDetails acquireReadLock(Resource resource, String key) {
+ return getResourceLocks(resource)
+ .acquireOne(resource, true, key);
+ }
+
+ @Override
+ public OMLockDetails acquireReadLock(Resource resource, String key1, String
key2) {
+ return getResourceLocks(resource)
+ .acquireOne(resource, true, CompositeKey.combineTwoKeys(key1, key2));
+ }
+
@Override
public OMLockDetails acquireReadLock(Resource resource, String... keys) {
+ Preconditions.assertTrue(keys.length > 2);
Review Comment:
Is this check required? As far as I am understanding all the methods i.e.
`acquireWriteLock()`, `releaseReadLock()`, `releaseWriteLock()` end up in
`combineMultiKeys()` where the `MultiComponents` constructor already does the
check.
```
Preconditions.assertTrue(components.length > 2, () -> "components.length " +
components.length + " <= 2");
```
--
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]