Data migration methods, apparatus, equipment, storage media, and computer program products

By creating an empty target storage block in the target storage pool and switching the data stream direction, the communication interruption problem caused by storage block migration in the distributed storage system is solved, realizing seamless and efficient data migration and ensuring business continuity.

CN117707750BActive Publication Date: 2026-11-17TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211102024.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-09-09
Publication Date
2026-11-17
Estimated Expiration
2042-09-09

AI Technical Summary

Technical Problem

In distributed storage systems, existing technologies require disconnecting the communication connection between the operating terminal and the source storage block during storage block migration, which causes data access services to be suspended and affects business processing.

Method used

By creating an empty target storage block in the target storage pool and sending a target identifier to the operation terminal to switch the data stream direction, the read and write requests of the source storage block are frozen in a consistent manner. If the target data is not found, the data is copied from the source storage block to the target storage block to respond to the request.

Benefits of technology

It achieves second-level switching, avoiding business processing delays caused by excessive data replication time, ensuring a seamless data migration process, and guaranteeing business continuity.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117707750B_ABST
    Figure CN117707750B_ABST
Patent Text Reader

Abstract

This application relates to data storage and read / write operations, specifically to a data migration method, apparatus, computer device, storage medium, and computer program product. The method includes: a storage device sending a migration instruction to an operating terminal; the operating terminal performing consistency freeze processing on read / write requests targeting a source storage block; after the consistency freeze processing is completed, the storage device creating an empty target storage block in the target storage pool; sending a target identifier pointing to the target storage block to the operating terminal; the operating terminal switching the data stream pointer based on the target identifier and releasing the consistency freeze. For target read / write requests initiated by the operating terminal based on the new data stream pointer, if the target data specified in the target read / write request is not found in the target storage block, the target data is retrieved from the source storage block and copied to the target storage block, thus responding to the target read / write request. This application can achieve cross-pool hot migration of storage repositories.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer network technology, and in particular to a data migration method, apparatus, computer equipment, storage medium, and computer program product. Background Technology

[0002] Distributed storage systems typically consist of a storage resource pool comprised of multiple storage devices deployed with distributed storage software. Terminals access these storage devices via a network. Block storage is a type of distributed storage service, and the pool serves as the logical management unit for block storage. After prolonged use, the storage capacity of a pool in a distributed storage system may reach its limit. To balance the storage capacity of different pools, storage blocks need to be migrated.

[0003] In related technologies, when migrating storage blocks, the communication connection between the operating terminal and the source storage block needs to be disconnected first. Only after all data from the source storage block has been migrated to the target storage block is the communication connection between the operating terminal and the target storage block re-established. Because data migration requires disconnecting the communication connection, data access services are suspended, significantly impacting business processing. Summary of the Invention

[0004] Therefore, it is necessary to provide a data migration method, apparatus, computer equipment, storage medium, and computer program product to address the aforementioned technical problems.

[0005] On the one hand, this application provides a data migration method, which includes:

[0006] Determine the source storage pool and the target storage pool, and identify the source storage blocks to be migrated from the source storage pool;

[0007] Send a migration command to the operation terminal. The migration command is used to instruct the operation terminal to perform consistency freeze processing on read and write requests for the source storage block.

[0008] After the consistency freeze process is completed, an empty target storage block is created in the target storage pool;

[0009] Send a target identifier pointing to the target storage block to the operation terminal. The target identifier is used to instruct the operation terminal to switch the data stream direction based on the target identifier and release the consistency freeze.

[0010] In response to a target read / write request initiated by the operating terminal based on a new data stream, if the target data specified in the target read / write request is not found in the target storage block, the target data is retrieved from the source storage block and copied to the target storage block.

[0011] On the other hand, this application also provides a data migration apparatus, which includes:

[0012] The determination module is used to determine the source storage pool and the target storage pool, and to determine the source storage blocks to be migrated from the source storage pool;

[0013] The sending module is used to send migration instructions to the operation terminal. The migration instructions are used to instruct the operation terminal to perform consistency freeze processing on read and write requests for the source storage block.

[0014] A module is created to create empty target storage blocks in the target storage pool after the consistency freeze process is completed;

[0015] The switching module is used to send a target identifier pointing to the target storage block to the operation terminal. The target identifier is used to instruct the operation terminal to switch the data stream pointing to the target based on the target identifier and to unfreeze the consistency.

[0016] The data migration module is used to respond to target read / write requests initiated by the operating terminal based on a new data stream. If the target data specified in the target read / write request is not found in the target storage block, the module retrieves the target data from the source storage block and copies it to the target storage block.

[0017] On the other hand, this application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above-described data migration method.

[0018] On the other hand, this application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps in the above-described data migration method.

[0019] On the other hand, this application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the above-described data migration method.

[0020] The aforementioned data migration method, apparatus, computer equipment, storage medium, and computer program products involve the storage device sending migration instructions to the operating terminal, instructing the terminal to perform consistency freeze processing on read / write requests targeting the source storage block. After the consistency freeze is completed, an empty target storage block is created in the target storage pool. The storage device sends a target identifier pointing to the target storage block to the operating terminal. The operating terminal switches the data stream pointer based on the target identifier, releases the consistency freeze, and then initiates target read / write requests based on the new data stream pointer. The storage device retrieves the target data from the source storage block and copies it to the target storage block in response to the target read / write requests. Because an empty target storage block is first created in the target storage pool, instead of directly migrating all data from the source storage block to the target storage block, a second-level switch can be completed, avoiding delays in business processing caused by excessive data copying time. Furthermore, by enabling the aforementioned second-level switching and redirecting read / write requests from the source storage block to the target storage block, the entire data migration process can proceed without first disconnecting the communication connection between the operating terminal and the source storage block, and then re-establishing the connection after the data migration is complete. This ensures a seamless migration process for users, eliminating the need to interrupt business operations.

[0021] In addition, the operating terminal can first perform a consistency freeze on read and write requests targeting the source storage block. In this way, before creating the target storage block as the migration target in the target storage pool, it can be ensured that read and write requests that are currently interacting with the source storage block complete the read and write process, ensuring that the data is persisted.

[0022] On the other hand, this application provides a data migration method, which includes:

[0023] Receive migration instructions sent by the storage device, and perform consistency freeze processing on read and write requests for source storage blocks in the source storage pool according to the migration instructions;

[0024] After the consistency freeze process is completed, a processing completion message is sent to the storage device. The processing completion message is used to instruct the storage device to create an empty target storage block in the target storage pool.

[0025] Receive the target identifier pointing to the target storage block from the storage device, switch the data stream pointer based on the target identifier, and undo the consistency freeze process;

[0026] Based on the new data flow direction, a target read / write request is initiated to the storage device. The target read / write request is used to instruct the storage device to retrieve the target data from the source storage block and copy it to the target storage block if the target data specified in the target read / write request is not found in the target storage block, in response to the target read / write request.

[0027] On the other hand, this application also provides a data migration apparatus, which includes:

[0028] The freeze processing module is used to receive migration instructions sent by the storage device and perform consistency freeze processing on read and write requests for source storage blocks in the source storage pool according to the migration instructions.

[0029] The sending module is used to send a processing completion message to the storage device after the consistency freeze process is completed. The processing completion message is used to instruct the storage device to create an empty target storage block in the target storage pool.

[0030] The switching module is used to receive the target identifier pointing to the target storage block from the storage device, switch the data stream pointing to the target based on the target identifier, and undo the consistency freeze process.

[0031] The data migration module is used to initiate a target read / write request to the storage device based on the new data flow direction. The target read / write request is used to instruct the storage device to obtain the target data from the source storage block and copy it to the target storage block if the target data specified in the target read / write request is not found in the target storage block, in response to the target read / write request.

[0032] On the other hand, this application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above-described data migration method.

[0033] On the other hand, this application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps in the above-described data migration method.

[0034] On the other hand, this application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the above-described data migration method.

[0035] The aforementioned data migration method, apparatus, computer equipment, storage medium, and computer program products involve an operating terminal receiving migration instructions from a storage device and performing consistency freeze processing on read / write requests for source storage blocks in the source storage pool according to these instructions. After the consistency freeze processing is complete, the operating terminal sends a processing completion message to the storage device, instructing it to create an empty target storage block in the target storage pool. The operating terminal receives a target identifier pointing to the target storage block from the storage device, switches the data stream direction based on the target identifier, and releases the consistency freeze processing. Based on the new data stream direction, the operating terminal initiates a target read / write request to the storage device. This request instructs the storage device to retrieve the target data from the source storage block and copy it to the target storage block if the target data specified in the request is not found there. Because an empty target storage block is created in the target storage pool first, instead of directly migrating all data from the source storage block to the target storage block, a second-level switch can be completed, avoiding delays in business processing due to excessive data copying time. Furthermore, by enabling the aforementioned second-level switching and redirecting read / write requests from the source storage block to the target storage block, the entire data migration process can proceed without first disconnecting the communication connection between the operating terminal and the source storage block, and then re-establishing the connection after the data migration is complete. This ensures a seamless migration process for users, eliminating the need to interrupt business operations.

[0036] In addition, the operating terminal can first perform a consistency freeze on read and write requests targeting the source storage block. In this way, before creating the target storage block as the migration target in the target storage pool, it can be ensured that read and write requests that are currently interacting with the source storage block complete the read and write process, ensuring that the data is persisted. Attached Figure Description

[0037] Figure 1 This is a diagram illustrating the application environment of a data migration method in one embodiment.

[0038] Figure 2 This is a flowchart illustrating a data migration method in one embodiment;

[0039] Figure 3 This is a flowchart illustrating a data migration method in one embodiment;

[0040] Figure 4 This is a schematic diagram of the consistency freeze process in one embodiment;

[0041] Figure 5 This is a schematic diagram of the callback process for a flight read / write request in one embodiment;

[0042] Figure 6This is a flowchart illustrating a data migration method in one embodiment;

[0043] Figure 7 This is a schematic diagram of the overall framework of a data migration method in one embodiment;

[0044] Figure 8 This is a schematic diagram illustrating the transmission of a freeze command stream in one embodiment;

[0045] Figure 9 This is a schematic diagram illustrating the process of freezing read / write request dequeueing in one embodiment;

