Data recovery method and apparatus

By receiving data recovery requests and updating expiration time information, the problem that the existing technology cannot recover expired data is solved, and flexible data recovery and correctness of business logic is achieved.

CN115904801BActive Publication Date: 2025-05-30ALIBABA (CHINA) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211203092.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-09-29
Publication Date
2025-05-30
Estimated Expiration
2042-09-29

AI Technical Summary

Technical Problem

The existing point-of-time recovery technology cannot recover the data that is automatically deleted when the key expires, resulting in the inability to meet business needs in some scenarios.

Method used

By receiving the data recovery request, the target time point information is extracted, the data operation entry containing the expiration time information is determined, the remaining time information is calculated, the expiration time information is updated, and the target data is restored based on the updated information.

Benefits of technology

It realizes the recovery of the target data corresponding to the data operation entry when there is a need, making it more convenient for users to flexibly control the expiration time information of the data operation entry and ensures the correctness of the business service logic.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115904801B_ABST
    Figure CN115904801B_ABST
Patent Text Reader

Abstract

The embodiments of this specification provide a data recovery method and apparatus. The data recovery method includes: receiving a data recovery request submitted for a file to be processed, and extracting target time point information in the data recovery request; determining data operation entries containing expiration time information in the file to be processed; calculating remaining time information of the data operation entries according to the expiration time information and the target time point information; updating the expiration time information based on the remaining time information, and recovering target data corresponding to the data operation entries according to the updated expiration time information.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of this specification relate to the field of database technology, and particularly to a data recovery method and apparatus. Background Art

[0002] With the development of Internet technology, databases have become essential data storage media for various services. As an important technology applied to structured data storage systems, the point-in-time recovery technology has been widely used in scenarios such as public clouds. Especially in the game field, it can be an important means to implement game rollback, which can not only reduce the difficulty of business logic development on the terminal side but also provide more flexible security services for customers' data. In actual applications, the keys stored in the structured data storage system can be set with expiration times. When the expiration time of a key is reached, the key will be automatically deleted. The execution system corresponding to the time recovery technology will regularly upload the backup set of the structured data storage system instance. The files included in the backup set also correspond to the expiration time information of the keys, and this part of the expiration time information is usually in milliseconds. When using this backup set for data recovery, the existing point-in-time recovery technology can only recover the keys that have not expired and cannot reproduce the data state at the recovery time point, resulting in excessive limitations in some scenarios and unable to meet business requirements. Therefore, an effective solution is urgently needed to solve the above problems. Summary of the Invention

[0003] In view of this, the embodiments of this specification provide a data recovery method. One or more embodiments of this specification also relate to a data recovery apparatus, a data recovery system, a computing device, a computer-readable storage medium, and a computer program to solve the technical defects existing in the prior art.

[0004] According to the first aspect of the embodiments of this specification, a data recovery method is provided, including:

[0005] Receiving a data recovery request submitted for a file to be processed, and extracting the target time point information in the data recovery request;

[0006] Determining the data operation entries containing expiration time information in the file to be processed;

[0007] Calculating the remaining time information of the data operation entries according to the expiration time information and the target time point information;

[0008] Updating the expiration time information based on the remaining time information, and recovering the target data corresponding to the data operation entries according to the updated expiration time information.

[0009] According to a second aspect of the embodiments of the present specification, a data recovery device is provided, including:

[0010] A receiving module, configured to receive a data recovery request submitted for a file to be processed and extract target time point information in the data recovery request;

[0011] A determining module, configured to determine a data operation entry containing expiration time information in the file to be processed;

[0012] A calculating module, configured to calculate remaining time information of the data operation entry according to the expiration time information and the target time point information;

[0013] An updating module, configured to update the expiration time information based on the remaining time information and recover target data corresponding to the data operation entry according to the updated expiration time information.

[0014] According to a third aspect of the embodiments of the present specification, a data recovery system is provided, including:

[0015] A data management unit and a database;

[0016] The data management unit is used to store and execute system executable instructions, and the database is used to store data associated with the system executable instructions. When the system executable instructions are executed by the data management unit, the steps of the above method are implemented, and the recovered data is stored through the database.

[0017] According to a fourth aspect of the embodiments of the present specification, a computing device is provided, including:

[0018] A memory and a processor;

[0019] The memory is used to store computer executable instructions, and the processor is used to implement the steps of any of the above data recovery methods when executing the computer executable instructions.

[0020] According to a fifth aspect of the embodiments of the present specification, a computer-readable storage medium is provided, which stores computer executable instructions, and when the instructions are executed by a processor, the steps of the above data recovery method are implemented.

[0021] According to a sixth aspect of the embodiments of the present specification, a computer program is provided, wherein when the computer program is executed on a computer, the computer is made to execute the steps of the above data recovery method.

[0022] The data recovery method provided in this specification can recalculate the expiration time information for data operation entries containing expiration time information, so as to realize the recovery of the target data corresponding to the data operation entries when there is a need. After receiving a data recovery request submitted for a file to be processed, the target time point information can be extracted from the data recovery request, and at the same time, the data operation entries containing expiration time information can be determined in the file to be processed; thereafter, the remaining time information corresponding to the data operation entries can be calculated by combining the expiration time information and the target time point information, so as to update the corresponding expiration time information by combining the remaining time information. After realizing the positioning of the expiration time information after data recovery, the target data corresponding to the data operation entries can be recovered according to the updated expiration time information, which is more convenient for users to flexibly control the expiration time information of the data operation entries in the file to be processed and ensure the correctness of the corresponding business service logic. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] Figure 1 is a schematic diagram of a data recovery method provided by an embodiment of this specification;

[0024] Figure 2 is a flowchart of a data recovery method provided by an embodiment of this specification;

[0025] Figure 3 is a schematic diagram of a file to be processed in a data recovery method provided by an embodiment of this specification

[0026] Figure 4 is a flowchart of the processing process of a data recovery method provided by an embodiment of this specification;

[0027] Figure 5 is a schematic structural diagram of a data recovery device provided by an embodiment of this specification;

[0028] Figure 6 is a structural block diagram of a computing device provided by an embodiment of this specification. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0029] Many specific details are set forth in the following description in order to provide a thorough understanding of this specification. However, this specification can be implemented in many other ways different from those described herein, and those skilled in the art can make similar generalizations without departing from the connotation of this specification. Therefore, this specification is not limited by the specific implementations disclosed below.

[0030] The terms used in one or more embodiments of this specification are for the purpose of describing specific embodiments only and are not intended to limit one or more embodiments of this specification. The singular forms "a", "the", and "said" used in one or more embodiments of this specification and the appended claims are also intended to include the plural forms unless the context clearly dictates otherwise. It should also be understood that the term "and / or" used in one or more embodiments of this specification refers to and encompasses any and all possible combinations of one or more of the associated listed items.

