HBASE-20889 PE scan is failing with NullPointerException

This commit is contained in:
tedyu 2018-07-16 09:53:47 -07:00
parent 2ae61521aa
commit 7211d13ac8

View File

@ -1558,7 +1558,6 @@ public class PerformanceEvaluation extends Configured implements Tool {
@Override
void testTakedown() throws IOException {
if (this.testScanner != null) {
updateScanMetrics(scan.getScanMetrics());
this.testScanner.close();
}
super.testTakedown();
@ -1568,7 +1567,7 @@ public class PerformanceEvaluation extends Configured implements Tool {
@Override
void testRow(final int i) throws IOException {
if (this.testScanner == null) {
Scan scan = new Scan(format(opts.startRow));
scan = new Scan(format(opts.startRow));
for (int family = 0; family < opts.families; family++) {
byte[] familyName = Bytes.toBytes(FAMILY_NAME_BASE + family);
if (opts.addColumns) {
@ -1587,8 +1586,12 @@ public class PerformanceEvaluation extends Configured implements Tool {
scan.setScanMetricsEnabled(true);
this.testScanner = table.getScanner(scan);
}
Result r = testScanner.next();
updateValueSize(r);
try {
Result r = testScanner.next();
updateValueSize(r);
} finally {
updateScanMetrics(scan.getScanMetrics());
}
}
}