Apache9 commented on a change in pull request #2497:
URL: https://github.com/apache/hbase/pull/2497#discussion_r501542748



##########
File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/AssignmentManager.java
##########
@@ -870,32 +870,49 @@ public TransitRegionStateProcedure 
createOneUnassignProcedure(RegionInfo ri, boo
       
.sorted(AssignmentManager::compare).toArray(TransitRegionStateProcedure[]::new);
   }
 
+  // for creating unassign TRSP when disabling a table or closing excess 
region replicas
+  private TransitRegionStateProcedure 
forceCreateUnssignProcedure(RegionStateNode regionNode) {
+    regionNode.lock();
+    try {
+      if (!regionStates.include(regionNode, false) ||
+        regionStates.isRegionOffline(regionNode.getRegionInfo())) {
+        return null;
+      }
+      // As in DisableTableProcedure or ModifyTableProcedure, we will hold the 
xlock for table, so
+      // we can make sure that this procedure has not been executed yet, as 
TRSP will hold the
+      // shared lock for table all the time. So here we will unset it and when 
it is actually
+      // executed, it will find that the attach procedure is not itself and 
quit immediately.
+      if (regionNode.getProcedure() != null) {
+        regionNode.unsetProcedure(regionNode.getProcedure());
+      }
+      TransitRegionStateProcedure proc = TransitRegionStateProcedure
+        .unassign(getProcedureEnvironment(), regionNode.getRegionInfo());
+      regionNode.setProcedure(proc);
+      return proc;

Review comment:
       Oh, I recall that you have changed the return value of setProcedure? Let 
me change.




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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to