[go: up one dir, main page]

WO2021103036A1 - Transaction commit system and method, and related device - Google Patents

Transaction commit system and method, and related device Download PDF

Info

Publication number
WO2021103036A1
WO2021103036A1 PCT/CN2019/122287 CN2019122287W WO2021103036A1 WO 2021103036 A1 WO2021103036 A1 WO 2021103036A1 CN 2019122287 W CN2019122287 W CN 2019122287W WO 2021103036 A1 WO2021103036 A1 WO 2021103036A1
Authority
WO
WIPO (PCT)
Prior art keywords
transaction
write request
server
storage server
storage
Prior art date
Application number
PCT/CN2019/122287
Other languages
French (fr)
Chinese (zh)
Inventor
王艳群
林超
魏明昌
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Priority to CN201980102354.8A priority Critical patent/CN114730314B/en
Priority to PCT/CN2019/122287 priority patent/WO2021103036A1/en
Publication of WO2021103036A1 publication Critical patent/WO2021103036A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor

Definitions

  • This application relates to the field of computer technology, in particular to a transaction submission system, method and related equipment.
  • a transaction is a logical unit in the execution of a database management system, including a limited sequence of database operations.
  • a distributed system in order to improve the reliability of data, it is necessary to establish a redundant relationship for the data. For example, multiple copies of the data are stored to establish a redundant relationship, and the multiple copies are distributed in different nodes.
  • each participant can determine the execution result of the transaction executed by each participant, but cannot know the execution result of other participants.
  • a coordinator In order to maintain the atomicity, consistency, isolation, and durability of the transaction, it is necessary to introduce a coordinator to manage the participants in the execution of the transaction.
  • Two-phase commit is a method designed for transaction commit based on the system architecture of a distributed system. However, in this method, multiple interactions are required between the coordinator and the participants and the master copy in the distributed system, which will cause the transaction to be committed. The time delay is longer.
  • the embodiment of the present invention provides a transaction submission system, method and related equipment, which can reduce the time delay of transaction submission.
  • this application provides a transaction processing system, including a coordination server and multiple storage servers, where:
  • the coordination server is configured to receive transactions, the transaction includes at least one transaction data information, and each transaction data information includes the storage location information of a copy of the original data on the storage server and the write operator; according to the pre-stored data distribution Information to determine transaction data distribution information, wherein the data distribution information indicates a storage server in the transaction processing system that stores each copy of each original data, and the transaction data distribution information indicates that each transaction included in the transaction is stored
  • the storage server for each copy of the original data corresponding to the transaction data information; generate at least one write request, each write request including the transaction data distribution information and one transaction data information; send each write request to the each 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; operate 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; Sending the execution result of the write request to the coordination server;
  • the coordination server is further configured to determine the transaction processing result of the transaction according to the execution result of the write request sent by each storage server that receives the write request, and send the transaction processing result to the service server.
  • the coordination server generates one or more write requests according to the transaction data information in the received transaction, and then sends each write request directly to the transaction data included in each write request according to the data distribution information of the distributed system stored in advance
  • the storage server where each copy of the original data corresponding to the information is located so as to avoid the coordination server from first sending the write request to the storage server where the master copy of the original data corresponding to the transaction data information is located, and then the master copy sends the write request to the corresponding
  • the backup copy process improves the efficiency of sending write requests to each storage server.
  • each storage server feeds back the execution result of the write request to the coordination server, and the coordination server can determine the transaction based on the execution result fed back by each storage server. Then, the transaction processing result of the above transaction is returned to the business server, so as to realize the one-stage transaction submission, reduce the time delay of write request processing, and improve the processing efficiency of write request and the work efficiency of the business server.
  • the coordination server is configured to receive a read request, where the read request includes a storage location and a read operator of a copy of the target data on the storage server; and the storage is determined according to the data distribution information.
  • the storage server that has received the read request is configured to query each storage server that has received the write request for the execution result of the write request according to the transaction data distribution information; according to each received write request
  • the execution result of the execution of the write request sent by the storage server determines the execution of the commit operation or the rollback operation; after the execution of the commit operation or the rollback operation, according to the storage location of the copy of the target data on the storage server Read the target data; send the read target data to the coordination server.
  • the storage server that receives the read request is further configured to generate operation information according to the execution result of the write request, and the operation information indicates a commit operation or a rollback operation, and the operation The information is sent to each storage server that receives the write request.
  • the coordination server does not send commit instructions or rollback instructions to the storage server. If the storage server receives a read request, the storage server can send the transaction data to the storage server according to the transaction data identifier and transaction data distribution information in the received write request.
  • the storage server of each copy of the original data corresponding to each transaction data information included queries the execution result of the write request, and determines the commit operation or rollback operation according to the execution result of the queried write request, and then executes the received read request .
  • the storage server is used to determine the transaction corresponding to the write request to perform the commit operation or rollback operation, which reduces the amount of data processed by the business server and improves the efficiency of the business server.
  • the coordination server is configured to determine multiple storage servers that store copies of the target data according to the data distribution information; from the determined multiple storage servers that store the target data Select a target storage server from the storage servers of the copy; send the read request to the target storage server.
  • the target storage server may be the closest to the coordination server among the multiple storage servers that store the copies of the target data, or the coordination server has the fastest access speed among the multiple storage servers that store the copies of the target data, so as to improve The speed at which the business server reads the target data improves work efficiency.
  • the coordination server is further configured to determine that each write request is received according to the execution result of the write request sent by each storage server that receives the write request.
  • the operation information that the storage server needs to perform, the operation information indicates the execution of a commit operation or a rollback operation, and the operation information is sent to each storage server that receives the write request.
  • the storage server that receives the write request is further used to determine that no data sent by the coordination server is received within a preset time after sending the execution result of the operation to the coordination server.
  • the operation information 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 write request; and determines according to the execution result Perform the commit operation or the rollback operation.
  • the storage server After the storage server feeds back the execution result to the coordination server, it does not receive the operation information sent by the coordination server within a preset time period, and the storage server determines that the coordination server is faulty. According to the transaction data distribution information, the storage server queries other storage servers included in the transaction data distribution information for the execution results of other storage servers executing write requests, and then determines to perform the commit operation or rollback operation based on the execution results of other storage servers to prevent the storage server from being When the commit command or rollback command from the coordination server is not received, the storage server cannot release the system resources applied for to execute the above write request, which leads to system congestion and inability to execute new transactions, and can improve the reliability of the system.
  • the present application provides a transaction processing method, which is applied to a transaction processing system including a coordination server and multiple storage servers, and the method includes:
  • the coordination server receives a transaction sent by a business server, 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 according to pre-stored data distribution information, where the data distribution information indicates a storage server that stores each copy of each original data in the transaction processing system, and the transaction data distribution The information indicates a storage server that stores each copy of original data corresponding to each transaction data information included in the transaction;
  • the coordination server generates at least one write request, and each write request includes the transaction data distribution information and one 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, and according to the transaction data information included in the write request, operates on a copy of the original data corresponding to the transaction data information included in the write request, and reports to the Coordinating the server to send the execution result of the write request;
  • the coordination server determines the transaction processing result of the transaction according to the execution result of the write request sent by each storage server that receives the write request, and sends the transaction processing result to the service server.
  • the coordination server receives a read request sent by the business server, where the read request includes a storage location and a read operator of the copy of the target data on the storage server;
  • the coordination server determines a storage server that stores a copy of the target data according to the data distribution information, and sends the read request to the storage server that stores the copy of the target data;
  • the storage server that has received the read request queries each storage server that has received the write request for the execution result of the write request; according to each storage server that has received the write request The sent execution result of the execution of the write request, confirming the execution of the commit operation or the rollback operation;
  • the storage server that receives the read request reads the target data according to the storage location of the copy of the target data on the storage server, and sends the read target data to the coordination server.
  • 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,
  • the operation information indicates a commit operation or a rollback operation.
  • the coordination server determines a storage server that stores a copy of the target data according to the data distribution information, and sends the read request to the storage server that stores the copy of the target data, include:
  • the coordination server determines a plurality of storage servers that store copies of the target data according to the data distribution information
  • the coordination server selects a target storage server from the determined storage servers that store copies of the target data, and sends the read request to the target storage server.
  • the method further includes: the coordination server determines that each write request is received according to the execution result of the write request sent by each storage server that receives the write request Operation information that the storage server needs to perform, where the operation information indicates the execution of a commit operation or a rollback operation;
  • the coordination server sends the operation information to each storage server that receives the write request.
  • the method further includes:
  • the storage server After receiving the write request, the storage server 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 according to the transaction data distribution information, The storage server storing each copy of the original data corresponding to each transaction data information included in the transaction queries the execution result of the write request;
  • the storage server receiving the write request determines to execute the commit operation or the rollback operation according to the execution result.
  • 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, and the method includes:
  • the coordination server receives the transaction sent by the business server, the transaction includes at least one transaction data information, and each transaction data information includes the storage location information of a copy of the original data on the storage server and the write operator;
  • the coordination server determines transaction data distribution information according to pre-stored data distribution information, where the data distribution information indicates a storage server that stores each copy of each original data in the transaction processing system, and the transaction data distribution information indicates A storage server that stores each copy of original data corresponding to each transaction data information included in the transaction;
  • the coordination server generates at least one write request, and each write request includes the transaction data distribution information and one 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 determines the transaction processing result of the transaction according to the execution result of the write request sent by each storage server that receives the write request, and sends the transaction processing result to the service server.
  • the method further includes: the coordination server determines that each write request is received according to the execution result of the write request sent by each storage server that receives the write request Operation information that the storage server needs to perform, where the operation information indicates the execution of a commit operation or a rollback operation;
  • the coordination server sends the operation information to each storage server that receives the write request.
  • the present application provides a transaction processing method, which is applied to a storage server in a transaction processing system including a coordination server and multiple storage servers, and the method includes:
  • the storage server receives a write request sent by the coordination server.
  • the write request includes transaction data distribution information and one transaction data information.
  • the write request is one of at least one write request generated by the coordination server according to the received transaction.
  • the storage server is one of multiple storage servers where a copy of the original data corresponding to the transaction data information included in the at least one write request is located, the transaction includes at least one transaction data information, and each transaction data information includes a copy of the original data
  • the storage location information and the write operator on the storage server, and the transaction data distribution information indicates the storage server that stores each copy of the original data corresponding to each transaction data information included in the transaction;
  • the 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 the 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 and a read operator of the copy of the target data on the storage server;
  • the storage server queries a storage server that stores each copy of original data corresponding to each transaction data information included in the transaction for the execution result of the at least one write request;
  • the storage server executes a commit operation or a rollback operation according to the execution result of the at least one write request obtained by the query.
  • the method further includes: the storage server generates 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;
  • the storage server sends the operation information to a storage server that stores each copy of original data corresponding to each transaction data information included in the transaction.
  • the present application provides a transaction processing method, which is applied to a storage server in a transaction processing system including a coordination server and multiple storage servers, and the method includes:
  • the storage server receives a write request sent by the coordination server.
  • the write request includes transaction data distribution information and one transaction data information.
  • the write request is one of at least one write request generated by the coordination server according to the received transaction.
  • the storage server is one of multiple storage servers where a copy of the original data corresponding to the transaction data information included in the at least one write request is located, the transaction includes at least one transaction data information, and each transaction data information includes a copy of the original data
  • the storage location information and the write operator on the storage server, and the transaction data distribution information indicates the storage server that stores each copy of the original data corresponding to each transaction data information included in the transaction;
  • the 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 the execution result of the write request to the coordination server;
  • the storage server determines that the operation information sent by the coordination server is not received within a preset time after sending the execution result of the write request to the coordination server, and according to the transaction data distribution information, the storage of the transaction includes The storage server of each copy of the original data corresponding to each transaction data information inquires the execution result of the at least one write request;
  • the storage server executes a commit operation or a rollback operation according to the execution result of the at least one write request obtained by the query.
  • the present application provides a coordination device, and the coordination device includes:
  • the communication unit is configured to receive a transaction sent by the service server, 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 processing unit is configured to determine transaction data distribution information according to pre-stored data distribution information, where the data distribution information indicates a storage server that stores each copy of each original data in the transaction processing system, and the transaction data distribution information Indicating a storage server that stores each copy of original data corresponding to each transaction data information included in the transaction;
  • each write request including the transaction data distribution information and one 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;
  • the processing unit is further configured to determine the transaction processing result of the transaction according to the 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 service server.
  • the processing unit is specifically configured to determine each storage server that receives the write request according to the execution result of the write request sent by each storage server that receives the write request The operation information that needs to be executed, the operation information indicating the execution of 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.
  • the present application provides a storage device, the device including:
  • the communication unit is configured to receive a write request sent by the coordination server, the write request includes transaction data distribution information and one transaction data information, and the write request is one of at least one write request generated by the coordination server according to the received transaction
  • the storage server is one of a plurality of storage servers where a copy of the original data corresponding to the transaction data information included in the at least one write request is located, the transaction includes at least one transaction data information, and each transaction data information includes an original
  • the storage location information and the write operator of the copy of the data on the storage server, and the transaction data distribution information indicates the storage server that stores each copy of the original data corresponding to each transaction data information included in the transaction;
  • a processing unit based on the transaction data information, operating on 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, where the read request includes the storage location and the reading of the copy of the target data on the storage server.
  • the processing unit is further configured to query the execution result of the at least one write request from the storage server storing each copy of the original data corresponding to each transaction data information included in the transaction according to the transaction data distribution information;
  • a commit operation or a rollback operation is performed.
  • 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, where the operation information indicates a commit operation or a rollback operation;
  • the communication unit is further configured to send the operation information to a storage server that stores each copy of the original data corresponding to each transaction data information included in the transaction.
  • the present application provides a storage device, the device including:
  • the communication unit is configured to receive a write request sent by the coordination server, the write request includes transaction data distribution information and one transaction data information, and the write request is one of at least one write request generated by the coordination server according to the received transaction
  • the storage server is one of a plurality of storage servers where a copy of the original data corresponding to the transaction data information included in the at least one write request is located, the transaction includes at least one transaction data information, and each transaction data information includes an original
  • the storage location information and the write operator of the copy of the data on the storage server, and the transaction data distribution information indicates the storage server that stores each copy of the original data corresponding to each transaction data information included in the transaction;
  • a processing unit configured to operate on a copy of the original data corresponding to the transaction data information included in the write request according to the transaction data information
  • the communication unit is further configured to send the execution result of the write request to the coordination server;
  • the processing unit 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 write request is sent to the coordination server, and send data to the storage system according to the transaction data distribution information.
  • the storage server of each copy of the original data corresponding to each transaction data information included in the transaction queries the execution result of the at least one write request;
  • a commit operation or a rollback operation is performed.
  • the present application provides a coordination server, including a processor and a memory; the memory is used to store instructions, and the processor is used to execute the instructions.
  • the processing The device executes the method provided in the third aspect or any one of the possible implementation manners of the third aspect.
  • the present application provides a storage server, including a processor and a memory; the memory is used to store instructions, the processor is used to execute the instructions, and when the processor executes the instructions, the processing The device executes the method provided by the fourth aspect or any one of the possible implementation manners of the fourth aspect.
  • the present application provides a storage server, including a processor and a memory; the memory is used to store instructions, the processor is used to execute the instructions, and when the processor executes the instructions, the The processor executes the fifth aspect or the method provided in any possible implementation manner of the fifth aspect.
  • the present application provides a non-transitory computer-readable storage medium, the computer-readable storage medium stores a computer program, and the computer program implements the third aspect or the third aspect when the computer program is executed by the coordination server.
  • the method provided by any one of the possible implementations.
  • the present application provides a non-transitory computer-readable storage medium, the computer-readable storage medium stores a computer program, and the computer program implements the fourth aspect or the fourth aspect when the computer program is executed by a storage server.
  • the method provided by any one of the possible implementations.
  • the present application provides a non-transitory computer-readable storage medium, the computer-readable storage medium stores a computer program, and the computer program implements the fifth aspect or the fifth aspect when the computer program is executed by a storage server The method provided by any one of the possible implementations.
  • FIG. 1 is a schematic diagram of a system architecture of a distributed system provided by an embodiment of the present application
  • FIG. 2 is a schematic diagram of a two-stage submission interaction provided by an embodiment of the present application
  • FIG. 3 is a schematic diagram of performing a commit operation or a rollback operation provided by an embodiment of the present application
  • FIG. 4 is another schematic diagram of the interaction of two-stage submission provided by an embodiment of the present application.
  • FIG. 5 is a schematic diagram of interaction of transaction commit provided by an embodiment of the present application.
  • FIG. 6 is a schematic diagram of interaction for executing a read request according to an embodiment of the present application.
  • FIG. 7 is a schematic diagram of another transaction submission interaction provided by an embodiment of the present application.
  • FIG. 8 is a schematic structural diagram of a coordination device provided by an embodiment of the present application.
  • FIG. 9 is a schematic structural diagram of a storage device provided by an embodiment of the present application.
  • FIG. 10 is a schematic structural diagram of another storage device provided by an embodiment of the present application.
  • FIG. 11 is a schematic structural diagram of a coordination server provided by an embodiment of the present application.
  • FIG. 12 is a schematic structural diagram of a storage server provided by an embodiment of the present application.
  • FIG. 13 is a schematic structural diagram of another storage server provided by an embodiment of the present application.
  • first and second in the embodiments of the present application are only used for descriptive purposes, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of indicated technical features. Thus, the features defined with “first” and “second” may explicitly or implicitly include one or more of these features.
  • a transaction is a logical unit in the execution of a database management system, which includes a limited sequence of database operations.
  • transactions must have four characteristics: atomicity, consistency, isolation, and durability.
  • atomicity refers to all operations in a transaction , Either all is completed, or all is not completed, it will not end in a certain link in the middle, the transaction will be rolled back to the state before the start of the transaction if an error occurs during the execution of the transaction.
  • Consistency means that the integrity of the database has not been destroyed before the start of the transaction and after the end of the transaction.
  • Isolation means that the database allows multiple concurrent transactions to read, write and modify data at the same time. Isolation can prevent data inconsistencies caused by cross execution when multiple transactions are executed concurrently. Persistence means that after the transaction is executed, the modification of the data is permanent, and it will not be lost even if the system fails.
  • a transaction includes a transaction request for one or more data, and the transaction request is a read request or a write request.
  • 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 creating a copy or erasure of the data Code verification improves the fault tolerance of the system.
  • the redundancy relationship is taken as an example for description, and other redundancy relationships are also applicable.
  • multiple copies of the same target data are called a participant, where the target data is one or more data requested in the transaction request, and one of the multiple copies is the master Copies, the rest are backup copies. It can be understood that when server resources are sufficient, and multiple copies of the same data are distributed on different storage servers, 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.
  • the coordinator assumes the coordinating role in the execution of the transaction.
  • each participant can determine the result of executing the transaction request, but cannot know the other participants The result of executing the transaction request.
  • a coordinator is therefore introduced to manage the results of executing the transaction request and instruct the storage server whether to submit the result of executing the transaction request, for example, to replace the original data with the updated data.
  • the distributed system includes one or more business servers, one or more coordinator servers (coordinators), and multiple storage servers.
  • a distributed system including a business server, a coordinator server and multiple storage servers is taken as an example.
  • the coordinator is used to receive the transaction request sent by the business server and send the transaction request 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 may be a chunk in the storage server. For example, if the storage server P1 in FIG.
  • the storage server P2 includes logical storage nodes P21, P22, and P23
  • the storage server P3 includes logical storage nodes P31, P32, and P33. If the logical storage nodes P11, P21, and P31 include three copies of the same data, the logical storage nodes P12, P22, and P32 include three copies of the same data, and the logical storage nodes P13, P23, and P33 include three copies of the same data.
  • the 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.
  • One of the multiple copies is the primary copy, and the rest are backup copies. For example, P11 is the primary copy of the participant, and P12 and P13 are the backup copies of the participant.
  • Two-phase commit is a method designed based on transaction commit under a distributed system architecture.
  • Two-phase commit includes a prepare phase and a commit phase.
  • the prepare phase includes:
  • the coordinator After receiving the transaction sent by the service server, the coordinator forwards one or more write requests included in the transaction to the participant where the original data requested for the operation in each write request is located.
  • the participant 1 receives the first write request
  • the participant 2 receives the second write request
  • the participant n receives the nth write request as an example.
  • each participant After each participant receives the write request, it executes the write request they received. Participants perform write requests on the original data to obtain the target data, but do not replace the original data with the target data, and only store the target data temporarily.
  • participant 1 generates the first operation result according to the execution of the first write request
  • participant 2 generates the second operation result according to the execution of the second write request
  • participant n generates the second operation result according to the execution of the nth write request. Take the nth operation result as an example.
  • the commit phase includes:
  • the coordinator determines the execution result of the write request according to the operation result sent by each participant, and sends a commit instruction or a rollback instruction to each participant. Among them, in the case that the operation result of each participant is successful, the coordinator determines that the execution result of the write request is successful, and the coordinator sends a commit instruction to each participant. In the case where at least one of the operation results of each participant is an operation failure, the coordinator determines that the execution result of the write request is an execution failure, and the coordinator sends a rollback instruction to each participant. In Figure 2, the execution result of the write request is the commit instruction as an example.
  • each participant executes the received commit instruction or rollback instruction.
  • each participant performs the commit operation and replaces the original data with the above target data;
  • each participant performs a rollback operation and saves the above temporarily stored target data delete.
  • the target data obtained after the original data A is written is B.
  • the target data B is temporarily stored. If the participant performs the commit operation according to the commit command, use B replaces A. If the participant performs a rollback operation according to the rollback instruction, the temporarily stored target data B will be deleted.
  • Each participant sends a confirmation message to the coordinator, and the confirmation message indicates the completion of the submission operation or the completion of the rollback operation.
  • the participant 1 generates the first confirmation information
  • the participant 2 generates the second confirmation information
  • the participant n generates the nth confirmation information as an example.
  • the coordinator returns the execution result of the transaction to the service server after receiving the confirmation message fed back by each participant.
  • a participant includes one or more copies of the same data, and the logical storage node where each copy of the same data is located.
  • the coordination server sends the write request corresponding to each participant to the logical storage node where the master copy of each participant is located, and the storage server where the master copy is located forwards the write request to the storage server storing the backup copy, and then receives it.
  • the multiple logical storage nodes to the write request execute the operation in the write request, and send the operation result in the storage server of each storage backup copy to the coordination server through the storage server storing the primary copy.
  • the coordination server determines whether the write request is executed successfully according to the received operation results of each participant, and sends a commit command or rollback command to the master copy, and then the master copy forwards the received instructions to the corresponding backup copy. It should be noted that the interaction between the logical storage nodes and the interaction between the logical storage nodes and the coordinator are all performed through the storage server where each logical storage node is located.
  • the prepare phase includes:
  • the coordination server first sends the first write request to the logical storage node P11 where the master copy of the first original data is stored, and sends the second write request to the logical storage node P43 where the master copy of the second original data is stored, where The first write request and the second write request are included in the transaction received by the coordination server, the first write request indicates to modify the first original data, and the second write request indicates to modify the second original data.
  • P11 sends the received first write request to P21 and P31 of the storage backup copy
  • P43 sends the received second write request to P33 and P53 of the storage backup copy.
  • P11, P21, and P31 perform the corresponding operations in the first write request respectively
  • P33, P43, and P53 perform the corresponding operations in the second write request respectively
  • P21 and P31 send the operation result of the first write request to the storage server P11 , P33 and P53 send the operation result of the second write request to P43, where the operation result indicates the success or failure of the write request operation.
  • P11 determines the execution result of the first write request according to the operation results of P11, P21, and P31
  • P43 determines the execution result of the second write request according to the operation results of P33, P43, and P53, and then P11 and P43 respectively determine the execution result of the first write request.
  • the execution result and the execution result of the second write request are sent to the coordination server.
  • P11 determines that the execution result of the first write request is successful.
  • P11 determines that the execution result of the first write request is execution failure.
  • the method for P43 to determine whether the execution result of the second write request is successful or failed is similar.
  • the commit phase includes:
  • the coordination server sends a commit command or a rollback command to P11 and P43 according to the execution result of the first write request and the execution result of the second write request fed back by P11 and P43.
  • the execution result of the write request is the commit instruction as an example.
  • P11 sends the received commit command or rollback command to P21 and P31
  • P43 sends the received commit command or rollback command to P33 and P53.
  • each logical storage node executes the received commit command or rollback command.
  • each logical storage node performs a commit operation, replacing the original data with the target data obtained after the update; when a rollback instruction is received, each logical storage node performs a rollback operation.
  • P21 and P31 feed back the first confirmation information (commit operation completion or rollback operation complete) to P11
  • P33 and P53 feed back the second confirmation information (commit operation completion or operation rollback completion) to P43.
  • the coordinator and the participant need to interact twice, and the primary and backup copies in the same participant need to interact twice, which will lead to a longer delay in transaction submission.
  • the coordination server fails, the resources requested by the storage server during the execution of the transaction cannot be released in time, which will cause the system to be in a blocked state, and other blocked transactions will wait until the original Resources related to the transaction request are released.
  • the embodiment of the present application provides a transaction commit method, which is applied to the distributed system as shown in FIG. 1, in which the business server sends the transaction to the coordination server, and the coordination server is based on the data distribution information of the distributed system and the transactions in the transaction.
  • the data information sends one or more write requests included in the transaction to the corresponding storage server for execution, and each storage server executes the corresponding operation according to the received write request and sends the respective execution result to the coordination server.
  • the coordination server determines the transaction processing result according to the execution result of each storage server, and returns the transaction processing result to the business server.
  • the transaction submission method provided by the present application will be described in detail from two aspects of the transaction request being a write request and a read request in conjunction with the accompanying drawings.
  • the transaction commit method includes:
  • the business server sends a transaction to the coordination server.
  • 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, and each transaction data information indicates a reference to the distributed database.
  • One or more raw data is operated, and each transaction data information includes storage location information of the original data and an operator, the storage location information includes an address or a data identifier, and the operator instructs to perform a write operation on the original data.
  • the coordination server stores data distribution information of the distributed system, and the data distribution information records the logical storage node where each data is located in the distributed system and the storage server to which each logical storage node belongs.
  • the coordination server may determine the logical storage node where the original data is located in the distributed database and the storage server to which the logical storage node belongs based on the storage location information and data distribution information of the original data.
  • 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.
  • the coordination server After receiving the transaction, the coordination server queries the data distribution information according to the storage location information of the original data in each transaction data information, and can obtain the query result corresponding to the transaction data information.
  • the query result includes the transaction data information instruction to write The logical storage node where each copy of the original data of the operation is located and the storage server where each logical storage node is located, where each copy of the original data corresponds to a logical storage node.
  • the coordination server can determine the query results corresponding to all transaction data information in the transaction according to each transaction data information and data distribution information, and merge the query results corresponding to all transaction data information included in the transaction to obtain transaction data distribution information, and the transaction data distribution information Indicate 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.
  • the coordination server After determining the transaction data distribution information, the coordination server generates multiple write requests according to the transaction data information, the transaction data identifier, and the transaction data distribution information in the transaction. Wherein, each write request includes a transaction data information, a transaction data identifier, and the foregoing transaction data distribution information. Then each write request is sent to the storage server where each copy of the original data corresponding to the transaction data information included in each write request is located.
  • a transaction includes 3 transaction data information, and each transaction data information indicates a write operation to an original data as an example.
  • the first transaction data information indicates an increase by 1 operation to the data of the second field recorded in page1.
  • the second transaction data information indicates that the data in the fifth field recorded in page2 should be added by 1
  • the third transaction data information indicates that the data in the third field recorded in page3 should be subtracted by 1, that is, the transaction instruction is three
  • the original data is written.
  • the coordination server determines that page1 is located in the logical storage node 11 of the storage server 1, the logical storage node 21 of the storage server 2, and the logical storage node 31 of the storage server 3 according to the above-mentioned data distribution information.
  • the aforementioned page2 is located in the logical storage of the storage server 1.
  • page 3 is located in logical storage node 13 of storage server 1, logical storage node 33 of storage server 3, and logical storage of storage server 4 Node 43.
  • the three transaction data identifiers corresponding to the above three transaction data information are block1, block2, and block3.
  • the coordination server determines the transaction data distribution information corresponding to the transaction according to the logical storage node and the storage server corresponding to each of the determined three transaction data information.
  • the transaction data distribution information corresponding to this transaction is shown in Table 1 below.
  • the coordination server After the coordination server determines the logical storage node and storage server corresponding to each transaction data information, the coordination server generates three write requests according to the three transaction data information, the three transaction data identifiers, and the transaction data distribution information.
  • a write request includes the above-mentioned first transaction data information, three transaction data identifiers, and transaction data distribution information, that is, the first write request instructs to add 1 to the data in the second field recorded in page1;
  • the second write request includes the above The second transaction data information, the three transaction data identifiers, and the transaction data distribution information, that is, the second write request indicates to add 1 to the data in the fifth field recorded in page2;
  • the third write request includes the aforementioned third transaction data information , Three transaction data identifiers and transaction data distribution information, that is, the third write request instructs to subtract 1 from the data in the third field recorded in page3.
  • the coordination server sends the first write request to storage server 1, storage server 2 and storage server 3, sends the second write request to storage server 1, storage
  • the coordination server generates one or more write requests according to the transaction data information in the received transaction, and then sends each write request directly to the transaction data included in each write request according to the data distribution information of the distributed system stored in advance
  • the storage server where each copy of the original data corresponding to the information is located so as to avoid the coordination server from first sending the write request to the storage server where the master copy of the original data corresponding to the transaction data information is located, and then the master copy sends the write request to the corresponding
  • the backup copy process improves the efficiency of sending write requests to each storage server.
  • the storage server executes a corresponding write operation according to the received write request.
  • each storage server After each storage server receives 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 received write request.
  • the storage server 1, the storage server 2, the storage server 3, and the storage server 4 receive the above-mentioned write request, according to the specific operation indicated by the respective received write request, perform processing on the original data of the specified field in the transaction data information.
  • the corresponding write operation For example, the 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 adds 1 to the data in the second field of page 1, and the logical storage node 12
  • the data in the fifth field in page2 is added by 1, and the logical storage node 13 is subtracted by 1 in the data in the third field in page3.
  • the storage server 2 receives the first write request and the second write request.
  • the logical storage node 21 of the storage server 2 adds 1 to the data in the second field of page1, and the logical storage node 22 adds 1 to the data in the fifth field of page2. Add 1 to the data.
  • 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.
  • the storage server sends the execution result of executing the write request to the coordination server.
  • the storage server After receiving the write request, the storage server performs the corresponding write operation on the data in the specified field in the received write request, and then sends the execution result to the coordination server, where each write request corresponds to an execution result, and the execution result instructs the storage server
  • the execution of the write request is successful or failed.
  • Successful execution means that the storage server performs a write operation on the original data specified in the write request to obtain the target data
  • execution failure means that the storage server cannot perform a write operation on the original data specified in the write request to obtain the target data. .
  • the storage server executes the write operation of the specified data in the received write request successfully, it will send the successful execution result of the write request to the coordination server, if the storage server executes the write operation of the specified data in the received write request If it fails, the execution result of the failed execution of the write request is sent to the coordination server.
  • the coordination server sends the first write request, the second write request, and the third write request to the storage server 1, the storage server 1 needs to feed back the three execution results corresponding to the three write requests to the coordination server.
  • the logical storage node 11 in the storage server 1 can successfully execute the write operation to the data in page1, that is, the storage server 1 can successfully execute the first write request, and the storage server 1 will send the execution of the first write request to the coordination server.
  • 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.
  • the coordination server After receiving the execution result corresponding to each write request sent by each storage server, the coordination server determines the transaction processing result according to the execution result sent by each storage server, and sends the transaction processing result to the service server. Specifically, when the coordination server receives that the execution results of the received write requests from each storage server are all executed successfully, the coordination server determines that the transaction processing result of the transaction is successful, and sends the transaction successful to the business server News. When the coordination server receives any one or more execution results that are execution failures, the coordination server determines that the transaction processing result of the transaction is a processing failure, and sends a transaction processing failure message to the business server.
  • the execution results sent by the storage server 1 and the storage server 2 and the storage server 4 are all successful, and the logical storage node 33 in the storage server 3 fails to perform the subtraction operation of the data in page 3, that is, the storage server 3 executes the third write If the request is an execution failure, the coordination server will receive a failed execution result sent by the storage server 3. The coordination server determines that the transaction processing result of the write request is a processing failure, and sends a transaction failure message to the business server.
  • each storage server After the storage server that has received the write request has executed the received write request, each storage server will feed back the execution result of the write request to the coordination server, and the coordination server can determine the transaction according to the execution result fed back by each storage server. After processing the result, the transaction processing result of the above transaction is returned to the service server, so as to realize the one-stage transaction submission, reduce the time delay of the write request processing, and improve the processing efficiency of the write request and the work efficiency of the business server.
  • the aforementioned coordination server determines the transaction processing result according to the execution result sent by the storage server, and after sending the transaction processing result to the service 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 that receives the read request needs to determine whether the target data that needs to be read by the received read request is related to the original data that the previously executed write request needs to operate, if relevant, The storage server that receives 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 the commit operation or rollback operation is performed.
  • 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, and the target data that the read request needs to read is the same as the write request.
  • the original data that needs to be operated overlaps, the storage location of the target data that needs to be read by the read request overlaps the storage location of the original data that needs to be operated on the write request, or the target data that needs to be read by the read request and the original data that needs to be operated on the write request belong to
  • the same storage area the storage area can be a data block (block), can be a data area (chunk).
  • the coordination server receives the read request sent by the service server, and sends the read request to the target storage server.
  • the above-mentioned read request includes the storage location information and the operator of the target data to be read.
  • the coordination server After receiving the read request, the coordination server first queries the data distribution information of the distributed system according to 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 information that the read request needs to read. Multiple logical storage nodes where multiple copies of the target data are located and multiple storage servers where the multiple logical storage nodes are located, where each copy corresponds to a logical storage node, and each logical storage node corresponds to a storage server. Then the coordination server 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.
  • the target storage server may be the 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 fastest coordinated server access among multiple storage servers where the target data to be read in the read request is located.
  • the target storage server sends a query request to one or more storage servers according to the read request.
  • the target storage server After receiving the above-mentioned read request, the target storage server determines that the target data that the read request needs to read is related to the original data that the target write request needs to write based on the read request and one or more previously received write requests, then the target The storage server cannot directly read the above target data.
  • the target storage server must first determine the transaction processing result of the transaction to which the target write request belongs, and determine the commit operation or rollback operation based on the transaction processing result to ensure that the read request needs to read Consistency of multiple copies of target data.
  • the foregoing target write request includes part or all of one or more write requests received by the target storage server before the read request is received. In the embodiment of the present application, the target write request includes one write request as an example.
  • the target storage server will determine the multiple storage servers included in the transaction data distribution information in the target write request according to the transaction data identification 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 target write request includes multiple transaction data identifiers, and the query request instructs the storage server to query the execution result of the write request corresponding to the multiple transaction data identifiers in the query request, and send the queried execution result to the target storage server.
  • the target storage server receives the query result, performs a submit operation or a rollback operation according to the query result, executes a read request, and obtains target data and sends it to the coordination server.
  • the target storage server determines the transaction processing result of the transaction to which the target write request belongs according to the execution results returned by multiple storage servers. If the transaction processing result is successful, the target storage server sends the transaction data distribution information in the target write request to the target write request. A storage server sends a commit instruction and performs a commit operation on the transaction to which the target write request belongs. If the transaction processing result is a processing failure, the target storage server sends a rollback to multiple storage servers included in the transaction data distribution information in the target write request Instruction, and perform a rollback operation on the transaction to which the target write request belongs. Finally, the received read request is executed, the target data to be read by the read request is obtained and the target data is sent to the coordination server.
  • the target storage server is the storage server 1.
  • the storage server 1 receives a read request after executing the first write request, the second write request, and the third write request.
  • the target data that the read request needs to read is located in the logic Storage node 11, the storage server 1 first determines the first write request, the second write request, and the third write request included in the transaction to which the first write request belongs according to the transaction data identifier and transaction data distribution information sent by the coordination server.
  • the write request is sent to the storage server 1, the storage server 2, the storage server 3, and the storage server 4.
  • the storage server 1 determines the execution results of the first write request, the second write request, and the third write request, and sends a query request to the storage server 2, the storage server 3, and the storage server 4.
  • the query request includes the first write request.
  • the transaction data identifier block1 corresponding to one write request, the transaction data identifier block2 corresponding to the second write request, and the transaction data identifier block3 corresponding to the third write request.
  • the query request instructs the storage server 2, the storage server 3 and the storage server 4 to query the execution result of the write request corresponding to the transaction data identifier in the query request, and send the execution result of each write request to the storage server 1.
  • the storage server 2 receives the first write request and the second write request
  • the storage server 2 queries the execution result of the first write request and the execution result of the second write request, and executes the first write request and the second write request.
  • the two execution results of are sent to the storage server 1 respectively.
  • the storage server 1 After the storage server 1 receives the execution results returned by the storage server 2, the storage server 3, and the storage server 4, if the storage server 1, the storage server 2, the storage server 3, and the storage server 4 all successfully execute the write request received respectively, then The storage server 1 performs the commit operation. If any write request in the storage server 1, the storage server 2, the storage server 3, or the storage server 4 fails, the storage server 1 performs a rollback operation.
  • the storage server 1 After the storage server 1 performs the commit operation or rollback operation, it reads the target data specified by the above read request, and sends the read target data to the coordination server. After the coordination server receives the target data sent by the storage server 1, the The target data is sent to the business server.
  • the coordination server does not send a commit command or rollback command to the storage server
  • the storage server receives a read request, and the target data that the read request needs to read is related to the original data that the storage server needs to operate on the write request previously received
  • 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, and perform the commit operation or rollback operation on the transaction to which the write request belongs based on the transaction processing result, and then Execute the received read request.
  • the storage server determines the transaction processing result of the transaction corresponding to the write request, reduces the amount of data processed by the business server, and improves the efficiency of the business server.
  • the target storage server may send the request to the coordination server Send a query request 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 processing success, the target storage server sends a commit instruction to multiple storage servers included in the transaction data distribution information in the target write request, and executes a commit to the transaction to which the target write request belongs operating.
  • the target storage server If the target storage server receives the transaction processing result sent by the coordination server as a processing failure, the target storage server sends a rollback instruction to multiple storage servers included in the transaction data distribution information in the target write request, and performs a rollback operation on the transaction to which the target write request belongs . Finally, the received read request is executed, the target data to be read by the read request is obtained and the target data is sent to the coordination server.
  • the coordination server may generate operation information according to the execution result of the write request fed back by the storage server that has received the write request, and the operation information instructs the storage server to perform submission Operation or rollback operation. If the execution result fed back by the storage server that receives the write request is successful, the coordination server generates the operation information as a commit command and sends a commit command to each storage server. After each storage server receives the commit command sent by the coordination server, Each logical storage node in each storage server executes the commit operation.
  • the coordination server If any one of the execution results fed back by the storage server that receives the write request is execution failure, the coordination server generates the operation information as a rollback instruction, and sends the rollback instruction to each storage server, and each storage server receives the coordination server's sending After the rollback instruction, perform the rollback operation.
  • the coordination server generates multiple write requests according to the transaction, sends the multiple write requests to some or all of the corresponding multiple storage servers, and sends the commit instruction or rollback instruction to the multiple storage servers.
  • the coordination server may fail or the network card may lose packets, causing the storage server that received the write request to not receive the commit command or rollback command sent by the coordination server.
  • 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 execution process of the transaction when the coordination server fails.
  • the storage server has the ability to sense and coordinate server failures. For example, the storage server that receives the write request executes the operations in S303 and S304 above, and if the above S304 is executed, the storage server does not receive it within a preset period of time. If the commit instruction or rollback instruction sent by the coordination server is sent, the storage server that has received the write request determines that the coordination server is faulty.
  • the storage server that receives the write request determines the multiple storage servers included in the transaction data distribution information according to the transaction data distribution information in the received write request, and then sends a query to the storage servers other than itself among the multiple storage servers Request, the query request includes multiple transaction data identifiers included in the write request, the query request instructs the storage server that has received the query request to query the execution result of the write request corresponding to the multiple transaction data identifiers in the query request, and the query result
  • the execution result is sent to the storage server that sent the query request.
  • the storage server receiving the write request generates operation information according to the received execution result.
  • the storage servers that have received the write request may be all storage servers that have received the write request, and each storage server that has received the write request needs to send a query request to other storage servers, and then generate operation information according to the received execution result.
  • the storage server that receives the write request may also be any storage server, for example, the first storage server that determines that the coordination server has failed.
  • the storage server that received the write request is a storage server, among the storage servers that received the write request, the first storage server that determines that the coordination server is faulty generates operation information based on the query execution results, and determines it based on the operation information After the commit operation or the rollback operation is performed, the generated operation information is sent to multiple storage servers included in the transaction data distribution information.
  • the storage server 1 determines according to 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 the storage server 1, the storage server 1.
  • the storage server 1 After the storage server 1 receives the execution results returned by the storage server 2, the storage server 3, and the storage server 4, if the storage server 1, the storage server 2, the storage server 3, and the storage server 4 all successfully execute the write request received respectively, then The storage server 1 determines that the transaction processing result is successful, and the operation information generated by the storage server 1 is a commit instruction, and sends the commit instruction to the storage server 2, the storage server 3, and the storage server 4, and then executes the commit operation. If any one or more of the storage server 1, the storage server 2, the storage server 3, or the storage server 4 fails to execute, the storage server 1 determines that the transaction processing result is a processing failure, and the operation information generated by the storage server 1 is a rollback instruction. And send the rollback instruction to the storage server 2, the storage server 3, and the storage server 4, and then perform the rollback operation.
  • some storage servers may receive the operation information sent by the coordination server.
  • the storage server After receiving the operation information, the storage server receives the query request sent by other storage servers according to the transaction in the query request.
  • the data identifier determines the write request of the query request, and then determines the operation information corresponding to the transaction to which the write request belongs, and then sends the operation information to the storage server that sent the query request.
  • the storage server 1 receives the operation information sent by the coordination server as a commit instruction. After the storage server 1 receives a query request sent by another storage server, the storage server 1 determines that the transaction to which the write request of the query request belongs corresponds to commit. Command, and then send a commit command to the storage server that sent the query request.
  • the storage server By sending transaction data distribution information to the storage server, when the storage server senses the failure of the coordination server, it queries other storage servers included in the transaction data distribution information for the execution results of other storage servers executing write requests based on the transaction data distribution information, and then According to the execution results of other storage servers, the commit operation or rollback operation is determined to prevent the storage server from not releasing the system resources requested for executing the above write request when the storage server does not receive the operation information of the coordinating server, which causes the system to be blocked and cannot be executed. Problems with new transactions and can improve the reliability of the system.
  • the storage server may also fail, causing the storage server to fail to execute the write request or fail to return the execution result to the coordination server after executing the write request.
  • the coordination server does not receive the execution result of the storage server within the preset time period, it is determined that the storage server is faulty.
  • the distributed system will select a replacement storage server from other storage servers to replace the failed storage server, and restore the failure in the replacement server based on the corresponding copy of the data in the failed storage server Store the data in the server.
  • the coordination server determines the information of the above-mentioned alternative storage server, the coordination server resends the corresponding write request to the above-mentioned alternative storage server, and then the alternative storage server that receives the write request executes the write operation specified in the write request and sends it to the coordination server The execution result of the execution of the write request.
  • the coordination server determines that the storage server m replaces the storage server 2, it updates the transaction data distribution information, for example, replaces the storage server 2 in the transaction data distribution information with the storage server m, and then sends the write request sent to the storage server 2 to the storage server m, and send the updated transaction data distribution information to the storage server 1, the storage server 3, and the storage server 4.
  • the storage server m After the storage server m receives the write request, it executes the operation specified in the write request, and then sends the execution result after executing the write request to the coordination server, and the coordination server according to the storage server 1, storage server 3, storage server 4, and storage server m The result of the execution determines the result of the transaction.
  • FIG. 8 is a schematic structural diagram of a coordination device provided by an embodiment of the present application.
  • 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).
  • the communication unit 810 is configured to receive a transaction sent by the service server, 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.
  • each transaction data information includes storage location information of a copy of the original data on the storage server and a write operator.
  • the processing unit 820 is configured to determine transaction data distribution information according to pre-stored data distribution information, where the data distribution information indicates a storage server that stores each copy of each original data in the transaction processing system, and the transaction data distribution information indicates storage of the foregoing A storage server for each copy of the original data corresponding to each transaction data information included in the transaction.
  • the processing unit 820 is further configured to generate at least one write request according to the received transaction, and each write request includes the foregoing transaction data distribution information and one transaction data information.
  • each write request includes the foregoing transaction data distribution information and one transaction data information.
  • the communication unit 810 is also configured to send each write request to the storage server where the copy of the original data corresponding to the transaction data information included in each write request is located.
  • the execution result sent by each storage server that receives the write request is received, and the execution result is the execution result of the storage server that received the write request operating the copy of the original data corresponding to the transaction data information included in the received write request.
  • the operation of the communication unit 810 sending each write request to the corresponding storage server may be the relevant description in S302 above.
  • the processing unit 820 is further configured to determine the transaction processing result of the transaction according to the execution result of executing the write request sent by each storage server that receives the write request. For the operation of the processing unit 820 to determine the transaction processing result, reference may be made to the relevant description in the foregoing S305, which will not be repeated here.
  • the communication unit 810 is also configured to send the transaction processing result to the service server.
  • the coordination device 800 may further include a storage unit 830, and the storage unit 830 is configured to store the foregoing data distribution information.
  • the specific operation of the coordination device 800 to implement distributed fact submission can refer to the operations performed by the coordination server in the foregoing method embodiment.
  • the processing unit 820 is configured to perform the operations performed by the coordination server in S301 to S305 or S601 to S603. The operation is not repeated here.
  • the storage device 900 includes a communication unit 910 and a processing unit 920. Among them, the communication unit 910 is used to communicate with other storage servers (storage devices) and coordination servers (coordination devices).
  • storage devices storage devices
  • coordination servers coordination devices
  • the communication unit 910 is configured to receive a write request sent by the coordination server.
  • the write request includes transaction data distribution information and one transaction data information.
  • the write request is any one or more of at least one write request generated by the coordination server according to the received transaction.
  • a write request, the target storage server is any one of the multiple storage servers where the copy of the original data corresponding to the transaction data information included in the at least one write request is located, the transaction includes at least one transaction data information, and the transaction data distribution information indicates the storage transaction
  • the storage server for each copy of the original data corresponding to each transaction data information included.
  • transaction data information, etc. please refer to the description in the above S301, which will not be repeated here.
  • the processing unit 920 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 the communication unit 910 sends the execution result of the above write request to the coordination server.
  • the processing unit 920 after receiving the write request reference may be made to operations performed by the storage server in S303 and S304, which will not be repeated here.
  • the communication unit 910 is also configured to receive a read request sent by the coordination server, where the read request includes the storage location of the copy of the target data on the storage server and the read operator.
  • the read request includes the storage location of the copy of the target data on the storage server and the read operator.
  • the processing unit 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.
  • the specific operation of the processing unit 920 to query the execution result of the at least one write request refer to the operation of the target storage server sending a query request to one or more storage servers in S602; the processing unit 920 feedbacks according to each storage server that receives the write request.
  • the method for determining the execution of the commit operation or the rollback operation according to the execution result refer to the description of the target storage server performing the commit operation or the rollback operation according to the query result in S603, which will not be repeated here.
  • the processing unit 920 is further configured to generate 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; the communication unit 910 is also configured to transfer the operation
  • the information is sent to a storage server that stores each copy of the original data corresponding to each transaction data information included in the transaction.
  • the method for the processing unit 920 to generate the operation information may refer to the method for the target storage server to generate the operation information in S603.
  • the storage device 900 further includes a storage unit 930, which is used to store the original data that needs to be manipulated by the write request and the target data that needs to be read by the read request.
  • the processing unit 920 is configured to perform the operations performed by the storage server in S301 to S305 or S601 to S603. The operation is not repeated here.
  • 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).
  • the communication unit 1010 is configured to receive a write request sent by the coordination server.
  • the write request includes transaction data distribution information and one transaction data information.
  • the write request is one of at least one write request generated by the coordination server according to the received transaction, and the storage server Is one of the multiple storage servers where a copy of the original data corresponding to the transaction data information included in the at least one write request is located, the transaction includes at least one transaction data information, and each transaction data information includes a copy of the original data on the storage server
  • the storage location information and the write operator, and the transaction data distribution information indicate a storage server that stores each copy of the original data corresponding to each transaction data information included in the transaction.
  • transaction data information, etc. please refer to the description in the above S301, which will not be repeated here.
  • the processing unit 1020 is configured to operate on a copy of the original data corresponding to the transaction data information included in the write request according to the transaction data information; the communication unit 1010 is also configured to send the execution result of the write request to the coordination server.
  • the processing unit 1020 after receiving the write request reference may be made to operations performed by the storage server in S303 and S304, which will not be repeated here.
  • the processing unit 1020 is further configured to determine that the operation information sent by the coordination server is not received within a preset time after sending the execution result of the write request to the coordination server, and send the operation information to the storage according to the transaction data distribution information.
  • the storage server of each copy of the original data corresponding to each transaction data information included in the transaction queries the execution result of the at least one write request; according to the execution result of the at least one write request obtained by the query, the commit operation or the response is executed Roll operation.
  • the processing unit 1020 executes, according to transaction data distribution information, querying the storage server storing each copy of the original data corresponding to each transaction data information included in the transaction for the execution result of the at least one write request, and according to the at least one write request.
  • For the operations performed as a result of the execution result of refer to the operations performed after the storage server perceives the failure of the coordination server in the foregoing method embodiment, which will not be repeated here.
  • the storage device 1000 further includes a storage unit 1030, which is configured to store the original data that needs to be operated on by the write request and the target data that needs to be read by the read request.
  • the processing unit 1020 executes the operations performed by the storage server in S301 to S305 and the operations performed by the storage server after sensing the failure of the coordination server, which will not be repeated here.
  • the coordination server 1100 includes: one or more processors 1110, a communication interface 1120, and a memory 1130.
  • the processor 1110, the communication interface 1120, and the memory 1130 are connected to each other through a bus 1140, where:
  • the processor 1110 is configured to implement the operations performed by the processing unit 820, and the specific implementation of the various operations performed by the processor 1110 may refer to the specific operations performed by the coordination server in the foregoing method embodiment.
  • the processor 1110 is configured to perform operations of the coordination server in S303 and S304 in FIG. 5, and details are not described herein again.
  • the processor 1110 may have a variety of specific implementation forms.
  • the processor 1110 may be a central processing unit (CPU) or an graphics processing unit (GPU), and the processor 1110 may also be a single-core processor or Multi-core processor.
  • the processor 1110 may be a combination of a CPU and a hardware chip.
  • the above-mentioned hardware chip may be an application-specific integrated circuit (ASIC), a programmable logic device (PLD) or a combination thereof.
  • the aforementioned PLD may 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 may also be implemented solely by a logic device with built-in processing logic, such as an FPGA or a digital signal processor (digital signal processor, DSP).
  • the communication interface 1120 can be a wired interface or a wireless interface for communicating with other modules or devices.
  • the wired interface can be an Ethernet interface, a local interconnect network (LIN), etc.
  • the wireless interface can be a cellular network interface or use Wireless LAN interface, etc.
  • the communication interface 1120 executes the operations implemented by the communication unit 810, for example, it can be used to execute the transaction sent by the service server in S301, or the execution result of the storage server.
  • the actions performed by the communication interface 1120 may refer to the actions received or sent by the coordination server in the foregoing method embodiments, and details are not described herein again.
  • the memory 1130 may be a non-volatile memory, for example, read-only memory (ROM), programmable read-only memory (programmable ROM, PROM), erasable programmable read-only memory (erasable PROM, EPROM), Electrically erasable programmable read-only memory (EPROM, EEPROM) or flash memory.
  • ROM read-only memory
  • PROM programmable read-only memory
  • EPROM erasable programmable read-only memory
  • EPROM Electrically erasable programmable read-only memory
  • EEPROM Electrically erasable programmable read-only memory
  • the memory 1130 may 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 coordinating operations performed by the server in the foregoing method embodiment.
  • the coordination server 1100 may include more or fewer components than those shown in FIG. 11, or may have different component configurations.
  • the bus 1140 may be a peripheral component interconnect standard (PCI) bus or an extended industry standard architecture (EISA) bus, etc.
  • PCI peripheral component interconnect standard
  • EISA extended industry standard architecture
  • the bus 1140 can be divided into an address bus, a data bus, a control bus, and so on. For ease of representation, only one thick line is used to represent in FIG. 11, but it does not mean that there is only one bus or one type of bus.
  • the coordination server 1100 may further include an input/output interface 1150, and the input/output interface 1150 is connected to an input/output device for receiving input information and outputting operation results.
  • FIG. 12 is a schematic structural diagram of a storage server according to an embodiment of the present application.
  • the storage server 1200 includes: one or more processors 1210, a communication interface 1220, and a memory 1230.
  • the processor 1210, the communication interface 1220, and the memory 1230 are connected to each other through a bus 1240, where:
  • the processor 1210 is configured to implement the operations performed by the processing unit 920.
  • the various operations performed by the processor 1210 refer to the specific operations performed by the storage server in the foregoing method embodiment.
  • the processor 1210 is used to perform the operations performed by the storage server in S303 and S304 in FIG. 5, or the operations performed by the storage servers in S301 to S305, and the operations performed by the storage server after sensing that the coordination server has failed. Go into details again.
  • the processor 1210 may have a variety of specific implementation forms.
  • the processor 1210 may be a central processing unit or an image processor, and 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.
  • the communication interface 1220 may be a wired interface or a wireless interface. For details, refer to the communication interface 1120.
  • the communication interface 1220 executes the operations implemented by the communication unit 910, which can be specifically used to perform operations such as receiving transaction data identifiers, transaction data information, and transaction data distribution information in S303, or perform operations of storing server execution results in S304. Send to the coordination server and other operations.
  • the actions performed by the communication interface 1220 may refer to the actions received or sent by the storage server in the foregoing method embodiment, and details are not described herein again.
  • the memory 1230 may be a non-volatile memory or a volatile memory. For details, refer to the memory 1130.
  • the memory 1230 may 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 foregoing method embodiment.
  • the storage server 1200 may include more or fewer components than those shown in FIG. 12, or may have different component configurations.
  • the bus 1240 may be a PCI bus, an EISA bus, or the like. For details, refer to the bus 1140.
  • the storage server 1200 may further include an input/output interface 1250, and the input/output interface 1250 is connected to an input/output device for receiving input information and outputting operation results.
  • FIG. 13 is a schematic structural diagram of a storage server according to an embodiment of the present application.
  • the storage server 1300 includes: one or more processors 1310, a communication interface 1320, and a memory 1330.
  • the processor 1310, the communication interface 1320, and the memory 1330 are connected to each other through a bus 1340, where:
  • the processor 1310 is configured to implement the operations performed by the processing unit 920, and the specific implementation of various operations performed by the processor 1310 may refer to the specific operations performed by the storage server in the foregoing method embodiment.
  • the processor 1310 is configured to perform the operations performed by the storage server in S301 to S305 in FIG. 5 and the operations performed by the storage server in the foregoing method-side embodiment after it perceives a failure of the coordination server, which will not be repeated here.
  • the processor 1310 can have a variety of specific implementation forms.
  • the processor 1310 can be a central processing unit or an image processor, the processor 1310 can also be a single-core processor or a multi-core processor, and the processor 1310 can also be composed of a CPU and a hardware chip. The combination.
  • the communication interface 1320 may be a wired interface or a wireless interface. For details, refer to the communication interface 1120.
  • the communication interface 1320 executes the operations implemented by the communication unit 910, which can be specifically used to perform operations such as receiving transaction data identifiers, transaction data information, and transaction data distribution information in S303, or execute S304 to store the execution results of the server Send to the coordination server and other operations.
  • the actions performed by the communication interface 1320 may refer to the actions received or sent by the storage server in the foregoing method embodiment, and details are not described herein again.
  • the memory 1330 may be a non-volatile memory or a volatile memory. For details, refer to the memory 1130.
  • the memory 1330 may 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, for example, the operations performed by the storage server in the foregoing method embodiment.
  • the storage server 1300 may include more or fewer components than those shown in FIG. 13, or may have different component configurations.
  • the bus 1340 may be a PCI bus, an EISA bus, or the like. For details, refer to the bus 1140.
  • the storage server 1300 may further include an input/output interface 1350.
  • the input/output interface 1350 is connected to an input/output device for receiving input information and outputting operation results.
  • the embodiment of the present application also provides a non-transitory computer-readable storage medium in which a computer program is stored.
  • the coordination server in the above-mentioned method embodiment can be implemented.
  • the processor of the computer storage medium can refer to the specific operations of the coordination server in the method embodiments for the specific implementation of the above method steps, which will not be repeated here.
  • the embodiments of the present application also provide a non-transitory computer-readable storage medium in which a computer program is stored.
  • the storage server in the above method embodiment can be executed.
  • the processor of the computer storage medium can refer to the specific operation of the storage server in the above method embodiment for the specific implementation of the above method steps, which will not be repeated here.
  • the above-mentioned embodiments may be implemented in whole or in part by software, hardware, firmware or any other combination.
  • the above-mentioned embodiments may be implemented in the form of a computer program product in whole or in part.
  • the computer program product includes one or more computer instructions.
  • the computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices.
  • the computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium.
  • the computer instructions may be transmitted from a website, computer, server, or data center.
  • the computer-readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server or a data center that includes one or more sets of available media.
  • the usable medium may be a magnetic medium (for example, a floppy disk, a hard disk, a magnetic tape), an optical medium (for example, a DVD), or a semiconductor medium.
  • the semiconductor medium may be a solid state drive (SSD).
  • the steps in the method in the embodiment of the present application can be adjusted, merged, or deleted in order according to actual needs; the modules in the device in the embodiment of the present application can be divided, merged, or deleted according to actual needs.

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Computing Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The present application provides a transaction commit system and method, and a related device. The system comprises a coordination server and a plurality of storage servers. The method comprises: the coordination server receives a transaction sent by a service server, generates at least one write request according to the transaction, and sends write requests to the storage servers which store data required to be operated by the write requests; the storage servers which receive the write requests execute the received write requests, and respectively send the execution results to the coordination server; the coordination server determines the transaction processing result of the transaction according to the execution results of the write requests fed back by the storage servers, and sends the transaction processing result to the service server. The coordination server can determine the transaction processing result of the transaction according to the execution results of the write requests sent by the storage servers, and returns the transaction processing result of the transaction to the service server, thereby achieving one-phase transaction commit, reduces the time delay of write request processing, and improves the processing efficiency and the working efficiency of the service server.

