Data processing method, electronic device, storage medium, and program product
By deploying a master-slave backup array in a distributed storage cluster, identifying backup storage nodes, and calculating check blocks, the overhead issues of storage space and performance associated with replication and erasure coding mechanisms are resolved, achieving a high-performance and low-storage-overhead redundancy mechanism.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- TSINGHUA UNIVERSITY
- Filing Date
- 2025-06-12
- Publication Date
- 2026-07-24
AI Technical Summary
In distributed storage clusters, existing data redundancy mechanisms such as replication and erasure coding incur significant overhead in terms of storage space and performance, resulting in high costs and poor performance.
By adopting a master-slave backup array mechanism, master-slave backup arrays are deployed in storage nodes. The master-slave backup arrays are used to determine backup storage nodes and send data copies. Combined with check block calculation and storage, data redundancy is achieved without the need to organize stripes.
It achieves high-performance data storage with storage overhead comparable to erasure coding mechanisms and far lower than replication mechanisms, balancing high performance and low storage space overhead.
Smart Images

Figure CN120669918B_ABST
Abstract
Description
Technical Field
[0001] This specification relates to the field of storage technology, and more particularly to a data processing method, electronic device, storage medium, and program product. Background Technology
[0002] In a distributed storage cluster, a storage node failure can render the data stored on it inaccessible, impacting data availability. To ensure data availability, distributed storage clusters typically employ data redundancy mechanisms. Common data redundancy mechanisms include replication and erasure coding.
[0003] In a replication mechanism, multiple copies of data can be stored across different storage nodes. Even if some storage nodes fail, the remaining nodes still store copies of the data. However, replication mechanisms consume a significant amount of storage space, and when the cost of storage media is high, the cost of a distributed storage cluster using a replication mechanism can be extremely high.
[0004] In erasure coding, data availability can be ensured with lower storage space overhead by encoding the original data into redundant data in parity check form. Striping, a fundamental concept in erasure coding, refers to a set of original data and a set of parity blocks. Maintaining the striping concept often introduces significant operational overhead in distributed storage clusters, resulting in performance that is typically far inferior to replication mechanisms. Summary of the Invention
[0005] In view of the above, one or more embodiments of this specification provide the following technical solutions:
[0006] According to a first aspect of one or more embodiments of this specification, a data processing method is proposed, applied to a storage node in a distributed storage cluster, wherein the storage node is deployed with a master-slave backup array, the number of rows and columns of the master-slave backup array being the same as the number of storage nodes in the distributed storage cluster, the row number and column number corresponding to the node number of the storage node, the elements of the master-slave backup array taking values of 0 or 1, each row and each column having k elements with a value of 1, and for any two rows, there exists a column such that the element values in this column for both rows are 1, wherein when the storage node is the master storage node for the data to be written, the method includes:
[0007] Receive a data write request sent by the client and store the data to be written carried in the data write request;
[0008] In the master-slave backup array, find the column number of the row corresponding to this storage node where the element value is 1 as the candidate column number;
[0009] Select p+1 column numbers from the candidate column numbers as backup storage node numbers for the data to be written, where p is the fault tolerance threshold of the distributed storage cluster and p is less than k;
[0010] The copy of the data to be written is sent to the corresponding backup storage node according to the backup storage node number, and after each backup storage node confirms that the copy has been received, a write completion response is sent to the client.
[0011] The backup storage node is used to cache the copy of the data to be written after receiving it, and calculate and store the corresponding check block based on each received copy when it determines that it has received the copy of the data to be written sent by the primary storage node corresponding to each check row number it maintains. The check row number is the row number of the column corresponding to the backup storage node in the primary-secondary backup array where the element value is 1.
[0012] According to a second aspect of one or more embodiments of this specification, a data processing method is proposed, applied to a storage node in a distributed storage cluster, wherein the storage node is deployed with a master-slave backup array, the number of rows and columns of the master-slave backup array being the same as the number of storage nodes in the distributed storage cluster, the row number and column number corresponding to the node number of the storage node, the elements of the master-slave backup array taking values of 0 or 1, each row and each column having k elements with a value of 1, and for any two rows, there exists a column such that the element values in this column for both rows are 1, when the storage node is a backup storage node for data to be written, the method includes:
[0013] Receive a copy of the data to be written from the primary storage node, and cache the copy;
[0014] Send a receive confirmation to the primary storage node so that the primary storage node can send a write completion response to the client after receiving the receive confirmations from each backup storage node of the data to be written.
[0015] If it is determined that a copy of the data to be written sent by the primary storage node corresponding to each verification row number has been received, the corresponding verification block is calculated and stored based on the received copy, wherein the verification row number is the row number of the column corresponding to this storage node in the primary-slave backup array where the element value is 1.
[0016] Wherein, the primary storage node is used to, after receiving a data write request sent by the client, search in the primary-slave backup array for the column number with an element value of 1 in the row corresponding to the primary storage node as a candidate column number, select p+1 column numbers from the candidate column numbers as backup storage node numbers for the data to be written, and send a copy of the data to be written according to the backup storage node number, where p is the fault tolerance threshold of the distributed storage cluster and p is less than k.
[0017] Optionally, the method further includes:
[0018] Receive data read requests sent by clients, which are sent by clients after determining that the main storage node of the data to be read has failed;
[0019] If the node stores the verification block corresponding to the data to be read specified in the data read request, the storage node other than the faulty node in the storage node corresponding to the verification row number is determined as the first-level recovery storage node.
[0020] Obtain the copy used to calculate the check block from the first-level recovery storage node as the recovery copy;
[0021] The data to be read is recovered based on the verification block and the recovery copy;
[0022] The data to be read is returned to the client.
[0023] Optionally, in the case of a failed node among the primary recovery storage nodes, the process of obtaining a recovery copy from the failed node includes:
[0024] Based on the column with an element value of 1 in the row where the faulty node is located in the master-slave backup array, the storage node that stores the verification block of the recovery copy is determined as the secondary recovery storage node.
[0025] Send a recovery instruction for the recovery copy to the secondary recovery storage node, so that the secondary recovery storage node can recover the recovery copy based on the check blocks it stores;
[0026] Receive the recovery copy returned by the secondary recovery storage node.
[0027] Optionally, the method further includes:
[0028] After storing the verification block, delete the cached copies of each piece of data to be written.
[0029] According to a third aspect of one or more embodiments of this specification, a data processing method is proposed, applied to a client accessing a distributed storage cluster, wherein a master-slave backup array is deployed in the storage nodes of the distributed storage cluster, the number of rows and columns of the master-slave backup array being the same as the number of storage nodes in the distributed storage cluster, the row number and column number corresponding to the node number of the storage node, the elements of the master-slave backup array taking values of 0 or 1, each row and each column having k elements with a value of 1, and for any two rows, there exists a column such that the element values in this column for both rows are 1, the method comprising:
[0030] Determine the primary storage node for the data to be written;
[0031] A data write request is sent to the primary storage node so that the primary storage node can store the data to be written carried in the data write request. The primary storage node searches for the column number with an element value of 1 in the row corresponding to its own storage node in the master-slave backup array as a candidate column number. Among the candidate column numbers, p+1 column numbers are selected as the backup storage node numbers for the data to be written, where p is the fault tolerance threshold of the distributed storage cluster and p is less than k. The backup storage node numbers are then used to send a copy of the data to be written to the backup storage node.
[0032] Receive a write complete response returned by the primary storage node, which is sent by the primary storage node after each backup storage node has determined that it has received the replica;
[0033] The backup storage node is used to cache the copy of the data to be written after receiving it, and calculate and store the corresponding check block based on each received copy when it determines that it has received the copy of the data to be written sent by the primary storage node corresponding to each check row number it maintains. The check row number is the row number of the column corresponding to the backup storage node in the primary-secondary backup array where the element value is 1.
[0034] Optionally, the client also deploys the master-slave backup array, and the method further includes:
[0035] Determine the primary storage node for the data to be read;
[0036] In the event of a failure of the primary storage node, the backup storage node number of the data to be read is determined based on the column number of the row corresponding to the primary storage node in the primary backup array, where the element value is 1.
[0037] A data read request is sent to the backup storage node according to the backup storage node number, so that the backup storage node, if it has a check block corresponding to the data to be read, determines the storage node corresponding to the check line number as the first-level recovery storage node; and obtains the copy used to calculate the check block from the first-level recovery storage node as a recovery copy, so as to recover the data to be read based on the check block and the recovery copy.
[0038] Receive the data to be read returned by the backup storage node.
[0039] According to a fourth aspect of one or more embodiments of this specification, an electronic device is provided, comprising: a processor; a memory for storing processor-executable instructions; wherein the processor performs the steps of the method as described above by executing the executable instructions.
[0040] According to a fifth aspect of one or more embodiments of this specification, a computer-readable storage medium is provided that stores computer instructions thereon, which, when executed by a processor, implement the steps of the method as described above.
[0041] According to a sixth aspect of one or more embodiments of this specification, a computer program product is provided, comprising a computer program / instructions that, when executed by a processor, implement the steps of the method as described above.
[0042] Using the data processing scheme provided in this specification, the primary storage node for the data to be written can determine backup storage nodes based on a primary-slave backup array. Replicas of the data to be written are sent to these backup storage nodes. Once each backup storage node confirms receipt of its replica, it sends a write completion response to the client. This makes the performance of data write operations on the critical path in the distributed storage cluster comparable to that of a replication mechanism, eliminating the need for striping and achieving high-performance data storage. Simultaneously, when a backup storage node confirms receipt of replicas of the data to be written from the primary storage node corresponding to each of its maintained check row numbers, it calculates and stores the corresponding check blocks based on each received replica. This converts k data replicas into a single check block, realizing the calculation and storage of check blocks in the erasure coding mechanism. The storage overhead is comparable to that of the erasure coding mechanism and far lower than that of the replication mechanism. In summary, the data processing scheme provided in this specification achieves a redundancy mechanism that combines high performance and low storage space overhead. Attached Figure Description
[0043] Figure 1 This is a schematic diagram of an access architecture for a distributed storage cluster provided in an exemplary embodiment.
[0044] Figure 2 This is a flowchart of a data processing method provided in an exemplary embodiment.
[0045] Figure 3 This is a flowchart of another data processing method provided in an exemplary embodiment.
[0046] Figure 4 This is a flowchart of another data processing method provided in an exemplary embodiment.
[0047] Figure 5 This is a schematic diagram of a master-slave backup array provided in an exemplary embodiment.
[0048] Figure 6 This is a flowchart of a data recovery method provided in an exemplary embodiment.
[0049] Figure 7 This is a schematic diagram of the structure of a device provided in an exemplary embodiment.
[0050] Figure 8 This is a block diagram of a data processing apparatus provided in an exemplary embodiment.
[0051] Figure 9 This is a block diagram of another data processing apparatus provided in an exemplary embodiment.
[0052] Figure 10 This is a block diagram of another data processing apparatus provided in an exemplary embodiment. Detailed Implementation
[0053] In a distributed storage cluster, a storage node failure can render the data stored on it inaccessible, impacting data availability. To ensure data availability, distributed storage clusters typically employ data redundancy mechanisms. Common data redundancy mechanisms include replication and erasure coding.
[0054] In a replication mechanism, multiple copies of data can be stored across different storage nodes. Even if some storage nodes fail, the remaining nodes still store copies of the data. However, replication mechanisms consume a significant amount of storage space, and when the cost of storage media is high, the cost of a distributed storage cluster using a replication mechanism can be extremely high.
[0055] In erasure coding, data availability can be ensured with lower storage space overhead by encoding the original data into redundant data in parity check form. Striping, a fundamental concept in erasure coding, refers to a set of original data and a set of parity blocks. Maintaining the striping concept often introduces significant operational overhead in distributed storage clusters, resulting in performance that is typically far inferior to replication mechanisms.
[0056] Taking a distributed object storage cluster as an example, if each object is divided into multiple raw data blocks and then encoded into stripes, since users typically access data at the object level, each read / write operation requires accessing multiple storage nodes, leading to increased fanout. When the cluster is heavily loaded, the latency of read / write operations is limited by the slowest of the accessed storage nodes, exacerbating tail latency issues. Furthermore, in scenarios with fast storage media and small object sizes (such as distributed caching), the number of network requests increases significantly, and frequent network requests significantly degrade cluster performance.
[0057] If objects are not split into data blocks, multiple objects must be organized into a stripe. This means that the storage cluster incurs some form of operational overhead to organize multiple objects stored on different storage nodes into a stripe. For example, some storage clusters organize stripes by proxying all read and write requests through a central node, but if this node fails, the entire storage cluster will become inaccessible. Another example is that some storage clusters pre-allocate stripes based on object keys (such as numbers) (e.g., objects 0-3 are assigned to stripe 0, objects 4-7 to stripe 1, etc.), but this strategy leads to wasted storage space when object writes are scattered. Suppose only object 0 is written and objects 1-3 are not; stripe 0 stores only one valid object and two check blocks, with storage efficiency comparable to a replication mechanism, losing the advantages of erasure coding.
[0058] Therefore, it is evident that distributed storage clusters incur significant operational overhead regardless of whether data is partitioned. The root cause of this overhead lies in the cluster's need to organize data into stripes and distribute the data across the storage nodes according to the stripe requirements.
[0059] To address the aforementioned issues, this specification provides a data processing scheme that enables data reading and writing in erasure coding mechanisms without relying on the striping concept. Since it does not rely on the striping concept, it avoids the operational overhead associated with striping, making its read / write performance comparable to replication mechanisms. Furthermore, its storage space overhead is essentially equivalent to existing erasure coding mechanisms, thus achieving a redundancy mechanism that combines high performance with low storage space overhead.
[0060] Figure 1 This is a schematic diagram of an access architecture for a distributed storage cluster, provided as an exemplary embodiment. For example... Figure 1 As shown, a distributed storage cluster may include multiple storage nodes, such as storage node 11, storage node 12, storage node 13, ... storage node 1N. Each storage node can be a physical server containing an independent host, or a virtual server hosted by a host cluster.
[0061] The access architecture of the distributed storage cluster also includes a client 2, which can access the distributed storage cluster to read and write data. The client can be a PC, mobile phone, tablet, laptop, wearable device (such as smart glasses, smartwatch, etc.), etc., and one or more embodiments in this specification do not limit this.
[0062] As for the network interaction between the client and the distributed storage cluster, the communication can be implemented using wired or wireless networks based on the communication methods supported by the corresponding devices. This manual does not impose any restrictions on this.
[0063] Figure 2This is a flowchart of a data processing method provided in an exemplary embodiment.
[0064] In this embodiment, the data processing method can be applied to the primary storage node in a distributed storage cluster. The primary storage node can be specified by the client. For example, when the client performs data write access, it can determine a storage node as the primary storage node in the distributed storage cluster based on the key value of the data to be written.
[0065] In this embodiment, each storage node in the distributed storage cluster can deploy a master-slave backup array corresponding to the distributed storage cluster. The number of rows and columns of the master-slave backup array is the same as the number of storage nodes in the distributed storage cluster. The row number and column number correspond to the node number of the storage node. That is, each storage node can correspond to one row and one column in the master-slave backup array, and the corresponding row number and column number are the same. For example, storage node 1 corresponds to the first row and the first column in the master-slave backup array. The elements of the master-slave backup array take values of 0 or 1. Each row and each column has k elements with a value of 1, and for any two rows, there exists a column such that the element values in this column for both rows are 1. Here, k is the sum of a power of a prime number and 1.
[0066] Please refer to Figure 2 The data processing method may include the following steps:
[0067] Step 202: Receive a data write request sent by the client and store the data to be written carried in the data write request.
[0068] Step 204: In the master-slave backup matrix, find the column number of the row corresponding to this storage node with an element value of 1 as the candidate column number.
[0069] Step 206: Select p+1 column numbers from the candidate column numbers as backup storage node numbers for the data to be written, where p is the fault tolerance threshold of the distributed storage cluster and p is less than k.
[0070] In this embodiment, after receiving the data to be written from the client, the primary storage node can determine backup storage nodes for the data. The number of backup storage nodes can be p+1, where p is the fault tolerance threshold of the distributed storage cluster, and p is less than k.
[0071] For example, the node number of the backup storage node can be determined based on the master-slave backup array, thereby determining the backup storage node. Specifically, the column number with an element value of 1 in the row corresponding to this storage node (i.e., the master storage node itself) can be searched in the master-slave backup array as a candidate column number, and the number of candidate column numbers is k. Then, p+1 column numbers are selected from these k candidate column numbers as the number of this storage node.
[0072] For example, suppose k=4, p=2, and there are four columns with a value of 1 in the row corresponding to a primary storage node: columns 2, 4, 5, and 6. Then, three of these columns can be selected as backup storage node numbers. Furthermore, suppose the primary storage node selects 2, 4, and 5 as backup storage node numbers; that is, the primary storage node selects storage nodes 2, 4, and 5 as backup storage nodes for the data to be written.
[0073] This specification does not limit the method of selecting backup storage node numbers from the candidate column numbers. For example, p+1 candidate column numbers can be randomly selected as backup storage node numbers. Alternatively, p+1 candidate column numbers can be selected at intervals. Yet another example is that p+1 candidate column numbers can be selected sequentially as backup node numbers.
[0074] Step 208: Send a copy of the data to be written to the corresponding backup storage node according to the backup storage node number, and after each backup storage node confirms that it has received the copy, send a write completion response to the client.
[0075] Based on the aforementioned step 206, after determining the backup storage node number, the primary storage node can send copies of the data to be written to the corresponding backup storage nodes based on the backup storage node number.
[0076] Taking 2, 4, and 5 as backup storage node numbers as an example, the primary storage node can send copies of the data to be written to storage node 2, storage node 4, and storage node 5 respectively.
[0077] After receiving a copy of the data to be written, the three backup storage nodes can first cache the copy and then return a receipt acknowledgment to the primary storage node. After receiving the receipt acknowledgments from each backup storage node, the primary storage node can determine that each backup storage node has received the copy, and then send a write completion response to the client.
[0078] For each backup storage node of the data to be written, if it is determined in the background that it has received a copy of the data to be written sent by the storage node (which is the primary storage node for the backup storage node) corresponding to each verification row number it maintains, it can calculate and store the corresponding verification block based on each received copy, so as to realize the calculation and storage of the verification block in the erasure coding mechanism.
[0079] The verification row number is the row number of the column corresponding to the backup storage node in the master-slave backup array where the element value is 1. For each backup storage node, there are k verification row numbers. That is, each storage node maintains a verification block of the original data stored in the storage node corresponding to the k row numbers where the element value in the corresponding column is 1. In other words, k data replicas can be converted into one verification block.
[0080] As can be seen from the above description, by adopting the data processing scheme provided in this specification, the primary storage node of the data to be written can determine the backup storage nodes for the data to be written based on the primary-slave backup array, so as to send copies of the data to be written to the backup storage nodes. After each backup storage node confirms that it has received the copy, it sends a write completion response to the client. Thus, the performance of the data write operation on the critical path in the distributed storage cluster is comparable to that of the replication mechanism, without the need to organize stripes, achieving high-performance data storage. At the same time, when the backup storage node confirms that it has received the copies of the data to be written sent by the primary storage node corresponding to each check row number it maintains, it calculates and stores the corresponding check block based on each received copy, thereby converting k data copies into one check block. This realizes the calculation and storage of check blocks in the erasure coding mechanism, and the storage overhead is comparable to that of the erasure coding mechanism and far lower than that of the replication mechanism. In summary, by adopting the data processing scheme provided in this specification, a redundancy mechanism that achieves both high performance and low storage space overhead is realized.
[0081] Figure 3 This is a flowchart of another data processing method provided in an exemplary embodiment.
[0082] In this embodiment, the data processing method can be applied to a backup storage node for the data to be written in a distributed storage cluster. The backup storage node can be determined by the primary storage node for the data to be written, as detailed above. Figure 2 The embodiments shown are not described in detail here.
[0083] Please refer to Figure 3 The data processing method may include the following steps:
[0084] Step 302: Receive a copy of the data to be written from the primary storage node and cache the copy.
[0085] Step 304: Send a receipt confirmation to the primary storage node so that the primary storage node can send a write completion response to the client after receiving the receipt confirmations from each backup storage node of the data to be written.
[0086] In this embodiment, after receiving a copy of the data to be written, the backup storage node can first cache the copy and return a receipt acknowledgment to the primary storage node. After receiving the receipt acknowledgments from each backup storage node of the data to be written, the primary storage node can determine that each backup storage node has received the copy, and then send a write completion response to the client.
[0087] Step 306: If it is determined that a copy of the data to be written sent by the primary storage node corresponding to each verification row number has been received, calculate and store the corresponding verification block based on the received copy, wherein the verification row number is the row number of the column corresponding to this storage node in the primary-slave backup matrix where the element value is 1.
[0088] In this embodiment, the backup storage node can calculate and store the corresponding check block based on each received copy of the data to be written sent by the primary storage node corresponding to each check row number it maintains, after determining in the background that it has received the copy of the data to be written, so as to realize the calculation and storage of check blocks in the erasure coding mechanism.
[0089] The verification row number is the row number of the column corresponding to the backup storage node in the master-slave backup array where the element value is 1. For each backup storage node, there are k verification row numbers. That is, each storage node maintains a verification block of the original data stored in the storage node corresponding to the k row numbers where the element value in the corresponding column is 1. In other words, k data replicas can be converted into one verification block.
[0090] For example, assuming k=4, backup storage node 2 maintains check blocks of the original data from the four storage nodes. Further assuming backup storage node 2 maintains check blocks of the original data from storage nodes 3, 7, 9, and 10, then after receiving copies of the data to be written from each of these four storage nodes, backup storage node 2 can calculate the XOR sum of these copies to obtain and store the check blocks encoding the data to be written, thus realizing the calculation and storage of check blocks in the erasure coding mechanism.
[0091] Figure 4 This is a flowchart of another data processing method provided in an exemplary embodiment.
[0092] In this embodiment, the data processing method can be applied to a client accessing a distributed storage cluster, where a master-slave backup array corresponding to the distributed storage cluster is also deployed. Please refer to... Figure 4 The data processing method may include the following steps:
[0093] Step 402: Determine the primary storage node for the data to be written.
[0094] In this embodiment, the client can obtain the key value of the data to be written, and then calculate the primary storage node number based on the key value, thereby determining the primary storage node of the data to be written. For example, the client can calculate the hash value of the key value of the data to be written, and then divide the hash value by the number of nodes in the distributed storage cluster to obtain the remainder, and then determine the primary storage node number based on the remainder. Of course, the above method is only an illustrative example. In other examples, methods such as rounding down can also be used to determine the primary storage node number of the data to be written, and this specification does not impose any special restrictions on this.
[0095] Step 404: Send a data write request to the primary storage node so that the primary storage node can store the data to be written carried in the data write request, and search in the primary-slave backup matrix for the column number of the element with a value of 1 in the row corresponding to this storage node as a candidate column number; select p+1 column numbers from the candidate column numbers as the backup storage node numbers of the data to be written, where p is the fault tolerance threshold of the distributed storage cluster and p is less than k; and send a copy of the data to be written to the backup storage node according to the backup storage node number.
[0096] Based on step 402 above, after determining the primary storage node for the data to be written, the client can send a data write request to the primary storage node. Upon receiving the data write request, the primary storage node can store the data to be written carried in the data write request, and can determine the backup storage nodes for the data to be written based on the master-slave backup array, and send copies of the data to be written to each backup storage node. The processing and implementation of this part can refer to the above. Figure 2 The embodiments shown will not be described in detail here.
[0097] In this process, after receiving a copy of the data to be written, the backup storage node can cache the copy. If it determines that it has received copies of the data to be written from the primary storage node corresponding to each check row number it maintains, it calculates and stores the corresponding check blocks based on each received copy. The processing and implementation of this part can be referred to the aforementioned... Figure 3 The embodiments shown will not be described in detail here.
[0098] Step 406: Receive the write complete response returned by the primary storage node. The response is sent by the primary storage node after each backup storage node has determined that it has received the replica.
[0099] As can be seen from the above description, using the data processing scheme provided in this specification, the client can determine the primary storage node for the data to be written and send the data write request to the primary storage node. The primary storage node can determine backup storage nodes for the data to be written based on the master-slave backup array, and send copies of the data to be written to the backup storage nodes. After each backup storage node confirms receipt of the copy, it sends a write completion response to the client. This makes the performance of the data write operation on the critical path in the distributed storage cluster comparable to that of the replication mechanism, eliminating the need for striping and achieving high-performance data storage. Simultaneously, when a backup storage node confirms that it has received copies of the data to be written from the primary storage node corresponding to each check row number it maintains, it calculates and stores the corresponding check block based on each received copy, thus converting k data copies into one check block. This achieves the calculation and storage of check blocks in the erasure coding mechanism, with storage overhead comparable to the erasure coding mechanism and far lower than that of the replication mechanism. In summary, using the data processing scheme provided in this specification achieves a redundancy mechanism that combines high performance and low storage space overhead.
[0100] The following sections will describe in detail the specific implementation of this manual from four aspects: master-slave backup array, data writing, data reading, and data recovery.
[0101] I. Master-Slave Backup Array
[0102] In this embodiment, a master-slave backup array can be deployed on both the client and each storage node in the distributed storage cluster. The master-slave backup array corresponds to the distributed storage cluster, with its number of rows and columns equal to the number of storage nodes in the distributed storage cluster. The row and column numbers correspond to the node numbers of the storage nodes; that is, each storage node can correspond to one row and one column in the master-slave backup array, and the corresponding row and column numbers are the same. The elements of the master-slave backup array take values of 0 or 1. Each row and each column has k elements with a value of 1, and for any two rows, there exists a column such that the element values in that column for both rows are 1.
[0103] For example, the master-slave backup matrix can be the incidence matrix of a Symmetric Balanced Incomplete Block Design (SBIBD). The design exponent of the SBIBD is 1, and its order is k-1. Here, k = q + 1, where q is a power of a prime number, and the incidence matrix of the SBIBD is k. 2 A square matrix of order -k+1.
[0104] Taking k=4 as an example, the order of the symmetric balanced incomplete block design is 3, and the design exponent is 1. Therefore, the incidence matrix of this symmetric balanced incomplete block design is a square matrix of order 13. Please refer to... Figure 5The example shows the element values of a master-slave backup matrix in tabular form. This matrix is a 13x13 matrix where each element is either 0 or 1. Each row and each column has four elements with a value of 1. For any two rows, there exists a column such that the elements in that column for both rows are both 1. For example, the element value in the 13th column of both the first and second rows is 1.
[0105] Still with Figure 5 For example, each storage node in the corresponding distributed storage cluster corresponds to one row and one column in the master-slave backup array. For instance, storage node 1 corresponds to the first row and first column in the master-slave backup array, storage node 2 corresponds to the second row and second column, and so on.
[0106] It is important to note that the order of a square matrix and the order of a symmetric balanced incomplete block design are different technical concepts. The order of a square matrix refers to the number of rows or columns. The order of a symmetric balanced incomplete block design refers to the number of processes in the design.
[0107] In this embodiment, each storage node selects a backup storage node based on the behavior benchmark in the master-slave backup array for the data to be written, and performs encoding calculation of the copy verification block of the data to be written based on the column. The details will be described in detail in subsequent embodiments.
[0108] II. Data Writing
[0109] In this embodiment, when a client writes data to a distributed storage cluster, it can first determine the primary storage node corresponding to the data based on the hash value of the data key. For example, the hash value can be divided by the number of storage nodes in the distributed storage cluster, and the remainder can be used to determine the primary storage node number. The number of storage nodes in the distributed storage cluster can be determined based on the master-slave backup array deployed in the client.
[0110] Still with Figure 5 Taking the master-slave backup array as an example, assuming that the remainder of the quotient of the hash value of the key value of the data to be written and the number of storage nodes in the cluster is 1, then the master storage node number can be determined to be 1, that is, the master storage node of the data to be written is storage node 1. The client can then send a data write request carrying the data to be written to storage node 1 based on this number.
[0111] In this embodiment, storage node 1 acts as the primary storage node. After receiving a data write request from the client, it stores the data to be written carried in the data write request and determines the backup storage node for the data to be written based on the deployed master-slave backup array.
[0112] Specifically, storage node 1 can search for the column number with an element value of 1 in the row corresponding to its own node in the master-slave backup array as a candidate column number, and then select p+1 column numbers from the candidate column numbers as the backup storage node numbers for the data to be written.
[0113] Still with Figure 5 Taking the master-slave backup array as an example, master storage node 1 corresponds to the first row of the array. In the first row, the column numbers with an element value of 1 are 4, 10, 12 and 13, that is, the candidate column numbers are 4, 10, 12 and 13.
[0114] If the fault tolerance threshold p of the distributed storage cluster is 1, the primary storage node 1 can select two candidate column numbers as backup storage node numbers. For example, if the primary storage node 1 selects 12 and 13 as backup storage node numbers, that is, the primary storage node selects storage node 12 and storage node 13 as backup storage nodes for the data to be written.
[0115] If the fault tolerance threshold p of the distributed storage cluster is 2, the primary storage node 1 can select 3 candidate column numbers as backup storage node numbers. For example, if the primary storage node 1 selects 4, 12, and 13 as backup storage node numbers, then the primary storage node selects storage node 4, storage node 12, and storage node 13 as backup storage nodes for the data to be written.
[0116] If the fault tolerance threshold p of the distributed storage cluster is 3, the primary storage node 1 can select 4 candidate column numbers as backup storage node numbers, that is, the primary storage node selects all candidate column numbers as backup storage node numbers. Then storage nodes 4, 10, 12, and 13 are all backup storage nodes for the data to be written.
[0117] In this embodiment, after determining the backup storage nodes, the primary storage node can send copies of the data to be written to each backup storage node. Each backup storage node, upon receiving the copies of the data to be written from the primary storage node, can cache the copies and return a receipt confirmation to the primary storage node. After receiving receipt confirmations from all selected backup storage nodes, the primary storage node can determine that all copies have been received and then return a write completion response to the client. Thus, for the client, the data to be written has been successfully written to the distributed storage cluster, with performance comparable to a distributed storage cluster using a replication mechanism.
[0118] In this embodiment, for the backup storage node of the data to be written, after receiving the copy sent by the primary storage node corresponding to the check row number it maintains in the background, each copy can be encoded into a check block, thereby realizing the calculation and storage of check blocks in the erasure coding mechanism.
[0119] Taking the backup storage node 12 containing the data to be written as an example, backup storage node 12 corresponds to column 12 in the master-slave backup matrix. The row number of the element with a value of 1 in column 12 is the verification row number maintained by backup storage node 12. Please continue to refer to... Figure 5 The checksum row numbers for standby storage node 12 are 1, 3, 9, and 13. After receiving data copies from primary storage nodes 1, 3, 9, and 13, standby storage node 12 can encode corresponding checksum blocks based on these four data copies. After encoding these four data copies into checksum blocks, standby storage node 12 can delete these four cached data copies to free up storage space.
[0120] It should be noted that the data replicas of primary storage nodes 1, 3, 9, and 13 may not be sent simultaneously. If backup storage node 12 has not received all the data replicas from the primary storage nodes corresponding to these four check rows, it can cache the received data replicas and postpone the encoding of the check block. For example, if backup storage node 12 only receives the data replicas to be written from primary storage nodes 1 and 3, it can cache these two data replicas first, and then encode the check block after receiving the data replicas to be written from primary storage nodes 9 and 13.
[0121] Furthermore, the primary storage node and backup storage node in this specification are relative concepts. For data to be written 1, storage node 1 may be the primary storage node and storage node 12 may be the backup storage node. For data to be written 2, storage node 12 may be the primary storage node and storage node 8 may be the backup storage node.
[0122] III. Data Reading
[0123] In this embodiment, when a client reads data from a distributed storage cluster, it can first determine the primary storage node corresponding to the data to be read based on the hash value of the key value, and then send a data read request to that primary storage node. If the primary node is functioning correctly, it can return the stored data to the client.
[0124] For example, taking storage node 1 as the primary storage node, when the client determines that the primary storage node for the data to be read is storage node 1, it can send a data read request to primary storage node 1. Primary storage node 1 can then find the corresponding data to be read and return the found data to the client.
[0125] Therefore, since the data is not split, there is no need to access multiple storage nodes during the data reading process, resulting in high efficiency.
[0126] In this embodiment, if the primary storage node of the data to be read fails, the client can read the data from the backup storage node.
[0127] Specifically, the client can determine the backup storage node number of the data to be read from the master-slave backup array corresponding to the distributed storage cluster, and then send a data read request to the backup storage node. Taking storage node 1 as the master storage node as an example, similar to selecting a backup storage node, the client can look up the column number with a value of 1 in the first row corresponding to master storage node 1 in the master-slave backup array. These column numbers may be the backup storage node numbers. Figure 5 For example, the client can find column numbers 4, 10, 11, and 12. However, if the fault tolerance threshold of the distributed storage cluster is not 3, meaning the number of backup storage nodes is not 4 but 2 or 3, then the client cannot determine which of the storage nodes 4, 10, 11, and 12 are backup storage nodes.
[0128] In one example, a client can send query requests to all the storage nodes corresponding to the found column numbers to check whether the storage nodes store the checksum block corresponding to the data to be read. For example, the client can send query requests to storage nodes 4, 10, 11, and 12 respectively, and can include the key value of the data to be read in the query request. After receiving the query request, storage nodes 4, 10, 11, and 12 can check whether the corresponding checksum block is stored according to the key value and return the query result to the client. Assuming that storage nodes 12 and 13 store the corresponding checksum block and return a storage response to the client, the client can select one of storage nodes 12 and 13 to send a data read request. The backup storage node that receives the data read request can then recover the data to be read based on the stored checksum block and other data copies, and return it to the client.
[0129] In another example, the client can also directly send data read requests to the storage nodes corresponding to all the found column numbers. The storage node storing the checksum block of the data to be read can then recover the data to be read based on the stored checksum block and other data copies, and return it to the client. The storage node that does not store the checksum block of the data to be read can return a response indicating that it has not been stored to the client.
[0130] Of course, in other examples, the client may use other methods to determine which storage nodes contain the check block of the data to be read, and this specification does not impose any special restrictions on this.
[0131] In this embodiment, the client can determine that the main storage node is faulty after not receiving the data to be read from the main storage node within a preset response time. The client can also determine that the main storage node is faulty after not receiving the data to be read from the main storage node for several consecutive times. The processing and implementation of this part can be referred to related technologies, and will not be described in detail here.
[0132] IV. Data Recovery
[0133] Please refer to Figure 6 The data recovery process for backup storage nodes may include the following steps:
[0134] Step 602: Receive the data read request sent by the client.
[0135] Step 604: If the local node stores the verification block corresponding to the data to be read specified in the data read request, the storage node other than the faulty node in the storage node corresponding to the verification row number is determined as the first-level recovery storage node.
[0136] Step 606: Obtain the copy used to calculate the check block from the first-level recovery storage node as the recovery copy.
[0137] Step 608: Recover the data to be read based on the verification block and the recovery copy.
[0138] In this embodiment, after receiving a data read request from the client, the backup storage node can determine whether it stores a checksum corresponding to the data to be read specified in the data read request. For example, it can determine whether a corresponding checksum is stored based on the key value of the data to be read.
[0139] If a checksum block corresponding to the data to be read is stored, the recovery logic for the data to be read can be executed.
[0140] Specifically, the standby storage node can identify the storage nodes other than the faulty node (i.e. the faulty primary storage node) among the storage nodes corresponding to the verification line number it maintains as primary recovery storage nodes. These primary recovery storage nodes are the primary storage nodes of the data copies used by the standby storage node to calculate the verification block. The standby storage node can then read the copies used to calculate the verification block from these primary recovery storage nodes as recovery copies, and then recover the data to be read based on the verification block and the read recovery copies.
[0141] Still with Figure 5For example, the primary storage node is storage node 1, p is 1, and the primary storage node selects storage nodes 12 and 13 as backup storage nodes. Assuming that the primary storage node 1 fails, backup storage node 12 receives a data read request from the client, determines that it stores the checksum block corresponding to the data to be read, and then identifies the storage nodes other than the primary storage node 1 among the storage nodes corresponding to the checksum row numbers (1, 3, 9, and 13) as primary recovery storage nodes, namely storage nodes 3, 9, and 13. Next, backup storage node 12 can obtain data copies of the calculated checksum block from storage nodes 3, 9, and 13 as recovery copies, and then recover the data to be read based on the three recovery copies and the checksum block.
[0142] If p is 2, assume that primary storage node 1 selects storage nodes 4, 12, and 13 as backup storage nodes. In the distributed storage cluster, besides the failure of primary storage node 1, there may be another storage node failure. Assuming storage node 4 fails, this means the checksum block of the data to be read stored in storage node 4 has been lost. Simultaneously, two storage nodes corresponding to the checksum row numbers (1, 2, 4, and 10) maintained by storage node 13 have failed (storage nodes 1 and 4 have failed), making it impossible to recover the data to be read without triggering recursive recovery. However, only storage node 1 has failed among the storage nodes corresponding to the checksum row numbers (1, 3, 9, and 13) maintained by storage node 12, allowing recovery of the data to be read without triggering recursive recovery. Therefore, storage node 12 can perform the data recovery. The specific recovery process can be referred to the previous description, which will not be repeated here. In this case, the client can determine the backup storage node 12, which does not require triggering recursive recovery, by sending an inquiry message, and then send the data read request to the backup storage node 12.
[0143] If p is 3, primary storage node 1 selects storage nodes 4, 10, 12, and 13 as backup storage nodes. In a distributed storage cluster, besides the failure of primary storage node 1, two other storage nodes may also fail. If the other two failed storage nodes are not both backup storage nodes 4 and 12, the data to be read can be recovered without triggering recursive recovery. If backup storage nodes 4 and 12 fail simultaneously, the remaining backup storage nodes 10 and 13 will store the checksum blocks corresponding to the data to be read.
[0144] Taking storage node 10 as an example, the check rows it maintains are 1, 7, 11, and 12. This means that the check block encoding it stores is derived from the data in storage nodes 1, 7, 11, and 12. In other words, storage nodes 7, 11, and 12 are its primary recovery storage nodes. However, storage node 12 also fails, thus preventing storage node 10 from directly recovering the data to be read.
[0145] Taking backup storage node 13 as an example, its maintained check row numbers are 1, 2, 4, and 10. That is, the check block encoding it stores is derived from the data in storage nodes 1, 2, 4, and 10. In other words, storage nodes 2, 4, and 10 are its primary recovery storage nodes. However, storage node 4 also fails, which in turn causes backup storage node 13 to be unable to directly recover the data to be read.
[0146] In this scenario, recursive recovery is required to first obtain a recovery copy, and then recover the data to be read based on the recovery copy and the checksum block. That is, recursive recovery is performed when a faulty node exists in the primary recovery storage node.
[0147] Taking backup storage node 10 as an example, let x be the checksum block corresponding to the data to be read stored on it. If storage node 12 in the primary storage node fails, backup storage node 10 can first determine the storage node storing the recovery replica checksum block of the failed node as the secondary recovery storage node based on the column with an element value of 1 in the row where the failed node (storage node 12) is located in the primary-slave backup array. Please continue to refer to Figure 5 In the row containing the faulty storage node 12, the columns with an element value of 1 are 2, 8, 10, and 11. This means the secondary recovery storage nodes are storage nodes 2, 8, 10, and 11. Since none of these four secondary recovery storage nodes are faulty, a recovery command can be sent to one of them for the recovery copy in storage node 12. This secondary recovery storage node can then recover the recovery copy based on the checksum of the recovery copy it stores. Taking secondary recovery storage node 8 as an example, it can recover the recovery copy in storage node 12 based on the data in storage nodes 5, 9, and 10, as well as the checksum (denoted as y) of the recovery copy in storage node 12 stored thereon. It can then return the recovered copy to the backup storage node 10. After obtaining the recovery copy from storage node 12, the backup storage node 10 can recover the data to be read based on the checksum x of the data to be read stored thereon, the recovery copy in storage node 7, the recovery copy in storage node 11, and the recovery copy in storage node 12.
[0148] Therefore, when using the data processing scheme provided in this manual to recover data in the event of a storage node failure, if recursive recovery is required, there is at least one secondary recovery node that can recover the lost recovery copy from the failed primary recovery node. That is, the recursion depth is at most 1, and it will not bring a lot of additional performance consumption to the cluster.
[0149] It is worth noting that in this embodiment, if the backup storage node has a copy of the data to be read cached, that is, the backup storage node has not yet encoded the verification block, it can directly return the copy of the data to be read to the client.
[0150] Step 610: Return the data to be read to the client.
[0151] In this embodiment, the backup storage node can return the recovered data to the client to complete the data reading.
[0152] As can be seen from the above description, by adopting the scheme provided in this specification, every k data replicas will be encoded into one check block. For a single data set, only (p+1) / k redundant data sets need to be stored additionally, and the storage space overhead is far lower than that of the replica mechanism.
[0153] Figure 7 This is a schematic structural diagram of a device provided in an exemplary embodiment. Please refer to... Figure 7 At the hardware level, the device includes a processor 702, an internal bus 704, a network interface 706, memory 708, and non-volatile memory 710, and may also include other hardware required for its functions. One or more embodiments of this specification can be implemented in software, for example, the processor 702 reads the corresponding computer program from the non-volatile memory 710 into memory 708 and then runs it. Of course, in addition to software implementation, one or more embodiments of this specification do not exclude other implementation methods, such as logic devices or a combination of hardware and software, etc. That is to say, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.
[0154] Please refer to Figure 8 The data processing device 800 can be applied to, for example... Figure 7In the illustrated device, the device can be a storage node in a distributed storage cluster to implement the technical solution of this specification. The storage node is deployed with a master-slave backup array. The number of rows and columns of the master-slave backup array is equal to the number of storage nodes in the distributed storage cluster. The row and column numbers correspond to the node numbers of the storage nodes. The elements of the master-slave backup array are either 0 or 1. Each row and each column has k elements with a value of 1. For any two rows, there exists a column such that the element values in this column for both rows are 1. When the storage node is the master storage node for the data to be written, the data processing device 800 may include:
[0155] The write request receiving unit 801 receives a data write request sent by the client and stores the data to be written carried in the data write request;
[0156] The candidate search unit 802 searches for the column number of the row corresponding to the storage node with an element value of 1 in the master-slave backup matrix as a candidate column number.
[0157] The backup node determination unit 803 selects p+1 column numbers from the candidate column numbers as backup storage node numbers for the data to be written, where p is the fault tolerance threshold of the distributed storage cluster and p is less than k.
[0158] The copy sending unit 804 sends a copy of the data to be written to the corresponding backup storage node according to the backup storage node number, and sends a write completion response to the client after each backup storage node confirms that it has received the copy;
[0159] The backup storage node is used to cache the copy of the data to be written after receiving it, and calculate and store the corresponding check block based on each received copy when it determines that it has received the copy of the data to be written sent by the primary storage node corresponding to each check row number it maintains. The check row number is the row number of the column corresponding to the backup storage node in the primary-secondary backup array where the element value is 1.
[0160] Please refer to Figure 9 The data processing device 900 can also be applied to, for example... Figure 7In the illustrated device, the device can be a storage node in a distributed storage cluster to implement the technical solution of this specification. The storage node is deployed with a master-slave backup array. The number of rows and columns of the master-slave backup array is equal to the number of storage nodes in the distributed storage cluster. The row and column numbers correspond to the node numbers of the storage nodes. The elements of the master-slave backup array are either 0 or 1. Each row and each column has k elements with a value of 1. For any two rows, there exists a column such that the element values in this column for both rows are 1. When the storage node is a backup storage node for the data to be written, the data processing device 900 may include:
[0161] The replica cache unit 901 receives a replica of the data to be written sent by the primary storage node and caches the replica.
[0162] The receiving confirmation unit 902 sends a receiving confirmation to the primary storage node, so that after the primary storage node receives the receiving confirmations returned by each backup storage node of the data to be written, it sends a write completion response to the client.
[0163] The verification block calculation unit 903, upon determining that it has received a copy of the data to be written sent by the primary storage node corresponding to each verification row number it maintains, calculates and stores the corresponding verification block based on the received copy, wherein the verification row number is the row number of the column corresponding to the current storage node in the primary-slave backup matrix with an element value of 1.
[0164] Wherein, the primary storage node is used to, after receiving a data write request sent by the client, search in the primary-slave backup array for the column number with an element value of 1 in the row corresponding to the primary storage node as a candidate column number, select p+1 column numbers from the candidate column numbers as backup storage node numbers for the data to be written, and send a copy of the data to be written according to the backup storage node number, where p is the fault tolerance threshold of the distributed storage cluster and p is less than k.
[0165] Optionally, the data processing device 900 further includes:
[0166] The data recovery unit 904 receives a data read request sent by a client after determining that the primary storage node of the data to be read has failed. If the local node stores a checksum block corresponding to the data to be read specified in the data read request, the storage node other than the failed node among the storage nodes corresponding to the checksum row number is identified as a primary recovery storage node. A copy used to calculate the checksum block is obtained from the primary recovery storage node as a recovery copy. The data to be read is recovered based on the checksum block and the recovery copy. The data to be read is then returned to the client.
[0167] Optionally, in the case of a failed node among the primary recovery storage nodes, the process of obtaining a recovery copy from the failed node includes:
[0168] Based on the column with an element value of 1 in the row where the faulty node is located in the master-slave backup array, the storage node that stores the verification block of the recovery copy is determined as the secondary recovery storage node.
[0169] Send a recovery instruction for the recovery copy to the secondary recovery storage node, so that the secondary recovery storage node can recover the recovery copy based on the check blocks it stores;
[0170] Receive the recovery copy returned by the secondary recovery storage node.
[0171] Optionally, the verification block calculation unit 903 is further configured to delete copies of each cached data to be written after storing the verification block.
[0172] Please refer to Figure 10 The data processing device 1000 can also be applied to, for example... Figure 7 In the device shown, the device can be a client accessing a distributed storage cluster to implement the technical solution of this specification. The distributed storage cluster's storage nodes are deployed with a master-slave backup array. The number of rows and columns of the master-slave backup array is the same as the number of storage nodes in the distributed storage cluster. The row number and column number correspond to the node numbers of the storage nodes. The elements of the master-slave backup array are either 0 or 1. Each row and each column has k elements with a value of 1. For any two rows, there exists a column such that the element values in this column for both rows are 1. The data processing device 1000 includes:
[0173] Master node determination unit 1001 determines the main storage node for the data to be written;
[0174] The write request sending unit 1002 sends a data write request to the primary storage node so that the primary storage node can store the data to be written carried in the data write request. It also searches the primary-secondary backup matrix for the column number of the row corresponding to its own storage node with an element value of 1 as a candidate column number. From the candidate column numbers, it selects p+1 column numbers as the backup storage node numbers for the data to be written, where p is the fault tolerance threshold of the distributed storage cluster, and p is less than k. Finally, it sends a copy of the data to be written to the backup storage node according to the backup storage node number.
[0175] Write completion response unit 1003 receives a write completion response returned by the primary storage node. The response is sent by the primary storage node after each backup storage node has determined that it has received the replica.
[0176] The backup storage node is used to cache the copy of the data to be written after receiving it, and calculate and store the corresponding check block based on each received copy when it determines that it has received the copy of the data to be written sent by the primary storage node corresponding to each check row number it maintains. The check row number is the row number of the column corresponding to the backup storage node in the primary-secondary backup array where the element value is 1.
[0177] Optionally, the client also deploys the master-slave backup array, and the master node determination unit 1001 is further used to determine the master storage node of the data to be read;
[0178] The write request sending unit 1002 is further configured to, in the event of a primary storage node failure, determine the backup storage node number of the data to be read based on the column number of the row corresponding to the primary storage node in the primary-slave backup array where the element value is 1; send a data read request to the backup storage node according to the backup storage node number, so that the backup storage node, if it stores a check block corresponding to the data to be read, determines the storage node corresponding to the check block row number as a first-level recovery storage node; obtain the copy used to calculate the check block from the first-level recovery storage node as a recovery copy, so as to recover the data to be read based on the check block and the recovery copy; and receive the data to be read returned by the backup storage node.
[0179] Based on the same concept as the methods described above, this specification also provides an electronic device, including: a processor; a memory for storing processor-executable instructions; wherein the processor performs the steps of the method as described in any of the above embodiments by executing the executable instructions.
[0180] Based on the same concept as the methods described above, this specification also provides a computer-readable storage medium having computer instructions stored thereon that, when executed by a processor, implement the steps of the methods as described in any of the above embodiments.
[0181] Based on the same concept as the methods described above, this specification also provides a computer program product, including a computer program / instructions that, when executed by a processor, implement the steps of the methods as described in any of the above embodiments.
Claims
1. A data processing method, characterized in that, The method is applied to storage nodes in a distributed storage cluster, wherein each storage node is deployed with a master-slave backup array. The number of rows and columns in the master-slave backup array is equal to the number of storage nodes in the distributed storage cluster. The row and column numbers correspond to the node numbers of the storage nodes. The elements of the master-slave backup array are either 0 or 1. Each row and each column has k elements with a value of 1. For any two rows, there exists a column such that the elements in this column of both rows have a value of 1. When the storage node is the master storage node for the data to be written, the method includes: Receive a data write request sent by the client and store the data to be written carried in the data write request; In the master-slave backup array, find the column number of the row corresponding to this storage node where the element value is 1 as the candidate column number; Select p+1 column numbers from the candidate column numbers as backup storage node numbers for the data to be written, where p is the fault tolerance threshold of the distributed storage cluster and p is less than k; The copy of the data to be written is sent to the corresponding backup storage node according to the backup storage node number, and after each backup storage node confirms that the copy has been received, a write completion response is sent to the client. The backup storage node is used to cache the copy of the data to be written after receiving it, and calculate and store the corresponding check block based on each received copy when it determines that it has received the copy of the data to be written sent by the primary storage node corresponding to each check row number it maintains. The check row number is the row number of the column corresponding to the backup storage node in the primary-secondary backup array where the element value is 1.
2. A data processing method, characterized in that, The method is applied to storage nodes in a distributed storage cluster, wherein each storage node is deployed with a master-slave backup array. The number of rows and columns in the master-slave backup array is equal to the number of storage nodes in the distributed storage cluster. The row and column numbers correspond to the node numbers of the storage nodes. The elements in the master-slave backup array are either 0 or 1. Each row and each column has k elements with a value of 1. For any two rows, there exists a column such that the elements in this column of both rows have a value of 1. When the storage node is a backup storage node for data to be written, the method includes: Receive a copy of the data to be written from the primary storage node, and cache the copy; Send a receive confirmation to the primary storage node so that the primary storage node can send a write completion response to the client after receiving the receive confirmations from each backup storage node of the data to be written. If it is determined that a copy of the data to be written sent by the primary storage node corresponding to each verification row number has been received, the corresponding verification block is calculated and stored based on the received copy, wherein the verification row number is the row number of the column corresponding to this storage node in the primary-slave backup array where the element value is 1. Wherein, the primary storage node is used to, after receiving a data write request sent by the client, search in the primary-slave backup array for the column number with an element value of 1 in the row corresponding to the primary storage node as a candidate column number, select p+1 column numbers from the candidate column numbers as backup storage node numbers for the data to be written, and send a copy of the data to be written according to the backup storage node number, where p is the fault tolerance threshold of the distributed storage cluster and p is less than k.
3. The method according to claim 2, characterized in that, The method further includes: Receive data read requests sent by clients, which are sent by clients after determining that the main storage node of the data to be read has failed; If the node stores the verification block corresponding to the data to be read specified in the data read request, the storage node other than the faulty node in the storage node corresponding to the verification row number is determined as the first-level recovery storage node. Obtain the copy used to calculate the check block from the first-level recovery storage node as the recovery copy; The data to be read is recovered based on the verification block and the recovery copy; The data to be read is returned to the client.
4. The method according to claim 3, characterized in that, In the event that a faulty node exists among the primary recovery storage nodes, the process of obtaining a recovery copy from the faulty node includes: Based on the column with an element value of 1 in the row where the faulty node is located in the master-slave backup array, the storage node that stores the verification block of the recovery copy is determined as the secondary recovery storage node. Send a recovery instruction for the recovery copy to the secondary recovery storage node, so that the secondary recovery storage node can recover the recovery copy based on the check blocks it stores; Receive the recovery copy returned by the secondary recovery storage node.
5. The method according to claim 2, characterized in that, The method further includes: After storing the verification block, delete the cached copies of each piece of data to be written.
6. A data processing method, characterized in that, A method for clients accessing a distributed storage cluster, wherein the storage nodes of the distributed storage cluster are deployed with master-slave backup arrays, the number of rows and columns of the master-slave backup arrays being equal to the number of storage nodes in the distributed storage cluster, and the row and column numbers corresponding to the node numbers of the storage nodes, wherein the elements of the master-slave backup arrays are either 0 or 1, each row and each column has k elements with a value of 1, and for any two rows, there exists a column such that the element values in this column for both rows are 1, the method comprising: Determine the primary storage node for the data to be written; A data write request is sent to the primary storage node so that the primary storage node can store the data to be written carried in the data write request. The primary storage node searches for the column number with an element value of 1 in the row corresponding to its own storage node in the master-slave backup array as a candidate column number. Among the candidate column numbers, p+1 column numbers are selected as the backup storage node numbers for the data to be written, where p is the fault tolerance threshold of the distributed storage cluster and p is less than k. The backup storage node numbers are then used to send a copy of the data to be written to the backup storage node. Receive a write complete response returned by the primary storage node, which is sent by the primary storage node after each backup storage node has determined that it has received the replica; The backup storage node is used to cache the copy of the data to be written after receiving it, and calculate and store the corresponding check block based on each received copy when it determines that it has received the copy of the data to be written sent by the primary storage node corresponding to each check row number it maintains. The check row number is the row number of the column corresponding to the backup storage node in the primary-secondary backup array where the element value is 1.
7. The method according to claim 6, characterized in that, The client also deploys the master-slave backup array, and the method further includes: Determine the primary storage node for the data to be read; In the event of a failure of the primary storage node, the backup storage node number of the data to be read is determined based on the column number of the row corresponding to the primary storage node in the primary backup array, where the element value is 1. A data read request is sent to the backup storage node according to the backup storage node number, so that the backup storage node, if it has a check block corresponding to the data to be read, determines the storage node corresponding to the check line number as the first-level recovery storage node; and obtains the copy used to calculate the check block from the first-level recovery storage node as a recovery copy, so as to recover the data to be read based on the check block and the recovery copy. Receive the data to be read returned by the backup storage node.
8. An electronic device, characterized in that, include: processor; A memory for storing processor-executable instructions; wherein the processor implements the steps of the method as described in any one of claims 1-7 by executing the executable instructions.
9. A computer-readable storage medium, characterized in that, It stores computer instructions that, when executed by a processor, implement the steps of the method as described in any one of claims 1-7.
10. A computer program product, characterized in that, Includes a computer program / instructions that, when executed by a processor, implement the steps of the method as described in any one of claims 1-7.