Duplicated data deleting method and filter
Through the hash calculation and query mechanism of the structured database, the problem of low efficiency of insertion vectors in the deduplication system is solved, efficient query and memory saving are achieved, and the insertion performance is improved.
Patent Information
- Application Number
- CN202410674399.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-28
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2044-05-28
AI Technical Summary
Existing accelerated index query technology has problems such as being unable to tell whether the slot is empty when inserting vectors in the deduplication system, resulting in low query efficiency and instability, resulting in reduced insertion performance and excessive memory overhead.
Use hash calculation to obtain the fingerprint information of the data block, query the existence of the vector through the structural database (including slot array, BitSet group and CountingSet group), and perform insertion or deletion operations when appropriate, by setting the first empty slot index The identification can quickly tell whether the slot is empty, improve insertion efficiency, and query in the BitSet group or CountingSet group to maintain high efficiency and reduce memory overhead.
It achieves efficient resolution and fast insertion when inserting vectors, provides stable and high query efficiency, significantly reduces memory overhead, and improves insertion performance by timely expanding the slot array to avoid relocation operations.
Smart Images

Figure CN118535539A
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data storage and processing, and in particular to a duplicate data deleting method and a filter. Background Art
[0002] At present, the total amount of data in the network is growing exponentially, which not only consumes more and more network bandwidth to transmit data, but also takes up huge data storage space. In order to reduce the total cost of ownership of computer data storage systems and computer networks, enterprises have begun to adopt data deduplication technology.
[0003] Data deduplication technology has become a mainstream and extremely important technology in the field of computer systems. Its working principle is to identify duplicate data from the data stream, keep only one copy of the duplicate data, delete other redundant data, and reference the location of the deleted duplicate data with a pointer, thereby saving a lot of data storage space or network bandwidth.
[0004] In order to meet the scalable performance requirements of massive data backup, it is crucial to use efficient data structures or algorithms in memory to accelerate index queries, avoid disk access, and achieve fast data deduplication.
[0005] However, existing technologies for accelerating index queries have many problems when working in deduplication systems: for example, they cannot tell whether a slot is empty when inserting a vector; the query efficiency is low and unstable; a large number of relocation operations lead to a decrease in insertion performance; and the memory overhead is too large. Summary of the invention
[0006] The present invention provides a deduplication method and filter, which solve the problems that when the existing accelerated index query technology works in a deduplication system, the insertion vector cannot distinguish whether a slot is empty, the query efficiency is low and unstable, a large number of relocation operations lead to reduced insertion performance, and the memory overhead is too large.
[0007] In order to solve the above technical problems, the technical solution adopted by the present invention is to provide a method for deleting duplicate data, including the steps of: cutting a file object to be processed into multiple data blocks, performing hash calculation on each of the data blocks, and obtaining fingerprint information corresponding to the data block; calculating and obtaining a vector of the fingerprint information to be queried and its corresponding candidate bucket; querying whether the vector exists in a structure database associated with the candidate bucket; if the vector does not exist in the structure database, inserting the vector into the corresponding candidate bucket; if the vector exists in the structure database, querying whether the fingerprint information corresponding to the vector exists in a disk database; if the fingerprint information exists in the disk database, deleting a copy of the vector of the fingerprint information; if the fingerprint information does not exist in the disk database, inserting the vector of the fingerprint information into the corresponding candidate bucket; wherein the structure database includes a slot array, a BitSet group and a CountingSet group.
[0008] In some embodiments, the query whether the vector exists in the structure database associated with the candidate bucket includes the steps of: calculating the space utilization of the storage bucket according to the number of the storage bucket and the vectors stored therein; wherein the storage bucket includes multiple candidate buckets; if the space utilization is not greater than the first set threshold or the second set threshold, querying whether the vector exists in the slot array associated with the candidate bucket; if the space utilization is greater than the second set threshold and not greater than the third set threshold, constructing the BitSet group associated with the candidate bucket according to the slot array, and querying whether the vector exists in the corresponding BitSet group; if the space utilization is greater than the third set threshold, constructing the CountingSet group associated with the candidate bucket according to the slot array and the BitSet group, and querying whether the vector exists in the corresponding CountingSet group.
[0009] In some embodiments, the method for inserting the vector into the corresponding candidate bucket includes the following steps: the number of the candidate buckets is two, and one of the candidate buckets is selected as the target insertion bucket; if the BitSet group and the CountingSet group associated with the target insertion bucket are not constructed, the vector is inserted into the slot position indicated by the first empty slot index of the slot array associated with the target insertion bucket, and the first empty slot index is recalculated; if the BitSet group associated with the target insertion bucket has been constructed, and the value of the corresponding position of the BitSet group is 1, the vector is inserted into the slot position indicated by the first empty slot index, and the first empty slot index is recalculated; if the value of the corresponding position of the BitSet group is 0, the value of the corresponding position of the BitSet group is set to 1; if the CountingSet group associated with the target insertion bucket has been constructed, the value of the corresponding counter in the CountingSet group is increased by one.
[0010] In some embodiments, the method for selecting one of the candidate buckets as the target insertion bucket comprises the following steps: if the two CountingSet groups respectively associated with the two candidate buckets have been constructed, comparing the values of the corresponding counters of the two CountingSet groups, and taking the candidate bucket of the CountingSet group with the smaller value of the corresponding counter as the target insertion bucket; if the CountingSet group corresponding to only one of the two candidate buckets has been constructed, taking the candidate bucket of the constructed CountingSet group as the target insertion bucket; if the two CountingSet groups associated with the two candidate buckets have not been constructed, and the CountingSet groups associated with the two candidate buckets have not been constructed, If the two BitSet groups associated with the candidate bucket have been constructed, the candidate bucket of the BitSet group with a value of 0 at the corresponding position is used as the target insertion bucket; if the two CountingSet groups associated with the two candidate buckets have not been constructed, and the BitSet group corresponding to only one candidate bucket has been constructed, the candidate bucket with the constructed BitSet group is used as the target insertion bucket; if the two CountingSet groups and the two BitSet groups associated with the two candidate buckets have not been constructed, the numbers of empty slots of the two slot arrays associated with the two candidate buckets are compared, and the candidate bucket of the slot array with a larger number of empty slots is used as the target insertion bucket.
[0011] In some embodiments, the method of inserting the vector into the corresponding candidate bucket also includes the steps of: under the premise that the two CountingSet groups and the two BitSet groups associated with the two candidate buckets are not constructed, and the number of empty slots of the two slot arrays associated with the two candidate buckets is 0: if the space utilization is less than the first set threshold, randomly selecting one of the candidate buckets, creating a new slot array for the selected candidate bucket, copying the contents of the original slot array of the selected candidate bucket to the corresponding positions of the newly created slot array, and deleting the original slot array; wherein the number of slots of the newly created slot array is twice the number of slots of the original slot array.
[0012] In some embodiments, the method of inserting the vector into the corresponding candidate bucket also includes the steps of: under the premise that the two CountingSet groups and the two BitSet groups associated with the two candidate buckets are not constructed, and the number of empty slots of the two slot arrays associated with the two candidate buckets are both 0: if the space utilization is not less than the first set threshold and not greater than the second set threshold, then creating multiple corresponding slot arrays for the storage bucket, and the number of slots of each newly created slot array is equal to the number of slots of each initial slot array.
[0013] In some embodiments, the method for deleting a copy of the vector of the fingerprint information includes the following steps: if the BitSet group and the CountingSet group associated with the candidate bucket are not constructed, then the vector at the slot position indicated by the first non-empty slot index of the slot array associated with the candidate bucket is moved to the slot position where the copy of the vector is located, the copy of the vector is deleted, and the first non-empty slot index is recalculated; if the BitSet group associated with the candidate bucket has been constructed, then query whether there is a copy of the vector in the slot array associated with the candidate bucket; if so, then delete the copy of the vector and set the value of the corresponding position of the BitSet group to 1; if not, then set the value of the corresponding position of the BitSet group to 0; if the CountingSet group associated with the candidate bucket has been constructed, then reduce the value of the corresponding counter in the CountingSet group by one.
[0014] In some embodiments, the method for constructing the BitSet group associated with the candidate bucket includes the steps of: reading the vector in the slot array associated with the candidate bucket, assigning a position to the BitSet group, and determining whether the value of the corresponding position in the BitSet group is 1; if not 1, setting the value of the corresponding position in the BitSet group to 1, deleting the corresponding vector in the slot array, and continuing to read the remaining vectors in the slot array; if it is 1, continuing to read the remaining vectors in the slot array, and repeating the above steps until all vectors in the slot array are read.
[0015] In some embodiments, the method for constructing the CountingSet group associated with the candidate bucket includes the following steps: if the BitSet group associated with the candidate bucket has not been constructed, reading all vectors in the slot array associated with the candidate bucket, assigning a counter to the CountingSet group, adding one to the value of each corresponding counter in the CountingSet group according to the vector, and deleting the slot array; if the BitSet group associated with the candidate bucket has been constructed, reading the value of each position in the BitSet group, assigning a counter to the CountingSet group, if the value of the corresponding position in the BitSet group is 1, adding one to the value of the corresponding counter in the CountingSet group, then deleting the BitSet group, continuing to read all vectors in the slot array associated with the candidate bucket, adding one to the value of each corresponding counter in the CountingSet group according to the vector, and deleting the slot array.
[0016] The present invention also provides a filter, including a storage bucket, wherein the storage bucket includes multiple candidate buckets, the candidate buckets are used to store vectors, the candidate buckets have slot arrays, BitSet groups and CountingSet groups associated with them, and the candidate buckets implement the above-mentioned deduplication method based on the slot arrays, BitSet groups and CountingSet groups.
[0017] The beneficial effects of the present invention are as follows: the present invention discloses a deduplication method and filter, the method comprising the steps of: cutting a file object to be processed into a plurality of data blocks, performing hash calculation on each data block, and obtaining fingerprint information corresponding to the data block; calculating and obtaining a vector of fingerprint information to be queried and a candidate bucket corresponding thereto; querying whether the vector exists in a structure database associated with the candidate bucket; if the vector does not exist in the structure database, inserting the vector into the corresponding candidate bucket; if the vector exists in the structure database, querying whether the fingerprint information corresponding to the vector exists in a disk database; if the fingerprint information exists in the disk database, deleting a copy of the vector of the fingerprint information; if the fingerprint information does not exist in the disk database, inserting the vector of the fingerprint information into the corresponding candidate bucket; wherein the structure database comprises a slot array, a BitSet group, and a CountingSet group. The filter comprises a storage bucket, the storage bucket comprises a plurality of candidate buckets, the candidate bucket is used to store vectors, the candidate bucket has a slot array, a BitSet group, and a CountingSet group associated therewith, and the candidate bucket implements the deduplication method described above based on the slot array, the BitSet group, and the CountingSet group. The present application sets the first empty slot index as the empty slot indication position, so that when inserting a vector, it is possible to quickly determine whether the slot is empty, thereby improving the efficiency of vector insertion; the candidate bucket in the present application is associated with three data structures (slot array, BitSet group and CountingSet group). When the amount of processed data gradually increases, the vector can be queried in the BitSet group or the CountingSet group, which provides stable and high query efficiency without affecting the false positive rate, while significantly reducing memory overhead; and the present application judges the space utilization rate and expands the slot array in a timely manner, thereby effectively avoiding relocation operations and improving insertion performance. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] Figure 1 It is a flowchart of the duplicate data deleting method provided by the present application;
[0019] Figure 2 It is a schematic diagram of the composition of the filter provided by the present application;
[0020] Figure 3 It is a structural schematic diagram of a slot array in the deduplication method provided by the present application;
[0021] Figure 4 It is a structural diagram of a BitSet group in the deduplication method provided by this application;
[0022] Figure 5 It is a structural diagram of the CountingSet group in the deduplication method provided by this application;
[0023] Figure 6 is a schematic diagram of the first empty slot index in the deduplication method provided by the present application;
[0024] Figure 7 This is a schematic diagram of inserting a vector in the deduplication method provided by this application. Figure 1 ;
[0025] Figure 8 This is a schematic diagram of inserting a vector in the deduplication method provided by this application. Figure 2 ;
[0026] Fig. 9 This is a schematic diagram of inserting a vector in the deduplication method provided by this application. Figure 3 ;
[0027] Fig.10 This is a schematic diagram of inserting a vector in the deduplication method provided by this application. Figure 4 ;
[0028] Fig.11 This is a schematic diagram of deleting vector copies in the deduplication method provided by this application. Figure 1 ;
[0029] Fig.12 This is a schematic diagram of deleting vector copies in the deduplication method provided by this application. Figure 2 ;
[0030] Fig.13 This is a schematic diagram of deleting vector copies in the deduplication method provided by this application. Figure 3 ;
[0031] Fig.14 This is a schematic diagram of deleting vector copies in the deduplication method provided by this application. Figure 4 ;
[0032] Fig.15 This is a schematic diagram of deleting vector copies in the deduplication method provided by this application. Figure 5 ;
[0033] Fig.16 This is a schematic diagram of deleting vector copies in the deduplication method provided by this application. Figure 6 ;
[0034] Fig.17 This is a schematic diagram of deleting vector copies in the deduplication method provided by this application. Figure 7 ;
[0035] Fig.18 This is a schematic diagram of deleting vector copies in the deduplication method provided by this application. Figure 8 . DETAILED DESCRIPTION
[0036] In order to facilitate the understanding of the present invention, the present invention is described in more detail below in conjunction with the accompanying drawings and specific embodiments. Preferred embodiments of the present invention are provided in the accompanying drawings. However, the present invention can be implemented in many different forms and is not limited to the embodiments described in this specification. On the contrary, the purpose of providing these embodiments is to make the understanding of the disclosure of the present invention more thorough and comprehensive.
[0037] It should be noted that, unless otherwise defined, all technical and scientific terms used in this specification have the same meaning as those commonly understood by those skilled in the art of the present invention. The terms used in the specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. The term "and / or" used in this specification includes any and all combinations of one or more related listed items.
[0038] Figure 1 The implementation flow chart of the duplicate data deleting method provided by the present application is shown, including the steps of:
[0039] S1: Cut the file object to be processed into multiple data blocks, perform hash calculation on each data block, and obtain fingerprint information corresponding to the data block.
[0040] S2: Calculate and obtain the vector of the fingerprint information to be queried and its corresponding candidate bucket.
[0041] S3: Whether the query vector exists in the structure database associated with the candidate bucket.
[0042] S4: If the vector does not exist in the structure database, insert the vector into the corresponding candidate bucket.
[0043] S5: If the vector exists in the structure database, query whether the fingerprint information corresponding to the vector exists in the disk database.
[0044] S6: If the fingerprint information exists in the disk database, the copy of the vector of the fingerprint information is deleted.
[0045] S7: If the fingerprint information does not exist in the disk database, insert the vector of the fingerprint information into the corresponding candidate bucket.
[0046] The structure database includes a slot array, a BitSet group and a CountingSet group.
[0047] The present application sets the first empty slot index as the empty slot indication position, so that when inserting a vector, it is possible to quickly determine whether the slot is empty, thereby improving the efficiency of vector insertion; the candidate bucket in the present application is associated with three data structures (slot array, BitSet group and CountingSet group). When the amount of processed data gradually increases, the vector can be queried in the BitSet group or the CountingSet group, which provides stable and high query efficiency without affecting the false positive rate, while significantly reducing memory overhead; and the present application judges the space utilization rate and expands the slot array in a timely manner, thereby effectively avoiding relocation operations and improving insertion performance.
[0048] Combine the following Figures 1 to 17 , this application is described in detail with specific embodiments.
[0049] like Figure 1 As shown, the deduplication method provided by the embodiment of the present application is described in detail as follows:
[0050] S1: Cut the file object to be processed into multiple data blocks, perform hash calculation on each data block, and obtain fingerprint information corresponding to the data block.
[0051] Among them, hash calculation is a method of mapping data of arbitrary length to data of fixed length, which is usually used in scenarios such as data integrity verification, password storage and comparison, data sharding and load balancing. Hash function is the core algorithm for implementing hash calculation, which maps input data to hash value or hash code, which is usually an integer (hexadecimal) of fixed length (such as 32 bits, 64 bits, etc.). Hash value is also called hash value, summary or fingerprint, which is the process of converting binary data of arbitrary length into a unique value of fixed length through hash algorithm.
[0052] Commonly used hash algorithms include MD5, SHA-1, SHA-256, etc. SHA-256 is one of the most widely used hash algorithms and is suitable for encryption of sensitive data. The characteristics of hash algorithms include: the input can be a string of any length, and the output result is fixed in length. The output value of the hash algorithm is of fixed length, so there is a collision problem, that is, different input values may get the same output value, that is, different data blocks may get the same fingerprint information.
[0053] S2: Calculate and obtain the vector of the fingerprint information to be queried and its corresponding candidate bucket.
[0054] like Figure 2As shown, the filter of the present application includes a storage bucket 1, which includes multiple candidate buckets 2, each of which has a structural database associated with it (slot array 3, BitSet group 4 and CountingSet group 5). When querying fingerprint information, it is first necessary to calculate the corresponding vector, as well as the two candidate buckets 2 corresponding to the fingerprint information and their positions, and then find out whether the corresponding vector exists in the structural database associated with the two candidate buckets 2, so as to determine whether the data block to which the fingerprint information belongs is new data, and further process it.
[0055] S3: Whether the query vector exists in the structure database associated with the candidate bucket.
[0056] In this embodiment, the structure database includes a slot array, a BitSet group, and a CountingSet group.
[0057] The structure of the slot array is as follows Figure 3 As shown, CF0 is the initial slot array, CF1 is the newly created slot array, each slot array includes multiple slots, each slot stores a corresponding vector, B i Represents one of the candidate buckets.
[0058] The structure of the BitSet group is as follows Figure 4 As shown, the BitSet group can accurately represent the existence status of all vectors. The length of the BitSet group is 2 r , r represents the length of each vector. Each position in the BitSet group corresponds to a vector (such as 000, 001, 010, etc.), and the value stored in each position is only 0 and 1. 0 means that the vector corresponding to the position does not exist, and 1 means that it exists. For example, the value in the position corresponding to the vector 000 is 1, which means that the vector 000 already exists in the BitSet group, while the value in the position corresponding to the vector 111 is 0, which means that the vector 111 does not exist in the BitSet group. In this way, it is possible to query whether the corresponding vector of the fingerprint information exists in the BitSet group.
[0059] The structure of the CountingSet group is as follows Figure 5 As shown, the CountingSet group is used to count the frequency of occurrence of vectors. Each CountingSet group includes multiple counters, each counter corresponds to a vector (such as 000, 001, 010, etc.); the length of the CountingSet group is 1×2 r, r represents the length of each vector, 1 represents the length of each counter; the value of each counter in the CountingSet group represents the number of times the corresponding vector appears, such as the value of the counter corresponding to the vector 000 is 1, which means that the vector 000 appears once in the CountingSet group, and the value of the counter corresponding to the vector 011 is 3, which means that the vector 011 appears three times in the CountingSet group, and the value of the counter corresponding to the vector 111 is 0, which means that the vector 111 has not appeared in the CountingSet group. Based on the above content, it is possible to query whether the corresponding vector of the fingerprint information exists in the CountingSet group.
[0060] Furthermore, according to the number of the bucket and the vectors stored therein, the space utilization of the bucket is calculated.
[0061] Specifically, the space utilization is equal to the number of all vectors stored in the bucket divided by the number of slots to which the vectors have been allocated and / or the number of positions of the BitSet group and / or the number of counters. The space utilization includes three preset thresholds: a first set threshold α, a second set threshold β, and a third set threshold γ, and the first set threshold α<the second set threshold β<the third set threshold γ.
[0062] Further, if the space utilization is not greater than the first set threshold α or the second set threshold β, it is queried whether the vector exists in the slot array associated with the candidate bucket.
[0063] Combination Figure 3 And the above related content, if the query vector is 011, according to Figure 3 From the contents of the third slot, the fifth slot, and the seventh slot of the slot array CF0, it can be seen that the vector 011 exists in the slot array associated with the candidate bucket, and the query result is a false positive. A false positive means that the vector exists in the structure database associated with the candidate bucket, but may not exist in the disk database. Therefore, it is necessary to further search for the corresponding fingerprint information in the disk database. If the vector to be queried is 010, according to the content of the first slot of the slot array CF1, it can be seen that the vector 010 exists in the slot array associated with the candidate bucket, and the query result is a false positive. If the vector to be queried is 111, according to the contents of the slots of the two slot arrays CF0 and CF1, it can be seen that the vector 111 does not exist in the slot array associated with the candidate bucket, and the query result is negative.
[0064] Further, if the space utilization is greater than the second set threshold β and not greater than the third set threshold γ, a BitSet group associated with the candidate bucket is constructed according to the slot array, and it is queried whether the vector exists in the corresponding BitSet group.
[0065] Specific, combined Figure 3 and Figure 4 , the method for constructing a BitSet group associated with a candidate bucket comprises the steps of:
[0066] like Figure 3 As shown, first read the vector in the slot array associated with the candidate bucket, assign a position to the BitSet group, and determine whether the value of the corresponding position in the BitSet group is 1. If it is not 1 (that is, 0), set the value of the corresponding position in the BitSet group to 1, delete the corresponding vector in the slot array, and continue to read the remaining vectors in the slot array. If it is 1, continue to read the remaining vectors in the slot array, and repeat the above steps until all vectors in the slot array are read.
[0067] For example, first read Figure 3 The vector 001 in the first slot of the slot array CF0 in the BitSet group has just been assigned, so the value in each position is 0 (that is, the initial state), so the corresponding position of the vector 001 in the BitSet group (that is, Figure 4 The value at the second position of the BitSet group in the Figure 3 The vector 001 in the first slot of the slot array CF0 is deleted. The vector 001 in the second slot of the slot array CF0 is read. At this time, the value of the corresponding position of the vector 001 in the BitSet group has been set to 1, so it is not processed; and the vector 011 in the third slot of the slot array CF0 is read. The corresponding position of the vector 011 in the BitSet group (i.e. Figure 4 The value at the fourth position of the BitSet group in the byte array is set to 1, and then Figure 3 The vector 011 in the third slot of the slot array CF0 is deleted. The vector 100 in the fourth slot of the slot array CF0 is read and processed, and so on, until the last vector 101 in the slot array CF1 is read and processed. At this time, the BitSet group associated with the candidate bucket is constructed, as shown in Figure 4 As shown in , the corresponding content of the slot array also changes.
[0068] Furthermore, it is queried whether the vector exists in the corresponding BitSet group that has been constructed.
[0069] Specifically, if the query vector is 011, according to Figure 4The value 1 in the fourth position of the BitSet group indicates that vector 011 exists in the BitSet group associated with the candidate bucket, so the query result is a false positive, and it is necessary to further search for the fingerprint information corresponding to vector 011 in the disk database; if the vector to be queried is 111, according to Figure 4 From the value 0 in the eighth position of the BitSet group, it can be seen that the vector 111 does not exist in the BitSet group associated with the candidate bucket, and the query result is negative.
[0070] Further, if the space utilization is greater than a third set threshold γ, a CountingSet group associated with the candidate bucket is constructed according to the slot array and the BitSet group, and it is queried whether the vector exists in the corresponding CountingSet group.
[0071] Specific, combined Figures 3 to 5 , the method for constructing a CountingSet group associated with a candidate bucket comprises the steps of:
[0072] If the BitSet group associated with the candidate bucket is not constructed, read all vectors in the slot array associated with the candidate bucket, assign counters to the CountingSet group, increase the value of each corresponding counter in the CountingSet group by one according to the vector, and delete the slot array.
[0073] For example, the BitSet group is not constructed, read Figure 3 All the vectors in the two slot arrays CF0 and CF1 in the CountingSet group are counted. At this time, the counters of the CountingSet group have just been allocated, and the value of each counter is 0. Then the value of the counter corresponding to each vector is increased by 1. If there are two identical vectors in the slot array (such as vector 001), the value of the counter is increased by 1 respectively. Finally, the value of the counter corresponding to vector 001 in the CountingSet group is 2. Figure 5 As shown in , the slot array is finally deleted, and the construction of the CountingSet group associated with the candidate bucket is completed.
[0074] If the BitSet group associated with the candidate bucket has been constructed, read the value of each position in the BitSet group, assign a counter to the CountingSet group, and if the value of the corresponding position in the BitSet group is 1, increase the value of the corresponding counter in the CountingSet group by one, then delete the BitSet group, continue to read all vectors in the slot array associated with the candidate bucket, increase the value of each corresponding counter in the CountingSet group by one according to the vector, and delete the slot array.
[0075] For example, the BitSet group has been constructed and read Figure 4The value of each position in the BitSet group is 1, and the vectors corresponding to the positions with a value of 1 (i.e., vectors 000, 001, 010, 011, 100, 101, 110) are incremented by one in the corresponding counters in the CountingSet group, and then the BitSet group is deleted (e.g. Figure 5 Continue reading Figure 4 All the vectors of the slot array CF0 (i.e., vectors 011, 001, 011) in the CountingSet group are incremented by one. Finally, the slot array is deleted (e.g., Figure 5 As shown), at this time, the construction of the CountingSet group associated with the candidate bucket is completed.
[0076] Furthermore, it is queried whether the vector exists in the corresponding CountingSet group that has been constructed.
[0077] Specifically, if the query vector is 011, according to Figure 5 The value of the fourth counter of the CountingSet group in 3 shows that vector 011 exists in the CountingSet group associated with the candidate bucket, so the query result is a false positive, and it is necessary to further search for the fingerprint information corresponding to vector 011 in the disk database; if the vector to be queried is 111, according to Figure 5 The value of the eighth counter of the CountingSet group is 0, indicating that vector 111 does not exist in the CountingSet group associated with the candidate bucket, and the query result is negative.
[0078] S4: If the vector does not exist in the structure database, insert the vector into the corresponding candidate bucket.
[0079] According to the query results in S3, vectors that do not exist in the structure database (ie, vectors for which the query results are negative) are inserted into the corresponding candidate buckets.
[0080] There are two candidate buckets, one of which is selected as the target insertion bucket, and the vector is inserted into the target insertion bucket.
[0081] Specifically, if two CountingSet groups respectively associated with two candidate buckets have been constructed, the values of the corresponding counters of the vector to be inserted in the two CountingSet groups are compared, and the candidate bucket of the CountingSet group with the smaller value of the corresponding counter is used as the target insertion bucket, and the value of the corresponding counter in the CountingSet group with the smaller value is increased by one, that is, the vector to be inserted is inserted into the target insertion bucket.
[0082] If only one of the two candidate buckets has a corresponding CountingSet group that has been constructed, the candidate bucket of the constructed CountingSet group is inserted into the bucket as the target, and the value of the corresponding counter in the CountingSet group is increased by one.
[0083] If the two CountingSet groups associated with the two candidate buckets are not constructed, and the two BitSet groups associated with the two candidate buckets are constructed, the candidate bucket of the BitSet group whose value at the corresponding position of the vector to be inserted is 0 is used as the target insertion bucket, and the value at the corresponding position of the BitSet group is set to 1.
[0084] If the two CountingSet groups associated with the two candidate buckets are not constructed, and only one BitSet group corresponding to the candidate bucket has been constructed, the candidate bucket with the constructed BitSet group is used as the target insertion bucket. If the value of the corresponding position of the vector to be inserted in the BitSet group is 1, the vector is inserted into the corresponding position. Figure 6 The target is inserted into the slot position indicated by the first empty slot index lastCelllndex of the slot array CF0 associated with the bucket B1, and the first empty slot index lastCelllndex is recalculated; wherein, the slot position indicated by the first empty slot index lastCelllndex is the position of the first empty slot in the slot array from left to right. If the value of the corresponding position of the vector to be inserted into the BitSet group is 0, the value of the corresponding position of the BitSet group is set to 1.
[0085] If the two CountingSet groups and the two BitSet groups associated with the two candidate buckets are not constructed, the number of empty slots in the two slot arrays associated with the two candidate buckets is compared, and the candidate bucket of the slot array with the larger number of empty slots is inserted into the bucket as the target; then the vector is inserted into the bucket associated with Figure 6 The target shown is inserted into the slot position indicated by the first empty slot index lastCelllndex of the slot array CF0 associated with the bucket B1, and the first empty slot index is recalculated.
[0086] Under the premise that the two CountingSet groups and the two BitSet groups associated with the two candidate buckets are not constructed, and the number of empty slots in the two slot arrays associated with the two candidate buckets is 0:
[0087] like Figure 7 , Figure 8As shown, if the space utilization is less than the first set threshold α, a candidate bucket is randomly selected, a new slot array is created for the selected candidate bucket, the content in the original slot array of the selected candidate bucket is copied to the corresponding position of the newly created slot array, and the original slot array is deleted; wherein the number of slots in the newly created slot array is twice the number of slots in the original slot array, Figure 7 is the original slot array, Figure 8 is the newly created slot array. The vector to be inserted is inserted into the first empty slot in the newly created slot array from left to right, where b6 is the vector to be inserted.
[0088] like Fig. 9 , Fig.10 As shown, if the space utilization is not less than the first set threshold α and not greater than the second set threshold β, multiple corresponding slot arrays are newly created for the storage bucket, and the number of slots in each newly created slot array is equal to the number of slots in each initial slot array. Among them, CF0 is the original slot array of the storage bucket, and CF1 is the newly created slot array of the storage bucket. The number of slots in each slot array in CF1 is four, which is equal to the number of slots set in each initial slot array. And insert the vector to be inserted into the newly created slot array, where f9 is the vector to be inserted.
[0089] S5: If the vector exists in the structure database, query whether the fingerprint information corresponding to the vector exists in the disk database.
[0090] According to S3, if the vector exists in the structure database, the query result is a false positive, and it is necessary to further query the corresponding fingerprint information in the disk database to determine whether the data block to which the fingerprint information belongs is new data; if the fingerprint information exists in the disk database, the data block to which it belongs is not new data; if the fingerprint information does not exist in the disk database, the data block to which it belongs is new data.
[0091] S6: If the fingerprint information exists in the disk database, the copy of the vector of the fingerprint information is deleted.
[0092] If the fingerprint information exists in the disk database, it means that the data block to which it belongs is not new data, so the copy of the vector corresponding to the fingerprint information needs to be deleted to save space.
[0093] Specifically, the method for deleting the copy of the vector of fingerprint information includes the steps of:
[0094] like Fig.11 and Fig.12As shown, if the BitSet group and the CountingSet group associated with the candidate bucket are not constructed, the vector 101 at the slot position indicated by the first non-empty slot index of the slot array associated with the candidate bucket (that is, the first digit before the slot position indicated by the first empty slot index lastCelllndex) is moved to the slot position where the copy 110 of the vector is located, the copy 110 of the vector is deleted, and the first non-empty slot index is recalculated. After the processing is completed, Fig.12 shown.
[0095] like Figures 13 to 16 As shown in , if the BitSet group associated with the candidate bucket has been constructed, then query whether there is a copy of the vector in the slot array associated with the candidate bucket. Fig.13 As shown in , there is a copy of the vector such as 011, then delete the copy of the vector 011, and set the value of the corresponding position of the BitSet group to 1, and move the vector 111 at the slot position indicated by the first non-empty slot index in the slot array to the original position of the copy of the vector 011 (that is, the position of the third slot). After the processing is completed, Fig.14 As shown. Fig.15 If there is no copy of the vector in the slot array, such as 101, the value of the corresponding position of the BitSet group is set to 0. Fig.16 shown.
[0096] like Fig.17 and Fig.18 As shown, if the CountingSet group associated with the candidate bucket has been constructed, combined with Fig.17 , assuming that the number of copies of the vector to be deleted is 110, then the value of the corresponding counter in the CountingSet group is reduced by one (that is, the value of the seventh counter in the CountingSet group is changed from 2 to 1). After the processing is completed, Fig.18 shown.
[0097] S7: If the fingerprint information does not exist in the disk database, insert the vector of the fingerprint information into the corresponding candidate bucket.
[0098] If the fingerprint information does not exist in the disk database, it means that the data block to which it belongs is new data, and the vector corresponding to the fingerprint information needs to be inserted into the corresponding candidate bucket. The specific insertion method can be referred to in S4, which will not be repeated here.
[0099] In summary, the deduplication method of the present application sets the first empty slot index lastCelllndex as the empty slot indication position, so that when inserting a vector, it can quickly determine whether the slot is empty, thereby improving the efficiency of vector insertion; the candidate bucket in the present application is associated with three data structures (slot array, BitSet group and CountingSet group). When the amount of processed data gradually increases, the vector can be queried in the BitSet group or the CountingSet group, which provides stable and high query efficiency without affecting the false positive rate, while significantly reducing memory overhead; and the present application judges the space utilization and expands the slot array in a timely manner, effectively avoiding relocation operations and improving insertion performance.
[0100] Corresponding to the duplicate data deleting method of the above embodiment, the embodiment of the present application further provides a filter. For the convenience of explanation, only the part related to the embodiment of the present application is shown.
[0101] like Figure 2 As shown, the filter includes a storage bucket 1, which includes multiple candidate buckets 2. The candidate buckets 2 are used to store vectors. Each candidate bucket 2 has a slot array 3, a BitSet group 4 and a CountingSet group 5 associated therewith. The candidate bucket 2 implements the above-mentioned deduplication method based on the slot array 3, the BitSet group 4 and the CountingSet group 5.
[0102] It should be noted that since the above-mentioned filter is based on the same concept as the embodiment of the method of the present application, its specific functions, the process of each component to realize its respective functions and the technical effects brought about can be specifically referred to the description of the embodiment shown in the aforementioned duplicate data deletion method, and will not be repeated here.
[0103] It can be seen that the present invention discloses a method and filter for deduplication, which includes the steps of: cutting a file object to be processed into multiple data blocks, performing hash calculation on each data block, and obtaining fingerprint information corresponding to the data block; calculating and obtaining a vector of fingerprint information to be queried and its corresponding candidate bucket; querying whether the vector exists in a structure database associated with the candidate bucket; if the vector does not exist in the structure database, inserting the vector into the corresponding candidate bucket; if the vector exists in the structure database, querying whether the fingerprint information corresponding to the vector exists in a disk database; if the fingerprint information exists in the disk database, deleting a copy of the vector of the fingerprint information; if the fingerprint information does not exist in the disk database, inserting the vector of the fingerprint information into the corresponding candidate bucket; wherein the structure database includes a slot array, a BitSet group, and a CountingSet group. The filter includes a storage bucket, and the storage bucket includes multiple candidate buckets, and the candidate bucket is used to store vectors, and the candidate bucket has a slot array, a BitSet group, and a CountingSet group associated with it, and the candidate bucket implements the above-mentioned deduplication method based on the slot array, the BitSet group, and the CountingSet group. The present application sets the first empty slot index as the empty slot indication position, so that when inserting a vector, it is possible to quickly determine whether the slot is empty, thereby improving the efficiency of vector insertion; the candidate bucket in the present application is associated with three data structures (slot array, BitSet group and CountingSet group). When the amount of processed data gradually increases, the vector can be queried in the BitSet group or the CountingSet group, which provides stable and high query efficiency without affecting the false positive rate, while significantly reducing memory overhead; and the present application judges the space utilization rate and expands the slot array in a timely manner, thereby effectively avoiding relocation operations and improving insertion performance.
[0104] The above are only embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structural transformations made using the contents of the present invention's specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A method for deleting duplicate data, characterized in that: Includes steps: Cut the file object to be processed into multiple data blocks, perform hash calculation on each of the data blocks, and obtain fingerprint information corresponding to the data block; Calculate and obtain the vector of the fingerprint information to be queried and its corresponding candidate bucket; querying whether the vector exists in a structure database associated with the candidate bucket; If the vector does not exist in the structure database, inserting the vector into the corresponding candidate bucket; If the vector exists in the structure database, query whether the fingerprint information corresponding to the vector exists in the disk database; If the fingerprint information exists in the disk database, the copy of the vector of the fingerprint information is deleted; if the fingerprint information does not exist in the disk database, the vector of the fingerprint information is inserted into the corresponding candidate bucket; The structure database includes a slot array, a BitSet group and a CountingSet group.
2. The method for deleting duplicate data according to claim 1, characterized in that: The querying whether the vector exists in the structure database associated with the candidate bucket comprises the steps of: According to the storage bucket and the number of the vectors stored therein, the space utilization rate of the storage bucket is calculated; wherein the storage bucket includes a plurality of the candidate buckets; If the space utilization is not greater than the first set threshold or the second set threshold, querying whether the vector exists in the slot array associated with the candidate bucket; If the space utilization is greater than the second set threshold and not greater than the third set threshold, constructing the BitSet group associated with the candidate bucket according to the slot array, and querying whether the vector exists in the corresponding BitSet group; If the space utilization is greater than the third set threshold, the CountingSet group associated with the candidate bucket is constructed according to the slot array and the BitSet group, and it is queried whether the vector exists in the corresponding CountingSet group.
3. The method for deleting duplicate data according to claim 2, characterized in that: The method of inserting the vector into the corresponding candidate bucket comprises the steps of: The number of the candidate buckets is two, and one of the candidate buckets is selected as the target insertion bucket; If neither the BitSet group nor the CountingSet group associated with the target insertion bucket is constructed, inserting the vector into the slot position indicated by the first empty slot index of the slot array associated with the target insertion bucket, and recalculating the first empty slot index; If the BitSet group associated with the target insertion bucket has been constructed and the value of the corresponding position of the BitSet group is 1, insert the vector into the slot position indicated by the first empty slot index, and recalculate the first empty slot index; if the value of the corresponding position of the BitSet group is 0, set the value of the corresponding position of the BitSet group to 1; If the CountingSet group associated with the target insertion bucket has been constructed, the value of the corresponding counter in the CountingSet group is increased by one.
4. The method for deleting duplicate data according to claim 3, characterized in that: The method of selecting one of the candidate buckets as a target insertion bucket comprises the steps of: If the two CountingSet groups respectively associated with the two candidate buckets have been constructed, comparing the values of the corresponding counters of the two CountingSet groups, and inserting the candidate bucket of the CountingSet group with the smaller value of the corresponding counter as the target bucket; If only one of the two candidate buckets has the CountingSet group corresponding to it constructed, the candidate bucket for which the CountingSet group has been constructed is used as the target insertion bucket; If the two CountingSet groups associated with the two candidate buckets are not constructed, and the two BitSet groups associated with the two candidate buckets are constructed, the candidate bucket of the BitSet group whose value at the corresponding position is 0 is used as the target insertion bucket; If the two CountingSet groups associated with the two candidate buckets are not constructed, and the BitSet group corresponding to only one candidate bucket has been constructed, the candidate bucket with the constructed BitSet group is used as the target insertion bucket; If the two CountingSet groups and the two BitSet groups associated with the two candidate buckets are not constructed, the numbers of empty slots of the two slot arrays associated with the two candidate buckets are compared, and the candidate bucket of the slot array with a larger number of empty slots is inserted as the target bucket.
5. The method for deleting duplicate data according to claim 4, characterized in that: The method of inserting the vector into the corresponding candidate bucket also includes the steps of: Under the premise that the two CountingSet groups and the two BitSet groups associated with the two candidate buckets are not constructed, and the numbers of empty slots in the two slot arrays associated with the two candidate buckets are both 0: If the space utilization rate is less than the first set threshold, a candidate bucket is randomly selected, a new slot array is created for the selected candidate bucket, the contents of the original slot array of the selected candidate bucket are copied to the corresponding positions of the newly created slot array, and the original slot array is deleted; wherein the number of slots in the newly created slot array is twice the number of slots in the original slot array.
6. The method for deleting duplicate data according to claim 4, characterized in that: The method of inserting the vector into the corresponding candidate bucket also includes the steps of: Under the premise that the two CountingSet groups and the two BitSet groups associated with the two candidate buckets are not constructed, and the numbers of empty slots in the two slot arrays associated with the two candidate buckets are both 0: If the space utilization is not less than the first set threshold and not greater than the second set threshold, a plurality of corresponding slot arrays are newly created for the storage bucket, and the number of slots in each newly created slot array is equal to the number of slots in the initial slot array.
7. The method for deleting duplicate data according to claim 2, characterized in that: The method for deleting the copy of the vector of the fingerprint information comprises the steps of: If neither the BitSet group nor the CountingSet group associated with the candidate bucket is constructed, moving the vector at the slot position indicated by the first non-empty slot index of the slot array associated with the candidate bucket to the slot position where the copy of the vector is located, deleting the copy of the vector, and recalculating the first non-empty slot index; If the BitSet group associated with the candidate bucket has been constructed, query whether there is a copy of the vector in the slot array associated with the candidate bucket; If it exists, delete the copy of the vector and set the value of the corresponding position of the BitSet group to 1; If it does not exist, the value of the corresponding position of the BitSet group is set to 0; If the CountingSet group associated with the candidate bucket has been constructed, the value of the corresponding counter in the CountingSet group is reduced by one.
8. The method for deleting duplicate data according to claim 2, characterized in that: The method for constructing the BitSet group associated with the candidate bucket comprises the steps of: Read the vector in the slot array associated with the candidate bucket, assign a position to the BitSet group, and determine whether the value of the corresponding position in the BitSet group is 1; If it is not 1, the value of the corresponding position in the BitSet group is set to 1, and the corresponding vector in the slot array is deleted, and the remaining vectors in the slot array are continued to be read; If it is 1, continue to read the remaining vectors in the slot array, and repeat the above steps until all vectors in the slot array are read.
9. The method for deleting duplicate data according to claim 2, characterized in that: The method of constructing the CountingSet group associated with the candidate bucket comprises the steps of: If the BitSet group associated with the candidate bucket is not constructed, read all vectors in the slot array associated with the candidate bucket, allocate counters to the CountingSet group, increase the value of each corresponding counter in the CountingSet group by one according to the vectors, and delete the slot array; If the BitSet group associated with the candidate bucket has been constructed, read the value of each position in the BitSet group, assign a counter to the CountingSet group, if the value of the corresponding position in the BitSet group is 1, increase the value of the corresponding counter in the CountingSet group by one, then delete the BitSet group, continue to read all vectors in the slot array associated with the candidate bucket, increase the value of each corresponding counter in the CountingSet group by one according to the vector, and delete the slot array.
10. A filter, characterized in that: It includes a storage bucket, which includes multiple candidate buckets. The candidate buckets are used to store vectors. The candidate buckets have slot arrays, BitSet groups and CountingSet groups associated with them. The candidate buckets implement the deduplication method according to any one of claims 1 to 9 based on the slot arrays, BitSet groups and CountingSet groups.
Citation Information
Patent Citations
A repeated data deleting method and device
CN106406762A
Techniques for efficient data deduplication
US20220012218A1
Cited By
Data deduplication method and device
RU2846558C1
