Package org.apache.hadoop.hbase.util
Class BaseTestHBaseFsck
java.lang.Object
org.apache.hadoop.hbase.util.BaseTestHBaseFsck
- Direct Known Subclasses:
TestHBaseFsckMOB
This is the base class for HBaseFsck's ability to detect reasons for inconsistent tables. Actual
tests are in : TestHBaseFsckTwoRS TestHBaseFsckOneRS TestHBaseFsckMOB TestHBaseFsckReplicas
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class(package private) static class -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static org.apache.hadoop.hbase.client.Adminprotected static org.apache.hadoop.hbase.master.assignment.AssignmentManagerprotected static final org.apache.hadoop.conf.Configurationprotected static org.apache.hadoop.hbase.client.ClusterConnectionprotected static final byte[]protected static final Stringprotected static ScheduledThreadPoolExecutorprotected static final org.slf4j.Loggerorg.junit.rules.TestName(package private) static final intprotected static final intprotected static org.apache.hadoop.hbase.master.assignment.RegionStatesprotected static final byte[][]protected static final byte[][]protected static ExecutorServiceprotected org.apache.hadoop.hbase.client.Tableprotected static final HBaseTestingUtility -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) voidcleanupTable(org.apache.hadoop.hbase.TableName tablename) delete table in preparation for next test(package private) intCounts the number of rows to verify data loss or non-dataloss.(package private) intcountRows(byte[] start, byte[] end) Counts the number of rows to verify data loss or non-dataloss.(package private) StringcreateMobFileName(String oldFileName) Creates a new mob file name by the old one.static voidcreateTable(HBaseTestingUtility testUtil, org.apache.hadoop.hbase.HTableDescriptor htd, byte[][] splitKeys) protected voiddeleteMetaRegion(org.apache.hadoop.conf.Configuration conf, boolean unassign, boolean hdfs, boolean regionInfoOnly) protected voiddeleteRegion(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.hbase.HTableDescriptor htd, byte[] startKey, byte[] endKey, boolean unassign, boolean metaRow, boolean hdfs) Delete a region from assignments, meta, or completely from hdfs.protected voiddeleteRegion(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.hbase.HTableDescriptor htd, byte[] startKey, byte[] endKey, boolean unassign, boolean metaRow, boolean hdfs, boolean regionInfoOnly, int replicaId) Delete a region from assignments, meta, or completely from hdfs.static voiddeleteTable(HBaseTestingUtility testUtil, org.apache.hadoop.hbase.TableName tableName) voiddeleteTableDir(org.apache.hadoop.hbase.TableName table) protected voiddoQuarantineTest(org.apache.hadoop.hbase.TableName table, org.apache.hadoop.hbase.util.HBaseFsck hbck, int check, int corrupt, int fail, int quar, int missing) Test that use this should have a timeout, because this method could potentially wait forever.protected voiddumpMeta(org.apache.hadoop.hbase.TableName tableName) Debugging method to dump the contents of meta.(package private) org.apache.hadoop.hbase.ServerNamefindDeployedHSI(Map<org.apache.hadoop.hbase.ServerName, List<String>> mm, org.apache.hadoop.hbase.client.RegionInfo hri) Returns the HSI a region info is on.getDeployedHRIs(org.apache.hadoop.hbase.client.Admin admin) Get region info from local cluster.(package private) org.apache.hadoop.fs.PathgetFlushedHFile(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.hbase.TableName table) We don't have an easy way to verify that a flush completed, so we loop until we find a legitimate hfile and return it.(package private) org.apache.hadoop.fs.PathgetFlushedMobFile(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.hbase.TableName table) Gets flushed mob files.(package private) voidsetupMobTable(org.apache.hadoop.hbase.TableName tablename) Setup a clean table with a mob-enabled column.(package private) voidsetupTable(org.apache.hadoop.hbase.TableName tablename) Setup a clean table before we start mucking with it.(package private) voidsetupTableWithRegionReplica(org.apache.hadoop.hbase.TableName tablename, int replicaCount) Setup a clean table with a certain region_replica count It will set tbl which needs to be closed after testprotected voidundeployRegion(org.apache.hadoop.hbase.client.Connection conn, org.apache.hadoop.hbase.ServerName sn, org.apache.hadoop.hbase.client.RegionInfo hri) This method is used to undeploy a region -- close it and attempt to remove its state from the Master.
-
Field Details
-
POOL_SIZE
- See Also:
-
LOG
-
TEST_UTIL
-
conf
-
FAM_STR
- See Also:
-
FAM
-
REGION_ONLINE_TIMEOUT
- See Also:
-
assignmentManager
-
regionStates
-
tableExecutorService
-
hbfsckExecutorService
-
connection
-
admin
-
tbl
-
SPLITS
-
ROWKEYS
-
name
-
-
Constructor Details
-
BaseTestHBaseFsck
public BaseTestHBaseFsck()
-
-
Method Details
-
dumpMeta
Debugging method to dump the contents of meta.- Throws:
IOException
-
undeployRegion
protected void undeployRegion(org.apache.hadoop.hbase.client.Connection conn, org.apache.hadoop.hbase.ServerName sn, org.apache.hadoop.hbase.client.RegionInfo hri) throws IOException, InterruptedException This method is used to undeploy a region -- close it and attempt to remove its state from the Master.- Throws:
IOExceptionInterruptedException
-
deleteRegion
protected void deleteRegion(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.hbase.HTableDescriptor htd, byte[] startKey, byte[] endKey, boolean unassign, boolean metaRow, boolean hdfs) throws IOException, InterruptedException Delete a region from assignments, meta, or completely from hdfs.- Parameters:
unassign- if true unassign region if assignedmetaRow- if true remove region's row from METAhdfs- if true remove region's dir in HDFS- Throws:
IOExceptionInterruptedException
-
deleteRegion
protected void deleteRegion(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.hbase.HTableDescriptor htd, byte[] startKey, byte[] endKey, boolean unassign, boolean metaRow, boolean hdfs, boolean regionInfoOnly, int replicaId) throws IOException, InterruptedException Delete a region from assignments, meta, or completely from hdfs.- Parameters:
unassign- if true unassign region if assignedmetaRow- if true remove region's row from METAhdfs- if true remove region's dir in HDFSregionInfoOnly- if true remove a region dir's .regioninfo filereplicaId- replica id- Throws:
IOExceptionInterruptedException
-
setupTable
Setup a clean table before we start mucking with it. It will set tbl which needs to be closed after test- Throws:
Exception
-
setupTableWithRegionReplica
void setupTableWithRegionReplica(org.apache.hadoop.hbase.TableName tablename, int replicaCount) throws Exception Setup a clean table with a certain region_replica count It will set tbl which needs to be closed after test- Throws:
Exception
-
setupMobTable
Setup a clean table with a mob-enabled column.- Parameters:
tablename- The name of a table to be created.- Throws:
Exception
-
countRows
Counts the number of rows to verify data loss or non-dataloss.- Throws:
IOException
-
countRows
Counts the number of rows to verify data loss or non-dataloss.- Throws:
IOException
-
cleanupTable
delete table in preparation for next test- Throws:
Exception
-
getDeployedHRIs
Map<org.apache.hadoop.hbase.ServerName,List<String>> getDeployedHRIs(org.apache.hadoop.hbase.client.Admin admin) throws IOException Get region info from local cluster.- Throws:
IOException
-
findDeployedHSI
org.apache.hadoop.hbase.ServerName findDeployedHSI(Map<org.apache.hadoop.hbase.ServerName, List<String>> mm, org.apache.hadoop.hbase.client.RegionInfo hri) Returns the HSI a region info is on. -
deleteTableDir
- Throws:
IOException
-
getFlushedHFile
org.apache.hadoop.fs.Path getFlushedHFile(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.hbase.TableName table) throws IOException We don't have an easy way to verify that a flush completed, so we loop until we find a legitimate hfile and return it.- Returns:
- Path of a flushed hfile.
- Throws:
IOException
-
getFlushedMobFile
org.apache.hadoop.fs.Path getFlushedMobFile(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.hbase.TableName table) throws IOException Gets flushed mob files.- Parameters:
fs- The current file system.table- The current table name.- Returns:
- Path of a flushed hfile.
- Throws:
IOException
-
createMobFileName
Creates a new mob file name by the old one.- Parameters:
oldFileName- The old mob file name.- Returns:
- The new mob file name.
-
doQuarantineTest
protected void doQuarantineTest(org.apache.hadoop.hbase.TableName table, org.apache.hadoop.hbase.util.HBaseFsck hbck, int check, int corrupt, int fail, int quar, int missing) throws Exception Test that use this should have a timeout, because this method could potentially wait forever.- Throws:
Exception
-
deleteMetaRegion
protected void deleteMetaRegion(org.apache.hadoop.conf.Configuration conf, boolean unassign, boolean hdfs, boolean regionInfoOnly) throws IOException, InterruptedException - Throws:
IOExceptionInterruptedException
-
createTable
public static void createTable(HBaseTestingUtility testUtil, org.apache.hadoop.hbase.HTableDescriptor htd, byte[][] splitKeys) throws Exception - Throws:
Exception
-
deleteTable
public static void deleteTable(HBaseTestingUtility testUtil, org.apache.hadoop.hbase.TableName tableName) throws Exception - Throws:
Exception
-