Class TestCatalogJanitor
java.lang.Object
org.apache.hadoop.hbase.master.janitor.TestCatalogJanitor
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final HBaseClassTestRuleprivate static final HBaseTestingUtilprivate org.apache.hadoop.hbase.master.janitor.CatalogJanitorprivate static final org.slf4j.Loggerprivate MockMasterServicesfinal org.junit.rules.TestName -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate org.apache.hadoop.fs.FileStatus[]addMockStoreFiles(int count, org.apache.hadoop.hbase.master.MasterServices services, org.apache.hadoop.fs.Path storedir) static voidprivate org.apache.hadoop.fs.PathcreateMergeReferenceFile(org.apache.hadoop.fs.Path storeDir, org.apache.hadoop.fs.Path tableDir, org.apache.hadoop.hbase.client.ColumnFamilyDescriptor columnFamilyDescriptor, org.apache.hadoop.hbase.client.RegionInfo mergedRegion, org.apache.hadoop.hbase.client.RegionInfo parentRegion) private org.apache.hadoop.fs.PathcreateReferences(org.apache.hadoop.hbase.master.MasterServices services, org.apache.hadoop.hbase.client.TableDescriptor td, org.apache.hadoop.hbase.client.RegionInfo parent, org.apache.hadoop.hbase.client.RegionInfo daughter, byte[] midkey, boolean top) private org.apache.hadoop.hbase.client.RegionInfocreateRegionInfo(org.apache.hadoop.hbase.TableName tableName, byte[] startKey, byte[] endKey) private org.apache.hadoop.hbase.client.RegionInfocreateRegionInfo(org.apache.hadoop.hbase.TableName tableName, byte[] startKey, byte[] endKey, boolean split) private org.apache.hadoop.hbase.client.ResultcreateResult(org.apache.hadoop.hbase.client.RegionInfo parent, org.apache.hadoop.hbase.client.RegionInfo a, org.apache.hadoop.hbase.client.RegionInfo b) private org.apache.hadoop.hbase.client.TableDescriptorprivate voidprivate voidparentWithSpecifiedEndKeyCleanedEvenIfDaughterGoneFirst(String rootDir, byte[] lastEndKey) Make sure parent with specified end key gets cleaned up even if daughter is cleaned up before it.private StringsetRootDirAndCleanIt(HBaseTestingUtil htu, String subdir) voidsetup()voidteardown()voidvoidvoidvoidTest clearing a split parent.voidvoidTest that if a store file with the same name is present as those already backed up cause the already archived files to be timestamped backupvoidMake sure last parent with empty end key gets cleaned up even if daughter is cleaned up before it.voidMake sure parent gets cleaned up even if daughter is cleaned up before it.voidCatalogJanitor.scan() should not clean parent regions if their own parents are still referencing them.voidTest that we correctly archive all the storefiles when a region is deleted
-
Field Details
-
CLASS_RULE
-
LOG
-
HTU
-
name
-
masterServices
-
janitor
-
-
Constructor Details
-
TestCatalogJanitor
public TestCatalogJanitor()
-
-
Method Details
-
beforeClass
- Throws:
Exception
-
setup
- Throws:
Exception
-
teardown
-
createRegionInfo
private org.apache.hadoop.hbase.client.RegionInfo createRegionInfo(org.apache.hadoop.hbase.TableName tableName, byte[] startKey, byte[] endKey) -
createRegionInfo
private org.apache.hadoop.hbase.client.RegionInfo createRegionInfo(org.apache.hadoop.hbase.TableName tableName, byte[] startKey, byte[] endKey, boolean split) -
testCleanMerge
- Throws:
IOException
-
testDontCleanMergeIfFileSystemException
- Throws:
IOException
-
createMergeReferenceFile
private org.apache.hadoop.fs.Path createMergeReferenceFile(org.apache.hadoop.fs.Path storeDir, org.apache.hadoop.fs.Path tableDir, org.apache.hadoop.hbase.client.ColumnFamilyDescriptor columnFamilyDescriptor, org.apache.hadoop.hbase.client.RegionInfo mergedRegion, org.apache.hadoop.hbase.client.RegionInfo parentRegion) throws IOException - Throws:
IOException
-
testCleanParent
Test clearing a split parent.- Throws:
IOExceptionInterruptedException
-
testParentCleanedEvenIfDaughterGoneFirst
Make sure parent gets cleaned up even if daughter is cleaned up before it.- Throws:
IOExceptionInterruptedException
-
testLastParentCleanedEvenIfDaughterGoneFirst
Make sure last parent with empty end key gets cleaned up even if daughter is cleaned up before it.- Throws:
IOExceptionInterruptedException
-
createTableDescriptorForCurrentMethod
- Returns:
- A TableDescriptor with a tableName of current method name and a column family that is MockMasterServices.DEFAULT_COLUMN_FAMILY_NAME)
-
parentWithSpecifiedEndKeyCleanedEvenIfDaughterGoneFirst
private void parentWithSpecifiedEndKeyCleanedEvenIfDaughterGoneFirst(String rootDir, byte[] lastEndKey) throws IOException, InterruptedException Make sure parent with specified end key gets cleaned up even if daughter is cleaned up before it.- Parameters:
rootDir- the test case name, used as the HBase testing utility rootlastEndKey- the end key of the split parent- Throws:
IOExceptionInterruptedException
-
testScanDoesNotCleanRegionsWithExistingParents
CatalogJanitor.scan() should not clean parent regions if their own parents are still referencing them. This ensures that grandparent regions do not point to deleted parent regions.- Throws:
Exception
-
testSplitParentFirstComparator
Test that we correctly archive all the storefiles when a region is deleted -
testArchiveOldRegion
- Throws:
Exception
-
logFiles
- Parameters:
description- description of the files for loggingstoreFiles- the status of the files to log
-
testDuplicateHFileResolution
Test that if a store file with the same name is present as those already backed up cause the already archived files to be timestamped backup- Throws:
Exception
-
testAlreadyRunningStatus
- Throws:
Exception
-
addMockStoreFiles
private org.apache.hadoop.fs.FileStatus[] addMockStoreFiles(int count, org.apache.hadoop.hbase.master.MasterServices services, org.apache.hadoop.fs.Path storedir) throws IOException - Throws:
IOException
-
setRootDirAndCleanIt
- Throws:
IOException
-
createReferences
private org.apache.hadoop.fs.Path createReferences(org.apache.hadoop.hbase.master.MasterServices services, org.apache.hadoop.hbase.client.TableDescriptor td, org.apache.hadoop.hbase.client.RegionInfo parent, org.apache.hadoop.hbase.client.RegionInfo daughter, byte[] midkey, boolean top) throws IOException - Throws:
IOException
-
createResult
private org.apache.hadoop.hbase.client.Result createResult(org.apache.hadoop.hbase.client.RegionInfo parent, org.apache.hadoop.hbase.client.RegionInfo a, org.apache.hadoop.hbase.client.RegionInfo b) throws IOException - Throws:
IOException
-