@InterfaceAudience.Private @InterfaceStability.Evolving public class QuotaTableUtil extends Object
| ROW-KEY | FAM/QUAL | DATA |
|---|---|---|
| n.<namespace> | q:s | <global-quotas> |
| n.<namespace> | u:p | <namespace-quota policy> |
| n.<namespace> | u:s | <SpaceQuotaSnapshot> |
| t.<table> | q:s | <global-quotas> |
| t.<table> | u:p | <table-quota policy> |
| t.<table> | u:ss.<snapshot name> | <SpaceQuotaSnapshot> |
| u.<user> | q:s | <global-quotas> |
| u.<user> | q:s.<table> | <table-quotas> |
| u.<user> | q:s.<ns> | <namespace-quotas> |
| Modifier and Type | Class and Description |
|---|---|
static interface |
QuotaTableUtil.NamespaceQuotasVisitor |
static interface |
QuotaTableUtil.QuotasVisitor |
static interface |
QuotaTableUtil.TableQuotasVisitor |
static interface |
QuotaTableUtil.UserQuotasVisitor |
| Modifier and Type | Field and Description |
|---|---|
protected static byte[] |
QUOTA_FAMILY_INFO |
protected static byte[] |
QUOTA_FAMILY_USAGE |
protected static byte[] |
QUOTA_NAMESPACE_ROW_KEY_PREFIX |
protected static String |
QUOTA_POLICY_COLUMN |
protected static byte[] |
QUOTA_QUALIFIER_POLICY |
protected static byte[] |
QUOTA_QUALIFIER_SETTINGS |
protected static byte[] |
QUOTA_QUALIFIER_SETTINGS_PREFIX |
protected static byte[] |
QUOTA_SNAPSHOT_SIZE_QUALIFIER |
static org.apache.hadoop.hbase.TableName |
QUOTA_TABLE_NAME
System table for quotas
|
protected static byte[] |
QUOTA_TABLE_ROW_KEY_PREFIX |
protected static byte[] |
QUOTA_USER_ROW_KEY_PREFIX |
| Constructor and Description |
|---|
QuotaTableUtil() |
| Modifier and Type | Method and Description |
|---|---|
protected static Result |
doGet(Connection connection,
Get get) |
protected static Result[] |
doGet(Connection connection,
List<Get> gets) |
static void |
extractQuotaSnapshot(Result result,
Map<org.apache.hadoop.hbase.TableName,SpaceQuotaSnapshot> snapshots)
Extracts the
SpaceViolationPolicy and TableName from the provided
Result and adds them to the given Map. |
protected static String |
extractSnapshotNameFromSizeCell(org.apache.hadoop.hbase.Cell c) |
protected static long |
extractSnapshotSize(byte[] data,
int offset,
int length) |
static SpaceQuotaSnapshot |
getCurrentSnapshot(Connection conn,
String namespace)
Returns the Master's view of a quota on the given
namespace or null if the
Master has no quota information on that namespace. |
static SpaceQuotaSnapshot |
getCurrentSnapshot(Connection conn,
org.apache.hadoop.hbase.TableName tn)
Returns the Master's view of a quota on the given
tableName or null if the
Master has no quota information on that table. |
static Map<org.apache.hadoop.hbase.TableName,Long> |
getMasterReportedTableSizes(Connection conn)
Fetches the table sizes on the filesystem as tracked by the HBase Master.
|
protected static String |
getNamespaceFromRowKey(byte[] key) |
static org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.Quotas |
getNamespaceQuota(Connection connection,
String namespace) |
protected static byte[] |
getNamespaceRowKey(String namespace) |
protected static String |
getNamespaceRowKeyRegex(String namespace) |
static Map<String,Long> |
getObservedSnapshotSizes(Connection conn)
Fetches any persisted HBase snapshot sizes stored in the quota table.
|
protected static org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.SpaceQuota |
getProtoViolationPolicy(SpaceViolationPolicy policy) |
static Map<org.apache.hadoop.hbase.TableName,SpaceQuotaSnapshot> |
getRegionServerQuotaSnapshots(Connection conn,
org.apache.hadoop.hbase.ServerName regionServer)
Fetches the observed
SpaceQuotaSnapshots observed by a RegionServer. |
protected static byte[] |
getSettingsQualifierForUserNamespace(String namespace) |
protected static byte[] |
getSettingsQualifierForUserTable(org.apache.hadoop.hbase.TableName tableName) |
protected static String |
getSettingsQualifierRegexForUserNamespace(String namespace) |
protected static String |
getSettingsQualifierRegexForUserTable(String table) |
static Map<org.apache.hadoop.hbase.TableName,SpaceQuotaSnapshot> |
getSnapshots(Connection conn)
Fetches all
SpaceQuotaSnapshot objects from the hbase:quota table. |
protected static byte[] |
getSnapshotSizeQualifier(String snapshotName) |
protected static org.apache.hadoop.hbase.TableName |
getTableFromRowKey(byte[] key) |
static org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.Quotas |
getTableQuota(Connection connection,
org.apache.hadoop.hbase.TableName table) |
protected static byte[] |
getTableRowKey(org.apache.hadoop.hbase.TableName table) |
protected static String |
getTableRowKeyRegex(String table) |
protected static String |
getUserFromRowKey(byte[] key) |
static org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.Quotas |
getUserQuota(Connection connection,
String user) |
static org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.Quotas |
getUserQuota(Connection connection,
String user,
String namespace) |
static org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.Quotas |
getUserQuota(Connection connection,
String user,
org.apache.hadoop.hbase.TableName table) |
protected static byte[] |
getUserRowKey(String user) |
protected static String |
getUserRowKeyRegex(String user) |
protected static SpaceViolationPolicy |
getViolationPolicy(org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.SpaceQuota proto) |
static boolean |
isEmptyQuota(org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.Quotas quotas) |
protected static boolean |
isNamespaceRowKey(byte[] key) |
protected static boolean |
isTableRowKey(byte[] key) |
protected static boolean |
isUserRowKey(byte[] key) |
static Filter |
makeFilter(QuotaFilter filter)
converts quotafilter to serializeable filterlists.
|
static Get |
makeGetForNamespaceQuotas(String namespace) |
static Get |
makeGetForTableQuotas(org.apache.hadoop.hbase.TableName table) |
static Get |
makeGetForUserQuotas(String user,
Iterable<org.apache.hadoop.hbase.TableName> tables,
Iterable<String> namespaces) |
static Scan |
makeQuotaSnapshotScan()
Creates a
Scan which returns only quota snapshots from the quota table. |
static Scan |
makeQuotaSnapshotScanForTable(org.apache.hadoop.hbase.TableName tn)
Creates a
Scan which returns only SpaceQuotaSnapshot from the quota table for a
specific table. |
static Scan |
makeScan(QuotaFilter filter) |
static void |
parseNamespaceResult(Result result,
QuotaTableUtil.NamespaceQuotasVisitor visitor) |
protected static void |
parseNamespaceResult(String namespace,
Result result,
QuotaTableUtil.NamespaceQuotasVisitor visitor) |
static void |
parseResult(Result result,
QuotaTableUtil.QuotasVisitor visitor) |
static void |
parseResultToCollection(Result result,
Collection<QuotaSettings> quotaSettings) |
static void |
parseTableResult(Result result,
QuotaTableUtil.TableQuotasVisitor visitor) |
protected static void |
parseTableResult(org.apache.hadoop.hbase.TableName table,
Result result,
QuotaTableUtil.TableQuotasVisitor visitor) |
static void |
parseUserResult(Result result,
QuotaTableUtil.UserQuotasVisitor visitor) |
protected static void |
parseUserResult(String userName,
Result result,
QuotaTableUtil.UserQuotasVisitor visitor) |
protected static org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.Quotas |
quotasFromData(byte[] data) |
protected static org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.Quotas |
quotasFromData(byte[] data,
int offset,
int length) |
protected static byte[] |
quotasToData(org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.Quotas data) |
public static final org.apache.hadoop.hbase.TableName QUOTA_TABLE_NAME
protected static final byte[] QUOTA_FAMILY_INFO
protected static final byte[] QUOTA_FAMILY_USAGE
protected static final byte[] QUOTA_QUALIFIER_SETTINGS
protected static final byte[] QUOTA_QUALIFIER_SETTINGS_PREFIX
protected static final byte[] QUOTA_QUALIFIER_POLICY
protected static final byte[] QUOTA_SNAPSHOT_SIZE_QUALIFIER
protected static final String QUOTA_POLICY_COLUMN
protected static final byte[] QUOTA_USER_ROW_KEY_PREFIX
protected static final byte[] QUOTA_TABLE_ROW_KEY_PREFIX
protected static final byte[] QUOTA_NAMESPACE_ROW_KEY_PREFIX
public static org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.Quotas getTableQuota(Connection connection, org.apache.hadoop.hbase.TableName table) throws IOException
IOExceptionpublic static org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.Quotas getNamespaceQuota(Connection connection, String namespace) throws IOException
IOExceptionpublic static org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.Quotas getUserQuota(Connection connection, String user) throws IOException
IOExceptionpublic static org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.Quotas getUserQuota(Connection connection, String user, org.apache.hadoop.hbase.TableName table) throws IOException
IOExceptionpublic static org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.Quotas getUserQuota(Connection connection, String user, String namespace) throws IOException
IOExceptionpublic static Get makeGetForTableQuotas(org.apache.hadoop.hbase.TableName table)
public static Get makeGetForUserQuotas(String user, Iterable<org.apache.hadoop.hbase.TableName> tables, Iterable<String> namespaces)
public static Scan makeScan(QuotaFilter filter)
public static Filter makeFilter(QuotaFilter filter)
public static Scan makeQuotaSnapshotScan()
Scan which returns only quota snapshots from the quota table.public static Map<org.apache.hadoop.hbase.TableName,SpaceQuotaSnapshot> getSnapshots(Connection conn) throws IOException
SpaceQuotaSnapshot objects from the hbase:quota table.conn - The HBase connectionIOExceptionpublic static Scan makeQuotaSnapshotScanForTable(org.apache.hadoop.hbase.TableName tn)
Scan which returns only SpaceQuotaSnapshot from the quota table for a
specific table.tn - Optionally, a table name to limit the scan's rowkey space. Can be null.public static void extractQuotaSnapshot(Result result, Map<org.apache.hadoop.hbase.TableName,SpaceQuotaSnapshot> snapshots)
SpaceViolationPolicy and TableName from the provided
Result and adds them to the given Map. If the result does not contain
the expected information or the serialized policy in the value is invalid, this method
will throw an IllegalArgumentException.result - A row from the quota table.snapshots - A map of snapshots to add the result of this method into.public static void parseResult(Result result, QuotaTableUtil.QuotasVisitor visitor) throws IOException
IOExceptionpublic static void parseResultToCollection(Result result, Collection<QuotaSettings> quotaSettings) throws IOException
IOExceptionpublic static void parseNamespaceResult(Result result, QuotaTableUtil.NamespaceQuotasVisitor visitor) throws IOException
IOExceptionprotected static void parseNamespaceResult(String namespace, Result result, QuotaTableUtil.NamespaceQuotasVisitor visitor) throws IOException
IOExceptionpublic static void parseTableResult(Result result, QuotaTableUtil.TableQuotasVisitor visitor) throws IOException
IOExceptionprotected static void parseTableResult(org.apache.hadoop.hbase.TableName table,
Result result,
QuotaTableUtil.TableQuotasVisitor visitor)
throws IOException
IOExceptionpublic static void parseUserResult(Result result, QuotaTableUtil.UserQuotasVisitor visitor) throws IOException
IOExceptionprotected static void parseUserResult(String userName, Result result, QuotaTableUtil.UserQuotasVisitor visitor) throws IOException
IOExceptionpublic static Map<String,Long> getObservedSnapshotSizes(Connection conn) throws IOException
IOExceptionpublic static Map<org.apache.hadoop.hbase.TableName,Long> getMasterReportedTableSizes(Connection conn) throws IOException
IOExceptionpublic static Map<org.apache.hadoop.hbase.TableName,SpaceQuotaSnapshot> getRegionServerQuotaSnapshots(Connection conn, org.apache.hadoop.hbase.ServerName regionServer) throws IOException
SpaceQuotaSnapshots observed by a RegionServer.IOExceptionpublic static SpaceQuotaSnapshot getCurrentSnapshot(Connection conn, org.apache.hadoop.hbase.TableName tn) throws IOException
tableName or null if the
Master has no quota information on that table.IOExceptionpublic static SpaceQuotaSnapshot getCurrentSnapshot(Connection conn, String namespace) throws IOException
namespace or null if the
Master has no quota information on that namespace.IOExceptionprotected static org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.Quotas quotasFromData(byte[] data)
throws IOException
IOExceptionprotected static org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.Quotas quotasFromData(byte[] data,
int offset,
int length)
throws IOException
IOExceptionprotected static byte[] quotasToData(org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.Quotas data)
throws IOException
IOExceptionpublic static boolean isEmptyQuota(org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.Quotas quotas)
protected static Result doGet(Connection connection, Get get) throws IOException
IOExceptionprotected static Result[] doGet(Connection connection, List<Get> gets) throws IOException
IOExceptionprotected static byte[] getUserRowKey(String user)
protected static byte[] getTableRowKey(org.apache.hadoop.hbase.TableName table)
protected static byte[] getNamespaceRowKey(String namespace)
protected static byte[] getSettingsQualifierForUserTable(org.apache.hadoop.hbase.TableName tableName)
protected static byte[] getSettingsQualifierForUserNamespace(String namespace)
protected static String getSettingsQualifierRegexForUserTable(String table)
protected static String getSettingsQualifierRegexForUserNamespace(String namespace)
protected static boolean isNamespaceRowKey(byte[] key)
protected static String getNamespaceFromRowKey(byte[] key)
protected static boolean isTableRowKey(byte[] key)
protected static org.apache.hadoop.hbase.TableName getTableFromRowKey(byte[] key)
protected static boolean isUserRowKey(byte[] key)
protected static String getUserFromRowKey(byte[] key)
protected static org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.SpaceQuota getProtoViolationPolicy(SpaceViolationPolicy policy)
protected static SpaceViolationPolicy getViolationPolicy(org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.SpaceQuota proto)
protected static byte[] getSnapshotSizeQualifier(String snapshotName)
protected static String extractSnapshotNameFromSizeCell(org.apache.hadoop.hbase.Cell c)
protected static long extractSnapshotSize(byte[] data,
int offset,
int length)
throws org.apache.hbase.thirdparty.com.google.protobuf.InvalidProtocolBufferException
org.apache.hbase.thirdparty.com.google.protobuf.InvalidProtocolBufferExceptionCopyright © 2007–2020 The Apache Software Foundation. All rights reserved.