/** * Add a list of regions to RegionStates. If a region is split * and offline, its state will be SPLIT. Otherwise, its state will * be OFFLINE. Region already in RegionStates will be skipped. */ public void createRegionStates( final List<HRegionInfo> hris) { for (HRegionInfo hri: hris) { createRegionState(hri); } }
/** * Add a region to RegionStates. If the region is split * and offline, its state will be SPLIT. Otherwise, its state will * be OFFLINE. If it is already in RegionStates, this call has * no effect, and the original state is returned. */ public RegionState createRegionState(final HRegionInfo hri) { return createRegionState(hri, null, null, null); }
/** * Get the HRegionInfo from cache, if not there, from the hbase:meta table * @param regionName * @return HRegionInfo for the region */ @SuppressWarnings("deprecation") protected HRegionInfo getRegionInfo(final byte [] regionName) { String encodedName = HRegionInfo.encodeRegionName(regionName); RegionState regionState = getRegionState(encodedName); if (regionState != null) { return regionState.getRegion(); } try { Pair<HRegionInfo, ServerName> p = MetaTableAccessor.getRegion(server.getConnection(), regionName); HRegionInfo hri = p == null ? null : p.getFirst(); if (hri != null) { createRegionState(hri); } return hri; } catch (IOException e) { server.abort("Aborting because error occoured while reading " + Bytes.toStringBinary(regionName) + " from hbase:meta", e); return null; } }
regionLocation = null; regionStates.createRegionState(regionInfo, state, regionLocation, lastHost); if (!regionStates.isRegionInState(regionInfo, State.OPEN)) {
ServerName currentMetaServer = metaState.getServerName(); if (!ConfigUtil.useZKForAssignment(conf)) { regionStates.createRegionState(hri, metaState.getState(), currentMetaServer, null); } else { regionStates.createRegionState(hri);
if (state == null) { LOG.warn("Assigning but not in region states: " + region); state = regionStates.createRegionState(region);