Data storage method and device

By introducing mirror nodes into distributed RAID systems, the receiving node only needs to send notification messages to the mirror nodes to instruct to write to the hard disk, solving the problem of data being sent across nodes in the prior art and improving the I/O bandwidth of the system.

CN111666043BActive Publication Date: 2025-03-21HUAWEI TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202010317108.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2017-11-03
Publication Date
2025-03-21
Estimated Expiration
2037-11-03

AI Technical Summary

Technical Problem

In the prior art, when data is sent from a local storage node to other storage nodes, it needs to be sent twice across nodes, resulting in a low I/O bandwidth of the system.

Method used

By introducing a mirror node in the distributed RAID system, the receiving node determines the mirror node based on the logical address of the data to be written, and sends the data to be written and the logical address to the mirror node, so that the N target data blocks are stored in the N mirror nodes respectively. The receiving node only needs to send a notification message to the mirror node instructing the mirror node to write the data block to the hard disk.

Benefits of technology

The number of times data is sent across nodes is reduced, thereby improving the I/O bandwidth of the system, and further optimizing bandwidth usage is further optimized by reducing the amount of data in notification messages.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111666043B_ABST
    Figure CN111666043B_ABST
Patent Text Reader

Abstract

The embodiment of the present application discloses a data storage method and device, which relates to the field of computer technology, and solves the problem of low I / O bandwidth of the system due to data being sent twice across nodes. The specific scheme is: the receiving node receives a first write request including data to be written and the logical address of the data to be written, and stores the data to be written in its own cache, and determines the mirror node according to the logical address of the data to be written, records the first corresponding relationship, and the first corresponding relationship is the mapping relationship between the logical address of the data to be written and the mirror node, and the receiving node sends the data to be written and the logical address of the data to be written to the mirror node, and selects N target data blocks from its own cache according to the first corresponding relationship, the mirror nodes of the N target data blocks are different from each other, and sends notification messages to the N mirror nodes corresponding to the N target data blocks respectively. The embodiment of the present application is used for the process of storing data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of computer technology, and in particular, to a data storage method and device. Background Art

[0002] A distributed redundant array of independent disks (RAID) system is generally composed of multiple storage nodes interconnected by a network. When storing data in a distributed RAID system, in order to ensure data reliability, a redundancy algorithm such as an erasure code (EC) algorithm can be used to achieve redundant data storage, and in order to improve the input / output (I / O) performance of the system, a data cache mechanism can be implemented in the distributed RAID system so that storage nodes can quickly read and write data from the cache.

[0003] In the prior art, after receiving a write request, the local storage node can send the write request to other storage nodes in the distributed RAID system, so that the data in the write request can be stored in the cache of at least two storage nodes including the local storage node, respectively, to ensure the reliability of the data, and then the local storage node can reply to the write request. After the local storage node receives multiple write requests, it can determine N data blocks from the data in its own cache that has not been written to the hard disk, and calculate M check data blocks according to the EC algorithm, and then send N data blocks and M check data blocks to N+M storage nodes respectively, so that each storage node in the N+M storage nodes can store the data in the received data blocks in its own hard disk.

[0004] There are at least the following technical problems in the prior art: since in the process of storing data on the hard disk, the local storage node sends data across nodes when sending a write request to other storage nodes, and the local storage node also needs to send data across nodes when sending N data blocks to N storage nodes, the data is sent across nodes twice, resulting in a low I / O bandwidth of the system. Summary of the invention

[0005] The embodiments of the present application provide a data storage method and device, which solve the problem of low I / O bandwidth of the system caused by data being sent twice across nodes.

[0006] In order to achieve the above objectives, this application adopts the following technical solutions:

[0007] In a first aspect, the present application provides a data storage method, which is applied to a distributed RAID system, wherein the distributed RAID system includes K storage nodes, where K is an integer greater than 0, and the method may include: a receiving node receives a first write request including data to be written and a logical address of the data to be written, and stores the data to be written in its own cache, and determines a mirror node according to the logical address of the data to be written, and records a first corresponding relationship, wherein the first corresponding relationship is a mapping relationship between the logical address of the data to be written and the mirror node, and the receiving node sends the data to be written and the logical address of the data to be written to the mirror node, and selects N target data blocks from its own cache according to the first corresponding relationship, wherein the mirror nodes of the N target data blocks are different from each other, so that the receiving node sends notification messages to the N mirror nodes corresponding to the N target data blocks respectively, wherein each notification message includes the logical address of the target data block corresponding to the mirror node to which the notification message is sent, and is used to instruct the mirror node to store the data block corresponding to the logical address in the notification message in its own cache to its own hard disk. Wherein, the receiving node is any one of the K storage nodes, and N is an integer greater than 0 and less than K.

[0008] In the data storage method provided by the embodiment of the present application, the receiving node determines the mirror node according to the logical address of the data to be written, and sends the data to be written and the logical address of the data to be written to the mirror node, so that N target data blocks are respectively stored in the N mirror nodes. The receiving node can directly send a notification message containing the logical address of the target data block to the N mirror nodes to instruct the mirror node to write the data block corresponding to the logical address to the hard disk. In this way, compared with the prior art in which the storage node needs to send the data to be written twice across nodes, the receiving node only needs to send the data to be written across nodes once when sending the data to be written to the mirror node. Moreover, since the amount of data of the logical address included in the notification message is small and the bandwidth occupied is small, the system I / O bandwidth is improved compared with the prior art.

[0009] In combination with the first aspect, in a possible implementation, the logical address of the data to be written includes at least one sub-logical address, and the receiving node determines the mirror node according to the logical address of the data to be written, which may specifically include: the receiving node uses the formula: X=Int(sub-logical address / length of the data block), and performs a rounding operation on each sub-logical address in the logical address of the data to be written after dividing it by the length of the data block to obtain an integer X corresponding to each sub-logical address, and the receiving node uses a pre-configured hash algorithm to perform a hash calculation on each integer X, and then modulo each hash calculation result, and obtains the number of the mirror node according to the modulo result. Wherein, the length of the data block is the number of sub-logical addresses included in each data block.

