Read-write request sending method and device, storage medium and electronic equipment

By upgrading the distributed storage cluster online and forwarding read and write requests, the problems of node removal and business suspension during cluster upgrades are solved, improving the upgrade effect and ensuring data consistency.

CN119668655APending Publication Date: 2025-03-21INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411845620.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-13
Publication Date
2025-03-21

AI Technical Summary

Technical Problem

In the process of upgrading distributed storage clusters, the nodes in the cluster need to be removed or the cluster services are suspended, resulting in poor upgrade results.

Method used

Upgrading the distributed cluster online is determined to determine the corresponding node of the received read and write request in the cluster, and when the node is in the upgrade state, the read and write request is forwarded to other nodes that are not in the upgrade state, so that after the node exits the upgrade state, the write request is obtained from the forwarding node and written to the original node.

Benefits of technology

It realizes that when the distributed storage cluster is upgraded online, node removal and business suspension are avoided, upgrade effect is improved, and data consistency and cluster stability are ensured.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119668655A_ABST
    Figure CN119668655A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a read-write request sending method and device, a storage medium and electronic device.The read-write request sending method comprises the steps that under the condition that a distributed cluster is upgraded in an online mode, a first node corresponding to a received read-write request in the distributed cluster is determined, the first node is a node requested by the read-write request to execute a read operation or a write operation; and under the condition that the first nodes comprise a second node in an upgrade state, sending the read-write request to a third node which is not in the upgrade state in the first nodes, so that the second node is in the upgrade state after exiting from the upgrade state. And obtaining a first data object requested to be written into the first node by a write request in the read-write request from the third node. The problem that the upgrading effect is poor due to the fact that nodes in the cluster need to be removed or cluster services need to be paused when the distributed storage cluster is upgraded in the related technology is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present application relate to the field of distributed cluster technology, and in particular, to a method and device for sending a read / write request, a storage medium, and an electronic device. Background Art

[0002] Traditional storage systems store all data on a single storage server, which makes the storage server a bottleneck of system performance and cannot cope with large-scale storage needs. Distributed storage systems, on the other hand, use a decentralized storage strategy to distribute data on multiple independent devices. Through a scalable system architecture, multiple storage servers share the storage load. This system not only improves system reliability, availability, and access efficiency, but also supports easy scalability.

[0003] In the conventional distributed storage system upgrade process, node offline upgrade or separation upgrade methods are usually used. Offline upgrade requires suspending the services of all nodes in the distributed cluster (i.e., distributed storage system), upgrading the nodes separately, and restarting the cluster (i.e., distributed cluster) after the upgrade of each node is completed. Separation upgrade first temporarily removes a node from the cluster and then performs a software update on it. After the update is complete, the node is rejoined to the cluster, and then other nodes are processed one by one until the upgrade of all nodes is completed.

[0004] Both offline upgrades and separate upgrades have significant limitations. During an offline upgrade, the cluster is out of service, which is unacceptable for clusters with important services. Separate upgrades require that the nodes to be upgraded be deleted from the cluster first and then added back after the upgrade is complete. During this period, the deletion and re-addition of nodes to be upgraded will inevitably lead to a large amount of data migration, which not only consumes space and time, but also increases business pressure and affects storage service performance.

[0005] In the related art, upgrading a distributed storage cluster requires removing nodes in the cluster or suspending cluster services, resulting in a poor upgrading effect, which has not yet been effectively solved. Summary of the invention

[0006] The embodiments of the present application provide a method and device for sending a read / write request, a storage medium, and an electronic device, so as to at least solve the problem in the related art that upgrading a distributed storage cluster requires removing nodes in the cluster or suspending cluster services, resulting in poor upgrading effect.

[0007] According to one embodiment of the present application, a method for sending a read / write request is provided, comprising: in the case of upgrading a distributed cluster in an online manner, determining a first node in the distributed cluster corresponding to a received read / write request, wherein the first node is a node requested by the read / write request to perform a read operation or a write operation; in the case where the first node includes a second node in an upgraded state, sending the read / write request to a third node in the first node that is not in the upgraded state, so that the second node obtains, from the third node, a first data object requested by the write request in the read / write request to be written to the first node after exiting the upgraded state.

[0008] In an exemplary embodiment, before determining that the received read / write request corresponds to the first node in the distributed cluster, the method also includes: detecting the cluster state of the distributed cluster; and when the cluster state meets the upgrade conditions, upgrading the multiple nodes in the distributed cluster in sequence through the online method according to a preset upgrade order.

[0009] In an exemplary embodiment, before sending the read / write request to a third node in the first node that is not in the upgraded state, the method further includes: receiving an upgrade event broadcast by a second node, wherein the upgrade event is an event broadcast to the distributed cluster after the second node enters the upgraded state; and determining that the second node is in the upgraded state through the upgrade event.

