Data recovery method, device, electronic device, storage medium and program product

By setting priority and update operations in a distributed database cluster, we ensure that the backup file is downloaded successfully at similar times, solving the problem of downloading time and resource waste caused by the distribution of backup file copy, and improving data recovery efficiency and file version accuracy.

CN117931830BActive Publication Date: 2025-08-26PINGCAP XINGCHEN (BEIJING) TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202410339704.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-03-22
Publication Date
2025-08-26
Estimated Expiration
2044-03-22

AI Technical Summary

Technical Problem

In the prior art, the distributed database cluster is distributed in different nodes during the data recovery process, which causes a long time to download and waste of resources, which affects the data recovery efficiency.

Method used

By determining the backup file information of the data to be restored, setting priority, performing priority update operations, determining priority based on the number of database nodes, ensuring that the backup file is downloaded successfully at a similar time, and ensuring that the file version is correct in the download queue.

Benefits of technology

It effectively improves the efficiency of backup file download, reduces time-consuming data recovery, avoids resource waste, and ensures the correctness of file version.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117931830B_ABST
    Figure CN117931830B_ABST
Patent Text Reader

Abstract

The embodiments of the present disclosure provide a data recovery method, device, electronic device, computer-readable storage medium, and computer program product, which relate to the field of database recovery technology. The method comprises: obtaining at least one backup file information corresponding to at least one backup file of the data to be recovered, the backup file information including the storage location of the corresponding backup file and at least one database node, performing at least one priority update operation for each backup file until each backup file is successfully downloaded to the corresponding database node, and sending a recovery request to at least one database node of each backup file to recover the data to be recovered. The embodiments of the present disclosure set a priority for each backup file of the data to be recovered, so that the download operation time of each backup file on different database nodes is similar, and data recovery is completed as soon as possible, which can effectively reduce the time consumed for data recovery.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the technical field of database recovery, and in particular to a data recovery method, device, electronic device, storage medium, and program product. Background Art

[0002] With the increasing application of next-generation information technologies such as cloud computing and big data in information technology, data volumes are constantly expanding, leading to the widespread use of distributed databases. When using distributed database clusters to store data, data backup is required to ensure data reliability. In the event of abnormal situations such as node failures or data corruption in the distributed database cluster, data recovery from the backup data is required.

[0003] In the existing technology, during the data recovery process, it is necessary to download the backup file on each database node and then perform data recovery. Since there are a large number of backup files and the copies of the backup files are distributed on different nodes, it is necessary to wait until all the backup file copies are successfully downloaded before data recovery can be performed, which easily causes a waste of resources and makes data recovery take a long time. Summary of the Invention

[0004] The embodiments of the present disclosure provide a data recovery method, device, electronic device, computer-readable storage medium, and computer program product, which aim to solve the technical problems that downloading a large number of backup files and their copies takes a long time, wastes resources, and data recovery takes a long time.

[0005] In a first aspect, a data recovery method is provided, the method comprising:

[0006] Obtaining at least one backup file information corresponding to at least one backup file of the data to be restored; the backup file information includes a storage location of the corresponding backup file and at least one database node;

[0007] For each backup file, perform at least one priority update operation until each backup file is successfully downloaded to the corresponding database node, and send a recovery request to at least one database node of each backup file to recover the data to be recovered;

[0008] Priority update operations include:

[0009] Determine a first number of database nodes corresponding to a current sub-priority update operation for each backup file;

[0010] determining the priority of each backup file based on the first quantity corresponding to each backup file; the database node of the backup file is negatively correlated with the priority of the backup file;

[0011] The backup file with the highest priority is used as the target backup file, so that each database node downloads the target backup file from the storage location of the target backup file; feedback information of each database node for the target backup file is received; and based on the feedback information, a first number of database nodes of the target backup file is updated.

[0012] Optionally, updating the first number of database nodes of the target backup file based on the feedback information includes:

[0013] If the feedback information indicates that the download is successful, updating the first number of database nodes of the target backup file corresponding to the feedback information;

[0014] The method also includes:

[0015] If the feedback information indicates that the download fails, the backup file information of the target backup file corresponding to the feedback information is updated.

[0016] Optionally, the method further includes:

[0017] generating a data download queue based on a first number of each database node;

[0018] If the feedback information indicates that the download failed, the backup file information of the target backup file corresponding to the feedback information is updated, and the following is also included:

[0019] If the feedback information indicates that the download has failed, then the backup file information of the target backup file corresponding to the feedback information is updated;

[0020] Based on the updated backup file information, the target backup file is added back to the data download queue.

[0021] Optionally, use the backup file with the highest priority as the target backup file, including:

[0022] Use the backup file with the highest priority as the first backup file;

[0023] Performing at least one judgment operation on the first backup file until a preset end condition is satisfied, and using the first backup file that satisfies the preset end condition as the target backup file; the preset end condition is that the first comparison result and the second comparison result are both the same;

[0024] The judgment operations include:

[0025] Determine version information of the first backup file and a priority of the first backup file;

[0026] Compare the version information with the reference version information in the file status information to obtain a first comparison result; compare the priority with the reference priority in the file status information to obtain a second comparison result;

[0027] If at least one of the first comparison result and the second comparison result is different, the second backup file with the highest priority except the first backup file is used as the first backup file corresponding to the next judgment operation.

[0028] Optionally, the method further includes:

[0029] If the feedback information is download failure, update the version information of the target backup file.

[0030] Optionally, before performing at least one priority update operation, the following steps are further included:

[0031] The priority of at least one backup file corresponding to the first priority update operation is set to the lowest priority.

[0032] Optionally, sending a restore request to at least one database node of each backup file includes:

[0033] determining a primary database node from at least one database node;