[0010] In combination with the first aspect and the foregoing possible implementation manner, in another possible implementation manner, when the receiving node uses a preconfigured hash algorithm to perform hash calculation on each integer X, if the preset number of mirror nodes is 1, the preconfigured hash algorithm is used to perform hash calculation on the integer X.

[0011] In combination with the first aspect and the above possible implementation methods, in another possible implementation method, when the receiving node uses a preconfigured hash algorithm to perform hash calculation on each integer X, if the preset number of mirror nodes is greater than 1, a preconfigured hash algorithm of a different type is used to calculate the integer X.

[0012] In combination with the first aspect and the foregoing possible implementation manner, in another possible implementation manner, when the receiving node uses a preconfigured hash algorithm to perform hash calculation on each integer X, if the preset number of mirror nodes is greater than 1, a preconfigured hash algorithm is first used to calculate the integer X, and then a preset number of other results are obtained based on the calculation result.

[0013] In combination with the first aspect and the above possible implementation manner, in another possible implementation manner, the logical address of the data to be written includes at least one sub-logical address, and the first correspondence records the mirror node corresponding to each sub-logical address. The receiving node selects N target data blocks in the cache according to the first correspondence, which may specifically include: the receiving node determines the sub-logical addresses with the same mirror node in the first correspondence, and selects the sub-logical address constituting a data block from the sub-logical addresses corresponding to the N different mirror nodes, and the data corresponding to the selected sub-logical addresses constitute the N target data blocks.

[0014] In combination with the first aspect and the above possible implementations, in another possible implementation, when the receiving node selects a sub-logical address constituting a data block from the sub-logical addresses corresponding to N different mirror nodes, it determines the sub-logical address missing when constituting a data block, and determines whether the missing sub-logical address is recorded in the second corresponding relationship, which is the corresponding relationship between the logical address of the data written to the hard disk of the mirror node and the physical address of the hard disk written to the mirror node. If it does not exist, the data corresponding to the missing sub-logical address is set to 0 to constitute the target data block, and the missing sub-logical address is recorded in the first corresponding relationship; if it exists, then according to the second corresponding relationship, the data corresponding to the missing sub-logical address is obtained from the mirror node to constitute the target data block, and the missing sub-logical address is added to the first corresponding relationship.

[0015] In combination with the first aspect and the above possible implementation methods, in another possible implementation method, it may also include: the receiving node calculates M check data blocks according to the N target data blocks, and sends the M check data blocks to storage nodes other than the N mirror nodes for storage.

[0016] In combination with the first aspect and the above possible implementations, in another possible implementation, after the receiving node sends the M check data blocks to storage nodes other than the N mirror nodes for storage, the method may further include: the receiving node deletes the correspondence between the sub-logical addresses of the N target data blocks and the mirror nodes from the first correspondence. The receiving node deletes the N target data blocks from its own cache, and sends indication messages to the N mirror nodes corresponding to the N target data blocks, respectively, each indication message including the logical address of the target data block corresponding to the mirror node to which the indication message is sent, for instructing the mirror node to delete the data block corresponding to the logical address in the indication message from the cache.

[0017] In a second aspect, the present application provides a data storage method, which is applied to a distributed RAID system, the distributed RAID system includes K storage nodes, K is an integer greater than 0, and the method may include: a mirror node receives a first write request sent by at least one receiving node, the first write request includes mirror data and the logical address of the mirror data, and writes the mirror data into its own cache, and records the corresponding relationship between the logical address of the mirror data and the receiving node. And the mirror node selects N target data blocks in its own cache according to the corresponding relationship between the mirror data and the receiving node, the receiving nodes of the N target data blocks are different from each other, and sends notification messages to the N receiving nodes corresponding to the N target data blocks respectively, each notification message includes the logical address of the target data block corresponding to the receiving node to which the notification message is sent, so as to instruct the receiving node to write the data block corresponding to the logical address in its own cache to the hard disk. Among them, the receiving node is a node that receives a second write request from the host, the second write request includes the data to be written and the logical address of the data to be written, the mirror node is determined by the receiving node according to the logical address of the data to be written, the mirror data is the data written to the mirror node determined by the receiving node, and N is an integer greater than 0 and less than K.

[0018] In the data storage method provided by the embodiment of the present application, the mirror node writes the mirror data in the first write request received into the cache and records the correspondence between the logical address of the mirror data and the receiving node, so that N target data blocks are respectively stored in the N receiving nodes. The mirror node can directly send a notification message containing the logical address of the target data block to the N receiving nodes to instruct the receiving node to write the data block corresponding to the logical address to the hard disk. In this way, compared with the prior art in which the storage node needs to send the data to be written twice across nodes, the present application only sends the data once across nodes, and because the amount of data of the logical address included in the notification message is small and the bandwidth occupied is small, the system I / O bandwidth is improved compared with the prior art.

[0019] In a third aspect, the present application provides a receiving node, which may include a module capable of implementing the method in the above-mentioned first aspect and its various embodiments.

[0020] In a fourth aspect, the present application provides a mirror node, which may include a module capable of implementing the method in the second aspect above.

[0021] In a fifth aspect, the present application provides a storage node, which includes: at least one processor, a memory, a communication interface, and a communication bus. At least one processor is connected to the memory and the communication interface through a communication bus, and the memory is used to store computer-executable instructions. When the storage node is running, the processor executes the computer-executable instructions stored in the memory, so that the storage node executes the data storage method as in the first aspect or any one of the possible implementations of the first aspect, or executes the data storage method as in the second aspect.

