MarkGaox commented on code in PR #2698:
URL: https://github.com/apache/helix/pull/2698#discussion_r1394871354


##########
helix-lock/src/test/java/org/apache/helix/lock/helix/TestZKHelixNonblockingLockWithPriority.java:
##########
@@ -81,6 +81,45 @@ public void afterSuite() throws IOException {
     super.afterSuite();
   }
 
+  @Test

Review Comment:
   Basically, customers will never have a lock that is recorded with priority = 
-1. 
   
   When creating the `ZKDistributedNonblockingLock`, there is 
[check](https://github.com/apache/helix/blob/master/helix-lock/src/main/java/org/apache/helix/lock/helix/ZKDistributedNonblockingLock.java#L134)
 to make sure the priority is  not negative. The priority = -1 can only be seen 
if the field `priority` is not represent in the lock and we need to read it by 
[`getPriority()`](https://github.com/apache/helix/blob/master/helix-lock/src/main/java/org/apache/helix/lock/LockInfo.java#L173).
 Because the field `priority` is missing, `getPriority()` will return old 
default priority -1 (now changed to 0) and 
[updater](https://github.com/apache/helix/blob/master/helix-lock/src/main/java/org/apache/helix/lock/helix/ZKDistributedNonblockingLock.java#L316)
 in this way uses -1  to determine whether to lock or unlock.
   
   Hope this explains.



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