Distributed storage node continuous capacity expansion method and device and medium

By introducing key-value updates, data migration and termination return modules into distributed storage clusters, the problem of inefficiency during continuous expansion of multiple nodes is solved, efficient data migration and hash key-value updates are realized, and cluster expansion efficiency is significantly improved.

CN119743493AActive Publication Date: 2025-04-01INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202411854757.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-16
Publication Date
2025-04-01
Estimated Expiration
2044-12-16

AI Technical Summary

Technical Problem

In a distributed storage cluster, when multiple nodes continuously expand capacity, it is inefficient and takes a lot of time, which affects the normal operation of the cluster.

Method used

By introducing key-value update modules, data migration modules and termination return modules into the cluster, continuous expansion of distributed storage nodes is achieved. When a new node is joined, the hash key value is updated and the data blocks are traversed for migration operations. If a new node joins the cluster during the migration process, stop the subsequent migration and return to the hash key value update step.

Benefits of technology

By dismantling the data migration process to migration of multiple data blocks and using atomic operations to ensure that the migration is not interrupted, the efficiency of continuous expansion of cluster nodes is improved and time-consuming is reduced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119743493A_ABST
    Figure CN119743493A_ABST
Patent Text Reader

Abstract

The invention discloses a distributed storage node continuous capacity expansion method, a distributed storage node continuous capacity expansion device and a medium, relates to the technical field of distributed storage, is used for realizing cluster node capacity expansion, and provides the distributed storage node continuous capacity expansion method aiming at the problem of low efficiency of a mode of independently performing capacity expansion on nodes one by one at present. And disassembling the data migration stage with the longest time consumption into migration of each data block. And the migration process of the minimum data block is ensured not to be interrupted by the atomic operation, and the accuracy and consistency of the data are ensured. On this basis, a new node is added at any moment in the data migration stage, that is, the data migration process can be interrupted for the data block with the minimum granularity. The method does not need to traverse other subsequent data blocks, and returns to the hash key value calculation stage, thereby greatly improving the efficiency of continuous capacity expansion of cluster nodes.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of distributed storage technology, and in particular to a distributed storage node continuous expansion method, device and medium. Background Art

[0002] In hyper-converged products, the data distribution of distributed storage clusters is mostly calculated using a two-layer hash algorithm. Based on the two-layer hash algorithm, there is a strong correlation between the storage location of all data in the cluster and the capacity of each node. Therefore, when the capacity of the cluster changes, the location of all data must change accordingly. Node expansion is a common scenario in which cluster capacity changes. Therefore, when the cluster expands the capacity of nodes, a large amount of data migration is required.

[0003] Since the data migration process takes a long time and once it starts, new nodes cannot be added in the middle, and the capacity can only be expanded one by one, it takes a lot of time to expand the capacity of multiple nodes in the cluster, and the expansion efficiency is extremely low, which seriously affects the normal operation of the cluster.

[0004] Therefore, technicians in this field are in urgent need of a distributed storage node continuous expansion method to solve the problem that the current cluster is inefficient and takes a lot of time when multiple nodes are continuously expanded. Summary of the invention

[0005] The purpose of the present invention is to provide a distributed storage node continuous expansion method, device and medium to solve the problem that the current cluster is inefficient and takes a lot of time when multiple nodes are continuously expanded.

[0006] In order to solve the above technical problems, the present invention provides a distributed storage node continuous expansion method, comprising:

[0007] When a new node joins the cluster, the hash key value of the cluster is calculated and updated according to the capacity of the new node;

[0008] Traversing all data blocks stored in the cluster, and judging whether each data block needs to be migrated according to the updated hash key value; if migration is required, performing a data migration operation on the current data block; wherein the data migration operation is an atomic operation;

[0009] During the data migration process of each of the data blocks, if a new node joins the cluster, the subsequent traversal is stopped and the process returns to the step of calculating and updating the hash key value of the cluster according to the capacity of the newly added node.

[0010] In a possible embodiment, the method further includes:

[0011] During the process of calculating and updating the hash key value of the cluster, if a new node joins the cluster, the calculation is stopped and the process returns to the step of calculating and updating the hash key value of the cluster according to the capacity of the newly added node.

[0012] In a possible embodiment, after the data block migration is completed, the method further includes:

[0013] The cleaning flag of the data block is set to a to-be-cleaned state; wherein the cleaning flag includes two states: a to-be-cleaned state and an initial state;

[0014] The method further comprises:

[0015] If no new node joins the cluster during the traversal of each data block, traverse all the data blocks in the cluster to determine whether the cleaning flag of each data block is in a to-be-cleaned state; if it is in a to-be-cleaned state, perform a data cleaning operation on the current data block; wherein the data cleaning operation is an atomic operation;

