@InterfaceAudience.Private @InterfaceStability.Evolving public class QuotaUtil extends QuotaTableUtil
Modifier and Type | Class and Description |
---|---|
private static interface |
QuotaUtil.KeyFromRow<T> |
QuotaTableUtil.NamespaceQuotasVisitor, QuotaTableUtil.QuotasVisitor, QuotaTableUtil.TableQuotasVisitor, QuotaTableUtil.UserQuotasVisitor
Modifier and Type | Field and Description |
---|---|
static long |
DEFAULT_READ_CAPACITY_UNIT |
static long |
DEFAULT_WRITE_CAPACITY_UNIT |
private static org.slf4j.Logger |
LOG |
static String |
QUOTA_CONF_KEY |
private static boolean |
QUOTA_ENABLED_DEFAULT |
static HTableDescriptor |
QUOTA_TABLE_DESC
Table descriptor for Quota internal table
|
static String |
READ_CAPACITY_UNIT_CONF_KEY |
static String |
WRITE_CAPACITY_UNIT_CONF_KEY |
QUOTA_FAMILY_INFO, QUOTA_FAMILY_USAGE, QUOTA_NAMESPACE_ROW_KEY_PREFIX, QUOTA_POLICY_COLUMN, QUOTA_QUALIFIER_POLICY, QUOTA_QUALIFIER_SETTINGS, QUOTA_QUALIFIER_SETTINGS_PREFIX, QUOTA_REGION_SERVER_ROW_KEY, QUOTA_REGION_SERVER_ROW_KEY_PREFIX, QUOTA_SNAPSHOT_SIZE_QUALIFIER, QUOTA_TABLE_NAME, QUOTA_TABLE_ROW_KEY_PREFIX, QUOTA_USER_ROW_KEY_PREFIX
Constructor and Description |
---|
QuotaUtil() |
Modifier and Type | Method and Description |
---|---|
static void |
addNamespaceQuota(Connection connection,
String namespace,
org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.Quotas data) |
private static void |
addQuotas(Connection connection,
byte[] rowKey,
byte[] qualifier,
org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.Quotas data) |
private static void |
addQuotas(Connection connection,
byte[] rowKey,
org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.Quotas data) |
static void |
addRegionServerQuota(Connection connection,
String regionServer,
org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.Quotas data) |
static void |
addTableQuota(Connection connection,
TableName table,
org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.Quotas data) |
static void |
addUserQuota(Connection connection,
String user,
org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.Quotas data) |
static void |
addUserQuota(Connection connection,
String user,
String namespace,
org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.Quotas data) |
static void |
addUserQuota(Connection connection,
String user,
TableName table,
org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.Quotas data) |
static long |
calculateMutationSize(Mutation mutation) |
static long |
calculateResultSize(List<Result> results) |
static long |
calculateResultSize(Result result) |
private static void |
checkRSQuotaToEnableExceedThrottle(org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.Quotas quotas) |
static void |
deleteNamespaceQuota(Connection connection,
String namespace) |
private static void |
deleteQuotas(Connection connection,
byte[] rowKey) |
private static void |
deleteQuotas(Connection connection,
byte[] rowKey,
byte[] qualifier) |
static void |
deleteRegionServerQuota(Connection connection,
String regionServer) |
static void |
deleteTableQuota(Connection connection,
TableName table) |
static void |
deleteUserQuota(Connection connection,
String user) |
static void |
deleteUserQuota(Connection connection,
String user,
String namespace) |
static void |
deleteUserQuota(Connection connection,
String user,
TableName table) |
static void |
disableTableIfNotDisabled(Connection conn,
TableName tableName)
Method to disable a table, if not already disabled.
|
private static void |
doDelete(Connection connection,
Delete delete) |
private static void |
doPut(Connection connection,
Put put) |
static void |
enableTableIfNotEnabled(Connection conn,
TableName tableName)
Method to enable a table, if not already enabled.
|
static <K> Map<K,QuotaState> |
fetchGlobalQuotas(String type,
Connection connection,
List<Get> gets,
QuotaUtil.KeyFromRow<K> kfr) |
static Map<String,QuotaState> |
fetchNamespaceQuotas(Connection connection,
List<Get> gets,
double factor) |
static Map<String,QuotaState> |
fetchRegionServerQuotas(Connection connection,
List<Get> gets) |
static Map<TableName,QuotaState> |
fetchTableQuotas(Connection connection,
List<Get> gets,
Map<TableName,Double> tableMachineFactors) |
static Map<String,UserQuotaState> |
fetchUserQuotas(Connection connection,
List<Get> gets,
Map<TableName,Double> tableMachineQuotaFactors,
double factor) |
protected static boolean |
isExceedThrottleQuotaEnabled(Connection connection) |
static boolean |
isQuotaEnabled(org.apache.hadoop.conf.Configuration conf)
Returns true if the support for quota is enabled
|
protected static void |
switchExceedThrottleQuota(Connection connection,
boolean exceedThrottleQuotaEnabled) |
private static org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.Quotas |
updateClusterQuotaToMachineQuota(org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.Quotas quotas,
double factor)
Convert cluster scope quota to machine scope quota
|
private static org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.TimedQuota |
updateTimedQuota(org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.TimedQuota timedQuota,
double factor) |
createDeletesForExistingNamespaceSnapshotSizes, createDeletesForExistingNamespaceSnapshotSizes, createDeletesForExistingSnapshotsFromScan, createDeletesForExistingTableSnapshotSizes, createDeletesForExistingTableSnapshotSizes, createGetNamespaceSnapshotSize, createPutForNamespaceSnapshotSize, createPutForSnapshotSize, createPutForSpaceSnapshot, createScanForNamespaceSnapshotSizes, createScanForNamespaceSnapshotSizes, createScanForSpaceSnapshotSizes, createScanForSpaceSnapshotSizes, doGet, doGet, extractQuotaSnapshot, extractSnapshotNameFromSizeCell, extractSnapshotSize, getCurrentSnapshotFromQuotaTable, getExceedThrottleQuotaRowKey, getNamespaceFromRowKey, getNamespaceQuota, getNamespaceRowKey, getNamespaceRowKeyRegex, getNamespaceSnapshots, getNamespaceSnapshotSize, getObservedSnapshotSizes, getProtoViolationPolicy, getRegionServerFromRowKey, getRegionServerQuota, getRegionServerRowKey, getSettingsQualifierForUserNamespace, getSettingsQualifierForUserTable, getSettingsQualifierRegexForUserNamespace, getSettingsQualifierRegexForUserTable, getSnapshots, getSnapshotSizeQualifier, getTableFromRowKey, getTableQuota, getTableRowKey, getTableRowKeyRegex, getTableSnapshots, getUserFromRowKey, getUserQuota, getUserQuota, getUserQuota, getUserRowKey, getUserRowKeyRegex, getViolationPolicy, isEmptyQuota, isNamespaceRowKey, isRegionServerRowKey, isTableRowKey, isUserRowKey, makeFilter, makeGetForNamespaceQuotas, makeGetForRegionServerQuotas, makeGetForSnapshotSize, makeGetForTableQuotas, makeGetForUserQuotas, makeQuotaSnapshotGetForTable, makeQuotaSnapshotScan, makeQuotaSnapshotScanForTable, makeScan, parseNamespaceResult, parseNamespaceResult, parseResult, parseResultToCollection, parseSnapshotSize, parseTableResult, parseTableResult, parseUserResult, parseUserResult, quotasFromData, quotasFromData, quotasToData
private static final org.slf4j.Logger LOG
public static final String QUOTA_CONF_KEY
private static final boolean QUOTA_ENABLED_DEFAULT
public static final String READ_CAPACITY_UNIT_CONF_KEY
public static final long DEFAULT_READ_CAPACITY_UNIT
public static final String WRITE_CAPACITY_UNIT_CONF_KEY
public static final long DEFAULT_WRITE_CAPACITY_UNIT
public static final HTableDescriptor QUOTA_TABLE_DESC
public QuotaUtil()
public static boolean isQuotaEnabled(org.apache.hadoop.conf.Configuration conf)
public static void addTableQuota(Connection connection, TableName table, org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.Quotas data) throws IOException
IOException
public static void deleteTableQuota(Connection connection, TableName table) throws IOException
IOException
public static void addNamespaceQuota(Connection connection, String namespace, org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.Quotas data) throws IOException
IOException
public static void deleteNamespaceQuota(Connection connection, String namespace) throws IOException
IOException
public static void addUserQuota(Connection connection, String user, org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.Quotas data) throws IOException
IOException
public static void addUserQuota(Connection connection, String user, TableName table, org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.Quotas data) throws IOException
IOException
public static void addUserQuota(Connection connection, String user, String namespace, org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.Quotas data) throws IOException
IOException
public static void deleteUserQuota(Connection connection, String user) throws IOException
IOException
public static void deleteUserQuota(Connection connection, String user, TableName table) throws IOException
IOException
public static void deleteUserQuota(Connection connection, String user, String namespace) throws IOException
IOException
public static void addRegionServerQuota(Connection connection, String regionServer, org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.Quotas data) throws IOException
IOException
public static void deleteRegionServerQuota(Connection connection, String regionServer) throws IOException
IOException
protected static void switchExceedThrottleQuota(Connection connection, boolean exceedThrottleQuotaEnabled) throws IOException
IOException
private static void checkRSQuotaToEnableExceedThrottle(org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.Quotas quotas) throws IOException
IOException
protected static boolean isExceedThrottleQuotaEnabled(Connection connection) throws IOException
IOException
private static void addQuotas(Connection connection, byte[] rowKey, org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.Quotas data) throws IOException
IOException
private static void addQuotas(Connection connection, byte[] rowKey, byte[] qualifier, org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.Quotas data) throws IOException
IOException
private static void deleteQuotas(Connection connection, byte[] rowKey) throws IOException
IOException
private static void deleteQuotas(Connection connection, byte[] rowKey, byte[] qualifier) throws IOException
IOException
public static Map<String,UserQuotaState> fetchUserQuotas(Connection connection, List<Get> gets, Map<TableName,Double> tableMachineQuotaFactors, double factor) throws IOException
IOException
public static Map<TableName,QuotaState> fetchTableQuotas(Connection connection, List<Get> gets, Map<TableName,Double> tableMachineFactors) throws IOException
IOException
public static Map<String,QuotaState> fetchNamespaceQuotas(Connection connection, List<Get> gets, double factor) throws IOException
IOException
public static Map<String,QuotaState> fetchRegionServerQuotas(Connection connection, List<Get> gets) throws IOException
IOException
public static <K> Map<K,QuotaState> fetchGlobalQuotas(String type, Connection connection, List<Get> gets, QuotaUtil.KeyFromRow<K> kfr) throws IOException
IOException
private static org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.Quotas updateClusterQuotaToMachineQuota(org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.Quotas quotas, double factor)
quotas
- the original quotafactor
- factor used to divide cluster limiter to machine limiterprivate static org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.TimedQuota updateTimedQuota(org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.TimedQuota timedQuota, double factor)
private static void doPut(Connection connection, Put put) throws IOException
IOException
private static void doDelete(Connection connection, Delete delete) throws IOException
IOException
public static long calculateMutationSize(Mutation mutation)
public static long calculateResultSize(Result result)
public static long calculateResultSize(List<Result> results)
public static void enableTableIfNotEnabled(Connection conn, TableName tableName) throws IOException
TableNotDisabledException
and TableNotFoundException
, if thrown while enabling
the table.conn
- connection to re-usetableName
- name of the table to be enabledIOException
public static void disableTableIfNotDisabled(Connection conn, TableName tableName) throws IOException
TableNotEnabledException
, if thrown while disabling the table.conn
- connection to re-usetableName
- table name which has moved into space quota violationIOException
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.