Package org.apache.hadoop.hbase.quotas
Class SpaceQuotaHelperForTests
java.lang.Object
org.apache.hadoop.hbase.quotas.SpaceQuotaHelperForTests
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static classPredicate that waits for all store files in a table to have no compacted files.(package private) static classAbstraction to simplify the case where a test needs to verify a certain state on aSpaceQuotaSnapshot. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final AtomicLongstatic final Stringprivate static final org.slf4j.Loggerprivate static final intstatic final longstatic final longstatic final longstatic final intprivate final org.junit.rules.TestNameprivate final HBaseTestingUtility -
Constructor Summary
ConstructorsConstructorDescriptionSpaceQuotaHelperForTests(HBaseTestingUtility testUtil, org.junit.rules.TestName testName, AtomicLong counter) -
Method Summary
Modifier and TypeMethodDescription(package private) org.apache.hadoop.hbase.NamespaceDescriptor(package private) org.apache.hadoop.hbase.NamespaceDescriptorcreateNamespace(String namespace) (package private) org.apache.hadoop.hbase.TableName(package private) org.apache.hadoop.hbase.TableNamecreateTableInNamespace(org.apache.hadoop.hbase.NamespaceDescriptor nd) (package private) org.apache.hbase.thirdparty.com.google.common.collect.Multimap<org.apache.hadoop.hbase.TableName,org.apache.hadoop.hbase.quotas.QuotaSettings> (package private) org.apache.hadoop.hbase.TableNamecreateTableWithRegions(int numRegions) (package private) org.apache.hadoop.hbase.TableNamecreateTableWithRegions(String namespace, int numRegions) (package private) org.apache.hadoop.hbase.TableNamecreateTableWithRegions(org.apache.hadoop.hbase.client.Admin admin, int numRegions) (package private) org.apache.hadoop.hbase.TableNamecreateTableWithRegions(org.apache.hadoop.hbase.client.Admin admin, String namespace, int numRegions, int numberOfReplicas) (package private) org.apache.hadoop.hbase.client.ClientServiceCallable<Void>generateFileToLoad(org.apache.hadoop.hbase.TableName tn, int numFiles, int numRowsPerFile) (package private) org.apache.hadoop.hbase.TableName(package private) org.apache.hadoop.hbase.TableNamegetNextTableName(String namespace) (package private) org.apache.hadoop.hbase.quotas.QuotaSettingsgetTableSpaceQuota(org.apache.hadoop.hbase.client.Connection conn, org.apache.hadoop.hbase.TableName tn) (package private) longlistNumDefinedQuotas(org.apache.hadoop.hbase.client.Connection conn) Returns the number of quotas defined in the HBase quota table.(package private) voidpartitionTablesByQuotaTarget(org.apache.hbase.thirdparty.com.google.common.collect.Multimap<org.apache.hadoop.hbase.TableName, org.apache.hadoop.hbase.quotas.QuotaSettings> quotas, Set<org.apache.hadoop.hbase.TableName> tablesWithTableQuota, Set<org.apache.hadoop.hbase.TableName> tablesWithNamespaceQuota) (package private) voidRemoves all quotas defined in the HBase quota table.(package private) voidremoveAllQuotas(org.apache.hadoop.hbase.client.Connection conn) Removes all quotas defined in the HBase quota table.(package private) voidRemoves the space quota from the given namespace(package private) voidremoveQuotaFromtable(org.apache.hadoop.hbase.TableName tn) Removes the space quota from the given table(package private) voidsetQuotaLimit(String ns, org.apache.hadoop.hbase.quotas.SpaceViolationPolicy policy, long sizeInMBs) Sets the given quota (policy & limit) on the passed namespace.(package private) voidsetQuotaLimit(org.apache.hadoop.hbase.TableName tn, org.apache.hadoop.hbase.quotas.SpaceViolationPolicy policy, long sizeInMBs) Sets the given quota (policy & limit) on the passed table.(package private) static voidupdateConfigForQuotas(org.apache.hadoop.conf.Configuration conf) (package private) voidverifyNoViolation(org.apache.hadoop.hbase.TableName tn, org.apache.hadoop.hbase.client.Mutation m) Verifies that no policy has been violated on the given table(package private) voidverifyTableUsageSnapshotForSpaceQuotaExist(org.apache.hadoop.hbase.TableName tn) Verifies that table usage snapshot exists for the table(package private) voidverifyViolation(org.apache.hadoop.hbase.quotas.SpaceViolationPolicy policyToViolate, org.apache.hadoop.hbase.TableName tn, org.apache.hadoop.hbase.client.Mutation m) Verifies that the given policy on the given table has been violatedvoidwaitForQuotaTable(org.apache.hadoop.hbase.client.Connection conn) Waits 30seconds for the HBase quota table to exist.voidwaitForQuotaTable(org.apache.hadoop.hbase.client.Connection conn, long timeout) Waitstimeoutmilliseconds for the HBase quota table to exist.(package private) voidwriteData(org.apache.hadoop.hbase.client.Connection conn, org.apache.hadoop.hbase.TableName tn, long sizeInBytes) (package private) voidwriteData(org.apache.hadoop.hbase.TableName tn, long sizeInBytes) (package private) voidwriteData(org.apache.hadoop.hbase.TableName tn, long sizeInBytes, byte[] qual) (package private) void(package private) org.apache.hadoop.hbase.TableNamewriteUntilViolation(org.apache.hadoop.hbase.quotas.SpaceViolationPolicy policyToViolate) Writes the given mutation into a table until it violates the given policy.(package private) org.apache.hadoop.hbase.TableNamewriteUntilViolationAndVerifyViolation(org.apache.hadoop.hbase.quotas.SpaceViolationPolicy policyToViolate, org.apache.hadoop.hbase.client.Mutation m) Writes the given mutation into a table until it violates the given policy.(package private) org.apache.hadoop.hbase.TableNamewriteUntilViolationAndVerifyViolationInNamespace(String ns, org.apache.hadoop.hbase.quotas.SpaceViolationPolicy policyToViolate, org.apache.hadoop.hbase.client.Mutation m) (package private) org.apache.hadoop.hbase.TableNamewriteUntilViolationInNamespace(String ns, org.apache.hadoop.hbase.quotas.SpaceViolationPolicy policyToViolate)
-
Field Details
-
LOG
-
SIZE_PER_VALUE
- See Also:
-
F1
- See Also:
-
ONE_KILOBYTE
- See Also:
-
ONE_MEGABYTE
- See Also:
-
ONE_GIGABYTE
- See Also:
-
testUtil
-
testName
-
counter
-
NUM_RETRIES
- See Also:
-
-
Constructor Details
-
SpaceQuotaHelperForTests
public SpaceQuotaHelperForTests(HBaseTestingUtility testUtil, org.junit.rules.TestName testName, AtomicLong counter)
-
-
Method Details
-
updateConfigForQuotas
-
listNumDefinedQuotas
Returns the number of quotas defined in the HBase quota table.- Throws:
IOException
-
writeUntilViolationAndVerifyViolation
org.apache.hadoop.hbase.TableName writeUntilViolationAndVerifyViolation(org.apache.hadoop.hbase.quotas.SpaceViolationPolicy policyToViolate, org.apache.hadoop.hbase.client.Mutation m) throws Exception Writes the given mutation into a table until it violates the given policy. Verifies that the policy has been violated & then returns the name of the table created & written into.- Throws:
Exception
-
writeUntilViolation
org.apache.hadoop.hbase.TableName writeUntilViolation(org.apache.hadoop.hbase.quotas.SpaceViolationPolicy policyToViolate) throws Exception Writes the given mutation into a table until it violates the given policy. Returns the name of the table created & written into.- Throws:
Exception
-
writeUntilViolationAndVerifyViolationInNamespace
org.apache.hadoop.hbase.TableName writeUntilViolationAndVerifyViolationInNamespace(String ns, org.apache.hadoop.hbase.quotas.SpaceViolationPolicy policyToViolate, org.apache.hadoop.hbase.client.Mutation m) throws Exception - Throws:
Exception
-
writeUntilViolationInNamespace
org.apache.hadoop.hbase.TableName writeUntilViolationInNamespace(String ns, org.apache.hadoop.hbase.quotas.SpaceViolationPolicy policyToViolate) throws Exception - Throws:
Exception
-
verifyViolation
void verifyViolation(org.apache.hadoop.hbase.quotas.SpaceViolationPolicy policyToViolate, org.apache.hadoop.hbase.TableName tn, org.apache.hadoop.hbase.client.Mutation m) throws Exception Verifies that the given policy on the given table has been violated- Throws:
Exception
-
verifyNoViolation
void verifyNoViolation(org.apache.hadoop.hbase.TableName tn, org.apache.hadoop.hbase.client.Mutation m) throws Exception Verifies that no policy has been violated on the given table- Throws:
Exception
-
verifyTableUsageSnapshotForSpaceQuotaExist
void verifyTableUsageSnapshotForSpaceQuotaExist(org.apache.hadoop.hbase.TableName tn) throws Exception Verifies that table usage snapshot exists for the table- Throws:
Exception
-
setQuotaLimit
void setQuotaLimit(org.apache.hadoop.hbase.TableName tn, org.apache.hadoop.hbase.quotas.SpaceViolationPolicy policy, long sizeInMBs) throws Exception Sets the given quota (policy & limit) on the passed table.- Throws:
Exception
-
setQuotaLimit
void setQuotaLimit(String ns, org.apache.hadoop.hbase.quotas.SpaceViolationPolicy policy, long sizeInMBs) throws Exception Sets the given quota (policy & limit) on the passed namespace.- Throws:
Exception
-
removeQuotaFromtable
Removes the space quota from the given table- Throws:
Exception
-
generateFileToLoad
org.apache.hadoop.hbase.client.ClientServiceCallable<Void> generateFileToLoad(org.apache.hadoop.hbase.TableName tn, int numFiles, int numRowsPerFile) throws Exception - Parameters:
tn- the tablenamenumFiles- number of filesnumRowsPerFile- number of rows per file- Returns:
- a clientServiceCallable which can be used with the Caller factory for bulk load
- Throws:
Exception- when failed to get connection, table or preparation of the bulk load
-
removeQuotaFromNamespace
Removes the space quota from the given namespace- Throws:
Exception
-
removeAllQuotas
Removes all quotas defined in the HBase quota table.- Throws:
Exception
-
removeAllQuotas
Removes all quotas defined in the HBase quota table.- Throws:
IOException
-
getTableSpaceQuota
org.apache.hadoop.hbase.quotas.QuotaSettings getTableSpaceQuota(org.apache.hadoop.hbase.client.Connection conn, org.apache.hadoop.hbase.TableName tn) throws IOException - Throws:
IOException
-
waitForQuotaTable
Waits 30seconds for the HBase quota table to exist.- Throws:
IOException
-
waitForQuotaTable
public void waitForQuotaTable(org.apache.hadoop.hbase.client.Connection conn, long timeout) throws IOException Waitstimeoutmilliseconds for the HBase quota table to exist.- Throws:
IOException
-
writeData
- Throws:
IOException
-
writeData
void writeData(org.apache.hadoop.hbase.client.Connection conn, org.apache.hadoop.hbase.TableName tn, long sizeInBytes) throws IOException - Throws:
IOException
-
writeData
void writeData(org.apache.hadoop.hbase.TableName tn, long sizeInBytes, String qual) throws IOException - Throws:
IOException
-
writeData
void writeData(org.apache.hadoop.hbase.TableName tn, long sizeInBytes, byte[] qual) throws IOException - Throws:
IOException
-
createNamespace
- Throws:
Exception
-
createNamespace
- Throws:
Exception
-
createTablesWithSpaceQuotas
org.apache.hbase.thirdparty.com.google.common.collect.Multimap<org.apache.hadoop.hbase.TableName,org.apache.hadoop.hbase.quotas.QuotaSettings> createTablesWithSpaceQuotas() throws Exception- Throws:
Exception
-
getNextTableName
org.apache.hadoop.hbase.TableName getNextTableName() -
getNextTableName
-
createTable
- Throws:
Exception
-
createTableWithRegions
- Throws:
Exception
-
createTableWithRegions
org.apache.hadoop.hbase.TableName createTableWithRegions(org.apache.hadoop.hbase.client.Admin admin, int numRegions) throws Exception - Throws:
Exception
-
createTableWithRegions
org.apache.hadoop.hbase.TableName createTableWithRegions(String namespace, int numRegions) throws Exception - Throws:
Exception
-
createTableWithRegions
org.apache.hadoop.hbase.TableName createTableWithRegions(org.apache.hadoop.hbase.client.Admin admin, String namespace, int numRegions, int numberOfReplicas) throws Exception - Throws:
Exception
-
createTableInNamespace
org.apache.hadoop.hbase.TableName createTableInNamespace(org.apache.hadoop.hbase.NamespaceDescriptor nd) throws Exception - Throws:
Exception
-
partitionTablesByQuotaTarget
void partitionTablesByQuotaTarget(org.apache.hbase.thirdparty.com.google.common.collect.Multimap<org.apache.hadoop.hbase.TableName, org.apache.hadoop.hbase.quotas.QuotaSettings> quotas, Set<org.apache.hadoop.hbase.TableName> tablesWithTableQuota, Set<org.apache.hadoop.hbase.TableName> tablesWithNamespaceQuota)
-