Open gastaldi opened 1 year ago
/cc @geoand (devservices,kubernetes), @iocanel (kubernetes), @stuartwdouglas (devservices)
I've also see the advice to also set max_connections
to the same value as max_prepared_transactions
.
Well, I think we can add this line to the application.properties to enable XA on pregresSQL devservice
quarkus.datasource.devservices.command = --max_prepared_transactions=100
I've also see the advice to also set
max_connections
to the same value asmax_prepared_transactions
.
The postgres doc also advices this: https://www.postgresql.org/docs/current/runtime-config-resource.html#GUC-MAX-PREPARED-TRANSACTIONS
If you are using prepared transactions, you will probably want max_prepared_transactions to be at least as large as max_connections, so that every session can have a prepared transaction pending.
Describe the bug
Having XA enabled in a Quarkus app (with
quarkus.datasource.jdbc.transactions=xa
in theapplication.properties
), and invoking two XA datasources in a@Transactional
method (or 1 datasource and 1 Resource Adapter), the following error happens when the transaction is committed:Enabling the
max_prepared_transactions
to a non-zero value (as stated in the exception message) fixes it.Expected behavior
No errors while committing the transaction
Actual behavior
The exception message is shown
How to Reproduce?
Create a Quarkus application with two XA datasources (one of them being a PostgreSQL DevService) and perform any operation in a
@Transactional
method. The error will be displayed when the transaction is committed.Output of
uname -a
orver
macOS m1
Output of
java -version
JDK 17
Quarkus version or git rev
3.5.0
Build tool (ie. output of
mvnw --version
orgradlew --version
)Apache Maven 3.9.2
Additional information
Setting the
max_prepared_transactions
parameter to100
fixes it, but it should preferably be enabled only if XA is enabled - https://stackoverflow.com/questions/45793501/recommended-way-to-configure-max-prepared-transactions-in-postgres-on-kubernetes