[0022] In a sixth aspect, the present application provides a computer storage medium having computer execution instructions stored thereon. When the computer execution instructions are executed by a processor, a data storage method as in the first aspect or any one of the possible implementation methods of the first aspect is implemented, or a data storage method as in the second aspect is implemented.

[0023] In a seventh aspect, the present application also provides a computer program product, which, when executed on a computer, enables the computer to execute the method described in the first or second aspect above.

[0024] In an eighth aspect, the present application further provides a communication chip storing computer execution instructions, which, when executed on a computer, enables the computer to execute the method described in the first or second aspect above.

[0025] It can be understood that any of the above-mentioned devices, computer storage media or computer program products are used to execute the corresponding methods provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding methods and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] Figure 1 An architecture diagram to which the embodiments of the present application can be applied is provided for the embodiments of the present application;

[0027] Figure 2 A schematic diagram of the composition of a storage node provided in an embodiment of the present application;

[0028] Figure 3 A flowchart of a data storage method provided in an embodiment of the present application;

[0029] Figure 4 A flowchart of another data storage method provided in an embodiment of the present application;

[0030] Figure 5 A schematic diagram of another storage node provided in an embodiment of the present application;

[0031] Figure 6 A schematic diagram of another storage node provided in an embodiment of the present application;

[0032] Figure 7 A schematic diagram of another storage node provided in an embodiment of the present application;

[0033] Figure 8 A schematic diagram of the composition of another storage node provided in an embodiment of the present application. DETAILED DESCRIPTION

[0034] Figure 1 An architecture diagram to which the embodiments of the present application can be applied is provided for the embodiments of the present application, such as Figure 1 As shown, the architecture may include: a host 11 and a distributed RAID system 12 .

[0035] Among them, the host 11 is used to send a first write request to any storage node in the distributed RAID system 12 when the host 11 needs to store data in the distributed RAID system 12, and is also used to receive a response message returned by the storage node, which is used to notify the host 11 that the data to be stored in the first write request has been stored in the distributed RAID system 12.

[0036] The distributed RAID system 12 is composed of K storage nodes interconnected through a network, and is used to provide massive storage space. K is an integer greater than 1, and each storage node in the distributed RAID system 12 can be a server in a specific implementation.

[0037] It should be noted that, in the embodiment of the present application, in order to facilitate the distinction between different storage nodes in the distributed RAID system 12, different numbers can be used to represent different storage nodes.

[0038] Figure 2 A schematic diagram of the composition of a storage node provided in an embodiment of the present application is shown in FIG. Figure 2 As shown, the storage node may include: at least one processor 21 , a memory 22 , a communication interface 23 and a communication bus 24 .

[0039] Combine the following Figure 2 The following is a detailed introduction to the components of a storage node:

[0040] The processor 21 is the control center of the storage node, and may be a processor or a general term for multiple processing elements. For example, the processor 21 is a central processing unit (CPU), or an application specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present application, such as one or more digital signal processors (DSP), or one or more field programmable gate arrays (FPGA).

[0041] In a specific implementation, as an embodiment, the storage node may include one or more CPUs, such as Figure 2 Also, as an embodiment, the storage node may include multiple processors, such as Figure 2 21 and processor 25 shown in FIG. Each of these processors may be a single-core processor (single-CPU) or a multi-core processor (multi-CPU). A processor herein may refer to one or more devices, circuits, and / or processing cores for processing data (e.g., computer program instructions).

[0042] In a specific implementation, the processor 21 can perform various functions of the storage node by running or executing the software program stored in the memory 22, and calling the data stored in the memory 22. For example, the processor 21 can run the computer program code stored in the memory 22 to execute the data storage method provided by the present application, and save the data to be stored in the write request to the hard disk of the distributed RAID system.

[0043] The memory 22 may be a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, a random access memory (RAM) or other types of dynamic storage devices that can store information and instructions, or an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compressed optical disc, laser disc, optical disc, digital versatile disc, Blu-ray disc, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory 22 may exist independently and be connected to the processor 21 via a communication bus 24. The memory 22 may also be integrated with the processor 21.

[0044] In a specific implementation, the memory 22 is used to store the data in the present application and execute the software program of the present application. For example, the memory 22 can be used to store the computer program code corresponding to the data storage method provided in the embodiment of the present application. In the embodiment of the present application, the memory 22 may include a cache and a hard disk to store the data to be stored in the write request.

[0045] The communication interface 23 uses any transceiver or other device for communicating with other devices or communication networks, such as a host, a radio access network (RAN), a wireless local area network (WLAN), etc. The communication interface 23 may include a receiving unit to implement a receiving function, and a sending unit to implement a sending function.

[0046] The communication bus 24 may be an industry standard architecture (ISA) bus, a peripheral component interconnect (PCI) bus, or an extended industry standard architecture (EISA) bus. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 2 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0047] In the prior art, when a local storage node sends a write request to other storage nodes, it needs to send data across nodes. When sending N data blocks to N storage nodes, it also needs to send data across nodes. This causes the data to be sent across nodes twice, resulting in a low I / O bandwidth for the system. Therefore, in order to solve the problem of low I / O bandwidth for the system, it can be used Figure 3 The data storage method shown is used to store data, such as Figure 3 As shown, the method may include:

[0048] It should be noted that, in the embodiment of the present application, the receiving node is taken as the first storage node for example, and the first storage node is any storage node in the distributed RAID system that receives the first write request sent by the host.

[0049] 301. A first storage node receives a first write request sent by a host.

