You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by hu...@apache.org on 2021/07/22 19:04:35 UTC

[hbase] branch branch-2 updated: HBASE-26108 add option to disable scanMetrics in TableSnapshotInputFormat (#3519)

This is an automated email from the ASF dual-hosted git repository.

huaxiangsun pushed a commit to branch branch-2
in repository https://gitbox.apache.org/repos/asf/hbase.git


The following commit(s) were added to refs/heads/branch-2 by this push:
     new 6854933  HBASE-26108 add option to disable scanMetrics in TableSnapshotInputFormat (#3519)
6854933 is described below

commit 68549338d0bb3e4fd8b3902a798e45ee53882257
Author: huaxiangsun <hu...@apache.org>
AuthorDate: Thu Jul 22 12:03:52 2021 -0700

    HBASE-26108 add option to disable scanMetrics in TableSnapshotInputFormat (#3519)
    
    Signed-off-by Anoop Sam John <an...@apache.org>
---
 .../hbase/mapreduce/TableSnapshotInputFormatImpl.java       | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/mapreduce/TableSnapshotInputFormatImpl.java b/hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/mapreduce/TableSnapshotInputFormatImpl.java
index 28b832e..5ed9be6 100644
--- a/hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/mapreduce/TableSnapshotInputFormatImpl.java
+++ b/hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/mapreduce/TableSnapshotInputFormatImpl.java
@@ -108,6 +108,14 @@ public class TableSnapshotInputFormatImpl {
       "hbase.TableSnapshotInputFormat.row.limit.per.inputsplit";
 
   /**
+   * Whether to enable scan metrics on Scan, default to true
+   */
+  public static final String  SNAPSHOT_INPUTFORMAT_SCAN_METRICS_ENABLED =
+    "hbase.TableSnapshotInputFormat.scan_metrics.enabled";
+
+  public static final boolean SNAPSHOT_INPUTFORMAT_SCAN_METRICS_ENABLED_DEFAULT = true;
+
+  /**
    * Implementation class for InputSplit logic common between mapred and mapreduce.
    */
   public static class InputSplit implements Writable {
@@ -240,7 +248,6 @@ public class TableSnapshotInputFormatImpl {
       scan.setIsolationLevel(IsolationLevel.READ_UNCOMMITTED);
       // disable caching of data blocks
       scan.setCacheBlocks(false);
-      scan.setScanMetricsEnabled(true);
 
       scanner =
           new ClientSideRegionScanner(conf, fs, new Path(split.restoreDir), htd, hri, scan, null);
@@ -381,6 +388,10 @@ public class TableSnapshotInputFormatImpl {
     boolean localityEnabled = conf.getBoolean(SNAPSHOT_INPUTFORMAT_LOCALITY_ENABLED_KEY,
                                               SNAPSHOT_INPUTFORMAT_LOCALITY_ENABLED_DEFAULT);
 
+    boolean scanMetricsEnabled = conf.getBoolean(SNAPSHOT_INPUTFORMAT_SCAN_METRICS_ENABLED,
+      SNAPSHOT_INPUTFORMAT_SCAN_METRICS_ENABLED_DEFAULT);
+    scan.setScanMetricsEnabled(scanMetricsEnabled);
+
     List<InputSplit> splits = new ArrayList<>();
     for (HRegionInfo hri : regionManifests) {
       // load region descriptor