Skip to content

Commit e233cfb

Browse files
committed
HBASE-22459 Expose store reader reference count (#248)
1 parent 1b2f863 commit e233cfb

10 files changed

Lines changed: 219 additions & 37 deletions

File tree

hbase-client/src/main/java/org/apache/hadoop/hbase/RegionLoad.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,13 @@ public long getLastMajorCompactionTs() {
187187
return regionLoadPB.getLastMajorCompactionTs();
188188
}
189189

190+
/**
191+
* @return the reference count for the stores of this region
192+
*/
193+
public int getStoreRefCount() {
194+
return regionLoadPB.getStoreRefCount();
195+
}
196+
190197
/**
191198
* @see java.lang.Object#toString()
192199
*/
@@ -196,6 +203,7 @@ public String toString() {
196203
this.getStores());
197204
sb = Strings.appendKeyValue(sb, "numberOfStorefiles",
198205
this.getStorefiles());
206+
sb = Strings.appendKeyValue(sb, "storeRefCount", this.getStoreRefCount());
199207
sb = Strings.appendKeyValue(sb, "storefileUncompressedSizeMB",
200208
this.getStoreUncompressedSizeMB());
201209
sb = Strings.appendKeyValue(sb, "lastMajorCompactionTimestamp",

hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionServerSource.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,8 @@ public interface MetricsRegionServerSource extends BaseSource, JvmPauseMonitorSo
229229
String WALFILE_SIZE_DESC = "Size of all WAL Files";
230230
String STOREFILE_COUNT = "storeFileCount";
231231
String STOREFILE_COUNT_DESC = "Number of Store Files";
232+
String STORE_REF_COUNT = "storeRefCount";
233+
String STORE_REF_COUNT_DESC = "Store reference count";
232234
String MEMSTORE_SIZE = "memStoreSize";
233235
String MEMSTORE_SIZE_DESC = "Size of the memstore";
234236
String STOREFILE_SIZE = "storeFileSize";

hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionWrapper.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,4 +142,9 @@ public interface MetricsRegionWrapper {
142142
* Get the replica id of this region.
143143
*/
144144
int getReplicaId();
145+
146+
/**
147+
* @return the number of references active on the store
148+
*/
149+
long getStoreRefCount();
145150
}

hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionSourceImpl.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,10 @@ void snapshot(MetricsRecordBuilder mrb, boolean ignored) {
213213
regionNamePrefix + MetricsRegionServerSource.STOREFILE_COUNT,
214214
MetricsRegionServerSource.STOREFILE_COUNT_DESC),
215215
this.regionWrapper.getNumStoreFiles());
216+
mrb.addGauge(Interns.info(
217+
regionNamePrefix + MetricsRegionServerSource.STORE_REF_COUNT,
218+
MetricsRegionServerSource.STORE_REF_COUNT),
219+
this.regionWrapper.getStoreRefCount());
216220
mrb.addGauge(Interns.info(
217221
regionNamePrefix + MetricsRegionServerSource.MEMSTORE_SIZE,
218222
MetricsRegionServerSource.MEMSTORE_SIZE_DESC),

hbase-hadoop2-compat/src/test/java/org/apache/hadoop/hbase/regionserver/TestMetricsRegionSourceImpl.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,6 @@
2222
import static org.junit.Assert.assertNotEquals;
2323
import static org.junit.Assert.assertTrue;
2424

25-
import java.util.Map;
26-
27-
import org.apache.commons.math.stat.descriptive.DescriptiveStatistics;
2825
import org.apache.hadoop.hbase.CompatibilitySingletonFactory;
2926
import org.apache.hadoop.hbase.testclassification.SmallTests;
3027
import org.apache.hadoop.hbase.testclassification.MetricsTests;
@@ -94,6 +91,11 @@ public long getNumStoreFiles() {
9491
return 0;
9592
}
9693

94+
@Override
95+
public long getStoreRefCount() {
96+
return 0;
97+
}
98+
9799
@Override
98100
public long getMemstoreSize() {
99101
return 0;

hbase-protocol/src/main/java/org/apache/hadoop/hbase/protobuf/generated/ClusterStatusProtos.java

Lines changed: 157 additions & 34 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

hbase-protocol/src/main/protobuf/ClusterStatus.proto

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,15 @@ message RegionLoad {
136136

137137
/** the most recent sequence Id of store from cache flush */
138138
repeated StoreSequenceId store_complete_sequence_id = 18;
139+
140+
/** branch-2 defines filtered_read_requests_count = 19, the current total
141+
filtered read requests made to region */
142+
143+
/** master defines cp_requests_count = 20, the current total coprocessor
144+
requests made to region */
145+
146+
/** the number of references active on the store */
147+
optional int32 store_ref_count = 21 [ default = 0 ];
139148
}
140149

141150
/* Server-level protobufs */

0 commit comments

Comments
 (0)