From 7b571ca9e44389f05051f10d108a19ad7ff36bf9 Mon Sep 17 00:00:00 2001 From: tianhang Date: Thu, 1 Jun 2023 17:13:13 +0800 Subject: [PATCH] HBASE-27712 Remove unused params in region metrics (#5100) Signed-off-by: Duo Zhang --- .../hadoop/hbase/regionserver/MetricsRegionSource.java | 9 ++++----- .../hbase/regionserver/MetricsRegionSourceImpl.java | 4 ++-- .../org/apache/hadoop/hbase/regionserver/HRegion.java | 9 ++++----- .../apache/hadoop/hbase/regionserver/MetricsRegion.java | 8 ++++---- .../apache/hadoop/hbase/regionserver/RSRpcServices.java | 8 ++++---- 5 files changed, 18 insertions(+), 20 deletions(-) diff --git a/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionSource.java b/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionSource.java index c3d955592d6..580b4a7624f 100644 --- a/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionSource.java +++ b/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionSource.java @@ -73,15 +73,14 @@ public interface MetricsRegionSource extends Comparable { void updateDelete(); /** - * Update time of gets - * @param mills time for this get operation. + * Update related counts of gets */ - void updateGet(long mills); + void updateGet(); /** - * Update time used of resultScanner.next(). + * Update related counts of resultScanner.next(). */ - void updateScanTime(long mills); + void updateScan(); /** * Update related counts of increments. diff --git a/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionSourceImpl.java b/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionSourceImpl.java index 6933241842c..410d775d7d3 100644 --- a/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionSourceImpl.java +++ b/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionSourceImpl.java @@ -149,12 +149,12 @@ public class MetricsRegionSourceImpl implements MetricsRegionSource { } @Override - public void updateGet(long mills) { + public void updateGet() { regionGet.incr(); } @Override - public void updateScanTime(long mills) { + public void updateScan() { regionScan.incr(); } diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java index 809f2bc5029..0dc96747dd3 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java @@ -7912,12 +7912,11 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi private List getInternal(Get get, boolean withCoprocessor, long nonceGroup, long nonce) throws IOException { List results = new ArrayList<>(); - long before = EnvironmentEdgeManager.currentTime(); // pre-get CP hook if (withCoprocessor && (coprocessorHost != null)) { if (coprocessorHost.preGet(get, results)) { - metricsUpdateForGet(results, before); + metricsUpdateForGet(); return results; } } @@ -7941,14 +7940,14 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi coprocessorHost.postGet(get, results); } - metricsUpdateForGet(results, before); + metricsUpdateForGet(); return results; } - void metricsUpdateForGet(List results, long before) { + void metricsUpdateForGet() { if (this.metricsRegion != null) { - this.metricsRegion.updateGet(EnvironmentEdgeManager.currentTime() - before); + this.metricsRegion.updateGet(); } if (this.rsServices != null && this.rsServices.getMetrics() != null) { rsServices.getMetrics().updateReadQueryMeter(this, 1); diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegion.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegion.java index a5a986369ef..e8e64b634c4 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegion.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegion.java @@ -50,12 +50,12 @@ public class MetricsRegion { source.updateDelete(); } - public void updateGet(final long t) { - source.updateGet(t); + public void updateGet() { + source.updateGet(); } - public void updateScanTime(final long t) { - source.updateScanTime(t); + public void updateScan() { + source.updateScan(); } public void updateFilteredRecords() { diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java index 87879d638de..57efe505c12 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java @@ -2518,11 +2518,10 @@ public class RSRpcServices extends HBaseRpcServicesBase // This method is almost the same as HRegion#get. List results = new ArrayList<>(); - long before = EnvironmentEdgeManager.currentTime(); // pre-get CP hook if (region.getCoprocessorHost() != null) { if (region.getCoprocessorHost().preGet(get, results)) { - region.metricsUpdateForGet(results, before); + region.metricsUpdateForGet(); return Result.create(results, get.isCheckExistenceOnly() ? !results.isEmpty() : null, stale); } @@ -2557,7 +2556,7 @@ public class RSRpcServices extends HBaseRpcServicesBase if (region.getCoprocessorHost() != null) { region.getCoprocessorHost().postGet(get, results); } - region.metricsUpdateForGet(results, before); + region.metricsUpdateForGet(); return Result.create(results, get.isCheckExistenceOnly() ? !results.isEmpty() : null, stale); } @@ -3461,13 +3460,14 @@ public class RSRpcServices extends HBaseRpcServicesBase region.closeRegionOperation(); // Update serverside metrics, even on error. long end = EnvironmentEdgeManager.currentTime(); + long responseCellSize = 0; long blockBytesScanned = 0; if (rpcCall != null) { responseCellSize = rpcCall.getResponseCellSize(); blockBytesScanned = rpcCall.getBlockBytesScanned(); } - region.getMetrics().updateScanTime(end - before); + region.getMetrics().updateScan(); final MetricsRegionServer metricsRegionServer = server.getMetrics(); if (metricsRegionServer != null) { metricsRegionServer.updateScan(region, end - before, responseCellSize, blockBytesScanned);