private boolean recordMetaRegion()

in hbase-hbck2/src/main/java/org/apache/hbase/hbck1/HBaseFsck.java [2219:2260]


  private boolean recordMetaRegion() throws IOException {
    // Modified from copy taken from hbase master to only use single getRegionLocator
    // rather than plural version.
    HRegionLocation loc;
    try (RegionLocator locator = connection.getRegionLocator(TableName.META_TABLE_NAME)) {
      loc = locator.getRegionLocation(HConstants.EMPTY_START_ROW, true);
    }
    if (loc == null) {
      errors.reportError(ErrorReporter.ERROR_CODE.NULL_META_REGION,
          "META region was not found in ZooKeeper");
      return false;
    }


    HRegionLocation metaLocation = loc;
    // Check if Meta region is valid and existing
    if (metaLocation == null) {
      errors.reportError(ErrorReporter.ERROR_CODE.NULL_META_REGION,
          "META region location is null");
      return false;
    }
    if (metaLocation.getRegion() == null) {
      errors.reportError(ErrorReporter.ERROR_CODE.NULL_META_REGION,
          "META location regionInfo is null");
      return false;
    }
    if (metaLocation.getHostname() == null) {
      errors.reportError(ErrorReporter.ERROR_CODE.NULL_META_REGION,
          "META location hostName is null");
      return false;
    }
    ServerName sn = metaLocation.getServerName();
    MetaEntry m =
      new MetaEntry(metaLocation.getRegion(), sn, System.currentTimeMillis());
    HbckInfo hbckInfo = regionInfoMap.get(metaLocation.getRegion().getEncodedName());
    if (hbckInfo == null) {
      regionInfoMap.put(metaLocation.getRegion().getEncodedName(), new HbckInfo(m));
    } else {
      hbckInfo.metaEntry = m;
    }
    return true;
  }