[0034] A recovery request is sent to the primary database node, so that the primary database node synchronizes the recovery request to each database node except the primary database node.

[0035] In a second aspect, a data recovery device is provided, the device comprising:

[0036] An information acquisition module, configured to acquire at least one backup file information corresponding to at least one backup file of the data to be restored; the backup file information includes a storage location of the corresponding backup file and at least one database node;

[0037] A data recovery module is configured to perform at least one priority update operation on each backup file until each backup file is successfully downloaded to the corresponding database node, and to send a recovery request to at least one database node of each backup file to recover the data to be recovered;

[0038] Priority update operations include:

[0039] Determine a first number of database nodes corresponding to a current sub-priority update operation for each backup file;

[0040] determining the priority of each backup file based on the first quantity corresponding to each backup file; the database node of the backup file is negatively correlated with the priority of the backup file;

[0041] The backup file with the highest priority is used as the target backup file, so that each database node downloads the target backup file from the storage location of the target backup file; feedback information of each database node for the target backup file is received; and based on the feedback information, a first number of database nodes of the target backup file is updated.

[0042] According to a third aspect, an electronic device is provided, comprising:

[0043] A memory, a processor, and a computer program stored in the memory, characterized in that the processor executes the computer program to implement the steps of any method in the first aspect of the present disclosure.

[0044] In a fourth aspect, a computer-readable storage medium is provided, on which a computer program is stored, characterized in that when the computer program is executed by a processor, the data recovery method shown in any one of the first aspects of the present disclosure is implemented.

[0045] In a fifth aspect, a computer program product is provided, comprising a computer program, characterized in that when the computer program is executed by a processor, the steps of any one of the methods in the first aspect of the present disclosure are implemented.

[0046] The technical solutions provided by the embodiments of the present disclosure have the following beneficial effects:

[0047] The functional testing method provided by the present invention determines the backup file information corresponding to each backup file of the data to be restored, thereby determining the database nodes where each backup file is located, setting a priority for each backup file, performing at least one priority update operation, and determining the priority based on a first number of database nodes of the backup file to be downloaded. There is a negative correlation between the database nodes of the backup file and the priority of the backup file. When a database node successfully downloads the backup file, the first number is modified and the priority is updated, so that all backup files corresponding to the data to be restored are successfully downloaded at a similar time, so that the data to be restored can be restored as soon as possible, which can effectively improve the backup file download efficiency and effectively reduce the time spent on data recovery.

[0048] Furthermore, a data download queue is generated based on the first number of database nodes corresponding to each backup file. When the backup file with the highest priority is determined to enter the download queue based on the priority, the version information corresponding to each backup file is determined, and the version information and priority are compared with the reference version information and reference priority in the file status information to determine whether to use the file as the target backup file and add it to the download queue. This can ensure that the downloaded file version is correct, avoid wasting time downloading the wrong file version, reduce resource waste, and improve data recovery efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0049] In order to more clearly illustrate the technical solutions in the embodiments of the present disclosure, the following briefly introduces the drawings required for describing the embodiments of the present disclosure.

[0050] Figure 1 A schematic diagram of an application scenario of a data recovery method provided by an embodiment of the present disclosure;

[0051] Figure 2 A flowchart of a data recovery method provided by an embodiment of the present disclosure;

[0052] Figure 3 A flowchart of a data recovery method according to an embodiment of the present invention;

[0053] Figure 4 A schematic diagram of a flow chart of a priority update operation in a data recovery method provided in an embodiment of the present disclosure;

[0054] Figure 5 A flowchart illustrating an example of a data recovery method provided in an embodiment of the present disclosure;

[0055] Figure 6 A schematic diagram of the structure of a data recovery device provided in an embodiment of the present disclosure;

[0056] Figure 7 A schematic structural diagram of an electronic device to which a data recovery method provided in an embodiment of the present disclosure is applicable. DETAILED DESCRIPTION

[0057] The following describes embodiments of the present disclosure in conjunction with the accompanying drawings. It should be understood that the embodiments described below in conjunction with the accompanying drawings are exemplary descriptions for explaining the technical solutions of the embodiments of the present disclosure and do not constitute a limitation on the technical solutions of the embodiments of the present disclosure.

[0058] Those skilled in the art will understand that, unless otherwise stated, the singular forms "a", "an", "said", and "the" used herein may also include plural forms. It should be further understood that the terms "including" and "comprising" used in the embodiments of the present disclosure mean that the corresponding features can be implemented as the presented features, information, data, steps, operations, elements and / or components, but do not exclude implementation as other features, information, data, steps, operations, elements, components and / or combinations thereof supported by the present technical field. It should be understood that when we say that an element is "connected" or "coupled" to another element, the element can be directly connected or coupled to the other element, or it can refer to the establishment of a connection relationship between the element and the other element through an intermediate element. In addition, the "connection" or "coupling" used here can include wireless connection or wireless coupling. The terms "or", "and / or", "including at least one of the following", etc. used in the present disclosure can be interpreted as inclusive, or mean any one or any combination. For example, "including at least one of the following: A, B, C" means "any one of the following: A; B; C; A and B; A and C; B and C; A and B and C", and for another example, "A, B or C" or "A, B and / or C" means "any one of the following: A; B; C; A and B; A and C; B and C; A and B and C".

[0059] In order to make the objectives, technical solutions and advantages of the present disclosure more clear, the embodiments of the present disclosure will be further described in detail below with reference to the accompanying drawings.

[0060] First, the technical terms involved in this disclosure are introduced and explained:

[0061] Data recovery: In a distributed database system, when a node or multiple nodes fail or data is lost, in order to ensure data integrity and reliability, distributed database systems usually adopt some strategies and technologies to handle data recovery to ensure that the system can repair and recover data in a timely and effective manner when facing node failure or data loss.

