Data recovery method, apparatus, and system

By directly restoring the database to a specified time point using backup data and continuous archive logs in the storage device, the problem of data recovery consumes computing resources in the prior art is solved, and efficient database business operation and accurate data recovery are achieved.

WO2025007539A1PCT designated stage expired Publication Date: 2025-01-09HUAWEI TECH CO LTD

Patent Information

Application Number
PCT/CN2024/071870
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-10-23
Filing Date
2024-01-11
Publication Date
2025-01-09

AI Technical Summary

Technical Problem

During the recovery process of existing database data recovery methods, the computing power and bandwidth of the computing nodes will consume, affecting the normal operation of database services.

Method used

By performing the data recovery process in the storage device, the database is directly restored to a specified time point by using the full backup data and continuous archive logs in the backup storage device to avoid computing devices participating in data recovery and data transmission.

Benefits of technology

It saves the resources and bandwidth of computing equipment, ensures the smooth operation of database services, and ensures the accuracy and efficiency of data recovery.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024071870_09012025_PF_FP_ABST
    Figure CN2024071870_09012025_PF_FP_ABST
Patent Text Reader

Abstract

The present application relates to the technical field of storage, and provides a data recovery method, apparatus, and system, which can achieve resource saving in a data recovery process and ensure smooth operation of database services. The method comprises: receiving a data recovery instruction, wherein the data recovery instruction comprises a specified time point, and the data recovery instruction is used for instructing to recover data of a database to the specified time point; on the basis of backup data in a backup storage device, obtaining full backup data of which the backup time is earlier than the specified time point; on the basis of an archive log of the database stored in the backup storage device, obtaining the archive log, wherein the archive log comprises a plurality of logs generated before the specified time point and after the backup time of the full backup data, and the serial numbers of the plurality of logs are consecutive; performing data recovery on the database on the basis of the full backup data and the archive log to obtain data of the database at the specified time point; and storing the data at the specified time point.
Need to check novelty before this filing date? Find Prior Art

Description

Data recovery method, device and system

[0001] This application claims priority to the Chinese patent application filed with the State Intellectual Property Office on July 4, 2023, with application number 202310813094.3 and application name “A database backup and recovery method”, and the Chinese patent application filed with the State Intellectual Property Office on October 23, 2023, with application number 202311382360.8 and application name “A data recovery method, device and system”, the entire contents of which are incorporated by reference into this application. Technical Field

[0002] The present application relates to the field of storage technology, and in particular to a data recovery method, device, and system. Background Art

[0003] In the field of storage technology, the reliability of data in a database directly affects the quality of services. To ensure the reliability of data in a database, data in the database is usually backed up so that the data in the database can be restored based on the backup data in case of a database failure.

[0004] One data recovery method is point-in-time recovery (PITR), which restores database data to a specific point in time. During PITR, the database application deployed on the compute nodes reads backup data and archived database logs from the backup storage system and restores the data to the specified point in time based on the backup data and database logs.

[0005] In the above data recovery method, the database application reads the backup data and database logs. After the data at the specified time point is restored, the restored data is stored in the database on the storage node. This process consumes the computing power of the computing node and occupies the bandwidth between the computing node and the storage node, which may affect the normal operation of the database business.

[0006] Summary of the Invention

[0007] The present application provides a data recovery method, device and system, which can save resources during the data recovery process and ensure the smooth operation of database services.

[0008] This application adopts the following technical solutions:

[0009] In a first aspect, the present application provides a data recovery method, which is applied to a primary storage device in a storage system, the storage system comprising a computing device, a primary storage device, and a backup storage device, wherein a database management system is running on the computing device, the primary storage device is used to store the database data and logs, and the backup storage device is used to store the database backup data and archive logs. The method comprises: receiving a data recovery instruction, the data recovery instruction being used to instruct to restore the database data to a specified time point; and based on the backup data in the backup storage device, obtaining full backup data with a backup time earlier than the specified time point; and based on the archive logs of the database stored in the backup storage device, obtaining archive logs, the archive logs comprising multiple logs generated before the specified time point and after the backup time of the full backup data, the multiple logs having consecutive serial numbers; then, based on the obtained full backup data and archive logs, performing data recovery on the database to obtain the database data at the specified time point; and storing the data at the specified time point.

[0010] In this application, a storage device performs a data recovery process based on backup data and archived logs, and the recovered data is stored in the storage space managed by the storage device. Compared to solutions in which a computing device performs data recovery based on backup data and archived logs obtained from a backup storage device and then sends the recovered data to a primary storage device for storage, this solution does not require the computing device to participate in data recovery, thus conserving computing device resources. Furthermore, since the data recovery process is performed by the storage device, there is no need for the storage device to interact with the computing device for data transmission. This conserves computing device bandwidth, ensuring that the computing device has sufficient resources to run database services, thereby ensuring smooth operation of database services.

[0011] Furthermore, compared to the case where the archived log serial numbers are discontinuous, the data corresponding to the missed logs cannot be recovered, resulting in the inability to restore the data to the specified time point. In the solution of the present application, since the serial numbers of the archived logs used for data recovery are continuous (that is, the logs are not missed), the storage device can restore the data to the specified time point based on the full backup data and complete logs earlier than the specified time point, thereby ensuring the accuracy of data recovery.

[0012] In one possible implementation, the backup data of the above-mentioned database is a data snapshot, and the data recovery method provided in the present application also includes: receiving a data backup instruction, which is used to instruct to back up the data of the database; and generating a data snapshot of the database; and writing the data snapshot to the backup storage device in the form of a full backup or incremental backup.

[0013] In this application, the data backup process is completed by the primary storage device, and the database management system in the computing device does not need to participate in the data backup, which can save the resources of the computing device. In addition, the data backup process does not require the storage device to interact with the computing device for data transmission, which can save the bandwidth of the computing device.

[0014] In one possible implementation, the above-mentioned archived log is a log snapshot, and the data recovery method provided by the present application also includes: receiving a log archiving instruction, where the log archiving instruction is used to instruct to archive the database log; and generating a log snapshot of the database at a specified time interval, wherein the serial numbers of the multiple logs contained in two consecutive log snapshots are continuous; and writing the log snapshot to a backup storage device in the form of a full backup or an incremental backup.

[0015] Due to the log recovery mechanism, the logs of some sequence numbers generated by the computing device may be recycled before being archived to the backup storage device, so that the logs of these sequence numbers fail to be archived to the backup storage device. Subsequently, in the process of data recovery, the sequence numbers of the logs (for data recovery) obtained based on the archive logs in the backup storage device are discontinuous. In the present application, before the data protected by the log are backed up by the snapshot, the logs are not recycled. In the present application, in the process of log archiving, the logs of the database are archived in the form of log snapshots, and it is ensured that the logs included in the continuous snapshots are complete logs, i.e., it is ensured that the logs are not missed, so that when performing data recovery based on the archive logs, it is helpful to smoothly realize point-in-time recovery (PITR).

[0016] In one possible implementation, before generating the database log snapshots at specified time intervals, the data recovery method provided herein further includes: recycling the database logs; and upon receiving a log archiving instruction, ceasing to recycle the database logs. Typically, a database has a log recycling mechanism, such as periodic log recycling. When a log recycling cycle is reached, the primary storage device recycles the database logs stored therein.

