Data processing method, device, computer device, readable storage medium and program product

By building a preset binary search tree, identifying and removing overlapping parts of the incremental data interval, and inserting the necessary incremental data interval, the problem of low data recovery efficiency caused by incremental backup is solved, and efficient data recovery is achieved.

CN119336546BActive Publication Date: 2025-07-25GUANGZHOU DINGJIA COMPUTER TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411437873.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-10-15
Publication Date
2025-07-25
Estimated Expiration
2044-10-15

AI Technical Summary

Technical Problem

The existing incremental backup method reduces the recovery efficiency due to multiple incremental backups during data recovery. The data needs to be restored one by one in the backup order, resulting in waste of resources and reduced efficiency.

Method used

By building a preset binary search tree, traversing the data interval, determining the overlapping part between the incremental data interval and the target data interval, and removing the overlapping part, determining the insertion position of the incremental data interval based on the removed target data interval, and inserting the incremental data interval into the binary search tree to realize deduplication and backup of the data interval.

Benefits of technology

Improve data recovery efficiency, avoid duplicate data recovery, ensure that only necessary data is restored during the recovery process, and improve data recovery efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119336546B_ABST
    Figure CN119336546B_ABST
Patent Text Reader

Abstract

The present application relates to a data processing method, apparatus, computer device, readable storage medium, and program product. By traversing a preset binary search tree with an incremental data interval corresponding to incremental data, determining each target data interval overlapping with the incremental data interval therein, removing the part of the target data interval overlapping with the incremental data interval, determining the insertion position of the incremental data interval in the preset binary search tree according to the target data interval after removal, and inserting the incremental data interval according to the insertion position to back up the incremental data. Compared with the traditional method of storing each incremental data every time, which requires restoring the incremental data one by one in the order of each backup during recovery, this solution duplicates the backup data by using data interval comparison during incremental backup, so that when recovering, directly restoring the data corresponding to each data interval is the necessary data, improving the data recovery efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of data processing, and in particular, to a data processing method, apparatus, computer device, computer-readable storage medium, and computer program product. Background Art

[0002] In the field of data backup, there is a technology called incremental backup. This technology only backs up the parts modified after the previous data backup. After multiple incremental backups, there are multiple incremental backup nodes. When restoring data, it is necessary to start from a full backup node and restore the data of the backup points in the order of backup. However, based on the current backup method of incremental backup for data restoration, due to the existence of multiple incremental backups, the restoration efficiency will decrease due to multiple restorations in the backup order.

[0003] Therefore, the current data backup processing method has the defect of reducing the data restoration efficiency. Summary of the Invention

[0004] Based on this, in view of the above technical problems, it is necessary to provide a data processing method, apparatus, computer device, computer-readable storage medium, and computer program product that can improve the data restoration efficiency.

[0005] In a first aspect, the present application provides a data processing method, and the method includes:

[0006] Obtain the backup storage location and data size corresponding to the incremental data, and determine the incremental data interval corresponding to the incremental data according to the backup storage location and data size;

[0007] Traverse each data interval in the preset binary search tree to determine each target data interval that overlaps with the incremental data interval in each of the data intervals; each of the data intervals in the preset binary search tree includes each of the data intervals corresponding to the full backup data, and the data intervals do not overlap with each other;

[0008] Remove the overlapping part 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 the removed target data intervals;

[0009] Insert the incremental data interval into the preset binary search tree according to the insertion position to back up the incremental data.

[0010] In one of the embodiments, the determining the incremental data interval corresponding to the incremental data according to the backup storage location and data size includes:

[0011] Determine the backup data path corresponding to the incremental data according to the backup storage location;

[0012] Determine the offset of the incremental data in the backup data path according to the data size;

[0013] Determine the left endpoint and the right endpoint of the incremental data interval according to the backup data path and the offset;

[0014] Determine the incremental data interval corresponding to the incremental data 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 the preset binary search tree to determine each target data interval overlapping with the incremental data interval in each data interval includes:

[0016] Traverse 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;