[0062] Database node: refers to the physical or virtual entity responsible for storing and processing data in a distributed database system. In a distributed database system, there are usually multiple database nodes distributed on different servers or computers, which work together to provide data storage, retrieval and processing services.

[0063] In the prior art, during the data recovery process, it is necessary to download backup files on each database node and then perform data recovery. Since there are a large number of backup files and the copies of the backup files are distributed on different nodes, it is necessary to wait until all the copies of the backup files are successfully downloaded before data recovery can be performed. When the number of download tasks on a node is small, a long waiting time may occur, which may easily cause a waste of resources. If the time interval between downloading the copies of the same backup file is long, for example, the copies of the same file are downloaded on the same node, a lot of time will be wasted, resulting in a long data recovery time.

[0064] The data recovery method, device, electronic device, computer-readable storage medium, and computer program product provided in the present disclosure are intended to solve at least one of the above technical problems in the prior art.

[0065] In response to at least one of the above-mentioned technical problems or areas that need improvement in the relevant technologies, the present disclosure proposes a data recovery method, device, electronic device and computer storage medium. The data recovery method provided by this scheme determines the backup file information corresponding to each backup file of the data to be recovered, thereby determining the database nodes where each backup file is located, setting a priority for each backup file, performing at least one priority update operation, and determining the priority based on the first number of database nodes of the backup file to be downloaded. There is a negative correlation between the database node of the backup file and the priority of the backup file. When a database node successfully downloads the backup file, the first number is modified and the priority is updated, so that all backup files corresponding to the data to be recovered are successfully downloaded at a similar time, so that the data to be recovered can be recovered as soon as possible, which can effectively improve the backup file download efficiency and effectively reduce the time spent on data recovery.

[0066] Furthermore, a data download queue is generated based on the first number of database nodes corresponding to each backup file. When the backup file with the highest priority is determined to enter the download queue based on the priority, the version information corresponding to each backup file is determined, and the version information and priority are compared with the reference version information and reference priority in the file status information to determine whether to use the file as the target backup file and add it to the download queue. This can ensure that the downloaded file version is correct, avoid wasting time downloading the wrong file version, reduce resource waste, and improve data recovery efficiency.

[0067] The following describes several exemplary embodiments to illustrate the technical solutions of the embodiments of the present disclosure and the technical effects produced by the technical solutions of the present disclosure. It should be noted that the following embodiments can refer to, draw on, or combine with each other, and the same terms, similar features, and similar implementation steps in different embodiments will not be repeated.

[0068] Figure 1A schematic diagram of an application scenario of the functional testing method provided in an embodiment of the present disclosure, wherein the application environment may include a backup scheduling terminal 101 and at least one database node 102, the backup scheduling terminal and the database node are connected via a network, and the backup scheduling terminal can be implemented on a terminal or a server.

[0069] Specifically, the backup scheduling end 101 schedules the database node 102 corresponding to each backup file, and in a data recovery process, obtains the backup file information of at least one backup file for the data to be recovered. The backup file information includes the storage location of each backup file and at least one database node 102. For each backup file, at least one priority update operation is performed until each backup file is successfully downloaded to the corresponding database node 102, and a recovery request is sent to at least one database node 102 for each backup file to recover the data to be recovered.

[0070] The above application scenario is only an example and does not limit the application scenario of the functional testing method disclosed herein.

[0071] Those skilled in the art will appreciate that the terminal may be a smart phone (such as an Android phone, an iOS phone, etc.), a tablet computer, a laptop computer, a digital broadcast receiver, a MID (Mobile Internet Devices), a PDA (Personal Digital Assistant), a desktop computer, a smart home appliance, a vehicle-mounted terminal (such as a vehicle-mounted navigation terminal, a vehicle-mounted computer, etc.), a smart speaker, a smart watch, etc. The terminal and the server may be connected directly or indirectly via wired or wireless communication, but is not limited thereto.

[0072] The server may include a server equipped with a computer capable of processing database operations. The server may be an independent physical server, or a server cluster or distributed system composed of multiple physical servers. It may also be a cloud server or server cluster that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms. The embodiments of the present invention can be applied to various scenarios, including but not limited to cloud technology, artificial intelligence, smart transportation, assisted driving, etc. The specific requirements can also be determined based on the actual application scenario requirements and are not limited here.

[0073] In some possible implementations, taking the execution subject as the backup scheduling end as an example, the embodiment of the present disclosure provides a function testing method, such as Figure 2 As shown, the following steps may be included:

[0074] S201: Obtain at least one backup file information corresponding to at least one backup file of data to be restored.

[0075] The backup file information includes the storage location of the corresponding backup file and at least one database node.

[0076] Among them, the backup file type may include SST (Sorted String Table file) and other file types that can be used for database recovery; the database node may be a node of a distributed database, and the distributed database node may include a distributed transaction key-value storage engine node, a distributed key-value storage system node, a distributed database system node, and a non-relational database node, etc. The specific type is not limited in this solution.

[0077] Specifically, when there is data to be recovered that needs to be recovered, at least one backup file corresponding to the data to be recovered is determined, and the corresponding storage location and database node are obtained from the backup file information of each backup file. The storage location may include the location on the external storage where the corresponding backup file is located. The process of downloading the backup file can be regarded as the process of downloading the backup file from the external storage to the local corresponding database node. In this solution, the copies of the backup file on other database nodes are also called backup files, and the number of backup files can be determined based on the preset number of copies of the database cluster. Among them, the backup files can be stored through: NFS (Network File System) and S3 (Simple Storage Service) and other methods.