[0017] In this application, upon receiving a log recycling instruction, the primary storage device stops recycling logs, which ensures that the serial numbers of logs included in consecutive log snapshots are continuous, so that no logs are missed, thereby facilitating the smooth implementation of PITR.

[0018] In one possible implementation, the data recovery method provided by this application further includes: upon receiving a log archiving instruction, marking logs generated within a specified time interval; and after generating a log snapshot, retrieving the marked logs. Marking the logs facilitates timely retrieval of snapshotted logs from the primary storage device based on the markings, thereby conserving storage space on the storage device.

[0019] In one possible implementation, the data recovery method provided by the present application further includes: obtaining database logs from a primary storage device based on the database log format, marking the logs and / or generating log snapshots. The primary storage device in the present application can sense the format of the database logs and accurately and smoothly obtain the logs based on the log format, thereby facilitating log archiving.

[0020] In one possible implementation, when the archived log is a log stream, the data recovery method provided by the present application further includes: obtaining the database log stream according to the database log format; and writing the database log stream to a backup storage device. Streaming archiving of the database log stream ensures that no database logs are missed, as the sequence numbers of the logs in the log stream are continuous, facilitating point-in-time recovery (PITR) of data.

[0021] In one possible implementation, the above-mentioned data recovery of the database based on the full backup data and the archived logs to obtain the data of the database at a specified point in time includes: starting from the full backup data, recovering the database data according to the arrangement order of the serial numbers of the logs in the archived logs to obtain the data of the database at a specified point in time.

[0022] In a second aspect, the present application provides a storage device, which is a primary storage device in a storage system. The storage system also includes a computing device and a backup storage device. A database management system runs on the computing device. The primary storage device is used to store database data and logs, and the backup storage device is used to store database backup data and archived logs. The storage device includes various modules for implementing the method described in the first aspect and any possible implementation thereof, such as a receiving module, an acquisition module, a data recovery module, a storage module, a generation module, a writing module, a log recovery module, a control module, and a marking module.

[0023] The storage device has the function of implementing the behavior in the method example of any one of the first aspect and its possible implementations. The function can be implemented by hardware or by hardware executing corresponding software implementation. The hardware or software includes one or more modules corresponding to the above-mentioned function.

[0024] In a third aspect, the present application provides a storage device comprising a memory and at least one processor connected to the memory, wherein the memory is used to store computer program code, and the computer program code comprises computer instructions. When the computer instructions are executed by at least one processor, the storage device executes the method of the first aspect and any one of its possible implementations.

[0025] In a fourth aspect, the present application provides a computer-readable storage medium storing computer instructions. When the computer instructions are run on a computer, the method of the first aspect and any one of its possible implementations is executed.

[0026] In a fifth aspect, the present application provides a computer program product, which includes computer instructions. When the computer instructions are run on a computer, the method of the first aspect and any one of its possible implementations is executed.

[0027] In a sixth aspect, the present application provides a chip system, comprising: a processor for calling and running a computer program from a memory, so that a storage device equipped with the chip system executes the method of the first aspect and any one of its possible implementations.

[0028] In the seventh aspect, the present application provides a storage system, including a computing device, a primary storage device and a secondary storage device; a database management system runs on the computing device, the primary storage device is used to store database data and logs, and the backup storage device is used to store database backup data and archived logs; the primary storage device is used to execute the method of any one of the first aspect and its possible implementation methods.

[0029] It should be understood that the beneficial effects achieved by the technical solutions of the second to seventh aspects of this application and the corresponding possible implementation methods can be referred to the technical effects of the first aspect and its corresponding possible implementation methods mentioned above, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0030] FIG1 is a schematic diagram of an architecture of a storage system provided in an embodiment of the present application;

[0031] FIG2 is a block diagram of a data backup and data recovery process provided by an embodiment of the present application;

[0032] FIG3 is a block diagram of a data backup and log archiving process provided in an embodiment of the present application;

[0033] FIG4 is a second schematic diagram of the architecture of a storage system provided in an embodiment of the present application;

[0034] FIG5 is a flow chart of a data backup method provided in an embodiment of the present application;

[0035] FIG6 is a block diagram of a full data backup process provided in an embodiment of the present application;

[0036] FIG7 is a block diagram of an incremental data backup process provided in an embodiment of the present application;

[0037] FIG8 is a flow chart of a log archiving method according to an embodiment of the present application;

[0038] FIG9 is a block diagram of a log archiving process according to an embodiment of the present application;

[0039] FIG10 is a second flow chart of a log archiving method provided in an embodiment of the present application;

[0040] FIG11 is a block diagram 2 of a log archiving process provided in an embodiment of the present application;

[0041] FIG12 is a flow chart of a data recovery method according to an embodiment of the present application;

[0042] FIG13 is a second flow chart of a data recovery method provided in an embodiment of the present application;

[0043] FIG14 is a schematic diagram of a structure of a storage device according to an embodiment of the present application;

[0044] FIG15 is a second structural diagram of a storage device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0045] The term "and / or" in this article is merely a description of the association relationship between associated objects, indicating that three relationships may exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone.

[0046] In the embodiments of this application, words such as "exemplary" or "for example" are used to indicate examples, illustrations, or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of this application should not be interpreted as being preferred or advantageous over other embodiments or designs. Rather, the use of words such as "exemplary" or "for example" is intended to present the relevant concepts in a concrete manner.

[0047] In the description of the embodiments of the present application, unless otherwise specified, “plurality” means two or more.

[0048] First, some concepts and technical knowledge involved in a data recovery method, device and storage system provided in the embodiments of the present application are explained.

[0049] 1. Database (DB)

[0050] A database is an organized, shared collection of data stored in a storage device. The data in a database is organized, described, and stored according to a specific data model. The database has minimal redundancy, high data independence, and easy scalability, and is shared by various users.

[0051] Databases are managed by a database management system (DBMS), a type of software that runs within an operating system (a DBMS can also be called a database application). Specifically, a DBMS is used to create, use, and maintain databases, providing unified management and control to ensure their security and integrity.

[0052] As will be appreciated, the aforementioned database and database management system constitute a database system (DBS). The database is stored on a storage device, while the DBMS runs on a computing device. Typically, users access data in the database through the DBMS, and database administrators also maintain the database through the DBMS.

[0053] 2. Data backup

[0054] Data backup is the process of copying all or part of the data from a computing device's storage medium (hard drive or storage array) to other storage media for storage to prevent data loss due to operational errors or failures. Data backup can include full, partial, and incremental backups.

[0055] Full backup refers to backing up all data at a certain point in time.

[0056] The advantage of full backup is that data recovery time is faster (since all data is backed up, data recovery can be completed by simply reading the backup data and then writing the data to the primary storage device). The disadvantage of full backup is that there is a large amount of duplicate information in the backup data. In addition, since the amount of data that needs to be backed up each time is quite large, the backup takes a long time.

