Transaction processing method and related device
By using persistent write-ahead logs and checkpoint mechanisms in distributed transactions, outstanding issues in distributed transactions when equipment is abnormal are solved, and reliable recovery and correct processing of transactions are achieved.
Patent Information
- Application Number
- PCT/CN2023/139803
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-03-17
- Filing Date
- 2023-12-19
- Publication Date
- 2024-09-26
AI Technical Summary
The existing distributed transaction retry mechanism cannot guarantee the correct processing of failed transactions, which may result in pending transactions, especially when the transaction coordinator or participant device is abnormal.
Use pre-written logs with persistent storage capabilities to record the transaction submission process, and set checkpoints at multiple process nodes to ensure that transactions can be re-advanced through log playback after device abnormal recovery, providing reliable transaction recovery capabilities.
It effectively avoids pending transactions, ensures that distributed transactions can be processed correctly, and improves the reliability and stability of the system.
Smart Images

Figure CN2023139803_26092024_PF_FP
Abstract
Description
Transaction processing method and related equipment
[0001] This application claims priority to the Chinese patent application filed with the China Patent Office on March 17, 2023, with application number 202310267376.8 and application name “Transaction Processing Method and Related Equipment”, the entire contents of which are incorporated by reference into this application. Technical Field
[0002] The present application relates to the field of computer technology, and in particular to a transaction processing method and related equipment. Background Art
[0003] When multiple transaction participants participate in a transaction, it's called a distributed transaction. Currently, to ensure the consistency of distributed transaction commits, the mainstream transaction commit protocol is typically the two-phase commit protocol (2PC). Because distributed transactions involve the coordinated scheduling of multiple transaction participants, they are more complex than traditional single-machine transactions.
[0004] Existing distributed failed transaction retry mechanisms generally retry failed transactions based on in-memory transaction log records. However, retrying failed transactions based on in-memory transaction log records may not guarantee that all failed transactions are properly processed. For example, if the transaction coordinator fails, pending failed transactions may be left on transaction participants.
[0005] Summary of the Invention
[0006] In view of this, it is necessary to provide a transaction processing method that can ensure that transactions can be processed correctly and avoid pending transactions.
[0007] In a first aspect, an embodiment of the present application discloses a transaction processing method, comprising: creating a distributed transaction for a received operation instruction in response to the operation instruction, the distributed transaction including multiple transaction branches; committing the distributed transaction based on a preset transaction commit mechanism, and generating a write-ahead log for the distributed transaction, the commit of each of the multiple transaction branches including multiple process nodes, the preset transaction commit mechanism including a checkpoint for detecting the execution status of the multiple process nodes and the transaction status of each transaction branch; if it is determined that the distributed transaction includes an abnormal transaction branch, processing the abnormal transaction branch based on the write-ahead log and the checkpoint, the abnormal transaction branch being caused by an abnormality in a device where a transaction coordinator of the distributed transaction is located, or an abnormality in a device where a transaction participant of the distributed transaction is located.
[0008] With the above technical solution, the submission of a distributed transaction may be left in an unresolved state due to an exception in the device where the transaction coordinator of the distributed transaction is located, or in the device where the transaction participant of the distributed transaction is located (device crash, power outage, network disconnection, restart, etc.). By adopting a pre-write log with persistent storage capability to record the transaction submission process during the transaction submission phase, and setting checkpoints at multiple process nodes in the transaction submission process to check the execution status and transaction status, for transactions with exceptions, after the device exception is recovered, the transaction can be re-promoted from the specified process node based on log playback, providing reliable transaction recovery capabilities for transaction exceptions, ensuring that transactions can be handled correctly, and avoiding unresolved transactions.
[0009] In some embodiments, creating a distributed transaction for an operation instruction includes: if the data processed by the operation instruction involves multiple sub-databases or multiple sub-tables, creating a distributed transaction for the operation instruction.
[0010] By adopting the above technical solution, when it is determined that the data processed by the operation instruction involves multiple sub-libraries or multiple sub-tables, indicating that there are multiple transaction participants (one sub-library or one sub-table can serve as a transaction participant), by creating a distributed transaction for the operation instruction, consistency processing of the data located in multiple sub-libraries or multiple sub-tables can be achieved.
[0011] In some embodiments, the preset transaction commit mechanism is a two-phase commit protocol, and generating a write-ahead log for the distributed transaction includes: generating a first write-ahead log before each transaction branch is pre-committed, and the first write-ahead log is used to record transaction-related information of the first phase in the two-phase commit protocol; generating a second write-ahead log before each transaction branch is committed, and the second write-ahead log is used to record transaction-related information of the second phase in the two-phase commit protocol; the transaction-related information of the first phase and the transaction-related information of the second phase both include transaction status information of the distributed transaction, transaction status information of the transaction branch, operation data, and structured query language (SQL) statements for processing the operation data.
[0012] By adopting the above technical solution, when committing a transaction using the two-phase commit protocol, a write-ahead log with persistent storage capability is used in the first and second phases of the transaction to record the transaction status information of the global transaction, the transaction status information of the transaction branch, the operation data, and the SQL statement used to process the operation data. This provides reliable transaction recovery capabilities for transaction exceptions, ensures that abnormal transactions can be correctly handled based on log playback, and avoids pending transactions.
[0013] In some embodiments, the transaction processing method further includes: if the generation of the first write-ahead log or the second write-ahead log fails, controlling each transaction branch to roll back.
[0014] With the above technical solution, if the generation of the first write-ahead log or the second write-ahead log fails, it indicates that the first or second phase of the transaction cannot be recorded through the write-ahead log, resulting in the inability to continue advancing the abnormal transaction from the first or second phase based on log playback. By controlling each transaction branch to roll back, the problem of being unable to continue advancing the abnormal transaction from the first or second phase based on log playback can be avoided.
[0015] In some embodiments, the submission of each transaction branch includes submitting a transaction process or rolling back a transaction process. The submitting transaction process or rolling back a transaction process both include multiple process nodes, and each of the multiple process nodes is provided with a checkpoint.
[0016] By adopting the above technical solution, both the transaction submission process and the transaction rollback process can include multiple process nodes. By setting multiple checkpoints in the transaction submission process and the transaction rollback process to check the execution status of each process node, it is possible to re-submit or roll back the transaction from the specified process node based on log playback after the device abnormality is recovered, providing reliable transaction recovery capabilities for transaction abnormalities, ensuring that transactions can be handled correctly, and avoiding pending transactions.
[0017] In some embodiments, after the distributed transaction is committed based on a preset transaction commit mechanism, the method further includes: determining a transaction branch that is not in a preset transaction state as an abnormal transaction branch, where the preset transaction state includes a Rollbacked state or a Committed state.
[0018] Using the above technical solution, transaction branches that are not in the Rollbacked or Committed state are identified as abnormal transaction branches. For abnormal transaction branches, based on log playback, the transaction can be re-committed or rolled back from the specified process node until it is in the Committed or Rollbacked state, ensuring that the transaction can be processed correctly and avoiding pending transactions.
[0019] In some embodiments, an abnormal transaction branch is processed based on a write-ahead log and a checkpoint, including: replaying the write-ahead log corresponding to the abnormal transaction branch, determining a process node for reprocessing the abnormal transaction branch; and processing the abnormal transaction branch with the determined process node as the starting process node.
[0020] By adopting the above technical solution, for transactions that have abnormalities, the pre-written log corresponding to the abnormal transaction branch can be replayed after the device recovers from the abnormality, thereby improving the efficiency of log replay. Based on the log replay, the transaction can be re-promoted from the specified process node, providing reliable transaction recovery capabilities for transaction abnormalities, ensuring that the transaction can be handled correctly, and avoiding pending transactions.
[0021] In a second aspect, an embodiment of the present application provides a distributed middleware, comprising: a creation module for creating a distributed transaction for an operation instruction in response to a received operation instruction, wherein the distributed transaction includes multiple transaction branches; a submission module for submitting the distributed transaction based on a preset transaction submission mechanism, and generating a pre-write log for the distributed transaction, wherein the submission of each transaction branch in the multiple transaction branches includes multiple process nodes, and the preset transaction submission mechanism includes a checkpoint for detecting the execution status of the multiple process nodes and the transaction status of each transaction branch; a processing module for processing the abnormal transaction branch based on the pre-write log and the checkpoint when determining that the distributed transaction contains an abnormal transaction branch, wherein the abnormal transaction branch is caused by an abnormality in the device where the transaction coordinator of the distributed transaction is located, or an abnormality in the device where the transaction participant of the distributed transaction is located.
[0022] With the above technical solution, the submission of a distributed transaction may be left in an unresolved state due to an exception in the device where the transaction coordinator of the distributed transaction is located, or in the device where the transaction participant of the distributed transaction is located (device crash, power outage, network disconnection, restart, etc.). By adopting a pre-write log with persistent storage capability to record the transaction submission process during the transaction submission phase, and setting checkpoints at multiple process nodes in the transaction submission process to check the execution status and transaction status, for transactions with exceptions, after the device exception is recovered, the transaction can be re-promoted from the specified process node based on log playback, providing reliable transaction recovery capabilities for transaction exceptions, ensuring that transactions can be handled correctly, and avoiding unresolved transactions.
[0023] In a third aspect, an embodiment of the present application provides a computer-readable storage medium comprising computer program instructions. When the computer program instructions are executed by a computing device cluster, the computing device cluster executes the transaction processing method as described in the first aspect.
[0024] In a fourth aspect, an embodiment of the present application provides a computing device cluster, comprising at least one computing device, each computing device comprising a processor and a memory; the processor of at least one computing device is used to execute instructions stored in the memory of at least one computing device, so that the computing device cluster executes the transaction processing method described in the first aspect.
[0025] In a fifth aspect, an embodiment of the present application provides a computer program product. When the computer program product is executed by a computing device cluster, the computing device cluster executes the transaction processing method as described in the first aspect.
[0026] In a sixth aspect, a device is provided, wherein the device has the function of implementing the computing device cluster behavior provided in the method provided in the first aspect. The function can be implemented through hardware or through hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above-mentioned functions.
[0027] It can be understood that the computer-readable storage medium described in the third aspect, the computing device cluster described in the fourth aspect, the computer program product described in the fifth aspect, and the apparatus described in the sixth aspect all correspond to the method of the first aspect. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding methods provided above and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] FIG1 is a schematic diagram of the architecture of a distributed transaction submission system provided in one embodiment of the present application;
[0029] FIG2 is a schematic diagram of an application environment of a transaction processing method provided in an embodiment of the present application;
[0030] FIG3 is a schematic diagram of the overall execution process of a distributed transaction provided by an embodiment of the present application;
[0031] FIG4 is a schematic diagram of a two-phase commit process for a distributed transaction according to an embodiment of the present application;
[0032] FIG5 is a schematic diagram of the organizational structure of a write-ahead log in a storage device according to an embodiment of the present application;
[0033] FIG6 is a schematic diagram of a process for ending a distributed transaction according to an embodiment of the present application;
[0034] FIG7 is a schematic diagram of a process for rolling back a distributed transaction according to an embodiment of the present application;
[0035] FIG8 is a schematic diagram of a process flow of a transaction processing method according to an embodiment of the present application;
[0036] FIG9 is a module diagram of a distributed database middleware provided in an embodiment of the present application;
[0037] FIG10 is a schematic diagram of the structure of a computing device provided in one embodiment of the present application;
[0038] FIG11 is a schematic diagram of the structure of a computing device cluster provided in one embodiment of the present application. DETAILED DESCRIPTION
[0039] It should be noted that in this application, "at least one" means one or more, and "more than one" means two or more than two. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. The terms "first", "second", "third", "fourth", etc. (if any) in the specification, claims and drawings of this application are used to distinguish similar objects, rather than to describe a specific order or sequence.
[0040] In the embodiments of this application, words such as "exemplary" or "for example" are used to indicate examples, illustrations, or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of this application should not be interpreted as being preferred or advantageous over other embodiments or designs. Rather, the use of words such as "exemplary" or "for example" is intended to present the relevant concepts in a concrete manner.
[0041] To facilitate understanding of the embodiments of the present application, the application scenarios of the present application are introduced below. The business scenarios described in the embodiments of the present application are intended to more clearly illustrate the technical solutions of the embodiments of the present application, and do not constitute a limitation on the technical solutions provided by the embodiments of the present application. Ordinary technicians in this field can know that with the emergence of new business scenarios, the technical solutions provided by the embodiments of the present application are also applicable to similar technical problems.
[0042] In order to facilitate understanding of the technical solutions in the embodiments of the present application, some of the terms involved in the embodiments of the present application are first explained below:
[0043] Distributed databases: Data from a centralized database is distributed across multiple network-connected data storage nodes to achieve greater storage capacity and higher concurrency. Sharding can be used to store massive amounts of data in separate shards across the various storage nodes of a distributed database. Generally speaking, sharding involves sharding large tables into separate storage nodes according to a defined partitioning strategy, or by dividing a large table into smaller business sub-tables and storing each sub-table on a separate storage node according to a defined partitioning strategy.
[0044] A transaction is a set of sequential operations that form a complete logical sequence. After executing this set of operations, the transaction commits the system, requiring it to transition from one consistent state to another. All operations in this set must either succeed or fail. If some operations succeed while others fail, the successful operations must be rolled back to the state before the unsuccessful execution.
[0045] XA protocol: A distributed transaction processing specification proposed by the X / Open organization. It primarily defines the interface between the transaction manager (TM) and the local resource manager (RM). The transaction manager, also known as the transaction coordinator, is responsible for assigning unique transaction identifiers, monitoring transaction progress, and managing transaction commits and rollbacks. The local resource manager, which can be a database or file system, provides access to resources. Applications define transaction boundaries (i.e., when a transaction begins and ends) and operate on resources within those boundaries.
[0046] Two-phase commit protocol based on the XA protocol: The transaction commit process is divided into the prepare phase, which is the first phase of the two-phase commit protocol, and the commit phase, which is the second phase of the two-phase commit protocol. The transaction coordinator can coordinate all transaction participants. If all transaction participants (RMs) can commit the transaction in the first phase, the transaction branch on each RM is committed in the second phase. Otherwise, the transaction coordinator rolls back the transaction branch on each RM.
[0047] Structured Query Language (SQL): is a database query and programming language used to access data and query, update, and manage relational database systems.
[0048] As shown in FIG1 , a schematic diagram of the architecture of a distributed transaction submission system provided in an embodiment of the present application is exemplarily introduced.
[0049] In this embodiment, a distributed transaction submission system may include a transaction coordinator 110 and multiple transaction participants 120. Transaction participants 120 are used to process distributed transactions. Transaction coordinator 110 coordinates and manages the processing of distributed transactions by multiple transaction participants 120. A distributed transaction, also known as a global transaction, may correspond to multiple transaction branches, each corresponding to a single transaction participant 120.
[0050] In some embodiments, the transaction coordinator 110 may be selected from multiple transaction participants 120. For example, the transaction coordinator 110 and one of the multiple transaction participants 120 may be the same node. Alternatively, the transaction coordinator 110 and the multiple transaction participants 120 may be different nodes, which is not limited in the embodiments of the present application. The specific implementation of a node may be a server or a virtual machine, which is not limited in the embodiments of the present application. For example, a node may refer to a data storage node in a distributed database.
[0051] In some embodiments, the transaction coordinator 110 may also be deployed in a middleware for providing function extension services for a distributed database. For example, the transaction coordinator 110 may be deployed in a distributed database middleware (DDM) 12 shown in FIG. 2 .
[0052] As shown in FIG2 , it is a schematic diagram illustrating an application environment of a transaction processing method provided in an embodiment of the present application.
[0053] This embodiment uses the example of a distributed transaction involving operations on multiple database shards. This embodiment includes application 11, DDM 12, and database 13. Application 11 can be a tenant-oriented cloud application or other types of applications, which are not limited in this application. Database 13 can be a cloud database or other types of databases, which are not limited in this application. DDM 12 can provide database 13 with capabilities such as sharding, read-write separation, and elastic expansion.
[0054] Application 11 can be used to receive user operation instructions and create a transaction tr1. The data involved in transaction tr1 may be distributed across different database shards on multiple relational database service (RDS) instances. A series of operations on the data tables within the same database shard on each RDS instance is equivalent to a transaction branch (local transaction). That is, transaction tr1 can be equivalent to a distributed transaction composed of transaction branches on multiple RDS instances, and these transaction branches may all be executed successfully or all fail to execute successfully. DDM 12 acts as the transaction coordinator in transaction tr1, and each RDS instance acts as a transaction participant. In some embodiments, DDM 12 can also execute the creation of transaction tr1.
[0055] As shown in FIG3 , an overall execution flow chart of a distributed transaction provided by an embodiment of the present application is exemplarily introduced.
[0056] In this embodiment, DDM 12 transparently encapsulates the two-phase commit of transactions. When using transactions, applications do not need to worry about whether the underlying transaction is a distributed transaction; they can simply use standard transaction instructions (BEGIN / COMMIT) to perform distributed transaction operations. DDM 12 automatically handles the two-phase commit logic of distributed transactions. If a transaction involves only one shard or one database, DDM 12 can also automatically downgrade the transaction to a local transaction with a one-phase commit.
[0057] For example, DDM 12 can map distributed transaction semantics with common transaction semantics. DDM 12 can determine whether a transaction is local or distributed by identifying whether the transaction's data involves multiple shards or multiple shard tables. If multiple shards or multiple shard tables are involved, the transaction is determined to be a distributed transaction and a two-phase commit is performed. If only one shard or one shard is involved, the transaction is determined to be a local transaction and a one-phase commit is performed.
[0058] 3 takes a distributed transaction including two transaction branches (hereinafter referred to as the first transaction branch and the second transaction branch) as an example. The first transaction branch corresponds to the first RDS instance RDS1, and the second transaction branch corresponds to the second RDS instance RDS2.
[0059] The first phase based on the XA protocol includes: starting an XA transaction (through the XA START instruction), executing business SQL (business SQL may include multiple SQL statements), ending the XA transaction (through the XA END instruction) and pre-committing the XA transaction (through the XA PREPARE instruction), thus completing the preparation operation of the business SQL.
[0060] The second phase of the XA protocol involves committing or rolling back an XA transaction. Executing the XA COMMIT command commits the XA transaction, at which point the business SQL statement is truly committed to the database. Executing the XA ROLLBACK command rolls back the XA transaction, completing the rollback of the business SQL statement and releasing database lock resources.
[0061] In the first phase, an XA transaction branch can be started using the XA START instruction, placing the XA transaction branch in the ACTIVE state. For an XA transaction branch in the ACTIVE state, the SQL statements that constitute the XA transaction branch are executed, specifying the boundaries of the XA transaction branch. The XA END instruction is then executed to place the XA transaction branch in the IDLE state, effectively ending the XA transaction branch boundaries. The SQL statements between the XA START and XA END instructions constitute the transaction scope of this XA transaction branch. For an XA transaction branch in the IDLE state, the XA PREPARE instruction can be executed to place the XA transaction branch in the PREPARED state. In the second phase, an XA transaction branch in the PREPARED state can be committed using the XA COMMIT instruction, or rolled back using the XA ROLLBACK instruction.
[0062] Distributed transactions are assigned a globally unique distributed transaction ID (XID). The XID consists of the transaction sequence number within the node, the node identity document (ID), and a timestamp. The XID is combined with the corresponding database name (also known as DBNAME) to form the unique ID (XA_ID) of the transaction branch actually opened on the physical database. Specifically, XA_ID = XID + DBNAME. An XA transaction branch can be started using the XA START "XID + DBNAME" command.
[0063] Assume that the XID of the distributed transaction shown in Figure 3 is: 34287.DDM.1.20210421024418, where "34287" is the transaction sequence number within the node, "1" is the node ID, and "20210421024418" is the timestamp. The shard corresponding to the first transaction branch is named db_sysbench_0003, and the shard corresponding to the second transaction branch is named db_sysbench_0004. That is, the XA_ID of the first transaction branch is: 34287.DDM.1.20210421024418.db_sysbench_0003, and the XA_ID of the second transaction branch is: 34287.DDM.1.20210421024418.db_sysbench_0004.
[0064] 4 , a flowchart of two-phase commit of distributed transactions provided by an embodiment of the present application is exemplarily introduced.
[0065] In this embodiment, by setting multiple checkpoints in the first and second phases (to detect whether each process node in the transaction commit or rollback process is executed successfully or failed), and using a write-ahead log (WAL) technology with persistence capabilities to record transaction commit and rollback, it is possible to continue to advance unfinished distributed transactions through log playback after a transaction exception occurs, until the transaction commit or transaction rollback is completed, thereby avoiding pending transactions. Transaction exceptions are generally caused by an exception in the device where the transaction coordinator is located, or the device where the transaction participants are located, such as a device crash, power outage, network disconnection, restart, etc. After the device abnormality is recovered, the unfinished distributed transaction is continued to advance based on log playback until the transaction commit or transaction rollback is completed.
[0066] In the first phase, the pre-commit process of a distributed transaction may include:
[0067] S4_0, distributed transaction pre-committed.
[0068] S4_1, the transaction coordinator writes a pre-log to record the transaction-related information of the first phase.
[0069] In some embodiments, the write-ahead log can be persisted, and the transaction-related information of the first phase may include transaction status information, SQL statements, and operation data. The transaction status information may include the XID of the distributed transaction, the status of the distributed transaction, the XA_ID of each transaction branch, and the status of each transaction branch. The operation data may be one or more items, and the operation data may be distributed in one shard or multiple shards. The operation data may be identified by the table number and the primary key. The SQL statement is used to indicate what processing is to be performed on the operation data.
[0070] In some embodiments, the write-ahead log is stored in a data structure of key-value pairs. Figure 5 shows the organizational structure of the write-ahead log in a storage device. As can be seen from the organizational structure shown in Figure 5, the write-ahead log is stored in a tree diagram organizational structure. The tree diagram includes multiple root blocks and multiple leaf blocks, and each root block corresponds to a leaf block. The leaf block is used to store the write-ahead log and the execution result of the transaction (distributed transaction or transaction branch) recorded in the write-ahead log, wherein when the execution result is completed, it is used to indicate that the transaction recorded in the write-ahead log is successfully executed, and when the execution result is incomplete, it is used to indicate that the transaction recorded in the write-ahead log is not successfully executed and log replay is required, so as to facilitate the retry (continue execution or rollback) of the transaction that was not successfully executed based on the replayed write-ahead log. The root block is used to store information of the leaf block, for example, the value range of the key of the write-ahead log in the leaf block stored in the root block and the storage address of the corresponding leaf block.
[0071] S4_2: If the transaction coordinator fails to write the pre-log, the distributed transaction enters the rollback process.
[0072] S4_3: If the transaction coordinator successfully writes the pre-log, the transaction coordinator records each transaction participant as being in the CONN state (also called the connection state) and notifies each transaction participant to set its own state to the PREPARING state (also called the preparing state).
[0073] In some embodiments, in the first phase, by setting a checkpoint to determine whether the write-ahead log is successful, each transaction participant performs a pre-commit after the write-ahead log is successful. This prevents the inability to subsequently advance abnormal transaction branches to the COMMITTED or ROLLBACKED state based on log replay. An abnormal transaction branch may be one whose final state is not the COMMITTED or ROLLBACKED state.
[0074] S4_4, each transaction participant executes the "XA END" instruction and the "XA PREPARE" instruction.
[0075] S4_5: If the transaction participant successfully executes the "XA END" instruction and the "XA PREPARE" instruction, the transaction participant sets its own state to the PREPARED state (also called the prepared success state).
[0076] S4_6: If the transaction participant fails to execute the "XA END" instruction and / or the "XA PREPARE" instruction, the transaction participant rolls back and disconnects from the transaction coordinator.
[0077] In some embodiments, a checkpoint is set during the execution of the "XA END" and "XA PREPARE" instructions by a transaction participant, and a rollback is performed in advance for a transaction participant whose instruction execution fails. The transaction participant rolling back may refer to the transaction participant executing the "XA ROLLBACK" instruction.
[0078] In some embodiments, a transaction participant disconnecting from the transaction coordinator may disconnect a connection established over the network or an inter-process communication (IPC) mechanism, while maintaining the session connection between the transaction coordinator and the transaction participant. After disconnecting from the transaction coordinator, the transaction participant may release lock resources used by the transaction participant in processing the transaction branch.
[0079] S4_7, if the transaction participant rolls back successfully, the transaction participant sets its own state to ROLLBACKED state (also called rollback success state), and the transaction coordinator records the transaction participant disconnected from it as CONN_QUIT state (also called disconnected state).
[0080] S4_8, if the transaction participant fails to roll back, the transaction participant sets its own state to ROLLBACK_FAILED state (also called rollback failure state), and the transaction coordinator records the transaction participant disconnected from it as CONN_QUIT state.
[0081] In some embodiments, a checkpoint is set during the rollback process after a transaction participant fails to prepare, so that the rollback status of the transaction participant (whether the rollback is successful or failed) can be known in a timely manner.
[0082] S4_9 If the transaction coordinator receives feedback from all transaction participants that they are in the PREPARED state, the distributed transaction enters the PREPARED state.
[0083] S4_10: If the transaction coordinator does not receive feedback from all transaction participants that the transaction is in the PREPARED state, the distributed transaction enters the rollback process.
[0084] In some embodiments, by setting a checkpoint to detect whether the transaction coordinator has received feedback from all transaction participants that they are in the PREPARED state, it is possible to promptly learn whether the transaction participants have successfully pre-committed.
[0085] For example, if a transaction participant goes down or loses connection, the transaction coordinator will not be able to receive feedback from the transaction participant that it is in the PREPARED state. In other words, the transaction coordinator may not receive feedback from all transaction participants that they are in the PREPARED state.
[0086] After a distributed transaction enters the PREPARED state, the transaction coordinator can send notifications to transaction participants, prompting each transaction participant to commit the transaction branch. In the second phase, the distributed transaction commit process may include:
[0087] S4_11, the distributed transaction is committed.
[0088] S4_12, the transaction coordinator writes a pre-log to record the transaction-related information of the second phase.
[0089] In some embodiments, the write-ahead log may be persisted, and the transaction-related information of the second phase may also include transaction status information, SQL statements, and operation data.
[0090] S4_13: If the transaction coordinator fails to write the pre-log, the distributed transaction enters the rollback process.
[0091] S4_14: If the transaction coordinator successfully writes the pre-log, each transaction participant executes the "XA COMMIT" instruction.
[0092] In some embodiments, in the second phase, by setting a checkpoint to determine whether the write-ahead log is successful, each transaction participant commits the transaction after the write-ahead log is successful, thereby avoiding the inability to advance the abnormal transaction branch to the COMMITED state or ROLLBACKED state based on log replay.
[0093] S4_15: If the transaction participant successfully executes the "XA COMMIT" instruction, the transaction participant sets its own state to the COMMITED state (also known as the commit success state).
[0094] S4_16: If the transaction participant fails to execute the "XA COMMIT" instruction, the transaction participant sets its own state to COMMIT_FAILED state (also known as commit failure state).
[0095] In some embodiments, a checkpoint is set during the execution of an "XA COMMIT" instruction by a transaction participant, and a COMMIT_FAILED state is set for a transaction participant that fails to execute the instruction, so that it can be known in a timely manner whether all transaction participants are in the COMMITED state.
[0096] S4_17: If the transaction coordinator receives feedback from all transaction participants that the transaction is in the COMMITED state, the distributed transaction enters the COMMITED state.
[0097] S4_18: If the transaction coordinator does not receive feedback from all transaction participants that they are in the COMMITED state, the distributed transaction enters the COMMIT_FAILED state.
[0098] In some embodiments, by setting a checkpoint to detect whether the transaction coordinator has received feedback from all transaction participants that they are in the COMMITED state, it is possible to promptly learn whether the transaction participants have successfully committed.
[0099] S4_19: After the distributed transaction enters the COMMIT_FAILED state, the distributed transaction commit is retried, that is, the process jumps to step S4_10 and re-executes the distributed transaction commit.
[0100] S4_20: If the distributed transaction cannot be committed again, or if the distributed transaction still enters the COMMIT_FAILED state after being committed again, the transaction coordinator performs log replay.
[0101] In some embodiments, a checkpoint is set during a distributed transaction commit retry process to determine whether to perform log replay.
[0102] In some embodiments, for a distributed transaction that submits an exception, the distributed transaction submission operation is re-executed until the number of failures reaches a preset threshold, which can be set based on actual needs and is not limited by this application. When the number of failures reaches the preset threshold, the transaction coordinator performs log playback.
[0103] In some embodiments, performing log replay may refer to replaying the write-ahead log of the transaction branch with the exception, determining the cause of failure of the abnormal transaction branch (for example, determining which process node caused the transaction branch to be unable to enter the COMMITED state or the ROLLBACKED state based on the checkpoint set above), and re-starting from the determined process node until the final state of the abnormal transaction branch is the COMMITED state or the ROLLBACKED state.
[0104] As shown in Figure 6, the specific execution process of ending an XA transaction includes:
[0105] S6_0, each transaction participant executes the "XA END" instruction.
[0106] S6_1: If the transaction participant successfully executes the "XA END" instruction, the transaction participant sets its own state to ENDED state (end state).
[0107] S6_2: If the transaction participant fails to execute the "XA END" instruction, the transaction participant rolls back and disconnects from the transaction coordinator.
[0108] In some embodiments, a checkpoint is set during the execution of the "XA END" instruction by a transaction participant, and a rollback can be performed in advance for a transaction participant whose execution fails.
[0109] S6_3: If the transaction participant rolls back successfully, the transaction participant sets its own state to ROLLBACKED, and the transaction coordinator records the disconnected transaction participant as CONN_QUIT.
[0110] S6_4: If the transaction participant fails to roll back, the transaction participant sets its own state to ROLLBACK_FAILED, and the transaction coordinator records the disconnected transaction participant as CONN_QUIT.
[0111] 7 , a flowchart of rolling back a distributed transaction provided by an embodiment of the present application is exemplarily introduced.
[0112] S7_0, distributed transaction rolls back.
[0113] S7_1, each transaction participant executes the "XA ROLLBACK" instruction.
[0114] S7_2: If the transaction participant executes the "XA ROLLBACK" instruction successfully, the transaction participant sets its own status to ROLLBACKED.
[0115] S7_3: If a transaction participant fails to execute the "XA ROLLBACK" instruction, the transaction participant rolls back and disconnects from the transaction coordinator.
[0116] In some embodiments, a checkpoint is set during the process of a transaction participant executing an "XA ROLLBACK" instruction, and a transaction participant that fails in execution may attempt to roll back again.
[0117] S7_4: If the transaction participant rolls back successfully, the transaction participant sets its own state to ROLLBACKED, and the transaction coordinator records the disconnected transaction participant as CONN_QUIT.
[0118] S7_5: If the transaction participant fails to roll back, the transaction participant sets its own status to ROLLBACK_FAILED, and the transaction coordinator records the disconnected transaction participant as CONN_QUIT.
[0119] S7_6: If the transaction coordinator receives feedback from all transaction participants that the transaction is in the ROLLBACKED state, the distributed transaction enters the ROLLBACKED state.
[0120] S7_7: If the transaction coordinator does not receive feedback from all transaction participants that the transaction is in the ROLLBACKED state, the distributed transaction is rolled back and retried, that is, the process jumps to step S7_0 and re-executes the distributed transaction rollback.
[0121] S7_8: If the distributed transaction cannot be rolled back again, or after the distributed transaction is rolled back again, all transaction participants are still not in the ROLLBACKED state, the transaction coordinator disconnects the SESSION connection (also called session connection) with each transaction participant and writes the information of the transaction participants in the ROLLBACK_FAILED state into the log.
[0122] S7_9, the transaction coordinator replays the log.
[0123] In some embodiments, the transaction coordinator performs log playback to determine the cause of the failure of the abnormal transaction branch during the rollback process (for example, based on the checkpoint set above, determine which process node in the rollback process caused the rollback failure), and re-rolls from the determined process node until the final state of the abnormal transaction branch is ROLLBACKED.
[0124] Referring to FIG8 , a flowchart of the steps of a transaction processing method provided in one embodiment of the present application is shown. Depending on different requirements, the order of the steps in the flowchart may be changed, and some steps may be omitted. In this embodiment, the transaction processing method may include:
[0125] Step S81: In response to the received operation instruction, a distributed transaction is created for the operation instruction, where the distributed transaction includes multiple transaction branches.
[0126] In some embodiments, if the data processed by the operation instruction involves multiple sub-libraries or multiple sub-tables, indicating that there are multiple transaction participants, one sub-library or one sub-table can serve as a transaction participant, and by creating a distributed transaction for the operation instruction, consistency processing of the data located in multiple sub-libraries or multiple sub-tables can be achieved.
[0127] Step S82: Commit the distributed transaction based on the preset transaction commit mechanism, and generate a pre-written log of the distributed transaction. The commit of each transaction branch in the multiple transaction branches includes multiple process nodes. The preset transaction commit mechanism includes a checkpoint for detecting the execution status of the multiple process nodes and the transaction status of each transaction branch.
[0128] In some embodiments, taking the preset transaction commit mechanism as 2PC as an example, a first write-ahead log can be generated before each transaction branch is pre-committed, and the transaction-related information of the first phase in the two-phase commit protocol is recorded through the first write-ahead log; before each transaction branch is committed, a second write-ahead log is generated, and the transaction-related information of the second phase in the two-phase commit protocol is recorded through the second write-ahead log, so that when an abnormal transaction branch occurs, the abnormal transaction branch can be continued from the first phase or the second phase based on log playback.
[0129] In some embodiments, the transaction-related information of the first phase and the transaction-related information of the second phase may include transaction status information of the distributed transaction, transaction status information of the transaction branch, operation data, and SQL statements for processing the operation data.
[0130] In some embodiments, if the generation of the first write-ahead log or the second write-ahead log fails, indicating that the first phase or the second phase of the transaction cannot be recorded through the write-ahead log, each transaction branch can be directly controlled to be rolled back, avoiding the problem of being unable to continue advancing the abnormal transaction branch from the first phase or the second phase based on log playback.
[0131] In some embodiments, the submission of each transaction branch includes submitting a transaction process or rolling back a transaction process. Each of the transaction processes includes multiple process nodes, and each of the multiple process nodes is provided with a checkpoint. Thus, for an abnormal transaction branch, the transaction can be resubmitted or rolled back from a specified process node based on log playback. An abnormal transaction branch may refer to a transaction branch that is not in a preset transaction state. For example, if a transaction branch is not in the Rollbacked state or the Committed state, the transaction branch may be considered an abnormal transaction branch.
[0132] Step S83: If it is determined that the distributed transaction contains an abnormal transaction branch, the abnormal transaction branch is processed based on the pre-written log and the checkpoint. The abnormal transaction branch is caused by an abnormality in the device where the transaction coordinator is located, or an abnormality in the device where the transaction participant is located.
[0133] For example, an exception may occur on the device where the transaction coordinator is located at a certain time point, resulting in the inability of each transaction participant to receive instructions from the transaction coordinator, or some transaction participants may not have received instructions from the transaction coordinator in time, resulting in the inability to smoothly execute the transaction commit process or rollback process, which may in turn generate one or more abnormal transaction branches; or, due to an exception on the device where a transaction participant is located, the transaction participant may not receive instructions from the transaction coordinator, or may not smoothly execute the transaction commit process or rollback process after receiving instructions from the transaction coordinator, which may in turn generate an abnormal transaction branch. After the device abnormality is recovered, the pre-written log corresponding to the abnormal transaction branch is replayed to determine the process node for reprocessing the abnormal transaction branch, and the abnormal transaction branch is processed using the determined process node as the starting process node, so as to achieve transaction re-advancement of the abnormal transaction branch from the specified process node. For example, a transaction participant of an abnormal transaction branch may send a request to re-advance the transaction to the transaction coordinator, which will then replay the write-ahead log corresponding to the abnormal transaction branch, determine the process node for reprocessing the abnormal transaction branch, and notify the transaction participant (transaction participant of the abnormal transaction branch) to re-advance the transaction (commit or roll back the transaction) for the abnormal transaction branch using the determined process node as the starting process node.
[0134] As shown in FIG9 , a distributed middleware 30 is provided for an embodiment of the present application. The distributed middleware 30 may include a creation module 301 , a submission module 302 , and a processing module 303 .
[0135] The creation module 301 is configured to create a distributed transaction for the operation instruction in response to the received operation instruction, where the distributed transaction includes multiple transaction branches.
[0136] The commit module 302 is used to commit distributed transactions based on a preset transaction commit mechanism and generate a pre-written log for the distributed transactions. The commit of each transaction branch in the multiple transaction branches includes multiple process nodes. The preset transaction commit mechanism includes a checkpoint for detecting the execution status of the multiple process nodes and the transaction status of each transaction branch.
[0137] The processing module 303 is used to process the abnormal transaction branch based on the pre-written log and the checkpoint when it is determined that the distributed transaction contains an abnormal transaction branch. The abnormal transaction branch is caused by an abnormality in the device where the transaction coordinator of the distributed transaction is located, or an abnormality in the device where the transaction participant of the distributed transaction is located.
[0138] The creation module 301, submission module 302, and processing module 303 can all be implemented in software or hardware. For example, the implementation of the creation module 301 will be described below using the creation module 301 as an example. Similarly, the implementation of the submission module 302 and processing module 303 can refer to the implementation of the creation module 301.
[0139] As an example of a software functional unit, the creation module 301 may include code running on a computing instance. The computing instance may include at least one of a physical host (computing device), a virtual machine, and a container. Furthermore, the computing instance may be one or more. For example, the creation module 301 may include code running on multiple hosts / virtual machines / containers. It should be noted that the multiple hosts / virtual machines / containers used to run the code may be distributed in the same region or in different regions. Furthermore, the multiple hosts / virtual machines / containers used to run the code may be distributed in the same availability zone (AZ) or in different AZs, each AZ including one data center or multiple geographically close data centers. Typically, a region may include multiple AZs.
[0140] Similarly, multiple hosts / virtual machines / containers running the code can be distributed within the same virtual private cloud (VPC) or across multiple VPCs. Typically, a VPC is set up within a region. Cross-region communication between two VPCs within the same region, or between VPCs in different regions, requires a communication gateway within each VPC to interconnect the VPCs.
[0141] As an example of a hardware functional unit, creation module 301 may include at least one computing device, such as a server. Alternatively, creation module 301 may be implemented using an application-specific integrated circuit (ASIC) or a programmable logic device (PLD). The PLD may be a complex programmable logical device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof.
[0142] The multiple computing devices included in the creation module 301 can be distributed in the same region or in different regions. The multiple computing devices included in the creation module 301 can be distributed in the same AZ or in different AZs. Similarly, the multiple computing devices included in the creation module 301 can be distributed in the same VPC or in multiple VPCs. The multiple computing devices can be any combination of servers, ASICs, PLDs, CPLDs, FPGAs, GALs, and other computing devices.
[0143] It should be noted that, in other embodiments, the creation module 301 can be used to execute any step in the transaction processing method, the submission module 302 can be used to execute any step in the transaction processing method, and the processing module 303 can be used to execute any step in the transaction processing method. The steps that the creation module 301, the submission module 302 and the processing module 303 are responsible for implementing can be specified as needed. The full functions of the decision-making device 30 are realized by respectively implementing different steps in the transaction processing method through the creation module 301, the submission module 302 and the processing module 303.
[0144] As shown in Figure 10, a computing device 100 provided in an embodiment of the present application includes a bus 102, a processor 104, a memory 106, and a communication interface 108. Processor 104, memory 106, and communication interface 108 communicate with each other via bus 102. Computing device 100 can be a server or a terminal device. It should be understood that this application does not limit the number of processors and memories in computing device 100.
[0145] Bus 102 may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, among others. Buses may be classified as address buses, data buses, control buses, and the like. For ease of illustration, FIG10 illustrates a single bus line, but this does not imply a single bus or type of bus. Bus 104 may include a path for transmitting information between various components of computing device 100 (e.g., memory 106, processor 104, and communication interface 108).
[0146] The processor 104 may include any one or more processors such as a central processing unit (CPU), a graphics processing unit (GPU), a microprocessor (MP), or a digital signal processor (DSP).
[0147] The memory 106 may include volatile memory, such as random access memory (RAM). The processor 104 may also include non-volatile memory, such as read-only memory (ROM), flash memory, hard disk drive (HDD), or solid state drive (SSD).
[0148] Memory 106 stores executable program code. Processor 104 executes this executable program code to implement the functions of the aforementioned creation module 301, submission module 302, and processing module 303, thereby implementing the transaction processing method. In other words, memory 106 stores instructions for executing the transaction processing method. FIG10 illustrates an example in which processor 104 executes this executable program code to implement the functions of the aforementioned creation module 301, submission module 302, and processing module 303.
[0149] The communication interface 108 uses a transceiver module such as, but not limited to, a network interface card or a transceiver to implement communication between the computing device 100 and other devices or a communication network.
[0150] The present application also provides a computing device cluster 10. The computing device cluster 10 includes at least one computing device. The computing device can be a server for data storage or a local server in a local data center. In some embodiments, the computing device can also be a terminal device such as a desktop computer, laptop computer, or smartphone.
[0151] 11 , the computing device cluster 10 includes at least one computing device 100. The memory 106 in one or more computing devices 100 in the computing device cluster 10 may store the same instructions for executing the transaction processing method.
[0152] In some possible implementations, the memory 106 of one or more computing devices 100 in the computing device cluster 10 may also store partial instructions for executing the transaction processing method. In other words, the combination of one or more computing devices 100 can jointly execute the instructions for executing the transaction processing method.
[0153] It should be noted that the memory 106 in different computing devices 100 in the computing device cluster 10 may store different instructions, each for executing a portion of the functions of the data access device. In other words, the instructions stored in the memory 106 in different computing devices 100 may implement the functions of one or more of the creation module 301, submission module 302, and processing module 303.
[0154] In some possible implementations, one or more computing devices in the computing device cluster 10 can be connected via a network. The network can be a wide area network or a local area network, etc. Figure 11 shows a possible implementation. As shown in Figure 11, two computing devices 100A and 100B are connected via a network, taking the functions of one or more modules in the creation module 301, the submission module 302 and the processing module 303 as an example. Specifically, the network is connected via a communication interface in each computing device. In this type of possible implementation, the memory 106 in the computing device 100A stores instructions for executing the functions of the creation module 301 and the submission module 302. At the same time, the memory 106 in the computing device 100B stores instructions for executing the functions of the processing module 303.
[0155] The connection method between the computing device clusters 10 shown in Figure 11 can be considered to be that the transaction processing method provided in this application requires a large amount of data storage and reading, so the functions implemented by the processing module 303 are considered to be handed over to the computing device 100B for execution.
[0156] It should be understood that the functions of the computing device 100A shown in FIG11 may also be completed by multiple computing devices 100. Similarly, the functions of the computing device 100B may also be completed by multiple computing devices 100.
[0157] The present application also provides a computer program product comprising instructions. The computer program product may be software or a program product comprising instructions that can be run on a computing device or stored in any available medium. When the computer program product is run on at least one computing device, the at least one computing device executes a transaction processing method.
[0158] The present application also provides a computer-readable storage medium. The computer-readable storage medium can be any available medium that can be stored by a computing device or a data storage device such as a data center that contains one or more available media. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a magnetic tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive). The computer-readable storage medium includes instructions that instruct the computing device to execute the transaction processing method.
[0159] Through the description of the above implementation methods, technical personnel in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.
[0160] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are schematic. For example, the division of the modules or units is a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0161] The units described as separate components may or may not be physically separate, and the components shown as units may be one physical unit or multiple physical units, that is, they may be located in one place or distributed in multiple places. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0162] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.
[0163] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the software product is stored in a storage medium, including a number of instructions for enabling a device (which can be a single-chip microcomputer, chip, etc.) or a processor to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory, a random access memory, a magnetic disk or an optical disk.
[0164] The above description is only a specific implementation method of the present application, but the protection scope of the present application is not limited thereto. Any changes or replacements within the technical scope disclosed in the present application should be included in the protection scope of the present application.
Claims
1. A transaction processing method, It is characterized in that The method comprises: In response to the received operation instruction, create a distributed transaction for the operation instruction, wherein the distributed transaction includes multiple transaction branches; Submitting the distributed transaction based on a preset transaction submission mechanism, and generating a write-ahead log of the distributed transaction, wherein the submission of each of the multiple transaction branches includes multiple process nodes, and the preset transaction submission mechanism includes a checkpoint for detecting the execution status of the multiple process nodes and the transaction status of each transaction branch; If it is determined that the distributed transaction includes an abnormal transaction branch, the abnormal transaction branch is processed based on the write-ahead log and the checkpoint, and the abnormal transaction branch is caused by an abnormality in a device where a transaction coordinator of the distributed transaction is located, or an abnormality in a device where a transaction participant of the distributed transaction is located.
2. The transaction processing method according to claim 1, It is characterized in that The step of creating a distributed transaction for the operation instruction includes: If the data processed by the operation instruction involves multiple sub-databases or multiple sub-tables, a distributed transaction is created for the operation instruction.
3. The transaction processing method according to claim 1 or 2, It is characterized in that The preset transaction commit mechanism is a two-phase commit protocol, and the generating of the write-ahead log of the distributed transaction includes: Before each transaction branch is pre-committed, a first write-ahead log is generated, where the first write-ahead log is used to record transaction-related information of the first phase in the two-phase commit protocol; Before each transaction branch is committed, a second write-ahead log is generated, where the second write-ahead log is used to record transaction-related information of the second phase in the two-phase commit protocol; the transaction-related information of the first phase and the transaction-related information of the second phase both include transaction status information of the distributed transaction, transaction status information of the transaction branch, operation data, and a structured query language SQL statement for processing the operation data.
4. The transaction processing method according to claim 3, It is characterized in that The method further comprises: If the generation of the first write-ahead log or the second write-ahead log fails, each transaction branch is controlled to be rolled back.
5. The transaction processing method according to any one of claims 1 to 4, It is characterized in that The commit of each transaction branch includes committing a transaction process or rolling back a transaction process. The committing transaction process or the rolling back transaction process both include a plurality of process nodes, and each of the plurality of process nodes is provided with the checkpoint.
6. The transaction processing method according to claim 5, It is characterized in that After the distributed transaction is submitted based on the preset transaction submission mechanism, the method further includes: A transaction branch that is not in a preset transaction state is determined as the abnormal transaction branch, where the preset transaction state includes a Rollbacked state or a Committed state.
7. The transaction processing method according to claim 6, It is characterized in that The processing of the abnormal transaction branch based on the write-ahead log and the checkpoint includes: Replaying the write-ahead log corresponding to the abnormal transaction branch, and determining a process node for reprocessing the abnormal transaction branch; The abnormal transaction branch is processed using the determined process node as the starting process node.
8. A distributed middleware, It is characterized in that include: A creation module, configured to create a distributed transaction for the operation instruction in response to the received operation instruction, wherein the distributed transaction includes a plurality of transaction branches; A commit module, configured to commit the distributed transaction based on a preset transaction commit mechanism, and generate a write-ahead log of the distributed transaction, wherein the commit of each of the multiple transaction branches includes multiple process nodes, and the preset transaction commit mechanism includes a checkpoint for detecting the execution status of the multiple process nodes and the transaction status of each transaction branch; a processing module, configured to process the abnormal transaction branch based on the write-ahead log and the checkpoint when determining that the distributed transaction includes an abnormal transaction branch, wherein the abnormal transaction branch is processed by the distributed transaction The device where the transaction coordinator is located has an exception, or the device where the transaction participant of the distributed transaction is located has an exception.
9. A computing device cluster, It is characterized in that comprising at least one computing device, each computing device comprising a processor and a memory; The processor of the at least one computing device is configured to execute instructions stored in the memory of the at least one computing device, so that the computing device cluster executes the transaction processing method according to any one of claims 1 to 7.
10. A computer program product comprising instructions, It is characterized in that When the instruction is executed by a computing device cluster, the computing device cluster executes the transaction processing method according to any one of claims 1 to 7.
11. A computer-readable storage medium, It is characterized in that The method comprises computer program instructions. When the computer program instructions are executed by a computing device cluster, the computing device cluster performs the transaction processing method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Distributed transaction guarantee method for memory data grid
CN111651243A
Constant time database recovery
CN112470130A
Distributed transaction processing method and device based on independent transaction coordinator and medium
CN114528073A
Distributed transactions with redo-only write-ahead log
US20160342616A1
Cited By
TCC distributed transaction performance optimization method and device and medium
CN121524144A