[0050] The first write request may include the data to be written and the logical address of the data to be written, and the logical address of the data to be written includes at least one sub-logical address. In a specific implementation, the logical address of the data to be written generally includes a first address and a data length. For example, if the first address is 0 and the data length is 3, it means that the logical address of the data to be written includes 3 sub-logical addresses, namely, logical address 0, logical address 1, and logical address 2.

[0051] 302. The first storage node stores the to-be-written data in the first write request in its own cache.

[0052] 303. The first storage node determines a mirror node according to a logical address of the data to be written in the first write request.

[0053] The length of the data block is the number of sub-logical addresses included in each data block. After the first storage node stores the data to be written in its own cache, the first storage node can use the formula: X = Int (sub-logical address / length of the data block) to round each sub-logical address in the logical address of the data to be written after dividing it by the length of the data block to obtain an integer X corresponding to each sub-logical address. At this time, the first storage node can use a pre-configured hash algorithm to perform a hash calculation on each integer X, and then take the remainder of each hash calculation result after dividing it by the number of storage nodes K in the distributed RAID system, and obtain the number of the mirror node based on the result of the remainder.

[0054] Wherein, when the first storage node performs hash calculation on each integer X using a pre-configured hash algorithm, if the preset number of mirror nodes is only 1, the first storage node may use the pre-configured hash algorithm to calculate the integer X, and then take the remainder to obtain the number of the mirror node. If the preset number of mirror nodes is greater than 1, then, in one implementation, the first storage node may use pre-configured different types of hash algorithms to calculate the integer X, the type of hash algorithm is the same as the number of mirror nodes, and after taking the remainder of the hash result, different mirror node numbers are obtained respectively. In another implementation, the first storage node may first perform hash calculation on the integer X, and after taking the remainder, obtain the number of a mirror node, and then determine the numbers of other mirror nodes according to the numbering result of the determined mirror node. For example, if the preset number of mirror nodes is 3, the first storage node may first perform hash calculation on the integer X, and after taking the remainder, obtain the number of the mirror node, and then use the two mirror node number values ​​adjacent to the determined mirror node numbering result as the other two mirror nodes, or perform hash calculation twice on the calculation result to obtain the numbers of the other two mirror nodes.

[0055] It should be noted that, in the embodiment of the present application, the length S of the data block can be pre-configured in the first storage node, so that starting from the sub-logical address 0, each continuous S sub-logical address is the logical address of a data block. In this way, the first storage node uses the length S of the data block to perform a rounding operation on each sub-logical address, so that the integer X obtained by rounding each sub-logical address in a data block is the same, so that the mirror node calculated according to each sub-logical address in a data block is the same, that is, a data block can be stored in a mirror node.

[0056] Furthermore, in the embodiment of the present application, the preset number of mirror nodes is determined by the reliability index of the distributed RAID system. Exemplarily, assuming that the reliability index of the distributed RAID system is that when the caches of two storage nodes fail respectively, the data in the caches of the two storage nodes can still be recovered, then the data in each storage node needs to be stored in the caches of at least three storage nodes respectively, that is, the preset number of mirror nodes in the first storage node is two or more.

[0057] Exemplarily, it is assumed that the sub-logical addresses included in the logical address of the data to be written are: logical address 2, logical address 3, and logical address 4, the length S of the data block pre-configured in the first storage node is 4, and two hash algorithms are pre-configured, the preset number of mirror nodes is two, and the number K of storage nodes in the distributed RAID system is 16. Then the first storage node can round up the logical addresses 2, 3, and 4 respectively, and the corresponding X is 0, 0, and 1 respectively. In this way, the first storage node can use two hash algorithms to perform hash calculations on the integer 0 respectively, and then take the remainder of the two hash calculation results after dividing by 16 respectively to obtain the numbers of the mirror nodes, which are assumed to be 5 and 6 respectively, and use two hash algorithms to calculate the integer 1 respectively, and then take the remainder of the two hash calculation results after dividing by 16 respectively to obtain the numbers of the mirror nodes, which are assumed to be 6 and 7 respectively. At this time, the first storage node can determine that the mirror nodes corresponding to the logical address 2 are the storage nodes numbered 5 and 6, the mirror nodes corresponding to the logical address 3 are the storage nodes numbered 5 and 6, and the mirror nodes corresponding to the logical address 4 are the storage nodes numbered 6 and 7.

[0058] 304. The first storage node records the first corresponding relationship.

[0059] After the first storage node determines the mirror node according to the logical address of the data to be written, the first storage node may save a first corresponding relationship, which is a mapping relationship between each sub-logical address and the serial number of the mirror node.

[0060] Exemplarily, according to the example in step 303 , assuming that the first storage node is numbered 1, the first storage node 1 may store the first corresponding relationship shown in Table 1.

[0061] Table 1

[0062] Logical address The ID of the receiving node The ID of the mirror node 2、3 1 5、6 4 1 6、7

[0063] 305. The first storage node sends the data to be written and the logical address of the data to be written to the mirror node.

[0064] Among them, after the first storage node records the first corresponding relationship, the first storage node can send the data to be written and the logical address of the data to be written to the mirror node. Specifically: the first storage node can send a second write request to each mirror node, and the second write request includes the mirror data and the logical address of the mirror data, wherein the logical address of the mirror data is the logical address corresponding to the mirror node in the first corresponding relationship. The mirror node can then save the mirror data contained in the received second write request in its own cache. And the mirror node can send a response message to the first storage node to notify the first storage node that the mirror data contained in the second write request has been stored in the cache of the mirror node.