[0016] During the data cleaning process of each of the data blocks, if a new node joins the cluster, the subsequent traversal is stopped and the process returns to the step of calculating and updating the hash key value of the cluster according to the capacity of the newly added node.

[0017] In a possible embodiment, after traversing all the data blocks in the cluster and determining whether the cleaning flag of each data block is in a to-be-cleaned state, the method further includes:

[0018] If it is not in the to-be-cleaned state, determining whether there is an error in the data of the current data block;

[0019] If yes, an error message is returned, the cluster is controlled to enter maintenance mode, and the method is terminated.

[0020] In a possible embodiment, determining whether an error occurs in the data of the current data block includes:

[0021] Determine whether the values ​​of the data migration flag bit and the migration completion flag bit corresponding to the current data block are equal, if not, determine that an error occurs in the data of the data block;

[0022] The data migration flag and the migration completion flag are both preset flags, and each data block corresponds to one data migration flag and one migration completion flag;

[0023] The method further comprises:

[0024] Whenever a new node joins the cluster, the value of the preset key value change flag is automatically incremented; wherein the key value change flag corresponds to the cluster;

[0025] Before performing the data migration operation on the current data block, the method further includes:

[0026] Assign the value of the key value change flag to the data migration flag corresponding to the current data block;

[0027] After performing the data migration operation on the current data block, the method further includes:

[0028] The value of the data migration flag is assigned to the migration completion flag corresponding to the current data block.

[0029] In a possible embodiment, judging whether each data block needs to be migrated according to the updated hash key value includes:

[0030] Determine the storage location of the current data block through a consistent hashing algorithm according to the updated hash key value;

[0031] Determining whether the newly determined storage location is the same as the actual storage location of the current data block;

[0032] If they are different, the current data block needs to be migrated.

[0033] In a possible embodiment, calculating and updating the hash key value of the cluster according to the capacity of the newly added node includes:

[0034] Determine the hash key value according to a first formula;

[0035] Among them, the first formula is:

[0036]

[0037] n represents the total number of nodes; a i represents the capacity of the i-th node; f(a1,a2,…,a n ) represents the greatest common divisor of the capacities of all nodes; x represents a constant coefficient.

[0038] In order to solve the above technical problems, the present invention also provides a distributed storage node continuous expansion device, comprising:

[0039] A key value update module, used to calculate and update the hash key value of the cluster according to the capacity of the newly added node when a new node joins the cluster;

[0040] A data migration module, used to traverse all data blocks stored in the cluster, and determine whether each data block needs to be migrated according to the updated hash key value; if migration is required, perform a data migration operation on the current data block; wherein the data migration operation is an atomic operation;

[0041] The termination return module is used to stop the subsequent traversal and re-trigger the key value update module if a new node joins the cluster during the data migration process of each data block.

[0042] In order to solve the above technical problems, the present invention also provides a distributed storage node continuous expansion device, comprising:

[0043] Memory for storing computer programs;

[0044] A processor is used to implement the steps of the distributed storage node continuous expansion method as described above when executing the computer program.

[0045] To solve the above technical problem, the present invention also provides a non-volatile storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the distributed storage node continuous expansion method as described above are implemented.

[0046] The present invention provides a method for continuous expansion of distributed storage nodes, which disassembles the entire data migration process into the migration process of each data block. And the migration of each data block is implemented by atomic operations to ensure that the migration of the data block cannot be interrupted. Based on this, the method also determines whether there is a new node joining the cluster during the data migration process. If so, the subsequent data block migration is no longer performed, and the method directly returns to the step of determining the hash key value (key value) to re-determine the new key value. Since the data migration process in the method is implemented by atomic operations, when a new node joins the cluster at any time during the data migration process, the current data block migration can be guaranteed to be completed normally, and there is no need to perform subsequent migration of other data blocks. It directly returns to the step of determining the key value to determine the new key value after the new node joins, thereby realizing continuous expansion of cluster nodes.

[0047] In summary, this method breaks down the longest data migration phase into the migration of individual data blocks when cluster nodes are continuously expanded. Atomic operations ensure that the migration process of the smallest data block cannot be interrupted, ensuring the accuracy and consistency of the data. Based on this, if a new node joins at any time during the data migration phase, the data migration process can be interrupted with the data block as the minimum granularity, and return to the key value calculation phase, thereby greatly improving the efficiency of continuous expansion of cluster nodes.

[0048] The distributed storage node continuous expansion device and non-volatile storage medium provided by the present invention correspond to the above method and have the same effect as above. BRIEF DESCRIPTION OF THE DRAWINGS

[0049] In order to more clearly illustrate the embodiments of the present invention, the following briefly introduces the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0050] Figure 1 This is a schematic diagram of data distribution before node expansion;

