szetszwo commented on code in PR #10919:
URL: https://github.com/apache/ozone/pull/10919#discussion_r3696833953


##########
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:
   > ... Precondition for <=2 keys. ... 
   
   Unless someone is doing Case 1 below, it won't fail.  Case 1 below should be 
discouraged. 
   - Case 1
   ```java
   acquireReadLock(resource, Object[]{key}); // it will call 
acquireReadLock(Resource resource, String... keys);
   ```
   
   - Case 2
   ```java
   acquireReadLock(resource, key);  // it won't call acquireReadLock(Resource 
resource, String... keys);
   ```
   
   > ... they might accidentally introduce regression.
   
   It will introduce regression only if (1) a contributor adds code calling it 
and (2) the code is never tested before committing it.  Then, the contributor 
and the reviewer have done a very bad job.  I don't think adding doc to help 
such case is worth.
   
   We are working on internal code but not a public library.  Adding too much 
doc will becomes a maintenance problem; see my next comment.
   



-- 
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]

Reply via email to