Description

一种事务提交系统、方法及相关设备Transaction submission system, method and related equipment 技术领域Technical field

本申请涉及计算机技术领域,尤其涉及一种事务提交系统、方法及相关设备。This application relates to the field of computer technology, in particular to a transaction submission system, method and related equipment.

背景技术Background technique

事务是数据库管理系统执行过程中的一个逻辑单位,包括一个有限的数据库操作序列。分布式系统中,为了提高数据的可靠性,需要为数据建立冗余关系,例如为数据存储多个副本以建立冗余关系,这多个副本分布在不同的节点中。当一个事务跨越多个参与者执行时,各个参与者能够确定各自执行的事务的执行结果,但无法知道其他参与者的执行结果。为了保持事务的原子性(atomicity)、一致性(consistency)、隔离性(isolation)、持久性(durability),需要引入协调者对执行事务的参与者进行管理。二阶段提交是基于分布式系统系统架构进行事务提交时而设计的一种方法,但是该方法中协调者与参与者以及分布式系统中的主副本之间需要进行多次交互,会导致事务提交的时延较长。A transaction is a logical unit in the execution of a database management system, including a limited sequence of database operations. In a distributed system, in order to improve the reliability of data, it is necessary to establish a redundant relationship for the data. For example, multiple copies of the data are stored to establish a redundant relationship, and the multiple copies are distributed in different nodes. When a transaction is executed across multiple participants, each participant can determine the execution result of the transaction executed by each participant, but cannot know the execution result of other participants. In order to maintain the atomicity, consistency, isolation, and durability of the transaction, it is necessary to introduce a coordinator to manage the participants in the execution of the transaction. Two-phase commit is a method designed for transaction commit based on the system architecture of a distributed system. However, in this method, multiple interactions are required between the coordinator and the participants and the master copy in the distributed system, which will cause the transaction to be committed. The time delay is longer.