[0046] Figure 10 This is a schematic diagram illustrating the process of handling all flight read / write requests in one embodiment.

[0047] Figure 11 This is a schematic diagram of the delayed migration process in one embodiment;

[0048] Figure 12 This is a schematic diagram illustrating the switching of data stream direction in one embodiment;

[0049] Figure 13 This is a schematic diagram illustrating the release of the consistency freeze in one embodiment;

[0050] Figure 14 This is a schematic diagram illustrating the processing of a target read request in one embodiment;

[0051] Figure 15 A schematic diagram illustrating the process of processing a target write request in one embodiment;

[0052] Figure 16 This is a structural block diagram of a data migration device in one embodiment;

[0053] Figure 17 This is a structural block diagram of a data migration device in one embodiment;

[0054] Figure 18 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation

[0055] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0056] First, before elaborating on the data migration method of this application, let's briefly explain some of the relevant terms used in the embodiments of this application:

[0057] Ceph refers to an open-source distributed storage system that can simultaneously provide block object, file, and block storage services. The data migration method in this application can be applied to the Ceph system.

[0058] RBD (RADOS Block Device): refers to an ordered byte sequence block, a commonly used storage service in Ceph. The storage block involved in this application can specifically be an RBD. Ceph's block storage is based on RADOS, thus leveraging RADOS's snapshot, replication, and consistency features to provide operations such as snapshots, cloning, and backups.

[0059] Librbd refers to a library that provides storage and implements the RBD interface. Through Librbd, storage blocks can be accessed.

[0060] Pool: refers to the logical grouping of data stored in Ceph, which can correspond to the storage pool in this application.

[0061] The data migration method provided in the embodiments of this application will be described in detail below:

[0062] In some embodiments, the data migration method provided in this application can be applied to, for example... Figure 1 In the application environment shown, the operation terminal 102 can communicate with the storage device 104 directly or indirectly via wired or wireless network, which is not specifically limited in this embodiment. Furthermore, the operation terminal 102 and the storage device 104 can cooperate to execute the data migration method in this embodiment. For example, the storage device 104 can send a migration instruction to the operation terminal 102, and the terminal 102 performs consistency freeze on read / write requests for the source storage block according to the migration instruction. After the consistency freeze is completed, the storage device 104 creates an empty target storage block in the target storage pool. The storage device 104 sends the target identifier of the target storage block to the operation terminal 102, and the operation terminal 102 switches the data stream direction based on the target identifier and releases the consistency freeze. When the storage device 104 receives a target read / write request initiated by the operation terminal 102 based on the new data stream direction, and the target data specified in the target read / write request is not found in the target storage block, the storage device 104 retrieves the target data from the source storage block and copies it to the target storage block to respond to the target read / write request.

[0063] The storage device 104 can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. The operating terminal 102 can be a smartphone, tablet, laptop, desktop computer, smart speaker, smartwatch, etc., but is not limited to these. Of course, considering that servers may need to access each other's data, the operating terminal 102 can also be a server; this application embodiment does not specifically limit this. Furthermore, the operating terminal 102 and the storage device 104 can be directly or indirectly connected via wired or wireless communication; this application does not impose any restrictions on this connection.

[0064] In some embodiments, the above definitions and implementation environment descriptions are combined, such as Figure 2 As shown, a data migration method is provided. Taking the application of this method to a storage device as an example, it includes the following steps:

[0065] Step 202: Determine the source storage pool and the target storage pool, and determine the source storage blocks to be migrated from the source storage pool.

[0066] In this context, both storage blocks and storage pools can be considered virtual storage spaces. In practical implementations, a distributed storage system can contain multiple storage devices providing physical storage space. The distributed storage system can virtualize these physical storage spaces, creating a mapping between virtual and physical storage spaces. This facilitates space expansion and provides non-local storage services. The determination of the source and target storage pools in this step can be made from all storage pools within the entire distributed storage system, or from all storage pools involved in a specific storage device. This application embodiment does not specifically limit this approach.

[0067] Storage pools and storage blocks can be hierarchical concepts in virtual storage spaces. A storage pool can include multiple storage blocks. This step mainly involves determining the source storage block to be migrated from the source storage pool. The number of source storage pools and source storage blocks determined by the storage device can be one or more; this embodiment does not specifically limit this. For ease of explanation, this embodiment uses the determination of a source storage pool and a source storage block to be migrated within that pool as an example.

[0068] The reason for data migration in this embodiment is primarily to balance the load levels of different storage pools. Therefore, when determining the source and target storage pools, the storage device can select the storage pool with the highest load as the source pool to be migrated, and the storage pool with the lowest load as the target pool, based on their load levels. Simultaneously, the storage device can use the storage blocks with the highest load in the source storage pool as the source storage blocks to be migrated.

[0069] Step 204: Send a migration instruction to the operation terminal. The migration instruction is used to instruct the operation terminal to perform consistency freeze processing on read and write requests for the source storage block.

[0070] After identifying the source storage block to be migrated, the storage device can inform the operation terminal to perform pre-migration preparations. The operation terminal primarily initiates read and write access to the storage device via read and write requests. It's understandable that when initiating the migration of the source storage block, the operation terminal may be accessing the source storage block, i.e., processing read and write requests for it. Directly interrupting read and write requests would prevent the processed data from being persisted to storage. Therefore, the operation terminal needs to complete the read and write requests that have already started but not yet finished, and simultaneously stop accepting existing but unprocessed read and write requests or newly created read and write requests. In other words, the operation terminal needs to perform consistency freeze processing on the read and write requests for the source storage block, which corresponds to the pre-migration preparations described earlier.

[0071] Step 206: After the consistency freeze process is completed, create an empty target storage block in the target storage pool.

[0072] After completing the consistency freeze process, the operating terminal will no longer accept read / write requests. At this point, the operating terminal can send a completion message to the storage device, allowing the storage device to be aware that the consistency freeze process is complete. The storage device can then begin preparing to migrate the source storage block. Since cross-pool storage block migration is required, the target storage pool naturally needs to be expanded, i.e., a new target storage block needs to be created within the target storage pool. In this step, an empty target storage block refers to a storage block that has not yet been allocated physical storage space. An empty target storage block can be created based on the metadata of the source storage block, such as the size of the data blocks in the source storage block, the size of the source storage block itself, and enabled features. Alternatively, it can be created based on preset parameters; this embodiment does not specifically limit this approach.

[0073] It should be noted that the creation of an empty target storage block in this step does not actually involve data migration. However, a mapping relationship can exist between the empty target storage block and the source storage block. This mapping relationship allows the storage device to read data from the corresponding physical storage space of the source storage block when actual data migration is required. Based on the read data, the device can temporarily allocate a physical storage space of the appropriate size to the empty target storage block and then fill the allocated physical storage space with the read data to achieve data migration.

[0074] Step 208: Send a target identifier pointing to the target storage block to the operation terminal. The target identifier is used to instruct the operation terminal to switch the data stream pointer based on the target identifier and release the consistency freeze.

[0075] After the storage device creates an empty target storage block in the target storage pool, it can send a target identifier pointing to the target storage block to the operation terminal, informing the terminal which storage block will be the migration result. It should be noted that since the storage block is included in the storage pool, in practice, the target identifier can correspond to two levels of pointing, that is, pointing to the target storage block within the target storage pool. Upon receiving the target identifier, the operation terminal can switch the data stream pointing based on the target identifier.

[0076] Here, "data flow direction" mainly refers to the data flow direction of read and write requests, that is, which storage block the operation terminal's read and write requests are targeting. In this step, the operation terminal can unfreeze the consistency freeze and switch read and write requests created before the consistency freeze but not yet processed, which were targeting the source storage block, to targets the target storage block; and also switch read and write requests newly created after the consistency freeze that were targeting the source storage block to targets the target storage block.

[0077] Step 210: For target read / write requests initiated by the operation terminal based on the new data stream, if the target data specified in the target read / write request is not found in the target storage block, the target data is obtained from the source storage block and copied to the target storage block in response to the target read / write request.

[0078] Specifically, a target read / write request initiated based on a new data flow can refer to a read / write request for a source storage block created by the operating terminal before the consistency freeze but not yet processed, or a newly created read / write request for a source storage block after the consistency freeze. Upon receiving a target read / write request, the storage device can first search for the data specified in the target storage block's corresponding physical storage space. If the data specified in the target read / write request is not found in the target storage block's corresponding physical storage space, the storage device can first obtain the target data from the source storage block, allocate physical storage space belonging to the target storage block for the target data, copy the target data to that physical storage space, and respond accordingly to the target read / write request.

[0079] In the aforementioned data migration method, the storage device sends a migration command to the operating terminal, instructing the terminal to perform consistency freeze processing on read / write requests targeting the source storage block. After the consistency freeze is completed, an empty target storage block is created in the target storage pool. The storage device sends a target identifier pointing to the target storage block to the operating terminal. The operating terminal switches the data stream pointer based on the target identifier, releases the consistency freeze, and then initiates target read / write requests based on the new data stream pointer. The storage device retrieves the target data from the source storage block and copies it to the target storage block in response to the target read / write requests. Because an empty target storage block is created in the target storage pool first, instead of directly migrating all data from the source storage block to the target storage block, a second-level switch can be completed, avoiding delays in business processing caused by excessively long data copying times. Furthermore, through this second-level switch and by switching the original read / write requests pointing to the source storage block to those pointing to the target storage block, the entire data migration process can proceed without first disconnecting the communication connection between the operating terminal and the source storage block, and then re-establishing the connection after the data migration is complete. In this way, the data migration process does not require interrupting business processing, ensuring a seamless migration at the user's business level.

[0080] In addition, the operating terminal can first perform a consistency freeze on read and write requests targeting the source storage block. In this way, before creating the target storage block as the migration target in the target storage pool, it can be ensured that read and write requests that are currently interacting with the source storage block complete the read and write process, ensuring that the data is persisted.

[0081] In some embodiments, determining the source storage pool and the target storage pool includes:

[0082] Detect the capacity utilization and read / write bandwidth utilization of each storage pool; determine the load level of each storage pool based on at least one of the capacity utilization or read / write bandwidth utilization; select a source storage pool and a target storage pool from multiple storage pools based on the load level of each storage pool, wherein the load level of the target storage pool is lower than that of the source storage pool.

