@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 | 
|---|---|
| (package private) static class  | CatalogJanitor.SplitParentFirstComparatorCompare 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 Report | lastReportSaved 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 static Pair<Boolean,Boolean> | checkDaughterInFs(MasterServices services,
                 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 | 
| 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) static boolean | cleanParent(MasterServices services,
           RegionInfo parent,
           Result rowContent) | 
| private boolean | cleanParent(RegionInfo parent,
           Result rowContent)If daughters no longer hold reference to the parents, delete the parent. | 
| private TableDescriptor | getDescriptor(TableName tableName) | 
| boolean | getEnabled() | 
| Report | getLastReport() | 
| private static 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. | 
| int | scan()Run janitorial scan of catalog  hbase:metatable looking for garbage to collect. | 
| protected Report | scanForReport()Scan hbase:meta. | 
| 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 Report lastReport
public CatalogJanitor(MasterServices services)
protected boolean initialChore()
ScheduledChoreinitialChore in class ScheduledChorepublic boolean setEnabled(boolean enabled)
public boolean getEnabled()
protected void chore()
ScheduledChorechore in class ScheduledChoreprivate static boolean isMetaLoaded(AssignmentManager am)
private static boolean isRIT(AssignmentManager am)
public int scan() throws IOException
hbase:meta table looking for garbage to collect.IOExceptionprotected Report scanForReport() throws IOException
ReportIOExceptionpublic Report getLastReport()
private boolean cleanMergeRegion(RegionInfo mergedRegion, List<RegionInfo> parents) throws IOException
IOExceptionstatic boolean cleanParent(MasterServices services, RegionInfo parent, Result rowContent) throws IOException
IOExceptionprivate boolean 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 static 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 static Pair<Boolean,Boolean> checkDaughterInFs(MasterServices services, RegionInfo parent, RegionInfo daughter) throws IOException
parent - Parent regiondaughter - Daughter regionIOExceptionprivate TableDescriptor getDescriptor(TableName tableName) throws IOException
IOExceptionprivate static void checkLog4jProperties()
public static void main(String[] args) throws IOException
IOExceptionCopyright © 2007–2021 The Apache Software Foundation. All rights reserved.