发明内容Summary of the invention

本发明实施例提供一种事务提交系统、方法及相关设备,能够减少事务提交的时延。The embodiment of the present invention provides a transaction submission system, method and related equipment, which can reduce the time delay of transaction submission.

第一方面,本申请提供一种事务处理系统,包括协调服务器和多个存储服务器,其中,In the first aspect, this application provides a transaction processing system, including a coordination server and multiple storage servers, where:

所述协调服务器,用于接收事务,所述事务包括至少一个事务数据信息,每个事务数据信息包括一个原始数据的副本在存储服务器上的存储位置信息以及写操作符;根据预先存储的数据分布信息,确定事务数据分布信息,其中,所述数据分布信息指示所述事务处理系统中存储每个原始数据的每个副本的存储服务器,所述事务数据分布信息指示存储所述事务包括的每个事务数据信息对应的原始数据的每个副本的存储服务器;生成至少一个写请求,每个写请求包括所述事务数据分布信息以及一个事务数据信息;将所述每个写请求发送至所述每个写请求包括的事务数据信息对应的原始数据的副本所在的存储服务器;The coordination server is configured to receive transactions, the transaction includes at least one transaction data information, and each transaction data information includes the storage location information of a copy of the original data on the storage server and the write operator; according to the pre-stored data distribution Information to determine transaction data distribution information, wherein the data distribution information indicates a storage server in the transaction processing system that stores each copy of each original data, and the transaction data distribution information indicates that each transaction included in the transaction is stored The storage server for each copy of the original data corresponding to the transaction data information; generate at least one write request, each write request including the transaction data distribution information and one transaction data information; send each write request to the each 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; operate 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; Sending the execution result of the write request to the coordination server;

所述协调服务器,还用于根据每个接收到所述写请求的存储服务器发送的所述写请求的执行结果,确定所述事务的事务处理结果,向业务服务器发送所述事务处理结果。The coordination server is further configured to determine the transaction processing result of the transaction according to the execution result of the write request sent by each storage server that receives the write request, and send the transaction processing result to the service server.

协调服务器根据接收到的事务中的事务数据信息生成一个或者多个写请求,然后根据预先存储的分布式系统的数据分布信息,将每个写请求直接发送给每个写请求中包括的事务数据信息对应的原始数据的每个副本所在的存储服务器,从而能够避免协调服务器先将写请求发送给事务数据信息对应的原始数据的主副本所在的存储服务器,再由主副本将写请求发送给对应的备副本过程,提高写请求发送至各个存储服务器的效率。另外,接收到写请求的存储服务器在执行完接收到的写请求之后,各个存储服务器分别将执行写请求的执行结果反馈给协调服务器,协调服务器根据各个存储服务器反馈的执行结果,即可确定事务的事务处理结果,然后将上述事务的事务处理结果返回给业务服务器,从而实现一阶段事务提交,降低 写请求处理的时延,提高写请求的处理效率与业务服务器的工作效率。The coordination server generates one or more write requests according to the transaction data information in the received transaction, and then sends each write request directly to the transaction data included in each write request according to the data distribution information of the distributed system stored in advance The storage server where each copy of the original data corresponding to the information is located, so as to avoid the coordination server from first sending the write request to the storage server where the master copy of the original data corresponding to the transaction data information is located, and then the master copy sends the write request to the corresponding The backup copy process improves the efficiency of sending write requests to each storage server. In addition, after the storage server that received the write request has executed the received write request, each storage server feeds back the execution result of the write request to the coordination server, and the coordination server can determine the transaction based on the execution result fed back by each storage server. Then, the transaction processing result of the above transaction is returned to the business server, so as to realize the one-stage transaction submission, reduce the time delay of write request processing, and improve the processing efficiency of write request and the work efficiency of the business server.

在一种可能的实现方式中,所述协调服务器,用于接收读请求,所述读请求包括目标数据的副本在存储服务器上的存储位置和读操作符;根据所述数据分布信息,确定存储所述目标数据的副本的存储服务器;将所述读请求发送至存储所述目标数据的副本的存储服务器;In a possible implementation manner, the coordination server is configured to receive a read request, where the read request includes a storage location and a read operator of a copy of the target data on the storage server; and the storage is determined according to the data distribution information. A storage server for the copy of the target data; sending the read request to the storage server for the copy of the target data;

接收到所述读请求的存储服务器,用于根据所述事务数据分布信息,向每个接收到所述写请求的存储服务器查询所述写请求的执行结果;根据每个接收到所述写请求的存储服务器发送的执行所述写请求的执行结果,确定执行提交操作或回滚操作;执行所述提交操作或所述回滚操作后,根据所述目标数据的副本在存储服务器上的存储位置读取所述目标数据;将读取的所述目标数据发送至所述协调服务器。The storage server that has received the read request is configured to query each storage server that has received the write request for the execution result of the write request according to the transaction data distribution information; according to each received write request The execution result of the execution of the write request sent by the storage server determines the execution of the commit operation or the rollback operation; after the execution of the commit operation or the rollback operation, according to the storage location of the copy of the target data on the storage server Read the target data; send the read target data to the coordination server.

在一种可能的实现方式中,接收到所述读请求的存储服务器,还用于根据所述写请求的执行结果生成操作信息,所述操作信息指示提交操作或回滚操作,将所述操作信息发送至每个接收到所述写请求的存储服务器。In a possible implementation manner, the storage server that receives the read request is further configured to generate operation information according to the execution result of the write request, and the operation information indicates a commit operation or a rollback operation, and the operation The information is sent to each storage server that receives the write request.

协调服务器在不向存储服务器发送commit指令或者rollback指令的情况下,若存储服务器接收到读请求,该存储服务器可以根据接收到的写请求中的事务数据标识与事务数据分布信息,向存储上述事务包括的每个事务数据信息对应的原始数据的每个副本的存储服务器查询写请求的执行结果,根据查询到的写请求的执行结果确定执行提交操作或者回滚操作,然后执行接收到的读请求。通过存储服务器来确定写请求对应的事务执行提交操作或者回滚操作,减少业务服务器处理的数据量,提高业务服务器的效率。The coordination server does not send commit instructions or rollback instructions to the storage server. If the storage server receives a read request, the storage server can send the transaction data to the storage server according to the transaction data identifier and transaction data distribution information in the received write request. The storage server of each copy of the original data corresponding to each transaction data information included queries the execution result of the write request, and determines the commit operation or rollback operation according to the execution result of the queried write request, and then executes the received read request . The storage server is used to determine the transaction corresponding to the write request to perform the commit operation or rollback operation, which reduces the amount of data processed by the business server and improves the efficiency of the business server.

在一种可能的实现方式中,所述目标数据的副本在存储服务器上的存储位置和所述原始数据的副本在存储服务器上的存储位置存在重叠,或者所述目标数据的副本和所述原始数据的副本存储于需要保持一致性的数据块中。In a possible implementation, the storage location of the copy of the target data on the storage server and the storage location of the copy of the original data on the storage server overlap, or the copy of the target data and the original Copies of data are stored in data blocks that need to be consistent.

在一种可能的实现方式中,所述协调服务器,用于根据所述数据分布信息,确定多个存储所述目标数据的副本的存储服务器;从确定的所述多个存储所述目标数据的副本的存储服务器中选择目标存储服务器;将所述读请求发送至所述目标存储服务器。In a possible implementation manner, the coordination server is configured to determine multiple storage servers that store copies of the target data according to the data distribution information; from the determined multiple storage servers that store the target data Select a target storage server from the storage servers of the copy; send the read request to the target storage server.

该目标存储服务器可以是存储所述目标数据的副本的多个存储服务器中距离协调服务器最近的,或存储所述目标数据的副本的多个存储服务器中协调服务器访问速度最快的,从而能够提高业务服务器的读取目标数据的速度,提高工作效率。The target storage server may be the closest to the coordination server among the multiple storage servers that store the copies of the target data, or the coordination server has the fastest access speed among the multiple storage servers that store the copies of the target data, so as to improve The speed at which the business server reads the target data improves work efficiency.

在一种可能的实现方式中,所述协调服务器,还用于根据每个接收到所述写请求的存储服务器发送的所述写请求的所述执行结果,确定每个接收到所述写请求的存储服务器需要执行的操作信息,所述操作信息指示执行提交操作或回滚操作,将所述操作信息发送至每个接收到所述写请求的存储服务器。In a possible implementation manner, the coordination server is further configured to determine that each write request is received according to the execution result of the write request sent by each storage server that receives the write request The operation information that the storage server needs to perform, the operation information indicates the execution of a commit operation or a rollback operation, and the operation information is sent to each storage server that receives the write request.

在一种可能的实现方式中,接收到所述写请求的存储服务器,还用于确定向所述协调服务器发送所述操作的执行结果后的预设时间内未收到所述协调服务器发送的所述操作信息,根据所述事务数据分布信息,向存储所述事务包括的每个事务数据信息对应的原始数据的每个副本的存储服务器查询写请求的执行结果;根据所述执行结果,确定执行所述提交操作或所述回滚操作。In a possible implementation manner, the storage server that receives the write request is further used to determine that no data sent by the coordination server is received within a preset time after sending the execution result of the operation to the coordination server. The operation information, according to the transaction data distribution information, 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 write request; and determines according to the execution result Perform the commit operation or the rollback operation.

存储服务器在向协调服务器反馈执行结果之后,在预设时长内没有接收到协调服务器发送的操作信息,存储服务器确定协调服务器发生故障。存储服务器根据事务数据分布信息向事务数据分布信息中包括的其他存储服务器查询其他存储服务器执行写请求的执行结果,然后根据其他存储服务器的执行结果确定执行提交操作或者回滚操作,防止存储服务器在没有 接收到协调服务器的commit指令或者rollback指令时,存储服务器不能释放执行上述写请求是申请的系统资源,导致系统阻塞,不能执行新的事务的问题,并能提升系统的可靠性。After the storage server feeds back the execution result to the coordination server, it does not receive the operation information sent by the coordination server within a preset time period, and the storage server determines that the coordination server is faulty. According to the transaction data distribution information, the storage server queries other storage servers included in the transaction data distribution information for the execution results of other storage servers executing write requests, and then determines to perform the commit operation or rollback operation based on the execution results of other storage servers to prevent the storage server from being When the commit command or rollback command from the coordination server is not received, the storage server cannot release the system resources applied for to execute the above write request, which leads to system congestion and inability to execute new transactions, and can improve the reliability of the system.

第二方面,本申请提供一种事务处理方法,应用于包括协调服务器和多个存储服务器的事务处理系统,所述方法包括:In a second aspect, the present application provides a transaction processing method, which is applied to a transaction processing system including a coordination server and multiple storage servers, and the method includes:

所述协调服务器接收业务服务器发送的事务,所述事务包括至少一个事务数据信息,每个事务数据信息包括一个原始数据的副本在存储服务器上的存储位置信息以及写操作符;The coordination server receives a transaction sent by a business server, 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 according to pre-stored data distribution information, where the data distribution information indicates a storage server that stores each copy of each original data in the transaction processing system, and the transaction data distribution The information indicates a storage server that stores each copy of original data corresponding to each transaction data information included in the transaction;

所述协调服务器生成至少一个写请求,每个写请求包括所述事务数据分布信息以及一个事务数据信息;The coordination server generates at least one write request, and each write request includes the transaction data distribution information and one 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, and according to the transaction data information included in the write request, operates on a copy of the original data corresponding to the transaction data information included in the write request, and reports to the Coordinating the server to send the execution result of the write request;

所述协调服务器根据每个接收到所述写请求的存储服务器发送的所述写请求执行结果,确定所述事务的事务处理结果,并向业务服务器发送所述事务处理结果。The coordination server determines the transaction processing result of the transaction according to the execution result of the write request sent by each storage server that receives the write request, and sends the transaction processing result to the service server.

在一种可能的实现方式中,所述协调服务器接收所述业务服务器发送的读请求,所述读请求包括目标数据的副本在存储服务器上的存储位置和读操作符;In a possible implementation manner, the coordination server receives a read request sent by the business server, where the read request includes a storage location and a read operator of the copy of the target data on the storage server;

所述协调服务器根据所述数据分布信息,确定存储所述目标数据的副本的存储服务器,将所述读请求发送至存储所述目标数据的副本的存储服务器;The coordination server determines a storage server that stores a copy of the target data according to the data distribution information, and sends the read request to the storage server that stores the copy of the target data;

接收到所述读请求的存储服务器根据所述事务数据分布信息,向每个接收到所述写请求的存储服务器查询所述写请求的执行结果;根据每个接收到所述写请求的存储服务器发送的执行所述写请求的执行结果,确定执行提交操作或回滚操作;According to the transaction data distribution information, the storage server that has received the read request queries each storage server that has received the write request for the execution result of the write request; according to each storage server that has received the write request The sent execution result of the execution of the write request, confirming the execution of the commit operation or the rollback operation;

接收到所述读请求的存储服务器根据所述目标数据的副本在存储服务器上的存储位置读取所述目标数据,将读取的所述目标数据发送至所述协调服务器。The storage server that receives the read request reads the target data according to the storage location of the copy of the target data on the storage server, and sends the read target data to the coordination server.

在一种可能的实现方式中,接收到所述读请求的存储服务器根据所述写请求的执行结果生成操作信息,并将所述操作信息发送至每个接收到所述写请求的存储服务器,所述操作信息指示提交操作或回滚操作。In a possible implementation manner, 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, The operation information indicates a commit operation or a rollback operation.

在一种可能的实现方式中,所述目标数据的副本在存储服务器上的存储位置和所述原始数据的副本在存储服务器上的存储位置存在重叠,或者所述目标数据的副本和所述原始数据的副本存储于需要保持一致性的数据块中。In a possible implementation, the storage location of the copy of the target data on the storage server and the storage location of the copy of the original data on the storage server overlap, or the copy of the target data and the original Copies of data are stored in data blocks that need to be consistent.

在一种可能的实现方式中,所述协调服务器根据所述数据分布信息,确定存储所述目标数据的副本的存储服务器,将所述读请求发送至存储所述目标数据的副本的存储服务器,包括:In a possible implementation manner, the coordination server determines a storage server that stores a copy of the target data according to the data distribution information, and sends the read request to the storage server that stores the copy of the target data, include:

所述协调服务器根据所述数据分布信息,确定多个存储所述目标数据的副本的存储服务器;The coordination server determines a plurality of storage servers that store copies of the target data according to the data distribution information;

所述协调服务器从确定的所述多个存储所述目标数据的副本的存储服务器中选择目标存 储服务器,并将所述读请求发送至所述目标存储服务器。The coordination server selects a target storage server from the determined storage servers that store copies of the target data, and sends the read request to the target storage server.

在一种可能的实现方式中,所述方法还包括:所述协调服务器根据每个接收到所述写请求的存储服务器发送的所述写请求的执行结果,确定每个接收到所述写请求的存储服务器需要执行的操作信息,所述操作信息指示执行提交操作或回滚操作;In a possible implementation manner, the method further includes: the coordination server determines that each write request is received according to the execution result of the write request sent by each storage server that receives the write request Operation information that the storage server needs to perform, where the operation information indicates the execution of a commit operation or a rollback operation;

所述协调服务器将所述操作信息发送至每个接收到所述写请求的存储服务器。The coordination server sends the operation information to each storage server that receives the write request.

在一种可能的实现方式中,所述方法还包括:In a possible implementation manner, the method further includes:

接收到所述写请求的存储服务器确定向所述协调服务器发送所述操作的执行结果后预设时间内未收到所述协调服务器发送的所述操作信息,根据所述事务数据分布信息,向存储所述事务包括的每个事务数据信息对应的原始数据的每个副本的存储服务器查询写请求的执行结果;After receiving the write request, the storage server 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 according to the transaction data distribution information, The storage server storing each copy of the original data corresponding to each transaction data information included in the transaction queries the execution result of the write request;

接收到所述写请求的存储服务器根据所述执行结果,确定执行所述提交操作或所述回滚操作。The storage server receiving the write request determines to execute the commit operation or the rollback operation according to the execution result.

第三方面,本申请提供一种事务处理方法,应用于包括协调服务器和多个存储服务器的事务处理系统中的协调服务器,所述方法包括: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, and the method includes:

协调服务器接收业务服务器发送的事务,所述事务包括至少一个事务数据信息,每个事务数据信息包括一个原始数据的副本在存储服务器上的存储位置信息以及写操作符;The coordination server receives the transaction sent by the business server, the transaction includes at least one transaction data information, and each transaction data information includes the storage location information of a copy of the original data on the storage server and the write operator;

所述协调服务器根据预先存储的数据分布信息,确定事务数据分布信息,其中,所述数据分布信息指示事务处理系统中存储每个原始数据的每个副本的存储服务器,所述事务数据分布信息指示存储所述事务包括的每个事务数据信息对应的原始数据的每个副本的存储服务器;The coordination server determines transaction data distribution information according to pre-stored data distribution information, where the data distribution information indicates a storage server that stores each copy of each original data in the transaction processing system, and the transaction data distribution information indicates A storage server that stores each copy of original data corresponding to each transaction data information included in the transaction;

所述协调服务器生成至少一个写请求,每个写请求包括所述事务数据分布信息以及一个事务数据信息;The coordination server generates at least one write request, and each write request includes the transaction data distribution information and one 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;

所述协调服务器接收每个接收到所述写请求的存储服务器发送的所述写请求的执行结果;Receiving, by the coordination server, an execution result of the write request sent by each storage server that receives the write request;

所述协调服务器根据每个接收到所述写请求的存储服务器发送的所述写请求的执行结果,确定所述事务的事务处理结果,并向所述业务服务器发送所述事务处理结果。The coordination server determines the transaction processing result of the transaction according to the execution result of the write request sent by each storage server that receives the write request, and sends the transaction processing result to the service server.

在一种可能的实现方式中,所述方法还包括:所述协调服务器根据每个接收到所述写请求的存储服务器发送的所述写请求的执行结果,确定每个接收到所述写请求的存储服务器需要执行的操作信息,所述操作信息指示执行提交操作或回滚操作;In a possible implementation manner, the method further includes: the coordination server determines that each write request is received according to the execution result of the write request sent by each storage server that receives the write request Operation information that the storage server needs to perform, where the operation information indicates the execution of a commit operation or a rollback operation;

所述协调服务器将所述操作信息发送至每个接收到所述写请求的存储服务器。The coordination server sends the operation information to each storage server that receives the write request.

第四方面,本申请提供一种事务处理方法,应用于包括协调服务器和多个存储服务器的事务处理系统中的存储服务器,所述方法包括:In a fourth aspect, the present application provides a transaction processing method, which is applied to a storage server in a transaction processing system including a coordination server and multiple storage servers, and the method includes:

存储服务器接收协调服务器发送的写请求,所述写请求包括事务数据分布信息以及一个事务数据信息,所述写请求是所述协调服务器根据接收到的事务生成的至少一个写请求之一,所述存储服务器是所述至少一个写请求包括的事务数据信息对应的原始数据的副本所在的多个存储服务器之一,所述事务包括至少一个事务数据信息,每个事务数据信息包括一个原始数据的副本在存储服务器上的存储位置信息以及写操作符,事务数据分布信息指示存储所述事务包括的每个事务数据信息对应的原始数据的每个副本的存储服务器;The storage server receives a write request sent by the coordination server. The write request includes transaction data distribution information and one transaction data information. The write request is one of at least one write request generated by the coordination server according to the received transaction. The storage server is one of multiple storage servers where a copy of the original data corresponding to the transaction data information included in the at least one write request is located, the transaction includes at least one transaction data information, and each transaction data information includes a copy of the original data The storage location information and the write operator on the storage server, and the transaction data distribution information indicates the storage server that stores each copy of the original data corresponding to each transaction data information included in the transaction;

所述存储服务器根据所述事务数据信息,对所述写请求包括的事务数据信息对应的原始 数据的副本进行操作,并向所述协调服务器发送所述写请求的执行结果;The 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 the 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 and a read operator of the copy of the target data on the storage server;

所述存储服务器根据所述事务数据分布信息,向存储所述事务包括的每个事务数据信息对应的原始数据的每个副本的存储服务器查询所述至少一个写请求的执行结果;According to the transaction data distribution information, the storage server queries a storage server that stores each copy of original data corresponding to each transaction data information included in the transaction for the execution result of the at least one write request;

所述存储服务器根据查询得到的所述至少一个写请求的执行结果,执行提交操作或回滚操作。The storage server executes a commit operation or a rollback operation according to the execution result of the at least one write request obtained by the query.

在一种可能的实现方式中,所述方法还包括:所述存储服务器根据查询得到的所述至少一个写请求的执行结果,生成操作信息,所述操作信息指示提交操作或回滚操作;In a possible implementation manner, the method further includes: the storage server generates 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;

