org.apache.hadoop.hbase.quotas.RegionServerSpaceQuotaManager Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hbase-server Show documentation
Show all versions of hbase-server Show documentation
Server functionality for HBase
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to you under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.hbase.quotas;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicReference;
import java.util.Map.Entry;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.classification.InterfaceAudience;
import org.apache.hadoop.hbase.client.Connection;
import org.apache.hadoop.hbase.quotas.SpaceQuotaSnapshot.SpaceQuotaStatus;
import org.apache.hadoop.hbase.regionserver.RegionServerServices;
import com.google.common.annotations.VisibleForTesting;
/**
* 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 {@link SpaceQuotaSnapshot}
* and a {@link 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
.
*/
@InterfaceAudience.Private
public class RegionServerSpaceQuotaManager {
private static final Log LOG = LogFactory.getLog(RegionServerSpaceQuotaManager.class);
private final RegionServerServices rsServices;
private SpaceQuotaRefresherChore spaceQuotaRefresher;
private AtomicReference