[0065] Exemplarily, according to the example in step 304, it is assumed that the data to be written included in the first write request is data A, data B, and data C, wherein data A corresponds to logical address 2, data B corresponds to logical address 3, and data C corresponds to logical address 4. Then, in the second write request sent by the first storage node 1 to the storage node 5, the logical address of the mirrored data includes: logical address 2 and logical address 3 corresponding to the mirrored node 5, and the mirrored data includes: data A and data B. In the second write request sent by the first storage node 1 to the storage node 6, the logical address of the mirrored data includes: logical address 2, logical address 3, and logical address 4 corresponding to the mirrored node 6, and the mirrored data includes: data A, data B, and data C. In the second write request sent by the first storage node 1 to the storage node 7, the logical address of the mirrored data includes: logical address 4 corresponding to the mirrored node 7, and the mirrored data includes data C.

[0066] 306. The first storage node sends a response message to the host.

[0067] After the first storage node receives the response message sent by each mirror node, the first storage node may send a response message to the host to notify the host that the data to be written in the first write request has been stored in the distributed RAID system.

[0068] It should be noted that in the embodiment of the present application, the host will send multiple write requests to the first storage node. At this time, the first storage node can process the received multiple write requests in parallel according to the processing capacity, and the first storage node can execute steps 301-306 when processing each write request. After the first storage node replies to the host with a response message, data persistence can be performed in the background, and the following steps 307-308 can be specifically executed:

[0069] 307. The first storage node selects N target data blocks from its own cache according to the first corresponding relationship, and the mirror nodes of the N target data blocks are different from each other.

[0070] The target data block includes data corresponding to each of the S consecutive logical addresses. The first storage node can first determine the sub-logical address with the same mirror node in the first corresponding relationship. The same mirror node may be one or more. If there are multiple same mirror nodes, the first storage node can first select one mirror node from the multiple mirror nodes. In this way, the first storage node can select N different mirror nodes, and select the sub-logical address that constitutes a data block from the sub-logical addresses corresponding to the N different mirror nodes. The data corresponding to the selected sub-logical address is the N target data blocks.

[0071] When the first storage node selects a sub-logical address constituting a data block, it can first determine the sub-logical address missing when constituting a data block, and then determine whether the missing logical address is recorded in the second corresponding relationship, which is the corresponding relationship between the logical address of the data written to the hard disk of the mirror node and the physical address of the hard disk written to the mirror node. If the missing sub-logical address does not exist in the second corresponding relationship, it indicates that the first storage node has not written the data corresponding to the missing sub-logical address to the hard disk. At this time, the first storage node can set the data corresponding to the missing sub-logical address to 0 to constitute the target data block, and record the missing sub-logical address in the first corresponding relationship. If the missing sub-logical address exists in the second corresponding relationship, it indicates that the first storage node has stored the data corresponding to the missing logical address in the hard disk of the mirror node. At this time, the first storage node can obtain the data corresponding to the missing sub-logical address from the mirror node according to the second corresponding relationship to constitute the target data block, and record the missing sub-logical address in the first corresponding relationship.

[0072] Exemplarily, assuming that the length S of the data block is 3 and N is 3, the first corresponding relationship stored in the first storage node 1 is as shown in Table 2.

[0073] Table 2

[0074] Logical address Receiving Node Mirror Node 3 1 2 0、1、2 1 4 4 1 2 9、10 1 3 11 1 3 15 1 7

[0075] Then the first storage node 1 can be determined in Table 2, respectively, with sub-logical addresses of mirror nodes 2, 3, 4, and 7. Then, the first storage node 1 can select three different mirror nodes, such as mirror nodes numbered 2, 3, and 4. At this time, the first storage node 1 can select sub-logical addresses that constitute a data block from the sub-logical addresses corresponding to the three mirror nodes, and when selecting the sub-logical addresses that constitute a data block, the first storage node can determine the missing sub-logical address 5, and fill in the data corresponding to the missing logical address 5 to form a target data block, and record the missing logical address 5 in the first corresponding relationship. At this time, the three target data blocks selected by the first storage node 1 are: data corresponding to logical address 3, logical address 4, and logical address 5, data corresponding to logical address 9, logical address 10, and logical address 11, and data corresponding to logical address 0, logical address 1, and logical address 2.

[0076] 308. The first storage node sends notification messages to the N mirror nodes corresponding to the N target data blocks respectively.

[0077] Each notification message includes the logical address of the target data block corresponding to the mirror node to which the notification message is sent, and the notification message is used to instruct the mirror node to store the data block corresponding to the logical address in the notification message in its own cache to its own hard disk.

[0078] After the first storage node determines the N target data blocks, the first storage node can send notification messages to the N mirror nodes corresponding to the N target data blocks respectively. After receiving the notification message, each mirror node can first determine whether the data corresponding to the logical address in the notification message is stored in its own cache. If the data corresponding to the logical address in the notification message is stored in its own cache, the mirror node can store the data block corresponding to the logical address in the notification message in its own hard disk. If the data corresponding to a certain logical address in the notification message is not stored in its own cache, the mirror node can determine whether the logical address of the missing data is recorded in the mapping relationship between the logical address of the data written to the hard disk and the physical address written to the hard disk. If it does not exist, the mirror node can set the data corresponding to the logical address of the missing data to 0 to form the target data block. If it exists, the mirror node can obtain the data corresponding to the logical address according to the mapping relationship between the logical address of the data written to the hard disk and the physical address written to the hard disk to form the target data block. Then the first storage node stores the data block corresponding to the logical address in the notification message in its own hard disk.

[0079] Exemplarily, according to the example in step 307, the first storage node 1 may send notification messages to storage nodes numbered 2, 3, and 4, respectively, wherein the logical addresses included in the notification message sent by the first storage node 1 to the storage node numbered 2 are 3, 4, and 5, the logical addresses included in the notification message sent by the first storage node 1 to the storage node numbered 3 are 9, 10, and 11, and the logical addresses included in the notification message sent by the first storage node 1 to the storage node numbered 4 are 0, 1, and 2.

[0080] 309. The first storage node calculates M check data blocks according to the N target data blocks.

