This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new 2ef84aceefdf test-infra: enable prepared transactions in the postgres
container
2ef84aceefdf is described below
commit 2ef84aceefdf50c6aa1612ec598b0dc31f93da18
Author: Federico Mariani <[email protected]>
AuthorDate: Sat Jul 11 19:39:14 2026 +0200
test-infra: enable prepared transactions in the postgres container
PostgreSQL defaults to max_prepared_transactions = 0, which rejects the
PREPARE TRANSACTION issued by XA two-phase commit. Start the container
with max_prepared_transactions=100, preserving the fsync=off set by
testcontainers, so camel-test-infra-postgres and 'camel infra run
postgres' can back distributed XA scenarios.
Closes #24595
---
.../services/PostgresLocalContainerInfraService.java | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git
a/test-infra/camel-test-infra-postgres/src/main/java/org/apache/camel/test/infra/postgres/services/PostgresLocalContainerInfraService.java
b/test-infra/camel-test-infra-postgres/src/main/java/org/apache/camel/test/infra/postgres/services/PostgresLocalContainerInfraService.java
index 6a6fcfa82e0d..cc09fcad11cd 100644
---
a/test-infra/camel-test-infra-postgres/src/main/java/org/apache/camel/test/infra/postgres/services/PostgresLocalContainerInfraService.java
+++
b/test-infra/camel-test-infra-postgres/src/main/java/org/apache/camel/test/infra/postgres/services/PostgresLocalContainerInfraService.java
@@ -16,6 +16,8 @@
*/
package org.apache.camel.test.infra.postgres.services;
+import java.util.Arrays;
+
import org.apache.camel.spi.annotations.InfraService;
import org.apache.camel.test.infra.common.LocalPropertyResolver;
import org.apache.camel.test.infra.common.services.ContainerEnvironmentUtil;
@@ -62,6 +64,16 @@ public class PostgresLocalContainerInfraService implements
PostgresInfraService,
ContainerEnvironmentUtil.configurePort(this, fixedPort, 5432);
withLogConsumer(new Slf4jLogConsumer(LOG));
+
+ // PostgreSQL disables prepared transactions by default
+ // (max_prepared_transactions = 0), which rejects the PREPARE
TRANSACTION
+ // issued by XA two-phase commit. Append to the command
configured by
+ // testcontainers ("postgres -c fsync=off") instead of
replacing it.
+ String[] command = getCommandParts();
+ String[] augmented = Arrays.copyOf(command, command.length +
2);
+ augmented[command.length] = "-c";
+ augmented[command.length + 1] =
"max_prepared_transactions=100";
+ setCommand(augmented);
}
}