@InterfaceAudience.Private public class MetaFixer extends Object
MetaTableAccessor is about low-level
 manipulations driven by the Master. This class MetaFixer is
 employed by the Master and it 'knows' about holes and orphans
 and encapsulates their fixing on behalf of the Master.| Modifier and Type | Class and Description | 
|---|---|
| private static class  | MetaFixer.Either<L,R>A union over  LandR. | 
| Modifier and Type | Field and Description | 
|---|---|
| private static org.slf4j.Logger | LOG | 
| private MasterServices | masterServices | 
| private static int | MAX_MERGE_COUNT_DEFAULT | 
| private static String | MAX_MERGE_COUNT_KEY | 
| private int | maxMergeCountMaximum for many regions to merge at a time. | 
| Constructor and Description | 
|---|
| MetaFixer(MasterServices masterServices) | 
| Modifier and Type | Method and Description | 
|---|---|
| private static RegionInfo | buildRegionInfo(TableName tn,
               byte[] start,
               byte[] end) | 
| (package private) static List<SortedSet<RegionInfo>> | calculateMerges(int maxMergeCount,
               List<Pair<RegionInfo,RegionInfo>> overlaps)Run through  overlapsand return a list of merges to run. | 
| private static void | calculateTableMerges(int maxMergeCount,
                    List<SortedSet<RegionInfo>> merges,
                    Collection<Pair<RegionInfo,RegionInfo>> overlaps) | 
| private static List<RegionInfo> | createMetaEntries(MasterServices masterServices,
                 List<RegionInfo> newRegionInfos)Create entries in the  hbase:metafor each providedRegionInfo. | 
| private static List<RegionInfo> | createRegionInfosForHoles(List<Pair<RegionInfo,RegionInfo>> holes)Create a new  RegionInfocorresponding to each provided "hole" pair. | 
| void | fix() | 
| (package private) void | fixHoles(Report report)If hole, it papers it over by adding a region in the filesystem and to hbase:meta. | 
| (package private) List<Long> | fixOverlaps(Report report)Fix overlaps noted in CJ consistency report. | 
| private static Optional<RegionInfo> | getHoleCover(Pair<RegionInfo,RegionInfo> hole) | 
| (package private) static RegionInfo | getRegionInfoWithLargestEndKey(RegionInfo a,
                              RegionInfo b) | 
| (package private) static boolean | isOverlap(RegionInfo ri,
         Pair<RegionInfo,RegionInfo> pair) | 
private static final org.slf4j.Logger LOG
private static final String MAX_MERGE_COUNT_KEY
private static final int MAX_MERGE_COUNT_DEFAULT
private final MasterServices masterServices
private final int maxMergeCount
public MetaFixer(MasterServices masterServices)
public void fix() throws IOException
IOExceptionvoid fixHoles(Report report)
private static List<RegionInfo> createRegionInfosForHoles(List<Pair<RegionInfo,RegionInfo>> holes)
RegionInfo corresponding to each provided "hole" pair.private static Optional<RegionInfo> getHoleCover(Pair<RegionInfo,RegionInfo> hole)
RegionInfo that covers the region range described
   in hole.private static RegionInfo buildRegionInfo(TableName tn, byte[] start, byte[] end)
private static List<RegionInfo> createMetaEntries(MasterServices masterServices, List<RegionInfo> newRegionInfos)
hbase:meta for each provided RegionInfo. Best effort.masterServices - used to connect to hbase:metanewRegionInfos - the new RegionInfo entries to add to the filesystemRegionInfo entries for which hbase:meta entries were
   successfully createdList<Long> fixOverlaps(Report report) throws IOException
IOExceptionstatic List<SortedSet<RegionInfo>> calculateMerges(int maxMergeCount, List<Pair<RegionInfo,RegionInfo>> overlaps)
overlaps and return a list of merges to run.
 Presumes overlaps are ordered (which they are coming out of the CatalogJanitor
 consistency report).maxMergeCount - Maximum regions to merge at a time (avoid merging
   100k regions in one go!)private static void calculateTableMerges(int maxMergeCount, List<SortedSet<RegionInfo>> merges, Collection<Pair<RegionInfo,RegionInfo>> overlaps)
static RegionInfo getRegionInfoWithLargestEndKey(RegionInfo a, RegionInfo b)
a or b, whichever has the
   endkey that is furthest along in the Table.static boolean isOverlap(RegionInfo ri, Pair<RegionInfo,RegionInfo> pair)
ri and
   the pair. Does NOT check the pairs themselves overlap.Copyright © 2007–2021 The Apache Software Foundation. All rights reserved.