View Javadoc

1   /**
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *     http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing, software
13   * distributed under the License is distributed on an "AS IS" BASIS,
14   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   * See the License for the specific language governing permissions and
16   * limitations under the License.
17   */
18  package org.apache.hadoop.hbase.regionserver;
19  
20  import java.util.Collection;
21  import java.util.List;
22  import java.util.concurrent.ScheduledExecutorService;
23  import java.util.concurrent.TimeUnit;
24  
25  import org.apache.commons.lang.StringUtils;
26  import org.apache.commons.logging.Log;
27  import org.apache.commons.logging.LogFactory;
28  import org.apache.hadoop.hbase.classification.InterfaceAudience;
29  import org.apache.hadoop.hbase.CompatibilitySingletonFactory;
30  import org.apache.hadoop.hbase.HConstants;
31  import org.apache.hadoop.hbase.HDFSBlocksDistribution;
32  import org.apache.hadoop.hbase.HRegionInfo;
33  import org.apache.hadoop.hbase.ServerName;
34  import org.apache.hadoop.hbase.io.hfile.BlockCache;
35  import org.apache.hadoop.hbase.io.hfile.CacheConfig;
36  import org.apache.hadoop.hbase.io.hfile.CacheStats;
37  import org.apache.hadoop.hbase.wal.WALProvider;
38  import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
39  import org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher;
40  import org.apache.hadoop.metrics2.MetricsExecutor;
41  
42  /**
43   * Impl for exposing HRegionServer Information through Hadoop's metrics 2 system.
44   */
45  @InterfaceAudience.Private
46  class MetricsRegionServerWrapperImpl
47      implements MetricsRegionServerWrapper {
48  
49    private static final Log LOG = LogFactory.getLog(MetricsRegionServerWrapperImpl.class);
50  
51    private final HRegionServer regionServer;
52  
53    private BlockCache blockCache;
54  
55    private volatile long numStores = 0;
56    private volatile long numWALFiles = 0;
57    private volatile long walFileSize = 0;
58    private volatile long numStoreFiles = 0;
59    private volatile long memstoreSize = 0;
60    private volatile long storeFileSize = 0;
61    private volatile long maxStoreFileAge = 0;
62    private volatile long minStoreFileAge = 0;
63    private volatile long avgStoreFileAge = 0;
64    private volatile long numReferenceFiles = 0;
65    private volatile double requestsPerSecond = 0.0;
66    private volatile long readRequestsCount = 0;
67    private volatile long writeRequestsCount = 0;
68    private volatile double readRequestsRate = 0;
69    private volatile double writeRequestsRate = 0;
70    private volatile long checkAndMutateChecksFailed = 0;
71    private volatile long checkAndMutateChecksPassed = 0;
72    private volatile long storefileIndexSize = 0;
73    private volatile long totalStaticIndexSize = 0;
74    private volatile long totalStaticBloomSize = 0;
75    private volatile long numMutationsWithoutWAL = 0;
76    private volatile long dataInMemoryWithoutWAL = 0;
77    private volatile double percentFileLocal = 0;
78    private volatile double percentFileLocalSecondaryRegions = 0;
79    private volatile long flushedCellsCount = 0;
80    private volatile long compactedCellsCount = 0;
81    private volatile long majorCompactedCellsCount = 0;
82    private volatile long flushedCellsSize = 0;
83    private volatile long compactedCellsSize = 0;
84    private volatile long majorCompactedCellsSize = 0;
85    private volatile long blockedRequestsCount = 0L;
86    private volatile long averageRegionSize = 0L;
87  
88    private CacheStats cacheStats;
89    private CacheStats l1Stats = null;
90    private CacheStats l2Stats = null;
91    private ScheduledExecutorService executor;
92    private Runnable runnable;
93    private long period;
94  
95    public MetricsRegionServerWrapperImpl(final HRegionServer regionServer) {
96      this.regionServer = regionServer;
97      initBlockCache();
98  
99      this.period =
100         regionServer.conf.getLong(HConstants.REGIONSERVER_METRICS_PERIOD,
101           HConstants.DEFAULT_REGIONSERVER_METRICS_PERIOD);
102 
103     this.executor = CompatibilitySingletonFactory.getInstance(MetricsExecutor.class).getExecutor();
104     this.runnable = new RegionServerMetricsWrapperRunnable();
105     this.executor.scheduleWithFixedDelay(this.runnable, this.period, this.period,
106       TimeUnit.MILLISECONDS);
107 
108     if (LOG.isInfoEnabled()) {
109       LOG.info("Computing regionserver metrics every " + this.period + " milliseconds");
110     }
111   }
112 
113   /**
114    * It's possible that due to threading the block cache could not be initialized
115    * yet (testing multiple region servers in one jvm).  So we need to try and initialize
116    * the blockCache and cacheStats reference multiple times until we succeed.
117    */
118   private synchronized  void initBlockCache() {
119     CacheConfig cacheConfig = this.regionServer.cacheConfig;
120     if (cacheConfig != null) {
121       l1Stats = cacheConfig.getL1Stats();
122       l2Stats = cacheConfig.getL2Stats();
123       if (this.blockCache == null) {
124         this.blockCache = cacheConfig.getBlockCache();
125       }
126     }
127 
128     if (this.blockCache != null && this.cacheStats == null) {
129       this.cacheStats = blockCache.getStats();
130     }
131   }
132 
133   @Override
134   public String getClusterId() {
135     return regionServer.getClusterId();
136   }
137 
138   @Override
139   public long getStartCode() {
140     return regionServer.getStartcode();
141   }
142 
143   @Override
144   public String getZookeeperQuorum() {
145     ZooKeeperWatcher zk = regionServer.getZooKeeper();
146     if (zk == null) {
147       return "";
148     }
149     return zk.getQuorum();
150   }
151 
152   @Override
153   public String getCoprocessors() {
154     String[] coprocessors = regionServer.getRegionServerCoprocessors();
155     if (coprocessors == null || coprocessors.length == 0) {
156       return "";
157     }
158     return StringUtils.join(coprocessors, ", ");
159   }
160 
161   @Override
162   public String getServerName() {
163     ServerName serverName = regionServer.getServerName();
164     if (serverName == null) {
165       return "";
166     }
167     return serverName.getServerName();
168   }
169 
170   @Override
171   public long getNumOnlineRegions() {
172     Collection<Region> onlineRegionsLocalContext = regionServer.getOnlineRegionsLocalContext();
173     if (onlineRegionsLocalContext == null) {
174       return 0;
175     }
176     return onlineRegionsLocalContext.size();
177   }
178 
179   @Override
180   public long getTotalRequestCount() {
181     return regionServer.rpcServices.requestCount.get();
182   }
183 
184   @Override
185   public long getTotalRowActionRequestCount() {
186     return readRequestsCount + writeRequestsCount;
187   }
188 
189   @Override
190   public int getSplitQueueSize() {
191     if (this.regionServer.compactSplitThread == null) {
192       return 0;
193     }
194     return this.regionServer.compactSplitThread.getSplitQueueSize();
195   }
196 
197   @Override
198   public int getCompactionQueueSize() {
199     //The thread could be zero.  if so assume there is no queue.
200     if (this.regionServer.compactSplitThread == null) {
201       return 0;
202     }
203     return this.regionServer.compactSplitThread.getCompactionQueueSize();
204   }
205 
206   @Override
207   public int getSmallCompactionQueueSize() {
208     //The thread could be zero.  if so assume there is no queue.
209     if (this.regionServer.compactSplitThread == null) {
210       return 0;
211     }
212     return this.regionServer.compactSplitThread.getSmallCompactionQueueSize();
213   }
214 
215   @Override
216   public int getLargeCompactionQueueSize() {
217     //The thread could be zero.  if so assume there is no queue.
218     if (this.regionServer.compactSplitThread == null) {
219       return 0;
220     }
221     return this.regionServer.compactSplitThread.getLargeCompactionQueueSize();
222   }
223 
224   @Override
225   public int getFlushQueueSize() {
226     //If there is no flusher there should be no queue.
227     if (this.regionServer.cacheFlusher == null) {
228       return 0;
229     }
230     return this.regionServer.cacheFlusher.getFlushQueueSize();
231   }
232 
233   @Override
234   public long getBlockCacheCount() {
235     if (this.blockCache == null) {
236       return 0;
237     }
238     return this.blockCache.getBlockCount();
239   }
240 
241   @Override
242   public long getBlockCacheSize() {
243     if (this.blockCache == null) {
244       return 0;
245     }
246     return this.blockCache.getCurrentSize();
247   }
248 
249   @Override
250   public long getBlockCacheFreeSize() {
251     if (this.blockCache == null) {
252       return 0;
253     }
254     return this.blockCache.getFreeSize();
255   }
256 
257   @Override
258   public long getBlockCacheHitCount() {
259     if (this.cacheStats == null) {
260       return 0;
261     }
262     return this.cacheStats.getHitCount();
263   }
264 
265   @Override
266   public long getBlockCachePrimaryHitCount() {
267     if (this.cacheStats == null) {
268       return 0;
269     }
270     return this.cacheStats.getPrimaryHitCount();
271   }
272 
273   @Override
274   public long getBlockCacheMissCount() {
275     if (this.cacheStats == null) {
276       return 0;
277     }
278     return this.cacheStats.getMissCount();
279   }
280 
281   @Override
282   public long getBlockCachePrimaryMissCount() {
283     if (this.cacheStats == null) {
284       return 0;
285     }
286     return this.cacheStats.getPrimaryMissCount();
287   }
288 
289   @Override
290   public long getBlockCacheEvictedCount() {
291     if (this.cacheStats == null) {
292       return 0;
293     }
294     return this.cacheStats.getEvictedCount();
295   }
296 
297   @Override
298   public long getBlockCachePrimaryEvictedCount() {
299     if (this.cacheStats == null) {
300       return 0;
301     }
302     return this.cacheStats.getPrimaryEvictedCount();
303   }
304 
305   @Override
306   public double getBlockCacheHitPercent() {
307     if (this.cacheStats == null) {
308       return 0;
309     }
310     double ratio = this.cacheStats.getHitRatio();
311     if (Double.isNaN(ratio)) {
312       ratio = 0;
313     }
314     return (ratio * 100);
315   }
316 
317   @Override
318   public double getBlockCacheHitCachingPercent() {
319     if (this.cacheStats == null) {
320       return 0;
321     }
322 
323     double ratio = this.cacheStats.getHitCachingRatio();
324 
325     if (Double.isNaN(ratio)) {
326       ratio = 0;
327     }
328     return (ratio * 100);
329   }
330 
331   @Override
332   public long getBlockCacheFailedInsertions() {
333     if (this.cacheStats == null) {
334       return 0;
335     }
336     return this.cacheStats.getFailedInserts();
337   }
338 
339   @Override
340   public long getL1CacheHitCount() {
341     if (this.l1Stats == null) {
342       return 0;
343     }
344     return this.l1Stats.getHitCount();
345   }
346 
347   @Override
348   public long getL1CacheMissCount() {
349     if (this.l1Stats == null) {
350       return 0;
351     }
352     return this.l1Stats.getMissCount();
353   }
354 
355   @Override
356   public double getL1CacheHitRatio() {
357     if (this.l1Stats == null) {
358       return 0;
359     }
360     return this.l1Stats.getHitRatio();
361   }
362 
363   @Override
364   public double getL1CacheMissRatio() {
365     if (this.l1Stats == null) {
366       return 0;
367     }
368     return this.l1Stats.getMissRatio();
369   }
370 
371   @Override
372   public long getL2CacheHitCount() {
373     if (this.l2Stats == null) {
374       return 0;
375     }
376     return this.l2Stats.getHitCount();
377   }
378 
379   @Override
380   public long getL2CacheMissCount() {
381     if (this.l2Stats == null) {
382       return 0;
383     }
384     return this.l2Stats.getMissCount();
385   }
386 
387   @Override
388   public double getL2CacheHitRatio() {
389     if (this.l2Stats == null) {
390       return 0;
391     }
392     return this.l2Stats.getHitRatio();
393   }
394 
395   @Override
396   public double getL2CacheMissRatio() {
397     if (this.l2Stats == null) {
398       return 0;
399     }
400     return this.l2Stats.getMissRatio();
401   }
402 
403   @Override public void forceRecompute() {
404     this.runnable.run();
405   }
406 
407   @Override
408   public long getNumStores() {
409     return numStores;
410   }
411   
412   @Override
413   public long getNumWALFiles() {
414     return numWALFiles;
415   }
416 
417   @Override
418   public long getWALFileSize() {
419     return walFileSize;
420   }
421   
422   @Override
423   public long getNumStoreFiles() {
424     return numStoreFiles;
425   }
426 
427   @Override
428   public long getMaxStoreFileAge() {
429     return maxStoreFileAge;
430   }
431 
432   @Override
433   public long getMinStoreFileAge() {
434     return minStoreFileAge;
435   }
436 
437   @Override
438   public long getAvgStoreFileAge() {
439     return avgStoreFileAge;
440   }
441 
442   @Override
443   public long getNumReferenceFiles() {
444     return numReferenceFiles;
445   }
446 
447   @Override
448   public long getMemstoreSize() {
449     return memstoreSize;
450   }
451 
452   @Override
453   public long getStoreFileSize() {
454     return storeFileSize;
455   }
456 
457   @Override public double getRequestsPerSecond() {
458     return requestsPerSecond;
459   }
460 
461   @Override
462   public long getReadRequestsCount() {
463     return readRequestsCount;
464   }
465 
466   @Override
467   public long getWriteRequestsCount() {
468     return writeRequestsCount;
469   }
470 
471   @Override
472   public double getReadRequestsRate() {
473     return readRequestsRate;
474   }
475 
476   @Override
477   public double getWriteRequestsRate() {
478     return writeRequestsRate;
479   }
480 
481   @Override
482   public long getRpcGetRequestsCount() {
483     return regionServer.rpcServices.rpcGetRequestCount.get();
484   }
485 
486   @Override
487   public long getRpcScanRequestsCount() {
488     return regionServer.rpcServices.rpcScanRequestCount.get();
489   }
490 
491   @Override
492   public long getRpcMultiRequestsCount() {
493     return regionServer.rpcServices.rpcMultiRequestCount.get();
494   }
495 
496   @Override
497   public long getRpcMutateRequestsCount() {
498     return regionServer.rpcServices.rpcMutateRequestCount.get();
499   }
500 
501   @Override
502   public long getCheckAndMutateChecksFailed() {
503     return checkAndMutateChecksFailed;
504   }
505 
506   @Override
507   public long getCheckAndMutateChecksPassed() {
508     return checkAndMutateChecksPassed;
509   }
510 
511   @Override
512   public long getStoreFileIndexSize() {
513     return storefileIndexSize;
514   }
515 
516   @Override
517   public long getTotalStaticIndexSize() {
518     return totalStaticIndexSize;
519   }
520 
521   @Override
522   public long getTotalStaticBloomSize() {
523     return totalStaticBloomSize;
524   }
525 
526   @Override
527   public long getNumMutationsWithoutWAL() {
528     return numMutationsWithoutWAL;
529   }
530 
531   @Override
532   public long getDataInMemoryWithoutWAL() {
533     return dataInMemoryWithoutWAL;
534   }
535 
536   @Override
537   public double getPercentFileLocal() {
538     return percentFileLocal;
539   }
540 
541   @Override
542   public double getPercentFileLocalSecondaryRegions() {
543     return percentFileLocalSecondaryRegions;
544   }
545 
546   @Override
547   public long getUpdatesBlockedTime() {
548     if (this.regionServer.cacheFlusher == null) {
549       return 0;
550     }
551     return this.regionServer.cacheFlusher.getUpdatesBlockedMsHighWater().get();
552   }
553 
554   @Override
555   public long getFlushedCellsCount() {
556     return flushedCellsCount;
557   }
558 
559   @Override
560   public long getCompactedCellsCount() {
561     return compactedCellsCount;
562   }
563 
564   @Override
565   public long getMajorCompactedCellsCount() {
566     return majorCompactedCellsCount;
567   }
568 
569   @Override
570   public long getFlushedCellsSize() {
571     return flushedCellsSize;
572   }
573 
574   @Override
575   public long getCompactedCellsSize() {
576     return compactedCellsSize;
577   }
578 
579   @Override
580   public long getMajorCompactedCellsSize() {
581     return majorCompactedCellsSize;
582   }
583 
584   /**
585    * This is the runnable that will be executed on the executor every PERIOD number of seconds
586    * It will take metrics/numbers from all of the regions and use them to compute point in
587    * time metrics.
588    */
589   public class RegionServerMetricsWrapperRunnable implements Runnable {
590 
591     private long lastRan = 0;
592     private long lastRequestCount = 0;
593     private long lastReadRequestsCount = 0;
594     private long lastWriteRequestsCount = 0;
595 
596     @Override
597     synchronized public void run() {
598       try {
599         initBlockCache();
600 
601         HDFSBlocksDistribution hdfsBlocksDistribution = new HDFSBlocksDistribution();
602         HDFSBlocksDistribution hdfsBlocksDistributionSecondaryRegions =
603             new HDFSBlocksDistribution();
604 
605         long tempNumStores = 0;
606         long tempNumStoreFiles = 0;
607         long tempMemstoreSize = 0;
608         long tempStoreFileSize = 0;
609         long tempMaxStoreFileAge = 0;
610         long tempNumReferenceFiles = 0;
611         long avgAgeNumerator = 0;
612         long numHFiles = 0;
613         long tempMinStoreFileAge = Long.MAX_VALUE;
614         long tempReadRequestsCount = 0;
615         long tempWriteRequestsCount = 0;
616         long tempCheckAndMutateChecksFailed = 0;
617         long tempCheckAndMutateChecksPassed = 0;
618         long tempStorefileIndexSize = 0;
619         long tempTotalStaticIndexSize = 0;
620         long tempTotalStaticBloomSize = 0;
621         long tempNumMutationsWithoutWAL = 0;
622         long tempDataInMemoryWithoutWAL = 0;
623         double tempPercentFileLocal = 0;
624         double tempPercentFileLocalSecondaryRegions = 0;
625         long tempFlushedCellsCount = 0;
626         long tempCompactedCellsCount = 0;
627         long tempMajorCompactedCellsCount = 0;
628         long tempFlushedCellsSize = 0;
629         long tempCompactedCellsSize = 0;
630         long tempMajorCompactedCellsSize = 0;
631         long tempBlockedRequestsCount = 0L;
632 
633         int regionCount = 0;
634         for (Region r : regionServer.getOnlineRegionsLocalContext()) {
635           tempNumMutationsWithoutWAL += r.getNumMutationsWithoutWAL();
636           tempDataInMemoryWithoutWAL += r.getDataInMemoryWithoutWAL();
637           tempReadRequestsCount += r.getReadRequestsCount();
638           tempWriteRequestsCount += r.getWriteRequestsCount();
639           tempCheckAndMutateChecksFailed += r.getCheckAndMutateChecksFailed();
640           tempCheckAndMutateChecksPassed += r.getCheckAndMutateChecksPassed();
641           tempBlockedRequestsCount += r.getBlockedRequestsCount();
642           List<Store> storeList = r.getStores();
643           tempNumStores += storeList.size();
644           for (Store store : storeList) {
645             tempNumStoreFiles += store.getStorefilesCount();
646             tempMemstoreSize += store.getMemStoreSize();
647             tempStoreFileSize += store.getStorefilesSize();
648 
649             long storeMaxStoreFileAge = store.getMaxStoreFileAge();
650             tempMaxStoreFileAge = (storeMaxStoreFileAge > tempMaxStoreFileAge) ?
651               storeMaxStoreFileAge : tempMaxStoreFileAge;
652 
653             long storeMinStoreFileAge = store.getMinStoreFileAge();
654             tempMinStoreFileAge = (storeMinStoreFileAge < tempMinStoreFileAge) ?
655               storeMinStoreFileAge : tempMinStoreFileAge;
656 
657             long storeHFiles = store.getNumHFiles();
658             avgAgeNumerator += store.getAvgStoreFileAge() * storeHFiles;
659             numHFiles += storeHFiles;
660             tempNumReferenceFiles += store.getNumReferenceFiles();
661 
662             tempStorefileIndexSize += store.getStorefilesIndexSize();
663             tempTotalStaticBloomSize += store.getTotalStaticBloomSize();
664             tempTotalStaticIndexSize += store.getTotalStaticIndexSize();
665             tempFlushedCellsCount += store.getFlushedCellsCount();
666             tempCompactedCellsCount += store.getCompactedCellsCount();
667             tempMajorCompactedCellsCount += store.getMajorCompactedCellsCount();
668             tempFlushedCellsSize += store.getFlushedCellsSize();
669             tempCompactedCellsSize += store.getCompactedCellsSize();
670             tempMajorCompactedCellsSize += store.getMajorCompactedCellsSize();
671           }
672 
673           HDFSBlocksDistribution distro = r.getHDFSBlocksDistribution();
674           hdfsBlocksDistribution.add(distro);
675           if (r.getRegionInfo().getReplicaId() != HRegionInfo.DEFAULT_REPLICA_ID) {
676             hdfsBlocksDistributionSecondaryRegions.add(distro);
677           }
678           regionCount++;
679         }
680 
681         float localityIndex =
682             hdfsBlocksDistribution
683                 .getBlockLocalityIndex(regionServer.getServerName().getHostname());
684         tempPercentFileLocal = Double.isNaN(tempBlockedRequestsCount) ? 0 : (localityIndex * 100);
685 
686         float localityIndexSecondaryRegions =
687             hdfsBlocksDistributionSecondaryRegions.getBlockLocalityIndex(regionServer
688                 .getServerName().getHostname());
689         tempPercentFileLocalSecondaryRegions = Double
690             .isNaN(localityIndexSecondaryRegions) ? 0 : (localityIndexSecondaryRegions * 100);
691 
692         // Compute the number of requests per second
693         long currentTime = EnvironmentEdgeManager.currentTime();
694 
695         // assume that it took PERIOD seconds to start the executor.
696         // this is a guess but it's a pretty good one.
697         if (lastRan == 0) {
698           lastRan = currentTime - period;
699         }
700 
701         // If we've time traveled keep the last requests per second.
702         if ((currentTime - lastRan) > 0) {
703           long currentRequestCount = getTotalRequestCount();
704           requestsPerSecond =
705               (currentRequestCount - lastRequestCount) / ((currentTime - lastRan) / 1000.0);
706           lastRequestCount = currentRequestCount;
707 
708           long intervalReadRequestsCount = tempReadRequestsCount - lastReadRequestsCount;
709           long intervalWriteRequestsCount = tempWriteRequestsCount - lastWriteRequestsCount;
710 
711           double readRequestsRatePerMilliSecond = ((double)intervalReadRequestsCount/
712               (double)period);
713           double writeRequestsRatePerMilliSecond = ((double)intervalWriteRequestsCount/
714               (double)period);
715 
716           readRequestsRate = readRequestsRatePerMilliSecond * 1000.0;
717           writeRequestsRate = writeRequestsRatePerMilliSecond * 1000.0;
718 
719           lastReadRequestsCount = tempReadRequestsCount;
720           lastWriteRequestsCount = tempWriteRequestsCount;
721 
722         }
723         lastRan = currentTime;
724 
725         WALProvider provider = regionServer.walFactory.getWALProvider();
726         WALProvider metaProvider = regionServer.walFactory.getMetaWALProvider();
727         numWALFiles =
728             (provider == null ? 0 : provider.getNumLogFiles())
729                 + (metaProvider == null ? 0 : metaProvider.getNumLogFiles());
730         walFileSize =
731             (provider == null ? 0 : provider.getLogFileSize())
732                 + (provider == null ? 0 : provider.getLogFileSize());
733         // Copy over computed values so that no thread sees half computed values.
734         numStores = tempNumStores;
735         numStoreFiles = tempNumStoreFiles;
736         memstoreSize = tempMemstoreSize;
737         storeFileSize = tempStoreFileSize;
738         maxStoreFileAge = tempMaxStoreFileAge;
739         if (regionCount > 0) {
740           averageRegionSize = (memstoreSize + storeFileSize) / regionCount;
741         }
742         if (tempMinStoreFileAge != Long.MAX_VALUE) {
743           minStoreFileAge = tempMinStoreFileAge;
744         }
745 
746         if (numHFiles != 0) {
747           avgStoreFileAge = avgAgeNumerator / numHFiles;
748         }
749 
750         numReferenceFiles= tempNumReferenceFiles;
751         readRequestsCount = tempReadRequestsCount;
752         writeRequestsCount = tempWriteRequestsCount;
753         checkAndMutateChecksFailed = tempCheckAndMutateChecksFailed;
754         checkAndMutateChecksPassed = tempCheckAndMutateChecksPassed;
755         storefileIndexSize = tempStorefileIndexSize;
756         totalStaticIndexSize = tempTotalStaticIndexSize;
757         totalStaticBloomSize = tempTotalStaticBloomSize;
758         numMutationsWithoutWAL = tempNumMutationsWithoutWAL;
759         dataInMemoryWithoutWAL = tempDataInMemoryWithoutWAL;
760         percentFileLocal = tempPercentFileLocal;
761         percentFileLocalSecondaryRegions = tempPercentFileLocalSecondaryRegions;
762         flushedCellsCount = tempFlushedCellsCount;
763         compactedCellsCount = tempCompactedCellsCount;
764         majorCompactedCellsCount = tempMajorCompactedCellsCount;
765         flushedCellsSize = tempFlushedCellsSize;
766         compactedCellsSize = tempCompactedCellsSize;
767         majorCompactedCellsSize = tempMajorCompactedCellsSize;
768         blockedRequestsCount = tempBlockedRequestsCount;
769       } catch (Throwable e) {
770         LOG.warn("Caught exception! Will suppress and retry.", e);
771       }
772     }
773   }
774 
775   @Override
776   public long getBlockedRequestsCount() {
777     return blockedRequestsCount;
778   }
779 
780   @Override
781   public long getAverageRegionSize() {
782     return averageRegionSize;
783   }
784 
785   public long getDataMissCount() {
786     if (this.cacheStats == null) {
787       return 0;
788     }
789     return cacheStats.getDataMissCount();
790   }
791 
792   @Override
793   public long getLeafIndexMissCount() {
794     if (this.cacheStats == null) {
795       return 0;
796     }
797     return cacheStats.getLeafIndexMissCount();
798   }
799 
800   @Override
801   public long getBloomChunkMissCount() {
802     if (this.cacheStats == null) {
803       return 0;
804     }
805     return cacheStats.getBloomChunkMissCount();
806   }
807 
808   @Override
809   public long getMetaMissCount() {
810     if (this.cacheStats == null) {
811       return 0;
812     }
813     return cacheStats.getMetaMissCount();
814   }
815 
816   @Override
817   public long getRootIndexMissCount() {
818     if (this.cacheStats == null) {
819       return 0;
820     }
821     return cacheStats.getRootIndexMissCount();
822   }
823 
824   @Override
825   public long getIntermediateIndexMissCount() {
826     if (this.cacheStats == null) {
827       return 0;
828     }
829     return cacheStats.getIntermediateIndexMissCount();
830   }
831 
832   @Override
833   public long getFileInfoMissCount() {
834     if (this.cacheStats == null) {
835       return 0;
836     }
837     return cacheStats.getFileInfoMissCount();
838   }
839 
840   @Override
841   public long getGeneralBloomMetaMissCount() {
842     if (this.cacheStats == null) {
843       return 0;
844     }
845     return cacheStats.getGeneralBloomMetaMissCount();
846   }
847 
848   @Override
849   public long getDeleteFamilyBloomMissCount() {
850     if (this.cacheStats == null) {
851       return 0;
852     }
853     return cacheStats.getDeleteFamilyBloomMissCount();
854   }
855 
856   @Override
857   public long getTrailerMissCount() {
858     if (this.cacheStats == null) {
859       return 0;
860     }
861     return cacheStats.getTrailerMissCount();
862   }
863 
864   @Override
865   public long getDataHitCount() {
866     if (this.cacheStats == null) {
867       return 0;
868     }
869     return cacheStats.getDataHitCount();
870   }
871 
872   @Override
873   public long getLeafIndexHitCount() {
874     if (this.cacheStats == null) {
875       return 0;
876     }
877     return cacheStats.getLeafIndexHitCount();
878   }
879 
880   @Override
881   public long getBloomChunkHitCount() {
882     if (this.cacheStats == null) {
883       return 0;
884     }
885     return cacheStats.getBloomChunkHitCount();
886   }
887 
888   @Override
889   public long getMetaHitCount() {
890     if (this.cacheStats == null) {
891       return 0;
892     }
893     return cacheStats.getMetaHitCount();
894   }
895 
896   @Override
897   public long getRootIndexHitCount() {
898     if (this.cacheStats == null) {
899       return 0;
900     }
901     return cacheStats.getRootIndexHitCount();
902   }
903 
904   @Override
905   public long getIntermediateIndexHitCount() {
906     if (this.cacheStats == null) {
907       return 0;
908     }
909     return cacheStats.getIntermediateIndexHitCount();
910   }
911 
912   @Override
913   public long getFileInfoHitCount() {
914     if (this.cacheStats == null) {
915       return 0;
916     }
917     return cacheStats.getFileInfoHitCount();
918   }
919 
920   @Override
921   public long getGeneralBloomMetaHitCount() {
922     if (this.cacheStats == null) {
923       return 0;
924     }
925     return cacheStats.getGeneralBloomMetaHitCount();
926   }
927 
928   @Override
929   public long getDeleteFamilyBloomHitCount() {
930     if (this.cacheStats == null) {
931       return 0;
932     }
933     return cacheStats.getDeleteFamilyBloomHitCount();
934   }
935 
936   @Override
937   public long getTrailerHitCount() {
938     if (this.cacheStats == null) {
939       return 0;
940     }
941     return cacheStats.getTrailerHitCount();
942   }
943 }