[0078] During the specific implementation process, before downloading each backup file of the data to be restored, the database cluster can be sharded according to the key range of the backup file corresponding to the data to be restored, where one backup file corresponds to at least one shard. Generally, one backup file corresponds to one shard. The number of shard copies is determined based on the preset number of copies of the cluster, and the copies of each shard will be randomly and evenly distributed on each database node.

[0079] For example, assuming that the preset number of replicas of the cluster is 3, the backup scheduling end will divide a shard from the database cluster for the backup file of the data to be restored, so that the key range of this shard includes the key range of this backup file. The shard can have two copies. The shard and the shard copies can be collectively referred to as 3 copies. The 3 copies correspond to the 3 backup files in this disclosure, and the 3 copies are on 3 different database nodes.

[0080] S202: Perform at least one priority update operation for each backup file until each backup file is successfully downloaded to the corresponding database node, and send a recovery request to at least one database node of each backup file to recover the data to be recovered.

[0081] Specifically, for each backup file, the corresponding database node downloads the backup file to the local node. Feedback information will be generated after each download. The feedback information is used to indicate whether the download on the database node is successful. If a database node successfully downloads the backup file, or a database node fails to download, a priority update operation is performed until all database nodes successfully download the backup file.

[0082] In the specific implementation process, Figure 3 As shown, before the backup scheduling end sends a recovery request, it is necessary to ensure that all database nodes have downloaded the specified backup file to the local area, and the backup file is in the shards and replicas of the database cluster. When the backup files are downloaded successfully, a recovery request is sent to restore the data to be restored. Since the resource utilization of the steps of downloading the backup file and restoring the data usually does not conflict, different files can be performed simultaneously (i.e., pipeline processing). Therefore, the present disclosure performs at least one priority update operation to make the time for downloading each backup file of the same data to be restored to the local area of ​​all database nodes as close as possible, thereby reducing the total time consumption of the recovery pipeline.

[0083] Priority update operations include:

[0084] (1) determining a first number of database nodes corresponding to the current sub-priority update operation for each backup file;

[0085] (2) determining the priority of each backup file based on the first quantity corresponding to each backup file;

[0086] (3) Using the backup file with the highest priority as the target backup file, so that each database node downloads the target backup file from the storage location of the target backup file; receiving feedback information from each database node regarding the target backup file; and updating the first number of database nodes of the target backup file based on the feedback information.

[0087] There is a negative correlation between the database node of the backup file and the priority of the backup file.

[0088] Specifically, determine the first number of database nodes corresponding to each backup file during the current priority update operation, where the first number can be the number of backup files that have not been downloaded or the number of database nodes that have not completed the download of backup files. Based on the first number, determine the priority of the corresponding backup file, determine the backup file with the highest priority as the target backup file, download the target backup file from the corresponding database node, obtain the download status returned by each database node, that is, feedback information, to update the first number corresponding to the unfinished target backup file, thereby modifying the priority corresponding to the target backup file.

[0089] For example, there is a negative correlation between the database nodes of the backup file and the priority of the backup file. The first number can be the number of database nodes of the backup file that has not been completed downloaded. The smaller the first number, the higher the priority. For example, the number of cluster copies is 3, and each backup file will have another 2 copies. The node where the 2 copies of a backup file A are located has completed the download, and the priority of the backup file is 1. The node where the 1 copy of another backup file B is located has completed the download, and the priority of the backup file is 2. Then it can be determined that the priority of backup file A is higher than that of backup file B.

[0090] In the specific implementation process, a download task selector can be set at the backup scheduling end to send a download request to each database node, so that each database node downloads the backup file based on the download request, such as Figure 4 As shown, the target backup file with the highest priority is selected from the priority queue, and the backup file information of the target backup file is sent to the download task selector, and the download task selector sends a download request to the three database nodes corresponding to the target backup file. When the backup file on any database node is downloaded, the download task selector can receive the corresponding feedback information, and modify the first quantity of each target backup file according to the feedback information, thereby modifying the priority corresponding to each target file. Among them, each database node can set a corresponding priority queue to modify the priority of each target file. Further, the priority queue of the database node corresponding to each target file can be modified, so that the target backup file and its copy of the same data to be restored can be downloaded at a similar time.

[0091] In some possible implementations, in the above method, updating the first number of database nodes of the target backup file based on the feedback information includes:

[0092] (1) If the feedback information indicates that the download is successful, the first number of the database node of the target backup file corresponding to the feedback information is updated;

[0093] The method also includes:

[0094] (2) If the feedback information indicates that the download has failed, the backup file information of the target backup file corresponding to the feedback information is updated.

[0095] The feedback information is used to indicate whether the corresponding database node successfully downloads the corresponding target backup file.

[0096] During the specific implementation process, the feedback information can generally include three situations: download error and the error cannot be retried, download error and the error can be retried, and download success. When the feedback information is download error and the error cannot be retried, the recovery process for the data to be recovered is terminated; when the feedback information is download error and the error can be retried, the backup file information of the target backup file corresponding to the feedback information is updated; when the feedback information is download success, the first number of the database node of the target backup file corresponding to the feedback information is updated to update the priority of the corresponding target backup file.

[0097] During the specific implementation process, if the feedback information is that the download is successful, the first quantity corresponding to the target backup file changes, and the download task selector in the backup scheduling end updates the priority of the backup file in the file status information. For each backup file of the same data to be restored, if the download status is in queue, the corresponding priority is modified, where the download status of the file can include: in queue, processing, and completed.

[0098] For example, if the current backup file is downloaded successfully and its original priority is p, then its current priority is p-1. The download status of the backup file on the current database node in the file status information is updated to completed, and the priority of each backup file for the same data to be restored is modified to p-1.