[0017] For the first data interval in the preset binary search tree and each data interval after the first data interval, 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, determine that the data interval is a target data interval overlapping with the incremental data interval.

[0019] In one embodiment, removing the overlapping part of each target data interval 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, 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;

[0021] Remove the overlapping first sub-target data interval in the preset binary search tree.

[0022] In one embodiment, each of the target data intervals includes a first target data interval and a second target data interval;

[0023] Removing the overlapping part of each target data interval with the incremental data interval further 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 according to the left endpoint of the incremental data interval and the right endpoint of the first target data interval, determine the overlapping second sub-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 according to the left endpoint of the second target data interval and the right endpoint of the incremental data interval, determine the overlapping third sub-target data interval;

[0026] Remove the overlapping second sub-target and third sub-target data intervals in the preset binary search tree.

[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, it further includes:

[0028] When a data recovery request is received, for each data interval in the preset binary search tree, obtain the corresponding backup data according to the backup storage position corresponding to the data interval;

[0029] Perform data recovery according to the backup data.

[0030] In a second aspect, the present application provides a data processing device, and the device includes:

[0031] An acquisition module, configured 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;

[0032] A determination module, configured to traverse each data interval in the preset binary search tree, and determine each target data interval that overlaps with the incremental data interval in each of the data intervals; each of the data intervals in the preset binary search tree includes each of the data intervals corresponding to the full backup data, and the data intervals do not overlap with each other;

[0033] A removal module, configured to remove the overlapping part between each of the target data intervals and the incremental data interval, and determine the insertion position of the incremental data interval in the preset binary search tree according to each of the target data intervals after removal;

[0034] A processing module, configured 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, where the memory stores a computer program, and when the processor executes the computer program, the steps of the above method are implemented.

[0036] In a fourth aspect, the present application provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the above method are implemented.

[0037] In a fifth aspect, the present application provides a computer program product, including a computer program, and when the computer program is executed by a processor, the steps of the above method are implemented.

[0038] For the above data processing method, device, computer device, computer-readable storage medium, and computer program product, by traversing the preset binary search tree with the incremental data interval corresponding to the incremental data, determining each target data interval overlapping with the incremental data interval therein, removing the part overlapping with the incremental data interval from the target data interval, determining the insertion position of the incremental data interval in the preset binary search tree according to the target data interval after removal, and inserting the incremental data interval according to the insertion position to back up the incremental data. Compared with the traditional method of storing each incremental data every time, which requires restoring the incremental data 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 recovering, directly restoring the data corresponding to each data interval is the necessary data, improving the data recovery efficiency. Description of the Drawings

[0039] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the following will briefly introduce the drawings required for use in the description of the embodiments of the present application or related technologies. Obviously, the drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other related drawings can also be obtained based on these drawings.

[0040] Figure 1 It is a schematic flowchart of the data processing method in an embodiment;

[0041] Figure 2 It is a schematic flowchart of the data processing method in another embodiment;

[0042] Figure 3 It is a structural block diagram of the data processing device in an embodiment;

[0043] Figure 4 The internal structure diagram of a computer device in an embodiment. Specific implementation manners

[0044] In order to make the objectives, technical solutions and advantages of the present application more clear and understandable, the present application will be further described in detail below with reference to 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 Figure 1 shown, a data processing method is provided. In this embodiment, the method is exemplified by being applied to a terminal. It can be understood 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 step S208. Among them:

[0046] Step S202: Obtain the backup storage location and data size corresponding to the incremental data, and determine the incremental data range 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 part modified after the previous data backup. To obtain the modification situation of the data, the CBT (Change Block Tracking) technology can be used. The CBT technology is a technology that can record the modification situation of the data and can track the modification situation of the data after a certain time point. Full backup refers to a complete copy of all data at a certain time point. In the current incremental backup method, during recovery, the incremental backup data needs to be restored one by one in the backup order, and the data restored during a certain recovery may be overwritten by the data restored subsequently. This means that a large amount of useless data is restored during the recovery process, resulting in waste of resources and reduced recovery efficiency. Therefore, the terminal can perform incremental backup by setting the data range, so that there will be no duplicate backup data in each data range corresponding to the full backup data, but all are necessary data.

[0048] When the terminal receives an incremental backup request, it can obtain the incremental data relative to the previous backup during this backup. Different data have corresponding backup storage locations in the terminal, such as the backup storage address, etc. Then the terminal can obtain the backup storage location and data size corresponding to the above incremental data, and determine the incremental data range corresponding to the incremental data based on the above backup storage location and data size. Among them, the incremental data range can include the identifiers corresponding to each data in the incremental data. For example, the satellite data of each data in the incremental data, including data such as the storage address, data size, and offset of the data at the storage address. The terminal can form the incremental data range corresponding to the incremental data based on the above data. That is, the real incremental data is not stored in the incremental data range, but the satellite data pointing to the backup storage location of the incremental data and its offset is stored.

[0049] Step S204, traverse each data range in the preset binary search tree, and determine each target data range that overlaps with the incremental data range in each data range; each data range corresponding to the full backup data is included in the preset binary search tree, and the data ranges do not overlap with each other.

[0050] Among them, the terminal can pre-construct the preset binary search tree. The binary search tree can be an empty tree or 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 sorting trees respectively. As a classic data structure, the binary search tree has both the characteristics of fast insertion and deletion operations of a linked list and the advantage of fast searching of an array; so it is widely used. For example, this data structure is generally used in file systems and database systems for high-efficiency sorting and retrieval operations.

[0051] Each data range corresponding to the full backup data can be stored in the preset binary search tree, that is, the preset binary search tree can be generated based on the full backup data during the previous full backup. Since the terminal needs to compare and deduplicate using the incremental backup data range with each data range in the preset binary search tree during incremental backup, the data ranges in the preset binary search tree do not overlap and are all data ranges corresponding to necessary data.

[0052] When performing incremental backup, the terminal can traverse each data interval in the preset binary search tree using the above incremental data interval to determine each target data interval that overlaps with the incremental data interval in each data interval. Among them, the terminal can determine whether there is an overlap by comparing the endpoints of the incremental data interval and each of the above data intervals. Among them, 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 ending position of the same data in the backup storage location. Then, when there is an overlapping part between two intervals, it means that there are duplicate data with the same address in the two intervals. The specific values of these duplicate data can be different, but the storage addresses and uses are the same. For the incremental backup process, to improve the recovery efficiency, only the latest incremental data needs to be backed up. Thus, the terminal can determine the overlapping part by comparing the endpoints between the incremental data interval and each data interval.

[0053] Step S206: Remove the overlapping part between each target data interval and the incremental data interval, and determine the insertion position of the incremental data interval in the preset binary search tree according to the remaining target data intervals after removal.

[0054] Among them, after the terminal determines each target data interval that overlaps with the incremental data interval in the preset binary search tree through interval comparison, it can remove the overlapping part between each of the above target data intervals and the incremental data interval. Among them, the terminal can achieve the segmentation of the overlapping interval part by re-determining the left and right endpoints of each target data interval with an overlapping part, and remove the segmented overlapping interval part, so as to remove the above overlapping part. After the terminal removes the overlapping parts of each target data interval in the preset binary search tree, there may be remaining non-overlapping interval parts in each target data interval, 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 the remaining target data intervals after removal. Among them, the above insertion position can be the blank space left after removing the overlapping interval part.

[0055] Step S208: Insert the incremental data interval into the 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, so as to realize the backup of the incremental data. The incremental data intervals 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 has been backed up, and information such as the backup storage location and offset is formed into an incremental data interval and stored in the preset binary search tree. During recovery, the terminal can recover the data of each data interval in the preset binary search tree in the way of recovering data intervals one by one.

[0057] 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, it further includes: when receiving a data recovery request, for each data interval in the preset binary search tree, obtaining the corresponding backup data according to the backup storage position corresponding to the data interval; performing data recovery according to the backup data.

[0058] In this embodiment, the terminal can receive a data recovery request after backup. When the terminal receives a data recovery request, it can recover the data corresponding to each node in the preset binary search tree. Among them, the above preset binary search tree includes multiple data intervals. For each data interval, the terminal can obtain the corresponding data to be recovered, such as obtaining the corresponding backup data from the above backup storage position, so as to obtain the corresponding backup data. Thus, the terminal can perform data recovery according to the above backup data. The terminal can perform data recovery on each data interval in the preset binary search tree, so as to obtain the restored full amount of data.

[0059] Specifically, the above preset binary search tree can be represented as T. T mainly stores interval information. 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 within T. Then the satellite data of each data interval within T stores the address of the backup data corresponding to this interval. For a full backup, the terminal can create a new T, and then insert intervals according to the following situations: 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 previous backup of T, and then inserts the incremental data interval of the current backup data into the copied T.

[0060] During the data recovery process, the terminal can traverse all intervals in T, and based on the satellite data of each data interval, that is, the backup data address corresponding to the data interval, and recover the corresponding backup data according to the backup data address. Among them, since there is no overlapping part in the intervals in T, data overwrite will not occur during the recovery process, ensuring that all the necessary data is recovered, thereby improving the efficiency of data recovery.

[0061] In the above data processing method, by traversing the preset binary search tree for the incremental data intervals corresponding to the incremental data, determining each target data interval that overlaps with the incremental data interval therein, removing the part of the target data interval that overlaps with the incremental data interval, determining the insertion position of the incremental data interval in the preset binary search tree according to the target data interval after removal, and inserting the incremental data interval according to the insertion position to back up the incremental data. Compared with the traditional method of storing each incremental data every time, which requires recovering each incremental data 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 recovering, directly recovering the data corresponding to each data interval is the necessary data, improving the data recovery efficiency.

[0062] In one embodiment, determining the incremental data interval corresponding to the incremental data according to the backup storage location and the data size includes: determining the backup data path corresponding to the incremental data according to the backup storage location; determining the offset of the incremental data in the backup data path according to the data size; determining the left endpoint and the right endpoint of the incremental data interval according to the backup data path and the offset; and determining the incremental data interval corresponding to the incremental data according to the left endpoint and the right endpoint of the incremental data interval.

[0063] In this embodiment, the terminal can generate the incremental data interval according to the storage address of the incremental data. For example, the above 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 backup storage location. The terminal can also determine the offset of the incremental data in the backup data path according to the above data size. The above 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 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 starting address and the offset.

[0064] The terminal can determine the incremental data interval corresponding to the incremental data according to the left endpoint and the right endpoint of the above incremental data interval, in combination with the backup data path and offset corresponding to the incremental data. For example, the terminal takes the above left endpoint and 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 range by using information such as the backup address and offset corresponding to the incremental data. Thus, the terminal can use the incremental data range to perform overlapping recognition and incremental backup for the incremental data, improving the efficiency of data recovery.

[0066] In one embodiment, traversing each data range in a preset binary search tree to determine each target data range that overlaps with the incremental data range includes: traversing each data range in the preset binary search tree to determine the first data range in the preset binary search tree whose left endpoint is less than or equal to the left endpoint of the incremental data range; for the first data range and each data range after the first data range in the preset binary search tree, comparing each endpoint of the data range with the incremental data range; if the left endpoint of the incremental data range is less than or equal to the right endpoint of the data range, and the right endpoint of the data range is greater than or equal to the left endpoint of the data range, then determine the data range as the target data range that overlaps with the incremental data range.

[0067] In this embodiment, the terminal can judge the overlapping part by comparing each endpoint of the data range. Among them, the preset binary search tree includes multiple data ranges, and the terminal can traverse each data range in the preset binary search tree and obtain the first data range whose left endpoint is less than or equal to the left endpoint of the incremental data range from them. Among them, the above-mentioned first data range means that the left endpoint of this range is less than or equal to the left endpoint of the above-mentioned incremental data range, and this range is the first data range among the data ranges in the preset binary search tree whose left endpoints are less than or equal to the left endpoint of the incremental data range. Among them, the earlier the endpoint is, the earlier the storage address of the corresponding data is.

[0068] For the first data range and each data range after the first data range in the preset binary search tree, the terminal can compare each endpoint of the data range with the incremental data range, including comparing the left endpoints and the right endpoints.

[0069] Among them, if the terminal detects that the left endpoint of the incremental data range is less than or equal to the right endpoint of this data range, and the right endpoint of the data range is greater than or equal to the left endpoint of the data range, then determine the data range as the target data range that overlaps with the incremental data range. Among them, the form of the overlap between the data range and the incremental data range can include but is not limited to the overlap relationship where the incremental data range is completely contained in the data range, the overlap relationship where the incremental data range completely contains the data range, and the overlap relationship where the incremental data range overlaps with a part of the data range, etc. For different overlap relationships, the terminal can adopt different methods to remove the overlapping part.

[0070] Specifically, taking the above-mentioned preset binary search tree as T, there are multiple implementation methods for T. In this embodiment, the terminal defines T as a binary search tree, where each node stores single interval information, and the nodes are sorted according to the left endpoints or right endpoints of the intervals. 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 the new interval I = [l, r], the terminal can first find the intervals in T that overlap with the incremental data interval. Specifically, it can be implemented through the following loop: The terminal first initializes, that is, defines the loop variable i as the interval in T whose first left endpoint is less than or equal to l, or the leftmost interval in T if it does not exist. Let i = [il, ir]; The terminal loops the following 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 this data interval, and the right endpoint of the data interval is greater than or equal to the left endpoint of the data interval. If it is true, it means 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 this data interval, and the terminal can delete this 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 the insert operation. When inserting a new incremental data interval into T, if the new incremental data interval overlaps with the intervals in T, the terminal first truncates the overlapping part of the intervals in T, retains the non-overlapping part, and deletes the interval that is completely contained by the new incremental data interval if it exists. Then, the entire new incremental data interval is inserted to ensure that T satisfies the property that the intervals do not overlap.

[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 overlapping part with the incremental data interval. Then, the terminal realizes incremental backup by removing the overlapping part and inserting the incremental data interval, retains only the necessary data in the preset binary search tree, and improves the efficiency of data recovery.

[0073] In one embodiment, removing the part of each target data interval that overlaps with the incremental data interval includes: if the right endpoint of the target data interval is greater than the right endpoint of the incremental data interval, obtaining the overlapping first sub-target data interval corresponding to the left endpoint and right endpoint of the incremental data interval in the target data interval; removing the overlapping first sub-target data interval in the preset binary search tree.

[0074] In this embodiment, after the terminal determines the part of the preset binary search tree that overlaps with the incremental data interval, the overlapping part can be removed. Among them, for different overlapping relationships, the terminal can use different removal methods to remove the overlapping part. For example, the terminal can detect the part of the target data interval with the overlapping relationship that overlaps with the incremental 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, 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 included in the target data interval. Then the terminal can obtain the overlapping first sub-target data interval corresponding to the left and right endpoints of the incremental data interval in the target data interval. For example, the terminal makes 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 makes 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. Thus, the terminal can obtain a first sub-target data interval that overlaps 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 as T, 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 the previous interval pits of its in T. The left endpoint of this 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 greater than the right endpoint of the incremental data interval, the terminal can insert the part on the right 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. Thus, the terminal can remove the overlapping part between the left and right endpoints of the incremental data interval in pits.

[0076] 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. Furthermore, the terminal realizes incremental backup by removing the overlapping part and inserting the incremental data interval, retains only the necessary data in the preset binary search tree, and improves the efficiency of data recovery.

[0077] In one embodiment, removing the overlapping parts of each target data interval with the incremental data interval further 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 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 determining 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; removing the overlapping second sub-target and third sub-target data intervals in the preset binary search tree.

[0078] In this embodiment, when there is an overlapping relationship between the incremental data interval and multiple data intervals in the preset binary search tree, there can be multiple such target data intervals, specifically including the first target data interval and the second target data interval, etc. Among them, the first target data interval can be the first target data interval among 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 can be the first target data interval among multiple target data intervals whose right endpoint is greater than or equal to the right endpoint of the incremental data interval. For the intervals in multiple target data intervals that are completely contained in the incremental data interval, the terminal can directly remove these contained 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 within the first target data interval and the right endpoint is not within the first target data interval. The terminal can 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, 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, then 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 from the preset binary search tree.

[0081] Specifically, taking the preset binary search tree as T, 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 the previous interval pits of its in T. The left endpoint of this 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. The terminal can determine the right endpoint of pits as the left endpoint of the incremental data interval and form the 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, then its must overlap 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 that is greater than the right endpoint of the incremental data interval as a new interval into T and form the third sub-target data interval based on the left endpoint of its and the right endpoint of the incremental data interval. Thus, the terminal can remove the above second sub-target data interval and 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 to determine the overlapping part with the incremental data interval. Furthermore, the terminal realizes incremental backup by removing the overlapping part and inserting the incremental data interval, retains only the necessary data in the preset binary search tree, and improves the efficiency of data recovery.

[0083] In an exemplary embodiment, as Figure 2 shown, Figure 2It is a schematic flowchart 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 in ascending order according to the left endpoint. The terminal can also use the right endpoint of the data interval and 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, using the right endpoint as the key is almost the same as using the left endpoint as the key. Among them, std::map can be replaced by other specific data structures: such as balanced binary sorting trees like 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 there are key-value pairs.

[0084] Among them, the above value includes information such as the right endpoint of the data interval, the offset of the interval data in the backup point file, and the path of the backup data. Assume 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 overlapping part of T with the incremental data interval, and then insert it after removing the overlapping part. 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 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 and the intervals in T have an overlapping part.

[0086] If its is not the first interval of T, the terminal can find the previous interval pits of its, 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 part on the right of pits that is greater than or equal to right into T as a new interval, and 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.

[0087] If the right endpoint of pits is equal to right, the terminal truncates 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 have 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 directly returns.

[0089] When the terminal detects that the left endpoint of its is less than right, its must overlap with the new interval. If the right endpoint of its is less than right at this time, the terminal can determine that its has been completely covered by the new interval, so 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, at this time its has been completely covered by the new interval, and the terminal can delete its. At this time, there are no intervals in T that overlap 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 are no intervals in T that overlap with the new interval, and the terminal can directly insert the incremental data interval. Among them, if there are s intervals in T that overlap with the new interval, the time complexity of the above insertion part algorithm is O(slogn).

[0092] When restoring data, for example, when restoring a certain 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 embodiments, the terminal eliminates duplicates of backup data by using data interval comparison during incremental backup, so that when restoring, directly restoring the data corresponding to each data interval is the necessary data, improving the data restoration efficiency.

[0094] It should be understood that although the steps in the flowcharts involved in the above embodiments are sequentially shown according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless there is a clear description in this article, the execution of these steps has no strict order limit, 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. These steps or stages are not necessarily executed at the same moment, but can be executed at different moments, and the execution order of these steps or stages is not necessarily sequential, but can be executed alternately or alternately with at least a part of other steps or steps or stages in other steps.

[0095] Based on the same inventive concept, an embodiment of the present application further provides a data processing apparatus for implementing the data processing method involved above. The solution provided by this apparatus for solving problems is similar to the solution described in the above method. Therefore, the specific limitations in one or more embodiments of the data processing apparatus provided below may refer to the limitations on the data processing method in the foregoing text, and will not be elaborated herein.

[0096] In an exemplary embodiment, as Figure 3 shown, a data processing apparatus is provided, including: an acquisition module 500, a determination module 502, a removal module 504, and a processing module 506, where:

[0097] The acquisition module 500 is configured to acquire the backup storage location and data size corresponding to the incremental data, and determine the incremental data range corresponding to the incremental data according to the backup storage location and data size.

[0098] The determination module 502 is configured to traverse each data range in the preset binary search tree, and determine each target data range that overlaps with the incremental data range in each data range; each data range in the preset binary search tree includes each data range corresponding to the full backup data, and the data ranges do not overlap with each other.

[0099] The removal module 504 is configured to remove the overlapping part of each target data range with the incremental data range, and determine the insertion position of the incremental data range in the preset binary search tree according to the removed target data ranges.

[0100] The processing module 506 is configured to insert the incremental data range into the preset binary search tree according to the insertion position to back up the incremental data.

[0101] In one embodiment, the above acquisition module 500 is configured 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 range according to the backup data path and the offset; and determine the incremental data range corresponding to the incremental data according to the left endpoint, right endpoint, backup data path, and offset of the incremental data range.

[0102] In one embodiment, the determining module 502 is configured to traverse each data interval in the preset binary search tree, and 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, compare each endpoint of the data interval with the endpoints 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 the data interval as the target data interval overlapping with the incremental data interval.

[0103] In one embodiment, the removing module 504 is configured to, 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, 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; remove the overlapping first sub-target data interval in the preset binary search tree.

[0104] In one embodiment, the removing module 504 is configured to, 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, 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, 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; remove the overlapping second sub-target and third sub-target data intervals in the preset binary search tree.

[0105] In one embodiment, the apparatus further includes: a recovery module, configured to, when receiving a data recovery request, for each data interval in the preset binary search tree, obtain the corresponding backup data according to the backup storage location corresponding to the data interval; perform data recovery according to the backup data.

[0106] Each module in the above data processing apparatus can be implemented in whole or in part by software, hardware, and their combination. The above modules can be embedded in the processor of the computer device in hardware form or be independent of it, or be stored in the memory of the computer device in software form, so that the processor can call and execute the operations corresponding to the above respective modules.

[0107] In an exemplary embodiment, a computer device is provided. The computer device may be a terminal, and its internal structural diagram may be as Figure 4As shown in the figure. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit, and an input device. Among them, the processor, the memory, and the input / output interface are connected through a system bus, and the communication interface, the display unit, and the input device are connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system 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 external devices. The communication interface of the computer device is used to communicate with external terminals in a wired or wireless manner, and the wireless manner can be implemented through WIFI, a mobile cellular network, near field communication (NFC), or other technologies. The computer program, when executed by the processor, implements a data processing method. The display unit of the computer device is used to form a visually visible picture, which can 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. The input device of the computer device can be a touch layer covering the display screen, or a button, a trackball, or a touchpad provided on the computer device housing, or an external keyboard, touchpad, or mouse, etc.

[0108] Those skilled in the art can understand that Figure 4 the structure shown in the figure is only a block diagram of some structures related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0109] In an exemplary embodiment, a computer device is provided, including a memory and a processor. A computer program is stored in the memory, and when the processor executes the computer program, the above-mentioned data processing method is implemented.

[0110] In an embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by the processor, the above-mentioned data processing method is implemented.

[0111] In an embodiment, a computer program product is provided, including a computer program. When the computer program is executed by the processor, the above-mentioned data processing method is implemented.

[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 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 need to comply with relevant regulations.

[0113] Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be completed by instructing relevant hardware through a computer program. 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 methods. Among them, any reference to a memory, database, or other medium used in the embodiments provided in this 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), Magnetoresistive 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. By way of illustration and not limitation, RAM can be in various forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM), etc. The databases involved in the embodiments provided in this application can include at least one of relational databases and non-relational databases. Non-relational databases can include distributed databases based on blockchain, etc., without limitation. The processors involved in the embodiments provided in this application can be general-purpose processors, central processors, graphics processors, digital signal processors, programmable logic devices, data processing logics based on quantum computing, Artificial Intelligence (AI) processors, etc., without limitation.