[0057] Incremental backup refers to the backup pointer after the last backup (the last backup may be a full backup or an incremental backup). Each subsequent backup only needs to back up the data that has been added or modified compared to the previous backup.

[0058] The advantage of incremental backup is that there is no duplicate backup data, so the amount of backup data is not large and the backup time is short. The disadvantage of incremental backup is that data must be restored based on the last full backup data and all incremental backup data, and the data recovery time is longer.

[0059] 3. Log Archiving

[0060] Databases all have transaction logs that record all transactions and the modifications each transaction makes to the database. In other words, a database log is a record of operations performed on database data. The log is a crucial component of a database; if a system failure occurs, the transaction log may be needed to recover the database.

[0061] For databases, log archiving is the process of saving database log files to a separate storage device for long-term storage. Log archiving is an important backup and recovery strategy that ensures database data integrity and reliability.

[0062] The main uses of log archiving include: database backup, database recovery, database rollback, and database replication.

[0063] It should be understood that a log contains at least the following information: the time of the database operation, the log sequence number, and the modification content. Database logs can be used to determine the operations performed on the database. For example, log 1 indicates that at time 1, data 1 in the database was deleted, while log 2 indicates that at time 2, data 2 in the database was modified to data 3.

[0064] 4. Data Recovery

[0065] Data recovery refers to restoring database data to the data before the failure through some technical means when data cannot be read or lost due to storage medium failure, human error, operating system failure, etc.

[0066] The data recovery involved in the embodiments of the present application is based on backup data. One data recovery method is to restore the database data to the data before the failure occurred based on the backup data. Another data recovery method is to restore the database data to a specified arbitrary time point before the failure occurred based on the backup data, i.e., point-in-time recovery (PITR). It should be understood that the data recovery performed in the embodiments of the present application is PITR, which also relies on archived logs.

[0067] The following is an exemplary introduction to the storage system with reference to the storage system architecture diagram shown in FIG1 . The storage system shown in FIG1 is a storage system with separated storage and computing, and includes a computing node cluster and a storage node cluster. The computing node cluster includes one or more computing nodes 110 (two computing nodes 110 are shown in FIG1 , but are not limited to two computing nodes 110 ), and each computing node 110 can communicate with each other. The storage node cluster includes multiple storage nodes 120 (two storage nodes 120 are shown in FIG1 , but are not limited to two storage nodes 120 ). Storage nodes can also be referred to as storage devices.

[0068] The computing node 110 is a computing device, such as a server, desktop computer, or storage array controller. In terms of hardware, as shown in Figure 1, computing node 110 includes at least a processor 1101, memory 1102, and a network interface card 1103. Processor 1101 is a central processing unit (CPU) that processes data access requests from outside computing node 110 or requests generated within computing node 110. A database management system runs on the computing node, which includes various database components, such as an SQL parser, SQL optimizer, buffer pool, and storage engine. For example, for a MySQL database, the database management system includes an SQL engine and a storage engine. The storage engine is primarily responsible for managing data layout, data format, and write mode, while the SQL engine is responsible for semantic parsing and executing database operations. The database application is implemented by the processor 1101 in computing node 110 running the database application program. Therefore, the actions performed by the database management system described below can be directly described as being performed by the processor 1101.

[0069] For example, when the processor 1101 (specifically, the database management system) receives a write request to the database sent by the user device, it can temporarily save the data in the write request in the memory 1102. When the total amount of data in the memory 1102 reaches a certain threshold, the processor 1101 sends the data stored in the memory 1102 to the storage node 120 for persistent storage.

[0070] In addition, the processor 1101 is also used to perform calculations or processing on data, such as metadata management, data deduplication, data compression, virtualized storage space, and address translation. Figure 1 shows only one CPU. In actual applications, the computing device 110 may include multiple CPUs, wherein a CPU may have one or more CPU cores. The embodiments of this application do not limit the number of CPUs or the number of CPU cores.

[0071] Memory 1102 of computing node 110 refers to internal storage that directly exchanges data with processor 1101. It can read and write data quickly and at any time, serving as temporary data storage for the operating system or other running programs. Memory 1102 can include at least two types of memory. For example, memory 1102 can be either random access memory (RAM) or read-only memory (ROM).

[0072] For example, RAM is dynamic random access memory (DRAM) or storage class memory (SCM). DRAM is a semiconductor memory and, like most random access memories, is a volatile memory device. SCM is a composite storage technology that combines traditional storage devices with memory characteristics. SCM can provide faster read and write speeds than hard disks, but has slower access speeds than DRAM and is cheaper than DRAM. Optionally, DRAM and SCM are merely exemplary descriptions in the embodiments of the present application, and memory 1102 may also include other random access memories, such as static random access memory (SRAM).

[0073] For example, the ROM may be a programmable read only memory (PROM), an erasable programmable read only memory (EPROM), etc.

[0074] In addition, the memory 1102 may also be a dual in-line memory module (DIMM), that is, a module composed of dynamic random access memory (DRAM), or a solid state disk (SSD).

[0075] Optionally, in actual applications, multiple memories 1102 and different types of memories 1102 can be configured in the computing node 110. The embodiment of the present application does not limit the number and type of memory 1102. In addition, the memory 1102 can be configured to have a power-saving function. The power-saving function means that when the system loses power and then powers on again, the data stored in the memory 1102 will not be lost. Memory with a power-saving function is called non-volatile random access memory (NVRAM), non-volatile dual in-line memory module (NVDIMM). For example, NVRAM can be a double data rate synchronous dynamic random access memory (DDR SDRAM).

[0076] The network card 1103 of the computing device 110 is used to communicate with the storage node 120. For example, when the total amount of data in the memory 1102 reaches a certain threshold, the computing node 110 can send a request to the storage node 120 through the network card 1103 to persistently store the data. In addition, the computing node 110 may also include a bus for communication between the components inside the computing node 110. Functionally, since the main function of the computing node 110 in Figure 1 is computing business, remote storage can be used to achieve persistent storage when storing data, so it has less local storage than a conventional server, thereby saving cost and space. However, this does not mean that the computing node 110 cannot have local storage. In actual implementation, the computing node 110 can also have a small number of hard disks built in, or a small number of external hard disks.

[0077] 1 , any computing node 110 can access any storage node 120 in the storage node cluster through the network. A storage node can be, for example, a server, a desktop computer, or a controller or disk enclosure of a storage array.

[0078] A storage node 120 includes one or more controllers (or control units) 1201, a network card 1202, and multiple hard disks 1203. The network card 1202 is used to communicate with the computing node 110. The hard disk 1203 is used to store data and can be a disk or other type of storage medium, such as a solid-state drive or a shingled magnetic recording hard disk. The controller 1201 is used to write data to the hard disk 105 or read data from the hard disk 1203 according to the data read / write request sent by the computing node 110. During the data reading and writing process, the controller 1201 needs to convert the address carried in the data read / write request into an address that can be recognized by the hard disk. As can be seen, the controller 1201 also has some simple computing functions.

