Delayed playback method, device, equipment and product for backup node in database

By sending cycles in the database to create time consistency point commands and obtaining time consistency point logs, determining the target time consistency point and determining whether it is within the delayed playback time period, the problem of inability to control playback data and ensuring data consistency in the prior art is solved, and flexible historical data reading and strong consistency are achieved.

CN119377326BActive Publication Date: 2025-04-18SUZHOU JIBEISI DATA TECHNOLOGY CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411920560.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-25
Publication Date
2025-04-18
Estimated Expiration
2044-12-25

AI Technical Summary

Technical Problem

The existing backup node data storage management methods cannot perform playback data control based on specific needs, and the consistency of data cannot be guaranteed.

Method used

By sending the cycle create time consistency point command to all master nodes, obtain the time consistency point log of all master nodes synchronized to their respective backup nodes, determine the target time consistency point, and determine whether the backup node plays data within the preset delayed playback time period.

Benefits of technology

It realizes that users can read the historical data of the backup node according to the preset delayed playback time period, meet the needs of using historical data, and ensure the consistency of data. It has the characteristics of flexible settings, easy use and strong consistency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119377326B_ABST
    Figure CN119377326B_ABST
Patent Text Reader

Abstract

The present invention provides a delayed playback method, device, equipment and product for a standby node in a database, including sending a periodic creation time consistency point command to all master nodes, obtaining the time consistency point logs of all master nodes synchronized to their respective corresponding standby nodes; determining a target time consistency point; if the target consistency point is outside the preset daily delayed playback time period, all standby nodes play back data to the target time consistency point; if the target consistency point is within the preset daily delayed playback time period, all standby nodes do not play back data. The present invention enables users to read the historical data of the standby nodes according to the preset daily delayed playback time period, meets the use requirements for historical data, and can ensure the consistency of data, with the characteristics of flexible setting, easy use and strong consistency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of databases, and in particular relates to a delayed playback method, device, equipment and product of a backup node in a database. Background Art

[0002] The amount of data stored in distributed databases is growing exponentially, and the amount of data and business volume are relatively large. On the one hand, in order to reduce the pressure on the primary node, it is hoped that the read business will be undertaken by the backup node. On the other hand, customers also hope to read non-latest data from the cluster, and get data before a certain time. For example, today they want to read yesterday's data, so that if the business data is misoperated, they can read the previous data from the backup node for recovery, or the business needs to use the old data to generate reports, such as generating a report of yesterday's data today. However, the existing backup node data storage and management method has the problem of not being able to replay data control according to specific needs and ensure data consistency at the same time. Summary of the invention

[0003] In view of this, the present invention aims to overcome the defects in the prior art and proposes a delayed playback method, device, equipment and product for a backup node in a database.

[0004] To achieve the above object, the technical solution of the present invention is achieved as follows:

[0005] In a first aspect, the present invention discloses a delayed playback method for a standby node in a database, the method comprising:

[0006] Send a periodic creation time consistency point command to all master nodes, where the master nodes include: coordination master node, data master node and global transaction management node;

[0007] Obtain the time consistency point logs of all master nodes synchronized to their corresponding standby nodes;

[0008] Determine that the earliest time consistency point in the set consisting of the latest time consistency points recorded in each time consistency point log is the target time consistency point;

[0009] If the target time consistency point is outside the preset daily delayed playback time period, all standby nodes replay data to the target time consistency point; if the target time consistency point is within the preset daily delayed playback time period, all standby nodes do not replay data.

[0010] In one embodiment of the present invention, determining that the earliest time consistency point in the set consisting of the latest time consistency points of each time consistency point log record is the target time consistency point includes:

[0011] Obtain the time consistency point logs of all the backup nodes coordinating the master node, where the earliest time consistency point in the set consisting of the latest time consistency points recorded in each time consistency point log is the time consistency point of the coordinating backup node;

[0012] Obtain the time consistency point logs of the standby nodes of all data master nodes, where the earliest time consistency point in the set consisting of the latest time consistency points recorded in each time consistency point log is the time consistency point of the data standby node;

[0013] Obtain the time consistency point logs of the standby nodes of all global transaction management nodes, where the earliest time consistency point in the set consisting of the latest time consistency points recorded in each time consistency point log is the time consistency point of the global transaction management standby node;

[0014] The target time consistency point is the smallest of the coordination standby node time consistency point, the data standby node time consistency point, and the global transaction management standby node time consistency point.