[0031] It should be understood that although the terms first, second, etc. may be used in one or more embodiments of this specification to describe various information, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from each other. For example, without departing from the scope of one or more embodiments of this specification, the first may also be referred to as the second, and similarly, the second may also be referred to as the first. Depending on the context, the word "if" as used herein may be interpreted as "when" or "while" or "in response to determining".

[0032] First, the noun terms related to one or more embodiments of this specification are explained.

[0033] Redis (Remote Dictionary Server): That is, the remote dictionary service, which is an open-source log-type, Key-Value database written in ANSI C language, supporting networks, memory-based or persistent, and providing APIs in multiple languages.

[0034] RDB (Redis database): A data persistence method of Redis. Redis can save a memory snapshot of the process as an RDB file. That is, by persisting in the RDB way, the data existing in the Redis memory is written into the RDB file and saved on the disk to achieve persistence.

[0035] AOF (append only file): A data persistence method of Redis. Redis can append each command to the AOF file in the form of a command. That is, by recording and saving all write commands to the AOF file stored on the disk by the Redis server, persistence is achieved.

[0036] In this specification, a data recovery method is provided. This specification also relates to a data recovery device, a data recovery system, a computing device, a computer-readable storage medium, and a computer program, which will be described in detail one by one in the following embodiments.

[0037] See Figure 1The schematic diagram shown is for the purpose of being able to recalculate the expiration time information of data operation entries containing expiration time information and to realize the restoration of the target data corresponding to the data operation entries when there is a need. After receiving a data restoration request submitted for a to-be-processed file containing an AOF file and an RDB file, the target time point information can be extracted from the data restoration request through a data synchronization tool, and at the same time, data operation entries containing expiration time information can be determined in the to-be-processed file. Thereafter, the remaining time information corresponding to the data operation entries can be calculated by combining the expiration time information and the target time point information, so as to update the corresponding expiration time information based on the remaining time information, and realize positioning the expiration time information after data restoration. Then, according to the updated expiration time information, the target data corresponding to the data operation entries can be restored, which is used to restore the target data in the backup set to the database, making it more convenient for users to flexibly control the expiration time information of the data operation entries in the to-be-processed file and ensuring the correctness of the corresponding business service logic.

[0038] Figure 2 The flowchart of a data restoration method provided according to an embodiment of this specification is shown, which specifically includes the following steps.

[0039] Step S202: Receive a data restoration request submitted for a to-be-processed file, and extract the target time point information in the data restoration request.

[0040] The data restoration method provided in this embodiment corresponds to the PITR (Point-In-Time-Recover) function in the structured data storage system, which is used to realize that when the PITR function is running, the expiration time information can be updated, so as to ensure that the expiration time information of the updated data operation entries does not expire at the restoration time point, thus facilitating the restoration of the target data for the data operation entries and making it more convenient for users to flexibly control the expiration time information of the data operation entries in the to-be-processed file.

[0041] Based on this, the file to be processed specifically refers to the backup set in the structured data storage system, which is used to back up data and instructions. That is, the file to be processed contains the RDB file storing the database state and the AOF file storing instructions. When performing data recovery, it is necessary to update the expiration time information for the RDB file and the AOF file respectively to ensure that the database can be restored to the specified state and the corresponding operation instructions can be passed back to the target database to implement node rollback in the business scenario. Correspondingly, the data recovery request specifically refers to the request triggered when the time point recovery function needs to be executed. This request can be automatically sent by the system or actively submitted by the user according to requirements. This embodiment does not make any limitations here. It is used to enable the data point recovery function to realize the recovery and use of data at the specified time point. Correspondingly, the target time point information specifically refers to the time point used to adjust the key expiration time information in the RDB file or the AOF file, which is used to calculate the remaining time information of the key to detect whether the data corresponding to the key can be successfully restored at the recovery time point. If it is detected that it cannot be restored, the expiration time information needs to be adjusted to ensure that the adjusted time point is after the recovery time point and does not affect the data recovery processing operation.

[0042] For example, the user uploads a backup set on day1. At day2, the user wants to use this backup set to flash the instance back to the t2 moment of day1. Since t3 of day1 is an absolute time within day1, when executing the setk1 PXAT day1_t3 command at day2, the key will be immediately deleted, resulting in the inability to flash back to the original consistent state when executing the next incrby statement because the key no longer exists. Therefore, after receiving the data recovery request submitted for the file to be processed, the target time point information carried in the request can be used to update the key expiration time information subsequently to ensure that the backup set can be flashed back to the t2 moment of day1 at day2.

[0043] Furthermore, in the process of determining the target time point information, considering that the data to be recovered may correspond to a preset recovery time point or a user-defined time point, it is necessary to determine it after reading the time point information from the configuration file. In this embodiment, the specific implementation method is as follows:

[0044] Parse the data recovery request to obtain a request configuration file; extract recovery time point information and selected time point information from the request configuration file, where the selected time point information is used to determine the update policy of the expiration time information; when the recovery time point information is the same as the selected time point information, select the recovery time point information as the target time point information; when the recovery time point information is different from the selected time point information, select the selected time point information as the target time point information.

[0045] Specifically, the request configuration file specifically refers to the function configuration file provided by the user to the data synchronization tool, and this configuration file contains information such as the file system directory where the file to be processed is located, the network address of the target instance, the recovery time point, etc.; correspondingly, the recovery time point information specifically refers to the time point information for presetting the recovery database state or instruction; correspondingly, the selected time point information specifically refers to the time point information defined by the user for recovering the database state or instruction; among them, the priority of the selected time point information is higher than that of the recovery time point information. It can be understood that the parameters corresponding to the selected time point information and the recovery time point information are recorded in the request configuration file. If both parameters are given constant values, the priority of the selected time point information being determined as the target time point information is higher than the priority of the recovery time point information being the target time point information.

[0046] Based on this, after receiving the data recovery request submitted for the file to be processed, it can be determined that the PITR function is triggered at this time. Then, the data recovery request can be parsed to obtain the request configuration file carried in the data recovery request. After that, the recovery time point information and the selected time point information for recovering the data can be extracted from the request configuration file.

[0047] When the recovery time point information is the same as the selected time point information, it indicates that this recovery processing operation has not been defined by the user. Then, the default recovery time point information can be directly selected as the target time point information for subsequent data recovery processing operations.

[0048] When the recovery time point information is different from the selected time point information, it indicates that this recovery processing operation is started by the user's definition. Correspondingly, the data to be recovered will also be the data specified by the user, or the database state is the state specified by the user, or the operation instruction is the operation instruction specified by the user. Therefore, the selected time point information can be used as the target time point information for subsequent data recovery processing operations.