[0079] In actual applications, the controller 1201 can have various forms. In one case, the controller 101 includes a CPU and memory. The CPU is used to perform operations such as address conversion and reading and writing data. The memory is used to temporarily store data to be written to the hard disk 1203, or data read from the hard disk 1203 to be sent to the computing node 110. In some cases, the controller 1201 is a programmable electronic component, such as a data processing unit (DPU). The DPU has the versatility and programmability of the CPU, but is more specialized and can efficiently run network data packets, storage requests or analysis requests. Unlike the CPU, the DPU has a greater degree of parallelism (needs to process a large number of requests). Optionally, the DPU can also be replaced with a processing chip such as a graphics processing unit (GPU) or an embedded neural network processor (NPU).

[0080] Typically, the number of controllers 1201 can be one, two, or more. When a storage node 120 includes at least two controllers 1201, the hard disks 1203 and the controllers 1201 may have an ownership relationship. When a hard disk 1203 and a controller 1201 have an ownership relationship, each controller can only access the hard disks that belong to it. If storage space is insufficient, adding a new hard disk 1203 to the storage node 120 requires rebinding the ownership relationship between the hard disk 1203 and the controller 1201.

[0081] In another embodiment, the functions of the controller 1201 can be offloaded to the network card 1202. In other words, the storage node 120 does not have a controller 1201 inside, but the network card 1202 performs data reading and writing, address conversion, and other computing functions. In this case, the network card 1202 is an intelligent network card, which can include a CPU and memory. The CPU is used to perform operations such as address conversion and reading and writing data, and the memory is used to temporarily store data to be written to the hard disk 1203, or read from the hard disk 1203 to be sent to the computing node 110. In this case, there is no ownership relationship between the network card 1202 and the hard disk 1203 in the storage node 120. The network card 1202 can access any hard disk 1203 in the storage node 120. Therefore, when the storage space is insufficient, the hard disk can be expanded more conveniently.

[0082] According to the above content, it can be seen that the storage node cluster includes multiple storage nodes 120. During actual use, some of the multiple storage nodes 120 can be primary storage nodes, and some storage nodes are backup storage nodes. That is to say, the database data is stored in the primary storage node, and the backup data of the data in the primary storage node is stored in the backup storage node for use in data recovery.

[0083] Currently, in the field of storage technology, the database data backup, log archiving, and data recovery processes must all be controlled by a data management system running in the computing nodes, and implemented through interaction between the computing nodes, primary storage nodes, and backup storage nodes. This will consume the computing power of the settlement nodes, and the interaction between the computing nodes and storage nodes for data transmission will occupy a certain amount of bandwidth, which will affect the normal operation of the database business.

[0084] Referring to Figure 2 (a), one data backup method involves a database administrator issuing a data backup instruction to a database management system (DBMS) using a backup and recovery tool. The DBMS then reads data from the primary storage device and writes it to the backup storage device. The data backup process specifically includes steps ① through ④.

[0085] Step 1: Receive data backup instructions.

[0086] The database administrator or user sends a data backup instruction to the database management system through the backup and recovery tool to trigger the data backup process. After receiving the data backup instruction, the data management system starts data backup.

[0087] Step 2: The database management system sends a data read request to the primary storage device to read the backup data.

[0088] Step 3: The database management system obtains the database data (for backup) from the primary storage device as backup data.

[0089] The backup data read by the database management system from the primary storage device can be full data or incremental data (i.e., differential data). That is, the data backup can be a backup of the full data of the database (i.e., full data backup) or a backup of the differential data of the database (difference data after the last backup time point) (i.e., incremental data backup).

[0090] Optionally, if an incremental backup is performed on the database data, then in the above step ②, the data read request sent by the database management system to the primary storage device is a read request for reading differential data. For example, the data read request may be a getDelta instruction, so that the primary storage device returns differential data relative to the data at the last backup time point to the data management system.

[0091] Step 4: The database management system writes the backup data into the backup storage device.

[0092] During the above data backup process, the backup data needs to be transmitted between the storage device and the computing device, which will occupy the bandwidth between the computing device and the storage device.

[0093] Based on the data backup method described in Figure 2 (a), referring to Figure 2 (b), one data recovery method involves a database administrator issuing a data recovery command to the database management system using a backup recovery tool. The database management system then reads the backup data from the backup storage device, recovers the data, and writes the recovered data to the primary storage device. The data recovery process specifically includes steps ① through ④.

[0094] Step ①', receiving a data recovery instruction.

[0095] When a database failure occurs and data recovery is required, the database administrator or user sends a data recovery instruction to the database management system through the backup and recovery tool to trigger the data recovery process. After receiving the data recovery instruction, the data management system begins to recover the database data.

[0096] Step ②′: the database management system sends a data read request to the backup storage device to read the backup data from the backup storage device.

[0097] Step ③': the database management system restores the database data based on the read backup data.

[0098] Combined with the description of the above backup process, if the data backup method is full data backup, the backup data read is the full backup data, the full backup data is the restored data, and the data restoration process is a full restoration process.

[0099] If the data is backed up using incremental backup, the backup data read is a backup set used for incremental recovery, which includes a full backup and at least one incremental backup. In other words, a backup set for incremental recovery is first selected, and the full data corresponding to the previous backup is restored using the full and incremental backups in that backup set. The incremental backup data, which preserves the time differences, is then applied to the restored full data to obtain the restored data. This data recovery process is an incremental recovery process.

[0100] Step ④': the database management system writes the recovered data to the primary storage device.

[0101] After the database data is restored to the primary storage device, the database management system can read the data from the primary storage device into the memory and continue to execute database services.

[0102] The above data backup process can restore data to the data before the failure. However, this data recovery method cannot achieve point-in-time recovery (PITR) because the database logs cannot be obtained (the logs are not archived).

[0103] Referring to Figure 3, in another approach, a database management system includes a primary database management system and a secondary database management system. The secondary database management system serves as a backup system for the primary database management system. If the primary database management system fails, the secondary database management system takes over the primary database management system's operations. The primary database management system generates database data and logs during database operations. The secondary database management system synchronizes the logs generated by the primary database management system and generates data identical to that of the primary database management system based on the logs and existing data.

[0104] Referring to Figure 3, another data backup method is: the auxiliary database management system assists in data backup, and the database administrator sends data backup instructions to the backup software through the backup and recovery tool. After that, the backup software notifies the auxiliary database management system to take a snapshot of the data generated by the auxiliary database management system, and obtains the data snapshot from the auxiliary database management system. The backup software writes the data snapshot to the backup storage device.

[0105] Referring to Figure 3, one log archiving method is: the auxiliary database management system assists in log archiving, and the database administrator sends a log archiving instruction to the backup software through the backup and recovery tool. After that, the backup software obtains the log stream from the auxiliary database management system (the log stream is the log synchronized by the auxiliary database management system from the primary database management system), and then writes the log stream to the backup storage device.

[0106] Optionally, the storage mode of the backup storage device may be object storage, and the data snapshot is stored in a snapshot bucket, and the log is stored in a log bucket.

[0107] Based on the above data backup method, the database data can be restored, and combined with the above archive logs, the database data can also be restored in time (PITR). PITR starts from a starting point, reads each log in the archive log one by one, and restores the backup data (such as redo) based on the data operations recorded in the log, and then writes the restored data back to the primary storage device.

