Skip to content

Commit 420a66a

Browse files
author
Huaxiang Sun
committed
HBASE-26108 add option to disable scanMetrics in TableSnapshotInputFormat
1 parent 21c4578 commit 420a66a

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/mapreduce/TableSnapshotInputFormatImpl.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,14 @@ public class TableSnapshotInputFormatImpl {
107107
public static final String SNAPSHOT_INPUTFORMAT_ROW_LIMIT_PER_INPUTSPLIT =
108108
"hbase.TableSnapshotInputFormat.row.limit.per.inputsplit";
109109

110+
/**
111+
* Whether to enable scan metrics on Scan, default to true
112+
*/
113+
public static final String SNAPSHOT_INPUTFORMAT_SCAN_METRICS_ENABLED =
114+
"hbase.TableSnapshotInputFormat.scan_metrics.enabled";
115+
116+
public static final boolean SNAPSHOT_INPUTFORMAT_SCAN_METRICS_ENABLED_DEFAULT = true;
117+
110118
/**
111119
* Implementation class for InputSplit logic common between mapred and mapreduce.
112120
*/
@@ -240,7 +248,6 @@ public void initialize(InputSplit split, Configuration conf) throws IOException
240248
scan.setIsolationLevel(IsolationLevel.READ_UNCOMMITTED);
241249
// disable caching of data blocks
242250
scan.setCacheBlocks(false);
243-
scan.setScanMetricsEnabled(true);
244251

245252
scanner =
246253
new ClientSideRegionScanner(conf, fs, new Path(split.restoreDir), htd, hri, scan, null);
@@ -381,6 +388,10 @@ public static List<InputSplit> getSplits(Scan scan, SnapshotManifest manifest,
381388
boolean localityEnabled = conf.getBoolean(SNAPSHOT_INPUTFORMAT_LOCALITY_ENABLED_KEY,
382389
SNAPSHOT_INPUTFORMAT_LOCALITY_ENABLED_DEFAULT);
383390

391+
boolean scanMetricsEnabled = conf.getBoolean(SNAPSHOT_INPUTFORMAT_SCAN_METRICS_ENABLED,
392+
SNAPSHOT_INPUTFORMAT_SCAN_METRICS_ENABLED_DEFAULT);
393+
scan.setScanMetricsEnabled(scanMetricsEnabled);
394+
384395
List<InputSplit> splits = new ArrayList<>();
385396
for (RegionInfo hri : regionManifests) {
386397
// load region descriptor

0 commit comments

Comments
 (0)