keith-turner commented on code in PR #5262:
URL: https://github.com/apache/accumulo/pull/5262#discussion_r1938321152


##########
core/src/main/java/org/apache/accumulo/core/fate/AdminUtil.java:
##########
@@ -275,38 +277,36 @@ private void findLocks(ZooSession zk, final 
ServiceLockPath lockPath,
     List<String> lockedIds = zr.getChildren(lockPath.toString());
 
     for (String id : lockedIds) {
-
       try {
-
         FateLockPath fLockPath = FateLock.path(lockPath + "/" + id);
-        List<String> lockNodes =
-            FateLock.validateAndSort(fLockPath, 
zr.getChildren(fLockPath.toString()));
+        SortedSet<FateLock.NodeName> lockNodes =
+            FateLock.validateAndWarn(fLockPath, 
zr.getChildren(fLockPath.toString()));
 
         int pos = 0;
         boolean sawWriteLock = false;
 
-        for (String node : lockNodes) {
+        for (FateLock.NodeName node : lockNodes) {
           try {
-            byte[] data = zr.getData(lockPath + "/" + id + "/" + node);
-            // Example data: "READ:<FateId>". FateId contains ':' hence the 
limit of 2
-            String[] lda = new String(data, UTF_8).split(":", 2);
-            FateId fateId = FateId.from(lda[1]);
+            FateLock.FateLockEntry fateLockEntry = node.fateLockEntry.get();
+            var fateId = fateLockEntry.getFateId();
+            var lockType = fateLockEntry.getLockType();
 
-            if (lda[0].charAt(0) == 'W') {
+            if (lockType == LockType.WRITE) {
               sawWriteLock = true;
             }
 
             Map<FateId,List<String>> locks;
 
             if (pos == 0) {
               locks = heldLocks;
-            } else if (lda[0].charAt(0) == 'R' && !sawWriteLock) {
+            } else if (lockType == LockType.READ && !sawWriteLock) {
               locks = heldLocks;
             } else {
               locks = waitingLocks;
             }
 
-            locks.computeIfAbsent(fateId, k -> new 
ArrayList<>()).add(lda[0].charAt(0) + ":" + id);
+            locks.computeIfAbsent(fateId, k -> new ArrayList<>())

Review Comment:
    I suspect the new FateLockEntry type could be used in this Admin class 
instead of the string things its doing here.  Going to open a follow on issue. 



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

Reply via email to