@InterfaceAudience.Private @InterfaceStability.Evolving public class MasterQuotaManager extends Object implements RegionStateListener
| Modifier and Type | Class and Description |
|---|---|
private static class |
MasterQuotaManager.NamedLock<T> |
private static interface |
MasterQuotaManager.SetQuotaOperations
Encapsulates CRUD quota operations for some subject.
|
private static class |
MasterQuotaManager.SizeSnapshotWithTimestamp
Holds the size of a region at the given time, millis since the epoch.
|
| Modifier and Type | Field and Description |
|---|---|
private static Map<RegionInfo,Long> |
EMPTY_MAP |
private boolean |
initialized |
private static org.slf4j.Logger |
LOG |
private MasterServices |
masterServices |
private MasterQuotaManager.NamedLock<String> |
namespaceLocks |
private NamespaceAuditor |
namespaceQuotaManager |
private MasterQuotaManager.NamedLock<String> |
regionServerLocks |
private ConcurrentHashMap<RegionInfo,MasterQuotaManager.SizeSnapshotWithTimestamp> |
regionSizes |
private RpcThrottleStorage |
rpcThrottleStorage |
private MasterQuotaManager.NamedLock<TableName> |
tableLocks |
private MasterQuotaManager.NamedLock<String> |
userLocks |
| Constructor and Description |
|---|
MasterQuotaManager(MasterServices masterServices) |
| Modifier and Type | Method and Description |
|---|---|
void |
addRegionSize(RegionInfo hri,
long size,
long time) |
void |
checkAndUpdateNamespaceRegionQuota(TableName tName,
int regions) |
void |
checkNamespaceTableAndRegionQuota(TableName tName,
int regions) |
private void |
checkQuotaSupport() |
private void |
createQuotaTable() |
NamespaceAuditor |
getNamespaceQuotaManager() |
int |
getRegionCountOfTable(TableName tName) |
(package private) void |
initializeRegionSizes() |
boolean |
isExceedThrottleQuotaEnabled() |
private boolean |
isInViolationAndPolicyDisable(TableName tableName,
QuotaObserverChore quotaObserverChore)
Method to check if a table is in violation and policy set on table is DISABLE.
|
boolean |
isQuotaInitialized() |
boolean |
isRpcThrottleEnabled() |
org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.IsRpcThrottleEnabledResponse |
isRpcThrottleEnabled(org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.IsRpcThrottleEnabledRequest request) |
void |
onRegionMerged(RegionInfo mergedRegion)
Process region merge event.
|
void |
onRegionSplit(RegionInfo hri)
Process region split event.
|
void |
onRegionSplitReverted(RegionInfo hri)
Process region split reverted event.
|
void |
processFileArchivals(org.apache.hadoop.hbase.shaded.protobuf.generated.RegionServerStatusProtos.FileArchiveNotificationRequest request,
Connection conn,
org.apache.hadoop.conf.Configuration conf,
org.apache.hadoop.fs.FileSystem fs) |
(package private) int |
pruneEntriesOlderThan(long timeToPruneBefore,
QuotaObserverChore quotaObserverChore) |
void |
removeNamespaceQuota(String namespace) |
void |
removeRegionSizesForTable(TableName tableName)
Removes each region size entry where the RegionInfo references the provided TableName.
|
void |
removeTableFromNamespaceQuota(TableName tName)
Remove table from namespace quota.
|
void |
setNamespaceQuota(NamespaceDescriptor desc) |
void |
setNamespaceQuota(String namespace,
org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.SetQuotaRequest req) |
org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.SetQuotaResponse |
setQuota(org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.SetQuotaRequest req) |
private void |
setQuota(org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.SetQuotaRequest req,
MasterQuotaManager.SetQuotaOperations quotaOps) |
void |
setRegionServerQuota(String regionServer,
org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.SetQuotaRequest req) |
void |
setTableQuota(TableName table,
org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.SetQuotaRequest req) |
void |
setUserQuota(String userName,
org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.SetQuotaRequest req) |
void |
setUserQuota(String userName,
String namespace,
org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.SetQuotaRequest req) |
void |
setUserQuota(String userName,
TableName table,
org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.SetQuotaRequest req) |
Map<RegionInfo,Long> |
snapshotRegionSizes() |
void |
start() |
void |
stop() |
org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.SwitchExceedThrottleQuotaResponse |
switchExceedThrottleQuota(org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.SwitchExceedThrottleQuotaRequest request) |
org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.SwitchRpcThrottleResponse |
switchRpcThrottle(org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.SwitchRpcThrottleRequest request) |
private static final org.slf4j.Logger LOG
private static final Map<RegionInfo,Long> EMPTY_MAP
private final MasterServices masterServices
private MasterQuotaManager.NamedLock<String> namespaceLocks
private MasterQuotaManager.NamedLock<TableName> tableLocks
private MasterQuotaManager.NamedLock<String> userLocks
private MasterQuotaManager.NamedLock<String> regionServerLocks
private boolean initialized
private NamespaceAuditor namespaceQuotaManager
private ConcurrentHashMap<RegionInfo,MasterQuotaManager.SizeSnapshotWithTimestamp> regionSizes
private RpcThrottleStorage rpcThrottleStorage
public MasterQuotaManager(MasterServices masterServices)
public void start() throws IOException
IOExceptionpublic void stop()
public boolean isQuotaInitialized()
public org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.SetQuotaResponse setQuota(org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.SetQuotaRequest req) throws IOException, InterruptedException
IOExceptionInterruptedExceptionpublic void setUserQuota(String userName, org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.SetQuotaRequest req) throws IOException, InterruptedException
IOExceptionInterruptedExceptionpublic void setUserQuota(String userName, TableName table, org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.SetQuotaRequest req) throws IOException, InterruptedException
IOExceptionInterruptedExceptionpublic void setUserQuota(String userName, String namespace, org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.SetQuotaRequest req) throws IOException, InterruptedException
IOExceptionInterruptedExceptionpublic void setTableQuota(TableName table, org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.SetQuotaRequest req) throws IOException, InterruptedException
IOExceptionInterruptedExceptionpublic void setNamespaceQuota(String namespace, org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.SetQuotaRequest req) throws IOException, InterruptedException
IOExceptionInterruptedExceptionpublic void setRegionServerQuota(String regionServer, org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.SetQuotaRequest req) throws IOException, InterruptedException
IOExceptionInterruptedExceptionpublic void setNamespaceQuota(NamespaceDescriptor desc) throws IOException
IOExceptionpublic void removeNamespaceQuota(String namespace) throws IOException
IOExceptionpublic org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.SwitchRpcThrottleResponse switchRpcThrottle(org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.SwitchRpcThrottleRequest request) throws IOException
IOExceptionpublic org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.IsRpcThrottleEnabledResponse isRpcThrottleEnabled(org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.IsRpcThrottleEnabledRequest request) throws IOException
IOExceptionpublic boolean isRpcThrottleEnabled() throws IOException
IOExceptionpublic org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.SwitchExceedThrottleQuotaResponse switchExceedThrottleQuota(org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.SwitchExceedThrottleQuotaRequest request) throws IOException
IOExceptionpublic boolean isExceedThrottleQuotaEnabled() throws IOException
IOExceptionprivate void setQuota(org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.SetQuotaRequest req, MasterQuotaManager.SetQuotaOperations quotaOps) throws IOException, InterruptedException
IOExceptionInterruptedExceptionpublic void checkNamespaceTableAndRegionQuota(TableName tName, int regions) throws IOException
IOExceptionpublic void checkAndUpdateNamespaceRegionQuota(TableName tName, int regions) throws IOException
IOExceptionpublic int getRegionCountOfTable(TableName tName) throws IOException
IOExceptionpublic void onRegionMerged(RegionInfo mergedRegion) throws IOException
RegionStateListeneronRegionMerged in interface RegionStateListenerIOExceptionpublic void onRegionSplit(RegionInfo hri) throws IOException
RegionStateListeneronRegionSplit in interface RegionStateListenerhri - An instance of RegionInfoIOExceptionpublic void removeTableFromNamespaceQuota(TableName tName) throws IOException
tName - - The table name to update quota usage.IOException - Signals that an I/O exception has occurred.public NamespaceAuditor getNamespaceQuotaManager()
private void checkQuotaSupport() throws IOException
IOExceptionprivate void createQuotaTable() throws IOException
IOExceptionpublic void onRegionSplitReverted(RegionInfo hri) throws IOException
RegionStateListeneronRegionSplitReverted in interface RegionStateListenerhri - An instance of RegionInfoIOException - Signals that an I/O exception has occurred.void initializeRegionSizes()
public void addRegionSize(RegionInfo hri, long size, long time)
public Map<RegionInfo,Long> snapshotRegionSizes()
int pruneEntriesOlderThan(long timeToPruneBefore, QuotaObserverChore quotaObserverChore)
private boolean isInViolationAndPolicyDisable(TableName tableName, QuotaObserverChore quotaObserverChore)
tableName - tableName to check.quotaObserverChore - QuotaObserverChore instancepublic void removeRegionSizesForTable(TableName tableName)
tableName - tableName.public void processFileArchivals(org.apache.hadoop.hbase.shaded.protobuf.generated.RegionServerStatusProtos.FileArchiveNotificationRequest request, Connection conn, org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.FileSystem fs) throws IOException
IOExceptionCopyright © 2007–2020 The Apache Software Foundation. All rights reserved.