[0108] During the data backup and log archiving process, the backup data and logs must be transferred between the storage device and the computing device, which consumes bandwidth between the computing and storage devices. Furthermore, the data recovery process also requires the computing device to perform specific actions (such as redoing data based on logs), which consumes computing device resources.

[0109] In response to the above problems, an embodiment of the present application provides a data recovery method, in which the data recovery process is performed by a primary storage device. Referring to the storage system architecture described in FIG4 , a database management system is running in the computing device. The information generated by the database management system includes data, logs, and metadata, all of which are stored in the primary storage device. A backup and recovery service is deployed in the primary storage device, which is used to perform data backup, log archiving, and data recovery processes. When performing data recovery, after receiving the data recovery instruction, the primary storage device can obtain the full backup data and archive logs for recovery at a specified point in time based on the backup data and archive logs in the backup storage device, and then restore the database data to the specified point in time based on the full backup data and archive logs.

[0110] In the technical solution provided by the present application, data recovery is performed by the storage device, and the computing device does not need to participate in the data recovery process. In this way, the resources of the computing device can be saved and the bandwidth of the computing device can be saved.

[0111] The technical solution provided in the embodiments of the present application can be applied in a storage system including a computing device, a primary storage device and a backup storage device, wherein a database management system (i.e., a database management system) runs on the computing device, the primary storage device is used to store database data and logs, and the backup storage device is used to store database backup data and archived logs.

[0112] It can be understood that the premise of the data recovery method provided in the embodiment of the present application is data backup and log archiving, that is, data recovery needs to rely on the backup data and archived logs stored in the backup storage device. Therefore, the following first introduces the data backup method and log archiving method provided in the embodiment of the present application in combination with the architectural diagram of the storage system shown in Figure 4 above.

[0113] As shown in FIG5 , the data backup method provided in the embodiment of the present application includes S501 - S503 .

[0114] S501: A primary storage device receives a data backup instruction.

[0115] The database administrator or user sends a data backup instruction to the primary storage device through the backup and recovery tool to trigger the data backup process. The backup and recovery service in the primary storage device responds to the data backup instruction and starts to perform data backup.

[0116] Optionally, data backup includes full backup and incremental backup. During the data backup process, the data backup instruction issued by the database administrator or user can be a full backup instruction or an incremental backup instruction, which is not limited in the embodiment of the present application.

[0117] S502: The primary storage device generates a data snapshot of the database.

[0118] In an embodiment of the present application, when the primary storage device receives a data backup instruction, it takes a snapshot of the storage volumes in the database that are related to the current business, for example, it takes a snapshot of the storage volumes used to store data in the database, or it takes a consistency snapshot of the storage volumes in the database. A consistency snapshot refers to taking a snapshot of a volume group (which may be called a consistency group) consisting of storage volumes for storing data (pages) of the same business, storage volumes for storing logs, and storage volumes for storing metadata.

[0119] S503: The primary storage device writes the data snapshot to the backup storage device.

[0120] According to the description of the above embodiment, data backup includes full backup and incremental backup. In S503, the primary storage device can write the data snapshot to the backup storage device in a full backup or incremental backup manner according to the instruction of the data backup instruction.

[0121] Optionally, in an embodiment of the present application, during the process of backing up the database data, invalid data can be skipped and only valid data can be copied to achieve efficient data backup. It should be understood that invalid data can include all zero data or some data with unallocated storage space (for example, metadata describing that some data has unallocated storage space).

[0122] Referring to Figure 6, if the data backup instruction indicates a full data backup (that is, a full backup instruction is issued to the primary storage device), the backup recovery service in the primary storage device responds to the full backup instruction, takes a snapshot of the current consistency group of the database, obtains snapshot T0, and then writes snapshot T0 to the backup storage device. Snapshot T0 is the full data of the database at the time of the snapshot.

[0123] 7, if the data backup instruction indicates to perform incremental data backup (i.e., the incremental backup instruction is issued to the primary storage device), the backup recovery service in the primary storage device responds to the incremental backup instruction and takes a snapshot of the current consistency group of the database to obtain a snapshot T x , and determine the current snapshot T x The snapshot difference T between the last snapshot (for example, the last snapshot is T0, that is, the last backup is a full backup) x -T0, and then the snapshot difference T x -T0 writes to the backup storage device.

[0124] The above data backup process is completed by the backup and recovery service in the primary storage device, and there is no need for the database management system in the computing device to participate in the data backup, which can save the resources of the computing device. In addition, the data backup process does not require the storage device and the computing device to interact for data transmission, which can save the bandwidth of the computing device.

[0125] Based on the above data backup method, when a failure occurs and the database data needs to be restored, the database data can be restored to the state before the failure based on the backup data.

[0126] Furthermore, based on the aforementioned data backup method, it can be seen that during the snapshot-based data backup process, consistent snapshots are taken of the relevant storage volumes in the database. These consistent snapshots include log snapshots, meaning that the database logs are also backed up. However, using the logs in the consistent snapshots to perform point-in-time recovery of the database remains challenging. This is because the database has a log recycling mechanism, and the logs between two consecutive snapshots may have discontinuous serial numbers due to log recycling between snapshots. Therefore, during data recovery based on the backup data and logs, data cannot be restored to any point in time due to omissions in the logs.

[0127] For example, assume that two consecutive snapshots are snapshot T0 and snapshot T1, and the time points for taking the snapshots are the first time point and the second time point. If five operations are performed on the data between the first time point and the second time point, that is, five logs are generated between the first time point and the second time point, in one case, after taking the snapshot at the first time point and before taking the snapshot at the second time point, the storage device recycles the database logs once and recycles two logs. Then, when taking the snapshot at the second time point, snapshot T1 only includes the last three of the five logs (the first two logs are recycled). It can be seen that there are omissions in the logs, that is, there are omissions in the transaction time points between the two consecutive snapshots. Then, when restoring the data to a time point between the first time point and the second time point based on snapshot T0, due to the discontinuity of the logs, the data at that time point cannot be restored based on snapshot T0, that is, PITR cannot be achieved.

[0128] To address the issue of discontinuous log sequence numbers preventing PITR, an embodiment of the present application proposes a log archiving method that ensures that no logs between two consecutive snapshots are missed in the archived logs (i.e., ensures that the log sequence numbers are continuous). As shown in Figure 8, an embodiment of the present application provides a log archiving method including S801-S804.

[0129] S801: The primary storage device receives a log archiving instruction.

[0130] The database administrator or user sends a log archiving instruction to the primary storage device through the backup and recovery tool to trigger the log archiving process. The backup and recovery service in the primary storage device responds to the log archiving instruction and starts executing log archiving.

[0131] S802: The primary storage device stops recycling database logs.

[0132] As is understandable, databases typically have a log recycling mechanism, such as periodic log recycling. When a log recycling period is reached, the primary storage device will recycle the logs of the database it stores. In the embodiment of the present application, to ensure that no logs are missed in the continuous log snapshots, the primary storage device stops recycling logs upon receiving the log backup instruction.

[0133] S803: The primary storage device generates a log snapshot of the database at a specified time interval.

