Data disaster recovery method, device and system, node equipment and standby node equipment

By using the page modification information bitmap in the database disaster recovery system to synchronize only the data modification pages of the main cluster, the problem of large data transmission volume and long RTO in WAL log replication mode is solved, and more efficient data synchronization and recovery are achieved.

CN118656248APending Publication Date: 2024-09-17HUAWEI CLOUD COMPUTING TECHNOLOGIES CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202310551521.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Priority Date
2023-03-09
Filing Date
2023-05-16
Publication Date
2024-09-17

AI Technical Summary

Technical Problem

In the database disaster recovery system, the WAL log-based streaming replication method requires a large amount of data to be transmitted between the main cluster and the disaster recovery cluster, which takes up a lot of network resources and has a long recovery time objective (RTO).

Method used

By using the page modification information bitmap in the node device of the main cluster to determine the pages where data modification occurred, and only synchronizing the data of these pages to the disaster recovery cluster, the amount of data transmission is reduced. The disaster recovery cluster directly saves the backup data without replaying the log. Complete synchronization quickly.

Benefits of technology

It reduces the amount of data transmission between the main cluster and the disaster recovery cluster, shortens the recovery time objective (RTO), and improves the reliability and efficiency of the database disaster recovery system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118656248A
    Figure CN118656248A
Patent Text Reader

Abstract

The invention discloses a data disaster recovery method, device and system, node equipment and standby node equipment, and relates to the field of data storage. The database disaster recovery system comprises a main cluster and a disaster recovery backup cluster, and the main cluster and the disaster recovery backup cluster periodically perform data synchronization. In a data synchronization process, node equipment in a main cluster can determine a to-be-synchronized page subjected to data modification in the node equipment according to a page modification information bitmap, copy data of the to-be-synchronized page, and send a page address of the to-be-synchronized page and the data of the to-be-synchronized page to standby node equipment corresponding to the node equipment; the backup node equipment is equipment in the disaster recovery backup cluster. In the embodiment of the invention, the node equipment in the main cluster only synchronizes the data of the page subjected to data modification to the backup node equipment in the disaster recovery backup cluster, so that the data transmission quantity between the main cluster and the disaster recovery backup cluster can be reduced, network resources occupied by data transmission are reduced, and RTO is effectively shortened.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] CROSS-REFERENCE TO RELATED APPLICATIONS

[0002] This application claims the priority of the Chinese patent application filed with the China National Intellectual Property Administration on March 9, 2023, with application number 202310224449.5 and application name “A Data Disaster Recovery Method”, all contents of which are incorporated by reference in this application. Technical Field

[0003] The present application relates to the technical field of data storage, and in particular to a data disaster recovery method, apparatus, system, node equipment, and backup node equipment. Background Art

[0004] The database disaster recovery system refers to the establishment of two or more database centers with the same functions in different data centers, which can monitor the health status and switch functions between each other. When a database center stops working due to an accident, it can be switched to another database center, which provides services so that the database disaster recovery system can continue to work normally. The database center can also be called a data storage cluster. At least one of the two database centers can be used as the main cluster, and the remaining database centers can be used as disaster recovery clusters. The main cluster can provide read and write services, and the disaster recovery cluster can provide read services.

[0005] In the database disaster recovery system, data will be synchronized periodically between the main cluster and the disaster recovery cluster. When synchronizing data between the main cluster and the disaster recovery cluster, a streaming replication method based on write ahead log (WAL) is usually adopted. In this method, the main cluster synchronizes the generated WAL log to the disaster recovery cluster, and the WAL log is generated and sent in real time.

[0006] As the amount of data that needs to be stored in actual application scenarios increases, a large number of WAL logs will be generated. When using streaming replication based on WAL logs for data synchronization, the amount of data that needs to be transmitted between the primary cluster and the disaster recovery cluster will be large, which will not only occupy more network resources, but also lead to a longer disaster recovery time object (RTO). Summary of the invention

[0007] The embodiments of the present application provide a data disaster recovery method, apparatus, system, node device and backup node device, which can save network resources occupied by data transmission and effectively shorten RTO.

[0008] In a first aspect, an embodiment of the present application provides a data disaster recovery method, which can be applied to a database disaster recovery system, wherein the database disaster recovery system includes a main cluster and a disaster recovery cluster, and the main cluster and the disaster recovery cluster periodically perform data synchronization. During the data synchronization process, a node device in the main cluster determines a page to be synchronized in which data modification has occurred in the node device according to a page modification information bitmap of the node device, and copies the data of the page to be synchronized. The page modification information bitmap is used to indicate the page address of the page in which data modification has occurred in the node device.

[0009] The node device sends the page address of the page to be synchronized and the data of the page to be synchronized to the standby node device corresponding to the node device. The standby node device stores the data of the page to be synchronized in the external memory of the standby node device according to the page address of the page to be synchronized. The standby node device is a device in the disaster recovery cluster.

[0010] In an embodiment of the present application, the node device in the main cluster only synchronizes the data of the page where data modification occurs to the standby node device in the disaster recovery cluster, which can reduce the amount of data transmission between the main cluster and the disaster recovery cluster and reduce the network resources occupied by data transmission; and the standby node device in the disaster recovery cluster can directly save the backup data sent by the node device of the main cluster, without the need to save the backup data by replaying the log, so the synchronization can be completed quickly and the RTO can be effectively shortened.

[0011] In one possible implementation, the page modification information bitmap of the node device may include multiple indicator bits, each indicator bit corresponding to a page storing data; when the node device receives a data write operation, it can determine the target page corresponding to the data write operation, and set the indicator bit corresponding to the target page in the page modification information bitmap to the page modification state, so that the node device can quickly determine the page where data modification occurs when performing data synchronization.

[0012] In a possible implementation, if a data deletion operation is received, the node device may wait for a set period of time and then delete the data indicated to be deleted by the data deletion operation.

[0013] The node device waits for a set period of time before executing the data deletion operation, which can ensure that the data query operation in the disaster recovery cluster can be executed normally, and avoid the disaster recovery cluster querying a certain data, and the node device in the main cluster has deleted the data and caused the data query to fail.

[0014] In a possible implementation, after the standby node device saves the data of the page to be synchronized to the external memory of the standby node device, if it is determined that the original data at the page address of the page to be synchronized is stored in the memory of the standby node device, the original data at the page address of the page to be synchronized in the memory is deleted, and the data at the page address of the page to be synchronized in the external memory is read into the memory of the standby node device again. The original data is read into the memory from the page address of the page to be synchronized in the external memory before executing this data synchronization.

[0015] Since the original data is inconsistent with the data stored in the page address of the page to be synchronized in the node device of the main cluster, the original data is not suitable for output as the query result. The data stored in the external memory of the standby node device is consistent with the data stored in the page address of the page to be synchronized in the node device of the main cluster. The standby node device deletes the original data under the page address of the page to be synchronized in the memory, and re-reads the data in the page address of the page to be synchronized in the external memory into the memory of the standby node device, so that the user can query the new data after data synchronization, so that the new data after data synchronization can take effect in time.

[0016] In a possible implementation, during the data synchronization process, the node device can also generate a global consistency snapshot, add the minimum transaction number in the global consistency snapshot and the log sequence number of the latest log on the node device to the control file, and send the control file to the standby node device. The minimum transaction number is the transaction number of the first operation transaction executed in the operation transaction being executed by the main cluster during the data synchronization. The standby node device performs query operations based on the global consistency snapshot and control file received during the data synchronization process.

[0017] In one possible implementation, when receiving a query operation, the standby node device obtains a query snapshot, which is a globally consistent snapshot received during the last data synchronization process before the query operation is received. During the query operation, the standby node device obtains the log sequence number of the page to be queried, which is the log sequence number of the latest log corresponding to the page to be queried. The standby node device obtains the minimum transaction number in the current control file, which is the control file received during the last data synchronization process before the current moment. If the log sequence number of the page to be queried is greater than the log sequence number in the query snapshot, and the minimum transaction number in the query snapshot is less than the minimum transaction number in the current control file, an error prompt message is output.

[0018] If the log sequence number of the page to be queried is greater than the log sequence number in the query snapshot, it means that the page to be queried has been modified after the data synchronization corresponding to the query snapshot. If the minimum transaction number in the query snapshot is less than the minimum transaction number in the current control file, it means that after receiving the query snapshot, the standby node device has performed a second data synchronization and received a new control file and a new global consistency snapshot. It can be determined that the page to be queried was modified during the second data synchronization. At this time, the standby node device performs query operations based on the query snapshot and determines the visibility of each piece of data, which will lead to query errors. To avoid querying incorrect data, the standby node device can output error prompt information.

