/** * Get the encoded region name for the region this plan is for. * @return Encoded region name */ public String getRegionName() { return this.hri.getEncodedName(); }
@Override public String toString() { return "region: " + region.getEncodedName() + " store(s): " + stores; } }
@Override public void editRegion(final RegionInfo hri) throws IOException { restoreMobRegion(hri, regionManifests.get(hri.getEncodedName())); } });
@Override public void fillRegion(final HRegion region) throws IOException { RegionInfo snapshotHri = snapshotRegions.get(region.getRegionInfo().getEncodedName()); cloneRegion(region, snapshotHri, regionManifests.get(snapshotHri.getEncodedName())); } });
public boolean isRegionTwiceOverThreshold(final RegionInfo regionInfo) { Map<String, RegionState> m = this.ritsOverThreshold; if (m == null) return false; final RegionState state = m.get(regionInfo.getEncodedName()); if (state == null) return false; return (statTimestamp - state.getStamp()) > (ritThreshold * 2); }
/** * Restore region by removing files not in the snapshot * and adding the missing ones from the snapshot. */ private void restoreRegion(final RegionInfo regionInfo, final SnapshotRegionManifest regionManifest) throws IOException { restoreRegion(regionInfo, regionManifest, new Path(tableDir, regionInfo.getEncodedName())); }
@Override public String getRegionName() { RegionInfo regionInfo = this.region.getRegionInfo(); if (regionInfo == null) { return UNKNOWN; } return regionInfo.getEncodedName(); }
@Override public void toStringClassDetails(final StringBuilder sb) { sb.append(getClass().getSimpleName()); sb.append(" table="); sb.append(getTableName()); sb.append(", region="); sb.append(getRegionInfo() == null ? null : getRegionInfo().getEncodedName()); }
@Override public String toString() { return "hri=" + this.hri.getEncodedName() + ", source=" + (this.source == null? "": this.source.toString()) + ", destination=" + (this.dest == null? "": this.dest.toString()); } }
/** * Create a new HFileLink name * * @param hfileRegionInfo - Linked HFile Region Info * @param hfileName - Linked HFile name * @return file name of the HFile Link */ public static String createHFileLinkName(final RegionInfo hfileRegionInfo, final String hfileName) { return createHFileLinkName(hfileRegionInfo.getTable(), hfileRegionInfo.getEncodedName(), hfileName); }
public RegionState getRegionState(final String encodedRegionName) { // TODO: Need a map <encodedName, ...> but it is just dispatch merge... for (RegionStateNode node: regionsMap.values()) { if (node.getRegionInfo().getEncodedName().equals(encodedRegionName)) { return node.toRegionState(); } } return null; }
/** * Gets the region dir of the mob files under the specified root dir. * It's {rootDir}/mobdir/data/{namespace}/{tableName}/{regionEncodedName}. * @param rootDir The qualified path of HBase root directory. * @param tableName The current table name. * @return The region dir of the mob files. */ public static Path getMobRegionPath(Path rootDir, TableName tableName) { Path tablePath = FSUtils.getTableDir(getMobHome(rootDir), tableName); RegionInfo regionInfo = getMobRegionInfo(tableName); return new Path(tablePath, regionInfo.getEncodedName()); }
/** * Clone the mob region. For the region create a new region * and create a HFileLink for each hfile. */ private void cloneHdfsMobRegion(final Map<String, SnapshotRegionManifest> regionManifests, final RegionInfo region) throws IOException { // clone region info (change embedded tableName with the new one) Path clonedRegionPath = MobUtils.getMobRegionPath(rootDir, tableDesc.getTableName()); cloneRegion(clonedRegionPath, region, regionManifests.get(region.getEncodedName())); }
protected final Path getWALRegionDir(MasterProcedureEnv env, RegionInfo region) throws IOException { return FSUtils.getWALRegionDir(env.getMasterConfiguration(), region.getTable(), region.getEncodedName()); }
public void checkQuotaToSplitRegion(RegionInfo hri) throws IOException { if (!stateManager.isInitialized()) { throw new IOException( "Split operation is being performed even before namespace auditor is initialized."); } else if (!stateManager .checkAndUpdateNamespaceRegionCount(hri.getTable(), hri.getRegionName(), 1)) { throw new QuotaExceededException("Region split not possible for :" + hri.getEncodedName() + " as quota limits are exceeded "); } }
public void updateQuotaForRegionMerge(RegionInfo mergedRegion) throws IOException { if (!stateManager.isInitialized()) { throw new IOException( "Merge operation is being performed even before namespace auditor is initialized."); } else if (!stateManager.checkAndUpdateNamespaceRegionCount(mergedRegion.getTable(), mergedRegion.getRegionName(), -1)) { throw new QuotaExceededException("Region merge not possible for :" + mergedRegion.getEncodedName() + " as quota limits are exceeded "); } }
private static void testGetRegion(final Connection connection, final RegionInfo region) throws IOException, InterruptedException { Pair<RegionInfo, ServerName> pair = MetaTableAccessor.getRegion(connection, region.getRegionName()); assertEquals(region.getEncodedName(), pair.getFirst().getEncodedName()); }
private long getOpenSeqNumForParentRegion(RegionInfo region) throws IOException { FileSystem walFS = master.getMasterWalManager().getFileSystem(); long maxSeqId = WALSplitter.getMaxRegionSequenceId(walFS, FSUtils.getWALRegionDir( master.getConfiguration(), region.getTable(), region.getEncodedName())); return maxSeqId > 0 ? maxSeqId + 1 : HConstants.NO_SEQNUM; }
/** * Helper method to get the archive directory for the specified region * @param conf {@link Configuration} to check for the name of the archive directory * @param region region that is being archived * @return {@link Path} to the archive directory for the given region */ public static Path getRegionArchiveDir(Configuration conf, HRegion region) throws IOException { return HFileArchiveUtil.getRegionArchiveDir( FSUtils.getRootDir(conf), region.getTableDescriptor().getTableName(), region.getRegionInfo().getEncodedName()); }
private void checkFavoredNodeAssignments(TableName tableName, FavoredNodesManager fnm, RegionStates regionStates) throws IOException { for (RegionInfo hri : admin.getTableRegions(tableName)) { ServerName host = regionStates.getRegionServerOfRegion(hri); assertNotNull("Region: " + hri.getEncodedName() + " not on FN, current: " + host + " FN list: " + fnm.getFavoredNodes(hri), FavoredNodesPlan.getFavoredServerPosition(fnm.getFavoredNodes(hri), host)); } }