[0081] To ensure data reliability when writing data to the hard disk, after the first storage node determines N target data blocks in step 307, the first storage node may use the EC algorithm to calculate the data of the N target data blocks to obtain M check data blocks.

[0082] 310. The first storage node sends the M check data blocks to storage nodes other than the N mirror nodes for storage.

[0083] Among them, after the first storage node obtains M verification data blocks, the first storage node can select M storage nodes except N mirror nodes, and send the M verification data blocks to the M storage nodes for storage, so that each storage node stores the received verification data blocks in its own hard disk, so that the N target data blocks stored in the hard disks of the N storage nodes and the M verification data blocks stored in the hard disks of the M storage nodes can form a stripe, so that in the event that the data of any Y target data blocks among the N target data blocks in the stripe is damaged or lost, the data of the damaged Y target data blocks can be restored by the data of the remaining undamaged NY target data blocks in the stripe and the data of the M verification data blocks.

[0084] 311. The first storage node deletes the correspondence between the sub-logical addresses of the N target data blocks and the mirror nodes from the first correspondence, deletes the N target data blocks from its own cache, and sends indication messages to the N mirror nodes corresponding to the N target data blocks respectively.

[0085] Among them, after the data of N target data blocks are stored in the hard disks of N storage nodes of the distributed RAID system, and the data of M verification data blocks are stored in the hard disks of M storage nodes, it indicates that the data of the N target data blocks have been reliably stored in the distributed RAID system. At this time, the first storage node can delete the correspondence between the sub-logical addresses of the N target data blocks and the mirror nodes from the first correspondence. And the first storage node can delete the N target data blocks from its own cache, and send indication messages to the N mirror nodes corresponding to the N target data blocks respectively, the indication message includes the logical address of the target data block corresponding to the mirror node to which the indication message is sent, and is used to instruct the mirror node to delete the data block corresponding to the logical address in the indication message from its own cache.

[0086] It should be noted that, in this embodiment of the present application, the logical address included in the indication message sent by the first storage node to any one of the N mirror nodes corresponding to the N target data blocks is the same as the logical address included in the notification message sent by the first storage node to the mirror node in step 308.

[0087] In the data storage method provided by the embodiment of the present application, the receiving node determines the mirror node according to the logical address of the data to be written, and sends the data to be written and the logical address of the data to be written to the mirror node, so that N target data blocks are respectively stored in the N mirror nodes. The receiving node can directly send a notification message containing the logical address of the target data block to the N mirror nodes to instruct the mirror node to write the data block corresponding to the logical address to the hard disk. In this way, compared with the prior art in which the storage node needs to send the data to be written twice across nodes, the receiving node only needs to send the data to be written across nodes once when sending the data to be written to the mirror node. Moreover, since the amount of data of the logical address included in the notification message is small and the bandwidth occupied is small, the system I / O bandwidth is improved compared with the prior art.

[0088] Furthermore, the first storage node performs a rounding operation on each sub-logical address by using the length of the data block, so that one data block can be stored in one mirror node. By taking the remainder of each hash calculation result after dividing it by K, and obtaining the number of the mirror node according to the remainder result, the calculated mirror node is a storage node in the distributed RAID system.

[0089] Figure 4 A flowchart of another data storage method provided in an embodiment of the present application, such as Figure 4 As shown, the method may include:

[0090] It should be noted that, in the embodiment of the present application, the mirror node is taken as the second storage node for illustration.

[0091] 401. A second storage node receives a first write request sent by at least one receiving node.

[0092] The first write request includes mirror data and the logical address of the mirror data, the receiving node is the node that receives the second write request from the host, the second write request includes the data to be written and the logical address of the data to be written, the mirror node is determined by the receiving node according to the logical address of the data to be written, and the mirror data is the data written to the mirror node determined by the receiving node. And the logical address of the mirror data includes at least one sub-logical address.

[0093] 402. The second storage node writes the mirrored data into its own cache, and records the correspondence between the logical address of the mirrored data and the receiving node.

[0094] After the second storage node receives the first write request, the second storage node may save the mirror data in the received first write request in its own cache, and record the correspondence between each sub-logical address in the logical address of the mirror data and the receiving node.

[0095] 403. The second storage node selects N target data blocks from its own cache according to the correspondence between the logical addresses of the mirrored data and the receiving nodes, where the receiving nodes of the N data blocks are different from each other.

[0096] The second storage node can first determine the sub-logical address with the same receiving node in the correspondence between the logical address of the mirrored data and the receiving node. Then, the first storage node can select N different receiving nodes, and select the sub-logical address constituting a data block from the sub-logical addresses corresponding to the N different receiving nodes, and the data corresponding to the selected sub-logical address is the N target data blocks.

[0097] It should be noted that, in the embodiment of the present application, the specific description of the second storage node selecting a sub-logical address constituting a data block can be referred to Figure 3 In step 307, the first storage node selects the relevant description of the sub-logical address constituting a data block, which will not be described in detail in the embodiment of the present application.

[0098] Step 404-step 407, in the embodiment of the present application, the relevant description of step 404-step 407 is the same as another embodiment of the present application Figure 3 The description of steps 308 to 311 is similar to that of steps 404 to 407. Figure 3 The relevant descriptions of steps 308 to 311 in the present embodiment of the application will not be repeated one by one.

[0099] In the data storage method provided by the embodiment of the present application, the mirror node writes the mirror data in the first write request received into the cache and records the correspondence between the logical address of the mirror data and the receiving node, so that N target data blocks are respectively stored in the N receiving nodes. The mirror node can directly send a notification message containing the logical address of the target data block to the N receiving nodes to instruct the receiving node to write the data block corresponding to the logical address to the hard disk. In this way, compared with the prior art in which the storage node needs to send the data to be written twice across nodes, the present application only sends the data once across nodes, and because the amount of data of the logical address included in the notification message is small and the bandwidth occupied is small, the system I / O bandwidth is improved compared with the prior art.

