Method, device and computer-readable storage medium for garbage collection
By using markers in the tree representation or hash tree of the backup system to distinguish valid and invalid backups, the problem of existing garbage collection solutions occupying a large amount of storage space and high complexity is solved, efficient garbage collection is achieved, and system performance and performance are improved. Capacity support.
Patent Information
- Application Number
- CN201910989992.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-10-17
- Publication Date
- 2024-08-27
- Estimated Expiration
- 2039-10-17
AI Technical Summary
Existing garbage collection solutions occupy a large amount of storage space in large-scale backup systems, resulting in limited system performance and high time complexity, which affects the maximum supported capacity of the system.
By using markers in the tree representation or hash tree of the backup system to distinguish valid and invalid backups, retaining nodes and references only for valid backups, and deleting invalid backups, the storage requirements and traversal complexity of the reference number array are reduced.
It significantly reduces storage space occupation and resource consumption, reduces the time complexity of garbage collection, improves system performance, and expands the maximum supported capacity.
Smart Images

Figure CN112685378B
Abstract
Description
Technical Field
[0001] Embodiments of the present disclosure relate generally to storage systems, and more particularly to methods, apparatus, and computer-readable storage media for garbage collection of backup systems. Background Art
[0002] The current garbage collection scheme maintains an array of reference numbers for data blocks to indicate how many backups reference the data block. Usually, at least 8 bits are used to record the actual number of references. For large backup systems, this will occupy a very large system storage space, seriously affecting system performance, thus limiting the maximum supported capacity.
[0003] During garbage collection, the current garbage collection scheme needs to traverse all backups, regardless of whether the backup is valid or is the target of garbage collection. Therefore, this garbage collection scheme has a high complexity. Once the reference count array is initialized, it will be necessary to periodically check each data in the array, delete the data blocks with zero references, and update other values if necessary. The time complexity is O(n n ). Summary of the invention
[0004] Embodiments of the present disclosure provide a method, an apparatus, a computer-readable storage medium, and a computer program product for managing a storage system.
[0005] In a first aspect, a method for garbage collection of a backup system is provided. The method comprises: determining whether a node in a tree representation of the backup system is associated with a valid backup or an invalid backup based on tags associated with at least some of the nodes in the tree representation; in response to determining that the node is associated with a valid backup, retaining the node and nodes referenced by the node; and in response to determining that the node is associated with an invalid backup, deleting the node.
[0006] In a second aspect, a method for garbage collection of a backup system is provided. The method includes: determining, based on metadata of the backup system, whether a first hash value in a hash tree representing the backup system is associated with a valid backup or an invalid backup; in response to determining that the first hash value is associated with a valid backup, retaining the first hash value and a hash value or data block referenced by the first hash value; in response to determining that the first hash value is associated with an invalid backup, determining whether the first hash value references a second hash value; in response to determining that the first hash value references the second hash value, traversing the second hash value and deleting the first hash value after traversing the second hash value; and in response to determining that the first hash value does not reference the second hash value, deleting the first hash value.
[0007] In a third aspect, a device for managing a storage system is provided. The device comprises: a processing unit; a memory coupled to the processing unit and comprising instructions stored thereon, wherein when the instructions are executed by the processing unit, the device performs actions, the actions comprising: determining whether a node in a tree representation of the backup system is associated with a valid backup or an invalid backup based on tags associated with at least some of the nodes in the tree representation; in response to determining that the node is associated with a valid backup, retaining the node and nodes referenced by the node; and in response to determining that the node is associated with an invalid backup, deleting the node.
[0008] In a fourth aspect, a device for managing a storage system is provided. The device includes: a processing unit; a memory coupled to the processing unit and including instructions stored thereon, wherein when the instructions are executed by the processing unit, the device performs an action, wherein the action includes: based on the metadata of the backup system, determining whether a first hash value in a hash tree representing the backup system is associated with a valid backup or an invalid backup; in response to determining that the first hash value is associated with a valid backup, retaining the first hash value and a hash value referenced by the first hash value; in response to determining that the first hash value is associated with an invalid backup, determining whether the first hash value references a second hash value; in response to determining that the first hash value references a second hash value, traversing the second hash value and deleting the first hash value after traversing the second hash value; and in response to determining that the first hash value does not reference the second hash value, deleting the first hash value.
[0009] In a fifth aspect, a computer-readable storage medium is provided, on which machine-executable instructions are stored. When the machine-executable instructions are executed by at least one processor, the at least one processor implements the method according to the first aspect.
[0010] In a sixth aspect, a computer-readable storage medium is provided, on which machine-executable instructions are stored. When the machine-executable instructions are executed by at least one processor, the at least one processor implements the method according to the second aspect.
[0011] In a seventh aspect, a computer program product is provided, the computer program product being stored on a computer readable medium and comprising machine executable instructions which, when executed, cause a machine to perform the method according to the first aspect.
[0012] In an eighth aspect, a computer program product is provided, the computer program product being stored on a computer readable medium and comprising machine executable instructions which, when executed, cause a machine to perform the method according to the second aspect.
[0013] This Summary is provided to introduce a selection of concepts in a simplified form that are further described below in the Detailed Description. This Summary is not intended to identify key features or essential features of the disclosure, nor is it intended to limit the scope of the disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] The above and other objects, features and advantages of the present disclosure will become more apparent through a more detailed description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, wherein like reference numerals generally represent like components in the exemplary embodiments of the present disclosure.
[0015] Figure 1 A schematic diagram of a backup system according to some embodiments of the present disclosure is shown;
[0016] Figure 2 A schematic diagram showing metadata of a backup system according to some embodiments of the present disclosure is shown;
[0017] Figure 3 A schematic diagram showing effective backup of a backup system according to some embodiments of the present disclosure is shown;
[0018] Figure 4 An interaction diagram of a backup system according to some embodiments of the present disclosure is shown;
[0019] Figure 5 A flowchart of a method for garbage collection according to some embodiments of the present disclosure is shown;
[0020] Figure 6 A flowchart showing a method for garbage collection according to some embodiments of the present disclosure; and
[0021] Figure 7 A schematic block diagram of an example device according to some embodiments of the present disclosure that can be used to implement embodiments of the present disclosure is shown. DETAILED DESCRIPTION
[0022] The preferred embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although the preferred embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided to make the present disclosure more thorough and complete, and to fully convey the scope of the present disclosure to those skilled in the art.
[0023] As used herein, the term "including" and its variations mean open inclusion, i.e., "including but not limited to". Unless otherwise stated, the term "or" means "and / or". The term "based on" means "based at least in part on". The terms "an example embodiment" and "an embodiment" mean "at least one example embodiment". The term "another embodiment" means "at least one additional embodiment". The terms "first", "second", etc. may refer to different or the same objects. Other explicit and implicit definitions may also be included below.
[0024] In a backup system that supports deduplication, a data block is saved only once, but can be referenced many times. Therefore, the system storage space can be saved. For example, the backup data can be divided into multiple data blocks, and then a hash algorithm is performed on each data block to obtain a unique hash value. Using these data blocks and hash values, a hash tree or Merkle tree can be used to represent the backup.
[0025] Figure 1 Schematic diagram of a backup system 100 according to some embodiments of the present disclosure is shown. The backup system 100 is a backup presented in the form of a hash tree and supports deduplication through indexing. Figure 1 As shown, backup system 100 includes two backups, represented by root hash #1 and root hash #2. It should be understood that backup system 100 is provided only as an example, the number of backups may be much greater than two, and the structure of the hash tree may be more complex.
[0026] like Figure 1 As shown, root hash #1 references hash #3, hash #4, and hash #5, where hash #3 references data block #1, hash #4 references data block #2, and hash #5 references data block #3. Root hash #2 references hash #5, hash #4, and hash #6, where hash #5 references data block #3, hash #4 references data block #2, and hash #6 references data block #4. For example, hash #3 can be the hash value of data block #1 or a portion thereof, and root hash #1 is the hash value of the data block that concatenates hash #3 to hash #5. Other hashes are also established in a similar manner.
[0027] In the existing garbage collection scheme, at the beginning of garbage collection, an array can be generated in the memory to record the number of references of each node. Then, all backups are traversed to determine the number of references of each node, and the value in the corresponding reference array is updated. For example, more than 8 bits are usually used to represent the number of references to meet the needs of the backup system.
[0028] For example, for Figure 1 The raw reference count values in the backup system, index file or array shown can be:
[0029] reference_count_array[hash#1]=1;
[0030] reference_count_array[hash#2]=1;
[0031] reference_count_array[hash#3]=1;
[0032] reference_count_array[hash#4]=2;
[0033] reference_count_array[hash#5]=2;
[0034] reference_count_array[hash#6]=1.
[0035] Assuming backup #1 is out of date, the reference array will change to:
[0036] reference_count_array[hash#1]=0;
[0037] reference_count_array[hash#2]=1;
[0038] reference_count_array[hash#3]=1;
[0039] reference_count_array[hash#4]=2;
[0040] reference_count_array[hash#5]=2;
[0041] reference_count_array[hash#6]=1.
[0042] During the first round of garbage collection, the data block represented by root hash #1 will be deleted because the reference count of root hash #1 is zero. Hash #3, hash #4, and hash #5 are referenced by root hash #1, so after deleting the data block represented by root hash #1, the reference counts of hash #3, hash #4, and hash #5 are reduced by one. Therefore, the reference count array is updated as follows:
[0043] reference_count_array[hash#2]=1;
[0044] reference_count_array[hash#3]=0;
[0045] reference_count_array[hash#4]=1;
[0046] reference_count_array[hash#5]=1;
[0047] reference_count_array[hash#6]=1.
[0048] During the second round of garbage collection, data block #3 represented by hash #3 will be deleted because the reference count of hash #3 is zero. Then, garbage collection stops because there are no more data blocks with zero reference counts.
[0049] The final reference count array is as follows:
[0050] reference_count_array[hash#2]=1;
[0051] reference_count_array[hash#4]=1;
[0052] reference_count_array[hash#5]=1;
[0053] reference_count_array[hash#6]=1.
[0054] In real backup systems, the amount of data is very large. The reference array will take up a lot of storage space and use a lot of system resources to create the reference count array, regardless of whether the reference is valid data or invalid data. Since the array is used to record the reference count, there are a lot of unused slots in the middle. In addition, it is also very complicated to constantly access the array to remove the data blocks with zero references and update the reference counts of other related data blocks. The time complexity of the existing garbage collection scheme is O(n n ). Therefore, this will seriously affect the system performance.
[0055] For example, if the length of the reference number is 8 bits, and the entire storage space of the system is 16TB, and the average size of each data block is 24KB, there will be about 1 billion hash values. Therefore, the storage space required for valid records in the reference number array will be at least 1GB. As the data increases, the garbage collection scheme becomes more of a bottleneck for the system. Since the resources consumed by garbage collection may cause the entire system to hang up, it limits the maximum capacity that the system can support.
[0056] To this end, the embodiments of the present disclosure provide an improved garbage collection solution. Figure 2-Figure 4 An improved garbage collection scheme according to some embodiments of the present disclosure is introduced.
[0057] Figure 2 FIG. 2 shows a schematic diagram of metadata 202 of a backup system according to some embodiments of the present disclosure. Figure 2 As shown, the database of metadata 202 may be traversed to divide metadata 202 into a set 204 and a set 206, wherein set 204 contains all valid backups and set 206 contains all invalid backups.
[0058] Figure 3 FIG. 2 shows a schematic diagram of an effective backup of a backup system according to some embodiments of the present disclosure. Figure 3 As shown, a tag, reference map or record is generated only for the data blocks referenced by the valid backups in the set 204. For example, a single-bit tag can be used to indicate that the data block is referenced. For example, for each backup in the set 204, each node in the hash tree of the backup can be traversed, and the tag of the node can be assigned a value of 1 using the hash value as an index. Since the hash value is relatively complex, the index can also be calculated based on the hash value, and the tag corresponding to the index can be assigned a value of 1.
[0059] like Figure 3 As shown, valid backup #1 is represented by root hash #1, where root hash #1 references hash #2 and hash #3, which reference data block #1 and data block #2, respectively. For this example, its tag can be determined by root hash #1 and assigned a value of 1. Similarly, the corresponding tags can be determined by hash #2 and hash #3 and assigned a value of 1.
[0060] Since the flag only needs to be assigned a value of 1, the flag can be a single-bit flag, and thus a large amount of storage space can be saved. Alternatively, the flag can also be assigned a value of 0. As an example, a flag can be generated only for the invalid backup in set 206 in a similar manner. As another example, a flag can also be generated for the backups in sets 204 and 206, wherein the flag of the valid backup is 1 and the flag of the invalid backup is 0. For convenience, the following description is made in conjunction with the generation of flags for the backups in set 204, and it can be understood that the following scheme can be easily applied to other implementations.
[0061] In addition to generating records for valid backups in set 204, invalid backups in set 206 may also be processed. For example, this processing may be performed in parallel with the process of generating the mark in combination 204. For example, the hash tree is traversed from the top of the hash tree of the invalid backup, and for each node, it may be determined whether there is a corresponding mark for the node. If so, it indicates that the node is still referenced by other valid backups, and the node (or the data block where the node is located) cannot be deleted. In addition, if a node is referenced by other nodes, then its underlying nodes are still referenced. Therefore, there is no need to further traverse the nodes of the hash tree downward, so that a large number of unnecessary mark checks can be skipped.
[0062] Figure 4 FIG. 4 is a schematic diagram of a hash tree 400 according to some embodiments of the present disclosure. Figure 4 As shown, the backup represented by root hash #2 is invalid due to expiration. However, hash #5 is still referenced by the valid backup represented by root hash #1, so hash #8 and hash #9 and the data blocks referenced below can be skipped. In this way, many unnecessary reference mapping checks can be skipped.
[0063] If there is no corresponding mark, then the node can be safely deleted. For example, the data block represented by root hash #2 can be deleted, and the content of which is the concatenation of hash #5, hash #6 and hash #7. The above operation can be repeated until the backups in set 206 are processed to complete the garbage collection operation.
[0064] According to the above embodiment, garbage collection can be triggered by an invalid backup, for example, garbage collection can start from the data block belonging to the invalid backup. This is an on-demand garbage collection scheme without the need to regularly check and update the reference array.
[0065] Compared with the existing garbage disposal scheme, the space occupied by the reference map is significantly reduced because the method only creates records or marks for data blocks referenced by the backups that are still valid, and the size of the reference number is also reduced from at least 8 bits to 1 bit. In the worst case, all data blocks are still valid, and the space occupied by the reference map is still 1 / 8 of the existing scheme. In addition, due to the logical complexity of the garbage collection process, it is not necessary to traverse the reference map to remove zero-referenced data blocks and reduce the reference data of other data blocks referenced by the deleted data blocks in rounds. Multiple threads can be started at the same time to check the references of multiple backup data blocks, so the time complexity is O(n).
[0066] Due to the low resource consumption of this scheme, a system that adopts this scheme for garbage collection can expand its maximum supported capacity without considering the suspension of garbage collection.
[0067] Figure 5 A flowchart of a garbage collection method 500 according to some embodiments of the present disclosure is shown. One or more steps in the method 500 may be combined with Figure 1-Figure 4 One or more features of the examples shown may be combined.
[0068] At 502, based on the tags associated with at least some of the nodes in the tree representation of the backup system, it is determined whether a node in the tree representation is associated with a valid backup or an invalid backup. For example, the tree representation can be a hash tree representing the backup system, and the nodes in the tree representation can be nodes in the hash tree. It should be understood that although the hash tree is used as an example here, the examples of the present disclosure can also be applied to any other suitable tree representation outside the hash tree. For example, the tag can be a single-bit tag, thereby saving storage space.
[0069] In some embodiments, based on the metadata of the backup system, a valid backup in the backup system can be determined, and a mark indicating that the node associated with the valid backup is valid is generated. In this case, if a mark corresponding to a node can be found, then the node belongs to the valid backup. If a mark corresponding to a node cannot be found, then the node belongs to the invalid backup.
[0070] Alternatively, invalid backups in the backup system may be determined based on metadata of the backup system, and a mark indicating that the node associated with the invalid backup is invalid may be generated. In this case, if a mark corresponding to a node can be found, then the node belongs to the invalid backup. If a mark corresponding to a node cannot be found, then the node belongs to the valid backup.
[0071] Alternatively, different marks may be generated for both the valid backup and the invalid backup, for example, the valid backup is 1 and the invalid backup is 0. In this case, if the value of the mark corresponding to a node is 1, the node belongs to the valid backup. If the value of the mark corresponding to a node is 0, the node belongs to the invalid backup.
[0072] If it is determined at 502 that the node is a valid backup, the method 500 proceeds to 504 to retain the node and the node referenced by the node. In this way, it is not necessary to further determine any nodes below the node to improve efficiency.
[0073] If it is determined at 502 that the node is an invalid backup, the method 500 proceeds to 506 to delete the node. If the node is not a leaf node, the child nodes of the node can be further traversed downward, and the node can be deleted after traversing all child nodes. If the node is a leaf node, the data block represented by the node is directly deleted.
[0074] Figure 6FIG. 6 is a flowchart of a garbage collection method 600 according to some embodiments of the present disclosure. One or more steps in the method 600 may be combined with Figure 1-Figure 4 One or more features of the illustrated examples are combined and may be combined with one or more steps in method 500 .
[0075] At 602 , based on metadata of a backup system, it is determined whether a first hash value in a hash tree representing the backup system is associated with a valid backup or an invalid backup.
[0076] In some embodiments, valid backups and invalid backups in the backup system can be determined based on metadata of the backup system, and a mark indicating that the hash value in the hash tree is associated with a valid backup, and / or a mark indicating that the hash value in the hash tree is associated with an invalid backup is generated. Then, based on the mark of the first hash value, it is determined whether the first hash value is associated with a valid backup or an invalid backup. The mark can be a single-bit mark to save storage space.
[0077] If it is determined at 602 that the first hash value is valid, the method 600 proceeds to 604 to retain the first hash value and the hash value referenced by the first hash value. In this way, there is no need to further traverse the hash tree downward, thereby improving computational efficiency.
[0078] If it is determined at 602 that the first hash value is invalid, the method proceeds to 606 to determine whether the first hash value references a second hash value.
[0079] If it is determined at 606 that the first hash value references the second hash value, then method 600 proceeds to 608 to traverse the second hash value and delete the first hash value after traversing the second hash value.
[0080] If it is determined at 606 that the first hash value does not reference the second hash value, then method 600 proceeds to 610 to delete the first hash value.
[0081] In method 600 , since it is not necessary to determine whether each node is a valid backup, the backup system can perform efficient garbage collection.
[0082] Figure 7 Schematic block diagram of a device 700 that can be used to implement an embodiment of the present disclosure is shown. Figure 7As shown, the device 700 includes a central processing unit (CPU) 701, which can perform various appropriate actions and processes according to computer program instructions stored in a read-only memory (ROM) 702 or computer program instructions loaded from a storage unit 708 into a random access memory (RAM) 703. In the RAM 703, various programs and data required for the operation of the device 700 can also be stored. The CPU 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.
[0083] A number of components in the device 700 are connected to the I / O interface 705, including: an input unit 706, such as a keyboard, a mouse, etc.; an output unit 707, such as various types of displays, speakers, etc.; a storage unit 708, such as a disk, an optical disk, etc.; and a communication unit 709, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 709 allows the device 700 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0084] The various processes and processing described above, such as methods 500-600, may be performed by the processing unit 701. For example, in some embodiments, the methods 500-600 may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as the storage unit 708. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 700 via the ROM 702 and / or the communication unit 709. When the computer program is loaded into the RAM 703 and executed by the CPU 701, one or more steps of the methods 500-600 described above may be performed.
[0085] The present disclosure may be a method, an apparatus, a system and / or a computer program product. The computer program product may include a computer-readable storage medium carrying computer-readable program instructions for executing various aspects of the present disclosure.
[0086] A computer-readable storage medium may be a tangible device that can hold and store instructions used by an instruction execution device. A computer-readable storage medium may be, for example, but not limited to, an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the foregoing. More specific examples of computer-readable storage media (a non-exhaustive list) include: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a static random access memory (SRAM), a portable compact disk read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, a mechanical encoding device, such as a punch card or a raised structure in a groove on which instructions are stored, and any suitable combination of the foregoing. As used herein, a computer-readable storage medium is not to be interpreted as a transient signal per se, such as a radio wave or other freely propagating electromagnetic wave, an electromagnetic wave propagating through a waveguide or other transmission medium (e.g., a light pulse through a fiber optic cable), or an electrical signal transmitted through a wire.
[0087] The computer-readable program instructions described herein can be downloaded from a computer-readable storage medium to each computing / processing device, or downloaded to an external computer or external storage device via a network, such as the Internet, a local area network, a wide area network, and / or a wireless network. The network can include copper transmission cables, optical fiber transmissions, wireless transmissions, routers, firewalls, switches, gateway computers, and / or edge servers. The network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards the computer-readable program instructions for storage in the computer-readable storage medium in each computing / processing device.
[0088] The computer program instructions for performing the operation of the present disclosure may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-related instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages, such as Smalltalk, C++, etc., and conventional procedural programming languages, such as "C" language or similar programming languages. Computer-readable program instructions may be executed completely on a user's computer, partially on a user's computer, as an independent software package, partially on a user's computer, partially on a remote computer, or completely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., using an Internet service provider to connect via the Internet). In some embodiments, an electronic circuit, such as a programmable logic circuit, a field programmable gate array (FPGA), or a programmable logic array (PLA), may be customized by utilizing the state information of the computer-readable program instructions, and the electronic circuit may execute the computer-readable program instructions, thereby realizing various aspects of the present disclosure.
[0089] Various aspects of the present disclosure are described herein with reference to the flowcharts and / or block diagrams of the methods, devices (systems) and computer program products according to the embodiments of the present disclosure. It should be understood that each box in the flowchart and / or block diagram and the combination of each box in the flowchart and / or block diagram can be implemented by computer-readable program instructions.
[0090] These computer-readable program instructions can be provided to a processing unit of a general-purpose computer, a special-purpose computer, or other programmable data processing device, thereby producing a machine, so that when these instructions are executed by the processing unit of the computer or other programmable data processing device, a device that implements the functions / actions specified in one or more boxes in the flowchart and / or block diagram is generated. These computer-readable program instructions can also be stored in a computer-readable storage medium, and these instructions cause the computer, programmable data processing device, and / or other equipment to work in a specific manner, so that the computer-readable medium storing the instructions includes a manufactured product, which includes instructions for implementing various aspects of the functions / actions specified in one or more boxes in the flowchart and / or block diagram.
[0091] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device so that a series of operating steps are performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to implement the functions / actions specified in one or more boxes in the flowchart and / or block diagram.
[0092] The flow chart and block diagram in the accompanying drawings show the possible architecture, function and operation of the system, method and computer program product according to multiple embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a part of a module, program segment or instruction, and a part of the module, program segment or instruction includes one or more executable instructions for realizing the specified logical function. In some alternative implementations, the function marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two continuous square boxes can actually be executed substantially in parallel, and they can sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs the specified function or action, or can be implemented with a combination of special hardware and computer instructions.
[0093] The embodiments of the present disclosure have been described above, and the above description is exemplary, not exhaustive, and is not limited to the disclosed embodiments. Many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The selection of terms used herein is intended to best explain the principles of the embodiments, practical applications, or technical improvements to the technology in the market, or to enable other persons of ordinary skill in the art to understand the embodiments disclosed herein.
Claims
1. A method for garbage collection of a backup system, comprising: determining, based on tags associated with at least some of the nodes in the tree representation of the backup system, whether a node in the tree representation is associated with a valid backup or an invalid backup; In response to determining that the node is associated with a valid backup, retaining the node and one or more nodes referenced by the node; as well as In response to determining that the node is associated with an invalid backup, deleting the node, Wherein deleting the node comprises: in response to determining that the node includes one or more child nodes, traversing the one or more child nodes, and deleting the node after traversing the one or more child nodes, wherein traversing the one or more child nodes comprises: In response to determining that a child node of the one or more child nodes is associated with a valid backup, the child node and one or more nodes referenced by the child node are retained.
2. The method according to claim 1, further comprising: Determining a valid backup in the backup system based on the metadata of the backup system; as well as A flag is generated indicating that a node in the tree representation associated with a valid backup is valid.
3. The method according to claim 1, further comprising: Based on the metadata of the backup system, determining an invalid backup in the backup system; as well as A flag is generated indicating that a node in the tree representation associated with the invalid backup is invalid.
4. The method according to any one of claims 1-3, wherein the mark is a single-bit mark.
5. The method of claim 1, wherein the tree representation of the backup system comprises a hash tree representing the backup system, and the nodes in the tree representation comprise nodes in the hash tree.
6. A method for garbage collection of a backup system, comprising: Based on the metadata of the backup system, determining whether a first hash value in a hash tree representing the backup system is associated with a valid backup or an invalid backup; In response to determining that the first hash value is associated with a valid backup, retaining the first hash value and one or more hash values referenced by the first hash value; In response to determining that the first hash value is associated with an invalid backup, determining whether the first hash value references one or more second hash values; In response to determining that the first hash value references the one or more second hash values, traversing the one or more second hash values, and deleting the first hash value after traversing the one or more second hash values, wherein traversing the one or more second hash values comprises: In response to determining that a second hash value of the one or more second hash values is associated with a valid backup, retaining the second hash value and one or more hash values referenced by the second hash value; as well as In response to determining that the first hash value does not reference any second hash value, the first hash value is deleted.
7. The method of claim 6, wherein determining whether the first hash value is associated with a valid backup or an invalid backup comprises: Determining valid backups and invalid backups in the backup system based on the metadata of the backup system; Generate at least one of the following: a flag indicating that a hash value in the hash tree is associated with a valid backup; or a flag indicating that a hash value in the hash tree is associated with an invalid backup; as well as A determination is made based on the flag of the first hash value whether the first hash value is associated with a valid backup or an invalid backup. The method of claim 7 , wherein the mark is a single-bit mark.
9. A device for garbage collection of a backup system, comprising: Processing unit; a memory coupled to the processing unit and comprising instructions stored thereon, the instructions, when executed by the processing unit, causing the device to perform actions, the actions comprising: determining, based on tags associated with at least some of the nodes in the tree representation of the backup system, whether a node in the tree representation is associated with a valid backup or an invalid backup; In response to determining that the node is associated with a valid backup, retaining the node and one or more nodes referenced by the node; and In response to determining that the node is associated with an invalid backup, deleting the node, Wherein deleting the node comprises: in response to determining that the node includes one or more child nodes, traversing the one or more child nodes, and deleting the node after traversing the one or more child nodes, wherein traversing the one or more child nodes comprises: In response to determining that a child node of the one or more child nodes is associated with a valid backup, the child node and one or more nodes referenced by the child node are retained.
10. The apparatus of claim 9, wherein the actions further comprise: Determining a valid backup in the backup system based on the metadata of the backup system; as well as A flag is generated indicating that a node in the tree representation associated with a valid backup is valid.
11. The apparatus of claim 9, wherein the actions further comprise: Based on the metadata of the backup system, determining an invalid backup in the backup system; as well as A flag is generated indicating that a node in the tree representation associated with the invalid backup is invalid.
12. The apparatus according to any one of claims 9 to 11, wherein the mark is a single-bit mark.
13. The apparatus of claim 9, wherein the tree representation of the backup system comprises a hash tree representing the backup system, and the nodes in the tree representation comprise nodes in the hash tree.
14. A computer-readable storage medium having machine-executable instructions stored thereon, which, when executed by at least one processor, enables the at least one processor to implement the method according to any one of claims 1 to 8.
