A transaction commit system, method and related apparatus
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- HUAWEI CLOUD COMPUTING TECHNOLOGIES CO LTD
- Filing Date
- 2019-11-30
- Publication Date
- 2026-08-07
AI Technical Summary
二阶段提交是基于分布式系统架构进行事务提交时而设计的一种方法,但是该方法中协调者与参与者以及分布式系统中的主副本之间需要进行多次交互,会导致事务提交的时延较长
Smart Images

Figure CN121009147B_ABST
Abstract
Description
[0001] This application is a divisional application. The original application has the application number 201980102354.8 and the original application date is November 30, 2019. The entire contents of the original application are incorporated herein by reference. Technical Field
[0002] This application relates to the field of computer technology, and in particular to a transaction submission system, method and related equipment. Background Technology
[0003] A transaction is a logical unit in the execution process of a database management system, consisting of a finite sequence of database operations. In distributed systems, to improve data reliability, redundancy needs to be established for data, such as storing multiple copies of data distributed across different nodes. When a transaction is executed across multiple participants, each participant can determine the result of its own transaction, but cannot know the results of other participants. To maintain the atomicity, consistency, isolation, and durability of transactions, a coordinator is needed to manage the participants executing the transaction. Two-phase commit is a method designed for transaction commit in distributed system architectures; however, this method requires multiple interactions between the coordinator, participants, and the primary replicas in the distributed system, leading to a longer transaction commit latency. Summary of the Invention
[0004] This invention provides a transaction commit system, method, and related equipment that can reduce the latency of transaction commits.
[0005] In a first aspect, this application provides a transaction processing system, including a coordination server and multiple storage servers, wherein...
[0006] The coordination server is configured to receive transactions, each transaction including at least one transaction data information, each transaction data information including the storage location information of a copy of the original data on a storage server and a write operator; determine transaction data distribution information based on pre-stored data distribution information, wherein the data distribution information indicates the storage server storing each copy of each original data in the transaction processing system, and the transaction data distribution information indicates the storage server storing each copy of the original data corresponding to each transaction data information included in the transaction; generate at least one write request, each write request including the transaction data distribution information and a transaction data information; and send each write request to the storage server where the copy of the original data corresponding to the transaction data information included in each write request is located.
[0007] The storage server that receives any write request stores the transaction data distribution information; operates on a copy of the original data corresponding to the transaction data information included in the write request; and sends the execution result of the write request to the coordination server.
[0008] The coordination server is further configured to determine the transaction processing result of the transaction based on the execution result of the write request sent by each storage server that received the write request, and send the transaction processing result to the business server.
[0009] The coordinating server generates one or more write requests based on the transaction data information received from the transaction. Then, according to the pre-stored data distribution information of the distributed system, it directly sends each write request to the storage server containing each replica of the original data corresponding to the transaction data information included in each write request. This avoids the process where the coordinating server first sends the write request to the storage server containing the primary replica of the original data corresponding to the transaction data information, and then the primary replica sends the write request to the corresponding backup replica, thus improving the efficiency of sending write requests to various storage servers. Furthermore, after receiving the write request, each storage server, after executing the received write request, feeds back the execution result to the coordinating server. Based on the execution results fed back by each storage server, the coordinating server can determine the transaction processing result and then return the transaction processing result to the business server, thereby achieving one-phase transaction commit, reducing the latency of write request processing, and improving the processing efficiency of write requests and the working efficiency of the business server.
[0010] In one possible implementation, the coordination server is configured to receive a read request, the read request including the storage location of a copy of the target data on the storage server and a read operator; determine the storage server storing the copy of the target data based on the data distribution information; and send the read request to the storage server storing the copy of the target data.
[0011] The storage server that receives the read request is configured to query the execution result of the write request from each storage server that received the write request, based on the transaction data distribution information; determine whether to perform a commit operation or a rollback operation based on the execution result of the write request sent by each storage server that received the write request; after performing the commit operation or the rollback operation, read the target data according to the storage location of the target data copy on the storage server; and send the read target data to the coordination server.
[0012] In one possible implementation, the storage server that receives the read request is further configured to generate operation information based on the execution result of the write request, the operation information indicating a commit operation or a rollback operation, and send the operation information to each storage server that received the write request.
[0013] Without sending commit or rollback commands to the storage server, if the coordinating server receives a read request, it can query the storage server storing each copy of the original data corresponding to each transaction data information included in the received write request, based on the transaction data identifier and transaction data distribution information in the received write request. The storage server then determines whether to commit or rollback the write request based on the query results, and finally executes the received read request. By using the storage server to determine whether to commit or rollback the transaction corresponding to the write request, the amount of data processed by the application server is reduced, thus improving the efficiency of the application server.
[0014] In one possible implementation, the storage location of the target data copy on the storage server overlaps with the storage location of the original data copy on the storage server, or the target data copy and the original data copy are stored in data blocks that need to maintain consistency.
[0015] In one possible implementation, the coordination server is configured to determine, based on the data distribution information, a plurality of storage servers storing copies of the target data; select a target storage server from the determined plurality of storage servers storing copies of the target data; and send the read request to the target storage server.
[0016] The target storage server can be the one closest to the coordinating server among multiple storage servers storing copies of the target data, or the one with the fastest access speed to the coordinating server among multiple storage servers storing copies of the target data, thereby improving the speed at which the business server reads the target data and increasing work efficiency.
[0017] In one possible implementation, the coordination server is further configured to determine operation information that each storage server receiving the write request needs to perform based on the execution result of the write request sent by each storage server that received the write request, the operation information indicating whether to perform a commit operation or a rollback operation, and to send the operation information to each storage server that received the write request.
[0018] In one possible implementation, the storage server that receives the write request is further configured to determine that it has not received the operation information sent by the coordination server within a preset time after sending the execution result of the operation to the coordination server, and according to the transaction data distribution information, query the storage server storing each copy of the original data corresponding to each transaction data information included in the transaction for the execution result of the write request; and according to the execution result, determine to execute the commit operation or the rollback operation.
[0019] If a storage server does not receive operation information from the coordinating server within a preset time after reporting the execution result to the coordinating server, the storage server determines that the coordinating server has failed. Based on the transaction data distribution information, the storage server queries other storage servers included in the transaction data distribution information for the execution results of their write requests. Then, based on the execution results of other storage servers, it determines whether to perform a commit or rollback operation. This prevents the storage server from being unable to release the system resources requested for the write request when it has not received a commit or rollback instruction from the coordinating server, which could lead to system blocking and the inability to execute new transactions, thus improving system reliability.
[0020] Secondly, this application provides a transaction processing method applied to a transaction processing system including a coordination server and multiple storage servers, the method comprising:
[0021] The coordination server receives transactions sent by the business server. Each transaction includes at least one transaction data information, and each transaction data information includes the storage location information of a copy of the original data on the storage server and a write operator.
[0022] The coordination server determines the transaction data distribution information based on the pre-stored data distribution information, wherein the data distribution information indicates the storage server that stores each copy of each original data in the transaction processing system, and the transaction data distribution information indicates the storage server that stores each copy of the original data corresponding to each transaction data information included in the transaction;
[0023] The coordination server generates at least one write request, each write request including the transaction data distribution information and a transaction data information;
[0024] The coordination server sends each write request to the storage server where the copy of the original data corresponding to the transaction data information included in each write request is located;
[0025] Upon receiving any write request, the storage server stores the transaction data distribution information, operates on a copy of the original data corresponding to the transaction data information included in the write request, and sends the execution result of the write request to the coordination server.
[0026] The coordination server determines the transaction processing result of the transaction based on the execution result of the write request sent by each storage server that received the write request, and sends the transaction processing result to the business server.
[0027] In one possible implementation, the coordination server receives a read request sent by the business server, the read request including the storage location of a copy of the target data on the storage server and a read operator;
[0028] The coordination server determines the storage server storing the copy of the target data based on the data distribution information, and sends the read request to the storage server storing the copy of the target data.
[0029] The storage server that receives the read request queries the execution result of the write request from each storage server that received the write request, based on the transaction data distribution information; and determines whether to perform a commit operation or a rollback operation based on the execution result of the write request sent by each storage server that received the write request.
[0030] Upon receiving the read request, the storage server reads the target data from its storage location on the storage server based on a copy of the target data, and then sends the read target data to the coordination server.
[0031] In one possible implementation, the storage server that receives the read request generates operation information based on the execution result of the write request, and sends the operation information to each storage server that received the write request, wherein the operation information indicates a commit operation or a rollback operation.
[0032] In one possible implementation, the storage location of the target data copy on the storage server overlaps with the storage location of the original data copy on the storage server, or the target data copy and the original data copy are stored in data blocks that need to maintain consistency.
[0033] In one possible implementation, the coordination server determines, based on the data distribution information, a storage server storing a copy of the target data, and sends the read request to the storage server storing the copy of the target data, including:
[0034] The coordination server determines multiple storage servers that store copies of the target data based on the data distribution information.
[0035] The coordination server selects a target storage server from the determined plurality of storage servers storing copies of the target data, and sends the read request to the target storage server.
[0036] In one possible implementation, the method further includes: the coordination server determining operation information that each storage server receiving the write request needs to perform based on the execution result of the write request sent by each storage server that received the write request, wherein the operation information indicates whether to perform a commit operation or a rollback operation.
[0037] The coordination server sends the operation information to each storage server that receives the write request.
[0038] In one possible implementation, the method further includes:
[0039] If the storage server that received the write request does not receive the operation information from the coordination server within a preset time after determining that it has sent the execution result of the operation to the coordination server, it queries the storage server that stores each copy of the original data corresponding to each transaction data information included in the transaction for the execution result of the write request according to the transaction data distribution information.
[0040] The storage server that receives the write request determines whether to perform the commit operation or the rollback operation based on the execution result.
[0041] Thirdly, this application provides a transaction processing method applied to a coordination server in a transaction processing system including a coordination server and multiple storage servers, the method comprising:
[0042] The coordination server receives transactions sent by the business server. The transactions include at least one transaction data information, and each transaction data information includes the storage location information of a copy of the original data on the storage server and a write operator.
[0043] The coordination server determines the transaction data distribution information based on the pre-stored data distribution information, wherein the data distribution information indicates the storage server that stores each copy of each original data in the transaction processing system, and the transaction data distribution information indicates the storage server that stores each copy of the original data corresponding to each transaction data information included in the transaction;
[0044] The coordination server generates at least one write request, each write request including the transaction data distribution information and a transaction data information;
[0045] The coordination server sends each write request to the storage server where the copy of the original data corresponding to the transaction data information included in each write request is located;
[0046] The coordination server receives the execution result of the write request from each storage server that received the write request;
[0047] The coordination server determines the transaction processing result of the transaction based on the execution result of the write request sent by each storage server that received the write request, and sends the transaction processing result to the business server.
[0048] In one possible implementation, the method further includes: the coordination server determining operation information that each storage server receiving the write request needs to perform based on the execution result of the write request sent by each storage server that received the write request, wherein the operation information indicates whether to perform a commit operation or a rollback operation.
[0049] The coordination server sends the operation information to each storage server that receives the write request.
[0050] Fourthly, this application provides a transaction processing method applied to a storage server in a transaction processing system including a coordination server and multiple storage servers, the method comprising:
[0051] The storage server receives a write request sent by the coordination server. The write request includes transaction data distribution information and a transaction data information. The write request is one of at least one write requests generated by the coordination server based on the received transaction. The storage server is one of a plurality of storage servers where a copy of the original data corresponding to the transaction data information included in the at least one write request is located. The transaction includes at least one transaction data information. Each transaction data information includes the storage location information of a copy of the original data on the storage server and a write operator. The transaction data distribution information indicates the storage server storing each copy of the original data corresponding to each transaction data information included in the transaction.
[0052] The storage server operates on a copy of the original data corresponding to the transaction data information included in the write request based on the transaction data information, and sends the execution result of the write request to the coordination server;
[0053] The storage server receives a read request sent by the coordination server, the read request including the storage location of a copy of the target data on the storage server and a read operator;
[0054] The storage server queries the storage server storing each copy of the original data corresponding to each transaction data information included in the transaction for the execution result of the at least one write request based on the transaction data distribution information.
[0055] The storage server performs a commit operation or a rollback operation based on the execution result of the at least one write request obtained from the query.
[0056] In one possible implementation, the method further includes: the storage server generating operation information based on the execution result of the at least one write request obtained from the query, the operation information indicating a commit operation or a rollback operation;
[0057] The storage server sends the operation information to each storage server that stores a copy of the original data corresponding to each transaction data information included in the transaction.
[0058] In one possible implementation, the storage location of the target data copy on the storage server overlaps with the storage location of the original data copy on the storage server, or the target data copy and the original data copy are stored in data blocks that need to maintain consistency.
[0059] Fifthly, this application provides a transaction processing method applied to a storage server in a transaction processing system including a coordination server and multiple storage servers, the method comprising:
[0060] The storage server receives a write request sent by the coordination server. The write request includes transaction data distribution information and a transaction data information. The write request is one of at least one write requests generated by the coordination server based on the received transaction. The storage server is one of a plurality of storage servers where a copy of the original data corresponding to the transaction data information included in the at least one write request is located. The transaction includes at least one transaction data information. Each transaction data information includes the storage location information of a copy of the original data on the storage server and a write operator. The transaction data distribution information indicates the storage server storing each copy of the original data corresponding to each transaction data information included in the transaction.
[0061] The server operates on a copy of the original data corresponding to the transaction data information included in the write request based on the transaction data information, and sends the execution result of the write request to the coordinating server;
[0062] If the storage server does not receive operation information from the coordination server within a preset time after determining that it has sent the execution result of the write request to the coordination server, it queries the storage server storing each copy of the original data corresponding to each transaction data information included in the transaction for the execution result of the at least one write request according to the transaction data distribution information.
[0063] The storage server performs a commit operation or a rollback operation based on the execution result of the at least one write request obtained from the query.
[0064] Sixthly, this application provides a coordination device, the coordination device comprising:
[0065] A communication unit is used to receive transactions sent by a business server. The transaction includes at least one transaction data information, and each transaction data information includes the storage location information of a copy of the original data on the storage server and a write operator.
[0066] The processing unit is configured to determine transaction data distribution information based on pre-stored data distribution information, wherein the data distribution information indicates the storage server in the transaction processing system that stores each copy of each original data, and the transaction data distribution information indicates the storage server that stores each copy of the original data corresponding to each transaction data information included in the transaction;
[0067] Generate at least one write request, each write request including the transaction data distribution information and a transaction data information;
[0068] The communication unit is also used to send each write request to the storage server where the copy of the original data corresponding to the transaction data information included in each write request is located;
[0069] Receive the execution result of the write request sent by each storage server that received the write request;
[0070] The processing unit is further configured to determine the transaction processing result of the transaction based on the execution result of the write request sent by each storage server that received the write request;
[0071] The communication unit is also used to send the transaction processing result to the business server.
[0072] In one possible implementation, the processing unit is specifically used to determine the operation information that each storage server receiving the write request needs to perform based on the execution result of the write request sent by each storage server that received the write request, wherein the operation information indicates whether to perform a commit operation or a rollback operation.
[0073] The communication unit is also used to send the operation information to each storage server that receives the write request.
[0074] In a seventh aspect, this application provides a storage device, the device comprising:
[0075] A communication unit is configured to receive a write request sent by a coordination server. The write request includes transaction data distribution information and a transaction data information. The write request is one of at least one write requests generated by the coordination server based on a received transaction. The storage server is one of a plurality of storage servers where a copy of the original data corresponding to the transaction data information included in the at least one write request is located. The transaction includes at least one transaction data information. Each transaction data information includes the storage location information of a copy of the original data on the storage server and a write operator. The transaction data distribution information indicates the storage server storing each copy of the original data corresponding to each transaction data information included in the transaction.
[0076] The processing unit operates on a copy of the original data corresponding to the transaction data information included in the write request, based on the transaction data information.
[0077] The communication unit is also configured to send the execution result of the write request to the coordination server; and receive a read request sent by the coordination server, wherein the read request includes the storage location of the copy of the target data on the storage server and the read operator;
[0078] The processing unit is further configured to query the execution result of the at least one write request from the storage server storing each copy of the original data corresponding to each transaction data information included in the transaction, based on the transaction data distribution information;
[0079] Based on the execution result of the at least one write request obtained from the query, perform a commit operation or a rollback operation.
[0080] In one possible implementation, the processing unit is further configured to generate operation information based on the execution result of the at least one write request obtained from the query, the operation information indicating a commit operation or a rollback operation;
[0081] The communication unit is further configured to send the operation information to a storage server that stores a copy of the original data corresponding to each transaction data information included in the transaction.
[0082] In one possible implementation, the storage location of the target data copy on the storage server overlaps with the storage location of the original data copy on the storage server, or the target data copy and the original data copy are stored in data blocks that need to maintain consistency.
[0083] Eighthly, this application provides a storage device, the device comprising:
[0084] A communication unit is configured to receive a write request sent by a coordination server. The write request includes transaction data distribution information and a transaction data information. The write request is one of at least one write requests generated by the coordination server based on a received transaction. The storage server is one of a plurality of storage servers where a copy of the original data corresponding to the transaction data information included in the at least one write request is located. The transaction includes at least one transaction data information. Each transaction data information includes the storage location information of a copy of the original data on the storage server and a write operator. The transaction data distribution information indicates the storage server storing each copy of the original data corresponding to each transaction data information included in the transaction.
[0085] The processing unit is configured to operate on a copy of the original data corresponding to the transaction data information included in the write request, based on the transaction data information.
[0086] The communication unit is also used to send the execution result of the write request to the coordination server;
[0087] The processing unit is further configured to determine that if no operation information is received from the coordination server within a preset time after the execution result of the write request is sent to the coordination server, and according to the transaction data distribution information, query the storage server storing each copy of the original data corresponding to each transaction data information included in the transaction for the execution result of the at least one write request.
[0088] Based on the execution result of the at least one write request obtained from the query, perform a commit operation or a rollback operation.
[0089] Ninthly, this application provides a coordination server, including a processor and a memory; the memory is used to store instructions, and the processor is used to execute the instructions, wherein when the processor executes the instructions, the processor performs the method provided by the third aspect or any possible implementation thereof.
[0090] In a tenth aspect, this application provides a storage server, including a processor and a memory; the memory is used to store instructions, and the processor is used to execute the instructions, wherein when the processor executes the instructions, the processor performs the method provided in the fourth aspect or any possible implementation of the fourth aspect.
[0091] In one aspect, this application provides a storage server, including a processor and a memory; the memory is used to store instructions, and the processor is used to execute the instructions. When the processor executes the instructions, the processor performs the method provided in the fifth aspect or any possible implementation of the fifth aspect.
[0092] In a twelfth aspect, this application provides a non-transient computer-readable storage medium storing a computer program that, when executed by a coordination server, implements the method provided by the third aspect or any possible implementation of the third aspect.
[0093] In a thirteenth aspect, this application provides a non-transient computer-readable storage medium storing a computer program that, when executed by a storage server, implements the method provided in the fourth aspect or any possible implementation of the fourth aspect.
[0094] In a fourteenth aspect, this application provides a non-transient computer-readable storage medium storing a computer program that, when executed by a storage server, implements the method provided in the fifth aspect or any possible implementation of the fifth aspect. Attached Figure Description
[0095] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below.
[0096] Figure 1 This is a schematic diagram of a distributed system architecture provided in an embodiment of this application;
[0097] Figure 2 This is an interactive diagram illustrating a two-stage submission provided in an embodiment of this application;
[0098] Figure 3 This is a schematic diagram illustrating the execution of a commit or rollback operation provided in an embodiment of this application;
[0099] Figure 4 This is another interactive diagram of two-stage submission provided in an embodiment of this application;
[0100] Figure 5 This is an interactive diagram illustrating a transaction commit provided in an embodiment of this application;
[0101] Figure 6 This is an interactive diagram illustrating the execution of a read request, provided in an embodiment of this application.
[0102] Figure 7 This is another interactive diagram of transaction commit provided in an embodiment of this application;
[0103] Figure 8 This is a schematic diagram of the structure of a coordination device provided in an embodiment of this application;
[0104] Figure 9 This is a schematic diagram of the structure of a storage device provided in an embodiment of this application;
[0105] Figure 10 This is a schematic diagram of another storage device provided in an embodiment of this application;
[0106] Figure 11 This is a schematic diagram of the structure of a coordination server provided in an embodiment of this application;
[0107] Figure 12 This is a schematic diagram of the structure of a storage server provided in an embodiment of this application;
[0108] Figure 13 This is a schematic diagram of another storage server provided in an embodiment of this application. Detailed Implementation
[0109] The terms "first" and "second" used in the embodiments of this application are for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Therefore, a feature defined with "first" and "second" may explicitly or implicitly include one or more of that feature.
[0110] First, some concepts involved in the embodiments of this application will be introduced.
[0111] A transaction is a logical unit in the execution process of a database management system, consisting of a finite sequence of database operations. To ensure data correctness and reliability, transactions must possess four properties: atomicity, consistency, isolation, and durability. Atomicity means that all operations within a transaction either complete entirely or not at all; it cannot end prematurely. If an error occurs during transaction execution, it will be rolled back to the state before the transaction began. Consistency means that the integrity of the database is not compromised before and after a transaction. Isolation means that the database allows multiple concurrent transactions to read, write, and modify data simultaneously, preventing data inconsistency caused by overlapping execution. Durability means that once a transaction is completed, the data modifications are permanent and will not be lost even in the event of a system failure.
[0112] Participants act as executors during transaction execution, receiving transaction requests from the coordinator and performing specified operations on the data specified in the transaction requests. A transaction includes requests for one or more pieces of data, which can be read or write requests. In distributed systems, data is stored on different storage servers. Since each storage server may fail, redundancy is necessary to improve data reliability, such as by creating replicas or erasure coding verification, thus enhancing system fault tolerance. This embodiment uses replication as an example of redundancy, but other redundancy relationships are equally applicable. During transaction execution, multiple replicas storing the same target data are referred to as a participant. The target data is one or more pieces of data requested for operation in the transaction request. One of the replicas is the primary replica, and the rest are backup replicas. It can be understood that, with sufficient server resources, multiple replicas of the same data distributed across different storage servers correspond to one or more storage servers. This embodiment uses multiple replicas of the same data distributed across different storage servers as an example.
[0113] The coordinator plays a coordinating role during transaction execution. In a distributed system, when a transaction is executed across multiple participants (i.e., a transaction includes transaction requests executed by multiple participants), each participant can determine the result of its own transaction request, but cannot know the results of other participants' transaction requests. To maintain these transactional characteristics, a coordinator is introduced to manage the results of the transaction requests and instruct the storage server whether to commit the results, such as replacing the original data with the updated data.
[0114] For example, a distributed system includes one or more business servers, one or more coordination servers (coordinators), and multiple storage servers. Figure 1 Taking a distributed system as an example, consisting of a business server, a coordination server, and multiple storage servers, the coordinator receives transaction requests from the business server and forwards them to one or more participants for execution. Each participant includes multiple replicas, and each storage server includes multiple logical storage nodes. Multiple replicas of the same data are stored on logical storage nodes of different storage servers. Each storage server includes multiple logical storage nodes, and each logical storage node can be a chunk within the storage server. For example, if the above... Figure 1Storage server P1 includes logical storage nodes P11, P12, and P13; storage server P2 includes logical storage nodes P21, P22, and P23; and storage server P3 includes logical storage nodes P31, P32, and P33. If logical storage nodes P11, P21, and P31 each contain three copies of the same data, logical storage nodes P12, P22, and P32 each contain three copies of the same data, and logical storage nodes P13, P23, and P33 each contain three copies of the same data, then logical storage nodes P11, P21, and P31 are logically one participant; P12, P22, and P32 are logically one participant; and P13, P23, and P33 are logically one participant. Among the multiple copies, one is the primary copy, and the rest are backup copies. For example, P11 is the primary copy for its respective participant, and P12 and P13 are backup copies for their respective participants.
[0115] Two-phase commit is a method designed for transaction commits in distributed system architectures. It consists of a prepare phase and a commit phase. Specifically, for example... Figure 2 As shown, taking a write request as an example of a transaction sent by the business server, the prepare phase includes:
[0116] a. After receiving a transaction from the business server, the coordinator forwards one or more write requests included in the transaction to the participant where the original data requested in each write request is located. Figure 2 Taking participant 1 receiving the first write request, participant 2 receiving the second write request, and participant n receiving the nth write request as an example.
[0117] b. After receiving a write request, each participant executes its own. The participant executes the write request on the original data to obtain the target data, but does not replace the original data with the target data; it only temporarily stores the target data.
[0118] c. The participant sends the operation result to the coordinator. If the participant can successfully obtain the target data based on the original data requested in the write request in step b, the participant sends the operation result as successful to the coordinator. If the participant cannot successfully obtain the target data based on the original data requested in the write request in step b, the participant sends the operation result as failed to the coordinator. Figure 2 Taking the example of participant 1 generating the first operation result based on the execution status of the first write request, participant 2 generating the second operation result based on the execution status of the second write request, and participant n generating the nth operation result based on the execution status of the nth write request.
[0119] The commit phase includes:
[0120] d. The coordinator determines the execution result of the write request based on the operation results sent by each participant and sends a commit or rollback command to each participant. Specifically, if all participants' operation results are successful, the coordinator determines the write request execution result as successful and sends a commit command to each participant. If at least one participant's operation result is a failure, the coordinator determines the write request execution result as failed and sends a rollback command to each participant. Figure 2 The example given is the commit command, which is the result of a write request.
[0121] e. Each participant executes the received commit or rollback command. When the coordinator sends a commit command, each participant performs a commit operation, replacing the original data with the target data; when the coordinator sends a rollback command, each participant performs a rollback operation, deleting the temporarily stored target data. For example... Figure 3 As shown, the target data obtained after performing a write operation on the original data A is B. Before receiving the commit or rollback command, the target data B is temporarily stored. If the participant performs a commit operation according to the commit command, A is replaced by B. If the participant performs a rollback operation according to the rollback command, the temporarily stored target data B is deleted.
[0122] f. Each participant sends a confirmation message to the coordinator, indicating that the commit operation or rollback operation is complete. Figure 2 Taking participant 1 generating the first confirmation message, participant 2 generating the second confirmation message, and participant n generating the nth confirmation message as an example.
[0123] After receiving confirmation messages from each participant, the coordinator returns the transaction execution result to the business server.
[0124] The above describes the interaction process between the coordinator and participants in a two-phase commit. In a distributed system, a participant includes one or more replicas of the same data, and the logical storage nodes of each replica are distributed across different storage servers. Therefore, in the preparation phase, after a participant receives a write request from the coordinator, there is an interaction relationship between the multiple replicas within that participant. Specifically, the coordinating server sends the write requests corresponding to each participant to the logical storage node where the primary replica resides. The storage server where the primary replica resides forwards the write request to the storage server where the backup replica resides. Then, the multiple logical storage nodes that receive the write request execute the operation in the write request and send the operation results from the storage servers where the backup replica resides to the coordinating server through the storage server where the primary replica resides. In the commit phase, the coordinating server determines whether the write request was executed successfully based on the received operation results from each participant and sends a commit or rollback command to the primary replica. The primary replica then forwards the received command to the corresponding backup replica. It should be noted that the interaction between logical storage nodes and the interaction between logical storage nodes and the coordinator are all conducted through the storage servers where each logical storage node resides.
[0125] For example, taking a distributed system with three replicas of data as an example, the write request above needs to modify two original data. The first original data is distributed in logical storage nodes P11, P21, and P31, which are located in storage servers P1, P2, and P3 respectively. The second original data is distributed in logical storage nodes P33, P43, and P53, which are located in storage servers P3, P4, and P5 respectively. That is, P11, P21, and P31 are one participant, and P33, P43, and P53 are another participant. Furthermore, P11 and P43 store the primary replicas. Then, as follows... Figure 4 As shown, the interaction process between logical storage nodes in the distributed system during the two-phase commit process is as follows:
[0126] The prepare phase includes:
[0127] a. The coordinating server first sends the first write request to the logical storage node P11 where the primary replica of the first original data is stored, and sends the second write request to the logical storage node P43 where the primary replica of the second original data is stored. The first write request and the second write request are included in the transaction received by the coordinating server. The first write request indicates that the first original data is modified, and the second write request indicates that the second original data is modified.
[0128] b. P11 sends the first write request it receives to P21 and P31 of the storage backup replica, and P43 sends the second write request it receives to P33 and P53 of the storage backup replica.
[0129] c. P11, P21, and P31 execute the corresponding operations in the first write request, and P33, P43, and P53 execute the corresponding operations in the second write request. P21 and P31 send the operation results of the first write request to the storage server P11, and P33 and P53 send the operation results of the second write request to P43. The operation results indicate whether the write request operation was successful or failed.
[0130] P11 determines the execution result of the first write request based on the operation results of P11, P21, and P31. P43 determines the execution result of the second write request based on the operation results of P33, P43, and P53. Then, P11 and P43 send the execution results of the first and second write requests to the coordinating server, respectively. Specifically, if the operation results of P11, P21, and P31 are all successful, P11 determines the execution result of the first write request as successful. If the operation results of any one or more of P11, P21, and P31 are unsuccessful, P11 determines the execution result of the first write request as unsuccessful. P43 determines the execution result of the second write request in a similar manner.
[0131] The commit phase includes:
[0132] d. Based on the execution results of the first and second write requests reported by P11 and P43, the coordinating server sends a commit command or a rollback command to P11 and P43. Figure 4 The example given is the commit command, which is the result of a write request.
[0133] e. P11 sends the received commit or rollback command to P21 and P31, and P43 sends the received commit or rollback command to P33 and P53. Figure 4 Take the commit command as an example.
[0134] f. P11, P21, P31, P33, P43, and P53 execute the received commit or rollback command. When a commit command is received, each logical storage node performs a commit operation, replacing the original data with the updated target data. When a rollback command is received, each logical storage node performs a rollback operation. Then, P21 and P31 send a first confirmation message (commit or rollback completed) to P11, and P33 and P53 send a second confirmation message (commit or rollback completed) to P43.
[0135] During the execution of the above transactions, the coordinator and participants need to interact twice, and the primary and backup replicas within the same participant also need to interact twice. This results in a relatively long transaction commit delay. Furthermore, if the coordinating server fails during transaction execution, causing the storage server to fail to release resources requested during the transaction, the system will be in a blocked state. Other blocked transactions will wait until the resources requested by the original transaction are released.
[0136] This application provides a transaction commit method, applicable to, for example... Figure 1 In the distributed system shown, the business server sends a transaction to the coordination server. The coordination server, based on the data distribution information of the distributed system and the transaction data information within the transaction, sends one or more write requests included in the transaction to the corresponding storage servers for execution. Each storage server executes the corresponding operation based on the received write request and sends its execution result back to the coordination server. The coordination server determines the transaction processing result based on the execution results of each storage server and returns the transaction processing result to the business server. The transaction commit method provided in this application will be described in detail below with reference to the accompanying drawings, focusing on both write and read requests. Figure 5 As shown, when the transaction request is a write request, the transaction commit method includes:
[0137] S301, The business server sends a transaction to the coordination server.
[0138] In this embodiment of the application, the above-mentioned transaction includes one or more transaction data information and one or more transaction data identifiers, wherein each transaction data information corresponds to a transaction data identifier, each transaction data information indicates an operation on one or more original data in the distributed database, each transaction data information includes the storage location information of the original data and an operator, the storage location information includes an address or a data identifier, and the operator indicates a write operation to the original data.
[0139] The coordination server stores data distribution information for the distributed system. This information records the logical storage node where each piece of data resides and the storage server to which that logical storage node belongs. Based on the original data's storage location information and the data distribution information, the coordination server can determine the logical storage node and the storage server to which the original data belongs within the distributed database.
[0140] S302. The coordination server generates one or more write requests based on the transactions sent by the business server, and sends each write request to the corresponding storage server.
[0141] After receiving a transaction, the coordination server queries the data distribution information based on the storage location information of the original data in each transaction's data information. This query result includes the logical storage node where each copy of the original data indicating the write operation is located, and the storage server where each logical storage node is located. Each copy of the original data corresponds to one logical storage node. Based on each transaction's data information and the data distribution information, the coordination server determines the query results for all transaction data information within the transaction. It then merges these results to obtain the transaction data distribution information, which indicates the storage server where each copy of the original data corresponding to the storage location information in each transaction's data information resides.
[0142] After determining the aforementioned transaction data distribution information, the coordination server generates multiple write requests based on the transaction data information, transaction data identifier, and transaction data distribution information within the transaction. Each write request includes a set of transaction data information, a transaction data identifier, and the aforementioned transaction data distribution information. Each write request is then sent to the storage server containing each replica of the original data corresponding to the transaction data information included in each write request.
[0143] For example, taking a transaction that includes three transaction data messages, each indicating a write operation on one piece of original data as an example, the first transaction data message indicates that the data in the second field of the record in page1 is incremented by 1; the second transaction data message indicates that the data in the fifth field of the record in page2 is incremented by 1; and the third transaction data message indicates that the data in the third field of the record in page3 is decremented by 1. That is, the transaction indicates that three pieces of original data are written.
[0144] Based on the aforementioned data distribution information, the coordination server determines that page1 is located in logical storage node 11 of storage server 1, logical storage node 21 of storage server 2, and logical storage node 31 of storage server 3; page2 is located in logical storage node 12 of storage server 1, logical storage node 22 of storage server 2, and logical storage node 42 of storage server 4; and page3 is located in logical storage node 13 of storage server 1, logical storage node 33 of storage server 3, and logical storage node 43 of storage server 4. The three transaction data identifiers corresponding to these three transaction data information are block1, block2, and block3, respectively. Based on the determined logical storage nodes and storage servers corresponding to each of the three transaction data information, the coordination server determines the transaction data distribution information corresponding to the transaction, as shown in Table 1 below.
[0145] Table 1
[0146]
[0147] After determining the logical storage node and storage server corresponding to each of the aforementioned transaction data information, the coordinating server generates three write requests based on the three transaction data information, three transaction data identifiers, and the aforementioned transaction data distribution information. The first write request includes the aforementioned first transaction data information, three transaction data identifiers, and transaction data distribution information; that is, the first write request instructs the server to increment the data in the second field of the record in page1 by 1. The second write request includes the aforementioned second transaction data information, three transaction data identifiers, and transaction data distribution information; that is, the second write request instructs the server to increment the data in the fifth field of the record in page2 by 1. The third write request includes the aforementioned third transaction data information, three transaction data identifiers, and transaction data distribution information; that is, the third write request instructs the server to decrement the data in the third field of the record in page3 by 1. The coordinating server then sends the first write request to storage servers 1, 2, and 3; the second write request to storage servers 1, 2, and 4; and the third write request to storage servers 1, 3, and 4.
[0148] The coordinating server generates one or more write requests based on the transaction data information in the received transaction. Then, based on the pre-stored data distribution information of the distributed system, it directly sends each write request to the storage server where each replica of the original data corresponding to the transaction data information included in each write request is located. This avoids the process where the coordinating server first sends the write request to the storage server where the primary replica of the original data corresponding to the transaction data information is located, and then the primary replica sends the write request to the corresponding backup replica, thus improving the efficiency of sending write requests to various storage service servers.
[0149] S303. The storage server executes the corresponding write operation based on the received write request.
[0150] After receiving a write request from the coordinating server, each storage server performs a corresponding write operation on the original data specified in the transaction data information within the write request. For example, storage servers 1, 2, 3, and 4, upon receiving the write request, perform corresponding write operations on the original data of the specified fields in the transaction data information according to the specific operation indicated in their respective write requests. For instance, when storage server 1 receives the first, second, and third write requests, logical storage node 11 increments the data in the second field of page 1 by 1, logical storage node 12 increments the data in the fifth field of page 2 by 1, and logical storage node 13 decrements the data in the third field of page 3 by 1. Similarly, when storage server 2 receives the first and second write requests, logical storage node 21 increments the data in the second field of page 1 by 1, and logical storage node 22 increments the data in the fifth field of page 2 by 1. Each storage server temporarily stores the target data obtained after performing write operations on the original data, but does not replace the original data with the target data.
[0151] S304. The storage server sends the execution result of the write request to the coordination server.
[0152] After receiving a write request, the storage server performs the corresponding write operation on the data in the specified field of the write request and sends the execution result to the coordinating server. Each write request corresponds to an execution result, which indicates whether the storage server executed the write request successfully or failed. Success means that the storage server performed the write operation on the original data specified in the write request and obtained the target data, while failure means that the storage server could not perform the write operation on the original data specified in the write request and obtain the target data.
[0153] If the storage server successfully executes the write operation on the specified data in the received write request, it sends the successful execution result of the write request to the coordination server. If the storage server fails to execute the write operation on the specified data in the received write request, it sends the failed execution result of the write request to the coordination server. For example, if the coordination server sends a first write request, a second write request, and a third write request to storage server 1, then storage server 1 needs to return three execution results corresponding to the three write requests to the coordination server. For instance, if logical storage node 11 in storage server 1 can successfully execute the write operation on the data in page 1 (i.e., storage server 1 can successfully execute the first write request), then storage server 1 will send the successful execution result of the first write request to the coordination server. If logical storage node 12 in storage server 1 cannot successfully execute the write operation on the data in page 2 (i.e., storage server 1 cannot successfully execute the second write request), then storage server 1 will send the failed execution result of the second write request to the coordination server.
[0154] S305. The coordinating server determines the transaction processing result based on the execution result sent by the storage server, and sends the transaction processing result to the business server.
[0155] After receiving the execution results of each write request from each storage server, the coordination server determines the transaction processing result based on these results and sends it to the business server. Specifically, if the coordination server receives successful execution results from all storage servers for the received write requests, it determines the transaction processing result as successful and sends a successful transaction message to the business server. If the coordination server receives one or more execution results indicating failure, it determines the transaction processing result as failed and sends a failed transaction message to the business server. For example, if storage servers 1, 2, and 4 all send successful execution results, but logical storage node 33 in storage server 3 fails to decrement the data in page 3 (i.e., storage server 3's third write request fails), the coordination server will receive a failed execution result from storage server 3, determine the transaction processing result of the write request as failed, and send a failed transaction message to the business server.
[0156] After receiving a write request, each storage server sends the execution result back to the coordinating server. Based on the execution results from each storage server, the coordinating server determines the transaction processing result and then returns the transaction processing result to the business server. This achieves a one-phase transaction commit, reduces the latency of write request processing, and improves the processing efficiency of write requests and the working efficiency of the business server.
[0157] The aforementioned coordination server determines the transaction processing result based on the execution result sent by the storage server and sends the transaction processing result to the business server. Afterward, the coordination server does not send commit or rollback commands to any of the storage servers. If a storage server receives a read request after executing a write request, the receiving storage server needs to first determine whether the target data to be read in the received read request is related to the original data to be operated on by the previously executed write request. If related, the receiving storage server needs to first determine whether the transaction to which the previously executed write request belongs needs to be committed or rolled back. Only after performing the commit or rollback operation will the received read request be executed. Here, "related to the target data to be read in the read request and the original data to be operated on by the write request" means that the target data to be read in the read request is the same as the original data to be operated on by the write request, the target data to be read in the read request overlaps with the original data to be operated on by the write request, the storage location of the target data to be read in the read request overlaps with the storage location of the original data to be operated on by the write request, or the target data to be read in the read request and the original data to be operated on by the write request belong to the same storage area, which can be a data block or a data chunk. The following section combines... Figure 6 This section describes the process of a storage server receiving a read request after executing a write request.
[0158] S601. The coordination server receives the read request sent by the business server and sends the read request to the target storage server.
[0159] The read request includes the storage location information and operators of the target data to be read. Upon receiving the read request, the coordinating server first queries the data distribution information of the distributed system based on the storage location information of the target data in the read request. This query result includes multiple logical storage nodes containing multiple replicas of the target data to be read, and multiple storage servers containing these logical storage nodes. Each replica corresponds to one logical storage node, and each logical storage node corresponds to one storage server. Then, the coordinating server determines the target storage server from the multiple storage servers included in the query result and sends the read request to that target storage server. The target storage server can be any one of the multiple storage servers containing the target data. For example, the target storage server could be the one closest to the coordinating server, or the one with the fastest access speed from the coordinating server.
[0160] S602. The target storage server sends a query request to one or more storage servers based on the read request.
[0161] After receiving the read request, the target storage server determines, based on the read request and one or more previously received write requests, that the target data to be read by the read request is related to the original data to be written by the target write request. Therefore, the target storage server cannot directly read the target data. Instead, it needs to first determine the transaction processing result of the transaction to which the target write request belongs, and then determine whether to perform a commit or rollback operation based on the transaction processing result to ensure the consistency of multiple copies of the target data to be read by the read request. The target write request includes some or all of the one or more write requests received by the target storage server before receiving the read request. In this embodiment, the target write request includes one write request as an example.
[0162] The target storage server determines the multiple storage servers included in the transaction data distribution information in the target write request based on the transaction data identifier and transaction data distribution information in the target write request. Then, it sends a query request to these multiple storage servers. The query request includes multiple transaction data identifiers contained in the target write request. The query request instructs the storage server to query the execution results of the write requests corresponding to the multiple transaction data identifiers in the query request, and sends the query results to the aforementioned target storage server.
[0163] S603. The target storage server receives the query results, performs a commit operation or a rollback operation based on the query results, and executes a read request to obtain the target data and send it to the coordinating server.
[0164] The target storage server determines the transaction processing result of the aforementioned target write request based on the execution results returned by multiple storage servers. If the transaction processing result is successful, the target storage server sends a commit instruction to the multiple storage servers included in the transaction data distribution information of the target write request and performs a commit operation on the transaction to which the target write request belongs. If the transaction processing result is unsuccessful, the target storage server sends a rollback instruction to the multiple storage servers included in the transaction data distribution information of the target write request and performs a rollback operation on the transaction to which the target write request belongs. Finally, it executes the received read request, obtains the target data that the read request needs to read, and sends the target data to the coordinating server.
[0165] For example, if the target storage server is storage server 1, and after executing the first, second, and third write requests, storage server 1 receives a read request, the target data to be read is located in logical storage node 11. Storage server 1 first determines, based on the transaction data identifier and transaction data distribution information sent by the coordinating server, that the coordinating server sent the first, second, and third write requests included in the transaction to which the first write request belongs to storage servers 1, 2, 3, and 4. Then, storage server 1 determines the execution results of the first, second, and third write requests and sends a query request to storage servers 2, 3, and 4. This query request includes the transaction data identifier block1 corresponding to the first write request, the transaction data identifier block2 corresponding to the second write request, and the transaction data identifier block3 corresponding to the third write request. This query request instructs storage servers 2, 3, and 4 to query the execution results of the write requests corresponding to the transaction data identifiers in the query request and send the execution results of each write request to storage server 1. For example, when storage server 2 receives the first write request and the second write request, it queries the execution results of the first write request and the second write request, and sends the two execution results of the first write request and the second write request to storage server 1 respectively.
[0166] After receiving the execution results from storage servers 2, 3, and 4, storage server 1 will commit the operation if all three servers successfully executed their respective write requests. If any one of the write requests fails, storage server 1 will rollback the operation.
[0167] After storage server 1 performs a commit or rollback operation, it reads the target data specified in the read request and sends the read target data to the coordination server. After receiving the target data sent by storage server 1, the coordination server sends the target data to the business server.
[0168] Without sending commit or rollback commands to the storage server, if the coordinating server receives a read request, and the target data to be read in the read request is related to the original data to be operated on by a write request previously received by the storage server, the storage server can determine the transaction processing result of the write request based on the transaction data identifier and transaction data distribution information in the write request. Based on the transaction processing result, the storage server will perform a commit or rollback operation on the transaction to which the write request belongs, and then execute the received read request. By determining the transaction processing result corresponding to the write request through the storage server, the amount of data processed by the application server is reduced, and the efficiency of the application server is improved.
[0169] In one possible implementation, after the target storage server receives the read request and determines the target write request, since the coordinating server has already determined the transaction processing result of the transaction to which the target write request belongs, the target storage server can send a query request to the coordinating server to query the transaction processing result of the transaction to which the target write request belongs. If the target storage server receives a transaction processing result from the coordinating server indicating successful processing, the target storage server sends a commit instruction to the multiple storage servers included in the transaction data distribution information in the target write request and performs a commit operation on the transaction to which the target write request belongs. If the target storage server receives a transaction processing result from the coordinating server indicating failure processing, the target storage server sends a rollback instruction to the multiple storage servers included in the transaction data distribution information in the target write request and performs a rollback operation on the transaction to which the target write request belongs. Finally, the received read request is executed, the target data to be read by the read request is obtained, and the target data is sent to the coordinating server.
[0170] See Figure 7In step S305 above, after the coordinating server sends the transaction processing result to the business server, it can generate operation information based on the execution results of the write requests returned by the storage servers that received the write requests. This operation information instructs the storage servers to perform a commit or rollback operation. If all the execution results returned by the storage servers that received the write requests are successful, the coordinating server generates a commit instruction and sends it to each storage server. After receiving the commit instruction from the coordinating server, each logical storage node in each storage server performs the commit operation. If any of the execution results returned by the storage servers that received the write requests are unsuccessful, the coordinating server generates a rollback instruction and sends it to each storage server. After receiving the rollback instruction from the coordinating server, each storage server performs a rollback operation.
[0171] In S302 above, after the coordinating server generates multiple write requests based on the transaction and sends these requests to some or all of the corresponding storage servers, but before sending the commit or rollback instructions to all of the storage servers, the coordinating server may fail or experience packet loss on its network interface card. This could cause the storage servers receiving the write requests to miss the commit or rollback instructions sent by the coordinating server. In this case, the storage server receiving the write request needs to determine whether the transaction to which the received write request belongs needs to be committed or rolled back. The following describes the transaction execution process when the coordinating server fails.
[0172] In this embodiment of the application, the storage server has the ability to detect the failure of the coordination server. For example, when the storage server receives a write request, it executes the operations in S303 and S304 above. If, after executing S304, it does not receive a commit instruction or rollback instruction from the coordination server within a preset time period, the storage server that received the write request determines that the coordination server has failed.
[0173] Upon receiving a write request, the storage server determines the multiple storage servers included in the transaction data distribution information based on the received write request. It then sends query requests to the other storage servers (excluding itself) among these multiple storage servers. These query requests include multiple transaction data identifiers contained in the write request. The query request instructs the receiving storage server to query the execution results of the write requests corresponding to the multiple transaction data identifiers in the query request, and to send the retrieved execution results back to the storage server that sent the query request. The receiving storage server then generates operation information based on the received execution results.
[0174] The storage server receiving the write request can be any storage server. Each storage server receiving the write request needs to send a query request to the other storage servers and then generate operation information based on the received execution results. Alternatively, the storage server receiving the write request can be any single storage server, such as the first storage server to determine that the coordinating server has failed. If the storage server receiving the write request is a single storage server, the first storage server to determine that the coordinating server has failed generates operation information based on the query execution results. After determining whether to perform a commit or rollback operation based on the operation information, it sends the generated operation information to the multiple storage servers included in the transaction data distribution information.
[0175] For example, after determining that the coordinating server has failed, storage server 1 determines, based on the transaction data distribution information, that the coordinating server sent the first write request, the second write request, and the third write request to storage servers 1, 2, 3, and 4. Therefore, storage server 1 sends query requests to storage servers 2, 3, and 4, instructing them to query the execution results of their respective first, second, and third write requests, and then send the execution results of the write requests back to storage server 1.
[0176] After receiving the execution results from storage servers 2, 3, and 4, storage server 1 determines the transaction processing result as successful if all three servers successfully executed their respective write requests. Storage server 1 then generates a commit instruction and sends it to storage servers 2, 3, and 4, and performs the commit operation. Conversely, if any one or more write requests from storage servers 1, 2, 3, or 4 fail, storage server 1 determines the transaction processing result as failed. Storage server 1 generates a rollback instruction and sends it to storage servers 2, 3, and 4, and performs a rollback operation.
[0177] Optionally, when the coordination server fails, some storage servers may receive operation information sent by the coordination server. Upon receiving a query request from another storage server, the storage server that received the operation information determines the write request being queried based on the transaction data identifier in the query request, thereby determining the operation information corresponding to the transaction to which the write request belongs, and then sends the operation information to the storage server that sent the query request. For example, if storage server 1 receives a commit command from the coordination server, and upon receiving a query request from another storage server, storage server 1 determines that the write request being queried by that query request belongs to a commit command within the same transaction, and then sends the commit command to the storage server that sent the query request.
[0178] By sending transaction data distribution information to the storage server, when the storage server detects a failure in the coordinating server, it queries other storage servers included in the transaction data distribution information for the execution results of write requests from those other storage servers. Then, based on the execution results of the other storage servers, it determines whether to perform a commit operation or a rollback operation. This prevents the storage server from being unable to release the system resources requested by the aforementioned write request when it has not received operation information from the coordinating server, which could lead to system blocking and the inability to execute new transactions, and improves the reliability of the system.
[0179] In one specific implementation, during transaction execution, the storage server may also fail, causing it to be unable to execute write requests or, after executing a write request, unable to return an execution result to the coordinating server. If the coordinating server does not receive an execution result from the storage server within a preset time period, it determines that the storage server has failed. At this point, to maintain consistency in the number of data backups in the system, the distributed system will select a replacement storage server from among other storage servers to replace the failed storage server, and restore the data from the failed storage server in the replacement server based on the corresponding replicas of the data in the failed storage server. After determining the information of the replacement storage server, the coordinating server will resend the corresponding write request to the replacement storage server. The replacement storage server that receives the write request will then execute the write operation specified in the write request and send the execution result of the write request to the coordinating server.
[0180] Continuing with the example of the coordinating server sending write requests to storage servers 1, 2, 3, and 4, when storage server 2 fails, the distributed system selects storage server m to replace it. Based on the corresponding replicas of the data in storage server 2, the system recovers the data from storage server 2 in storage server m. After determining that storage server m will replace storage server 2, the coordinating server updates the transaction data distribution information, for example, replacing storage server 2 with storage server m. It then forwards the write requests intended for storage server 2 to storage server m and sends the updated transaction data distribution information to storage servers 1, 3, and 4. Upon receiving the write request, storage server m executes the operation specified in the write request and sends the execution result to the coordinating server. The coordinating server determines the transaction processing result based on the execution results from storage servers 1, 3, 4, and m.
[0181] The above text combines Figures 1 to 7 The transaction commit system provided in this application has been described in detail. The following will combine... Figures 8 to 13 This application describes the apparatus and equipment for implementing transaction submission according to the present application. See also Figure 8 , Figure 8 This is a schematic diagram of a coordination device provided in an embodiment of this application. The coordination device 800 includes a communication unit 810 and a processing unit 820. The communication unit 810 is used to communicate with the business server and the storage server (storage device).
[0182] The communication unit 810 is used to receive transactions sent by the service server. Each transaction includes at least one transaction data message, and each transaction data message includes information about the storage location of a copy of the original data on the storage server, as well as a write operator. The information included in the transaction can be found in the relevant description in S302 above, and will not be repeated here.
[0183] The processing unit 820 is configured to determine transaction data distribution information based on pre-stored data distribution information, wherein the data distribution information indicates the storage server that stores each copy of each original data in the transaction processing system, and the transaction data distribution information indicates the storage server that stores each copy of the original data corresponding to each transaction data information included in the above transaction.
[0184] The processing unit 820 is further configured to generate at least one write request based on the received transaction, each write request including the aforementioned transaction data distribution information and a transaction data information. The specific operation of the processing unit 820 in generating the write request can be referred to the relevant description in S302 above.
[0185] The communication unit 810 is further configured to send each write request to the storage server where a copy of the original data corresponding to the transaction data information included in each write request resides. It also receives an execution result from each storage server that receives the write request; this execution result is the result of the storage server performing operations on the copy of the original data corresponding to the transaction data information included in the received write request. The operation of the communication unit 810 in sending each write request to the corresponding storage server is consistent with the relevant description in S302 above.
[0186] The processing unit 820 is further configured to determine the transaction processing result based on the execution result of the write request sent by each storage server that received the write request. The operation of the processing unit 820 in determining the transaction processing result can be referred to the relevant description in S305 above, and will not be repeated here.
[0187] The communication unit 810 is also used to send the above transaction processing results to the business server.
[0188] The coordination device 800 may also include a storage unit 830 for storing the aforementioned data distribution information.
[0189] Specifically, the specific operation of the coordination device 800 to implement distributed factual submission can refer to the operation performed by the coordination server in the above method embodiment. For example, the processing unit 820 is used to perform the operation performed by the coordination server in S301 to S305 or S601 to S603, which will not be described in detail here.
[0190] See Figure 9 , Figure 9 This is a schematic diagram of a storage device 900 provided in this application. The storage device 900 includes a communication unit 910 and a processing unit 920. The communication unit 910 is used to communicate with other storage servers (storage devices) and coordination servers (coordination devices).
[0191] The communication unit 910 is used to receive write requests sent by the coordination server. The write request includes transaction data distribution information and a transaction data piece. The write request is any one or more write requests generated by the coordination server based on the received transaction. The target storage server is any one of multiple storage servers where a copy of the original data corresponding to the transaction data information included in the at least one write request is located. The transaction includes at least one transaction data piece, and the transaction data distribution information indicates the storage server storing each copy of the original data corresponding to each transaction data piece included in the transaction. The information included in the transaction, the transaction data information, etc., can be referred to in the description in S301 above, and will not be repeated here.
[0192] Processing unit 920 operates on a copy of the original data corresponding to the transaction data information included in the write request, based on the transaction data information. Communication unit 910 sends the execution result of the write request to the coordination server. The operations performed by processing unit 920 after receiving the write request can refer to the operations performed by the storage server in S303 and S304 above, and will not be repeated here.
[0193] Communication unit 910 is also configured to receive a read request sent by the coordination server, the read request including the storage location of a copy of the target data on the storage server and a read operator. Specific information included in the read request can be found in the description in S601 above.
[0194] Processing unit 920, based on the transaction data distribution information in the received write requests, queries the storage server storing each copy of the original data corresponding to each transaction data information included in the transaction for the execution results of at least one write request; based on the execution results of the at least one write request obtained from the query, performs a commit operation or a rollback operation; reads the target data according to the storage location of the target data copy on the storage device, and sends the read target data to the coordination server. The specific operation of processing unit 920 querying the execution results of at least one write request can refer to the operation in S602 above where the target storage server sends a query request to one or more storage servers; the method by which processing unit 920 determines whether to perform a commit operation or a rollback operation based on the execution results fed back by each storage server that received the write request can refer to the description in S603 above where the target storage server performs a commit operation or a rollback operation based on the query results, and will not be repeated here.
[0195] The processing unit 920 is further configured to generate operation information based on the execution result of the at least one write request obtained from the query, the operation information indicating a commit operation or a rollback operation; the communication unit 910 is further configured to send the operation information to a storage server storing each copy of the original data corresponding to each transaction data information included in the transaction. The method by which the processing unit 920 generates the operation information can refer to the method by which the target storage server generates operation information in S603 above.
[0196] The storage device 900 also includes a storage unit 930, which is used to store the original data to be operated on by the write request and the target data to be read by the read request.
[0197] Specifically, the specific operations of the storage device 900 in implementing distributed factual submission can refer to the operations performed by the storage server in the above method embodiments. For example, the processing unit 920 is used to execute the operations performed by the storage server in S301 to S305 or S601 to S603, which will not be described in detail here.
[0198] See Figure 10 , Figure 10 This is a schematic diagram of a storage device 1000 provided in this application. The storage device 1000 includes a communication unit 1010 and a processing unit 1020. The communication unit 1010 is used to communicate with other storage servers (storage devices) and coordination servers (coordination devices).
[0199] The communication unit 1010 is used to receive a write request sent by the coordination server. The write request includes transaction data distribution information and a transaction data message. The write request is one of at least one write requests generated by the coordination server based on a received transaction. The storage server is one of a plurality of storage servers where a copy of the original data corresponding to the transaction data message included in the at least one write request resides. The transaction includes at least one transaction data message, and each transaction data message includes the storage location information of a copy of the original data on the storage server and a write operator. The transaction data distribution information indicates the storage server storing each copy of the original data corresponding to each transaction data message included in the transaction. The information included in the transaction, the transaction data message, etc., can be referred to in the description in S301 above, and will not be repeated here.
[0200] The processing unit 1020 is configured to operate on a copy of the original data corresponding to the transaction data information included in the write request, based on the transaction data information; the communication unit 1010 is further configured to send the execution result of the write request to the coordination server. The operations performed by the processing unit 1020 upon receiving the write request can refer to the operations performed by the storage server in S303 and S304 above, and will not be repeated here.
[0201] The processing unit 1020 is further configured to: determine if, within a preset time after sending the execution result of the write request to the coordination server, no operation information is received from the coordination server; and, based on the transaction data distribution information, query the storage server storing each copy of the original data corresponding to each transaction data information included in the transaction for the execution result of the at least one write request; and, based on the obtained execution result of the at least one write request, perform a commit operation or a rollback operation. The processing unit 1020's actions of querying the storage server storing each copy of the original data corresponding to each transaction data information included in the transaction for the execution result of the at least one write request, and performing the actions based on the execution result of the at least one write request, can be referred to in the above method embodiment, specifically the actions performed by the storage server after detecting a failure in the coordination server, which will not be elaborated further here.
[0202] The storage device 1000 also includes a storage unit 1030, which stores the original data to be operated on in the write request and the target data to be read in the read request. The processing unit 1020 executes the operations performed by the storage server in S301 to S305 and the operations performed by the storage server after it detects a failure in the coordination server, which will not be described in detail here.
[0203] See Figure 11 , Figure 11 This is a schematic diagram of the structure of a coordination server provided in an embodiment of this application. The coordination server 1100 includes one or more processors 1110, a communication interface 1120, and a memory 1130. Optionally, the processors 1110, the communication interface 1120, and the memory 1130 are interconnected via a bus 1140.
[0204] The processor 1110 is used to implement the operations performed by the processing unit 820. The specific implementation of various operations by the processor 1110 can refer to the specific operations performed by the coordination server as the execution entity in the above method embodiments. For example, the processor 1110 is used to execute the above... Figure 5 The operation of the coordination server in S303 and S304 will not be elaborated here.
[0205] The processor 1110 can be implemented in various ways. For example, it can be a central processing unit (CPU) or a graphics processing unit (GPU), and it can also be a single-core or multi-core processor. The processor 1110 can be a combination of a CPU and hardware chips. These hardware chips can be application-specific integrated circuits (ASICs), programmable logic devices (PLDs), or combinations thereof. The PLDs can be complex programmable logic devices (CPLDs), field-programmable gate arrays (FPGAs), generic array logic (GALs), or any combination thereof. The processor 1110 can also be implemented using logic devices with built-in processing logic, such as FPGAs or digital signal processors (DSPs).
[0206] The communication interface 1120 can be a wired interface or a wireless interface, used to communicate with other modules or devices. The wired interface can be an Ethernet interface, a local interconnect network (LIN), etc., and the wireless interface can be a cellular network interface or a wireless LAN interface, etc.
[0207] In this embodiment, the communication interface 1120 performs the operations implemented by the communication unit 810 described above. For example, it can be used to receive transactions sent by the service server in S301, or to receive execution results from the storage server. Specifically, the actions performed by the communication interface 1120 can refer to the actions of coordinating the server's receiving or sending in the above method embodiments, and will not be repeated here.
[0208] Memory 1130 can be non-volatile memory, such as read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Memory 1130 can also be volatile memory, which can be random access memory (RAM) used as an external cache.
[0209] The memory 1130 can also be used to store instructions and data, so that the processor 1110 can call the instructions stored in the memory 1130 to implement the operations performed by the processing unit 820, such as the operations performed by the coordination server in the above method embodiment. Furthermore, the coordination server 1100 may include, compared to... Figure 11 The number of components displayed may be more or less, or there may be different component configurations.
[0210] Bus 1140 can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. Bus 1140 can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 11 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.
[0211] Optionally, the coordination server 1100 may also include an input / output interface 1150, which is connected to input / output devices for receiving input information and outputting operation results.
[0212] Specifically, the specific implementation of the various operations performed by the coordination server 1100 can be referred to the specific operations performed by the coordination server in the above method embodiment, and will not be repeated here.
[0213] See Figure 12 , Figure 12 This is a schematic diagram of a storage server provided in an embodiment of this application. The storage server 1200 includes one or more processors 1210, a communication interface 1220, and a memory 1230. Optionally, the processors 1210, the communication interface 1220, and the memory 1230 are interconnected via a bus 1240.
[0214] The processor 1210 is used to implement the operations performed by the processing unit 920. The specific implementation of various operations performed by the processor 1210 can refer to the specific operations performed by the storage server as the execution entity in the above method embodiments. For example, the processor 1210 is used to perform the above... Figure 5 The operations performed by the storage servers in S303 and S304, or the operations performed by the storage servers in S301 to S305, as well as the operations performed by the storage servers after they detect a failure in the coordination server, will not be described in detail here.
[0215] The processor 1210 can have various specific implementations. For example, the processor 1210 can be a central processing unit or a graphics processing unit. The processor 1210 can also be a single-core processor or a multi-core processor. The processor 1210 can be a combination of a CPU and hardware chips.
[0216] Communication interface 1220 can be a wired interface or a wireless interface; please refer to communication interface 1120 for details.
[0217] In this embodiment, the communication interface 1220 performs the operations implemented by the communication unit 910 described above. Specifically, it can be used to perform operations such as receiving transaction data identifiers, transaction data information, and transaction data distribution information in S303, or to perform operations such as sending the execution results of the storage server to the coordination server in S304. Specifically, the actions performed by the communication interface 1220 can refer to the actions of the storage server receiving or sending data in the above method embodiment, and will not be repeated here.
[0218] Memory 1230 can be non-volatile memory or volatile memory, see memory 1130 for details.
[0219] The memory 1230 can also be used to store instructions and data, so that the processor 1210 can call the instructions stored in the memory 1230 to implement the operations performed by the processing unit 920, such as the operations performed by the storage server in the above method embodiment. Furthermore, the storage server 1200 may include, compared to... Figure 12 The number of components displayed may be more or less, or there may be different component configurations.
[0220] Bus 1240 can be a PCI bus or an EISA bus, etc. Please refer to bus 1140 for details.
[0221] Optionally, the storage server 1200 may also include an input / output interface 1250, which is connected to input / output devices for receiving input information and outputting operation results.
[0222] Specifically, the specific implementation of the various operations performed by the server 1200 can be referred to the specific operations performed by the storage server in the above method embodiment, and will not be repeated here.
[0223] See Figure 13 , Figure 13 This is a schematic diagram of the structure of a storage server 1300 provided in an embodiment of this application. The storage server 1300 includes one or more processors 1310, a communication interface 1320, and a memory 1330. Optionally, the processors 1310, the communication interface 1320, and the memory 1330 are interconnected via a bus 1340.
[0224] The processor 1310 is used to implement the operations performed by the processing unit 920. The specific implementation of various operations by the processor 1310 can refer to the specific operations performed by the storage server as the execution entity in the above method embodiments. For example, the processor 1310 is used to execute the above... Figure 5 The operations performed by the storage servers S301 to S305, as well as the operations performed by the storage server after it detects a failure in the coordination server in the above method embodiment, will not be described in detail here.
[0225] The processor 1310 can have various specific implementations. For example, the processor 1310 can be a central processing unit or a graphics processor. The processor 1310 can also be a single-core processor or a multi-core processor. The processor 1310 can also be a combination of a CPU and hardware chips.
[0226] Communication interface 1320 can be a wired interface or a wireless interface; please refer to communication interface 1120 for details.
[0227] In this embodiment, the communication interface 1320 performs the operations implemented by the communication unit 910 described above. Specifically, it can be used to perform operations such as receiving transaction data identifiers, transaction data information, and transaction data distribution information in S303, or to perform operations such as sending the execution results of the storage server to the coordination server in S304. Specifically, the actions performed by the communication interface 1320 can refer to the actions of the storage server receiving or sending data in the above method embodiment, and will not be repeated here.
[0228] Memory 1330 can be non-volatile memory or volatile memory, see memory 1130 for details.
[0229] The memory 1330 can also be used to store instructions and data, so that the processor 1310 can call the instructions stored in the memory 1330 to implement the operations performed by the processing unit 820, such as the operations performed by the storage server in the above method embodiment. Furthermore, the storage server 1300 may include, compared to... Figure 13 The number of components displayed may be more or less, or there may be different component configurations.
[0230] Bus 1340 can be a PCI bus or an EISA bus, etc. Please refer to bus 1140 for details.
[0231] Optionally, the storage server 1300 may also include an input / output interface 1350, which is connected to input / output devices for receiving input information and outputting operation results.
[0232] This application also provides a non-transient computer-readable storage medium storing a computer program. When the computer program runs on a processor, it can implement the method steps executed by the coordination server in the above method embodiments. The specific implementation of the processor of the computer storage medium in executing the above method steps can refer to the specific operation of the coordination server in the above method embodiments, and will not be repeated here.
[0233] This application also provides a non-transient computer-readable storage medium storing a computer program. When the computer program runs on a processor, it can implement the method steps executed by the storage server in the above method embodiments. The specific implementation of the processor of the computer storage medium in executing the above method steps can refer to the specific operation of the storage server in the above method embodiments, and will not be repeated here.
[0234] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.
[0235] The above embodiments can be implemented, in whole or in part, by software, hardware, firmware, or any other combination thereof. When implemented using software, the above embodiments can be implemented, in whole or in part, as a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded or executed on a computer, all or part of the processes or functions described in the embodiments of the present invention are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more sets of available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium. A semiconductor medium can be a solid-state drive (SSD).
[0236] The steps in the method of this application embodiment can be adjusted, merged, or deleted in order according to actual needs; the modules in the device of this application embodiment can be divided, merged, or deleted according to actual needs.
[0237] The embodiments of this application have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of this application. The description of the above embodiments is only for the purpose of helping to understand the method and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. A transaction processing system, characterized in that, This includes a coordination server and multiple storage servers; The coordination server is configured to receive transactions, each transaction including at least one transaction data information, each transaction data information including the storage location information of a copy of the original data on a storage server and a write operator; determine transaction data distribution information based on pre-stored data distribution information, wherein the data distribution information indicates the storage server storing each copy of each original data in the transaction processing system, and the transaction data distribution information indicates the storage server storing each copy of the original data corresponding to each transaction data information included in the transaction; generate at least one write request, each write request including the transaction data distribution information and a transaction data information; and send each write request to the storage server where the copy of the original data corresponding to the transaction data information included in each write request is located. The storage server that receives any write request stores the transaction data distribution information; operates on a copy of the original data corresponding to the transaction data information included in the write request; and sends the execution result of the write request to the coordination server. The coordination server is further configured to determine the transaction processing result of the transaction based on the execution result of the write request sent by each storage server that received the write request, and send the transaction processing result to the business server. The coordination server is further configured to determine, based on the execution result of the write request sent by each storage server that received the write request, operation information that each storage server that received the write request needs to perform, the operation information indicating whether to perform a commit operation or a rollback operation, and to send the operation information to each storage server that received the write request.
2. The transaction processing system as described in claim 1, characterized in that, The coordination server is also configured to receive read requests, the read requests including the storage location of a copy of the target data on the storage server and a read operator; and to determine the storage server storing the copy of the target data based on the data distribution information. The read request is sent to the storage server that stores a copy of the target data; The storage server that receives the read request is configured to query the execution result of the write request from each storage server that received the write request, based on the transaction data distribution information. Based on the execution result of the write request sent by each storage server that received the write request, determine whether to perform a commit operation or a rollback operation; After performing the commit operation or the rollback operation, the target data is read from the storage location on the storage server according to the copy of the target data; The read target data is sent to the coordination server.
3. The transaction processing system as described in claim 2, characterized in that, The storage server that receives the read request is further configured to generate operation information based on the execution result of the write request, the operation information indicating a commit operation or a rollback operation, and send the operation information to each storage server that received the write request.
4. The transaction processing system as described in claim 2 or 3, characterized in that, The storage location of the target data copy on the storage server overlaps with the storage location of the original data copy on the storage server, or the target data copy and the original data copy are stored in data blocks that need to maintain consistency.
5. The transaction processing system as described in claim 2 or 3, characterized in that, The coordination server is configured to determine, based on the data distribution information, multiple storage servers storing copies of the target data; and select a target storage server from the determined multiple storage servers storing copies of the target data. The read request is sent to the target storage server.
6. The transaction processing system as described in claim 1, characterized in that, The storage server that receives the write request is further configured to determine that it has not received the operation information sent by the coordination server within a preset time after sending the execution result of the operation to the coordination server, and query the storage server that stores each copy of the original data corresponding to each transaction data information included in the transaction for the execution result of the write request according to the transaction data distribution information; Based on the execution result, determine whether to perform the commit operation or the rollback operation.
7. A transaction processing method, characterized in that, Applied to a transaction processing system including a coordination server and multiple storage servers, the method includes: The coordination server receives transactions sent by the business server. Each transaction includes at least one transaction data information, and each transaction data information includes the storage location information of a copy of the original data on the storage server and a write operator. The coordination server determines the transaction data distribution information based on the pre-stored data distribution information, wherein the data distribution information indicates the storage server that stores each copy of each original data in the transaction processing system, and the transaction data distribution information indicates the storage server that stores each copy of the original data corresponding to each transaction data information included in the transaction; The coordination server generates at least one write request, each write request including the transaction data distribution information and a transaction data information; The coordination server sends each write request to the storage server where the copy of the original data corresponding to the transaction data information included in each write request is located; Upon receiving any write request, the storage server stores the transaction data distribution information, operates on a copy of the original data corresponding to the transaction data information included in the write request, and sends the execution result of the write request to the coordination server. The coordination server determines the transaction processing result based on the execution result of the write request sent by each storage server that received the write request, and sends the transaction processing result to the business server. The coordination server determines the operation information that each storage server that received the write request needs to perform based on the execution result of the write request sent by each storage server that received the write request. The operation information indicates whether to perform a commit operation or a rollback operation. The coordination server sends the operation information to each storage server that receives the write request.
8. The method as described in claim 7, characterized in that, The method further includes: The coordination server receives a read request sent by the business server, the read request including the storage location of a copy of the target data on the storage server and a read operator; The coordination server determines the storage server storing the copy of the target data based on the data distribution information, and sends the read request to the storage server storing the copy of the target data. The storage server that receives the read request queries the execution result of the write request from each storage server that received the write request, based on the transaction data distribution information; and determines whether to perform a commit operation or a rollback operation based on the execution result of the write request sent by each storage server that received the write request. Upon receiving the read request, the storage server reads the target data from its storage location on the storage server based on a copy of the target data, and then sends the read target data to the coordination server.
9. The method as described in claim 8, characterized in that, The method further includes: The storage server that receives the read request generates operation information based on the execution result of the write request, and sends the operation information to each storage server that received the write request. The operation information indicates whether to commit the operation or rollback the operation.
10. The method as described in claim 8 or 9, characterized in that, The storage location of the target data copy on the storage server overlaps with the storage location of the original data copy on the storage server, or the target data copy and the original data copy are stored in data blocks that need to maintain consistency.
11. The method as described in claim 8 or 9, characterized in that, The coordination server determines the storage server storing the copy of the target data based on the data distribution information, and sends the read request to the storage server storing the copy of the target data, including: The coordination server determines multiple storage servers that store copies of the target data based on the data distribution information. The coordination server selects a target storage server from the determined plurality of storage servers storing copies of the target data, and sends the read request to the target storage server.
12. The method as described in claim 7, characterized in that, The method further includes: If the storage server that received the write request does not receive the operation information from the coordination server within a preset time after determining that it has sent the execution result of the operation to the coordination server, it queries the storage server that stores each copy of the original data corresponding to each transaction data information included in the transaction for the execution result of the write request according to the transaction data distribution information. The storage server that receives the write request determines whether to perform the commit operation or the rollback operation based on the execution result.
13. A transaction processing method, characterized in that, The method includes: The coordination server receives transactions sent by the business server. The transactions include at least one transaction data information, and each transaction data information includes the storage location information of a copy of the original data on the storage server and a write operator. The coordination server determines the transaction data distribution information based on the pre-stored data distribution information, wherein the data distribution information indicates the storage server that stores each copy of each original data in the transaction processing system, and the transaction data distribution information indicates the storage server that stores each copy of the original data corresponding to each transaction data information included in the transaction; The coordination server generates at least one write request, each write request including the transaction data distribution information and a transaction data information; The coordination server sends each write request to the storage server where the copy of the original data corresponding to the transaction data information included in each write request is located; The coordination server receives the execution result of the write request from each storage server that received the write request; The coordination server determines the transaction processing result of the transaction based on the execution result of the write request sent by each storage server that received the write request, and sends the transaction processing result to the business server. The coordination server determines the operation information that each storage server that received the write request needs to perform based on the execution result of the write request sent by each storage server that received the write request. The operation information indicates whether to perform a commit operation or a rollback operation. The coordination server sends the operation information to each storage server that receives the write request.
14. A transaction processing method, characterized in that, The method includes: The storage server receives a write request sent by the coordination server. The write request includes transaction data distribution information and a transaction data information. The write request is one of at least one write requests generated by the coordination server based on the received transaction. The storage server is one of a plurality of storage servers where a copy of the original data corresponding to the transaction data information included in the at least one write request is located. The transaction includes at least one transaction data information. Each transaction data information includes the storage location information of a copy of the original data on the storage server and a write operator. The transaction data distribution information indicates the storage server storing each copy of the original data corresponding to each transaction data information included in the transaction. The storage server operates on a copy of the original data corresponding to the transaction data information included in the write request based on the transaction data information, and sends the execution result of the write request to the coordination server; The storage server receives a read request sent by the coordination server, the read request including the storage location of a copy of the target data on the storage server and a read operator; The storage server queries the storage server storing each copy of the original data corresponding to each transaction data information included in the transaction for the execution result of the at least one write request based on the transaction data distribution information. The storage server performs a commit operation or a rollback operation based on the execution result of the at least one write request obtained from the query.
15. The method as described in claim 14, characterized in that, The method further includes: The storage server generates operation information based on the execution results of the at least one write request obtained from the query, and the operation information indicates a commit operation or a rollback operation. The storage server sends the operation information to each storage server that stores a copy of the original data corresponding to each transaction data information included in the transaction.
16. The method as described in claim 14 or 15, characterized in that, The storage location of the target data copy on the storage server overlaps with the storage location of the original data copy on the storage server, or the target data copy and the original data copy are stored in data blocks that need to maintain consistency.
17. A coordination device, characterized in that, The coordination device includes: A communication unit is used to receive transactions sent by a business server. The transaction includes at least one transaction data information, and each transaction data information includes the storage location information of a copy of the original data on the storage server and a write operator. The processing unit is configured to determine transaction data distribution information based on pre-stored data distribution information, wherein the data distribution information indicates the storage server in the transaction processing system that stores each copy of each original data, and the transaction data distribution information indicates the storage server that stores each copy of the original data corresponding to each transaction data information included in the transaction; Generate at least one write request, each write request including the transaction data distribution information and a transaction data information; The communication unit is also used to send each write request to the storage server where the copy of the original data corresponding to the transaction data information included in each write request is located; Receive the execution result of the write request sent by each storage server that received the write request; The processing unit is further configured to determine the transaction processing result of the transaction based on the execution result of the write request sent by each storage server that received the write request; The communication unit is also used to send the transaction processing result to the business server; The communication unit is further configured to determine, based on the execution result of the write request sent by each storage server that received the write request, operation information that each storage server that received the write request needs to perform, the operation information indicating whether to perform a commit operation or a rollback operation, and to send the operation information to each storage server that received the write request.
18. The apparatus as claimed in claim 17, characterized in that, The processing unit is further configured to determine the operation information that each storage server receiving the write request needs to perform based on the execution result of the write request sent by each storage server that received the write request, wherein the operation information indicates whether to perform a commit operation or a rollback operation. The communication unit is used to send the operation information to each storage server that receives the write request.
19. A storage device, characterized in that, The device includes: A communication unit is used to receive a write request sent by a coordination server. The write request includes transaction data distribution information and a transaction data information. The write request is one of at least one write requests generated by the coordination server based on the received transaction. The storage server is one of a plurality of storage servers where a copy of the original data corresponding to the transaction data information included in the at least one write request is located. The transaction includes at least one transaction data information. Each transaction data information includes the storage location information of a copy of the original data on the storage server and a write operator. The transaction data distribution information indicates the storage server storing each copy of the original data corresponding to each transaction data information included in the transaction. The processing unit operates on a copy of the original data corresponding to the transaction data information included in the write request, based on the transaction data information. The communication unit is also configured to send the execution result of the write request to the coordination server; and receive a read request sent by the coordination server, wherein the read request includes the storage location of the copy of the target data on the storage server and the read operator; The processing unit is further configured to query the execution result of the at least one write request from the storage server storing each copy of the original data corresponding to each transaction data information included in the transaction, based on the transaction data distribution information; Based on the execution result of the at least one write request obtained from the query, perform a commit operation or a rollback operation.
20. The apparatus as claimed in claim 19, characterized in that, The processing unit is further configured to generate operation information based on the execution result of the at least one write request obtained from the query, wherein the operation information indicates a commit operation or a rollback operation. The communication unit is further configured to send the operation information to a storage server that stores a copy of the original data corresponding to each transaction data information included in the transaction.
21. The apparatus as claimed in claim 19 or 20, characterized in that, The storage location of the target data copy on the storage server overlaps with the storage location of the original data copy on the storage server, or the target data copy and the original data copy are stored in data blocks that need to maintain consistency.
22. A coordination server, characterized in that, It includes a processor and a memory; the memory is used to store instructions, and the processor is used to execute the instructions, wherein when the processor executes the instructions, the processor performs the method as described in claim 13.
23. A storage server, characterized in that, It includes a processor and a memory; the memory is used to store instructions, and the processor is used to execute the instructions, wherein when the processor executes the instructions, the processor performs the method as described in any one of claims 14 to 16.
24. A non-transient computer-readable storage medium storing a computer program that, when executed by a coordination server, implements the method of claim 13.
25. A non-transient computer-readable storage medium storing a computer program that, when executed by a storage server, implements the method as described in any one of claims 14 to 16.
Citation Information
Patent Citations
Distributed system and method for guaranteeing transaction consistency and linear consistency
CN109977171A
System and method for managing transactions for multiple data store nodes without a central log
US20190228096A1