From 329f0baa98c8b938ebd926e5bf8cfa69fd2f2a74 Mon Sep 17 00:00:00 2001 From: bsglz <18031031@qq.com> Date: Thu, 10 Jun 2021 09:37:31 +0800 Subject: [PATCH] =?UTF-8?q?HBASE-25967=20The=20readRequestsCount=20does=20?= =?UTF-8?q?not=20calculate=20when=20the=20outResu=E2=80=A6=20(#3351)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * HBASE-25967 The readRequestsCount does not calculate when the outResults is empty Co-authored-by: Zheng Wang --- .../hadoop/hbase/regionserver/RegionScannerImpl.java | 8 +++----- .../assignment/TestTransitRegionStateProcedure.java | 4 +++- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RegionScannerImpl.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RegionScannerImpl.java index 519c67aba7e..881f4234bf9 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RegionScannerImpl.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RegionScannerImpl.java @@ -270,11 +270,9 @@ class RegionScannerImpl implements RegionScanner, Shipper, RpcCallback { outResults.addAll(tmpList); } - if (!outResults.isEmpty()) { - region.addReadRequestsCount(1); - if (region.getMetrics() != null) { - region.getMetrics().updateReadRequestCount(); - } + region.addReadRequestsCount(1); + if (region.getMetrics() != null) { + region.getMetrics().updateReadRequestCount(); } // If the size limit was reached it means a partial Result is being returned. Returning a diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/assignment/TestTransitRegionStateProcedure.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/assignment/TestTransitRegionStateProcedure.java index c55a9f966b6..477069092fd 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/assignment/TestTransitRegionStateProcedure.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/assignment/TestTransitRegionStateProcedure.java @@ -142,7 +142,9 @@ public class TestTransitRegionStateProcedure { long openSeqNum2 = region2.getOpenSeqNum(); // confirm that the region is successfully opened assertTrue(openSeqNum2 > openSeqNum); - assertEquals(1, region2.getReadRequestsCount()); + // we check the available by scan after table created, + // so the readRequestsCount should be 2 here + assertEquals(2, region2.getReadRequestsCount()); assertEquals(2, region2.getWriteRequestsCount()); }