[0049] For example, after receiving a data recovery request submitted by a user, it can be determined that the PIRT function is started. At this time, the data synchronization tool can be used to retrieve the recovery time point information in the corresponding configuration file, denoted as recovery_timestamp, and extract the user-specified time point information TimeShift in the configuration file, denoted as shift_timestamp. If the recovery time point information is the same as the specified time point information, recovery_timestamp can be selected as the parameter for subsequent updating of the expiration time information. Otherwise, shift_timestamp can be selected as the parameter for subsequent updating of the expiration time information. That is to say, during the data recovery phase, the time is actually adjusted to the recovery time point to extend the expiration time information, enabling the recovery of the database state or instructions in the backup set at any time point.

[0050] In summary, by combining the selection of time point information and recovery time point information to determine the target time point information, it can be ensured that when subsequent data recovery processing is performed, the requirements of user-defined or system-preconfigured can be met, thereby ensuring the availability of the restored database state and the instructions of the sending database.

[0051] Step S204, determine the data operation entries containing expiration time information in the file to be processed.

[0052] Specifically, after obtaining the target time point information above, it is also necessary to determine the data operation entries containing expiration time information from the file to be processed, so as to facilitate the subsequent update of the expiration time information corresponding to the data operation entries in combination with the target time point information, enabling the recovery processing operation of the data corresponding to the data operation entries based on the recalculated expiration time information.

[0053] That is to say, there are a large number of data operation entries in the file to be processed, and some data operation entries correspond to expiration time information, while some data operation entries do not correspond to expiration time information. No processing needs to be done for the data operation entries that do not correspond to expiration time information as they will not expire, and the data recovery processing operation can be directly performed. For the data operation entries corresponding to expiration time information, they will be immediately deleted when the expiration time information is reached or exceeded. The keys that were not expired at the recovery time point may expire at the current time point. Therefore, after determining the data operation entries containing expiration time information, the expiration time information can be updated in combination with the target time point information to recalculate the expiration time information at the current time point, enabling the successful recovery of the data corresponding to the data operation entries at the recovery time point.

[0054] Based on this, in order to implement the above operations, it is necessary to first determine the data operation entries containing expiration time information from the file to be processed. Among them, the expiration time information specifically refers to the expiration time information corresponding to the key in the data operation entry, which can be a time stamp in milliseconds or a time stamp in seconds, depending on the business to which it belongs. This embodiment does not make any limitations here. Correspondingly, the data operation entry specifically refers to the key-value information containing the expiration time information. The expiration time information of each data operation entry can be set by the user.

[0055] Furthermore, when determining the data operation entries containing expiration time information, considering that the file to be processed is a backup set of a structured data storage system, which contains an RDB file and an AOF file, different operation processes need to be performed for different files. In this embodiment, the specific implementation method is as follows:

[0056] Determine the space occupancy information of the file to be processed, and detect whether the space occupancy information meets the data recovery condition; if so, select a data file from the file to be processed, and determine the data operation entries containing expiration time information in the data file; if not, select an instruction file from the file to be processed, and determine the data operation entries containing expiration time information in the instruction file.

[0057] Specifically, the space occupancy information specifically refers to the space occupancy size information of the file to be processed, which is used to represent the size of the data volume contained in the file to be processed; correspondingly, the data recovery condition specifically refers to the condition for detecting whether the file to be processed contains data; correspondingly, the data file specifically refers to the RDB file; correspondingly, the instruction file specifically refers to the AOF file.

[0058] Based on this, first determine the space occupancy information corresponding to the file to be processed, and then detect whether the space occupancy information meets the data recovery condition. If it meets, it means that the data file in the file to be processed contains data. Therefore, a data file can be selected from the file to be processed, and then the data operation entries containing expiration time information are determined in the data file. If it does not meet, it means that the data file in the file to be processed does not contain data, and the instruction file can be directly selected, and the data operation entries containing expiration time information are determined in the instruction file for subsequent data recovery processing operations.

[0059] In summary, by detecting the space occupancy information to determine whether to process the data file or the instruction file, the data recovery efficiency can be effectively improved, and the time consumption for recovering data can be reduced.

[0060] Further, when determining the data operation entries containing expiration time information from the data file, it actually traverses each data operation entry in the data file one by one. After traversing a data operation entry containing expiration time information, a subsequent expiration time information update and data recovery processing operation is performed. After all operations are completed, it can be determined that there are no unprocessed data operation entries in the data file. In this embodiment, the specific implementation method is as follows:

[0061] Extract at least one initial data operation entry from the data file; traverse the at least one initial data operation entry, and select the initial operation entry containing expiration time information according to the traversal result as the data operation entry.

[0062] Specifically, the initial data operation entry specifically refers to the entry that records key-value information in the data file. Based on this, first extract at least one initial data operation entry from the data file; secondly, traverse the at least one initial data operation entry, and select the initial operation entry containing expiration time information according to the traversal result as the data operation entry.

[0063] For example, after determining that the backup set contains the RDB file and the AOF file, the space occupancy information corresponding to the RDB file can be determined first. Then, it can be detected whether the size of the RDB file is 0 according to the space occupancy information to detect whether the RDB file contains data. If so, the RDB file can be parsed, and the RDB entry can be extracted from the RDB file according to the parsing result. By detecting whether the RDB entry contains expiration time information, subsequent data recovery processing operations can be performed on the RDB entry containing expiration time information. If not, it means that the RDB file is empty, and then the AOF file can be directly processed, that is, the AOF file is parsed, and the AOF entry is extracted from the AOF file according to the parsing result. By detecting whether the AOF entry contains expiration time information, subsequent data recovery processing operations can be performed on the AOF entry containing expiration time information.

[0064] In summary, by traversing the initial data operation entries to determine the data operation entries containing expiration time information, it is convenient to update the expiration time information subsequently, so as to ensure that the data operation entries can be processed smoothly to restore the corresponding data to meet the business requirements.

[0065] Step S206, calculate the remaining time information of the data operation entry according to the expiration time information and the target time point information.

[0066] Specifically, based on the above determination of the data operation entry containing the expiration time information and the target time point information, further, considering that the data operation entry carries the expiration time information, when the expiration time information is reached, the key recorded in the data operation entry will be deleted. Therefore, in order to ensure that at the recovery time point, the key that has reached the expiration time can still be used, the remaining time information corresponding to the data operation entry can be calculated based on the expiration time information and the target time point information, so as to determine whether the data operation entry will expire at the recovery time point based on the remaining time information. In the case of expiration, the expiration time information can be updated by combining the current time point with the target time point at the current time point, so as to re-locate the expiration time information of the data operation entry, so as to perform recovery processing on the data corresponding to the key at the recovery time point.

[0067] Among them, the remaining time information specifically refers to the remaining time corresponding to the key in the data operation entry. If the remaining time is less than or equal to 0, it indicates that it will expire at the recovery time point, and vice versa, greater than 0 indicates that it will not expire at the recovery time point.

[0068] Further, considering that the files to be processed include data files and instruction files, and the time point representation types corresponding to the two files are different. The instruction file corresponds to the absolute expiration time, while the data file corresponds to the relative expiration time. Therefore, different methods need to be used to calculate the remaining time information for different files, so as to be used to update the expiration time information of the data operation entry subsequently. In this embodiment, the specific implementation is as follows:

