Data processing method and device, computer equipment, readable storage medium and program product
By using data interval comparison and binary search tree insertion technology during incremental backup, the problem of low data recovery efficiency in existing incremental backup technology is solved and efficient data recovery is achieved.
Patent Information
- Application Number
- CN202411437873.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-15
- Publication Date
- 2025-01-21
- Estimated Expiration
- 2044-10-15
AI Technical Summary
The existing incremental backup technology reduces the recovery efficiency due to multiple incremental backups when data is restored.
By obtaining the backup storage location and data size corresponding to the incremental data, determine the incremental data interval, traverse each data interval in the preset binary search tree, remove the overlapping parts, determine the insertion position of the incremental data interval, and insert it into the binary search tree. Fork the search tree for efficient incremental backup.
It improves data recovery efficiency and avoids resource waste and reduced recovery efficiency caused by multiple incremental backups in traditional methods.
Smart Images

Figure CN119336546A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a data processing method, apparatus, computer equipment, computer-readable storage medium, and computer program product. Background Art
[0002] In the field of data backup, there is a technology called incremental backup, which only backs up the modified parts after the last data backup. After multiple incremental backups, there are multiple incremental backup nodes. When restoring data, it is necessary to start from a certain full backup node and restore the data of the backup points in the order of backup. However, when restoring data based on the current incremental backup method, due to the existence of multiple incremental backups, the recovery efficiency will be reduced due to multiple restorations in the backup order.
[0003] Therefore, the current data backup processing method has the defect of reducing the data recovery efficiency. Summary of the invention
[0004] Based on this, it is necessary to provide a data processing method, apparatus, computer equipment, computer-readable storage medium and computer program product that can improve data recovery efficiency in response to the above technical problems.
[0005] In a first aspect, the present application provides a data processing method, the method comprising:
[0006] Acquire a backup storage location and data size corresponding to the incremental data, and determine an incremental data interval corresponding to the incremental data according to the backup storage location and data size;
[0007] Traversing each data interval in a preset binary search tree, determining each target data interval in each data interval that overlaps with the incremental data interval; the preset binary search tree includes each data interval corresponding to the full backup data, and each data interval does not overlap;
[0008] Removing the portion of each target data interval that overlaps with the incremental data interval, and determining the insertion position of the incremental data interval in the preset binary search tree according to each target data interval after removal;
[0009] The incremental data interval is inserted into the preset binary search tree according to the insertion position to back up the incremental data.
[0010] In one of the embodiments, determining the incremental data interval corresponding to the incremental data according to the backup storage location and the data size includes:
[0011] Determining a backup data path corresponding to the incremental data according to the backup storage location;
[0012] Determining, according to the data size, an offset of the incremental data in the backup data path;
[0013] Determine the left endpoint and the right endpoint of the incremental data interval according to the backup data path and the offset;
[0014] The incremental data interval corresponding to the incremental data is determined according to the left endpoint, the right endpoint, the backup data path and the offset of the incremental data interval.
[0015] In one embodiment, traversing each data interval in a preset binary search tree to determine each target data interval in each data interval that overlaps with the incremental data interval includes:
[0016] Traversing each data interval in a preset binary search tree, determining a first data interval in the preset binary search tree whose left endpoint is less than or equal to the left endpoint of the incremental data interval;
[0017] For the first data interval and each data interval after the first data interval in the preset binary search tree, compare each endpoint of the data interval with the incremental data interval;
[0018] If the left endpoint of the incremental data interval is less than or equal to the right endpoint of the data interval, and the right endpoint of the data interval is greater than or equal to the left endpoint of the data interval, then the data interval is determined to be a target data interval overlapping with the incremental data interval.
[0019] In one embodiment, removing the portion of each target data interval that overlaps with the incremental data interval includes:
[0020] If the left endpoint of the target data interval is less than or equal to the left endpoint of the incremental data interval, and the right endpoint is greater than the right endpoint of the incremental data interval, then obtaining the overlapping first sub-target data interval corresponding to the left endpoint and the right endpoint of the incremental data interval in the target data interval;
[0021] The overlapping first sub-target data intervals are removed in the preset binary search tree.
[0022] In one of the embodiments, each of the target data intervals includes a first target data interval and a second target data interval;
[0023] The removing of the portion of each target data interval that overlaps with the incremental data interval also includes:
[0024] If the left endpoint of the first target data interval is less than or equal to the left endpoint of the incremental data interval, the right endpoint of the first target data interval is greater than the left endpoint of the incremental data interval, and the right endpoint of the first target data interval is less than the right endpoint of the incremental data interval, then determine the overlapping second sub-target data interval according to the left endpoint of the incremental data interval and the right endpoint of the first target data interval;
[0025] If the left endpoint of the second target data interval is greater than the left endpoint of the incremental data interval, the left endpoint of the second target data interval is less than the right endpoint of the incremental data interval, and the right endpoint of the second target data interval is greater than the right endpoint of the incremental data interval, then determine the overlapping third sub-target data interval according to the left endpoint of the second target data interval and the right endpoint of the incremental data interval;
[0026] In the preset binary search tree, the overlapping data intervals of the second sub-target and the third sub-target are removed.
[0027] In one embodiment, after inserting the incremental data interval into the preset binary search tree according to the insertion position to back up the incremental data, the method further includes:
[0028] When a data recovery request is received, for each data interval in the preset binary search tree, corresponding backup data is obtained according to the backup storage location corresponding to the data interval;
[0029] Data recovery is performed according to the backup data.
[0030] In a second aspect, the present application provides a data processing device, the device comprising:
[0031] An acquisition module, used to acquire a backup storage location and a data size corresponding to the incremental data, and determine an incremental data interval corresponding to the incremental data according to the backup storage location and the data size;
[0032] A determination module is used to traverse each data interval in a preset binary search tree to determine each target data interval in each data interval that overlaps with the incremental data interval; the preset binary search tree includes each data interval corresponding to the full backup data, and each data interval does not overlap;
[0033] A removal module, used to remove the portion of each target data interval that overlaps with the incremental data interval, and determine the insertion position of the incremental data interval in the preset binary search tree according to each target data interval after removal;
[0034] A processing module is used to insert the incremental data interval into the preset binary search tree according to the insertion position to back up the incremental data.
[0035] In a third aspect, the present application provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above method when executing the computer program.
[0036] In a fourth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program implements the steps of the above method when executed by a processor.
[0037] In a fifth aspect, the present application provides a computer program product, including a computer program, which implements the steps of the above method when executed by a processor.
[0038] The above-mentioned data processing method, device, computer equipment, computer-readable storage medium and computer program product, by traversing the incremental data interval corresponding to the incremental data through a preset binary search tree, determine each target data interval that overlaps with the incremental data interval, remove the part of the target data interval that overlaps with the incremental data interval, determine the insertion position of the incremental data interval in the preset binary search tree according to the removed target data interval, insert the incremental data interval according to the insertion position, so as to back up the incremental data. Compared with the traditional method of storing each incremental data, so that the incremental data needs to be restored one by one in the order of each backup during recovery, this scheme uses data interval comparison during incremental backup to deduplicate the backup data, so that when restoring, the data corresponding to each data interval is directly restored as necessary data, thereby improving data recovery efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the related technologies, the drawings required for use in the embodiments of the present application or the related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0040] FIG1 is a schematic flow chart of a data processing method in one embodiment;
[0041] FIG2 is a schematic flow chart of a data processing method in another embodiment;
[0042] FIG3 is a block diagram of a data processing device in one embodiment;
[0043] FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0044] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0045] In one embodiment, as shown in FIG1 , a data processing method is provided. This embodiment is described by taking the method applied to a terminal as an example. It is understandable that the method can also be applied to a server, and can also be applied to a system including a terminal and a server, and is implemented through the interaction between the terminal and the server, including the following steps S202 to S208. Among them:
[0046] Step S202, obtaining a backup storage location and data size corresponding to the incremental data, and determining an incremental data interval corresponding to the incremental data according to the backup storage location and data size.
[0047] Among them, incremental backup only needs to back up the modified parts after the last data backup. In order to obtain the data modification status, CBT (Change Block Tracking) technology can be used. CBT technology is a technology that can record data modification status and can track data modification status after a certain point in time. Full backup refers to a complete copy of all data at a certain point in time. The current incremental backup method needs to restore the incremental backup data one by one in the backup order during recovery. During this period, the data restored at a certain time may be overwritten by the data restored later, which means that a large amount of useless data is restored during the recovery process, resulting in a waste of resources and reducing the efficiency of recovery. Therefore, the terminal can perform incremental backup by setting data intervals, so that each data interval corresponding to the full backup data will not have duplicate backup data, but all are necessary data.
[0048] When the terminal receives an incremental backup request, it can obtain the incremental data of this backup relative to the previous backup. Different data has a corresponding backup storage location in the terminal, such as the backup storage address. Then the terminal can obtain the backup storage location and data size corresponding to the above incremental data, and determine the incremental data interval corresponding to the incremental data based on the above backup storage location and data size. Among them, the incremental data interval can include identifiers corresponding to each data in the incremental data, such as satellite data of each data in the incremental data, including storage address, data size and data offset at the storage address, etc. The terminal can form an incremental data interval corresponding to the incremental data based on the above data. That is, the incremental data interval does not store real incremental data, but stores satellite data pointing to the backup storage location of the incremental data and its offset.
[0049] Step S204, traverse each data interval in the preset binary search tree to determine each target data interval in each data interval that overlaps with the incremental data interval; the preset binary search tree includes each data interval corresponding to the full backup data, and each data interval does not overlap.
[0050] Among them, the terminal can pre-build a preset binary search tree. The binary search tree can be an empty tree, and it is also a binary tree with the following properties: if its left subtree is not empty, then the values of all nodes on the left subtree are less than the value of its root node; if its right subtree is not empty, then the values of all nodes on the right subtree are greater than the value of its root node; its left and right subtrees are also binary sorted trees. As a classic data structure, the binary search tree has the characteristics of fast insertion and deletion operations of a linked list and the advantages of fast search of an array; therefore, it is widely used. For example, file systems and database systems generally use this data structure for efficient sorting and retrieval operations.
[0051] The preset binary search tree can store various data intervals corresponding to the full backup data, that is, the preset binary search tree can be generated based on the full backup data of the last full backup. Since the terminal needs to compare and deduplicate the incremental backup data intervals with the various data intervals in the preset binary search tree when performing incremental backup, the various data intervals in the preset binary search tree do not overlap and are all data intervals corresponding to the necessary data.
[0052] When performing incremental backup, the terminal can use the incremental data interval to traverse each data interval in the preset binary search tree to determine each target data interval in each data interval that overlaps with the incremental data interval. The terminal can judge whether there is overlap by comparing the incremental data interval with the endpoints of each of the above data intervals. Each of the above intervals can include a left endpoint and a right endpoint. The left endpoint can be the satellite data at the starting point of the backup storage location corresponding to the data, and the right endpoint can be the satellite data corresponding to the end position of the same data in the backup storage location. When there is an overlapping part between the two intervals, it means that there are duplicate data with the same address in the two intervals. The specific values of these duplicate data may be different, but the storage address and purpose are the same. For the incremental backup process, in order to improve the recovery efficiency, only the latest incremental data needs to be backed up. Therefore, the terminal can judge the overlapping part by comparing the incremental data interval with each endpoint between each data interval.
[0053] Step S206, removing the overlapping parts of each target data interval with the incremental data interval, and determining the insertion position of the incremental data interval in the preset binary search tree according to each target data interval after removal.
[0054] Among them, after the terminal determines each target data interval in the preset binary search tree that has overlapping parts with the incremental data interval through interval comparison, it can remove the overlapping parts of each target data interval. Among them, the terminal can segment the overlapping interval part by re-determining the left and right endpoints of each target data interval with overlapping parts, and remove the segmented overlapping interval part, so as to remove the above-mentioned overlapping part. After the terminal removes the overlapping parts of each target data interval in the preset binary search tree, each target data interval may have a remaining non-overlapping interval part, and the removed overlapping part is currently in a blank state, then the terminal can determine the insertion position of the incremental data interval in the preset binary search tree according to each target data interval after removal. Among them, the above-mentioned insertion position can be the blank space left after removing the overlapping interval part.
[0055] Step S208, inserting the incremental data interval into a preset binary search tree according to the insertion position to back up the incremental data.
[0056] Among them, the insertion position can be the insertion position of the incremental data interval in the preset binary search tree. The terminal can insert the incremental data interval into the preset binary search tree according to the above insertion position, thereby realizing the backup of the incremental data. The incremental data interval can be arranged in the preset binary search tree according to the storage order of the data, and each node in the preset binary search tree can store a single data interval. After the incremental data interval is inserted into the preset binary search tree, it means that the incremental data is backed up, and the backup storage location and offset and other information are formed into an incremental data interval and stored in the preset binary search tree. During recovery, the terminal can restore data for each data interval in the preset binary search tree by restoring the data intervals one by one.
[0057] In one embodiment, after the incremental data interval is inserted into a preset binary search tree according to the insertion position to back up the incremental data, it also includes: when a data recovery request is received, for each data interval in the preset binary search tree, according to the backup storage position corresponding to the data interval, obtaining the corresponding backup data; and performing data recovery based on the backup data.
[0058] In this embodiment, the terminal may receive a data recovery request after the backup. When the terminal receives the data recovery request, the data corresponding to each node in the preset binary search tree may be recovered. The preset second search tree includes multiple data intervals. For each data interval, the terminal may obtain the corresponding data to be recovered from the backup storage location corresponding to the data interval, for example, from the backup storage location to obtain the corresponding backup data, so that the terminal can perform data recovery based on the backup data. The terminal may perform data recovery on each data interval in the preset binary search tree to obtain the full amount of data after recovery.
[0059] Specifically, the above-mentioned preset binary search tree can be represented as T, where T mainly stores interval information, and each data interval can store additional satellite data, such as the path of the backup point, the offset of the interval data in the backup point, etc. There is no overlapping part in the intervals in T. Then the satellite data of each data interval in T stores the address of the backup data corresponding to the interval. For a full backup, the terminal can create a new T, and then insert the interval according to the following conditions: if the platform supports giving the range of valid data in the form of an interval, insert the interval of valid data; otherwise, insert the interval of the entire full backup data. During incremental backup, the terminal copies a copy of T from the last backup, and then inserts the incremental data interval of the current backup data into the copied T.
[0060] In the process of restoring data, the terminal can traverse all intervals within T, and restore the corresponding backup data according to the satellite data of each data interval, that is, the backup data address corresponding to the data interval. Among them, since there is no overlapping part in the interval within T, data overwriting will not occur during the recovery process, ensuring that only necessary data is restored, thereby improving the efficiency of data recovery.
[0061] In the above data processing method, the incremental data interval corresponding to the incremental data is traversed through a preset binary search tree to determine each target data interval that overlaps with the incremental data interval, and the part of the target data interval that overlaps with the incremental data interval is removed. According to the removed target data interval, the insertion position of the incremental data interval in the preset binary search tree is determined, and the incremental data interval is inserted according to the insertion position to back up the incremental data. Compared with the traditional method of storing each incremental data, so that the incremental data needs to be restored one by one in the order of each backup during recovery, this solution uses data interval comparison during incremental backup to deduplicate the backup data, so that when restoring, the data corresponding to each data interval is directly restored as necessary data, thereby improving data recovery efficiency.
[0062] In one embodiment, the incremental data interval corresponding to the incremental data is determined based on the backup storage location and the data size, including: determining the backup data path corresponding to the incremental data based on the backup storage location; determining the offset of the incremental data in the backup data path based on the data size; determining the left endpoint and the right endpoint of the incremental data interval based on the backup data path and the offset; determining the incremental data interval corresponding to the incremental data based on the left endpoint and the right endpoint of the incremental data interval.
[0063] In this embodiment, the terminal can generate an incremental data interval according to the storage address of the incremental data. For example, the above-mentioned backup storage location can be the location where the incremental data is stored during backup, and the terminal can determine the backup data path corresponding to the incremental data according to the above-mentioned backup storage location. The terminal can also determine the offset of the incremental data in the backup data path according to the above-mentioned data size. The above-mentioned backup data path and offset can be used as satellite data, and the terminal can determine the left endpoint and the right endpoint of the incremental data interval according to the above-mentioned backup data path and offset. Among them, the left endpoint can be determined based on the starting address of the backup data path, and the right endpoint can be determined based on the above-mentioned starting address and offset.
[0064] The terminal can determine the incremental data interval corresponding to the incremental data based on the left endpoint and the right endpoint of the incremental data interval, combined with the backup data path and offset corresponding to the incremental data. For example, the terminal uses the left endpoint and the right endpoint as the two endpoints of the incremental data interval, and stores the backup data path and offset in the incremental data interval.
[0065] Through this embodiment, the terminal can generate a corresponding incremental data interval using information such as the backup address and offset corresponding to the incremental data, so that the terminal can use the incremental data interval to perform overlap identification and incremental backup of the incremental data, thereby improving the efficiency of data recovery.
[0066] In one embodiment, traversing each data interval in a preset binary search tree to determine each target data interval in each data interval that overlaps with the incremental data interval includes: traversing each data interval in the preset binary search tree to determine the first data interval in the preset binary search tree whose left endpoint is less than or equal to the left endpoint of the incremental data interval; for the first data interval and each data interval after the first data interval in the preset binary search tree, comparing each endpoint of the data interval with the incremental data interval; if the left endpoint of the incremental data interval is less than or equal to the right endpoint of the data interval, and the right endpoint of the data interval is greater than or equal to the left endpoint of the data interval, then determining that the data interval is a target data interval that overlaps with the incremental data interval.
[0067] In this embodiment, the terminal can judge the overlapping part by comparing each endpoint of the data interval. Among them, the preset binary search tree includes multiple data intervals, and the terminal can traverse each data interval in the preset binary search tree, and obtain the first data interval whose left endpoint is less than or equal to the left endpoint of the incremental data interval. Among them, the above-mentioned first data interval means that the left endpoint of the interval is less than or equal to the left endpoint of the above-mentioned incremental data interval, and the interval is the first data interval in the data intervals whose left endpoints in the preset binary search tree are less than or equal to the left endpoint of the incremental data interval. Among them, the earlier the endpoint, the earlier the storage address of the corresponding data.
[0068] For the first data interval and each data interval after the first data interval in the preset binary search tree, the terminal may compare the data interval with each endpoint of the incremental data interval, including comparison of the left endpoint and comparison of the right endpoint.
[0069] If the terminal detects that the left endpoint of the incremental data interval is less than or equal to the right endpoint of the data interval, and the right endpoint of the data interval is greater than or equal to the left endpoint of the data interval, the data interval is determined to be a target data interval overlapping with the incremental data interval. The overlapping form of the data interval and the incremental data interval may include but is not limited to an overlapping relationship in which the incremental data interval is completely contained by the data interval, an overlapping relationship in which the incremental data interval completely contains the data interval, and an overlapping relationship between the incremental data interval and a part of the data interval. For different overlapping relationships, the terminal may remove the overlapping portion in different ways.
[0070] Specifically, taking the above-mentioned preset binary search tree as T as an example, T has multiple implementation methods. In this embodiment, the terminal defines T as a binary search tree, in which each node stores a single interval information, and the nodes are sorted according to the left endpoint or the right endpoint of the interval. Since the intervals in T do not overlap, using the right endpoint as the key is equivalent to using the left endpoint as the key. This embodiment takes the left endpoint sorting as an example. Taking the incremental data interval as I=[l,r] as an example, l is the left endpoint and r is the right endpoint. When inserting a new interval I=[l,r], the terminal can first find the interval in T that overlaps with the incremental data interval. This can be achieved through the following loop: the terminal is first initialized, that is, the loop variable i is defined as the first interval in T whose left endpoint is less than or equal to l. If it does not exist, it is the leftmost interval in T, and i=[il,ir] is set; the terminal loops the invariant: l≤ir∧r≥il, which means that the left endpoint of the incremental data interval is less than or equal to the right endpoint of the data interval, and the right endpoint of the data interval is greater than or equal to the left endpoint of the data interval. If true, it means that it overlaps with the incremental data interval to be inserted. Among them, for each overlapping interval, if i is included in I, it means that the incremental data interval completely contains the data interval, and the terminal can delete the data interval from T. Otherwise, the terminal can truncate the part of the data interval i that overlaps with I, and insert the above new interval after removing the overlapping part.
[0071] That is, the preset binary search tree supports insertion operations. When inserting a new incremental data interval into T, if the new incremental data interval overlaps with the interval in T, the terminal first cuts off the overlapping part of the interval in T and retains the non-overlapping part. If there is an interval that is completely included in the new incremental data interval, the data interval is deleted, and then the entire new incremental data interval is inserted to ensure that T satisfies the property that there is no overlapping interval.
[0072] Through this embodiment, the terminal can compare the incremental data interval with each data interval in the preset binary search tree to determine the part that overlaps with the incremental data interval, and then the terminal can implement incremental backup by removing the overlapping part and inserting the incremental data interval, retaining only the necessary data in the preset binary search tree, thereby improving the efficiency of data recovery.
[0073] In one embodiment, the portion of each target data interval that overlaps with the incremental data interval is removed, including: if the right endpoint of the target data interval is larger than the right endpoint of the incremental data interval, obtaining the overlapping first sub-target data interval corresponding to the left endpoint and the right endpoint of the incremental data interval in the target data interval; and removing the overlapping first sub-target data interval in a preset binary search tree.
[0074] In this embodiment, after the terminal determines the part overlapping with the incremental data interval in the preset binary search tree, the overlapping part can be removed. Among them, for different overlapping relationships, the terminal can use different removal methods to achieve the removal of the overlapping part. For example, the terminal can detect the part overlapping with the incremental data interval in the target data interval with the overlapping relationship. If the left endpoint of the target data interval is less than or equal to the left endpoint of the incremental data interval, and the right endpoint is greater than the right endpoint of the incremental data interval, the terminal can determine that there is one target data interval, and the overlapping relationship between the target data interval and the incremental data interval is that the incremental data interval is completely contained by the target data interval. Then the terminal can obtain the overlapping first sub-target data interval corresponding to the left endpoint and the right endpoint of the incremental data interval in the target data interval. For example, the terminal performs a first mark at the corresponding position in the above target data interval according to the address of the left endpoint of the incremental data interval, and performs a second mark at the corresponding position in the above target data interval according to the address of the right endpoint of the incremental data interval, so that the terminal can obtain a first sub-target data interval overlapping with the incremental data interval in the target data interval, and the terminal can remove the overlapping first sub-target data interval in the preset binary search tree.
[0075] Specifically, taking the preset binary search tree T as an example, the terminal can obtain the first interval its whose left endpoint is greater than the left endpoint of the incremental data interval. If its is not the starting interval, the terminal can search for its' previous interval pits in T. The left endpoint of the interval pits must be smaller than the left endpoint of the incremental data interval. If the terminal detects that the right endpoint of pits is greater than the right endpoint of the incremental data interval, the terminal can insert the part of the right side of pits that is greater than or equal to the right endpoint of the incremental data interval into T as a new interval, and truncate pits, with the left endpoint of pits as the left endpoint, and the left endpoint of the incremental data interval as the new right endpoint of pits, so that the terminal can remove the part of pits that overlaps with the left and right endpoints of the incremental data interval.
[0076] Through this embodiment, the terminal can compare the incremental data interval with each data interval in the preset binary search tree, determine the part that overlaps with the incremental data interval, and then the terminal implements incremental backup by removing the overlapping part and inserting the incremental data interval, retaining only the necessary data in the preset binary search tree, thereby improving the efficiency of data recovery.
[0077] In one embodiment, removing the overlapping parts of each target data interval with the incremental data interval also includes: if the left endpoint of the first target data interval is less than or equal to the left endpoint of the incremental data interval, the right endpoint of the first target data interval is greater than the left endpoint of the incremental data interval, and the right endpoint of the first target data interval is less than the right endpoint of the incremental data interval, then determining the overlapping second sub-target data interval based on the left endpoint of the incremental data interval and the right endpoint of the first target data interval; if the left endpoint of the second target data interval is greater than the left endpoint of the incremental data interval, the left endpoint of the second target data interval is less than the right endpoint of the incremental data interval, and the right endpoint of the second target data interval is greater than the right endpoint of the incremental data interval; and removing the overlapping second sub-target and third sub-target data intervals in a preset binary search tree.
[0078] In this embodiment, when the incremental data interval overlaps with multiple data intervals in the preset binary search tree, there may be multiple target data intervals, which may specifically include a first target data interval and a second target data interval. The first target data interval may be the first target data interval among the multiple target data intervals whose left endpoint is less than or equal to the left endpoint of the incremental data interval, and the second target data interval may be the first target data interval among the multiple target data intervals whose right endpoint is greater than or equal to the right endpoint of the incremental data interval. For the intervals among the multiple target data intervals that are completely included in the incremental data interval, the terminal may directly remove these included target data intervals.
[0079] The terminal can detect the first target data interval and the second target data interval respectively. If the terminal detects that the left endpoint of the first target data interval is less than or equal to the left endpoint of the incremental data interval, the right endpoint of the first target data interval is greater than the left endpoint of the incremental data interval, and the right endpoint of the first target data interval is less than the right endpoint of the incremental data interval, then the terminal can determine that the left endpoint of the incremental data interval is in the first target data interval, and the right endpoint is not in the first target data interval. The terminal can determine the overlapping second sub-target data interval based on the left endpoint of the incremental data interval and the right endpoint of the first target data interval, that is, the left endpoint of the second sub-target data interval is the left endpoint of the incremental data interval, and the right endpoint of the second sub-target data interval is the right endpoint of the first target data interval.
[0080] If the terminal detects that the left endpoint of the second target data interval is greater than the left endpoint of the incremental data interval, the left endpoint of the second target data interval is less than the right endpoint of the incremental data interval, and the right endpoint of the second target data interval is greater than the right endpoint of the incremental data interval, the terminal can determine that the left endpoint of the incremental data interval is not in the second target data interval, and the right endpoint is in the second target data interval. The terminal can determine the overlapping third sub-target data interval based on the left endpoint of the second target data interval and the right endpoint of the incremental data interval, that is, the left endpoint of the third sub-target data interval is the left endpoint of the first target data interval, and the right endpoint of the second sub-target data interval is the right endpoint of the incremental data interval. Thus, the terminal can remove the overlapping second sub-target and third sub-target data intervals in the preset binary search tree.
[0081] Specifically, taking the preset binary search tree as T as an example, the terminal can obtain the first interval its whose left endpoint is greater than the left endpoint of the incremental data interval. If its is not the starting interval, the terminal can search for its previous interval pits in T. The left endpoint of the interval pits must be less than the left endpoint of the incremental data interval. If the terminal detects that the right endpoint of pits is less than the right endpoint of the incremental data interval, the terminal can use pits as the first target data interval, and the terminal can determine the right endpoint of pits as the left endpoint of the incremental data interval, and form a second sub-target data interval based on the left endpoint of the incremental data interval and the right endpoint of pits. When the left endpoint of its is less than the right endpoint of the incremental data interval, its must have an overlapping part with the incremental data interval. If the terminal detects that the right endpoint of its is greater than the right endpoint of the incremental data interval, the terminal can insert the part of its right side greater than the right endpoint of the incremental data interval as a new interval into T, and form a third sub-target data interval based on the left endpoint of its and the right endpoint of the incremental data interval, so that the terminal can remove the above-mentioned second sub-target data interval and the third sub-target data interval.
[0082] Through this embodiment, the terminal can compare the incremental data interval with each data interval in the preset binary search tree, determine the part that overlaps with the incremental data interval, and then the terminal implements incremental backup by removing the overlapping part and inserting the incremental data interval, retaining only the necessary data in the preset binary search tree, thereby improving the efficiency of data recovery.
[0083] In an exemplary embodiment, as shown in FIG2 , FIG2 is a flow chart of a data processing method in another embodiment. In this embodiment, the terminal can implement a preset binary search tree T through std::map. Each node in T includes a key-value pair, which can be represented as<key,value> . The terminal can use the left endpoint of the data interval as the key of std::map, which means that the intervals in T are arranged from small to large according to the left endpoint. The terminal can also use the right endpoint of the interval and the satellite data as the value of std::map. In some embodiments, the terminal can also use the right endpoint as the key. Since the intervals in T do not overlap, there is almost no difference between using the right endpoint as the key and using the left endpoint as the key. Among them, std::map can be replaced with other specific data structures: such as balanced binary sorted trees such as AVL trees and treaps, or data structures such as sequential lists, or other specific data structures, as long as they can satisfy the properties that T can be traversed and key-value pairs exist.
[0084] The above value includes the right endpoint of the data interval, the offset of the interval data in the backup point file, the path of the backup data, etc. Assuming that there are n intervals in T, when inserting an incremental data interval [left, right], left is the left endpoint of the incremental data interval, and right is the right endpoint of the incremental data interval.
[0085] The terminal can first detect the part of T that overlaps with the incremental data interval, remove it, and then insert it. If the terminal detects that T is empty, there must be no overlapping part, and the terminal can directly insert the above incremental data interval. Otherwise, the terminal can find the first interval its in T whose left endpoint is greater than or equal to left. If its is the first interval in T, and the above right is less than or equal to the right endpoint of its, it means that the new interval has no overlapping part with the interval in T, and the terminal can return directly.
[0086] If its is not the first interval of T, the terminal can find its previous interval pits, and the left endpoint of pits must be less than or equal to left. If the right endpoint of pits is greater than right, the terminal can insert the right part of pits greater than or equal to right into T as a new interval, and truncate pits to take left as the right endpoint. At this time, there is no interval in T that overlaps with the new interval, and the terminal can directly insert the incremental data interval.
[0087] If the right endpoint of pits is equal to right, the terminal will truncate pits to have left as the right endpoint. At this time, there is no interval in T that overlaps with the new interval, and the terminal can directly insert the incremental data interval.
[0088] If the right endpoint of pits is greater than left, the terminal can truncate pits to take left as the right endpoint and remove the part of pits that overlaps with the incremental data interval. If the terminal does not find its, it returns directly.
[0089] When the terminal detects that the left endpoint of its is smaller than right, its must overlap with the new interval. If the right endpoint of its is smaller than right at this time, the terminal can determine that its has been completely covered by the new interval, and the terminal can delete its and obtain its next interval. Among them, there may be other intervals in T that overlap with the new interval, and the terminal can continue to iterate.
[0090] If the right endpoint of its is equal to right, its has been completely covered by the new interval, and the terminal can delete its. At this time, there is no interval in T that overlaps with the new interval, and the terminal can directly insert the incremental data interval.
[0091] When the right endpoint of its is greater than right, the terminal can insert the part of its that is greater than right as a new interval into T and delete its. At this time, there is no interval in T that overlaps with the new interval, and the terminal can directly insert the incremental data interval. If there are s intervals in T that overlap with the new interval, the time complexity of the above insertion algorithm is O(slogn).
[0092] When restoring data, for example, restoring a backup point, the terminal can read the interval information from the backup point and restore the backup data according to the backup data address in the interval. For example, the terminal can read the interval information from the backup point and restore the backup data from the address.
[0093] Through the above embodiment, the terminal deduplicates the backup data by comparing data intervals during incremental backup, so that when restoring, the data corresponding to each data interval is directly restored as necessary data, thereby improving data recovery efficiency.
[0094] It should be understood that, although the steps in the flowcharts involved in the above embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above embodiments may include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0095] Based on the same inventive concept, the embodiment of the present application also provides a data processing device for implementing the data processing method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in the one or more data processing device embodiments provided below can refer to the limitations on the data processing method above, and will not be repeated here.
[0096] In an exemplary embodiment, as shown in FIG3 , a data processing device is provided, including: an acquisition module 500, a determination module 502, a removal module 504 and a processing module 506, wherein:
[0097] The acquisition module 500 is used to acquire the backup storage position and data size corresponding to the incremental data, and determine the incremental data interval corresponding to the incremental data according to the backup storage position and data size.
[0098] Determination module 502 is used to traverse each data interval in the preset binary search tree and determine each target data interval in each data interval that overlaps with the incremental data interval; the preset binary search tree includes each data interval corresponding to the full backup data, and each data interval does not overlap.
[0099] The removal module 504 is used to remove the overlapping parts of each target data interval with the incremental data interval, and determine the insertion position of the incremental data interval in the preset binary search tree according to each target data interval after removal.
[0100] The processing module 506 is used to insert the incremental data interval into a preset binary search tree according to the insertion position to back up the incremental data.
[0101] In one embodiment, the above-mentioned acquisition module 500 is used to determine the backup data path corresponding to the incremental data according to the backup storage location; determine the offset of the incremental data in the backup data path according to the data size; determine the left endpoint and right endpoint of the incremental data interval according to the backup data path and the offset; determine the incremental data interval corresponding to the incremental data according to the left endpoint, right endpoint, backup data path and offset of the incremental data interval.
[0102] In one embodiment, the above-mentioned determination module 502 is used to traverse each data interval in a preset binary search tree, determine the first data interval in the preset binary search tree whose left endpoint is less than or equal to the left endpoint of the incremental data interval; for the first data interval in the preset binary search tree and each data interval after the first data interval, compare the endpoints of the data interval with those of the incremental data interval; if the left endpoint of the incremental data interval is less than or equal to the right endpoint of the data interval, and the right endpoint of the data interval is greater than or equal to the left endpoint of the data interval, then determine that the data interval is a target data interval that overlaps with the incremental data interval.
[0103] In one embodiment, the above-mentioned removal module 504 is used to obtain the overlapping first sub-target data interval corresponding to the left endpoint and the right endpoint of the incremental data interval in the target data interval if the left endpoint of the target data interval is less than or equal to the left endpoint of the incremental data interval and the right endpoint is greater than the right endpoint of the incremental data interval; and remove the overlapping first sub-target data interval in the preset binary search tree.
[0104] In one embodiment, the above-mentioned removal module 504 is used to determine the overlapping second sub-target data interval according to the left endpoint of the incremental data interval and the right endpoint of the first target data interval if the left endpoint of the first target data interval is less than or equal to the left endpoint of the incremental data interval, the right endpoint of the first target data interval is greater than the left endpoint of the incremental data interval, and the right endpoint of the first target data interval is less than the right endpoint of the incremental data interval; if the left endpoint of the second target data interval is greater than the left endpoint of the incremental data interval, the left endpoint of the second target data interval is less than the right endpoint of the incremental data interval, and the right endpoint of the second target data interval is greater than the right endpoint of the incremental data interval; and remove the overlapping second sub-target and third sub-target data intervals in the preset binary search tree.
[0105] In one embodiment, the above-mentioned device also includes: a recovery module, which is used to obtain corresponding backup data for each data interval in the preset binary search tree according to the backup storage location corresponding to the data interval when a data recovery request is received; and perform data recovery according to the backup data.
[0106] Each module in the above data processing device can be implemented in whole or in part by software, hardware or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.
[0107] In an exemplary embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be shown in FIG4. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit, and an input device. The processor, the memory, and the input / output interface are connected via a system bus, and the communication interface, the display unit, and the input device are connected to the system bus via the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner may be implemented through WIFI, a mobile cellular network, near field communication (NFC) or other technologies. When the computer program is executed by the processor, a data processing method is implemented. The display unit of the computer device is used to form a visually visible picture, which may be a display screen, a projection device, or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device shell, or an external keyboard, touchpad or mouse.
[0108] Those skilled in the art will understand that the structure shown in FIG. 4 is merely a block diagram of a partial structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different arrangement of components.
[0109] In an exemplary embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the above-mentioned data processing method when executing the computer program.
[0110] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the above-mentioned data processing method is implemented.
[0111] In one embodiment, a computer program product is provided, including a computer program, which implements the above data processing method when executed by a processor.
[0112] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.
[0113] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.
[0114] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0115] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A data processing method, characterized in that: The method comprises: Acquire a backup storage location and data size corresponding to the incremental data, and determine an incremental data interval corresponding to the incremental data according to the backup storage location and data size; Traversing each data interval in a preset binary search tree, determining each target data interval in each data interval that overlaps with the incremental data interval; the preset binary search tree includes each data interval corresponding to the full backup data, and each data interval does not overlap; Removing the portion of each target data interval that overlaps with the incremental data interval, and determining the insertion position of the incremental data interval in the preset binary search tree according to each target data interval after removal; The incremental data interval is inserted into the preset binary search tree according to the insertion position to back up the incremental data.
2. The method according to claim 1, characterized in that The step of determining the incremental data interval corresponding to the incremental data according to the backup storage location and the data size includes: Determining a backup data path corresponding to the incremental data according to the backup storage location; Determining, according to the data size, an offset of the incremental data in the backup data path; Determine the left endpoint and the right endpoint of the incremental data interval according to the backup data path and the offset; The incremental data interval corresponding to the incremental data is determined according to the left endpoint, the right endpoint, the backup data path and the offset of the incremental data interval.
3. The method according to claim 1, characterized in that The traversing each data interval in the preset binary search tree to determine each target data interval in each data interval that overlaps with the incremental data interval includes: Traversing each data interval in a preset binary search tree, determining a first data interval in the preset binary search tree whose left endpoint is less than or equal to the left endpoint of the incremental data interval; For the first data interval and each data interval after the first data interval in the preset binary search tree, compare each endpoint of the data interval with the incremental data interval; If the left endpoint of the incremental data interval is less than or equal to the right endpoint of the data interval, and the right endpoint of the data interval is greater than or equal to the left endpoint of the data interval, the data interval is determined to be a target data interval overlapping with the incremental data interval.
4. The method according to claim 1, characterized in that: The removing of the parts of each target data interval that overlap with the incremental data interval includes: If the left endpoint of the target data interval is less than or equal to the left endpoint of the incremental data interval, and the right endpoint is greater than the right endpoint of the incremental data interval, then obtaining the overlapping first sub-target data interval corresponding to the left endpoint and the right endpoint of the incremental data interval in the target data interval; The overlapping first sub-target data intervals are removed in the preset binary search tree.
5. The method according to claim 1, characterized in that Each of the target data intervals includes a first target data interval and a second target data interval; The removing of the portion of each target data interval that overlaps with the incremental data interval also includes: If the left endpoint of the first target data interval is less than or equal to the left endpoint of the incremental data interval, the right endpoint of the first target data interval is greater than the left endpoint of the incremental data interval, and the right endpoint of the first target data interval is less than the right endpoint of the incremental data interval, then determine the overlapping second sub-target data interval according to the left endpoint of the incremental data interval and the right endpoint of the first target data interval; If the left endpoint of the second target data interval is greater than the left endpoint of the incremental data interval, the left endpoint of the second target data interval is less than the right endpoint of the incremental data interval, and the right endpoint of the second target data interval is greater than the right endpoint of the incremental data interval, then determine the overlapping third sub-target data interval according to the left endpoint of the second target data interval and the right endpoint of the incremental data interval; In the preset binary search tree, the overlapping data intervals of the second sub-target and the third sub-target are removed.
6. The method according to any one of claims 1 to 5, characterized in that: After inserting the incremental data interval into the preset binary search tree according to the insertion position to back up the incremental data, the method further includes: When a data recovery request is received, for each data interval in the preset binary search tree, corresponding backup data is obtained according to the backup storage location corresponding to the data interval; Data recovery is performed according to the backup data.
7. A data processing device, characterized in that: The device comprises: An acquisition module, used to acquire a backup storage location and a data size corresponding to the incremental data, and determine an incremental data interval corresponding to the incremental data according to the backup storage location and the data size; A determination module is used to traverse each data interval in a preset binary search tree to determine each target data interval in each data interval that overlaps with the incremental data interval; the preset binary search tree includes each data interval corresponding to the full backup data, and each data interval does not overlap; A removal module, used to remove the portion of each target data interval that overlaps with the incremental data interval, and determine the insertion position of the incremental data interval in the preset binary search tree according to each target data interval after removal; A processing module is used to insert the incremental data interval into the preset binary search tree according to the insertion position to back up the incremental data.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Data block processing method, device and equipment, and storage medium
CN112463077A
Data backup method and device and data recovery method and device
CN114036004A
Data synthesis method and device, equipment and storage medium
CN114328016A
Data recovery method and device, computer equipment, storage medium and program product
CN115269274A
Data backup method and device, data recovery method and device, medium and electronic equipment
CN116107811A