Data deduplication methods, products, computer devices and storage media
Through the method of slicing and mapping positioning in distributed storage systems, duplicate data blocks are identified and deleted, which solves the complexity and performance problems of duplicate data deletion in distributed storage systems, and improves storage space utilization and system performance.
Patent Information
- Application Number
- CN202411018597.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-29
- Publication Date
- 2024-10-29
- Estimated Expiration
- 2044-07-29
AI Technical Summary
The difficulty of deleting duplicate data in distributed storage systems increases, resulting in low storage space utilization, and random broadcasting in a massive small file scenario leads to performance degradation, and the metadata update and duplicate search IO redirection during the data balancing process are complex, affecting performance. .
By slicing the data object into multiple pre-stored data blocks, and using the consistency algorithm to map and locate the storage in the distributed storage system, establish the object mapping table and data block information table, identify and delete duplicate data blocks, and regularly clean up invalid consistency labels. Block fingerprint to avoid broadcast IO overhead and complex search process.
It improves the storage space utilization of the distributed storage system, ensures performance and consistency, avoids performance degradation caused by random broadcast in massive small file scenarios, and reduces the complexity of metadata updates and repeated searches during the data balancing process. .
Smart Images

Figure CN118550477B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of distributed storage systems, and in particular to a method, product, computer device and storage medium for deleting duplicate data. Background Art
[0002] With the development of the Internet and the popularity of smart devices, the amount of data and the type of data are growing rapidly. Traditional storage systems can no longer meet the large-scale and diversified data storage needs. The rise of big data and cloud computing technologies has provided more application scenarios for distributed storage systems and promoted the development of distributed storage system technology. Distributed storage systems are designed to provide high-performance, high-reliability and scalable storage solutions. The design concept of distributed storage systems is based on scalability and fault tolerance, eliminating performance bottlenecks such as single-point metadata, adopting a distributed and decentralized design architecture, slicing data and distributing it in the form of objects on multiple nodes, and ensuring that the load and capacity of each node are balanced. Data access and management technology is performed through network connections, while providing a unified storage interface.
[0003] As data storage becomes larger, more diverse, and more expensive, the distributed storage cluster system in the related art cannot achieve optimal storage space utilization due to fault tolerance, heterogeneity of storage devices, and specific constraints of data centers. Therefore, in order to improve the efficiency of storage space utilization, it is urgent to delete duplicate data in the distributed storage system to optimize the distributed storage capacity.
[0004] Currently, deduplication is mainly applied to centralized storage. The characteristics of centralized storage are centralized data management, which is easy to maintain and control, but there are risks of single point failure and performance bottleneck. In centralized storage, since all data are stored in the same place, it is relatively easy to delete duplicate data, and a simple and effective way can be used to find and delete duplicate data. The characteristics of distributed storage are high availability, horizontal scalability, and strong fault tolerance, but it needs to solve problems such as consistency and fault recovery.
[0005] In distributed storage, since data is distributed on multiple nodes, deduplication becomes more complicated. It is necessary to consider distributed consistency and data synchronization issues, as well as data deduplication algorithms and strategies in a distributed environment. If duplicate data is deleted in a distributed storage system, the I / O performance of the distributed storage system will be reduced. Therefore, the deduplication method strategy in a distributed storage system is crucial. Summary of the invention
[0006] Based on this, a method, device, computer equipment and storage medium for deduplication are provided. Based on the characteristics of the distributed storage system, on the one hand, the broadcast overhead of fingerprint search IO in the deduplication process is solved, and the problem of performance degradation caused by such random broadcast in the scenario of massive small files is avoided. On the other hand, the problem of performance degradation caused by a large amount of updated metadata, duplicate search IO redirection, and the index storage location of data fingerprints and data blocks occupying space and the complex search process in the data balancing process of the distributed storage system is solved.
[0007] In one aspect, a method for deleting duplicate data is provided, the method comprising:
[0008] In response to a distributed storage system client writing a data object, slicing the data object into a plurality of pre-stored data blocks, and obtaining a block fingerprint corresponding to each pre-stored data block;
[0009] The pre-stored data blocks are located and stored in the daemon process of each storage node of the distributed storage system through consistency algorithm mapping;
[0010] An associated object mapping table and a data block information table are stored in each storage node, wherein the object mapping table is used to locate the storage locations of multiple pre-stored data blocks of the data object, and the data block information table is used to record the block fingerprints, reference counts, and consistency tag states of the data blocks stored in the storage node;
[0011] Compare the block fingerprint of the pre-stored data block in the daemon process with the block fingerprint of the data block stored in the storage node to identify whether it is duplicate data, increase the reference count corresponding to the block fingerprint of the duplicate data by one, and update the state of the consistency label;
[0012] The pre-stored data blocks and block fingerprints that are duplicate data in the daemon process are deleted.
[0013] In one embodiment, in response to a distributed storage system client writing a data object, slicing the data object into a plurality of pre-stored data blocks, and obtaining a block fingerprint corresponding to each pre-stored data block includes:
[0014] Acquire a data object written by a client of the distributed storage system, slice the data object using a preset fixed size, and generate multiple small data block objects as pre-stored data blocks;
[0015] The small data block objects are grouped, wherein the group ID is equal to the modulo of a hash operation performed on the small data block objects and the number of groups;
[0016] The object name of the data object is obtained, and the object fingerprint and block fingerprint are generated using the SHA-256 algorithm.
[0017] In one embodiment, storing the associated object mapping table and data block information table in each storage node includes:
[0018] A metadata sharding module is set in each storage node of the distributed storage system, and each metadata sharding module stores the object name and data block content information in a data structure, and the data structure includes an object mapping table and a data block information table;
[0019] The object mapping table includes an object name, an object fingerprint and a data block linked list, and the data block information table includes a block fingerprint, a reference count and a consistency tag; the data block linked list points to the storage location of the data block, and the same consistency tag is set for multiple pre-stored data blocks of the same data object.
[0020] In one embodiment, storing the associated object mapping table and data block information table in each storage node includes:
[0021] The data structure is set to be in the form of {object mapping table, data block information table};
[0022] The state of the consistency tag in the data block information table is set to include valid or invalid. A valid consistency tag represents that the data block corresponding to the block fingerprint is valid data, and an invalid consistency tag represents that the data block corresponding to the block fingerprint is lost or is currently in a transaction.
[0023] In one of the embodiments, comparing the block fingerprint of the pre-stored data block in the daemon process with the block fingerprint of the data block stored in the storage node to identify whether it is duplicate data, increasing the reference count corresponding to the block fingerprint of the duplicate data by one, and updating the state of the consistency label includes:
[0024] Presetting the state of the consistency tag of the pre-stored data block in the daemon process to invalid;
[0025] Determining whether there is a block fingerprint corresponding to the pre-stored data block in the data block information table;
[0026] If the block fingerprint exists and the consistency flag is valid, the reference count is incremented by one, and the pre-stored data block is determined to be duplicate data;
[0027] If the block fingerprint exists and the consistency flag is invalid, the reference count is not granted to increase, and if the content of the pre-stored data block can be called, the consistency flag is switched to valid;
[0028] If the block fingerprint does not exist, the pre-stored data block is determined to be the only data block, and the consistency flag is switched to valid.
[0029] In one embodiment, the method further comprises:
[0030] storing the pre-stored data block determined to be a unique data block in a storage node of the distributed storage system according to a mapping location;
[0031] When the pre-stored data block is written successfully, the daemon process sends a confirmation message to the distributed storage system client.
[0032] In one embodiment, storing the pre-stored data block determined to be the only data block in the storage node of the distributed storage system according to the mapping location includes:
[0033] Acquire the storage node to which the pre-stored data block determined to be the only data block is mapped;
[0034] Setting the data block linked list in the object mapping table to point to the storage node where the pre-stored data block is mapped;
[0035] The daemon process is executed, and the pre-stored data block determined as the only data block in the daemon process is stored in a storage node of the distributed storage system.
[0036] In one embodiment, the method further comprises:
[0037] Periodically collecting block fingerprints with invalid consistency tags from the data block information table;
[0038] When the number of block fingerprints with invalid consistency tags exceeds a threshold, checking the collected block fingerprints with the consistency tags in the data block information table;
[0039] When the collected consistency tag states do not change, the data blocks corresponding to the invalid consistency tags are deleted from the distributed storage system, and the block fingerprints corresponding to the invalid consistency tags are deleted.
[0040] In one embodiment, the periodically collecting block fingerprints with invalid consistency tags from the data block information table includes:
[0041] On each storage node in the distributed storage system, block fingerprints with invalid consistency tags are collected using entries in the data block information table and cached through a buffer list.
[0042] In one embodiment, when the number of block fingerprints with invalid consistency tags exceeds a threshold, checking the collected block fingerprints with the consistency tags in the data block information table includes:
[0043] Periodically collecting block fingerprints with invalid consistency tags from the data block information table, and counting the total number of the collected block fingerprints with invalid consistency tags;
[0044] When the total number of block fingerprints with invalid consistency tags exceeds a threshold, it is detected whether the consistency tag status of the collected block fingerprints changes from invalid to valid.
[0045] In one embodiment, when the collected consistency tag state does not change, deleting the data block corresponding to the invalid consistency tag from the distributed storage system, and deleting the block fingerprint corresponding to the invalid consistency tag includes:
[0046] The block fingerprint whose consistency tag status changes from invalid to valid is deleted from the buffer list, and the data block corresponding to the block fingerprint with invalid consistency tag in the buffer list is determined as a garbage data block;
[0047] The garbage data block and its corresponding block fingerprint are deleted from the distributed storage system.
[0048] In one embodiment, when the collected consistency tag state does not change, deleting the data block corresponding to the invalid consistency tag from the distributed storage system, and deleting the block fingerprint corresponding to the invalid consistency tag also includes:
[0049] Controlling deletion of the junk data blocks and their corresponding block fingerprints from the distributed storage system one by one, and detecting whether a failure occurs after the junk data blocks and their corresponding block fingerprints are deleted;
[0050] If a failure occurs, the deleted garbage data blocks and their corresponding block fingerprints are restored;
[0051] If no failure occurs, the next garbage data block and its corresponding block fingerprint are deleted.
[0052] In another aspect, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the following steps:
[0053] In response to a distributed storage system client writing a data object, slicing the data object into a plurality of pre-stored data blocks, and obtaining a block fingerprint corresponding to each pre-stored data block;
[0054] The pre-stored data blocks are located and stored in the daemon process of each storage node of the distributed storage system through consistency algorithm mapping;
[0055] An associated object mapping table and a data block information table are stored in each storage node, wherein the object mapping table is used to locate the storage locations of multiple pre-stored data blocks of the data object, and the data block information table is used to record the block fingerprints, reference counts, and consistency tag states of the data blocks stored in the storage node;
[0056] Compare the block fingerprint of the pre-stored data block in the daemon process with the block fingerprint of the data block stored in the storage node to identify whether it is duplicate data, increase the reference count corresponding to the block fingerprint of the duplicate data by one, and update the state of the consistency label;
[0057] The pre-stored data blocks and block fingerprints that are duplicate data in the daemon process are deleted.
[0058] In another aspect, a computer device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the following steps are implemented:
[0059] In response to a distributed storage system client writing a data object, slicing the data object into a plurality of pre-stored data blocks, and obtaining a block fingerprint corresponding to each pre-stored data block;
[0060] The pre-stored data blocks are located and stored in the daemon process of each storage node of the distributed storage system through consistency algorithm mapping;
[0061] An associated object mapping table and a data block information table are stored in each storage node, wherein the object mapping table is used to locate the storage locations of multiple pre-stored data blocks of the data object, and the data block information table is used to record the block fingerprints, reference counts, and consistency tag states of the data blocks stored in the storage node;
[0062] Compare the block fingerprint of the pre-stored data block in the daemon process with the block fingerprint of the data block stored in the storage node to identify whether it is duplicate data, increase the reference count corresponding to the block fingerprint of the duplicate data by one, and update the state of the consistency label;
[0063] The pre-stored data blocks and block fingerprints that are duplicate data in the daemon process are deleted.
[0064] In another aspect, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
[0065] In response to a distributed storage system client writing a data object, slicing the data object into a plurality of pre-stored data blocks, and obtaining a block fingerprint corresponding to each pre-stored data block;
[0066] The pre-stored data blocks are located and stored in the daemon process of each storage node of the distributed storage system through consistency algorithm mapping;
[0067] An associated object mapping table and a data block information table are stored in each storage node, wherein the object mapping table is used to locate the storage locations of multiple pre-stored data blocks of the data object, and the data block information table is used to record the block fingerprints, reference counts, and consistency tag states of the data blocks stored in the storage node;
[0068] Compare the block fingerprint of the pre-stored data block in the daemon process with the block fingerprint of the data block stored in the storage node to identify whether it is duplicate data, increase the reference count corresponding to the block fingerprint of the duplicate data by one, and update the state of the consistency label;
[0069] The pre-stored data blocks and block fingerprints that are duplicate data in the daemon process are deleted.
[0070] The above-mentioned deduplication data method, product, computer device and storage medium implement storage in a distributed storage system by slicing the written data object into multiple pre-stored data blocks, and implement online storage in a daemon process by mapping and positioning the pre-stored data blocks. Based on the online deduplication method, the block fingerprint of the pre-stored data block in the daemon process is compared with the block fingerprint of the data block stored in the storage node to identify whether it is duplicate data. The reference count corresponding to the block fingerprint of the duplicate data is increased by one to avoid writing duplicate data, and the corresponding deletion of the pre-stored data blocks and block fingerprints that are duplicate data in the daemon process can avoid the problem of performance degradation caused by random broadcasting in a scenario with massive small files. At the same time, the online deduplication method can avoid the problem of performance degradation caused by complex search process in data balancing of the distributed storage system. BRIEF DESCRIPTION OF THE DRAWINGS
[0071] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0072] Figure 1 This is a diagram of a distributed storage system architecture for an application environment of a method for deduplication of data in one embodiment of the present application;
[0073] Figure 2 A schematic flow chart of a cluster-wide deduplication method based on metadata sharding and data block fingerprint positioning in one embodiment of the present application;
[0074] Figure 3A schematic diagram of a metadata sharding mechanism of a method for deduplicating data in one embodiment of the present application;
[0075] Figure 4 A flowchart of a method for deleting duplicate data in one embodiment of the present application;
[0076] Figure 5 This is a structural block diagram of a data deduplication device in one embodiment of the present application;
[0077] Figure 6 This is a diagram of the internal structure of a computer device in one embodiment of the present application. DETAILED DESCRIPTION
[0078] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0079] As described in the background technology, since the distributed storage system adopts a decentralized design architecture, it is highly scalable; the failure of a single storage server node will not affect the unavailability of the entire distributed storage cluster; it supports dynamic expansion to add or delete storage server nodes, and can automatically relocate data objects in the cluster to balance the storage space utilization between storage servers. Among them, high reliability: the use of data redundancy and automatic fault recovery mechanisms can ensure the reliability and persistence of data. High scalability: the distributed storage system cluster can be dynamically expanded horizontally to support hundreds or even thousands of nodes. Unified interface: provides a unified file system, object storage and block storage interface to facilitate user data access and management. Capacity balancing: can balance data to ensure that data is evenly distributed in the storage cluster.
[0080] In the prior art, a database deduplication service module is added to each storage node in a distributed storage cluster system, and corresponding storage partitions are set, and a database-based deduplication method is proposed. The database deduplication module of each distributed storage node maintains the full metadata information. When deduplication is performed, first, the duplicate data fingerprint is searched, and the search IO is redirected and broadcast to all database deduplication service instances in the distributed storage cluster. Then, the found metadata information is fingerprint scanned and judged to perform data deduplication operations. When the distributed storage system expands and shrinks nodes, and when nodes fail, data reconstruction will occur to balance distributed storage data. This process will redistribute data to balance the space utilization in the distributed storage cluster. In this case, in order to locate the storage location of data in the entire cluster, it is necessary to deduplicate the database in the distributed storage cluster to serve the metadata update. Therefore, data balancing will result in higher metadata update IO, which will reduce the I / O performance of the distributed storage system. In addition, adding a database deduplication service module to each storage node also requires modifying the existing rebalancing mechanism to detect the location change mapping information.
[0081] There are some problems with the database deduplication service method, namely, in order to identify duplicate data blocks, the fingerprint search IO will be broadcast to all database deduplication services in the cluster, which poses a serious threat to scalability. In the scenario of massive small files, this random broadcast will lead to performance degradation. The existing technology will also have a serious impact on the consistency and scalability of the distributed storage system, because a large amount of metadata updates, duplicate search IO redirection, and index storage locations of data fingerprints and data blocks are required in the balanced data. In addition, in failure scenarios and other situations, data blocks, duplicate deduplication metadata and garbage data will be inconsistent, posing risks to the data security and consistency of distributed storage.
[0082] In the prior art, another method is to use the extended metadata attribute method to achieve data deduplication. In this method, each data in the distributed storage system has its own separate metadata object, which contains attributes and layout information, and the reference count, description information and other related metadata are stored in the extended attributes of each data block. The deduplication of duplicate data is achieved by performing operations such as fingerprint search and reference update on the descriptive information in the extended attributes. When a distributed storage system fails, it may cause data inconsistency and metadata deletion. In order to solve the problem during failure, a transaction-based metadata update method is proposed. Transaction sorting and delay operations require additional checkpoints and log records.
[0083] Deduplication is performed by using metadata extension attributes. In massive distributed storage scenarios, since each object has an extension attribute file, high metadata overhead is generated. Operations such as fingerprint lookup and reference update will affect IO, resulting in slower request responses and reduced distributed storage service performance. The transactional metadata update method generates garbage blocks. The recycling of garbage blocks and ensuring the correctness of reference counts for each fingerprint require additional monitoring services and log overhead, which burdens the management of distributed storage systems. Example 1
[0084] To solve the above problems, a method for deleting duplicate data based on a distributed storage system is creatively proposed in Example 1 of the present invention. First, the distributed storage system client uses online deduplication when writing data through three different types of interfaces such as blocks, objects, and files. According to the distributed storage system deduplication metadata sharding method proposed by the present invention, an object mapping table and a data block information table are designed in the metadata sharding module. Through fingerprint-based Hash redirection, efficient index positioning of duplicate data can be performed, avoiding the performance impact of IO broadcast on the storage cluster. Then, in the case of distributed storage system failure scenarios and the like, when data balancing occurs, the consistency and efficiency of the data are guaranteed through the consistency transaction reading and writing method and the processing judgment strategy; finally, the garbage data blocks are collected, filtered, and recycled in a timely manner by creating a consistency label for the data block in the data block information table. Based on the above method, the present invention can effectively improve the space utilization of the distributed storage system and ensure the performance, consistency and stability of the distributed storage system.
[0085] The deduplication method meets the design constraints of high scalability and no central node of the distributed storage system, where "no central node" in the distributed storage system means that there is no single central node or centralized control entity in the system to manage the operation and data storage of the entire system. Instead, data and control are distributed among various nodes in the entire system, and each node can independently store, manage and process data.
[0086] The deduplication method based on the distributed storage system proposed in the present invention is performed in an online deduplication manner. In the distributed storage system, online deduplication is a data deduplication technology used to identify and delete duplicate data blocks stored in the system, thereby saving storage space and improving storage efficiency. Online deduplication realizes the identification and deduplication operation of duplicate data by comparing the fingerprint (fingerprint) or hash value of the newly written data block with the existing data block.
[0087] The deduplication method provided in this application can be applied to Figure 1 In the application environment shown in the figure, Figure 1 The figure shows the overall architecture diagram of the method disclosed in the present invention in a distributed storage system according to the embodiment: the design concept of the distributed storage system is based on scalability and fault tolerance, eliminating performance bottlenecks such as single-point metadata, adopting a distributed and decentralized design architecture, slicing data and distributing and storing them on multiple nodes in the form of objects, and ensuring that the load and capacity of each node are balanced, and using network connections to access and manage data, while providing a unified storage interface. Since the distributed storage system adopts a decentralized design architecture, it is highly scalable; the failure of a single storage server node will not affect the unavailability of the entire distributed storage cluster; it supports dynamic expansion to add or delete storage server nodes, and can automatically relocate data objects in the cluster to balance the storage space utilization between storage servers. The distributed storage system architecture includes multiple components, such as object gateway services, block device services, file system services, a unified, self-controlled, and scalable distributed storage consistency management system, a storage pool, a controllable, scalable, distributed data balancing placement algorithm, and a metadata and monitoring service cluster. In the storage pool, the client data is stored in slices, which are fixed to 4MB objects by default. The objects are grouped, and the group id is the modulo value of Hash (object x) and the number of groups, and finally stored in the underlying device.
[0088] like Figure 1 As shown in the figure, the distributed storage system architecture includes the following key components:
[0089] 1) Object gateway service, block device service, file system service: Provide a unified storage interface to provide access interface services for distributed storage clients.
[0090] 2) Unified, self-controlled, and scalable distributed storage consistency management system: This component is the core component of the distributed storage cluster. It provides distributed storage services in the form of objects. In this component, data is stored as objects, and each object has a unique identifier and related data. It is responsible for storing objects in a distributed manner on each node of the storage cluster and provides functions such as data replication, recovery, and load balancing to ensure data reliability and high-performance access.
[0091] Storage pool: A distributed storage cluster consists of multiple storage nodes, each of which can contain multiple hard disks or storage devices. The storage pool divides storage resources into different pools to meet different storage needs.
[0092] 3) Controllable, scalable, distributed data balanced placement algorithm: This component evenly distributes data objects across the nodes of the storage cluster to avoid data hot spots and improve system performance.
[0093] 4) Metadata and monitoring service cluster: The metadata cluster is only responsible for managing the metadata information of the file system, including the attributes and location of files and directories. The monitoring service cluster is responsible for monitoring the status and configuration information of the cluster. Its technical principles include maintaining the status information, configuration information, health status, etc. of the cluster to ensure the consistency and availability of the cluster.
[0094] In one embodiment, Figure 2 As shown, a method for deleting duplicate data is provided, comprising the following steps:
[0095] First, the distributed storage system client IO requests the data object Object test, fingerprint (0xAA), wherein the present invention uses a fixed size of 4MB to block the client request data object, and uses the SHA-256 algorithm to generate the data block fingerprint. Then, the fingerprint is passed to the controllable, scalable, distributed data balanced placement algorithm component of the distributed storage system to distribute and evenly store the data blocks in the distributed storage cluster.
[0096] The present invention stipulates that storage redundancy is three copies, which are written to OSD1 of node 1, OSD6 of node 2, and OSD9 of node 3, that is, shards C1, C2, and C3 of object test, and data is stored in {OSD1, OSD6, OSD9}, and the corresponding fingerprint is {C1=0xAA}{C2=0xB4}{C3=0xB5}.
[0097] Among them, OSD is a daemon process.
[0098] The deduplication system implementing the deduplication method includes four modules:
[0099] Data block fingerprint positioning module: Due to the data balancing characteristics of the distributed storage system, it is impossible to accurately and unchangeably determine the storage distribution location of fixed data blocks. This module uses a controllable, scalable, distributed data balancing placement algorithm component to store data blocks and block fingerprints, and locates and searches for the corresponding metadata blocks and data blocks of duplicate data based on the algorithm.
[0100] Metadata sharding module: In a distributed storage system, a metadata sharding module is designed for each storage node. Each metadata sharding module stores the unique information of the object name and data block (i.e., data content) in a data structure, including an object mapping table and a data block information table.
[0101] Consistency tag module: This module is used to ensure the consistency of data blocks and deduplication metadata. A consistency mark is designed for each data block fingerprint in the data block information table shard of the metadata sharding module to monitor the consistency status of the object mapping table and the data block information table in the metadata sharding module.
[0102] Garbage collection module: This module is executed regularly on each distributed storage node through the consistency tag mechanism and garbage collection thread strategy to identify, organize and remove garbage data blocks and invalid fingerprint items in the deduplication metadata shards.
[0103] For distributed storage IO processes, such as Figure 1 As shown in the figure, first, the distributed storage client writes data, slices the written data, and generates small data blocks object 1 and object n; then, the objects are grouped, and the group id is equal to the modulo of Hash (object x name) and the number of groups; finally, the consistency algorithm is used to map and locate the storage to the storage device OSD (daemon). Each distributed storage node is responsible for deleting duplicate data and storing data and metadata. When a storage service node receives a write request, such as Figure 2 As shown, specifically, a storage device OSD on the node, such as OSD1, is responsible for dividing the data written by the client into small data block objects of fixed size, and calculating the fingerprint of the content of each small data block object, and then redirecting the data block to other redundant distributed storage service nodes through a distributed storage controllable, scalable, and distributed data balanced placement algorithm component based on the calculated fingerprint. This method does not need to retain the position of each data block in the storage system through fingerprint-based redirection. At this time, the storage node constructs a mapping relationship between the object and its data block fingerprint in the metadata sharding module.
[0104] When other storage nodes receive redirected requests to other daemons, first, the fingerprint search is performed in the data block information table of the metadata sharding module. If the block fingerprint exists and the consistency flag is valid, the reference count in the data block information table is granted plus 1, and the non-existent fingerprint is regarded as a unique data block. When all data blocks are stored, an object mapping table and a data block information table will be created on the daemon. The object mapping table designed by the present invention includes an object layout, such as the name of the slice object, fingerprint information and a data block linked list; the data block information table includes the fingerprint, reference count and consistency label of the data block. When all data blocks, object mapping tables and data block information table data structures are created, the write operation is completed. The consistency label ensures the validity and correctness of all data block information table entries and data blocks in the distributed storage without the need for additional logging and log records. The object mapping table and consistency label are used to identify junk data blocks, that is, junk data blocks generated by some failed transactions due to failures and other scenarios.
[0105] Furthermore, in order to efficiently manage the metadata of the deduplication method, the present invention specifically designs a metadata sharding mechanism, such as Figure 3 The metadata sharding mechanism of the distributed storage system deduplication method shown in the figure deploys the metadata sharding service on each storage node in the distributed storage system cluster and stores it in all persistent data structures. Each shard stores the unique information of the object name and data block in a separate data structure, namely the object mapping table and the data block information table. For example, other copies of OSD1 can quickly find the OSD copies of other data C2->Hash(0xB4)=OSD6, C3->Hash(0xB5)=OSD9 through the data block linked list in the object mapping table. When different data, test1, test2 have different fingerprints, but there is the same block data C2, it is possible to efficiently obtain the duplicate database index information by only accessing and querying the single process of OSD1. In detail, the object mapping table: maintains the storage layout of the object, namely the object name, object fingerprint and data block linked list. In the distributed storage system, the object is identified by hashing the object name. Each row of the object mapping table represents an original object layout.
[0106] Table 1 Object mapping table
[0107]
[0108] Data block information table: includes data block fingerprint, reference count and consistency tag. All block search and reference update operations can be implemented through this data structure. Each row of the data block information table represents information about a specific block fingerprint.
[0109] Table 2 Data block information table
[0110]
[0111] The present invention adopts a mechanism combining two object mapping tables and a data block information table, which has the following advantages: it can efficiently perform fingerprint search, and compared with the single fingerprint table data structure in the related art, it is simple and easy to maintain; when concurrent IO accesses the data structure, it reduces IO waiting congestion on a single data structure.
[0112] In a distributed storage system, in order to determine the exact location of a data block and a metadata shard of a corresponding deduplication method in a distributed cluster system, it is necessary to first locate the fingerprint of the data block. The fingerprint of a data block can be obtained in two ways: the first is to directly calculate and generate the fingerprint from the data block content; the second method is to obtain the data block fingerprint from the object mapping table of the present invention, and the fingerprint notifies the storage node daemon process responsible for storing the actual data block and the location of the metadata shard database information table of the deduplication method. The above method mechanism only needs to search in a single storage node when deduplication is performed, and there is no need to broadcast IO to search for fingerprints to all storage service nodes.
[0113] The write transaction process of the deduplication method specifically includes:
[0114] Step 11) The distributed storage client writes data for slicing, generating small data block objects 1, ..., object n.
[0115] Step 12) Calculate the fingerprint fp based on the content of each data block.
[0116] Step 13) Redirect the fingerprint to the daemon process in the cluster according to the distributed storage controllable, scalable, distributed data balanced placement algorithm component. The controllable, scalable, distributed data balanced placement algorithm is: through this component, the data objects are evenly distributed on each node of the storage cluster to avoid data hot spots and improve system performance.
[0117] Step 14) In the metadata sharding module of the deduplication method in the daemon process, verify whether the fingerprint exists in the data block information table. If the fingerprint exists and the consistency flag is valid, the reference count increment is granted. If the fingerprint exists and the consistency flag is invalid, the reference count is not granted. The existence of the data block content is verified through a getattr request. If the getattr call does not exist, the data block is stored and the consistency flag is switched to valid. The logic is as follows:
[0118] if fingerprint fp in data block information table
[0119] if fp.flag == valid
[0120] fp.rfc++;
[0121] else
[0122] if fp.getattr() != exist
[0123] store chunk();
[0124] switch fp.flag();
[0125] else
[0126] Data block information table.add(fp);
[0127] store chunk();
[0128] send_ack().
[0129] Step 15) Finally, after the write is successful, the daemon sends a confirmation message to the client.
[0130] The read transaction process of the deduplication method specifically includes:
[0131] Step 21) The distributed storage client sends a read object request, which is redirected to the OSD device process through a controllable, scalable, distributed data balancing placement algorithm component.
[0132] Step 22) Then, in the deduplication metadata sharding structure, the object layout information in the object mapping table is retrieved and the data block list is traversed in parallel to obtain the object to be read.
[0133] for (i = 0; i <chunklist.size();i++)
[0134] object += read_chunk(chunklist[i]).
[0135] Step 23) Finally, the object read in parallel is constructed and returned to the client.
[0136] In order to solve the consistency problem, the present invention adds a consistency tag to each data block entry in the data block information table, which specifies the consistency status of the data block and can also recover the lost data block. The present invention stipulates that the consistency tag has only two states: valid or invalid. By default, the consistency tag bit of each data block table entry in the data block information table is invalid. The valid consistency tag bit can ensure the correct storage of the data block and the consistency of the deduplication metadata. An invalid consistency tag indicates that the data block corresponding to the fingerprint entry is lost from the storage or the transaction is currently in progress. In addition, the fingerprint entry with an invalid consistency tag will be counted by the garbage collection mechanism, and finally the garbage data block and fingerprint will be deleted.
[0137] In order to solve the problem of data balancing process in distributed storage system, when storage data balancing is triggered, the storage system will relocate data blocks across cluster nodes. In this case, the data block information table entry will be filled with an invalid tag for the relocated data block on the metadata sharding module. Once the data block is successfully rearranged, the flag entry will be updated. The way to perform the tag update is the same as the way to perform a regular data block write operation.
[0138] In the prior art, the garbage collection of the deduplication method of the distributed storage system uses different types of log records and monitoring, which will overload the storage server and consume the system resources of the storage service node, thereby reducing the overall performance of the system. In order to effectively release the space occupied by the garbage data block, the present invention designs an effective parallel multi-threaded garbage identification and removal mechanism. Since the deduplication method service of the present invention is deployed on the daemon process of each distributed storage service node, the garbage collection mechanism is also specifically for each object storage service node. The present invention designs a garbage collection thread to run in the background, regularly collects data block fingerprints with invalid consistency labels from the data block information table, and retains the fingerprints in the predefined threshold designed by the present invention. When the threshold is exceeded, the garbage thread will asynchronously check the collected fingerprints with the consistency labels of the data block information table entries. When the collected consistency label state does not change, the garbage data block is deleted from the distributed storage system, and its corresponding fingerprint is deleted from the metadata sharding module of the deduplication method. The garbage collection mechanism of the present invention does not require additional storage log records, does not occupy storage space, and has high efficiency.
[0139] Specifically, the present invention proposes an effective parallel garbage identification and removal mechanism, and the specific method is divided into three stages:
[0140] 1) The first stage collects garbage data:
[0141] On each storage node in the distributed storage system, fingerprints with invalid consistency tags are collected through the data block information table entries of the metadata sharding module and cached through the bufferlist.
[0142] 2) The second stage is to filter junk data:
[0143] During the filtering phase, the fingerprints of data blocks with invalid consistency labels are collected periodically from the data block information table through the respective fingerprint labels in the metadata sharding module of the data deduplication method of the storage node, and the fingerprints are retained within the predefined threshold designed by the present invention. When the threshold is exceeded, the garbage thread will asynchronously check the collected fingerprints and the consistency labels of the data block information table entries. When the state of the collected consistency labels does not change, the garbage data blocks are deleted from the distributed storage system, and their corresponding fingerprints are deleted from the metadata sharding module of the data deduplication method. In a specific embodiment, in the garbage collection process, if a fingerprint has an invalid label in the first stage, but during the asynchronous check, the fingerprint consistency flag is changed to valid, then the fingerprint and the related data blocks are not deleted from the metadata sharding module.
[0144] 3) The third stage is to clear junk data:
[0145] The stored data blocks and bufferlist entries are deleted from the metadata sharding module. In particular, in the deduplication operation, the order in which the fingerprint information and data blocks are deleted is critical because if a garbage collection operation fails or is interrupted after the data blocks are removed, the present invention is designed to collect and delete fingerprint entries from the metadata sharding module in the next garbage collection cycle. If the fingerprint information is deleted first and a failure occurs at this time, the data blocks will be inaccessible because the fingerprints that reference the data blocks have been deleted and therefore the data blocks are inaccessible.
[0146] Based on the characteristics of distributed storage systems, object mapping tables and data block information tables are designed in the metadata sharding module. The fingerprint-based Hash redirection method can efficiently locate the index of duplicate data to solve the broadcast overhead of fingerprint search IO during duplicate deletion, avoiding the performance degradation caused by random broadcast in the scenario of massive small files.
[0147] Setting up the object mapping table and data block information table can solve the problems of large amounts of metadata updates, repeated IO redirection searches, space occupation by data fingerprint and data block index storage locations, and complex search performance overhead during data balancing in distributed storage systems.
[0148] In situations such as distributed storage system failure scenarios, when data balancing occurs, the consistency and efficiency of data can be ensured through consistent transaction read and write methods and processing judgment strategies.
[0149] The method of creating a consistency label for a data block in a data block information table can collect, filter, and recycle junk data blocks in a timely manner.
[0150] Based on the above method, the present invention can effectively improve the space utilization of the distributed storage system and ensure the performance, consistency and stability of the distributed storage system. Based on the same hardware resources, in a high-concurrency and multi-cloud distributed storage environment, it solves the metadata and broadcast IO overhead of distributed storage caused by deduplication. The method of the invention is decoupled from the distributed storage module, is transparent to the business client, and has stability. The components and method modules of the present invention are encapsulated and processed, which is safe. The components and modules proposed by the present invention can improve the competitiveness and maintenance cost of distributed storage. The method of the embodiment of the present invention is portable and universal on different hardware devices. Example 2
[0151] Embodiment 2 includes the technical features of Embodiment 1, such as Figure 4 As shown, in embodiment 2, a method for deleting duplicate data is provided, comprising the following steps:
[0152] Step S1, in response to a distributed storage system client writing a data object, slicing the data object into a plurality of pre-stored data blocks, and obtaining a block fingerprint corresponding to each pre-stored data block;
[0153] Step S2, locating and storing the pre-stored data blocks in the daemon process of each storage node of the distributed storage system through consistency algorithm mapping;
[0154] Step S3, storing an associated object mapping table and a data block information table in each storage node, wherein the object mapping table is used to locate the storage locations of multiple pre-stored data blocks of the data object, and the data block information table is used to record the block fingerprints, reference counts, and consistency tag states of the data blocks stored in the storage node;
[0155] Step S4, comparing the block fingerprint of the pre-stored data block in the daemon process with the block fingerprint of the data block stored in the storage node to identify whether it is duplicate data, adding one to the reference count corresponding to the block fingerprint of the duplicate data, and updating the state of the consistency label;
[0156] Step S5, deleting the pre-stored data blocks and block fingerprints that are duplicate data in the daemon process.
[0157] Among them, the noun fingerprint is the definition of data characteristics.
[0158] This embodiment implements storage in a distributed storage system by slicing a written data object into multiple pre-stored data blocks, and implements online storage in a daemon process by mapping and locating the pre-stored data blocks. Based on an online deduplication method, the block fingerprint of the pre-stored data block in the daemon process is compared with the block fingerprint of the data block stored in the storage node to identify whether it is duplicate data. The reference count corresponding to the block fingerprint of the duplicate data is increased by one to avoid writing duplicate data, and the pre-stored data blocks and block fingerprints of the duplicate data in the daemon process are deleted accordingly to avoid the problem of performance degradation caused by random broadcasting in a scenario with massive small files. At the same time, the online deduplication method can avoid the problem of performance degradation caused by complex search process in data balancing in a distributed storage system.
[0159] In this embodiment, in response to the distributed storage system client writing a data object, slicing the data object into a plurality of pre-stored data blocks, and obtaining a block fingerprint corresponding to each pre-stored data block includes:
[0160] Acquire a data object written by a client of the distributed storage system, slice the data object using a preset fixed size, and generate multiple small data block objects as pre-stored data blocks;
[0161] The small data block objects are grouped, wherein the group ID is equal to the modulo of a hash operation performed on the small data block objects and the number of groups;
[0162] The object name of the data object is obtained, and the object fingerprint and block fingerprint are generated using the SHA-256 algorithm.
[0163] The preset fixed size is preferably 4 MB. The specific slicing method and fingerprint generation method can effectively achieve distributed storage of data objects adapted to the distributed storage system.
[0164] In this embodiment, storing the associated object mapping table and data block information table in each storage node includes:
[0165] A metadata sharding module is set in each storage node of the distributed storage system, and each metadata sharding module stores the object name and data block content information in a data structure, and the data structure includes an object mapping table and a data block information table;
[0166] The object mapping table includes an object name, an object fingerprint and a data block linked list, and the data block information table includes a block fingerprint, a reference count and a consistency tag; the data block linked list points to the storage location of the data block, and the same consistency tag is set for multiple pre-stored data blocks of the same data object.
[0167] In this embodiment, the multiple pre-stored data blocks of the same data object are set with the same consistency tag, including:
[0168] In response to a data object written in a distributed storage system client, setting a consistency tag for the data object that is different from an existing consistency tag in the distributed storage system;
[0169] When slicing the data object to generate a plurality of small data block objects, copying the consistency tag of the data object as the consistency tag of the small data block object;
[0170] When the small data block object is asynchronously stored as a pre-stored data block, the consistency tag corresponding to the pre-stored data block is saved.
[0171] No matter when the pre-stored data blocks are stored or deleted, it can be ensured that the same consistency label is set for multiple pre-stored data blocks of the same data object, and it can be ensured that the same data object can be traced back to the same data source through the consistency label after being evenly distributed and stored in the distributed storage system.
[0172] In this embodiment, storing the associated object mapping table and data block information table in each storage node includes:
[0173] The data structure is set to be in the form of {object mapping table, data block information table};
[0174] The state of the consistency tag in the data block information table is set to include valid or invalid. A valid consistency tag represents that the data block corresponding to the block fingerprint is valid data, and an invalid consistency tag represents that the data block corresponding to the block fingerprint is lost or is currently in a transaction.
[0175] like Figure 2 As shown, the object mapping table and the data block information table are set in the data structure in the form of {object mapping table, data block information table}. The pre-stored data in the daemon process can be effectively identified based on the fingerprints corresponding to the data slices and data blocks.
[0176] In this embodiment, comparing the block fingerprint of the pre-stored data block in the daemon process with the block fingerprint of the data block stored in the storage node to identify whether it is duplicate data, adding one to the reference count corresponding to the block fingerprint of the duplicate data, and updating the state of the consistency label includes:
[0177] Presetting the state of the consistency tag of the pre-stored data block in the daemon process to invalid;
[0178] Determining whether there is a block fingerprint corresponding to the pre-stored data block in the data block information table;
[0179] If the block fingerprint exists and the consistency flag is valid, the reference count is incremented by one, and the pre-stored data block is determined to be duplicate data;
[0180] If the block fingerprint exists and the consistency flag is invalid, the reference count is not granted to increase, and if the content of the pre-stored data block can be called, the consistency flag is switched to valid;
[0181] If the block fingerprint does not exist, the pre-stored data block is determined to be the only data block, and the consistency flag is switched to valid.
[0182] like Figure 4 As shown, in this embodiment, the method further includes:
[0183] Step S6, storing the pre-stored data block determined to be the only data block in the storage node of the distributed storage system according to the mapping location;
[0184] Step S7: When the pre-stored data block is written successfully, the daemon process sends a confirmation message to the distributed storage system client.
[0185] In this embodiment, storing the pre-stored data block determined to be the only data block in the storage node of the distributed storage system according to the mapping location includes:
[0186] Acquire the storage node to which the pre-stored data block determined to be the only data block is mapped;
[0187] Setting the data block linked list in the object mapping table to point to the storage node where the pre-stored data block is mapped;
[0188] The daemon process is executed, and the pre-stored data block determined as the only data block in the daemon process is stored in a storage node of the distributed storage system.
[0189] In this embodiment, the method further includes:
[0190] Periodically collecting block fingerprints with invalid consistency tags from the data block information table;
[0191] When the number of block fingerprints with invalid consistency tags exceeds a threshold, checking the collected block fingerprints with the consistency tags in the data block information table;
[0192] When the collected consistency tag states do not change, the data blocks corresponding to the invalid consistency tags are deleted from the distributed storage system, and the block fingerprints corresponding to the invalid consistency tags are deleted.
[0193] System storage space is maintained by periodically detecting invalid consistency tags and deleting invalid data.
[0194] In this embodiment, the periodically collecting block fingerprints with invalid consistency tags from the data block information table includes:
[0195] On each storage node in the distributed storage system, block fingerprints with invalid consistency tags are collected using entries in the data block information table and cached through a buffer list.
[0196] In this embodiment, when the number of block fingerprints with invalid consistency tags exceeds a threshold, checking the collected block fingerprints with the consistency tags in the data block information table includes:
[0197] Periodically collecting block fingerprints with invalid consistency tags from the data block information table, and counting the total number of the collected block fingerprints with invalid consistency tags;
[0198] When the total number of block fingerprints with invalid consistency tags exceeds a threshold, it is detected whether the consistency tag status of the collected block fingerprints changes from invalid to valid.
[0199] By judging whether an invalid consistency tag becomes valid, data blocks in a transaction can be prevented from being mistakenly judged as invalid data.
[0200] In this embodiment, when the collected consistency tag state does not change, deleting the data block corresponding to the invalid consistency tag from the distributed storage system, and deleting the block fingerprint corresponding to the invalid consistency tag includes:
[0201] The block fingerprint whose consistency tag status changes from invalid to valid is deleted from the buffer list, and the data block corresponding to the block fingerprint with invalid consistency tag in the buffer list is determined as a garbage data block;
[0202] The garbage data block and its corresponding block fingerprint are deleted from the distributed storage system.
[0203] In this embodiment, when the collected consistency tag state does not change, deleting the data block corresponding to the invalid consistency tag from the distributed storage system, and deleting the block fingerprint corresponding to the invalid consistency tag also includes:
[0204] Controlling deletion of the junk data blocks and their corresponding block fingerprints from the distributed storage system one by one, and detecting whether a failure occurs after the junk data blocks and their corresponding block fingerprints are deleted;
[0205] If a failure occurs, the deleted garbage data blocks and their corresponding block fingerprints are restored;
[0206] If no failure occurs, the next garbage data block and its corresponding block fingerprint are deleted.
[0207] After deleting the data with invalid consistency tags, it is further determined whether it is deleted by mistake. If it is deleted by mistake, it is recovered and restored to prevent the data blocks in the transaction from being deleted by mistake.
[0208] In the above-mentioned deduplication method, the written data object is sliced into multiple pre-stored data blocks for storage in a distributed storage system, and the pre-stored data blocks are mapped and positioned to be stored online in a daemon process. Based on the online deduplication method, the block fingerprint of the pre-stored data block in the daemon process is compared with the block fingerprint of the data block stored in the storage node to identify whether it is duplicate data. The reference count corresponding to the block fingerprint of the duplicate data is increased by one to avoid writing duplicate data, and the pre-stored data blocks and block fingerprints of the duplicate data in the daemon process are deleted accordingly to avoid the problem of performance degradation caused by random broadcasting in a scenario with massive small files. At the same time, the online deduplication method can avoid the problem of performance degradation caused by complex search process in data balancing of the distributed storage system. Example 3
[0209] In Example 3, Figure 5 As shown, a data deduplication system 10 is provided, including: a data block fingerprint positioning module 1, a metadata sharding module 2, a consistency tag module 3 and a garbage collection module 4.
[0210] The data block fingerprint positioning module 1 is used to slice the data object into multiple pre-stored data blocks in response to the distributed storage system client writing the data object, and obtain the block fingerprint corresponding to each pre-stored data block; the pre-stored data blocks are located and stored in the daemon process of each storage node of the distributed storage system through consistency algorithm mapping.
[0211] The metadata sharding module 2 is used to store associated object mapping tables and data block information tables in each storage node, wherein the object mapping table is used to locate the storage locations of multiple pre-stored data blocks of the data object, and the data block information table is used to record the block fingerprints, reference counts and consistency label status of the data blocks stored in the storage node.
[0212] The consistency label module 3 is used to compare the block fingerprint of the pre-stored data block in the daemon process with the block fingerprint of the data block stored in the storage node to identify whether it is duplicate data, increase the reference count corresponding to the block fingerprint of the duplicate data by one, and update the status of the consistency label.
[0213] The garbage collection module 4 is used to delete the pre-stored data blocks and block fingerprints that are duplicate data in the daemon process.
[0214] In this embodiment, in response to the distributed storage system client writing a data object, slicing the data object into a plurality of pre-stored data blocks, and obtaining a block fingerprint corresponding to each pre-stored data block includes:
[0215] Acquire a data object written by a client of the distributed storage system, slice the data object using a preset fixed size, and generate multiple small data block objects as pre-stored data blocks;
[0216] The small data block objects are grouped, wherein the group ID is equal to the modulo of a hash operation performed on the small data block objects and the number of groups;
[0217] The object name of the data object is obtained, and the object fingerprint and block fingerprint are generated using the SHA-256 algorithm.
[0218] In this embodiment, storing the associated object mapping table and data block information table in each storage node includes:
[0219] A metadata sharding module is set in each storage node of the distributed storage system, and each metadata sharding module stores the object name and data block content information in a data structure, and the data structure includes an object mapping table and a data block information table;
[0220] The object mapping table includes an object name, an object fingerprint and a data block linked list, and the data block information table includes a block fingerprint, a reference count and a consistency tag; the data block linked list points to the storage location of the data block, and the same consistency tag is set for multiple pre-stored data blocks of the same data object.
[0221] In this embodiment, storing the associated object mapping table and data block information table in each storage node includes:
[0222] The data structure is set to be in the form of {object mapping table, data block information table};
[0223] The state of the consistency tag in the data block information table is set to include valid or invalid. A valid consistency tag represents that the data block corresponding to the block fingerprint is valid data, and an invalid consistency tag represents that the data block corresponding to the block fingerprint is lost or is currently in a transaction.
[0224] In this embodiment, comparing the block fingerprint of the pre-stored data block in the daemon process with the block fingerprint of the data block stored in the storage node to identify whether it is duplicate data, adding one to the reference count corresponding to the block fingerprint of the duplicate data, and updating the state of the consistency label includes:
[0225] Presetting the state of the consistency tag of the pre-stored data block in the daemon process to invalid;
[0226] Determining whether there is a block fingerprint corresponding to the pre-stored data block in the data block information table;
[0227] If the block fingerprint exists and the consistency flag is valid, the reference count is incremented by one, and the pre-stored data block is determined to be duplicate data;
[0228] If the block fingerprint exists and the consistency flag is invalid, the reference count is not granted to increase, and if the content of the pre-stored data block can be called, the consistency flag is switched to valid;
[0229] If the block fingerprint does not exist, the pre-stored data block is determined to be the only data block, and the consistency flag is switched to valid.
[0230] In this embodiment, the Figure 5 As shown, a data deduplication system 10 is provided, which also includes a storage and feedback module 5 .
[0231] The storage and feedback module 5 is used to store the pre-stored data block determined to be the only data block in the storage node of the distributed storage system according to the mapping location; when the pre-stored data block is written successfully, the daemon process sends a confirmation message to the distributed storage system client.
[0232] In this embodiment, storing the pre-stored data block determined to be the only data block in the storage node of the distributed storage system according to the mapping location includes:
[0233] Obtaining a storage node to which the pre-stored data block determined to be a unique data block is mapped;
[0234] Setting the data block linked list in the object mapping table to point to the storage node where the pre-stored data block is mapped;
[0235] The daemon process is executed, and the pre-stored data block determined as the only data block in the daemon process is stored in a storage node of the distributed storage system.
[0236] In this embodiment, the garbage collection module 4 is also used for:
[0237] Periodically collecting block fingerprints with invalid consistency tags from the data block information table;
[0238] When the number of block fingerprints with invalid consistency tags exceeds a threshold, checking the collected block fingerprints with the consistency tags in the data block information table;
[0239] When the collected consistency tag states do not change, the data blocks corresponding to the invalid consistency tags are deleted from the distributed storage system, and the block fingerprints corresponding to the invalid consistency tags are deleted.
[0240] In this embodiment, the periodically collecting block fingerprints with invalid consistency tags from the data block information table includes:
[0241] On each storage node in the distributed storage system, block fingerprints with invalid consistency tags are collected using entries in the data block information table and cached through a buffer list.
[0242] In this embodiment, when the number of block fingerprints with invalid consistency tags exceeds a threshold, checking the collected block fingerprints with the consistency tags in the data block information table includes:
[0243] Periodically collecting block fingerprints with invalid consistency tags from the data block information table, and counting the total number of the collected block fingerprints with invalid consistency tags;
[0244] When the total number of block fingerprints with invalid consistency tags exceeds a threshold, it is detected whether the consistency tag status of the collected block fingerprints changes from invalid to valid.
[0245] In this embodiment, when the collected consistency tag state does not change, deleting the data block corresponding to the invalid consistency tag from the distributed storage system, and deleting the block fingerprint corresponding to the invalid consistency tag includes:
[0246] The block fingerprint whose consistency tag status changes from invalid to valid is deleted from the buffer list, and the data block corresponding to the block fingerprint with invalid consistency tag in the buffer list is determined as a garbage data block;
[0247] The garbage data block and its corresponding block fingerprint are deleted from the distributed storage system.
[0248] In this embodiment, when the collected consistency tag state does not change, deleting the data block corresponding to the invalid consistency tag from the distributed storage system, and deleting the block fingerprint corresponding to the invalid consistency tag also includes:
[0249] Controlling deletion of the junk data blocks and their corresponding block fingerprints from the distributed storage system one by one, and detecting whether a failure occurs after the junk data blocks and their corresponding block fingerprints are deleted;
[0250] If a failure occurs, the deleted garbage data blocks and their corresponding block fingerprints are restored;
[0251] If no failure occurs, the next garbage data block and its corresponding block fingerprint are deleted.
[0252] In the above-mentioned deduplication device, the written data object is sliced into multiple pre-stored data blocks for storage in a distributed storage system, and the pre-stored data blocks are mapped and positioned to achieve online storage in the daemon process. Based on the online deduplication method, the block fingerprint of the pre-stored data block in the daemon process is compared with the block fingerprint of the data block stored in the storage node to identify whether it is duplicate data. The reference count corresponding to the block fingerprint of the duplicate data is increased by one to avoid writing duplicate data, and the pre-stored data blocks and block fingerprints of the duplicate data in the daemon process are deleted accordingly to avoid the problem of performance degradation caused by random broadcasting in a scenario with massive small files. At the same time, the online deduplication method can avoid the problem of performance degradation caused by complex search process in data balancing in the distributed storage system.
[0253] For the specific definition of the deduplication device, please refer to the definition of the deduplication method above, which will not be repeated here. Each module in the above deduplication device can be implemented in whole or in part by software, hardware and a combination thereof. Each of the above modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to each of the above modules.
[0254] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 6 As shown. The computer device includes a processor, a memory, a network interface and a database connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store deduplication data. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a deduplication method is implemented.
[0255] Those skilled in the art will understand that Figure 6 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0256] In one embodiment, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the following steps:
[0257] In response to a distributed storage system client writing a data object, slicing the data object into a plurality of pre-stored data blocks, and obtaining a block fingerprint corresponding to each pre-stored data block;
[0258] The pre-stored data blocks are located and stored in the daemon process of each storage node of the distributed storage system through consistency algorithm mapping;
[0259] An associated object mapping table and a data block information table are stored in each storage node, wherein the object mapping table is used to locate the storage locations of multiple pre-stored data blocks of the data object, and the data block information table is used to record the block fingerprints, reference counts, and consistency tag states of the data blocks stored in the storage node;
[0260] Compare the block fingerprint of the pre-stored data block in the daemon process with the block fingerprint of the data block stored in the storage node to identify whether it is duplicate data, increase the reference count corresponding to the block fingerprint of the duplicate data by one, and update the state of the consistency label;
[0261] The pre-stored data blocks and block fingerprints that are duplicate data in the daemon process are deleted.
[0262] For specific limitations on the steps implemented when the computer program is executed by the processor, please refer to the limitations on the method for deleting duplicate data above, which will not be repeated here.
[0263] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the following steps when executing the computer program:
[0264] In response to a distributed storage system client writing a data object, slicing the data object into a plurality of pre-stored data blocks, and obtaining a block fingerprint corresponding to each pre-stored data block;
[0265] The pre-stored data blocks are located and stored in the daemon process of each storage node of the distributed storage system through consistency algorithm mapping;
[0266] An associated object mapping table and a data block information table are stored in each storage node, wherein the object mapping table is used to locate the storage locations of multiple pre-stored data blocks of the data object, and the data block information table is used to record the block fingerprints, reference counts, and consistency tag states of the data blocks stored in the storage node;
[0267] Compare the block fingerprint of the pre-stored data block in the daemon process with the block fingerprint of the data block stored in the storage node to identify whether it is duplicate data, increase the reference count corresponding to the block fingerprint of the duplicate data by one, and update the state of the consistency label;
[0268] The pre-stored data blocks and block fingerprints that are duplicate data in the daemon process are deleted.
[0269] For specific limitations on the steps implemented when the processor executes the computer program, please refer to the limitations on the method for deleting duplicate data above, which will not be repeated here.
[0270] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
[0271] In response to a distributed storage system client writing a data object, slicing the data object into a plurality of pre-stored data blocks, and obtaining a block fingerprint corresponding to each pre-stored data block;
[0272] The pre-stored data blocks are located and stored in the daemon process of each storage node of the distributed storage system through consistency algorithm mapping;
[0273] An associated object mapping table and a data block information table are stored in each storage node, wherein the object mapping table is used to locate the storage locations of multiple pre-stored data blocks of the data object, and the data block information table is used to record the block fingerprints, reference counts, and consistency tag states of the data blocks stored in the storage node;
[0274] Compare the block fingerprint of the pre-stored data block in the daemon process with the block fingerprint of the data block stored in the storage node to identify whether it is duplicate data, increase the reference count corresponding to the block fingerprint of the duplicate data by one, and update the state of the consistency label;
[0275] The pre-stored data blocks and block fingerprints that are duplicate data in the daemon process are deleted.
[0276] For specific limitations on the steps implemented when the computer program is executed by the processor, please refer to the limitations on the method for deleting duplicate data above, which will not be repeated here.
[0277] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0278] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0279] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.
Claims
1. A method for deleting duplicate data, characterized in that: include: In response to a distributed storage system client writing a data object, slicing the data object into a plurality of pre-stored data blocks, and obtaining a block fingerprint corresponding to each pre-stored data block; The pre-stored data blocks are located and stored in the daemon process of each storage node of the distributed storage system through consistency algorithm mapping; An associated object mapping table and a data block information table are stored in each storage node, wherein the object mapping table is used to locate the storage locations of multiple pre-stored data blocks of the data object, and the data block information table is used to record the block fingerprints, reference counts, and consistency tag states of the data blocks stored in the storage node; Compare the block fingerprint of the pre-stored data block in the daemon process with the block fingerprint of the data block stored in the storage node to identify whether it is duplicate data, increase the reference count corresponding to the block fingerprint of the duplicate data by one, and update the state of the consistency label; Deleting pre-stored data blocks and block fingerprints that are duplicate data in the daemon process; The storing of the associated object mapping table and data block information table in each storage node includes: A metadata sharding module is set in each storage node of the distributed storage system, and each metadata sharding module stores the object name and data block content information in a data structure, and the data structure includes an object mapping table and a data block information table; The object mapping table includes an object name, an object fingerprint and a data block linked list, and the data block information table includes a block fingerprint, a reference count and a consistency tag; the data block linked list points to the storage location of the data block, and the same consistency tag is set for multiple pre-stored data blocks of the same data object; The storing of the associated object mapping table and data block information table in each storage node includes: The data structure is set to be in the form of {object mapping table, data block information table}; Setting the state of the consistency tag in the data block information table to include valid or invalid, a valid consistency tag represents that the data block corresponding to the block fingerprint is valid data, and an invalid consistency tag represents that the data block corresponding to the block fingerprint is lost or is currently in a transaction; The step of comparing the block fingerprint of the pre-stored data block in the daemon process with the block fingerprint of the data block stored in the storage node to identify whether the data is duplicate data, adding one to the reference count corresponding to the block fingerprint of the duplicate data, and updating the state of the consistency label includes: Presetting the state of the consistency tag of the pre-stored data block in the daemon process to invalid; Determining whether there is a block fingerprint corresponding to the pre-stored data block in the data block information table; If the block fingerprint exists and the consistency flag is valid, the reference count is incremented by one, and the pre-stored data block is determined to be duplicate data; If the block fingerprint exists and the consistency flag is invalid, the reference count is not granted to increase, and if the content of the pre-stored data block can be called, the consistency flag is switched to valid; If the block fingerprint does not exist, the pre-stored data block is determined to be a unique data block, and the consistency flag is switched to valid; The method for deleting duplicate data further comprises: Periodically collecting block fingerprints with invalid consistency tags from the data block information table; When the number of block fingerprints with invalid consistency tags exceeds a threshold, checking the collected block fingerprints with the consistency tags in the data block information table; When the collected consistency tag state does not change, the data block corresponding to the invalid consistency tag is deleted from the distributed storage system, and the block fingerprint corresponding to the invalid consistency tag is deleted; The periodically collecting block fingerprints with invalid consistency tags from the data block information table includes: On each storage node in the distributed storage system, using the entries in the data block information table to collect block fingerprints with invalid consistency tags, and caching them through a buffer list; Wherein, when the number of block fingerprints with invalid consistency tags exceeds a threshold, checking the collected block fingerprints with the consistency tags in the data block information table includes: Periodically collecting block fingerprints with invalid consistency tags from the data block information table, and counting the total number of the collected block fingerprints with invalid consistency tags; When the total number of block fingerprints with invalid consistency tags exceeds the threshold, detect whether the consistency tag status of the collected block fingerprints changes from invalid to valid; by judging whether the invalid consistency tag becomes valid, prevent the data block in the transaction from being misjudged as invalid data; Wherein, when the collected consistency tag state does not change, deleting the data block corresponding to the invalid consistency tag from the distributed storage system, and deleting the block fingerprint corresponding to the invalid consistency tag includes: The block fingerprint whose consistency tag status changes from invalid to valid is deleted from the buffer list, and the data block corresponding to the block fingerprint with invalid consistency tag in the buffer list is determined as a garbage data block; Deleting the junk data block and its corresponding block fingerprint from the distributed storage system; Wherein, when the collected consistency tag state does not change, deleting the data block corresponding to the invalid consistency tag from the distributed storage system, and deleting the block fingerprint corresponding to the invalid consistency tag also includes: Controlling deletion of the junk data blocks and their corresponding block fingerprints from the distributed storage system one by one, and detecting whether a failure occurs after the junk data blocks and their corresponding block fingerprints are deleted; If a failure occurs, the deleted garbage data blocks and their corresponding block fingerprints are restored; If no failure occurs, the next garbage data block and its corresponding block fingerprint are deleted.
2. The method for deleting duplicate data according to claim 1, characterized in that: In response to the distributed storage system client writing a data object, slicing the data object into a plurality of pre-stored data blocks, and obtaining a block fingerprint corresponding to each pre-stored data block comprises: Acquire a data object written by a client of the distributed storage system, slice the data object using a preset fixed size, and generate multiple small data block objects as pre-stored data blocks; The small data block objects are grouped, wherein the group ID is equal to the modulo of a hash operation performed on the small data block objects and the number of groups; The object name of the data object is obtained, and the object fingerprint and block fingerprint are generated using the SHA-256 algorithm.
3. The method for deleting duplicate data according to claim 1, characterized in that: The method further comprises: storing the pre-stored data block determined to be a unique data block in a storage node of the distributed storage system according to a mapping location; When the pre-stored data block is written successfully, the daemon process sends a confirmation message to the distributed storage system client.
4. The method for deleting duplicate data according to claim 3, characterized in that: The storing the pre-stored data block determined to be the only data block in the storage node of the distributed storage system according to the mapping location comprises: Acquire the storage node to which the pre-stored data block determined to be the only data block is mapped; Setting the data block linked list in the object mapping table to point to the storage node where the pre-stored data block is mapped; The daemon process is executed, and the pre-stored data block determined as the only data block in the daemon process is stored in a storage node of the distributed storage system.
5. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 4 are implemented.
6. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 4 are implemented.
7. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 4 are implemented.
Citation Information
Patent Citations
Virtual bucket multiple hash tables for efficient memory in-line deduplication application
CN107273397A
Data deduplication method and device, storage node and storage medium
CN110427347A
Distributed storage method, device and equipment and machine readable storage medium
CN114721594A
Data deduplication method and device, equipment and storage medium
CN115328403A
Distributed deduplication using locality sensitive hashing
US20160019232A1
