MartijnVisser commented on code in PR #259:
URL: 
https://github.com/apache/flink-connector-jdbc/pull/259#discussion_r4773113793


##########
flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/datastream/sink/JdbcSink.java:
##########
@@ -102,6 +111,36 @@ public SimpleVersionedSerializer<JdbcCommitable> 
getCommittableSerializer() {
         return new JdbcCommitableSerializer();
     }
 
+    @Override
+    @Internal
+    public DataStream<CommittableMessage<JdbcCommitable>> addPreCommitTopology(
+            DataStream<CommittableMessage<JdbcCommitable>> committables) {
+        if (deliveryGuarantee != DeliveryGuarantee.EXACTLY_ONCE) {
+            return committables;
+        }
+        // A prepared transaction keeps its locks until it is committed, so a 
writer chained to the
+        // committer could block on one and keep the committer from running. 
The map is chained to
+        // the writer, so the writer keeps its generated operator id and 
savepoints without a uid

Review Comment:
   Without a uid the committer does get a new id, but the map takes the one the 
committer had, so the restore doesn't need `--allowNonRestoredState`. The map 
drops the old committer state, which is safe: the 4.1 writer commits at the 
barrier and keeps a failed commit in its own state. I restored a 4.1.0 
savepoint without uids on 2.1.3, 2.2.1 and 2.3.0, and every run finished with 
each row exactly once and nothing left prepared. 
`testMapTakesTheCommitterOperatorIdWithoutUid` fails if the map stops taking 
that id, for example without the `global()`. 75f444ad
   



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to