[0019] In a possible implementation, the global consistency snapshot also includes a first transaction commit number, which is the transaction commit number of the last transaction committed in the primary cluster during the data synchronization. The page to be queried stores at least one piece of data.

[0020] If the log sequence number of the page to be queried is less than or equal to the log sequence number in the query snapshot, or the minimum transaction number in the query snapshot is greater than or equal to the minimum transaction number in the current control file, the standby node device obtains the second transaction commit number of each piece of data in the page to be queried; wherein the second transaction commit number of any piece of data is the transaction commit number of the operation transaction corresponding to the data. The standby node device obtains the first transaction commit number in the query snapshot; the first transaction commit number is the transaction commit number of the last operation transaction committed in the primary cluster when the query snapshot is generated. The standby node device outputs data whose second transaction commit number is less than the first transaction commit number in the query snapshot.

[0021] For any piece of data, if the second transaction commit number of the data is greater than or equal to the first transaction commit number in the query snapshot, it means that the commit time of the task that modifies the data is later than the commit time of the last operation transaction in the main cluster during the last data synchronization before the query operation is executed, that is, the commit time of the task that modifies the data may be after the query operation is started. Therefore, the data is not visible when the query operation is executed, and the standby node device may not output the data. Otherwise, it is considered that the data is visible when the query operation is executed, and the standby node device may output the data, thereby ensuring the consistency of data query between the main cluster and the disaster recovery cluster.

[0022] The minimum transaction number, transaction commit number, and log sequence number can be used to prevent the disaster recovery cluster from querying incorrect data when performing data query operations, ensure the consistency of data queries between the main cluster and the disaster recovery cluster, and improve the correctness of data queried by the disaster recovery cluster.

[0023] In the second aspect, an embodiment of the present application provides a data disaster recovery method, which can be executed by any node device in the main cluster of the database disaster recovery system. During the data synchronization process, the node device determines the page to be synchronized in which data modification has occurred in the node device according to the page modification information bitmap of the node device; wherein the page modification information bitmap is used to indicate the page address of the page in which data modification has occurred in the node device. The node device copies the data of the page to be synchronized, and sends the page address of the page to be synchronized and the data of the page to be synchronized to the standby node device corresponding to the node device; wherein the standby node device is a device in the disaster recovery cluster.

[0024] In a possible implementation, the page modification information bitmap includes multiple indicator bits, each indicator bit corresponds to a page storing data. When the node device receives a data write operation, it determines the target page corresponding to the data write operation, and sets the indicator bit corresponding to the target page in the page modification information bitmap to the page modification state.

[0025] In a possible implementation, if a node device receives a data deletion operation, it waits for a set period of time and then deletes the data that the data deletion operation indicates to delete.

[0026] In a third aspect, an embodiment of the present application provides a data disaster recovery method, which can be executed by any standby node device in a disaster recovery cluster of a database disaster recovery system. During the data synchronization process, the standby node device receives the page address of the page to be synchronized and the data of the page to be synchronized sent by the node device corresponding to the standby node device, and stores the data of the page to be synchronized in the external memory of the standby node device according to the page address of the page to be synchronized. Among them, the node device is a device in the main cluster, and the page to be synchronized is a page where data modification is determined according to the page modification information bitmap of the node device.

[0027] In a possible implementation, after the standby node device saves the data of the page to be synchronized to the external memory of the standby node device, if it is determined that the original data at the page address of the page to be synchronized is stored in the memory of the standby node device, the original data at the page address of the page to be synchronized in the memory is deleted, and the data at the page address of the page to be synchronized in the external memory is read into the memory of the standby node device again. The original data is read into the memory from the page address of the page to be synchronized in the external memory before executing this data synchronization.

[0028] In a possible implementation, during the data synchronization process, the standby node device may receive and save the global consistency snapshot and control file generated during the data synchronization sent by the corresponding node device.

[0029] In a possible implementation, the global consistency snapshot includes the minimum transaction number and the log sequence number of the latest log on the node device. The minimum transaction number is the transaction number of the first operation transaction executed among the operation transactions being executed by the primary cluster during the data synchronization.

[0030] When receiving a query operation, the standby node device obtains a query snapshot; the query snapshot is the control file received during the last data synchronization process before the query operation is received. During the query operation, the standby node device obtains the log sequence number of the page to be queried and the minimum transaction number in the current control file; the log sequence number of the page to be queried is the log sequence number of the latest log corresponding to the page to be queried; the current control file is the control file received during the last data synchronization process before the current moment. If the log sequence number of the page to be queried is greater than the log sequence number in the query snapshot, and the minimum transaction number in the query snapshot is less than the minimum transaction number in the current control file, the standby node device outputs an error prompt message.

[0031] In a possible implementation, at least one piece of data is stored in the page to be queried. If the log sequence number of the page to be queried is less than or equal to the log sequence number in the query snapshot, or the minimum transaction number in the query snapshot is greater than or equal to the minimum transaction number in the current control file, the standby node device obtains the second transaction commit number of each piece of data in the page to be queried and the first transaction commit number in the query snapshot; wherein the second transaction commit number of any piece of data is the transaction commit number of the operation transaction corresponding to any piece of data; the first transaction commit number is the transaction commit number of the last operation transaction committed in the main cluster when the query snapshot is generated; the standby node device outputs the data whose second transaction commit number is less than the first transaction commit number in the query snapshot.

[0032] In a fourth aspect, an embodiment of the present application provides a data disaster recovery device, which is applied to any node device in a main cluster, the main cluster is located in a database disaster recovery system, and the database disaster recovery system includes a main cluster and a disaster recovery cluster. The data disaster recovery device may include:

[0033] The page identification module is used to determine the page to be synchronized in the node device where data modification has occurred according to the page modification information bitmap of the node device during the data synchronization process; the page modification information bitmap is used to indicate the page address of the page where data modification has occurred in the node device;

[0034] The data synchronization module is used to copy the data of the page to be synchronized, and send the page address and data of the page to be synchronized to the standby node device corresponding to the node device; the standby node device is a device in the disaster recovery cluster.

[0035] In a possible implementation, the page modification information bitmap includes a plurality of indication bits, each indication bit corresponds to a page storing data; the page identification module may also be used to:

[0036] If a data write operation is received, determining a target page corresponding to the data write operation;

[0037] The indication bit corresponding to the target page in the page modification information bitmap is set to the page modification state.

[0038] In a possible implementation, the data disaster recovery device may further include:

[0039] The data deletion module is used to delete the data indicated to be deleted by the data deletion operation after waiting for a set period of time when receiving the data deletion operation.

[0040] In a fifth aspect, an embodiment of the present application provides a data disaster recovery device, which is applied to any standby node device in a disaster recovery cluster, where the disaster recovery cluster is located in a database disaster recovery system, where the database disaster recovery system includes a main cluster and a disaster recovery cluster; the data disaster recovery device includes:

[0041] The data receiving module is used to receive the page address and data of the page to be synchronized sent by the node device corresponding to the standby node device during the data synchronization process; the node device is a device in the main cluster; the page to be synchronized is a page where data modification is determined according to the page modification information bitmap of the node device;

[0042] The data processing module is used to store the data of the page to be synchronized in the external memory of the standby node device according to the page address of the page to be synchronized.

[0043] In a possible implementation, the data processing module may also be used to:

[0044] If it is determined that the original data in the page address of the page to be synchronized is stored in the memory of the standby node device, the original data under the page address of the page to be synchronized in the memory is deleted; the original data is read into the memory from the page address of the page to be synchronized in the external memory before performing this data synchronization;

[0045] The data in the page address of the page to be synchronized in the external memory is read into the memory of the standby node device again.

[0046] In a possible implementation, the data receiving module may also be used to:

[0047] During the data synchronization process, the global consistency snapshot and control file generated during the data synchronization sent by the node device corresponding to the standby node device are received and saved.

[0048] In a possible implementation, the global consistency snapshot includes the minimum transaction number and the log sequence number of the latest log on the node device; the minimum transaction number is the transaction number of the operation transaction that is first executed among the operation transactions being executed by the main cluster during the data synchronization; the data disaster recovery device may also include a data query module; the data query module is used to:

[0049] If a query operation is received, a query snapshot is obtained; the query snapshot is the control file received during the last data synchronization process before the query operation is received;

[0050] During the query operation, the log sequence number of the page to be queried is obtained; the log sequence number of the page to be queried is the log sequence number of the latest log corresponding to the page to be queried;

[0051] Get the minimum transaction number in the current control file; the current control file is the control file received during the last data synchronization before the current time;

