@InterfaceAudience.Private @InterfaceStability.Evolving public class QuotaCache extends Object implements Stoppable
Modifier and Type | Class and Description |
---|---|
(package private) static interface |
QuotaCache.Fetcher<Key,Value> |
private class |
QuotaCache.QuotaRefresherChore |
Modifier and Type | Field and Description |
---|---|
private static int |
EVICT_PERIOD_FACTOR |
private boolean |
exceedThrottleQuotaEnabled |
private static org.slf4j.Logger |
LOG |
private double |
machineQuotaFactor |
private ConcurrentMap<String,QuotaState> |
namespaceQuotaCache |
static String |
QUOTA_USER_REQUEST_ATTRIBUTE_OVERRIDE_KEY |
static String |
REFRESH_CONF_KEY |
private static int |
REFRESH_DEFAULT_PERIOD |
private QuotaCache.QuotaRefresherChore |
refreshChore |
private ConcurrentMap<String,QuotaState> |
regionServerQuotaCache |
private RegionServerServices |
rsServices |
private boolean |
stopped |
private ConcurrentHashMap<TableName,Double> |
tableMachineQuotaFactors |
private ConcurrentMap<TableName,QuotaState> |
tableQuotaCache |
(package private) static boolean |
TEST_BLOCK_REFRESH |
(package private) static boolean |
TEST_FORCE_REFRESH |
private String |
userOverrideRequestAttributeKey |
private ConcurrentMap<String,UserQuotaState> |
userQuotaCache |
Constructor and Description |
---|
QuotaCache(RegionServerServices rsServices) |
Modifier and Type | Method and Description |
---|---|
(package private) long |
getLastUpdate() |
QuotaLimiter |
getNamespaceLimiter(String namespace)
Returns the limiter associated to the specified namespace.
|
(package private) Map<String,QuotaState> |
getNamespaceQuotaCache() |
private <K> QuotaState |
getQuotaState(ConcurrentMap<K,QuotaState> quotasMap,
K key)
Returns the QuotaState requested.
|
private String |
getQuotaUserName(org.apache.hadoop.security.UserGroupInformation ugi)
Applies a request attribute user override if available, otherwise returns the UGI's short
username
|
(package private) Map<String,QuotaState> |
getRegionServerQuotaCache() |
QuotaLimiter |
getRegionServerQuotaLimiter(String regionServer)
Returns the limiter associated to the specified region server.
|
QuotaLimiter |
getTableLimiter(TableName table)
Returns the limiter associated to the specified table.
|
(package private) Map<TableName,QuotaState> |
getTableQuotaCache() |
QuotaLimiter |
getUserLimiter(org.apache.hadoop.security.UserGroupInformation ugi,
TableName table)
Returns the limiter associated to the specified user/table.
|
(package private) Map<String,UserQuotaState> |
getUserQuotaCache() |
UserQuotaState |
getUserQuotaState(org.apache.hadoop.security.UserGroupInformation ugi)
Returns the QuotaState associated to the specified user.
|
protected boolean |
isExceedThrottleQuotaEnabled() |
boolean |
isStopped()
Returns True if
Stoppable.stop(String) has been closed. |
void |
start() |
void |
stop(String why)
Stop this service.
|
(package private) void |
triggerCacheRefresh() |
private static final org.slf4j.Logger LOG
public static final String REFRESH_CONF_KEY
public static final String QUOTA_USER_REQUEST_ATTRIBUTE_OVERRIDE_KEY
private static final int REFRESH_DEFAULT_PERIOD
private static final int EVICT_PERIOD_FACTOR
static boolean TEST_FORCE_REFRESH
static boolean TEST_BLOCK_REFRESH
private final ConcurrentMap<String,QuotaState> namespaceQuotaCache
private final ConcurrentMap<TableName,QuotaState> tableQuotaCache
private final ConcurrentMap<String,UserQuotaState> userQuotaCache
private final ConcurrentMap<String,QuotaState> regionServerQuotaCache
private volatile boolean exceedThrottleQuotaEnabled
private volatile double machineQuotaFactor
private final ConcurrentHashMap<TableName,Double> tableMachineQuotaFactors
private final RegionServerServices rsServices
private final String userOverrideRequestAttributeKey
private QuotaCache.QuotaRefresherChore refreshChore
private boolean stopped
public QuotaCache(RegionServerServices rsServices)
public void start() throws IOException
IOException
public void stop(String why)
Stoppable
public boolean isStopped()
Stoppable
Stoppable.stop(String)
has been closed.public QuotaLimiter getUserLimiter(org.apache.hadoop.security.UserGroupInformation ugi, TableName table)
ugi
- the user to limittable
- the table to limitpublic UserQuotaState getUserQuotaState(org.apache.hadoop.security.UserGroupInformation ugi)
ugi
- the userpublic QuotaLimiter getTableLimiter(TableName table)
table
- the table to limitpublic QuotaLimiter getNamespaceLimiter(String namespace)
namespace
- the namespace to limitpublic QuotaLimiter getRegionServerQuotaLimiter(String regionServer)
regionServer
- the region server to limitprotected boolean isExceedThrottleQuotaEnabled()
private String getQuotaUserName(org.apache.hadoop.security.UserGroupInformation ugi)
ugi
- The request's UserGroupInformationprivate <K> QuotaState getQuotaState(ConcurrentMap<K,QuotaState> quotasMap, K key)
void triggerCacheRefresh()
long getLastUpdate()
Map<String,QuotaState> getNamespaceQuotaCache()
Map<String,QuotaState> getRegionServerQuotaCache()
Map<TableName,QuotaState> getTableQuotaCache()
Map<String,UserQuotaState> getUserQuotaCache()
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.