[0010] In an exemplary embodiment, determining the first node corresponding to the received read / write request in the distributed cluster includes: determining the second data object requested by the read / write request to perform a read operation or a write operation, wherein the second data object includes at least one of the following: a third data object requested by the read / write request to perform a read operation, and the first data object; determining the fourth node where the first object copy of the second data object in the distributed cluster is located; and determining the fourth node as the first node.

[0011] In an exemplary embodiment, the read-write request is sent to a third node in the first node that is not in the upgraded state, so that the second node obtains the first data object requested to be written into the first node by the write request in the read-write request from the third node after exiting the upgraded state, including: determining the request type of the read-write request; if the request type indicates that the read-write request is a read request, stop forwarding the read request to the second node; recalculate the fifth node where the copy of the second object requested to be read by the read request is located; if the fifth node is not in the upgraded state, use the fifth node as the third node and send the read request to the fifth node; if the request type indicates that the read-write request is a write request, stop forwarding the write request to the second node; forward the write request to the third node in the first node that is not in the upgraded state, and record the write operation corresponding to the write request in the preset list in the third node, so that after exiting the upgraded state, the second node obtains the first data object requested to be written into the first node by the write request in the read-write request from the third node through the preset list.

[0012] In an exemplary embodiment, recording the write operation corresponding to the write request in a preset list in the third node includes: determining the preset list pre-set in the third node; marking the write operation as a write operation during the upgrade of the second node in the preset list; and writing the change record and corresponding version of the first data object into the preset list.

[0013] In an exemplary embodiment, after sending the read / write request to a third node in the first node that is not in the upgrade state, the method further includes: when the second node exits the upgrade state, instructing the second node to read a preset list in a sixth node in the distributed cluster, wherein the sixth node is any target node in the distributed cluster except the second node, and at least one third object copy in the target node is the same as the fourth object copy in the second node; the preset list in the sixth node records the write operations performed on the at least one third object copy when the second node is in the upgrade state, and the sixth node includes: the third node; instructing the second node to obtain the fourth data object requested to be written to the second node by all read / write requests during the period when the second node is in the upgrade state through the preset list in the sixth node, wherein the fourth data object includes: the first data object.

[0014] According to another embodiment of the present application, a device for sending a read / write request is provided, comprising: a determination module for determining, when a distributed cluster is upgraded online, a first node corresponding to a received read / write request in the distributed cluster, wherein the first node is a node requested by the read / write request to perform a read operation or a write operation; a sending module for, when the first node includes a second node in an upgraded state, sending the read / write request to a third node in the first node that is not in the upgraded state, so that the second node obtains, from the third node, a first data object requested by the write request in the read / write request to be written into the first node after exiting the upgraded state.

[0015] According to another embodiment of the present application, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when run.

[0016] According to another embodiment of the present application, an electronic device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.

[0017] According to another embodiment of the present application, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, the steps in any of the above method embodiments are implemented.

[0018] Through the present application, in the case of upgrading a distributed cluster in an online manner, the first node corresponding to the received read / write request in the distributed cluster is determined, wherein the first node is the node requested by the read / write request to perform a read operation or a write operation; in the case where the first node includes a second node in an upgraded state, the read / write request is sent to a third node in the first node that is not in the upgraded state, so that the second node obtains the first data object requested by the write request in the read / write request to be written to the first node from the third node after exiting the upgraded state. Therefore, the problem in the related art that the upgrade of a distributed storage cluster requires the removal of nodes in the cluster or the suspension of cluster services, resulting in poor upgrade effects, can be solved. This improves the upgrade effect of the distributed cluster. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] Figure 1 It is a hardware structure block diagram of a computer terminal of a method for sending a read / write request according to an embodiment of the present application;

[0020] Figure 2is a flowchart of a method for sending a read / write request according to an embodiment of the present application;

[0021] Figure 3 is another flow chart of a method for sending a read / write request according to an embodiment of the present application;

[0022] Figure 4 is another flow chart of a method for sending a read / write request according to an embodiment of the present application;

[0023] Figure 5 It is a schematic diagram of the upgrade pre-check of the method for sending a read / write request according to an embodiment of the present application;

[0024] Figure 6 It is a schematic diagram of a node upgrade operation of a method for sending a read / write request according to an embodiment of the present application;

[0025] Figure 7 It is a schematic diagram of processing a read request for an upgraded node during an upgrade of the method for sending a read and write request according to an embodiment of the present application;

[0026] Figure 8 It is a schematic diagram of processing a write request to an upgraded node during an upgrade of the method for sending a read / write request according to an embodiment of the present application;

[0027] Fig. 9 It is a schematic diagram of data recovery after node upgrade according to the method for sending read and write requests in an embodiment of the present application;

