From 1f6e82eb5df065389fbb8ffe8964409540e9d3c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Mal=C3=A9=C5=99?= Date: Mon, 26 Jun 2023 11:39:20 +0200 Subject: [PATCH] revieving the chapter MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michal Maléř Fixes Signed-off-by: Michal Maléř Fixes Signed-off-by: Michal Maléř --- docs/src/main/asciidoc/datasource.adoc | 4 +++- docs/src/main/asciidoc/transaction.adoc | 31 +++++++++++++++++++++---- 2 files changed, 29 insertions(+), 6 deletions(-) diff --git a/docs/src/main/asciidoc/datasource.adoc b/docs/src/main/asciidoc/datasource.adoc index 6ea86c80b4d277..61eeb67606d3d0 100644 --- a/docs/src/main/asciidoc/datasource.adoc +++ b/docs/src/main/asciidoc/datasource.adoc @@ -434,7 +434,9 @@ You can override this by setting the `transactions` configuration property: * `quarkus.datasource.jdbc.transactions` for default unnamend datasource * `quarkus.datasource.__.jdbc.transactions` for named datasource -See the <> section below. +For more information, see the <> section below. + +To facilitate the storage of transaction logs in a database by using JDBC, see xref:transaction.adoc#jdbcstore[Configuring transaction logs to be stored in a datasource] section of the xref:transaction.adoc[Using transactions in Quarkus] guide. ==== Named datasources diff --git a/docs/src/main/asciidoc/transaction.adoc b/docs/src/main/asciidoc/transaction.adoc index bd870f4c95f25a..303f0daf8fc63f 100644 --- a/docs/src/main/asciidoc/transaction.adoc +++ b/docs/src/main/asciidoc/transaction.adoc @@ -362,15 +362,36 @@ NOTE: The `event` object represents the transaction ID, and defines `toString()` TIP: In listener methods, you can access more information about the transaction in progress by accessing the `TransactionManager`, which is a CDI bean and can be ``@Inject``ed. -== Configuring transaction log to be stored in a DataSource +[[jdbcstore]] +== Configure storing of Quarkus transaction logs in a database -The Narayana project has the capability to store the transaction logs into a JDBC Datasource; this should be our recommendation for users needing transaction recovery capabilities, especially when running in volatile containers. +In cloud environments where persistent storage is not available, such as when application containers are unable to use persistent volumes, you can configure the transaction management to store transaction logs in a database by using a JDBC datasource. -To enable this capability, you need to set `quarkus.transaction-manager.object-store.type` to `jdbc` explicitly. Also, you can specify a datasource name to be used for the transaction log storage by setting `quarkus.transaction-manager.object-store.datasource`. It will use the default datasource configuration if not specified. +IMPORTANT: While there are several benefits to using a database to store transaction logs, you might notice a reduction in performance compared with using the file system to store the logs. -If you enable `quarkus.transaction-manager.object-store.create-table`, the transaction log table will be created automatically if it does not exist. +Quarkus allows the following JDBC-specific configuration of the object store included in `quarkus.transacion-manager.object-store.` properties, where can be: -NOTE: When enabling this capability, the transaction node identifier must be set through `quarkus.transaction-manager.node-name`. +* `type` (_string_): Configure this property to `jdbc` to enable usage of a Quarkus JDBC datasource for transaction logging. +The default value is `file-system`. +* `datasource` (_string_): Specify the name of the datasource for the transaction log storage. +If no value is provided for the `datasource` property, Quarkus uses the xref:datasource.adoc#dev-services[default datasource]. +* `create-table` (_boolean_): When set to `true`, the transaction log table gets automatically created if it does not already exist. +The default value is `false`. +* `drop-table` (_boolean_): When set to `true`, the table creation is canceled on startup if it exists. +The default value is `false`. +* `table-prefix` (string): Specify the prefix for a related table name. +The default value is `quarkus_`. + +[NOTE] +==== +To work around the current known issue of link:https://issues.redhat.com/browse/AG-209[Agroal having a different view on running transaction checks], set the datasource transaction type for the datasource responsible for writing the transaction logs to `disabled`: + +---- +quarkus.datasource.TX_LOG.jdbc.transactions=disabled +---- + +This example uses TX_LOG as the datasource name. +==== == Why always having a transaction manager?