HBASE-26688 Threads shared EMPTY_RESULT may lead to unexpected client job down. ...
[hbase.git] / hbase-client / src / main / java / org / apache / hadoop / hbase / RegionMetrics.java
blob8cd3ea156c4da10d79ccacf4f0dc7e4a8bc771ee
1 /**
2 * Copyright The Apache Software Foundation
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
21 package org.apache.hadoop.hbase;
23 import java.util.Map;
24 import org.apache.hadoop.hbase.client.CompactionState;
25 import org.apache.hadoop.hbase.util.Bytes;
26 import org.apache.yetus.audience.InterfaceAudience;
28 /**
29 * Encapsulates per-region load metrics.
31 @InterfaceAudience.Public
32 public interface RegionMetrics {
34 /**
35 * @return the region name
37 byte[] getRegionName();
39 /**
40 * @return the number of stores
42 int getStoreCount();
44 /**
45 * @return the number of storefiles
47 int getStoreFileCount();
49 /**
50 * @return the total size of the storefiles
52 Size getStoreFileSize();
54 /**
55 * @return the memstore size
57 Size getMemStoreSize();
59 /**
60 * @return the number of read requests made to region
62 long getReadRequestCount();
64 /**
65 * @return the number of write requests made to region
67 long getWriteRequestCount();
69 /**
70 * @return the number of coprocessor service requests made to region
72 public long getCpRequestCount();
74 /**
75 * @return the number of write requests and read requests and coprocessor
76 * service requests made to region
78 default long getRequestCount() {
79 return getReadRequestCount() + getWriteRequestCount() + getCpRequestCount();
82 /**
83 * @return the region name as a string
85 default String getNameAsString() {
86 return Bytes.toStringBinary(getRegionName());
89 /**
90 * @return the number of filtered read requests made to region
92 long getFilteredReadRequestCount();
94 /**
95 * TODO: why we pass the same value to different counters? Currently, the value from
96 * getStoreFileIndexSize() is same with getStoreFileRootLevelIndexSize()
97 * see HRegionServer#createRegionLoad.
98 * @return The current total size of root-level indexes for the region
100 Size getStoreFileIndexSize();
103 * @return The current total size of root-level indexes for the region
105 Size getStoreFileRootLevelIndexSize();
108 * @return The total size of all index blocks, not just the root level
110 Size getStoreFileUncompressedDataIndexSize();
113 * @return The total size of all Bloom filter blocks, not just loaded into the block cache
115 Size getBloomFilterSize();
118 * @return the total number of cells in current compaction
120 long getCompactingCellCount();
123 * @return the number of already compacted kvs in current compaction
125 long getCompactedCellCount();
128 * This does not really belong inside RegionLoad but its being done in the name of expediency.
129 * @return the completed sequence Id for the region
131 long getCompletedSequenceId();
134 * @return completed sequence id per store.
136 Map<byte[], Long> getStoreSequenceId();
140 * @return the uncompressed size of the storefiles
142 Size getUncompressedStoreFileSize();
145 * @return the data locality of region in the regionserver.
147 float getDataLocality();
150 * @return the timestamp of the oldest hfile for any store of this region.
152 long getLastMajorCompactionTimestamp();
155 * @return the reference count for the stores of this region
157 int getStoreRefCount();
160 * @return the max reference count for any store file among all compacted stores files
161 * of this region
163 int getMaxCompactedStoreFileRefCount();
166 * Different from dataLocality,this metric's numerator only include the data stored on ssd
167 * @return the data locality for ssd of region in the regionserver
169 float getDataLocalityForSsd();
172 * @return the data at local weight of this region in the regionserver
174 long getBlocksLocalWeight();
177 * Different from blocksLocalWeight,this metric's numerator only include the data stored on ssd
178 * @return the data at local with ssd weight of this region in the regionserver
180 long getBlocksLocalWithSsdWeight();
183 * @return the block total weight of this region
185 long getBlocksTotalWeight();
188 * @return the compaction state of this region
190 CompactionState getCompactionState();