METHOD AND DEVICE FOR DATA PROCESSING IN A STORAGE SYSTEM AND COMPUTER-READY STORAGE MEDIUM
Patent Information
- Application Number
- DE602019058965
- Authority / Receiving Office
- DE · DE
- Patent Type
- Patents
- Current Assignee / Owner
- Filing Date
- 2019-07-26
- Publication Date
- 2024-09-11
- Estimated Expiration
- 2039-07-26
AI Technical Summary
Inline deduplication in storage systems incurs significant resource overheads due to fingerprint queries, affecting performance by increasing processor and memory usage, especially during high loads.
A data processing method that dynamically determines whether to perform inline deduplication based on system load, skipping it during high loads and recording mapping entries in a log to reduce resource usage and optimize storage performance by migrating data blocks to dedicated storage spaces based on compression rates and distances.
This approach reduces resource overheads and improves storage system performance by minimizing fingerprint queries and optimizing data block migration, thereby enhancing overall system efficiency and storage space utilization.
Description
TECHNICAL FIELD
[0001] The present disclosure relates to the field of information technologies, and more specifically, to a data processing method and apparatus in a storage system, and a computer readable storage medium.BACKGROUND
[0002] As a technology that saves data storage space in a storage system, deduplication is quickly proliferating and has high market value. Inline deduplication removes redundancies from data before the data is written to a hard disk, to achieve data reduction. An advantage is that a number of write times of a hard disk can be reduced. However, for the inline deduplication, it needs to query whether a fingerprint table includes a fingerprint same as that of a data block. The fingerprint query can cause a large quantity of resource overheads and affect performance of the storage system.
[0003] CN108762679A relates to method for combining online DDP and offline DDP, and related device thereof. CN109542360A relates to data re-deletion method, device, apparatus and system, and computer readable storage medium.SUMMARY
[0004] The present disclosure provides a data processing method in a storage system, to reduce resource overheads of the storage system and improve storage performance of the storage system.
[0005] The invention has been defined in the independent claims. Further specific technical features have been defined in the dependent claims.
[0006] According to a first aspect, a data processing method in a storage system is provided. The method includes: calculating a first fingerprint of a first data block; and when the storage system is under a first load, performing an inline deduplication operation on the first data block by querying a fingerprint table based on the first fingerprint; calculating a second fingerprint of a second data block; and when the storage system is under a second load, directly storing the second data block without performing the inline deduplication operation; and recording a mapping entry between the second fingerprint and a first storage address of the second data block, where the mapping entry is used to record mapping between the second fingerprint and the first storage address of the second data block. The first load is less than the second load. In this solution, the storage system determines, based on the load of the storage system, whether to perform the inline deduplication operation on a data block that is not stored. This can reduce resource overheads of the storage system, and improve performance of the storage system.
[0007] The method further includes: querying, based on the second fingerprint, whether the fingerprint table includes a first fingerprint entry, where the first fingerprint entry includes mapping between the second fingerprint and a second storage address, and the second storage address stores a data block that has same content as the second data block; when the fingerprint table includes the first fingerprint entry, establishing mapping between a logical address of the second data block and the second fingerprint in the first fingerprint entry; when the fingerprint table does not include the first fingerprint entry, adding a second fingerprint entry to the fingerprint table, where the second fingerprint entry includes mapping between the second fingerprint and a third storage address, and the third storage address is used to store a storage address of a second data block migrated by the storage system from the first storage address; and establishing mapping between the logical address of the second data block and the second fingerprint. In this solution, deduplication is further performed on a stored data block on which the inline deduplication is not performed. This can release and save storage space.
[0008] After the deduplication operation is further performed on the stored data block on which the inline deduplication operation is not performed, the mapping entry between the second fingerprint and the first storage address of the second data block is deleted, to release storage space.
[0009] The recording a mapping entry between the second fingerprint and a first storage address of the second data block specifically includes: recording, in a log, the mapping entry between the second fingerprint and the first storage address of the second data block. The mapping entry between the second fingerprint and the first storage address of the second data block is persistently recorded in the log. This can prevent fingerprint information from being lost, to help perform the deduplication operation.
[0010] Further, the method further includes: determining whether a plurality of mapping entries recorded in the log include the second fingerprint, where the plurality of mapping entries all include the second fingerprint, but storage addresses in the plurality of mapping entries are different; and establishing mapping between a logical address of a data block stored at another storage address other than the first storage address in the plurality of mapping entries and the second fingerprint in the fingerprint table.
[0011] Further, the method further includes: selecting the first storage address from the storage addresses in the plurality of mapping entries according to a migration policy, and migrating the second data block at the first storage address to the third storage address.
[0012] The migration policy includes at least one of whether the data block is compressed, a compression rate of a compression algorithm used when the data block is compressed, or a distance between the storage addresses in the plurality of mapping entries and storage space in which the third storage address is located.
[0013] A plurality of mapping entries with a same fingerprint, for example, the second fingerprint, are recorded in the log. The storage addresses in the plurality of mapping entries are different. These storage addresses may be located on a plurality of storage nodes that use distributed storage. Data blocks at the storage addresses may be data blocks that are stored after being compressed. These data blocks may be compressed by using different compression algorithms. In other words, a compression rate and compression performance of a compression algorithm used by each data block varies.
[0014] The storage address in the fingerprint entry of the fingerprint table provided in this implementation of the present disclosure is dedicated storage space allocated by the storage system, and the storage space is used to store a data block on which the deduplication operation (inline deduplication and post-deduplication) is performed. Therefore, for a data block that is directly stored and on which the inline deduplication operation is not performed, a corresponding fingerprint is not found in the fingerprint table after the post-deduplication operation is performed, and the data block needs to be migrated to storage space dedicated to store a data block on which the deduplication operation is performed. When the fingerprint table does not include the first fingerprint entry, a second fingerprint entry is added to the fingerprint table, where the second fingerprint entry includes mapping between the second fingerprint and a third storage address, and the third storage address is used to store a storage address of a second data block migrated by the storage system from the first storage address.
[0015] In a scenario in which the plurality of mapping entries with the same fingerprint are recorded in the log, when it is determined that the same fingerprint is a new fingerprint in the storage system, one storage address is selected from a plurality of storage addresses in the plurality of mapping entries, a data block at the selected storage address is migrated to storage space dedicated to store a data block on which the deduplication operation is performed. For example, when the fingerprint table does not include the first fingerprint entry, third storage space in the second fingerprint entry is added to the fingerprint table. A new fingerprint entry is established in the fingerprint table. When a data block that needs to be migrated is selected from the plurality of data blocks with the same fingerprint, the to-be-migrated data block is selected based on factors such as whether the data block is compressed, a compression rate of the data block, a distance between the data block and storage space dedicated to store a data block on which the deduplication operation is performed. In other words, the to-be-migrated data block is a data block that needs to be reserved after the post-deduplication operation is performed. A compressed data block is preferentially used as a to-be-migrated data block than a decompressed data block. A data block that is compressed by using a compression algorithm with a high compression rate is preferentially used as a to-be-migrated data block than a data block that is compressed by using a compression algorithm with a low compression rate. A data block that has a short distance from migrating to storage space dedicated to store a data block on which the deduplication operation is performed is preferentially used as a to-be-migrated data block than a data block that has a long distance from migrating to storage space dedicated to store a data block on which the deduplication operation is performed. When the to-be-migrated data block is selected based on the at least two factors, priorities in descending order are as follows: a data block that has a short distance from migrating to storage space dedicated to store a data block on which the deduplication operation is performed and that is compressed by using a compression algorithm with a high compression rate, a data block that has a long distance from migrating to storage space dedicated to store a data block on which the deduplication operation is performed and that is compressed by using a compression algorithm with a high compression rate, a data block that has a short distance from migrating to storage space dedicated to store a data block on which the deduplication operation is performed and that is compressed by using a compression algorithm with a low compression rate, a data block that has a long distance from migrating to storage space dedicated to store a data block on which the deduplication operation is performed and that is compressed by using a compression algorithm with a low compression rate, a data block that has a short distance from migrating to storage space dedicated to store a data block on which the deduplication operation is performed and that is not compressed, and a data block that has a long distance from migrating to storage space dedicated to store a data block on which the deduplication operation is performed and that is not compressed. In this implementation of the present disclosure, in a process of migrating the compressed data block, the data block does not need to be decompressed.
[0016] Further, the method further includes: deleting the plurality of mapping entries.
[0017] According to a second aspect, a data processing apparatus is provided. The data processing apparatus includes an interface and a processor, the interface communicates with the processor, and the processor is further configured to perform the method in any one of the first aspect or the possible implementations of the first aspect.
[0018] According to a third aspect, a computer program product including an instruction is provided. When a processor of a computer executes the instruction in the computer program product, the processor is configured to perform the method in any one of the first aspect or the possible implementations of the first aspect.BRIEF DESCRIPTION OF DRAWINGS
[0019] FIG. 1 is a schematic architectural diagram of a storage system according to an implementation of the present disclosure; FIG. 2 is a schematic structural diagram of a storage controller according to an implementation of the present disclosure within the scope of the appended claims; FIG. 3 is a schematic architectural diagram of a distributed storage system according to an implementation of the present disclosure; FIG. 4 is a schematic structural diagram of a server in a distributed storage system according to an implementation of the present disclosure; FIG. 5 is a schematic structural diagram of a fingerprint entry of a fingerprint table according to an implementation of the present disclosure; FIG. 6 is a schematic flowchart of deduplication according to an implementation of the present disclosure within the scope of the appended claims; FIG. 7 is a schematic flowchart of deduplication according to an implementation of the present disclosure within the scope of the appended claims; and FIG. 8 is a schematic structural diagram of a data processing device according to an implementation of the present disclosure. DESCRIPTION OF IMPLEMENTATIONS
[0020] To make the objectives, technical solutions, and advantages of this invention clearer, the following further describes various implementations in detail with reference to the accompanying drawings. The implementations described below are not all claimed, they are included to help understanding the context of the invention. While the description refers to various implementations, the embodiments of the invention are those which comprise at least all the features of an independent claim. Any implementation which does not fall within the scope of the claims does not form part of the invention, but rather included as an illustrative example that is useful for understanding the invention.
[0021] First, a storage system applicable to the implementations of the present disclosure is described.
[0022] As shown in FIG. 1, the storage system in this implementation of the present disclosure may be a storage array (for example, the Oceanstor ®< 18000 series and the Oceanstor ®< Dorado ®< series of Huawei ®< ). The storage array includes a storage controller 101 and a plurality of hard disks, and the hard disk includes a solid state drive (Solid State Disk, SSD), a disk, or the like. As shown in FIG. 2, the storage controller 101 includes a central processing unit (Central Processing Unit, CPU) 201, a memory 202, and an interface 203. The memory 202 stores a computer instruction. The CPU 201 executes the computer instruction in the memory 202 to perform management and data access operations on the storage system. In addition, the processor 201 may be a central processing unit (Central Processing Unit, CPU), or may be a field programmable gate array (Field Programmable Gate Array, FPGA), or other hardware may be used as a processor, or an FPGA or other hardware and a CPU together are used as a processor, and the processor communicates with the interface 203. The memory 202 in the implementations of the present disclosure provides a memory for the CPU. The interface 203 may be a network interface card (Networking Interface Card, NIC), a host bus adapter (Host Bus Adapter, HBA), or the like.
[0023] In the storage array described in FIG. 1 and FIG. 2, the controller 101 is configured to perform the data processing method in the implementations of the present disclosure.
[0024] Further, the storage system in the implementations of the present disclosure may also be a distributed storage system (for example, Fusionstorage ®< series of Huawei ®< ). Fusionstorage ®< series of Huawei ®< is used as an example. For example, as shown in FIG. 3, the distributed storage system includes a plurality of servers, such as a server 1, a server 2, a server 3, ..., and a server 6. The servers communicate with each other over an infinite bandwidth (InfiniBand) or an Ethernet network. In actual application, a quantity of servers in the distributed storage system may be increased or decreased based on an actual requirement. This is not limited in this implementation of the present disclosure. The server in the distributed storage system is also referred to as a storage node.
[0025] The server in the distributed storage system includes a structure shown in FIG. 4. As shown in FIG. 4, each server in the distributed storage system includes a central processing unit (Central Processing Unit, CPU) 401, a memory 402, an interface 403, a hard disk 1, a hard disk 2, and a hard disk 3. The memory 402 stores a computer instruction, and the CPU 401 executes the program instruction in the memory 402 to perform a corresponding operation. The interface 403 may be a hardware interface, for example, a network interface card (Network Interface Card, NIC) or a host bus adapter (Host Bus Adaptor, HBA), or may be a program interface module. The hard disk includes a solid state drive (Solid State Disk, SSD), a disk, or the like. In addition, the processor 401 may be a central processing unit (Central Processing Unit, CPU), or may be a field programmable gate array (Field Programmable Gate Array, FPGA), or other hardware may be used as a processor, or a combination of an FPGA (or other hardware) and a CPU is used as a processor. The memory 402 in the implementations of the present disclosure may provide a memory for the CPU 401. The interface 303 may be a network interface card (Networking Interface Card, NIC), or a host bus adapter (Host Bus Adaptor, HBA).
[0026] The storage system receives data and divides the data into data blocks. The data can be divided into data blocks with a fixed length or data blocks with variable lengths according to different division methods. A fingerprint of the data block (for example, a hash operation is performed on the data block, and a hash value obtained through the operation is used as the fingerprint of the data block) is obtained, and a deduplication operation is performed based on the fingerprint of the data block. Specifically, the deduplication includes: querying whether a fingerprint table includes a same fingerprint (which means that a data block represented by the fingerprint exists in the storage system), if the fingerprint table does not include the fingerprint (which means that a data block represented by the fingerprint does not exist in the storage system), allocating a storage address in the storage system and storing the data block at the storage address, adding a new fingerprint entry to the fingerprint table, that is, establishing mapping between the fingerprint and the storage address, and establishing metadata of the data block, that is, establishing mapping between a logical block address of the data block and the fingerprint. When the data block with the same fingerprint is written into the storage system again, the storage system only needs to establish mapping between a logical block address of the data block that is written again and the fingerprint in the fingerprint table, and does not need to store the data block that is written again. This avoids repeated storage of the same data block. A fingerprint entry of the fingerprint table is shown in FIG. 5, and includes a fingerprint A and a storage address SD for storing data corresponding to the fingerprint. The fingerprint entry may further include a reference count, and the reference count is used to indicate a quantity of data blocks of the fingerprint that is pointed to. For example, when the storage system stores the data block for the first time, the reference count is 1. When the storage system stores the data block for the second time, the reference count is updated to 2.
[0027] In the storage system, to query the fingerprint table, the fingerprint table needs to be stored in a memory. To reduce memory usage of the fingerprint table, not all fingerprint tables are loaded in the memory. Therefore, in a deduplication process, the storage system queries and loads a corresponding fingerprint table based on a relationship between fingerprint distribution and the fingerprint table. The foregoing operation process may increase overheads of the storage system. For example, cross-network querying may increase network overheads. A fingerprint query process may also increase resource overheads in the storage system and increase load of the storage system. Resource overheads in this implementation of the present disclosure include, for example, overheads of a processor and overheads of a memory. The increasing of overheads may affect performance of the storage system.
[0028] In this implementation of the present disclosure, to reduce resource overheads of the storage system and improve storage performance of the storage system, whether to perform an inline deduplication operation or reduce a quantity of times of an inline deduplication operation is determined based on the load of the storage system. In this implementation of the present disclosure, a load threshold may be set. The storage system calculates the fingerprint of the data block, and when the load of the storage system is less than the load threshold, the storage system queries the fingerprint table to perform the inline deduplication operation on the data block. A specific implementation process includes: querying whether the fingerprint table includes the fingerprint, and when the fingerprint table includes the fingerprint, skipping storing the data block, and establishing mapping between a logical address of the data block and the fingerprint in the fingerprint table; or when the fingerprint table does not include the fingerprint, storing the data block, adding a new fingerprint entry to the fingerprint table, and establishing mapping between a logical address of the data block and the fingerprint in the new fingerprint entry. The new fingerprint entry includes mapping between the fingerprint and a storage address for storing the data block.
[0029] When the load of the storage system is greater than the load threshold, the inline deduplication operation is not performed, the data block is directly stored, and mapping between a logical address and a storage address of the data block is established. A mapping entry between the fingerprint of the data block and the storage address of the data block is recorded in a log. The mapping entry includes mapping between the fingerprint of the data block and the storage address of the data block. In this implementation of the present disclosure, the storage address is a location of the data block in the storage system. The logical address of the data block is an address that is accessed by a host, for example, a logical block address (Logical Block Address, LBA). In this implementation of the present disclosure, the deduplication operation before the storage system stores the data block is referred to as an inline deduplication operation. The deduplication operation performed on the data block stored in the storage system is referred to as a post-deduplication operation.
[0030] In this embodiment, which is within the scope of the appended claims, whether to perform the inline deduplication operation is determined based on the load of the storage system. A specific procedure is shown in FIG. 6.
[0031] Step 601: Calculate a first fingerprint of a first data block.
[0032] Step 602: When a storage system is under a first load, perform an inline deduplication operation on the first data block by querying a fingerprint table based on the first fingerprint.
[0033] Step 603: Calculate a second fingerprint of a second data block.
[0034] Step 604: When the storage system is under a second load, directly store the second data block without performing the inline deduplication operation.
[0035] Step 605: Record a mapping entry between the second fingerprint and a first storage address of the second data block.
[0036] In this implementation of the present disclosure, to prevent the fingerprint from being lost, when no inline deduplication operation is performed, a mapping entry between the fingerprint of the second data block and the first storage address is persistently stored in a log. In this implementation of the present disclosure, the first load is less than the second load. For example, the second load is greater than a load threshold, and the first load is less than the load threshold. The mapping entry between the second fingerprint and the first storage address of the second data block includes mapping between the second fingerprint and the first storage address of the second data block.
[0037] Whether to perform the inline deduplication operation is determined based on the load of the storage system. This can reduce resource overheads of the inline deduplication, reduce the load of the storage system, and improve performance of the storage system.
[0038] In another implementation of this implementation of the present disclosure, a plurality of load thresholds may be set, so that different operations are performed in different load ranges. For example, when the storage system is in a highest load range, the inline deduplication operation is not performed on all data blocks, but the data blocks are directly stored in the storage system. In one implementation, an inline deduplication function may be disabled. When the storage system is in a minimum load range, the inline deduplication operation is performed on all data blocks, and then a unique data block that is determined to be stored after the inline deduplication operation is performed, namely, a data block with unique content is stored. When the load of the storage system is between the maximum load and the minimum load, a quantity of times of the inline deduplication operation can be reduced. In specific implementation, for example, only one load threshold may be set, for example, 50%. When the load is greater than 50%, the storage system does not perform the inline deduplication operation on the data block. When the load is less than or equal to 50%, the storage system performs the inline deduplication operation on the data block. In another implementation of this implementation of the present disclosure, when there are a plurality of load thresholds, for example, 70% and 40%, loads may be divided into three load ranges. For example, if a load range 1 includes load that is greater than 70%, the load range 1 is denoted as (70%-100%). If a load range 2 includes load that is greater than 40% but not greater than 70%, the load range 2 is denoted as (40%-70%]. If a load range 3 includes load that is not greater than 40%, the load range 3 is denoted as (0-40%]. In this implementation of the present disclosure, the load may also be represented in another form.
[0039] The load in this implementation of the present disclosure may be specifically CPU usage, memory usage, network performance, or the like in the storage system, or may be one or more of these parameters. This is not limited in this implementation of the present disclosure.
[0040] In this implementation of the present disclosure, in the step 605, the mapping entry between the second fingerprint and the first storage address of the second data block is recorded. A specific implementation may be persistently storing in a form of the log. This can prevent fingerprint information from being lost, to help perform the deduplication operation. In another implementation, storage may also be performed in a form of an index table.
[0041] In this implementation of the present disclosure, whether to perform the inline deduplication operation on the data block is determined based on the load of the storage system. Therefore, there is a case in which a data block is directly stored without being performed the inline deduplication operation. To further save and release storage space, in this implementation of the present disclosure, a post-deduplication operation is further performed on the data block. The post-deduplication operation is a deduplication operation performed on a data block that has been stored in the storage system. With reference to the implementation shown in FIG. 6, an embodiment, which is within the scope of the appended claims, as shown in FIG. 7 includes the following steps.
[0042] Step 701: Query, based on a second fingerprint, whether a first fingerprint entry in a fingerprint table includes the second fingerprint.
[0043] The first fingerprint entry includes mapping between the second fingerprint and a second storage address, and the second storage address stores a data block that has same content as the second data block.
[0044] Step 702: When the fingerprint table includes the first fingerprint entry, establish mapping between a logical address of the second data block and the second fingerprint in the first fingerprint entry.
[0045] Step 703: When the fingerprint table does not include the first fingerprint entry, add a second fingerprint entry to the fingerprint table, where the second fingerprint entry includes mapping between the second fingerprint and a third storage address, and the third storage address is used to store the second data block migrated by the storage system from the first storage address.
[0046] In another implementation, the second fingerprint entry includes mapping between the second fingerprint and the first storage address.
[0047] Step 704: Establish mapping between the logical address of the second data block and the second fingerprint.
[0048] The second fingerprint in the mapping between the logical address of the second data block and the second fingerprint is the second fingerprint in the first fingerprint entry or the second fingerprint in the second fingerprint entry.
[0049] Further, the implementation shown in FIG. 7 further includes: deleting the mapping entry between the second fingerprint and the first storage address. After deduplication is performed, the mapping entry that records the second fingerprint and the first storage address is deleted. In this implementation of the present disclosure, the mapping entry between the second fingerprint and the first storage address is persistently recorded in a form of a log. In the log, there may be a plurality of mapping entries that all include the second fingerprint, but data blocks corresponding to all the second fingerprints are stored at different locations in the storage system. In other words, storage addresses in the plurality of mapping entries are different. In the log, if the plurality of mapping entries all include the second fingerprint, it indicates that an inline deduplication operation is not performed on a plurality of data blocks, and the plurality of data blocks are directly stored in the storage system. The mapping entry in the log may be clustered based on the fingerprint. To be specific, mapping entries with a same fingerprint are arranged together. In this way, data blocks that have same content and on which no inline deduplication operation is performed can be determined. Then, step 701 to step 704 are performed. There are a plurality of mapping entries with a same fingerprint, for example, the second fingerprint, and accordingly, there are a plurality of same data blocks. If all these data blocks each are a valid data block, mapping between a logical address of each of the data blocks and the second fingerprint in the fingerprint table is separately established. The valid data block is a data block that is not modified, or a data block whose mapping between a logical address of the data block and a storage address of the data block is valid before a post-deduplication operation is performed. Further, after the deduplication operation is performed, the plurality of mapping entries in the log are deleted. In another implementation of this implementation of the present disclosure, before the post-deduplication operation is performed, the plurality of mapping entries in the log are deleted.
[0050] A plurality of mapping entries with a same fingerprint, for example, the second fingerprint, are recorded in the log. The storage addresses in the plurality of mapping entries are different. These storage addresses may be located on a plurality of storage nodes that use distributed storage. Data blocks at the storage addresses may be data blocks that are stored after being compressed. These data blocks may be compressed by using different compression algorithms. In other words, a compression rate and compression performance of a compression algorithm used by each data block varies.
[0051] The storage address in the fingerprint entry of the fingerprint table provided in this implementation of the present disclosure is dedicated storage space allocated by the storage system, and is used to store a data block on which the deduplication operation (inline deduplication and post-deduplication) is performed. Therefore, for a data block that is directly stored and on which the inline deduplication operation is not performed, a corresponding fingerprint is not found in the fingerprint table after the post-deduplication operation is performed, and the data block needs to be migrated to storage space dedicated to store a data block on which the deduplication operation is performed. For example, in the step 703 in the implementation shown in FIG. 7, when the fingerprint table does not include the first fingerprint entry, a second fingerprint entry is added to the fingerprint table, where the second fingerprint entry includes mapping between the second fingerprint and a third storage address, and the third storage address is used to store the second data block migrated by the storage system from the first storage address.
[0052] In a scenario in which the plurality of mapping entries with the same fingerprint are recorded in the log, when it is determined that the same fingerprint is a new fingerprint in the storage system, one storage address is selected from a plurality of storage addresses in the plurality of mapping entries, a data block at the selected storage address is migrated to storage space, for example third storage space in the step 703, dedicated to store a data block on which the deduplication operation is performed. Anew fingerprint entry is established in the fingerprint table. For example, in step 703, the fingerprint entry includes mapping between the second fingerprint and the third storage address. When a data block that needs to be migrated is selected from the plurality of data blocks with the same fingerprint, the to-be-migrated data block is selected based on factors such as whether the data block is compressed, a compression rate of the data block, a distance between the data block and storage space dedicated to store a data block on which the deduplication operation is performed. In other words, the to-be-migrated data block is a data block that needs to be reserved after the post-deduplication operation is performed. A compressed data block is preferentially used as a to-be-migrated data block than a decompressed data block. A data block that is compressed by using a compression algorithm with a high compression rate is preferentially used as a to-be-migrated data block than a data block that is compressed by using a compression algorithm with a low compression rate. A data block that has a short distance from migrating to storage space dedicated to store a data block on which the deduplication operation is performed is preferentially used as a to-be-migrated data block than a data block that has a long distance from migrating to storage space dedicated to store a data block on which the deduplication operation is performed. When the to-be-migrated data block is selected based on the at least two factors, priorities in descending order are as follows: a data block that has a short distance from migrating to storage space dedicated to store a data block on which the deduplication operation is performed and that is compressed by using a compression algorithm with a high compression rate, a data block that has a long distance from migrating to storage space dedicated to store a data block on which the deduplication operation is performed and that is compressed by using a compression algorithm with a high compression rate, a data block that has a short distance from migrating to storage space dedicated to store a data block on which the deduplication operation is performed and that is compressed by using a compression algorithm with a low compression rate, a data block that has a long distance from migrating to storage space dedicated to store a data block on which the deduplication operation is performed and that is compressed by using a compression algorithm with a low compression rate, a data block that has a short distance from migrating to storage space dedicated to store a data block on which the deduplication operation is performed and that is not compressed, and a data block that has a long distance from migrating to storage space dedicated to store a data block on which the deduplication operation is performed and that is not compressed. In this implementation of the present disclosure, in a process of migrating the compressed data block, the data block does not need to be decompressed. In this implementation of the present disclosure, the distance from migrating to the storage space dedicated to store the data block on which the deduplication operation is performed is a distance between a storage node on which a storage address of a current storage data block is located and a storage node on which the storage space dedicated to store a data block on which the deduplication operation is performed is located. For example, whether the data block needs to be migrated across a network (for example, whether the storage address of the current storage data block and the storage space dedicated to store the data block are on a same storage node) and a quantity of hops in the network. In this implementation of this application, the data block migration policy can be used to reduce resource consumption of the storage system in a data migration process and to improve performance of the storage system.
[0053] A solution of selecting the to-be-migrated data block in this implementation of the present disclosure may also be applied to a solution in which the log is not used. This is not limited in this implementation of the present disclosure.
[0054] In this implementation of the present disclosure, the post-deduplication operation may also be performed based on the load of the storage system. This improves performance of the storage system.
[0055] Based on the foregoing implementation, an implementation of the present disclosure provides a data processing device. The data processing device includes a calculation unit 801, a deduplication unit 802, a storage unit 803, and a recording unit 804, where the calculation unit 801 is configured to calculate a first fingerprint of a first data block; the inline deduplication unit 802 is configured to: when the storage system is under a first load, perform an inline deduplication operation on the first data block by querying a fingerprint table based on the first fingerprint, where the calculation unit 801 is further configured to calculate a second fingerprint of a second data block; the storage unit 803 is configured to: when the storage system is under a second load, directly store the second data block without performing the inline deduplication operation, where the first load is less than the second load; and the recording unit 804 is configured to record a mapping entry between the second fingerprint and a first storage address of the second data block, where the mapping entry is used to record mapping between the second fingerprint and the first storage address of the second data block.
[0056] Further, the data processing device shown in FIG. 8 further includes: a query unit, configured to query, based on the second fingerprint, whether the fingerprint table includes a first fingerprint entry, where the first fingerprint entry includes mapping between the second fingerprint and a second storage address, and the second storage address stores a data block that has same content as the second data block; an establishment unit, configured to: when the fingerprint table includes the first fingerprint entry, establish mapping between a logical address of the second data block and the second fingerprint in the first fingerprint entry; and an adding unit configured to: when the fingerprint table does not include the first fingerprint entry, add a second fingerprint entry to the fingerprint table, where the second fingerprint entry includes mapping between the second fingerprint and a third storage address, and the third storage address is used to store a storage address of a second data block migrated by the storage system from the first storage address, where the establishment unit is further configured to establish mapping between the logical address of the second data block and the second fingerprint.
[0057] Further, the data processing device further includes: a deletion unit, configured to delete the mapping entry between the second fingerprint and the first storage address of the second data block.
[0058] Further, the recording unit 804 is specifically configured to record, in a log, the mapping entry between the second fingerprint and the first storage address of the second data block.
[0059] Further, the data processing device further includes: a determining unit, configured to determine whether a plurality of mapping entries recorded in the log include the second fingerprint, where the plurality of mapping entries all include the second fingerprint, but storage addresses in the plurality of mapping entries are different, where the establishment unit is further configured to establish mapping between a logical address of a data block stored at another storage address other than the first storage address in the plurality of mapping entries and the second fingerprint in the fingerprint table.
[0060] Further, the data processing device further includes a deletion unit, and the deletion unit is configured to delete the plurality of mapping entries.
[0061] Further, the processing device further includes a selection unit, and the selection unit is configured to select the first storage address from the storage addresses in the plurality of mapping entries according to a migration policy, and migrate the second data block at the first storage address to the third storage address.
[0062] The present disclosure provides a computer-readable storage medium. The computer-readable storage medium stores an instruction, and when a processor runs the instruction, the processor is configured to perform functions of the data processing device in the implementations of the present disclosure.
[0063] The present disclosure provides a computer program product including an instruction. When a processor runs the instruction in the computer program product, the processor is configured to perform functions of the data processing device in the implementations of the present disclosure.
[0064] For specific implementations of the data processing device, the computer-readable storage medium, and the computer program product provided in the implementations of the present disclosure, refer to the foregoing descriptions in the implementations of the present disclosure. Details are not described herein again.
[0065] It may be understood that the memory mentioned in the implementations of the present disclosure may be a volatile memory or a nonvolatile memory, or may include a volatile memory and a nonvolatile memory. The nonvolatile memory may be a read-only memory (Read-Only Memory, ROM), a programmable read-only memory (Programmable ROM, PROM), an erasable programmable read-only memory (Erasable PROM, EPROM), an electrically erasable programmable read-only memory (Electrically EPROM, EEPROM), or a flash memory. The volatile memory may be a random access memory (Random Access Memory, RAM), used as an external cache. Through example but not limitative description, many forms of RAMs may be used, for example, a static random access memory (Static RAM, SRAM), a dynamic random access memory (Dynamic RAM, DRAM), a synchronous dynamic random access memory (Synchronous DRAM, SDRAM), a double data rate synchronous dynamic random access memory (Double Data Rate SDRAM, DDR SDRAM), an enhanced synchronous dynamic random access memory (Enhanced SDRAM, ESDRAM), a synchlink dynamic random access memory (Synchlink DRAM, SLDRAM), and a direct rambus random access memory (Direct Rambus RAM, DR RAM).
[0066] It should be noted that when the processor is a general-purpose processor, a DSP, an ASIC, an FPGA, or another programmable logic device, discrete gate, transistor logic device, or discrete hardware component, the memory (storage module) may be integrated into the processor.
[0067] It should be noted that the memory described in this specification includes but is not limited to these and any memory of another proper type.
[0068] A person of ordinary skill in the art may be aware that, in combination with the examples described in the implementations disclosed in this specification, units and algorithm steps may be implemented by electronic hardware or a combination of computer software and electronic hardware. Whether the functions are performed by hardware or software depends on particular applications and design constraint conditions of the technical solutions. A person skilled in the art may use different methods to implement the described functions for each particular application.
[0069] It may be clearly understood by a person skilled in the art that, for the purpose of convenient and brief description, for a detailed working process of the foregoing system, apparatus, and unit, refer to a corresponding process in the foregoing method implementations, and details are not described herein again.
[0070] In the several implementations provided in the present disclosure, it should be understood that the disclosed system, apparatus, and method may be implemented in other manners. For example, the described apparatus implementation is merely an example. For example, division into units is merely logical function division and may be other division in actual implementation. For example, a plurality of units or components may be combined or integrated into another system, or some features may be ignored or not performed. In addition, the displayed or discussed mutual couplings or direct couplings or communication connections may be implemented by using some interfaces. The indirect couplings or communication connections between the apparatuses or units may be implemented in electronic, mechanical, or other forms.
[0071] The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one position, or may be distributed on a plurality of network units. Some or all of the units may be selected based on actual requirements to achieve the objectives of the solutions of the implementations.
[0072] In addition, functional units in the implementations of the present disclosure may be integrated into one processing unit, or each of the units may exist alone physically, or two or more units are integrated into one unit.
[0073] When the functions are implemented in the form of a software functional unit and sold or used as an independent product, the functions may be stored in a computer-readable storage medium. Based on such an understanding, the technical solutions of the present disclosure essentially, or the part contributing to the prior art, or some of the technical solutions may be implemented in a form of a software product. The computer software product is stored in a storage medium, and includes several instructions for instructing a computer device (which may be a personal computer, a server, or a network device) to perform all or some of the steps of the methods described in the implementations of the present disclosure. The foregoing storage medium includes: any medium that can store program code, such as a USB flash drive, a removable hard disk, a read-only memory (Read-Only Memory, ROM), a random access memory (Random Access Memory, RAM), a magnetic disk, or an optical disc.
[0074] The scope of protection shall be defined by the appended claims.
Claims
1. A data processing method in a storage system, wherein the method comprises: calculating (601) a first fingerprint of a first data block; when the storage system is under a first load, performing (602) an inline deduplication operation on the first data block by querying a fingerprint table based on the first fingerprint; calculating (603) a second fingerprint of a second data block; when the storage system is under a second load, directly storing (604) the second data block without performing the inline deduplication operation, wherein the second load is greater than the first load; and recording (605), in a log, a mapping entry between the second fingerprint and a first storage address of the second data block, wherein the mapping entry is used to describe mapping between the second fingerprint and the first storage address of the second data block; wherein each load is one or more of a CPU usage parameter, a memory usage parameter, and a network performance parameter of a data processing device in the storage system; wherein the method further comprises: querying, based on the second fingerprint, whether the fingerprint table comprises a first fingerprint entry, wherein the first fingerprint entry comprises mapping between the second fingerprint and a second storage address, and the second storage address stores a data block that has same content as the second data block; when the fingerprint table comprises the first fingerprint entry, the method comprises: establishing mapping between a logical address of the second data block and the second fingerprint in the first fingerprint entry; and deleting the mapping entry between the second fingerprint and the first storage address of the second data block; and when the fingerprint table does not comprise the first fingerprint entry, the method comprises: adding a second fingerprint entry to the fingerprint table, wherein the second fingerprint entry comprises mapping between the second fingerprint and a third storage address, and the third storage address is used to store the second data block migrated by the storage system from the first storage address; establishing mapping between the logical address of the second data block and the second fingerprint in the second fingerprint entry; and deleting the mapping entry between the second fingerprint and the first storage address of the second data block; wherein when a plurality of mapping entries recorded in the log comprise the second fingerprint, but storage addresses in the plurality of mapping entries are different, the method specifically comprises: selecting the first storage address from the storage addresses in the plurality of mapping entries according to a migration policy, and migrating the second data block at the first storage address to the third storage address; and establishing mapping between a logical address of a data block stored at another storage address other than the first storage address in the plurality of mapping entries and the second fingerprint in the fingerprint table; and deleting the plurality of mapping entries; wherein, the second data block is compressed and when a plurality of mapping entries with the second fingerprint are recorded in the log, a compression rate and a compression performance of a compression algorithm used by the data blocks varies; and wherein the migration policy includes at least one of whether the data block is compressed, a compression rate of a compression algorithm used when the data block is compressed, or a distance between the storage addresses in the plurality of mapping entries and storage space in which the third storage address is located.
2. A data processing device for use in a storage system, wherein the data processing device comprises an interface and a processor, the interface communicates with the processor, and the processor is further configured to perform the method according to claim 1.
3. A computer program product, wherein the computer program product comprises a set of instructions, which when executed by a processor of a computer cause the processor to perform the method according to claim 1.