[0099] During the specific implementation process, when a download error occurs, it is necessary to determine whether the current download can be retried. The determination of whether to retry can be made based on the type of error and the preset retry rules. For example, if the error type is an external storage error, it can be retried; if the error type is a database node error, it cannot be retried. The determination of whether to retry can also be made based on the number of downloads that have been made. When the number of downloads is equal to or greater than the preset threshold, it is determined that it cannot be retried; when the number of downloads is less than the preset threshold, it is determined that it can be retried. When the download cannot be retried, an error reminder can be returned to the backup scheduling end, and the data recovery process can be stopped without further downloading the relevant backup files.

[0100] In some possible implementations, the above method further includes:

[0101] (1) generating a data download queue based on a first number of each database node;

[0102] If the feedback information indicates that the download failed, the backup file information of the target backup file corresponding to the feedback information is updated, and the following is also included:

[0103] (2) If the feedback information indicates that the download has failed, then the backup file information of the target backup file corresponding to the feedback information is updated;

[0104] (3) Based on the updated backup file information, the target backup file is added back to the data download queue.

[0105] Specifically, based on the first number of database nodes corresponding to the backup file, a data download queue is generated, and each database node can correspond to a download queue. When the feedback information of the target backup file is that the download failed and can be retried, the backup file information of the target backup file is updated. The backup file information includes the storage location of the target backup file and at least one corresponding database node, and then the corresponding target backup file can be re-downloaded based on the new backup file information. The backup file information is updated before re-downloading the target backup file. If there is data migration, it can be discovered and updated in time, so that the accuracy of the backup file download can be guaranteed.

[0106] During the specific implementation process, if the feedback information is that the download failed and the error can be retried, the download task selector in the backup scheduling end re-acquires the backup file and updates the version information of the backup file in the file status information. For each backup file of the same data to be restored, if the download status is in the queue, the target backup file will be added back to the data download queue.

[0107] In some possible implementations, the above method uses the backup file with the highest priority as the target backup file, including:

[0108] (1) Use the backup file with the highest priority as the first backup file;

[0109] (2) performing at least one judgment operation on the first backup file until a preset end condition is satisfied, and taking the first backup file that satisfies the preset end condition as the target backup file;

[0110] The judgment operations include:

[0111] (3) Determine the version information of the first backup file and the priority of the first backup file;

[0112] (4) Compare the version information with the reference version information in the file status information to obtain a first comparison result; compare the priority with the reference priority in the file status information to obtain a second comparison result;

[0113] (5) If at least one of the first comparison result and the second comparison result is different, the second backup file with the highest priority other than the first backup file is used as the first backup file corresponding to the next judgment operation.

[0114] The preset end condition is that the first comparison result and the second comparison result are the same.

[0115] The text status information includes information about all backup files in the database cluster, specifically including version information, priority, and download status information of each backup file.

[0116] Specifically, the first backup file with the highest priority is selected for judgment operation, and the priority and version information of the first backup file are obtained. If the version information of the backup file is the same as the reference version information of the backup file in the file status information, and the priority is the same as the priority of the backup file in the file status information, then the preset end condition is met, and the first backup file is used as the target backup file. If the preset end condition is not met, continue to select the backup file with the highest priority to continue judgment.

[0117] For example, determine the priority j and version information v of the backup file with the highest priority. If the version information v of the backup file is the same as the reference version information of the backup file in the file status information, and the priority j is the same as the priority of the backup file in the file status information, then the backup file will be used as the target backup file. If it is not satisfied, the backup file will be deemed expired and skipped to continue selecting the backup file with the highest priority.

[0118] In some possible implementations, the above method further includes:

[0119] (1) If the feedback information is download failure, update the version information of the target backup file.

[0120] Specifically, if the feedback information is that the download failed and the error can be retried, the version information of the backup file in the file status information is updated. The method of updating the backup file version information can be to add one to the version value, and the next time the target backup file is determined, it is determined based on the updated version information.

[0121] In some possible implementations, before performing at least one priority update operation in the above method, the method further includes:

[0122] (1) The priority of at least one backup file corresponding to the first priority update operation is set to the lowest priority.

[0123] Specifically, before the first priority update operation, the priority of at least one backup file is set to the lowest priority. Since the number of copies of the same database cluster is the same, the priority of all backup files is the same before the first priority update. When a successful download or other situations occur, the priority of other backup files of the data to be restored corresponding to the successfully downloaded backup file will be updated.

[0124] In the specific implementation process, the database node where each backup file is located is determined, and the backup files are added to the priority queue of the corresponding database node. If there are multiple backup files with the same priority, a priority queue can also be set, which can be a first-in-first-out queue.

[0125] During the specific implementation process, in order to prevent most requests from being sent to a few database nodes at a certain moment, causing some database nodes to be idle and wasting resources, before the first priority update operation, a preset number of file download requests can be set for each database node in advance. Through the priority mechanism, it is guaranteed that each database node has a sufficient number of download requests, avoiding resource waste and long-tail waiting.

[0126] In some possible implementations, the method of sending a restore request to at least one database node for each backup file includes:

[0127] (1) Determine a primary database node from at least one database node;

[0128] (2) Send a recovery request to the master database node so that the master database node synchronizes the recovery request to each database node except the master database node.

[0129] Specifically, the above synchronization operation can be implemented through a consistency algorithm. The backup scheduling end sends the recovery request to the primary database node, and the primary database node can synchronize the recovery request to each database node other than the primary database node based on the consensus algorithm. Among them, the consistency algorithm can include Paxos (Paxos algorithm), Raft (consensus algorithm), Byzantine fault tolerance algorithm, etc.