[0052] If the log sequence number of the page to be queried is greater than the log sequence number in the query snapshot, and the minimum transaction number in the query snapshot is less than the minimum transaction number in the current control file, an error prompt message is output.

[0053] In a possible implementation, at least one piece of data is stored in the page to be queried; the data query module is further used to:

[0054] If the log sequence number of the page to be queried is less than or equal to the log sequence number in the query snapshot, or the minimum transaction number in the query snapshot is greater than or equal to the minimum transaction number in the current control file, then the second transaction commit number of each piece of data in the page to be queried is obtained; wherein the second transaction commit number of any piece of data is the transaction commit number of the operation transaction corresponding to any piece of data;

[0055] Get the first transaction commit number in the query snapshot; the first transaction commit number is the transaction commit number of the last operation transaction committed in the primary cluster when the query snapshot is generated;

[0056] Output data whose second transaction commit number is less than the first transaction commit number in the query snapshot.

[0057] In a sixth aspect, an embodiment of the present application provides a node device, comprising a memory and a processor, wherein a computer program is stored in the memory; the processor is used to read and execute the computer program stored in the memory, so that any one of the methods provided in the first aspect is executed.

[0058] In the seventh aspect, an embodiment of the present application provides a standby node device, comprising a memory and a processor, wherein a computer program is stored in the memory; the processor is used to read and execute the computer program stored in the memory, so that any one of the methods provided in the second aspect is executed.

[0059] In an eighth aspect, an embodiment of the present application provides a main cluster, including at least one node device, and the node device can adopt the node device provided in the fifth aspect.

[0060] In a ninth aspect, an embodiment of the present application provides a disaster recovery cluster, including at least one standby node device, and the standby node device may adopt the standby node device provided in the sixth aspect.

[0061] In a tenth aspect, an embodiment of the present application provides a database disaster recovery system, comprising the main cluster provided in the seventh aspect and the disaster recovery cluster provided in the eighth aspect.

[0062] In an eleventh aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to enable a computer to execute any one of the methods provided in the first aspect above.

[0063] In a twelfth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to enable a computer to execute any one of the methods provided in the above-mentioned second aspect.

[0064] In a thirteenth aspect, an embodiment of the present application provides a computer program product comprising computer executable instructions, which are used to enable a computer to execute any one of the methods provided in the first aspect above.

[0065] In a fourteenth aspect, an embodiment of the present application provides a computer program product comprising computer executable instructions, which are used to enable a computer to execute any one of the methods provided in the second aspect.

[0066] The technical effects that can be achieved in any of the second to fourteenth aspects mentioned above can refer to the description of the beneficial effects in the first aspect mentioned above, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0067] Figure 1 A schematic diagram of the structure of a database disaster recovery system provided in an embodiment of the present application;

[0068] Figure 2 An interactive schematic diagram of a data disaster recovery method provided in an embodiment of the present application;

[0069] Figure 3A schematic diagram of a page modification information bitmap provided in an embodiment of the present application;

[0070] Figure 4 A schematic diagram of the effect of a data synchronization process provided by an embodiment of the present application;

[0071] Figure 5 A flowchart of a data query process of a standby node device provided in an embodiment of the present application;

[0072] Figure 6 A schematic diagram of a data disaster recovery device provided in an embodiment of the present application;

[0073] Figure 7 A schematic diagram of another data disaster recovery device provided in an embodiment of the present application;

[0074] Figure 8 A schematic diagram of another data disaster recovery device provided in an embodiment of the present application;

[0075] Fig. 9 A schematic diagram of another data disaster recovery device provided in an embodiment of the present application;

[0076] Fig.10 A schematic diagram of the structure of a node device provided in an embodiment of the present application;

[0077] Fig.11 A schematic diagram of the structure of a standby node device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0078] In order to make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the embodiments of the present application will be described in detail below in conjunction with the accompanying drawings. The terms used in the implementation mode of the present application are only used to explain the specific embodiments of the present application, and are not intended to limit the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application.

[0079] Before introducing the specific solutions provided by the embodiments of the present application, some terms in the present application are explained to facilitate understanding by those skilled in the art, and the terms in the present application are not limited.

[0080] (1) Disaster recovery: A component of system high availability technology. Two or more database centers with the same functions are established. The database centers can monitor each other's health status and switch functions. When one database center stops working due to an accident (such as fire, earthquake, etc.), it can be switched to another database center so that the system functions can continue to work normally.

[0081] (2) RTO: Recovery Time Objective refers to the time required to restore business to normal after a disaster occurs and business is interrupted. For example, if a disaster occurs at 3:00 p.m. and the RTO is 4 hours, the disaster recovery cluster will restore business to normal before 7:00 p.m.

[0082] (3) Establish a recovery point object (RPO): This refers to the time point to which data must be restored after a disaster occurs. RPO is used to describe the maximum acceptable amount of data loss and is an indicator of how much production data will be lost after a disaster occurs. For example, if a disaster occurs at 15:00 p.m. and the RPO is 2 hours, then business data within 2 hours before the disaster, that is, from 13:00 to 15:00, may be lost.

[0083] (4) Streaming replication: A technology for database high availability. The primary cluster achieves data high availability by synchronizing the generated WAL logs to the disaster recovery cluster. WAL logs are generated and sent in real time.

[0084] (5) Peta byte (PB): a unit of computer storage capacity, 1PB = 2 ^50 byte.

[0085] In the embodiments of the present application, "multiple" refers to two or more than two. In view of this, in the embodiments of the present application, "multiple" can also be understood as "at least two". "At least one" can be understood as one or more, for example, one, two or more. For example, including at least one means including one, two or more, and there is no restriction on which ones are included. For example, including at least one of A, B and C, then A, B, C, A and B, A and C, B and C, or A and B and C may be included. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / ", unless otherwise specified, generally indicates that the previously associated objects are in an "or" relationship.

[0086] Unless otherwise specified, the ordinal numbers such as "first" and "second" mentioned in the embodiments of the present application are used to distinguish multiple objects and are not used to limit the order, timing, priority or importance of the multiple objects.

[0087] The data disaster recovery method provided by the embodiment of the present application is described below with reference to the accompanying drawings.

[0088] The data disaster recovery method provided in the embodiment of the present application can be applied to Figure 1 In the database disaster recovery system shown in the figure. Figure 1As shown, the database disaster recovery system includes a main cluster 100 and a disaster recovery cluster 200. The main cluster 100 can be understood as a database, and the disaster recovery cluster 200 can also be understood as a database. A database is a warehouse that organizes, stores, and manages data according to a data structure, and can also be called a data warehouse. In actual use scenarios, the storage capacity of a data warehouse can reach PB level.

[0089] Figure 1 Only one disaster recovery cluster 200 is shown as an example. In actual use, the database disaster recovery system may also be provided with multiple disaster recovery clusters. The present application does not limit the number of disaster recovery clusters in the database disaster recovery system.

[0090] The main cluster 100 may include one or more node devices. Figure 1 Node device 110, node device 120 and node device 130 are shown. Corresponding to the main cluster 100, the disaster recovery cluster 200 may also include one or more backup node devices. Figure 1 The diagram shows a standby node device 210 , a standby node device 220 and a standby node device 230 . The node devices in the main cluster 100 and the disaster recovery cluster 200 correspond one to one, that is, each node device in the main cluster 100 has a corresponding standby node device in the disaster recovery cluster 200 .

[0091] Both the main cluster 100 and the disaster recovery cluster 200 can provide services to the outside world, and this approach can be called active-active. The main cluster 100 can provide read and write services to the outside world, and the disaster recovery cluster 200 can provide read services to the outside world.

[0092] When the main cluster 100 is operating normally, it needs to periodically send data backup to the disaster recovery cluster 200 for data synchronization, so that when the main cluster 100 fails, the disaster recovery cluster 200 can take over the business of the main cluster 100.

[0093] In some embodiments, if the master cluster 100 includes multiple node devices, there may be one master node device among the multiple node devices, and the remaining node devices serve as slave node devices. When performing data synchronization, the master node device may send a data synchronization task to each slave node device, and each slave node device may send data backup to the corresponding standby node device in the disaster recovery cluster 200 after receiving the data synchronization task sent by the master node device. After sending the data synchronization task to each slave node device, the master node device will also send data backup to the standby node device corresponding to the master node device in the disaster recovery cluster 200.

[0094] When the main cluster 100 and the disaster recovery cluster 200 perform data synchronization, a streaming replication method based on WAL logs is usually adopted. In this method, data synchronization is achieved between the node devices in the main cluster and the standby node devices in the disaster recovery cluster by synchronizing WAL logs. The node devices in the main cluster can generate WAL logs in real time, and synchronize the WAL logs to the standby node devices in the disaster recovery cluster in real time to achieve the purpose of high data availability.

