rkhachatryan commented on a change in pull request #16898:
URL: https://github.com/apache/flink/pull/16898#discussion_r694078662



##########
File path: docs/content/docs/connectors/datastream/jdbc.md
##########
@@ -187,11 +178,47 @@ env
                 });
 env.execute();
 ```
-Postgres XADataSource Example:
+**NOTE:** Some databases only allow a single XA transaction per connection 
(e.g. PostgreSQL, MySQL).
+In such cases, please use the following API to construct 
`JdbcExactlyOnceOptions`:
+```java
+JdbcExactlyOnceOptions.builder()
+.withTransactionPerConnection(true)
+.build()
+```
+This will make Flink use a separate connection for every XA transaction. This 
may require adjusting connection limits.
+For PostgreSQL and MySQL, this can be done by increasing `max_connections`.
+
+Furthermore, XA needs to be enabled and/or configured in some databases.
+For PostgreSQL, you should set `max_prepared_transactions` to some value 
greater than zero.
+For MySQL v8+, you should grant `XA_RECOVER_ADMIN` to Flink DB user.
+
+**ATTENTION:** Currently, `JdbcSink.exactlyOnceSink` can ensure exactly once 
semantics
+with `JdbcExecutionOptions.maxRetries == 0`; otherwise, duplicated results 
maybe produced.

Review comment:
       Right (unless the query is a `delete`).




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