[0028] Fig.10 It is a schematic diagram of the cluster upgrade state change process of the method for sending a read / write request according to an embodiment of the present application;

[0029] Fig.11 It is a structural block diagram of a device for sending read and write requests according to an embodiment of the present application. DETAILED DESCRIPTION

[0030] The embodiments of the present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.

[0031] It should be noted that the terms "first", "second", etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.

[0032] The method embodiments provided in the embodiments of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Taking running on a computer terminal as an example, Figure 1 1 is a hardware structure block diagram of a computer terminal of a method for sending a read / write request according to an embodiment of the present application. Figure 1 As shown, the computer terminal may include one or more ( Figure 1Only one is shown in the figure) a processor 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data, wherein the above-mentioned computer terminal may also include a transmission device 106 and an input / output device 108 for communication functions. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above-mentioned computer terminal. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations are shown.

[0033] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the method for allocating load resources in the embodiment of the present application. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, the above method is implemented. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the computer terminal via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0034] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of a computer terminal. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0035] Figure 2 is a flowchart of a method for sending a read / write request according to an embodiment of the present application, such as Figure 2 As shown, the process includes the following steps:

[0036] Step S202, in the case of upgrading the distributed cluster in an online manner, determining a first node corresponding to the received read / write request in the distributed cluster, wherein the first node is a node requested by the read / write request to perform a read operation or a write operation;

[0037] Step S204, in the case that the first node includes a second node in an upgraded state, the read-write request is sent to a third node in the first node that is not in the upgraded state, so that after the second node exits the upgraded state, it obtains the first data object requested by the write request in the read-write request to be written into the first node from the third node.

[0038] Through the above steps, in the case of upgrading a distributed cluster online, the first node corresponding to the received read / write request in the distributed cluster is determined, wherein the first node is the node requested by the read / write request to perform a read operation or a write operation; in the case where the first node includes a second node in an upgraded state, the read / write request is sent to a third node in the first node that is not in the upgraded state, so that the second node obtains the first data object requested by the write request in the read / write request to be written to the first node from the third node after exiting the upgraded state. Therefore, the problem in the related art that the upgrade of a distributed storage cluster requires the removal of nodes in the cluster or the suspension of cluster services, resulting in poor upgrade effects, can be solved. This improves the upgrade effect of the distributed cluster.

[0039] In an exemplary embodiment, before determining that the received read / write request corresponds to the first node in the distributed cluster, the method also includes: detecting the cluster state of the distributed cluster; and when the cluster state meets the upgrade conditions, upgrading the multiple nodes in the distributed cluster in sequence through the online method according to a preset upgrade order.

[0040] The cluster status includes at least one of the following: the cluster status of the distributed cluster, the node status of all nodes in the distributed cluster, the task status in the distributed cluster, and the data status in the distributed cluster. The upgrade conditions that the cluster status needs to meet include: the cluster status is healthy, all nodes in the cluster are online and healthy, all nodes in the cluster have no ongoing tasks, and there is no data migration or data recovery in the cluster. It should be noted that an unhealthy status includes, for example: a node in the cluster is not online, a disk deployed on a node is damaged, etc.

[0041] Through the above embodiments of the present application, it is possible to ensure that the distributed cluster can upgrade multiple nodes in an orderly manner when the upgrade conditions are met, avoiding data consistency problems caused by a disordered upgrade order. For example, in a large-scale e-commerce transaction system, this method can ensure that system upgrades do not affect business continuity under high concurrent read and write operations, while ensuring data accuracy and security.

[0042] In an optional embodiment, before sending the read / write request to a third node in the first node that is not in the upgraded state, the method further includes: receiving an upgrade event broadcast by a second node, wherein the upgrade event is an event broadcast to the distributed cluster after the second node enters the upgraded state; and determining that the second node is in the upgraded state through the upgrade event.

[0043] The node entering the upgrade state broadcasts the upgrade event to the entire distributed cluster to declare that it is in the upgrade state. This mechanism can promptly notify other nodes in the cluster and avoid data access conflicts. It is particularly suitable for scenarios with high real-time requirements, such as financial trading systems, real-time data analysis platforms, etc., to ensure that during the upgrade process, the system can respond quickly and adjust data access strategies, thereby improving the overall stability and response speed of the system.

[0044] In an exemplary embodiment, determining the first node corresponding to the received read / write request in the distributed cluster includes: determining the second data object requested by the read / write request to perform a read operation or a write operation, wherein the second data object includes at least one of the following: a third data object requested by the read / write request to perform a read operation, and the first data object; determining the fourth node where the first object copy of the second data object in the distributed cluster is located; and determining the fourth node as the first node.

