HBASE-19337 AsyncMetaTableAccessor may hang when call ScanController.terminate many times

This commit is contained in:
Guanghao Zhang 2017-11-23 17:30:02 +08:00
parent 73e3af00e9
commit f521000d78
1 changed files with 13 additions and 6 deletions

View File

@ -303,8 +303,8 @@ public class AsyncMetaTableAccessor {
startRow.ifPresent(scan::withStartRow);
stopRow.ifPresent(scan::withStopRow);
if (LOG.isTraceEnabled()) {
LOG.trace("Scanning META" + " starting at row=" + Bytes.toStringBinary(scan.getStartRow())
if (LOG.isDebugEnabled()) {
LOG.debug("Scanning META" + " starting at row=" + Bytes.toStringBinary(scan.getStartRow())
+ " stopping at row=" + Bytes.toStringBinary(scan.getStopRow()) + " for max="
+ rowUpperLimit + " with caching=" + scan.getCaching());
}
@ -346,19 +346,26 @@ public class AsyncMetaTableAccessor {
@Override
public void onNext(Result[] results, ScanController controller) {
boolean terminateScan = false;
for (Result result : results) {
try {
if (!visitor.visit(result)) {
controller.terminate();
terminateScan = true;
break;
}
} catch (IOException e) {
} catch (Exception e) {
future.completeExceptionally(e);
controller.terminate();
terminateScan = true;
break;
}
if (++currentRowCount >= rowUpperLimit) {
controller.terminate();
terminateScan = true;
break;
}
}
if (terminateScan) {
controller.terminate();
}
}
}