所述存储服务器将所述操作信息发送至存储所述事务包括的每个事务数据信息对应的原始数据的每个副本的存储服务器。The storage server sends the operation information to a storage server that stores each copy of original data corresponding to each transaction data information included in the transaction.

在一种可能的实现方式中,所述目标数据的副本在存储服务器上的存储位置和所述原始数据的副本在存储服务器上的存储位置存在重叠,或者所述目标数据的副本和所述原始数据的副本存储于需要保持一致性的数据块中。In a possible implementation, the storage location of the copy of the target data on the storage server and the storage location of the copy of the original data on the storage server overlap, or the copy of the target data and the original Copies of data are stored in data blocks that need to be consistent.

第五方面,本申请提供一种事务处理方法,应用于包括协调服务器和多个存储服务器的事务处理系统中的存储服务器,所述方法包括:In a fifth aspect, the present application provides a transaction processing method, which is applied to a storage server in a transaction processing system including a coordination server and multiple storage servers, and the method includes:

存储服务器接收协调服务器发送的写请求,所述写请求包括事务数据分布信息以及一个事务数据信息,所述写请求是所述协调服务器根据接收到的事务生成的至少一个写请求之一,所述存储服务器是所述至少一个写请求包括的事务数据信息对应的原始数据的副本所在的多个存储服务器之一,所述事务包括至少一个事务数据信息,每个事务数据信息包括一个原始数据的副本在存储服务器上的存储位置信息以及写操作符,事务数据分布信息指示存储所述事务包括的每个事务数据信息对应的原始数据的每个副本的存储服务器;The storage server receives a write request sent by the coordination server. The write request includes transaction data distribution information and one transaction data information. The write request is one of at least one write request generated by the coordination server according to the received transaction. The storage server is one of multiple storage servers where a copy of the original data corresponding to the transaction data information included in the at least one write request is located, the transaction includes at least one transaction data information, and each transaction data information includes a copy of the original data The storage location information and the write operator on the storage server, and the transaction data distribution information indicates the storage server that stores each copy of the original data corresponding to each transaction data information included in the transaction;

所述服务器根据所述事务数据信息,对所述写请求包括的事务数据信息对应的原始数据的副本进行操作,并向所述协调服务器发送所述写请求的执行结果;The 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 the execution result of the write request to the coordination server;

所述存储服务器确定向所述协调服务器发送所述写请求的执行结果后的预设时间内未收到所述协调服务器发送的操作信息,根据所述事务数据分布信息,向存储所述事务包括的每个事务数据信息对应的原始数据的每个副本的存储服务器查询所述至少一个写请求的执行结果;The storage server determines that the operation information sent by the coordination server is not received within a preset time after sending the execution result of the write request to the coordination server, and according to the transaction data distribution information, the storage of the transaction includes The storage server of each copy of the original data corresponding to each transaction data information inquires the execution result of the at least one write request;

所述存储服务器根据查询得到的所述至少一个写请求的执行结果,执行提交操作或回滚操作。The storage server executes a commit operation or a rollback operation according to the execution result of the at least one write request obtained by the query.

第六方面,本申请提供一种协调装置,所述协调装置包括:In a sixth aspect, the present application provides a coordination device, and the coordination device includes:

通信单元,用于接收业务服务器发送的事务,所述事务包括至少一个事务数据信息,每个事务数据信息包括一个原始数据的副本在存储服务器上的存储位置信息以及写操作符;The communication unit is configured to receive a transaction sent by the service server, 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 processing unit is configured to determine transaction data distribution information according to pre-stored data distribution information, where the data distribution information indicates a storage server that stores each copy of each original data in the transaction processing system, and the transaction data distribution information Indicating a storage server that stores each copy of original data corresponding to each transaction data information included in the transaction;

生成至少一个写请求,每个写请求包括所述事务数据分布信息以及一个事务数据信息;Generating at least one write request, each write request including the transaction data distribution information and one 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 the transaction processing result of the transaction according to the 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 service server.

在一种可能的实现方式中,所述处理单元具体用于根据每个接收到所述写请求的存储服务器发送的所述写请求的执行结果,确定每个接收到所述写请求的存储服务器需要执行的操作信息,所述操作信息指示执行提交操作或回滚操作;In a possible implementation manner, the processing unit is specifically configured to determine each storage server that receives the write request according to the execution result of the write request sent by each storage server that receives the write request The operation information that needs to be executed, the operation information indicating the execution of 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.

第七方面,本申请提供一种存储装置,所述装置包括:In a seventh aspect, the present application provides a storage device, the device including:

通信单元,用于接收协调服务器发送的写请求,所述写请求包括事务数据分布信息以及一个事务数据信息,所述写请求是所述协调服务器根据接收到的事务生成的至少一个写请求之一,所述存储服务器是所述至少一个写请求包括的事务数据信息对应的原始数据的副本所在的多个存储服务器之一,所述事务包括至少一个事务数据信息,每个事务数据信息包括一个原始数据的副本在存储服务器上的存储位置信息以及写操作符,事务数据分布信息指示存储所述事务包括的每个事务数据信息对应的原始数据的每个副本的存储服务器;The communication unit is configured to receive a write request sent by the coordination server, the write request includes transaction data distribution information and one transaction data information, and the write request is one of at least one write request generated by the coordination server according to the received transaction The storage server is one of a plurality of storage servers where a copy of the original data corresponding to the transaction data information included in the at least one write request is located, the transaction includes at least one transaction data information, and each transaction data information includes an original The storage location information and the write operator of the copy of the data on the storage server, and the transaction data distribution information indicates the storage server that stores each copy of the original data corresponding to each transaction data information included in the transaction;

处理单元,根据所述事务数据信息,对所述写请求包括的事务数据信息对应的原始数据的副本进行操作;A processing unit, based on the transaction data information, operating on 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, where the read request includes the storage location and the reading of the copy of the target data on the storage server. Operator

所述处理单元,还用于根据所述事务数据分布信息,向存储所述事务包括的每个事务数据信息对应的原始数据的每个副本的存储服务器查询所述至少一个写请求的执行结果;The processing unit is further configured to query the execution result of the at least one write request from the storage server storing each copy of the original data corresponding to each transaction data information included in the transaction according to the transaction data distribution information;

根据查询得到的所述至少一个写请求的执行结果,执行提交操作或回滚操作。According to the execution result of the at least one write request obtained by the query, a commit operation or a rollback operation is performed.

在一种可能的实现方式中,所述处理单元,还用于根据查询得到的所述至少一个写请求的执行结果,生成操作信息,所述操作信息指示提交操作或回滚操作;In a possible implementation manner, 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, where the operation information indicates a commit operation or a rollback operation;

所述通信单元,还用于将所述操作信息发送至存储所述事务包括的每个事务数据信息对应的原始数据的每个副本的存储服务器。The communication unit is further configured to send the operation information to a storage server that stores each copy of the original data corresponding to each transaction data information included in the transaction.

在一种可能的实现方式中,所述目标数据的副本在存储服务器上的存储位置和所述原始数据的副本在存储服务器上的存储位置存在重叠,或者所述目标数据的副本和所述原始数据的副本存储于需要保持一致性的数据块中。In a possible implementation, the storage location of the copy of the target data on the storage server and the storage location of the copy of the original data on the storage server overlap, or the copy of the target data and the original Copies of data are stored in data blocks that need to be consistent.

第八方面,本申请提供一种存储装置,所述装置包括:In an eighth aspect, the present application provides a storage device, the device including:

通信单元,用于接收协调服务器发送的写请求,所述写请求包括事务数据分布信息以及一个事务数据信息,所述写请求是所述协调服务器根据接收到的事务生成的至少一个写请求之一,所述存储服务器是所述至少一个写请求包括的事务数据信息对应的原始数据的副本所在的多个存储服务器之一,所述事务包括至少一个事务数据信息,每个事务数据信息包括一个原始数据的副本在存储服务器上的存储位置信息以及写操作符,事务数据分布信息指示存储所述事务包括的每个事务数据信息对应的原始数据的每个副本的存储服务器;The communication unit is configured to receive a write request sent by the coordination server, the write request includes transaction data distribution information and one transaction data information, and the write request is one of at least one write request generated by the coordination server according to the received transaction The storage server is one of a plurality of storage servers where a copy of the original data corresponding to the transaction data information included in the at least one write request is located, the transaction includes at least one transaction data information, and each transaction data information includes an original The storage location information and the write operator of the copy of the data on the storage server, and the transaction data distribution information indicates the storage server that stores each copy of the original data corresponding to each transaction data information included in the transaction;

处理单元,用于根据所述事务数据信息,对所述写请求包括的事务数据信息对应的原始数据的副本进行操作;A processing unit, configured to operate on a copy of the original data corresponding to the transaction data information included in the write request according to the transaction data information;

所述通信单元,还用于向所述协调服务器发送所述写请求的执行结果;The communication unit is further configured to send the execution result of the write request to the coordination server;

所述处理单元,还用于确定向所述协调服务器发送所述写请求的执行结果后的预设时间 内未收到所述协调服务器发送的操作信息,根据所述事务数据分布信息,向存储所述事务包括的每个事务数据信息对应的原始数据的每个副本的存储服务器查询所述至少一个写请求的执行结果;The processing unit 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 write request is sent to the coordination server, and send data to the storage system according to the transaction data distribution information. The storage server of each copy of the original data corresponding to each transaction data information included in the transaction queries the execution result of the at least one write request;

根据查询得到的所述至少一个写请求的执行结果,执行提交操作或回滚操作。According to the execution result of the at least one write request obtained by the query, a commit operation or a rollback operation is performed.

第九方面,本申请提供一种协调服务器,包括处理器和存储器;所述存储器用于存储指令,所述处理器用于执行所述指令,当所述处理器执行所述指令时,所述处理器执行执行第三方面或第三方面的任意一种可能的实现方式提供的方法。In a ninth aspect, the present application provides a coordination server, including a processor and a memory; the memory is used to store instructions, and the processor is used to execute the instructions. When the processor executes the instructions, the processing The device executes the method provided in the third aspect or any one of the possible implementation manners of the third aspect.

第十方面,本申请提供一种存储服务器,包括处理器和存储器;所述存储器用于存储指令,所述处理器用于执行所述指令,当所述处理器执行所述指令时,所述处理器执行执行第四方面或第四方面的任意一种可能的实现方式提供的方法。In a tenth aspect, the present application provides a storage server, including a processor and a memory; the memory is used to store instructions, the processor is used to execute the instructions, and when the processor executes the instructions, the processing The device executes the method provided by the fourth aspect or any one of the possible implementation manners of the fourth aspect.

第十一方面,本申请提供一种存储服务器,包括处理器和存储器;所述存储器用于存储指令,所述处理器用于执行所述指令,当所述处理器执行所述指令时,所述处理器执行执行第五方面或第五方面的任意一种可能的实现方式提供的方法。In an eleventh aspect, the present application provides a storage server, including a processor and a memory; the memory is used to store instructions, the processor is used to execute the instructions, and when the processor executes the instructions, the The processor executes the fifth aspect or the method provided in any possible implementation manner of the fifth aspect.

第十二方面,本申请提供一种非瞬态的计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,所述计算机程序被协调服务器执行时实现第三方面或第三方面的任意一种可能的实现方式提供的方法。In the twelfth aspect, the present application provides a non-transitory computer-readable storage medium, the computer-readable storage medium stores a computer program, and the computer program implements the third aspect or the third aspect when the computer program is executed by the coordination server. The method provided by any one of the possible implementations.

第十三方面,本申请提供一种非瞬态的计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,所述计算机程序被存储服务器执行时实现第四方面或第四方面的任意一种可能的实现方式提供的方法。In the thirteenth aspect, the present application provides a non-transitory computer-readable storage medium, the computer-readable storage medium stores a computer program, and the computer program implements the fourth aspect or the fourth aspect when the computer program is executed by a storage server. The method provided by any one of the possible implementations.

第十四方面,本申请提供一种非瞬态的计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,所述计算机程序被存储服务器执行时实现第五方面或第五方面的任意一种可能的实现方式提供的方法。In a fourteenth aspect, the present application provides a non-transitory computer-readable storage medium, the computer-readable storage medium stores a computer program, and the computer program implements the fifth aspect or the fifth aspect when the computer program is executed by a storage server The method provided by any one of the possible implementations.

附图说明Description of the drawings

为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍。In order to explain the embodiments of the present invention or the technical solutions in the prior art more clearly, the following will briefly introduce the drawings that need to be used in the description of the embodiments or the prior art.

图1是本申请实施例提供的一种分布式系统的系统架构示意图;FIG. 1 is a schematic diagram of a system architecture of a distributed system provided by an embodiment of the present application;

图2是本申请实施例提供的一种二阶段提交的交互示意图;FIG. 2 is a schematic diagram of a two-stage submission interaction provided by an embodiment of the present application;

图3是本申请实施例提供的执行提交操作或回滚操作的示意图;FIG. 3 is a schematic diagram of performing a commit operation or a rollback operation provided by an embodiment of the present application;

图4是本申请实施例提供的另一种二阶段提交的交互示意图;FIG. 4 is another schematic diagram of the interaction of two-stage submission provided by an embodiment of the present application;

图5是本申请实施例提供的一种事务提交的交互示意图;FIG. 5 is a schematic diagram of interaction of transaction commit provided by an embodiment of the present application;

图6是本申请实施例提供的一种执行读请求的交互示意图;FIG. 6 is a schematic diagram of interaction for executing a read request according to an embodiment of the present application;

图7是本申请实施例提供的另一种事务提交的交互示意图;FIG. 7 is a schematic diagram of another transaction submission interaction provided by an embodiment of the present application;

图8是本申请实施例提供的一种协调装置的结构示意图;FIG. 8 is a schematic structural diagram of a coordination device provided by an embodiment of the present application;

图9是本申请实施例提供的一种存储装置的结构示意图;FIG. 9 is a schematic structural diagram of a storage device provided by an embodiment of the present application;

图10是本申请实施例提供的另一种存储装置的结构示意图;FIG. 10 is a schematic structural diagram of another storage device provided by an embodiment of the present application;

图11是本申请实施例提供的一种协调服务器的结构示意图;FIG. 11 is a schematic structural diagram of a coordination server provided by an embodiment of the present application;

图12是本申请实施例提供的一种存储服务器的结构示意图;FIG. 12 is a schematic structural diagram of a storage server provided by an embodiment of the present application;

图13是本申请实施例提供的另一种存储服务器的结构示意图。FIG. 13 is a schematic structural diagram of another storage server provided by an embodiment of the present application.

具体实施方式Detailed ways

本申请实施例中的术语“第一”、“第二”仅用于描述目的,而不能理解为指示或暗示相对重要性或者隐含指明所指示的技术特征的数量。由此,限定有“第一”、“第二”的特征可以明示或者隐含地包括一个或者更多个该特征。The terms "first" and "second" in the embodiments of the present application are only used for descriptive purposes, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of indicated technical features. Thus, the features defined with "first" and "second" may explicitly or implicitly include one or more of these features.

首先对本申请实施例中所涉及到的一些概念进行介绍。First, some concepts involved in the embodiments of the present application are introduced.

事务是数据库管理系统执行过程中的一个逻辑单位,其包括有限的数据库操作序列。为保证数据的正确可靠,事务必须具备四个特性:原子性(atomicity)、一致性(consistency)、隔离性(isolation)、持久性(durability),其中,原子性是指一个事务中的所有操作,或者全部完成,或者全部不完成,不会结束在中间某个环节,事务在执行过程中发生错误,会被回滚到事务开始前的状态。一致性是指在事务开始之前和事务结束以后,数据库的完整性没有被破坏。隔离性是指数据库允许多个并发事务同时对数据进行读写和修改,隔离性可以防止多个事务并发执行时由于交叉执行而导致数据的不一致。持久性是指事务执行结束后,对数据的修改就是永久的,即便系统故障也不会丢失。A transaction is a logical unit in the execution of a database management system, which includes a limited sequence of database operations. In order to ensure the correctness and reliability of data, transactions must have four characteristics: atomicity, consistency, isolation, and durability. Among them, atomicity refers to all operations in a transaction , Either all is completed, or all is not completed, it will not end in a certain link in the middle, the transaction will be rolled back to the state before the start of the transaction if an error occurs during the execution of the transaction. Consistency means that the integrity of the database has not been destroyed before the start of the transaction and after the end of the transaction. Isolation means that the database allows multiple concurrent transactions to read, write and modify data at the same time. Isolation can prevent data inconsistencies caused by cross execution when multiple transactions are executed concurrently. Persistence means that after the transaction is executed, the modification of the data is permanent, and it will not be lost even if the system fails.

参与者在事务执行过程中承担执行者角色,用于接收协调者发送的事务请求,对事务请求中指定的数据进行指定操作。其中,一个事务中包括对一个或者多个数据的事务请求,事务请求为读请求或者写请求。在分布式系统中,数据分别存储在不同的存储服务器中,由于每个存储服务器都可能出现故障,为了提高数据的可靠性,需要为数据建立冗余关系,比如通过为数据建立副本或者纠删码校验,提高系统容错性。本申请实施例中以冗余关系为副本为例进行描述,其他冗余关系同样适用。在事务的执行过程中,将存储有相同目标数据的多个副本称为一个参与者,其中,上述目标数据为事务请求中请求操作的一个或者多个数据,上述多个副本中的一个为主副本,其余为备副本。可以理解,在服务器资源充足的情况下,相同数据的多个副本分布在不同的存储服务器上,则一个参与者对应一个或者多个存储服务器。本申请实施例中以相同数据的多个副本分布在不同存储服务器上为例。Participants assume the role of executor in the transaction execution process, used to receive the transaction request sent by the coordinator, and perform specified operations on the data specified in the transaction request. Among them, a transaction includes a transaction request 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 creating a copy or erasure of the data Code verification improves the fault tolerance of the system. In the embodiments of the present application, the redundancy relationship is taken as an example for description, and other redundancy relationships are also applicable. During the execution of a transaction, multiple copies of the same target data are called a participant, where the target data is one or more data requested in the transaction request, and one of the multiple copies is the master Copies, the rest are backup copies. It can be understood that when server resources are sufficient, and multiple copies of the same data are distributed on different storage servers, 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.

协调者在事务执行过程中承担协调角色。在分布式系统中,当一个事务跨越多个参与者执行时(即一个事务包括的事务请求由多个参与者执行),各个参与者能够确定各自执行事务请求的结果,但无法知道其他参与者执行事务请求的结果。为了保持上述的事务特性,因此引入协调者对执行事务请求的结果进行管理,并指示存储服务器是否要把执行事务请求的结果进行提交,例如用更新后的数据替换原始数据。The coordinator assumes the coordinating role in the execution of the transaction. In a distributed system, when a transaction is executed across multiple participants (that is, the transaction request included in a transaction is executed by multiple participants), each participant can determine the result of executing the transaction request, but cannot know the other participants The result of executing the transaction request. In order to maintain the above transaction characteristics, a coordinator is therefore introduced to manage the results of executing the transaction request and instruct the storage server whether to submit the result of executing the transaction request, for example, to replace the original data with the updated data.

示例性的,分布式系统包括一个或者多个业务服务器、一个或者多个协调者服务器(协调者)和多个存储服务器。图1中以分布式系统包括一个业务服务器、一个协调者服务器和多个存储服务器为例。协调者用于接收业务服务器发送的事务请求,并将事务请求发送给一个或者多个参与者执行。其中,每个参与者包括多个副本,每个存储服务器中包括多个逻辑存储节点,同一个数据的多个副本保存在不同存储服务器的逻辑存储节点中。其中,每个存储服务器包括多个逻辑存储节点,每个逻辑存储节点可以是存储服务器中的一个区(chunk)。例如,若上述图1中存储服务器P1中包括逻辑存储节点P11、P12与P13,存储服务器P2中包括逻辑存储节点P21、P22与P23,存储服务器P3中包括逻辑存储节点P31、P32与P33。若逻辑存储节点P11、P21与P31中包括相同数据的3副本,逻辑存储节点P12、P22与P32中包括相同数据的3副本,逻辑存储节点P13、P23与P33中包括相同数据的3副本。则逻辑存储节点P11、P21与P31为逻辑上的一个参与者;P12、P22与P32为逻辑上的一个参与者,P13、P23与P33为逻辑上的一个参与者。多个副本中一个为主副本,其余为备副本,比如P11为所在参与者的主副 本,P12和P13为所在参与者的备副本。Exemplarily, the distributed system includes one or more business servers, one or more coordinator servers (coordinators), and multiple storage servers. In Figure 1, a distributed system including a business server, a coordinator server and multiple storage servers is taken as an example. The coordinator is used to receive the transaction request sent by the business server and send the transaction request to one or more participants for execution. Among them, 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. Wherein, each storage server includes multiple logical storage nodes, and each logical storage node may be a chunk in the storage server. For example, if the storage server P1 in FIG. 1 includes logical storage nodes P11, P12, and P13, the storage server P2 includes logical storage nodes P21, P22, and P23, and the storage server P3 includes logical storage nodes P31, P32, and P33. If the logical storage nodes P11, P21, and P31 include three copies of the same data, the logical storage nodes P12, P22, and P32 include three copies of the same data, and the logical storage nodes P13, P23, and P33 include three copies of the same data. The 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. One of the multiple copies is the primary copy, and the rest are backup copies. For example, P11 is the primary copy of the participant, and P12 and P13 are the backup copies of the participant.

二阶段提交是基于分布式系统架构下进行事务提交而设计的一种方法,二阶段提交包括准备(prepare)阶段和提交(commit)阶段。具体的,如图2所示,以业务服务器发送的事务包括的事务请求为写请求为例,prepare阶段包括:Two-phase commit is a method designed based on transaction commit under a distributed system architecture. Two-phase commit includes a prepare phase and a commit phase. Specifically, as shown in Figure 2, taking the transaction request included in the transaction sent by the business server as a write request as an example, the prepare phase includes:

a,协调者接收业务服务器发送的事务之后,将该事务中包括的一个或者多个写请求转发给每个写请求中请求操作的原始数据所在的参与者。图2中以参与者1接收第一写请求,参与者2接收第二写请求,参与者n接收第n写请求为例。a. After receiving the transaction sent by the service server, the coordinator forwards one or more write requests included in the transaction to the participant where the original data requested for the operation in each write request is located. In FIG. 2, the participant 1 receives the first write request, the participant 2 receives the second write request, and the participant n receives the nth write request as an example.

b,各参与者接收到写请求之后,执行各自接收的写请求。参与者对原始数据执行写请求得到目标数据,但是不用目标数据替换原始数据,仅将目标数据暂时存储。b. After each participant receives the write request, it executes the write request they received. Participants perform write requests on the original data to obtain the target data, but do not replace the original data with the target data, and only store the target data temporarily.

c,参与者向协调者发送操作结果,如果参与者在步骤b中可以成功根据写请求中请求操作的原始数据得到目标数据,则向协调者发送操作成功的操作结果,如果参与者在步骤b中不能成功根据写请求中请求操作的原始数据得到目标数据,则向协调者发送操作失败的操作结果。图2中以参与者1根据第一写请求的执行情况生成第一操作结果,参与者2根据第二写请求的执行情况生成第二操作结果,参与者n根据第n写请求的执行情况生成第n操作结果为例。c. The participant sends the operation result to the coordinator. If the participant can successfully obtain the target data based on the original data requested in the write request in step b, then the operation result of the successful operation is sent to the coordinator. If the participant is in step b If the target data cannot be successfully obtained based on the original data of the requested operation in the write request, the operation result of the operation failure is sent to the coordinator. In Figure 2, participant 1 generates the first operation result according to the execution of the first write request, participant 2 generates the second operation result according to the execution of the second write request, and participant n generates the second operation result according to the execution of the nth write request. Take the nth operation result as an example.

commit阶段包括:The commit phase includes:

d,协调者根据各参与者发送的操作结果,确定写请求的执行结果,并发送提交(commit)指令或者回滚(rollback)指令给各参与者。其中,在每个参与者的操作结果均为操作成功的情况下,协调者确定写请求的执行结果为执行成功,协调者向各个参与者发送commit指令。在各个参与者的操作结果中有至少一个为操作失败的情况下,协调者确定写请求的执行结果为执行失败,协调者向各个参与者发送rollback指令。图2中以写请求的执行结果为commit指令为例。d. The coordinator determines the execution result of the write request according to the operation result sent by each participant, and sends a commit instruction or a rollback instruction to each participant. Among them, in the case that the operation result of each participant is successful, the coordinator determines that the execution result of the write request is successful, and the coordinator sends a commit instruction to each participant. In the case where at least one of the operation results of each participant is an operation failure, the coordinator determines that the execution result of the write request is an execution failure, and the coordinator sends a rollback instruction to each participant. In Figure 2, the execution result of the write request is the commit instruction as an example.

e,各参与者执行接收的commit指令或者rollback指令。当协调者发送的是commit指令时,各个参与者执行提交操作,用上述目标数据替换原始数据;当协调者发送的是rollback指令时,各个参与者执行回滚操作,将上述暂存的目标数据删除。如图3所示,对原始数据A执行写操作后得到的目标数据为B,在接收到commit指令或者rollback指令之前,将目标数据B暂时存储,若参与者根据commit指令执行提交操作,则用B替换A,若参与者根据rollback指令执行回滚操作,则删除暂存的目标数据B。e, each participant executes the received commit instruction or rollback instruction. When the coordinator sends a commit command, each participant performs the commit operation and replaces the original data with the above target data; when the coordinator sends a rollback command, each participant performs a rollback operation and saves the above temporarily stored target data delete. As shown in Figure 3, the target data obtained after the original data A is written is B. Before the commit command or rollback command is received, the target data B is temporarily stored. If the participant performs the commit operation according to the commit command, use B replaces A. If the participant performs a rollback operation according to the rollback instruction, the temporarily stored target data B will be deleted.

f,各参与者向协调者发送确认消息,确认消息指示提交操作完成或者回滚操作完成。图2中以参与者1生成第一确认信息,参与者2生成第二确认信息,参与者n生成第n确认信息为例。f. Each participant sends a confirmation message to the coordinator, and the confirmation message indicates the completion of the submission operation or the completion of the rollback operation. In FIG. 2, the participant 1 generates the first confirmation information, the participant 2 generates the second confirmation information, and the participant n generates the nth confirmation information as an example.

协调者在接收到各参与者反馈的确认消息之后,向业务服务器返回事务的执行结果。The coordinator returns the execution result of the transaction to the service server after receiving the confirmation message fed back by each participant.

