in flink-vvp-connector-adbpg/src/main/java/org/apache/flink/connector/jdbc/table/sink/AdbpgOutputFormat.java [740:764]
private void executeSql(String sql) throws SQLException {
int retryTime = 0;
while (retryTime++ < maxRetryTime) {
try {
connection = dataSource.getConnection();
statement = connection.createStatement();
if (LOG.isDebugEnabled()) {
LOG.debug(sql);
}
statement.execute(sql);
break;
} catch (SQLException e) {
//e.printStackTrace();
if ((e.getMessage() != null && e.getMessage().indexOf("duplicate key") != -1
&& e.getMessage().indexOf("violates unique constraint") != -1) || retryTime >= maxRetryTime - 1) {
throw e;
}
try {
Thread.sleep(retryWaitTime);
} catch (Exception e1) {
LOG.error("Thread sleep exception in AdbpgOutputFormat class", e1);
}
}
}
}