Package org.apache.hadoop.hbase.quotas
Class SpaceQuotaHelperForTests
java.lang.Object
org.apache.hadoop.hbase.quotas.SpaceQuotaHelperForTests
-
Nested Class Summary
Modifier and TypeClassDescription(package private) static class
Predicate that waits for all store files in a table to have no compacted files.(package private) static class
Abstraction to simplify the case where a test needs to verify a certain state on aSpaceQuotaSnapshot
. -
Field Summary
Modifier and TypeFieldDescriptionprivate final AtomicLong
static final String
private static final org.slf4j.Logger
private static final int
static final long
static final long
static final long
static final int
private final org.junit.rules.TestName
private final HBaseTestingUtil
-
Constructor Summary
ConstructorDescriptionSpaceQuotaHelperForTests
(HBaseTestingUtil 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.NamespaceDescriptor
createNamespace
(String namespace) (package private) org.apache.hadoop.hbase.TableName
(package private) org.apache.hadoop.hbase.TableName
createTableInNamespace
(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.TableName
createTableWithRegions
(int numRegions) (package private) org.apache.hadoop.hbase.TableName
createTableWithRegions
(String namespace, int numRegions) (package private) org.apache.hadoop.hbase.TableName
createTableWithRegions
(org.apache.hadoop.hbase.client.Admin admin, int numRegions) (package private) org.apache.hadoop.hbase.TableName
createTableWithRegions
(org.apache.hadoop.hbase.client.Admin admin, String namespace, int numRegions, int numberOfReplicas) generateFileToLoad
(org.apache.hadoop.hbase.TableName tn, int numFiles, int numRowsPerFile) Bulk-loads a number of files with a number of rows to the given table.(package private) org.apache.hadoop.hbase.TableName
(package private) org.apache.hadoop.hbase.TableName
getNextTableName
(String namespace) (package private) org.apache.hadoop.hbase.quotas.QuotaSettings
getTableSpaceQuota
(org.apache.hadoop.hbase.client.Connection conn, org.apache.hadoop.hbase.TableName tn) (package private) long
listNumDefinedQuotas
(org.apache.hadoop.hbase.client.Connection conn) Returns the number of quotas defined in the HBase quota table.(package private) 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) (package private) void
Removes all quotas defined in the HBase quota table.(package private) void
removeAllQuotas
(org.apache.hadoop.hbase.client.Connection conn) Removes all quotas defined in the HBase quota table.(package private) void
Removes the space quota from the given namespace(package private) void
removeQuotaFromtable
(org.apache.hadoop.hbase.TableName tn) Removes the space quota from the given table(package private) void
setQuotaLimit
(String ns, org.apache.hadoop.hbase.quotas.SpaceViolationPolicy policy, long sizeInMBs) Sets the given quota (policy & limit) on the passed namespace.(package private) void
setQuotaLimit
(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 void
updateConfigForQuotas
(org.apache.hadoop.conf.Configuration conf) (package private) void
verifyNoViolation
(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) void
verifyTableUsageSnapshotForSpaceQuotaExist
(org.apache.hadoop.hbase.TableName tn) Verifies that table usage snapshot exists for the table(package private) void
verifyViolation
(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 violated(package private) void
waitForQuotaTable
(org.apache.hadoop.hbase.client.Connection conn) Waits 30seconds for the HBase quota table to exist.(package private) void
waitForQuotaTable
(org.apache.hadoop.hbase.client.Connection conn, long timeout) Waitstimeout
milliseconds for the HBase quota table to exist.(package private) void
writeData
(org.apache.hadoop.hbase.client.Connection conn, org.apache.hadoop.hbase.TableName tn, long sizeInBytes) (package private) void
writeData
(org.apache.hadoop.hbase.TableName tn, long sizeInBytes) (package private) void
writeData
(org.apache.hadoop.hbase.TableName tn, long sizeInBytes, byte[] qual) (package private) void
(package private) org.apache.hadoop.hbase.TableName
writeUntilViolation
(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.TableName
writeUntilViolationAndVerifyViolation
(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.TableName
writeUntilViolationAndVerifyViolationInNamespace
(String ns, org.apache.hadoop.hbase.quotas.SpaceViolationPolicy policyToViolate, org.apache.hadoop.hbase.client.Mutation m) (package private) org.apache.hadoop.hbase.TableName
writeUntilViolationInNamespace
(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(HBaseTestingUtil 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
-
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
void waitForQuotaTable(org.apache.hadoop.hbase.client.Connection conn, long timeout) throws IOException Waitstimeout
milliseconds 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) -
generateFileToLoad
Map<byte[],List<org.apache.hadoop.fs.Path>> generateFileToLoad(org.apache.hadoop.hbase.TableName tn, int numFiles, int numRowsPerFile) throws Exception Bulk-loads a number of files with a number of rows to the given table.- Throws:
Exception
-