[0083] It's understandable that if a storage pool is a virtual storage space mapped to physical storage space, then the storage pool also has a corresponding capacity, and the capacity utilization can be represented by the capacity utilization percentage. Similarly, storage blocks can also have a capacity utilization level, represented by the capacity utilization percentage. Read / write bandwidth utilization, on the other hand, represents the total amount of data that can be transferred within a fixed time period. Storage devices can use the read / write bandwidth utilization percentage to represent their read / write bandwidth utilization, and can adjust the read / write bandwidth according to the amount of data requested by read / write requests.

[0084] Specifically, the storage device can detect the capacity utilization and read / write bandwidth utilization of each storage pool at the current moment. This detection primarily aims to identify source storage blocks that can be migrated and target storage blocks that can be migrated. The storage device can perform this detection periodically, and the detection frequency can be set according to requirements; this embodiment does not impose a specific limitation on this.

[0085] For a given storage pool, a storage device can determine its load level solely based on its capacity utilization, such as directly using the capacity utilization percentage as the load level. Alternatively, it can determine the load level solely based on its read / write bandwidth utilization, again using the read / write bandwidth utilization percentage as the load level. Of course, a storage device can also determine the load level based on both capacity utilization and read / write bandwidth utilization simultaneously, such as by weighted summation of these two metrics.

[0086] After determining the load level of each storage pool, the storage device can select source and target storage pools based on their load levels. Specifically, the storage device can identify storage pools with load levels greater than a first load level as source storage pools. Furthermore, it can identify storage pools with load levels less than a second load level as target storage pools. The first load level is higher than the second load level. Through this selection process, a source storage pool with a higher load level and a target storage pool with a lower load level can be selected from all storage pools.

[0087] It should be noted that in the aforementioned process of "determining the source storage blocks to be migrated from the source storage pool," at least one of the storage block capacity utilization or read / write bandwidth utilization can be used to determine the source storage blocks from multiple storage blocks in the source storage pool. This process mainly selects source storage blocks with higher load levels; for details, please refer to the source storage pool selection process.

[0088] Furthermore, the number of source storage pools selected does not have to be limited to one, as long as each source storage pool corresponds to a specific target storage pool. Similarly, the number of source storage blocks selected does not have to be limited to one, as long as each source storage block corresponds to a specific target storage block. Subsequent processes can asynchronously migrate data from multiple source storage blocks.

[0089] In the above embodiments, the storage device determines the load level of each storage pool based on at least one of capacity usage or read / write bandwidth usage, and selects a source storage pool with a higher load and a target storage pool with a lower load from multiple storage pools based on the load level. Since the selection of the source storage pool and source storage block is automatically determined based on the load level, no user intervention is required. Furthermore, after the source storage block is determined, the entire migration process does not require disconnecting and re-establishing the communication connection between the operating terminal and the storage block, nor does it require user assistance in disconnecting the communication connection between the source storage block and the operating terminal. Therefore, the data migration process can reduce the workload of human intervention and is more efficient.

[0090] In some embodiments, selecting a source storage pool and a target storage pool from multiple storage pools based on the load level of each storage pool includes: sorting the load levels of each storage pool from largest to smallest; selecting the storage pool with a sorting number less than a first preset number as the source storage pool, and selecting the storage pool with a sorting number less than a second preset number as the target storage pool.

[0091] Specifically, the above process mainly involves sorting multiple storage pools according to their load levels, selecting the storage pools with higher load levels as source storage pools, and selecting the storage pools with lower load levels as target storage pools. The number of source storage pools selected can be one or more by setting the first preset sequence number, and the same applies to setting the second preset sequence number; this embodiment does not impose specific limitations on this.

[0092] In the above embodiments, the storage device sorts multiple storage pools according to their load levels and filters them using a first preset sequence number and a second preset sequence number. Since the selection of source storage pools and source storage blocks is automatically determined based on load levels, no user intervention is required. Furthermore, after the source storage blocks are determined, no user assistance is needed to disconnect the communication connection between the source storage blocks and the operating terminal. As a result, the data migration process reduces human intervention and is more efficient.

[0093] In some embodiments, the migration instruction is specifically used to instruct the operating terminal to stop processing uninitiated read / write requests for the source storage block, continue processing fly read / write requests for the source storage block, and determine that the consistency freeze process is complete after all fly read / write requests have been processed, wherein the fly read / write request is a read / write request that has been initiated but not yet completed.

[0094] Specifically, the migration instruction sent by the storage device to the operating terminal may include a source identifier pointing to a source storage block in the source storage pool. Upon receiving the migration instruction, the operating terminal can stop processing any pending read / write requests for the source storage block. These pending read / write requests refer to those that have been created but not yet processed. Simultaneously, the operating terminal continues processing any pending read / write requests for the source storage block. Once all pending read / write requests have been processed, the operating terminal can determine that the consistency freeze process is complete. At this point, the operating terminal can send a completion message to the storage device.

[0095] In the above embodiments, the storage device sends a migration command to the operation terminal, which can first perform a consistency freeze on read and write requests targeting the source storage block. This ensures that read and write requests currently interacting with the source storage block are completed before the target storage block is created in the target storage pool, thus guaranteeing data persistence.

[0096] In some embodiments, creating an empty target storage block in a target storage pool includes: obtaining metadata of a source storage block; and based on the metadata of the source storage block, creating an empty target storage block in the target storage pool that has a mapping relationship with the source storage block but has not been allocated physical storage space.

[0097] Specifically, metadata can be understood as descriptive information about storage blocks, which may include the size of data blocks within the storage block, the overall size of the storage block, and enabled functionalities, etc. This application embodiment does not specifically limit this. Based on metadata, a storage device can create an empty target storage block without allocated physical storage space, which can be understood as cloning a new target storage block. The metadata of the source storage block can record the mapping relationships between the source storage block and other storage blocks. The target storage block does not inherit these mapping relationships but instead establishes a mapping relationship with the source storage block.

[0098] In the above embodiments, the storage device creates an empty target storage block that has a mapping relationship with the source storage block but has not been allocated physical storage space, based on the metadata of the source storage block. Since it is not necessary to wait for all the data in the source storage block to be migrated to the target storage block, but rather to migrate it during subsequent read and write operations, the migration can be completed instantaneously simply by creating an empty target storage block, eliminating migration waiting time.

[0099] In some embodiments, creating an empty target storage block in the target storage pool that has a mapping relationship with the source storage block but has not been allocated physical storage space, based on the metadata of the source storage block, includes: creating a snapshot of the source storage block based on the metadata of the source storage block; and creating a target storage block in the target storage pool that is mapped to the snapshot but has not been allocated physical storage space.

[0100] In this context, a snapshot refers to a consistent data copy of a source storage block at a specific point in time. A snapshot created by a storage device based on the metadata of the source storage block is primarily a data copy, distinct from the target storage block. The target storage block is the data access object for read and write requests, while a snapshot is merely a data copy and not the data access object for read and write requests. Creating a snapshot based on metadata primarily involves using data such as the size of the source storage block and the size of the data block.

[0101] It should be noted that in actual implementation, when creating a snapshot, the storage device can simultaneously copy the data from the source storage block to form a data copy of the snapshot. Alternatively, the storage device can choose to create only an empty snapshot. That is, instead of creating a data copy of the snapshot through data copying, the storage device copies the data content before the data to be updated occurs in the source storage block, thus forming a data copy of the snapshot.

[0102] In the above embodiments, the storage device creates a snapshot based on the metadata of the source storage block, and then creates an empty target storage block mapped to the snapshot but without allocated physical storage space. Because it does not require waiting for all data in the source storage block to be migrated to the target storage block, but instead migrates data during subsequent read and write operations, instantaneous migration can be completed simply by creating an empty target storage block, eliminating migration waiting time. Furthermore, creating the target storage block based on a snapshot provides a clear data version reference for the data in the target storage block. Additionally, it ensures the data security of the source storage block, preventing data tampering from directly using the source storage block to create the target storage block, thus guaranteeing the data security of the source storage block.

[0103] In some embodiments, when the target read / write request is a target read request, retrieving target data from the source storage block and copying it to the target storage block in response to the target read / write request includes: traversing the physical storage space of the source storage block to retrieve the target data specified by the offset in the target read request, and copying the retrieved target data to the target storage block; and returning the target data to the operation terminal in response to the target read operation.

[0104] Specifically, a storage block can be mapped to a segment of physical storage space. Alternatively, the source storage block can be a virtual storage space, and thus can also be mapped to multiple segments of physical storage space. A storage block can include multiple smallest partitions, each corresponding to a segment of storage space, and each segment of storage space has a start address and an end address. Therefore, after obtaining the start address of the target storage block, the storage device can traverse backwards from the start address of the target storage block based on the offset in the target read request to find the start address of the data to be read. Thus, the storage device can read all data after that start address, or it can read only the data of at least one smallest partition after that start address.

[0105] As described in the previous embodiments, after receiving a target read / write request initiated by the operating terminal, the storage device first searches for the target data specified in the target read / write request in the target storage block. This search method can also refer to the offset-based search process described above. If the target data is not found in the target storage block, it then searches in the source storage block.

[0106] It should be noted that, as mentioned in the previous embodiment, a snapshot can be created first based on the metadata of the source storage block, and then the target storage block can be created based on the snapshot. If, during snapshot creation, an empty snapshot is not created, but a data copy of the snapshot is created simultaneously; or, when the data in the source storage block is updated, the data before the update is copied to form a corresponding data copy of the snapshot, then if the target data is not found in the target storage block, it can first be searched for in the data copy of the snapshot. If the target data is not found in the snapshot, it can then be searched for in the source storage block. After obtaining the target data, the storage device can copy the target data to the target storage block. Simultaneously, for a target read operation initiated by the operating terminal, the storage device can return the target data to the operating terminal to respond to the target read request from the operating terminal.

[0107] In the above embodiment, an empty target storage block is first created in the target storage pool. Instead of directly migrating all data from the source storage block to the target storage block, when a target read request is received, if the target data specified in the read request is not found in the target storage block, the target data is then retrieved from the source storage block and migrated to the target storage block. This allows for second-level switching, avoiding delays in business processing caused by excessively long data replication times.