[0015] In one embodiment of the present invention, sending a periodic creation time consistency point command to all master nodes includes: sending a periodic creation time consistency point command from any coordinating master node to all master nodes.

[0016] In one embodiment of the present invention, the time consistency point log is an XLOG log including time consistency point information.

[0017] In one embodiment of the present invention, sending a periodic creation time consistency point command to all master nodes also includes: after any master node receives the periodic creation time consistency point command, it blocks transaction submission and waits for all pending transactions to be submitted to complete before creating a time consistency point.

[0018] In one embodiment of the present invention, each master node is correspondingly provided with at least one standby node.

[0019] In one embodiment of the present invention, presetting the daily delayed playback time period includes: setting a daily start time and a daily end time, and the time period between the daily start time and the daily end time is the daily preset delayed playback time period.

[0020] In a second aspect, the present invention discloses a delayed playback device for a backup node in a database, the device comprising:

[0021] A creation time consistency point module is used to send a periodic creation time consistency point command to all master nodes, wherein the master nodes include: a coordination master node, a data master node, and a global transaction management node;

[0022] The acquisition module is used to obtain the time consistency point logs of all master nodes synchronized to their corresponding standby nodes;

[0023] A determination module, used to determine that the earliest time consistency point in a set consisting of the latest time consistency points recorded in each time consistency point log is a target time consistency point;

[0024] The playback module is used to replay data to the target time consistency point if the target time consistency point is outside the preset daily delayed playback time period; if the target time consistency point is within the preset daily delayed playback time period, all backup nodes do not replay data.

[0025] In a third aspect, the present invention discloses an electronic device, comprising: one or more processors; a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors execute the above method.

[0026] In a fourth aspect, the present invention discloses a computer program product, including a computer program, which implements the above method when executed by a processor.

[0027] Compared with the prior art, the present invention has the following advantages:

[0028] The present invention discloses a delayed playback method, device, equipment and product for a standby node in a database. By sending a periodic creation time consistency point command to all master nodes, obtaining the time consistency point logs of all master nodes synchronized to their respective corresponding standby nodes, determining the target time consistency point and judging whether the standby node plays back the data, the user can read the historical data of the standby node according to the preset daily delayed playback time period, meet the use requirements of the historical data, and ensure the consistency of the data. The method has the characteristics of flexible setting, easy use and strong consistency. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] The accompanying drawings, which constitute a part of the present invention, are used to provide a further understanding of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute improper limitations on the present invention.

[0030] In the attached picture:

[0031] Figure 1 A schematic diagram of an application scenario of a delayed playback method of a standby node in a database according to an embodiment of the present invention;

[0032] Figure 2 A schematic diagram of an embodiment of a delayed playback method for a backup node in a database according to the present invention;

[0033] Figure 3 A schematic diagram of another embodiment of a delayed playback method for a backup node in a database of the present invention;

[0034] Figure 4 A schematic diagram of a method for delayed playback of a standby node in a database according to an embodiment of the present invention, in which a daily delayed playback time period is preset;

[0035] Figure 5 A schematic diagram of a delayed playback device of a standby node in a database according to an embodiment of the present invention;

[0036] Figure 6 The present invention is a schematic diagram of a delayed playback electronic device of a backup node in a database according to an embodiment of the present invention. DETAILED DESCRIPTION

[0037] It should be noted that, in the absence of conflict, the embodiments of the present invention and the features in the embodiments may be combined with each other.

[0038] In the description of the present invention, it should be further explained that the terms "first", "second", etc. are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first", "second", etc. may explicitly or implicitly include one or more of the features. In the description of the present invention, unless otherwise specified, "plurality" means two or more.

[0039] The existing backup node data storage management method has the problem of being unable to control playback data according to specific needs while ensuring data consistency.

[0040] The present invention discloses a delayed playback method, device, equipment and product for a standby node in a database. By sending a periodic creation time consistency point command to all master nodes, obtaining the time consistency point logs of all master nodes synchronized to their respective corresponding standby nodes, determining the target time consistency point and judging whether the standby node plays back the data, the user can read the historical data of the standby node according to the preset daily delayed playback time period, meet the use requirements of the historical data, and ensure the consistency of the data. The method has the characteristics of flexible setting, easy use and strong consistency.

[0041] like Figure 1 As shown, an application scenario of a delayed playback method of a standby node in a database of the present invention includes a coordinating master node 11 and several groups of corresponding coordinating standby nodes 12, a data master node 31 and several groups of corresponding data standby nodes 32, a global transaction management node 21 and several groups of corresponding global transaction management standby nodes 22.

