Apache9 commented on code in PR #5442:
URL: https://github.com/apache/hbase/pull/5442#discussion_r1349474487


##########
hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/AssignmentManager.java:
##########
@@ -1398,27 +1398,37 @@ private void checkOnlineRegionsReport(ServerStateNode 
serverNode, Set<byte[]> re
         continue;
       }
       final long lag = 1000;
-      regionNode.lock();
       try {
-        long diff = EnvironmentEdgeManager.currentTime() - 
regionNode.getLastUpdate();
-        if (regionNode.isInState(State.OPENING, State.OPEN)) {
-          // This is possible as a region server has just closed a region but 
the region server
-          // report is generated before the closing, but arrive after the 
closing. Make sure there
-          // is some elapsed time so less false alarms.
-          if (!regionNode.getRegionLocation().equals(serverName) && diff > 
lag) {
-            LOG.warn("Reporting {} server does not match {} (time since last "
-              + "update={}ms); closing...", serverName, regionNode, diff);
-            closeRegionSilently(serverNode.getServerName(), regionName);
-          }
-        } else if (!regionNode.isInState(State.CLOSING, State.SPLITTING)) {
-          // So, we can get report that a region is CLOSED or SPLIT because a 
heartbeat
-          // came in at about same time as a region transition. Make sure 
there is some
-          // elapsed time so less false alarms.
-          if (diff > lag) {
-            LOG.warn("Reporting {} state does not match {} (time since last 
update={}ms)",
-              serverName, regionNode, diff);
+        // It is likely that another thread is currently holding the lock. To 
avoid deadlock, use
+        // tryLock waiting for a specified period of time
+        if (regionNode.tryLock(10, TimeUnit.SECONDS)) {

Review Comment:
   tryLock should be placed outside the try block, as we do not need to unlock 
if we get a false here.



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