[0108] In some embodiments, when the target read / write request is a target write request, obtaining target data from the source storage block and copying it to the target storage block in response to the target read / write request includes: traversing the physical storage space of the source storage block to obtain the target data specified by the offset in the target write request; in response to the target write request, modifying the obtained target data based on the modification information in the target write request to obtain updated target data, and copying the updated target data to the target storage block.

[0109] Specifically, the process of traversing the target data based on the offset can be referred to the previous embodiment. Unlike read requests that only read the target data, write requests typically need to modify the previously stored target data. Therefore, if the storage device finds the target data specified by the target read / write request in the target storage block, it can directly modify the target data in the target storage block. Conversely, the storage device can first obtain the target data from the source storage block, modify it based on the target data, and then allocate corresponding physical storage space for the target storage block to copy the updated target data to the target storage block.

[0110] It should also be noted that, as mentioned in the previous embodiment, a snapshot can be created first based on the metadata of the source storage block, and then the target storage block can be created based on the snapshot. If, when creating the snapshot, an empty snapshot is not created, but a data copy of the snapshot is created simultaneously; or, when the data in the source storage block is updated, the data before the update is copied to form a corresponding data copy of the snapshot, then if the target data is not found in the target storage block, the target data can be searched for first in the data copy of the snapshot. If the target data is not found in the snapshot, it can then be searched for in the source storage block.

[0111] In the above embodiment, an empty target storage block is first created in the target storage pool. Instead of directly migrating all data from the source storage block to the target storage block, when a target write request is received, if the target data specified in the write request is not found in the target storage block, the target data is retrieved from the source storage block, modified based on the modification information in the write request, and then migrated to the target storage block. This allows for second-level switching, avoiding delays in business processing caused by excessive data replication time.

[0112] In some embodiments, the method further includes: determining that the data in the source storage block has been migrated to the target storage block when any target read / write request can find the target data specified by the corresponding target read / write request in the target storage block; and releasing the physical storage space in the source storage block after all the data in the source storage block has been migrated.

[0113] Specifically, the storage device can generate a migration completion message to confirm completion after migrating all data in the source storage block. Alternatively, a preset migration time can be set, and migration is considered complete if the preset time is exceeded. After all data in the source storage block has been migrated, the storage device can release the physical storage space in the source storage block, as the source storage block may need to store other data or may be deactivated and no longer exist. In the case of a virtual storage block, releasing the physical storage space in the source storage block may refer to canceling the mapping relationship between the source storage block and the physical storage space.

[0114] In the above embodiments, after the storage device completes the data migration from the source storage block, it can release the physical storage space of the source storage block, thereby enabling the physical storage space to be better configured and improving space utilization.

[0115] The above process primarily explains the data migration method on the storage device side. In actual implementation, the storage device side also has a corresponding execution process. Therefore, in some embodiments, the above explanations of terms, techniques, and implementation environment are combined, such as... Figure 3 As shown, a data migration method is provided, which is applied to... Figure 1 Taking the operating terminal in the example, the following steps are included:

[0116] Step 302: Receive the migration instruction sent by the storage device, and perform consistency freeze processing on read and write requests for source storage blocks in the source storage pool according to the migration instruction.

[0117] Specifically, after identifying the source storage block to be migrated, the storage device can instruct the operation terminal to perform pre-migration preparations. The operation terminal can then receive a migration instruction from the storage device, which may include a source identifier pointing to the source storage block within the source storage pool.

[0118] Understandably, when initiating a migration of the source storage block, the operating terminal may be accessing the source storage block, i.e., processing read and write requests for the source storage block. Directly interrupting read and write requests would prevent the processed data from being persisted to storage. Therefore, the operating terminal needs to first process the read and write requests that have already started but not yet completed, and simultaneously stop accepting read and write requests that have been created but not yet started, or any newly created read and write requests. In other words, the operating terminal needs to perform consistency freeze processing on the read and write requests for the source storage block.

[0119] Step 304: After the consistency freeze process is completed, a processing completion message is sent to the storage device. The processing completion message is used to instruct the storage device to create an empty target storage block in the target storage pool.

[0120] After completing the consistency freeze process, the operating terminal will no longer accept read and write requests. At this point, the operating terminal can send a completion message to the storage device, allowing the storage device to be aware that the consistency freeze process is complete. The storage device can then begin preparing to migrate the source storage block. Since cross-pool storage block migration is required, the target storage pool naturally needs to be expanded, meaning a new target storage block needs to be created within it. In this step, an empty target storage block refers to a storage block that has not yet been allocated physical storage space. An empty target storage block can be created based on the metadata of the source storage block, such as the data block size, the size of the source storage block, and enabled features.

[0121] Step 306: Receive the target identifier pointing to the target storage block from the storage device, switch the data stream pointer based on the target identifier, and release the consistency freeze process.

[0122] After the storage device creates an empty target storage block in the target storage pool, it can send a target identifier pointing to the target storage block to the operation terminal, informing the terminal which storage block will be the migration result. It should be noted that since the storage block is included in the storage pool, in practice, the target identifier can correspond to two levels of pointing, that is, pointing to the target storage block within the target storage pool. Upon receiving the target identifier, the operation terminal can switch the data stream pointing based on the target identifier.

[0123] Here, "data flow direction" mainly refers to the data flow direction of read and write requests, that is, which storage block the operation terminal's read and write requests are targeting. In this step, the operation terminal can unfreeze the consistency freeze and switch read and write requests created before the consistency freeze but not yet processed, which were targeting the source storage block, to targets the target storage block; and also switch read and write requests newly created after the consistency freeze that were targeting the source storage block to targets the target storage block.

[0124] Step 308: Based on the new data flow direction, initiate a target read / write request to the storage device. The target read / write request is used to instruct the storage device to obtain the target data from the source storage block and copy it to the target storage block if the target data specified in the target read / write request is not found in the target storage block, in response to the target read / write request.

[0125] Specifically, a target read / write request initiated based on a new data flow can refer to a read / write request for a source storage block created by the operating terminal before the consistency freeze but not yet processed, or a newly created read / write request for a source storage block after the consistency freeze. Upon receiving a target read / write request, the storage device can first search for the data specified in the target storage block's corresponding physical storage space. If the data specified in the target read / write request is not found in the target storage block's corresponding physical storage space, the storage device can first obtain the target data from the source storage block, allocate physical storage space belonging to the target storage block for the target data, copy the target data to that physical storage space, and respond accordingly to the target read / write request.

[0126] The above data migration method involves the operating terminal receiving a migration instruction from the storage device and performing consistency freeze processing on read / write requests for source storage blocks in the source storage pool according to the instruction. After the consistency freeze processing is complete, the operating terminal sends a processing completion message to the storage device, instructing the storage device to create an empty target storage block in the target storage pool. The operating terminal receives a target identifier pointing to the target storage block from the storage device, switches the data stream direction based on the target identifier, and releases the consistency freeze processing. Based on the new data stream direction, the operating terminal initiates a target read / write request to the storage device. This request instructs the storage device to retrieve the target data from the source storage block and copy it to the target storage block if the target data specified in the request is not found there. Because an empty target storage block is created in the target storage pool first, instead of directly migrating all data from the source storage block to the target storage block, a second-level switch can be completed, avoiding delays in business processing caused by excessive data copying time. Furthermore, by enabling the aforementioned second-level switching and redirecting read / write requests from the source storage block to the target storage block, the entire data migration process can proceed without first disconnecting the communication connection between the operating terminal and the source storage block, and then re-establishing the connection after the data migration is complete. This ensures a seamless migration process for users, eliminating the need to interrupt business operations.

[0127] In addition, the operating terminal can first perform a consistency freeze on read and write requests targeting the source storage block. In this way, before creating the target storage block as the migration target in the target storage pool, it can be ensured that read and write requests that are currently interacting with the source storage block complete the read and write process, ensuring that the data is persisted.

[0128] In some embodiments, performing consistency freeze processing on read and write requests for the source storage pool according to migration instructions includes: determining the source storage blocks in the source storage pool to be migrated according to the migration instructions; stopping the processing of inactive read and write requests for the source storage blocks and continuing to process fly read and write requests for the source storage blocks, where fly read and write requests are read and write requests that have been started but not yet completed; and determining that the consistency freeze processing is complete after all fly read and write requests have been processed.

[0129] Specifically, upon receiving the migration instruction, the operating terminal can stop processing any pending read / write requests for the source storage block. These pending read / write requests refer to those that have been created but not yet processed. Simultaneously, the operating terminal continues processing any pending read / write requests for the source storage block. Once all pending read / write requests have been processed, the operating terminal can determine that the consistency freeze process is complete. At this point, the operating terminal can send a completion message to the storage device.

[0130] In the above embodiments, the storage device sends a migration command to the operation terminal, which can first perform a consistency freeze on read and write requests targeting the source storage block. This ensures that read and write requests currently interacting with the source storage block are completed before the target storage block is created in the target storage pool, thus guaranteeing data persistence.

[0131] In some embodiments, stopping the processing of uninitiated read / write requests for the source storage block and continuing to process flying read / write requests for the source storage block includes: setting a freeze flag to a freeze marker to control uninitiated read / write requests in the read / write request queue from being moved to the flying read / write request queue; and processing each flying read / write request in the flying read / write request queue until all flying read / write requests in the flying read / write request queue have been processed.

[0132] Specifically, the process of consistency freezing can be found in [reference needed]. Figure 4 .like Figure 4 As shown, the operating terminal can obtain created read / write requests through the read / write receiving unit, while the read / write request queue can be used to store created but not yet initiated read / write requests. By setting the freeze flag to a freeze indicator through the freeze module, the read / write request queue will no longer move to the flight read / write request queue through the read / write processing unit, thus preventing the initiation of subsequent created read / write requests. The operating terminal can then process each flight read / write request in the flight read / write request queue through the read / write processing unit until all flight read / write requests in the queue have been processed.

