flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From haohui <...@git.apache.org>
Subject [GitHub] flink pull request #3712: [FLINK-6281] Create TableSink for JDBC.
Date Wed, 07 Jun 2017 22:55:33 GMT
Github user haohui commented on a diff in the pull request:

    https://github.com/apache/flink/pull/3712#discussion_r120765156
  
    --- Diff: flink-connectors/flink-jdbc/src/main/java/org/apache/flink/api/java/io/jdbc/JDBCOutputFormat.java
---
    @@ -202,14 +202,20 @@ public void writeRecord(Row row) throws IOException {
     			upload.addBatch();
     			batchCount++;
     			if (batchCount >= batchInterval) {
    -				upload.executeBatch();
    -				batchCount = 0;
    +				flush();
     			}
     		} catch (SQLException | IllegalArgumentException e) {
     			throw new IllegalArgumentException("writeRecord() failed", e);
     		}
     	}
     
    +	void flush() throws SQLException {
    +		if (upload != null) {
    +			upload.executeBatch();
    --- End diff --
    
    It is a synchronous call. It will throw `SQLException` and abort the sink. The behavior
has not been changed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message