@InterfaceAudience.Private public class CatalogJanitor extends ScheduledChore
hbase:meta catalog
table on a period. Makes a lastReport on state of hbase:meta. Looks for unused
regions to garbage collect. Scan of hbase:meta runs if we are NOT in maintenance
mode, if we are NOT shutting down, AND if the assignmentmanager is loaded.
Playing it safe, we will garbage collect no-longer needed region references
only if there are no regions-in-transition (RIT).| Modifier and Type | Class and Description |
|---|---|
static class |
CatalogJanitor.Report
Report made by ReportMakingVisitor
|
(package private) static class |
CatalogJanitor.ReportMakingVisitor
Visitor we use in here in CatalogJanitor to go against hbase:meta table.
|
(package private) static class |
CatalogJanitor.SplitParentFirstComparator
Compare HRegionInfos in a way that has split parents sort BEFORE their daughters.
|
| Modifier and Type | Field and Description |
|---|---|
private AtomicBoolean |
alreadyRunning |
private AtomicBoolean |
enabled |
private CatalogJanitor.Report |
lastReport
Saved report from last hbase:meta scan to completion.
|
private static org.slf4j.Logger |
LOG |
private MasterServices |
services |
| Constructor and Description |
|---|
CatalogJanitor(MasterServices services) |
| Modifier and Type | Method and Description |
|---|---|
private Pair<Boolean,Boolean> |
checkDaughterInFs(RegionInfo parent,
RegionInfo daughter)
Checks if a daughter region -- either splitA or splitB -- still holds
references to parent.
|
private static void |
checkLog4jProperties() |
protected void |
chore()
The task to execute on each scheduled execution of the Chore
|
boolean |
cleanMergeQualifier(RegionInfo region)
Checks if the specified region has merge qualifiers, if so, try to clean them.
|
private boolean |
cleanMergeRegion(RegionInfo mergedRegion,
List<RegionInfo> parents)
If merged region no longer holds reference to the merge regions, archive
merge region on hdfs and perform deleting references in hbase:meta
|
(package private) boolean |
cleanParent(RegionInfo parent,
Result rowContent)
If daughters no longer hold reference to the parents, delete the parent.
|
private TableDescriptor |
getDescriptor(TableName tableName) |
(package private) boolean |
getEnabled() |
CatalogJanitor.Report |
getLastReport() |
private boolean |
hasNoReferences(Pair<Boolean,Boolean> p) |
protected boolean |
initialChore()
Override to run a task before we start looping.
|
private static boolean |
isMetaLoaded(AssignmentManager am) |
private static boolean |
isRIT(AssignmentManager am) |
static void |
main(String[] args)
For testing against a cluster.
|
(package private) int |
scan()
Run janitorial scan of catalog
hbase:meta table looking for
garbage to collect. |
(package private) CatalogJanitor.Report |
scanForReport()
Scan hbase:meta.
|
(package private) boolean |
setEnabled(boolean enabled) |
cancel, cancel, choreForTesting, cleanup, getInitialDelay, getName, getPeriod, getStopper, getTimeUnit, isInitialChoreComplete, isScheduled, run, toString, triggerNowprivate static final org.slf4j.Logger LOG
private final AtomicBoolean alreadyRunning
private final AtomicBoolean enabled
private final MasterServices services
private volatile CatalogJanitor.Report lastReport
CatalogJanitor(MasterServices services)
protected boolean initialChore()
ScheduledChoreinitialChore in class ScheduledChoreboolean setEnabled(boolean enabled)
boolean getEnabled()
protected void chore()
ScheduledChorechore in class ScheduledChoreprivate static boolean isMetaLoaded(AssignmentManager am)
private static boolean isRIT(AssignmentManager am)
int scan() throws IOException
hbase:meta table looking for
garbage to collect.IOExceptionCatalogJanitor.Report scanForReport() throws IOException
CatalogJanitor.ReportIOExceptionpublic CatalogJanitor.Report getLastReport()
private boolean cleanMergeRegion(RegionInfo mergedRegion, List<RegionInfo> parents) throws IOException
IOExceptionboolean cleanParent(RegionInfo parent, Result rowContent) throws IOException
parent - RegionInfo of split offlined parentrowContent - Content of parent row in
metaRegionNameparent from meta table and from
the filesystem.IOExceptionprivate boolean hasNoReferences(Pair<Boolean,Boolean> p)
p - A pair where the first boolean says whether or not the daughter
region directory exists in the filesystem and then the second boolean says
whether the daughter has references to the parent.p signifies no references.private Pair<Boolean,Boolean> checkDaughterInFs(RegionInfo parent, RegionInfo daughter) throws IOException
parent - Parent regiondaughter - Daughter regionIOExceptionprivate TableDescriptor getDescriptor(TableName tableName) throws IOException
IOExceptionpublic boolean cleanMergeQualifier(RegionInfo region) throws IOException
IOExceptionprivate static void checkLog4jProperties()
public static void main(String[] args) throws IOException
IOExceptionCopyright © 2007–2019 The Apache Software Foundation. All rights reserved.