Transaction submission system, method and related equipment
By coordinating the server to send write requests directly to the storage server and process the results, the problem of extended transaction submission in the distributed system is solved, and efficient transaction processing and system reliability are achieved.
Patent Information
- Application Number
- CN201980102354.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-11-30
- Publication Date
- 2025-09-12
- Estimated Expiration
- 2039-11-30
AI Technical Summary
In distributed systems, the two-phase commit method results in long transaction commit delays. Multiple interactions between the coordinator, participants, and primary replicas increase processing delays. In addition, when the coordination server fails, storage server resources cannot be released in time, causing system congestion.
The coordination server sends write requests directly to each storage server. The storage server executes the operation and feeds back the results. The coordination server determines the transaction processing result based on the result, reducing the interaction between the coordination server and the storage server, improving the efficiency of write request processing, and allowing the storage server to handle the transaction results independently when the coordination server fails.
It implements one-stage transaction submission, reduces transaction submission latency, improves write request processing efficiency and business server efficiency, enhances system reliability and prevents system congestion.
Smart Images

Figure CN114730314B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a transaction submission system, method, and related equipment. Background Art
[0002] A transaction is a logical unit of execution within a database management system, consisting of a finite sequence of database operations. In distributed systems, data redundancy is necessary to improve data reliability. For example, multiple replicas of the data are stored across different nodes. When a transaction spans multiple participants, each participant can determine the outcome of their own transaction but cannot know the outcomes of other participants. To maintain transaction atomicity, consistency, isolation, and durability, a coordinator is required to manage the participants executing the transaction. Two-phase commit is a transaction commit method designed based on distributed system architectures. However, this method requires multiple interactions between the coordinator, participants, and the primary replica in the distributed system, resulting in longer transaction commit delays. Summary of the Invention
[0003] Embodiments of the present invention provide a transaction submission system, method, and related devices, which can reduce the delay of transaction submission.
[0004] In a first aspect, the present application provides a transaction processing system, including a coordination server and multiple storage servers, wherein:
[0005] The coordination server is configured to receive a transaction, wherein the transaction includes at least one transaction data information, each transaction data information including storage location information of a copy of original data on a storage server and a write operator; determine the transaction data distribution information based on pre-stored data distribution information, wherein the data distribution information indicates a storage server storing each copy of each original data in the transaction processing system, and the transaction data distribution information indicates a 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 one 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;
[0006] The storage server that receives any write request is configured to store the transaction data distribution information; perform an operation on a copy of the original data corresponding to the transaction data information included in the write request according to the transaction data information included in the write request; and send an execution result of the write request to the coordination server;
[0007] The coordination server is further configured to determine a transaction processing result of the transaction according to an execution result of the write request sent by each storage server that receives the write request, and send the transaction processing result to the business server.
[0008] The coordination server generates one or more write requests based on the transaction data information in the received transaction, and then sends each write request directly to the storage server where each copy of the original data corresponding to the transaction data information included in each write request is located based on the pre-stored data distribution information of the distributed system. This can avoid the coordination server first sending the write request to the storage server where the primary copy of the original data corresponding to the transaction data information is located, and then the primary copy sends the write request to the corresponding backup copy, thereby improving the efficiency of sending the write request to each storage server. In addition, after the storage server that receives the write request executes the received write request, each storage server will feed back the execution result of the write request to the coordination server. The coordination server can determine the transaction processing result of the transaction based on the execution result fed back by each storage server, and then return the transaction processing result of the above transaction to the business server, thereby realizing one-stage transaction submission, reducing the delay in write request processing, and improving the processing efficiency of write requests and the work efficiency of business servers.
[0009] In a possible implementation, the coordination server is configured to receive a read request, the read request including a storage location of a copy of target data on a storage server and a read operator; determine, based on the data distribution information, a storage server storing the copy of the target data; and send the read request to the storage server storing the copy of the target data;
[0010] The storage server that receives the read request is used to query each storage server that receives the write request about the execution result of 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 receives the write request; after performing the commit operation or the rollback operation, read the target data at the storage location on the storage server based on the copy of the target data; and send the read target data to the coordination server.
[0011] In one possible implementation, the storage server that receives the read request is also used to generate operation information based on the execution result of the write request, where the operation information indicates a commit operation or a rollback operation, and sends the operation information to each storage server that receives the write request.
[0012] When a storage server receives a read request without sending a commit instruction or a rollback instruction to the storage server, the coordination server can 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 based on the transaction data identifier and transaction data distribution information in the received write request. Based on the query execution result of the write request, the storage server determines whether to perform a commit operation or a rollback operation, and then executes the received read request. By determining whether to perform a commit operation or a rollback operation on the transaction corresponding to the write request through the storage server, the amount of data processed by the business server is reduced, thereby improving the efficiency of the business server.
[0013] In one possible implementation, the storage location of the copy of the target data on the storage server overlaps with the storage location of the copy of the original data on the storage server, or the copy of the target data and the copy of the original data are stored in data blocks that need to maintain consistency.
[0014] In one possible implementation, the coordination server is used to determine multiple storage servers that store copies of the target data based on the data distribution information; select a target storage server from the multiple storage servers that store copies of the target data; and send the read request to the target storage server.
[0015] The target storage server can be the one closest to the coordination server among multiple storage servers storing copies of the target data, or the coordination server with the fastest access speed among multiple storage servers storing copies of the target data, thereby increasing the speed at which the business server reads the target data and improving work efficiency.
[0016] In one possible implementation, the coordination server is also used to determine the operation information that each storage server that receives the write request needs to execute based on the execution result of the write request sent by each storage server that receives the write request, the operation information indicating whether to perform a commit operation or a rollback operation, and send the operation information to each storage server that receives the write request.
[0017] In one possible implementation, the storage server that receives the write request is also used to determine that the operation information sent by the coordination server is not received within a preset time after the execution result of the operation is sent to the coordination server, and according to the transaction data distribution information, 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; and according to the execution result, determine to execute the commit operation or the rollback operation.
[0018] After feeding back the execution result to the coordination server, if the storage server does not receive any operation information from the coordination server within a preset time period, the storage server determines that the coordination 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 the write request executed by other storage servers. Then, based on the execution results of the other storage servers, the storage server 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 to execute the above-mentioned write request when it does not receive the commit instruction or rollback instruction from the coordination server, causing the system to be blocked and unable to execute new transactions, and can improve system reliability.
[0019] In a second aspect, the present application provides a transaction processing method, applied to a transaction processing system including a coordination server and multiple storage servers, the method comprising:
[0020] The coordination server receives a transaction sent by the business server, wherein the transaction includes at least one transaction data information, and each transaction data information includes storage location information of a copy of the original data on the storage server and a write operator;
[0021] The coordination server determines transaction data distribution information based on pre-stored data distribution information, wherein the data distribution information indicates a storage server storing each copy of each original data in the transaction processing system, and the transaction data distribution information indicates a storage server storing each copy of the original data corresponding to each transaction data information included in the transaction;
[0022] The coordination server generates at least one write request, each write request including the transaction data distribution information and a transaction data information;
[0023] The coordination server sends each write request to a storage server where a copy of the original data corresponding to the transaction data information included in each write request is located;
[0024] The storage server that receives any write request stores the transaction data distribution information, operates on the copy of the original data corresponding to the transaction data information included in the write request according to the transaction data information included in the write request, and sends the execution result of the write request to the coordination server;
[0025] The coordination server determines a transaction processing result of the transaction according to the write request execution result sent by each storage server that receives the write request, and sends the transaction processing result to the business server.
[0026] In a possible implementation, the coordination server receives a read request sent by the business server, where the read request includes a storage location of a copy of the target data on a storage server and a read operator;
[0027] 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;
[0028] The storage server that receives the read request queries each storage server that receives the write request for an execution result of 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 receives the write request;
[0029] The storage server that receives the read request reads the target data from the storage location of the copy of the target data on the storage server, and sends the read target data to the coordination server.
[0030] 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 receives the write request, where the operation information indicates a commit operation or a rollback operation.
[0031] In one possible implementation, the storage location of the copy of the target data on the storage server overlaps with the storage location of the copy of the original data on the storage server, or the copy of the target data and the copy of the original data are stored in data blocks that need to maintain consistency.
[0032] In a 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:
[0033] The coordination server determines, based on the data distribution information, a plurality of storage servers storing copies of the target data;
[0034] 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.
[0035] In one possible implementation, the method further includes: the coordination server determining, based on an execution result of the write request sent by each storage server that receives the write request, operation information that each storage server that receives the write request needs to perform, where the operation information indicates whether to perform a commit operation or a rollback operation;
[0036] The coordination server sends the operation information to each storage server that receives the write request.
[0037] In a possible implementation, the method further includes:
[0038] The storage server that receives the write request determines 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 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 based on the transaction data distribution information;
[0039] The storage server that receives the write request determines whether to perform the commit operation or the rollback operation based on the execution result.
[0040] In a third aspect, the present application provides a transaction processing method, which is applied to a coordination server in a transaction processing system including a coordination server and multiple storage servers, the method comprising:
[0041] The coordination server receives a transaction sent by the business server, wherein the transaction includes at least one transaction data information, and each transaction data information includes storage location information of a copy of the original data on the storage server and a write operator;
[0042] The coordination server determines transaction data distribution information based on pre-stored data distribution information, wherein the data distribution information indicates a storage server storing each copy of each original data in the transaction processing system, and the transaction data distribution information indicates a storage server storing each copy of the original data corresponding to each transaction data information included in the transaction;
[0043] The coordination server generates at least one write request, each write request including the transaction data distribution information and a transaction data information;
[0044] The coordination server sends each write request to a storage server where a copy of the original data corresponding to the transaction data information included in each write request is located;
[0045] The coordination server receives the execution result of the write request sent by each storage server that receives the write request;
[0046] The coordination server determines a transaction processing result of the transaction according to an execution result of the write request sent by each storage server that receives the write request, and sends the transaction processing result to the business server.
[0047] In one possible implementation, the method further includes: the coordination server determining, based on an execution result of the write request sent by each storage server that receives the write request, operation information that each storage server that receives the write request needs to perform, where the operation information indicates whether to perform a commit operation or a rollback operation;
[0048] The coordination server sends the operation information to each storage server that receives the write request.
[0049] In a fourth aspect, the present 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:
[0050] The storage server receives a write request sent by the coordination server, where the write request includes transaction data distribution information and a piece of transaction data information. The write request is one of at least one write request generated by the coordination server based on the received transaction. The storage server is one of multiple storage servers where a copy of original data corresponding to the transaction data information included in the at least one write request is located. The transaction includes at least one piece of transaction data information, each piece of transaction data information includes storage location information of a copy of the original data on the storage server and a write operator. The transaction data distribution information indicates a storage server that stores each copy of the original data corresponding to each piece of transaction data information included in the transaction.
[0051] The storage server operates on a copy of the original data corresponding to the transaction data information included in the write request according to the transaction data information, and sends an execution result of the write request to the coordination server;
[0052] The storage server receives a read request sent by the coordination server, where the read request includes a storage location of a copy of the target data on the storage server and a read operator;
[0053] The storage server queries, according to the transaction data distribution information, a storage server storing each copy of the original data corresponding to each transaction data information included in the transaction, for an execution result of the at least one write request;
[0054] The storage server performs a commit operation or a rollback operation according to the execution result of the at least one write request obtained by the query.
[0055] In a possible implementation, the method further includes: the storage server generating operation information according to the execution result of the at least one write request obtained by the query, the operation information indicating a commit operation or a rollback operation;
[0056] The storage server sends the operation information to a storage server storing each copy of the original data corresponding to each transaction data information included in the transaction.
[0057] In one possible implementation, the storage location of the copy of the target data on the storage server overlaps with the storage location of the copy of the original data on the storage server, or the copy of the target data and the copy of the original data are stored in data blocks that need to maintain consistency.
[0058] In a fifth aspect, the present 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:
[0059] The storage server receives a write request sent by the coordination server, where the write request includes transaction data distribution information and a piece of transaction data information. The write request is one of at least one write request generated by the coordination server based on the received transaction. The storage server is one of multiple storage servers where a copy of original data corresponding to the transaction data information included in the at least one write request is located. The transaction includes at least one piece of transaction data information, each piece of transaction data information includes storage location information of a copy of the original data on the storage server and a write operator. The transaction data distribution information indicates a storage server that stores each copy of the original data corresponding to each piece of transaction data information included in the transaction.
[0060] The server operates on a copy of the original data corresponding to the transaction data information included in the write request according to the transaction data information, and sends an execution result of the write request to the coordination server;
[0061] The storage server determines that no operation information sent by the coordination server is received within a preset time after sending the execution result of the write request to the coordination server, and 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;
[0062] The storage server performs a commit operation or a rollback operation according to the execution result of the at least one write request obtained by the query.
[0063] In a sixth aspect, the present application provides a coordination device, comprising:
[0064] A communication unit, configured to receive a transaction sent by a business server, wherein the transaction includes at least one transaction data message, and each transaction data message includes storage location information of a copy of the original data on the storage server and a write operator;
[0065] a processing unit, configured to determine transaction data distribution information based on pre-stored data distribution information, wherein the data distribution information indicates a storage server storing each copy of each original data in a transaction processing system, and the transaction data distribution information indicates a storage server storing each copy of the original data corresponding to each transaction data information included in the transaction;
[0066] Generate at least one write request, each write request including the transaction data distribution information and a transaction data information;
[0067] The communication unit is further configured to send each write request to a storage server where a copy of the original data corresponding to the transaction data information included in each write request is located;
[0068] receiving an execution result of the write request sent by each storage server that receives the write request;
[0069] The processing unit is further configured to determine a transaction processing result of the transaction according to an execution result of the write request sent by each storage server that receives the write request;
[0070] The communication unit is further configured to send the transaction processing result to the service server.
[0071] In a possible implementation, the processing unit is specifically configured to determine, based on an execution result of the write request sent by each storage server that receives the write request, operation information that needs to be performed by each storage server that receives the write request, where the operation information indicates whether to perform a commit operation or a rollback operation;
[0072] The communication unit is further configured to send the operation information to each storage server that receives the write request.
[0073] In a seventh aspect, the present application provides a storage device, comprising:
[0074] a communication unit, configured to receive a write request sent by a coordination server, the write request including transaction data distribution information and a piece of transaction data information, the write request being one of at least one write request generated by the coordination server based on a received transaction, the storage server being one of a plurality of storage servers where a copy of original data corresponding to the transaction data information included in the at least one write request is located, the transaction including at least one piece of transaction data information, each piece of transaction data information including storage location information of a copy of the original data on the storage server and a write operator, the transaction data distribution information indicating a storage server storing each copy of the original data corresponding to each piece of transaction data information included in the transaction;
[0075] a processing unit, operating, according to the transaction data information, a copy of the original data corresponding to the transaction data information included in the write request;
[0076] The communication unit is further configured to send the execution result of the write request to the coordination server; receive a read request sent by the coordination server, wherein the read request includes a storage location of a copy of the target data on the storage server and a read operator;
[0077] The processing unit is further configured to query, based on the transaction data distribution information, a storage server storing each copy of original data corresponding to each transaction data information included in the transaction for an execution result of the at least one write request;
[0078] A commit operation or a rollback operation is performed according to the execution result of the at least one write request obtained by the query.
[0079] In a possible implementation, the processing unit is further configured to generate operation information according to an execution result of the at least one write request obtained by the query, where the operation information indicates a commit operation or a rollback operation;
[0080] The communication unit 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.
[0081] In one possible implementation, the storage location of the copy of the target data on the storage server overlaps with the storage location of the copy of the original data on the storage server, or the copy of the target data and the copy of the original data are stored in data blocks that need to maintain consistency.
[0082] In an eighth aspect, the present application provides a storage device, comprising:
[0083] a communication unit, configured to receive a write request sent by a coordination server, the write request including transaction data distribution information and a piece of transaction data information, the write request being one of at least one write request generated by the coordination server based on a received transaction, the storage server being one of a plurality of storage servers where a copy of original data corresponding to the transaction data information included in the at least one write request is located, the transaction including at least one piece of transaction data information, each piece of transaction data information including storage location information of a copy of the original data on the storage server and a write operator, the transaction data distribution information indicating a storage server storing each copy of the original data corresponding to each piece of transaction data information included in the transaction;
[0084] a processing unit, configured to operate on a copy of original data corresponding to the transaction data information included in the write request according to the transaction data information;
[0085] The communication unit is further configured to send the execution result of the write request to the coordination server;
[0086] The processing unit is further configured to determine that no operation information sent by the coordination server is received within a preset time after the execution result of the write request is sent to the coordination server, and 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 based on the transaction data distribution information;
[0087] A commit operation or a rollback operation is performed according to the execution result of the at least one write request obtained by the query.
[0088] In the ninth aspect, the present application provides a coordination server comprising 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 executes the method provided by the third aspect or any possible implementation of the third aspect.
[0089] In the tenth aspect, the present application provides a storage server comprising 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 executes the method provided in the fourth aspect or any possible implementation of the fourth aspect.
[0090] In the eleventh aspect, the present application provides a storage server comprising 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 executes the method provided in the fifth aspect or any possible implementation of the fifth aspect.
[0091] In the twelfth aspect, the present application provides a non-transitory computer-readable storage medium, which stores a computer program, and when the computer program is executed by a coordination server, implements the method provided by the third aspect or any possible implementation of the third aspect.
[0092] In the thirteenth aspect, the present application provides a non-transitory computer-readable storage medium, which stores a computer program, and when the computer program is executed by a storage server, it implements the method provided by the fourth aspect or any possible implementation of the fourth aspect.
[0093] In the fourteenth aspect, the present application provides a non-transitory computer-readable storage medium, which stores a computer program. When the computer program is executed by a storage server, it implements the method provided by the fifth aspect or any possible implementation of the fifth aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0094] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for describing the embodiments or the prior art.
[0095] Figure 1 This is a schematic diagram of the system architecture of a distributed system provided in an embodiment of the present application;
[0096] Figure 2 This is a schematic diagram of a two-phase commit interaction provided by an embodiment of the present application;
[0097] Figure 3 This is a schematic diagram of executing a commit operation or a rollback operation provided in an embodiment of the present application;
[0098] Figure 4 This is another interactive diagram of a two-phase commit provided in an embodiment of the present application;
[0099] Figure 5 This is an interactive diagram of a transaction submission provided by an embodiment of the present application;
[0100] Figure 6 This is an interactive diagram of executing a read request provided by an embodiment of the present application;
[0101] Figure 7This is another interactive diagram of transaction submission provided by an embodiment of the present application;
[0102] Figure 8 This is a schematic diagram of the structure of a coordination device provided in an embodiment of the present application;
[0103] Figure 9 is a structural diagram of a storage device provided in an embodiment of the present application;
[0104] Figure 10 is a structural diagram of another storage device provided in an embodiment of the present application;
[0105] Figure 11 This is a schematic diagram of the structure of a coordination server provided in an embodiment of the present application;
[0106] Figure 12 This is a schematic diagram of the structure of a storage server provided in an embodiment of the present application;
[0107] Figure 13 This is a structural diagram of another storage server provided in an embodiment of the present application. DETAILED DESCRIPTION
[0108] The terms "first" and "second" in the embodiments of this application are used for descriptive purposes only and should not be understood to indicate or imply relative importance or implicitly specify the number of technical features indicated. Therefore, features specified as "first" or "second" may explicitly or implicitly include one or more of the features.
[0109] First, some concepts involved in the embodiments of this application are introduced.
[0110] A transaction is a logical unit within a database management system's execution process, consisting of a finite sequence of database operations. To ensure data accuracy and reliability, transactions must possess four properties: atomicity, consistency, isolation, and durability. Atomicity means that all operations within a transaction are either fully completed or not completed, and will not terminate at any intermediate stage. If a transaction encounters an error during 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 the transaction begins. Isolation means that the database allows multiple concurrent transactions to read, write, and modify data simultaneously. Isolation prevents data inconsistencies caused by cross-execution of multiple transactions. Durability means that after a transaction completes, changes to the data are permanent and will not be lost even in the event of a system failure.
[0111] Participants assume the role of executors during the transaction execution process, and are used to receive transaction requests sent by the coordinator and perform specified operations on the data specified in the transaction request. Among them, a transaction includes transaction requests for one or more data, and the transaction request is a read request or a write request. In a distributed system, data is stored in different storage servers. Since each storage server may fail, in order to improve the reliability of the data, it is necessary to establish a redundant relationship for the data, such as by establishing copies or erasure code verification for the data to improve the system fault tolerance. In the embodiment of the present application, the redundant relationship is described as a copy, and other redundant relationships are also applicable. During the execution of a transaction, multiple copies of the same target data are stored as a participant, wherein the above-mentioned target data is one or more data requested to be operated in the transaction request, one of the above-mentioned multiple copies is the primary copy, and the rest are backup copies. It can be understood that when server resources are sufficient, multiple copies of the same data are distributed on different storage servers, and then one participant corresponds to one or more storage servers. In the embodiment of the present application, multiple copies of the same data are distributed on different storage servers as an example.
[0112] The coordinator plays a coordinating role during transaction execution. In a distributed system, when a transaction spans multiple participants (i.e., a transaction includes transaction requests that are executed by multiple participants), each participant can determine the results of its own transaction request but cannot know the results of other participants' transaction requests. To maintain these transactional properties, a coordinator is introduced to manage the results of transaction requests and instruct the storage server whether to commit the results of transaction requests, for example, replacing the original data with updated data.
[0113] Exemplarily, the distributed system includes one or more service servers, one or more coordinator servers (coordinators), and multiple storage servers. Figure 1 In the example, a distributed system includes a business server, a coordinator server and multiple storage servers. The coordinator is used to receive transaction requests sent by the business server and send the transaction requests to one or more participants for execution. Each participant includes multiple copies, each storage server includes multiple logical storage nodes, and multiple copies of the same data are stored in the logical storage nodes of different storage servers. Each storage server includes multiple logical storage nodes, and each logical storage node can be a chunk in 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 include three copies of the same data, logical storage nodes P12, P22, and P32 include three copies of the same data, and logical storage nodes P13, P23, and P33 include 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. Of the multiple copies, one is the primary copy, and the rest are backup copies. For example, P11 is the primary copy of its participant, and P12 and P13 are backup copies of their participants.
[0114] Two-phase commit is a method designed for transaction commit based on distributed system architecture. It includes the prepare phase and the commit phase. Figure 2 As shown, taking the transaction request included in the transaction sent by the business server as a write request as an example, the prepare phase includes:
[0115] a. After receiving the transaction sent by the business server, the coordinator forwards one or more write requests included in the transaction to the participants where the original data of the requested operation in each write request is located. Figure 2 In the example, participant 1 receives the first write request, participant 2 receives the second write request, and participant n receives the nth write request.
[0116] b. After receiving the write request, each participant executes the write request. 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. The target data is only temporarily stored.
[0117] c. The participant sends the operation result to the coordinator. If the participant can successfully obtain the target data based on the original data of the write request in step b, the operation result of successful operation is sent to the coordinator. If the participant cannot successfully obtain the target data based on the original data of the write request in step b, the operation result of failed operation is sent to the coordinator. Figure 2 In the example, participant 1 generates a first operation result according to the execution status of the first write request, participant 2 generates a second operation result according to the execution status of the second write request, and participant n generates an nth operation result according to the execution status of the nth write request.
[0118] The commit phase includes:
[0119] d. The coordinator determines the execution result of the write request based on the operation results sent by each participant and sends a commit command or a rollback command to each participant. If the operation results of each participant are all successful, the coordinator determines that the execution result of the write request is a success and sends a commit command to each participant. If at least one of the operation results of each participant is a failure, the coordinator determines that the execution result of the write request is a failure and sends a rollback command to each participant. Figure 2 In the example, the execution result of the write request is the commit instruction.
[0120] e. Each participant executes the received commit command or rollback command. When the coordinator sends a commit command, each participant executes the commit operation and replaces the original data with the target data; when the coordinator sends a rollback command, each participant executes the rollback operation and deletes the temporarily stored target data. Figure 3 As shown, the target data obtained after performing a write operation on the original data A is B. Before receiving the commit instruction or the rollback instruction, the target data B is temporarily stored. If the participant performs a commit operation according to the commit instruction, A is replaced by B. If the participant performs a rollback operation according to the rollback instruction, the temporarily stored target data B is deleted.
[0121] f. Each participant sends a confirmation message to the coordinator, which indicates that the commit operation is complete or the rollback operation is complete. Figure 2 In the example, participant 1 generates the first confirmation information, participant 2 generates the second confirmation information, and participant n generates the nth confirmation information.
[0122] After receiving the confirmation messages from each participant, the coordinator returns the transaction execution result to the business server.
[0123] 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 for each replica of the same data are distributed across different storage servers. Therefore, during the preparation phase, after a participant receives a write request from the coordinator, an interactive relationship occurs between the multiple replicas within that participant. Specifically, the coordinating server sends the write request corresponding to each participant to the logical storage node where the primary replica of each participant resides. The storage server where the primary replica resides forwards the write request to the storage server storing the backup replica. The multiple logical storage nodes that receive the write request then execute the operations in the write request and, via the storage server storing the primary replica, send the operation results from each storage server storing the backup replica to the coordinating server. During the commit phase, the coordinating server determines whether the write request was successfully executed 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 interactions between logical storage nodes and between logical storage nodes and the coordinator are all conducted through the storage servers where each logical storage node resides.
[0124] For example, take the case where there are three copies of data in a distributed system. The above write request requires modification of two original data, where the first original data is distributed in the logical storage nodes P11, P21 and P31, which are located in the storage servers P1, P2 and P3 respectively. The second original data is distributed in the logical storage nodes P33, P43 and P53, which are located in the storage servers P3, P4 and P5 respectively. That is, P11, P21 and P31 are one participant, P33, P43 and P53 are one participant, and P11 and P43 store the primary copy. Then Figure 4 As shown in the figure, during the two-phase commit process, the interaction process between logical storage nodes in the distributed system is as follows:
[0125] The prepare phase includes:
[0126] a. The coordination server first sends a first write request to the logical storage node P11 where the primary copy of the first original data is stored, and sends a second write request to the logical storage node P43 where the primary copy of the second original data is stored, wherein the first write request and the second write request are included in the transaction received by the coordination server, the first write request indicates modification of the first original data, and the second write request indicates modification of the second original data.
[0127] b. P11 sends the received first write request to P21 and P31 storing the backup copy, and P43 sends the received second write request to P33 and P53 storing the backup copy.
[0128] c. P11, P21, and P31 respectively execute the corresponding operations in the first write request, and P33, P43, and P53 respectively 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, where the operation results indicate whether the write request operation is successful or failed.
[0129] P11 determines the execution result of the first write request based on the operation results of P11, P21, and P31, and 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 result of the first write request and the execution result of the second write request to the coordination server, respectively. When the operation results of P11, P21, and P31 are all successful, P11 determines the execution result of the first write request as a success. When the operation results of any one or more of P11, P21, and P31 are failures, P11 determines the execution result of the first write request as a failure. The method by which P43 determines whether the execution result of the second write request is a success or a failure is similar.
[0130] The commit phase includes:
[0131] d. The coordination server sends a commit instruction or a rollback instruction to P11 and P43 according to the execution results of the first write request and the execution results of the second write request fed back by P11 and P43. Figure 4 In the example, the execution result of the write request is the commit instruction.
[0132] e. P11 sends the received commit instruction or rollback instruction to P21 and P31, and P43 sends the received commit instruction or rollback instruction to P33 and P53. Figure 4 Take the commit instruction as an example.
[0133] f, P11, P21, P31, and P33, P43, and P53 execute the received commit or rollback instructions. When a commit instruction is received, each logical storage node performs a commit operation, replacing the original data with the updated target data; when a rollback instruction is received, each logical storage node performs a rollback operation. P21 and P31 then provide a first confirmation message (commit operation completed or rollback operation completed) to P11, and P33 and P53 provide a second confirmation message (commit operation completed or rollback operation completed) to P43.
[0134] During the execution of these transactions, the coordinator and participants need to interact twice, and the primary and backup replicas within the same participant need to interact twice, resulting in longer transaction commit delays. Furthermore, if the coordinator server fails during transaction execution, resources requested by the storage server during the transaction cannot be released in a timely manner, causing the system to become blocked. Other blocked transactions will continue to wait until the resources associated with the original transaction are released.
[0135] The present application embodiment provides a transaction submission method, which is applied to Figure 1 In the distributed system shown, the business server sends a transaction to the coordination server, and the coordination server sends one or more write requests included in the transaction to the corresponding storage server for execution based on the data distribution information of the distributed system and the transaction data information in the transaction. Each storage server performs corresponding operations based on the received write request and sends its own execution results 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 submission method provided by this application is described in detail below in conjunction with the accompanying drawings from the two aspects of whether the transaction request is a write request or a read request. Figure 4 As shown, when the transaction request is a write request, the transaction commit method includes:
[0136] S301: The business server sends a transaction to the coordination server.
[0137] In an embodiment of the present 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 a distributed database, and each transaction data information includes storage location information of the original data and an operator, the storage location information includes an address or data identifier, and the operator indicates a write operation on the original data.
[0138] The coordination server stores the distributed system's data distribution information, which records the logical storage node where each piece of data resides and the storage server to which each logical storage node belongs. Based on the original data's storage location information and data distribution information, the coordination server can determine the logical storage node and storage server to which the original data resides in the distributed database.
[0139] S302: The coordination server generates one or more write requests according to the transaction sent by the business server, and sends each write request to a corresponding storage server.
[0140] 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 data information, and can obtain a query result corresponding to the transaction data information. The query result includes the logical storage node where each copy of the original data for the write operation indicated by the transaction data information is located and the storage server where each logical storage node is located, wherein each copy of the original data corresponds to a logical storage node. Based on each transaction data information and the data distribution information, the coordination server can determine the query results corresponding to all transaction data information in the transaction, merge the query results corresponding to all transaction data information included in the transaction, and obtain transaction data distribution information. The transaction data distribution information indicates the storage server where each copy of the original data corresponding to the storage location information in each transaction data information in the transaction is located.
[0141] After determining the 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 in the transaction. Each write request includes transaction data information, a transaction data identifier, and the transaction data distribution information. Each write request is then sent to the storage server where each replica of the original data corresponding to the transaction data information included in each write request is located.
[0142] For example, taking a transaction including three transaction data information, where each transaction data information indicates a write operation on an original data, the first transaction data information indicates an addition operation on the data of the second field recorded in page 1; the second transaction data information indicates an addition operation on the data of the fifth field recorded in page 2; and the third transaction data information indicates a subtraction operation on the data of the third field recorded in page 3, that is, the transaction indicates a write operation on three original data.
[0143] Based on the above data distribution information, the coordination server determines that page 1 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; page 2 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 page 3 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 the three transaction data information are block 1, block 2, and block 3, respectively. Based on the logical storage nodes and storage servers corresponding to the three transaction data information, the coordination server determines the transaction data distribution information corresponding to the transaction. The transaction data distribution information corresponding to the transaction is shown in Table 1 below.
[0144] Table 1
[0145]
[0146] After determining the logical storage node and storage server corresponding to each of the transaction data information, the coordination server generates three write requests based on the three transaction data information, the three transaction data identifiers, and the transaction data distribution information. The first write request includes the first transaction data information, the three transaction data identifiers, and the transaction data distribution information, i.e., the first write request instructs to perform an increment operation on the data in the second field recorded in page 1. The second write request includes the second transaction data information, the three transaction data identifiers, and the transaction data distribution information, i.e., the second write request instructs to perform an increment operation on the data in the fifth field recorded in page 2. The third write request includes the third transaction data information, the three transaction data identifiers, and the transaction data distribution information, i.e., the third write request instructs to perform a decrement operation on the data in the third field recorded in page 3. The coordination 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.
[0147] The coordination server generates one or more write requests based on the transaction data information in the received transaction, and then sends each write request directly to the storage server where each copy of the original data corresponding to the transaction data information included in each write request is located based on the pre-stored data distribution information of the distributed system. This avoids the coordination server first sending the write request to the storage server where the primary copy of the original data corresponding to the transaction data information is located, and then the primary copy sends the write request to the corresponding backup copy, thereby improving the efficiency of sending write requests to each storage server.
[0148] S303: The storage server performs a corresponding write operation according to the received write request.
[0149] After receiving the write request sent by the coordination server, each storage server performs a corresponding write operation on the original data indicated by the transaction data information in the write request according to the write request received by each storage server. Exemplarily, after receiving the above-mentioned write request, storage server 1, storage server 2, storage server 3, and storage server 4 perform a corresponding write operation on the original data of the specified field in the transaction data information according to the specific operation indicated by the write request received by each storage server. For example, the above-mentioned storage server 1 receives the first write request, the second write request, and the third write request. The logical storage node 11 in the storage server 1 performs an addition operation on the data of the second field of page 1, the logical storage node 12 performs an addition operation on the data of the fifth field of page 2, and the logical storage node 13 performs a subtraction operation on the data of the third field of page 3. The above-mentioned storage server 2 receives the first write request and the second write request. The logical storage node 21 in the storage server 2 performs an addition operation on the data of the second field of page 1, and the logical storage node 22 performs an addition operation on the data of the fifth field of page 2. Each storage server temporarily stores the target data obtained after performing a write operation on the original data, but does not replace the original data with the target data.
[0150] S304: The storage server sends the execution result of the write request to the coordination server.
[0151] After the storage servers that receive the write requests perform the corresponding write operations on the data in the specified fields of the write requests they receive, they send the execution results to the coordination server, where each write request corresponds to an execution result, and the execution result indicates whether the storage server executes the write request successfully or fails. Successful execution indicates that the storage server performs the write operation on the original data specified in the write request to obtain the target data, and failed execution indicates that the storage server cannot perform the write operation on the original data specified in the write request to obtain the target data.
[0152] If the storage server successfully executes the write operation on the specified data in the received write request, the execution result of the successful execution of the write request is sent to the coordination server. If the storage server fails to execute the write operation on the specified data in the received write request, the execution result of the failed execution of the write request is sent to the coordination server. For example, the above-mentioned coordination server sends the first write request, the second write request and the third write request to the storage server 1, then the storage server 1 needs to feedback the three execution results corresponding to the execution of the above-mentioned three write requests to the coordination server. For example, the logical storage node 11 in the above-mentioned storage server 1 can successfully execute the write operation on the data in page1, that is, the storage server 1 can successfully execute the first write request, then the storage server 1 will send the execution result of the successful execution of the first write request to the coordination server; if the logical storage node 12 in the storage server 1 cannot successfully execute the write operation on the data in page2, that is, the storage server 1 cannot successfully execute the second write request, then the storage server 1 sends the execution result of the failed execution of the second write request to the coordination server.
[0153] S305: The coordination server determines the transaction processing result according to the execution result sent by the storage server, and sends the transaction processing result to the business server.
[0154] After receiving the execution results corresponding to each write request sent by each storage server, the coordination server determines the transaction processing result based on the execution results sent by each storage server and sends the transaction processing result to the business server. Specifically, when the coordination server receives that the execution results of the received write requests from each storage server are all successful, the coordination server determines that the transaction processing result of the above transaction is a successful process and sends a transaction processing success message to the above business server. When the coordination server receives that any one or more execution results are execution failures, the coordination server determines that the transaction processing result of the above transaction is a processing failure and sends a transaction processing failure message to the business server. For example, the execution results sent by the above storage servers 1, 2, and 4 are all successful, and the logical storage node 33 in the storage server 3 fails to execute the subtraction operation on the data in page 3, that is, the storage server 3 fails to execute the third write request. Then, the coordination server will receive an execution result of failure sent by the storage server 3, and the coordination server determines that the transaction processing result of the above write request is a processing failure, and sends a transaction processing failure message to the above business server.
[0155] After the storage server that receives the write request executes the received write request, each storage server will feed back the execution result of the write request to the coordination server. The coordination server can determine the transaction processing result of the transaction based on the execution results fed back by each storage server, and then return the transaction processing result of the above transaction to the business server, thereby realizing one-stage transaction submission, reducing the delay in write request processing, and improving the processing efficiency of write requests and the work efficiency of business servers.
[0156] The above-mentioned coordination server determines the transaction processing result based on the execution result sent by the storage server, and after sending the transaction processing result to the business server, the coordination server does not send a commit instruction or a rollback instruction to each storage server. If the storage server receives a read request after executing a write request, the storage server receiving the read request needs to first determine whether the target data that needs to be read by the received read request is related to the original data that needs to be operated by the previously executed write request. If so, the storage server receiving the read request needs to first determine whether the transaction to which the previously executed write request belongs needs to perform a commit operation or a rollback operation, and then execute the received read request after performing the commit operation or the rollback operation. Among them, the target data that the read request needs to read is related to the original data that the write request needs to operate on, which means that the target data that the read request needs to read is the same as the original data that the write request needs to operate on, the target data that the read request needs to read overlaps with the original data that the write request needs to operate on, the storage location of the target data that the read request needs to read overlaps with the storage location of the original data that the write request needs to operate on, or the target data that the read request needs to read and the original data that the write request needs to operate on belong to the same storage area, and the storage area can be a data block or a data chunk. The following is combined with Figure 6 , describes the processing process when the storage server receives a read request after executing a write request.
[0157] S601: The coordination server receives a read request sent by the business server, and sends the read request to a target storage server.
[0158] The above-mentioned read request includes the storage location information and operator of the target data to be read. After receiving the read request, the coordination 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, and obtains the query result corresponding to the read request. The query result includes the multiple logical storage nodes where the multiple copies of the target data to be read by the above-mentioned read request are located, and the multiple storage servers where the multiple logical storage nodes are located, wherein each copy corresponds to a logical storage node, and each logical storage node corresponds to a storage server. The coordination server then determines the target storage server from the multiple storage servers included in the query result, and sends the above-mentioned read request to the target storage server. The target storage server is any one of the multiple storage servers where the above-mentioned target data is located. For example, the target storage server can be the one closest to the coordination server among the multiple storage servers where the target data to be read in the read request is located, or the coordination server with the fastest access speed among the multiple storage servers where the target data to be read in the read request is located.
[0159] S602: The target storage server sends a query request to one or more storage servers according to the read request.
[0160] After receiving the above-mentioned 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. In this case, the target storage server cannot directly read the above-mentioned target data. The target storage server needs to first determine the transaction processing result of the transaction to which the above-mentioned target write request belongs, and determine to perform a commit operation or a 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 above-mentioned target write request includes part or all of the one or more write requests received by the target storage server before receiving the read request. In the embodiment of the present application, the target write request includes one write request as an example.
[0161] The target storage server will determine 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, and then send a query request to these multiple storage servers. The query request includes the 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 send the queried execution results to the above-mentioned target storage server.
[0162] S603: The target storage server receives the query result, performs a commit operation or a rollback operation according to the query result, and executes a read request to obtain the target data and send it to the coordination server.
[0163] The target storage server determines the transaction processing result of the transaction to which the target write request belongs based on the execution results returned by the 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 in 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 a failure, 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 target storage server executes the received read request, obtains the target data required by the read request, and sends the target data to the coordination server.
[0164] For example, the target storage server is storage server 1. After executing the first, second, and third write requests, storage server 1 receives a read request. The target data to be read by the read request 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 coordination server, that the coordination 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. Storage server 1 then determines the execution results of the first, second, and third write requests and sends a query request to storage servers 2, 3, and 4. The query request includes transaction data identifier block 1 corresponding to the first write request, transaction data identifier block 2 corresponding to the second write request, and transaction data identifier block 3 corresponding to the third write request. The 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 the storage server 2 receives the first write request and the second write request, the storage server 2 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 the storage server 1 respectively.
[0165] After receiving the execution results returned by storage servers 2, 3, and 4, storage server 1 performs a commit operation if each of the three servers successfully executes the write request received. If any of the three servers fails to execute the write request, storage server 1 performs a rollback operation.
[0166] After the storage server 1 performs a commit operation or a 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 the storage server 1, the coordination server sends the target data to the business server.
[0167] Without sending a commit instruction or a rollback instruction to the storage server, if the storage server receives a read request and the target data to be read by the read request is related to the original data to be operated by a write request previously received by the storage server, the storage server can determine the transaction processing result of the transaction to which the write request belongs based on the transaction data identifier and transaction data distribution information in the write request, perform a commit operation or a rollback operation on the transaction to which the write request belongs based on the transaction processing result, and then execute the received read request. By determining the transaction processing result of the transaction corresponding to the write request through the storage server, the amount of data processed by the business server is reduced, thereby improving the efficiency of the business server.
[0168] In a possible implementation, after the target storage server receives the above-mentioned read request and determines the above-mentioned target write request, since the coordination server has 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 coordination server to query the transaction processing result of the transaction to which the target write request belongs. If the target storage server receives the transaction processing result sent by the coordination server as 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 the transaction processing result sent by the coordination server as failed 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 to obtain the target data that the read request needs to read and send the target data to the coordination server.
[0169] See also Figure 7In the above S305, after the coordination server sends the transaction processing result to the business server, the coordination server can generate operation information based on the execution result of the write request fed back by the storage server that received the write request, and the operation information instructs the storage server to perform a commit operation or a rollback operation. If the execution results fed back by the storage server that received the write request are all successful, the coordination server generates the operation information as a commit instruction, and sends the commit instruction to each storage server. After each storage server receives the commit instruction sent by the coordination server, each logical storage node in each storage server performs a commit operation. If any of the execution results fed back by the storage server that received the write request is an execution failure, the coordination server generates the operation information as a rollback instruction, and sends the rollback instruction to each storage server. After each storage server receives the rollback instruction sent by the coordination server, it performs a rollback operation.
[0170] In S302 above, after the coordination server generates multiple write requests based on the transaction and sends these multiple write requests to some or all of the corresponding multiple storage servers, and before sending a commit instruction or a rollback instruction to all of the multiple storage servers, the coordination server may fail or the network card may experience packet loss, resulting in the storage server that received the write request not receiving the commit instruction or rollback instruction sent by the coordination server. At this time, the storage server that received the write request needs to determine whether the transaction to which the received write request belongs needs to perform a commit operation or a rollback operation. The following describes the transaction execution process when the coordination server fails.
[0171] In an embodiment of the present application, the storage server has the ability to perceive the failure of the coordination server. For example, the storage server that receives the write request executes the operations in the above S303 and the above S304. If after executing the above S304, no commit instruction or rollback instruction is received from the coordination server within a preset time period, the storage server that receives the write request determines that the coordination server has failed.
[0172] The storage server that receives the write request determines, based on the transaction data distribution information in the received write request, multiple storage servers included in the transaction data distribution information. The storage server then sends a query request to the storage servers other than itself among the multiple storage servers. The query request includes the multiple transaction data identifiers included in the write request. The query request instructs the storage server that receives the query request to query for execution results of the write request corresponding to the multiple transaction data identifiers in the query request, and to send the queryed execution results to the storage server that sent the query request. The storage server that receives the write request generates operation information based on the received execution results.
[0173] The above-mentioned storage server that receives the write request can be all storage servers that receive the write request. In this case, each storage server that receives the write request needs to send a query request to other storage servers, and then generate operation information based on the received execution result. The above-mentioned storage server that receives the write request can also be any storage server, for example, the first storage server that determines that the coordination server has failed. In the case that the storage server that receives the write request is a storage server, among the storage servers that receive the write request, the first storage server that determines that the coordination server has failed generates operation information based on the queried execution result, determines to perform a commit operation or a rollback operation based on the operation information, and sends the generated operation information to multiple storage servers included in the transaction data distribution information.
[0174] Illustratively, after storage server 1 determines that the coordination server has failed, storage server 1 determines, based on the transaction data distribution information, that the coordination server has sent the first write request, the second write request, and the third write request to storage server 1, storage server 2, storage server 3, and storage server 4. Therefore, storage server 1 sends a query request to storage server 2, storage server 3, and storage server 4, instructing storage server 2, storage server 3, and storage server 4 to query the execution results of each of the received first write request, second write request, and third write request, and sends the execution results of the write requests to storage server 1.
[0175] After storage server 1 receives the execution results returned by storage server 2, storage server 3, and storage server 4, if storage server 1, storage server 2, storage server 3, and storage server 4 all successfully execute the write requests they received, storage server 1 determines that the transaction processing result is successful, the operation information generated by storage server 1 is a commit instruction, and the commit instruction is sent to storage server 2, storage server 3, and storage server 4, and then the commit operation is performed. If any one or more of the write requests from storage server 1, storage server 2, storage server 3, or storage server 4 fail to execute, storage server 1 determines that the transaction processing result is a failure, the operation information generated by storage server 1 is a rollback instruction, and the rollback instruction is sent to storage server 2, storage server 3, and storage server 4, and then the rollback operation is performed.
[0176] Optionally, when a coordination server fails, some storage servers may receive operation information sent by the coordination server. After receiving query requests sent by other storage servers, the storage servers that received the operation information determine the write request queried by the query request based on the transaction data identifier in the query request, and then determine the transaction corresponding to the operation information to which the write request belongs, and then send the operation information to the storage server that sent the query request. For example, if storage server 1 receives the operation information sent by the coordination server as a commit instruction, after storage server 1 receives query requests sent by other storage servers, storage server 1 determines that the transaction corresponding to the write request queried by the query request belongs to a commit instruction, and then sends the commit instruction to the storage server that sent the query request.
[0177] By sending transaction data distribution information to the storage server, when the storage server senses that the coordination server has failed, it queries other storage servers included in the transaction data distribution information for the execution results of the write request executed by other storage servers based on the transaction data distribution information, and then determines to execute a commit operation or a rollback operation based on the execution results of other storage servers. This prevents the storage server from not being able to release the system resources applied for executing the above write request when it does not receive the operation information from the coordination server, causing the system to be blocked and unable to execute new transactions, and can improve the reliability of the system.
[0178] In a specific embodiment, during the execution of a transaction, the storage server may also fail, causing the storage server to be unable to execute the write request or to be unable to return the execution result to the coordination server after executing the write request. When the coordination server does not receive the execution result of the storage server within a preset time period, it determines that the storage server has failed. At this time, in order to maintain the consistency of the number of data backups in the system, the distributed system will select a replacement storage server from other storage servers to replace the failed storage server, and restore the data in the failed storage server in the replacement server based on the corresponding copy of the data in the failed storage server. After the coordination server determines the information of the above-mentioned replacement storage server, the coordination server resends the corresponding write request to the above-mentioned replacement storage server, and then the replacement storage server that receives the write request executes the write operation specified in the write request, and sends the execution result of the write request to the coordination server.
[0179] Continuing with the example of the coordinating server sending a write request to storage servers 1, 2, 3, and 4, when storage server 2 fails, the distributed system selects storage server m to replace storage server 2 and, based on the replica of the data in storage server 2, restores the data in 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 in the transaction data distribution information with storage server m. It then sends the write request sent to storage server 2 to storage server m and the updated transaction data distribution information to storage servers 1, 3, and 4. After receiving the write request, storage server m performs the operation specified in the write request and then sends the execution result of the write request to the coordinating server. The coordinating server then determines the transaction processing result based on the execution results of storage servers 1, 3, 4, and m.
[0180] Combined with the above Figures 1 to 7 The transaction submission system provided by this application is described in detail. Figures 8 to 13 , describes the relevant devices and equipment for implementing transaction submission provided by this application. Figure 8 , Figure 8 8 is a schematic diagram of a coordination device according to an embodiment of the present application, wherein the coordination device 800 includes a communication unit 810 and a processing unit 820. The communication unit 810 is used to communicate with a service server and a storage server (storage device).
[0181] Communication unit 810 is configured to receive a transaction sent by a business server. The transaction includes at least one transaction data message. 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 information included in the transaction can be found in the description of S302 above and is not further described here.
[0182] Processing unit 820 is used 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.
[0183] The processing unit 820 is further configured to generate at least one write request based on the received transaction, each write request including the transaction data distribution information and a transaction data information. The specific operation of the processing unit 820 generating the write request can refer to the relevant description in the above S302.
[0184] Communication unit 810 is further configured to send each of the aforementioned write requests to a storage server where a copy of the original data corresponding to the transaction data information included in each write request is located. Communication unit 810 is also configured to receive an execution result from each storage server that receives the write request. The execution result is the result of the operation performed by the storage server that receives the write request on the copy of the original data corresponding to the transaction data information included in the write request. The operation of communication unit 810 sending each write request to the corresponding storage server may be as described in S302 above.
[0185] The processing unit 820 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 receives the write request. The operation of the processing unit 820 determining the transaction processing result can be referred to the relevant description in S305 above and will not be repeated here.
[0186] The communication unit 810 is further configured to send the transaction processing result to the service server.
[0187] The coordination device 800 may further include a storage unit 830, and the storage unit 830 is used to store the above-mentioned data distribution information.
[0188] Specifically, the specific operations of the coordination device 800 to implement distributed fact service submission can refer to the operations performed by the coordination server in the above method embodiment. For example, the processing unit 820 is used to execute the operations performed by the coordination server in the above S301~S305 or S601~S603, which will not be repeated here.
[0189] See also Figure 9 , Figure 9 1 is a schematic diagram of the structure of a storage device provided by the present application, wherein 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).
[0190] Communication unit 910 is used to receive a write request sent by a coordination server, where the write request includes transaction data distribution information and a transaction data message. The write request is any one or more of at least one write request 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 message included in the at least one write request is located. The transaction includes at least one transaction data message, and the transaction data distribution information indicates the storage server that stores 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 the description in S301 above and will not be repeated here.
[0191] Processing unit 920, based on the transaction data information, performs an operation on the copy of the original data corresponding to the transaction data information included in the write request. Communication unit 910 transmits the execution result of the write request to the coordination server. The operations performed by processing unit 920 in response to the received write request can refer to the operations performed by the storage server in S303 and S304 above and are not further described here.
[0192] The communication unit 910 is further configured to receive a read request sent by the coordination server, wherein the read request includes the storage location of the target data copy on the storage server and a read operator. For specific information included in the read request, please refer to the description in S601 above.
[0193] The processing unit 920 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 in the received write request; performs a commit operation or a rollback operation based on the execution result of the at least one write request obtained by the query; reads the target data based on the storage location of the copy of the target data on the storage device, and sends the read target data to the coordination server. The specific operation of the processing unit 920 querying the execution result of the at least one write request can refer to the operation of the target storage server sending a query request to one or more storage servers in S602 above; the method for the processing unit 920 to determine whether to perform a commit operation or a rollback operation based on the execution result fed back by each storage server that receives the write request can refer to the description of the target storage server performing a commit operation or a rollback operation based on the query result in S603 above, which will not be repeated here.
[0194] 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, where the operation information indicates 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 replica of the original data corresponding to each transaction data information included in the transaction. The method for generating the operation information by the processing unit 920 may refer to the method for generating the operation information by the target storage server in S603 above.
[0195] The storage device 900 further includes a storage unit 930 , which is used to store the original data to be operated by the above-mentioned write request and the target data to be read by the read request.
[0196] Specifically, the specific operations of the storage device 900 to implement distributed fact service submission can refer to the operations performed by the storage server in the above method embodiment. For example, the processing unit 920 is used to execute the operations performed by the storage server in the above S301~S305 or S601~S603, which will not be repeated here.
[0197] See also Figure 10 , Figure 10 1 is a schematic diagram of the structure of a storage device provided by the present application, wherein the storage device 1000 includes a communication unit 1010 and a processing unit 1020. The communication unit 910 is used to communicate with other storage servers (storage devices) and coordination servers (coordination devices).
[0198] Communication unit 1010 is used to receive a write request sent by a coordination server, where the write request includes transaction data distribution information and a transaction data message. The write request is one of at least one write request generated by the coordination server based on the received transaction. The storage server is one of multiple storage servers where a copy of the original data corresponding to the transaction data message included in the at least one write request is located. The transaction includes at least one transaction data message, each transaction data message includes 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 that stores 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 information, etc. can be referred to the description in S301 above and will not be repeated here.
[0199] Processing unit 1020 is configured to perform an operation 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 1010 is further configured to send the execution result of the write request to the coordination server. The operations performed by processing unit 1020 upon receiving the write request can refer to the operations performed by the storage server in S303 and S304 above and are not further described here.
[0200] The processing unit 1020 is further configured to determine that no operation information sent by the coordination server is received within a preset time after the execution result of the write request is sent to the coordination server, and 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 based on the transaction data distribution information; and perform a commit operation or a rollback operation based on the execution result of the at least one write request obtained from the query. The processing unit 1020 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, and performs operations based on the execution result of the at least one write request. The operations performed by the storage server after sensing a failure of the coordination server in the above-mentioned method embodiment can be referred to, and will not be repeated here.
[0201] Storage device 1000 further includes a storage unit 1030 for storing the original data required for the write request and the target data required for the read request. Processing unit 1020 performs the operations performed by the storage server in steps S301 to S305, as well as the operations performed by the storage server upon detecting a failure in the coordination server. These operations are not further described here.
[0202] See also Figure 11 , Figure 11 1 is a schematic diagram of the structure of a coordination server provided in an embodiment of the present application. The coordination server 1100 includes: one or more processors 1110, a communication interface 1120, and a memory 1130. Optionally, the processor 1110, the communication interface 1120, and the memory 1130 are interconnected via a bus 1140, wherein:
[0203] The processor 1110 is used to implement the operations performed by the processing unit 820. The specific implementation of the various operations performed by the processor 1110 can refer to the specific operations performed by the coordination server as the execution subject in the above method embodiment. Figure 5 The operations of the coordination server in S303 and S304 will not be described in detail here.
[0204] The processor 1110 can have a variety of specific implementation forms. For example, the processor 1110 can be a central processing unit (CPU) or a graphics processing unit (GPU). The processor 1110 can also be a single-core processor or a multi-core processor. The processor 1110 can be a combination of a CPU and a hardware chip. The above-mentioned hardware chip can be an application-specific integrated circuit (ASIC), a programmable logic device (PLD), or a combination thereof. The above-mentioned PLD can be a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof. The processor 1110 can also be implemented solely using a logic device with built-in processing logic, such as an FPGA or a digital signal processor (DSP).
[0205] The communication interface 1120 may be a wired interface or a wireless interface for communicating with other modules or devices. The wired interface may be an Ethernet interface, a local interconnect network (LIN), etc. The wireless interface may be a cellular network interface or a wireless local area network interface, etc.
[0206] In the embodiment of the present application, the communication interface 1120 performs the operations implemented by the communication unit 810. For example, it can be used to perform the above-mentioned S301 to receive the transaction sent by the business server, or receive the execution result of the storage server. Specifically, the actions performed by the communication interface 1120 can refer to the actions received or sent by the coordination server in the above-mentioned method embodiment, and will not be repeated here.
[0207] The memory 1130 may be a non-volatile memory, such as a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The memory 1130 may also be a volatile memory, such as a random access memory (RAM), which is used as an external cache.
[0208] 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. In addition, the coordination server 1100 may include a Figure 11 Show more or fewer components, or configure components differently.
[0209] The bus 1140 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus. The bus 1140 may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 11 Only one thick line is used in the diagram, but this does not mean that there is only one bus or one type of bus.
[0210] Optionally, the coordination server 1100 may further include an input / output interface 1150 , to which an input / output device is connected for receiving input information and outputting operation results.
[0211] Specifically, the specific implementation of the various operations performed by the coordination server 1100 can refer to the specific operations performed by the coordination server in the above method embodiment, which will not be repeated here.
[0212] See also Figure 12 , Figure 12 1 is a schematic diagram of the structure of a storage server provided in an embodiment of the present application. The storage server 1200 includes: one or more processors 1210, a communication interface 1220, and a memory 1230. Optionally, the processor 1210, the communication interface 1220, and the memory 1230 are interconnected via a bus 1240, wherein:
[0213] The processor 1210 is used to implement the operations performed by the processing unit 920. The specific implementation of the various operations performed by the processor 1210 can refer to the specific operations performed by the storage server as the execution subject in the above method embodiment. Figure 5 The operations performed by the storage server in S303 and S304, or the operations performed by the storage server in S301 to S305 and the operations performed by the storage server after sensing that the coordination server has failed, are not described in detail here.
[0214] The processor 1210 may be implemented in various forms. For example, the processor 1210 may be a central processing unit (CPU) or a graphics processor (GPU). The processor 1210 may also be a single-core processor or a multi-core processor. The processor 1210 may be a combination of a CPU and a hardware chip.
[0215] The communication interface 1220 may be a wired interface or a wireless interface, and for details, please refer to the communication interface 1120 .
[0216] In the embodiment of the present application, the communication interface 1220 performs the operations implemented by the communication unit 910, and can specifically be used to perform operations such as receiving transaction data identifiers, transaction data information, and transaction data distribution information in the above-mentioned S303, or performing 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 received or sent by the storage server in the above-mentioned method embodiment, and will not be repeated here.
[0217] The memory 1230 may be a non-volatile memory or a volatile memory, specifically referring to the memory 1130 .
[0218] 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. In addition, the storage server 1200 may include a plurality of storage devices, such as a plurality of storage devices, and a plurality of storage devices. Figure 12 Show more or fewer components, or configure components differently.
[0219] The bus 1240 may be a PCI bus or an EISA bus, etc., and specifically refers to the bus 1140 .
[0220] Optionally, the storage server 1200 may further include an input / output interface 1250 , to which an input / output device is connected, for receiving input information and outputting operation results.
[0221] Specifically, the specific implementation of the various operations performed by the server 1200 can refer to the specific operations performed by the storage server in the above method embodiment, which will not be repeated here.
[0222] See also Figure 13 , Figure 13 13 is a schematic diagram of the structure of a storage server provided in an embodiment of the present application. The storage server 1300 includes: one or more processors 1310, a communication interface 1320, and a memory 1330. Optionally, the processor 1310, the communication interface 1320, and the memory 1330 are interconnected via a bus 1340, wherein:
[0223] The processor 1310 is used to implement the operations performed by the processing unit 920. The specific implementation of the various operations performed by the processor 1310 can refer to the specific operations performed by the storage server as the execution subject in the above method embodiment. Figure 5 The operations performed by the storage server in S301 to S305 and the operations performed by the storage server after sensing the failure of the coordination server in the above method embodiment are not described in detail here.
[0224] The processor 1310 may have various specific implementation forms. For example, the processor 1310 may be a central processing unit or an image processor. The processor 1310 may also be a single-core processor or a multi-core processor. The processor 1310 may also be a combination of a CPU and a hardware chip.
[0225] The communication interface 1320 may be a wired interface or a wireless interface, and for details, please refer to the communication interface 1120 .
[0226] In the embodiment of the present application, the communication interface 1320 performs the operations implemented by the communication unit 910, and can specifically be used to perform operations such as receiving transaction data identifiers, transaction data information, and transaction data distribution information in the above-mentioned S303, or performing 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 received or sent by the storage server in the above-mentioned method embodiment, and will not be repeated here.
[0227] The memory 1330 may be a non-volatile memory or a volatile memory, specifically referring to the memory 1130 .
[0228] 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. In addition, the storage server 1300 may include a plurality of storage devices, such as a plurality of storage devices, and a plurality of storage devices. Figure 13 Show more or fewer components, or configure components differently.
[0229] The bus 1340 may be a PCI bus or an EISA bus, etc., and specifically refers to the bus 1140 .
[0230] Optionally, the storage server 1300 may further include an input / output interface 1350 , to which an input / output device is connected for receiving input information and outputting operation results.
[0231] An embodiment of the present application also provides a non-volatile computer-readable storage medium, in which a computer program is stored. When the computer program runs on a processor, the method steps executed by the coordination server in the above method embodiment can be implemented. The specific implementation of the processor of the computer storage medium in executing the above method steps can refer to the specific operations of the coordination server in the above method embodiment, which will not be repeated here.
[0232] An embodiment of the present application further provides a non-transitory computer-readable storage medium, in which a computer program is stored. When the computer program runs on a processor, the method steps executed by the storage server in the above method embodiment can be implemented. The specific implementation of the processor of the computer storage medium in executing the above method steps can refer to the specific operations of the storage server in the above method embodiment, which will not be repeated here.
[0233] In the above embodiments, the description of each embodiment has its own focus. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0234] The above embodiments can be implemented in whole or in part through software, hardware, firmware, or any other combination. When implemented using software, the above embodiments can be implemented in whole or in part in the form of 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, the processes or functions described in accordance with the embodiments of the present invention are generated in whole or in part. 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, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or data center that contains a collection of one or more available media. The available medium can be a magnetic medium (e.g., a floppy disk, hard disk, tape), an optical medium (e.g., a DVD), or a semiconductor medium. The semiconductor medium can be a solid state drive (SSD).
[0235] The steps in the method of the embodiment of the present application can be adjusted in order, combined or deleted according to actual needs; the modules in the device of the embodiment of the present application can be divided, combined or deleted according to actual needs.
[0236] The above is a detailed introduction to the embodiments of the present application. Specific examples are used herein to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method and core idea of the present application. At the same time, for those skilled in the art, according to the idea of the present application, there may be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A transaction processing system, characterized in that: Includes a coordination server and multiple storage servers; The coordination server is configured to receive a transaction, wherein the transaction includes at least one transaction data information, each transaction data information including storage location information of a copy of original data on a storage server and a write operator; determine the transaction data distribution information based on pre-stored data distribution information, wherein the data distribution information indicates a storage server storing each copy of each original data in the transaction processing system, and the transaction data distribution information indicates a 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 one 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 is configured to store the transaction data distribution information; perform an operation on a copy of the original data corresponding to the transaction data information included in the write request according to the transaction data information included in the write request; and send an execution result of the write request to the coordination server; The coordination server is further configured to determine a transaction processing result of the transaction according to an execution result of the write request sent by each storage server that receives the write request, and send the transaction processing result to the business server; The coordination server is further configured to receive a read request sent by the business server and send the read request to the storage server where the target data of the read request is located; The storage server that receives the read request is used to determine, based on the read request and one or more write requests received previously, whether the target data that needs to be read by the read request is related to the original data that needs to be written by the at least one write request, determine the transaction processing result of the transaction to which the at least one write request belongs, and determine whether to perform a commit operation or a rollback operation based on the transaction processing result.
2. The transaction processing system according to claim 1, wherein: The coordination server is specifically configured to receive a read request, the read request including a storage location of a copy of the target data on a storage server and a read operator; determine a storage server storing a 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; The storage server that receives the read request is specifically configured to query each storage server that receives the write request for an execution result of the write request based on the transaction data distribution information; and 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 receives the write request; After executing the commit operation or the rollback operation, reading the target data from a storage location on a storage server according to a copy of the target data; The read target data is sent to the coordination server.
3. The transaction processing system according to claim 2, wherein: The storage server that receives the read request is further configured to generate operation information according to the execution result of the write request, where the operation information indicates a commit operation or a rollback operation, and send the operation information to each storage server that receives the write request.
4. The transaction processing system according to claim 2 or 3, wherein: The storage location of the copy of the target data on the storage server overlaps with the storage location of the copy of the original data on the storage server, or the copy of the target data and the copy of the original data are stored in data blocks that need to maintain consistency.
5. The transaction processing system according to claim 2 or 3, wherein: The coordination server is configured to determine, based on the data distribution information, a plurality of storage servers storing copies of the target data; and select a target storage server from the determined plurality of storage servers storing copies of the target data; The read request is sent to the target storage server.
6. The transaction processing system according to claim 1, wherein: The coordination server is also used to determine the operation information that each storage server that receives the write request needs to execute based on the execution result of the write request sent by each storage server that receives the write request, the operation information indicating whether to perform a commit operation or a rollback operation, and send the operation information to each storage server that receives the write request.
7. The transaction processing system according to claim 6, wherein: The storage server that receives the write request is further configured to determine that the operation information sent by the coordination server has not been received within a preset time after the execution result of the operation is sent 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 based on the transaction data distribution information; Determine whether to execute the commit operation or the rollback operation according to the execution result.
8. 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 a transaction sent by the business server, wherein the transaction includes at least one transaction data information, and each transaction data information includes storage location information of a copy of the original data on the storage server and a write operator; The coordination server determines transaction data distribution information based on pre-stored data distribution information, wherein the data distribution information indicates a storage server storing each copy of each original data in the transaction processing system, and the transaction data distribution information indicates a storage server storing 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 a storage server where a 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 the copy of the original data corresponding to the transaction data information included in the write request according 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 of the transaction according to the write request execution result sent by each storage server that receives the write request, and sends the transaction processing result to the business server The coordination server receives the read request sent by the business server, and sends the read request to the storage server where the target data of the read request is located; The storage server that receives the read request determines, based on the read request and one or more write requests received previously, that the target data that needs to be read by the read request is related to the original data that needs to be written by the at least one write request, determines the transaction processing result of the transaction to which the at least one write request belongs, and determines whether to perform a commit operation or a rollback operation based on the transaction processing result.
9. The method according to claim 8, wherein The method further comprises: The coordination server receives a read request sent by the business server, where the read request includes a storage location of a copy of the target data on the storage server and a read operator; 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; The storage server that receives the read request queries each storage server that receives the write request for an execution result of 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 receives the write request; The storage server that receives the read request reads the target data from the storage location of the copy of the target data on the storage server, and sends the read target data to the coordination server.
10. The method according to claim 9, wherein The method further comprises: The storage server that receives the read request generates operation information according to the execution result of the write request, and sends the operation information to each storage server that receives the write request, where the operation information indicates a commit operation or a rollback operation.
11. The method according to claim 9 or 10, wherein: The storage location of the copy of the target data on the storage server overlaps with the storage location of the copy of the original data on the storage server, or the copy of the target data and the copy of the original data are stored in data blocks that need to maintain consistency.
12. The method according to claim 9 or 10, wherein: 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: The coordination server determines, based on the data distribution information, a plurality of storage servers storing copies of the target data; 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.
13. The method according to claim 8, wherein The method further comprises: The coordination server determines, based on the execution result of the write request sent by each storage server that receives the write request, operation information that each storage server that receives the write request needs to perform, where 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. The method according to claim 13, wherein The method further comprises: The storage server that receives the write request determines 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 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 based on 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.
15. A transaction processing method, characterized in that: The method comprises: The coordination server receives a transaction sent by the business server, wherein the transaction includes at least one transaction data information, and each transaction data information includes storage location information of a copy of the original data on the storage server and a write operator; The coordination server determines transaction data distribution information based on pre-stored data distribution information, wherein the data distribution information indicates a storage server storing each copy of each original data in the transaction processing system, and the transaction data distribution information indicates a storage server storing 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 a storage server where a 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 sent by each storage server that receives the write request; The coordination server determines a transaction processing result of the transaction according to an execution result of the write request sent by each storage server that receives the write request, and sends the transaction processing result to the business server; The coordination server receives the read request sent by the business server and sends the read request to the storage server where the target data of the read request is located; so that the storage server that receives the read request determines, based on the read request and one or more write requests received previously, that the target data that needs to be read by the read request is related to the original data that needs to be written by the at least one write request, and determines whether to perform a commit operation or a rollback operation based on the transaction processing result.
16. The method according to claim 15, wherein The method further comprises: The coordination server determines, based on the execution result of the write request sent by each storage server that receives the write request, operation information that each storage server that receives the write request needs to perform, where 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.
17. A transaction processing method, characterized in that: The method comprises: The storage server receives a write request sent by the coordination server, where the write request includes transaction data distribution information and a piece of transaction data information. The write request is one of at least one write request generated by the coordination server based on the received transaction. The storage server is one of multiple storage servers where a copy of original data corresponding to the transaction data information included in the at least one write request is located. The transaction includes at least one piece of transaction data information, each piece of transaction data information includes storage location information of a copy of the original data on the storage server and a write operator. The transaction data distribution information indicates a storage server that stores each copy of the original data corresponding to each piece of 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 according to the transaction data information, and sends an execution result of the write request to the coordination server; The storage server receives a read request sent by the coordination server, where the read request includes a storage location of a copy of the target data on the storage server and a read operator; The storage server queries, according to the transaction data distribution information, a storage server storing each copy of the original data corresponding to each transaction data information included in the transaction, for an execution result of the at least one write request; The storage server performs a commit operation or a rollback operation according to the execution result of the at least one write request obtained by the query.
18. The method according to claim 17, wherein The method further comprises: The storage server generates operation information according to the execution result of the at least one write request obtained by the query, where the operation information indicates a commit operation or a rollback operation; The storage server sends the operation information to a storage server storing each copy of the original data corresponding to each transaction data information included in the transaction.
19. The method according to claim 17 or 18, wherein: The storage location of the copy of the target data on the storage server overlaps with the storage location of the copy of the original data on the storage server, or the copy of the target data and the copy of the original data are stored in data blocks that need to maintain consistency.
20. A coordination device, characterized in that: The coordination device comprises: A communication unit, configured to receive a transaction sent by a business server, wherein the transaction includes at least one transaction data message, and each transaction data message includes storage location information of a copy of the original data on the storage server and a write operator; a processing unit, configured to determine transaction data distribution information based on pre-stored data distribution information, wherein the data distribution information indicates a storage server storing each copy of each original data in a transaction processing system, and the transaction data distribution information indicates a 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; The communication unit is further configured to send each write request to a storage server where a copy of the original data corresponding to the transaction data information included in each write request is located; receiving an execution result of the write request sent by each storage server that receives the write request; The processing unit is further configured to determine a transaction processing result of the transaction according to an execution result of the write request sent by each storage server that receives the write request; The communication unit is further configured to send the transaction processing result to the business server; The communication unit is also used to receive a read request sent by a business server and send the read request to a storage server where the target data of the read request is located; so that the storage server that receives the read request determines, based on the read request and one or more previously received write requests, that the target data that needs to be read by the read request is related to the original data that needs to be written by the at least one write request, and determines whether to perform a commit operation or a rollback operation based on the transaction processing result.
21. The device according to claim 20, wherein The processing unit is specifically configured to determine, based on an execution result of the write request sent by each storage server that receives the write request, operation information that needs to be executed by each storage server that receives the write request, where the operation information indicates whether to execute a commit operation or a rollback operation; The communication unit is further configured to send the operation information to each storage server that receives the write request.
22. A storage device, characterized in that: The device comprises: a communication unit, configured to receive a write request sent by a coordination server, the write request including transaction data distribution information and a transaction data message, the write request being one of at least one write request generated by the coordination server based on a received transaction, the storage server being one of a plurality of storage servers where a copy of original data corresponding to the transaction data message included in the at least one write request is located, the transaction including at least one transaction data message, each transaction data message including storage location information of a copy of the original data on the storage server and a write operator, the transaction data distribution information indicating a storage server storing each copy of the original data corresponding to each transaction data message included in the transaction; a processing unit, operating, according to the transaction data information, a copy of the original data corresponding to the transaction data information included in the write request; The communication unit is further configured to send the execution result of the write request to the coordination server; receive a read request sent by the coordination server, wherein the read request includes a storage location of a copy of the target data on the storage server and a read operator; The processing unit is further configured to query, based on the transaction data distribution information, a storage server storing each copy of original data corresponding to each transaction data information included in the transaction for an execution result of the at least one write request; A commit operation or a rollback operation is performed according to the execution result of the at least one write request obtained by the query.
23. The device according to claim 22, wherein The processing unit is further configured to generate operation information according to the execution result of the at least one write request obtained by 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 storing each copy of the original data corresponding to each transaction data information included in the transaction.
24. The device according to claim 22 or 23, characterized in that The storage location of the copy of the target data on the storage server overlaps with the storage location of the copy of the original data on the storage server, or the copy of the target data and the copy of the original data are stored in data blocks that need to maintain consistency.
25. 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. When the processor executes the instructions, the processor executes the method according to any one of claims 15 or 16.
26. A storage server, characterized in that: The method comprises 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 executes the method according to any one of claims 17 to 19.
27. A non-transitory computer-readable storage medium storing a computer program, wherein the computer program implements the method according to any one of claims 15 or 16 when executed by a coordination server.
28. A non-transitory computer-readable storage medium storing a computer program, wherein the computer program implements the method according to any one of claims 17 to 19 when executed by a storage server.
Citation Information
Patent Citations
Transaction processing method, transaction coordinator device and transaction participant device and system
CN103677968A