Class MetaFixer
java.lang.Object
org.apache.hadoop.hbase.master.janitor.MetaFixer
Server-side fixing of bad or inconsistent state in hbase:meta. Distinct from MetaTableAccessor
because
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.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classA union overMetaFixer.EitherandMetaFixer.Either. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final org.slf4j.Loggerprivate final MasterServicesprivate static final intprivate static final Stringprivate final intMaximum for many regions to merge at a time. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static RegionInfobuildRegionInfo(TableName tn, byte[] start, byte[] end) (package private) static List<SortedSet<RegionInfo>>calculateMerges(int maxMergeCount, List<Pair<RegionInfo, RegionInfo>> overlaps) Run throughoverlapsand return a list of merges to run.private static voidcalculateTableMerges(int maxMergeCount, List<SortedSet<RegionInfo>> merges, Collection<Pair<RegionInfo, RegionInfo>> overlaps) private static List<RegionInfo>createMetaEntries(MasterServices masterServices, List<RegionInfo> newRegionInfos) Create entries in thehbase:metafor each providedRegionInfo.private static List<RegionInfo>Create a newRegionInfocorresponding to each provided "hole" pair.voidfix()(package private) voidfixHoles(CatalogJanitorReport report) If hole, it papers it over by adding a region in the filesystem and to hbase:meta.fixOverlaps(CatalogJanitorReport report) Fix overlaps noted in CJ consistency report.private static Optional<RegionInfo>getHoleCover(Pair<RegionInfo, RegionInfo> hole) (package private) static RegionInfo(package private) static booleanisOverlap(RegionInfo ri, Pair<RegionInfo, RegionInfo> pair)
-
Field Details
-
LOG
-
MAX_MERGE_COUNT_KEY
- See Also:
-
MAX_MERGE_COUNT_DEFAULT
- See Also:
-
masterServices
-
maxMergeCount
Maximum for many regions to merge at a time.
-
-
Constructor Details
-
MetaFixer
-
-
Method Details
-
fix
- Throws:
IOException
-
fixHoles
If hole, it papers it over by adding a region in the filesystem and to hbase:meta. Does not assign. -
createRegionInfosForHoles
Create a newRegionInfocorresponding to each provided "hole" pair. -
getHoleCover
- Returns:
- Attempts to calculate a new
RegionInfothat covers the region range described inhole.
-
buildRegionInfo
-
createMetaEntries
private static List<RegionInfo> createMetaEntries(MasterServices masterServices, List<RegionInfo> newRegionInfos) Create entries in thehbase:metafor each providedRegionInfo. Best effort.- Parameters:
masterServices- used to connect tohbase:metanewRegionInfos- the newRegionInfoentries to add to the filesystem- Returns:
- a list of
RegionInfoentries for whichhbase:metaentries were successfully created
-
fixOverlaps
Fix overlaps noted in CJ consistency report.- Throws:
IOException
-
calculateMerges
static List<SortedSet<RegionInfo>> calculateMerges(int maxMergeCount, List<Pair<RegionInfo, RegionInfo>> overlaps) Run throughoverlapsand return a list of merges to run. Presumes overlaps are ordered (which they are coming out of the CatalogJanitor consistency report).- Parameters:
maxMergeCount- Maximum regions to merge at a time (avoid merging 100k regions in one go!)
-
calculateTableMerges
private static void calculateTableMerges(int maxMergeCount, List<SortedSet<RegionInfo>> merges, Collection<Pair<RegionInfo, RegionInfo>> overlaps) -
getRegionInfoWithLargestEndKey
- Returns:
- Either
aorb, whichever has the endkey that is furthest along in the Table.
-
isOverlap
- Returns:
- True if an overlap found between passed in
riand thepair. Does NOT check the pairs themselves overlap.
-