private TransitRegionStateProcedure createAssignProcedure(RegionInfo regionInfo, ServerName sn,
    boolean override, boolean force) throws IOException {
    RegionStateNode regionNode = regionStates.getOrCreateRegionStateNode(regionInfo);
    regionNode.lock();
    try {
      if (override) {
        if (!force) {
          preTransitCheck(regionNode, STATES_EXPECTED_ON_ASSIGN);
        }
        if (regionNode.getProcedure() != null) {
          regionNode.unsetProcedure(regionNode.getProcedure());
        }
      } else {
        preTransitCheck(regionNode, STATES_EXPECTED_ON_ASSIGN);
      }
      assert regionNode.getProcedure() == null;
      return regionNode.setProcedure(
        TransitRegionStateProcedure.assign(getProcedureEnvironment(), regionInfo, sn));
    } finally {
      regionNode.unlock();
    }
  }
Create an assign TransitRegionStateProcedure. Makes sure of RegionState. Throws exception if
not appropriate UNLESS override is set. Used by hbck2 but also by straightline
{@link #assign(RegionInfo, ServerName)} and {@link #assignAsync(RegionInfo, ServerName)}.
@see #createAssignProcedure(RegionStateNode, ServerName) for a version that does NO checking
     used when only when no checking needed.
@param override If false, check RegionState is appropriate for assign; if not throw exception.
hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/AssignmentManager.java