[0133] The modules mentioned above are mainly divided according to different functions in the operating terminal. In actual implementation, the division can be made according to requirements, and this application embodiment does not impose specific limitations on this. In addition, the freeze flag can be set as a freeze flag when unfreezing, thereby enabling inactive IO requests in the read / write request queue to be moved to the flight read / write request queue. The unfreeze flag and the freeze flag can be represented by different characters.

[0134] In the above embodiments, before determining to begin migration, the operating terminal can first perform a consistency freeze on read and write requests targeting the source storage block. This ensures that read and write requests currently interacting with the source storage block complete their read and write processes before creating the target storage block in the target storage pool, thus ensuring data persistence. Furthermore, because read and write requests in different states can be distinguished by read and write request queues and flying read and write request queues, and the flow of read and write requests from the read and write request queue to the flying read and write request queue is controlled solely by a freeze flag, the efficiency of consistency freeze processing and subsequent unfreezing processes can be improved.

[0135] In some embodiments, the first flight read / write request in the flight read / write request queue is configured with a callback variable to process each flight read / write request in the queue until all flight read / write requests in the queue have been processed, including:

[0136] Each flight read / write request in the flight read / write request queue is processed asynchronously. According to the order of the flight read / write requests in the flight read / write request queue, starting from the first flight read / write request, after the flight read / write request that is ranked first is processed, the callback variable is passed to the next flight read / write request, until the last flight read / write request in the flight read / write request queue passes the callback variable, at which point it is determined that all flight read / write requests in the flight read / write request queue have been processed.

[0137] Specifically, the callback process mentioned above can be found in [reference needed]. Figure 5 .like Figure 5 As shown, the first read / write request in the flight read / write request queue has a callback variable set. Upon completion of the first flight read / write request, the "completion callback" is passed to the right. The "completion callback" corresponds to the callback variable. It should be noted that flight read / write requests in the queue can be processed asynchronously, although the callback process is... Figure 5 The queue order shown is from left to right, but in actual implementation, the asynchronous processing order of flight read / write requests may not be the same as the queue order. If a flight read / write request has been completed, but the callback variable has not yet been passed to that flight read / write request, then that flight read / write request can wait for the callback variable to be passed from the previous flight read / write request.

[0138] In the above embodiments, by setting a callback variable for the first flight read / write request in the flight read / write request queue, and passing the callback variable among the flight read / write requests according to their order in the queue, it is determined that all flight read / write requests in the queue have been processed when the callback variable is passed out by the last flight read / write request. Because of the callback-based movement mechanism, only one callback variable is needed to confirm whether all flight read / write requests in the queue have been processed, eliminating the need to set a completion indicator parameter for each flight read / write request. This reduces the number of variables required in the code and improves code conciseness.

[0139] In some embodiments, the target identifier pointing to the target storage block includes the identifier information of the target storage pool and the identifier information of the target storage block. Switching the data stream pointer based on the target identifier includes: adjusting the identifier information of the source storage pool in the context code used to access the source storage block to the identifier information of the target storage pool, and adjusting the identifier information of the source storage block to the identifier information of the target storage block.

[0140] It's understandable that read and write requests are implemented through code, and the code related to accessing the source storage block corresponding to these requests can be called context code. In the context code originally used to access the source storage block, the source storage block, as the access object, is pointed to through identification information. Furthermore, since the source storage block exists in the source storage pool, this context code also needs to point to the source storage pool through its identification information.

[0141] The target identifier can include the identifier information of the target storage pool and the identifier information of the target storage block. By switching the data stream pointer based on the target identifier, read / write requests that originally accessed the source storage block can be changed to access the target storage block. Therefore, the operating terminal can adjust the identifier information of the source storage pool in this context code to the identifier information of the target storage pool, i.e., adjust it to point to the target storage pool. Similarly, adjusting the identifier information of the source storage block to the identifier information of the target storage block also points to the target storage block. Subsequent read / write requests that originally needed to access data in the source storage block will be redirected to access data in the target storage block.

[0142] In the above embodiments, since only the identification information in the context code needs to be modified, the access target in the context code can be changed from the source storage pool to the target storage pool, and from the source storage block to the target storage block, thereby enabling a relatively convenient switching of the data stream target.

[0143] The above embodiments mainly illustrate the data migration method from the perspectives of the storage device side and the operating terminal side, respectively. For ease of understanding, as... Figure 6As shown, the data migration method mentioned in this application will now be described in conjunction with both the storage device side and the operating terminal side, including the following steps:

[0144] Step 602: The storage device determines the source storage pool and the target storage pool, and determines the source storage blocks to be migrated from the source storage pool.

[0145] Step 604: The storage device sends a migration command to the operating terminal.

[0146] Step 606: The operation terminal performs consistency freeze processing on read and write requests for source storage blocks in the source storage pool according to the migration instructions.

[0147] Step 608: After the consistency freeze process is completed, the operation terminal sends a processing completion message to the storage device.

[0148] Step 610: Based on the processing completion message, the storage device determines that the consistency freeze process is complete and creates an empty target storage block in the target storage pool.

[0149] Step 612: The storage device sends a target identifier pointing to the target storage block to the operation terminal.

[0150] Step 614: The operation terminal switches the data stream direction based on the target identifier and releases the consistency freeze process.

[0151] Step 616: The operating terminal initiates a target read / write request to the storage device based on the new data stream pointer.

[0152] Step 618: If the storage device does not find the target data specified in the target read / write request in the target storage block, it retrieves the target data from the source storage block and copies it to the target storage block in response to the target read / write request.

[0153] In the aforementioned data migration method, the storage device sends a migration command to the operating terminal, instructing the terminal to perform consistency freeze processing on read / write requests targeting the source storage block. After the consistency freeze is completed, an empty target storage block is created in the target storage pool. The storage device sends a target identifier pointing to the target storage block to the operating terminal. The operating terminal switches the data stream pointer based on the target identifier, releases the consistency freeze, and then initiates target read / write requests based on the new data stream pointer. The storage device retrieves the target data from the source storage block and copies it to the target storage block in response to the target read / write requests. Because an empty target storage block is created in the target storage pool first, instead of directly migrating all data from the source storage block to the target storage block, a second-level switch can be completed, avoiding delays in business processing caused by excessively long data copying times. Furthermore, through this second-level switch and by switching the original read / write requests pointing to the source storage block to those pointing to the target storage block, the entire data migration process can proceed without first disconnecting the communication connection between the operating terminal and the source storage block, and then re-establishing the connection after the data migration is complete. In this way, the data migration process does not require interrupting business processing, ensuring a seamless migration at the user's business level.

[0154] In addition, the operating terminal can first perform a consistency freeze on read and write requests targeting the source storage block. In this way, before creating the target storage block as the migration target in the target storage pool, it can be ensured that read and write requests that are currently interacting with the source storage block complete the read and write process, ensuring that the data is persisted.

[0155] This application provides an application scenario, taking the example of an operating terminal initiating a target read request to a storage device. Before providing further explanation, the division of functional modules in the operating terminal and storage device will be described. Specifically, the division of functional modules can be found in [reference needed]. Figure 7 A schematic diagram of the data migration framework in [the context]. Figure 7 In this context, the proxy module represents the functional module in the operating terminal that enables data migration through interaction with the storage device. The access module represents the functional module in the operating terminal responsible for accessing storage blocks and can provide access to dynamic libraries. The multi-pool load balancing control module represents the functional module in the storage device that enables data migration through interaction with the operating terminal. The multi-pool load balancing control module, the source storage pool, and the target storage pool can all be considered as a storage device. It should be noted that the storage device mentioned here can refer to the entire distributed storage system, such as the entire Ceph system, and is not limited to a single storage server. It is used here primarily for ease of explanation.

[0156] It should be noted that, Figure 7The concepts mentioned above—source storage pool, target storage pool, source storage block, and target storage block—are primarily named from a functional perspective. These concepts may have different names in different types of distributed storage systems. For example, in a Ceph system, the source storage pool can be called the source pool, the target storage pool can be called the destination pool, the source storage block can be called the source RBD block device, and the target storage block can be called the destination RBD block device. Again, for ease of explanation, we will use the concepts mentioned above as a unified term. We will now use... Figure 7 As part of the overall framework, this data migration method is applied in this application scenario as follows:

[0157] The multi-pool load balancing control module monitors the load level of each storage pool in real time and determines the source and target storage pools based on the load level of each storage pool. Then, it determines the source storage blocks based on the load level of each storage block in the source storage pool. The load level can be determined based on capacity utilization and read / write bandwidth utilization.

[0158] The multi-pool load balancing control module generates migration instructions based on the source identifiers of the source storage pool and source storage block, and sends these instructions to the agent module. The agent module can then instruct the access module to perform consistency freeze processing on read and write requests targeting source storage blocks in the source storage pool, based on the migration instruction pairs. The reason for consistency freeze processing is that when migration is initiated, user services may still be making read and write requests. These read and write requests currently being executed in the access module are being written to the source storage block. Because read and write operations are in progress and the data has not yet been written to disk, these are referred to as "flying read and write requests." Before migration begins, it is necessary to ensure that the data from these read and write operations has been written to the source storage block, and that subsequent read and write requests that have not yet been started are suspended, i.e., frozen. Therefore, two things need to be done to ensure data consistency before migration: first, ensuring that unstarted read and write requests targeting the source storage block stop running; and second, ensuring that flying read and write requests targeting the source storage block that have been started but not yet completed are completed.

[0159] The following is combined with Figure 8 , Figure 9 and Figure 10 This section explains the process of consistency freezing. First, it combines... Figure 8 To explain, in Figure 8 The access module can be further divided into command units and freeze units. After receiving the migration instruction, the resident service process in the agent module can send a freeze command stream to the command unit through a socket. The socket can specifically be a Unix socket; this embodiment does not impose a specific limitation on it.

[0160] The command unit obtains the freeze command stream by receiving the socket. Since the freeze command stream is also in the form of a socket file, the command unit can parse the socket to obtain the freeze command stream. The command unit then passes the freeze command stream to the freezing unit, which performs the consistent freeze processing.

[0161] As can be seen from the above, consistency freezing mainly involves two tasks, both of which can be handled by the freezing unit. Now, in conjunction with... Figure 9 This section explains how to ensure that uninitiated read / write requests for the source storage block are prevented from entering the running process:

