Package org.apache.hadoop.hbase.quotas
Class QuotaCache
java.lang.Object
org.apache.hadoop.hbase.quotas.QuotaCache
- All Implemented Interfaces:
Stoppable
Cache that keeps track of the quota settings for the users and tables that are interacting with
it. To avoid blocking the operations if the requested quota is not in cache an "empty quota" will
be returned and the request to fetch the quota information will be enqueued for the next refresh.
TODO: At the moment the Cache has a Chore that will be triggered every 5min or on cache-miss
events. Later the Quotas will be pushed using the notification system.
-
Nested Class Summary
Modifier and TypeClassDescription(package private) static interface
private class
-
Field Summary
Modifier and TypeFieldDescriptionprivate static final int
private boolean
private static final org.slf4j.Logger
private double
private final ConcurrentMap<String,
QuotaState> static final String
static final String
private static final int
private QuotaCache.QuotaRefresherChore
private final ConcurrentMap<String,
QuotaState> private final RegionServerServices
private boolean
private final ConcurrentHashMap<TableName,
Double> private final ConcurrentMap<TableName,
QuotaState> (package private) static boolean
(package private) static boolean
private final String
private final ConcurrentMap<String,
UserQuotaState> -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription(package private) long
getNamespaceLimiter
(String namespace) Returns the limiter associated to the specified namespace.(package private) Map<String,
QuotaState> 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> getRegionServerQuotaLimiter
(String regionServer) Returns the limiter associated to the specified region server.getTableLimiter
(TableName table) Returns the limiter associated to the specified table.(package private) Map<TableName,
QuotaState> getUserLimiter
(org.apache.hadoop.security.UserGroupInformation ugi, TableName table) Returns the limiter associated to the specified user/table.(package private) Map<String,
UserQuotaState> getUserQuotaState
(org.apache.hadoop.security.UserGroupInformation ugi) Returns the QuotaState associated to the specified user.protected boolean
boolean
Returns True ifStoppable.stop(String)
has been closed.void
start()
void
Stop this service.(package private) void
-
Field Details
-
LOG
-
REFRESH_CONF_KEY
- See Also:
-
QUOTA_USER_REQUEST_ATTRIBUTE_OVERRIDE_KEY
- See Also:
-
REFRESH_DEFAULT_PERIOD
- See Also:
-
EVICT_PERIOD_FACTOR
- See Also:
-
TEST_FORCE_REFRESH
-
TEST_BLOCK_REFRESH
-
namespaceQuotaCache
-
tableQuotaCache
-
userQuotaCache
-
regionServerQuotaCache
-
exceedThrottleQuotaEnabled
-
machineQuotaFactor
-
tableMachineQuotaFactors
-
rsServices
-
userOverrideRequestAttributeKey
-
refreshChore
-
stopped
-
-
Constructor Details
-
QuotaCache
-
-
Method Details
-
start
- Throws:
IOException
-
stop
Description copied from interface:Stoppable
Stop this service. Implementers should favor logging errors over throwing RuntimeExceptions. -
isStopped
Description copied from interface:Stoppable
Returns True ifStoppable.stop(String)
has been closed. -
getUserLimiter
public QuotaLimiter getUserLimiter(org.apache.hadoop.security.UserGroupInformation ugi, TableName table) Returns the limiter associated to the specified user/table.- Parameters:
ugi
- the user to limittable
- the table to limit- Returns:
- the limiter associated to the specified user/table
-
getUserQuotaState
Returns the QuotaState associated to the specified user.- Parameters:
ugi
- the user- Returns:
- the quota info associated to specified user
-
getTableLimiter
Returns the limiter associated to the specified table.- Parameters:
table
- the table to limit- Returns:
- the limiter associated to the specified table
-
getNamespaceLimiter
Returns the limiter associated to the specified namespace.- Parameters:
namespace
- the namespace to limit- Returns:
- the limiter associated to the specified namespace
-
getRegionServerQuotaLimiter
Returns the limiter associated to the specified region server.- Parameters:
regionServer
- the region server to limit- Returns:
- the limiter associated to the specified region server
-
isExceedThrottleQuotaEnabled
-
getQuotaUserName
Applies a request attribute user override if available, otherwise returns the UGI's short username- Parameters:
ugi
- The request's UserGroupInformation
-
getQuotaState
Returns the QuotaState requested. If the quota info is not in cache an empty one will be returned and the quota request will be enqueued for the next cache refresh. -
triggerCacheRefresh
void triggerCacheRefresh() -
getLastUpdate
long getLastUpdate() -
getNamespaceQuotaCache
-
getRegionServerQuotaCache
-
getTableQuotaCache
-
getUserQuotaCache
-