[0045] In an embodiment of the present application, the second data object that the read / write request needs to perform a read operation or a write operation is first accurately identified, and then all data copies of the second data object in the distributed cluster (i.e., the first object copy) can be more effectively located based on the second data object. Thus, by pre-locating the data copy, the fourth node to which the read / write request needs to be forwarded can be determined, thereby ensuring the accuracy and efficiency of data access. In large-scale data processing and analysis scenarios, such as big data analysis platforms, cloud storage services, etc., this method can significantly improve the accuracy and speed of data access, reduce data processing delays, and enhance user experience.

[0046] In an exemplary embodiment, the read-write request is sent to a third node in the first node that is not in the upgraded state, so that the second node obtains the first data object requested to be written into the first node by the write request in the read-write request from the third node after exiting the upgraded state, including: determining the request type of the read-write request; if the request type indicates that the read-write request is a read request, stop forwarding the read request to the second node; recalculate the fifth node where the copy of the second object requested to be read by the read request is located; if the fifth node is not in the upgraded state, use the fifth node as the third node and send the read request to the fifth node; if the request type indicates that the read-write request is a write request, stop forwarding the write request to the second node; forward the write request to the third node in the first node that is not in the upgraded state, and record the write operation corresponding to the write request in the preset list in the third node, so that after exiting the upgraded state, the second node obtains the first data object requested to be written into the first node by the write request in the read-write request from the third node through the preset list.

[0047] Optionally, recording the write operation corresponding to the write request in a preset list in the third node, including: determining the preset list pre-set in the third node; marking the write operation as a write operation during the upgrade of the second node in the preset list; and writing the change record and corresponding version of the first data object into the preset list.

[0048] The above embodiments of the present application describe in detail how to process and control read and write requests between nodes when a distributed cluster is performing an online upgrade to ensure data consistency and integrity. Specifically, when a node (the first node, such as node A) is in an upgrade state, other nodes in the cluster (such as node B) need to perform special processing on read and write requests sent to node A. This processing strategy is mainly divided into two aspects: processing of read requests and processing of write requests.

[0049] Specifically, the processing strategy for read requests includes:

[0050] 1) Determine the read request type and target node status: When node B receives a read request, it first needs to determine whether the request is to read a data object (second object copy) stored on node A. At the same time, check whether node A is in an upgraded state.

[0051] 2) Stop forwarding read requests to the upgraded node: If it is confirmed that node A is in the upgraded state, node B will stop forwarding read requests to node A to avoid data inconsistency problems that may be caused by read operations on node A during the upgrade process.

[0052] 3) Recalculate the target node of the read request: Node B then recalculates the target copy location of the read request, that is, searches for another node (the fifth node) that is not in an upgraded state and stores a copy of the data object required by the read request.

[0053] 4) Forward the read request to the non-upgraded node: After confirming that the fifth node (i.e., the third node, referred to here as the fifth node to emphasize its role as the new target node) is not in an upgraded state, Node B forwards the read request to the fifth node to ensure that the read operation can be successfully completed on the normally operating node.

[0054] Specifically, the processing strategy for write requests includes:

[0055] 1) Determine the write request type and target node status: When node B receives a write request, it also needs to confirm whether the target node A of the request is in an upgraded state.

[0056] 2) Stop forwarding write requests to the upgraded node: If node A is in the upgraded state, node B will stop forwarding write requests to node A to avoid write operations being interrupted during the upgrade process, resulting in data consistency issues.

[0057] 3) Redirection and recording of write requests: Node B redirects the write request to the non-upgraded node (third node) where another copy of Node A is located. At the same time, the operation content of the write request and the corresponding version information are recorded in the preset list (such as recover_list) of this non-upgraded node to ensure the accuracy and consistency of the data. If there are multiple write requests for the same data object during the upgrade, these write operations will be merged and recorded, and the version information will be updated.

[0058] 4) Data recovery after upgrading, including: after sending the read-write request to the third node in the first node that is not in the upgraded state, the method further includes: when the second node exits the upgraded state, instructing the second node to read a preset list in a sixth node in the distributed cluster, wherein the sixth node is any node in the target node other than the second node in the distributed cluster, and at least one third object copy in the target node is the same as the fourth object copy in the second node; the preset list in the sixth node records the write operations performed on the at least one third object copy when the second node is in the upgraded state, and the sixth node includes: the third node; instructing the second node to obtain the fourth data object requested to be written to the second node by all read-write requests during the period when the second node is in the upgraded state through the preset list in the sixth node, wherein the fourth data object includes: the first data object.

[0059] When node A completes the upgrade and exits the upgrade state, node A collects the list to be restored (i.e., the preset list) from the nodes with the same object replica (i.e., the sixth node, including the third node that forwarded the write request before). Node A restores data in batches based on the information in the list (i.e., the preset list), ensuring that all write requests redirected during the upgrade can be executed correctly, thereby ensuring data consistency and integrity.