[0100] The above mainly introduces the solution provided by the embodiment of the present application from the perspective of the storage node. It is understandable that, in order to realize the above functions, the storage node includes hardware structures and / or software modules corresponding to the execution of each function. Those skilled in the art should easily realize that, in combination with the algorithm steps of each example described in the embodiments disclosed herein, the present invention can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present invention.

[0101] The embodiment of the present application can divide the storage node into functional modules according to the above method example. For example, each functional module can be divided according to each function, or two or more functions can be integrated into one processing module. The above integrated module can be implemented in the form of hardware or in the form of software functional modules. It should be noted that the division of modules in the embodiment of the present application is schematic and is only a logical function division. There may be other division methods in actual implementation.

[0102] In the case of dividing each functional module into corresponding functional modules, Figure 5 A possible composition diagram of the storage nodes involved in the above embodiments is shown. Figure 5 As shown, the storage node may include: a receiving unit 51, a storage unit 52, a determining unit 53, a sending unit 54 and a selecting unit 55.

[0103] The receiving unit 51 is used to support the storage node to execute Figure 3 Step 301 in the data storage method shown.

[0104] Storage unit 52, used to support storage nodes to execute Figure 3Steps 302 and 304 in the data storage method shown.

[0105] Determining unit 53, used to support the storage node to execute Figure 3 Step 303 in the data storage method shown.

[0106] The sending unit 54 is used to support the storage node to execute Figure 3 In the data storage method shown, steps 305, 306, 308, 310 and 311 send indication messages to the N mirror nodes corresponding to the N target data blocks respectively.

[0107] The selection unit 55 is used to support the storage node to execute Figure 3 Step 307 in the data storage method shown.

[0108] In the embodiments of the present application, further, Figure 6 As shown, the storage node may further include: a calculation unit 56 and a deletion unit 57 .

[0109] The computing unit 56 is used to support the storage node to execute Figure 3 Step 309 in the data storage method shown.

[0110] Deletion unit 57, used to support storage nodes to perform Figure 3 In step 311 of the data storage method shown, the correspondence between the sub-logical addresses of the N target data blocks and the mirror nodes is deleted from the first correspondence, and the N target data blocks are deleted from the cache of the data block itself.

[0111] It should be noted that all relevant contents of each step involved in the above method embodiment can be referred to the functional description of the corresponding functional module and will not be repeated here.

[0112] The storage node provided in the embodiment of the present application is used to execute the above Figure 3 The data storage method in can thus achieve the same effect as the above data storage method.

[0113] In the case of dividing each functional module into corresponding functional modules, Figure 7 A possible composition diagram of the storage nodes involved in the above embodiments is shown. Figure 7 As shown, the storage node may include: a receiving unit 61, a storage unit 62, a selection unit 63 and a sending unit 64.

[0114] The receiving unit 61 is used to support the storage node to execute Figure 4 Step 401 in the data storage method shown.

[0115] Storage unit 62, used to support storage nodes to execute Figure 4 Step 402 in the data storage method is shown.

[0116] The selection unit 63 is used to support the storage node to execute Figure 4 Step 403 in the data storage method shown.

[0117] The sending unit 64 is used to support the storage node to execute Figure 4 In the data storage method shown, step 404, step 406, and step 407 send indication messages to N receiving nodes corresponding to the N target data blocks respectively.

[0118] It should be noted that all relevant contents of each step involved in the above method embodiment can be referred to the functional description of the corresponding functional module and will not be repeated here.

[0119] The storage node provided in the embodiment of the present application is used to execute the above Figure 4 The data storage method in can thus achieve the same effect as the above data storage method.

[0120] In the case of an integrated unit, Figure 8 FIG. 2 shows another possible composition diagram of the storage node involved in the above embodiment. Figure 8 As shown, the storage node includes: a processing module 71 and a communication module 72.

[0121] The processing module 71 is used to control and manage the actions of the storage node. For example, the processing module 71 is used to support the storage node to execute Figure 3 The corresponding relationship between the sub-logical addresses of the N target data blocks and the mirror nodes is deleted from the first corresponding relationship, and the N target data blocks are deleted from the cache of the own, Figure 4 The communication module 72 is used to support the communication between the storage node and other network entities, such as a host or other storage nodes in a distributed RAID system. For example, the communication module 72 is used to support the storage node to perform Figure 3 In steps 301, 305, 306, 308, 310, and 311 of the method, instruction messages are sent to the N mirror nodes corresponding to the N target data blocks respectively. Figure 4The storage node may further include a storage module 73 for storing program codes and data of the storage node. For example, the storage module 73 is used to support the storage node to execute Figure 3 Step 302, step 304, Figure 4 Step 402 is shown.

[0122] Among them, the processing module 71 can be Figure 2 The processor or controller in the embodiment of the present invention can implement or execute various exemplary logic blocks, modules and circuits described in conjunction with the present disclosure. The processor can also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of DSP and microprocessor, etc. The communication module 72 can be Figure 2 The storage module 73 may be Figure 2 The memory in .

[0123] Through the description of the above implementation methods, technical personnel in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.

[0124] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0125] The units described as separate components may or may not be physically separated, and the components shown as units may be one physical unit or multiple physical units, that is, they may be located in one place or distributed in multiple different places. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0126] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0127] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium, including several instructions to enable a device (which can be a single-chip microcomputer, chip, etc.) or a processor (processor) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as USB flash drives, mobile hard drives, ROM, RAM, magnetic disks or optical disks.

[0128] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions within the technical scope disclosed by the present invention should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.

Claims

