Skip to content

Commit 13b2edc

Browse files
PankajReidddddd
authored andcommitted
HBASE-22928 ScanMetrics counter update may not happen in case of exception in TableRecordReaderImpl
Signed-off-by: Reid Chan <[email protected]>
1 parent a5ef6b2 commit 13b2edc

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/mapreduce/TableRecordReaderImpl.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@ public class TableRecordReaderImpl {
7777
* @throws IOException When restarting fails.
7878
*/
7979
public void restart(byte[] firstRow) throws IOException {
80+
// Update counter metrics based on current scan before reinitializing it
81+
if (currentScan != null) {
82+
updateCounters();
83+
}
8084
currentScan = new Scan(scan);
8185
currentScan.withStartRow(firstRow);
8286
currentScan.setScanMetricsEnabled(true);
@@ -219,6 +223,7 @@ public boolean nextKeyValue() throws IOException, InterruptedException {
219223
} catch (IOException e) {
220224
// do not retry if the exception tells us not to do so
221225
if (e instanceof DoNotRetryIOException) {
226+
updateCounters();
222227
throw e;
223228
}
224229
// try to handle all other IOExceptions by restarting
@@ -257,6 +262,7 @@ public boolean nextKeyValue() throws IOException, InterruptedException {
257262
updateCounters();
258263
return false;
259264
} catch (IOException ioe) {
265+
updateCounters();
260266
if (logScannerActivity) {
261267
long now = System.currentTimeMillis();
262268
LOG.info("Mapper took " + (now-timestamp)

0 commit comments

Comments
 (0)