上面介绍了两阶段提交中协调者与参与者之间的交互过程,在分布式系统中,一个参与者包括同一个数据的一个或者多个副本,同一个数据的每个副本所在的逻辑存储节点分布在不同的存储服务器上。因此在准备阶段,一个参与者在接收到协调者发送的写请求之后,该参与者中的多个副本之间存在交互关系。具体的,协调服务器将各个参与者对应的写请求发送给各参与者中的主副本所在的逻辑存储节点,由该主副本所在的存储服务器将写请求转发给存储备副本的存储服务器,然后接收到写请求的多个逻辑存储节点执行该写请求中的操作,并通过存储主副本的存储服务器将各个存储备副本的存储服务器中的操作结果发送给协调服务器。提交阶段中,协调服务器根据接收到的各个参与者的操作结果确定写请求是否执行成功,并向主副本发送commit指令或者rollback指令,然后由主副本将接收到的指令转发给对 应的备副本。需要说明的是,逻辑存储节点之间进行交互以及逻辑存储节点与协调者之间进行交互均是通过各逻辑存储节点所在的存储服务器进行的。The above describes the interaction process between the coordinator and the participant in the two-phase submission. In a distributed system, a participant includes one or more copies of the same data, and the logical storage node where each copy of the same data is located. Distributed on different storage servers. Therefore, in the preparation phase, after a participant receives a write request sent by the coordinator, there is an interactive relationship among multiple copies of the participant. Specifically, the coordination server sends the write request corresponding to each participant to the logical storage node where the master copy of each participant is located, and the storage server where the master copy is located forwards the write request to the storage server storing the backup copy, and then receives it. The multiple logical storage nodes to the write request execute the operation in the write request, and send the operation result in the storage server of each storage backup copy to the coordination server through the storage server storing the primary copy. In the commit phase, the coordination server determines whether the write request is executed successfully according to the received operation results of each participant, and sends a commit command or rollback command to the master copy, and then the master copy forwards the received instructions to the corresponding backup copy. It should be noted that the interaction between the logical storage nodes and the interaction between the logical storage nodes and the coordinator are all performed through the storage server where each logical storage node is located.

示例性的,以分布式系统中的数据有三个副本为例,上述写请求中需要对两个原始数据进行修改,其中第一原始数据分布在逻辑存储节点P11、P21与P31中,上述三个逻辑存储节点分别位于存储服务器P1、P2与P3中,第二原始数据分布在逻辑存储节点P33、P43与P53中,这三个逻辑存储节点分别位于存储服务器P3、P4与P5中,即P11、P21与P31是一个参与者,P33、P43与P53是一个参与者,且P11和P43中存储的是主副本。则如图4所示,二阶段提交过程中,分布式系统中逻辑存储节点之间的交互过程如下所示:Exemplarily, taking three copies of data in a distributed system as an example, two original data need to be modified in the above write request, where the first original data is distributed in logical storage nodes P11, P21, and P31, and the above three The logical storage nodes are located in storage servers P1, P2, and P3, and the second original data is distributed in logical storage nodes P33, P43, and P53. These three logical storage nodes are located in storage servers P3, P4, and P5, namely, P11, P21 and P31 are a participant, P33, P43, and P53 are a participant, and P11 and P43 are stored as master copies. As shown in Figure 4, during the two-phase commit process, the interaction process between logical storage nodes in the distributed system is as follows:

prepare阶段包括:The prepare phase includes:

a,协调服务器首先将第一写请求发送给存储第一原始数据的主副本所在的逻辑存储节点P11,将第二写请求发送给存储第二原始数据的主副本所在的逻辑存储节点P43,其中,第一写请求与第二写请求是协调服务器接收到的事务中包括的,第一写请求指示对第一原始数据进行修改,第二写请求指示对第二原始数据进行修改。a. The coordination server first sends the first write request to the logical storage node P11 where the master copy of the first original data is stored, and sends the second write request to the logical storage node P43 where the master copy of the second original data is stored, where The first write request and the second write request are included in the transaction received by the coordination server, the first write request indicates to modify the first original data, and the second write request indicates to modify the second original data.

b,P11将接收到的第一写请求发送给存储备副本的P21和P31,P43将接收到的第二写请求发送给存储备副本的P33和P53。b. P11 sends the received first write request to P21 and P31 of the storage backup copy, and P43 sends the received second write request to P33 and P53 of the storage backup copy.

c,P11、P21、P31分别执行第一写请求中对应的操作,P33、P43、P53分别执行第二写请求中对应的操作,P21和P31将第一写请求的操作结果发送给存储服务器P11,P33和P53将第二写请求的操作结果发送给P43,其中,操作结果指示写请求操作成功或者操作失败。c, P11, P21, and P31 perform the corresponding operations in the first write request respectively, P33, P43, and P53 perform the corresponding operations in the second write request respectively, and P21 and P31 send the operation result of the first write request to the storage server P11 , P33 and P53 send the operation result of the second write request to P43, where the operation result indicates the success or failure of the write request operation.

P11根据P11、P21、P31的操作结果确定第一写请求的执行结果,P43根据P33、P43、P53的操作结果确定第二写请求的执行结果,然后P11和P43分别将上述第一写请求的执行结果和第二写请求的执行结果发送给协调服务器。其中,当P11、P21、P31的操作结果均为操作成功时,P11确定第一写请求的执行结果为执行成功,当P11、P21、P31中任意一个或者多个的操作结果为操作失败时,P11确定第一写请求的执行结果为执行失败。P43确定第二写请求的执行结果为执行成功还是执行失败的方法类似。P11 determines the execution result of the first write request according to the operation results of P11, P21, and P31, and P43 determines the execution result of the second write request according to the operation results of P33, P43, and P53, and then P11 and P43 respectively determine the execution result of the first write request. The execution result and the execution result of the second write request are sent to the coordination server. Among them, when the operation results of P11, P21, and P31 are all successful, P11 determines that the execution result of the first write request is successful. When the operation result of any one or more of P11, P21, and P31 is operation failure, P11 determines that the execution result of the first write request is execution failure. The method for P43 to determine whether the execution result of the second write request is successful or failed is similar.

commit阶段包括:The commit phase includes:

d,协调服务器根据P11和P43反馈的第一写请求的执行结果和第二写请求的执行结果,向P11和P43发送commit指令或者rollback指令。图4中以写请求的执行结果为commit指令为例。d. The coordination server sends a commit command or a rollback command to P11 and P43 according to the execution result of the first write request and the execution result of the second write request fed back by P11 and P43. In Figure 4, the execution result of the write request is the commit instruction as an example.

e,P11将接收到的commit指令或者rollback指令发送给P21和P31,P43将接收到的commit指令或者rollback指令发送给P33和P53。图4中以commit指令为例。e, P11 sends the received commit command or rollback command to P21 and P31, and P43 sends the received commit command or rollback command to P33 and P53. Take the commit command as an example in Figure 4.

f,P11、P21、P31以及P33、P43、P53执行接收的commit指令或者rollback指令。其中,当接收到的是commit指令时,各个逻辑存储节点执行提交操作,用更新后得到的目标数据替换原始数据;当接收到的是rollback指令时,各个逻辑存储节点执行回滚操作。然后P21和P31反馈第一确认信息(提交操作完成或者回滚操作完成)给P11,P33和P53反馈第二确认信息(提交操作完成或者操作回滚完成)给P43。f, P11, P21, P31 and P33, P43, P53 execute the received commit command or rollback command. Among them, when a commit instruction is received, each logical storage node performs a commit operation, replacing the original data with the target data obtained after the update; when a rollback instruction is received, each logical storage node performs a rollback operation. Then P21 and P31 feed back the first confirmation information (commit operation completion or rollback operation complete) to P11, and P33 and P53 feed back the second confirmation information (commit operation completion or operation rollback completion) to P43.

上述事务的执行过程中,协调者与参与者之间需要进行两次交互,同一个参与者中的主备副本之间需要进行两次交互,因此会导致事务提交的时延较长。另外,事务在执行的过程中,如果协调服务器出现故障,导致存储服务器在执行事务的过程中申请的资源无法及时释放,会导致系统处于阻塞状态,其他被阻塞的事务会一直等待,直到原来的事务请求相关的资源被释放。During the execution of the above transaction, the coordinator and the participant need to interact twice, and the primary and backup copies in the same participant need to interact twice, which will lead to a longer delay in transaction submission. In addition, during the execution of the transaction, if the coordination server fails, the resources requested by the storage server during the execution of the transaction cannot be released in time, which will cause the system to be in a blocked state, and other blocked transactions will wait until the original Resources related to the transaction request are released.

本申请实施例提供一种事务的提交方法,应用于如图1所示的分布式系统中,其中,业务服务器向协调服务器发送事务,协调服务器根据分布式系统的数据分布信息以及事务中的事务数据信息将事务中包括的一个或者多个写请求发送给对应的存储服务器执行,各存储服务器根据接收到的写请求执行对应的操作并将各自的执行结果发送给协调服务器。协调服务器根据各存储服务器的执行结果确定事务处理结果,并将事务处理结果返回给业务服务器。下面结合附图分别从事务请求为写请求与读请求两个方面对本申请提供的事务提交方法进行详细阐述。如图4所示,在事务请求为写请求时,该事务提交方法包括:The embodiment of the present application provides a transaction commit method, which is applied to the distributed system as shown in FIG. 1, in which the business server sends the transaction to the coordination server, and the coordination server is based on the data distribution information of the distributed system and the transactions in the transaction. The data information sends one or more write requests included in the transaction to the corresponding storage server for execution, and each storage server executes the corresponding operation according to the received write request and sends the respective execution result to the coordination server. The coordination server determines the transaction processing result according to the execution result of each storage server, and returns the transaction processing result to the business server. In the following, the transaction submission method provided by the present application will be described in detail from two aspects of the transaction request being a write request and a read request in conjunction with the accompanying drawings. As shown in Figure 4, when the transaction request is a write request, the transaction commit method includes:

S301、业务服务器向协调服务器发送事务。S301. The business server sends a transaction to the coordination server.

本申请实施例中,上述事务包括一个或多个事务数据信息与一个或多个事务数据标识,其中,每个事务数据信息对应一个事务数据标识,每个事务数据信息指示对分布式数据库中的一个或者多个原始数据进行操作,每个事务数据信息包括原始数据的存储位置信息以及操作符,该存储位置信息包括地址或者数据标识,该操作符指示对原始数据执行写操作。In the 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, and each transaction data information indicates a reference to the distributed database. One or more raw data is operated, and each transaction data information includes storage location information of the original data and an operator, the storage location information includes an address or a data identifier, and the operator instructs to perform a write operation on the original data.

协调服务器存储有分布式系统的数据分布信息,数据分布信息中记录有分布式系统中每个数据所在的逻辑存储节点和每个数据所在逻辑存储节点所属的存储服务器。协调服务器可以根据原始数据的存储位置信息与数据分布信息,确定原始数据在分布式数据库中的位于的逻辑存储节点与逻辑存储节点所属的存储服务器。The coordination server stores data distribution information of the distributed system, and the data distribution information records the logical storage node where each data is located in the distributed system and the storage server to which each logical storage node belongs. The coordination server may determine the logical storage node where the original data is located in the distributed database and the storage server to which the logical storage node belongs based on the storage location information and data distribution information of the original data.

S302、协调服务器根据业务服务器发送的事务,生成一个或者多个写请求,并将每个写请求发送给对应的存储服务器。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.

协调服务器在接收到事务之后,根据每个事务数据信息中的原始数据的存储位置信息,查询数据分布信息,可以得到该事务数据信息对应的查询结果,该查询结果包括该事务数据信息指示进行写操作的原始数据的每个副本所在的逻辑存储节点和每个逻辑存储节点所在的存储服务器,其中,每个原始数据的一个副本对应一个逻辑存储节点。协调服务器根据每个事务数据信息以及数据分布信息,可以确定事务中所有事务数据信息对应的查询结果,合并事务包括的所有事务数据信息对应的查询结果,得到事务数据分布信息,该事务数据分布信息指示事务中每个事务数据信息中存储位置信息对应的原始数据的每个副本所在的存储服务器。After receiving the transaction, the coordination server queries the data distribution information according to the storage location information of the original data in each transaction data information, and can obtain the query result corresponding to the transaction data information. The query result includes the transaction data information instruction to write The logical storage node where each copy of the original data of the operation is located and the storage server where each logical storage node is located, where each copy of the original data corresponds to a logical storage node. The coordination server can determine the query results corresponding to all transaction data information in the transaction according to each transaction data information and data distribution information, and merge the query results corresponding to all transaction data information included in the transaction to obtain transaction data distribution information, and the transaction data distribution information Indicate 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.

协调服务器在确定上述事务数据分布信息之后,根据事务中的事务数据信息、事务数据标识以及事务数据分布信息,生成多个写请求。其中,每个写请求包括一个事务数据信息、事务数据标识以及上述事务数据分布信息。然后将每个写请求发送给每个写请求中包括的事务数据信息对应的原始数据的每个副本所在的存储服务器。After determining the transaction data distribution information, the coordination server generates multiple write requests according to the transaction data information, the transaction data identifier, and the transaction data distribution information in the transaction. Wherein, each write request includes a transaction data information, a transaction data identifier, and the foregoing transaction data distribution information. Then each write request is sent to the storage server where each copy of the original data corresponding to the transaction data information included in each write request is located.

示例性的,以事务包括3个事务数据信息,每个事务数据信息指示对一个原始数据进行写操作为例,第一事务数据信息指示对page1中记录的第2个字段的数据做加1操作;第二事务数据信息指示对page2中记录的第5个字段的数据做加1操作;第三事务数据信息指示对page3中记录的第3个字段的数据做减1操作,即事务指示对三个原始数据进行写操作。Exemplarily, a transaction includes 3 transaction data information, and each transaction data information indicates a write operation to an original data as an example. The first transaction data information indicates an increase by 1 operation to the data of the second field recorded in page1. ; The second transaction data information indicates that the data in the fifth field recorded in page2 should be added by 1; the third transaction data information indicates that the data in the third field recorded in page3 should be subtracted by 1, that is, the transaction instruction is three The original data is written.

协调服务器根据上述数据分布信息,确定page1位于存储服务器1中的逻辑存储节点11、存储服务器2的逻辑存储节点21以及存储服务器3的逻辑存储节点31中,上述page2位于存储服务器1中的逻辑存储节点12、存储服务器2的逻辑存储节点22以及存储服务器4的逻辑存储节点42中,上述page3位于存储服务器1中的逻辑存储节点13、存储服务器3的逻辑存储节点33以及存储服务器4的逻辑存储节点43中。上述三个事务数据信息对应的三个事务数据标识分别为block1、block2与block3,协调服务器根据确定的三个事务数据信息各 自对应的逻辑存储节点与存储服务器,确定事务对应的事务数据分布信息,该事务对应的事务数据分布信息如下表1所示。The coordination server determines that page1 is located in the logical storage node 11 of the storage server 1, the logical storage node 21 of the storage server 2, and the logical storage node 31 of the storage server 3 according to the above-mentioned data distribution information. The aforementioned page2 is located in the logical storage of the storage server 1. In node 12, logical storage node 22 of storage server 2 and logical storage node 42 of storage server 4, page 3 is located in logical storage node 13 of storage server 1, logical storage node 33 of storage server 3, and logical storage of storage server 4 Node 43. The three transaction data identifiers corresponding to the above three transaction data information are block1, block2, and block3. The coordination server determines the transaction data distribution information corresponding to the transaction according to the logical storage node and the storage server corresponding to each of the determined three transaction data information. The transaction data distribution information corresponding to this transaction is shown in Table 1 below.

表1Table 1

Figure PCTCN2019122287-appb-000001
Figure PCTCN2019122287-appb-000001

协调服务器在确定上述每个事务数据信息对应的逻辑存储节点与存储服务器之后,协调服务器根据三个事务数据信息、三个事务数据标识以及上述事务数据分布信息,生成三个写请求,其中,第一写请求包括上述第一事务数据信息、三个事务数据标识以及事务数据分布信息,即第一写请求指示对page1中记录的第2个字段的数据做加1操作;第二写请求包括上述第二事务数据信息、三个事务数据标识以及事务数据分布信息,即第二写请求指示对page2中记录的第5个字段的数据做加1操作;第三写请求包括上述第三事务数据信息、三个事务数据标识以及事务数据分布信息,即第三写请求指示对page3中记录的第3个字段的数据做减1操作。然后协调服务器将第一写请求发送给存储服务器1、存储服务器2和存储服务器3,将第二写请求发送给存储服务器1、存储服务器2和存储服务器4,将第三写请求发送给存储服务器1、存储服务器3和存储服务器4。After the coordination server determines the logical storage node and storage server corresponding to each transaction data information, the coordination server generates three write requests according to the three transaction data information, the three transaction data identifiers, and the transaction data distribution information. A write request includes the above-mentioned first transaction data information, three transaction data identifiers, and transaction data distribution information, that is, the first write request instructs to add 1 to the data in the second field recorded in page1; the second write request includes the above The second transaction data information, the three transaction data identifiers, and the transaction data distribution information, that is, the second write request indicates to add 1 to the data in the fifth field recorded in page2; the third write request includes the aforementioned third transaction data information , Three transaction data identifiers and transaction data distribution information, that is, the third write request instructs to subtract 1 from the data in the third field recorded in page3. Then the coordination server sends the first write request to storage server 1, storage server 2 and storage server 3, sends the second write request to storage server 1, storage server 2 and storage server 4, and sends the third write request to storage server 1. Storage server 3 and storage server 4.

协调服务器根据接收到的事务中的事务数据信息生成一个或者多个写请求,然后根据预先存储的分布式系统的数据分布信息,将每个写请求直接发送给每个写请求中包括的事务数据信息对应的原始数据的每个副本所在的存储服务器,从而能够避免协调服务器先将写请求发送给事务数据信息对应的原始数据的主副本所在的存储服务器,再由主副本将写请求发送给对应的备副本过程,提高写请求发送至各个存储服务器的效率。The coordination server generates one or more write requests according to the transaction data information in the received transaction, and then sends each write request directly to the transaction data included in each write request according to the data distribution information of the distributed system stored in advance The storage server where each copy of the original data corresponding to the information is located, so as to avoid the coordination server from first sending the write request to the storage server where the master copy of the original data corresponding to the transaction data information is located, and then the master copy sends the write request to the corresponding The backup copy process improves the efficiency of sending write requests to each storage server.

S303、存储服务器根据接收到的写请求执行对应的写操作。S303. The storage server executes a corresponding write operation according to the received write request.

各个存储服务器在接收到协调服务器发送的写请求之后,各个存储服务器根据各自接收到的写请求对写请求中事务数据信息指示进行操作的原始数据执行对应的写操作。示例性的,存储服务器1、存储服务器2、存储服务器3与存储服务器4在接收到上述写请求之后,根据各自接收到的写请求指示的具体操作,对事务数据信息中指定字段的原始数据进行对应的写操作。例如,上述存储服务器1接收到第一写请求、第二写请求与第三写请求,存储服务器1中的逻辑存储节点11对page1的第2个字段的数据做加1操作,逻辑存储节点12对page2中的第5个字段的数据做加1操作,逻辑存储节点13对page3中的第3个字段的数据做减1操作。上述存储服务器2接收到第一写请求与第二写请求,存储服务器2的逻辑存储节点21对page1的第2个字段的数据做加1操作,逻辑存储节点22对page2的第5个字段的数据做加1操作。各个存储服务器将对原始数据执行写操作后得到的目标数据暂时存储起来,但是不用目标数据替换原始数据。After each storage server receives 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 received write request. Exemplarily, after the storage server 1, the storage server 2, the storage server 3, and the storage server 4 receive the above-mentioned write request, according to the specific operation indicated by the respective received write request, perform processing on the original data of the specified field in the transaction data information. The corresponding write operation. For example, the 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 adds 1 to the data in the second field of page 1, and the logical storage node 12 The data in the fifth field in page2 is added by 1, and the logical storage node 13 is subtracted by 1 in the data in the third field in page3. The storage server 2 receives the first write request and the second write request. The logical storage node 21 of the storage server 2 adds 1 to the data in the second field of page1, and the logical storage node 22 adds 1 to the data in the fifth field of page2. Add 1 to the data. 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.

S304、存储服务器将执行写请求的执行结果发送给协调服务器。S304. The storage server sends the execution result of executing the write request to the coordination server.

接收到写请求的存储服务器对各自接收到的写请求中指定字段的数据执行对应的写操作 之后,将执行结果发送给协调服务器,其中,每个写请求对应一个执行结果,执行结果指示存储服务器执行写请求执行成功或者执行失败,执行成功表示存储服务器对写请求中指定的原始数据执行写操作得到目标数据,执行失败表示存储服务器不能对对写请求中指定的原始数据执行写操作得到目标数据。After receiving the write request, the storage server performs the corresponding write operation on the data in the specified field in the received write request, and then sends the execution result to the coordination server, where each write request corresponds to an execution result, and the execution result instructs the storage server The execution of the write request is successful or failed. Successful execution means that the storage server performs a write operation on the original data specified in the write request to obtain the target data, and execution failure means that the storage server cannot perform a write operation on the original data specified in the write request to obtain the target data. .

若存储服务器对接收到的写请求中指定数据的写操作执行成成功,则将该写请求执行成功的执行结果发送给协调服务器,若存储服务器对接收到的写请求中指定数据的写操作执行失败,则将该写请求执行失败的执行结果发送给协调服务器。示例性的,上述协调服务器向存储服务器1发送了第一写请求、第二写请求与第三写请求,则存储服务器1需要向协调服务器反馈执行上述三个写请求对应的三个执行结果。例如,上述存储服务器1中的逻辑存储节点11可以成功执行对page1中数据的写操作,即存储服务器1可以成功执行第一写请求,则存储服务器1将向协调服务器发送执行第一写请求执行成功的执行结果;若存储服务器1中的逻辑存储节点12不能成功执行对page2中的数据的写操作,即存储服务器1不能成功执行第二写请求,则存储服务器1向协调服务器发送执行第二写请求执行失败的执行结果。If the storage server executes the write operation of the specified data in the received write request successfully, it will send the successful execution result of the write request to the coordination server, if the storage server executes the write operation of the specified data in the received write request If it fails, the execution result of the failed execution of the write request is sent to the coordination server. Exemplarily, if the coordination server sends the first write request, the second write request, and the third write request to the storage server 1, the storage server 1 needs to feed back the three execution results corresponding to the three write requests to the coordination server. For example, the logical storage node 11 in the storage server 1 can successfully execute the write operation to the data in page1, that is, the storage server 1 can successfully execute the first write request, and the storage server 1 will send the execution of the first write request to the coordination server. Successful execution result; if the logical storage node 12 in the storage server 1 cannot successfully execute the write operation to the data in page2, that is, the storage server 1 cannot successfully execute the second write request, the storage server 1 sends the execution second to the coordination server The execution result of the failed execution of the write request.

S305、协调服务器根据存储服务器发送的执行结果,确定事务处理结果,并向业务服务器发送事务处理结果。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.

协调服务器在接收到各存储服务器发送的各个写请求对应的执行结果之后,根据各存储服务器发送的执行结果确定事务处理结果,并将事务处理结果发送给业务服务器。具体的,在协调服务器接收到各存储服务器对接收到的写请求的执行结果均为执行成功的情况下,协调服务器确定上述事务的事务处理结果为处理成功,并向上述业务服务器发送事务处理成功的消息。在协调服务器接收到任意一个或者多个执行结果为执行失败的情况下,上述协调服务器确定上述事务的事务处理结果为处理失败,并向业务服务器发送事务处理失败的消息。例如,上述存储服务器1存储服务器2与存储服务器4发送的执行结果均为执行成功,存储服务器3中的逻辑存储节点33对page3中数据的减1操作执行失败,即存储服务器3执行第三写请求为执行失败,则协调服务器会接收到存储服务器3发送的一个执行失败的执行结果,协调服务器确定上述写请求的事务处理结果为处理失败,并向上述业务服务器发送事务处理失败的消息。After receiving the execution result corresponding to each write request sent by each storage server, the coordination server determines the transaction processing result according to the execution result sent by each storage server, and sends the transaction processing result to the service server. Specifically, when the coordination server receives that the execution results of the received write requests from each storage server are all executed successfully, the coordination server determines that the transaction processing result of the transaction is successful, and sends the transaction successful to the business server News. When the coordination server receives any one or more execution results that are execution failures, the coordination server determines that the transaction processing result of the transaction is a processing failure, and sends a transaction processing failure message to the business server. For example, the execution results sent by the storage server 1 and the storage server 2 and the storage server 4 are all successful, and the logical storage node 33 in the storage server 3 fails to perform the subtraction operation of the data in page 3, that is, the storage server 3 executes the third write If the request is an execution failure, the coordination server will receive a failed execution result sent by the storage server 3. The coordination server determines that the transaction processing result of the write request is a processing failure, and sends a transaction failure message to the business server.

接收到写请求的存储服务器在执行完接收到的写请求之后,各个存储服务器分别将执行写请求的执行结果反馈给协调服务器,协调服务器根据各个存储服务器反馈的执行结果,即可确定事务的事务处理结果,然后将上述事务的事务处理结果返回给业务服务器,从而实现一阶段事务提交,降低写请求处理的时延,提高写请求的处理效率与业务服务器的工作效率。After the storage server that has received the write request has executed the received write request, each storage server will feed back the execution result of the write request to the coordination server, and the coordination server can determine the transaction according to the execution result fed back by each storage server. After processing the result, the transaction processing result of the above transaction is returned to the service server, so as to realize the one-stage transaction submission, reduce the time delay of the write request processing, and improve the processing efficiency of the write request and the work efficiency of the business server.

上述协调服务器根据存储服务器发送的执行结果,确定事务处理结果,并向业务服务器发送事务处理结果之后,协调服务器不向各存储服务器发送commit指令或者rollback指令。若存储服务器执行了写请求之后接收到读请求,接收读请求的存储服务器需要先确定接收到的读请求需要读取的目标数据与之前执行的写请求需要操作的原始数据是否相关,若相关,接收到读请求的存储服务器需要先确定之前执行的写请求所属的事务需要执行提交操作还是回滚操作,然后在执行提交操作或者回滚操作之后,再执行接收到的读请求。其中,读请求需要读取的目标数据与写请求需要操作的原始数据相关是指读请求需要读取的目标数据与写请求需要操作的原始数据相同、读请求需要读取的目标数据与写请求需要操作的原始数据存在重叠、读请求需要读取的目标数据的存储位置与写请求需要操作的原始数据的存储位置存在重叠或读请求需要读取的目标数据与写请求需要操作的原始数据属于同一个存储区域,该 存储区域可以是数据块(block),可以是数据区(chunk)。下面结合图6,对存储服务器执行写请求之后接收到读请求时的处理过程进行介绍。The aforementioned coordination server determines the transaction processing result according to the execution result sent by the storage server, and after sending the transaction processing result to the service 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 that receives the read request needs to determine whether the target data that needs to be read by the received read request is related to the original data that the previously executed write request needs to operate, if relevant, The storage server that receives 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 the commit operation or rollback operation is performed. 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, and the target data that the read request needs to read is the same as the write request. The original data that needs to be operated overlaps, the storage location of the target data that needs to be read by the read request overlaps the storage location of the original data that needs to be operated on the write request, or the target data that needs to be read by the read request and the original data that needs to be operated on the write request belong to The same storage area, the storage area can be a data block (block), can be a data area (chunk). The following describes the processing procedure when the storage server receives the read request after executing the write request with reference to FIG. 6.

S601、协调服务器接收业务服务器发送的读请求,并将读请求发送给目标存储服务器。S601. The coordination server receives the read request sent by the service server, and sends the read request to the target storage server.

