In a distributed computing system, a processing device executing a caveat enabled transaction manager registers one or more transaction participants with the transaction manager. To register a transaction participant, the caveat enabled transaction manager records an address of the transaction participant. The caveat enabled transaction manager additionally determines whether the transaction participant is associated with any transaction caveats. If the transaction participant is associated with a transaction caveat, the caveat enabled transaction manager records the transaction caveat.
|
1. A method comprising:
registering, by a processing device executing a transaction manager, a plurality of transaction participants of a transaction with the transaction manager before initiating the transaction, wherein registering at least one transaction participant of the plurality of transaction participants comprises:
recording an address of the transaction participant;
determining that the transaction participant is associated with a transaction caveat, wherein the transaction caveat comprises data that identifies an action the transaction participant to take regarding the transaction under at least one of:
first circumstances that will cause the transaction participant to commit to the transaction if the first circumstances are later realized during the transaction; or
second circumstances that will cause the transaction participant to roll back the transaction if the second circumstances are later realized during the transaction; and
recording the transaction caveat associated with the transaction participant;
initiating a prepare phase of the transaction after completing the registering, wherein the prepare phase is initiated before initiating a commit phase of the transaction; and
managing the transaction for the plurality of registered transaction participants using the transaction caveat.
17. A system comprising:
a memory to store instructions for a transaction manager; and
a processing device, connected to the memory, to execute the instructions, wherein the instructions cause the processing device to:
perform registration of a plurality of transaction participants to the transaction manager before initiating a transaction, wherein to register at least one transaction participant of the plurality of transaction participants the processing device records an address of the transaction participant, determines that the transaction participant is associated with a transaction caveat that identifies an action the transaction participant to take regarding the transaction under at least one of first circumstances that will cause the transaction participant to commit to the transaction if the first circumstances are later realized during the transaction or second circumstances that will cause the transaction participant to roll back the transaction if the second circumstances are later realized during the transaction, and records the transaction caveat associated with the transaction participant;
initiate a prepare phase of the transaction after completing the registration, wherein the prepare phase is initiated before initiating a commit phase of the transaction; and
manage the transaction for the plurality of registered transaction participants using the transaction caveat.
9. A non-transitory computer-readable storage medium including instructions that, when executed by a processing device, cause the processing device to:
register, by a transaction manager running on the processing device, plurality of transaction participants with the transaction manager before initiating a transaction, wherein registering at least one transaction participant of the plurality of transaction participants comprises:
recording an address of the transaction participant;
determining that the transaction participant is associated with a transaction caveat, wherein the transaction caveat comprises data that identifies an action the transaction participant to take regarding the transaction under at least one of:
first circumstances that will cause the transaction participant to commit to the transaction if the first circumstances are later realized during the transaction; or
second circumstances that will cause the transaction participant to roll back the transaction if the second circumstances are later realized during the transaction; and
recording the transaction caveat associated with the transaction participant;
initiate a prepare phase of the transaction after completing the registering, wherein the prepare phase is initiated before initiating a commit phase of the transaction; and
manage the transaction for the plurality of registered transaction participants using the transaction caveat.
2. The method of
sending a commit query to each of the plurality of registered transaction participants by the transaction manager;
receiving commit responses from each of the plurality of registered transaction participants;
determining an order in which to send commit commands to the plurality of transaction participants based on the transaction caveat; and
sending the commit commands to the plurality of transaction participants in the determined order.
3. The method of
4. The method of
identifying by the transaction manager that the transaction has not completed within the predetermined time period; and
sending roll back messages to the plurality of transaction participants before receiving commit or abort responses from all of the plurality of transaction participants.
5. The method of
notifying the application that the transaction must complete within the predetermined time period, wherein the application notifies the user to commit to the transaction within the predetermined time period.
6. The method of
detecting that the transaction participant associated with the crash recovery transaction caveat has experienced a system crash; and
rolling back the transaction in response to detecting the system crash.
7. The method of
detecting that the transaction participant associated with the crash recovery transaction caveat has experienced a system crash;
receiving commit responses from all of the plurality of transaction participants other than the transaction participant that experienced the system crash; and
committing the transaction without receiving a commit response from the transaction participant that experienced the system crash.
8. The method of
10. The non-transitory computer-readable storage medium of
send a commit query to each of the plurality of registered transaction participants by the transaction manager;
receive commit responses from each of the plurality of registered transaction participants;
determine an order in which to send commit commands to the plurality of transaction participants based on the transaction caveat; and
send the commit commands to the plurality of transaction participants in the determined order.
11. The non-transitory computer-readable storage medium of
12. The non-transitory computer-readable storage medium of
identify by the transaction manager that the transaction has not completed within the predetermined time period; and
send roll back messages to the plurality of transaction participants before receiving commit or abort responses from all of the plurality of transaction participants.
13. The non-transitory computer-readable storage medium of
notify the application that the transaction must complete within the predetermined time period, wherein the application notifies the user to commit to the transaction within the predetermined time period.
14. The non-transitory computer-readable storage medium of
detect that the transaction participant associated with the crash recovery transaction caveat has experienced a system crash; and
roll back the transaction in response to detecting the system crash.
15. The non-transitory computer-readable storage medium of
detect that the transaction participant associated with the crash recovery transaction caveat has experienced a system crash;
receive commit responses from all of the plurality of transaction participants other than the transaction participant that experienced the system crash; and
commit the transaction without receiving a commit response from the transaction participant that experienced the system crash.
16. The non-transitory computer-readable storage medium of
18. The system of
send a commit query to each of the plurality of registered transaction participants by the transaction manager;
receive commit responses from each of the plurality of registered transaction participants;
determine an order in which to send commit commands to the plurality of transaction participants based on the transaction caveat; and
send the commit commands to the plurality of transaction participants in the determined order.
19. The system of
20. The system of
identify that the transaction has not completed within the predetermined time period; and
send roll back messages to the plurality of transaction participants before receiving commit or abort responses from all of the plurality of transaction participants.
21. The system of
notify the application that the transaction must complete within the predetermined time period, wherein the application notifies the user to commit to the transaction within the predetermined time period.
22. The system of
detect that the transaction participant associated with the crash recovery transaction caveat has experienced a system crash; and
roll back the transaction in response to detecting the system crash.
23. The system of
detect that the transaction participant associated with the crash recovery transaction caveat has experienced a system crash;
receive commit responses from all of the plurality of transaction participants other than the transaction participant that experienced the system crash; and
commit the transaction without receiving a commit response from the transaction participant that experienced the system crash.
24. The system of
|
Embodiments of the present invention relate to distributed transactions, and more specifically to using transaction caveats to improve the efficiency of distributed transactions.
Distributed transactions are often performed on distributed computing systems. Herein, a distributed computing system that performs distributed transactions is referred to as a distributed transaction system. A distributed transaction is a set of operations that update shared objects. Distributed transactions must satisfy the properties of Atomicity, Consistency, Isolation and Durability, known commonly as the ACID properties. According to the Atomicity property, either the transaction successfully executes to completion, and the effects of all operations are recorded, or the transaction fails. The Consistency property requires that the transaction does not violate integrity constraints of the shared objects. The Isolation property requires that intermediate effects of the transaction are not detectable to concurrent transactions. Finally, the Durability property requires that changes to shared objects due to the transaction are permanent.
To ensure the Atomicity property, all participants of the distributed transaction must coordinate their actions so that they either unanimously abort or unanimously commit to the transaction. A two-phase commit protocol is commonly used to ensure Atomicity. Under the two-phase commit protocol, the distributed transaction system performs the commit operation in two phases. In the first phase, commonly known as the prepare phase or request phase, a coordinator node (a node in the distributed transaction system managing the transaction) asks all participant nodes whether they are willing to commit to the transaction. During the second phase, commonly known as the commit phase, the coordinator node determines whether the transaction should be completed. If during the prepare phase all participant nodes committed to the transaction, the coordinator node successfully completes the transaction. If during the prepare phase one or more participant nodes failed to commit to the transaction, the coordinator node does not complete the transaction.
Distributed transaction systems include one or more transaction managers that coordinate a transaction. When a transaction is initiated, a transaction manager registers each of the services, clients, applications and/or other entities that will participate in the transaction. In conventional transaction systems, such registration consists solely of recording an address of each of the transaction participants. Transaction managers of conventional transaction systems are not capable of recording additional information about transaction participants at the time of participant registration.
The present invention is illustrated by way of example, and not by way of limitation, in the figures of the accompanying drawings and in which:
Described herein is a method and apparatus for optimizing distributed transaction systems through the use of transaction caveats. In one embodiment, a processing device executing a caveat enabled transaction manager (referred to herein interchangeably as a CETM or simply transaction manager) registers one or more transaction participants with the transaction manager. To register a transaction participant, the transaction manager records an address of the transaction participant. The transaction manager additionally determines whether the transaction participant is associated with any transaction caveats. If the transaction participant is associated with a transaction caveat, the transaction manager records the transaction caveat. During a two-phase commit distributed transaction, the transaction manager can make decisions on whether to commit or rollback a transaction based in part on the transaction caveats. In some situations, the recorded transaction caveats enable the transaction manager to more efficiently manage distributed transactions.
In the following description, numerous details are set forth. It will be apparent, however, to one skilled in the art, that the present invention may be practiced without these specific details. In some instances, well-known structures and devices are shown in block diagram form, rather than in detail, in order to avoid obscuring the present invention.
Some portions of the detailed descriptions which follow are presented in terms of algorithms and symbolic representations of operations on data bits within a computer memory. These algorithmic descriptions and representations are the means used by those skilled in the data processing arts to most effectively convey the substance of their work to others skilled in the art. An algorithm is here, and generally, conceived to be a self-consistent sequence of steps leading to a desired result. The steps are those requiring physical manipulations of physical quantities. Usually, though not necessarily, these quantities take the form of electrical or magnetic signals capable of being stored, transferred, combined, compared, and otherwise manipulated. It has proven convenient at times, principally for reasons of common usage, to refer to these signals as bits, values, elements, symbols, characters, terms, numbers, or the like.
It should be borne in mind, however, that all of these and similar terms are to be associated with the appropriate physical quantities and are merely convenient labels applied to these quantities. Unless specifically stated otherwise, as apparent from the following discussion, it is appreciated that throughout the description, discussions utilizing terms such as “registering”, “recording”, “managing”, “determining”, “identifying”, or the like, refer to the action and processes of a computer system, or similar electronic computing device, that manipulates and transforms data represented as physical (electronic) quantities within the computer system's registers and memories into other data similarly represented as physical quantities within the computer system memories or registers or other such information storage or display devices.
The present invention also relates to an apparatus for performing the operations herein. This apparatus may be specially constructed for the required purposes, or it may comprise a general purpose computer selectively activated or reconfigured by a computer program stored in the computer. Such a computer program may be stored in a computer readable storage medium, such as, but not limited to, any type of disk including floppy disks, optical disks, CD-ROMs, and magnetic-optical disks, read-only memories (ROMs), random access memories (RAMs), EPROMs, EEPROMs, magnetic or optical cards, or any type of media suitable for storing electronic instructions, each coupled to a computer system bus.
The present invention may be provided as a computer program product, or software, that may include a machine-readable medium having stored thereon instructions, which may be used to program a computer system (or other electronic devices) to perform a process according to the present invention. A machine-readable medium includes any mechanism for storing information in a form readable by a machine (e.g., a computer). For example, a machine-readable (e.g., computer-readable) medium includes a machine (e.g., a computer) readable storage medium such as a read only memory (“ROM”), random access memory (“RAM”), magnetic disk storage media, optical storage media, or flash memory device.
The distributed transaction system 100 includes multiple computing devices (e.g., computing device 105, computing device 110 and computing device 112), which are connected via a network 155. Each of the computing devices 105, 110, 112 may be personal computers (PC), palm-sized computing devices, personal digital assistants (PDA), mobile phones, server computers such as rackmount servers, or other computing devices. Each of the computing devices 105, 110, 112 may host services, applications and/or other functionality that is available to clients on the distributed transaction system 100. Two or more of the computing devices 105, 110, 112 may be coupled in a cluster configuration or in a non-cluster configuration. The network 155 may be a private network (e.g., local area network (LAN), wide area network (WAN), intranet, etc.), a public network (e.g., the Internet), or a combination thereof.
In one embodiment, computing device 112 includes one or more clients 102. Additionally, computing device 105 and computing device 110 may also include one or more clients. Client(s) 102 may be applications or programs run on a computing device. In the SOA, client(s) 102 include applications that access services such as transactional resources. Client(s) 102 may be fat clients (client that performs local processing and data storage), thin client (client that performs minimal or no local processing and minimal to no data storage), and/or hybrid clients (client that performs local processing but little to no data storage). In one embodiment, clients 102 are applications that implement transactional operations (e.g., programs that initiate business transactions). Clients 102 may direct a transaction manager to create and demarcate transactions, may propagate transaction context, and may operate on data via resource managers.
In one embodiment, computing device 105 includes caveat enabled transaction manager 120 and computing device 110 includes caveat enabled transaction manager 145. Computing device 112 may also include a transaction manager. A transaction manager is a component that coordinates (acts as a transaction coordinator for) multiple participants during a distributed transaction. A caveat enabled transaction manager is a transaction manager that can use transaction caveats to optimize distributed transactions. Exemplary transaction caveats are described in greater detail below with reference to
A participant may be another transaction manager (e.g., from another computing device), a local resource manager (e.g., resource manager 115 and resource manager 125 are local resource managers for transaction manager 120), a client application (e.g., client 102), or other entity. Coordinating a distributed transaction may include assigning identifiers to the transaction, registering participants of the transaction, monitoring progress of the transaction, taking responsibility for transaction completion, and providing fault recovery for the transaction. Taking responsibility for transaction completion may include determining whether each participant can commit to a transaction, directing each participant to commit if all participants can commit to the transaction, and directing each participant to rollback if not all participating nodes are able to commit.
Any transaction manager in the distributed transaction system 100 is capable of operating as a transaction coordinator. A transaction manager 120, 145 may act as a transaction coordinator when a client 102 requests that the transaction manager 120, 145 initiate a transaction. The transaction manager may be located on the same computing device as the requesting client, on the computing device of one or more resources that will participate in the transaction, or on another computing device. Moreover, a transaction manager can hand responsibility over to another transaction manager, causing the other transaction manager to become the transaction coordinator for a particular distributed transaction.
In one embodiment, computing device 105 includes multiple resource managers 115 and 125, and computing device 110 also includes a resource manager 150. Computing device 112 may also include one or more resource managers, and computing device 110 may include multiple resource managers. A resource manager is a component that manages a persistent and stable storage system. Examples of resource managers include databases and file managers. Each resource manager 115, 125, 150 may act as a participant in a distributed transaction for a resource associated with that resource manager. Each resource manager 115, 125, 150 may include an interface for operating on the data maintained by the resource manager (e.g., by clients 102) and another interface for interacting with the transaction manager and participating in distributed transactions. Some or all of the resource managers 115, 125, 150 may be caveat enabled resource managers. A caveat enabled resource manager is a resource manager that includes one or more transaction caveats, which are discussed below with reference to
Each resource manager 115, 125, 150 may maintain an undo log (log of committed changes that occur during a distributed transaction) and/or redo log (log of uncommitted changes that occur during a distributed transaction). The redo logs and/or undo logs can be used to rollback any changes that occurred during a distributed transaction if the transaction is aborted. These logs may also include an identifier of the coordinator of the transaction, an address of the coordinator, an identification of the transaction, a process identification of a process that started the transaction, a description of the transaction, identification of other participants of the transaction, a timestamp indicating when the transaction was started and/or additional data.
When the transaction manager 200 receives a request (e.g., from a client) to initiate a new transaction, the transaction generator 240 generates the new transaction, the new transaction having a unique transaction identifier. Since multiple clients and/or resources may participate in a transaction, the new transaction has a transaction context, which is associated with the transaction identifier. The transaction context provides an association between transactional operations on the resources and the clients or services invoking those operations. The transaction identifier is sent to the entity (e.g., client) that requested the transaction. The requestor (e.g., client) may then send the transaction identifier to each entity (e.g., additional client, application, resource manager, etc.) that will be a participant to the transaction. Alternatively, the requestor may notify transaction manager 200 of the participants, and transaction manager 200 may send the transaction identifier to each of the identified participants.
The transaction manager 200 maintains a log of active transactions for which that transaction manager acts as a transaction coordinator. In one embodiment, the transaction generator 240 generates a transaction log 220 for each new transaction. The transaction generator 240 may record in a transaction log 220 an identification of the transaction associated with the log(e.g., a transaction identification number), a process identification of the process (e.g., client) that initiated the transaction, a description of the transaction, a timestamp identifying when the transaction was started and/or additional data.
Once a transaction is generated, the transaction manager 200 performs participant registration (also known as resource enlistment). Any resources that will be modified, accessed, or otherwise affected by the transaction are registered with the transaction via either the standard registration interface 205 or the enhanced registration interface 210. Client applications may also register with the transaction. Each resource and/or client application that will participate in the transaction may inform the transaction manager 200 of their participation in the transaction by providing the transaction identifier to the transaction manager 200 and requesting registration to the transaction associated with the provided transaction identifier. Alternatively, the client that requested the transaction may identify to the transaction manager 200 each of the resources and/or additional applications that should be enlisted, and the transaction manager 200 may add those participants to the transaction without first receiving registration requests from those participants.
Standard registration interface 205 is used to enlist/register transaction participants that are not configured to handle transaction caveats. For example, legacy applications and/or resources may enlist in the transaction using the standard registration interface. The standard registration interface 205 includes an address recorder 245 that registers a participant to a transaction by adding an entry for the participant in the transaction log 220 associated with the transaction. Alternatively, the address recorder 245 may record the participant's address into a separate participant log associated with the transaction. The participant's address may be a universal resource locator (URL), a common object resource broker architecture (CORBA) interoperable internet object protocol (IIOP) reference, an internet protocol address and/or port address, and/or other form of electronic address.
Enhanced registration interface 210 is used to enlist/register participants that include transaction caveats. A transaction caveat is a statement that identifies how a participant will behave regarding a transaction under particular circumstances. For example, transaction caveats may include timeout transaction caveats that specify actions that a participant will take if a transaction fails to be resolved prior to a timeout period and/or crash recovery transaction caveats that specify actions that a participant will take upon recovering from a system crash. Transaction caveats act as cautionary details that the transaction manager can consider when evaluating whether to commit or rollback a transaction, how to distribute commands to participants, and/or how to otherwise manage a transaction.
Enhanced registration interface 210 includes an address recorder 250, a caveat identifier 255 and a caveat recorder 260. Address recorder 250 records participant addresses to transaction log 220 (or to a participant log) as described above with reference to address recorder 245. Caveat identifier 255 identifies what caveats, if any, are associated with a participant. The participant notifies the caveat identifier 255 of the transaction caveats used by the participant. This may be in response to the caveat identifier 255 polling the participant for transaction caveats, or may be reported along with participant address by the participant without the caveat identifier 255 sending a query to the participant (e.g., when the participant requests to be enlisted in the transaction via the enhanced registration interface 210). Caveat recorder 260 records any identified transaction caveats in the transaction log 220. In one embodiment, the identified transaction caveats are recorded in an entry for the participant along with the participant's address.
A participant may have one or multiple transaction caveats. Each transaction caveat identifies whether the transaction participant will commit to a transaction or rollback a transaction given a particular set of circumstances. One type of transaction caveat is a timeout transaction caveat. A timeout transaction caveat specifies a time period after which the associated participant will automatically rollback or commit to a distributed transaction. For example, a timeout transaction caveat may specify that the associated participant will automatically rollback any transactions that are not completed within 30 seconds of when the transactions begin.
Another type of transaction caveat is a crash recovery transaction caveat. A crash recovery transaction caveat specifies that if the participant crashes (e.g., the machine hosting the participant crashes or just the participant crashes), when the participant recovers from the crash, the participant will automatically commit to the transaction or rollback the transaction. Participants may also include other types of transaction caveats.
Transaction processing module 225 is responsible for actually coordinating a distributed transaction. The transaction processing module 225 administers the two-phase commit transaction protocol. Accordingly, during a prepare phase of a two-phase commit distributed transaction, the transaction processing module 225 sends a commit query to each participant asking whether the participant can commit to the transaction. If the participant can commit to the transaction, it sends a commit response back to the transaction coordinator. If the participant cannot commit to the transaction, it sends an abort response (also known as a rollback response) to the transaction coordinator. During a commit phase of a two-phase commit distributed transaction, the transaction processing module 225 sends a commit command to each participant if all participants indicated that they were able to commit. Each participant then commits to the transaction and sends a confirmation to the transaction coordinator that the transaction was successfully completed. If one or more of the participants sent an abort response, then the transaction processing module 225 sends an abort command to each participant during the commit phase. Each participant then rolls back the transaction, and may send a confirmation to the transaction coordinator that the transaction was rolled back. Messages such as the commit query, commit command and rollback command are sent to participants using the participant's addresses that are recorded in the transaction log 220.
Transaction processing module 225 may use the transaction caveats in the transaction log 220 to optimize how a transaction is coordinated. For example, consider a transaction having a first participant with a timeout transaction caveat that specifies that the associated participant will automatically rollback a transaction if not completed in 30 seconds and additional participants that do not include any timeout transaction caveats. Once all participants have sent commit responses to the transaction manager 200, the transaction processing module 225 may determine that a commit command should be sent to the first participant before sending the commit command to other participants to ensure that the first participant will not automatically rollback the transaction. Additionally, if responses have not been received from all participants before the 30 second time period, then transaction processing module 225 knows that the first transaction participant has already rolled back the transaction. Thus, the transaction processing module 225 may send abort (rollback) commands to the participants before receiving commit or rollback responses from all of the participants.
Consider another example, in which a first transaction participant includes a crash recovery transaction caveat specifying that the transaction participant will automatically rollback the transaction upon recovery. At any point during a distributed transaction, one or more participants may fail/crash. If the transaction manager 200 detects that the first transaction participant has crashed, then the transaction processing module 225 may automatically rollback the transaction without receiving commit or rollback responses from all participants. Thus, transaction caveats can cause transactions to complete (commit or rollback) sooner than they would otherwise complete, increasing their efficiency.
Referring to
At block 315, the transaction manager receives a request to enlist/register a transaction participant to the transaction. In one embodiment, the request includes the transaction identifier to identify the transaction that the participant will participate in. The request may also include an address of the participant and one or more transaction caveats associated with the participant.
At block 320, the transaction manager records an address of the transaction participant. At block 325, the transaction manager determines whether the transaction participant is associated with a transaction caveat 325. If the transaction participant is associated with a transaction caveat, the method continues to block 330, and the transaction manager records the transaction caveat for the transaction participant. The transaction caveat and participant address may be included in an entry of a transaction log maintained by the transaction manager. If the transaction participant is not associated with a transaction caveat, the method proceeds to block 335. At block 335, the transaction manager determines whether there are any additional participants to add to the transaction (e.g., if the transaction manager has received any requests to register additional participants). If there are additional participants to enlist in the transaction, the method returns to block 320 for the next participant. Otherwise, the method ends.
Once participants have been registered in a transaction, if any of those participants were registered with transaction caveats, the transaction manager can use those transaction caveats in managing the transaction. Use of the transaction managements to manage a transaction can reduce rollbacks due to transaction timeouts, reduce transaction pendency, and otherwise optimize transactions.
Referring to
At block 425, the transaction manager determines whether any time limits included in any automatic rollback caveats have expired. If a time limit of a timeout caveat specifying that the associated participant will roll back the transaction has expired, then it is known that the associated participant has already rolled back the transaction. Thus, there is no need to wait for commit or rollback responses from participants. Under such circumstances, the method proceeds to block 430, and the transaction is rolled back. This includes sending rollback commands to the participants. In one embodiment, a rollback command is not sent to the participant having an automatic rollback timeout caveat that has expired, since it has already unilaterally rolled back the transaction. Rollback commands also may not be sent to any participants that have automatic rollback timeout caveats that have time limits that have not expired, since they will unilaterally rollback the transaction when their time limits expire.
If at block 425 no automatic rollback timeout caveats have time limits that have expired, the method continues to block 435. At block 435, the transaction manager receives a response message. At block 445, the transaction manager then determines whether the received response message is an abort/rollback response or a commit response. If the received response is an abort response, the method proceeds to block 430 and the transaction is rolled back. If the received response is a commit response, the method continues to block 447.
At block 447, the transaction manager determines whether response messages have been received from all registered participants. If response messages have not been received from all transaction participants, the method returns to block 420 to await additional response messages. If commit responses have been received from all participants, the method continues to block 450.
Any transaction participants having automatic rollback timeout caveats will automatically roll back the transaction, even after sending a commit response, if they do not receive a commit command from the transaction manager before the timeout period (before the time limit has expired). Accordingly, at block 450, the transaction manager determines an order in which to send commit commands to participants based on time limits in automatic rollback transaction caveats. The order may be determined by prioritizing participants based on the transaction caveats, and ordering the participants in descending order of priority (e.g., so that the participant having the highest priority is ordered first, and so on). In one embodiment, transaction participants having automatic rollback timeout caveats are prioritized over participants that do not have such caveats. Additionally, participants that have the shortest timeout periods for their automatic rollback timeout caveats are prioritized higher than participants that have longer timeout periods. At block 455, the transaction manager sends commit commands to the participants based on the determined order, which may be based on a determined prioritization of the participants. This minimizes the risk that any transaction participants will unilaterally rollback the transaction before its completion.
Referring to
At block 520, the transaction manager determines whether the crashed participant is associated with an automatic rollback crash recovery caveat. If the participant is associated with an automatic rollback crash recovery caveat, then the transaction manager knows that upon recovery from the system crash, the participant will abort or rollback the transaction. Thus, if the crashed participant is associated with an automatic rollback crash recovery caveat, the method continues to block 555, and the transaction manager rolls back the transaction. This includes sending rollback commands to the participants. In one embodiment, a rollback command is not sent to the crashed participant, since the crashed participant will automatically rollback the transaction upon recovery.
If at block 520 the crashed participant is not associated with an automatic rollback crash recovery caveat, the method continues to block 525. At block 525, the transaction manager waits for a response message until a response message is received (or potentially until a timer times out). At block 530, the transaction manager then determines whether the received response message is an abort/rollback response or a commit response. If the received response is an abort response, the method proceeds to block 555 and the transaction is rolled back. If the received response is a commit response, the method continues to block 535.
At block 535, the transaction manager determines whether response messages have been received from all registered participants. If response messages have not been received from all transaction participants, the method returns to block 525 to await additional response messages. If commit responses have been received from all participants, the method continues to block 540.
At block 540, the transaction manager determines whether the crashed participant is associated with an automatic commit crash recovery caveat. If the participant is associated with an automatic commit crash recovery caveat, then the transaction manager knows that upon recovery from the system crash, the participant will issue a commit response for the transaction. Thus, if the crashed participant is associated with an automatic commit crash recovery caveat, the method continues to block 550, and the transaction manager commits the transaction. This includes sending commit commands to each of the participants, including the crashed participant. The commit command is sent to the crashed participant once that participant recovers from the crash.
If at block 540 the crashed participant is not associated with an automatic commit crash recovery caveat, the method proceeds to block 545. At block 545, the transaction manager waits for the crashed participant to recover and provide a response message. If the response message is an abort response, the method continues to block 555, and the transaction is aborted. If the response message is a commit response, the method continues to block 550, and the transaction manager commits the transaction.
Method 500 can significantly reduce the pendency of distributed transactions where a transaction participant has experienced a system crash.
The exemplary computer system 600 includes a processing device 602, a main memory 604 (e.g., read-only memory (ROM), flash memory, dynamic random access memory (DRAM) such as synchronous DRAM (SDRAM) or Rambus DRAM (RDRAM), etc.), a static memory 608 (e.g., flash memory, static random access memory (SRAM), etc.), and a secondary memory 618 (e.g., a data storage device), which communicate with each other via a bus 630.
Processing device 602 represents one or more general-purpose processing devices such as a microprocessor, central processing unit, or the like. More particularly, the processing device 602 may be a complex instruction set computing (CISC) microprocessor, reduced instruction set computing (RISC) microprocessor, very long instruction word (VLIW) microprocessor, processor implementing other instruction sets, or processors implementing a combination of instruction sets. Processing device 602 may also be one or more special-purpose processing devices such as an application specific integrated circuit (ASIC), a field programmable gate array (FPGA), a digital signal processor (DSP), network processor, or the like. Processing device 602 is configured to execute processing logic (e.g., instructions 626) for performing the operations and steps discussed herein.
The computer system 600 may further include a network interface device 622. The computer system 600 also may include a video display unit 610 (e.g., a liquid crystal display (LCD) or a cathode ray tube (CRT)), an alphanumeric input device 612 (e.g., a keyboard), a cursor control device 614 (e.g., a mouse), and a signal generation device 620 (e.g., a speaker).
The secondary memory 618 may include a machine-readable storage medium (or more specifically a computer-readable storage medium) 624 on which is stored one or more sets of instructions 626 embodying any one or more of the methodologies or functions described herein. The instructions 626 may also reside, completely or at least partially, within the main memory 604 and/or within the processing device 602 during execution thereof by the computer system 600, the main memory 604 and the processing device 602 also constituting machine-readable storage media.
The machine-readable storage medium 624 may also be used to store a caveat enabled transaction manager (CETM) (e.g., CETM 200 of
It is to be understood that the above description is intended to be illustrative, and not restrictive. Many other embodiments will be apparent to those of skill in the art upon reading and understanding the above description. Although the present invention has been described with reference to specific exemplary embodiments, it will be recognized that the invention is not limited to the embodiments described, but can be practiced with modification and alteration within the spirit and scope of the appended claims. Accordingly, the specification and drawings are to be regarded in an illustrative sense rather than a restrictive sense. The scope of the invention should, therefore, be determined with reference to the appended claims, along with the full scope of equivalents to which such claims are entitled.
Patent | Priority | Assignee | Title |
10430402, | Jan 16 2015 | Red Hat, Inc.; Red Hat, Inc | Distributed transaction with dynamic form |
Patent | Priority | Assignee | Title |
5761721, | Dec 28 1993 | International Business Machines Corporation | Method and system for cache coherence despite unordered interconnect transport |
5781910, | Sep 13 1996 | Alcatel Lucent | Preforming concurrent transactions in a replicated database environment |
6138143, | Jan 28 1999 | SAP SE | Method and apparatus for asynchronous transaction processing |
6157927, | Apr 22 1998 | Unisys Corporation | Methods and apparatus for enabling a component in a first transaction processing environment to access a resource in another environment that is under the control of an Xatmi complaint transaction manager |
6286110, | Jul 30 1998 | HEWLETT-PACKARD DEVELOPMENT COMPANY, L P | Fault-tolerant transaction processing in a distributed system using explicit resource information for fault determination |
6301601, | Oct 28 1997 | Microsoft Technology Licensing, LLC | Disabling and enabling transaction committal in transactional application components |
6438582, | Jul 21 1998 | International Business Machines Corporation | Method and system for efficiently coordinating commit processing in a parallel or distributed database system |
6493726, | Dec 29 1998 | Oracle International Corporation | Performing 2-phase commit with delayed forget |
6738971, | Mar 10 1999 | Oracle International Corporation | Using a resource manager to coordinate the comitting of a distributed transaction |
7197533, | Jan 24 2003 | International Business Machines Corporation | Non-persistent service support in transactional application support environments |
7290056, | Sep 09 1999 | Oracle International Corporation | Monitoring latency of a network to manage termination of distributed transactions |
7337441, | Jul 17 2001 | Oracle International Corporation | System and method for prepreparing a transaction process involving a chain of servers in a circular flow |
7346905, | Jun 10 2003 | International Business Machines Corporation | Apparatus and method for maintaining resource integrity without a unified transaction manager in a software environment |
7441025, | Jul 17 2001 | Oracle International Corporation | System and method for transaction processing with delegated commit feature |
7818429, | Nov 30 2004 | International Business Machines Corporation | Registering a resource that delegates commit voting |
8001548, | Oct 20 2008 | Microsoft Technology Licensing, LLC | Transaction processing for side-effecting actions in transactional memory |
8213295, | Sep 12 2006 | Qualcomm Incorporated | Transaction timeout handling in communication session management |
8271448, | Jan 28 2005 | Oracle International Corporation | Method for strategizing protocol presumptions in two phase commit coordinator |
8396961, | Aug 31 2009 | Red Hat, Inc.; Red Hat, Inc | Dynamic control of transaction timeout periods |
20010011228, | |||
20050055325, | |||
20050119908, | |||
20050187891, | |||
20060143186, | |||
20070043784, | |||
20070072163, | |||
20080034082, | |||
20080046608, | |||
20080062863, | |||
20080312998, | |||
20100223217, | |||
20110055376, | |||
GB2335516, |
Executed on | Assignor | Assignee | Conveyance | Frame | Reel | Doc |
Mar 31 2010 | LITTLE, MARK CAMERON, DR | Red Hat, Inc | ASSIGNMENT OF ASSIGNORS INTEREST SEE DOCUMENT FOR DETAILS | 024177 | /0205 | |
Apr 01 2010 | Red Hat, Inc. | (assignment on the face of the patent) | / |
Date | Maintenance Fee Events |
Feb 11 2020 | M1551: Payment of Maintenance Fee, 4th Year, Large Entity. |
Apr 08 2024 | REM: Maintenance Fee Reminder Mailed. |
Date | Maintenance Schedule |
Aug 16 2019 | 4 years fee payment window open |
Feb 16 2020 | 6 months grace period start (w surcharge) |
Aug 16 2020 | patent expiry (for year 4) |
Aug 16 2022 | 2 years to revive unintentionally abandoned end. (for year 4) |
Aug 16 2023 | 8 years fee payment window open |
Feb 16 2024 | 6 months grace period start (w surcharge) |
Aug 16 2024 | patent expiry (for year 8) |
Aug 16 2026 | 2 years to revive unintentionally abandoned end. (for year 8) |
Aug 16 2027 | 12 years fee payment window open |
Feb 16 2028 | 6 months grace period start (w surcharge) |
Aug 16 2028 | patent expiry (for year 12) |
Aug 16 2030 | 2 years to revive unintentionally abandoned end. (for year 12) |