1. A data storage method, characterized in that: The method comprises: The storage node selects N target data blocks from the cache of the storage node, and a copy of the i-th target data block among the N target data blocks is stored in the i-th mirror node of the storage node, where i is each of 1 to N, and N is an integer greater than or equal to 2; The storage node sends notification messages to the N mirror nodes corresponding to the N target data blocks respectively, wherein the notification messages are used to instruct the mirror nodes that receive the notification messages to store the copies of the target data blocks indicated by the notification messages in their own caches to their own hard disks; The method further comprises: The storage node receives a write request, wherein the write request carries a logical address of data to be written; Determine a mirror node for writing the data to be written according to the logical address of the data to be written, wherein the mirror node for writing the data to be written is used to store a copy of the data to be written; Recording the correspondence between the logical address of the data to be written and the mirror node of the data to be written; The storage node selecting N target data blocks from the cache of the storage node includes: According to the corresponding relationship, data corresponding to the same logical address of the mirror node is selected to form a target data block, and the selected mirror node is the mirror node of the formed target data block.

2. The method according to claim 1, characterized in that The method further comprises: The storage node calculates M check data blocks according to the N target data blocks; The storage node sends the M check data blocks to storage nodes other than the N mirror nodes for storage.

3. The method according to claim 1 or 2, characterized in that: The logical address of the data to be written includes at least one sub-logical address, and the storage node determines the mirror node to write the data to be written according to the logical address of the data to be written, including: The storage node uses the formula: X=Int(sub-logical address / length of data block), divides each sub-logical address in the logical address of the data to be written by the length of the data block, and then performs a rounding operation to obtain an integer X corresponding to each sub-logical address, where the length of the data block is the number of sub-logical addresses included in each data block; The storage node performs hash calculation on each integer X using a pre-configured hash algorithm, then takes the remainder of each hash calculation result after dividing it by K, and obtains the number of the mirror node according to the result of the remainder.

4. The method according to claim 2, characterized in that: After the storage node sends the M check data blocks to storage nodes other than the N mirror nodes for storage, the method further includes: The storage node deletes the correspondence between the logical addresses of the N target data blocks and the mirror nodes from the correspondence; The storage node deletes the N target data blocks from its own cache, and sends indication messages to the N mirror nodes corresponding to the N target data blocks respectively, each indication message including a logical address of the target data block corresponding to the mirror node to which the indication message is sent, and the indication message is used to instruct the mirror node to delete the data block corresponding to the logical address in the indication message from the cache.

5. A storage node, characterized in that: The storage node comprises: A selection unit, in which a user selects N target data blocks from the cache of the storage node, and a copy of an i-th target data block among the N target data blocks is stored in an i-th mirror node of the storage node, where i is each of 1 to N, and N is an integer greater than or equal to 2; A sending unit, used to send notification messages to the N mirror nodes corresponding to the N target data blocks respectively, wherein the notification messages are used to instruct the mirror nodes that have received the notification messages to store the copies of the target data blocks indicated by the notification messages in their own caches to their own hard disks; A receiving unit, configured to receive a write request, wherein the write request carries a logical address of data to be written; A determination unit, configured to determine a mirror node for writing the data to be written according to a logical address of the data to be written, wherein the mirror node for writing the data to be written is used to store a copy of the data to be written; A storage unit, used for recording the correspondence between the logical address of the data to be written and the mirror node of the data to be written; The selection unit is specifically used for: According to the corresponding relationship, data corresponding to the same logical address of the mirror node is selected to form a target data block, and the selected mirror node is the mirror node of the formed target data block.

6. The storage node according to claim 5, characterized in that: Also includes: A calculation module, used for calculating M check data blocks according to the N target data blocks; The sending unit is further configured to send the M check data blocks to storage nodes other than the N mirror nodes for storage.

7. The storage node according to claim 5 or 6, characterized in that: The logical address of the data to be written includes at least one sub-logical address, and the storage node determines the mirror node where the data to be written is written according to the logical address of the data to be written, and the determining unit is specifically used to: The storage node uses the formula: X=Int(sub-logical address / length of data block), divides each sub-logical address in the logical address of the data to be written by the length of the data block, and then performs a rounding operation to obtain an integer X corresponding to each sub-logical address, where the length of the data block is the number of sub-logical addresses included in each data block; The storage node performs hash calculation on each integer X using a pre-configured hash algorithm, then takes the remainder of each hash calculation result after dividing it by K, and obtains the number of the mirror node according to the result of the remainder.

8. The storage node according to claim 6, characterized in that: After the storage node sends the M check data blocks to storage nodes other than the N mirror nodes for storage, the method further includes: A deleting unit, configured to delete the corresponding relationship between the logical addresses of the N target data blocks and the mirror nodes from the corresponding relationship, and delete the N target data blocks from its own cache; The sending unit is further used to send indication messages to the N mirror nodes corresponding to the N target data blocks respectively, each indication message including a logical address of the target data block corresponding to the mirror node to which the indication message is sent, and the indication message is used to instruct the mirror node to delete the data block corresponding to the logical address in the indication message from the cache.

9. A storage node, characterized in that: include: processor; The processor is connected to a memory, the memory is used to store computer-executable instructions, and the processor executes the computer-executable instructions stored in the memory to enable the storage node to execute the method according to any one of claims 1 to 4.

10. A computer-readable storage medium, characterized in that: The method comprises instructions, which, when executed on a computer, cause the computer to execute the method according to any one of claims 1 to 4.

11. A chip, characterized in that: The method comprises instructions, which, when executed on a computer, cause the computer to execute the method according to any one of claims 1 to 4.

12. A computer program product comprising instructions, characterized in that When the method is executed on a computer, the computer is enabled to execute the method according to any one of claims 1 to 4.

Citation Information

Patent Citations

  • RAID1 and RAID4 hybrid structure network storage system and method

    CN103761058A