@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.SplitParentFirstComparator
Compare HRegionInfos in a way that has split parents sort BEFORE their daughters.
|
Modifier and Type | Field and Description |
---|---|
private AtomicBoolean |
alreadyRunning |
static int |
DEFAULT_HBASE_CATALOGJANITOR_INTERVAL |
private AtomicBoolean |
enabled |
private CatalogJanitorReport |
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 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() |
CatalogJanitorReport |
getLastReport()
Returns Returns last published Report that comes of last successful scan of hbase:meta.
|
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:meta table looking for garbage to collect. |
protected CatalogJanitorReport |
scanForReport()
Scan hbase:meta.
|
boolean |
setEnabled(boolean enabled) |
private void |
updateAssignmentManagerMetrics() |
cancel, cancel, choreForTesting, cleanup, getInitialDelay, getName, getPeriod, getStopper, getTimeUnit, isInitialChoreComplete, isScheduled, run, shutdown, shutdown, toString, triggerNow
public static final int DEFAULT_HBASE_CATALOGJANITOR_INTERVAL
private static final org.slf4j.Logger LOG
private final AtomicBoolean alreadyRunning
private final AtomicBoolean enabled
private final MasterServices services
private volatile CatalogJanitorReport lastReport
public CatalogJanitor(MasterServices services)
protected boolean initialChore()
ScheduledChore
initialChore
in class ScheduledChore
public boolean setEnabled(boolean enabled)
public boolean getEnabled()
protected void chore()
ScheduledChore
chore
in class ScheduledChore
private static boolean isMetaLoaded(AssignmentManager am)
private static boolean isRIT(AssignmentManager am)
public int scan() throws IOException
hbase:meta
table looking for garbage to collect.IOException
protected CatalogJanitorReport scanForReport() throws IOException
CatalogJanitorReport
IOException
public CatalogJanitorReport getLastReport()
private boolean cleanMergeRegion(RegionInfo mergedRegion, List<RegionInfo> parents) throws IOException
IOException
static boolean cleanParent(MasterServices services, RegionInfo parent, Result rowContent) throws IOException
IOException
private boolean cleanParent(RegionInfo parent, Result rowContent) throws IOException
parent
- RegionInfo of split offlined parentrowContent
- Content of parent
row in metaRegionName
parent
from meta table and from the filesystem.IOException
private 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 regionIOException
private TableDescriptor getDescriptor(TableName tableName) throws IOException
IOException
private void updateAssignmentManagerMetrics()
private static void checkLog4jProperties()
public static void main(String[] args) throws IOException
IOException
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.