You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by su...@apache.org on 2021/02/24 06:46:31 UTC
[hbase] branch branch-2.4 updated: HBASE-25598
TestFromClientSide5.testScanMetrics is flaky (#2977)
This is an automated email from the ASF dual-hosted git repository.
sunxin pushed a commit to branch branch-2.4
in repository https://gitbox.apache.org/repos/asf/hbase.git
The following commit(s) were added to refs/heads/branch-2.4 by this push:
new 9ebddee HBASE-25598 TestFromClientSide5.testScanMetrics is flaky (#2977)
9ebddee is described below
commit 9ebddeeda5a713a3aa6ee08c2a746153acadb8be
Author: XinSun <dd...@gmail.com>
AuthorDate: Wed Feb 24 14:15:51 2021 +0800
HBASE-25598 TestFromClientSide5.testScanMetrics is flaky (#2977)
Signed-off-by: Duo Zhang <zh...@apache.org>
---
.../hadoop/hbase/client/TestFromClientSide5.java | 20 +++++++++-----------
1 file changed, 9 insertions(+), 11 deletions(-)
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide5.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide5.java
index a23234a..19256fd 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide5.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide5.java
@@ -968,7 +968,7 @@ public class TestFromClientSide5 extends FromClientSideBase {
numRecords++;
}
- LOG.info("test data has " + numRecords + " records.");
+ LOG.info("test data has {} records.", numRecords);
// by default, scan metrics collection is turned off
assertNull(scanner.getScanMetrics());
@@ -981,8 +981,6 @@ public class TestFromClientSide5 extends FromClientSideBase {
try (ResultScanner scanner = ht.getScanner(scan2)) {
for (Result result : scanner.next(numRecords - 1)) {
}
- scanner.close();
- // closing the scanner will set the metrics.
assertNotNull(scanner.getScanMetrics());
}
@@ -997,7 +995,7 @@ public class TestFromClientSide5 extends FromClientSideBase {
}
ScanMetrics scanMetrics = scanner.getScanMetrics();
assertEquals("Did not access all the regions in the table", numOfRegions,
- scanMetrics.countOfRegions.get());
+ scanMetrics.countOfRegions.get());
}
// check byte counters
@@ -1006,15 +1004,14 @@ public class TestFromClientSide5 extends FromClientSideBase {
scan2.setCaching(1);
try (ResultScanner scanner = ht.getScanner(scan2)) {
int numBytes = 0;
- for (Result result : scanner.next(1)) {
+ for (Result result : scanner) {
for (Cell cell : result.listCells()) {
numBytes += PrivateCellUtil.estimatedSerializedSizeOf(cell);
}
}
- scanner.close();
ScanMetrics scanMetrics = scanner.getScanMetrics();
assertEquals("Did not count the result bytes", numBytes,
- scanMetrics.countOfBytesInResults.get());
+ scanMetrics.countOfBytesInResults.get());
}
// check byte counters on a small scan
@@ -1024,15 +1021,14 @@ public class TestFromClientSide5 extends FromClientSideBase {
scan2.setSmall(true);
try (ResultScanner scanner = ht.getScanner(scan2)) {
int numBytes = 0;
- for (Result result : scanner.next(1)) {
+ for (Result result : scanner) {
for (Cell cell : result.listCells()) {
numBytes += PrivateCellUtil.estimatedSerializedSizeOf(cell);
}
}
- scanner.close();
ScanMetrics scanMetrics = scanner.getScanMetrics();
assertEquals("Did not count the result bytes", numBytes,
- scanMetrics.countOfBytesInResults.get());
+ scanMetrics.countOfBytesInResults.get());
}
// now, test that the metrics are still collected even if you don't call close, but do
@@ -1062,8 +1058,10 @@ public class TestFromClientSide5 extends FromClientSideBase {
scannerWithClose.close();
ScanMetrics scanMetricsWithClose = scannerWithClose.getScanMetrics();
assertEquals("Did not access all the regions in the table", numOfRegions,
- scanMetricsWithClose.countOfRegions.get());
+ scanMetricsWithClose.countOfRegions.get());
}
+ } finally {
+ TEST_UTIL.deleteTable(tableName);
}
}