A method and device for continuously expanding a distributed storage node and a medium

By breaking down the data migration process into atomic operations of data block migration and returning to the hash key-value calculation stage when a new node is added, the problem of low efficiency in continuous expansion of distributed storage cluster nodes is solved, and efficient and accurate node expansion is achieved.

CN119743493BActive Publication Date: 2025-10-17INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

In distributed storage clusters, continuous expansion of nodes is inefficient and time-consuming, and existing technologies cannot efficiently expand multiple nodes.

Method used

The data migration process is broken down into atomic operations for data block migration. During the data migration process, it is determined whether a new node has been added. If so, the process returns to the hash key value calculation stage to redetermine the new key value in order to achieve continuous expansion.

Benefits of technology

It improves the efficiency of node expansion, reduces expansion time, ensures the accuracy and consistency of data migration, and avoids interrupting the existing migration process due to the addition of new nodes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119743493B_ABST
    Figure CN119743493B_ABST
Patent Text Reader

Abstract

The application discloses a distributed storage node continuous expansion method and device and medium, relates to the technical field of distributed storage, and is used for realizing cluster node expansion. In view of the low-efficiency problem of the current expansion mode of individual nodes, a distributed storage node continuous expansion method is provided. The longest data migration stage is disassembled into the migration of each data block. The atomic operation guarantees that the minimum data block migration process cannot be interrupted, and the accuracy and consistency of data are guaranteed. Based on this, if a new node is added at any moment in the data migration stage, the data migration process can be interrupted with the data block as the minimum granularity. Subsequent traversal of other data blocks is not needed, and the method returns to the hash key value calculation stage, so that the efficiency of the cluster node continuous expansion is greatly improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of distributed storage, and particularly relates to a method and device for continuously expanding a distributed storage node and a medium. BACKGROUND

[0002] In a hyper-converged product, data distribution of a distributed storage cluster is usually implemented by using a two-layer hash algorithm. Based on the two-layer hash algorithm, the storage locations of all data in the cluster and the capacities of nodes are strongly related. Therefore, when the capacity of the cluster changes, the locations of all data also change accordingly. Node expansion is a common scenario in which the capacity of the cluster changes. Therefore, when the cluster expands nodes, a large amount of data migration needs to be performed.

[0003] Because the data migration process takes a long time, and once started, new nodes cannot be added in the middle, but only one node can be expanded at a time. Therefore, when the cluster expands multiple nodes, a large amount of time is consumed, and the expansion efficiency is extremely low, which seriously affects the normal operation of the cluster.

[0004] Therefore, there is an urgent need in the art for a method for continuously expanding a distributed storage node to solve the problem that the current cluster has low efficiency and consumes a large amount of time when multiple nodes are continuously expanded. SUMMARY

[0005] The present application provides a method and device for continuously expanding a distributed storage node to solve the problem that the current cluster has low efficiency and consumes a large amount of time when multiple nodes are continuously expanded.

[0006] To solve the above technical problems, the present application provides a method for continuously expanding a distributed storage node, comprising:

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

[0008] All data blocks stored in the cluster are traversed, and it is determined whether each data block needs to be migrated according to the updated hash key value. If the data block needs to be migrated, a data migration operation is performed on the current data block. The data migration operation is an atomic operation.

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

[0010] In one possible embodiment, the method further comprises:

[0011] If a new node is added to the cluster during the process of calculating and updating the hash key value of 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 comprises:

[0013] setting the cleaning flag bit of the data block to a to-be-cleaned state; wherein the cleaning flag bit comprises two states, i.e., the to-be-cleaned state and an initial state;

[0014] The method further comprises:

[0015] If no new node is added to the cluster during the traversal of the data blocks, all the data blocks in the cluster are traversed, and it is determined whether the cleaning flag bit of each data block is in the to-be-cleaned state; if yes, a data cleaning operation is performed on the current data block; wherein the data cleaning operation is an atomic operation.