[0051] Figure 2 This is a schematic diagram of data distribution after node expansion;

[0052] Figure 3 A flow chart of a distributed storage node continuous expansion method provided by an embodiment of the present invention;

[0053] Figure 4 A flowchart of another distributed storage node continuous expansion method provided by an embodiment of the present invention;

[0054] Figure 5 A structural diagram of a distributed storage node continuous capacity expansion device provided by an embodiment of the present invention;

[0055] Figure 6 A structural diagram of another distributed storage node continuous expansion device provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0056] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0057] The core of the present invention is to provide a method, device and medium for continuous capacity expansion of distributed storage nodes.

[0058] In order to enable those skilled in the art to better understand the solution of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.

[0059] In related technologies, data distribution calculation in a distributed storage cluster is generally obtained through a two-layer hash ring calculation. The advantage of a two-layer hash ring is that it does not require additional space to store data location information, and the physical location information can be directly calculated based on the logical location information of the data. However, this method also has a disadvantage, that is, when the total capacity of the cluster changes, the location of all data in the cluster must be recalculated, otherwise the physical location of the data will be lost.

[0060] For example, Figure 1 As shown in the figure, assume that there are three nodes 1 to 3 with the same capacity in the distributed storage cluster. The capacity ratio of these nodes 1 to 3 in the cluster is 1:1:1, that is, the hash key value (key value) of the consistent hashing algorithm is 3. Furthermore, according to the consistent hashing algorithm, if the logical address of a data block is 00000003, then the physical location of the data block corresponds to Figure 2 In node 1 of .

[0061] Further, such as Figure 2 As shown in the figure, when a new node 4 is added, assuming that the capacity of the newly added node 4 is consistent with the capacity of the original nodes 1 to 3, the key value of the consistent hashing algorithm needs to be updated to 4. At this time, if the location of the original data remains unchanged, the consistent hashing algorithm will fail, and the physical location information of all data will be lost, which is unacceptable.

[0062] Therefore, when a new node joins the cluster, all data needs to be redistributed. Take the data block with the logical address 00000003 as an example. Before the node joins, the location of the data block is on node 1. After the node joins, the key value changes, and the data block needs to be migrated from node 1 to node 4. When a new node joins the cluster, all data in the cluster needs to be determined and migrated to the new location, which takes a lot of time.

[0063] In addition, when new nodes are added to the cluster continuously, that is, when the cluster is continuously expanding nodes, the key value needs to be updated every time a new node is added. And all data in the cluster needs to be based on a unified key value to ensure consistency during migration judgment and data migration. Therefore, currently when expanding nodes, only nodes can be expanded one by one. And the next node can only be expanded after the previous node expansion is completed. As a result, the entire process of continuous node expansion in the cluster is very time-consuming and the expansion efficiency is extremely low.

[0064] To solve the above problems, the present invention provides a distributed storage node continuous expansion method, such as Figure 3 As shown, including:

[0065] S11: When a new node joins the cluster, the hash key value of the cluster is calculated and updated according to the capacity of the new node.

[0066] S21: traverse all data blocks stored in the cluster, and determine whether each data block needs to be migrated according to the updated hash key value; if migration is required, perform data migration operations on the current data block.

[0067] Among them, the data migration operation is an atomic operation.

[0068] S22: During the data migration process of each data block, if a new node joins the cluster, the subsequent traversal is stopped and the process returns to step S11.

[0069] The above step S11 is a process of recalculating the key value according to the capacity of the new node when a new node joins the cluster. In this embodiment, the actual address of the subsequent calculation data can be realized by the consistent hashing algorithm. Therefore, in step S11, the key value determined here is also the key value of the consistent hashing algorithm.

[0070] It should be noted that this embodiment does not limit how to determine the key value. However, this embodiment provides a possible implementation scheme:

[0071] In step S11, the key value is determined by using the first formula.

[0072] Among them, the first formula is:

[0073]

[0074] n represents the total number of nodes; a i represents the capacity of the i-th node; f(a1,a2,…,a n ) represents the greatest common divisor of the capacities of all nodes; x represents a constant coefficient.

[0075] After re-determining the new key value in step S11, step S21 can determine whether the data stored in the cluster needs to be migrated according to the updated key value. It should be noted that in this method, the data in the time cluster is in units of data blocks, and the migration determination of each data block is performed in turn by traversal, and the data migration is performed on the data blocks that need to be migrated.

[0076] In short, step S21 first divides the redistribution of all data in the cluster into the redistribution of each data block. For each data block, a complete traversal process includes migration determination and possible data migration (subsequent data migration is performed only when the migration determines that the data block needs to be migrated).

[0077] The present invention does not impose any restrictions on the size of the divided data blocks, which can be determined according to the actual data processing needs. For example, in a possible implementation scenario, it is easier to implement and has a higher processing efficiency to process data of 4M in size. Then the data blocks divided in this method can be 4M in size.