[0114] The technical features of the above embodiments can be combined arbitrarily. For the sake of concise description, 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, it should be considered as the scope recorded in this application.

[0115] The above-described embodiments merely represent several implementation manners of this application. The description is relatively specific and detailed, but it should not be construed as a limitation on the patent scope of this application. It should be noted that for those of ordinary skill in the art, without departing from the concept of this application, several modifications and improvements can still be made, and these all belong to the protection scope of this application. Therefore, the protection scope of this application shall be subject to the appended claims.

Claims

1. A data processing method, characterized in that, The method includes: Obtain the backup storage location and data size corresponding to the incremental data, and determine the incremental data range corresponding to the incremental data according to the backup storage location and data size; Traverse each data range in the preset binary search tree, and determine each target data range overlapping with the incremental data range in each of the data ranges, including: Traverse each data range in the preset binary search tree, and determine the first data range in the preset binary search tree whose left endpoint is less than or equal to the left endpoint of the incremental data range; For the first data range and each data range after the first data range in the preset binary search tree, compare each endpoint of each data range with the endpoints of the incremental data range; If the left endpoint of the incremental data range is less than or equal to the right endpoint of each data range, and the right endpoint of the incremental data range is greater than or equal to the left endpoint of each data range, then determine each data range as a target data range overlapping with the incremental data range; Each of the data ranges in the preset binary search tree includes the data ranges corresponding to the full backup data, and the data ranges do not overlap with each other; Remove the parts of each of the target data ranges that overlap with the incremental data range, and determine the insertion position of the incremental data range in the preset binary search tree according to the target data ranges after removal; Insert the incremental data range 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 determining the incremental data range corresponding to the incremental data according to the backup storage location and data size includes: 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 range according to the backup data path and the offset; Determine the incremental data range corresponding to the incremental data according to the left endpoint, the right endpoint, the backup data path and the offset of the incremental data range.