[0042] The present invention will be described in detail below with reference to the accompanying drawings and in conjunction with embodiments.

[0043] In one embodiment of the present invention, Figure 2As shown, a delayed playback method of a standby node in a database includes:

[0044] Step S201, sending a periodic creation time consistency point command to all master nodes, wherein the master nodes include: a coordination master node, a data master node, and a global transaction management node;

[0045] In this embodiment, a periodic creation time consistency point command is sent from any coordinating master node to all master nodes.

[0046] After any master node receives the command to periodically create a time consistency point, it blocks transaction submission and waits for all pending transactions to be completed before creating a time consistency point and backing it up to the corresponding standby node.

[0047] Exemplary:

[0048] The coordination master node is represented by CN: it is responsible for receiving client requests, performing SQL parsing and optimization, generating execution plans, and coordinating the data master node for data query and writing;

[0049] The data master node is represented by DN: it completes data storage and local data query and writing;

[0050] The global transaction management node is represented by GTM: it generates and maintains global timestamps to ensure strong consistency of cluster data.

[0051] Under existing technical conditions, the general data master node mainly supports database reading and writing. However, due to the exponential growth of the amount of data stored in the distributed database, the amount of data and the amount of business are relatively large. In order to reduce the pressure on the data master node, the read business is expected to be undertaken by the data backup node. In addition, customers also hope to read non-latest data from the cluster to achieve the required functions.

[0052] Step S202, obtaining the time consistency point logs of all master nodes synchronized to their corresponding standby nodes;

[0053] In this embodiment, each master node is correspondingly provided with at least one standby node.

[0054] Step S203, determining that the earliest time consistency point in the set consisting of the latest time consistency point recorded in each time consistency point log is the target time consistency point;

[0055] In this embodiment, after the target time consistency point is determined, the target time consistency point information is sent to all standby nodes to synchronize the logs of the corresponding master nodes.

[0056] Step S204: if the target time consistency point is outside the preset daily delayed playback time period, all standby nodes replay data to the target time consistency point; if the target time consistency point is within the preset daily delayed playback time period, all standby nodes do not replay data.

[0057] In another embodiment of the present invention, Figure 3 As shown, determining that the earliest time consistency point in the set consisting of the latest time consistency point recorded in each time consistency point log is the target time consistency point includes:

[0058] Step S301, obtaining the time consistency point logs of all the backup nodes coordinating the master node, wherein the earliest time consistency point in the set consisting of the latest time consistency points recorded in each time consistency point log is the time consistency point of the coordinating backup node;

[0059] Step S302, obtaining the time consistency point logs of the backup nodes of all data master nodes, wherein the earliest time consistency point in the set consisting of the latest time consistency points recorded in each time consistency point log is the data backup node time consistency point;

[0060] In step S302, the plurality of data standby nodes corresponding to each data master node are used as a high availability group, the earliest time consistency point in the set consisting of the latest time consistency points recorded in all time consistency point logs in the high availability group is used as the group time consistency point, and the earliest time consistency point in the set of group time consistency points of all high availability groups is the data standby node time consistency point;

[0061] This method of determining the time consistency point of the data backup node based on the high availability group can achieve parallel computing effects and improve efficiency.

[0062] Step S303, obtaining the time consistency point logs of the standby nodes of all global transaction management nodes, wherein the earliest time consistency point in the set consisting of the latest time consistency points recorded in each time consistency point log is the time consistency point of the global transaction management standby node;

[0063] Step S304: the target time consistency point is the smallest of the coordination standby node time consistency point, the data standby node time consistency point, and the global transaction management standby node time consistency point.

[0064] In this example, based on the calculation method of the coordination standby node time consistency point, the data standby node time consistency point and the global transaction management standby node time consistency point, the partition parallel computing effect can be achieved and the speed of determining the target time consistency point can be improved.

[0065] In this embodiment, the time consistency point log is an XLOG log including time consistency point information.

[0066] In another embodiment of the present invention, Figure 4 As shown, the preset daily delayed playback time period includes: setting a daily start time and a daily end time, and the time period between the daily start time and the daily end time is the daily preset delayed playback time period.

