@InterfaceAudience.Private 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
L and R . |
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 |
maxMergeCount
Maximum 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
overlaps and return a list of merges to run. |
private static List<RegionInfo> |
createMetaEntries(MasterServices masterServices,
List<RegionInfo> newRegionInfos)
Create entries in the
hbase:meta for each provided RegionInfo . |
private static List<RegionInfo> |
createRegionInfosForHoles(List<Pair<RegionInfo,RegionInfo>> holes)
Create a new
RegionInfo corresponding to each provided "hole" pair. |
(package private) void |
fix() |
(package private) void |
fixHoles(CatalogJanitor.Report report)
If hole, it papers it over by adding a region in the filesystem and to hbase:meta.
|
(package private) void |
fixOverlaps(CatalogJanitor.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
MetaFixer(MasterServices masterServices)
void fix() throws IOException
IOException
void fixHoles(CatalogJanitor.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:meta
newRegionInfos
- the new RegionInfo
entries to add to the filesystemRegionInfo
entries for which hbase:meta
entries were
successfully createdvoid fixOverlaps(CatalogJanitor.Report report) throws IOException
IOException
static 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!)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–2020 The Apache Software Foundation. All rights reserved.