上述读请求包括需要读取的目标数据的存储位置信息和操作符。协调服务器在接收到读请求之后,先根据读请求中目标数据的存储位置信息,查询分布式系统的数据分布信息,获得该读请求对应的查询结果,该查询结果包括上述读请求需要读取的目标数据的多个副本所在的多个逻辑存储节点以及这多个逻辑存储节点所在的多个存储服务器,其中,每个副本对应一个逻辑存储节点,每个逻辑存储节点对应一个存储服务器。然后协调服务器从查询结果中包括的多个存储服务器中确定目标存储服务器;将上述读请求发送给该目标存储服务器。其中,该目标存储服务器为上述目标数据所在的多个存储服务器中的任意一个,例如,该目标存储服务器可以是读请求中需要读取的目标数据所在的多个存储服务器中距离协调服务器最近的,或读请求中需要读取的目标数据所在的多个存储服务器中协调服务器访问速度最快的。The above-mentioned read request includes the storage location information and the 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 according to 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 information that the read request needs to read. Multiple logical storage nodes where multiple copies of the target data are located and multiple storage servers where the multiple logical storage nodes are located, where each copy corresponds to a logical storage node, and each logical storage node corresponds to a storage server. Then the coordination server 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. Wherein, 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 may be the 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 fastest coordinated server access among multiple storage servers where the target data to be read in the read request is located.

S602、目标存储服务器根据读请求,向一个或者多个存储服务器发送查询请求。S602. The target storage server sends a query request to one or more storage servers according to the read request.

目标存储服务器在接收到上述读请求之后,根据读请求与之前接收到的一个或者多个写请求确定该读请求需要读取的目标数据与目标写请求需要进行写操作的原始数据相关,则目标存储服务器不能直接读取上述目标数据,目标存储服务器需要先确定上述目标写请求所属的事务的事务处理结果,并根据事务处理结果确定执行提交操作或回滚操作,以确保读请求需要读取的目标数据的多个副本的一致性。其中,上述目标写请求包括目标存储服务器在接收到读请求之前接收到的一个或者多个写请求中的部分或者全部,本申请实施例中以目标写请求包括一个写请求为例。After receiving the above-mentioned read request, the target storage server determines that the target data that the read request needs to read is related to the original data that the target write request needs to write based on the read request and one or more previously received write requests, then the target The storage server cannot directly read the above target data. The target storage server must first determine the transaction processing result of the transaction to which the target write request belongs, and determine the commit operation or rollback operation based on the transaction processing result to ensure that the read request needs to read Consistency of multiple copies of target data. The foregoing target write request includes part or all of one or more write requests received by the target storage server before the read request is received. In the embodiment of the present application, the target write request includes one write request as an example.

目标存储服务器会根据目标写请求中的事务数据标识以及事务数据分布信息,确定目标写请求中事务数据分布信息包括的多个存储服务器,然后向这多个存储服务器发送查询请求,该查询请求包括该目标写请求中包含的多个事务数据标识,该查询请求指示存储服务器查询查询请求中多个事务数据标识对应的写请求的执行结果,并将查询到的执行结果发送给上述目标存储服务器。The target storage server will determine the multiple storage servers included in the transaction data distribution information in the target write request according to the transaction data identification 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 target write request includes multiple transaction data identifiers, and the query request instructs the storage server to query the execution result of the write request corresponding to the multiple transaction data identifiers in the query request, and send the queried execution result to the target storage server.

S603、目标存储服务器接收查询结果,根据查询结果执行提交操作或者回滚操作,并执行读请求,获取目标数据发送给协调服务器。S603: The target storage server receives the query result, performs a submit operation or a rollback operation according to the query result, executes a read request, and obtains target data and sends it to the coordination server.

目标存储服务器根据多个存储服务器返回的执行结果确定上述目标写请求所属事务的事务处理结果,在事务处理结果为处理成功的情况下,目标存储服务器向目标写请求中事务数据分布信息包括的多个存储服务器发送commit指令,并对目标写请求所属的事务执行提交操作,在事务处理结果为处理失败的情况下,目标存储服务器向目标写请求中事务数据分布信息包括的多个存储服务器发送rollback指令,并对目标写请求所属的事务执行rollback操作。最后再执行接收到的读请求,获取读请求需要读取的目标数据并将该目标数据发送给协调服务器。The target storage server determines the transaction processing result of the transaction to which the target write request belongs according to the execution results returned by multiple storage servers. If the transaction processing result is successful, the target storage server sends the transaction data distribution information in the target write request to the target write request. A storage server sends a commit instruction and performs a commit operation on the transaction to which the target write request belongs. If the transaction processing result is a processing failure, the target storage server sends a rollback to multiple storage servers included in the transaction data distribution information in the target write request Instruction, and perform a rollback operation on the transaction to which the target write request belongs. Finally, the received read request is executed, the target data to be read by the read request is obtained and the target data is sent to the coordination server.

例如,上述目标存储服务器为上述存储服务器1,存储服务器1在执行上述第一写请求、第二写请求与第三写请求之后,接收到读请求,该读请求需要读取的目标数据位于逻辑存储节点11,则存储服务器1首先根据协调服务器发送的事务数据标识以及事务数据分布信息,确定上述协调服务器将第一写请求所属的事务中包括的第一写请求、第二写请求以及第三写请求发送给了存储服务器1、存储服务器2、存储服务器3和存储服务器4。然后存储服务器 1确定其执行上述第一写请求、第二写请求与第三写请求的执行结果,并向存储服务器2、存储服务器3和存储服务器4发送查询请求,该查询请求中包括上述第一写请求对应的事务数据标识block1、第二写请求对应的事务数据标识block2以及第三写请求对应的事务数据标识block3。该查询请求指示存储服务器2、存储服务器3与存储服务器4查询该查询请求中事务数据标识对应的写请求的执行结果,并向存储服务器1发送执行各写请求执行结果。例如,上述存储服务器2接收到第一写请求与第二写请求,则存储服务器2查询第一写请求的执行结果与第二写请求的执行结果,将执行第一写请求与第二写请求的两个执行结果分别发送给存储服务器1。For example, the target storage server is the storage server 1. The storage server 1 receives a read request after executing the first write request, the second write request, and the third write request. The target data that the read request needs to read is located in the logic Storage node 11, the storage server 1 first determines the first write request, the second write request, and the third write request included in the transaction to which the first write request belongs according to the transaction data identifier and transaction data distribution information sent by the coordination server. The write request is sent to the storage server 1, the storage server 2, the storage server 3, and the storage server 4. Then the storage server 1 determines the execution results of the first write request, the second write request, and the third write request, and sends a query request to the storage server 2, the storage server 3, and the storage server 4. The query request includes the first write request. The transaction data identifier block1 corresponding to one write request, the transaction data identifier block2 corresponding to the second write request, and the transaction data identifier block3 corresponding to the third write request. The query request instructs the storage server 2, the storage server 3 and the storage server 4 to query the execution result of the write request corresponding to the transaction data identifier in the query request, and send the execution result of each write request to the storage server 1. For example, if the storage server 2 receives the first write request and the second write request, the storage server 2 queries the execution result of the first write request and the execution result of the second write request, and executes the first write request and the second write request. The two execution results of are sent to the storage server 1 respectively.

存储服务器1在接收到存储服务器2、存储服务器3和存储服务器4返回的执行结果之后,如果存储服务器1、存储服务器2、存储服务器3和存储服务器4均成功执行各自接收到的写请求,则存储服务器1执行提交操作。如果存储服务器1、存储服务器2、存储服务器3或者存储服务器4中执行任意一个写请求失败,则存储服务器1执行回滚操作。After the storage server 1 receives the execution results returned by the storage server 2, the storage server 3, and the storage server 4, if the storage server 1, the storage server 2, the storage server 3, and the storage server 4 all successfully execute the write request received respectively, then The storage server 1 performs the commit operation. If any write request in the storage server 1, the storage server 2, the storage server 3, or the storage server 4 fails, the storage server 1 performs a rollback operation.

存储服务器1执行提交操作或者回滚操作之后,读取上述读请求指定的目标数据,并将读取的目标数据发送给协调服务器,协调服务器在接收到存储服务器1发送的目标数据之后,将该目标数据发送给业务服务器。After the storage server 1 performs the commit operation or rollback operation, it reads the target data specified by the above read request, and sends the read target data to the coordination server. After the coordination server receives the target data sent by the storage server 1, the The target data is sent to the business server.

协调服务器在不向存储服务器发送commit指令或者rollback指令的情况下,若存储服务器接收到读请求,且该读请求需要读取的目标数据与该存储服务器之前接收的写请求需要操作的原始数据相关,该存储服务器可以根据写请求中的事务数据标识与事务数据分布信息,确定该写请求所属的事务的事务处理结果,根据事务处理结果对写请求所属的事务执行提交操作或者回滚操作,然后执行接收到的读请求。通过存储服务器来确定写请求对应的事务的事务处理结果,减少业务服务器处理的数据量,提高业务服务器的效率。If the coordination server does not send a commit command or rollback command to the storage server, if the storage server receives a read request, and the target data that the read request needs to read is related to the original data that the storage server needs to operate on the write request previously received 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, and perform the commit operation or rollback operation on the transaction to which the write request belongs based on the transaction processing result, and then Execute the received read request. The storage server determines the transaction processing result of the transaction corresponding to the write request, reduces the amount of data processed by the business server, and improves the efficiency of the business server.

在一种可能的实施方式中,当目标存储服务器接收到上述读请求并确定上述目标写请求之后,由于协调服务器已确定目标写请求所属的事务的事务处理结果,则目标存储服务器可以向协调服务器发送查询请求,查询目标写请求所属的事务的事务处理结果。若目标存储服务器接收到协调服务器发送的事务处理结果为处理成功,则目标存储服务器向目标写请求中事务数据分布信息包括的多个存储服务器发送commit指令,并对目标写请求所属的事务执行提交操作。若目标存储服务器接收到协调服务器发送的事务处理结果为处理失败,目标存储服务器向目标写请求中事务数据分布信息包括的多个存储服务器发送rollback指令,并对目标写请求所属的事务执行rollback操作。最后再执行接收到的读请求,获取读请求需要读取的目标数据并将该目标数据发送给协调服务器。In a possible implementation manner, after the target storage server receives the read request and determines the target write request, since the coordination server has determined the transaction result of the transaction to which the target write request belongs, the target storage server may send the request to the coordination server Send a query request 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 processing success, the target storage server sends a commit instruction to multiple storage servers included in the transaction data distribution information in the target write request, and executes a commit to the transaction to which the target write request belongs operating. If the target storage server receives the transaction processing result sent by the coordination server as a processing failure, the target storage server sends a rollback instruction to multiple storage servers included in the transaction data distribution information in the target write request, and performs a rollback operation on the transaction to which the target write request belongs . Finally, the received read request is executed, the target data to be read by the read request is obtained and the target data is sent to the coordination server.

参见图7,上述S305中,协调服务器在向业务服务器发送事务处理结果之后,协调服务器可以根据接收到写请求的存储服务器反馈的写请求的执行结果,生成操作信息,操作信息指示存储服务器执行提交操作或回滚操作。若接收到写请求的存储服务器反馈的执行结果均为执行成功,则协调服务器生成操作信息为commit指令,并向各个存储服务器发送commit指令,各存储服务器在接收到协调服务器发送的commit指令之后,各存储服务器中的各逻辑存储节点执行提交操作。若接收到写请求的存储服务器反馈的执行结果中有任意一个执行结果为执行失败,则协调服务器生成操作信息为rollback指令,并向各存储服务器发送rollback指令,各存储服务器在接收到协调服务器发送的rollback指令之后,执行回滚操作。Referring to Figure 7, in the above S305, after the coordination server sends the transaction processing result to the business server, the coordination server may generate operation information according to the execution result of the write request fed back by the storage server that has received the write request, and the operation information instructs the storage server to perform submission Operation or rollback operation. If the execution result fed back by the storage server that receives the write request is successful, the coordination server generates the operation information as a commit command and sends a commit command to each storage server. After each storage server receives the commit command sent by the coordination server, Each logical storage node in each storage server executes the commit operation. If any one of the execution results fed back by the storage server that receives the write request is execution failure, the coordination server generates the operation information as a rollback instruction, and sends the rollback instruction to each storage server, and each storage server receives the coordination server's sending After the rollback instruction, perform the rollback operation.

在上述S302中协调服务器在根据事务生成多个写请求,将这多个写请求发送给对应的多个存储服务器中的部分或者全部之后,且在将commit指令或者rollback指令发送给上述多个 存储服务器中的全部服务器之前,协调服务器可能出现故障或者网卡出现丢包,导致接收到写请求的存储服务器接收不到协调服务器发送的commit指令或者rollback指令,此时接收到写请求的存储服务器需要确定接收到的写请求所属的事务需要执行提交操作还是回滚操作。下面介绍协调服务器发生故障时事务的执行过程。In the foregoing S302, the coordination server generates multiple write requests according to the transaction, sends the multiple write requests to some or all of the corresponding multiple storage servers, and sends the commit instruction or rollback instruction to the multiple storage servers. Before all the servers in the server, the coordination server may fail or the network card may lose packets, causing the storage server that received the write request to not receive the commit command or rollback command 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 execution process of the transaction when the coordination server fails.

本申请实施例中,存储服务器具有感知协调服务器故障的能力,例如,接收到写请求的存储服务器执行上述S303和上述S304中的操作,若执行了上述S304之后,在预设时长内没有接收到协调服务器发送的commit指令或rollback指令,则接收到写请求的存储服务器确定协调服务器出现故障。In the embodiment of the present application, the storage server has the ability to sense and coordinate server failures. For example, the storage server that receives the write request executes the operations in S303 and S304 above, and if the above S304 is executed, the storage server does not receive it within a preset period of time. If the commit instruction or rollback instruction sent by the coordination server is sent, the storage server that has received the write request determines that the coordination server is faulty.

接收到写请求的存储服务器根据接收到的写请求中的事务数据分布信息,确定事务数据分布信息包括的多个存储服务器,然后向这多个存储服务器中除本身之外的其他存储服务器发送查询请求,该查询请求包括写请求中包含的多个事务数据标识,该查询请求指示接收到查询请求的存储服务器查询查询请求中多个事务数据标识对应的写请求的执行结果,并将查询到的执行结果发送给发送查询请求的存储服务器。接收到写请求的存储服务器根据接收到的执行结果生成操作信息。The storage server that receives the write request determines the multiple storage servers included in the transaction data distribution information according to the transaction data distribution information in the received write request, and then sends a query to the storage servers other than itself among the multiple storage servers Request, the query request includes multiple transaction data identifiers included in the write request, the query request instructs the storage server that has received the query request to query the execution result of the write request corresponding to the multiple transaction data identifiers in the query request, and the query result The execution result is sent to the storage server that sent the query request. The storage server receiving the write request generates operation information according to the received execution result.

上述接收到写请求的存储服务器可以是所有接收到写请求的存储服务器,则每个接收到写请求的存储服务器均需要向其他存储服务器发送查询请求,然后根据接收到的执行结果生成操作信息。上述接收到写请求的存储服务器也可以是任意一个存储服务器,例如,第一个确定协调服务器发生故障的存储服务器。在接收到写请求的存储服务器是一个存储服务器的情况下,接收到写请求的存储服务器中,第一个确定协调服务器出现故障的存储服务器根据查询到的执行结果生成操作信息,根据操作信息确定执行提交操作或者回滚操作之后,,并向事务数据分布信息包括的多个存储服务器发送生成的操作信息。The storage servers that have received the write request may be all storage servers that have received the write request, and each storage server that has received the write request needs to send a query request to other storage servers, and then generate operation information according to the received execution result. The storage server that receives the write request may 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 received the write request is a storage server, among the storage servers that received the write request, the first storage server that determines that the coordination server is faulty generates operation information based on the query execution results, and determines it based on the operation information After the commit operation or the rollback operation is performed, the generated operation information is sent to multiple storage servers included in the transaction data distribution information.

示例性的,存储服务器1在确定协调服务器发生故障之后,存储服务器1根据事务数据分布信息确定协调服务器将第一写请求、第二写请求与第三写请求均发送给了存储服务器1、存储服务器2、存储服务器3和存储服务器4。因此,存储服务器1向存储服务器2、存储服务器3和存储服务器4发送查询请求,指示存储服务器2、存储服务器3与存储服务器4查询各自执行接收到的第一写请求、第二写请求与第三写请求的执行结果,并向存储服务器1发送执行写请求的执行结果。Exemplarily, after the storage server 1 determines that the coordination server is faulty, the storage server 1 determines according to 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 the storage server 1, the storage server 1. Server 2, storage server 3, and storage server 4. Therefore, the storage server 1 sends query requests to the storage server 2, the storage server 3, and the storage server 4, instructing the storage server 2, the storage server 3, and the storage server 4 to query the first write request, the second write request, and the first write request received. Three write the execution result of the request, and send the execution result of the execution write request to the storage server 1.

存储服务器1在接收到存储服务器2、存储服务器3和存储服务器4返回的执行结果之后,如果存储服务器1、存储服务器2、存储服务器3和存储服务器4均成功执行各自接收到的写请求,则存储服务器1确定事务处理结果为处理成功,存储服务器1生成的操作信息为commit指令,并将commit指令发送给存储服务器2、存储服务器3和存储服务器4,然后执行提交操作。如果存储服务器1、存储服务器2、存储服务器3或者存储服务器4中任意一个或者多个写请求执行失败,则存储服务器1确定事务处理结果为处理失败,存储服务器1生成的操作信息为rollback指令,并将rollback指令发送给存储服务器2、存储服务器3和存储服务器4,然后执行回滚操作。After the storage server 1 receives the execution results returned by the storage server 2, the storage server 3, and the storage server 4, if the storage server 1, the storage server 2, the storage server 3, and the storage server 4 all successfully execute the write request received respectively, then The storage server 1 determines that the transaction processing result is successful, and the operation information generated by the storage server 1 is a commit instruction, and sends the commit instruction to the storage server 2, the storage server 3, and the storage server 4, and then executes the commit operation. If any one or more of the storage server 1, the storage server 2, the storage server 3, or the storage server 4 fails to execute, the storage server 1 determines that the transaction processing result is a processing failure, and the operation information generated by the storage server 1 is a rollback instruction. And send the rollback instruction to the storage server 2, the storage server 3, and the storage server 4, and then perform the rollback operation.

可选地,当协调服务器发生故障时,可能有部分存储服务器接收到了协调服务器发送的操作信息,接收到操作信息的存储服务器在接收到其他存储服务器发送的查询请求之后,根据查询请求中的事务数据标识确定该查询请求查询的写请求,进而确定写请求所属的事务对应操作信息,然后向发送查询请求的存储服务器发送操作信息。例如,存储服务器1接收到协调服务器发送的操作信息为commit指令,当存储服务器1接收到其他存储服务器发送的查 询请求之后,存储服务器1确定该查询请求查询的写请求所属的事务对应的是commit指令,进而向发送查询请求的存储服务器发送commit指令。Optionally, when the coordination server fails, some storage servers may receive the operation information sent by the coordination server. After receiving the operation information, the storage server receives the query request sent by other storage servers according to the transaction in the query request. The data identifier determines the write request of the query request, and then determines the operation information corresponding to the transaction to which the write request belongs, and then sends the operation information to the storage server that sent the query request. For example, the storage server 1 receives the operation information sent by the coordination server as a commit instruction. After the storage server 1 receives a query request sent by another storage server, the storage server 1 determines that the transaction to which the write request of the query request belongs corresponds to commit. Command, and then send a commit command to the storage server that sent the query request.

通过将事务数据分布信息发送给存储服务器,存储服务器在感知到协调服务器发生故障时,根据事务数据分布信息向事务数据分布信息中包括的其他存储服务器查询其他存储服务器执行写请求的执行结果,然后根据其他存储服务器的执行结果确定执行提交操作或者回滚操作,防止存储服务器在没有接收到协调服务器的操作信息时,存储服务器不能释放执行上述写请求是申请的系统资源,导致系统阻塞,不能执行新的事务的问题,并能提升系统的可靠性。By sending transaction data distribution information to the storage server, when the storage server senses the failure of the coordination server, it queries other storage servers included in the transaction data distribution information for the execution results of other storage servers executing write requests based on the transaction data distribution information, and then According to the execution results of other storage servers, the commit operation or rollback operation is determined to prevent the storage server from not releasing the system resources requested for executing the above write request when the storage server does not receive the operation information of the coordinating server, which causes the system to be blocked and cannot be executed. Problems with new transactions and can improve the reliability of the system.

在一种具体的实施方式中,在事务执行的过程中,存储服务器也可能出现故障,导致存储服务器无法执行写请求或者在执行完写请求之后,不能向协调服务器返回执行结果。协调服务器在预设时长内没有接收到该存储服务器的执行结果时,确定该存储服务器发生故障。此时分布式系统为了保持系统中的数据备份数量一致,会从其他存储服务器中选择一个替代存储服务器替代故障存储服务器,并根据故障存储服务器中的数据对应的副本,在替代服务器中恢复出故障存储服务器中的数据。协调服务器在确定上述替代存储服务器的信息之后,协调服务器将对应的写请求重新发送给上述替代存储服务器,然后接收到写请求的替代存储服务器执行写请求中指定的写操作,并向协调服务器发送执行写请求的执行结果。In a specific implementation manner, during the execution of the transaction, the storage server may also fail, causing the storage server to fail to execute the write request or fail 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 the preset time period, it is determined that the storage server is faulty. At this time, in order to keep the number of data backups in the system consistent, the distributed system will select a replacement storage server from other storage servers to replace the failed storage server, and restore the failure in the replacement server based on the corresponding copy of the data in the failed storage server Store the data in the server. After the coordination server determines the information of the above-mentioned alternative storage server, the coordination server resends the corresponding write request to the above-mentioned alternative storage server, and then the alternative storage server that receives the write request executes the write operation specified in the write request and sends it to the coordination server The execution result of the execution of the write request.

继续以上述协调服务器向存储服务器1、存储服务器2、存储服务器3以及存储服务器4发送写请求为例,当存储服务器2出现故障时,分布式系统选择存储服务器m替代存储服务器2,并根据存储服务器2中数据对应的副本,在存储服务器m中恢复出存储服务器2中的数据。协调服务器在确定存储服务器m代替存储服务器2之后,更新事务数据分布信息,例如将事务数据分布信息中的存储服务器2更换为存储服务器m,然后将发送给存储服务器2的写请求发送给存储服务器m,并将更新后的事务数据分布信息发送给存储服务器1、存储服务器3与存储服务器4。存储服务器m在接收到写请求之后,执行写请求中指定的操作,然后将执行写请求之后的执行结果发送给协调服务器,协调服务器根据存储服务器1、存储服务器3、存储服务器4以及存储服务器m的执行结果确定事务处理结果。Continue to take the aforementioned coordination server sending write requests to storage server 1, storage server 2, storage server 3, and storage server 4 as an example. When storage server 2 fails, the distributed system selects storage server m to replace storage server 2, and according to the storage The corresponding copy of the data in the server 2 restores the data in the storage server 2 in the storage server m. After the coordination server determines that the storage server m replaces the storage server 2, it updates the transaction data distribution information, for example, replaces the storage server 2 in the transaction data distribution information with the storage server m, and then sends the write request sent to the storage server 2 to the storage server m, and send the updated transaction data distribution information to the storage server 1, the storage server 3, and the storage server 4. After the storage server m receives the write request, it executes the operation specified in the write request, and then sends the execution result after executing the write request to the coordination server, and the coordination server according to the storage server 1, storage server 3, storage server 4, and storage server m The result of the execution determines the result of the transaction.

上文中结合图1至图7详细描述了本申请提供的事务提交系统,下面将结合图8至图13,描述根据本申请提供的实现事务提交的相关装置与设备。参见图8,图8是本申请实施例提供的一种协调装置的结构示意图,该协调装置800包括通信单元810与处理单元820。其中,通信单元810用于与业务服务器和存储服务器(存储装置)通信。The transaction submission system provided by the present application is described in detail above with reference to Figs. 1 to 7, and the related devices and equipment for implementing transaction submission provided by the present application will be described below with reference to Figs. 8-13. Referring to FIG. 8, FIG. 8 is a schematic structural diagram of a coordination device provided by an embodiment of the present application. The coordination device 800 includes a communication unit 810 and a processing unit 820. Among them, the communication unit 810 is used to communicate with a service server and a storage server (storage device).

通信单元810,用于接收业务服务器发送的事务,该事务包括至少一个事务数据信息,每个事务数据信息包括一个原始数据的副本在存储服务器上的存储位置信息以及写操作符。上述事务包括的信息可参照上述S302中的相关描述,在此不再赘述。The communication unit 810 is configured to receive a transaction sent by the service server, 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. For the information included in the foregoing transaction, refer to the related description in the foregoing S302, which is not repeated here.

处理单元820,用于根据预先存储的数据分布信息,确定事务数据分布信息,其中,数据分布信息指示事务处理系统中存储每个原始数据的每个副本的存储服务器,事务数据分布信息指示存储上述事务包括的每个事务数据信息对应的原始数据的每个副本的存储服务器。The processing unit 820 is configured to determine transaction data distribution information according to pre-stored data distribution information, where the data distribution information indicates a storage server that stores each copy of each original data in the transaction processing system, and the transaction data distribution information indicates storage of the foregoing A storage server for each copy of the original data corresponding to each transaction data information included in the transaction.

处理单元820,还用于根据接收到的事务生成至少一个写请求,每个写请求包括上述事务数据分布信息以及一个事务数据信息。处理单元820生成写请求的具体操作可参照上述S302中的相关描述。The processing unit 820 is further configured to generate at least one write request according to the received transaction, and each write request includes the foregoing transaction data distribution information and one transaction data information. For the specific operation of the processing unit 820 to generate the write request, reference may be made to the related description in the foregoing S302.

通信单元810,还用于将上述每个写请求发送至每个写请求包括的事务数据信息对应的原始数据的副本所在的存储服务器。并接收每个接收到写请求的存储服务器发送的执行结果, 该执行结果为接收到写请求的存储服务器对接收到写请求中包括的事务数据信息对应的原始数据的副本进行操作的执行结果。通信单元810将每个写请求发送至对应存储服务器的操作可残值上述S302中的相关描述。The communication unit 810 is also configured to send each write request to the storage server where the copy of the original data corresponding to the transaction data information included in each write request is located. The execution result sent by each storage server that receives the write request is received, and the execution result is the execution result of the storage server that received the write request operating the copy of the original data corresponding to the transaction data information included in the received write request. The operation of the communication unit 810 sending each write request to the corresponding storage server may be the relevant description in S302 above.

处理单元820,还用于根据每个接收到写请求的存储服务器发送的执行写请求的执行结果,确定事务的事务处理结果。处理单元820确定事务处理结果的操作可参照上述S305中的相关描述,在此不再赘述。The processing unit 820 is further configured to determine the transaction processing result of the transaction according to the execution result of executing the write request sent by each storage server that receives the write request. For the operation of the processing unit 820 to determine the transaction processing result, reference may be made to the relevant description in the foregoing S305, which will not be repeated here.

通信单元810,还用于将上述事务处理结果发送给业务服务器。The communication unit 810 is also configured to send the transaction processing result to the service server.