[0060] 5) Data synchronization threshold control: During the data recovery process, node A will determine whether to restore in batches based on the total amount of data to be restored. When the amount of data to be restored exceeds the preset threshold Y (optional, Y is a positive number), node A will only restore the amount of data equal to the threshold Y, and the remaining data will be restored in one or more subsequent operations. When the remaining amount of data to be restored is less than the threshold Y, node A will restore all the remaining data at once, inform the cluster that it is ready, and exit the upgrade mode.

[0061] 6) Resuming normal service: After completing data recovery, node A will resume normal service status and begin to receive and process all types of read and write (Input / Output, referred to as IO) requests for stored data objects, including read and write requests that were redirected during the upgrade.

[0062] Therefore, through the above strategy, the embodiment of the present application can minimize the impact on cluster services during node upgrades while ensuring data consistency and integrity. This online upgrade process and IO control strategy has important practical value for distributed storage systems to perform software upgrades without stopping services or interrupting business.

[0063] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application, or the part that contributes to the relevant technology, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, disk, CD), and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in each embodiment of the present application.

[0064] In order to better understand the process of the above-mentioned method for sending read and write requests, the implementation process of the above-mentioned method for sending read and write requests is described below in combination with an optional embodiment, but it is not used to limit the technical solution of the embodiment of the present application.

[0065] The optional embodiments of the present application propose an online upgrade process for a distributed cluster and a node IO control strategy during the upgrade (equivalent to the method for sending read and write requests in the above embodiments), which can realize online upgrade of the storage cluster without removing nodes and stopping upper-layer services, and perform special control processing on the IO requests of the upgraded nodes during the upgrade so that the cluster can recover quickly after the node is upgraded.

[0066] The basic idea of ​​the optional embodiment of the present application is to execute an online upgrade process for a distributed cluster, which specifically includes: pre-upgrade check, node upgrade, IO control during upgrade, data recovery after upgrade and other main parts.

[0067] The overall cluster upgrade process is as follows: Figure 3 As shown, including:

[0068] Step S31: Cluster status detection. Before cluster upgrade, a series of pre-checks must be performed, including cluster status, node status, task status in the cluster, data migration and recovery status in the cluster, etc.

[0069] Step S32: When it is determined that the cluster status meets the upgrade conditions, execute step S33; otherwise, execute step S36; Step S33: Enter cluster upgrade and upgrade single nodes sequentially (IO control);

[0070] Through step S32 and step S33, stability and data consistency during the upgrade are guaranteed;

[0071] When performing a single node upgrade, the single node (equivalent to the second node in the above embodiment) first broadcasts its own upgrade event to the cluster, disconnects all sessions connected to itself, and sets the node to an upgrade state; then updates the software package, and restarts the storage service after the update is complete;

[0072] During the node (equivalent to the second node in the above embodiment) upgrade period, all requests to read data objects (object, referred to as obj) to the upgraded node (equivalent to the read request in the above embodiment) need to be redirected to the node where other replicas are located (i.e., the fifth node in the above embodiment); write requests to the upgraded node need to be discarded, and then a list to be restored (i.e., a preset list) is constructed in the memory of other replica nodes to store the corresponding obj operations and version information (i.e., the change record and corresponding version of the first data object);

[0073] Step S34: Single node upgrade completed;

[0074] After the node is updated and restarted, it needs to go to all other nodes (i.e. the sixth node) to collect the obj list to be restored (i.e. the preset list) when joining the cluster, and perform data recovery in batches according to the list; when the data to be restored is less than a certain threshold, the node exits the upgrade state, then takes away all the data to be restored at one time, and delays the processing of newly arrived IO requests; after the data recovery is completed, the node processes IO requests normally, and the node upgrade is completed at this time;

[0075] Step S35: Determine whether all nodes have been upgraded. If all nodes have been upgraded, execute step S36; otherwise, execute step S33;

[0076] Step S36: Exit cluster upgrade.

[0077] Repeat the above process for each node in the cluster until all nodes are upgraded and the cluster is upgraded, then exit the upgrade mode.

[0078] More specifically, during the node upgrade process, the IO control flow of the upgraded node (i.e., the second node) is as follows: Figure 4 shown.

[0079] Step S401: any node in the distributed cluster receives an IO request (equivalent to the read and write request in the above embodiment);

[0080] Step S402: Determine whether the read / write request is a read request or a write request. If it is a read request, execute step S403; if it is a write request, execute step S408;

[0081] Step S403: Determine whether the read request requests local reading, if yes, execute step S404; otherwise, execute step S405;

[0082] Step S404: Read the local copy, end;.

[0083] Step S405: Find other node copies to read;

[0084] In steps S404 and S405, reading the local copy at any node, or searching for any node in the copy of other nodes and the other nodes are equivalent to the first node in the above embodiment.

