Data processing method, device, electronic device and computer readable storage medium
By setting a logical identifier on the first node that receives the write request in the distributed storage system and synchronizing it to other nodes, the write sequence is directly determined, which solves the problems of cumbersome and time-prolonged write operations in the existing technology and achieves high efficiency. consistent writing.
Patent Information
- Application Number
- CN202110470297.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-04-28
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2041-04-28
AI Technical Summary
When writing data, existing distributed storage systems need to elect supervisor nodes and negotiate the writing order, resulting in cumbersome operations and long delays.
When the client sends multiple write requests to the storage system, the first node that receives the request sets a logical identifier and synchronizes it to other nodes. The nodes determine the write order based on the logical identifier and directly perform the write operation, avoiding the need for Supervises the node's dependency and negotiation process.
It simplifies the writing operation steps, reduces writing latency, ensures data consistency, and improves storage performance and resource utilization efficiency.
Smart Images

Figure CN113253924B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of electronic equipment, and in particular, relates to a data processing method, device, electronic equipment and computer-readable storage medium. Background Art
[0002] With the rapid development of electronic technology and the increasing requirements for data storage, the application of distributed storage systems in life is becoming more and more extensive. For example, in large enterprises, storage servers can be established in different regions, and a distributed storage system composed of multiple storage servers can be used to read and write data in different regions, and the data in the storage system can be guaranteed to be highly available and highly consistent.
[0003] In existing distributed storage systems, before executing the operation of writing data according to the received write request, the nodes in the storage system often need to elect a supervisor node, and the supervisor node guides other nodes to negotiate the writing order with each other to ensure the consistency of writing of each node. However, this writing method is relatively cumbersome and the delay of data writing is relatively long. Summary of the invention
[0004] In view of this, the present invention provides a data processing method, device, electronic device and computer-readable storage medium, which to a certain extent solve the problems of complicated operations and long delay in data writing.
[0005] According to a first aspect of the present invention, there is provided a data processing method, which is applied to a storage system including a plurality of nodes, and the method comprises:
[0006] In the case of multiple write requests sent by the client to the storage system, the first node in the storage system sets a logical identifier for each of the write requests; the logical identifiers change monotonically in sequence according to the setting order; the first node is the first node in the storage system to receive the multiple write requests;
[0007] The first node synchronizes the target information of each write request to each second node in the storage system; the target information includes the logical identifier; the second node is a node in the storage system other than the first node;
[0008] Each third node in the storage system determines the target execution order between the write requests according to the logical identifier, and writes the to-be-written data corresponding to the write requests according to the target execution order; the third node is any node in the storage system.
[0009] According to a second aspect of the present invention, there is provided a data processing device, which is applied to a storage system including a plurality of nodes, and the device includes:
[0010] A setting module, configured to, when a client sends multiple write requests to the storage system, cause a first node in the storage system to set a logical identifier for each write request; each of the logical identifiers monotonically changes in sequence according to a setting order; and the first node is a first node in the storage system to receive the multiple write requests;
[0011] A synchronization module, used for the first node to synchronize the target information of each write request to each second node in the storage system; the target information includes the logical identifier; the second node is a node in the storage system other than the first node;
[0012] A write module is used for each third node in the storage system to determine the target execution order between each write request according to the logical identifier, and write the to-be-written data corresponding to the write request according to the target execution order; the third node is any node in the storage system.
[0013] In a third aspect, an embodiment of the present invention provides a computer-readable storage medium, characterized in that a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the steps of the data processing method described in the first aspect are implemented.
[0014] In a fourth aspect, the present invention provides an electronic device comprising: a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the data processing method described in the first aspect when executing the program.
[0015] Compared with the prior art, the present invention has the following advantages:
[0016] In the data processing method provided by the embodiment of the present invention, in the case of multiple write requests sent by the client to the storage system, the first node in the storage system sets a logical identifier for each write request, and each logical identifier changes monotonically in sequence according to the setting order. The first node is the first node in the storage system to receive multiple write requests. Then, the first node synchronizes the target information of each write request to each second node in the storage system, and the target information includes the logical identifier. The second node is a node other than the first node in the storage system. Finally, each third node in the storage system determines the target execution order between each write request according to the logical identifier, and writes the data to be written corresponding to the write request according to the target execution order. The third node is any node in the storage system. In the present invention, there is no need to elect a supervisor node between nodes, nor to negotiate the write order with each other. The first node that first receives the request directly sets the logical identifier to specify the execution order of each write request, and controls all nodes in the storage system to perform write operations according to the execution order. While ensuring write consistency, it can simplify the operation steps and reduce write latency. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present invention. Moreover, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:
[0018] Figure 1 is a flow chart of steps of a data processing method provided by an embodiment of the present invention;
[0019] Figure 2 is a schematic diagram of data processing provided by an embodiment of the present invention;
[0020] Figure 3 is a block diagram of a data processing device provided by an embodiment of the present invention;
[0021] Figure 4 It is a structural schematic diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0022] The exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present invention are shown in the accompanying drawings, it should be understood that the present invention can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided in order to enable a more thorough understanding of the present invention and to enable the scope of the present invention to be fully communicated to those skilled in the art.
[0023] The data processing method in the embodiment of the present invention is described in detail below.
[0024] Embodiment 1
[0025] Figure 1 is a flow chart of steps of a data processing method provided by an embodiment of the present invention, such as Figure 1 As shown, the method may include:
[0026] Step 101, when a client sends multiple write requests to the storage system, the first node in the storage system sets a logical identifier for each of the write requests; each of the logical identifiers changes monotonically in the order in which they are set; the first node is the first node in the storage system to receive the multiple write requests.
[0027] The embodiment of the present invention can be applied to a storage system including multiple nodes, and the storage system can be a distributed storage system (Distributed Storage System) or other forms of storage systems, which are not limited by the present invention. The storage system can store data in a dispersed manner on multiple nodes, and the multiple nodes can be respectively set at different geographical locations, so as to receive write requests sent by clients in different regions nearby, thereby avoiding the problem of long information transmission delay caused by the client being far away from the storage system.
[0028] In an embodiment of the present invention, the first node in the storage system sets a logical identifier for each write request. This may be based on the time when the first node receives each write request sent by the client, and the logical identifier is set for each write request in order of the reception time. For example, a logical identifier with a smaller value may be set for a write request with an earlier reception time, and a logical identifier with a larger value may be set for a write request with a later reception time. It should be noted that in an embodiment of the present invention, in order to facilitate determining the order of write requests according to the logical identifier, the logical identifier set for each write request may be monotonically changed, for example, it may be monotonically increasing or monotonically decreasing, and the present invention does not limit this. For example, the storage system receives a write request cmd1 sent by the client at 08:44:22 on April 1, 2021, a write request cmd2 sent by the client at 08:45:20 on April 1, 2021, and a write request cmd3 sent by the client at 08:41:46 on April 1, 2021. A logical identifier is set for each write request in the order of receipt. Since the order of the write requests is cmd3, cmd1, and cmd2 in order of receipt time, the logical identifier can be set to 040101 for cmd3, 040102 for cmd1, and 040103 for cmd2.
[0029] Compared with the storage system in the prior art, different operation permissions are often set for nodes. For example, the nodes can be set as the supervisor node, the slave node and the coordination node respectively. After receiving the write request sent by the client, it is necessary to first select the target master node to execute the write request from the supervisor node, and then the coordination node forwards the write request sent by the client to the target master node. Finally, the target master node synchronizes the write request to the remaining supervisor nodes and all slave nodes and executes the write operation. In the storage system in the embodiment of the present invention, since the dependence on the supervisor node is eliminated, each node in the storage system can provide read and write services equally, and by setting a logical identifier for the write request, other nodes only need to perform the write operation according to the logical identifier set by the first node, thereby greatly improving the storage performance of the storage system and improving the resource utilization efficiency.
[0030] Step 102: The first node synchronizes the target information of each write request to each second node in the storage system; the target information includes the logical identifier; the second node is a node in the storage system other than the first node.
[0031] In the embodiment of the present invention, the first node synchronizes the target information of each write request to each second node in the storage system, which may be that the first node sends the logical identifier set for each write request to each second node in the storage system, or the first node sends the logical identifier set for each write request and each write request itself to each second node.
[0032] In an embodiment of the present invention, since the first node is the first node to receive multiple write requests, when any node in the storage system receives a write request sent by the client, it can act as the first node to synchronously set a logical identifier to the second node in the storage system except the first node, so that the write content of each second node is consistent with the write content of the first node.
[0033] Step 103, each third node in the storage system determines the target execution order between the write requests according to the logical identifier, and writes the to-be-written data corresponding to the write requests according to the target execution order; the third node is any node in the storage system.
[0034] In the embodiment of the present invention, since the logical identifier of each write request received by any third node in the storage system is consistent, the target execution order of each write request determined by each third node based on the logical identifier is also consistent. Furthermore, each third node writes the data to be written corresponding to the write request in sequence according to the target execution order, which can ensure that the content written by each node in the storage system is consistent, thereby ensuring the consistency of data storage in the storage system and ensuring the validity of the stored data.
[0035] In summary, in the data processing method provided by the embodiment of the present invention, in the case of multiple write requests sent by the client to the storage system, the first node in the storage system sets a logical identifier for each write request, and each logical identifier changes monotonically in sequence according to the setting order. The first node is the first node in the storage system to receive multiple write requests. Then, the first node synchronizes the target information of each write request to each second node in the storage system, and the target information includes the logical identifier. The second node is a node other than the first node in the storage system. Finally, each third node in the storage system determines the target execution order between each write request according to the logical identifier, and writes the data to be written corresponding to the write request according to the target execution order. The third node is any node in the storage system. In the present invention, there is no need to elect a supervisor node between nodes, nor to negotiate the write order with each other. The first node that first receives the request directly sets the logical identifier to specify the execution order of each write request, and controls all nodes in the storage system to perform write operations according to the execution order. While ensuring write consistency, it can simplify the operation steps and reduce write latency.
[0036] Embodiment 2
[0037] Optionally, in an implementation manner, the target information in an embodiment of the present invention includes a target dependency relationship, which can be used to characterize whether there is a dependency relationship between write requests. For example, data A carried by write request 1 is generated based on data B carried by write request 2. Therefore, it can be obtained that the target dependency relationship is that write request 1 depends on write request 2.
[0038] Accordingly, before the step of synchronizing the target information of each write request to each second node in the storage system at the first node in the embodiment of the present invention, the following sub-steps may be performed:
[0039] Sub-step (1): the first node counts the requests on which each of the write requests depends to generate a first dependency relationship, and obtains a second dependency relationship determined by each fourth node in the target node cluster; the second dependency relationship is determined by the fourth node by counting the requests on which the local request depends; the fourth node in the target node cluster is selected by the first node, and the local request is a write request received by the fourth node.
[0040] In an embodiment of the present invention, the first node generates a first dependency relationship by counting the requests on which each write request depends. The first node may detect whether the data to be written carried by the write request has a dependency relationship with the data carried by other requests received on the first node. If there is a dependency relationship, it can be determined that the other request is the request on which the write request depends, and the generated dependency relationship is used as the first dependency relationship. For example, when data A is generated dependent on data B, it can be detected that there is a dependency relationship between write request 1 corresponding to data A and write request 2 corresponding to data B, that is, write request 1 depends on write request 2, and the generated first dependency relationship can be "write request depends on request 2".
[0041] In an embodiment of the present invention, the second dependency determined by each fourth node in the target node cluster is obtained, wherein the second dependency may be the request on which the local request on the fourth node depends, or may be the union of the request on which the local request on the fourth node depends and the request on which each write request on the first node depends. Specifically, the fourth node in the target node cluster may first count the requests on which each write request depends locally to obtain the second dependency, and then return the second dependency to the first node; or the fourth node in the target node cluster may count the requests on which each write request depends locally to obtain the dependency, and then take the union of the dependency and the first dependency sent by the first node to obtain the second dependency, and return the second dependency to the first node. The local request on the fourth node may be the write request received by the fourth node. It should be noted that when the requests received on the fourth node are consistent with the requests received on the first node, the second dependency may be consistent with the first dependency; when the requests received on the fourth node are inconsistent with the requests received on the first node, for example, the fourth node fails and does not receive the request, the second dependency may be inconsistent with the first dependency.
[0042] It should be noted that the target node cluster may be pre-divided according to the first node. Specifically, it may be based on the geographical location of the first node, and each node located near the geographical location may be divided into the target node cluster corresponding to the first node. Alternatively, each node may be directly divided in the storage system, and the node cluster where the first node is located may be used as the target node cluster. The target node cluster may be divided before receiving the request sent by the client, that is, it may be divided before determining the first node. The storage system may pre-set a corresponding node cluster for each node, so that the dependency relationship can be determined directly based on the divided node clusters later, thereby improving the efficiency of data statistics.
[0043] In the embodiment of the present invention, the storage system is often set with a fault tolerance number, that is, during the operation of the storage system, if a node with a number less than the fault tolerance number has a problem, the storage system can recover the operation through its own fault recovery program, but if a node with a number greater than the fault tolerance number has a problem, it may be difficult for the storage system to recover the operation through its own fault recovery program, and manual troubleshooting and recovery are required. Therefore, when selecting a target node cluster, you can select a node cluster consisting of The node cluster consists of nodes, where n is the total number of nodes in the storage system and f is the number of fault-tolerant nodes in the storage system. This is because when the storage system executes two independent cmd1 and cmd2 in parallel, and when cmd1 and cmd2 have a dependency on a certain node, then according to the majority principle, the failure is solved by executing two commands at any node. A node that obtains a set of dependent nodes must be able to observe this dependency relationship Further, when the first node fails, in the case where f nodes are down, including the first node, since the first node has sent the first dependency to On the second node, you can The target dependency of the current write request is restored by f nodes. In the case that f nodes are down, but not including the first node, the target dependency can be restored directly through the first node.
[0044] Sub-step (2): The first node determines the target dependency based on the first dependency and the second dependency.
[0045] In the embodiment of the present invention, the first dependency relationship and the second dependency relationship may be compared according to a preset condition, and the dependency relationship that meets the preset condition may be used as the target dependency relationship. For example, the preset condition may be to select the dependency relationship that contains the most content, and if the second dependency relationship contains the most content, the second dependency relationship may be determined as the target dependency relationship. The preset condition may be to select the dependency relationship that appears the most times, and if the first dependency relationship contains the dependency relationship that appears the most times, the first dependency relationship may be determined as the target dependency relationship.
[0046] For example, Figure 2 is a schematic diagram of data processing provided by an embodiment of the present invention, such as Figure 2As shown, the storage system includes three nodes, node A, node B, and node C. There are two clients, client 1 and client 2, that simultaneously initiate requests to the storage system. Client 1 sends a write request x to the storage system, and client 2 sends a write request y to the storage system. However, the order in which requests arrive at different nodes is not the same. Node A receives write request X first and then write request Y, node B receives write request X first and then write request Y, and node C receives write request Y first and then write request X. When two concurrent requests initiated by different clients arrive at each node in the order of {x→y} and {y→x}, the possible results of the overall sorting on the three nodes are: {x→y}, {y→x}, {x→y}∩{y→x}. For {x→y} and {y→x}, since the order in which the two requests arrive at all nodes is consistent, a consistent submission order will be formed in the storage system anyway. For the scenario of {x→y}∩{y→x}, that is, write request X arrives before write request Y on some nodes, and write request Y arrives before write request X on some nodes, the relationship {x→y}∩{y→x} is constructed by using a directed acyclic graph (DAG). Since x and y are bidirectional relationships, they do not meet the requirements of a directed acyclic graph by default. Therefore, when requests x and y reach the first node, a logical timestamp {replica_id:sequence_number} is generated for it, where replica_id is the unique label for the write request in the storage system, and sequence_number can increase monotonically with the number of write requests received on the node. A definite order relationship can be established for the two requests x and y through the logical clock. Since write request x and write request y are concurrent requests initiated by different clients, a consistent order relationship needs to be formed on all nodes. Therefore, in the scenario where {x→y}∩{y→x} occurs, they can be classified as {x→y} or {y→x} through comparison of logical clocks, so that a completely consistent order can be achieved on all nodes in the end, thereby satisfying the strong consistency constraint on write content in the storage system.
[0047] Optionally, in the embodiment of the present invention, the step of the first node determining the target dependency relationship according to the first dependency relationship and the second dependency relationship may include the following sub-steps:
[0048] Sub-step (2A): determining the first dependency and the second dependency as candidate dependencies.
[0049] For example, the first dependency is that request 11 depends on request 09, request 15 depends on request 14, and request 20 depends on request 15; the second dependency is that request 15 depends on request 14, and request 20 depends on request 15. Then the alternative dependency can be that request 11 depends on request 09, request 15 depends on request 14, request 20 depends on request 15, request 15 depends on request 14, and request 20 depends on request 15.
[0050] Sub-step (2B): Selecting the dependency with the highest occurrence frequency from the candidate dependencies as the target dependency.
[0051] For example, if in the alternative dependency relationships, request 15 depends on request 14 and request 20 depends on request 15 and appears the most times, then request 15 depends on request 14 and request 20 depends on request 15 can be used as the target dependency relationships.
[0052] In the embodiment of the present invention, since the dependency with the highest frequency of occurrence often represents that the dependency exists on most nodes in the target node cluster, it means that the dependency is true on most nodes. Therefore, selecting the dependency with the highest frequency of occurrence as the target dependency can ensure to a certain extent that the target dependency represents the dependency of each write request on each node in the target node cluster, so as to facilitate subsequent operations based on the target dependency, thereby improving the effectiveness of data processing to a certain extent.
[0053] Optionally, in the embodiment of the present invention, each third node in the storage system determines the target execution order between each write request according to the logical identifier, which may include the following sub-steps:
[0054] Sub-step (3): The third node determines each initial execution order according to the order indicated by the logical identifier of each write request.
[0055] In an embodiment of the present invention, it is assumed that each write request includes request 1, request 2, request 3, and request 4, wherein the logical identifier of request 1 is 030503, the logical identifier of request 2 is 030502, the logical identifier of request 3 is 030504, and the logical identifier of request 4 is 030501. Therefore, the initial execution order of each write request can be determined, which is request 4, request 2, request 1, and request 3 from first to last.
[0056] Sub-step (4): Based on the target dependency, the initial execution order is adjusted so that the adjusted initial execution order is compatible with the target dependency.
[0057] In an embodiment of the present invention, it is assumed that the initial execution order is request 4, request 2, request 1, and request 3 from first to last, and the target dependency relationship indicates that request 1 depends on request 3, that is, the data carried by request 1 is generated based on the data carried by request 3. Therefore, the order of request 3 should be before request 1. Therefore, the initial execution order can be adjusted, and the adjusted initial execution order is request 4, request 2, request 3, and request 1.
[0058] In the embodiment of the present invention, when the data carried by one request is related to the data carried by another request, for example, the data may be generated based on the data carried by another request, or the data may be generated based on the data prerequisite carried by another request, etc., it is possible to obtain a dependency relationship between the two requests. Therefore, when a target dependency relationship occurs, it is necessary to ensure that in the process of writing data, the dependent request is written first, and then the dependent request is written, so that the logic of writing data can be most consistent with the actual situation, and the problem of disordered writing content due to delays in information transmission can be eliminated, thereby further improving the effectiveness of writing data in the storage system.
[0059] Sub-step (5): taking the adjusted initial execution order as the target execution order.
[0060] In the embodiment of the present invention, if the adjusted initial execution order is request 4, request 2, request 3, request 1, the target execution order can be obtained as request 4, request 2, request 3, request 1.
[0061] In an embodiment of the present invention, the initial execution order obtained by the logical identifier is adjusted based on the target dependency, so that the obtained target execution order can not only conform to the order in which the first node receives the requests, but also conform to the dependency between the requests, so that the target execution order can be consistent with the actual data writing order to a certain extent, avoiding the problem of disordered writing order due to delays in information transmission, and further improving the accuracy of writing in the storage system.
[0062] Embodiment 3
[0063] Optionally, in another implementation, in an embodiment of the present invention, before the step of writing the data to be written corresponding to the write request in the target execution order, the following sub-steps may be performed:
[0064] Sub-step (6): the third node adjusts the state of the write request to a preset state.
[0065] In the embodiment of the present invention, the preset state may be a Commit state, and adjusting the state of the write request to the preset state may be to modify the state recorded in the tag associated with the write request to the Commit state.
[0066] In the embodiment of the present invention, the above-mentioned writing of the to-be-written data corresponding to the write request in the target execution order may include the following sub-steps:
[0067] Sub-step (7): when the state of the write request is a preset state, the third node executes the operation of writing the to-be-written data corresponding to the write request according to the target execution order.
[0068] In an embodiment of the present invention, by first adjusting the state of a write request and then executing the operation of writing the to-be-written data corresponding to the write request, it is possible to facilitate a later review of the processing progress of each request by quickly knowing the processing status of the request directly based on the state corresponding to the request, and it is also possible to know what operations need to be performed based on the state of the request, thereby improving the efficiency of checking the request processing status in the storage system and avoiding the situation where requests are missed.
[0069] In an embodiment of the present invention, the process from when the storage system receives a write request from a client to when the write request is written into the storage system can be divided into four stages, namely, a start state, a collect state, a commit state, and an execute state, and these four states can be set to be executed in sequence, that is, the state of the request can be adjusted to the next state only when the request is in the previous state. For example, if the state of the request is a collect state, the state of the request can be adjusted to a commit state, but cannot be adjusted to a start state or an execute state. Furthermore, a recover state can be set for the storage system to handle the recovery process when a write operation fails in the storage system.
[0070] Specifically, after the node receives each write request, the status of the write request can be modified to the Start status; when the first node obtains the second dependency determined by each fourth node in the target node cluster, the status of the write request can be modified to the Collect status; when the first node synchronizes the target information of each write request to each second node in the storage system and writes the data to be written corresponding to the write request in the target execution order, the status of the write request can be modified to the Commit status; before each third node in the storage system writes the data to be written corresponding to the write request in the target execution order.
[0071] In the embodiment of the present invention, in the first step, when a write request cmd from a client reaches any node in the storage system, the node can be used as the first node, and the first node generates a logical identifier for each cmd, and the logical identifier can be cmd_id = {replica_id, sequence_number}, where replica_id can be the number of the write request, which is unique in the storage system, and sequence_number can increase monotonically with the number of write requests received on the node. Calculate the first local dependency of the first node, select a nodes, and mark the cmd as the COLLECT state; and send an "MCollect" message to all fourth nodes in the target node cluster, where the "MCollect" message includes: cmd_id, cmd, the first dependency, and the target node cluster.
[0072] In the second step, after each fourth node in the target node cluster receives the "MCollect" message, it calculates the local second dependency of the fourth node, and unifies the first dependency and the second dependency to obtain "Dep", and records "Dep" locally on the fourth node; the fourth node marks the status of the write request cmd as COLLECT status; and replies to the first node with an "MCollectAck" message, which includes: cmd_id, "Dep", and the target node cluster.
[0073] In the third step, the first node takes the union of each "Dep" in the "MCollectAck" message replied by each fourth node in the target node cluster to obtain the target dependency, and sends an "MCommit" message to each fourth node in the target node cluster. The "MCommit" message contains: cmd_id, cmd, and target dependency.
[0074] In the fourth step, after each fourth node in the target node cluster receives the "MCommit" message, if the cmd status on the fourth node is not in the COMMIT status or the EXECUTE status, the fourth node can locally record: cmd and target dependency, and modify the status corresponding to the write request cmd to the COMMIT status.
[0075] Embodiment 4
[0076] Optionally, in another implementation, the data processing method of the embodiment of the present invention may further perform the following steps:
[0077] Step A: When the first node fails, the target recovery node determines a member node in the target node cluster.
[0078] In an embodiment of the present invention, since the target node cluster determined according to the first node is often only recorded locally on the first node and other nodes are unaware of it, when the first node fails, the step of the first node obtaining the second dependency determined by each fourth node in the target node cluster and the step of the first node determining the target dependency according to the first dependency and the second dependency may not be completed, that is, the first node may not obtain the second dependency, or the first node may not determine the target dependency, or the first node may determine the target dependency but fail to send it to each second node in the storage system, or only some of the second nodes receive the target dependency sent by the first node while the other part fails to receive it, and so on. Therefore, it is necessary to first determine the member nodes included in the target node cluster before a fault recovery procedure can be performed for the process in which the first node fails and the write operation cannot be continued, that is, the nodes in the target node cluster that have not completed the write operation are recovered and continue to perform the write operation.
[0079] In the embodiment of the present invention, the target recovery node is a node selected from the second node.
[0080] Step B: The target recovery node obtains the second dependency relationship determined by each of the member nodes.
[0081] In an embodiment of the present invention, the target recovery node may send a message to all nodes in the storage system, for example, sending an "MRecover" message, and each node determines whether the node has received the information sent by the first node that has failed based on the message, and returns the information sent by the first node to the target recovery node. The target recovery node can determine the node that returns the information sent by the first node as a member node in the target node cluster.
[0082] In the embodiment of the present invention, when a member node only receives the first dependency but does not receive the target dependency, or when a member node does not receive the first dependency, the member node can count the requests that each write request depends on the member node to obtain the second dependency, and send the second dependency to the target recovery node. Accordingly, the target recovery node can receive the second dependency. Further, when a member node has received the target dependency, the member node can send the target dependency to the target recovery node. Accordingly, the target recovery node can directly obtain the target dependency.
[0083] Step C: The target recovery node redetermines the target dependency relationship according to the second dependency relationship.
[0084] In an embodiment of the present invention, when the first member node receives the target dependency, but the second member node may only receive the first dependency, or has not received the information from the first node, the target recovery node can redetermine the target dependency by taking the union of the second dependency of each second member node and the target dependency.
[0085] In the embodiment of the present invention, when all member nodes in the target node cluster have received the target dependency, the target recovery node can directly determine the target dependency. When all member nodes in the target node cluster have not received the information sent by the first node, the target recovery node can be used as a new first node and the operations of step 101 to step 103 can be re-executed.
[0086] In an embodiment of the present invention, if the first node that has a fault is recovered and added to the target node cluster as the fourth node, since the target node cluster contains n-f nodes, when the target dependency is recalculated in the target node cluster, the essence of the target dependency calculated by the original first node in the target node cluster under the normal process is the same, that is, the target dependency calculated in the fault recovery process is consistent with the target dependency calculated in the normal process. If the first node that has a fault is not added to the target node cluster after recovery, the write request on the first node that has a fault may already be in the COMMIT state. Therefore, in order to ensure that the target dependency calculated in the fault recovery process is consistent with the target dependency calculated in the normal process, it is necessary to take the union of the target dependency calculated in the fault recovery process and the target dependency calculated in the target node cluster except the first node.
[0087] In the embodiment of the present invention, in actual business scenarios, three nodes are currently set in the strongly consistent storage system. Compared with the strong synchronous replication algorithm based on the strong supervisor node in the prior art, the selection of the supervisor node is likely to become a bottleneck. The present invention eliminates the dependence on the supervisor node, and all nodes can provide read and write services equally, thereby greatly improving the storage performance of the storage cluster and improving the efficiency of resource utilization.
[0088] Furthermore, in a data sharding scheme based on "Paxos Group", if the user's read / write request and the corresponding "Paxos Group" supervisor node are not in the same area, the read / write request also needs to be routed by the coordination node to the area where the supervisor node of the "Paxos Group" is located, resulting in at least 2 round-trip delays required to complete a strongly consistent read / write request when performing a write operation. However, the present invention can consume only 1 round-trip delay in any case to complete a strongly consistent read / write request, thereby improving the read / write service capability of the entire storage system, effectively utilizing resources, and providing smoother service capabilities to the business, so that all read / write requests can complete strongly consistent read / write services in 3 nodes with only one round-trip delay, which not only improves the query capability, but also significantly reduces the delay of business access. Completing strongly consistent storage submission with one round-trip delay can improve the processing capability of the storage system by more than 50% to a certain extent, regardless of the business load, and reduce the access delay by about 40%. Moreover, in typical business scenarios, when carrying the same business traffic, resource utilization can be reduced to about 1 / 2, thereby saving costs.
[0089] In the embodiments of the present invention, compared with the existing solutions for optimizing the read and write delays of the strongly consistent system, the algorithms and processes are extremely complex and the engineering implementation is difficult. The present invention not only optimizes the read and write delays of the strongly consistent system, but also simplifies and clarifies the operation steps, thereby reducing the workload of operation and maintenance to a certain extent.
[0090] Embodiment 5
[0091] Figure 3 is a block diagram of a data processing device provided by an embodiment of the present invention, such as Figure 3 As shown, the device 30 may include:
[0092] A setting module 301 is used for, when a client sends multiple write requests to the storage system, the first node in the storage system sets a logical identifier for each of the write requests; the logical identifiers change monotonically in sequence according to the setting order; the first node is the first node in the storage system to receive the multiple write requests;
[0093] Synchronization module 302, used for the first node to synchronize the target information of each write request to each second node in the storage system; the target information includes the logical identifier; the second node is a node in the storage system other than the first node;
[0094] The write module 303 is used for each third node in the storage system to determine the target execution order between each write request according to the logical identifier, and write the to-be-written data corresponding to the write request according to the target execution order; the third node is any node in the storage system.
[0095] Optionally, the target information includes target dependencies;
[0096] The device 30 further includes:
[0097] A first acquisition module is used for the first node to count the requests on which each of the write requests depends to generate a first dependency relationship, and to obtain a second dependency relationship determined by each fourth node in the target node cluster; the second dependency relationship is determined by the fourth node by counting the requests on which the local request depends; the fourth node in the target node cluster is selected by the first node, and the local request is a write request received by the fourth node;
[0098] The first determination module is used for the first node to determine the target dependency relationship according to the first dependency relationship and the second dependency relationship.
[0099] Optionally, the first determining module is further used to:
[0100] Determine the first dependency relationship and the second dependency relationship as candidate dependency relationships;
[0101] A dependency relationship with the highest occurrence frequency is selected from the candidate dependency relationships to serve as the target dependency relationship.
[0102] Optionally, the writing module 303 is further used for:
[0103] The third node determines each initial execution order according to the order indicated by the logical identifier of each write request;
[0104] Based on the target dependency, adjusting the initial execution order so that the adjusted initial execution order is compatible with the target dependency;
[0105] The adjusted initial execution order is used as the target execution order.
[0106] Optionally, the device 30 further includes:
[0107] An adjustment module, configured for the third node to adjust the state of the write request to a preset state;
[0108] The writing module 303 is further used for:
[0109] The third node executes the operation of writing the to-be-written data corresponding to the write request according to the target execution order when the state of the write request is a preset state.
[0110] Optionally, the device 30 further includes:
[0111] A second determination module, configured to determine, by a target recovery node, a member node in the target node cluster when a failure occurs in the first node;
[0112] A second acquisition module, configured for the target recovery node to acquire the second dependency relationship determined by each of the member nodes;
[0113] The third determination module is used for the target recovery node to redetermine the target dependency relationship according to the second dependency relationship.
[0114] Optionally, the target recovery node is a node selected from the second nodes.
[0115] The data processing device provided in the embodiment of the present invention has a functional module corresponding to executing the data processing method, and can execute the data processing method provided in any one of the embodiments 1 to 4 of the present invention, and can achieve the same beneficial effects.
[0116] In another embodiment of the present invention, an electronic device is provided. The electronic device may include: a processor, a memory, and a computer program stored in the memory and executable on the processor. When the processor executes the program, each process of the above data processing method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it is not described here. For example, Figure 4 As shown, the electronic device may specifically include: a processor 401, a storage device 402, a display screen 403 with a touch function, an input device 404, an output device 405, and a communication device 406. The number of processors 401 in the electronic device may be one or more. Figure 4 A processor 401 is taken as an example. The processor 401, storage device 402, display screen 403, input device 404, output device 405 and communication device 406 of the electronic device can be connected via a bus or other means.
[0117] In another embodiment of the present invention, a computer-readable storage medium is provided. The computer-readable storage medium stores instructions. When the instructions are executed on a computer, the computer executes the data processing method described in any one of the above embodiments.
[0118] In another embodiment of the present invention, a computer program product including instructions is provided. When the computer program product is run on a computer, the computer executes the data processing method described in any one of the above embodiments.
[0119] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0120] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0121] The above description is only a preferred embodiment of the present invention and is not intended to limit the protection scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention are included in the protection scope of the present invention.
Claims
1. A data processing method, characterized in that: Applied to a storage system including multiple nodes, the method includes: In the case of multiple write requests sent by the client to the storage system, the first node in the storage system sets a logical identifier for each of the write requests; the logical identifiers change monotonically in sequence according to the setting order; the first node is the first node in the storage system to receive one of the multiple write requests; The first node synchronizes the target information of each write request to each second node in the storage system; the target information includes the logical identifier; the second node is a node in the storage system other than the first node; wherein, when any node in the storage system receives the write request sent by the client, it acts as the first node and synchronously sets the logical identifier to the second node in the storage system other than the first node; Each third node in the storage system determines the target execution order between each write request according to the logical identifier, and writes the to-be-written data corresponding to the write request according to the target execution order; the third node is any node in the storage system.
2. The method according to claim 1, characterized in that The target information includes target dependencies; Before the first node synchronizes the target information of each write request to each second node in the storage system, the method further includes: The first node counts the requests on which each of the write requests depends to generate a first dependency relationship, and obtains a second dependency relationship determined by each fourth node in the target node cluster; the second dependency relationship is determined by the fourth node by counting the requests on which the local request depends; the fourth node in the target node cluster is selected by the first node, and the local request is a write request received by the fourth node; The first node determines the target dependency relationship according to the first dependency relationship and the second dependency relationship.
3. The method according to claim 2, characterized in that The first node determines the target dependency relationship according to the first dependency relationship and the second dependency relationship, including: Determine the first dependency relationship and the second dependency relationship as candidate dependency relationships; A dependency relationship with the highest occurrence frequency is selected from the candidate dependency relationships to serve as the target dependency relationship.
4. The method according to claim 2, characterized in that Each third node in the storage system determines a target execution order between each write request according to the logical identifier, including: The third node determines each initial execution order according to the order indicated by the logical identifier of each write request; Based on the target dependency, adjusting the initial execution order so that the adjusted initial execution order is compatible with the target dependency; The adjusted initial execution order is used as the target execution order.
5. The method according to claim 1, characterized in that Before writing the to-be-written data corresponding to the write request in the target execution order, the method further includes: The third node adjusts the state of the write request to a preset state; Writing the to-be-written data corresponding to the write request according to the target execution order includes: The third node executes the operation of writing the to-be-written data corresponding to the write request according to the target execution order when the state of the write request is a preset state.
6. The method according to any one of claims 2 to 4, characterized in that: The method further comprises: In the event that the first node fails, the target recovery node determines a member node in the target node cluster; The target recovery node obtains the second dependency relationship determined by each of the member nodes; The target recovery node redetermines the target dependency relationship according to the second dependency relationship.
7. The method according to claim 6, characterized in that The target recovery node is a node selected from the second nodes.
8. A data processing device, characterized in that: Applied to a storage system including multiple nodes, the device includes: A setting module, used for, in the case of multiple write requests sent by the client to the storage system, the first node in the storage system sets a logical identifier for each of the write requests; the logical identifiers change monotonically in sequence according to the setting order; the first node is the first node in the storage system to receive one of the multiple write requests; A synchronization module, used for the first node to synchronize the target information of each write request to each second node in the storage system; the target information includes the logical identifier; the second node is a node in the storage system other than the first node; wherein, when any node in the storage system receives the write request sent by the client, it acts as the first node and synchronously sets the logical identifier to the second node in the storage system other than the first node; A write module is used for each third node in the storage system to determine the target execution order between each write request according to the logical identifier, and write the to-be-written data corresponding to the write request according to the target execution order; the third node is any node in the storage system.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the data processing method according to any one of claims 1 to 7 are implemented.
10. An electronic device, characterized in that: include: A processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the data processing method according to any one of claims 1 to 7 when executing the program.
Citation Information
Patent Citations
Writing request response method and apparatus
CN106557282A
Data stream processing method and related equipment
CN111090464A