[0069] (1) When the data file is selected from the files to be processed, calculate the remaining time information of the data operation entry according to the expiration time information and the target time point information, including: calculating the first time difference between the expiration time information and the target time point information; determining the remaining time information of the data operation entry according to the first time difference; correspondingly, updating the expiration time information based on the remaining time information includes: when the remaining time information is less than or equal to the first time threshold, performing the step of updating the expiration time information based on the remaining time information.

[0070] Specifically, after selecting a data file from the file to be processed and performing data operation entry processing, the remaining time information corresponding to the data operation entry is actually calculated based on the expiration time information and the target time point information, so that the expiration time information corresponding to the data operation entry can be updated according to the remaining time information subsequently, so that the updated expiration time information does not cause the data operation entry to expire, so that the corresponding data recovery processing operation can be performed. That is, calculate the first time difference between the expiration time information and the target time point information; determine the remaining time information of the data operation entry according to the first time difference; facilitate subsequent execution of the step of updating the expiration time information based on the remaining time information when the remaining time information is less than or equal to the first time threshold.

[0071] For example, after determining the RDB entry containing the expiration time information from the RDB file, the RDB entry can be decoded, and the corresponding expiration time information can be determined according to the decoding result, denoted as key_expire_timestamp, while the target time point information of the RDB entry is shift_timestamp. At this time, it can be determined that the ttl corresponding to the RDB entry is key_expire_timestamp - shift_timestamp. After the calculation is completed, if ttl is less than or equal to 0, it means that the RDB entry will expire at the expiration time point. Therefore, it is necessary to recalculate the corresponding expiration time information so that after the expiration time information is updated subsequently, the key contained in it can be used for data recovery processing.

[0072] In practical applications, as a snapshot file of the database, RDB contains the expiration time information of all keys at the moment when RDB is generated. Assume that the expiration information of the key is key_expire_timestamp (millisecond-level timestamp). Then at the recovery time point recovery_timestamp, the remaining ttl of this key is key_expire_timestamp - recovery_timestamp. When restoring data, the restore key ttl value command can be used to restore the data corresponding to this entry. That is, use restore key (key_expire_timestamp - recovery_timestamp) value to rewrite the expiration time information of the key.

[0073] That is to say, all the data corresponding to the snapshot moment is saved in the RDB file, which records all key-value pairs and their corresponding expiration times. When restoring the data in the RDB file, the restore command can be used, and its format is restore key(key_expire_timestamp-recovery_timestamp)value, where ttl is the remaining time of the key. Therefore, when restoring the data in the RDB, it is necessary to calculate the actual remaining ttl of the key.

[0074] For example, as shown in Figure 3 (a) below, to restore k1 in the RDB file, the command restore key1(expire_timestamp-recovery_timestamp)value1 needs to be used to rewrite the expiration time information of key1. After rewriting, ensure that key1 will not expire at the original expiration time point to facilitate the restoration processing operation of the data corresponding to key1 at the current moment. To restore k2 in the RDB file, the command restore key2(expire_timestamp-recovery_timestamp)value2 needs to be used to rewrite the expiration time information of key2. After rewriting, ensure that key2 will not expire at the original expiration time point to facilitate the restoration processing operation of the data corresponding to key2 at the current moment.

[0075] In summary, by combining the expiration time information and the recovery time point information to update the expiration time information, the updated expiration time point can be made after the recovery time point, so as to ensure that the data operation entries will not be deleted and the subsequent restoration processing operation of the data can be realized according to the business requirements.

[0076] (2) When selecting the instruction file in the file to be processed, according to the expiration time information and the target time point information, calculate the remaining time information of the data operation entry, including: calculating the second time difference between the expiration time information and the target time point information; when the second time difference is greater than the second time threshold, calculate the absolute expiration time information according to the current time point information and the second time difference as the remaining time information of the data operation entry; correspondingly, the updating of the expiration time information based on the remaining time information includes: using the absolute expiration time information to replace the expiration time information as the update of the expiration time information.

[0077] Specifically, after selecting the instruction file from the file to be processed and performing data operation entry processing, the absolute expiration time information corresponding to the data operation entry is actually calculated based on the expiration time information and the target time point information, and used as the remaining time information, so as to facilitate subsequent updating of the expiration time information corresponding to the data operation entry in combination with the absolute expiration time information, and ensure that the updated expiration time information does not cause the data operation entry to expire, so that the corresponding data recovery processing operation can be performed. That is, calculate the second time difference between the expiration time information and the target time point information; in the case where the second time difference is greater than the second time threshold, calculate the absolute expiration time information based on the current time point information and the second time difference, and use it as the remaining time information of the data operation entry. For subsequent use, the absolute expiration time information can be directly used to replace the expiration time information as an update to the expiration time information.

[0078] For example, after determining that the AOF entry containing expiration time information in the AOF file is set key value PXAT16986875898, the corresponding expiration time information can be determined from the AOF entry, denoted as key_expire_timestamp, and the target time point information of the AOF entry is shift_timestamp. At this time, the ttl corresponding to the AOF entry can be determined as key_expire_timestamp - shift_timestamp. After the calculation is completed, if ttl is greater than 0, it means that the AOF entry will expire at the expiration time point. Therefore, it is necessary to recalculate the corresponding expiration time information. At this time, it is necessary to calculate the absolute expiration time absttl = current_timestamp + ttl to facilitate subsequent updating of the expiration time information and then resending the instruction to the database for execution.

[0079] In practical applications, the times in the AOF file are all absolute timestamps. Assuming that the expiration information of the instruction is key_expire_timestamp (millisecond-level timestamp), then at the recovery time point recovery_timestamp, the remaining ttl of the key is key_expire_timestamp - recovery_timestamp. Based on this, the calculated absolute expiration time is current_timestamp + key_expire_timestamp - recovery_timestamp. When performing instruction recovery, et key value PXAT(current_timestamp + key_expire_timestamp - recovery_timestamp) can be used to reset the expiration time.

[0080] That is to say, the AOF records only the absolute expiration time. Therefore, to calculate the new absolute expiration time, it is necessary to first obtain the remaining TTL of the instruction at the recovery_timestamp, that is, (key_expire_timestamp - recovery_timestamp); then add the current time to the TTL, which is the absolute expiration time.

[0081] For example, as shown in Figure 3 (b), to restore key3 in the AOF file, the command set key3 value3 pxat (current_timestamp + expire_timestamp3 - recovery_timestamp) needs to be used. Rewrite the expiration time information of key3, and ensure that key3 will not expire after rewriting, so as to facilitate sending the instruction corresponding to key3 to the database at the recovery time point. To restore key4 in the AOF file, the command set key4 value4 pxat (current_timestamp + expire_timestamp4 - recovery_timestamp) needs to be used. Rewrite the expiration time information of key4, and ensure that key4 will not expire after rewriting, so as to facilitate sending the instruction corresponding to key4 to the database at the recovery time point.