[0095] As the amount of data that needs to be stored in actual application scenarios increases, a large number of WAL logs will be generated during data operations. When using streaming replication based on WAL logs for data synchronization, the amount of data that needs to be transmitted between the primary cluster and the disaster recovery cluster will be large, which will not only occupy more network resources, but also lead to a longer RTO.

[0096] Based on this, an embodiment of the present application provides a data disaster recovery method. A page modification information bitmap is set in each node device in the main cluster, and the page modification information bitmap in any node device is used to indicate the page address of the page where data modification occurs in the node device. For any node device in the main cluster, when performing data synchronization, the node device can determine the page to be synchronized where data modification occurs in the node device according to the page modification information bitmap, and copy the data of the page to be synchronized, and send the page address of the page to be synchronized and the data of the page to be synchronized to the standby node device corresponding to the node device in the disaster recovery cluster. The standby node device can store the data of the page to be synchronized in the external memory of the standby node device according to the page address of the page to be synchronized. Compared with data synchronization based on the streaming replication method of the WAL log, the main cluster in the embodiment of the present application only synchronizes the data of the page where data modification occurs to the disaster recovery cluster, which can reduce the network resources occupied by data transmission and effectively shorten the RTO.

[0097] Data synchronization is performed periodically between the primary cluster and the disaster recovery cluster. For example, data synchronization may be performed between the primary cluster and the disaster recovery cluster every half an hour to ensure data consistency between the disaster recovery cluster and the primary cluster. Figure 2 The following is an exemplary diagram showing an interaction process between a node device and a backup node device during data synchronization. The node device may be any node device in the primary cluster, and the backup node device is a backup node device corresponding to the node device in the disaster recovery cluster. Figure 2 As shown, the process may include the following steps:

[0098] S201, the node device determines, according to a page modification information bitmap, a page to be synchronized in which data modification has occurred in the node device.

[0099] The node device is provided with a page modification information bitmap, which is used to indicate the page addresses of the pages in the storage space of the node device where data modification has occurred during the period from the last data synchronization to the current data synchronization. The page modification information bitmap may include multiple indication bits, each of which corresponds to a page storing data.

[0100] Exemplarily, the page modification information bitmap may also be referred to as a page modification hash table (Change block Map, CBM). Figure 3 As shown, the CBM includes multiple indicator bits, and each indicator bit can occupy one bit. Figure 3 Only a part of the CBM is shown exemplarily. In actual use, depending on the amount of data stored in the node device, the number of indicator bits contained in the CBM may be more. Each indicator bit can correspond to two different states: the page unmodified state and the page modified state. For example, the value "0" and the value "1" can be used to represent the page unmodified state and the page modified state, respectively, where the value "0" represents the page unmodified state. If the value on an indicator bit is "0", it means that the page corresponding to the indicator bit has not been modified. The value "1" represents the page modified state. If the value on an indicator bit is "1", it means that the page corresponding to the indicator bit has been modified.

[0101] The multiple indicator bits in the CBM correspond one-to-one to the multiple pages in the node device arranged in order from small to large according to the page address. For example, assuming that the size of a page is 4K, the first indicator bit in the CBM corresponds to the page address with a starting address of 0K in the node device, and the value "1" in the first indicator bit indicates that the data of the page with a starting address of 0K has been modified; the second indicator bit in the CBM corresponds to the page address with a starting address of 4K in the node device, and the value "0" in the second indicator bit indicates that the data of the page with a starting address of 4K has not been modified; the third indicator bit in the CBM corresponds to the page address with a starting address of 8K in the node device, and the value "1" in the third indicator bit indicates that the data of the page with a starting address of 8K has been modified; and so on.

[0102] The value of an indicator bit in the CBM will change when data modification occurs on the page corresponding to the indicator bit. In some embodiments, when a node device receives a data write operation, it can determine the target page corresponding to the data write operation, and set the indicator bit corresponding to the target page to the page modification state in the page modification information bitmap. The data write operation may include operations such as data write, data modification, and data deletion that modify the original data stored in the page.

[0103] For example, the values ​​of each indicator bit in CBM are all "0" at the initial moment. When the node device receives a data write operation, if it is determined that the target page corresponding to the data write operation is a page with a starting address of 8K, the value of the third indicator bit in CBM is changed from "0" to "1", that is, the third indicator bit in CBM is set to the page modification state.

[0104] When performing data synchronization, the node device can read the value of each indicator bit in the CBM, and determine the page where data modification occurs in the node device according to the value of each indicator bit in the CBM. Figure 3 According to the CBM shown, the node device can determine that the pages where data modification occurs include a page with a starting address of 0K, a page with a starting address of 8K, and a page with a starting address of 28K. The node device regards the pages where data modification occurs as pages to be synchronized.

[0105] In some embodiments, the node device may use a data exchange instruction to read the value of each indicator bit in the CBM, and while reading the value of each indicator bit in the CBM, the value of each indicator bit in the CBM is set to "0". In other embodiments, after reading the value of each indicator bit in the CBM, the node device may set the value of each indicator bit in the CBM to "0" through a bitmap clearing operation to avoid the node device from repeatedly backing up the data that has been backed up when performing data synchronization next time.

[0106] S202, the node device copies the data of the page to be synchronized.

[0107] S203: The node device sends the page address and data of the page to be synchronized to the standby node device.

[0108] The node device may copy the data of each to-be-synchronized page according to the page address of each to-be-synchronized page determined in step S201, and send the page address of the to-be-synchronized page and the data of the to-be-synchronized page to the standby node device corresponding to the node device in the disaster recovery cluster.

[0109] S204: The standby node device stores the data of the page to be synchronized in the external memory of the standby node device according to the page address of the page to be synchronized.

[0110] The standby node device receives the page address of the page to be synchronized and the data of the page to be synchronized sent by the node device, and can store the data of the page to be synchronized in the storage space corresponding to the page address of the page to be synchronized in the external memory of the standby node device.

[0111] Figure 4 The effect of data synchronization between the node devices in the main cluster and the backup node devices in the disaster recovery cluster is shown. Figure 4It can be seen that during the data synchronization process, the standby node device can modify the corresponding pages stored in the standby node device according to the pages where data modification occurs in the node device. The standby node device does not need to modify the pages where data modification occurs in the node device, so that the data stored in the standby node device is consistent with the data stored in the node device.

[0112] The main cluster in the embodiment of the present application only synchronizes the data of the page where the data modification occurs to the disaster recovery cluster, which can reduce the amount of data transmission between the main cluster and the disaster recovery cluster, and reduce the network resources occupied by data transmission; and the backup node device in the disaster recovery cluster can directly save the backup data sent by the node device of the main cluster, without the need to save the backup data by replaying the log, and can quickly complete the synchronization. In addition, the shorter the data synchronization cycle, the smaller the amount of data that needs to be transmitted during data synchronization, and the shorter the time taken by data synchronization, so the data synchronization cycle can be appropriately shortened, which is conducive to the disaster recovery cluster to quickly take over the business when a disaster or failure occurs in the main cluster, effectively shortening the RTO.

[0113] The data disaster recovery method provided by the embodiment of the present application can be applied to data warehouse application scenarios with large data storage capacity. In a data warehouse with a data storage capacity of PB level, the RPO and RTO both require more than 12 hours using the traditional WAL log-based streaming replication method. Using the data disaster recovery method provided by the embodiment of the present application, the RPO can be optimized to 2 hours and the RTO can be shorter. The shorter the RPO and RTO, the more reliable the database disaster recovery system is, and even if a disaster occurs, it will not seriously affect the business.

[0114] In an optional embodiment, after the standby node device stores the data of the page to be synchronized in the external memory of the standby node device, it can also determine whether the original data in the page address of the page to be synchronized is stored in the memory of the standby node device. Exemplarily, the standby node device can search whether the memory contains the page address of the page to be synchronized. If the memory of the standby node device contains the page address of the page to be synchronized, it means that the original data in the page address of the page to be synchronized is stored in the memory, indicating that the standby node device may be querying the data in the page address of the page to be synchronized. Among them, the original data is read into the memory from the page address of the page to be synchronized in the external memory before executing this data synchronization. The original data is inconsistent with the data stored in the page address of the page to be synchronized in the node device of the main cluster, so the original data is not suitable for output as a query result.

[0115] In order to ensure the correctness of the queried data and make the new data after data synchronization effective in time, the standby node device can delete the original data under the page address of the page to be synchronized in the memory, and re-read the data in the page address of the page to be synchronized in the external memory into the memory of the standby node device. This process can be called page swapping. Since the data stored in the external memory of the standby node device is consistent with the data stored in the page address of the page to be synchronized in the node device in the main cluster, through page swapping, users can query the new data after data synchronization, so that the new data after data synchronization can take effect in time.