[0078] In addition, for the data migration determination in step S21. As can be seen from the above, when the key value is updated, all data in the cluster needs to be redistributed. Then, according to whether the logical address determined after the data block is redistributed is consistent with the original logical address, it can be simply and efficiently determined whether the data block needs to be migrated. Correspondingly, for the data block migration determination method provided above, this embodiment also provides a specific implementation plan, and the above step S21 determines whether each data block needs to be migrated according to the updated hash key value specifically includes:

[0079] S211: Determine the storage location of the current data block through a consistent hashing algorithm according to the updated hash key value.

[0080] S212: Determine whether the newly determined storage location is the same as the actual storage location of the current data block. If they are different, the current data block needs to be migrated.

[0081] In addition, it is not difficult to understand that if the newly determined storage location is the same as the actual storage location of the current data block, the current data does not need to be migrated.

[0082] Afterwards, if it is determined that migration is required, step S21 of the method performs data migration. It should be noted that in the method, the migration of data blocks is achieved through atomic operations. Atomic operations refer to operations that will not be interrupted by the thread scheduling mechanism. That is, in the method, the data migration process of each data block will not be interrupted by any thread.

[0083] That is, in combination with steps S211 and S212 provided in the above embodiment, when traversing a data block, the complete process of step S21 in the present method includes:

[0084] S211: Determine the storage location of the current data block through a consistent hashing algorithm according to the updated hash key value.

[0085] S212: Determine whether the newly determined storage location is the same as the actual storage location of the current data block. If they are different, go to step S213. If they are the same, traverse the next data block.

[0086] S213: Migrate data of the current data block through atomic operations.

[0087] During the traversal process of each data block in the cluster (including the migration determination of each data block and the data migration of the data blocks that need to be migrated), if a new node joins the cluster, if it is the node expansion solution in the above-mentioned related technology, the expansion of the newly added node needs to be shelved first, and the expansion of the newly added node can be carried out after the current node expansion process is fully executed.

[0088] However, for this method, if a new node joins during the process of a node expansion. Since the most time-consuming stage of the entire node expansion process is the data migration stage, the time required for the key value calculation process is very small compared to the data migration stage. Therefore, if a new node joins during a node expansion stage, it is highly likely to occur during the data migration stage. Therefore, in this method, step S22 is used to process the new node joining request that occurs during the data migration stage. When a new node joins during the data migration stage, the data block traversal in step S21 is interrupted. It can be seen from the description of the above step S21 that in step S21, migration judgment and data migration are performed in units of data blocks, and data migration is implemented by uninterruptible atomic operations. If a new node joins during the migration judgment, since the migration judgment only involves the calculation and comparison of the logical address of the data block, and does not involve the actual data input and output (IO) operation, step S22 directly interrupts the migration judgment. When the new node joins during the migration of the data block, since the migration of the data block is implemented by atomic operations, the migration of the data block is a whole and cannot be interrupted. Therefore, step S22 can only wait until the current data block is migrated, interrupt the traversal of subsequent data blocks and return to the key value calculation stage of step S11.

[0089] It is not difficult to understand that since this method decomposes the redistribution of data in the cluster into the redistribution of multiple data blocks, it takes the approach of traversing each data block in turn and performing migration determination and data migration. In the data migration phase, if a new node joins during the traversal of any data block (migration determination and possible data migration), the traversal of subsequent data blocks is terminated, and the key value is re-determined in step S11, and then the data migration phase is re-entered to recalculate the data distribution in the cluster with the new key value.

[0090] In summary, the method for continuous expansion of distributed storage nodes provided by the present invention divides the complete expansion process of a node into a key value calculation stage (i.e., step S1X) and a data migration stage (i.e., step S2X). The data migration stage, which takes the longest time and cannot be interrupted, is further divided into a migration process of multiple uninterruptible data blocks. Each data block includes a migration determination step, which can be interrupted because it does not involve actual operations (i.e., it only involves calculations and comparisons, and does not modify any data in the cluster). And if the current data block needs to be migrated, uninterruptible data migration is performed through atomic operations. Although it is also uninterruptible, the data migration in this method is based on data blocks, and the migration of a single data block cannot be interrupted, but the data migration of the entire cluster can be interrupted in data blocks, which greatly improves the granularity of data migration. Furthermore, when a new node joins the node expansion, the current data migration stage can be interrupted in data blocks, and the first stage, i.e., the key value calculation stage, is returned to achieve continuous node expansion.

