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.io.IOException;
21  import java.util.Collection;
22  import java.util.List;
23  import java.util.concurrent.ScheduledExecutorService;
24  import java.util.concurrent.TimeUnit;
25  
26  import org.apache.commons.lang.StringUtils;
27  import org.apache.commons.logging.Log;
28  import org.apache.commons.logging.LogFactory;
29  import org.apache.hadoop.hbase.classification.InterfaceAudience;
30  import org.apache.hadoop.hbase.CompatibilitySingletonFactory;
31  import org.apache.hadoop.hbase.HConstants;
32  import org.apache.hadoop.hbase.HDFSBlocksDistribution;
33  import org.apache.hadoop.hbase.HRegionInfo;
34  import org.apache.hadoop.hbase.ServerName;
35  import org.apache.hadoop.hbase.io.hfile.BlockCache;
36  import org.apache.hadoop.hbase.io.hfile.CacheConfig;
37  import org.apache.hadoop.hbase.io.hfile.CacheStats;
38  import org.apache.hadoop.hbase.mob.MobCacheConfig;
39  import org.apache.hadoop.hbase.mob.MobFileCache;
40  import org.apache.hadoop.hbase.regionserver.wal.MetricsWALSource;
41  import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
42  import org.apache.hadoop.hbase.util.FSUtils;
43  import org.apache.hadoop.hbase.wal.WALProvider;
44  import org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher;
45  import org.apache.hadoop.hdfs.DFSHedgedReadMetrics;
46  import org.apache.hadoop.metrics2.MetricsExecutor;
47  
48  /**
49   * Impl for exposing HRegionServer Information through Hadoop's metrics 2 system.
50   */
51  @InterfaceAudience.Private
52  class MetricsRegionServerWrapperImpl
53      implements MetricsRegionServerWrapper {
54  
55    private static final Log LOG = LogFactory.getLog(MetricsRegionServerWrapperImpl.class);
56  
57    private final HRegionServer regionServer;
58    private final MetricsWALSource metricsWALSource;
59  
60    private BlockCache blockCache;
61    private MobFileCache mobFileCache;
62  
63    private volatile long numStores = 0;
64    private volatile long numWALFiles = 0;
65    private volatile long walFileSize = 0;
66    private volatile long numStoreFiles = 0;
67    private volatile long memstoreSize = 0;
68    private volatile long storeFileSize = 0;
69    private volatile double requestsPerSecond = 0.0;
70    private volatile long readRequestsCount = 0;
71    private volatile long filteredReadRequestsCount = 0;
72    private volatile long writeRequestsCount = 0;
73    private volatile long checkAndMutateChecksFailed = 0;
74    private volatile long checkAndMutateChecksPassed = 0;
75    private volatile long storefileIndexSize = 0;
76    private volatile long totalStaticIndexSize = 0;
77    private volatile long totalStaticBloomSize = 0;
78    private volatile long numMutationsWithoutWAL = 0;
79    private volatile long dataInMemoryWithoutWAL = 0;
80    private volatile double percentFileLocal = 0;
81    private volatile double percentFileLocalSecondaryRegions = 0;
82    private volatile long flushedCellsCount = 0;
83    private volatile long compactedCellsCount = 0;
84    private volatile long majorCompactedCellsCount = 0;
85    private volatile long flushedCellsSize = 0;
86    private volatile long compactedCellsSize = 0;
87    private volatile long majorCompactedCellsSize = 0;
88    private volatile long cellsCountCompactedToMob = 0;
89    private volatile long cellsCountCompactedFromMob = 0;
90    private volatile long cellsSizeCompactedToMob = 0;
91    private volatile long cellsSizeCompactedFromMob = 0;
92    private volatile long mobFlushCount = 0;
93    private volatile long mobFlushedCellsCount = 0;
94    private volatile long mobFlushedCellsSize = 0;
95    private volatile long mobScanCellsCount = 0;
96    private volatile long mobScanCellsSize = 0;
97    private volatile long mobFileCacheAccessCount = 0;
98    private volatile long mobFileCacheMissCount = 0;
99    private volatile double mobFileCacheHitRatio = 0;
100   private volatile long mobFileCacheEvictedCount = 0;
101   private volatile long mobFileCacheCount = 0;
102   private volatile long blockedRequestsCount = 0L;
103 
104   private CacheStats cacheStats;
105   private ScheduledExecutorService executor;
106   private Runnable runnable;
107   private long period;
108 
109   /**
110    * Can be null if not on hdfs.
111    */
112   private DFSHedgedReadMetrics dfsHedgedReadMetrics;
113 
114   public MetricsRegionServerWrapperImpl(final HRegionServer regionServer) {
115     this.regionServer = regionServer;
116     initBlockCache();
117     initMobFileCache();
118 
119     this.period =
120         regionServer.conf.getLong(HConstants.REGIONSERVER_METRICS_PERIOD,
121           HConstants.DEFAULT_REGIONSERVER_METRICS_PERIOD);
122 
123     this.executor = CompatibilitySingletonFactory.getInstance(MetricsExecutor.class).getExecutor();
124     this.runnable = new RegionServerMetricsWrapperRunnable();
125     this.executor.scheduleWithFixedDelay(this.runnable, this.period, this.period,
126       TimeUnit.MILLISECONDS);
127     this.metricsWALSource = CompatibilitySingletonFactory.getInstance(MetricsWALSource.class);
128 
129     try {
130       this.dfsHedgedReadMetrics = FSUtils.getDFSHedgedReadMetrics(regionServer.getConfiguration());
131     } catch (IOException e) {
132       LOG.warn("Failed to get hedged metrics", e);
133     }
134     if (LOG.isInfoEnabled()) {
135       LOG.info("Computing regionserver metrics every " + this.period + " milliseconds");
136     }
137   }
138 
139   /**
140    * It's possible that due to threading the block cache could not be initialized
141    * yet (testing multiple region servers in one jvm).  So we need to try and initialize
142    * the blockCache and cacheStats reference multiple times until we succeed.
143    */
144   private synchronized  void initBlockCache() {
145     CacheConfig cacheConfig = this.regionServer.cacheConfig;
146     if (cacheConfig != null && this.blockCache == null) {
147       this.blockCache = cacheConfig.getBlockCache();
148     }
149 
150     if (this.blockCache != null && this.cacheStats == null) {
151       this.cacheStats = blockCache.getStats();
152     }
153   }
154 
155   /**
156    * Initializes the mob file cache.
157    */
158   private synchronized void initMobFileCache() {
159     MobCacheConfig mobCacheConfig = this.regionServer.mobCacheConfig;
160     if (mobCacheConfig != null && this.mobFileCache == null) {
161       this.mobFileCache = mobCacheConfig.getMobFileCache();
162     }
163   }
164 
165   @Override
166   public String getClusterId() {
167     return regionServer.getClusterId();
168   }
169 
170   @Override
171   public long getStartCode() {
172     return regionServer.getStartcode();
173   }
174 
175   @Override
176   public String getZookeeperQuorum() {
177     ZooKeeperWatcher zk = regionServer.getZooKeeper();
178     if (zk == null) {
179       return "";
180     }
181     return zk.getQuorum();
182   }
183 
184   @Override
185   public String getCoprocessors() {
186     String[] coprocessors = regionServer.getRegionServerCoprocessors();
187     if (coprocessors == null || coprocessors.length == 0) {
188       return "";
189     }
190     return StringUtils.join(coprocessors, ", ");
191   }
192 
193   @Override
194   public String getServerName() {
195     ServerName serverName = regionServer.getServerName();
196     if (serverName == null) {
197       return "";
198     }
199     return serverName.getServerName();
200   }
201 
202   @Override
203   public long getNumOnlineRegions() {
204     Collection<Region> onlineRegionsLocalContext = regionServer.getOnlineRegionsLocalContext();
205     if (onlineRegionsLocalContext == null) {
206       return 0;
207     }
208     return onlineRegionsLocalContext.size();
209   }
210 
211   @Override
212   public long getTotalRequestCount() {
213     return regionServer.rpcServices.requestCount.get();
214   }
215 
216   @Override
217   public int getSplitQueueSize() {
218     if (this.regionServer.compactSplitThread == null) {
219       return 0;
220     }
221     return this.regionServer.compactSplitThread.getSplitQueueSize();
222   }
223 
224   @Override
225   public int getCompactionQueueSize() {
226     //The thread could be zero.  if so assume there is no queue.
227     if (this.regionServer.compactSplitThread == null) {
228       return 0;
229     }
230     return this.regionServer.compactSplitThread.getCompactionQueueSize();
231   }
232 
233   @Override
234   public int getSmallCompactionQueueSize() {
235     //The thread could be zero.  if so assume there is no queue.
236     if (this.regionServer.compactSplitThread == null) {
237       return 0;
238     }
239     return this.regionServer.compactSplitThread.getSmallCompactionQueueSize();
240   }
241 
242   @Override
243   public int getLargeCompactionQueueSize() {
244     //The thread could be zero.  if so assume there is no queue.
245     if (this.regionServer.compactSplitThread == null) {
246       return 0;
247     }
248     return this.regionServer.compactSplitThread.getLargeCompactionQueueSize();
249   }
250 
251   @Override
252   public int getFlushQueueSize() {
253     //If there is no flusher there should be no queue.
254     if (this.regionServer.cacheFlusher == null) {
255       return 0;
256     }
257     return this.regionServer.cacheFlusher.getFlushQueueSize();
258   }
259 
260   @Override
261   public long getBlockCacheCount() {
262     if (this.blockCache == null) {
263       return 0;
264     }
265     return this.blockCache.getBlockCount();
266   }
267 
268   @Override
269   public long getBlockCacheSize() {
270     if (this.blockCache == null) {
271       return 0;
272     }
273     return this.blockCache.getCurrentSize();
274   }
275 
276   @Override
277   public long getBlockCacheFreeSize() {
278     if (this.blockCache == null) {
279       return 0;
280     }
281     return this.blockCache.getFreeSize();
282   }
283 
284   @Override
285   public long getBlockCacheHitCount() {
286     if (this.cacheStats == null) {
287       return 0;
288     }
289     return this.cacheStats.getHitCount();
290   }
291 
292   @Override
293   public long getBlockCachePrimaryHitCount() {
294     if (this.cacheStats == null) {
295       return 0;
296     }
297     return this.cacheStats.getPrimaryHitCount();
298   }
299 
300   @Override
301   public long getBlockCacheMissCount() {
302     if (this.cacheStats == null) {
303       return 0;
304     }
305     return this.cacheStats.getMissCount();
306   }
307 
308   @Override
309   public long getBlockCachePrimaryMissCount() {
310     if (this.cacheStats == null) {
311       return 0;
312     }
313     return this.cacheStats.getPrimaryMissCount();
314   }
315 
316   @Override
317   public long getBlockCacheEvictedCount() {
318     if (this.cacheStats == null) {
319       return 0;
320     }
321     return this.cacheStats.getEvictedCount();
322   }
323 
324   @Override
325   public long getBlockCachePrimaryEvictedCount() {
326     if (this.cacheStats == null) {
327       return 0;
328     }
329     return this.cacheStats.getPrimaryEvictedCount();
330   }
331 
332   @Override
333   public double getBlockCacheHitPercent() {
334     if (this.cacheStats == null) {
335       return 0;
336     }
337     double ratio = this.cacheStats.getHitRatio();
338     if (Double.isNaN(ratio)) {
339       ratio = 0;
340     }
341     return (ratio * 100);
342   }
343 
344   @Override
345   public double getBlockCacheHitCachingPercent() {
346     if (this.cacheStats == null) {
347       return 0;
348     }
349 
350     double ratio = this.cacheStats.getHitCachingRatio();
351 
352     if (Double.isNaN(ratio)) {
353       ratio = 0;
354     }
355     return (ratio * 100);
356   }
357 
358   @Override
359   public long getBlockCacheFailedInsertions() {
360     return this.cacheStats.getFailedInserts();
361   }
362 
363   @Override public void forceRecompute() {
364     this.runnable.run();
365   }
366 
367   @Override
368   public long getNumStores() {
369     return numStores;
370   }
371   
372   @Override
373   public long getNumWALFiles() {
374     return numWALFiles;
375   }
376 
377   @Override
378   public long getWALFileSize() {
379     return walFileSize;
380   }
381 
382   @Override
383   public long getNumWALSlowAppend() {
384     return metricsWALSource.getSlowAppendCount();
385   }
386   
387   @Override
388   public long getNumStoreFiles() {
389     return numStoreFiles;
390   }
391 
392   @Override
393   public long getMemstoreSize() {
394     return memstoreSize;
395   }
396 
397   @Override
398   public long getStoreFileSize() {
399     return storeFileSize;
400   }
401 
402   @Override public double getRequestsPerSecond() {
403     return requestsPerSecond;
404   }
405 
406   @Override
407   public long getReadRequestsCount() {
408     return readRequestsCount;
409   }
410 
411   @Override
412   public long getFilteredReadRequestsCount() {
413     return filteredReadRequestsCount;
414   }
415 
416   @Override
417   public long getWriteRequestsCount() {
418     return writeRequestsCount;
419   }
420 
421   @Override
422   public long getRpcGetRequestsCount() {
423     return regionServer.rpcServices.rpcGetRequestCount.get();
424   }
425 
426   @Override
427   public long getRpcScanRequestsCount() {
428     return regionServer.rpcServices.rpcScanRequestCount.get();
429   }
430 
431   @Override
432   public long getRpcMultiRequestsCount() {
433     return regionServer.rpcServices.rpcMultiRequestCount.get();
434   }
435 
436   @Override
437   public long getRpcMutateRequestsCount() {
438     return regionServer.rpcServices.rpcMutateRequestCount.get();
439   }
440 
441   @Override
442   public long getCheckAndMutateChecksFailed() {
443     return checkAndMutateChecksFailed;
444   }
445 
446   @Override
447   public long getCheckAndMutateChecksPassed() {
448     return checkAndMutateChecksPassed;
449   }
450 
451   @Override
452   public long getStoreFileIndexSize() {
453     return storefileIndexSize;
454   }
455 
456   @Override
457   public long getTotalStaticIndexSize() {
458     return totalStaticIndexSize;
459   }
460 
461   @Override
462   public long getTotalStaticBloomSize() {
463     return totalStaticBloomSize;
464   }
465 
466   @Override
467   public long getNumMutationsWithoutWAL() {
468     return numMutationsWithoutWAL;
469   }
470 
471   @Override
472   public long getDataInMemoryWithoutWAL() {
473     return dataInMemoryWithoutWAL;
474   }
475 
476   @Override
477   public double getPercentFileLocal() {
478     return percentFileLocal;
479   }
480 
481   @Override
482   public double getPercentFileLocalSecondaryRegions() {
483     return percentFileLocalSecondaryRegions;
484   }
485 
486   @Override
487   public long getUpdatesBlockedTime() {
488     if (this.regionServer.cacheFlusher == null) {
489       return 0;
490     }
491     return this.regionServer.cacheFlusher.getUpdatesBlockedMsHighWater().get();
492   }
493 
494   @Override
495   public long getFlushedCellsCount() {
496     return flushedCellsCount;
497   }
498 
499   @Override
500   public long getCompactedCellsCount() {
501     return compactedCellsCount;
502   }
503 
504   @Override
505   public long getMajorCompactedCellsCount() {
506     return majorCompactedCellsCount;
507   }
508 
509   @Override
510   public long getFlushedCellsSize() {
511     return flushedCellsSize;
512   }
513 
514   @Override
515   public long getCompactedCellsSize() {
516     return compactedCellsSize;
517   }
518 
519   @Override
520   public long getMajorCompactedCellsSize() {
521     return majorCompactedCellsSize;
522   }
523 
524   @Override
525   public long getCellsCountCompactedFromMob() {
526     return cellsCountCompactedFromMob;
527   }
528 
529   @Override
530   public long getCellsCountCompactedToMob() {
531     return cellsCountCompactedToMob;
532   }
533 
534   @Override
535   public long getCellsSizeCompactedFromMob() {
536     return cellsSizeCompactedFromMob;
537   }
538 
539   @Override
540   public long getCellsSizeCompactedToMob() {
541     return cellsSizeCompactedToMob;
542   }
543 
544   @Override
545   public long getMobFlushCount() {
546     return mobFlushCount;
547   }
548 
549   @Override
550   public long getMobFlushedCellsCount() {
551     return mobFlushedCellsCount;
552   }
553 
554   @Override
555   public long getMobFlushedCellsSize() {
556     return mobFlushedCellsSize;
557   }
558 
559   @Override
560   public long getMobScanCellsCount() {
561     return mobScanCellsCount;
562   }
563 
564   @Override
565   public long getMobScanCellsSize() {
566     return mobScanCellsSize;
567   }
568 
569   @Override
570   public long getMobFileCacheAccessCount() {
571     return mobFileCacheAccessCount;
572   }
573 
574   @Override
575   public long getMobFileCacheMissCount() {
576     return mobFileCacheMissCount;
577   }
578 
579   @Override
580   public long getMobFileCacheCount() {
581     return mobFileCacheCount;
582   }
583 
584   @Override
585   public long getMobFileCacheEvictedCount() {
586     return mobFileCacheEvictedCount;
587   }
588 
589   @Override
590   public double getMobFileCacheHitPercent() {
591     return mobFileCacheHitRatio * 100;
592   }
593 
594   /**
595    * This is the runnable that will be executed on the executor every PERIOD number of seconds
596    * It will take metrics/numbers from all of the regions and use them to compute point in
597    * time metrics.
598    */
599   public class RegionServerMetricsWrapperRunnable implements Runnable {
600 
601     private long lastRan = 0;
602     private long lastRequestCount = 0;
603 
604     @Override
605     synchronized public void run() {
606       try {
607         initBlockCache();
608         initMobFileCache();
609         cacheStats = blockCache.getStats();
610 
611         HDFSBlocksDistribution hdfsBlocksDistribution =
612             new HDFSBlocksDistribution();
613         HDFSBlocksDistribution hdfsBlocksDistributionSecondaryRegions =
614             new HDFSBlocksDistribution();
615 
616         long tempNumStores = 0, tempNumStoreFiles = 0, tempMemstoreSize = 0, tempStoreFileSize = 0;
617         long tempReadRequestsCount = 0, tempFilteredReadRequestsCount = 0,
618           tempWriteRequestsCount = 0;
619         long tempCheckAndMutateChecksFailed = 0;
620         long tempCheckAndMutateChecksPassed = 0;
621         long tempStorefileIndexSize = 0;
622         long tempTotalStaticIndexSize = 0;
623         long tempTotalStaticBloomSize = 0;
624         long tempNumMutationsWithoutWAL = 0;
625         long tempDataInMemoryWithoutWAL = 0;
626         double tempPercentFileLocal = 0;
627         double tempPercentFileLocalSecondaryRegions = 0;
628         long tempFlushedCellsCount = 0;
629         long tempCompactedCellsCount = 0;
630         long tempMajorCompactedCellsCount = 0;
631         long tempFlushedCellsSize = 0;
632         long tempCompactedCellsSize = 0;
633         long tempMajorCompactedCellsSize = 0;
634         long tempCellsCountCompactedToMob = 0;
635         long tempCellsCountCompactedFromMob = 0;
636         long tempCellsSizeCompactedToMob = 0;
637         long tempCellsSizeCompactedFromMob = 0;
638         long tempMobFlushCount = 0;
639         long tempMobFlushedCellsCount = 0;
640         long tempMobFlushedCellsSize = 0;
641         long tempMobScanCellsCount = 0;
642         long tempMobScanCellsSize = 0;
643         long tempBlockedRequestsCount = 0;
644 
645         for (Region r : regionServer.getOnlineRegionsLocalContext()) {
646           tempNumMutationsWithoutWAL += r.getNumMutationsWithoutWAL();
647           tempDataInMemoryWithoutWAL += r.getDataInMemoryWithoutWAL();
648           tempReadRequestsCount += r.getReadRequestsCount();
649           tempFilteredReadRequestsCount += r.getFilteredReadRequestsCount();
650           tempWriteRequestsCount += r.getWriteRequestsCount();
651           tempCheckAndMutateChecksFailed += r.getCheckAndMutateChecksFailed();
652           tempCheckAndMutateChecksPassed += r.getCheckAndMutateChecksPassed();
653           tempBlockedRequestsCount += r.getBlockedRequestsCount();
654           List<Store> storeList = r.getStores();
655           tempNumStores += storeList.size();
656           for (Store store : storeList) {
657             tempNumStoreFiles += store.getStorefilesCount();
658             tempMemstoreSize += store.getMemStoreSize();
659             tempStoreFileSize += store.getStorefilesSize();
660             tempStorefileIndexSize += store.getStorefilesIndexSize();
661             tempTotalStaticBloomSize += store.getTotalStaticBloomSize();
662             tempTotalStaticIndexSize += store.getTotalStaticIndexSize();
663             tempFlushedCellsCount += store.getFlushedCellsCount();
664             tempCompactedCellsCount += store.getCompactedCellsCount();
665             tempMajorCompactedCellsCount += store.getMajorCompactedCellsCount();
666             tempFlushedCellsSize += store.getFlushedCellsSize();
667             tempCompactedCellsSize += store.getCompactedCellsSize();
668             tempMajorCompactedCellsSize += store.getMajorCompactedCellsSize();
669             if (store instanceof HMobStore) {
670               HMobStore mobStore = (HMobStore) store;
671               tempCellsCountCompactedToMob += mobStore.getCellsCountCompactedToMob();
672               tempCellsCountCompactedFromMob += mobStore.getCellsCountCompactedFromMob();
673               tempCellsSizeCompactedToMob += mobStore.getCellsSizeCompactedToMob();
674               tempCellsSizeCompactedFromMob += mobStore.getCellsSizeCompactedFromMob();
675               tempMobFlushCount += mobStore.getMobFlushCount();
676               tempMobFlushedCellsCount += mobStore.getMobFlushedCellsCount();
677               tempMobFlushedCellsSize += mobStore.getMobFlushedCellsSize();
678               tempMobScanCellsCount += mobStore.getMobScanCellsCount();
679               tempMobScanCellsSize += mobStore.getMobScanCellsSize();
680             }
681           }
682 
683           HDFSBlocksDistribution distro = r.getHDFSBlocksDistribution();
684           hdfsBlocksDistribution.add(distro);
685           if (r.getRegionInfo().getReplicaId() != HRegionInfo.DEFAULT_REPLICA_ID) {
686             hdfsBlocksDistributionSecondaryRegions.add(distro);
687           }
688         }
689         float localityIndex = hdfsBlocksDistribution.getBlockLocalityIndex(
690             regionServer.getServerName().getHostname());
691         tempPercentFileLocal = Double.isNaN(tempBlockedRequestsCount) ? 0 : (localityIndex * 100);
692 
693         float localityIndexSecondaryRegions = hdfsBlocksDistributionSecondaryRegions
694             .getBlockLocalityIndex(regionServer.getServerName().getHostname());
695         tempPercentFileLocalSecondaryRegions = Double.
696             isNaN(localityIndexSecondaryRegions) ? 0 : (localityIndexSecondaryRegions * 100);
697 
698         // Compute the number of requests per second
699         long currentTime = EnvironmentEdgeManager.currentTime();
700 
701         // assume that it took PERIOD seconds to start the executor.
702         // this is a guess but it's a pretty good one.
703         if (lastRan == 0) {
704           lastRan = currentTime - period;
705         }
706         // If we've time traveled keep the last requests per second.
707         if ((currentTime - lastRan) > 0) {
708           long currentRequestCount = getTotalRequestCount();
709           requestsPerSecond = (currentRequestCount - lastRequestCount) /
710               ((currentTime - lastRan) / 1000.0);
711           lastRequestCount = currentRequestCount;
712         }
713         lastRan = currentTime;
714 
715         WALProvider provider = regionServer.walFactory.getWALProvider();
716         WALProvider metaProvider = regionServer.walFactory.getMetaWALProvider();
717         numWALFiles = (provider == null ? 0 : provider.getNumLogFiles()) +
718             (metaProvider == null ? 0 : metaProvider.getNumLogFiles());
719         walFileSize = (provider == null ? 0 : provider.getLogFileSize()) +
720             (provider == null ? 0 : provider.getLogFileSize());
721         // Copy over computed values so that no thread sees half computed values.
722         numStores = tempNumStores;
723         numStoreFiles = tempNumStoreFiles;
724         memstoreSize = tempMemstoreSize;
725         storeFileSize = tempStoreFileSize;
726         readRequestsCount = tempReadRequestsCount;
727         filteredReadRequestsCount = tempFilteredReadRequestsCount;
728         writeRequestsCount = tempWriteRequestsCount;
729         checkAndMutateChecksFailed = tempCheckAndMutateChecksFailed;
730         checkAndMutateChecksPassed = tempCheckAndMutateChecksPassed;
731         storefileIndexSize = tempStorefileIndexSize;
732         totalStaticIndexSize = tempTotalStaticIndexSize;
733         totalStaticBloomSize = tempTotalStaticBloomSize;
734         numMutationsWithoutWAL = tempNumMutationsWithoutWAL;
735         dataInMemoryWithoutWAL = tempDataInMemoryWithoutWAL;
736         percentFileLocal = tempPercentFileLocal;
737         percentFileLocalSecondaryRegions = tempPercentFileLocalSecondaryRegions;
738         flushedCellsCount = tempFlushedCellsCount;
739         compactedCellsCount = tempCompactedCellsCount;
740         majorCompactedCellsCount = tempMajorCompactedCellsCount;
741         flushedCellsSize = tempFlushedCellsSize;
742         compactedCellsSize = tempCompactedCellsSize;
743         majorCompactedCellsSize = tempMajorCompactedCellsSize;
744         cellsCountCompactedToMob = tempCellsCountCompactedToMob;
745         cellsCountCompactedFromMob = tempCellsCountCompactedFromMob;
746         cellsSizeCompactedToMob = tempCellsSizeCompactedToMob;
747         cellsSizeCompactedFromMob = tempCellsSizeCompactedFromMob;
748         mobFlushCount = tempMobFlushCount;
749         mobFlushedCellsCount = tempMobFlushedCellsCount;
750         mobFlushedCellsSize = tempMobFlushedCellsSize;
751         mobScanCellsCount = tempMobScanCellsCount;
752         mobScanCellsSize = tempMobScanCellsSize;
753         mobFileCacheAccessCount = mobFileCache.getAccessCount();
754         mobFileCacheMissCount = mobFileCache.getMissCount();
755         mobFileCacheHitRatio = Double.
756             isNaN(mobFileCache.getHitRatio())?0:mobFileCache.getHitRatio();
757         mobFileCacheEvictedCount = mobFileCache.getEvictedFileCount();
758         mobFileCacheCount = mobFileCache.getCacheSize();
759         blockedRequestsCount = tempBlockedRequestsCount;
760       } catch (Throwable e) {
761         LOG.warn("Caught exception! Will suppress and retry.", e);
762       }
763     }
764   }
765 
766   @Override
767   public long getHedgedReadOps() {
768     return this.dfsHedgedReadMetrics == null? 0: this.dfsHedgedReadMetrics.getHedgedReadOps();
769   }
770 
771   @Override
772   public long getHedgedReadWins() {
773     return this.dfsHedgedReadMetrics == null? 0: this.dfsHedgedReadMetrics.getHedgedReadWins();
774   }
775 
776   @Override
777   public long getBlockedRequestsCount() {
778     return blockedRequestsCount;
779   }
780 }