flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [flink] hequn8128 commented on a change in pull request #8429: [FLINK-12499][JDBC] JDBCAppendTableSink support retry
Date Sat, 18 May 2019 03:41:08 GMT
hequn8128 commented on a change in pull request #8429: [FLINK-12499][JDBC] JDBCAppendTableSink
support retry
URL: https://github.com/apache/flink/pull/8429#discussion_r285117690
 
 

 ##########
 File path: flink-connectors/flink-jdbc/src/main/java/org/apache/flink/api/java/io/jdbc/JDBCOutputFormat.java
 ##########
 @@ -221,11 +231,34 @@ public void writeRecord(Row row) throws IOException {
 	}
 
 	void flush() {
+		CompletableFuture<Boolean> retry = FutureUtils.retry(
+			() -> {
+				try {
+					upload.executeBatch();
+					batchCount = 0;
+					return CompletableFuture.completedFuture(true);
+				} catch (SQLException e) {
+					// Sync sleep to simulate delay
+					try {
+						Thread.sleep(retryDelay.toMilliseconds());
 
 Review comment:
   Maybe sleep longer if the thread keep failing?  For example, sleep 1s for the first time,
sleep 2s for the second time. sleep n seconds for the nth time. 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message