[0085] Step S406: Determine whether the replica node where the other node replica is located is in the upgrade mode (ie, upgrade state), if yes, execute step S405; otherwise, execute step S407;

[0086] It should be noted that for a read request, each time when looking for other node copies to read, only one node (i.e., the fifth node) where the other node copy is located is found; if the node where the other node copy is located is in the upgraded state, then continue to look for other nodes where the other node copies are located to update the fifth node until the node where the other node copy is located is not in the upgraded state.

[0087] Step S407: Read the copy, the read request is completed, and the process ends.

[0088] Step S408: whether all replica nodes include an upgraded node, if yes, execute step S409; if no, execute step S410;

[0089] Step S409: discard the write request to the upgraded node; the non-upgraded node (i.e., the third node) records the write request and version in the memory, and continues to execute step S411;

[0090] Step S410: local writing or forwarding writing, end.

[0091] Step S411: the non-upgraded node stores the obj modification record in the memory, waits for the upgraded node to recover, and ends.

[0092] Furthermore, taking a distributed storage cluster with three nodes (NODE: A, B, C) and two replicas as an example, the overall upgrade process includes:

[0093] 1) Cluster online upgrade, such as Figure 5 As shown, first perform a pre-check, and the following upgrade conditions must be met: the cluster is in a healthy state, all nodes in the cluster are online and in a healthy state, all nodes in the cluster have no ongoing tasks, and there is no data migration or data recovery in the cluster; when all the above conditions are met, you can enter the upgrade state;

[0094] 2) Single node upgrade, such as Figure 6 As shown, the node first enters the upgrade state and broadcasts its own upgrade event to the cluster; the upgraded node disconnects and rejects all iSCSI session links, installs the software upgrade package, and restarts the storage service after the installation is complete;

[0095] It should be noted that iSCSI, Internet Small Computer System Interface, is a storage technology based on the Internet and SCSI-3 protocol; session is the iSCSI session connection.

[0096] 3) During the upgrade of node A, if Figure 7As shown, node B receives a read request to obj①, and calculates that one of the copies of obj is located at node A. Before forwarding the read request to node A, it checks and finds that A is in the upgraded state; at this time, it needs to abandon the read request to the upgraded node and recalculate the location of another copy of obj (i.e., the second object copy); it is calculated that the node where another copy of obj①, obj①′, is located is C (which is equivalent to the fifth node at this time), and finally chooses to send the read request of obj① to node C;

[0097] 4) During the upgrade of node A, if Figure 8 As shown, node B receives a write request to obj②, and calculates that one of the copies of obj is located in node A. Before forwarding the write request to node A, it checks and finds that A is in the upgrade state; at this time, it is necessary to abandon the write request to the upgraded node and recalculate the location of another copy of obj; it is calculated that the node where another copy of obj②, obj②′, is located is C (equivalent to the third node at this time), and finally chooses to send a write request for obj② to node C, and marks this write as a write operation during the node upgrade, and stores the change record of obj② and the corresponding version in the recover_list list in the memory of node C, waiting for data synchronization after the upgrade of node A is completed; if there are multiple write operations on obj② during the upgrade, the write content is merged with the record in recover_list each time, and the version information is updated;

[0098] 5) After node A is upgraded, restart the service and rejoin the cluster. First, go to other nodes to obtain the list to be restored. Fig. 9 As shown in the figure, at the current moment, the total amount of obj in the recovery list of other nodes is greater than the threshold Y, A takes out the obj list (①, ②, ③, ④) equal to the threshold Y, and performs the first recovery (①′, ②′, ③′, ④′); the second time the list to be recovered is accessed, the remaining total length is less than Y, then A takes out all the remaining obj to be recovered (⑤, ⑥) and recovers (⑤', ⑥′); when node A takes out the list to be recovered for the last time, it informs each node that it is ready and exits the upgrade mode; the IO that each node needs to forward to node A is directly forwarded without any special processing; node A first processes the remaining obj to be recovered, and then receives and processes the IO normally;

[0099] 6) After node A is successfully upgraded, the subsequent nodes are upgraded sequentially. Fig.10 As shown, repeat the above node upgrade operation until the last node upgrade is completed, the cluster upgrade is successful, and then exit the upgrade mode.

[0100] In summary, the optional embodiments of the present application propose an online upgrade process of a distributed cluster and an IO control strategy during node upgrade. The online upgrade of the distributed cluster can achieve the premise that the node is not offline by upgrading the node one by one, so that the cluster can continue to provide storage services during the upgrade process; the stability of the upgrade process and the integrity of the data are guaranteed by the methods of pre-upgrade check, IO control during upgrade, and post-upgrade data recovery; and the IO control strategy in this scheme can reduce the impact of the upgrade on the business while ensuring the integrity and consistency of the data in the cluster by performing special processing on the IO requests that need to be forwarded to the upgraded node during the node upgrade, building a list of data to be recovered for write IO, and recovering the data after the node upgrade is completed.