该协调装置800还可以包括存储单元830,存储单元830用于存储上述数据分布信息。The coordination device 800 may further include a storage unit 830, and the storage unit 830 is configured to store the foregoing data distribution information.

具体的,协调装置800实现分布式事实务提交的具体操作可参照上述方法实施例中协调服务器执行的操作,例如,处理单元820用于执行上述S301~S305或S601~S603中协调服务器所执行的操作,在此不再赘述。Specifically, the specific operation of the coordination device 800 to implement distributed fact submission can refer to the operations performed by the coordination server in the foregoing method embodiment. For example, the processing unit 820 is configured to perform the operations performed by the coordination server in S301 to S305 or S601 to S603. The operation is not repeated here.

参见图9,图9是本申请提供的一种存储装置的结构示意图,该存储装置900包括通信单元910与处理单元920。其中,通信单元910用于与其他存储服务器(存储装置)和协调服务器(协调装置)通信。Refer to FIG. 9, which is a schematic structural diagram of a storage device provided by the present application. The storage device 900 includes a communication unit 910 and a processing unit 920. Among them, the communication unit 910 is used to communicate with other storage servers (storage devices) and coordination servers (coordination devices).

通信单元910,用于接收协调服务器发送的写请求,该写请求包括事务数据分布信息以及一个事务数据信息,写请求是协调服务器根据接收到的事务生成的至少一个写请求中的任意一个或者多个写请求,目标存储服务器是至少一个写请求包括的事务数据信息对应的原始数据的副本所在的多个存储服务器中的任一个,上述事务包括至少一个事务数据信息,事务数据分布信息指示存储事务包括的每个事务数据信息对应的原始数据的每个副本的存储服务器。上述事务包括的信息、事务数据信息等可参照上述S301中的描述,在此不再赘述。The communication unit 910 is configured to receive a write request sent by the coordination server. The write request includes transaction data distribution information and one transaction data information. The write request is any one or more of at least one write request generated by the coordination server according to the received transaction. A write request, the target storage server is any one of the multiple storage servers where the copy of the original data corresponding to the transaction data information included in the at least one write request is located, the transaction includes at least one transaction data information, and the transaction data distribution information indicates the storage transaction The storage server for each copy of the original data corresponding to each transaction data information included. For the information included in the above transaction, transaction data information, etc., please refer to the description in the above S301, which will not be repeated here.

处理单元920,根据事务数据信息,对写请求包括的事务数据信息对应的原始数据的副本进行操作,通信单元910向协调服务器发送上述写请求的执行结果。处理单元920根据接收到的写请求后执行的操作可以参照上述S303和S304中存储服务器执行的操作,在此不再赘述。The processing unit 920 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 the communication unit 910 sends the execution result of the above write request to the coordination server. For operations performed by the processing unit 920 after receiving the write request, reference may be made to operations performed by the storage server in S303 and S304, which will not be repeated here.

通信单元910还用于接收协调服务器发送的读请求,所述读请求包括目标数据的副本在存储服务器上的存储位置和读操作符。该读请求中包括的具体信息可参照上述S601中的描述。The communication unit 910 is also configured to receive a read request sent by the coordination server, where the read request includes the storage location of the copy of the target data on the storage server and the read operator. For the specific information included in the read request, refer to the description in S601 above.

处理单元920,根据所接收到的写请求中的事务数据分布信息,向存储所述事务包括的每个事务数据信息对应的原始数据的每个副本的存储服务器查询上述至少一个写请求的执行结果;根据查询得到的上述至少一个写请求的执行结果,执行提交操作或回滚操作;根据目标数据的副本在存储装置上的存储位置读取目标数据,并将读取的所述目标数据发送至所述协调服务器。处理单元920查询上述至少一个写请求的执行结果的具体操作可以参照上述S602中目标存储服务器向一个或者多个存储服务器发送查询请求的操作;处理单元920根据每个接收到写请求的存储服务器反馈的执行结果确定执行提交操作或者回滚操作的方法可以参照上述S603中目标存储服务器根据查询结果执行提交操作或者回滚操作的描述,在此不再赘述。The processing unit 920, according to the transaction data distribution information in the received write request, 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. Execute the commit operation or rollback operation according to the execution result of the at least one write request obtained by the query; read the target data according to the storage location of the copy of the target data on the storage device, and send the read target data to The coordination server. For the specific operation of the processing unit 920 to query the execution result of the at least one write request, refer to the operation of the target storage server sending a query request to one or more storage servers in S602; the processing unit 920 feedbacks according to each storage server that receives the write request. For the method for determining the execution of the commit operation or the rollback operation according to the execution result, refer to the description of the target storage server performing the commit operation or the rollback operation according to the query result in S603, which will not be repeated here.

处理单元920,还用于根据查询得到的所述至少一个写请求的执行结果,生成操作信息,所述操作信息指示提交操作或回滚操作;所述通信单元910,还用于将所述操作信息发送至存储所述事务包括的每个事务数据信息对应的原始数据的每个副本的存储服务器。处理单元920生成操作信息的方法可以参照上述S603中目标存储服务器生成操作信息的方法。The processing unit 920 is further configured to generate 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; the communication unit 910 is also configured to transfer the operation The information is sent to a storage server that stores each copy of the original data corresponding to each transaction data information included in the transaction. The method for the processing unit 920 to generate the operation information may refer to the method for the target storage server to generate the operation information in S603.

存储装置900还包括存储单元930,存储单元930用于存储上述写请求需要操作的原始 数据和读请求需要读取的目标数据。The storage device 900 further includes a storage unit 930, which is used to store the original data that needs to be manipulated by the write request and the target data that needs to be read by the read request.

具体的,存储装置900实现分布式事实务提交的具体操作可参照上述方法实施例中存储服务器执行的操作,例如,处理单元920用于执行上述S301~S305或S601~S603中存储服务器所执行的操作,在此不再赘述。Specifically, for the specific operations of the storage device 900 to implement distributed fact submission, refer to the operations performed by the storage server in the foregoing method embodiment. For example, the processing unit 920 is configured to perform the operations performed by the storage server in S301 to S305 or S601 to S603. The operation is not repeated here.

参见图10,图10是本申请提供的一种存储装置的结构示意图,该存储装置1000包括通信单元1010与处理单元1020。其中,通信单元910用于与其他存储服务器(存储装置)和协调服务器(协调装置)通信。Refer to FIG. 10, which is a schematic structural diagram of a storage device provided by the present application. The storage device 1000 includes a communication unit 1010 and a processing unit 1020. Among them, the communication unit 910 is used to communicate with other storage servers (storage devices) and coordination servers (coordination devices).

通信单元1010,用于接收协调服务器发送的写请求,该写请求包括事务数据分布信息以及一个事务数据信息,该写请求是协调服务器根据接收到的事务生成的至少一个写请求之一,存储服务器是上述至少一个写请求包括的事务数据信息对应的原始数据的副本所在的多个存储服务器之一,事务包括至少一个事务数据信息,每个事务数据信息包括一个原始数据的副本在存储服务器上的存储位置信息以及写操作符,事务数据分布信息指示存储所述事务包括的每个事务数据信息对应的原始数据的每个副本的存储服务器。上述事务包括的信息、事务数据信息等可参照上述S301中的描述,在此不再赘述。The communication unit 1010 is configured to receive a write request sent by the coordination server. The write request includes transaction data distribution information and one transaction data information. The write request is one of at least one write request generated by the coordination server according to the received transaction, and the storage server Is one of the multiple storage servers where a copy of the original data corresponding to the transaction data information included in the at least one write request is located, the transaction includes at least one transaction data information, and each transaction data information includes a copy of the original data on the storage server The storage location information and the write operator, and the transaction data distribution information indicate a storage server that stores each copy of the original data corresponding to each transaction data information included in the transaction. For the information included in the above transaction, transaction data information, etc., please refer to the description in the above S301, which will not be repeated here.

处理单元1020,用于根据事务数据信息,对所述写请求包括的事务数据信息对应的原始数据的副本进行操作;通信单元1010,还用于向协调服务器发送所述写请求的执行结果。处理单元1020根据接收到的写请求后执行的操作可以参照上述S303和S304中存储服务器执行的操作,在此不再赘述。The processing unit 1020 is configured to operate on a copy of the original data corresponding to the transaction data information included in the write request according to the transaction data information; the communication unit 1010 is also configured to send the execution result of the write request to the coordination server. For operations performed by the processing unit 1020 after receiving the write request, reference may be made to operations performed by the storage server in S303 and S304, which will not be repeated here.

处理单元1020,还用于确定向所述协调服务器发送所述写请求的执行结果后的预设时间内未收到所述协调服务器发送的操作信息,根据所述事务数据分布信息,向存储所述事务包括的每个事务数据信息对应的原始数据的每个副本的存储服务器查询所述至少一个写请求的执行结果;根据查询得到的所述至少一个写请求的执行结果,执行提交操作或回滚操作。处理单元1020执行根据事务数据分布信息,向存储所述事务包括的每个事务数据信息对应的原始数据的每个副本的存储服务器查询所述至少一个写请求的执行结果以及根据上述至少一个写请求的执行结果执行的操作,可以参照上述方法实施例中,存储服务器感知到协调服务器出现故障后执行的操作,在此不再赘述。The processing unit 1020 is further configured to determine that the operation information sent by the coordination server is not received within a preset time after sending the execution result of the write request to the coordination server, and send the operation information to the storage according to the transaction data distribution information. The storage server of each copy of the original data corresponding to each transaction data information included in the transaction queries the execution result of the at least one write request; according to the execution result of the at least one write request obtained by the query, the commit operation or the response is executed Roll operation. The processing unit 1020 executes, according to transaction data distribution information, querying the storage server storing each copy of the original data corresponding to each transaction data information included in the transaction for the execution result of the at least one write request, and according to the at least one write request. For the operations performed as a result of the execution result of, refer to the operations performed after the storage server perceives the failure of the coordination server in the foregoing method embodiment, which will not be repeated here.

存储装置1000还包括存储单元1030,存储单元1030用于存储上述写请求需要操作的原始数据和读请求需要读取的目标数据。处理单元1020执行上述S301~S305存储服务器所执行的操作以及存储服务器感知到协调服务器出现故障后执行的操作,在此不再赘述。The storage device 1000 further includes a storage unit 1030, which is configured to store the original data that needs to be operated on by the write request and the target data that needs to be read by the read request. The processing unit 1020 executes the operations performed by the storage server in S301 to S305 and the operations performed by the storage server after sensing the failure of the coordination server, which will not be repeated here.

参见图11,图11是本申请实施例提供的一种协调服务器的结构示意图,该协调服务器1100包括:一个或者多个处理器1110、通信接口1120以及存储器1130。可选的,所述处理器1110、通信接口1120以及存储器1130通过总线1140相互连接,其中,Refer to FIG. 11, which is a schematic structural diagram of a coordination server provided by 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 connected to each other through a bus 1140, where:

所述处理器1110用于实现上述处理单元820执行的操作,处理器1110执行各种操作的具体实现可参照上述方法实施例中以协调服务器为执行主体执行的具体操作。例如处理器1110用于执行上述图5中S303、S304中协调服务器的操作等,在此不再赘述。The processor 1110 is configured to implement the operations performed by the processing unit 820, and the specific implementation of the various operations performed by the processor 1110 may refer to the specific operations performed by the coordination server in the foregoing method embodiment. For example, the processor 1110 is configured to perform operations of the coordination server in S303 and S304 in FIG. 5, and details are not described herein again.

处理器1110可以有多种具体实现形式,例如处理器1110可以为中央处理器(central processing unit,CPU)或图像处理器(graphics processing unit,GPU),处理器1110还可以是单核处理器或多核处理器。处理器1110可以由CPU和硬件芯片的组合。上述硬件芯片可以是专用集成电路(application-specific integrated circuit,ASIC),可编程逻辑器件(programmable logic device,PLD)或其组合。上述PLD可以是复杂可编程逻辑器件(complex  programmable logic device,CPLD),现场可编程逻辑门阵列(field-programmable gate array,FPGA),通用阵列逻辑(generic array logic,GAL)或其任意组合。处理器1110也可以单独采用内置处理逻辑的逻辑器件来实现,例如FPGA或数字信号处理器(digital signal processor,DSP)等。The processor 1110 may have a variety of specific implementation forms. For example, the processor 1110 may be a central processing unit (CPU) or an graphics processing unit (GPU), and the processor 1110 may also be a single-core processor or Multi-core processor. The processor 1110 may be a combination of a CPU and a hardware chip. The above-mentioned hardware chip may be an application-specific integrated circuit (ASIC), a programmable logic device (PLD) or a combination thereof. The aforementioned PLD may 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 may also be implemented solely by a logic device with built-in processing logic, such as an FPGA or a digital signal processor (digital signal processor, DSP).

通信接口1120可以为有线接口或无线接口,用于与其他模块或设备进行通信,有线接口可以是以太接口、局域互联网络(local interconnect network,LIN)等,无线接口可以是蜂窝网络接口或使用无线局域网接口等。The communication interface 1120 can be a wired interface or a wireless interface for communicating with other modules or devices. The wired interface can be an Ethernet interface, a local interconnect network (LIN), etc., and the wireless interface can be a cellular network interface or use Wireless LAN interface, etc.

本申请实施例中通信接口1120执行上述通信单元810实现的操作,例如,可用于执行上述S301中接收业务服务器发送的事务,或者接收存储服务器的执行结果等。具体的,通信接口1120执行的动作可以参照上述方法实施例协调服务器接收或者发送的动作,在此不再赘述。In the embodiment of the present application, the communication interface 1120 executes the operations implemented by the communication unit 810, for example, it can be used to execute the transaction sent by the service server in S301, or the execution result of the storage server. Specifically, the actions performed by the communication interface 1120 may refer to the actions received or sent by the coordination server in the foregoing method embodiments, and details are not described herein again.

存储器1130可以是非易失性存储器,例如,只读存储器(read-only memory,ROM)、可编程只读存储器(programmable ROM,PROM)、可擦除可编程只读存储器(erasable PROM,EPROM)、电可擦除可编程只读存储器(electrically EPROM,EEPROM)或闪存。存储器1130也可以是易失性存储器,易失性存储器可以是随机存取存储器(random access memory,RAM),其用作外部高速缓存。The memory 1130 may be a non-volatile memory, for example, read-only memory (ROM), programmable read-only memory (programmable ROM, PROM), erasable programmable read-only memory (erasable PROM, EPROM), Electrically erasable programmable read-only memory (EPROM, EEPROM) or flash memory. The memory 1130 may also be a volatile memory, and the volatile memory may be a random access memory (RAM), which is used as an external cache.

存储器1130也可用于存储指令和数据,以便于处理器1110调用存储器1130中存储的指令实现上述处理单元820执行的操作,例如上述方法实施例中协调服务器执行的操作。此外,协调服务器1100可能包含相比于图11展示的更多或者更少的组件,或者有不同的组件配置方式。The memory 1130 may 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 coordinating operations performed by the server in the foregoing method embodiment. In addition, the coordination server 1100 may include more or fewer components than those shown in FIG. 11, or may have different component configurations.