[0162] The access module can add read / write requests for the source storage block to the read / write request queue through the read / write acceptance unit, and simultaneously remove read / write requests from the queue when needed for processing by the read / write processing unit. It should be noted that the length of the read / write request queue shown in the diagram is for illustrative purposes only; in actual implementation, the queue length is not limited to the length shown. It is crucial to ensure that inactive read / write requests for the source storage block are prevented from entering the queue, i.e., dequeuing read / write requests from the queue is prohibited. The freeze unit controls the freeze process by setting a freeze flag based on the freeze command stream.

[0163] For example, after receiving the freeze command stream, the freeze unit can set the freeze flag to a freeze indicator, such as the `true` field. Upon detecting that the freeze flag has been set, the read / write accept unit can prevent read / write requests from leaving the read / write request queue. This ensures that no new read / write requests are dequeued and become pending read / write requests after the consistent freeze process.

[0164] Consistency freezing requires another step, which we will now combine. Figure 10 The process of ensuring that read / write requests that have been initiated but not yet completed for the source storage block are completed is explained:

[0165] The read / write processing unit is responsible for adding read / write requests removed from the read / write request queue to the flying read / write request queue, and for processing the flying read / write requests in the flying read / write request queue. Specifically, after no new read / write requests are removed from the read / write request queue and become flying read / write requests, the read / write processing unit needs to ensure that all previous flying read / write requests have completed. Because processing flying read / write requests is an asynchronous operation, and all asynchronous operations are in an asynchronous waiting completion queue (i.e., the flying read / write request queue), the freeze unit can wait for the callback completion result and set a waiting condition variable based on the callback completion result to ensure that all flying read / write requests are processed and completed.

[0166] The callback mechanism works as follows: Flight read / write requests are queued in a flight read / write request queue. The first flight read / write request in the queue has a callback variable set. Once the first flight read / write request is processed, this callback variable moves towards the tail of the queue as the request completes and is removed, until the last flight read / write request in the queue passes out its callback variable. At this point, the access module can set the value of a waiting condition variable based on the passed callback variable to determine that all flight read / write requests in the queue have been executed and complete the waiting process. The freezing unit can then use this waiting condition variable to set the freeze flag as a thaw flag to initiate the process of removing read / write requests from the queue.

[0167] After the consistency freeze is complete, there are no running read / write requests in the terminal. At this point, the migration of the source storage blocks can begin. Delayed migration is used here, meaning that instead of actually migrating data, snapshots and cloning of storage blocks are used to achieve a migration in seconds. Since no actual data is migrated, the migration time is independent of the amount of data stored in the storage blocks.

[0168] A snapshot is a state mirror of the data in a source storage block at a specific moment, similar to taking a photograph of the source storage block; a snapshot preserves the data at that particular instant. Cloning, on the other hand, refers to quickly creating a new storage block from a snapshot. The cloned target storage block initially contains no data; data is read from the source storage block as needed, which is a delayed migration process.

[0169] The delayed migration process can be found in the following reference. Figure 11 ,exist Figure 11 In this process, the multi-pool load balancing control module first creates a snapshot of the source storage block in the source storage pool, and then uses the created snapshot to create a cloned storage block. Both operations are completed within seconds. Thus, the delayed migration process initially only involves creating snapshots and clones, which are based on the metadata of the source storage block. The actual data migration occurs on demand after the migration is complete, when users read and write to the target storage block. This is why it is called delayed migration.

[0170] After a delayed migration via snapshots and cloning, the data stream used by the operating terminal to access the storage device needs to be switched to access the target storage block instead of the source block. Ceph systems typically use a pseudo-random distribution algorithm to determine which storage block to access. For read / write requests randomly assigned to access the source block, the main factors related to the data stream direction are the storage pool identifier and the storage block identifier of the accessed object. Therefore, the data stream direction needs to be modified from pointing to the source storage pool and source block to pointing to the target storage pool and target block.

[0171] For details on the modification process, please refer to [link / reference]. Figure 12 .exist Figure 12 In this process, the multi-pool load balancing control module can obtain the identification information of the target storage block (and, since the target storage block is in the target storage pool, it can also obtain the identification information of the target storage pool). This obtained identification information is then sent as the target identifier to the proxy module in the operation terminal. Thus, the operation terminal can know that an empty target storage block has been created on the storage device. The proxy module can send the target identifier to the access module via a socket. The access module can then adjust the identification information of the source storage pool in the context code used to access the source storage block to the identification information of the target storage pool, and adjust the identification information of the source storage block to the identification information of the target storage block. This process completes the switch of data flow direction within seconds.

[0172] After the data stream direction is switched, the previous freeze can be lifted. The process for lifting the freeze can be found in [reference needed]. Figure 13 .exist Figure 13 In this process, after confirming that the data stream has switched, the freezing unit can set the freeze flag to the unfreeze flag based on the waiting condition variable, thereby controlling the unfreezing process. For example, the freezing unit can set the freeze flag to the unfreeze flag, such as the false field. After detecting that the freeze flag has been set to the unfreeze flag, the read / write accept unit can resume allowing read / write requests to continue leaving the read / write request queue.

[0173] For a target read request from the target storage device, data can be retrieved from the source storage block on demand. This is now combined with... Figure 14 The process of handling the target read request is explained below: Figure 14 In this process, the operating terminal initiates a target read request for the target storage block through the initiating unit. If the target data specified in the target read request is found in the target storage block, the target data is read directly from the target storage block and returned to the operating terminal. If the target data specified in the target read request is not found in the target storage block, the target data is obtained from the source storage block, copied to the target storage block, and returned to the operating terminal.

[0174] It should be noted that the reading process can be implemented based on offsets; the specific process can be found in the previous embodiment. Additionally, if the target data specified in the target read request is not found in the target storage block, Figure 14 The delayed data migration refers to a snapshot. This process is merely an example; that is, if the target data exists in the snapshot, then the target data is retrieved from the snapshot. For the reasons for using snapshots to create the target storage block, please refer to the previous embodiment.

[0175] This application provides an application scenario, taking the example of an operating terminal initiating a target write request to a storage device. Now, let's take... Figure 7 As part of the overall framework, this data migration method is applied in this application scenario as follows:

[0176] Specifically, the data migration preparation process before processing the target write request can be referred to the relevant descriptions in the previous application scenario embodiments. Regarding the target write request for the target storage device, the following will be combined with... Figure 15 The process of handling the target read request is explained below: Figure 15 In this process, the operating terminal initiates a target write request for the target storage block through the initiating unit. If the target data specified in the target read / write request is found in the target storage block, the target data in the target storage block is directly modified according to the modification information in the target write request. If the target data specified in the target write request is not found in the target storage block, the target data is obtained from the source storage block, modified according to the modification information in the target write request, and the updated target data is copied to the target storage block. Similarly, it should be noted that if the target data specified in the target read request is not found in the target storage block... Figure 15 The delayed data migration refers to a snapshot. This process is just an example; that is, if the target data exists in the snapshot, then the target data is obtained from the snapshot.

[0177] It should be understood that although the steps in the flowcharts of the above embodiments are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the above embodiments may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.

[0178] Based on the same inventive concept, this application also provides a data migration apparatus for implementing the data migration method described above. The solution provided by this apparatus is similar to the implementation scheme described in the above method; therefore, the specific limitations in one or more data migration apparatus embodiments provided below can be found in the limitations of the data migration method described above, and will not be repeated here.

[0179] In some embodiments, such as Figure 16As shown, a data migration device is provided. This device can be a software module, a hardware module, or a combination of both, integrated into a computer device. Specifically, the device includes: a determining module 1602, a sending module 1604, a creating module 1606, a switching module 1608, and a data migration module 1610, wherein:

[0180] The determination module 1602 is used to determine the source storage pool and the target storage pool, and to determine the source storage blocks to be migrated from the source storage pool.

[0181] The sending module 1604 is used to send migration instructions to the operation terminal. The migration instructions are used to instruct the operation terminal to perform consistency freeze processing on read and write requests for the source storage block.

[0182] Create module 1606 to create an empty target storage block in the target storage pool after the consistency freeze process is completed.

[0183] The switching module 1608 is used to send a target identifier pointing to the target storage block to the operation terminal. The target identifier is used to instruct the operation terminal to switch the data stream pointing to the target based on the target identifier and to release the consistency freeze.

[0184] The data migration module 1610 is used to respond to the target read / write request initiated by the operation terminal based on the new data stream direction. If the target data specified in the target read / write request is not found in the target storage block, the module retrieves the target data from the source storage block and copies it to the target storage block.

[0185] In some embodiments, the determining module 1602 is specifically used to detect the capacity utilization and read / write bandwidth utilization of each storage pool; determine the load level of each storage pool based on at least one of the capacity utilization or read / write bandwidth utilization; and select a source storage pool and a target storage pool from multiple storage pools based on the load level of each storage pool, wherein the load level of the target storage pool is lower than that of the source storage pool.

[0186] In some embodiments, the determining module 1602 is further configured to sort the load levels of each storage pool from largest to smallest; and to use the storage pool with a sorting number less than a first preset number as the source storage pool, and the storage pool with a sorting number less than a second preset number as the target storage pool.

[0187] In some embodiments, the migration instruction is specifically used to instruct the operating terminal to stop processing uninitiated read / write requests for the source storage block, continue processing fly read / write requests for the source storage block, and determine that the consistency freeze process is complete after all fly read / write requests have been processed, wherein the fly read / write request is a read / write request that has been initiated but not yet completed.

[0188] In some embodiments, the creation module 1606 is used to obtain the metadata of the source storage block; based on the metadata of the source storage block, an empty target storage block with a mapping relationship to the source storage block is created in the target storage pool, but no physical storage space is allocated.

[0189] In some embodiments, the creation module 1606 is further configured to create a snapshot of the source storage block based on the metadata of the source storage block; and to create a target storage block in the target storage pool that is mapped to the snapshot but has not been allocated physical storage space.

[0190] In some embodiments, when the target read / write request is a target read request, the data migration module 1610 is specifically used to traverse the physical storage space of the source storage block to obtain the target data specified by the offset in the target read request, and copy the obtained target data to the target storage block; in response to the target read operation, the target data is returned to the operation terminal.

