You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Jark Wu (Jira)" <ji...@apache.org> on 2019/12/13 06:12:00 UTC

[jira] [Commented] (FLINK-14941) The AbstractTableInputFormat#nextRecord in hbase connector will handle the same rowkey twice once encountered any exception

    [ https://issues.apache.org/jira/browse/FLINK-14941?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16995382#comment-16995382 ] 

Jark Wu commented on FLINK-14941:
---------------------------------

1.11.0: 127ef48ec510663debb31e96a0bca9322625e2fd
1.10.0: 8b0278c72b0662e9c44065a9e8aceff28c80f7e4


> The AbstractTableInputFormat#nextRecord in hbase connector will handle the same rowkey twice once encountered any exception
> ---------------------------------------------------------------------------------------------------------------------------
>
>                 Key: FLINK-14941
>                 URL: https://issues.apache.org/jira/browse/FLINK-14941
>             Project: Flink
>          Issue Type: Bug
>          Components: Connectors / HBase
>    Affects Versions: 1.9.1
>            Reporter: Zheng Hu
>            Assignee: Zheng Hu
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 1.10.0
>
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> In the mail list [1].   The user complain that it will see the same row twice if encountered any HBase exception. 
> The problem is here: 
> {code}
> public T nextRecord(T reuse) throws IOException {
> 		if (resultScanner == null) {
> 			throw new IOException("No table result scanner provided!");
> 		}
> 		try {
> 			Result res = resultScanner.next();
> 			if (res != null) {
> 				scannedRows++;
> 				currentRow = res.getRow();
> 				return mapResultToOutType(res);
> 			}
> 		} catch (Exception e) {
> 			resultScanner.close();
> 			//workaround for timeout on scan
> 			LOG.warn("Error after scan of " + scannedRows + " rows. Retry with a new scanner...", e);
> 			scan.setStartRow(currentRow);
> 			resultScanner = table.getScanner(scan);
> 			Result res = resultScanner.next();
> 			if (res != null) {
> 				scannedRows++;
> 				currentRow = res.getRow();
> 				return mapResultToOutType(res);
> 			}
> 		}
> 		endReached = true;
> 		return null;
> 	}
> {code}
> We will set the startRow of the new scan to the currentRow which has been seen,  that means the currentRow will be seen twice.   Actually, we should replace the scan.setStartRow(currentRow) as scan.withStartRow(currentRow, false) , the false means exclude the currentRow. 
> [1]. http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/DataSet-API-HBase-ScannerTimeoutException-and-double-Result-processing-td31174.html



--
This message was sent by Atlassian Jira
(v8.3.4#803005)