[0134] The serial numbers of multiple logs contained in two consecutive log snapshots are continuous.

[0135] In an embodiment of the present application, the primary storage device responds to the log archiving instruction and starts an automatic continuous data protection mechanism, that is, continuously taking snapshots of the database log (or the consistency group of the database) at specified time intervals.

[0136] Optionally, the above-mentioned specified time interval can be set according to actual needs. For example, the specified time interval can be set to 20 seconds, 30 seconds, etc.

[0137] In some embodiments, when the primary storage device receives a log archiving instruction, the backup and recovery service in the primary storage device can also mark the logs generated within a specified time interval, and after generating a log snapshot within a time interval, recycle the marked logs within the time interval.

[0138] In one implementation, a log format awareness module is also deployed in the primary storage device, so that the primary storage device can perceive the log format of the database. It should be understood that the log format awareness module can perceive the log format of some open source databases (such as MySQL, PostgreSQL, etc.). In other words, the databases in the embodiments of this application are all open source data, or are manufacturer-developed databases (for which the log format can be known) that are not open source.

[0139] Based on the above-mentioned log format perception module, in an embodiment of the present application, the primary storage device can obtain the database log from the primary storage device according to the database log format, that is, identify the database log, so as to mark the log and / or generate a log snapshot. For example, when marking the database log, it is necessary to first identify which information is log, and then mark the log; for another example, when taking a snapshot of the database log, it is also necessary to first identify which information is log, and then smoothly take the log snapshot.

[0140] S804: The primary storage device writes the log snapshot to the backup storage device.

[0141] Due to the log recycling mechanism, some logs with serial numbers generated by the computing device may be recycled before being archived to the backup storage device. As a result, these logs with serial numbers cannot be archived to the backup storage device. During the subsequent data recovery process, the serial numbers of the logs obtained based on the archived logs of the backup storage device are discontinuous. In the embodiment of the present application, during the process of archiving the database logs through S801-S804 above, the recycling of the database logs can be delayed, and the logs included in the continuous snapshots can be ensured to be complete logs, that is, to ensure that no logs are missed, thereby facilitating the implementation of PITR when performing data recovery based on the archived logs.

[0142] Optionally, similar to the above data backup, log archiving can be full archiving of logs or incremental archiving of logs. Referring to Figure 9, taking incremental archiving of logs as an example, the primary storage device takes snapshots of the database logs. For example, the log snapshots obtained at three consecutive time intervals are snapshots T0, T1, T2, and T3 respectively. a , snapshot Ta+1 and snapshot T a+2 , the snapshot T0 is stored as a full log snapshot to the backup storage device. Subsequently, the snapshot differences are stored in the form of incremental backup. The primary storage device reads the snapshot differences of the continuous snapshots, such as the snapshot difference T a -T0, snapshot difference T a+1 -T a and the snapshot difference T a+2 -T a+1 and writes the snapshot differences to the backup storage device.

[0143] Optionally, after writing a log snapshot (full or incremental) at a point in time to a backup storage device, if the log snapshot corresponding to the previous point in time is no longer needed, the previous log snapshot can be deleted from the primary storage device. Marking logs facilitates timely recycling of snapshotted logs from the primary storage device based on the tags, thus saving storage space on the primary storage device.

[0144] To address the problem of being unable to implement PITR due to discontinuous log sequence numbers, an embodiment of the present application proposes another log archiving method that can ensure that archived logs are not missed (i.e., ensure that the log sequence numbers are continuous). As shown in Figure 10, an embodiment of the present application provides a log archiving method including S1001-S1003.

[0145] S1001: The primary storage device receives a log archiving instruction.

[0146] S1002: The primary storage device obtains a log stream of the database according to the log format of the database.

[0147] Similar to S803 above, a log format perception module is deployed in the primary storage device, so that the primary storage device can perceive the log format of the database and accurately and smoothly obtain the database log from the primary storage device according to the log format of the database, that is, identify the database log.

[0148] S1003: The primary storage device writes the log stream to the backup storage device.

[0149] It should be understood that in this implementation, when the primary storage device archives logs, it archives the database log stream in a streaming manner. The logs in the log stream are continuous, which ensures that no database logs are missed, which is conducive to achieving PITR.

[0150] Referring to FIG11 , when archiving database logs, after the log format perception module in the primary storage device identifies the logs, the backup recovery service in the primary storage device reads the log stream and writes the log stream to the backup storage device.

[0151] Based on the above data backup and log archiving content, an embodiment of the present application provides a data recovery method, which is executed by a primary storage device. As shown in FIG12 , the method includes S1201 - S1205 .

[0152] S1201: Receive a data recovery instruction.

[0153] The data recovery instruction is used to instruct to recover the data of the database to a specified time point, and the specified time point may be any time point before the database failure occurs. Optionally, the data recovery instruction may include the specified time point.

[0154] S1202: Based on the backup data in the backup storage device, obtain full backup data whose backup time is earlier than the specified time point.

[0155] In an embodiment of the present application, in the process of restoring data at a specified time point, the starting point of data recovery is first determined based on the checkpoint of the database (the starting point is earlier than the specified time point), and the data at the starting point is obtained (it should be understood that the data at the starting point is the full data).

[0156] In one case, when the backup data of the data at the starting point is full data, the data at the starting time point can be directly read from the backup data, and the read data is the full backup data of the starting point.

[0157] In another case, when the backup data of the starting point data is incremental data, the process of obtaining the starting point data (that is, the full backup data whose backup time is earlier than the specified time point) can specifically include: obtaining a full backup data that is earlier than the starting point and closest to the starting time point from the backup storage device, and based on the full backup data and the incremental data of the intermediate process, the full backup data corresponding to the starting point can be determined.

[0158] S1203. Obtain archive logs based on the archive logs of the database stored in the backup storage device. The archive logs include multiple logs generated before the specified time point and after the backup time of the full backup data, and the serial numbers of the multiple logs are continuous.

[0159] For the log archiving method of S801-S804 above, in an embodiment of the present application, first, a full log snapshot that is earlier than the above starting point and closest to the starting point is obtained from the archive log of the database; secondly, a target snapshot time point (referring to the time point of taking the snapshot) that is later than the above specified time point but closest to the specified time point is determined, and based on the above full log snapshot and the snapshot differences between them, all logs between the starting point and the target snapshot time point are restored, and all logs between the starting point and the specified time point are obtained as archive logs. Referring to the above log archiving method, it can be seen that the serial numbers of the logs in the obtained archive logs are continuous.

[0160] For the log archiving method of S1001-S1003 above, all logs between the starting point and the specified time point can be directly read from the log stream stored in the backup storage device as archive logs, and the serial numbers of the logs in the archive log are continuous.

[0161] S1204: Recover the database data based on the full backup data and archive logs to obtain the database data at a specified time point.

[0162] In combination with FIG12 , as shown in FIG13 , the above S1204 may be specifically implemented through S1204a.

[0163] S1204a. Starting from the full backup data, the database is restored according to the sequence of the logs in the archive logs to obtain the data of the database at a specified time point.