[0016] If a new node is added to the cluster during the data cleaning of the data blocks, 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 the traversal of all the data blocks in the cluster and the determination of whether the cleaning flag bit of each data block is in the to-be-cleaned state, the method further comprises:

[0018] If no, it is determined whether the data of the current data block is erroneous.

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

[0020] In a possible embodiment, the determination of whether the data of the current data block is erroneous comprises:

[0021] determining whether the values of a data migration flag bit and a migration completion flag bit corresponding to the current data block are equal, and if not, determining that the data of the data block is erroneous.

[0022] wherein the data migration flag bit and the migration completion flag bit are both preset flag bits, and each data block corresponds to one data migration flag bit and one migration completion flag bit.

[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] Assigning 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, determining 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 using 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 capacity of all nodes; x represents a constant coefficient.

[0038] To solve the above technical problems, the present invention further provides a distributed storage node continuous expansion device, comprising:

[0039] A key value update module 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;

[0040] a data migration module, configured 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 needed, a data migration operation is performed on the current data block; wherein the data migration operation is an atomic operation;

[0041] a termination returning module, configured to, during the data migration of each data block, if a new node is added to the cluster, stop subsequent traversal, and retrigger the key value updating module.

[0042] To solve the above technical problems, the application further provides a distributed storage node continuous expansion device, comprising:

[0043] a memory, configured to store a computer program;

[0044] a processor, configured to execute the computer program to implement the steps of the distributed storage node continuous expansion method.

[0045] To solve the above technical problems, the application further provides a non-volatile storage medium, wherein the non-volatile storage medium stores a computer program, and the computer program is executed by a processor to implement the steps of the distributed storage node continuous expansion method.

[0046] The distributed storage node continuous expansion method provided by the application divides the entire data migration process into the migration process of each data block, and each data block migration is realized by an atomic operation, so that the migration of the data block cannot be interrupted. Based on this, the method further determines whether a new node is added to the cluster during the data migration process. If yes, the migration of the subsequent data block is not performed, and the step of determining the hash key value (key value) is directly returned to determine the new key value. Since the data migration process in the method is realized by an atomic operation, when a new node is added to the cluster at any time during the data migration process, the migration of the current data block can be ensured to be completed normally, and the migration of the subsequent data block is not needed, the step of determining the key value is directly returned to determine the new key value after the new node is added, and the continuous expansion of the cluster node is realized.

[0047] In summary, the method divides the longest data migration phase in the continuous expansion of the cluster node into the migration of each data block. The atomic operation ensures that the migration process of the smallest data block cannot be interrupted, and the accuracy and consistency of the data are ensured. Based on this, when a new node is added at any time during the data migration phase, the data migration process can be interrupted with the smallest granularity of the data block, and the key value calculation phase is returned, so that the efficiency of the continuous expansion of the cluster node is greatly improved.

[0048] The distributed storage node continuous expansion device and the nonvolatile storage medium correspond to the method, and have the same effect. BRIEF DESCRIPTION OF DRAWINGS

[0049] In order to more clearly illustrate the embodiments of the present application, the following will briefly introduce the drawings needed to be used in the embodiments. Obviously, the drawings described in the following are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without any creative effort on the basis of these drawings.

[0050] Figure 1 A data distribution schematic diagram before node expansion;

[0051] Figure 2 A data distribution schematic diagram after node expansion;

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

[0053] Figure 4 A flow chart of another distributed storage node continuous expansion method provided by the embodiment of the present application;

[0054] Figure 5 A structure diagram of a distributed storage node continuous expansion device provided by the embodiment of the present application;

[0055] Figure 6 A structure diagram of another distributed storage node continuous expansion device provided by the embodiment of the present application. DETAILED DESCRIPTION

[0056] The technical solutions in the embodiments of the present application will be described clearly and completely in the following with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only some of the embodiments of the present application, but not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without any creative effort belong to the protection scope of the present application.

[0057] The core of the present application is to provide a distributed storage node continuous expansion method, device and medium.

[0058] In order to make the personnel in the technical field better understand the present application scheme, the present application will be further described in detail in the following with reference to the drawings and specific embodiments.

[0059] In related technologies, data distribution calculations in distributed storage clusters are typically performed using a two-layer hash ring. The advantage of a two-layer hash ring is that it eliminates the need for additional space to store data location information, allowing the physical location information to be directly calculated based on the data's logical location. However, this approach also has a drawback: if the total capacity of the cluster changes, the location of all data in the cluster must be recalculated, otherwise the data's physical location 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, which means that 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 must be redistributed. For example, consider a data block with logical address 00000003. Before the node joins, this data block is located on Node 1. After the node joins, the key value changes, and the data block must be migrated from Node 1 to Node 4. When a new node joins the cluster, all data in the cluster must undergo the aforementioned determination and data migration to move the required data blocks to their new locations. This process is time-consuming.

[0063] Furthermore, when new nodes are continuously added to the cluster—that is, when the cluster is continuously expanding its nodes—the key value must be updated with each new node. Furthermore, all data in the cluster must be based on a unified key value to ensure consistency during migration decisions and data migration. Therefore, currently, node expansion can only be performed one node at a time. Furthermore, the next node can only be expanded after the previous node has been expanded. This makes the entire process of continuous node expansion in the cluster extremely time-consuming and inefficient.

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

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

[0066] S21: All data blocks stored in the cluster are traversed, and it is determined whether each data block needs to be migrated according to the updated hash key value; if it needs to be migrated, a data migration operation is performed on the current data block.

[0067] The data migration operation is an atomic operation.

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

[0069] For the above step S11, that is, when a new node is added to the cluster, the key value is recalculated according to the capacity of the new node. In this embodiment, the actual address of the subsequent calculation data can be achieved by a consistent hash algorithm. Therefore, the key value determined in step S11 is the key value of the consistent hash algorithm.

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

[0071] Step S11 determines the key value by the first formula.

[0072] 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 the new key value is determined by 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 cluster is in the form of data blocks, and the migration of each data block is determined by traversal, and the data migration of the data block that needs to be migrated is performed.

[0076] In short, step S21 first subdivides 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 (only when the migration determination determines that the data block needs to be migrated, the subsequent data migration is performed).

[0077] The size of the divided data block is not limited in the present application, and can be determined according to the actual data processing needs. For example, in a possible implementation scenario, it is easier to implement and has higher processing efficiency to process data with a size of 4M. Therefore, the divided data block in the present method can be 4M in size.

[0078] In addition, for the data migration determination in step S21. As described above, when the key value is updated, all data in the cluster needs to be redistributed. Therefore, whether the logical address determined after the redistribution of the data block is consistent with the original logical address can be used to simply and efficiently determine whether the data block needs to be migrated. Correspondingly, for the data block migration determination method provided above, the embodiment also provides a specific implementation scheme, and the step S21 of determining whether each data block needs to be migrated according to the updated hash key value specifically includes:

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

[0080] S212: determining whether the newly determined storage location is the same as the actual storage location of the current data block, and if not, 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 block does not need to be migrated.

[0082] After that, if it is determined that migration is needed, the step S21 of the present method performs data migration. It should be noted that the migration of the data block in the present method is realized through atomic operation. Atomic operation refers to an operation that cannot be interrupted by a thread scheduling mechanism. That is, in the present method, the data migration process of each data block cannot be interrupted by any thread.

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

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

[0085] S212: determining whether the newly determined storage location is the same as the actual storage location of the current data block, and if not, proceeding to step S213, and if the same, traversing the next data block.

[0086] S213: migrating the data of the current data block through atomic operation.

[0087] In the process of traversing each data block in the cluster (including the migration determination of each data block and the data migration of the data block that needs to be migrated), if a new node is added to the cluster. If the node expansion scheme in the related art described above, the expansion of the newly added node needs to be put on hold, and the expansion of the newly added node is performed after the current node expansion process is completed.

[0088] However, for the present method, if a new node is added during the process of expanding a node. 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 much smaller compared to the data migration stage. Therefore, if a new node is added during the expansion of a node, it is highly probable that it occurs during the data migration stage. Therefore, in the present method, the request for adding a new node occurring during the data migration stage is processed by step S22. When a new node is added during the data migration stage, the traversal of the data block in step S21 is interrupted. As described in the above step S21 part, the migration determination and data migration in step S21 are performed in units of data blocks, and the data migration is implemented by an atomic operation that cannot be interrupted. If a new node is added during the migration determination, since the migration determination only involves the calculation and comparison of the logical addresses of the data blocks, and does not involve actual data input / output (IO) operations, step S22 can directly interrupt the migration determination. When the addition of a new node occurs during the migration of a data block, since the migration of a data block is implemented by an atomic operation, the migration of a data block is a whole and cannot be interrupted. Therefore, step S22 can only wait for the completion of the migration of the current data block, interrupt the traversal of the subsequent data block, and return to the key value calculation stage of step S11.

[0089] As can be easily understood, since the present method divides the redistribution of data in the cluster into the redistribution of multiple data blocks, it adopts the method of sequentially traversing each data block and performing migration determination and data migration. In the data migration stage, if a new node is added during the traversal (migration determination and possible data migration) of any data block, the traversal of the subsequent data block is terminated, and the key value is determined again in step S11, and the data migration stage is re-entered to re-calculate the data distribution in the cluster with a new key value.

[0090] In summary, the method for continuous expansion of distributed storage nodes provided by the application 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 is the longest and cannot be interrupted, is further divided into a plurality of migration processes of data blocks that cannot be interrupted. Each data block includes a migration determination step, which can be interrupted because it does not involve actual operations (i.e., only calculation and comparison, without modifying any data in the cluster). If the current data block needs to be migrated, atomic operation is used to perform the data migration, which cannot be interrupted. Although the data migration in this method cannot be interrupted, the granularity of the data migration is greatly improved because the data migration is performed in units of 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 units of data blocks. Furthermore, when a new node joins during the expansion of the node, the current data migration stage can be interrupted in units of data blocks, and the process returns to the first stage, i.e., the key value calculation stage, to realize continuous expansion of the node.

[0091] As can be seen, the method does not need to expand one node at a time, and the expansion of the next node cannot be performed until the expansion of the previous node is completed. Instead, the data migration stage, which is the most time-consuming in the expansion process of the node, is divided into smaller granularity, so that when a new node joins during the data migration stage, the process can be interrupted according to the granularity, and the process returns to the key value calculation stage to realize expansion of the new node, thereby greatly improving the efficiency of continuous expansion of the nodes in the cluster.

[0092] On the other hand, in addition to the above-mentioned interruption of the current process and return to the key value calculation stage when a new node joins during the data migration stage, the embodiment also provides another possible implementation, in which the method further includes:

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

[0094] As can be easily understood, when the key values of the cluster are calculated, no actual data operation has been performed (especially, data migration has not started). Therefore, the current calculation can be interrupted directly, and the calculation of the key values is restarted according to the capacity of the new node.

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

[0096] In summary, the embodiment provides a new interruptible node in a node expansion process, so that the current process can be interrupted to start a new node expansion process when a new node is added at any time during the node expansion process, thereby further improving the expansion efficiency.

[0097] On the other hand, in practical applications, the stages included in a complete node expansion process are different according to different node expansion schemes. However, regardless of the node expansion scheme, at least the key value calculation stage and the data migration stage are included. Therefore, in the above embodiment, a node continuous expansion scheme is provided for the key value calculation stage and the data migration stage.

[0098] Further, the embodiment provides a possible node expansion scheme, and a complete node expansion process includes a key value calculation stage, a data migration stage, and a data cleaning stage.

[0099] The node expansion process is triggered by the addition of a new node. If not interrupted, the key value calculation stage, the data migration stage, and the data cleaning stage are performed in sequence. When the data cleaning stage ends, it is considered that a complete node expansion process is completed.

[0100] As can be easily understood, the data migration process is used to determine whether the data block needs to be migrated, and to migrate the data block from the original logical address to the newly determined logical address when it is determined that the data block needs to be migrated. As described above, after the data block is migrated, the data on the original logical address has not been processed. If other data blocks are re-calculated and assigned to this logical address, the data on the original logical address can be overwritten after the data migration. However, if there is no data block pointing to this logical address, the data on the logical address is redundant data, which needs to be cleaned to ensure the consistency of the data in the cluster. Based on this, the embodiment further includes a data cleaning stage after the data migration stage. Specifically, for the implementation of the data cleaning stage, the above method further includes the following steps after each data block is migrated:

[0101] S23: Set the cleaning flag of the data block to the to-be-cleaned state.

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

[0103] Correspondingly, if no new node is added to the cluster during the traversal of each data block, i.e., when the data migration stage ends, the method further includes the following steps:

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

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

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

[0107] The data cleaning operation is an atomic operation.

[0108] S32: If a new node is added to the cluster during the data cleaning process of each data block, stop subsequent traversal and return to step S11.

[0109] As can be seen from the above steps, the embodiment provides a redundant data cleaning scheme, that is, after the data migration is completed, the redundant data on the original address is cleaned to ensure the consistency of the stored data in the cluster before and after the node expansion. Moreover, although the time consumption of the data cleaning phase is much smaller than that of the data migration phase. However, considering that the data cleaning phase is also part of the node expansion, in order to improve the efficiency of continuous node expansion, the embodiment also adds a corresponding interruption mechanism in the data cleaning phase. That is, when a new node is added in the data cleaning phase, the current process is interrupted and returned to step S11 at the beginning of the node expansion process. In addition, since the data cleaning operation involves specific data processing, the embodiment also uses atomic operations to achieve non-interruptible data cleaning, avoiding data chaos in the cluster caused by interruption.

[0110] Based on the implementation scheme provided by the embodiment and the above-mentioned embodiments, the entire continuous node expansion process is as shown in Figure 4 , including three stages of key value calculation stage, data migration stage and data cleaning stage. And each stage has an interruption mechanism triggered by the addition of a new node during the process, and after interruption, it returns to the beginning of the entire process, that is, it reenters 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, and 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 in units of data blocks. Until the key value calculation stage, the data migration stage and the data cleaning stage are successfully executed without the addition of a new node and are not interrupted, a complete continuous node expansion process is completed. Compared with the way of performing node expansion one by one, and performing the next node expansion after one node expansion is completed, the node expansion realized by the method can bring higher efficiency and significantly reduce the time consumption.

[0111] In another aspect, the embodiment provides a further implementation based on the redundant data cleaning solution provided in the above embodiment. In the judgment in step S311, if the data block is not in the cleaning state, the method further includes:

[0112] S313: judging whether the data of the current data block is erroneous, and if so, proceeding to step S314.

[0113] S314: returning an error message, controlling the cluster to enter a maintenance mode, and terminating the method.

[0114] That is, the embodiment provides a detection mechanism for detecting whether data migration is erroneous in the data cleaning phase. Specifically, for the data block whose cleaning flag is not in the cleaning state, the data block can be a target data block after data migration (i.e., a new data block after data migration), an original data block before data migration (i.e., an old data block before data migration), or a data block that does not need to be migrated. Since the data migration phase is the most time-consuming and most likely to cause problems in the entire node expansion process, the error detection of the above data blocks can further avoid data damage and other problems in the implementation of the node expansion.

[0115] Further, for how to determine whether the data of the data block is erroneous in step S313, one possible solution is to use a data checking mechanism. However, the embodiment provides another possible implementation. Specifically, step S313 is:

[0116] judging whether the value of the data migration flag corresponding to the current data block is equal to the value of the migration completion flag, and if not, determining 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 one data migration flag and one migration completion flag.

[0118] Correspondingly, to support the implementation of step S313, the method further includes:

[0119] S13: whenever a new node is added to the cluster, the value of the preset key value change flag is incremented.

[0120] The key value change flag (cluster age) corresponds to the cluster. That is, one cluster only needs one key value change flag. In one possible embodiment, whenever a new node is added to the cluster, the key value change flag is incremented by 1. At this time, the specific value of the key value change flag can represent how many new nodes are added to the cluster.

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

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

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

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

[0125] As can be seen from the above step S214 and step S215, before and after the data migration of a data block, the data migration flag bit (latest) and the migration completion flag bit (stable) corresponding to the data block are respectively assigned. Each data block corresponds to a data migration flag bit and a migration completion flag bit. The data migration flag bit is used to represent that the data block will undergo data migration, so a new value is assigned before the data block undergoes migration. Similarly, the migration completion flag bit represents that the data block has completed data migration, so a new value is assigned after the data block undergoes migration.

[0126] And based on the above possible increment mechanism of the key value change flag bit, that is, the key value change flag bit is incremented by 1 each time a node is added. Based on the assignment mode of the above step S214 and step S215, it can be seen that each time the data migration flag bit of a data block is equal to the current key value change flag bit, that is, the number of the newly added nodes, it means that the data block is a data block to be migrated based on the key value of the latest added node. Similarly, each time the migration completion flag bit of a data block is equal to the current data migration flag bit (or key value change flag bit), it means that the data block is a data block that has completed data migration based on the key value of the latest added node. Based on the three flag bits and the cleaning flag bit in the above embodiment, the management of each stage in the node expansion process can be realized.

[0127] And based on the above step S214 and step S215, it can be seen that whether a data block undergoes data migration or not, its data migration flag bit and migration completion flag bit should be equal in the normal case in the data cleaning stage. If not, the data block must have undergone data migration and an error occurred in the data migration. Therefore, there is a high possibility that the data in the data block has an error. In summary, the present embodiment can conveniently and efficiently realize the judgment of whether the data in the data block has an error through the setting of several flag bits, thereby further ensuring that the problem of data loss in the cluster does not occur.

[0128] In addition to the embodiment of the method of continuously expanding the distributed storage node provided in the above embodiment, the present application also provides an embodiment of a computer program product. The computer program product comprises computer programs / instructions which, when executed by a processor, can implement the steps of the method of continuously expanding the distributed storage node according to any one of the above embodiments.

[0129] Since the embodiment of the computer program product part corresponds to the embodiment of the method part, the embodiment of the computer program product part is described in the description of the embodiment of the method part, and will not be described here.

[0130] In the above embodiment, the method of continuously expanding the distributed storage node is described in detail, and the present application also provides an embodiment of an apparatus for continuously expanding the distributed storage node. It should be noted that the embodiment of the apparatus part is described from two angles, one is based on the functional module, and the other is based on the hardware.

[0131] Based on the functional module, as shown in Figure 5 The embodiment provides an apparatus for continuously expanding the distributed storage node, which comprises:

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

[0133] The data migration module 12 is configured 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 the data block needs to be migrated, a data migration operation is performed on the current data block. The data migration operation is an atomic operation.

[0134] The termination returning module 13 is configured to stop subsequent traversal and retrigger the key value updating module if a new node is added to the cluster during the data migration process of each data block.

[0135] Since the embodiment of the apparatus part corresponds to the embodiment of the method part, the embodiment of the apparatus part is described in the description of the embodiment of the method part, and will not be described here.

[0136] Figure 6 The structure diagram of the apparatus for continuously expanding the distributed storage node provided in another embodiment of the present application is shown in Figure 6 The apparatus for continuously expanding the distributed storage node comprises a memory 20 for storing computer programs.

[0137] The processor 21 is configured to implement the steps of the method of continuously expanding the distributed storage node according to the above embodiment when executing the computer programs.

[0138] The distributed storage node continuous expansion device provided by the embodiment can include but is not limited to a mobile terminal, a personal computer, a workstation, and the like.

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

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

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

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

[0143] The distributed storage node continuous expansion device provided by the embodiment of the present application comprises a memory and a processor, and the processor can realize the following method when executing the program stored in the memory: a distributed storage node continuous expansion method.

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

[0145] It can be understood that if the method in the above embodiment is realized in the form of a software function unit and sold or used as an independent product, it can be stored in a non-volatile storage medium. Based on such understanding, the technical solutions of the present application essentially or the part that contributes to the prior art or the whole or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium, and executes all or part of the steps of the method described in each embodiment of the present application. The foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and various media that can store program codes.

[0146] The above provides a detailed description of the distributed storage node continuous expansion method, device and medium. The embodiments in the specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts of each embodiment can be referred to. 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. It should be pointed out that for ordinary skilled in the art, without departing from the principles of the present application, the present application can be improved and modified, and these improvements and modifications also fall within the scope of the present application.

[0147] It also needs to be explained that in the present specification, the relational terms such as first and second and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises", "comprising", or any other variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but can include other elements not expressly listed or inherent to such process, method, article, or apparatus. An element proceeded by "comprises... a" does not, without more constraints, exclude the existence of additional identical elements in the process, method, article, or apparatus that comprises 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 newly joined node; wherein the calculating and updating of the hash key value of the cluster according to the capacity of the newly joined 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; represents the capacity of the i-th node; represents the greatest common divisor of the capacity of all nodes; x represents a constant coefficient; 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, performing a data migration operation on the current data block; wherein the data migration operation is an atomic operation; 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 the step of calculating and updating the hash key value of the cluster according to the capacity of the newly joined node; 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 joined node; After the migration of the data block is completed, 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; If no new node joins the cluster during the traversal of each data block, all the data blocks in the cluster are traversed 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, a data cleaning operation is performed on the current data block; wherein the data cleaning operation is an atomic operation; 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 the step of calculating and updating the hash key value of the cluster according to the capacity of the newly joined node.

2. The method for continuous capacity expansion of distributed storage nodes according to claim 1, 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 so, an error message is returned, the cluster is controlled to enter maintenance mode, and the method is terminated.

3. The method for continuous capacity expansion of distributed storage nodes according to claim 2, characterized in that: Determining whether an error occurs in the data of the current data block includes: Determine whether the values ​​of the data migration flag and the migration completion flag 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: Assigning 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.

4. The method for continuous capacity expansion of distributed storage nodes according to claim 1, wherein: The determining whether each data block needs to be migrated according to the updated hash key value includes: Determine the storage location of the current data block using 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.

5. A distributed storage node continuous expansion device, characterized in that: include: A key value update module is configured 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; wherein the calculation and updating of 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; represents the capacity of the i-th node; represents the greatest common divisor of the capacity of all nodes; x represents a constant coefficient; A data migration module is configured to traverse all data blocks stored in the cluster and determine whether each data block needs to be migrated based on 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; a termination and return module for stopping subsequent traversal and re-triggering the key value update module if a new node joins the cluster during the data migration process of each data block; wherein, the module further includes: during the calculation and update of the hash key value of the cluster, if a new node joins the cluster, stopping the calculation and returning to the step of calculating and updating the hash key value of the cluster based on the capacity of the newly joined node; after the data block migration is completed, setting the cleanup flag of the data block to a pending cleanup state; wherein, the cleanup flag includes two states: a pending cleanup state and an initial state; if no new node joins the cluster during the traversal process of each data block, traversing all the data blocks in the cluster to determine whether the cleanup flag of each data block is in a pending cleanup state; if it is in a pending cleanup state, performing a data cleanup operation on the current data block; wherein, the data cleanup operation is an atomic operation; during the data cleanup process of each data block, if a new node joins the cluster, stopping subsequent traversal and returning to the step of calculating and updating the hash key value of the cluster based on the capacity of the newly joined node.

6. 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 4 when executing the computer program.

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

Citation Information

Patent Citations

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

    CN117435129A

  • Method and apparatus for failover processing

    US20170364423A1