[0101] In the present embodiment, a sending device for a read / write request is also provided, and the device is used to implement the above-mentioned embodiment and the preferred implementation mode, and the descriptions which have been made are omitted. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the device described in the following embodiments is preferably implemented in software, the implementation of hardware, or a combination of software and hardware is also possible and conceived.

[0102] Fig.11 is a structural block diagram of a device for sending a read / write request according to an embodiment of the present application, such as Fig.11 As shown, the device comprises:

[0103] A determination module 1102 is used to determine, when upgrading a distributed cluster in an online manner, a first node corresponding to the received read / write request in the distributed cluster, wherein the first node is a node requested by the read / write request to perform a read operation or a write operation;

[0104] The sending module 1104 is used to send the read-write request to a third node in the first node that is not in the upgraded state, when the first node includes a second node in the upgraded state, so that the second node obtains the first data object requested by the write request in the read-write request to be written into the first node from the third node after exiting the upgraded state.

[0105] Through the above-mentioned device, in the case of upgrading a distributed cluster in an online manner, the first node corresponding to the received read / write request in the distributed cluster is determined, wherein the first node is the node requested by the read / write request to perform a read operation or a write operation; in the case where the first node includes a second node in an upgraded state, the read / write request is sent to a third node in the first node that is not in the upgraded state, so that the second node obtains the first data object requested by the write request in the read / write request to be written to the first node from the third node after exiting the upgraded state. Therefore, the problem in the related art that the upgrade of a distributed storage cluster requires the removal of nodes in the cluster or the suspension of cluster services, resulting in poor upgrade effects, can be solved. This improves the upgrade effect of the distributed cluster.

[0106] In an exemplary embodiment, the device also includes an upgrade module, which is used to determine that before the received read and write request corresponds to the first node in the distributed cluster: detect the cluster status of the distributed cluster; and when the cluster status meets the upgrade conditions, upgrade multiple nodes in the distributed cluster in sequence through the online method according to a preset upgrade order.

[0107] In an exemplary embodiment, the device also includes a receiving module, which is used to, before sending the read / write request to a third node in the first node that is not in the upgraded state: receive an upgrade event broadcast by a second node, wherein the upgrade event is an event broadcast to the distributed cluster after the second node enters the upgraded state; and determine that the second node is in the upgraded state through the upgrade event.

[0108] In an exemplary embodiment, the determination module 1102 is also used to: determine the second data object requested by the read / write request to perform a read operation or a write operation, wherein the second data object includes at least one of the following: a third data object requested by the read / write request to perform a read operation, and the first data object; determine the fourth node where the first object copy of the second data object in the distributed cluster is located; and determine the fourth node as the first node.

[0109] In an exemplary embodiment, the sending module 1104 is also used to: determine the request type of the read-write request; if the request type indicates that the read-write request is a read request, stop forwarding the read request to the second node; recalculate the fifth node where the copy of the second object requested to be read by the read request is located; if the fifth node is not in an upgraded state, use the fifth node as the third node and send the read request to the fifth node; if the request type indicates that the read-write request is a write request, stop forwarding the write request to the second node; forward the write request to the third node in the first node that is in a non-upgraded state, and record the write operation corresponding to the write request in the preset list in the third node, so that after the second node exits the upgraded state, it can obtain the first data object requested to be written to the first node by the write request in the read-write request from the third node through the preset list.

[0110] In an exemplary embodiment, the sending module 1104 is also used to: determine the preset list pre-set in the third node; mark the write operation as a write operation during the upgrade of the second node in the preset list; and write the change record and corresponding version of the first data object into the preset list.

[0111] In an exemplary embodiment, the device also includes a data recovery module, which is used to send the read and write request to a third node in the first node that is not in the upgraded state: when the second node exits the upgraded state, instruct the second node to read a preset list in a sixth node in the distributed cluster, wherein the sixth node is any target node in the distributed cluster except the second node, and at least one third object copy in the target node is the same as the fourth object copy in the second node; the preset list in the sixth node records the write operations performed on the at least one third object copy when the second node is in the upgraded state, and the sixth node includes: the third node; instruct the second node to obtain the fourth data object requested to be written to the second node by all read and write requests during the period when the second node is in the upgraded state through the preset list in the sixth node, wherein the fourth data object includes: the first data object.

[0112] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when running.

[0113] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk.

[0114] An embodiment of the present application further provides an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.

[0115] In an exemplary embodiment, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.

[0116] An embodiment of the present application further provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the steps in any one of the above method embodiments are implemented.

