Wednesday, April 30, 2014

Which WebLogic optimization allows one non-XA resource

I was asked about the solution of the following task:

Which WebLogic optimization allows one non-XA resource to participate in a distributed transaction? Select correct answer:
  1. enabling Pinned to Thread 
  2. enabling Logging Last Resource 
  3. increasing the Statement cache size 
  4. setting the statement cache type to LRU 
  5. setting the initial and maximum capacity to the same number 
At start I rejected as absolutely erroneous answers 3 and 5.

Answers 1 and 4 also looked like wrong, but I checked it out:
  • LRU = When you select LRU (Least Recently Used, the default) as the Statement Cache Type, WebLogic Server caches prepared and callable statements used on the connection until the statement cache size is reached.
  • Pinned to Thread = About this documentation says: When Pinned To Thread is enabled, WebLogic Server pins a database connection from the data source to an execution thread the first time an application uses the thread to reserve a connection. When the application finishes using the connection and calls connection.close(), which otherwise returns the connection to the data
    source, WebLogic Server keeps the connection with the execute thread and does not return it to the data source. When an application subsequently requests a connection using the same execute thread, WebLogic Server provides the connection already reserved by the thread.
OK. Correct answer is 2. But WTF is  "Logging Last Resource". At first sight, there is no relation between LLR and transactionability. And .. nothing could be more wrong

Generally, if you have to use global transactions in your applications, you should use an XA JDBC driver. If an XA driver is unavailable for your database, or you prefer not to use an XA driver, you should enable support for global transactions in the data source. And what more (as says Administering JDBC Data Sources for Oracle WebLogic Server12c (12.1.2)), when you select Supports Global Transactions, you must also select the protocol for WebLogic Server to use for the transaction branch when processing a global transaction. One of this is:
  • Logging Last Resource: With this option, the transaction branch in which the connection is used is processed as the last resource in the transaction and is processed as a local transaction. Commit records for two-phase commit (2PC) transactions are inserted in a table on the resource itself, and the result determines the success or failure of the prepare phase of the global transaction. This option offers some performance benefits and greater data safety than Emulate Two-Phase Commit, but it has some limitations.

No comments:

Post a Comment