[0130] In the above embodiment, by determining the backup file information corresponding to each backup file of the data to be restored, the database nodes where each backup file is located are determined, a priority is set for each backup file, and at least one priority update operation is performed. The priority is determined based on the first number of database nodes of the backup file to be downloaded. There is a negative correlation between the database node of the backup file and the priority of the backup file. When a database node successfully downloads the backup file, the first number is modified and the priority is updated, so that all backup files corresponding to the data to be restored are successfully downloaded at a similar time, so that the data to be restored can be restored as soon as possible, which can effectively improve the efficiency of backup file downloading and effectively reduce the time spent on data recovery.

[0131] Furthermore, a data download queue is generated based on the first number of database nodes corresponding to each backup file. When the backup file with the highest priority is determined to enter the download queue based on the priority, the version information corresponding to each backup file is determined, and the version information and priority are compared with the reference version information and reference priority in the file status information to determine whether to use the file as the target backup file and add it to the download queue. This can ensure that the downloaded file version is correct, avoid wasting time downloading the wrong file version, reduce resource waste, and improve data recovery efficiency.

[0132] In one example, the functional testing method of the present disclosure, such as Figure 5 As shown, this may include:

[0133] The backup scheduling end obtains at least one backup file information corresponding to at least one backup file of the data to be restored, and obtains the storage location of each backup file and the corresponding at least one database node;

[0134] For each backup file, perform at least one priority update operation until each backup file is successfully downloaded to the corresponding database node. After all backup files are successfully downloaded, determine the primary database node from at least one database node, and send a recovery request to the primary database node by the recovery task selector, so that the primary database node synchronizes the recovery request to each database node except the primary database node to recover the data to be recovered;

[0135] The priority update operations include:

[0136] Determine a first number of database nodes corresponding to a current sub-priority update operation of each backup file, determine a priority of each backup file, and generate a priority queue corresponding to each database node;

[0137] The backup file with the highest priority (i.e., priority 0 as shown in the figure) is used as the first backup file; at least one judgment operation is performed on the first backup file until a preset end condition is satisfied, and the first backup file that satisfies the preset end condition is used as the target backup file (i.e., backup file 1 as shown in the figure); the backup file information of the target backup file is sent to the download task selector, so that the download task selector sends a download request to each database node to download the target backup file from the storage location of the target backup file;

[0138] Receive feedback information from each database node for the target backup file; if the feedback information indicates that the download is successful, update the first number of the database node of the target backup file corresponding to the feedback information; if the feedback information indicates that the download fails, update the backup file information and version information of the target backup file corresponding to the feedback information, and based on the updated backup file information, re-add the target backup file to the data download queue of the corresponding database node.

[0139] The above-mentioned functional testing method determines the backup file information corresponding to each backup file of the data to be restored, thereby determining the database nodes where each backup file is located, setting a priority for each backup file, performing at least one priority update operation, and determining the priority based on the first number of database nodes of the backup file to be downloaded. There is a negative correlation between the database node of the backup file and the priority of the backup file. When a database node successfully downloads the backup file, the first number is modified and the priority is updated, so that all backup files corresponding to the data to be restored are successfully downloaded at a similar time, so that the data to be restored can be restored as soon as possible, which can effectively improve the efficiency of backup file downloading and effectively reduce the time spent on data recovery.

[0140] Furthermore, a data download queue is generated based on the first number of database nodes corresponding to each backup file. When the backup file with the highest priority is determined to enter the download queue based on the priority, the version information corresponding to each backup file is determined, and the version information and priority are compared with the reference version information and reference priority in the file status information to determine whether to use the file as the target backup file and add it to the download queue. This can ensure that the downloaded file version is correct, avoid wasting time downloading the wrong file version, reduce resource waste, and improve data recovery efficiency.

[0141] The present disclosure provides a data recovery device. Figure 6 As shown, the data recovery device 60 may include: an information acquisition module 601 and a data recovery module 602, wherein:

[0142] An information acquisition module 601 is configured to acquire at least one backup file information corresponding to at least one backup file of the data to be restored; the backup file information includes a storage location of the corresponding backup file and at least one database node;

[0143] The data recovery module 602 is configured to perform at least one priority update operation on each backup file until each backup file is successfully downloaded to the corresponding database node, and to send a recovery request to at least one database node for each backup file to recover the data to be recovered;

[0144] Priority update operations include:

[0145] Determine a first number of database nodes corresponding to a current sub-priority update operation for each backup file;

[0146] determining the priority of each backup file based on the first quantity corresponding to each backup file; the database node of the backup file is negatively correlated with the priority of the backup file;

[0147] The backup file with the highest priority is used as the target backup file, so that each database node downloads the target backup file from the storage location of the target backup file; feedback information of each database node for the target backup file is received; and based on the feedback information, a first number of database nodes of the target backup file is updated.

[0148] As an optional embodiment, in the device, the data recovery module is specifically configured to:

[0149] Updating a first number of database nodes of the target backup file based on the feedback information includes:

[0150] If the feedback information indicates that the download is successful, updating the first number of database nodes of the target backup file corresponding to the feedback information;

[0151] The method also includes:

[0152] If the feedback information indicates that the download fails, the backup file information of the target backup file corresponding to the feedback information is updated.

[0153] As an optional embodiment, in the device, the data recovery module is specifically configured to:

[0154] generating a data download queue based on a first number of each database node;

[0155] If the feedback information indicates that the download failed, the backup file information of the target backup file corresponding to the feedback information is updated, and the following is also included:

[0156] If the feedback information indicates that the download has failed, then the backup file information of the target backup file corresponding to the feedback information is updated;

[0157] Based on the updated backup file information, the target backup file is added back to the data download queue.

[0158] As an optional embodiment, in the device, the data recovery module is specifically configured to use the backup file with the highest priority as the target backup file, including:

[0159] Use the backup files with the highest priority as the target backup files, including:

[0160] Use the backup file with the highest priority as the first backup file;