[0091] It can be seen that when the nodes of the cluster are continuously expanded, this method does not need to expand each node separately, and the expansion of the next node can only be carried out after the expansion of the previous node is completed. Instead, the most time-consuming data migration stage in the node expansion process is divided into finer granularity, so that when a new node joins the data migration stage, it can be interrupted according to the granularity and return to the key value calculation stage to realize the expansion of the newly added node, thereby greatly improving the efficiency of continuous expansion of cluster nodes.

[0092] On the other hand, in addition to the above-mentioned situation where a new node is added during the data migration phase to interrupt the current process and return to the key value calculation phase, this embodiment also provides another possible implementation scheme, and the above-mentioned method further includes:

[0093] S12: During the process of calculating and updating the hash key value of the cluster, if a new node joins the cluster, the calculation is stopped and the process returns to step S11.

[0094] It is easy to understand that when calculating the key value of the cluster, no actual data operation is involved (especially data migration has not started yet). Therefore, the current calculation can be interrupted directly at this time, and the key value can be recalculated based on the capacity of the newly added node.

[0095] That is, this embodiment also provides an interruption mechanism in the key value calculation stage. When a new node joins the cluster in the key value calculation stage, the current process can also be interrupted and return to the first step of the method, i.e., step S11, to start a new key value calculation.

[0096] In summary, this embodiment provides a new interruptible node in a node expansion process for the implementation of continuous expansion of cluster nodes, so that when a new node is added at any time during the node expansion process, the current process can be interrupted more quickly to carry out a new node expansion process, thereby further improving the expansion efficiency.

[0097] On the other hand, in actual applications, depending on the node expansion scheme adopted, the stages included in a complete node expansion process are also different. However, no matter which node expansion scheme is used, it at least includes the key value calculation stage and the data migration stage. Therefore, in the above embodiment, a node continuous expansion scheme is provided for the key value calculation stage and the data migration stage.

[0098] Furthermore, this embodiment provides a possible node expansion solution, and a complete node expansion process includes: a key value calculation phase, a data migration phase, and a data cleaning phase.

[0099] The node expansion process is triggered by the addition of new nodes. If it is not interrupted, the key value calculation phase, data migration phase, and data cleaning phase will be carried out in sequence. When the data cleaning phase is over, it is considered that a complete node expansion process is completed.

[0100] It is easy to understand that the data migration process is used to determine whether a data block needs to be migrated, and when it is determined that the data block needs to be migrated, the data block is migrated from the original logical address to the newly determined logical address. It can be seen from the above that after the data block is migrated, the data at the original logical address has not been processed. If other data blocks are assigned to this logical address after recalculating the distribution, the original data of this logical address can be overwritten after the data migration. However, if no data block points to this logical address, the data above this logical address is redundant data and needs to be cleaned up to ensure the consistency of data in the cluster. Based on this, the present embodiment also adds a data cleaning stage after the data migration stage. Specifically, with respect to the implementation of the data cleaning stage, the above method also includes, after each data block migration is completed:

[0101] S23: Set the cleaning flag position of the data block to a waiting-to-clean state.

[0102] The clean flag (clean) includes two states: a state to be cleaned (true) and an initial state (false).

[0103] Accordingly, if no new node joins the cluster during the traversal of each data block, that is, when the data migration phase ends, the method further includes:

[0104] S311: traverse all data blocks in the cluster to determine whether the cleaning flag of each data block is in the to-be-cleaned state. If it is in the to-be-cleaned state, go to step S312.

[0105] It is easy to understand that if it is not in the state to be cleaned, the next data block is traversed and its cleaning flag is determined to be in the state to be cleaned.

[0106] S312: Perform data cleaning operation on the current data block.

[0107] Among them, the data cleaning operation is an atomic operation.

[0108] S32: During the data cleaning process of each data block, if a new node joins the cluster, the subsequent traversal is stopped and the process returns to step S11.

[0109] It can be seen from the above steps that this embodiment provides a redundant data cleaning solution, that is, after the data migration is completed, the redundant data at the original address is cleaned up to ensure the consistency of the data stored in the cluster before and after the node expansion. In addition, although the data cleaning stage is much less time-consuming than the data migration stage. However, considering that the data cleaning stage is also part of the node expansion, in order to improve the efficiency of continuous node expansion, this embodiment also adds a corresponding interruption mechanism in the data cleaning stage. That is, when a new node is added in the data cleaning stage, the current process is interrupted and returned to the first step S11 of the node expansion process. In addition, since the data cleaning operation involves specific data processing, this embodiment also uses atomic operations to implement uninterruptible data cleaning to avoid confusion in the data in the cluster due to interruptions.

