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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate class(package private) static class(package private) static interface -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanprivate booleanprivate final Objectprivate static final org.slf4j.Loggerprivate doubleprivate Map<String,QuotaState> static final Stringstatic final Stringprivate static final intprivate QuotaCache.QuotaRefresherChorestatic final Stringprivate Map<String,QuotaState> private final RegionServerServicesprivate booleanstatic final Stringprivate final ConcurrentHashMap<TableName,Double> private Map<TableName,QuotaState> private final Stringprivate Map<String,UserQuotaState> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidprivate Map<String,QuotaState> private Map<String,QuotaState> private Map<TableName,QuotaState> private Map<String,UserQuotaState> (package private) voidgetNamespaceLimiter(String namespace) Returns the limiter associated to the specified namespace.(package private) Map<String,QuotaState> visible for testing(package private) StringgetQuotaUserName(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> visible for testinggetRegionServerQuotaLimiter(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> visible for testinggetUserLimiter(org.apache.hadoop.security.UserGroupInformation ugi, TableName table) Returns the limiter associated to the specified user/table.(package private) Map<String,UserQuotaState> visible for testinggetUserQuotaState(org.apache.hadoop.security.UserGroupInformation ugi) Returns the QuotaState associated to the specified user.protected booleanbooleanReturns True ifStoppable.stop(String)has been closed.voidstart()voidStop this service.(package private) void(package private) static <K,V extends QuotaState>
voidupdateNewCacheFromOld(Map<K, V> oldCache, Map<K, V> newCache) visible for testing
-
Field Details
-
LOG
-
REFRESH_CONF_KEY
- See Also:
-
TABLE_REGION_STATES_CACHE_TTL_MS
- See Also:
-
REGION_SERVERS_SIZE_CACHE_TTL_MS
- See Also:
-
QUOTA_USER_REQUEST_ATTRIBUTE_OVERRIDE_KEY
- See Also:
-
REFRESH_DEFAULT_PERIOD
- See Also:
-
initializerLock
-
initialized
-
namespaceQuotaCache
-
tableQuotaCache
-
userQuotaCache
-
regionServerQuotaCache
-
exceedThrottleQuotaEnabled
-
machineQuotaFactor
-
tableMachineQuotaFactors
-
rsServices
-
userOverrideRequestAttributeKey
-
refreshChore
-
stopped
-
-
Constructor Details
-
QuotaCache
-
-
Method Details
-
start
- Throws:
IOException
-
stop
Description copied from interface:StoppableStop this service. Implementers should favor logging errors over throwing RuntimeExceptions. -
isStopped
Description copied from interface:StoppableReturns True ifStoppable.stop(String)has been closed. -
ensureInitialized
-
fetchUserQuotaStateEntries
- Throws:
IOException
-
fetchRegionServerQuotaStateEntries
- Throws:
IOException
-
fetchTableQuotaStateEntries
- Throws:
IOException
-
fetchNamespaceQuotaStateEntries
- Throws:
IOException
-
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
-
triggerCacheRefresh
void triggerCacheRefresh() -
forceSynchronousCacheRefresh
void forceSynchronousCacheRefresh() -
getNamespaceQuotaCache
visible for testing -
getRegionServerQuotaCache
visible for testing -
getTableQuotaCache
visible for testing -
getUserQuotaCache
visible for testing -
updateNewCacheFromOld
visible for testing
-