3. The method according to claim 1, wherein The removing the parts of each of the target data ranges that overlap with the incremental data range includes: If the left endpoint of the target data range is less than or equal to the left endpoint of the incremental data range and the right endpoint is greater than the right endpoint of the incremental data range, then obtain the overlapping first sub-target data range corresponding to the left endpoint and the right endpoint of the incremental data range in the target data range; Remove the overlapping first sub-target data range in the preset binary search tree.

4. The method according to claim 1, characterized in that, Each of the target data ranges includes a first target data range and a second target data range; The removing the parts of each of the target data ranges that overlap with the incremental data range further 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 a second sub-target data interval that overlaps is determined according to the left endpoint of the incremental data interval and the right endpoint of the first target data interval; The overlapping second sub-target data interval is removed from the preset binary search tree.

5. The method according to claim 4, wherein The removing the overlapping parts of each of the target data intervals and the incremental data interval further includes: 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 a third sub-target data interval that overlaps is determined according to the left endpoint of the second target data interval and the right endpoint of the incremental data interval; The overlapping third sub-target data interval is removed from the preset binary search tree.

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, it further includes: When a data recovery request is received, for each data interval in the preset binary search tree, the corresponding backup data is obtained according to the backup storage position corresponding to the data interval; Data recovery is performed according to the backup data.

7. A data processing device, characterized in that, The device includes: An acquisition module, configured 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; A determination module, configured to traverse each data interval in the preset binary search tree, and determine each target data interval that overlaps with the incremental data interval among each of the data intervals. Specifically, it is configured to traverse 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, compare each data interval with each endpoint of the incremental data interval; if the left endpoint of the incremental data interval is less than or equal to the right endpoint of each data interval, and the right endpoint of the incremental data interval is greater than or equal to the left endpoint of each data interval, then determine each data interval as a target data interval that overlaps with the incremental data interval; each of the data intervals in the preset binary search tree includes each data interval corresponding to the full backup data, and there is no overlap between each of the data intervals; A removal module, configured to remove the overlapping parts of each of the target data intervals and the incremental data interval, and determine the insertion position of the incremental data interval in the preset binary search tree according to each of the target data intervals after removal; A processing module, configured 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, the memory storing a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method described in any one of claims 1 to 6.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the steps of the method described in any one of claims 1 to 6.

10. A computer program product comprising a computer program, characterized in that, When the computer program is executed by the processor, it implements the steps of the method described in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Data backup method and device and data recovery method and device

    CN114036004A

  • Data recovery method and device, computer equipment, storage medium and program product

    CN115269274A