[0110] Based on the implementation schemes provided in this embodiment and the above embodiments, the entire node continuous expansion process is as follows: Figure 4 As shown, it includes three stages: key value calculation stage, data migration stage and data cleaning stage. And there is an interruption mechanism triggered by the addition of new nodes in each stage. After the interruption, it returns to the beginning of the entire process, that is, re-enters the key value calculation stage. In addition, in the data migration stage and the data cleaning stage, the migration and cleaning based on atomic operations are performed in units of data blocks. The migration and cleaning of each data block cannot be interrupted, but the migration and cleaning of data in the entire cluster can be interrupted at the granularity of data blocks. Until the three stages of the key value calculation stage, the data migration stage and the data cleaning stage are successfully executed without any new nodes joining, a complete set of node continuous expansion processes is completed. Compared with the method of expanding nodes one by one, and the next node expansion can only be carried out after the expansion of one node is completed, the node expansion achieved by this method can bring higher efficiency and significantly reduce time consumption.

[0111] On the other hand, this embodiment provides a further implementation scheme based on the redundant data clearing scheme provided in the above embodiment. In the judgment of step S311, if it is not in the state to be cleared, the method further includes:

[0112] S313: Determine whether there is an error in the data of the current data block, if so, go to step S314.

[0113] S314: Return an error message, control the cluster to enter maintenance mode, and terminate this method.

[0114] That is, this embodiment also provides a detection mechanism for whether data migration is wrong during the data cleaning stage. Specifically, for a data block whose cleaning flag is not in the to-be-cleaned state, this data block may be a target data block that has undergone data migration (i.e., a new data block after data migration), an original data block that is about to undergo data migration (i.e., an old data block before data migration), or a data block that does not require data migration. Since the most time-consuming and most prone to problems in the entire node expansion process is the data migration stage, error detection is performed on the above-mentioned data blocks to further avoid problems such as data corruption when implementing node expansion in this method.

[0115] Furthermore, as to how to implement the judgment of whether a data block has a data error in the above step S313, one possible solution is to implement it through a data verification mechanism. However, this embodiment also provides another possible implementation scheme, and the above step S313 is specifically as follows:

[0116] It is determined whether the values ​​of the data migration flag bit and the migration completion flag bit corresponding to the current data block are equal. If not, it is determined that the data of the data block is erroneous.

[0117] The data migration flag and the migration completion flag are both preset flags, and each data block corresponds to a data migration flag and a migration completion flag.

[0118] Accordingly, to support the implementation of step S313 provided in this embodiment, the method further includes:

[0119] S13: Whenever a new node joins the cluster, the value of the preset key value change flag is automatically incremented.

[0120] Among them, the key value change flag bit (cluster age) corresponds to the cluster. That is, a cluster only needs one key value change flag bit. And in a possible embodiment, every time a new node joins the cluster, the key value change flag bit is incremented by 1. At this time, the specific value of the key value change flag bit can indicate how many new nodes have joined the cluster.

[0121] Before performing the data migration operation on the current data block in step S213, the method further includes:

[0122] S214: Assign the value of the key value change flag to the data migration flag corresponding to the current data block.

[0123] After performing the data migration operation on the current data block in step S213, the method further includes:

[0124] S215: Assign the value of the data migration flag to the migration completion flag corresponding to the current data block.

[0125] It can be seen from the above steps S214 and S215 that before and after a data block is migrated, the data migration flag bit (latest) and the migration completion flag bit (stable) corresponding to the data block are assigned values ​​respectively. Among them, each data block corresponds to a data migration flag bit and a migration completion flag bit. The data migration flag bit is used to indicate that data migration will occur in this data block, so a new value is assigned before the data block is migrated. Similarly, the migration completion flag bit indicates that data migration is completed for this data block, so a new value is assigned after the data block is migrated.

[0126] A possible self-increment mechanism based on the above-mentioned key value change flag is that each time a node is added, the key value change flag is incremented by 1. Based on the assignment method of the above-mentioned steps S214 and S215, it can be known that whenever the data migration flag of a data block is equal to the current key value change flag, that is, the number of newly added nodes, it means that this data block is a data block that will undergo data migration based on the key value of the most recent node added. Similarly, whenever the migration completion flag of a data block is equal to the current data migration flag (or key value change flag), it means that this data block is a data block that has completed data migration based on the key value of the most recent node added. Based on these three flags and the cleanup flag of the above-mentioned embodiment, management of each stage in the node expansion process can be achieved.

[0127] Furthermore, based on the above steps S214 and S215, it can be known that, regardless of whether a data block undergoes data migration or not, its data migration flag and migration completion flag in the data cleaning phase should be equal under normal circumstances. If they are not equal, then this data block must have undergone data migration and an error occurred during the data migration. It is highly likely that the data in this data block has an error. In summary, this embodiment can conveniently and efficiently determine whether the data in the data block has an error by setting several flags, thereby further ensuring that data loss and other issues do not occur in the cluster.