[0116] In some embodiments, the disaster recovery cluster can provide users with a data query function. Due to the access lag of the disaster recovery cluster or other reasons, some data query operations may take a long time. The data query operation with a long time can be called a long query. In an optional embodiment, to ensure that the long query in the disaster recovery cluster can be executed normally, for any node device in the main cluster, if a data deletion operation is received, it can wait for a set time and then delete the data deleted by the data deletion operation. Among them, the set time corresponding to different node devices can be the same or different. Among them, the set time can be set according to the actual needs of the long query of the disaster recovery cluster. For example, the set time can be 30 minutes, or it can be 1 hour or several hours. For example, if most of the long queries of the disaster recovery cluster can be completed within 2 hours, the set time can be set to 2 hours. The node device waits for the set time and then executes the data deletion operation, which can ensure that the long query in the disaster recovery cluster can be executed normally.

[0117] For example, suppose that the standby node device in the disaster recovery cluster receives a data query operation initiated by the user, executes the data query operation, and queries data A. Data A can be a very long data or a data set consisting of a lot of data. Five minutes later, the node device in the main cluster receives a data deletion operation, and the data deletion operation indicates that data A or part of data A is to be deleted. At this time, the data query operation for data A in the disaster recovery cluster may not have ended, and it will take a long time to end. If the node device immediately executes the data deletion operation, and after 1 minute, the data is synchronized between the main cluster and the disaster recovery cluster, then the standby node device in the disaster recovery cluster will also delete data A or part of data A, resulting in the inability to execute the data query operation for data A in the disaster recovery cluster normally, resulting in access failure. In the embodiment of the present application, assuming that the set time is 2 hours, after the node device in the main cluster receives the data deletion operation for data A, it waits for 2 hours before executing the operation of deleting data A. In this way, even after the node device deletes data A, the data synchronization between the main cluster and the disaster recovery cluster is immediately performed. When the backup node device in the disaster recovery cluster deletes data A, 125 minutes have passed since the time when the data query operation for data A was received. At this time, the long query for data A has ended. Therefore, by setting the set time for clearing data waiting, it can be ensured that the data being accessed by the disaster recovery cluster is not cleared, and the long query in the disaster recovery cluster can be executed normally.

[0118] In an optional embodiment, each time data synchronization is performed, in addition to sending the page address and data of the page to be synchronized to the standby node device, the node device may also send the global consistency snapshot and control file generated when performing data synchronization to the standby node device. Exemplarily, each time data synchronization is performed, the node devices in the main cluster create a global consistency point and generate a global consistency point snapshot. Among them, the global consistency point can be understood as the time point when the main cluster and the disaster recovery cluster synchronize data to achieve global consistency, and the global consistency point snapshot can be understood as a copy or image of the log of the data and executed operation transactions saved in the node device at the moment of creating the global consistency point, or when data synchronization is performed. Operational transactions refer to the tasks performed by the node device for each business operation.

[0119] Taking any data synchronization as an example, the global consistency snapshot generated by this data synchronization may include the minimum transaction number and the log sequence number (LSN) of the latest log on the node device. Among them, the minimum transaction number is the transaction number of the operation transaction that is first executed among the operation transactions being executed by the main cluster during this data synchronization. Therefore, the minimum transaction number can also be called the oldest transaction number (oldestXmin). Each operation transaction will obtain a transaction number (Xmin) when it starts to execute. This transaction number is unique in the data disaster recovery system and is used to identify the time when an operation transaction starts to execute. Therefore, the size of the transaction number in the data disaster recovery system increases monotonically over time. For example, if the time when operation transaction a starts to execute is earlier than the time when operation transaction b starts to execute, then the transaction number of operation transaction a is smaller than the transaction number of operation transaction b.

[0120] The node device generates a log for each operation transaction executed. The log is used to record the description information of the corresponding operation transaction. Each log contains a log sequence number, which is unique in the data disaster recovery system and is used to identify the time sequence of log generation. Similar to the transaction number, the size of the log sequence number in the data disaster recovery system also increases monotonically over time.

[0121] The node device adds the minimum transaction number in the generated global consistency snapshot and the log sequence number of the latest log on the node device to the control file, and sends the generated global consistency snapshot and control file to the standby node device. The standby node device receives and saves the global consistency snapshot and control file sent by the node device.

[0122] In some embodiments, the global consistency snapshot may also include a transaction commit number (commit sequence number, CSN), which is the transaction commit number of the last operation transaction submitted in the main cluster during the data synchronization. Each operation transaction will obtain a transaction commit number when it is submitted. The transaction commit number is unique in the data disaster recovery system and is used to identify the submission order of each transaction. The size of the transaction commit number in the data disaster recovery system also increases monotonically over time.

[0123] When any standby node device in the disaster recovery cluster performs data query, in order to ensure that the correct data is queried, you can use Figure 5 The query process is performed in the manner shown, and the process may include the following steps:

[0124] S501: If a query operation is received, a snapshot for the query is obtained.

[0125] When receiving a query operation, the standby node device obtains the query snapshot received during the most recent data synchronization process. That is, the query snapshot is a globally consistent snapshot received during the most recent data synchronization process before the query operation is received.

[0126] The standby node device performs a query operation based on the query snapshot. Exemplarily, when querying page K, the standby node device determines which data is visible and which data is invisible among multiple data included in page K based on the obtained query snapshot.

[0127] S502, during the query operation, obtaining the log sequence number of the page to be queried, and obtaining the minimum transaction number in the current control file.

[0128] The log sequence number of the page to be queried is the log sequence number of the latest log corresponding to the page to be queried. The current control file is the control file received during the last data synchronization process before the current time when the query operation is performed on the page to be queried.

[0129] For example, suppose that the main cluster and the disaster recovery cluster perform data synchronization every half an hour, and the main cluster and the disaster recovery cluster perform data synchronization at 8:00, 8:30, and 9:00 respectively. If the standby node device receives a query operation at 8:20, and is still executing the query operation at 8:40, and the page K is queried, that is, at 8:40, the page to be queried is page K, then the standby node device obtains the query snapshot at 8:20, where the query snapshot is the global consistency snapshot received during the last data synchronization before 8:20, that is, the query snapshot is the global consistency snapshot sent by the node device in the main cluster to the standby node device at 8:00. At 8:40, the standby node device obtains the current control file, which is the control file received during the last data synchronization before 8:40, that is, the current control file is the control file sent by the node device in the main cluster to the standby node device at 8:30.

[0130] S503, determine whether the log sequence number of the page to be queried is greater than the log sequence number in the query snapshot; if yes, execute step S504, if not, execute step S506.

[0131] S504, determining whether the minimum transaction number in the query snapshot is smaller than the minimum transaction number in the current control file; if yes, executing step S505, if no, executing step S506.

[0132] S505: Output error prompt information.

[0133] If the log sequence number of the page to be queried is greater than the log sequence number in the query snapshot, it means that the page to be queried has been modified after the data synchronization corresponding to the query snapshot. If the minimum transaction number in the query snapshot is less than the minimum transaction number in the current control file, it means that after receiving the query snapshot, the standby node device has performed a second data synchronization and received a new control file and a new global consistency snapshot. It can be determined that the page to be queried was modified during the second data synchronization. At this time, the standby node device performs a query operation based on the query snapshot again to determine the visibility of each piece of data, which will result in a query error. Therefore, the standby node device terminates the query operation and outputs an error prompt message.

[0134] If the log sequence number of the page to be queried is less than or equal to the log sequence number in the query snapshot, it means that the data of the page to be queried has not been modified after the data synchronization corresponding to the query snapshot. At this time, no matter whether the standby node device performs a second data synchronization after receiving the query snapshot, it has no effect on the page to be queried. Therefore, there is no need to determine the size relationship between the minimum transaction number in the query snapshot and the minimum transaction number in the current control file, and the query operation can continue to be executed.

[0135] If the minimum transaction number in the query snapshot is not less than the minimum transaction number in the current control file, it means that the standby node device has not performed new data synchronization after receiving the query snapshot, and has not received a new control file and a new global consistency snapshot. For example, if the minimum transaction number in the query snapshot is equal to the minimum transaction number in the current control file, it means that the query snapshot and the current control file are global consistency snapshots and control files received by the standby node device during the same data synchronization process, and the standby node device has not performed new data synchronization after receiving the query snapshot, so the page to be queried will not be modified due to new data synchronization at the current moment. Therefore, regardless of whether the log sequence number of the page to be queried is greater than the log sequence number in the query snapshot, the query operation can continue to be executed.

