@InterfaceAudience.LimitedPrivate(value="Tools") @InterfaceStability.Evolving public class HBaseFsck extends org.apache.hadoop.conf.Configured implements Closeable
Region consistency checks verify that hbase:meta, region deployment on region servers and the state of data in HDFS (.regioninfo files) all are in accordance.
Table integrity checks verify that all possible row keys resolve to exactly one region of a table. This means there are no individual degenerate or backwards regions; no holes between regions; and that there are no overlapping regions.
The general repair strategy works in two phases:
For table integrity repairs, the tables' region directories are scanned for .regioninfo files. Each table's integrity is then verified. If there are any orphan regions (regions with no .regioninfo files) or holes, new regions are fabricated. Backwards regions are sidelined as well as empty degenerate (endkey==startkey) regions. If there are any overlapping regions, a new region is created and all data is merged into the new region.
Table integrity repairs deal solely with HDFS and could potentially be done offline -- the hbase region servers or master do not need to be running. This phase can eventually be used to completely reconstruct the hbase:meta table in an offline fashion.
Region consistency requires three conditions -- 1) valid .regioninfo file present in an HDFS region dir, 2) valid row with .regioninfo data in META, and 3) a region is deployed only at the regionserver that was assigned to with proper state in the master.
Region consistency repairs require hbase to be online so that hbck can contact the HBase master and region servers. The hbck#connect() method must first be called successfully. Much of the region consistency information is transient and less risky to repair.
If hbck is run from the command line, there are a handful of arguments that
can be used to limit the kinds of repairs hbck will do. See the code in
printUsageAndExit()
for more details.
Modifier and Type | Class and Description |
---|---|
(package private) class |
HBaseFsck.CheckRegionConsistencyWorkItem |
private static class |
HBaseFsck.FileLockCallable |
(package private) static class |
HBaseFsck.HBaseFsckTool
This is a Tool wrapper that gathers -Dxxx=yyy configuration settings from the command line.
|
(package private) static class |
HBaseFsck.PrintingErrorReporter |
private static class |
HBaseFsck.RegionBoundariesInformation |
(package private) class |
HBaseFsck.WorkItemHdfsDir
Contact hdfs and get all information about specified table directory into
regioninfo list.
|
(package private) static class |
HBaseFsck.WorkItemHdfsRegionInfo
Contact hdfs and get all information about specified table directory into
regioninfo list.
|
(package private) static class |
HBaseFsck.WorkItemOverlapMerge |
(package private) static class |
HBaseFsck.WorkItemRegion
Contact a region server and get all information from it
|
Modifier and Type | Field and Description |
---|---|
private Admin |
admin |
private boolean |
checkHdfs |
private boolean |
checkMetaOnly |
private boolean |
checkRegionBoundaries |
private ClusterConnection |
connection |
private RetryCounterFactory |
createZNodeRetryCounterFactory |
private static int |
DEFAULT_CREATE_ZNODE_ATTEMPT_MAX_SLEEP_TIME |
private static int |
DEFAULT_CREATE_ZNODE_ATTEMPT_SLEEP_INTERVAL |
private static int |
DEFAULT_LOCK_FILE_ATTEMPT_MAX_SLEEP_TIME |
private static int |
DEFAULT_LOCK_FILE_ATTEMPT_SLEEP_INTERVAL |
private static int |
DEFAULT_MAX_CREATE_ZNODE_ATTEMPTS |
private static int |
DEFAULT_MAX_LOCK_FILE_ATTEMPTS |
private static int |
DEFAULT_MAX_MERGE |
private static int |
DEFAULT_OVERLAPS_TO_SIDELINE |
static long |
DEFAULT_SLEEP_BEFORE_RERUN |
static long |
DEFAULT_TIME_LAG |
private static int |
DEFAULT_WAIT_FOR_LOCK_TIMEOUT |
private static boolean |
details
Options
|
private Set<Result> |
emptyRegionInfoQualifiers |
private HbckErrorReporter |
errors
State
|
protected ExecutorService |
executor |
private boolean |
fixAny |
private boolean |
fixAssignments |
private boolean |
fixEmptyMetaCells |
(package private) int |
fixes |
private boolean |
fixHdfsHoles |
private boolean |
fixHdfsOrphans |
private boolean |
fixHdfsOverlaps |
private boolean |
fixHFileLinks |
private boolean |
fixMeta |
private boolean |
fixReferenceFiles |
private boolean |
fixReplication |
private boolean |
fixSplitParents |
private boolean |
fixTableOrphans |
private boolean |
fixVersionFile |
private static boolean |
forceExclusive |
static String |
HBCK_LOCK_FILE
Here is where hbase-1.x used to default the lock for hbck1.
|
private org.apache.hadoop.fs.Path |
HBCK_LOCK_PATH |
private String |
hbckEphemeralNodePath |
private AtomicBoolean |
hbckLockCleanup |
private org.apache.hadoop.fs.FSDataOutputStream |
hbckOutFd |
private boolean |
hbckZodeCreated |
private HFileCorruptionChecker |
hfcc |
private boolean |
ignorePreCheckPermission |
private RetryCounterFactory |
lockFileRetryCounterFactory |
private static org.slf4j.Logger |
LOG
Internal resources
|
private static int |
MAX_NUM_THREADS |
private int |
maxMerge |
private int |
maxOverlapsToSideline |
private Table |
meta |
private List<HbckRegionInfo> |
orphanHdfsDirs
When initially looking at HDFS, we attempt to find any orphaned data.
|
private Map<TableName,Set<String>> |
orphanTableDirs |
private TreeMap<String,HbckRegionInfo> |
regionInfoMap
This map contains the state of all hbck items.
|
private boolean |
removeParents |
private boolean |
rerun |
private int |
retcode |
private static boolean |
rsSupportsOffline |
private boolean |
sidelineBigOverlaps |
private org.apache.hadoop.fs.Path |
sidelineDir |
private Map<TableName,Set<String>> |
skippedRegions |
private long |
startMillis |
private ClusterMetrics |
status |
private static boolean |
summary |
private Set<TableName> |
tablesIncluded |
private SortedMap<TableName,HbckTableInfo> |
tablesInfo
This map from Tablename -> TableInfo contains the structures necessary to
detect table consistency problems (holes, dupes, overlaps).
|
private Map<TableName,TableState> |
tableStates |
private long |
timelag |
private static Set<String> |
unsupportedOptionsInV2 |
private ZKWatcher |
zkw |
Constructor and Description |
---|
HBaseFsck(org.apache.hadoop.conf.Configuration conf)
Constructor
|
HBaseFsck(org.apache.hadoop.conf.Configuration conf,
ExecutorService exec)
Constructor
|
Modifier and Type | Method and Description |
---|---|
private void |
addSkippedRegion(HbckRegionInfo hbi) |
private void |
adoptHdfsOrphan(HbckRegionInfo hi)
Orphaned regions are regions without a .regioninfo file in them.
|
private void |
adoptHdfsOrphans(Collection<HbckRegionInfo> orphanHdfsDirs)
Iterates through the list of all orphan/invalid regiondirs.
|
private void |
assignMetaReplica(int replicaId) |
private void |
checkAndFixConsistency()
Check consistency of all regions that have been found in previous phases.
|
private void |
checkAndFixReplication() |
private void |
checkAndFixTableStates()
Check and fix table states, assumes full info available:
- tableInfos
- empty tables loaded
|
static Pair<org.apache.hadoop.fs.Path,org.apache.hadoop.fs.FSDataOutputStream> |
checkAndMarkRunningHbck(org.apache.hadoop.conf.Configuration conf,
RetryCounter retryCounter)
This method maintains a lock using a file.
|
private SortedMap<TableName,HbckTableInfo> |
checkHdfsIntegrity(boolean fixHoles,
boolean fixOverlaps) |
(package private) SortedMap<TableName,HbckTableInfo> |
checkIntegrity()
Checks tables integrity.
|
(package private) boolean |
checkMetaRegion()
Check values in regionInfo for hbase:meta
Check if zero or more than one regions with hbase:meta are found.
|
void |
checkRegionBoundaries() |
private void |
checkRegionConsistency(String key,
HbckRegionInfo hbi)
Check a single region for consistency and correct deployment.
|
private void |
checkRegionConsistencyConcurrently(List<HBaseFsck.CheckRegionConsistencyWorkItem> workItems)
Check consistency of all regions using mulitple threads concurrently.
|
private void |
cleanupHbckZnode() |
private void |
clearState()
Clear the current state of hbck.
|
void |
close() |
(package private) void |
closeRegion(HbckRegionInfo hi)
Attempts to undeploy a region from a region server based in information in
META.
|
void |
connect()
To repair region consistency, one must call connect() in order to repair
online state.
|
protected HFileCorruptionChecker |
createHFileCorruptionChecker(boolean sidelineCorruptHFiles) |
static RetryCounterFactory |
createLockRetryCounterFactory(org.apache.hadoop.conf.Configuration conf) |
private static ExecutorService |
createThreadPool(org.apache.hadoop.conf.Configuration conf) |
private static RetryCounterFactory |
createZnodeRetryCounterFactory(org.apache.hadoop.conf.Configuration conf) |
private ZKWatcher |
createZooKeeperWatcher() |
static void |
debugLsr(org.apache.hadoop.conf.Configuration conf,
org.apache.hadoop.fs.Path p)
ls -r for debugging purposes
|
static void |
debugLsr(org.apache.hadoop.conf.Configuration conf,
org.apache.hadoop.fs.Path p,
HbckErrorReporter errors)
ls -r for debugging purposes
|
(package private) void |
debugLsr(org.apache.hadoop.fs.Path p)
ls -r for debugging purposes
|
private void |
deleteMetaRegion(byte[] metaKey)
Deletes region from meta table
|
private void |
deleteMetaRegion(HbckRegionInfo hi)
Deletes region from meta table
|
HBaseFsck |
exec(ExecutorService exec,
String[] args) |
private boolean |
fabricateTableInfo(FSTableDescriptors fstd,
TableName tableName,
Set<String> columns)
To fabricate a .tableinfo file with following contents
1. |
void |
fixEmptyMetaCells()
To fix the empty REGIONINFO_QUALIFIER rows from hbase:meta
|
void |
fixOrphanTables()
To fix orphan table by creating a .tableinfo file under tableDir
1. |
private Set<String> |
getColumnFamilyList(Set<String> columns,
HbckRegionInfo hbi)
To get the column family list according to the column family dirs
|
(package private) static HbckErrorReporter |
getErrorReporter(org.apache.hadoop.conf.Configuration conf) |
HbckErrorReporter |
getErrors() |
HFileCorruptionChecker |
getHFilecorruptionChecker() |
(package private) Set<TableName> |
getIncludedTables() |
int |
getMaxMerge() |
int |
getMaxOverlapsToSideline() |
private ServerName |
getMetaRegionServerName(int replicaId) |
private HbckRegionInfo |
getOrCreateInfo(String name)
Gets the entry in regionInfo corresponding to the the given encoded
region name.
|
int |
getRetCode() |
(package private) org.apache.hadoop.fs.Path |
getSidelineDir() |
(package private) TableDescriptor[] |
getTableDescriptors(List<TableName> tableNames) |
(package private) TableDescriptor[] |
getTables(AtomicInteger numSkipped)
Return a list of user-space table names whose metadata have not been
modified in the last few milliseconds specified by timelag
if any of the REGIONINFO_QUALIFIER, SERVER_QUALIFIER, STARTCODE_QUALIFIER,
SPLITA_QUALIFIER, SPLITB_QUALIFIER have not changed in the last
milliseconds specified by timelag, then the table is a candidate to be returned.
|
static org.apache.hadoop.fs.Path |
getTmpDir(org.apache.hadoop.conf.Configuration conf) |
void |
includeTable(TableName table) |
boolean |
isExclusive()
Only one instance of hbck can modify HBase at a time.
|
private boolean |
isOptionsSupported(String[] args) |
(package private) boolean |
isTableDisabled(TableName tableName)
Check if the specified region's table is disabled.
|
(package private) boolean |
isTableIncluded(TableName table)
Only check/fix tables specified by the list,
Empty list means all tables are included.
|
static byte[] |
keyOnly(byte[] b) |
private void |
loadDeployedRegions()
Get deployed regions according to the region servers.
|
void |
loadHdfsRegionDirs()
Scan HDFS for all regions, recording their information into
regionInfoMap
|
private SortedMap<TableName,HbckTableInfo> |
loadHdfsRegionInfos()
Populate hbi's from regionInfos loaded from file system.
|
(package private) boolean |
loadMetaEntries()
Scan hbase:meta, adding all regions found to the regionInfo map.
|
private void |
loadTableInfosForTablesWithNoRegion()
Loads table info's for tables that may not have been included, since there are no
regions reported for the table, but table dir is there in hdfs
|
private void |
loadTableStates()
Load the list of disabled tables in ZK into local set.
|
private void |
logParallelMerge()
Log an appropriate message about whether or not overlapping merges are computed in parallel.
|
static void |
main(String[] args)
Main program
|
int |
mergeRegionDirs(org.apache.hadoop.fs.Path targetRegionDir,
HbckRegionInfo contained)
Merge hdfs data by moving from contained HbckRegionInfo into targetRegionDir.
|
(package private) void |
offline(byte[] regionName)
This backwards-compatibility wrapper for permanently offlining a region
that should not be alive.
|
void |
offlineHdfsIntegrityRepair()
This repair method analyzes hbase data in hdfs and repairs it to satisfy
the table integrity rules.
|
private void |
offlineHLinkFileRepair()
Scan all the store file names to find any lingering HFileLink files,
which refer to some none-exiting files.
|
private void |
offlineReferenceFileRepair()
Scan all the store file names to find any lingering reference files,
which refer to some none-exiting files.
|
int |
onlineConsistencyRepair()
This repair method requires the cluster to be online since it contacts
region servers and the masters.
|
int |
onlineHbck()
Contacts the master and prints out cluster-wide information
|
private void |
preCheckPermission() |
private void |
printTableSummary(SortedMap<TableName,HbckTableInfo> tablesInfo)
Prints summary of all tables found on the system.
|
protected HBaseFsck |
printUsageAndExit() |
(package private) void |
processRegionServers(Collection<ServerName> regionServerList)
Contacts each regionserver and fetches metadata about regions.
|
private boolean |
recordMetaRegion()
Record the location of the hbase:meta region as found in ZooKeeper.
|
private void |
reportEmptyMetaCells()
TODO -- need to add tests for this.
|
private void |
reportTablesInFlux()
TODO -- need to add tests for this.
|
private void |
resetSplitParent(HbckRegionInfo hi)
Reset the split parent region info in meta table
|
private int |
restoreHdfsIntegrity()
This method determines if there are table integrity errors in HDFS.
|
void |
setCheckHdfs(boolean checking) |
(package private) void |
setCheckMetaOnly()
Set hbase:meta check mode.
|
static void |
setDisplayFullReport()
Display the full report from fsck.
|
void |
setFixAssignments(boolean shouldFix)
Fix inconsistencies found by fsck.
|
void |
setFixEmptyMetaCells(boolean shouldFix) |
void |
setFixHdfsHoles(boolean shouldFix) |
void |
setFixHdfsOrphans(boolean shouldFix) |
void |
setFixHdfsOverlaps(boolean shouldFix) |
void |
setFixHFileLinks(boolean shouldFix) |
void |
setFixMeta(boolean shouldFix) |
void |
setFixReferenceFiles(boolean shouldFix) |
void |
setFixReplication(boolean shouldFix)
Set replication fix mode.
|
void |
setFixSplitParents(boolean shouldFix) |
void |
setFixTableOrphans(boolean shouldFix) |
void |
setFixVersionFile(boolean shouldFix) |
static void |
setForceExclusive()
Set exclusive mode.
|
void |
setHFileCorruptionChecker(HFileCorruptionChecker hfcc) |
void |
setIgnorePreCheckPermission(boolean ignorePreCheckPermission) |
private boolean |
setMasterInMaintenanceMode()
This method maintains an ephemeral znode.
|
void |
setMaxMerge(int mm) |
void |
setMaxOverlapsToSideline(int mo) |
(package private) void |
setRegionBoundariesCheck()
Set region boundaries check mode.
|
void |
setRemoveParents(boolean shouldFix) |
void |
setRetCode(int code) |
(package private) void |
setShouldRerun()
Check if we should rerun fsck again.
|
void |
setSidelineBigOverlaps(boolean sbo) |
void |
setSidelineDir(String sidelineDir) |
(package private) static void |
setSummary()
Set summary mode.
|
void |
setTimeLag(long seconds)
We are interested in only those tables that have not changed their state in
hbase:meta during the last few seconds specified by hbase.admin.fsck.timelag
|
(package private) boolean |
shouldCheckHdfs() |
static boolean |
shouldDisplayFullReport() |
(package private) boolean |
shouldFixAssignments() |
(package private) boolean |
shouldFixEmptyMetaCells() |
(package private) boolean |
shouldFixHdfsHoles() |
(package private) boolean |
shouldFixHdfsOrphans() |
(package private) boolean |
shouldFixHdfsOverlaps() |
(package private) boolean |
shouldFixHFileLinks() |
(package private) boolean |
shouldFixMeta() |
(package private) boolean |
shouldFixReferenceFiles() |
(package private) boolean |
shouldFixSplitParents() |
(package private) boolean |
shouldFixTableOrphans() |
boolean |
shouldFixVersionFile() |
boolean |
shouldIgnorePreCheckPermission() |
(package private) boolean |
shouldRemoveParents() |
(package private) boolean |
shouldRerun() |
boolean |
shouldSidelineBigOverlaps() |
private boolean |
sidelineFile(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path hbaseRoot,
org.apache.hadoop.fs.Path path) |
(package private) org.apache.hadoop.fs.Path |
sidelineRegionDir(org.apache.hadoop.fs.FileSystem fs,
HbckRegionInfo hi)
Sideline a region dir (instead of deleting it)
|
(package private) org.apache.hadoop.fs.Path |
sidelineRegionDir(org.apache.hadoop.fs.FileSystem fs,
String parentDir,
HbckRegionInfo hi)
Sideline a region dir (instead of deleting it)
|
private void |
tryAssignmentRepair(HbckRegionInfo hbi,
String msg) |
private void |
unassignMetaReplica(HbckRegionInfo hi) |
private void |
undeployRegions(HbckRegionInfo hi) |
private void |
undeployRegionsForHbi(HbckRegionInfo hi) |
private void |
unlockHbck() |
public static final long DEFAULT_TIME_LAG
public static final long DEFAULT_SLEEP_BEFORE_RERUN
private static final int MAX_NUM_THREADS
private static boolean rsSupportsOffline
private static final int DEFAULT_OVERLAPS_TO_SIDELINE
private static final int DEFAULT_MAX_MERGE
public static final String HBCK_LOCK_FILE
private static final int DEFAULT_MAX_LOCK_FILE_ATTEMPTS
private static final int DEFAULT_LOCK_FILE_ATTEMPT_SLEEP_INTERVAL
private static final int DEFAULT_LOCK_FILE_ATTEMPT_MAX_SLEEP_TIME
private static final int DEFAULT_WAIT_FOR_LOCK_TIMEOUT
private static final int DEFAULT_MAX_CREATE_ZNODE_ATTEMPTS
private static final int DEFAULT_CREATE_ZNODE_ATTEMPT_SLEEP_INTERVAL
private static final int DEFAULT_CREATE_ZNODE_ATTEMPT_MAX_SLEEP_TIME
private static final org.slf4j.Logger LOG
private ClusterMetrics status
private ClusterConnection connection
protected ExecutorService executor
private long startMillis
private HFileCorruptionChecker hfcc
private int retcode
private org.apache.hadoop.fs.Path HBCK_LOCK_PATH
private org.apache.hadoop.fs.FSDataOutputStream hbckOutFd
private final AtomicBoolean hbckLockCleanup
private static final Set<String> unsupportedOptionsInV2
private static boolean details
private long timelag
private static boolean forceExclusive
private boolean fixAssignments
private boolean fixMeta
private boolean checkHdfs
private boolean fixHdfsHoles
private boolean fixHdfsOverlaps
private boolean fixHdfsOrphans
private boolean fixTableOrphans
private boolean fixVersionFile
private boolean fixSplitParents
private boolean removeParents
private boolean fixReferenceFiles
private boolean fixHFileLinks
private boolean fixEmptyMetaCells
private boolean fixReplication
private boolean fixAny
private Set<TableName> tablesIncluded
private int maxMerge
private int maxOverlapsToSideline
private boolean sidelineBigOverlaps
private org.apache.hadoop.fs.Path sidelineDir
private boolean rerun
private static boolean summary
private boolean checkMetaOnly
private boolean checkRegionBoundaries
private boolean ignorePreCheckPermission
private final HbckErrorReporter errors
int fixes
private TreeMap<String,HbckRegionInfo> regionInfoMap
private Set<Result> emptyRegionInfoQualifiers
private SortedMap<TableName,HbckTableInfo> tablesInfo
private List<HbckRegionInfo> orphanHdfsDirs
private Map<TableName,Set<String>> orphanTableDirs
private Map<TableName,TableState> tableStates
private final RetryCounterFactory lockFileRetryCounterFactory
private final RetryCounterFactory createZNodeRetryCounterFactory
private Map<TableName,Set<String>> skippedRegions
private String hbckEphemeralNodePath
private boolean hbckZodeCreated
public HBaseFsck(org.apache.hadoop.conf.Configuration conf) throws MasterNotRunningException, ZooKeeperConnectionException, IOException, ClassNotFoundException
conf
- Configuration objectMasterNotRunningException
- if the master is not runningZooKeeperConnectionException
- if unable to connect to ZooKeeperIOException
ClassNotFoundException
public HBaseFsck(org.apache.hadoop.conf.Configuration conf, ExecutorService exec) throws MasterNotRunningException, ZooKeeperConnectionException, IOException, ClassNotFoundException
conf
- Configuration objectMasterNotRunningException
- if the master is not runningZooKeeperConnectionException
- if unable to connect to ZooKeeperIOException
ClassNotFoundException
private static ExecutorService createThreadPool(org.apache.hadoop.conf.Configuration conf)
public static RetryCounterFactory createLockRetryCounterFactory(org.apache.hadoop.conf.Configuration conf)
private static RetryCounterFactory createZnodeRetryCounterFactory(org.apache.hadoop.conf.Configuration conf)
public static org.apache.hadoop.fs.Path getTmpDir(org.apache.hadoop.conf.Configuration conf) throws IOException
IOException
public static Pair<org.apache.hadoop.fs.Path,org.apache.hadoop.fs.FSDataOutputStream> checkAndMarkRunningHbck(org.apache.hadoop.conf.Configuration conf, RetryCounter retryCounter) throws IOException
IOException
- if IO failure occursprivate void unlockHbck()
public void connect() throws IOException
IOException
private void loadDeployedRegions() throws IOException, InterruptedException
IOException
InterruptedException
private void clearState()
public void offlineHdfsIntegrityRepair() throws IOException, InterruptedException
IOException
InterruptedException
public int onlineConsistencyRepair() throws IOException, org.apache.zookeeper.KeeperException, InterruptedException
IOException
org.apache.zookeeper.KeeperException
InterruptedException
private boolean setMasterInMaintenanceMode() throws IOException
IOException
- if IO failure occursprivate void cleanupHbckZnode()
public int onlineHbck() throws IOException, org.apache.zookeeper.KeeperException, InterruptedException
IOException
org.apache.zookeeper.KeeperException
InterruptedException
public static byte[] keyOnly(byte[] b)
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
public void checkRegionBoundaries()
private void adoptHdfsOrphans(Collection<HbckRegionInfo> orphanHdfsDirs) throws IOException
IOException
private void adoptHdfsOrphan(HbckRegionInfo hi) throws IOException
IOException
private int restoreHdfsIntegrity() throws IOException, InterruptedException
IOException
InterruptedException
private void offlineReferenceFileRepair() throws IOException, InterruptedException
Lingering reference file prevents a region from opening. It has to be fixed before a cluster can start properly.
IOException
InterruptedException
private void offlineHLinkFileRepair() throws IOException, InterruptedException
IOException
InterruptedException
private boolean sidelineFile(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path hbaseRoot, org.apache.hadoop.fs.Path path) throws IOException
IOException
private void reportEmptyMetaCells()
private void reportTablesInFlux()
public HbckErrorReporter getErrors()
private SortedMap<TableName,HbckTableInfo> loadHdfsRegionInfos() throws IOException, InterruptedException
IOException
InterruptedException
private Set<String> getColumnFamilyList(Set<String> columns, HbckRegionInfo hbi) throws IOException
columns
- hbi
- IOException
private boolean fabricateTableInfo(FSTableDescriptors fstd, TableName tableName, Set<String> columns) throws IOException
TableDescriptor
and ColumnFamilyDescriptor
IOException
public void fixEmptyMetaCells() throws IOException
IOException
public void fixOrphanTables() throws IOException
TableDescriptor
and ColumnFamilyDescriptor
IOException
private void logParallelMerge()
private SortedMap<TableName,HbckTableInfo> checkHdfsIntegrity(boolean fixHoles, boolean fixOverlaps) throws IOException
IOException
org.apache.hadoop.fs.Path getSidelineDir() throws IOException
IOException
org.apache.hadoop.fs.Path sidelineRegionDir(org.apache.hadoop.fs.FileSystem fs, HbckRegionInfo hi) throws IOException
IOException
org.apache.hadoop.fs.Path sidelineRegionDir(org.apache.hadoop.fs.FileSystem fs, String parentDir, HbckRegionInfo hi) throws IOException
parentDir
- if specified, the region will be sidelined to folder like
.../parentDir/<table name>/<region name>. The purpose is to group together
similar regions sidelined, for example, those regions should be bulk loaded back later
on. If NULL, it is ignored.IOException
private void loadTableStates() throws IOException
boolean isTableDisabled(TableName tableName)
tableName
- table to check status ofpublic void loadHdfsRegionDirs() throws IOException, InterruptedException
IOException
InterruptedException
private boolean recordMetaRegion() throws IOException
IOException
private ZKWatcher createZooKeeperWatcher() throws IOException
IOException
private ServerName getMetaRegionServerName(int replicaId) throws IOException, org.apache.zookeeper.KeeperException
IOException
org.apache.zookeeper.KeeperException
void processRegionServers(Collection<ServerName> regionServerList) throws IOException, InterruptedException
regionServerList
- - the list of region servers to connect toIOException
- if a remote or network exception occursInterruptedException
private void checkAndFixConsistency() throws IOException, org.apache.zookeeper.KeeperException, InterruptedException
IOException
org.apache.zookeeper.KeeperException
InterruptedException
private void checkRegionConsistencyConcurrently(List<HBaseFsck.CheckRegionConsistencyWorkItem> workItems) throws IOException, org.apache.zookeeper.KeeperException, InterruptedException
IOException
org.apache.zookeeper.KeeperException
InterruptedException
private void addSkippedRegion(HbckRegionInfo hbi)
private void checkAndFixTableStates() throws IOException
IOException
private void preCheckPermission() throws IOException, AccessDeniedException
IOException
AccessDeniedException
private void deleteMetaRegion(HbckRegionInfo hi) throws IOException
IOException
private void deleteMetaRegion(byte[] metaKey) throws IOException
IOException
private void resetSplitParent(HbckRegionInfo hi) throws IOException
IOException
void offline(byte[] regionName) throws IOException
IOException
void closeRegion(HbckRegionInfo hi) throws IOException, InterruptedException
IOException
InterruptedException
private void undeployRegions(HbckRegionInfo hi) throws IOException, InterruptedException
IOException
InterruptedException
private void undeployRegionsForHbi(HbckRegionInfo hi) throws IOException, InterruptedException
IOException
InterruptedException
private void tryAssignmentRepair(HbckRegionInfo hbi, String msg) throws IOException, org.apache.zookeeper.KeeperException, InterruptedException
IOException
org.apache.zookeeper.KeeperException
InterruptedException
private void checkRegionConsistency(String key, HbckRegionInfo hbi) throws IOException, org.apache.zookeeper.KeeperException, InterruptedException
IOException
org.apache.zookeeper.KeeperException
InterruptedException
SortedMap<TableName,HbckTableInfo> checkIntegrity() throws IOException
IOException
private void loadTableInfosForTablesWithNoRegion() throws IOException
IOException
public int mergeRegionDirs(org.apache.hadoop.fs.Path targetRegionDir, HbckRegionInfo contained) throws IOException
IOException
TableDescriptor[] getTables(AtomicInteger numSkipped)
IOException
- if an error is encounteredTableDescriptor[] getTableDescriptors(List<TableName> tableNames)
private HbckRegionInfo getOrCreateInfo(String name)
private void checkAndFixReplication() throws IOException
IOException
boolean checkMetaRegion() throws IOException, org.apache.zookeeper.KeeperException, InterruptedException
IOException
- from HBaseFsckRepair functionsorg.apache.zookeeper.KeeperException
InterruptedException
private void unassignMetaReplica(HbckRegionInfo hi) throws IOException, InterruptedException, org.apache.zookeeper.KeeperException
IOException
InterruptedException
org.apache.zookeeper.KeeperException
private void assignMetaReplica(int replicaId) throws IOException, org.apache.zookeeper.KeeperException, InterruptedException
IOException
org.apache.zookeeper.KeeperException
InterruptedException
boolean loadMetaEntries() throws IOException
IOException
- if an error is encounteredprivate void printTableSummary(SortedMap<TableName,HbckTableInfo> tablesInfo)
static HbckErrorReporter getErrorReporter(org.apache.hadoop.conf.Configuration conf) throws ClassNotFoundException
ClassNotFoundException
public static void setDisplayFullReport()
public static boolean shouldDisplayFullReport()
public static void setForceExclusive()
public boolean isExclusive()
static void setSummary()
void setCheckMetaOnly()
void setRegionBoundariesCheck()
public void setFixReplication(boolean shouldFix)
void setShouldRerun()
boolean shouldRerun()
public void setFixAssignments(boolean shouldFix)
boolean shouldFixAssignments()
public void setFixMeta(boolean shouldFix)
boolean shouldFixMeta()
public void setFixEmptyMetaCells(boolean shouldFix)
boolean shouldFixEmptyMetaCells()
public void setCheckHdfs(boolean checking)
boolean shouldCheckHdfs()
public void setFixHdfsHoles(boolean shouldFix)
boolean shouldFixHdfsHoles()
public void setFixTableOrphans(boolean shouldFix)
boolean shouldFixTableOrphans()
public void setFixHdfsOverlaps(boolean shouldFix)
boolean shouldFixHdfsOverlaps()
public void setFixHdfsOrphans(boolean shouldFix)
boolean shouldFixHdfsOrphans()
public void setFixVersionFile(boolean shouldFix)
public boolean shouldFixVersionFile()
public void setSidelineBigOverlaps(boolean sbo)
public boolean shouldSidelineBigOverlaps()
public void setFixSplitParents(boolean shouldFix)
public void setRemoveParents(boolean shouldFix)
boolean shouldFixSplitParents()
boolean shouldRemoveParents()
public void setFixReferenceFiles(boolean shouldFix)
boolean shouldFixReferenceFiles()
public void setFixHFileLinks(boolean shouldFix)
boolean shouldFixHFileLinks()
public boolean shouldIgnorePreCheckPermission()
public void setIgnorePreCheckPermission(boolean ignorePreCheckPermission)
public void setMaxMerge(int mm)
mm
- maximum number of regions to merge into a single region.public int getMaxMerge()
public void setMaxOverlapsToSideline(int mo)
public int getMaxOverlapsToSideline()
boolean isTableIncluded(TableName table)
public void includeTable(TableName table)
Set<TableName> getIncludedTables()
public void setTimeLag(long seconds)
seconds
- - the time in secondspublic void setSidelineDir(String sidelineDir)
sidelineDir
- - HDFS path to sideline dataprotected HFileCorruptionChecker createHFileCorruptionChecker(boolean sidelineCorruptHFiles) throws IOException
IOException
public HFileCorruptionChecker getHFilecorruptionChecker()
public void setHFileCorruptionChecker(HFileCorruptionChecker hfcc)
public void setRetCode(int code)
public int getRetCode()
protected HBaseFsck printUsageAndExit()
public static void main(String[] args) throws Exception
args
- Exception
public HBaseFsck exec(ExecutorService exec, String[] args) throws org.apache.zookeeper.KeeperException, IOException, InterruptedException
org.apache.zookeeper.KeeperException
IOException
InterruptedException
private boolean isOptionsSupported(String[] args)
void debugLsr(org.apache.hadoop.fs.Path p) throws IOException
IOException
public static void debugLsr(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.Path p) throws IOException
IOException
public static void debugLsr(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.Path p, HbckErrorReporter errors) throws IOException
IOException
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.