[0082] In summary, when calculating the remaining time information of the data operation entries in the operation file, considering that they all record the absolute expiration time, when updating the expiration time information, it is also necessary to calculate the absolute expiration time to ensure that the updated time is also the absolute expiration time, thus facilitating the use in the data recovery stage.

[0083] Step S208: Update the expiration time information based on the remaining time information, and restore the target data corresponding to the data operation entry according to the updated expiration time information.

[0084] Specifically, after determining the remaining time information of the corresponding data operation entry, the expiration time information can be updated based on the remaining time information to determine the target expiration time information corresponding to the data operation entry according to the update result, so as to delay the expiration time of the data operation entry after locating the new expiration time information, and thus restore the target data corresponding to the data operation entry at the current time point, that is, use the key in the data operation entry to restore its corresponding data.

[0085] Further, when performing target data recovery, it actually delays the deletion time of the data operation entry by combining the updated expiration time information, and completes the data recovery processing operation by combining the key in the entry. In this embodiment, the specific implementation method is as follows:

[0086] Determine the target expiration time information according to the updated expiration time information; when the current time information does not exceed the target expiration time information, read the data identification information in the data operation entry; read the target data based on the data identification information, and perform recovery processing on the target data.

[0087] Specifically, the target expiration time information specifically refers to the updated expiration time information; correspondingly, the data identification information specifically refers to the key information recorded in the data operation entry; correspondingly, the target data specifically refers to the data corresponding to the key. Based on this, after updating the expiration time information based on the remaining time information, the target expiration time information can be determined according to the updated expiration time information; when the current time information does not exceed the target expiration time information, read the data identification information in the data operation entry; at this time, the target data can be read based on the data identification information, and recovery processing is performed on the target data. That is, the target data can be restored to the database to restore the database to the state of the set time node.

[0088] In summary, by combining the data identification information to perform the recovery processing of the target data, it can ensure that the data corresponding to each data operation entry is restored, so that the database can be restored to the specified state for facilitating the corresponding business processing.

[0089] Further, when selecting an instruction file from the file to be processed, considering that the instruction file records only instructions, after determining the absolute expiration time information, it can be sent to the target database to execute the instruction to restore the database state. In this embodiment, the specific implementation method is as follows:

[0090] Send the data operation entry to the target database according to the absolute expiration time information; execute the data operation entry through the target database to restore the target data corresponding to the data operation entry.

[0091] Specifically, the target database specifically refers to the database that performs the data recovery processing operation, and it needs to be restored to the set state according to the user's requirements. Based on this, after determining the absolute expiration time information, the data operation entry can be sent to the target database according to the absolute expiration time information; execute the data operation entry through the target database to realize the restoration of the target data corresponding to the data operation entry.

[0092] Continuing with the above example, after obtaining absttl in the above calculation, the original expiration information in the command can be replaced with absttl, and the command can be sent to the target database to enable the target database to continue executing the command at the restored time point and complete the backtracking after database rollback.

[0093] In summary, when performing data recovery processing on an instruction file, the instruction can be restored to the target database in combination with data operation entries to enable the target database to execute the instruction from the recovery time node and complete the global rollback.

[0094] In addition, considering that the data recovery request may be triggered by the user or automatically by the system, when it is determined that the data recovery request carries a data recovery identifier, steps S202 to S208 can be executed. In this embodiment, the specific implementation method is as follows:

[0095] Receive a data recovery request submitted for the file to be processed. When the data recovery request carries a data recovery identifier, execute the step of extracting the target time point information in the data recovery request; correspondingly, after the step of recovering the target data corresponding to the data operation entry according to the updated expiration time information, it further includes: adjusting the data recovery policy associated with the file to be processed and updating the policy status of the adjusted data recovery policy.

[0096] Specifically, the data recovery identifier specifically refers to: identification information indicating that the data recovery request is triggered by the system. Based on this, after receiving a data recovery request submitted for the file to be processed, if it is determined that the data recovery request carries a data recovery identifier, the step of extracting the target time point information in the data recovery request can be executed; and after data recovery processing, the data recovery policy associated with the file to be processed can be adjusted and the policy status of the adjusted data recovery policy can be updated.

[0097] That is to say, the data recovery processing operation can also be set at the database level of the structured data storage system, that is, the database itself recalculates the expiration time information. The data synchronization tool directly transmits the commands in the backup set to the database, and the database itself recalculates the expiration time of all keys according to the TimeShift configuration information, and the same effect can also be achieved at this time. However, considering the database structure characteristics, it can be set that the database senses the source of the current data recovery request, and the sensing method can be achieved by detecting the data recovery identifier. In addition, combined with the bandwidth-saving feature of the data synchronization tool, it can be detected in advance on the data synchronization tool whether the key has expired, and the expired key can be selected not to be sent to the database, so as to achieve the purpose of saving bandwidth and CPU.

[0098] In summary, by combining the data recovery identifier for status adjustment, the purpose of saving bandwidth and computing resources can be achieved, thereby effectively improving the flexibility of data recovery processing operations.

[0099] In addition, considering that the file to be processed contains both an operation file and an instruction file, when performing recovery processing, it is necessary to process them sequentially to respond to the data recovery request. Therefore, the instruction file can be processed after the operation file. In this embodiment, the specific implementation method is as follows:

[0100] Select a target data file from the file to be processed, and determine a data operation entry containing expiration time information in the target data file; correspondingly, after the step of recovering the target data corresponding to the data operation entry according to the updated expiration time information, it further includes: when the target data file meets the processing end condition, select a target instruction file from the file to be processed, determine a data operation entry containing expiration time information in the target instruction file, and execute the step of calculating the remaining time information of the data operation entry according to the expiration time information and the target time point information; until the target instruction file meets the processing end condition, feedback data recovery end information in response to the data recovery request.

[0101] Specifically, the target data file specifically refers to an RDB file; the target instruction file specifically refers to an AOF file; correspondingly, the processing end condition specifically refers to the condition of detecting whether there are unprocessed data operation entries in the target data file or the target instruction file.

[0102] Based on this, first select a target data file from the file to be processed, secondly, determine a data operation entry containing expiration time information in the target data file, and then calculate the remaining time information of the data operation entry according to the expiration time information and the target time point information; and update the expiration time information based on the remaining time information, and recover the target data corresponding to the data operation entry according to the updated expiration time information. After the processing of this data operation entry is completed, it will be detected whether the target data file meets the processing end condition. If not, the above operations will be repeated; until all the data operation directories in the target data file are processed, the target instruction file can be selected from the file to be processed again, secondly, determine a data operation entry containing expiration time information in the target instruction file, and then calculate the remaining time information of the data operation entry according to the expiration time information and the target time point information; and update the expiration time information based on the remaining time information, and recover the target data corresponding to the data operation entry according to the updated expiration time information. Until all the data operation entries contained in the target instruction file are processed, the PITR processing process is completed.