[0136] S506, obtaining the second transaction commit number of each piece of data in the page to be queried, and obtaining the first transaction commit number in the query snapshot.

[0137] If the log sequence number of the page to be queried is less than or equal to the log sequence number in the query snapshot, or the minimum transaction number in the query snapshot is not less than the minimum transaction number in the current control file, the standby node device continues to execute the query operation, obtains the second transaction commit number of each data in the page to be queried, and obtains the first transaction commit number in the query snapshot. Among them, the first transaction commit number is the transaction commit number of the last operation transaction submitted in the main cluster when the query snapshot is generated. The second transaction commit number of any data in the page to be queried is the transaction commit number of the operation transaction corresponding to the data. The operation transaction corresponding to the data can be a task to modify the data, and the second transaction commit number can be used to identify the submission time of the task to modify the data.

[0138] S507, outputting data whose second transaction commit number is smaller than the first transaction commit number in the query snapshot.

[0139] For example, assuming that the current page to be queried is page K, the standby node device performs the following operations for each piece of data in page K:

[0140] The second transaction commit number of the data is obtained, and it is determined whether the second transaction commit number of the data is less than the first transaction commit number in the query snapshot. When executing a query operation, the first transaction commit number is used to identify the commit time of the last operation transaction in the main cluster during the last data synchronization before executing the query operation, and the commit time is earlier than the start time of the query operation.

[0141] If the second transaction commit number of the data is less than the first transaction commit number in the query snapshot, it means that the commit time of the task that modifies the data is earlier than the commit time of the last operation transaction in the primary cluster during the last data synchronization before the query operation is executed, that is, the commit time of the task that modifies the data is before the query operation is started. Therefore, the data is visible when the query operation is executed and can be output.

[0142] If the second transaction commit number of the data is greater than or equal to the first transaction commit number in the query snapshot, it means that the commit time of the task that modifies the data is later than the commit time of the last operation transaction in the primary cluster during the last data synchronization before the query operation is executed, that is, the commit time of the task that modifies the data may be after the query operation is started. Therefore, the data is not visible when executing this query operation, and the standby node device does not output the data to ensure the consistency of data query between the primary cluster and the disaster recovery cluster.

[0143] The minimum transaction number, transaction commit number, and log sequence number can ensure the consistency of data queries between the main cluster and the disaster recovery cluster, thereby improving the correctness of data queried by the disaster recovery cluster.

[0144] Based on the same inventive concept as the above method embodiment, the present application embodiment also provides a data disaster recovery device, which can be applied to any node device in the main cluster of the database disaster recovery system. Figure 6 As shown, the data disaster recovery device 600 may include a page identification module 601 and a data synchronization module 602. The data disaster recovery device 600 may be used to implement the functions of the above method embodiment, and thus may achieve the beneficial effects of the above method embodiment.

[0145] The page identification module 601 can be used to determine the page to be synchronized where data modification has occurred in the node device according to the page modification information bitmap of the node device during the data synchronization process. The page modification information bitmap is used to indicate the page address of the page where data modification has occurred in the node device. The data synchronization module 602 can be used to copy the data of the page to be synchronized, and send the page address and data of the page to be synchronized to the standby node device corresponding to the node device; the standby node device is a device in the disaster recovery cluster.

[0146] In some embodiments, Figure 7 As shown, the data disaster recovery device 600 may further include a data deletion module 603. The data deletion module 603 may be used to: upon receiving a data deletion operation, delete the data indicated to be deleted by the data deletion operation after waiting for a set period of time.

[0147] For example, the page identification module 601, the data synchronization module 602 and the data deletion module 603 can be integrated into Figure 1 Any node device in the main cluster 100 in the. Page identification module 601, data synchronization module 602 and data deletion module 603 can all be implemented by software, or can be implemented by hardware. Exemplarily, the implementation of the page identification module 601 is introduced below. Similarly, the implementation of the data synchronization module 602 and the data deletion module 603 can refer to the implementation of the page identification module 601.

[0148] As an example of a software function module, the page identification module 601 may include code running on a computing instance. The computing instance may include at least one of a physical host (node ​​device), a virtual machine, and a container. Further, the computing instance may be one or more. For example, the page identification module 601 may include code running on multiple hosts / virtual machines / containers.

[0149] As an example of a hardware functional module, the page identification module 601 can be a device implemented by an application-specific integrated circuit (ASIC) or a programmable logic device (PLD). The PLD can be a complex programmable logical device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL) or any combination thereof.

[0150] It should be noted that, in other embodiments, the page identification module 601 can be used to execute any step in the data disaster recovery method, the data synchronization module 602 can be used to execute any step in the data reading method, and the data deletion module 603 can be used to execute any step in the data reading method. The steps that the page identification module 601, the data synchronization module 602, and the data deletion module 603 are responsible for implementing can be specified as needed, and the full functions of the data disaster recovery device are realized by implementing different steps in the data disaster recovery method through the page identification module 601, the data synchronization module 602, and the data deletion module 603.

[0151] Based on the same inventive concept as the above method embodiment, the present application embodiment also provides a data disaster recovery device, which can be applied to any standby node device in a disaster recovery cluster of a database disaster recovery system. Figure 8 As shown, the data disaster recovery device 800 may include a data receiving module 801 and a data processing module 802. The data disaster recovery device 800 may be used to implement the functions of the above method embodiment, and thus may achieve the beneficial effects of the above method embodiment.

[0152] The data receiving module 801 can be used to receive the page address of the page to be synchronized and the data of the page to be synchronized sent by the node device corresponding to the standby node device during the data synchronization process. The node device is a device in the main cluster, and the page to be synchronized is a page where data modification occurs, determined according to the page modification information bitmap of the node device. The data processing module 802 can be used to store the data of the page to be synchronized in the external memory of the standby node device according to the page address of the page to be synchronized.

[0153] In some embodiments, Fig. 9As shown, the data disaster recovery device 800 may also include a data query module 803, which may be used to: obtain a query snapshot when receiving a query operation; the query snapshot is a global consistency snapshot received during the last data synchronization process before the query operation is received; during the query operation, obtain the log sequence number of the page to be queried; obtain the minimum transaction number in the current control file; the current control file is the control file received during the last data synchronization process before the current moment. If the log sequence number of the page to be queried is greater than the log sequence number in the query snapshot, and the minimum transaction number in the query snapshot is less than the minimum transaction number in the current control file, an error prompt message is output.

[0154] For example, the data receiving module 801, the data processing module 802 and the data query module 803 can be integrated in Figure 1 In any standby node device in the disaster recovery cluster 200 shown. The data receiving module 801, the data processing module 802 and the data query module 803 can all be implemented by software, or can be implemented by hardware. Exemplarily, the implementation of the data receiving module is introduced below by taking the data receiving module 801 as an example. Similarly, the implementation of the data processing module 802 and the data query module 803 can refer to the implementation of the data receiving module.

[0155] As an example of a software function module, the data receiving module 801 may include code running on a computing instance. The computing instance may include at least one of a physical host (node ​​device), a virtual machine, and a container. Furthermore, the computing instance may be one or more. For example, the data receiving module 801 may include code running on multiple hosts / virtual machines / containers.

[0156] As an example of a hardware functional module, the data receiving module 801 may be a device implemented by using ASIC or PLD, etc. The PLD may be implemented by CPLD, FPGA, GAL or any combination thereof.

[0157] It should be noted that, in other embodiments, the data receiving module 801 can be used to execute any step in the data disaster recovery method, the data processing module 802 can be used to execute any step in the data disaster recovery method, and the data query module 803 can be used to execute any step in the data disaster recovery method. The steps that the data receiving module 801, the data processing module 802, and the data query module 803 are responsible for implementing can be specified as needed, and the data receiving module 801, the data processing module 802, and the data query module 803 respectively implement different steps in the data disaster recovery method to realize the full functions of the data disaster recovery device.

[0158] Each functional module in the embodiment of the present application can be integrated into one processor, or each module can exist physically separately, or two or more modules can be integrated into one module. The above integrated modules can be implemented in the form of hardware or software functional modules.

[0159] If the integrated module is implemented in the form of a software function module 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 to enable a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor (processor) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program code.

[0160] Based on the same inventive concept as the above method embodiment, a node device is also provided in the embodiment of the present application, which can be a physical machine, or a server or a computing device. The node device can be used to implement the functions performed by the node device in the above method embodiment, so the beneficial effects of the above method embodiment can be achieved.