[0191] In some embodiments, when the target read / write request is a target write request, the data migration module 1610 is specifically used to traverse the physical storage space of the source storage block to obtain the target data specified by the offset in the target write request; in response to the target write request, the obtained target data is modified based on the modification information in the target write request to obtain updated target data, and the updated target data is copied to the target storage block.

[0192] In some embodiments, the device further includes:

[0193] The release module is used to determine that the data in the source storage block has been completely migrated to the target storage block when the target data specified by the target read / write request can be found in the target storage block for any target read / write request; and to release the physical storage space in the source storage block after all the data in the source storage block has been migrated.

[0194] In the aforementioned data migration device, the storage device sends a migration command to the operating terminal, instructing the terminal to perform consistency freeze processing on read / write requests targeting the source storage block. After the consistency freeze is completed, an empty target storage block is created in the target storage pool. The storage device sends a target identifier pointing to the target storage block to the operating terminal. The operating terminal switches the data stream pointer based on the target identifier, releases the consistency freeze, and then initiates target read / write requests based on the new data stream pointer. Based on the target read / write requests, the storage device retrieves the target data from the source storage block and copies it to the target storage block in response. Because an empty target storage block is created in the target storage pool first, instead of directly migrating all data from the source storage block to the target storage block, a second-level switch can be completed, avoiding delays in business processing caused by excessively long data copying times. Furthermore, through the aforementioned second-level switch and the switching of read / write requests originally pointing to the source storage block to those pointing to the target storage block, the entire data migration process can proceed without first disconnecting the communication connection between the operating terminal and the source storage block, and then re-establishing the communication connection after the data migration is complete. In this way, the data migration process does not require interrupting business processing, ensuring a seamless migration at the user's business level.

[0195] In addition, the operating terminal can first perform a consistency freeze on read and write requests targeting the source storage block. In this way, before creating the target storage block as the migration target in the target storage pool, it can be ensured that read and write requests that are currently interacting with the source storage block complete the read and write process, ensuring that the data is persisted.

[0196] Based on the same inventive concept, this application also provides a data migration apparatus for implementing the data migration method described above. The solution provided by this apparatus is similar to the implementation scheme described in the above method; therefore, the specific limitations in one or more data migration apparatus embodiments provided below can be found in the limitations of the data migration method described above, and will not be repeated here.

[0197] In some embodiments, such as Figure 17 As shown, a data migration device is provided. This device can be a software module, a hardware module, or a combination of both as part of a computer device. Specifically, the device includes: a freeze processing module 1702, a sending module 1704, a switching module 1706, and a data migration module 1708, wherein:

[0198] The freeze processing module 1702 is used to receive migration instructions sent by the storage device and perform consistency freeze processing on read and write requests for source storage blocks in the source storage pool according to the migration instructions.

[0199] The sending module 1704 is used to send a processing completion message to the storage device after the consistency freeze process is completed. The processing completion message is used to instruct the storage device to create an empty target storage block in the target storage pool.

[0200] The switching module 1706 is used to receive the target identifier pointing to the target storage block from the storage device, switch the data stream pointer based on the target identifier, and release the consistency freeze process.

[0201] The data migration module 1708 is used to initiate a target read / write request to the storage device based on the new data flow direction. The target read / write request is used to instruct the storage device to obtain the target data from the source storage block and copy it to the target storage block if the target data specified in the target read / write request is not found in the target storage block, in response to the target read / write request.

[0202] In some embodiments, the freeze processing module 1702 is specifically used to determine the source storage block in the source storage pool to be migrated according to the migration instruction; stop processing the unstarted read / write requests for the source storage block, and continue processing the flying read / write requests for the source storage block, where the flying read / write requests are read / write requests that have been started but not yet completed; and determine that the consistency freeze processing is complete after all flying read / write requests have been processed.

[0203] In some embodiments, the freeze processing module 1702 is further configured to set the freeze identifier to a freeze flag to control that the unstarted read / write requests in the read / write request queue are no longer moved to the flight read / write request queue; and to process each flight read / write request in the flight read / write request queue until all flight read / write requests in the flight read / write request queue have been processed.

[0204] In some embodiments, the first flight read / write request in the flight read / write request queue is set with a callback variable; the freeze processing module 1702 is also used to asynchronously process each flight read / write request in the flight read / write request queue; according to the order of each flight read / write request in the flight read / write request queue, starting from the first flight read / write request, after the flight read / write request that is sorted first is processed, the callback variable is passed to the next flight read / write request, until the last flight read / write request in the flight read / write request queue passes out the callback variable, at which point it is determined that all flight read / write requests in the flight read / write request queue have been processed.

[0205] In some embodiments, the target identifier pointing to the target storage block includes the identifier information of the target storage pool and the identifier information of the target storage block; the switching module 1706 is specifically used to adjust the identifier information of the source storage pool in the context code used to access the source storage block to the identifier information of the target storage pool, and to adjust the identifier information of the source storage block to the identifier information of the target storage block.

[0206] The aforementioned data migration device involves an operating terminal receiving migration instructions from the storage device and performing consistency freeze processing on read / write requests for source storage blocks in the source storage pool according to these instructions. After the consistency freeze is complete, the operating terminal sends a processing completion message to the storage device, instructing it to create an empty target storage block in the target storage pool. The operating terminal receives a target identifier pointing to the target storage block from the storage device, switches the data stream direction based on the target identifier, and releases the consistency freeze. Based on the new data stream direction, the operating terminal initiates a target read / write request to the storage device. This request instructs the storage device to retrieve the target data from the source storage block and copy it to the target storage block if the target data specified in the request is not found there. Because an empty target storage block is created in the target storage pool first, instead of directly migrating all data from the source storage block to the target storage block, a second-level switch can be completed, avoiding delays in business processing due to excessive data copying time. Furthermore, by enabling the aforementioned second-level switching and redirecting read / write requests from the source storage block to the target storage block, the entire data migration process can proceed without first disconnecting the communication connection between the operating terminal and the source storage block, and then re-establishing the connection after the data migration is complete. This ensures a seamless migration process for users, eliminating the need to interrupt business operations.

[0207] In addition, the operating terminal can first perform a consistency freeze on read and write requests targeting the source storage block. In this way, before creating the target storage block as the migration target in the target storage pool, it can be ensured that read and write requests that are currently interacting with the source storage block complete the read and write process, ensuring that the data is persisted.

[0208] For specific limitations on the data migration device, please refer to the limitations on the data migration method above, which will not be repeated here. Each module in the aforementioned data migration device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in the computer device in hardware form, or stored in the memory of the computer device in software form, so that the processor can call and execute the operations corresponding to each module.

[0209] In one embodiment, a computer device is provided, which may be a storage device or an operating terminal, and its internal structure diagram may be as follows: Figure 18As shown, this computer device includes a processor, memory, input / output (I / O) interfaces, and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides the environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The I / O interfaces are used for exchanging information between the processor and external devices. The communication interface is used for communicating with external terminals via a network connection. When the computer program is executed by the processor, it implements a data migration method.

[0210] Those skilled in the art will understand that Figure 18 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0211] In one embodiment, a computer device is also provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above method embodiments.

[0212] In one embodiment, a computer-readable storage medium is provided storing a computer program that, when executed by a processor, implements the steps in the above method embodiments.

[0213] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above method embodiments.

[0214] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these. The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as the combination of these technical features does not contradict each other, it should be considered within the scope of this specification.

[0215] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the invention patent. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this patent application should be determined by the appended claims.

Claims

1. A data migration method, characterized by, The method includes: Determine the source storage pool and the target storage pool, and determine the source storage blocks to be migrated from the source storage pool; A migration instruction is sent to the operating terminal. The migration instruction is used to instruct the operating terminal to perform consistency freeze processing on read and write requests for the source storage block. Specifically, the migration instruction is used to instruct the operating terminal to stop processing unstarted read and write requests for the source storage block and continue processing flying read and write requests for the source storage block. After all flying read and write requests have been processed, the consistency freeze processing is determined to be complete. The flying read and write requests are read and write requests that have been started but not yet completed. After the consistency freeze process is completed, an empty target storage block is created in the target storage pool. The empty target storage block refers to a storage block that has not yet been allocated physical storage space. There is a mapping relationship between the empty target storage block and the source storage block. Send a target identifier pointing to the target storage block to the operation terminal. The target identifier is used to instruct the operation terminal to switch the data stream direction based on the target identifier and release the consistency freeze. In response to a target read / write request initiated by an operating terminal based on a new data stream, if the target data specified in the target read / write request is not found in the target storage block, the target data is obtained from the source storage block based on the mapping relationship and copied to the target storage block in response to the target read / write request.

2. The method of claim 1, wherein, The determination of the source storage pool and the target storage pool includes: Detect the capacity utilization and read / write bandwidth utilization of each storage pool; The load level of each storage pool is determined based on at least one of the following: capacity utilization or read / write bandwidth utilization. Based on the load level of each storage pool, a source storage pool and a target storage pool are selected from the multiple storage pools, wherein the load level of the target storage pool is lower than that of the source storage pool.

3. The method of claim 2, wherein, The step of selecting a source storage pool and a target storage pool from multiple storage pools based on the load level of each storage pool includes: The load levels of each storage pool are sorted from highest to lowest. The storage pool with a sorting number less than the first preset number is used as the source storage pool, and the storage pool with a sorting number less than the second preset number is used as the target storage pool.

4. The method of claim 1, wherein, Creating an empty target storage block in the target storage pool includes: Obtain the metadata of the source storage block; Based on the metadata of the source storage block, an empty target storage block is created in the target storage pool that has a mapping relationship with the source storage block but has not been allocated physical storage space.

5. The method of claim 4, wherein, The step of creating an empty target storage block in the target storage pool, which has a mapping relationship with the source storage block but has not been allocated physical storage space, based on the metadata of the source storage block, includes: A snapshot of the source storage block is created based on the source storage block's metadata; Create a target storage block in the target storage pool that is mapped to the snapshot but has not been allocated physical storage space.