[0128] In addition to the embodiment of a distributed storage node continuous expansion method provided in the above embodiment, the present invention also provides an embodiment corresponding to a computer program product. A computer program product includes a computer program / instruction, and when the computer program / instruction is executed by a processor, the steps of the distributed storage node continuous expansion method described in any of the above embodiments can be implemented.

[0129] Since the embodiments of the computer program product part correspond to the embodiments of the method part, please refer to the description of the embodiments of the method part for the embodiments of the computer program product part, which will not be repeated here.

[0130] In the above embodiment, a method for continuous expansion of distributed storage nodes is described in detail, and the present invention also provides a corresponding embodiment of a distributed storage node continuous expansion device. It should be noted that the present invention describes the embodiments of the device part from two perspectives, one is based on the perspective of functional modules, and the other is based on the perspective of hardware.

[0131] Based on the functional module perspective, such as Figure 5 As shown, this embodiment provides a distributed storage node continuous expansion device, including:

[0132] The key value update module 11 is used to calculate and update the hash key value of the cluster according to the capacity of the newly added node when a new node joins the cluster;

[0133] The data migration module 12 is used to traverse all data blocks stored in the cluster and determine whether each data block needs to be migrated according to the updated hash key value; if migration is required, perform a data migration operation on the current data block; wherein the data migration operation is an atomic operation;

[0134] The termination return module 13 is used to stop the subsequent traversal and re-trigger the key value update module if a new node joins the cluster during the data migration process of each data block.

[0135] Since the embodiments of the apparatus part correspond to the embodiments of the method part, please refer to the description of the embodiments of the method part for the embodiments of the apparatus part, which will not be repeated here.

[0136] Figure 6 A structural diagram of a distributed storage node continuous expansion device provided by another embodiment of the present invention, such as Figure 6 As shown, a distributed storage node continuous expansion device includes: a memory 20, for storing computer programs;

[0137] The processor 21 is used to implement the steps of a method for continuous capacity expansion of distributed storage nodes in the above embodiment when executing a computer program.

[0138] The distributed storage node continuous expansion device provided in this embodiment may include but is not limited to a mobile terminal, a personal computer, a workstation, etc.

[0139] Among them, the processor 21 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 21 can be implemented in at least one hardware form of a digital signal processor (DSP), a field-programmable gate array (FPGA), and a programmable logic array (PLA). The processor 21 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a central processing unit (CPU); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 21 may be integrated with a graphics processing unit (GPU), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 21 may also include an artificial intelligence (AI) processor, which is used to process computing operations related to machine learning.

[0140] The memory 20 may include one or more computer-readable storage media, which may be non-transitory. The memory 20 may also include a high-speed random access memory, and a non-volatile memory, such as one or more disk storage devices, flash memory storage devices. In this embodiment, the memory 20 is at least used to store the following computer program 201, wherein, after the computer program is loaded and executed by the processor 21, it can implement the relevant steps of a distributed storage node continuous expansion method disclosed in any of the aforementioned embodiments. In addition, the resources stored in the memory 20 may also include an operating system 202 and data 203, etc., and the storage method may be temporary storage or permanent storage. Among them, the operating system 202 may include Windows, Unix, Linux, etc. Data 203 may include, but is not limited to, a distributed storage node continuous expansion method, etc.

[0141] In some embodiments, a distributed storage node continuous expansion device may also include a display screen 22 , an input and output interface 23 , a communication interface 24 , a power supply 25 , and a communication bus 26 .

[0142] Those skilled in the art will understand that Figure 6The structure shown in does not constitute a limitation on a distributed storage node continuous expansion device, and may include more or fewer components than shown in the figure.

[0143] An embodiment of the present invention provides a distributed storage node continuous expansion device, including a memory and a processor. When the processor executes a program stored in the memory, it can implement the following method: a distributed storage node continuous expansion method.

[0144] Finally, the present invention also provides an embodiment corresponding to a non-volatile storage medium. The non-volatile storage medium stores a computer program, and when the computer program is executed by a processor, the steps recorded in the above method embodiment are implemented.

[0145] It is understandable that if the method in the above embodiment is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a non-volatile storage medium. Based on this understanding, the technical solution of the present invention, 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, and the computer software product is stored in a storage medium to execute all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk, etc. Various media that can store program codes.

[0146] The above is a detailed introduction to a method, device and medium for continuous expansion of distributed storage nodes provided by the present invention. The various embodiments in the specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same and similar parts between the embodiments can be referenced to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description. It should be pointed out that for ordinary technicians in this technical field, without departing from the principle of the present invention, several improvements and modifications can be made to the present invention, and these improvements and modifications also fall within the scope of protection of the present invention.

[0147] It should also be noted that, in this specification, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprise", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the statement "comprises a ..." does not exclude the presence of other identical elements in the process, method, article or device including the element.

Claims