[0117] An embodiment of the present application further provides another computer program product, including a non-volatile computer-readable storage medium, wherein the non-volatile computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in any of the above method embodiments are implemented.

[0118] An embodiment of the present application also provides a computer program, which includes computer instructions stored in a computer-readable storage medium; a processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the steps in any one of the above method embodiments.

[0119] For specific examples in this embodiment, reference may be made to the examples described in the above embodiments and exemplary implementation modes, and this embodiment will not be described in detail herein.

[0120] Obviously, those skilled in the art should understand that the above modules or steps of the present application can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order from that herein, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present application is not limited to any specific combination of hardware and software.

[0121] The above description is only the preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the principles of the present application shall be included in the protection scope of the present application.

Claims

1. A method for sending a read / write request, characterized in that: include: In the case of upgrading a distributed cluster in an online manner, determine the first node in the distributed cluster corresponding to the received read / write request, wherein the first node is the node requested by the read / write request to perform a read operation or a write operation; in the case where the first node includes a second node in an upgraded state, send the read / write request to a third node in the first node that is not in the upgraded state, so that after the second node exits the upgraded state, it obtains from the third node the first data object requested by the write request in the read / write request to be written to the first node.

2. The method according to claim 1, characterized in that Before determining that the received read / write request corresponds to the first node in the distributed cluster, the method further includes: Detecting the cluster status of the distributed cluster; When the cluster status meets the upgrade condition, multiple nodes in the distributed cluster are upgraded in sequence through the online method according to a preset upgrade order.

3. The method according to claim 1, characterized in that Before sending the read / write request to a third node in the first node that is not in the upgraded state, the method further includes: receiving an upgrade event broadcast by a second node, wherein the upgrade event is an event broadcast to the distributed cluster after the second node enters the upgrade state; It is determined through the upgrade event that the second node is in the upgrade state.

4. The method according to claim 1, characterized in that: Determining a first node corresponding to the received read / write request in the distributed cluster includes: Determine a second data object requested by the read / write request to perform a read operation or a write operation, wherein the second data object includes at least one of the following: a third data object requested by the read / write request to perform a read operation, and the first data object; Determine a fourth node where a first object copy of the second data object in the distributed cluster is located; The fourth node is determined as the first node.

5. The method according to claim 1, characterized in that Sending the read / write request to a third node in the first node that is not in the upgraded state, so that the second node, after exiting the upgraded state, obtains from the third node the first data object requested to be written in the first node by the write request in the read / write request, comprising: Determine the request type of the read / write request; If the request type indicates that the read-write request is a read request, stop forwarding the read request to the second node; recalculate the fifth node where the second object copy requested to be read by the read request is located; if the fifth node is not in an upgraded state, use the fifth node as the third node and send the read request to the fifth node; When the request type indicates that the read-write request is a write request, stop forwarding the write request to the second node; forward the write request to a third node in a non-upgraded state in the first node, and record the write operation corresponding to the write request in a preset list in the third node, so that after the second node exits the upgraded state, it can obtain the first data object requested by the write request in the read-write request to be written to the first node from the third node through the preset list.

6. The method according to claim 5, characterized in that Recording the write operation corresponding to the write request in a preset list in the third node includes: Determining the preset list pre-set in the third node; marking the write operation as a write operation during the second node upgrade in the preset list; and The change record and the corresponding version of the first data object are written into the preset list.

7. The method according to claim 5, characterized in that After sending the read / write request to a third node in the first node that is not in the upgraded state, the method further includes: In the case where the second node exits the upgrade state, instruct the second node to read a preset list in a sixth node in the distributed cluster, wherein the sixth node is any node in the target nodes other than the second node in the distributed cluster, and at least one third object replica in the target node is the same as the fourth object replica in the second node; the preset list in the sixth node records the write operations that have been performed on the at least one third object replica when the second node is in the upgrade state, and the sixth node includes: the third node; Instruct the second node to obtain, through a preset list in the sixth node, a fourth data object requested to be written to the second node by all read and write requests during the period when the second node is in an upgraded state, wherein the fourth data object includes: the first data object.

8. A device for sending a read / write request, characterized in that: include: A determination module, configured to determine, when upgrading a distributed cluster in an online manner, a first node corresponding to a received read / write request in the distributed cluster, wherein the first node is a node requested by the read / write request to perform a read operation or a write operation; A sending module is used to send the read-write request to a third node in the first node that is not in the upgraded state, when the first node includes a second node in the upgraded state, so that the second node obtains the first data object requested to be written into the first node by the write request in the read-write request from the third node after exiting the upgraded state.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program implements the steps of the method described in any one of claims 1 to 7 when executed by a processor.

10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method described in any one of claims 1 to 7 are implemented.

Citation Information

Cited By

  • Data read-write method, first node, second node and storage medium

    CN120896934A