6. The method of claim 1, wherein, When the target read / write request is a target read request, the step of retrieving the target data from the source storage block and copying it to the target storage block in response to the target read / write request includes: Traverse the physical storage space of the source storage block to obtain the target data specified by the offset in the target read request, and copy the obtained target data into the target storage block; In response to the target read operation, the target data is returned to the operation terminal.

7. The method of claim 1, wherein, When the target read / write request is a target write request, the step of retrieving the target data from the source storage block and copying it to the target storage block in response to the target read / write request includes: Traverse the physical storage space of the source storage block to obtain the target data specified by the offset in the target write request; In response to the target write request, the obtained target data is modified based on the modification information in the target write request to obtain updated target data, and the updated target data is copied to the target storage block.

8. The method according to any one of claims 1 to 7, characterized in that, The method further includes: If the target data specified by any target read / write request can be found in the target storage block, it is determined that the data in the source storage block has been migrated to the target storage block. After all the data in the source storage block has been migrated, the physical storage space in the source storage block is released.

9. A data migration method, characterized by, The method includes: The system receives a migration instruction sent by the storage device and performs consistency freeze processing on read and write requests for source storage blocks in the source storage pool according to the migration instruction. Specifically, the migration instruction is used to instruct the operation terminal to stop processing unstarted read and write requests for the source storage blocks and continue processing fly read and write requests for the source storage blocks. The system determines that the consistency freeze processing is complete after all fly read and write requests have been processed. The fly read and write requests are read and write requests that have been started but not yet completed. After the consistency freeze process is completed, a processing completion message is sent to the storage device. The processing completion message is used to instruct the storage device to create an empty target storage block in the target storage pool. The empty target storage block refers to a storage block that has not yet been allocated physical storage space. There is a mapping relationship between the empty target storage block and the source storage block. Receive the target identifier pointing to the target storage block fed back by the storage device, switch the data stream pointing based on the target identifier, and undo the consistency freeze process; Based on the new data flow direction, a target read / write request is initiated to the storage device. The target read / write request is used to instruct the storage device to obtain the target data from the source storage block and copy it to the target storage block based on the mapping relationship if the target data specified by the target read / write request is not found in the target storage block, in response to the target read / write request.

10. The method of claim 9, wherein, The process of freezing read and write requests to the source storage pool according to the migration instructions includes: The source storage blocks in the source storage pool to be migrated are determined according to the migration instructions; Stop processing inactive read / write requests for the source storage block and continue processing on-the-fly read / write requests for the source storage block, which are read / write requests that have been initiated but not yet completed. After all flight read / write requests have been processed, the consistency freeze process is confirmed to be complete.

11. The method of claim 10, wherein, The step of stopping processing inactive read / write requests for the source storage block and continuing to process on-the-fly read / write requests for the source storage block includes: Set the freeze flag to freeze flag to prevent inactive read / write requests in the read / write request queue from being moved to the flight read / write request queue; Each flight read / write request in the flight read / write request queue is processed until all flight read / write requests in the flight read / write request queue have been processed.

12. The method of claim 11, wherein, The first flight read / write request in the flight read / write request queue is set with a callback variable. The process of processing each flight read / write request in the flight read / write request queue until all flight read / write requests in the queue have been processed includes: Each flight read / write request in the flight read / write request queue is processed asynchronously; According to the order of the flight read / write requests in the flight read / write request queue, starting from the first flight read / write request, after the flight read / write request that is ranked first is processed, the callback variable is passed to the next flight read / write request, until the last flight read / write request in the flight read / write request queue passes out the callback variable, at which point it is determined that all flight read / write requests in the flight read / write request queue have been processed.

13. The method of claim 9, wherein, The target identifier pointing to the target storage block includes the identifier information of the target storage pool and the identifier information of the target storage block. Switching the data stream pointer based on the target identifier includes: The identifier information of the source storage pool in the context code used to access the source storage block is adjusted to the identifier information of the target storage pool, and the identifier information of the source storage block is adjusted to the identifier information of the target storage block.

14. A data migration apparatus, characterized by comprising: The device includes: The determination module is used to determine the source storage pool and the target storage pool, and to determine the source storage blocks to be migrated from the source storage pool; The sending module is used to send a migration instruction to the operation terminal. The migration instruction is used to instruct the operation terminal to perform consistency freeze processing on read and write requests for the source storage block. Specifically, the migration instruction is used to instruct the operation terminal to stop processing unstarted read and write requests for the source storage block and continue processing flying read and write requests for the source storage block. After all flying read and write requests have been processed, the consistency freeze processing is determined to be completed. The flying read and write requests are read and write requests that have been started but not yet completed. A creation module is used to create an empty target storage block in the target storage pool after the consistency freeze process is completed. The empty target storage block refers to a storage block that has not yet been allocated physical storage space. There is a mapping relationship between the empty target storage block and the source storage block. The switching module is used to send a target identifier pointing to the target storage block to the operation terminal. The target identifier is used to instruct the operation terminal to switch the data stream pointing to the target based on the target identifier and to release the consistency freeze. The data migration module is used to respond to the target read / write request initiated by the operating terminal based on a new data stream direction. If the target data specified in the target read / write request is not found in the target storage block, the module retrieves the target data from the source storage block based on the mapping relationship and copies it to the target storage block.

15. The apparatus of claim 14, wherein, The determining module is specifically used to detect the capacity utilization and read / write bandwidth utilization of each storage pool; determine the load level of each storage pool based on at least one of the capacity utilization or read / write bandwidth utilization; and select a source storage pool and a target storage pool from the multiple storage pools based on the load level of each storage pool, wherein the load level of the target storage pool is lower than that of the source storage pool.

16. The apparatus of claim 15, wherein, The determining module is also used to sort the load levels of each storage pool from largest to smallest; and to use the storage pool with the sorting number less than the first preset number as the source storage pool, and the storage pool with the sorting number less than the second preset number as the target storage pool.

17. The apparatus of claim 14, wherein, The creation module is used to obtain the metadata of the source storage block; based on the metadata of the source storage block, it creates an empty target storage block in the target storage pool that has a mapping relationship with the source storage block but has not been allocated physical storage space.

18. The apparatus of claim 17, wherein, The creation module is also used to create a snapshot of the source storage block based on the metadata of the source storage block; and to create a target storage block in the target storage pool that is mapped to the snapshot but has not been allocated physical storage space.

19. The apparatus of claim 14, wherein, When the target read / write request is a target read request, the data migration module is specifically used to traverse the physical storage space of the source storage block to obtain the target data specified by the offset in the target read request, and copy the obtained target data into the target storage block; In response to the target read operation, the target data is returned to the operation terminal.

20. The apparatus of claim 14, wherein, When the target read / write request is a target write request, the data migration module is specifically used to traverse the physical storage space of the source storage block to obtain the target data specified by the offset in the target write request; in response to the target write request, the obtained target data is modified based on the modification information in the target write request to obtain updated target data, and the updated target data is copied to the target storage block.

21. The apparatus of any one of claims 14-20, wherein, The device further includes: The release module is used to determine that the data in the source storage block has been completely migrated to the target storage block when the target data specified by the target read / write request can be found in the target storage block for any target read / write request. After all the data in the source storage block has been migrated, the physical storage space in the source storage block is released.

22. A data migration apparatus, comprising: The device includes: The freeze processing module is used to receive migration instructions sent by the storage device and perform consistency freeze processing on read and write requests for source storage blocks in the source storage pool according to the migration instructions. Specifically, the migration instructions are used to instruct the operation terminal to stop processing unstarted read and write requests for the source storage blocks and continue processing fly read and write requests for the source storage blocks. The consistency freeze processing is determined to be completed after all fly read and write requests have been processed. The fly read and write requests are read and write requests that have been started but not yet completed. The sending module is used to send a processing completion message to the storage device after the consistency freeze process is completed. The processing completion message is used to instruct the storage device to create an empty target storage block in the target storage pool. The empty target storage block refers to a storage block that has not yet been allocated physical storage space. There is a mapping relationship between the empty target storage block and the source storage block. The switching module is used to receive the target identifier pointing to the target storage block fed back by the storage device, switch the data stream pointing to the target based on the target identifier, and release the consistency freeze process. The data migration module is used to initiate a target read / write request to the storage device based on a new data flow direction. The target read / write request is used to instruct the storage device to obtain the target data from the source storage block and copy it to the target storage block based on the mapping relationship if the target data specified by the target read / write request is not found in the target storage block, in response to the target read / write request.

23. The apparatus of claim 22, wherein, The freeze processing module is specifically used to determine the source storage block in the source storage pool to be migrated according to the migration instruction; stop processing the unstarted read / write requests for the source storage block, and continue processing the flying read / write requests for the source storage block, wherein the flying read / write requests are read / write requests that have been started but not yet completed; and determine that the consistency freeze processing is complete after all flying read / write requests have been processed.

24. The apparatus of claim 23, wherein, The freeze processing module is also used to set the freeze identifier as a freeze flag to control the unstarted read / write requests in the read / write request queue from being moved to the flight read / write request queue; and to process each flight read / write request in the flight read / write request queue until all flight read / write requests in the flight read / write request queue have been processed.

25. The apparatus of claim 24, wherein, The first flight read / write request in the flight read / write request queue is configured with a callback variable. The freeze processing module is also used to asynchronously process each flight read / write request in the flight read / write request queue. According to the order of each flight read / write request in the flight read / write request queue, starting from the first flight read / write request, after the flight read / write request that is ranked first is processed, the callback variable is passed to the next flight read / write request. This continues until the last flight read / write request in the flight read / write request queue passes out the callback variable, at which point it is determined that all flight read / write requests in the flight read / write request queue have been processed.

26. The apparatus according to claim 22, characterized in that, The target identifier pointing to the target storage block includes the identifier information of the target storage pool and the identifier information of the target storage block. The switching module is specifically used to adjust the identifier information of the source storage pool in the context code used to access the source storage block to the identifier information of the target storage pool, and to adjust the identifier information of the source storage block to the identifier information of the target storage block.

27. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 13.

28. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 13.

29. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 13.

Citation Information

Patent Citations

  • Data migration method applied in storage system and storage devices

    CN105549904A

  • Virtual machine cross-cloud platform migration method, system and device and storage medium

    CN113760454A