1. A method for continuous capacity expansion of distributed storage nodes, characterized in that: include: When a new node joins the cluster, the hash key value of the cluster is calculated and updated according to the capacity of the new node; Traversing all data blocks stored in the cluster, and determining whether each data block needs to be migrated according to the updated hash key value; If migration is required, a data migration operation is performed on the current data block; wherein the data migration operation is an atomic operation; During the data migration process of each of the data blocks, if a new node joins the cluster, the subsequent traversal is stopped and the process returns to the step of calculating and updating the hash key value of the cluster according to the capacity of the newly added node.

2. The distributed storage node continuous expansion method according to claim 1, characterized in that: The method further comprises: During the process of calculating and updating the hash key value of the cluster, if a new node joins the cluster, the calculation is stopped and the process returns to the step of calculating and updating the hash key value of the cluster according to the capacity of the newly added node.

3. The distributed storage node continuous expansion method according to claim 1, characterized in that: After the data block migration is completed, the method further includes: The cleaning flag of the data block is set to a to-be-cleaned state; wherein the cleaning flag includes two states: a to-be-cleaned state and an initial state; The method further comprises: If no new node joins the cluster during the traversal of each data block, traverse all the data blocks in the cluster to determine whether the cleaning flag of each data block is in a to-be-cleaned state; if it is in a to-be-cleaned state, perform a data cleaning operation on the current data block; wherein the data cleaning operation is an atomic operation; During the data cleaning process of each of the data blocks, if a new node joins the cluster, the subsequent traversal is stopped and the process returns to the step of calculating and updating the hash key value of the cluster according to the capacity of the newly added node.

4. The distributed storage node continuous expansion method according to claim 3, characterized in that: After traversing all the data blocks in the cluster and determining whether the cleaning flag of each data block is in a to-be-cleaned state, the method further includes: If it is not in the to-be-cleaned state, determining whether there is an error in the data of the current data block; If yes, an error message is returned, the cluster is controlled to enter maintenance mode, and the method is terminated.

5. The method for continuous capacity expansion of distributed storage nodes according to claim 4, characterized in that: The determining whether an error occurs in the data of the current data block includes: Determine whether the values ​​of the data migration flag bit and the migration completion flag bit corresponding to the current data block are equal, if not, determine that an error occurs in the data of the data block; The data migration flag and the migration completion flag are both preset flags, and each data block corresponds to one data migration flag and one migration completion flag; The method further comprises: Whenever a new node joins the cluster, the value of the preset key value change flag is automatically incremented; wherein the key value change flag corresponds to the cluster; Before performing the data migration operation on the current data block, the method further includes: Assign the value of the key value change flag to the data migration flag corresponding to the current data block; After performing the data migration operation on the current data block, the method further includes: The value of the data migration flag is assigned to the migration completion flag corresponding to the current data block.

6. The distributed storage node continuous expansion method according to claim 1, characterized in that: The determining whether each of the data blocks needs to be migrated according to the updated hash key value includes: Determine the storage location of the current data block through a consistent hashing algorithm according to the updated hash key value; Determining whether the newly determined storage location is the same as the actual storage location of the current data block; If they are different, the current data block needs to be migrated.

7. The distributed storage node continuous expansion method according to any one of claims 1 to 6, characterized in that: The step of calculating and updating the hash key value of the cluster according to the capacity of the newly added node includes: Determine the hash key value according to a first formula; Among them, the first formula is: n represents the total number of nodes; a i represents the capacity of the i-th node; f(a1,a2,…,a n ) represents the greatest common divisor of the capacities of all nodes; x represents a constant coefficient.

8. A distributed storage node continuous expansion device, characterized in that: include: A key value update module, used to calculate and update the hash key value of the cluster according to the capacity of the newly added node when a new node joins the cluster; A data migration module, used to traverse all data blocks stored in the cluster and determine whether each data block needs to be migrated according to the updated hash key value; If migration is required, a data migration operation is performed on the current data block; wherein the data migration operation is an atomic operation; The termination return module is used to stop the subsequent traversal and re-trigger the key value update module if a new node joins the cluster during the data migration process of each data block.

9. A distributed storage node continuous expansion device, characterized in that: include: Memory for storing computer programs; A processor, configured to implement the steps of the method for continuous capacity expansion of distributed storage nodes as described in any one of claims 1 to 7 when executing the computer program.

10. A non-volatile storage medium, characterized in that: The non-volatile storage medium stores a computer program, and when the computer program is executed by the processor, the steps of the method for continuous capacity expansion of distributed storage nodes as described in any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Storage cluster capacity expansion method and device, computer equipment and storage medium

    CN117435129A

  • Method and apparatus for failover processing

    US20170364423A1

  • Data cluster storage method and apparatus, and computer device

    WO2021003935A1