HBASE-22928 ScanMetrics counter update may not happen in case of exception in TableRecordReaderImpl
Signed-off-by: Reid Chan <reidchan@apache.org>
This commit is contained in:
parent
212fa2e6d5
commit
0e87e86a29
|
@ -77,6 +77,10 @@ public class TableRecordReaderImpl {
|
||||||
* @throws IOException When restarting fails.
|
* @throws IOException When restarting fails.
|
||||||
*/
|
*/
|
||||||
public void restart(byte[] firstRow) throws IOException {
|
public void restart(byte[] firstRow) throws IOException {
|
||||||
|
// Update counter metrics based on current scan before reinitializing it
|
||||||
|
if (currentScan != null) {
|
||||||
|
updateCounters();
|
||||||
|
}
|
||||||
currentScan = new Scan(scan);
|
currentScan = new Scan(scan);
|
||||||
currentScan.withStartRow(firstRow);
|
currentScan.withStartRow(firstRow);
|
||||||
currentScan.setScanMetricsEnabled(true);
|
currentScan.setScanMetricsEnabled(true);
|
||||||
|
@ -219,6 +223,7 @@ public class TableRecordReaderImpl {
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
// do not retry if the exception tells us not to do so
|
// do not retry if the exception tells us not to do so
|
||||||
if (e instanceof DoNotRetryIOException) {
|
if (e instanceof DoNotRetryIOException) {
|
||||||
|
updateCounters();
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
// try to handle all other IOExceptions by restarting
|
// try to handle all other IOExceptions by restarting
|
||||||
|
@ -257,6 +262,7 @@ public class TableRecordReaderImpl {
|
||||||
updateCounters();
|
updateCounters();
|
||||||
return false;
|
return false;
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
|
updateCounters();
|
||||||
if (logScannerActivity) {
|
if (logScannerActivity) {
|
||||||
long now = System.currentTimeMillis();
|
long now = System.currentTimeMillis();
|
||||||
LOG.info("Mapper took " + (now-timestamp)
|
LOG.info("Mapper took " + (now-timestamp)
|
||||||
|
|
Loading…
Reference in New Issue