rkhachatryan commented on a change in pull request #15636:
URL: https://github.com/apache/flink/pull/15636#discussion_r616174124
##########
File path:
flink-connectors/flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/xa/JdbcXaSinkFunction.java
##########
@@ -234,13 +231,19 @@ public void open(Configuration configuration) throws
Exception {
xaGroupOps.recoverAndRollback();
}
beginTx(0L);
+ outputFormat.setRuntimeContext(getRuntimeContext());
+ // open format only after starting the transaction so it gets a ready
to use connection
+ outputFormat.open(
+ getRuntimeContext().getIndexOfThisSubtask(),
+ getRuntimeContext().getNumberOfParallelSubtasks());
}
@Override
public void snapshotState(FunctionSnapshotContext context) throws
Exception {
LOG.debug("snapshot state, checkpointId={}",
context.getCheckpointId());
prepareCurrentTx(context.getCheckpointId());
beginTx(context.getCheckpointId() + 1);
+ outputFormat.reconnect(false); // associate with potentially new
connection
Review comment:
Right. I'll update the comment and rename the method.
--
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:
[email protected]