[0161] In some embodiments, the node device is Figure 1 Any node device in the main cluster 100 of the database disaster recovery system shown in FIG. 1000 may have a structure as shown in FIG. Fig.10 As shown, it includes a processor 1010 and a memory 1020 connected to the processor 1010. The processor 1010 and the memory 1020 can be interconnected via a bus, and the processor 1010 can serve as the main processor of the node device 1000, that is, the control core of the node device 1000. The bus can be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. The specific connection medium between the above-mentioned processor 1010 and the memory 1020 is not limited in the embodiment of the present application.

[0162] The memory 1020 may be a volatile memory, such as a random access memory; the memory may also be a non-volatile memory, such as a read-only memory, a flash memory, a hard disk drive (HDD) or a solid-state drive (SSD), or the memory 1020 may be any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory 1020 may be a combination of the above memories. The memory 1020 may be used to store software programs and modules.

[0163] The processor 1010 may include one or more processors. The processor 1010 executes various functional applications and data processing of the node device 1000 by running software programs and modules stored in the memory 1020, such as the data disaster recovery method provided in the embodiment of the present application.

[0164] In some embodiments, the node device 1000 may further include a communication module, which is connected to the processor 1010 and the memory 1020 via a bus. The communication module may be used to communicate with the backup node devices in the disaster recovery cluster and the user's terminal device via a network.

[0165] Exemplarily, when the node device 1000 is used to implement the functions performed by the node device in the above method embodiment, the processor 1010 can be used to determine, during the data synchronization process, the page to be synchronized where data modification has occurred in the node device according to the page modification information bitmap of the node device; the page modification information bitmap is used to indicate the page address of the page where data modification has occurred in the node device; the data of the page to be synchronized is copied, and the page address of the page to be synchronized and the data of the page to be synchronized are sent to the standby node device corresponding to the node device through the communication module; the standby node device is a device in the disaster recovery cluster.

[0166] It is to be understood that the structure illustrated in the embodiments of the present application does not constitute a specific limitation on the node device. In other embodiments of the present application, the node device may include more or fewer components than shown in the figure, or combine certain components, or split certain components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.

[0167] The embodiment of the present application also provides a main cluster, which can be Figure 1 The main cluster 100 shown in FIG. 1 may include at least one node device, and each node device may adopt Fig.10 The structure shown includes a processor and a memory. The processor of each node device is used to execute instructions stored in the memory of the node device, so that the node device implements the functions performed by the node device in the above method embodiment.

[0168] Based on the same technical concept as the above method embodiment, a standby node device is also provided in the embodiment of the present application. The standby node device can be a physical machine, or a server or a computing device. The standby node device can be used to implement the functions performed by the standby node device in the above method embodiment, so the beneficial effects possessed by the above method embodiment can be achieved.

[0169] In some embodiments, the standby node device may be Figure 1 Any standby node device in the disaster recovery cluster 200 of the database disaster recovery system shown in FIG. The structure of the standby node device 1100 can be as follows: Fig.11 As shown, it includes a processor 1110 and a memory 1120 connected to the processor 1110. The processor 1110 and the memory 1120 can be interconnected via a bus, and the processor 1110 can serve as the main processor of the standby node device 1100, that is, the control core of the standby node device 1100. The bus can be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. The specific connection medium between the above-mentioned processor 1110 and the memory 1120 is not limited in the embodiments of the present application.

[0170] The memory 1120 may be a volatile memory, such as a random access memory, which may be used as the memory of the standby node device 1100; the memory 1120 may also be a non-volatile memory, such as a read-only memory, a flash memory, a hard disk drive (HDD) or a solid-state drive (SSD), which may be used as the external memory of the standby node device 1100, or the memory 1120 may be any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory 1120 may be a combination of the above memories. The memory 1120 may be used to store software programs and modules.

[0171] The processor 1110 may include one or more processors. The processor 1110 executes various functional applications and data processing of the standby node device 1100 by running software programs and modules stored in the memory 1120, such as the data disaster recovery method provided in the embodiment of the present application.

[0172] In some embodiments, the standby node device 1100 may further include a communication module, which is connected to the processor 1110 and the memory 1120 via a bus. The communication module may be used to communicate with the node devices in the main cluster and the user's terminal device via a network.

[0173] Exemplarily, when the standby node device 1100 is used to implement the functions performed by the standby node device in the above method embodiment, the communication module can be used to receive the page address of the page to be synchronized and the data of the page to be synchronized sent by the node device corresponding to the standby node device during the data synchronization process; the node device is a device in the main cluster; the page to be synchronized is a page where data modification occurs, determined according to the page modification information bitmap of the node device. The processor 1110 can be used to store the data of the page to be synchronized in the external memory of the standby node device according to the page address of the page to be synchronized.

[0174] It is to be understood that the structure illustrated in the embodiments of the present application does not constitute a specific limitation on the computing device. In other embodiments of the present application, the computing device may include more or fewer components than shown in the figure, or combine certain components, or split certain components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.

[0175] The present application also provides a disaster recovery cluster, which can be Figure 1 The disaster recovery cluster 200 shown in FIG. 1 may include at least one standby node device, each of which may use Fig.11 The structure shown includes a processor and a memory. The processor of each standby node device is used to execute instructions stored in the memory of the standby node device, so that the standby node device implements the functions performed by the standby node device in the above method embodiment.

[0176] The present application also provides a database disaster recovery system. Figure 1 As shown, it may include a main cluster 100 and a disaster recovery cluster 200. The main cluster 100 includes multiple node devices, and the disaster recovery cluster 200 includes multiple standby node devices. Each node device in the main cluster 100 has a corresponding standby node device in the disaster recovery cluster 200. The node device may adopt Fig.10 The structure shown in FIG. 1 includes a processor and a memory. The structure of the standby node device can be as follows: Fig.11 As shown, no further description is given here.

[0177] The method steps in the embodiments of the present application may be implemented by hardware, or by a processor executing a computer program or instruction. The computer program or instruction may constitute a computer program product.

[0178] The present application also provides a computer program product, which includes computer executable instructions. In one embodiment, the computer executable instructions are used to enable a computer to execute the functions of the node device or standby node device in the above method embodiment.

[0179] The computer executable instructions can be stored in a computer readable storage medium. The embodiment of the present application also provides a computer readable storage medium, wherein the computer readable storage medium stores executable instructions. In one embodiment, the computer executable instructions are used to enable a computer to execute the functions of the node device or standby node device in the above method embodiment.

[0180] The computer-readable storage medium provided in the embodiments of the present application may be a random access memory (RAM), a flash memory, a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a register, a hard disk, a mobile hard disk, a CD-ROM, or any other form of computer-readable storage medium known in the art.

[0181] Computer executable instructions may be stored in a computer readable storage medium or transferred from one computer readable storage medium to another computer readable storage medium, for example, the computer program or instructions may be transferred from one website, computer, server or data center to another website, computer, server or data center by wired or wireless means. The computer readable storage medium may be any available medium that can be accessed by a computer or a computing device such as a server or data center that integrates one or more available media. The available medium may be a magnetic medium, such as a floppy disk, a hard disk, or a magnetic tape; it may also be an optical medium, such as a digital video disc (DVD); it may also be a semiconductor medium, such as a solid state drive.

[0182] In each embodiment of the present application, if there is no special explanation and logical conflict, the terms and / or descriptions between different embodiments are consistent and can be referenced to each other, and the technical features in different embodiments can be combined to form new embodiments according to their inherent logical relationships. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, including a series of steps or modules. Methods, systems, products or devices are not necessarily limited to those steps or modules clearly listed, but may include other steps or modules that are not clearly listed or inherent to these processes, methods, products or devices.

[0183] Although the present application has been described in conjunction with specific features and embodiments thereof, it is apparent that various modifications and combinations may be made thereto without departing from the spirit and scope of the present application. Accordingly, the present specification and the accompanying drawings are merely exemplary illustrations of the schemes defined by the appended claims, and are deemed to have covered any and all modifications, variations, combinations or equivalents within the scope of the present application.

[0184] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the scope of the present application. Thus, if these modifications and variations of the embodiments of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.

Claims

1. A data disaster recovery method, characterized in that: Applied to a database disaster recovery system, the database disaster recovery system includes a main cluster and a disaster recovery cluster; the method includes: During the data synchronization process, the node device in the main cluster determines the page to be synchronized in which data modification occurs in the node device according to the page modification information bitmap of the node device; the page modification information bitmap is used to indicate the page address of the page in which data modification occurs in the node device; The node device copies the data of the page to be synchronized, and sends the page address of the page to be synchronized and the data of the page to be synchronized to the standby node device corresponding to the node device; the standby node device is a device in the disaster recovery cluster; The standby node device stores the data of the page to be synchronized in the external memory of the standby node device according to the page address of the page to be synchronized.