[0103] The data recovery method provided in the specification, in order to be able to recalculate the expiration time information of data operation entries containing expiration time information and achieve the restoration of the target data corresponding to the data operation entries when there is a need, can, after receiving a data recovery request submitted for a file to be processed, extract the target time point information from the data recovery request, and at the same time determine the data operation entries containing expiration time information in the file to be processed; thereafter, the remaining time information corresponding to the data operation entries can be calculated by combining the expiration time information and the target time point information, so as to update the corresponding expiration time information by combining the remaining time information, and achieve positioning the expiration time information after restoring the data, and then the target data corresponding to the data operation entries can be restored according to the updated expiration time information, which is more convenient for users to flexibly control the expiration time information of data operation entries in the file to be processed and ensure the correctness of the corresponding business service logic.

[0104] The following combines the attached Figure 4 , taking the application of the data recovery method provided in this specification in the database operation scenario as an example, further illustrate the data recovery method. Among them, Figure 4 shows the processing process flowchart of a data recovery method provided by an embodiment of this specification, which specifically includes the following steps.

[0105] Step S402, receive a data recovery request submitted for a file to be processed, and extract the target time point information in the data recovery request.

[0106] Step S404, select a data file in the file to be processed, and extract at least one initial data operation entry from the data file.

[0107] Step S406, traverse at least one initial data operation entry, and select the initial operation entry containing expiration time information according to the traversal result as the data operation entry.

[0108] Step S408, calculate the first time difference between the expiration time information and the target time point information.

[0109] Step S410, determine the remaining time information of the data operation entry according to the first time difference.

[0110] Step S412, when the remaining time information is less than or equal to the first time threshold, update the expiration time information based on the remaining time information.

[0111] Step S414, determine the target expiration time information according to the updated expiration time information, and read the data identification information in the data operation entry according to the target expiration time information.

[0112] Step S416: Read the target data based on the data identification information and perform recovery processing on the target data.

[0113] Step S418: When the data operation entry is the last data operation entry of the data file, select the instruction file in the file to be processed.

[0114] Step S420: Determine the data operation entry containing the expiration time information in the instruction file and calculate the second time difference between the expiration time information and the target time point information.

[0115] Step S422: When the second time difference is greater than the second time threshold, calculate the absolute expiration time information based on the current time point information and the second time difference as the remaining time information of the data operation entry.

[0116] Step S424: Replace the expiration time information with the absolute expiration time information and recover the target data corresponding to the data operation entry according to the absolute expiration time information.

[0117] In summary, in order to be able to recalculate the expiration time information of the data operation entry containing the expiration time information and realize the recovery of the target data corresponding to the data operation entry when there is a need, after receiving the data recovery request submitted for the file to be processed, the target time point information can be extracted from the data recovery request, and at the same time, the data operation entry containing the expiration time information can be determined in the file to be processed; thereafter, the remaining time information corresponding to the data operation entry can be calculated by combining the expiration time information and the target time point information, so as to update the corresponding expiration time information by combining the remaining time information, and realize positioning the expiration time information after data recovery, and then the target data corresponding to the data operation entry can be recovered according to the updated expiration time information, which is more convenient for users to flexibly control the expiration time information of the data operation entry in the file to be processed and ensure the correctness of the corresponding business service logic.

[0118] Corresponding to the above method embodiment, this specification also provides an embodiment of a data recovery device. Figure 5 The structure diagram of a data recovery device provided by an embodiment of this specification is shown. As Figure 5 shown, the device includes:

[0119] A receiving module 502, configured to receive a data recovery request submitted for the file to be processed and extract the target time point information in the data recovery request;

[0120] A determining module 504, configured to determine the data operation entry containing the expiration time information in the file to be processed;

[0121] A calculation module 506, configured to calculate remaining time information of the data operation entry according to the expiration time information and the target time point information;

[0122] An update module 508, configured to update the expiration time information based on the remaining time information, and restore the target data corresponding to the data operation entry according to the updated expiration time information.

[0123] In an optional embodiment, the receiving module 502 is further configured to:

[0124] Parse the data recovery request to obtain a request configuration file; extract recovery time point information and selection time point information from the request configuration file, where the selection time point information is used to determine an update policy for the expiration time information; when the recovery time point information is the same as the selection time point information, select the recovery time point information as the target time point information; when the recovery time point information is different from the selection time point information, select the selection time point information as the target time point information.

[0125] In an optional embodiment, the determining module 504 is further configured to:

[0126] Determine space occupancy information of the file to be processed, and detect whether the space occupancy information meets a data recovery condition; if so, select a data file from the file to be processed, and determine a data operation entry including expiration time information in the data file; if not, select an instruction file from the file to be processed, and determine a data operation entry including expiration time information in the instruction file.

[0127] In an optional embodiment, the calculation module 506 is further configured to:

[0128] Extract at least one initial data operation entry from the data file; traverse the at least one initial data operation entry, and select an initial operation entry including expiration time information according to the traversal result as the data operation entry.

[0129] In an optional embodiment, the update module 508 is further configured to:

[0130] Determine target expiration time information according to the updated expiration time information; when the current time information does not exceed the target expiration time information, read data identification information in the data operation entry; read the target data based on the data identification information, and perform a recovery process on the target data.

[0131] In an alternative embodiment, when the data file is selected from the file to be processed, the computing module 506 is further configured to:

[0132] Calculate a first time difference between the expiration time information and the target time point information; determine remaining time information of the data operation entry according to the first time difference; correspondingly, updating the expiration time information based on the remaining time information includes: when the remaining time information is less than or equal to a first time threshold, performing the step of updating the expiration time information based on the remaining time information.

[0133] In an alternative embodiment, when an instruction file is selected from the file to be processed, the computing module 506 is further configured to:

[0134] Calculate a second time difference between the expiration time information and the target time point information; when the second time difference is greater than a second time threshold, calculate absolute expiration time information according to the current time point information and the second time difference, and use the absolute expiration time information as the remaining time information of the data operation entry; correspondingly, updating the expiration time information based on the remaining time information includes: using the absolute expiration time information to replace the expiration time information as an update to the expiration time information.

[0135] In an alternative embodiment, the updating module 508 is further configured to:

[0136] Send the data operation entry to a target database according to the absolute expiration time information; execute the data operation entry through the target database to restore target data corresponding to the data operation entry.

[0137] In an alternative embodiment, the determining module 504 is further configured to:

[0138] Select a target data file from the file to be processed, and determine a data operation entry including expiration time information in the target data file;

[0139] Correspondingly, the apparatus further includes:

[0140] A feedback module, configured to, when the target data file meets a processing end condition, select a target instruction file from the file to be processed, determine a data operation entry including expiration time information in the target instruction file, and perform the step of calculating remaining time information of the data operation entry according to the expiration time information and the target time point information; until the target instruction file meets the processing end condition, feedback data recovery end information in response to the data recovery request.

[0141] In an alternative embodiment, the receiving module 502 is further configured to:

[0142] Receive a data recovery request submitted for the file to be processed, and perform the step of extracting the target time point information in the data recovery request when the data recovery request carries a data recovery identifier;

[0143] Correspondingly, the apparatus further includes:

[0144] An adjustment module, configured to adjust the data recovery policy associated with the file to be processed and update the policy state of the adjusted data recovery policy.

[0145] The data recovery apparatus provided in this specification, in order to be able to recalculate the expiration time information of the data operation entry containing the expiration time information and realize the recovery of the target data corresponding to the data operation entry when there is a need, can extract the target time point information from the data recovery request after receiving the data recovery request submitted for the file to be processed, and at the same time determine the data operation entry containing the expiration time information in the file to be processed; thereafter, the remaining time information corresponding to the data operation entry can be calculated by combining the expiration time information and the target time point information, so as to update the corresponding expiration time information by combining the remaining time information, and realize positioning the expiration time information after data recovery, and then the target data corresponding to the data operation entry can be recovered according to the updated expiration time information, which is more convenient for the user to flexibly control the expiration time information of the data operation entries in the file to be processed and ensure the correctness of the corresponding service logic.

[0146] The above is a schematic solution of a data recovery apparatus in this embodiment. It should be noted that the technical solution of this data recovery apparatus and the technical solution of the above data recovery method belong to the same concept. For the details not described in detail in the technical solution of the data recovery apparatus, reference can be made to the description of the technical solution of the above data recovery method.

[0147] An embodiment of this specification further provides a data recovery system, which includes a data management unit and a database; the data management unit is used to store and execute system executable instructions, and the database is used to store data associated with the system executable instructions. When the system executable instructions are executed by the data management unit, the following steps are implemented:

[0148] Receive a data recovery request submitted for a file to be processed, and extract the target time point information in the data recovery request; determine a data operation entry containing expiration time information in the file to be processed; calculate the remaining time information of the data operation entry according to the expiration time information and the target time point information; update the expiration time information based on the remaining time information, and recover the target data corresponding to the data operation entry according to the updated expiration time information.

[0149] The above is a schematic solution of a data recovery system according to this embodiment. It should be noted that the technical solution of this data recovery system and the technical solution of the above data recovery method belong to the same concept. For the details not described in the technical solution of the data recovery system, reference can be made to the description of the technical solution of the above data recovery method.

[0150] Figure 6 FIG. shows a structural block diagram of a computing device 600 according to an embodiment of the present specification. The components of the computing device 600 include, but are not limited to, a memory 610 and a processor 620. The processor 620 is connected to the memory 610 through a bus 630, and a database 650 is used to store data.

[0151] The computing device 600 further includes an access device 640, which enables the computing device 600 to communicate via one or more networks 660. Examples of these networks include the Public Switched Telephone Network (PSTN), Local Area Network (LAN), Wide Area Network (WAN), Personal Area Network (PAN), or a combination of communication networks such as the Internet. The access device 640 may include one or more of any type of wired or wireless network interfaces (e.g., Network Interface Card (NIC)), such as IEEE802.11 Wireless Local Area Network (WLAN) wireless interface, Worldwide Interoperability for Microwave Access (Wi-MAX) interface, Ethernet interface, Universal Serial Bus (USB) interface, cellular network interface, Bluetooth interface, Near Field Communication (NFC) interface, and so on.

[0152] In an embodiment of the present specification, the above components of the computing device 600 and Figure 6 other components not shown in the figure may also be connected to each other, for example, through a bus. It should be understood that Figure 6 the shown structural block diagram of the computing device is only for illustrative purposes and is not a limitation on the scope of the present specification. Those skilled in the art can add or replace other components as needed.

[0153] The computing device 600 can be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., a tablet computer, a personal digital assistant, a laptop computer, a notebook computer, a netbook, etc.), a mobile phone (e.g., a smart phone), a wearable computing device (e.g., a smart watch, smart glasses, etc.) or other types of mobile devices, or a stationary computing device such as a desktop computer or a PC. The computing device 600 can also be a mobile or stationary server.

[0154] Wherein, the processor 620 is used to execute the following computer-executable instructions, and when the computer-executable instructions are executed by the processor, the following steps are implemented:

[0155] Receiving a data recovery request submitted for a file to be processed, and extracting the target time point information in the data recovery request; determining a data operation entry including expiration time information in the file to be processed; calculating the remaining time information of the data operation entry according to the expiration time information and the target time point information; updating the expiration time information based on the remaining time information, and recovering the target data corresponding to the data operation entry according to the updated expiration time information.

[0156] The above is a schematic solution of a computing device according to this embodiment. It should be noted that the technical solution of the computing device and the technical solution of the above data recovery method belong to the same concept. For the details not described in detail in the technical solution of the computing device, reference can be made to the description of the technical solution of the above data recovery method.

[0157] An embodiment of this specification also provides a computer-readable storage medium, which stores computer-executable instructions, and when the computer-executable instructions are executed by a processor, the following steps are implemented:

[0158] Receiving a data recovery request submitted for a file to be processed, and extracting the target time point information in the data recovery request; determining a data operation entry including expiration time information in the file to be processed; calculating the remaining time information of the data operation entry according to the expiration time information and the target time point information; updating the expiration time information based on the remaining time information, and recovering the target data corresponding to the data operation entry according to the updated expiration time information.

[0159] The above is a schematic solution of a computer-readable storage medium according to this embodiment. It should be noted that the technical solution of the storage medium and the technical solution of the above data recovery method belong to the same concept. For the details not described in detail in the technical solution of the storage medium, reference can be made to the description of the technical solution of the above data recovery method.

[0160] An embodiment of this specification also provides a computer program. When the computer program is executed on a computer, the computer is made to execute the following steps:

[0161] Receive a data recovery request submitted for a file to be processed, and extract the target time point information in the data recovery request; determine the data operation entries containing expiration time information in the file to be processed; calculate the remaining time information of the data operation entries according to the expiration time information and the target time point information; update the expiration time information based on the remaining time information, and recover the target data corresponding to the data operation entries according to the updated expiration time information.

[0162] The above is a schematic solution of a computer program in this embodiment. It should be noted that the technical solution of this computer program and the technical solution of the above data recovery method belong to the same concept. For the details not described in detail in the technical solution of the computer program, reference can be made to the description of the technical solution of the above data recovery method.

[0163] The above describes specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in a different order than in the embodiments and still achieve the desired result. Additionally, the processes depicted in the figures do not necessarily require the particular order or sequential order shown to achieve the desired result. In certain embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0164] The computer instructions include computer program code, and the computer program code may be in the form of source code, object code, executable file, or some intermediate form, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disc, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electrical carrier signal, telecommunication signal, and software distribution medium, etc. It should be noted that the content included in the computer-readable medium may be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, the computer-readable medium does not include electrical carrier signals and telecommunication signals.