[0067] In this embodiment, the start time of each day is set to t1, and the end time of each day is set to t2. For example, t1 is configured as 0:00 and t2 is configured as 16:00. Then the data that the user queries between 0:00-16:00 is the data before 0:00 of the day. The new data of the master node is stored as a log on the corresponding standby node. The standby node does not replay the data. After 16:00 every day, all the standby node data is replayed to the target time consistency point.

[0068] In this embodiment, the daily preset delayed playback time period can be freely set as needed, thereby improving the applicability of the method.

[0069] like Figure 5 As shown, the present invention also discloses a delayed playback device for a backup node in a database, comprising:

[0070] The creation time consistency point module 401 is used to send a periodic creation time consistency point command to all master nodes, wherein the master nodes include: a coordination master node, a data master node, and a global transaction management node;

[0071] The acquisition module 402 is used to obtain the time consistency point logs of all the master nodes synchronized to their corresponding standby nodes;

[0072] A determination module 403 is used to determine that the earliest time consistency point in the set consisting of the latest time consistency point recorded in each time consistency point log is the target time consistency point;

[0073] The playback module 404 is used to replay data to the target time consistency point if the target time consistency point is outside the preset daily delayed playback time period; if the target time consistency point is within the preset daily delayed playback time period, all backup nodes do not replay data.

[0074] The present invention also discloses an electronic device, such as Figure 6 As shown, an embodiment is disclosed, which is a block diagram of an electronic device suitable for delayed playback of a standby node in the above database.

[0075] The electronic device 50 of this embodiment includes a processor 501, which can perform various appropriate actions and processes according to the program stored in the ROM 502 or the program loaded from the storage part 508 to the RAM 503. The processor 501 may include, for example, a general-purpose microprocessor, an instruction set processor and / or a related chipset and / or a dedicated microprocessor, etc. The processor 501 may also include an onboard memory for caching purposes. The processor 501 may include a single processing unit or multiple processing units for performing different actions of the method flow according to the embodiment of the present invention.

[0076] In RAM503, various programs and data required for the operation of electronic device 50 are stored. Processor 501, ROM502 and RAM503 are connected to each other via bus 504, and processor 501 performs various operations of the method flow according to the embodiment of the present invention by executing the program in ROM502 and / or RAM503. It should be noted that the program can also be stored in one or more memories other than ROM502 and RAM503, and processor 501 can also perform various operations of the method flow according to the embodiment of the present invention by executing the program stored in one or more memories.

[0077] According to an embodiment of the present invention, the electronic device 50 may further include an I / O interface 505, which is also connected to the bus 504. The electronic device 50 may further include one or more of the following components connected to the I / O interface 505: an input portion 506 including a keyboard, a mouse, etc.; an output portion 507 including a cathode ray tube, a liquid crystal display, and a speaker; a storage portion 508 including a hard disk, etc.; and a communication portion 509 including a network interface card such as a LAN card, a modem, etc. The communication portion 509 performs communication processing via a network such as the Internet. A drive 5010 is also connected to the I / O interface 505 as needed. A removable medium 5011, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 5010 as needed, so that a computer program read therefrom is installed into the storage portion 508 as needed.

[0078] Embodiments of the present invention also include a computer program product.

[0079] The computer program product includes a computer program, which contains program codes for executing the method provided by the embodiment of the present invention. When the computer program product runs on an electronic device, the program codes are used to enable the electronic device to implement the method provided by the embodiment of the present invention.

[0080] In one embodiment, the computer program may rely on a tangible storage medium such as an optical storage device or a magnetic storage device. In another embodiment, the computer program may also be transmitted and distributed in the form of a signal on a network medium. The program code included in the computer program may be transmitted using any appropriate network medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.

[0081] According to an embodiment of the present invention, the program code for executing the computer program provided by the embodiment of the present invention can be written by any combination of one or more programming languages, and specifically, these computing programs can be implemented using high-level process and / or object-oriented programming languages. Programming languages ​​include but are not limited to programming languages ​​such as Java, C++, python, C language or similar. The program code can be executed completely on the user computing device, partially on the user device, partially on the remote computing device, or completely on the remote computing device or server. In the case of a remote computing device, the remote computing device can be connected to the user computing device through any type of network, including a local area network or a wide area network, or can be connected to an external computing device.

[0082] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present invention. In this regard, each box in the flowchart or block diagram may represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of the code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box may also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of boxes in the block diagram or flowchart, can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions. It can be understood by those skilled in the art that the features recorded in the various embodiments and / or claims of the present invention can be combined and / or combined in various ways, even if such a combination or combination is not explicitly recorded in the present invention. In particular, without departing from the spirit and teaching of the present invention, the features described in the various embodiments and / or claims of the present invention may be combined and / or combined in a variety of ways. All of these combinations and / or combinations fall within the scope of the present invention.