[0164] For example, assuming that the specified time point is 12:00:15 (12:00:15), the full backup data obtained above is the data at 12:00:00, and the full backup data is T0. The archived log is the log from 12:00:00 to 12:00:30, and there are 4 logs between 12:00:00 and 12:00:30. The following is a brief illustration of the data recovery process with reference to the operations corresponding to the 4 logs in the example in Table 1 below.

[0165] Table 1

[0166] Combined with Table 1, the log sequence numbers from small to large represent the time when the logs were generated from early to late. Taking T0 as the starting point for data recovery, data recovery is performed from Table 1 in the order of the log sequence numbers from small to large. The details are as follows:

[0167] 1. According to the operation in log 1, delete data 1 from data T0 to obtain data T1.

[0168] 2. According to the operation in log 2, add data 2 to data T1 to obtain data T2.

[0169] 3. According to the operation in log 3, data 3 in data T2 is modified to data 4, obtaining data T3.

[0170] 4. According to the operation in log 4, add data 5 to data T3 to obtain data T4. Then T4 is the data at the specified time point 12:00:15.

[0171] S1205: Store data at a specified time point.

[0172] The primary storage device performs data recovery based on the backup data and archive logs to obtain the data at the specified time point, and stores the data at the specified time point in the storage space of the primary storage device so that the computing node can read and use the data later.

[0173] In summary, the data recovery method provided by the embodiments of the present application is a method in which a storage device performs a data recovery process based on backup data and archived logs, and the recovered data is stored in a storage space managed by the storage device. Compared to a solution in which a computing device performs data recovery based on backup data and archived logs obtained from a backup storage device and then sends the recovered data to a primary storage device for storage, the solution of the present application does not require the computing device to participate in data recovery, thereby saving computing device resources. Furthermore, the data recovery process is performed by the storage device, and the data recovery process does not require the storage device to interact with the computing device for data transmission. This saves computing device bandwidth, ensures that the computing device has sufficient resources to run database services, and thus ensures the smooth operation of database services.

[0174] Furthermore, compared to the case where the archived log serial numbers are discontinuous, the data corresponding to the missed logs cannot be recovered, resulting in the inability to restore the data to the specified time point. In the solution of the present application, since the serial numbers of the archived logs used for data recovery are continuous (that is, the logs are not missed), the storage device can restore the data to the specified time point based on the full backup data and complete logs earlier than the specified time point, thereby ensuring the accuracy of data recovery.

[0175] It is understandable that the above-mentioned data storage method is executed by a storage device, and in order to realize the above-mentioned functions, the storage device includes a hardware structure and / or software module corresponding to the execution of each function. It should be easily appreciated by those skilled in the art that, in combination with the method steps of each example described in the embodiments disclosed herein, the embodiments of the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in a hardware-driven or computer software-driven hardware manner depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the embodiments of the present application.

[0176] In the embodiment of the present application, the functional modules of the storage device can be divided according to the above method example. For example, each functional module can be divided according to each function, or two or more functions can be integrated into one processing module. The above integrated modules can be implemented in the form of hardware or in the form of software functional modules. It should be noted that the division of modules in the embodiment of the present application is schematic and is only a logical functional division. In actual implementation, there may be other division methods.

[0177] 14 shows a possible structural diagram of the storage device involved in the above embodiment, in which the functional modules are divided according to their functions. The storage device includes a receiving module 1401 , an acquiring module 1402 , a data recovery module 1403 and a storage module 1404 .

[0178] Among them, the receiving module 1401 is used to execute S501, S801, S1001, and S1201 in the above method embodiment; the acquisition module 1402 is used to execute S1002, S1202, and S1203 in the above method embodiment; the data recovery module 1403 is used to execute S1204 (including 1204a) in the above method embodiment, and the storage module 1404 is used to execute S1205 in the above method embodiment.

[0179] Optionally, the storage device provided in the embodiment of the present application further includes a control module 1405, a log recovery module 1406, a generation module 1407, a write module 1408, and a marking module 1409. The control module 1405 is configured to execute S802 in the above method embodiment; the log recovery module 1406 is configured to recover database logs; the generation module 1407 is configured to execute S502 and S803 in the above method embodiment; the write module 1408 is configured to execute S503, S804, and S1003 in the above method embodiment; and the marking module 1409 is configured to mark logs generated within a specified time interval.

[0180] The modules of the above-mentioned storage device can also be used to perform other actions in the above-mentioned method embodiment. All relevant contents of each step involved in the above-mentioned method embodiment can be referred to the functional description of the corresponding functional module and will not be repeated here.

[0181] In the case of adopting an integrated unit, Figure 15 shows another possible structural diagram of the storage device involved in the above embodiment. As shown in Figure 15, the storage device provided in the embodiment of the present application may include: a processing module 1501 and a communication module 1502. The processing module 1501 can be used to control and manage the actions of the storage device. For example, the processing module 1501 can be used to support the acquisition module 1402, data recovery module 1403, control module 1405, log recovery module 1406, generation module 1407, write module 1408 and marking module 1409 in Figure 14 above to perform corresponding steps, and / or other processes for the technology described herein. The communication module 1502 can be used to support the communication between the communication device and other network entities. For example, the communication module 1502 is used to execute the corresponding steps performed by the above-mentioned receiving module 1401. As shown in Figure 15, the communication device may also include a storage module 1503 for storing computer instructions and data (for example, storage recovered data).

[0182] The processing module 1501 may be a processor or a controller (for example, the processor 1501 may be the controller 1201 in the storage node 120 in FIG. 1 ). The processor 1501 may 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, and the like. The communication module 1502 may be a communication interface (for example, the communication module 1502 may be the network card 1202 in the storage node 120 in FIG. 1 ). The storage module 1503 may be a memory (for example, the storage module 1503 may be the memory or hard disk 1203 of the storage node 120 in FIG. 1 ). When the processing module 1501 is a processor, the communication module 1502 is a communication interface, and the storage module 1503 is a memory, the processor, transceiver, and memory may be connected via a bus.

[0183] For more details on how the modules included in the above storage device implement the above functions, please refer to the descriptions in the previous method embodiments, which will not be repeated here. The various embodiments in this specification are described in a progressive manner, and the same or similar parts between the various embodiments can be referenced to each other. Each embodiment focuses on the differences from other embodiments.

[0184] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware, or any combination thereof. When implemented using a software program, all or part of the embodiments may be implemented in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer instructions are loaded and executed on a computer, all or part of the processes or functions in accordance with the embodiments of the present application are generated. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via a wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) method. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated therein. The available medium may be a magnetic medium (eg, a floppy disk, a magnetic disk, a magnetic tape), an optical medium (eg, a digital video disc (DVD)), or a semiconductor medium (eg, a solid state drive (SSD)).

[0185] Through the description of the above embodiments, those skilled in the art will clearly understand that for the sake of convenience and brevity, only the division of the above functional modules is used as an example. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. The specific working processes of the above-described systems, devices, and units can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0186] In the several embodiments provided in this application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the division of the modules or units is only a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.

[0187] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.

[0188] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.

[0189] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) or a processor to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as flash memory, mobile hard disk, read-only memory, random access memory, magnetic disk or optical disk.