[0165] It should be noted that, for the foregoing method embodiments, for the sake of simplicity of description, they are all expressed as a series of action combinations. However, those skilled in the art should know that the embodiments of this specification are not limited by the described action sequence, because according to the embodiments of this specification, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily essential to the embodiments of this specification.

[0166] In the above embodiments, the descriptions of each embodiment have their own emphases. For the parts not detailed in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0167] The preferred embodiments of this specification disclosed above are only used to help explain this specification. The alternative embodiments do not elaborate on all details and do not limit the invention to the specific embodiments described. Obviously, many modifications and variations can be made according to the content of the embodiments of this specification. This specification selects and specifically describes these embodiments to better explain the principles and practical applications of the embodiments of this specification, so that those skilled in the art can well understand and utilize this specification. This specification is only limited by the claims and their full scope and equivalents.

Claims

1. A data recovery method, comprising: receiving a data recovery request submitted for a file to be processed, and extracting target time point information in the data recovery request; determining, in the file to be processed, a data operation entry containing expiration time information; calculating remaining time information of the data operation entry according to the expiration time information and the target time point information; updating the expiration time information based on the remaining time information, and recovering target data corresponding to the data operation entry according to the updated expiration time information; The determining, in the file to be processed, a data operation entry containing expiration time information includes: selecting a target data file in the file to be processed, and determining, in the target data file, a data operation entry containing expiration time information; Correspondingly, after the step of recovering the target data corresponding to the data operation entry according to the updated expiration time information, further comprising: when the target data file meets the processing end condition, selecting a target instruction file in the file to be processed, determining, in the target instruction file, a data operation entry containing expiration time information, and performing the step of calculating remaining time information of the data operation entry according to the expiration time information and the target time point information; until the target instruction file meets the processing end condition, feeding back data recovery end information in response to the data recovery request.

2. The method according to claim 1, wherein the extracting target time point information in the data recovery request comprises: parsing the data recovery request to obtain a request configuration file; extracting recovery time point information and selection time point information in the request configuration file, wherein the selection time point information is used to determine an update policy for the expiration time information; when the recovery time point information is the same as the selection time point information, selecting the recovery time point information as the target time point information; when the recovery time point information is different from the selection time point information, selecting the selection time point information as the target time point information.

3. The method according to claim 1, wherein the determining, in the file to be processed, a data operation entry containing expiration time information comprises: determining space occupancy information of the file to be processed, and detecting whether the space occupancy information meets the data recovery condition; if so, selecting a data file in the file to be processed, and determining, in the data file, a data operation entry containing expiration time information; if not, selecting an instruction file in the file to be processed, and determining, in the instruction file, a data operation entry containing expiration time information.

4. The method according to claim 3, wherein the determining, in the data file, a data operation entry containing expiration time information comprises: extracting at least one initial data operation entry in the data file; traversing the at least one initial data operation entry, and selecting, according to the traversal result, an initial operation entry containing expiration time information as the data operation entry.

5. The method according to claim 1, wherein restoring the target data corresponding to the data operation entry according to the updated expiration time information comprises: determining target expiration time information according to the updated expiration time information; reading data identification information from the data operation entry when the current time information does not exceed the target expiration time information; reading the target data based on the data identification information and performing a restoration process on the target data.

6. The method according to claim 3, when selecting the data file in the file to be processed, calculating remaining time information of the data operation entry according to the expiration time information and the target time point information comprises: calculating a first time difference between the expiration time information and the target time point information; determining the remaining time information of the data operation entry according to the first time difference; Correspondingly, updating the expiration time information based on the remaining time information comprises: performing the step of updating the expiration time information based on the remaining time information when the remaining time information is less than or equal to a first time threshold.

7. The method according to claim 3, when selecting an instruction file in the file to be processed, calculating remaining time information of the data operation entry according to the expiration time information and the target time point information comprises: calculating a second time difference between the expiration time information and the target time point information; when the second time difference is greater than a second time threshold, calculating absolute expiration time information according to the current time point information and the second time difference as the remaining time information of the data operation entry; Correspondingly, updating the expiration time information based on the remaining time information comprises: using the absolute expiration time information to replace the expiration time information as an update to the expiration time information.

8. The method according to claim 7, wherein restoring the target data corresponding to the data operation entry according to the updated expiration time information comprises: sending the data operation entry to a target database according to the absolute expiration time information; executing the data operation entry through the target database to restore the target data corresponding to the data operation entry.

9. The method according to claim 1, wherein receiving a data restoration request submitted for a file to be processed comprises: receiving a data restoration request submitted for the file to be processed, and performing the step of extracting the target time point information from the data restoration request when the data restoration request carries a data restoration identifier; Correspondingly, after the step of restoring the target data corresponding to the data operation entry according to the updated expiration time information is executed further comprises: adjusting the data restoration policy associated with the file to be processed and updating the policy status of the adjusted data restoration policy.

10. A data restoration apparatus comprises: a receiving module configured to receive a data restoration request submitted for a file to be processed and extract the target time point information from the data restoration request; A determination module, configured to determine a data operation entry containing expiration time information in the file to be processed; A calculation module, configured to calculate remaining time information of the data operation entry according to the expiration time information and the target time point information; An update module, configured to update the expiration time information based on the remaining time information, and restore target data corresponding to the data operation entry according to the updated expiration time information; The determination module is further configured to select a target data file in the file to be processed, and determine a data operation entry containing expiration time information in the target data file; Correspondingly, the apparatus further includes: A feedback module, configured to, when the target data file meets the processing end condition, select a target instruction file in the file to be processed, determine a data operation entry containing expiration time information in the target instruction file, and perform the step of calculating remaining time information of the data operation entry according to the expiration time information and the target time point information; until when the target instruction file meets the processing end condition, feedback data recovery end information in response to the data recovery request.

11. A data recovery system, including: A data management unit and a database; The data management unit is used to store and execute system executable instructions, and the database is used to store data associated with the system executable instructions. When the system executable instructions are executed by the data management unit, the steps of the method according to any one of claims 1 to 9 are implemented, and the restored data is stored through the database.

12. A computing device, including: A memory and a processor; The memory is used to store computer executable instructions, and the processor is used to execute the computer executable instructions. When the computer executable instructions are executed by the processor, the steps of the method according to any one of claims 1 to 9 are implemented.

13. A computer-readable storage medium, which stores computer executable instructions. When the computer executable instructions are executed by a processor, the steps of the method according to any one of claims 1 to 9 are implemented.

Citation Information

Patent Citations

  • Data recovery method and device

    CN106844102A

  • Data recovery method and device based on Redis, equipment and medium

    CN112486732A