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
Modifier and TypeClassDescriptionprivate static class
A union overMetaFixer.Either
andMetaFixer.Either
. -
Field Summary
Modifier and TypeFieldDescriptionprivate static final org.slf4j.Logger
private final MasterServices
private static final int
private static final String
private final int
Maximum for many regions to merge at a time. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprivate static RegionInfo
buildRegionInfo
(TableName tn, byte[] start, byte[] end) (package private) static List<SortedSet<RegionInfo>>
calculateMerges
(int maxMergeCount, List<Pair<RegionInfo, RegionInfo>> overlaps) Run throughoverlaps
and 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 thehbase:meta
for each providedRegionInfo
.private static List<RegionInfo>
Create a newRegionInfo
corresponding to each provided "hole" pair.void
fix()
(package private) void
fixHoles
(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 boolean
isOverlap
(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 newRegionInfo
corresponding to each provided "hole" pair. -
getHoleCover
- Returns:
- Attempts to calculate a new
RegionInfo
that covers the region range described inhole
.
-
buildRegionInfo
-
createMetaEntries
private static List<RegionInfo> createMetaEntries(MasterServices masterServices, List<RegionInfo> newRegionInfos) Create entries in thehbase:meta
for each providedRegionInfo
. Best effort.- Parameters:
masterServices
- used to connect tohbase:meta
newRegionInfos
- the newRegionInfo
entries to add to the filesystem- Returns:
- a list of
RegionInfo
entries for whichhbase:meta
entries 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 throughoverlaps
and 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
a
orb
, whichever has the endkey that is furthest along in the Table.
-
isOverlap
- Returns:
- True if an overlap found between passed in
ri
and thepair
. Does NOT check the pairs themselves overlap.
-