private void tryAssignmentRepair(HbckRegionInfo hbi, String msg)
    throws IOException, KeeperException, InterruptedException {
    // If we are trying to fix the errors
    if (shouldFixAssignments()) {
      errors.print(msg);
      undeployRegions(hbi);
      setShouldRerun();
      RegionInfo hri = hbi.getHdfsHRI();
      if (hri == null) {
        hri = hbi.getMetaEntry().getRegionInfo();
      }
      HBaseFsckRepair.fixUnassigned(admin, hri);
      HBaseFsckRepair.waitUntilAssigned(admin, hri);

      // also assign replicas if needed (do it only when this call operates on a primary replica)
      if (hbi.getReplicaId() != RegionInfo.DEFAULT_REPLICA_ID) return;
      int replicationCount = admin.getDescriptor(hri.getTable()).getRegionReplication();
      for (int i = 1; i < replicationCount; i++) {
        hri = RegionReplicaUtil.getRegionInfoForReplica(hri, i);
        HbckRegionInfo h = regionInfoMap.get(hri.getEncodedName());
        if (h != null) {
          undeployRegions(h);
          // set skip checks; we undeploy & deploy it; we don't want to evaluate this hbi anymore
          // in consistency checks
          h.setSkipChecks(true);
        }
        HBaseFsckRepair.fixUnassigned(admin, hri);
        HBaseFsckRepair.waitUntilAssigned(admin, hri);
      }

    }
  }
Attempts to undeploy a region from a region server based in information in META. Any operations
that modify the file system should make sure that its corresponding region is not deployed to
prevent data races. A separate call is required to update the master in-memory region state
kept in the AssignementManager. Because disable uses this state instead of that found in META,
we can't seem to cleanly disable/delete tables that have been hbck fixed. When used on a
version of HBase that does not have the offline ipc call exposed on the master (&lt;0.90.5,
&lt;0.92.0) a master restart or failover may be required.
hbase-server/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java