szetszwo commented on code in PR #10919:
URL: https://github.com/apache/ozone/pull/10919#discussion_r3696836876
##########
hadoop-ozone/interface-storage/src/main/java/org/apache/hadoop/ozone/om/lock/IOzoneManagerLock.java:
##########
@@ -26,34 +26,52 @@
*/
public interface IOzoneManagerLock {
- OMLockDetails acquireReadLock(Resource resource,
- String... resources);
+ // ---------- acquireReadLock ----------
+ OMLockDetails acquireReadLock(Resource resource, String key);
+
+ OMLockDetails acquireReadLock(Resource resource, String key1, String key2);
+
+ OMLockDetails acquireReadLock(Resource resource, String... keys);
Review Comment:
> * For S3_BUCKET_LOCK, VOLUME_LOCK, BUCKET_LOCK, the same thread
acquiring the
We should not mention S3_BUCKET_LOCK, VOLUME_LOCK, BUCKET_LOCK, etc here.
The abstraction is incorrect -- This interface is a general lock interface and
there are two implementations, OmReadOnlyLock and OzoneManagerLock. The
S3_BUCKET_LOCK, VOLUME_LOCK, BUCKET_LOCK things are only for OzoneManagerLock.
The correct place to document S3_BUCKET_LOCK, VOLUME_LOCK, BUCKET_LOCK is
the definition, i.e. LeveledResource. However, I believe javadoc below and
javadoc/comments in LeveledResource are highly inaccurate and probably
contradict to each other. That's why I removed some of the (repeated,
inaccurate) javadoc from OzoneManagerLock in this PR.
```java
/**
* 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... keys) {
...
}
```
--
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]