2. The method according to claim 1, characterized in that The page modification information bitmap includes a plurality of indication bits, each indication bit corresponds to a page storing data; the method further includes: The node device receives a data write operation and determines a target page corresponding to the data write operation; The node device sets the indication bit corresponding to the target page in the page modification information bitmap to a page modification state.

3. The method according to claim 1 or 2, characterized in that: The method further comprises: The node device receives the data deletion operation, waits for a set period of time, and then deletes the data indicated to be deleted by the data deletion operation.

4. The method according to any one of claims 1 to 3, characterized in that: After the standby node device saves the data of the to-be-synchronized page to the external memory of the standby node device, the method further includes: When the standby node device determines that the original data in the page address of the page to be synchronized is stored in the memory of the standby node device, the standby node device deletes the original data under the page address of the page to be synchronized in the memory; the original data is read into the memory from the page address of the page to be synchronized in the external memory before performing the data synchronization; The standby node device re-reads the data in the page address of the page to be synchronized in the external memory into the memory of the standby node device.

5. The method according to any one of claims 1 to 4, characterized in that: The method further comprises: During the data synchronization process, the node device generates a global consistency snapshot; the global consistency snapshot includes the minimum transaction number and the log sequence number of the latest log on the node device; the minimum transaction number is the transaction number of the operation transaction that is first executed among the operation transactions being executed by the main cluster during the data synchronization; The node device adds the minimum transaction number and the log sequence number of the latest log on the node device to the control file, and sends the global consistency snapshot and the control file to the standby node device; The standby node device performs a query operation based on the global consistency snapshot and the control file received during the data synchronization process.

6. The method according to claim 5, characterized in that The standby node device performs a query operation based on the global consistency snapshot and the control file received during the data synchronization process, including: When the standby node device receives a query operation, it obtains a query snapshot; the query snapshot is a global consistency snapshot received during the last data synchronization process before the query operation is received; During the query operation, the standby node device obtains the log sequence number of the page to be queried and the minimum transaction number in the current control file; the log sequence number of the page to be queried is the log sequence number of the latest log corresponding to the page to be queried; the current control file is the control file received during the last data synchronization before the current moment; If the standby node device determines that the log sequence number of the to-be-queried page is greater than the log sequence number in the query snapshot, and the minimum transaction number in the query snapshot is less than the minimum transaction number in the current control file, an error prompt message is output.

7. The method according to claim 6, characterized in that The global consistency snapshot also includes a first transaction submission number; the first transaction submission number is the transaction submission number of the last operation transaction submitted in the main cluster during the data synchronization; at least one piece of data is stored in the page to be queried; The method further comprises: If the standby node device determines that the log sequence number of the page to be queried is less than or equal to the log sequence number in the query snapshot, or the minimum transaction number in the query snapshot is greater than or equal to the minimum transaction number in the current control file, then obtain the second transaction commit number of each piece of data in the page to be queried and the first transaction commit number in the query snapshot; wherein the second transaction commit number of any piece of data is the transaction commit number of the operation transaction corresponding to the any piece of data; Output data whose second transaction commit number is less than the first transaction commit number in the query snapshot.

8. A data disaster recovery method, characterized in that: Applied to any node device in a main cluster, the main cluster is located in a database disaster recovery system, and the database disaster recovery system includes the main cluster and a disaster recovery cluster; the method includes: During the data synchronization process, the page to be synchronized in which data modification occurs in the node device is determined according to the page modification information bitmap of the node device; the page modification information bitmap is used to indicate the page address of the page in which data modification occurs in the node device; Copy the data of the page to be synchronized; The page address of the page to be synchronized and the data of the page to be synchronized are sent to a standby node device corresponding to the node device; the standby node device is a device in the disaster recovery cluster.

9. The method according to claim 8, characterized in that The page modification information bitmap includes a plurality of indication bits, each indication bit corresponds to a page storing data; the method further includes: If a data write operation is received, determining a target page corresponding to the data write operation; The indication bit corresponding to the target page is set as a page modification state in the page modification information bitmap.

10. The method according to claim 8 or 9, characterized in that: The method further comprises: If a data deletion operation is received, after waiting for a set period of time, the data indicated to be deleted by the data deletion operation is deleted.

11. A data disaster recovery method, characterized in that: Applied to any standby node device in a disaster recovery cluster, the disaster recovery cluster is located in a database disaster recovery system, the database disaster recovery system includes a main cluster and the disaster recovery cluster; the method includes: During the data synchronization process, receiving the page address of the page to be synchronized and the data of the page to be synchronized sent by the node device corresponding to the standby node device; the node device is a device in the main cluster; the page to be synchronized is a page where data modification occurs, determined according to the page modification information bitmap of the node device; According to the page address of the page to be synchronized, the data of the page to be synchronized is stored in the external memory of the standby node device.

12. The method according to claim 11, characterized in that After the data of the page to be synchronized is saved in the external memory of the standby node device according to the page address of the page to be synchronized, the method further includes: If it is determined that the original data in the page address of the page to be synchronized is stored in the memory of the standby node device, the original data under the page address of the page to be synchronized in the memory is deleted; the original data is read into the memory from the page address of the page to be synchronized in the external memory before performing the data synchronization; The data in the page address of the page to be synchronized in the external memory is re-read into the memory of the standby node device.

13. A data disaster recovery device, characterized in that: Applied to any node device in a main cluster, the main cluster is located in a database disaster recovery system, the database disaster recovery system includes the main cluster and a disaster recovery cluster; the device includes: A page identification module, used to determine, during the data synchronization process, the page to be synchronized in the node device where data modification has occurred according to the page modification information bitmap of the node device; the page modification information bitmap is used to indicate the page address of the page in the node device where data modification has occurred; The data synchronization module is used to copy the data of the page to be synchronized, and send the page address of the page to be synchronized and the data of the page to be synchronized to the standby node device corresponding to the node device; the standby node device is a device in the disaster recovery cluster.

14. The device according to claim 13, characterized in that The page modification information bitmap includes a plurality of indication bits, each indication bit corresponds to a page storing data; the page identification module is further used for: If a data write operation is received, determining a target page corresponding to the data write operation; The indication bit corresponding to the target page is set as a page modification state in the page modification information bitmap.

15. The device according to claim 13 or 14, characterized in that The device also includes: The data deletion module is used to delete the data indicated to be deleted by the data deletion operation after waiting for a set time period when receiving the data deletion operation.

16. A data disaster recovery device, characterized in that: Applied to any standby node device in a disaster recovery cluster, the disaster recovery cluster is located in a database disaster recovery system, the database disaster recovery system includes a main cluster and the disaster recovery cluster; the device includes: A data receiving module, used for receiving, during the data synchronization process, the page address of the page to be synchronized and the data of the page to be synchronized sent by the node device corresponding to the standby node device; the node device is a device in the main cluster; the page to be synchronized is a page on which data modification occurs, determined according to the page modification information bitmap of the node device; The data processing module is used to store the data of the page to be synchronized in the external memory of the standby node device according to the page address of the page to be synchronized.

17. The device according to claim 16, characterized in that The data processing module is further used for: If it is determined that the original data in the page address of the page to be synchronized is stored in the memory of the standby node device, the original data under the page address of the page to be synchronized in the memory is deleted; the original data is read into the memory from the page address of the page to be synchronized in the external memory before performing the data synchronization; The data in the page address of the page to be synchronized in the external memory is re-read into the memory of the standby node device.

18. A node device, characterized in that: include: A memory and a processor, wherein the memory stores a computer program; and the processor is used to execute the computer program stored in the memory to implement the method according to any one of claims 8 to 10.

19. A standby node device, characterized in that: include: A memory and a processor, wherein the memory stores a computer program; and the processor is used to execute the computer program stored in the memory to implement the method according to any one of claims 11 to 12.

20. A main cluster, characterized in that: The main cluster includes at least one node device as described in claim 18.

21. A disaster recovery cluster, characterized in that: The disaster recovery cluster includes at least one backup node device as described in claim 19.

22. A database disaster recovery system, characterized in that: It includes the main cluster described in claim 20 and the disaster recovery cluster described in claim 21.

23. A computer-readable storage medium, characterized in that: Computer executable instructions are stored, and the computer executable instructions are used to enable a computer to execute the method according to any one of claims 8 to 10, or the method according to any one of claims 11 to 12.

24. A computer program product, characterized in that The method comprises computer executable instructions, wherein the computer executable instructions are used to enable a computer to execute the method according to any one of claims 8 to 10, or the method according to any one of claims 11 to 12.

Citation Information

Cited By

  • Data disaster recovery method, apparatus and system, node device, and standby node device

    EP4660811A1