Package org.apache.hadoop.hbase.quotas
Class RegionServerSpaceQuotaManager
java.lang.Object
org.apache.hadoop.hbase.quotas.RegionServerSpaceQuotaManager
A manager for filesystem space quotas in the RegionServer. This class is the centralized point
for what a RegionServer knows about space quotas on tables. For each table, it tracks two
different things: the
SpaceQuotaSnapshot
and a SpaceViolationPolicyEnforcement
(which may be null when a quota is not being violated). Both of these are sensitive on when they
were last updated. The {link SpaceQutoaViolationPolicyRefresherChore} periodically runs and
updates the state on this
.-
Field Summary
Modifier and TypeFieldDescriptionprivate AtomicReference<Map<TableName,
SpaceQuotaSnapshot>> private final ConcurrentHashMap<TableName,
SpaceViolationPolicyEnforcement> private static final org.slf4j.Logger
private RegionSizeReportingChore
private RegionSizeStore
private final RegionServerServices
private SpaceQuotaRefresherChore
private boolean
-
Constructor Summary
ConstructorDescriptionRegionServerSpaceQuotaManager
(RegionServerServices rsServices) RegionServerSpaceQuotaManager
(RegionServerServices rsServices, SpaceViolationPolicyEnforcementFactory factory) -
Method Summary
Modifier and TypeMethodDescriptionboolean
areCompactionsDisabled
(TableName tableName) Returns whether or not compactions should be disabled for the giventableName
per a space quota violation policy.org.apache.hadoop.hbase.shaded.protobuf.generated.RegionServerStatusProtos.FileArchiveNotificationRequest
buildFileArchiveRequest
(TableName tn, Collection<Map.Entry<String, Long>> archivedFiles) Builds the protobuf message to inform the Master of files being archived.(package private) Map<TableName,
SpaceViolationPolicyEnforcement> Returns the collection of tables which have quota violation policies enforced on this RegionServer.Copies the lastSpaceQuotaSnapshot
s that were recorded.void
disableViolationPolicyEnforcement
(TableName tableName) Disables enforcement on any violation policy on the giventableName
.void
enforceViolationPolicy
(TableName tableName, SpaceQuotaSnapshot snapshot) Enforces the given violationPolicy on the given table in this RegionServer.Creates an object well-suited for the RegionServer to use in verifying active policies.Converts a map of table toSpaceViolationPolicyEnforcement
s intoSpaceViolationPolicy
s.(package private) Connection
(package private) SpaceViolationPolicyEnforcementFactory
(package private) RegionServerServices
Returns theRegionSizeStore
tracking filesystem utilization by each region.boolean
Returns if theChore
has been started.void
start()
void
stop()
void
updateQuotaSnapshot
(Map<TableName, SpaceQuotaSnapshot> newSnapshots) Updates the currentSpaceQuotaSnapshot
s for the RegionServer.
-
Field Details
-
LOG
-
rsServices
-
spaceQuotaRefresher
-
currentQuotaSnapshots
-
started
-
enforcedPolicies
-
factory
-
regionSizeStore
-
regionSizeReporter
-
-
Constructor Details
-
RegionServerSpaceQuotaManager
-
RegionServerSpaceQuotaManager
RegionServerSpaceQuotaManager(RegionServerServices rsServices, SpaceViolationPolicyEnforcementFactory factory)
-
-
Method Details
-
start
- Throws:
IOException
-
stop
-
isStarted
Returns if theChore
has been started. -
copyQuotaSnapshots
Copies the lastSpaceQuotaSnapshot
s that were recorded. The current view of what the RegionServer thinks the table's utilization is. -
updateQuotaSnapshot
Updates the currentSpaceQuotaSnapshot
s for the RegionServer.- Parameters:
newSnapshots
- The space quota snapshots.
-
getActiveEnforcements
Creates an object well-suited for the RegionServer to use in verifying active policies. -
getActivePoliciesAsMap
Converts a map of table toSpaceViolationPolicyEnforcement
s intoSpaceViolationPolicy
s. -
enforceViolationPolicy
Enforces the given violationPolicy on the given table in this RegionServer. -
disableViolationPolicyEnforcement
Disables enforcement on any violation policy on the giventableName
. -
areCompactionsDisabled
Returns whether or not compactions should be disabled for the giventableName
per a space quota violation policy. A convenience method.- Parameters:
tableName
- The table to check- Returns:
- True if compactions should be disabled for the table, false otherwise.
-
getRegionSizeStore
Returns theRegionSizeStore
tracking filesystem utilization by each region.- Returns:
- A
RegionSizeStore
implementation.
-
buildFileArchiveRequest
public org.apache.hadoop.hbase.shaded.protobuf.generated.RegionServerStatusProtos.FileArchiveNotificationRequest buildFileArchiveRequest(TableName tn, Collection<Map.Entry<String, Long>> archivedFiles) Builds the protobuf message to inform the Master of files being archived.- Parameters:
tn
- The table the files previously belonged to.archivedFiles
- The files and their size in bytes that were archived.- Returns:
- The protobuf representation
-
copyActiveEnforcements
Returns the collection of tables which have quota violation policies enforced on this RegionServer. -
getRegionServerServices
-
getConnection
-
getFactory
-