[0161] Performing at least one judgment operation on the first backup file until a preset end condition is satisfied, and using the first backup file that satisfies the preset end condition as the target backup file; the preset end condition is that the first comparison result and the second comparison result are both the same;

[0162] The judgment operations include:

[0163] Determine version information of the first backup file and a priority of the first backup file;

[0164] Compare the version information with the reference version information in the file status information to obtain a first comparison result; compare the priority with the reference priority in the file status information to obtain a second comparison result;

[0165] If at least one of the first comparison result and the second comparison result is different, the second backup file with the highest priority except the first backup file is used as the first backup file corresponding to the next judgment operation.

[0166] As an optional embodiment, in the device, the data recovery module is specifically configured to:

[0167] If the feedback information is download failure, update the version information of the target backup file.

[0168] As an optional embodiment, in the device, the data recovery module is specifically configured to:

[0169] Before performing at least one priority update operation, it also includes:

[0170] The priority of at least one backup file corresponding to the first priority update operation is set to the lowest priority.

[0171] As an optional embodiment, in the device, the data recovery module is specifically configured to:

[0172] Sending a restore request to at least one database node for each backup file includes:

[0173] determining a primary database node from at least one database node;

[0174] A recovery request is sent to the primary database node, so that the primary database node synchronizes the recovery request to each database node except the primary database node.

[0175] The functional testing device provided by the present invention determines the backup file information corresponding to each backup file of the data to be restored, thereby determining the database nodes where each backup file is located, setting a priority for each backup file, performing at least one priority update operation, and determining the priority based on the first number of database nodes of the backup file to be downloaded. There is a negative correlation between the database node of the backup file and the priority of the backup file. When a database node successfully downloads the backup file, the first number is modified and the priority is updated, so that all backup files corresponding to the data to be restored are successfully downloaded at a similar time, so that the data to be restored can be restored as soon as possible, which can effectively improve the backup file download efficiency and effectively reduce the time spent on data recovery.

[0176] Furthermore, a data download queue is generated based on the first number of database nodes corresponding to each backup file. When the backup file with the highest priority is determined to enter the download queue based on the priority, the version information corresponding to each backup file is determined, and the version information and priority are compared with the reference version information and reference priority in the file status information to determine whether to use the file as the target backup file and add it to the download queue. This can ensure that the downloaded file version is correct, avoid wasting time downloading the wrong file version, reduce resource waste, and improve data recovery efficiency.

[0177] The apparatus of the embodiments of the present disclosure can execute the methods provided by the embodiments of the present disclosure, and their implementation principles are similar and have corresponding technical effects. The actions performed by each module in the apparatus of each embodiment of the present disclosure correspond to the steps in the methods of each embodiment of the present disclosure. For detailed functional descriptions of each module of the apparatus, please refer to the descriptions of the corresponding methods shown above, and will not be repeated here.

[0178] In an embodiment of the present disclosure, an electronic device (computer device / equipment / system) is provided, comprising a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the steps of the method provided in any optional embodiment of the present disclosure. Compared with the prior art, the following can be achieved: by determining the backup file information corresponding to each backup file of the data to be restored, thereby determining the database node where each backup file is located, setting a priority for each backup file, performing at least one priority update operation, determining the priority based on the first number of database nodes of the backup file to be downloaded, and there is a negative correlation between the database node of the backup file and the priority of the backup file. When a database node successfully downloads a backup file, the first number is modified and the priority is updated, so that all backup files corresponding to the data to be restored are successfully downloaded at a similar time, so that the data to be restored can be restored as soon as possible, which can effectively improve the efficiency of downloading backup files and effectively reduce the time spent on data recovery.

[0179] In an alternative embodiment, an electronic device is provided, such as Figure 7 As shown, Figure 7 The electronic device 7000 shown includes: a processor 7001 and a memory 7003. The processor 7001 and the memory 7003 are connected, for example, via a bus 7002. Optionally, the electronic device 7000 may further include a transceiver 7004, which may be used for data exchange between the electronic device and other electronic devices, such as data transmission and / or data reception. It should be noted that in actual applications, the number of transceivers 7004 is not limited to one, and the structure of the electronic device 7000 does not constitute a limitation on the embodiments of the present disclosure.

[0180] Processor 7001 can be a CPU (Central Processing Unit), a general-purpose processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array), or other programmable logic device, transistor logic device, hardware component, or any combination thereof. It can implement or execute the various exemplary logic blocks, modules, and circuits described in conjunction with the present disclosure. Processor 7001 can also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, etc.

[0181] Bus 7002 may include a path for transmitting information between the above components. Bus 7002 may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus. Bus 7002 may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, Figure 7 Only one thick line is used in the diagram, but this does not mean that there is only one bus or one type of bus.

[0182] The memory 7003 may be a ROM (Read Only Memory) or other type of static storage device that can store static information and instructions, a RAM (Random Access Memory) or other type of dynamic storage device that can store information and instructions, or an EEPROM (Electrically Erasable Programmable Read Only Memory), a CD-ROM (Compact Disc Read Only Memory) or other optical disk storage, optical disk storage (including compact discs, laser discs, optical discs, digital versatile discs, Blu-ray discs, etc.), magnetic disk storage media, other magnetic storage devices, or any other medium that can be used to carry or store computer programs and can be read by a computer, without limitation herein.

[0183] The memory 7003 is used to store the computer program for executing the embodiments of the present disclosure, and the execution is controlled by the processor 7001. The processor 7001 is used to execute the computer program stored in the memory 7003 to implement the steps shown in the above method embodiments.

[0184] The electronic device includes but is not limited to: a terminal or server capable of performing the above-mentioned data recovery operation.

[0185] An embodiment of the present disclosure provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the steps and corresponding contents of the aforementioned method embodiment can be implemented.

[0186] The embodiments of the present disclosure further provide a computer program product, including a computer program, which can implement the steps and corresponding contents of the aforementioned method embodiments when executed by a processor.

[0187] In the description and claims of the present disclosure and the accompanying drawings, the terms "first," "second," "third," "fourth," "1," "2," and the like (if any) are used to distinguish similar objects and are not necessarily used to describe a particular order or sequential sequence. It should be understood that the terms used in this manner are interchangeable where appropriate, such that the embodiments of the present disclosure described herein can be practiced in an order other than that shown or described.

[0188] It should be understood that, although the flowcharts of the embodiments of the present disclosure indicate the various operation steps by arrows, the order of implementation of these steps is not limited to the order indicated by the arrows. Unless otherwise clearly stated herein, in some implementation scenarios of the embodiments of the present disclosure, the implementation steps in each flowchart can be performed in other orders as required. In addition, some or all of the steps in each flowchart may include multiple sub-steps or multiple stages based on the actual implementation scenario. Some or all of these sub-steps or stages can be executed at the same time, and each sub-step or stage in these sub-steps or stages can also be executed at different times. In scenarios where the execution times are different, the order of execution of these sub-steps or stages can be flexibly configured as required, and the embodiments of the present disclosure do not limit this.

[0189] The above description is only an optional implementation method for some implementation scenarios of the present disclosure. It should be pointed out that for ordinary technicians in this technical field, without departing from the technical concept of the solution of the present disclosure, other similar implementation methods based on the technical ideas of the present disclosure also fall within the protection scope of the embodiments of the present disclosure.

Claims

1. A data recovery method, characterized in that: Applied to the backup scheduling end, including: Obtaining at least one backup file information corresponding to at least one backup file of the data to be restored; the backup file information includes a storage location of the corresponding backup file and at least one database node; each backup file and its corresponding copy correspond to at least two different database nodes in the distributed database system; For each backup file, perform at least one priority update operation until each backup file and its corresponding copy are successfully downloaded to the corresponding database node, and send a recovery request to at least one database node of each backup file to recover the data to be recovered; The priority update operation includes: Determine the priority of each backup file; the priority of the backup file is negatively correlated with the number of database nodes that have not completed the backup file download; taking the backup file with the highest priority as the target backup file, so that each database node downloads the target backup file from the storage location of the target backup file; and receiving feedback information from each database node regarding the target backup file; If the feedback information indicates that the download is successful, updating the priority in the backup file information of the target backup file corresponding to the feedback information in the file status information; If the feedback information indicates that the download has failed and the error can be retried, then updating the version information in the backup file information of the target backup file corresponding to the feedback information in the file status information; The file status information includes backup file information of each backup file in the database cluster.

2. The data recovery method according to claim 1, characterized in that: The method further comprises: generating a data download queue based on a first number of each database node; If the feedback information indicates that the download has failed, updating the backup file information of the target backup file corresponding to the feedback information further includes: If the feedback information indicates that the download has failed, updating the backup file information of the target backup file corresponding to the feedback information; Based on the updated backup file information, the target backup file is re-added to the data download queue.

3. The data recovery method according to claim 1, characterized in that: The step of using the backup file with the highest priority as the target backup file includes: Use the backup file with the highest priority as the first backup file; Performing at least one judgment operation on the first backup file until a preset end condition is satisfied, and using the first backup file that satisfies the preset end condition as the target backup file; the preset end condition is that the first comparison result and the second comparison result are identical; The judgment operation includes: Determining version information of the first backup file and a priority of the first backup file; Comparing the version information with the reference version information in the file status information to obtain the first comparison result; comparing the priority with the reference priority in the file status information to obtain the second comparison result; If at least one of the first comparison result and the second comparison result is different, the second backup file with the highest priority except the first backup file is used as the first backup file corresponding to the next judgment operation.

4. The data recovery method according to claim 1, characterized in that: Before performing at least one priority update operation, the method further includes: The priority of at least one backup file corresponding to the first priority update operation is set to the lowest priority.

5. The data recovery method according to claim 1, characterized in that: The sending of a recovery request to at least one database node of each backup file includes: determining a master database node from the at least one database node; The recovery request is sent to the master database node, so that the master database node synchronizes the recovery request to each database node except the master database node.

6. A data recovery device, characterized in that: include: An information acquisition module, configured to acquire at least one backup file information corresponding to at least one backup file of data to be restored; The backup file information includes the storage location of the corresponding backup file and at least one database node; each backup file and its corresponding copy correspond to at least two different database nodes in the distributed database system; A data recovery module is configured to perform at least one priority update operation on each backup file until each backup file and its corresponding copy are successfully downloaded to the corresponding database node, and to send a recovery request to at least one database node of each backup file to recover the data to be recovered; The priority update operation includes: Determine the priority of each backup file; the priority of the backup file is negatively correlated with the number of database nodes that have not completed the backup file download; taking the backup file with the highest priority as the target backup file, so that each database node downloads the target backup file from the storage location of the target backup file; and receiving feedback information from each database node regarding the target backup file; If the feedback information indicates that the download is successful, updating the priority in the backup file information of the target backup file corresponding to the feedback information in the file status information; If the feedback information indicates that the download has failed and the error can be retried, then updating the version information in the backup file information of the target backup file corresponding to the feedback information in the file status information; The file status information includes backup file information of each backup file in the database cluster.

7. An electronic device comprising a memory, a processor, and a computer program stored in the memory, characterized in that: The processor executes the computer program to implement the steps of the method according to any one of claims 1 to 5.

8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the data recovery method according to any one of claims 1 to 5 are implemented.

9. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.

Citation Information

Patent Citations

  • Disaster recovery data high-value rapid ordered recovery method based on file popularity and multi-objective optimization

    CN117033071A