MDM Transactions

EnrichVersion
6.4
6.3
6.2
6.1
EnrichProdName
Talend MDM Platform
Talend Open Studio for MDM
Talend Data Fabric
task
Data Governance > Retrieving data
Data Quality and Preparation > Enriching data
Data Governance > Consolidating data
EnrichPlatform
Talend MDM Server

MDM Transactions

Each CRUD (Create, Request, Update, Delete) operation on MDM records needs a transaction.

A transaction in MDM is actually composed of multiple storage transactions. For example, a single update operation can involve several storage instances: the master data container storage and the update report storage.

If an MDM transaction involves the master storage or the staging storage, the MDM transaction usually spans across both of the storages.

Transactions are also used to isolate read operations. Therefore, all read operations (even those only including read-only requests) must be performed in a transaction context.

This articles applies to Talend MDM 6.0 and later.

Usage of commit or rollback calls

MDM can take advantage of commit and rollback calls to log additional data (for example, access to records).

For read-only operations:

  • If you are able to initiate the read operation and read all the records you want to, you should call commit. This indicates to MDM that the read operation has completed successfully and the user is able to see all results in the query.
  • If something goes wrong when you read the query results, you should call rollback. This can be used to log that a query has caused an issue and MDM is not able to serve results.

REST API for transaction operations

An MDM REST interface is available for transaction operations.

All HTTP requests must be authenticated. In other words, open or anonymous access is not possible to this REST API. You need to provide proper credentials (basic HTTP authentication) in the HTTP request.

Below list all the REST API resources for transaction operations:

Resource

Description

GET /talendmdm/services/transactions

List all active transactions with their ids

PUT/talendmdm/services/transactions

Create a new transaction (and get its UUID)

POST/talendmdm/services/transactions/{id}

Commit a transaction

DELETE/talendmdm/services/transactions/{id}

Rollback a transaction

For more information about the Talend MDM REST resources documentation, see the Talend MDM Web User Interface User Guide.

Troubleshooting transaction issues

You can use any of the following operations to debug transaction issues.

List active transactions

If you enable the Log4j category com.amalto.core.server, the server will periodically show every 20 seconds how many active transactions are currently managed and all active transactions with their ids.

Change MDM transaction log level to DEBUG

Edit the file <MDM_ROOT>conf/log4j.xml and make sure the following configuration exists:

<category name="com.amalto.core.server.MDMTransaction">
   <priority value="DEBUG"/>
</category>

In this mode, MDM will track transaction creations and then provide more information on problematic transactions when they are detected.

Add the TransactionsGuard filter

Edit the file <Tomcat_Path>/webapps/talendmdm/WEB-INF/web.xml and then add the following:

<filter>
   <filter-name>transactionGuardFilter</filter-name>
   <filter-class>com.amalto.core.servlet.TransactionsGuardFilter</filter-class>
   <init-param>
      <param-name>throw.exceptions.BEFORE</param-name>
      <param-value>true</param-value>
   </init-param>
   <init-param>
      <param-name>throw.exceptions.AFTER</param-name>
      <param-value>false</param-value>
   </init-param>
</filter>
<filter-mapping>
   <filter-name>transactionGuardFilter</filter-name>
   <url-pattern>/*</url-pattern>
</filter-mapping>

This will add and activate a new servlet filter to the Web application.

This filter will check before and after each HTTP request if a transaction is attached to the current HTTP thread.

If a transaction is found, the filter will log a warning message, including the transaction creation stacktrace if DEBUG is enabled on MDM transaction. For more information, see Change MDM transaction log level to DEBUG.

The filter parameters are described below:

Filter parameter

Description

throw.exceptions.BEFORE

If this parameter is set to true, the filter will throw an exception before executing the request (returning an HTTP 500 error).

throw.exceptions.AFTER

If this parameter is set to true, the filter will throw an exception if a transaction is attached to the current thread after executing the request (returning an HTTP 500 error even if the request was actually successful, which is not really recommended).