[0190] The above is only a specific embodiment of the present application, but the scope of protection of this application is not limited to this. Any changes or substitutions within the technical scope disclosed in this application should be included in the scope of protection of this application. Therefore, the scope of protection of this application should be based on the scope of protection of the claims.

Claims

1. A data recovery method, characterized in that: A main storage device applied to a storage system, the storage system comprising a computing device, the main storage device and a backup storage device, a database management system running on the computing device, the main storage device being used to store data and logs of the database, and the backup storage device being used to store backup data and archive logs of the database; the method comprising: Receiving a data recovery instruction; the data recovery instruction is used to instruct to recover the data of the database to a specified time point; Based on the backup data in the backup storage device, obtaining full backup data whose backup time is earlier than the specified time point; Based on the archive log of the database stored in the backup storage device, obtaining the archive log; the archive log includes a plurality of logs generated before the specified time point and after the backup time of the full backup data, and the serial numbers of the plurality of logs are continuous; Performing data recovery on the database according to the full backup data and the archive log to obtain the data of the database at the specified time point; The data at the specified time point is stored.

2. The method according to claim 1, characterized in that The backup data of the database is a data snapshot, and the method further includes: Receive a data backup instruction; the data backup instruction is used to instruct to back up the data in the database; Generate a data snapshot of the database; The data snapshot is written to the backup storage device in a full backup or incremental backup manner.

3. The method according to claim 1 or 2, characterized in that: The archive log is a log snapshot, and the method further includes: receiving a log archiving instruction, wherein the log archiving instruction is used to instruct to archive the logs of the database; Generate a log snapshot of the database at a specified time interval; wherein the serial numbers of the multiple logs included in two consecutive log snapshots are continuous; The log snapshot is written to the backup storage device in a full backup or incremental backup manner.

4. The method according to claim 3, characterized in that Before generating the log snapshot of the database at the specified time interval, the method further includes: Recovering logs of the database; When the log archiving instruction is received, the log recovery of the database is stopped.

5. The method according to claim 3 or 4, characterized in that: The method further comprises: When receiving the log archiving instruction, marking the logs generated within the specified time interval; After the log snapshot is generated, the marked log is recycled.

6. The method according to any one of claims 3 to 5, characterized in that: The method further comprises: According to the log format of the database, the log of the database is obtained from the primary storage device to mark the log and / or generate a log snapshot.

7. The method according to claim 1 or 2, characterized in that: The archive log is a log stream, and the method further includes: According to the log format of the database, obtaining the log stream of the database; The log stream of the database is written into the backup storage device.

8. The method according to any one of claims 1 to 7, characterized in that: The recovering the database according to the full backup data and the archive log to obtain the data of the database at the specified time point includes: Taking the full backup data as a starting point, data recovery is performed on the database according to the arrangement order of the serial numbers of the logs in the archive logs to obtain the data of the database at the specified time point.

9. A storage device, characterized in that: The storage device is a main storage device in the storage system, and the storage system further includes a computing device and a backup storage device. A database management system runs on the computing device. The main storage device is used to store the data and logs of the database, and the backup storage device is used to store the backup data and archive logs of the database. The storage device includes a receiving module, an acquisition module, a data recovery module and a storage module. The receiving module is used to receive a data recovery instruction; the data recovery instruction is used to instruct to recover the data of the database to a specified time point; The acquisition module is used to obtain the full backup data whose backup time is earlier than the specified time point based on the backup data in the backup storage device; The acquisition module is further used to obtain an archive log based on the archive log of the database stored in the backup storage device; the archive log includes a plurality of logs generated before the specified time point and after the backup time of the full backup data, and the serial numbers of the plurality of logs are continuous; The data recovery module is used to recover the database data according to the full backup data and the archive log to obtain the data of the database at the specified time point; The storage module is used to store the data at the specified time point.

10. The storage device according to claim 9, characterized in that: The backup data of the database is a data snapshot; the storage device also includes a generation module and a writing module; The receiving module is further used to receive a data backup instruction; the data backup instruction is used to instruct to back up the data in the database; The generating module is used to generate a data snapshot of the database; The writing module is used to write the data snapshot into the backup storage device in a full backup or incremental backup manner.

11. The storage device according to claim 9 or 10, characterized in that: The archived log is a log snapshot; The receiving module is further used to receive a log archiving instruction, where the log archiving instruction is used to instruct to archive the logs of the database; The generating module is further used to generate a log snapshot of the database at a specified time interval; wherein the serial numbers of the multiple logs included in two consecutive log snapshots are continuous; The writing module is used to write the log snapshot into the backup storage device in a full backup or incremental backup manner.

12. The storage device according to claim 11, characterized in that: The storage device also includes a log recovery module and a control module; The log recovery module is used to recover the logs of the database; The control module is used to control the log recovery module to stop recovering the logs of the database when the receiving module receives the log archiving instruction.

13. The storage device according to claim 11 or 12, characterized in that: The storage device also includes a marking module; The marking module is used to mark the logs generated within the specified time interval when the receiving module receives the log archiving instruction; The log recovery module is further used to recover the marked logs after generating the log snapshot.

14. The storage device according to any one of claims 11 to 13, characterized in that: The acquisition module is further used to acquire the log of the database from the primary storage device according to the log format of the database, so as to mark the log and / or generate a log snapshot.

15. The storage device according to claim 9 or 10, characterized in that: The archive log is a log stream; The acquisition module is further used to acquire the log stream of the database according to the log format of the database; The writing module is further used to write the log stream of the database into the backup storage device.

16. The storage device according to any one of claims 9 to 15, characterized in that: The data recovery module is specifically used to recover the data of the database based on the full backup data as the starting point and the arrangement order of the serial numbers of the logs in the archive log to obtain the data of the database at the specified time point.

17. A storage device, characterized in that: The method comprises a memory and at least one processor connected to the memory, wherein the memory is used to store computer program code, and the computer program code comprises computer instructions. When the computer instructions are executed by the at least one processor, the storage device executes the method according to any one of claims 1 to 8.

18. A storage system, characterized in that: It comprises a computing device, a primary storage device and an auxiliary storage device; a database management system is run on the computing device, the primary storage device is used to store the data and logs of the database, and the backup storage device is used to store the backup data and archive logs of the database; the primary storage device is used to execute the method according to any one of claims 1 to 8 to recover the data of the database.

19. A computer-readable storage medium, characterized in that: Computer instructions are stored, and when the computer instructions are executed on a computer, the method according to any one of claims 1 to 8 is executed.

Citation Information

Patent Citations

  • Data processing method and system

    CN109165117A

  • Method and equipment for recovering data based on backup system

    CN113360322A

  • Methods and systems for restoring data containers in a storage system

    US20170060699A1

  • Remote control of backup media in a secondary storage subsystem through access to a primary storage subsystem

    US6353878B1

  • Systems and methods for restoring data files

    US9852200B1

Cited By

  • Disk backup method and device, storage medium and electronic equipment

    CN119938409A

  • Distributed report file management method and system, electronic equipment and storage medium

    CN120448361A

  • Database recoverable time interval acquisition method, medium and equipment

    CN122111764A