HBASE-25598 TestFromClientSide5.testScanMetrics is flaky (#2977)
Signed-off-by: Duo Zhang <zhangduo@apache.org>
This commit is contained in:
parent
8f03c4429f
commit
51a3d45f9d
|
@ -970,7 +970,7 @@ public class TestFromClientSide5 extends FromClientSideBase {
|
||||||
numRecords++;
|
numRecords++;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG.info("test data has " + numRecords + " records.");
|
LOG.info("test data has {} records.", numRecords);
|
||||||
|
|
||||||
// by default, scan metrics collection is turned off
|
// by default, scan metrics collection is turned off
|
||||||
assertNull(scanner.getScanMetrics());
|
assertNull(scanner.getScanMetrics());
|
||||||
|
@ -983,8 +983,6 @@ public class TestFromClientSide5 extends FromClientSideBase {
|
||||||
try (ResultScanner scanner = ht.getScanner(scan2)) {
|
try (ResultScanner scanner = ht.getScanner(scan2)) {
|
||||||
for (Result result : scanner.next(numRecords - 1)) {
|
for (Result result : scanner.next(numRecords - 1)) {
|
||||||
}
|
}
|
||||||
scanner.close();
|
|
||||||
// closing the scanner will set the metrics.
|
|
||||||
assertNotNull(scanner.getScanMetrics());
|
assertNotNull(scanner.getScanMetrics());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1008,12 +1006,11 @@ public class TestFromClientSide5 extends FromClientSideBase {
|
||||||
scan2.setCaching(1);
|
scan2.setCaching(1);
|
||||||
try (ResultScanner scanner = ht.getScanner(scan2)) {
|
try (ResultScanner scanner = ht.getScanner(scan2)) {
|
||||||
int numBytes = 0;
|
int numBytes = 0;
|
||||||
for (Result result : scanner.next(1)) {
|
for (Result result : scanner) {
|
||||||
for (Cell cell : result.listCells()) {
|
for (Cell cell : result.listCells()) {
|
||||||
numBytes += PrivateCellUtil.estimatedSerializedSizeOf(cell);
|
numBytes += PrivateCellUtil.estimatedSerializedSizeOf(cell);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
scanner.close();
|
|
||||||
ScanMetrics scanMetrics = scanner.getScanMetrics();
|
ScanMetrics scanMetrics = scanner.getScanMetrics();
|
||||||
assertEquals("Did not count the result bytes", numBytes,
|
assertEquals("Did not count the result bytes", numBytes,
|
||||||
scanMetrics.countOfBytesInResults.get());
|
scanMetrics.countOfBytesInResults.get());
|
||||||
|
@ -1026,12 +1023,11 @@ public class TestFromClientSide5 extends FromClientSideBase {
|
||||||
scan2.setSmall(true);
|
scan2.setSmall(true);
|
||||||
try (ResultScanner scanner = ht.getScanner(scan2)) {
|
try (ResultScanner scanner = ht.getScanner(scan2)) {
|
||||||
int numBytes = 0;
|
int numBytes = 0;
|
||||||
for (Result result : scanner.next(1)) {
|
for (Result result : scanner) {
|
||||||
for (Cell cell : result.listCells()) {
|
for (Cell cell : result.listCells()) {
|
||||||
numBytes += PrivateCellUtil.estimatedSerializedSizeOf(cell);
|
numBytes += PrivateCellUtil.estimatedSerializedSizeOf(cell);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
scanner.close();
|
|
||||||
ScanMetrics scanMetrics = scanner.getScanMetrics();
|
ScanMetrics scanMetrics = scanner.getScanMetrics();
|
||||||
assertEquals("Did not count the result bytes", numBytes,
|
assertEquals("Did not count the result bytes", numBytes,
|
||||||
scanMetrics.countOfBytesInResults.get());
|
scanMetrics.countOfBytesInResults.get());
|
||||||
|
@ -1066,6 +1062,8 @@ public class TestFromClientSide5 extends FromClientSideBase {
|
||||||
assertEquals("Did not access all the regions in the table", numOfRegions,
|
assertEquals("Did not access all the regions in the table", numOfRegions,
|
||||||
scanMetricsWithClose.countOfRegions.get());
|
scanMetricsWithClose.countOfRegions.get());
|
||||||
}
|
}
|
||||||
|
} finally {
|
||||||
|
TEST_UTIL.deleteTable(tableName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue