A method and device for expanding storage nodes
By using the task table to be migrated and the task table being migrated in the storage device, the migration of virtual nodes and the expansion of data is solved, and the reliability and efficiency of data storage are improved.
Patent Information
- Application Number
- CN202210873475.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-22
- Publication Date
- 2025-06-27
- Estimated Expiration
- 2042-07-22
AI Technical Summary
When existing storage devices face the increasing demand for data storage, they are difficult to expand flexibly and reliably, and cannot effectively meet the growing data storage needs.
By introducing the task table to be migrated and the task table being migrated into the storage device, the virtual nodes that need to be migrated will be determined, the data will be migrated and the mapping relationship will be updated, thereby achieving the expansion of the storage node.
It realizes flexible expansion of storage devices, ensures high reliability and migration efficiency of business access during data migration, and meets the growing data storage needs.
Smart Images

Figure CN115268777B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of object storage, and particularly to a method and device for expanding storage nodes. Background Art
[0002] With the rapid development of Internet technology in the information age, the types of data are changing. The proportion of unstructured data such as pictures, videos, voices, and documents in the total data volume is increasing. Object storage, which is good at storing and utilizing unstructured data, has become the preferred storage engine for distributed storage. Facing the continuous increase in the demand for data storage, existing storage devices may face the problem of insufficient existing storage space at any time. At this time, it is necessary to further add new storage nodes on the basis of the existing storage nodes of the original storage device, so that the expanded storage device can meet the increasingly explosive demand for data storage. How to flexibly and reliably expand the existing storage device is a technical problem to be solved in object storage. Summary of the Invention
[0003] In view of this, this application provides a method and display device for expanding storage nodes to solve the above technical problems.
[0004] Specifically, this application is implemented through the following technical solutions:
[0005] The embodiment of this application provides a method for expanding storage nodes. This method is applied to a storage device, and the storage device includes an original storage node and a destination storage node, and includes:
[0006] Determine a target virtual node that needs to be migrated currently from the generated task table to be migrated. The task table to be migrated is used to record at least one subtask of a virtual node that needs to be migrated. A subtask includes a virtual node to be migrated, the original storage node mapped to this virtual node, and the destination storage node mapped to this virtual node;
[0007] Remove the target subtask belonging to the target virtual node from the task table to be migrated, and add the target subtask and the time stamp when migrating the target subtask to the configured positive migration task table. The positive migration task table is used to record at least one target subtask in the process of being migrated, and the time stamp when migrating each target subtask;
[0008] If it is determined that the new storage node belonging to the target subtask does not store object data with a storage time greater than the time stamp corresponding to the target subtask and the same version as the object data stored in the original storage node belonging to the target subtask, then copy the object data stored in the original storage node belonging to the target subtask to the new storage node belonging to the target subtask;
[0009] For each target subtask, after determining that the object data stored in the original storage node belonging to the target subtask has been transferred, change the mapping relationship of the target virtual node belonging to the target subtask that has been stored to the mapping relationship between the target virtual node belonging to the target subtask and the newly added storage node, remove the target subtask from the positive migration task table, and delete the object data stored in the original storage node belonging to the target subtask.
[0010] An expansion device for a storage node, characterized in that the method is applied to a storage device, and the storage device includes an original storage node and a newly added storage node, and includes:
[0011] A virtual node determination unit, configured to determine a target virtual node that needs to be migrated currently from the generated task table to be migrated, where the task table to be migrated is used to record at least one subtask that needs to migrate a virtual node, and a subtask includes a virtual node to be migrated, an original storage node mapped to the virtual node, and a newly added storage node mapped to the virtual node;
[0012] A virtual node migration unit, configured to remove the target subtask belonging to the target virtual node from the task table to be migrated, and add the target subtask and the timestamp when migrating the target subtask to the configured positive migration task table, where the positive migration task table is used to record at least one target subtask in the process of migration, and the timestamp when migrating each target subtask; if it is determined that the newly added storage node belonging to the target subtask does not store object data with a storage time greater than the timestamp corresponding to the target subtask and the same version as the object data stored in the original storage node belonging to the target subtask, trigger the data replication unit;
[0013] The data replication unit is configured to copy the object data stored in the original storage node belonging to the target subtask to the newly added storage node belonging to the target subtask;
[0014] A mapping relationship change unit, for each target subtask, after determining that the object data stored in the original storage node belonging to the target subtask has been transferred, change the mapping relationship of the target virtual node belonging to the target subtask that has been stored to the mapping relationship between the target virtual node belonging to the target subtask and the newly added storage node, remove the target subtask from the positive migration task table, and delete the object data stored in the original storage node belonging to the target subtask.
[0015] As can be seen from the above technical solutions, when the storage device of the present application is expanded, first, the target virtual node that needs to be migrated currently is determined from the generated task table to be migrated, and then the target subtask belonging to the target virtual node is removed from the task table to be migrated, and the target subtask and the time stamp when migrating the target subtask are added to the configured task table being migrated; if it is determined that the object data stored in the newly added storage node belonging to the target subtask is not the same version as the object data stored in the original storage node belonging to the target subtask and the storage time is greater than the time stamp corresponding to the target subtask, the object data stored in the original storage node belonging to the target subtask is copied to the newly added storage node belonging to the target subtask; for each target subtask, after it is determined that the transmission of the object data stored in the original storage node belonging to the target subtask is completed, the mapping relationship of the target virtual node belonging to the target subtask that has been stored is changed to the mapping relationship between the target virtual node belonging to the target subtask and the newly added storage node, and the target subtask is removed from the task table being migrated, and the object data stored in the original storage node belonging to the target subtask is deleted. Therefore, by applying the technical solution provided by the present application, the virtual nodes on the storage device can be flexibly and reliably mapped to the new storage nodes, thereby realizing the expansion of the original storage device. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Figure 1 A flowchart of a method for expanding a storage node provided in this embodiment;
[0017] Figure 2 A schematic diagram of virtual node migration during storage node expansion provided in this embodiment;
[0018] Figure 3 A flowchart of a specific implementation method of step 103 provided in this embodiment;
[0019] Figure 4 A schematic diagram of the structure of a storage node expansion device provided in this embodiment;
[0020] Figure 5 A schematic diagram of the structure of an electronic device provided in this embodiment. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0021] To make the purpose, implementation manners, and advantages of the present application clearer, the following will clearly and completely describe the exemplary implementation manners of the present application with reference to the drawings in the exemplary embodiments of the present application. Obviously, the described exemplary embodiments are only a part of the embodiments of the present application, rather than all the embodiments.
[0022] Based on the exemplary embodiments described in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the scope of protection of the appended claims of the present application. In addition, although the disclosure in the present application is introduced according to one or several exemplary instances, it should be understood that each aspect of these disclosures can also constitute a complete implementation manner alone.
[0023] It should be noted that the brief description of the terms in the present application is only for the convenience of understanding the following described embodiments, rather than intending to limit the embodiments of the present application. Unless otherwise specified, these terms should be understood in their ordinary and common meanings.
[0024] In the present application, the terms "first", "second", "third", etc. in the specification, claims and the above-mentioned drawings are used to distinguish similar or like objects or entities, and do not necessarily mean to limit a specific order or sequence, unless otherwise indicated. It should be understood that such terms can be interchanged under appropriate circumstances, for example, can be implemented in an order other than those given in the illustration or description of the embodiments of the present application.
[0025] In addition, the terms "comprising" and "having" and any variations thereof are intended to cover but not exclude inclusion. For example, a product or device comprising a series of components does not necessarily have to be limited to those components clearly listed, but may include other components not clearly listed or inherent to these products or devices.
[0026] See Figure 1 , Figure 1 is a flowchart of a method for expanding the capacity of a storage node provided by an embodiment of the present application. This method is applied to a storage device, which includes an original storage node and a newly added storage node. The newly added storage node in this embodiment is the storage node that needs to be expanded. The method includes the following steps:
[0027] Step 101, determine the target virtual node that needs to be migrated currently from the generated task table to be migrated.
[0028] In this embodiment, the task table to be migrated is used to record at least one subtask of virtual nodes that need to be migrated. A subtask includes a virtual node to be migrated, the original storage node mapped to the virtual node, and the newly added storage node mapped to the virtual node.
[0029] Notify the storage device of the newly added storage node information, and the storage device reallocates virtual nodes based on the newly added storage node and the original storage nodes. Assume that the number of virtual nodes corresponding to the original storage nodes is determined according to the rule of allocating objects based on the consistent hashing algorithm. The newly added storage node will change the mapping of some virtual nodes. Based on this, a migration task table is introduced in this embodiment. As an example, the migration task table can be determined according to the number of virtual nodes corresponding to the original storage nodes and the number of newly added storage nodes.
[0030] Exemplarily, if the number of virtual nodes of the storage device is 2^19, there are 10 original storage nodes before expansion, and the number of virtual nodes expected to be allocated to each original storage node in the storage device is 2^19 / 10 virtual nodes. When adding 1 storage node, that is, the newly added storage node, after expansion, the number of virtual nodes of each storage node is 2^19 / 11, and the number of virtual nodes to be migrated for each storage node is 2^19 / 10 - 2^19 / 11, which is approximately 4766. At the same time, the destination storage nodes to be migrated are calculated. Organize the original mapping node information and the new mapping node information of all virtual nodes to be migrated into multiple migration subtasks to form a migration task table.
[0031] The destination storage nodes are determined according to the number of virtual nodes to be migrated and the number of newly added storage nodes. The destination storage nodes include at least one newly added storage node.
[0032] For ease of understanding, an example of the migration task table shown in Table 1 below is given. Here, V10001, ……, Vn0001 are the virtual node identifiers corresponding to the serial numbers 1, ……, n respectively, 0001, ……, 000m are the original storage node identifiers corresponding to the serial numbers 1, ……, m respectively, and 0011 is the destination storage node identifier.
[0033] Table 1 Migration Task Table
[0034] Virtual node Original storage node Destination storage node V10001 0001 0011 …… …… …… Vn0001 000m 0011
[0035] As shown in Table 1, for the virtual node V10001, the subtask corresponding to V10001 is: V10001 corresponds to the original storage node 0001, and V10001 corresponds to the destination storage node 00011. For the virtual node Vn0001, the subtask corresponding to Vn0001 is: Vn0001 corresponds to the original storage node 000m, and Vn0001 corresponds to the destination storage node 00011.
[0036] As an embodiment, the implementation method of step 101 includes: determining the target virtual node to be migrated currently according to the CPU occupancy of this storage device when processing the current service. The CPU occupancy of this storage device when processing the current service can be understood as the magnitude of the processing pressure of this storage device for the current service. For example, the traffic data of the current service processed by the CPU per second. If this traffic data is greater than the traffic threshold, it is considered that the storage device has a large processing pressure for the current service, and then the number of target virtual nodes to be migrated currently is reduced. If this traffic data is less than the traffic threshold, it is considered that the storage device has a small processing pressure for the current service, and then the number of target virtual nodes to be migrated currently is increased. If this traffic data is equal to the traffic threshold, it is considered that the storage device has an appropriate processing pressure for the current service, and the number of target virtual nodes to be migrated currently is adjusted to a preset number. As an embodiment, the maximum number of concurrent virtual nodes does not exceed the number of CPU cores of the original storage device / 2. The preset number can be the number of CPU cores of the original storage device / 2. It can be seen that applying the technical solution provided by this embodiment can dynamically adjust the number of concurrent migration subtasks during the data migration process according to the magnitude of the processing pressure of the storage device for the current service. When the service pressure is small, the number of concurrent virtual nodes is increased. When the service pressure is large, the number of concurrent virtual nodes is reduced.
[0037] It should be noted that when actually expanding the storage nodes of the storage device, the number of virtual nodes of each storage node after expansion will be calculated based on the number of newly added storage nodes and the number of original storage nodes. The virtual node group of the newly added storage nodes, such as Figure 2 the virtual node group of the newly added nodes shown in, will be allocated a part of the virtual nodes from the original storage nodes. This part of the virtual nodes is regarded as the virtual nodes to be migrated. For example, Figure 2 the boxes filled with slashes in are that nodes 1, 2, 3, and k are all virtual nodes to be migrated, which correspond to the original virtual node group in Figure 2 and nodes 1, 2, 3, and k are migrated from the original virtual node group to the virtual node group of the newly added nodes to complete the virtual node group after expansion. The virtual node group after expansion includes nodes 1, 2, 3, ……, node f, node f + 1. f is the serial number of the virtual node in the virtual node group after expansion, and k is the serial number of the node in the original virtual node group. This embodiment is an implementation method for migrating a part of the virtual nodes corresponding to the original storage nodes.
[0038] Step 102: Remove the target subtasks belonging to the target virtual node from the task table to be migrated, and add the target subtasks and the time stamps when migrating the target subtasks to the configured positive migration task table. If it is determined that the target storage node belonging to the target subtask does not store object data with a storage time greater than the time stamp corresponding to the target subtask and the same version as the object data stored in the original storage node belonging to the target subtask, then execute Step 103.
[0039] Among them, the positive migration task table is used to record at least one target subtask in the process of being migrated, and the time stamp when migrating each target subtask.
[0040] The target subtasks in this embodiment are the subtasks for the target virtual node. The target virtual node is the virtual node that needs to be migrated currently.
[0041] The positive migration task table in this embodiment also includes the target subtasks corresponding to multiple target virtual nodes, but the above positive migration task table also includes the time stamp when migrating each target subtask. For details, see Table 2.
[0042] Table 2 Positive Migration Task Table
[0043] Virtual node Original storage node Destination storage node Timestamp V10001 0001 0011 Timestamp 1 …… …… …… Vn0001 000m 0011 Timestamp K
[0044] In Table 2, each target subtask corresponds to a time stamp. Exemplarily, the target subtask for virtual node V10001 is: V10001 corresponds to the original storage node 0001, and V10001 corresponds to the target storage node 00011. The time stamp corresponding to this target subtask is time stamp 1. The above time stamp K is the time stamp of the target subtask corresponding to virtual node Vn0001.
[0045] Before copying the object data stored in the original storage node corresponding to the virtual node, it is first necessary to determine whether the target storage node belonging to the target subtask stores object data with a storage time greater than the time stamp corresponding to the target subtask and the same version as the object data stored in the original storage node belonging to the target subtask. If it is determined that the target storage node belonging to the target subtask does not store object data with a storage time greater than the time stamp corresponding to the target subtask and the same version as the object data stored in the original storage node belonging to the target subtask. It can be understood that the latest version of the object data that the original storage node needs to copy is not stored in the newly added storage node to be migrated. If the latest version of the object data that the original storage node needs to copy is stored in the newly added storage node to be migrated, it means that there is no need to migrate the old version of the object data in the original storage node to the corresponding newly added storage node.
[0046] Step 103: Copy the object data stored in the original storage node belonging to the target subtask to the destination storage node belonging to the target subtask.
[0047] In this embodiment, the object data includes the actually stored data and object metadata. An object is the basic storage unit in object storage, which consists of object metadata and the data actually stored in the object. And object metadata: that is, the basic information data of the object, including the object size, creation time, update time, Etag value, etc.
[0048] Step 104: For each target subtask, after determining that the transmission of the object data stored in the original storage node belonging to the target subtask is completed, change the mapping relationship of the target virtual node that has been stored and belongs to the target subtask to the mapping relationship between the target virtual node belonging to the target subtask and the destination storage node, and remove the target subtask from the positive migration task table, and delete the object data stored in the original storage node belonging to the target subtask.
[0049] In this step, the original mapping relationship of the target virtual node belonging to the target subtask is the mapping relationship between the target virtual node belonging to the target subtask and the original storage node, and now it is changed to the mapping relationship between the target virtual node belonging to the target subtask and the destination storage node. It should be noted that the above destination storage node also belongs to the destination storage node of the target subtask.
[0050] Removing the target subtask from the positive migration task table means that the target virtual node corresponding to the target subtask has successfully completed the migration. At the same time, in order to reduce the occupancy of the original storage node space by the data and to facilitate accurately finding the corresponding stored data subsequently, the object data stored in the original storage node belonging to the target subtask is deleted.
[0051] So far, Figure 1 all the processes in
[0052] As can be seen from the above technical solutions, when the storage device of the present application is expanded, first, the target virtual node that needs to be migrated currently is determined from the generated pending migration task table, and then the target subtasks belonging to the target virtual node are removed from the pending migration task table, and the target subtasks and the time stamps when migrating the target subtasks are added to the configured ongoing migration task table; if it is determined that the newly added storage node belonging to the target subtask does not store object data whose storage time is greater than the time stamp corresponding to the target subtask and whose object data is the same version as the object data stored in the original storage node belonging to the target subtask, then the object data stored in the original storage node belonging to the target subtask is copied to the newly added storage node belonging to the target subtask; for each target subtask, after it is determined that the transmission of the object data stored in the original storage node belonging to the target subtask is completed, the mapping relationship of the target virtual node belonging to the target subtask that has been stored is changed to the mapping relationship between the target virtual node belonging to the target subtask and the newly added storage node, and the target subtask is removed from the ongoing migration task table, and the object data stored in the original storage node belonging to the target subtask is deleted. Therefore, by applying the technical solutions provided by the present application, the virtual nodes on the storage device can be flexibly and reliably mapped to the new storage nodes, thereby realizing the expansion of the original storage device.
[0053] In the related migration technical solutions, during data migration, the storage device will map the data of the virtual nodes to be migrated one by one from the original storage nodes to the newly added storage nodes. At this time, if a business data access is made to the virtual node that is being migrated, a storage path ambiguity problem will occur. The existing processing method is that the storage device records the virtual node that is currently being migrated and temporarily rejects the business requests of this virtual node until the migration of this virtual node is completed. When the business requests access the virtual nodes that have not been migrated, do not need to be migrated, and have been migrated, the business data can be read and written normally. If the number of virtual nodes in the storage device is 2^19, the probability that the data access reaches the virtual node that is being migrated is 1 / 2^19, and the success rate of the business requests is 99.9998%. After the migration is completed, the data is evenly distributed to the original storage nodes and the newly added storage nodes, the used capacity of the original storage nodes becomes smaller, and the business requests read and write data according to the expanded hash mapping table, and the expansion of the storage device is completed. It is not difficult to see that in the existing related technical solutions, during the data migration process, the virtual nodes that are being migrated cannot provide normal business access, the success rate of business access depends on the number of virtual nodes and the number of virtual nodes that are being migrated, and as the number of virtual nodes that are being migrated increases, the access success rate will decrease, and the high availability of the storage device and the efficiency of migration cannot be taken into account at the same time. To solve the above technical problems, during the execution of step 103, as an embodiment, as Figure 3 shown, the method further includes the following steps:
[0054] Step 1031: When a read / write request is received, determine a first virtual node for processing the target data according to the target data requested to be processed by the read / write request; if there is a positive migration task table for the first virtual node, execute Step 1032.
[0055] The read / write request in this embodiment can be a read request, a write request, or a delete request, and this embodiment does not limit this.
[0056] The first virtual node is only named for the convenience of distinguishing it from other virtual nodes, and this embodiment does not limit this.
[0057] Virtual nodes can be divided into four categories according to data migration tasks, namely: the first category, virtual nodes that do not need to be migrated. The second category, virtual nodes to be migrated. The third category, virtual nodes that are being migrated. The fourth category, virtual nodes that have completed migration. Among them, when the first category, the second category, and the fourth category of virtual nodes perform data reading and writing, no special processing is required. For the third category of virtual nodes, implemented according to this embodiment, this embodiment can detect whether there is a positive migration task table for the above-mentioned first virtual node. If so, it is considered to belong to the third category of virtual nodes and execute Step 1032. If not, it is considered to belong to the first category of virtual nodes, the second category of virtual nodes, or the fourth category of virtual nodes, and the data in the storage node corresponding to the first virtual node is processed according to the existing storage method, and no further elaboration is made here.
[0058] Step 1032: Process the target data requested to be processed by the read / write request according to the mapping relationship for the first virtual node recorded in the positive migration task table.
[0059] It can be seen that applying the technical solution provided by this embodiment can accurately process the read / write request by using the mapping relationship recorded in the positive migration task table during the data migration process, so that during the data migration process, the virtual nodes being migrated can normally provide service access, and further, the storage device provided by this embodiment can ensure that the number of virtual nodes and the number of virtual nodes being migrated provide corresponding service access, ensuring the success rate of service access, so that the storage device can balance high reliability and migration efficiency.
[0060] As an embodiment, when the read / write request is a read request, the implementation method of Step 1031 includes the following steps:
[0061] Step A: Determine a first virtual node corresponding to the storage node storing the target data according to the target data requested to be read by the read request.
[0062] Based on Step A, the implementation of Step 1032 includes Steps B to D:
[0063] Step B: Search for the mapping relationships between the first virtual node and the original storage node and between the first virtual node and the destination storage node in the positive migration task table. According to the mapping relationship between the first virtual node and the destination storage node, determine whether the target data exists in the destination storage node corresponding to the first virtual node. If it exists, execute Step C; if not, execute Step D.
[0064] In this embodiment, search for the mapping relationship between the first virtual node and the original storage node and the mapping relationship between the first virtual node and the destination storage node in the positive migration task table. According to the mapping relationship between the first virtual node and the destination storage node, first check whether the target data exists in the newly added storage node corresponding to the first virtual node, that is, the destination storage node. If it exists, it means that the target data has been successfully copied. Based on this, execute Step C. If not, it means that the target data is stored in the original storage node and has not been successfully copied. Based on this, execute Step D to read the target data from the original storage node corresponding to the first virtual node.
[0065] Step C: Read the target data from the destination storage node corresponding to the first virtual node.
[0066] Step D: According to the mapping relationship between the first virtual node and the original storage node, read the target data from the original storage node corresponding to the first virtual node.
[0067] It can be seen that applying the technical solution provided in this embodiment can, during the process of migrating data, utilize the mapping relationships recorded in the positive migration task table to accurately handle the read request without affecting business access, ensuring both high reliability of business access and improving migration efficiency.
[0068] As another embodiment, when the read / write request is a write request, the implementation of Step 1031 includes:
[0069] Step E: Determine the first virtual node corresponding to the storage node where the target data to be written according to the write request.
[0070] Based on Step E, the implementation of Step 1032 includes Step F:
[0071] Step F: Search for the mapping relationship between the first virtual node and the destination storage node in the positive migration task table, and according to the mapping relationship between the first virtual node and the destination storage node, write the target data into the destination storage node corresponding to the first virtual node.
[0072] In this embodiment, when processing the write operation, directly write the target data carried in the write request into the destination storage node corresponding to the first virtual node.
[0073] It can be seen that by applying the technical solution provided in this embodiment, during the process of migrating data, the mapping relationship recorded in the positive migration task table can be utilized to accurately process the write request without affecting business access, which can not only ensure the high reliability of business access but also improve the migration efficiency.
[0074] When the read / write request is a deletion request, determining the first virtual node for processing the target data according to the target data requested to be processed by the read / write request includes:
[0075] Determining the first virtual node corresponding to the storage node storing the target data according to the target data requested to be deleted by the write request;
[0076] As another embodiment, when the read / write request is a deletion request, the implementation manner of implementing step 1031 may include the following steps:
[0077] Step G: Search in the positive migration task table for the mapping relationships between the first virtual node and the original storage node and between the first virtual node and the destination storage node, and respectively determine whether the target data exists in the destination storage node mapped by the first virtual node and the original storage node mapped by the first virtual node according to the mapping relationship between the first virtual node and the destination storage node and the mapping relationship between the first virtual node and the destination storage node. If it exists, execute step H.
[0078] In this embodiment, it is necessary to search for the target data in both the original storage node and the destination storage node respectively. That is to say, regardless of whether the original storage node or the destination storage node stores the target data, in order to ensure that the target data to be deleted can be completely deleted, the target data will be searched from both the destination storage node and the original storage node. If both store the target data, step H will be executed for both. If only one of them stores the target data, step H will be executed for the storage node storing the target data.
[0079] Step H: Delete the target data.
[0080] It can be seen that by applying the technical solution provided in this embodiment, during the process of migrating data, the mapping relationship recorded in the positive migration task table can be utilized to accurately process the deletion request without affecting business access, which can not only ensure the high reliability of business access but also improve the migration efficiency.
[0081] As an embodiment, the method further includes: during the process of migrating the target virtual node, when it is detected that there is a first target storage node in the task table to be migrated whose network connection changes from an abnormal state to a normal state, the task table to be migrated is re-determined, and the migration subtasks not completed by the target storage node are completed. When it is detected that there is a second target storage node in the task table being migrated whose network connection changes from an abnormal state to a normal state, analyze the task stage that the subtask to which the second target storage node belongs was executing before the disconnection, and based on the analyzed task stage information, continue to execute the migration of the subtask to which the second target storage stage belongs.
[0082] In this embodiment, when the network connection changes from an abnormal state to a normal state, it means that the network connection is online and can transmit signals normally. When the network connection changes from a normal state to an abnormal state, it means that the network connection is disconnected and cannot provide normal network services.
[0083] It can be seen that by applying the technical solution provided in the embodiment of the present application, even after the network connection is abnormally disconnected, the subtasks to be migrated will not be affected. After the disconnected storage node goes online, the task table to be migrated is re-scanned to complete the migration tasks not completed by this storage node. For the subtasks that were being migrated before the disconnection, analyze the task stage that was being executed before the disconnection, and continue the subsequent migration process, thereby ensuring the normal implementation of the migrated data.
[0084] As an embodiment, according to the characteristics of object allocation by the consistent hashing algorithm, the object data allocated under each virtual node is basically uniform, and the progress of the expansion and completed migration can be calculated according to the number of virtual nodes to be migrated. The calculation method can be (the number of virtual nodes with completed migration) / (the total number of virtual nodes to be migrated). It can be seen that this embodiment can determine the progress of the expansion and completed migration according to the number of virtual nodes with completed migration and the total number of virtual nodes to be migrated, and the calculated progress can be displayed on the display end of the storage device.
[0085] The above example description is completed.
[0086] The device provided by the present application will be described below:
[0087] See Figure 4 as shown Figure 4 FIG. 400 is a schematic structural diagram of an expansion device for a storage node provided by an embodiment of the present application. This device is applied to a storage device, and the storage device includes an original storage node and a destination storage node, and includes:
[0088] A virtual node determination unit 401, configured to determine, from the generated task table to be migrated, a target virtual node that needs to be migrated currently. The task table to be migrated is used to record at least one subtask that needs to migrate a virtual node. A subtask includes a virtual node to be migrated, an original storage node mapped to the virtual node, and a destination storage node mapped to the virtual node.
[0089] A virtual node migration unit 402, configured to remove a target subtask belonging to the target virtual node from the task table to be migrated, and add the target subtask and the timestamp when migrating the target subtask to a configured ongoing migration task table. The ongoing migration task table is used to record at least one target subtask in the process of migration, and the timestamp when migrating each target subtask. If it is determined that there is no object data stored in the destination storage node belonging to the target subtask with a storage time greater than the timestamp corresponding to the target subtask and the same version as the object data stored in the original storage node belonging to the target subtask, the data replication unit 403 is triggered.
[0090] The data replication unit 403 is configured to copy the object data stored in the original storage node belonging to the target subtask to the destination storage node belonging to the target subtask.
[0091] A mapping relationship change unit 404, for each target subtask, after determining that the transmission of the object data stored in the original storage node belonging to the target subtask is completed, change the mapping relationship of the target virtual node belonging to the target subtask that has been stored to the mapping relationship between the target virtual node belonging to the target subtask and the destination storage node, and remove the target subtask from the ongoing migration task table, and delete the object data stored in the original storage node belonging to the target subtask.
[0092] As an embodiment, the apparatus further includes:
[0093] A first virtual node determination unit, configured to, during the process of migrating the target virtual node, when receiving a read / write request, determine a first virtual node for processing the target data according to the target data requested to be processed by the read / write request. If the first virtual node exists in the ongoing migration task table, the request processing unit is triggered.
[0094] The request processing unit is configured to process the target data requested to be processed by the read / write request according to the mapping relationship of the first virtual node recorded in the ongoing migration task table.
[0095] As an embodiment, the read / write request is a read request, and the first virtual node determination unit is configured to:
[0096] Determine a first virtual node corresponding to a storage node storing the target data according to the target data requested to be read based on the read request;
[0097] The request processing unit is specifically configured to:
[0098] Search for mapping relationships between the first virtual node and the original storage node and between the first virtual node and the destination storage node in the positive migration task table, and determine whether the target data exists in the destination storage node corresponding to the first virtual node according to the mapping relationship between the first virtual node and the destination storage node. If it exists, read the target data from the destination storage node corresponding to the first virtual node. If it does not exist, read the target data from the original storage node corresponding to the first virtual node according to the mapping relationship between the first virtual node and the original storage node.
[0099] As an embodiment, the read / write request is a write request, and the first virtual node determination unit is configured to:
[0100] Determine a first virtual node corresponding to a storage node for writing the target data according to the target data requested to be written based on the write request;
[0101] The request processing unit is specifically configured to:
[0102] Search for the mapping relationship between the first virtual node and the destination storage node in the positive migration task table, and write the target data into the destination storage node corresponding to the first virtual node according to the mapping relationship between the first virtual node and the destination storage node.
[0103] As an embodiment, the read / write request is a delete request, and the first virtual node determination unit is configured to:
[0104] Determine a first virtual node corresponding to a storage node storing the target data according to the target data requested to be deleted based on the write request;
[0105] The request processing unit is specifically configured to:
[0106] Search for mapping relationships between the first virtual node and the original storage node and between the first virtual node and the destination storage node in the positive migration task table, and respectively determine whether the target data exists in the destination storage node mapped by the first virtual node and the original storage node mapped by the first virtual node according to the mapping relationship between the first virtual node and the destination storage node and the mapping relationship between the first virtual node and the destination storage node. If it exists, delete the target data.
[0107] As an embodiment, the virtual node determination unit specifically:
[0108] Determine the target virtual node that needs to be migrated currently according to the CPU usage of the current service processed by the storage device.
[0109] As an embodiment, the apparatus further includes: a migration task completion unit, configured to:
[0110] When it is detected that there is a first target storage node in the to-be-migrated task table whose network connection changes from an abnormal state to a normal state, re-determine the to-be-migrated task table and complete the migration subtasks that are not completed by the target storage node;
[0111] When it is detected that there is a second target storage node in the in-migration task table whose network connection changes from an abnormal state to a normal state, analyze the task stage that the subtask to which the second target storage node belongs was executing before the disconnection, and continue to execute the migration of the subtask to which the second target storage stage belongs based on the analyzed task stage information.
[0112] It can be seen from the above technical solutions that when the storage device of the present application is expanded, first, determine the target virtual node that needs to be migrated currently from the generated to-be-migrated task table, then remove the target subtask belonging to the target virtual node from the to-be-migrated task table, and add the target subtask and the time stamp when migrating the target subtask to the configured in-migration task table; if it is determined that there is no object data stored in the newly added storage node belonging to the target subtask whose storage time is greater than the time stamp corresponding to the target subtask and is the same version as the object data stored in the original storage node belonging to the target subtask, then copy the object data stored in the original storage node belonging to the target subtask to the newly added storage node belonging to the target subtask; for each target subtask, after determining that the transmission of the object data stored in the original storage node belonging to the target subtask is completed, change the mapping relationship of the target virtual node belonging to the target subtask that has been stored to the mapping relationship between the target virtual node belonging to the target subtask and the newly added storage node, and remove the target subtask from the in-migration task table, and delete the object data stored in the original storage node belonging to the target subtask. Therefore, by applying the technical solution provided by the present application, the virtual nodes on the storage device can be flexibly and reliably mapped to the new storage nodes, thereby realizing the expansion of the original storage device.
[0113] The implementation processes of the functions and effects of each unit in the above apparatus are specifically described in the implementation processes of the corresponding steps in the above method, and will not be elaborated here.
[0114] For the electronic device provided in the embodiment of the present application, from the hardware level, the schematic diagram of the hardware architecture can be referred to Figure 5As shown in the figure. It includes: a machine-readable storage medium and a processor, where: the machine-readable storage medium stores machine-executable instructions that can be executed by the processor; the processor is used to execute the machine-executable instructions to implement the expansion operation of the storage node disclosed in the above example.
[0115] The machine-readable storage medium provided by the embodiment of the present application stores machine-executable instructions. When the machine-executable instructions are called and executed by the processor, the machine-executable instructions cause the processor to implement the expansion operation of the storage node disclosed in the above example.
[0116] Here, the machine-readable storage medium can be any electronic, magnetic, optical or other physical storage device that can contain or store information, such as executable instructions, data, etc. For example, the machine-readable storage medium can be: RAM (Random Access Memory), volatile memory, non-volatile memory, flash memory, storage drives (such as hard disk drives), solid-state drives, any type of storage disk (such as optical discs, DVDs, etc.), or similar storage media, or a combination thereof.
[0117] The systems, devices, modules or units illustrated in the above embodiments can be specifically implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer, and the specific form of the computer can be a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email transceiver device, a game console, a tablet computer, a wearable device, or a combination of any several of these devices.
[0118] For the convenience of description, when describing the above devices, they are described separately as various units according to functions. Of course, when implementing the present application, the functions of each unit can be implemented in the same or multiple software and / or hardware.
[0119] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, a system, or a computer program product. Therefore, the present application can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the embodiments of the present application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0120] This application is described with reference to the flowcharts and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the present application. It should be understood that each flow and / or block in the flowchart and / or block diagram, and the combination of flows and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing device to generate a machine, such that the instructions executed by the processor of the computer or other programmable data processing device produce a means for implementing the functions specified in one flow Figure 1 one flow or multiple flows and / or blocks Figure 1 a block or multiple blocks.
[0121] Moreover, these computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, such that the instructions stored in the computer-readable memory produce a manufactured article including an instruction means that implements the functions specified in one flow Figure 1 one flow or multiple flows and / or blocks Figure 1 a block or multiple blocks.
[0122] These computer program instructions can also be loaded onto a computer or other programmable data processing device, such that a series of operation steps are executed on the computer or other programmable device to produce a computer-implemented process, so that the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one flow Figure 1 one flow or multiple flows and / or blocks Figure 1 a block or multiple blocks.
[0123] For the apparatus embodiments, since they basically correspond to the method embodiments, the relevant parts can be referred to the partial descriptions of the method embodiments. The apparatus embodiments described above are merely illustrative. The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place, or may be distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of the present application. Those of ordinary skill in the art can understand and implement it without creative efforts.
[0124] So far, the description of Figure 5 the device shown is completed.
[0125] The above are only the preferred embodiments of the present application and are not intended to limit the present application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present application shall be included within the scope of protection of the present application.
Claims
1. A method for expanding a storage node, characterized in that The method is applied to a storage device, and the storage device includes an original storage node and a newly added storage node, and the method includes: Determine a target virtual node that needs to be migrated currently from a generated task table to be migrated. The task table to be migrated is used to record at least one subtask of a virtual node that needs to be migrated. A subtask includes a virtual node to be migrated, an original storage node mapped to the virtual node, and a destination storage node mapped to the virtual node. The destination storage node includes at least one newly added storage node; Remove a target subtask belonging to the target virtual node from the task table to be migrated, and add the target subtask and the timestamp when migrating the target subtask to a configured positive migration task table. The positive migration task table is used to record at least one target subtask in the process of being migrated, and the timestamp when migrating each target subtask; If it is determined that the destination storage node belonging to the target subtask does not store object data with a storage time greater than the timestamp corresponding to the target subtask and the same version as the object data stored in the original storage node belonging to the target subtask, then copy the object data stored in the original storage node belonging to the target subtask to the destination storage node belonging to the target subtask; For each target subtask, after determining that the transmission of the object data stored in the original storage node belonging to the target subtask is completed, change the mapping relationship of the target virtual node belonging to the target subtask that has been stored to the mapping relationship between the target virtual node belonging to the target subtask and the destination storage node, and remove the target subtask from the positive migration task table, and delete the object data stored in the original storage node belonging to the target subtask.
2. The method according to claim 1, characterized in that, In the process of executing the copying of the object data stored in the original storage node belonging to the target subtask to the destination storage node belonging to the target subtask, it further includes: When a read / write request is received, determine a first virtual node for processing the target data according to the target data requested to be processed by the read / write request; If the first virtual node exists in the positive migration task table, process the target data requested to be processed by the read / write request according to the mapping relationship recorded in the positive migration task table for the first virtual node.
3. The method according to claim 2, wherein The read / write request is a read request, and determining the first virtual node for processing the target data according to the target data requested to be processed by the read / write request includes: Determine the first virtual node corresponding to the storage node storing the target data according to the target data requested to be read by the read request; Processing the target data requested to be processed by the read / write request according to the mapping relationship recorded in the positive migration task table for the first virtual node includes: Look up the mapping relationships between the first virtual node and the original storage node and between the first virtual node and the destination storage node in the positive migration task table. According to the mapping relationship between the first virtual node and the destination storage node, determine whether the target data exists in the destination storage node corresponding to the first virtual node. If it exists, read the target data from the destination storage node corresponding to the first virtual node. If it does not exist, read the target data from the original storage node corresponding to the first virtual node according to the mapping relationship between the first virtual node and the original storage node.
4. The method according to claim 2, wherein The read / write request is a write request. Determining the first virtual node for processing the target data according to the target data requested to be processed by the read / write request includes: Determine the first virtual node corresponding to the storage node for writing the target data according to the target data requested to be written by the write request; Processing the target data requested to be processed by the read / write request according to the mapping relationship recorded in the positive migration task table for the first virtual node includes: Look up the mapping relationship between the first virtual node and the destination storage node in the positive migration task table, and write the target data into the destination storage node corresponding to the first virtual node according to the mapping relationship between the first virtual node and the destination storage node.
5. The method according to claim 2, wherein The read / write request is a delete request. Determining the first virtual node for processing the target data according to the target data requested to be processed by the read / write request includes: Determine the first virtual node corresponding to the storage node storing the target data according to the target data requested to be deleted by the write request; Processing the target data requested to be processed by the read / write request according to the mapping relationship recorded in the positive migration task table for the first virtual node includes: Look up the mapping relationships between the first virtual node and the original storage node and between the first virtual node and the destination storage node in the positive migration task table. According to the mapping relationship between the first virtual node and the destination storage node and the mapping relationship between the first virtual node and the destination storage node, respectively determine whether the target data exists in the destination storage node mapped by the first virtual node and the original storage node mapped by the first virtual node. If it exists, delete the target data.
6. The method according to claim 1, characterized in that, Determining the target virtual node that needs to be migrated currently from the generated pending migration task table includes: Determine the target virtual node that needs to be migrated currently according to the size of the CPU occupied by the current storage device when processing the current service.
7. The method according to claim 1, wherein During the process of migrating the target virtual node, when it is detected that there is a first target storage node in the pending migration task table whose network connection changes from an abnormal state to a normal state, re-determine the pending migration task table and complete the unfinished migration subtasks of the target storage node; When it is detected that there is a second target storage node in the positive migration task table whose network connection changes from an abnormal state to a normal state, analyze the task stage that the subtask to which the second target storage node belongs was executing before going offline, and based on the analyzed task stage information, continue to execute the migration of the subtask to which the second target storage stage belongs.
8. An expansion device for a storage node, characterized in that, The device is applied to a storage device, and the storage device includes an original storage node and a destination storage node, and includes: A virtual node determination unit, configured to determine a target virtual node that needs to be migrated currently from the generated task table to be migrated, where the task table to be migrated is used to record at least one subtask that needs to migrate a virtual node, and a subtask includes a virtual node to be migrated, an original storage node mapped to the virtual node, and a destination storage node mapped to the virtual node; A virtual node migration unit, configured to remove a target subtask belonging to the target virtual node from the task table to be migrated, and add the target subtask and the timestamp when migrating the target subtask to the configured positive migration task table, where the positive migration task table is used to record at least one target subtask in the process of migration, and the timestamp when migrating each target subtask; if it is determined that there is no object data stored in the destination storage node belonging to the target subtask whose storage time is greater than the timestamp corresponding to the target subtask and is the same version as the object data stored in the original storage node belonging to the target subtask, trigger the data replication unit; The data replication unit is configured to copy the object data stored in the original storage node belonging to the target subtask to the destination storage node belonging to the target subtask; A mapping relationship change unit, configured to, for each target subtask, after determining that the transmission of the object data stored in the original storage node belonging to the target subtask is completed, change the mapping relationship of the target virtual node belonging to the target subtask that has been stored to the mapping relationship between the target virtual node belonging to the target subtask and the destination storage node, and remove the target subtask from the positive migration task table, and delete the object data stored in the original storage node belonging to the target subtask.
9. The device according to claim 8, wherein, The device further includes: A first virtual node determination unit, configured to, during the process of migrating the target virtual node, when receiving a read / write request, determine a first virtual node for processing the target data according to the target data requested to be processed by the read / write request; if the first virtual node exists in the positive migration task table, trigger the request processing unit; The request processing unit is configured to process the target data requested to be processed by the read / write request according to the mapping relationship of the first virtual node recorded in the positive migration task table.
10. The device according to claim 8, characterized in that, The device further includes: a migration task completion unit, configured to: When it is detected that there is a first target storage node in the task table to be migrated whose network connection changes from an abnormal state to a normal state, re-determine the task table to be migrated, and complete the migration subtasks that the target storage node has not completed; When it is detected that there is a second target storage node in the positive migration task table whose network connection changes from an abnormal state to a normal state, analyze the task stage that the subtask to which the second target storage node belongs was executing before going offline, and continue to perform the migration of the subtask to which the second target storage stage belongs based on the analyzed task stage information.
Citation Information
Patent Citations
Block device thin-provisioning method for log mapping
CN104035729A
Distributed storage system data migration method and system and related components
CN111078121A