总线1140可以是外设部件互连标准(peripheral component interconnect,PCI)总线或扩展工业标准结构(extended industry standard architecture,简称EISA)总线等。所述总线1140可以分为地址总线、数据总线、控制总线等。为便于表示,图11中仅用一条粗线表示,但并不表示仅有一根总线或一种类型的总线。The bus 1140 may be a peripheral component interconnect standard (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The bus 1140 can be divided into an address bus, a data bus, a control bus, and so on. For ease of representation, only one thick line is used to represent in FIG. 11, but it does not mean that there is only one bus or one type of bus.

可选地,该协调服务器1100还可以包括输入/输出接口1150,输入/输出接口1150连接有输入/输出设备,用于接收输入的信息,输出操作结果。Optionally, the coordination server 1100 may further include an input/output interface 1150, and the input/output interface 1150 is connected to an input/output device for receiving input information and outputting operation results.

具体地,上述协调服务器1100执行各种操作的具体实现可参照上述方法实施例中协调服务器执行的具体操作,在此不再赘述。Specifically, for the specific implementation of various operations performed by the aforementioned coordination server 1100, reference may be made to the specific operations performed by the coordination server in the foregoing method embodiments, and details are not described herein again.

参见图12,图12是本申请实施例提供的一种存储服务器的结构示意图,该存储服务器1200包括:一个或者多个处理器1210、通信接口1220以及存储器1230。可选的,所述处理器1210、通信接口1220以及存储器1230通过总线1240相互连接,其中,Referring to FIG. 12, FIG. 12 is a schematic structural diagram of a storage server according to 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 connected to each other through a bus 1240, where:

所述处理器1210用于实现上述处理单元920执行的操作,处理器1210执行各种操作的具体实现可参照上述方法实施例中以存储服务器为执行主体执行的具体操作。例如处理器1210用于执行上述图5中S303与S304中的存储服务器执行的操作,或者上述S301~S305存储服务器所执行的操作以及存储服务器感知到协调服务器出现故障后执行的操作,在此不再赘述。The processor 1210 is configured to implement the operations performed by the processing unit 920. For the specific implementation of the various operations performed by the processor 1210, refer to the specific operations performed by the storage server in the foregoing method embodiment. For example, the processor 1210 is used to perform the operations performed by the storage server in S303 and S304 in FIG. 5, or the operations performed by the storage servers in S301 to S305, and the operations performed by the storage server after sensing that the coordination server has failed. Go into details again.

处理器1210可以有多种具体实现形式,例如处理器1210可以为中央处理器或图像处理器,处理器1210还可以是单核处理器或多核处理器。处理器1210可以由CPU和硬件芯片的组合。The processor 1210 may have a variety of specific implementation forms. For example, the processor 1210 may be a central processing unit or an image processor, and 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.

通信接口1220可以为有线接口或无线接口,具体参考通信接口1120。The communication interface 1220 may be a wired interface or a wireless interface. For details, refer to the communication interface 1120.

本申请实施例中通信接口1220执行上述通信单元910实现的操作,具体可用于执行上述 S303中接收事务数据标识、事务数据信息以及事务数据分布信息等操作,或者执行S304中将存储服务器的执行结果发送给协调服务器等操作。具体的,通信接口1220执行的动作可以参照上述方法实施例存储服务器接收或者发送的动作,在此不再赘述。In the embodiment of the application, the communication interface 1220 executes the operations implemented by the communication unit 910, which can be specifically used to perform operations such as receiving transaction data identifiers, transaction data information, and transaction data distribution information in S303, or perform operations of storing server execution results in S304. Send to the coordination server and other operations. Specifically, the actions performed by the communication interface 1220 may refer to the actions received or sent by the storage server in the foregoing method embodiment, and details are not described herein again.

存储器1230可以是非易失性存储器或易失性存储器,具体参考存储器1130。The memory 1230 may be a non-volatile memory or a volatile memory. For details, refer to the memory 1130.

存储器1230也可用于存储指令和数据,以便于处理器1210调用存储器1230中存储的指令实现上述处理单元920执行的操作,例如上述方法实施例中存储服务器执行的操作。此外,存储服务器1200可能包含相比于图12展示的更多或者更少的组件,或者有不同的组件配置方式。The memory 1230 may 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 foregoing method embodiment. In addition, the storage server 1200 may include more or fewer components than those shown in FIG. 12, or may have different component configurations.

总线1240可以是PCI总线或EISA总线等,具体参考总线1140。The bus 1240 may be a PCI bus, an EISA bus, or the like. For details, refer to the bus 1140.

可选地,该存储服务器1200还可以包括输入/输出接口1250,输入/输出接口1250连接有输入/输出设备,用于接收输入的信息,输出操作结果。Optionally, the storage server 1200 may further include an input/output interface 1250, and the input/output interface 1250 is connected to an input/output device for receiving input information and outputting operation results.

具体地,上述服务器1200执行各种操作的具体实现可参照上述方法实施例中存储服务器执行的具体操作,在此不再赘述。Specifically, for the specific implementation of the various operations performed by the foregoing server 1200, reference may be made to the specific operations performed by the storage server in the foregoing method embodiment, and details are not described herein again.

参见图13,图13是本申请实施例提供的一种存储服务器的结构示意图,该存储服务器1300包括:一个或者多个处理器1310、通信接口1320以及存储器1330。可选的,所述处理器1310、通信接口1320以及存储器1330通过总线1340相互连接,其中,Referring to FIG. 13, FIG. 13 is a schematic structural diagram of a storage server according to 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 connected to each other through a bus 1340, where:

所述处理器1310用于实现上述处理单元920执行的操作,处理器1310执行各种操作的具体实现可参照上述方法实施例中以存储服务器为执行主体执行的具体操作。例如处理器1310用于执行上述图5中S301~S305存储服务器所执行的操作以及上述方法侧实施例中存储服务器感知到协调服务器出现故障后执行的操作,在此不再赘述。The processor 1310 is configured to implement the operations performed by the processing unit 920, and the specific implementation of various operations performed by the processor 1310 may refer to the specific operations performed by the storage server in the foregoing method embodiment. For example, the processor 1310 is configured to perform the operations performed by the storage server in S301 to S305 in FIG. 5 and the operations performed by the storage server in the foregoing method-side embodiment after it perceives a failure of the coordination server, which will not be repeated here.

处理器1310可以有多种具体实现形式,例如处理器1310可以为中央处理器或图像处理器,处理器1310还可以是单核处理器或多核处理器,处理器1310还可以由CPU和硬件芯片的组合。The processor 1310 can have a variety of specific implementation forms. For example, the processor 1310 can be a central processing unit or an image processor, the processor 1310 can also be a single-core processor or a multi-core processor, and the processor 1310 can also be composed of a CPU and a hardware chip. The combination.

通信接口1320可以为有线接口或无线接口,具体参考通信接口1120。The communication interface 1320 may be a wired interface or a wireless interface. For details, refer to the communication interface 1120.

本申请实施例中通信接口1320执行上述通信单元910实现的操作,具体可用于执行上述S303中接收事务数据标识、事务数据信息以及事务数据分布信息等操作,或者执行S304中将存储服务器的执行结果发送给协调服务器等操作。具体的,通信接口1320执行的动作可以参照上述方法实施例存储服务器接收或者发送的动作,在此不再赘述。In this embodiment of the application, the communication interface 1320 executes the operations implemented by the communication unit 910, which can be specifically used to perform operations such as receiving transaction data identifiers, transaction data information, and transaction data distribution information in S303, or execute S304 to store the execution results of the server Send to the coordination server and other operations. Specifically, the actions performed by the communication interface 1320 may refer to the actions received or sent by the storage server in the foregoing method embodiment, and details are not described herein again.

存储器1330可以是非易失性存储器或易失性存储器,具体参考存储器1130。The memory 1330 may be a non-volatile memory or a volatile memory. For details, refer to the memory 1130.

存储器1330也可用于存储指令和数据,以便于处理器1310调用存储器1330中存储的指令实现上述处理单元820执行的操作,例如上述方法实施例中存储服务器执行的操作。此外,存储服务器1300可能包含相比于图13展示的更多或者更少的组件,或者有不同的组件配置方式。The memory 1330 may 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, for example, the operations performed by the storage server in the foregoing method embodiment. In addition, the storage server 1300 may include more or fewer components than those shown in FIG. 13, or may have different component configurations.

总线1340可以是PCI总线或EISA总线等,具体参考总线1140。The bus 1340 may be a PCI bus, an EISA bus, or the like. For details, refer to the bus 1140.

可选地,该存储服务器1300还可以包括输入/输出接口1350,输入/输出接口1350连接有输入/输出设备,用于接收输入的信息,输出操作结果。Optionally, the storage server 1300 may further include an input/output interface 1350. The input/output interface 1350 is connected to an input/output device for receiving input information and outputting operation results.

本申请实施例还提供一种非瞬态计算机可读存储介质,所述计算机可读存储介质中存储有计算机程序,当计算机程序在处理器上运行时,可以实现上述方法实施例中的协调服务器执行的方法步骤,所述计算机存储介质的处理器在执行上述方法步骤的具体实现可参照上述方法实施例中协调服务器的具体操作,在此不再赘述。The embodiment of the present application also provides a non-transitory computer-readable storage medium in which a computer program is stored. When the computer program runs on a processor, the coordination server in the above-mentioned method embodiment can be implemented. For the method steps to be executed, the processor of the computer storage medium can refer to the specific operations of the coordination server in the method embodiments for the specific implementation of the above method steps, which will not be repeated here.

本申请实施例还提供一种非瞬态计算机可读存储介质,所述计算机可读存储介质中存储有计算机程序,当计算机程序在处理器上运行时,可以实现上述方法实施例中存储服务器执行的方法步骤,所述计算机存储介质的处理器在执行上述方法步骤的具体实现可参照上述方法实施例中存储服务器的具体操作,在此不再赘述。The embodiments of the present application also provide a non-transitory computer-readable storage medium in which a computer program is stored. When the computer program runs on a processor, the storage server in the above method embodiment can be executed. For the method steps of the computer storage medium, the processor of the computer storage medium can refer to the specific operation of the storage server in the above method embodiment for the specific implementation of the above method steps, which will not be repeated here.

在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述的部分,可以参见其它实施例的相关描述。In the above-mentioned embodiments, the description of each embodiment has its own focus. For a part that is not described in detail in an embodiment, reference may be made to related descriptions of other embodiments.

上述实施例,可以全部或部分地通过软件、硬件、固件或其他任意组合来实现。当使用软件实现时,上述实施例可以全部或部分地以计算机程序产品的形式实现。所述计算机程序产品包括一个或多个计算机指令。在计算机上加载或执行所述计算机程序指令时,全部或部分地产生按照本发明实施例所述的流程或功能。所述计算机可以为通用计算机、专用计算机、计算机网络、或者其他可编程装置。所述计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,所述计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线(例如同轴电缆、光纤、数字用户线(DSL))或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传输。所述计算机可读存储介质可以是计算机能够存取的任何可用介质或者是包含一个或多个可用介质集合的服务器、数据中心等数据存储设备。所述可用介质可以是磁性介质(例如,软盘、硬盘、磁带)、光介质(例如,DVD)、或者半导体介质。半导体介质可以是固态硬盘(solid state drive,SSD)。The above-mentioned embodiments may be implemented in whole or in part by software, hardware, firmware or any other combination. When implemented using software, the above-mentioned embodiments may be implemented in the form of a computer program product in whole or in part. 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 the embodiments of the present invention are generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from a website, computer, server, or data center. Transmission to another website, computer, server or data center via wired (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, microwave, etc.). The computer-readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server or a data center that includes one or more sets of available media. The usable medium may be a magnetic medium (for example, a floppy disk, a hard disk, a magnetic tape), an optical medium (for example, a DVD), or a semiconductor medium. The semiconductor medium may be a solid state drive (SSD).

本申请实施例方法中的步骤可以根据实际需要进行顺序调整、合并或删减;本申请实施例装置中的模块可以根据实际需要进行划分、合并或删减。The steps in the method in the embodiment of the present application can be adjusted, merged, or deleted in order according to actual needs; the modules in the device in the embodiment of the present application can be divided, merged, or deleted according to actual needs.

以上对本申请实施例进行了详细介绍,本文中应用了具体个例对本申请的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本申请的方法及其核心思想;同时,对于本领域的一般技术人员,依据本申请的思想,在具体实施方式及应用范围上均会有改变之处,综上所述,本说明书内容不应理解为对本申请的限制。The embodiments of the application are described in detail above, and specific examples are used in this article to illustrate the principles and implementation of the application. The descriptions of the above embodiments are only used to help understand the methods and core ideas of the application; at the same time, for Those of ordinary skill in the art, based on the idea of the application, will have changes in the specific implementation and the scope of application. In summary, the content of this specification should not be construed as a limitation to the application.

Claims (28)

一种事务处理系统,其特征在于,包括协调服务器和多个存储服务器;A transaction processing system, characterized in that it includes a coordination server and a plurality of storage servers; 所述协调服务器,用于接收事务,所述事务包括至少一个事务数据信息,每个事务数据信息包括一个原始数据的副本在存储服务器上的存储位置信息以及写操作符;根据预先存储的数据分布信息,确定事务数据分布信息,其中,所述数据分布信息指示所述事务处理系统中存储每个原始数据的每个副本的存储服务器,所述事务数据分布信息指示存储所述事务包括的每个事务数据信息对应的原始数据的每个副本的存储服务器;生成至少一个写请求,每个写请求包括所述事务数据分布信息以及一个事务数据信息;将所述每个写请求发送至所述每个写请求包括的事务数据信息对应的原始数据的副本所在的存储服务器;The coordination server is configured to receive transactions, the transaction includes at least one transaction data information, and each transaction data information includes the storage location information of a copy of the original data on the storage server and the write operator; according to the pre-stored data distribution Information to determine transaction data distribution information, wherein the data distribution information indicates a storage server in the transaction processing system that stores each copy of each original data, and the transaction data distribution information indicates that each transaction included in the transaction is stored The storage server for each copy of the original data corresponding to the transaction data information; generate at least one write request, each write request including the transaction data distribution information and one transaction data information; send each write request to the each 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; operate 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; Sending the execution result of the write request to the coordination server; 所述协调服务器,还用于根据每个接收到所述写请求的存储服务器发送的所述写请求的执行结果,确定所述事务的事务处理结果,向业务服务器发送所述事务处理结果。The coordination server is further configured to determine the transaction processing result of the transaction according to the execution result of the write request sent by each storage server that receives the write request, and send the transaction processing result to the service server. 如权利要求1所述的事务处理系统,其特征在于,The transaction processing system of claim 1, wherein: 所述协调服务器,用于接收读请求,所述读请求包括目标数据的副本在存储服务器上的存储位置和读操作符;根据所述数据分布信息,确定存储所述目标数据的副本的存储服务器;将所述读请求发送至存储所述目标数据的副本的存储服务器;The coordination server is configured to receive a read request, where the read request includes a storage location and a read operator of the copy of the target data on the storage server; according to the data distribution information, the storage server that stores the copy of the target data is determined ; Send the read request to a storage server that stores a copy of the target data; 接收到所述读请求的存储服务器,用于根据所述事务数据分布信息,向每个接收到所述写请求的存储服务器查询所述写请求的执行结果;根据每个接收到所述写请求的存储服务器发送的执行所述写请求的执行结果,确定执行提交操作或回滚操作;执行所述提交操作或所述回滚操作后,根据所述目标数据的副本在存储服务器上的存储位置读取所述目标数据;将读取的所述目标数据发送至所述协调服务器。The storage server that has received the read request is configured to query each storage server that has received the write request for the execution result of the write request according to the transaction data distribution information; according to each received write request The execution result of the execution of the write request sent by the storage server determines the execution of the commit operation or the rollback operation; after the execution of the commit operation or the rollback operation, according to the storage location of the copy of the target data on the storage server Read the target data; send the read target data to the coordination server. 如权利要求2所述的事务处理系统,其特征在于,The transaction processing system of 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, the operation information indicating a submit operation or a rollback operation, and send the operation information to each receiving The storage server for the write request. 如权利要求2或3所述的事务处理系统,其特征在于,所述目标数据的副本在存储服务器上的存储位置和所述原始数据的副本在存储服务器上的存储位置存在重叠,或者所述目标数据的副本和所述原始数据的副本存储于需要保持一致性的数据块中。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 The copy of the target data and the copy of the original data are stored in a data block that needs to be consistent. 如权利要求2至4任一所述的事务处理系统,其特征在于,The transaction processing system according to any one of claims 2 to 4, wherein: 所述协调服务器,用于根据所述数据分布信息,确定多个存储所述目标数据的副本的存储服务器;从确定的所述多个存储所述目标数据的副本的存储服务器中选择目标存储服务器;将所述读请求发送至所述目标存储服务器。The coordination server is configured to determine a plurality of storage servers that store copies of the target data according to the data distribution information; select the target storage server from the determined multiple storage servers that store copies of the target data ; Send the read request to the target storage server. 如权利要求1所述的事务处理系统,其特征在于,The transaction processing system of claim 1, wherein: 所述协调服务器,还用于根据每个接收到所述写请求的存储服务器发送的所述写请求的所述执行结果,确定每个接收到所述写请求的存储服务器需要执行的操作信息,所述操作信息指示执行提交操作或回滚操作,将所述操作信息发送至每个接收到所述写请求的存储服务器。The coordination server is further configured to determine the operation information that each storage server that receives the write request needs to perform based on the execution result of the write request sent by each storage server that receives the write request, The operation information indicates the execution of a commit operation or a rollback operation, and the operation information is sent to each storage server that receives the write request. 如权利要求6所述的事务处理系统,其特征在于,The transaction processing system of 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 is not received within a preset time after sending the execution result of the operation to the coordination server, and according to the transaction The data distribution information 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 write request; according to the execution result, it is determined to execute the commit operation or the return Roll operation. 一种事务处理方法,其特征在于,应用于包括协调服务器和多个存储服务器的事务处理系统,所述方法包括:A transaction processing method, characterized in that it is applied to a transaction processing system including a coordination server and a plurality of storage servers, and the method includes: 所述协调服务器接收业务服务器发送的事务,所述事务包括至少一个事务数据信息,每个事务数据信息包括一个原始数据的副本在存储服务器上的存储位置信息以及写操作符;The coordination server receives a transaction sent by a business server, 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 according to pre-stored data distribution information, where the data distribution information indicates a storage server that stores each copy of each original data in the transaction processing system, and the transaction data distribution The information indicates a storage server that stores each copy of original data corresponding to each transaction data information included in the transaction; 所述协调服务器生成至少一个写请求,每个写请求包括所述事务数据分布信息以及一个事务数据信息;The coordination server generates at least one write request, and each write request includes the transaction data distribution information and one 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, and according to the transaction data information included in the write request, operates on a copy of the original data corresponding to the transaction data information included in the write request, and reports to the Coordinating the server to send the execution result of the write request; 所述协调服务器根据每个接收到所述写请求的存储服务器发送的所述写请求执行结果,确定所述事务的事务处理结果,并向业务服务器发送所述事务处理结果。The coordination server determines the transaction processing result of the transaction according to the execution result of the write request sent by each storage server that receives the write request, and sends the transaction processing result to the service server. 如权利要求8所述的方法,其特征在于,所述方法还包括:The method according to claim 8, wherein the method further comprises: 所述协调服务器接收所述业务服务器发送的读请求,所述读请求包括目标数据的副本在存储服务器上的存储位置和读操作符;Receiving, by the coordination server, a read request sent by the business server, the read request including a storage location and a read operator of the copy of the target data on the storage server; 所述协调服务器根据所述数据分布信息,确定存储所述目标数据的副本的存储服务器,将所述读请求发送至存储所述目标数据的副本的存储服务器;The coordination server determines a storage server that stores a copy of the target data according to the data distribution information, and sends the read request to the storage server that stores the copy of the target data; 接收到所述读请求的存储服务器根据所述事务数据分布信息,向每个接收到所述写请求的存储服务器查询所述写请求的执行结果;根据每个接收到所述写请求的存储服务器发送的执行所述写请求的执行结果,确定执行提交操作或回滚操作;According to the transaction data distribution information, the storage server that has received the read request queries each storage server that has received the write request for the execution result of the write request; according to each storage server that has received the write request The sent execution result of the execution of the write request, confirming the execution of the commit operation or the rollback operation; 接收到所述读请求的存储服务器根据所述目标数据的副本在存储服务器上的存储位置读取所述目标数据,将读取的所述目标数据发送至所述协调服务器。The storage server that receives the read request reads the target data according to the storage location of the copy of the target data on the storage server, and sends the read target data to the coordination server. 如权利要求9所述的方法,其特征在于,所述方法还包括: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, and the operation information indicates submitting an operation or returning Roll operation. 如权利要求9或10所述的方法,其特征在于,所述目标数据的副本在存储服务器上的存储位置和所述原始数据的副本在存储服务器上的存储位置存在重叠,或者所述目标数据的副本和所述原始数据的副本存储于需要保持一致性的数据块中。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 target data The copy of and the copy of the original data are stored in a data block that needs to be consistent. 如权利要求9至11任一项所述的方法,其特征在于,所述协调服务器根据所述数据分布信息,确定存储所述目标数据的副本的存储服务器,将所述读请求发送至存储所述目标 数据的副本的存储服务器,包括:The method according to any one of claims 9 to 11, wherein the coordination server determines a storage server that stores a copy of the target data according to the data distribution information, and sends the read request to the storage The storage server for the copy of the target data includes: 所述协调服务器根据所述数据分布信息,确定多个存储所述目标数据的副本的存储服务器;The coordination server determines a plurality of storage servers that store copies of the target data according to the data distribution information; 所述协调服务器从确定的所述多个存储所述目标数据的副本的存储服务器中选择目标存储服务器,并将所述读请求发送至所述目标存储服务器。The coordination server selects a target storage server from the determined storage servers that store copies of the target data, and sends the read request to the target storage server. 如权利要求8所述的方法,其特征在于,所述方法还包括:The method according to claim 8, wherein the method further comprises: 所述协调服务器根据每个接收到所述写请求的存储服务器发送的所述写请求的执行结果,确定每个接收到所述写请求的存储服务器需要执行的操作信息,所述操作信息指示执行提交操作或回滚操作;The coordination server determines the operation information that each storage server that receives the write request needs to perform according to the execution result of the write request sent by each storage server that receives the write request, and the operation information indicates the execution Submit operation or rollback operation; 所述协调服务器将所述操作信息发送至每个接收到所述写请求的存储服务器。The coordination server sends the operation information to each storage server that receives the write request. 如权利要求13所述的方法,其特征在于,所述方法还包括:The method of claim 13, wherein the method further comprises: 接收到所述写请求的存储服务器确定向所述协调服务器发送所述操作的执行结果后预设时间内未收到所述协调服务器发送的所述操作信息,根据所述事务数据分布信息,向存储所述事务包括的每个事务数据信息对应的原始数据的每个副本的存储服务器查询写请求的执行结果;After receiving the write request, the storage server 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 according to the transaction data distribution information, The storage server storing each copy of the original data corresponding to each transaction data information included in the transaction queries the execution result of the write request; 接收到所述写请求的存储服务器根据所述执行结果,确定执行所述提交操作或所述回滚操作。The storage server receiving the write request determines to execute the commit operation or the rollback operation according to the execution result. 一种事务处理方法,其特征在于,所述方法包括:A transaction processing method, characterized in that the method includes: 协调服务器接收业务服务器发送的事务,所述事务包括至少一个事务数据信息,每个事务数据信息包括一个原始数据的副本在存储服务器上的存储位置信息以及写操作符;The coordination server receives the transaction sent by the business server, the transaction includes at least one transaction data information, and each transaction data information includes the storage location information of a copy of the original data on the storage server and the write operator; 所述协调服务器根据预先存储的数据分布信息,确定事务数据分布信息,其中,所述数据分布信息指示事务处理系统中存储每个原始数据的每个副本的存储服务器,所述事务数据分布信息指示存储所述事务包括的每个事务数据信息对应的原始数据的每个副本的存储服务器;The coordination server determines transaction data distribution information according to pre-stored data distribution information, where the data distribution information indicates a storage server that stores each copy of each original data in the transaction processing system, and the transaction data distribution information indicates A storage server that stores each copy of original data corresponding to each transaction data information included in the transaction; 所述协调服务器生成至少一个写请求,每个写请求包括所述事务数据分布信息以及一个事务数据信息;The coordination server generates at least one write request, and each write request includes the transaction data distribution information and one 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; 所述协调服务器接收每个接收到所述写请求的存储服务器发送的所述写请求的执行结果;Receiving, by the coordination server, an execution result of the write request sent by each storage server that receives the write request; 所述协调服务器根据每个接收到所述写请求的存储服务器发送的所述写请求的执行结果,确定所述事务的事务处理结果,并向所述业务服务器发送所述事务处理结果。The coordination server determines the transaction processing result of the transaction according to the execution result of the write request sent by each storage server that receives the write request, and sends the transaction processing result to the service server. 如权利要求15所述的方法,其特征在于,所述方法还包括:The method of claim 15, wherein the method further comprises: 所述协调服务器根据每个接收到所述写请求的存储服务器发送的所述写请求的执行结果,确定每个接收到所述写请求的存储服务器需要执行的操作信息,所述操作信息指示执行提交操作或回滚操作;The coordination server determines the operation information that each storage server that receives the write request needs to perform according to the execution result of the write request sent by each storage server that receives the write request, and the operation information indicates the execution Submit operation or rollback operation; 所述协调服务器将所述操作信息发送至每个接收到所述写请求的存储服务器。The coordination server sends the operation information to each storage server that receives the write request. 一种事务处理方法,其特征在于,所述方法包括:A transaction processing method, characterized in that the method includes: 存储服务器接收协调服务器发送的写请求,所述写请求包括事务数据分布信息以及一个事务数据信息,所述写请求是所述协调服务器根据接收到的事务生成的至少一个写请求之一,所述存储服务器是所述至少一个写请求包括的事务数据信息对应的原始数据的副本所在的多 个存储服务器之一,所述事务包括至少一个事务数据信息,每个事务数据信息包括一个原始数据的副本在存储服务器上的存储位置信息以及写操作符,事务数据分布信息指示存储所述事务包括的每个事务数据信息对应的原始数据的每个副本的存储服务器;The storage server receives a write request sent by the coordination server. The write request includes transaction data distribution information and one transaction data information. The write request is one of at least one write request generated by the coordination server according to the received transaction. The storage server is one of multiple storage servers where a copy of the original data corresponding to the transaction data information included in the at least one write request is located, the transaction includes at least one transaction data information, and each transaction data information includes a copy of the original data The storage location information and the write operator on the storage server, and the transaction data distribution information indicates the storage server that stores each copy of the original data corresponding to each transaction data information included in the transaction; 所述存储服务器根据所述事务数据信息,对所述写请求包括的事务数据信息对应的原始数据的副本进行操作,并向所述协调服务器发送所述写请求的执行结果;The 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 the 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 and a read operator of the copy of the target data on the storage server; 所述存储服务器根据所述事务数据分布信息,向存储所述事务包括的每个事务数据信息对应的原始数据的每个副本的存储服务器查询所述至少一个写请求的执行结果;According to the transaction data distribution information, the storage server queries a storage server that stores each copy of original data corresponding to each transaction data information included in the transaction for the execution result of the at least one write request; 所述存储服务器根据查询得到的所述至少一个写请求的执行结果,执行提交操作或回滚操作。The storage server executes a commit operation or a rollback operation according to the execution result of the at least one write request obtained by the query. 如权利要求17所述的方法,其特征在于,所述方法还包括:The method of 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, and the operation information indicates a commit operation or a rollback operation; 所述存储服务器将所述操作信息发送至存储所述事务包括的每个事务数据信息对应的原始数据的每个副本的存储服务器。The storage server sends the operation information to a storage server that stores each copy of original data corresponding to each transaction data information included in the transaction. 如权利要求17或18所述的方法,其特征在于,The method of claim 17 or 18, wherein: 所述目标数据的副本在存储服务器上的存储位置和所述原始数据的副本在存储服务器上的存储位置存在重叠,或者所述目标数据的副本和所述原始数据的副本存储于需要保持一致性的数据块中。The storage location of the copy of the target data on the storage server and the storage location of the copy of the original data on the storage server overlap, or the copy of the target data and the copy of the original data are stored in a storage that needs to be consistent In the data block. 一种协调装置,其特征在于,所述协调装置包括:A coordination device, characterized in that the coordination device includes: 通信单元,用于接收业务服务器发送的事务,所述事务包括至少一个事务数据信息,每个事务数据信息包括一个原始数据的副本在存储服务器上的存储位置信息以及写操作符;The communication unit is configured to receive a transaction sent by the service server, 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 processing unit is configured to determine transaction data distribution information according to pre-stored data distribution information, where the data distribution information indicates a storage server that stores each copy of each original data in the transaction processing system, and the transaction data distribution information Indicating a storage server that stores each copy of original data corresponding to each transaction data information included in the transaction; 生成至少一个写请求,每个写请求包括所述事务数据分布信息以及一个事务数据信息;Generating at least one write request, each write request including the transaction data distribution information and one 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 the transaction processing result of the transaction according to the 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 service server. 如权利要求20所述的装置,其特征在于,The device of claim 20, wherein: 所述处理单元具体用于根据每个接收到所述写请求的存储服务器发送的所述写请求的执行结果,确定每个接收到所述写请求的存储服务器需要执行的操作信息,所述操作信息指示执行提交操作或回滚操作;The processing unit is specifically configured to determine the operation information that each storage server that receives the write request needs to perform according to the execution result of the write request sent by each storage server that receives the write request, the operation The information indicates the execution of 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. 一种存储装置,其特征在于,所述装置包括:A storage device, characterized in that the device comprises: 通信单元,用于接收协调服务器发送的写请求,所述写请求包括事务数据分布信息以及一个事务数据信息,所述写请求是所述协调服务器根据接收到的事务生成的至少一个写请求之一,所述存储服务器是所述至少一个写请求包括的事务数据信息对应的原始数据的副本所在的多个存储服务器之一,所述事务包括至少一个事务数据信息,每个事务数据信息包括一个原始数据的副本在存储服务器上的存储位置信息以及写操作符,事务数据分布信息指示存储所述事务包括的每个事务数据信息对应的原始数据的每个副本的存储服务器;The communication unit is configured to receive a write request sent by the coordination server, the write request includes transaction data distribution information and one transaction data information, and the write request is one of at least one write request generated by the coordination server according to the received transaction The storage server is one of a plurality of storage servers where a copy of the original data corresponding to the transaction data information included in the at least one write request is located, the transaction includes at least one transaction data information, and each transaction data information includes an original The storage location information and the write operator of the copy of the data on the storage server, and the transaction data distribution information indicates the storage server that stores each copy of the original data corresponding to each transaction data information included in the transaction; 处理单元,根据所述事务数据信息,对所述写请求包括的事务数据信息对应的原始数据的副本进行操作;A processing unit, based on the transaction data information, operating on 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, where the read request includes the storage location and the reading of the copy of the target data on the storage server. Operator 所述处理单元,还用于根据所述事务数据分布信息,向存储所述事务包括的每个事务数据信息对应的原始数据的每个副本的存储服务器查询所述至少一个写请求的执行结果;The processing unit is further configured to query the execution result of the at least one write request from the storage server storing each copy of the original data corresponding to each transaction data information included in the transaction according to the transaction data distribution information; 根据查询得到的所述至少一个写请求的执行结果,执行提交操作或回滚操作。According to the execution result of the at least one write request obtained by the query, a commit operation or a rollback operation is performed. 如权利要求22所述的装置,其特征在于,The device of 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, where the operation information indicates a commit operation or a rollback operation; 所述通信单元,还用于将所述操作信息发送至存储所述事务包括的每个事务数据信息对应的原始数据的每个副本的存储服务器。The communication unit is further configured to send the operation information to a storage server that stores each copy of the original data corresponding to each transaction data information included in the transaction. 如权利要求22或23所述的装置,其特征在于,所述目标数据的副本在存储服务器上的存储位置和所述原始数据的副本在存储服务器上的存储位置存在重叠,或者所述目标数据的副本和所述原始数据的副本存储于需要保持一致性的数据块中。The device according to claim 22 or 23, 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 target data The copy of and the copy of the original data are stored in a data block that needs to be consistent. 一种协调服务器,其特征在于,包括处理器和存储器;所述存储器用于存储指令,所述处理器用于执行所述指令,当所述处理器执行所述指令时,所述处理器执行如权利要求15或16任一项所述的方法。A coordination server, characterized by comprising a processor and a memory; the memory is used to store instructions, the processor is used to execute the instructions, and when the processor executes the instructions, the processor executes The method of any one of claims 15 or 16. 一种存储服务器,其特征在于,包括处理器和存储器;所述存储器用于存储指令,所述处理器用于执行所述指令,当所述处理器执行所述指令时,所述处理器执行如权利要求17至19任一项所述的方法。A storage server, characterized by comprising a processor and a memory; the memory is used to store instructions, the processor is used to execute the instructions, and when the processor executes the instructions, the processor executes The method of any one of claims 17-19. 一种非瞬态的计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,所述计算机程序被协调服务器执行时实现如权利要求15或16任一项所述的方法。A non-transitory computer-readable storage medium, the computer-readable storage medium stores a computer program, and when the computer program is executed by a coordination server, the method according to any one of claims 15 or 16 is implemented. 一种非瞬态的计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,所述计算机程序被存储服务器执行时实现如权利要求17至19任一项所述的方法。A non-transitory computer-readable storage medium, the computer-readable storage medium stores a computer program, and when the computer program is executed by a storage server, the method according to any one of claims 17 to 19 is implemented.
PCT/CN2019/122287 2019-11-30 2019-11-30 Transaction commit system and method, and related device WO2021103036A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201980102354.8A CN114730314B (en) 2019-11-30 2019-11-30 Transaction submission system, method and related equipment
PCT/CN2019/122287 WO2021103036A1 (en) 2019-11-30 2019-11-30 Transaction commit system and method, and related device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2019/122287 WO2021103036A1 (en) 2019-11-30 2019-11-30 Transaction commit system and method, and related device

Publications (1)

Publication Number Publication Date
WO2021103036A1 true WO2021103036A1 (en) 2021-06-03

Family

ID=76129035

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/122287 WO2021103036A1 (en) 2019-11-30 2019-11-30 Transaction commit system and method, and related device

Country Status (2)

Country Link
CN (1) CN114730314B (en)
WO (1) WO2021103036A1 (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115103011A (en) * 2022-06-24 2022-09-23 北京奥星贝斯科技有限公司 A cross-data center business processing method, device, and device
WO2023030013A1 (en) * 2021-09-01 2023-03-09 华为技术有限公司 Data processing method and apparatus
CN116303328A (en) * 2023-03-28 2023-06-23 厦门大学 Client and Distributed File System
CN116578395A (en) * 2023-07-13 2023-08-11 腾讯科技(深圳)有限公司 Transaction processing method, system, device, electronic equipment and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103677968A (en) * 2012-09-07 2014-03-26 腾讯科技(深圳)有限公司 Transaction processing method, transaction coordinator device and transaction participant device and system
US20160203034A1 (en) * 2007-11-29 2016-07-14 Red Hat, Inc. Commit-one-phase distributed transactions with multiple starting participants
CN105786595A (en) * 2016-02-29 2016-07-20 浪潮通用软件有限公司 Transaction control method achieving two-stage submitting
CN109901914A (en) * 2018-12-28 2019-06-18 阿里巴巴集团控股有限公司 Transaction methods, device and equipment

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8356007B2 (en) * 2010-10-20 2013-01-15 Microsoft Corporation Distributed transaction management for database systems with multiversioning
CN106997305B (en) * 2013-10-29 2020-09-29 华为技术有限公司 A transaction processing method and device
US10474493B2 (en) * 2014-02-28 2019-11-12 Red Hat, Inc. Systems and methods for semi-durable transaction log storage in two-phase commit protocol transaction processing
CN110196760B (en) * 2018-07-12 2023-04-18 腾讯科技(深圳)有限公司 Method and device for realizing consistency of distributed transactions

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160203034A1 (en) * 2007-11-29 2016-07-14 Red Hat, Inc. Commit-one-phase distributed transactions with multiple starting participants
CN103677968A (en) * 2012-09-07 2014-03-26 腾讯科技(深圳)有限公司 Transaction processing method, transaction coordinator device and transaction participant device and system
CN105786595A (en) * 2016-02-29 2016-07-20 浪潮通用软件有限公司 Transaction control method achieving two-stage submitting
CN109901914A (en) * 2018-12-28 2019-06-18 阿里巴巴集团控股有限公司 Transaction methods, device and equipment

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2023030013A1 (en) * 2021-09-01 2023-03-09 华为技术有限公司 Data processing method and apparatus
CN115103011A (en) * 2022-06-24 2022-09-23 北京奥星贝斯科技有限公司 A cross-data center business processing method, device, and device
CN115103011B (en) * 2022-06-24 2024-02-09 北京奥星贝斯科技有限公司 Cross-data center service processing method, device and equipment
CN116303328A (en) * 2023-03-28 2023-06-23 厦门大学 Client and Distributed File System
CN116303328B (en) * 2023-03-28 2025-07-01 厦门大学 Client and distributed file system
CN116578395A (en) * 2023-07-13 2023-08-11 腾讯科技(深圳)有限公司 Transaction processing method, system, device, electronic equipment and storage medium
CN116578395B (en) * 2023-07-13 2024-04-05 腾讯科技(深圳)有限公司 Transaction processing method, system, device, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN114730314B (en) 2025-09-12
CN114730314A (en) 2022-07-08

Similar Documents

Publication Publication Date Title
CN108932338B (en) Data updating method, device, equipment and medium
CN111080449B (en) Cross-chain transaction methods, management nodes, and blockchain networks of blockchain
US9031910B2 (en) System and method for maintaining a cluster setup
WO2021103036A1 (en) Transaction commit system and method, and related device
US11768820B2 (en) Elimination of log file synchronization delay at transaction commit time
CN106843749B (en) Write request processing method, device and equipment
JP6921107B2 (en) Service processing methods, devices, and systems
US8516210B2 (en) Application consistent snapshots of a shared volume
WO2021217986A1 (en) Distributed message transmission method and apparatus, computer device and storage medium
JP6588080B2 (en) Support for detecting memory corruption in distributed shared memory applications
US20120011100A1 (en) Snapshot acquisition processing technique
US10055445B2 (en) Transaction processing method and apparatus
CN110737716B (en) A method and device for writing data
US20200099745A1 (en) Storage segment server covered cache
CN114547108A (en) Data processing method, apparatus, equipment and medium
US20220043776A1 (en) Metadata management program and information processing apparatus
JP2012089049A (en) Computer system and server
US10620872B2 (en) Replicating data in a data storage system
JP2015095015A (en) Data arrangement method, data arrangement program, and information processing system
CN115905114A (en) Metadata batch update method, system, electronic device and readable storage medium
CN116301562A (en) Data storage method, device, computer equipment and storage medium
CN115698955A (en) Fault Tolerance for Transaction Mirroring
CN106020975A (en) Data operation method, device and system
CN120256479B (en) Data processing method and device
CN114817166B (en) Method, device and medium for canceling file operation

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19954638

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19954638

Country of ref document: EP

Kind code of ref document: A1