LOGGING LAST RESOURCE
A logging last resource (LLR) system can provide a transaction log and transaction data to a LLR resource after a number of two-phase-commit resources have been prepared. The LLR resource manager can operate on the transaction log and transaction data in an atomic fashion so that the one-phase or local commit can be done. The one-phase or local commit can be done by the LLR manager in an atomic manner.
1 . A transaction system for transactions including two or more resources comprising:
a transaction manager for transactions;
a two-phase-commit resource manager interacting with the transaction manager, the two-phase-commit resource manager using a two-phase commit; and
a Logging Last Resource (LLR) resource manager interacting with the transaction manager, the LLR resource manager indicating at the logging last resource whether the logging last resource has committed.
2 . The transaction system of claim 1 , wherein the resource of the LLR resource manager is a database.
3 . The transaction system of claim 2 , wherein the database stores the transaction log and transaction data.
4 . The transaction system of claim 3 , wherein the database stores the transaction log and transaction data in an atomic manner.
5 . The transaction system of claim 2 , wherein the LLR resource manager includes a connection pool used to connect to the database.
6 . The transaction system of claim 5 , wherein the connection pool is a Java Database Connectivity (JDBC) connection pool.
7 . The transaction system of claim 5 , wherein a single connection of the connection pool is used to store the transaction log and transaction data into the database.
8 . The transaction system of claim 1 , wherein the resource of the LLR manager is a messaging system.
9 . The transaction system of claim 1 , wherein the transaction manager can recover from crashes during the transaction.
10 . The transaction system of claim 1 , wherein LLR resource manager is part of the resource.
11 . The transaction system of claim 1 , wherein the resource of the LLR resource manager operates in an atomic manner.
12 . The transaction system of claim 1 , wherein the LLR resource manager stores an indication at the LLR when the LLR commits.
13 . A method comprising:
at a logging last resource (LLR) resource manager, receiving a single-commit instruction as part of a transaction that includes at least one two-phase commit;
committing to the transaction in a single phase commit; and
indicating at the logging last resource that the logging last resource has committed.
14 . The method of claim 13 , wherein the resource of the LLR resource manager is a database.
15 . The method of claim 14 , wherein the database stores a transaction log and transaction data.
16 . The method of claim 15 , wherein the database stores the transaction log and transaction data in an atomic manner.
17 . The method of claim 14 , wherein the LLR resource manager includes a connection pool to connect to the database.
18 . The method of claim 17 , wherein the connection pool is on the same server as a transaction manager.
19 . The method of claim 17 , wherein the connection pool is a Java Database Connectivity (JDBC) connection pool.
20 . The method of claim 17 , wherein one connection of the connection pool is used to store the transaction log and transaction data into the database.
21 . The method of claim 13 , wherein a transaction manager can use a stored transaction log at the LLR to recover from a crash.
22 . The method of claim 13 , wherein LLR resource manager is part of the resource.
23 . The method of claim 13 , wherein the resource of the LLR resource manager operates in an atomic manner.
24 . The method of claim 13 , wherein the LLR resource manager stores an indication at the LLR when the LLR commits.
25 . An application server to run applications; the application server including a transaction manager for multiphase transactions; the transaction manager managing a multiphase transaction by:
instructing at least one two-phase commit resource manager to do a prepare phase of a transaction;
receiving an OK from the at least one two-phase commit resource manager;
thereafter, instructing a logging last resource (LLR) resource manager to do a one-phase or local commit and to indicate that the one-phase or local commit has occurred; and
receiving an OK from the LLR resource manager; and
instructing the two-phase commit resource manager to commit.
26 . The application server of claim 25 , wherein the transaction manager instructs the LLR resource manager to store an indication at the LLR when the LLR commits.
27 . The application server of claim 26 , wherein the transaction manager sends a transaction log to the LLR resource manager that is stored at the LLR when the LLR commits.
28 . The application server of claim 26 , wherein the resource of the LLR resource manager is a database.
29 . The application server of claim 28 , wherein the database stores a transaction log and transaction data.
30 . The application server of claim 29 , wherein the database stores the transaction log and transaction data in an atomic manner.
31 . The application server of claim 25 , wherein the LLR resource manager includes a connection pool to connect to the database.
32 . The application server of claim 31 , wherein the connection pool is a Java Database Connectivity (JDBC) connection pool.
33 . A transaction processing system, comprising:
at least one two-phase commit resource manager;
a single-phase commit resource manager, wherein the single-phase commit resource manager can emulate a two-phase commit resource manager;
a global transaction, wherein the participants in the global transaction include the single-phase commit resource manager and at least one two-phase commit resource manager;
a transaction manager, wherein the transaction manager performs the following steps for the global transaction:
a. call prepare on each two-phase commit resource manager participating in the global transaction;
b. if all of the resource managers in step a complete successfully, then commit is called on the single-phase commit resource manager; and
c. if the commit on the single-phase commit resource manager is completed successfully, then call commit on each two-phase commit resource manager.
34 . The transaction manager of claim 33 , wherein if the commit on the single-phase commit resource manager failed, then the transaction log for the single-phase commit resource manager is read and if the transaction was written to the transaction log successfully, then call commit on each the two-phase commit resource managers, else call rollback on each of the two-phase commit resource managers.