[0083] The embodiments of the present invention are described above. However, these embodiments are only for the purpose of illustration, and are not intended to limit the scope of the present invention. Although the embodiments are described above, this does not mean that the measures in the various embodiments cannot be used in combination. The scope of the present invention is limited by the attached claims and their equivalents. Without departing from the scope of the present invention, those skilled in the art may make various substitutions and modifications, which should all fall within the scope of the present invention.

Claims

1. A delayed playback method for a backup node in a database, characterized in that: The method comprises: Sending a periodic creation time consistency point command to all master nodes, wherein the master nodes include: a coordination master node, a data master node, and a global transaction management node; Obtain the time consistency point logs of all master nodes synchronized to their corresponding standby nodes; Determine that the earliest time consistency point in the set consisting of the latest time consistency points recorded in each of the time consistency point logs is the target time consistency point; The target time consistency point is the smallest of the coordination standby node time consistency point, the data standby node time consistency point, and the global transaction management standby node time consistency point; If the target time consistency point is outside the preset daily delayed playback time period, all the backup nodes will replay the data to the target time consistency point; if the target time consistency point is within the preset daily delayed playback time period, all the backup nodes will not replay the data.

2. The delayed playback method of a backup node in a database according to claim 1, characterized in that: The determining that the earliest time consistency point in the set consisting of the latest time consistency points recorded in each time consistency point log is the target time consistency point comprises: Obtain the time consistency point logs of the standby nodes of all the coordinating master nodes, wherein the earliest time consistency point in the set consisting of the latest time consistency points recorded in each of the time consistency point logs is the time consistency point of the coordinating standby node; Obtain the time consistency point logs of the standby nodes of all the data master nodes, wherein the earliest time consistency point in the set consisting of the latest time consistency point recorded in each time consistency point log is the data standby node time consistency point; The time consistency point logs of the standby nodes of all the global transaction management nodes are obtained, wherein the earliest time consistency point in the set consisting of the latest time consistency points recorded in each time consistency point log is the time consistency point of the global transaction management standby node.

3. The delayed playback method of a backup node in a database according to claim 1, characterized in that: The sending of a periodic creation time consistency point command to all master nodes includes: sending a periodic creation time consistency point command from any of the coordinating master nodes to all master nodes.

4. The delayed playback method of a backup node in a database according to claim 1, characterized in that: The time consistency point log is an XLOG log including time consistency point information.

5. The delayed playback method of a backup node in a database according to claim 1, characterized in that: The sending of the periodic creation time consistency point command to all master nodes also includes: after any of the master nodes receives the periodic creation time consistency point command, blocking transaction submission, waiting for all pending transactions to be submitted to complete, and then creating a time consistency point.

6. The delayed playback method of a backup node in a database according to claim 1, characterized in that: Each of the master nodes is correspondingly provided with at least one standby node.

7. The delayed playback method of a backup node in a database according to claim 1, characterized in that: The preset daily delayed playback time period includes: setting a start time of each day and an end time of each day, and the period between the start time of each day and the end time of each day is the preset daily delayed playback time period.

8. A delayed playback device for a backup node in a database, characterized in that: The device comprises: A creation time consistency point module is used to send a periodic creation time consistency point command to all master nodes, wherein the master nodes include: a coordination master node, a data master node, and a global transaction management node; The acquisition module is used to obtain the time consistency point logs of all master nodes synchronized to their corresponding standby nodes; A determination module, used to determine that the earliest time consistency point in the set consisting of the latest time consistency point recorded in each time consistency point log is the target time consistency point; the target time consistency point is the smallest of the coordination standby node time consistency point, the data standby node time consistency point and the global transaction management standby node time consistency point; A playback module is used to: if the target time consistency point is outside the preset daily delayed playback time period, all the backup nodes will play back the data to the target time consistency point; if the target time consistency point is within the preset daily delayed playback time period, all the backup nodes will not play back the data.

9. An electronic device, characterized in that: include: one or more processors; A storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors are caused to perform the method according to any one of claims 1 to 7.

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

Citation Information

Patent Citations

  • Distributed database management method and device based on distributed logic timestamps

    CN110795506A

  • Restoration method and device of distributed database system and computer readable storage medium

    CN112000522A