WO2020134480A1 - 一种数据库主备复制延迟监控方法、装置和系统 - Google Patents
一种数据库主备复制延迟监控方法、装置和系统 Download PDFInfo
- Publication number
- WO2020134480A1 WO2020134480A1 PCT/CN2019/113464 CN2019113464W WO2020134480A1 WO 2020134480 A1 WO2020134480 A1 WO 2020134480A1 CN 2019113464 W CN2019113464 W CN 2019113464W WO 2020134480 A1 WO2020134480 A1 WO 2020134480A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- latest
- log file
- log
- synchronization
- timestamp
- Prior art date
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/30—Monitoring
- G06F11/3003—Monitoring arrangements specially adapted to the computing system or computing system component being monitored
- G06F11/302—Monitoring arrangements specially adapted to the computing system or computing system component being monitored where the computing system component is a software system
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/30—Monitoring
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Definitions
- the embodiments of the present application relate to, but are not limited to, the field of databases, and in particular, to a method, device, and system for monitoring database primary and backup replication delay.
- the database is composed of a host and a backup machine in a master-slave replication environment.
- the backup machine needs to synchronize the host log and playback the host log.
- Synchronous host log means that the receiving thread of the standby machine receives the host log from the network and persists it to a local file.
- Replaying the host log means that the playback thread reads the content of the synchronization log and executes the operation recorded in the log on the standby machine.
- the synchronization delay determines the amount of data lost after a host disaster. The greater the synchronization delay, the more data the host loses after a disaster. The actual system needs to monitor the synchronization delay in real time. If it is found that the synchronization delay exceeds the threshold, it will actively alert and implement corresponding measures to reduce the synchronization delay.
- the playback delay is related to the visibility of data when the standby machine is used as a reading device. If the playback delay is too large, users will not be able to read the committed transactions on the standby machine.
- the playback delay is also related to the time it takes for the host to fail over after a disaster. If the playback delay is too large, the failover time will be very long, causing the system to be unable to provide external services for a long time. In the same way, the actual system needs to monitor the playback delay in real time. If it is found that the playback delay exceeds the threshold, it will actively alert and implement corresponding measures to reduce the synchronization delay.
- the embodiments of the present application provide a database master-slave replication delay monitoring method, device and system, which can accurately obtain the synchronization delay and playback delay of the standby machine, so as to ensure the related requirements of system operation and failover.
- An embodiment of the present application provides a database master-slave replication delay monitoring method, including: writing a first predetermined log generated when a transaction is submitted to a first log file, and updating the latest position and latest timestamp of the first log file; The first scheduled log, the latest position of the first log file and the latest timestamp are sent to the backup machine.
- An embodiment of the present application provides a database master-slave replication delay monitoring method, which includes: receiving a first scheduled log of a host, the latest position and a latest timestamp of a first log file, and writing the first scheduled log into a synchronization log file, Update the latest position and latest timestamp of the first log file, update the latest position and latest timestamp of the synchronization log file; read the synchronization log file, execute the contents of the synchronization log file, and update the latest position of the replayed log after each transaction is completed And the latest timestamp; calculate the synchronization delay based on the latest position and latest timestamp of the first log file, the latest position and latest timestamp of the synchronization log file, and the latest position and latest timestamp of the first log file, and the latest of the replayed log The location and latest timestamp calculate the playback delay.
- An embodiment of the present application provides a database master-slave replication delay monitoring device, including: a first update module for writing a first predetermined log generated when a transaction is submitted to a first log file to update the latest of the first log file Location and latest timestamp; communication module, used to send the latest location and latest timestamp of the first predetermined log and the first log file to the backup machine.
- An embodiment of the present application provides a database master-slave replication delay monitoring device, including: a second update module, configured to receive a first scheduled log of a host, the latest location and a latest timestamp of a first log file, and convert the first scheduled log Write to the synchronization log file, update the latest position and latest timestamp of the first log file, update the latest position and latest timestamp of the synchronization log file; the third update module is used to read the synchronization log file and execute the synchronization log file Content, update the latest position and latest timestamp of the replayed log every time a transaction is executed; calculation module, used to calculate the synchronization delay based on the latest position and latest timestamp of the first log file, the latest position and latest timestamp of the synchronization log file , Calculate the playback delay according to the latest position and latest timestamp of the first log file, the latest position and latest timestamp of the replayed log.
- a second update module configured to receive a first scheduled log of a host, the
- An embodiment of the present application provides a database master-slave replication delay monitoring device, which includes a processor and a computer-readable storage medium.
- the computer-readable storage medium stores instructions, and when the instructions are executed by the processor, Implement any of the above methods for monitoring the primary and secondary replication delays of the database.
- An embodiment of the present application provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the steps of any one of the above database master-slave replication delay monitoring methods are implemented.
- An embodiment of the present application provides a database master-slave replication delay monitoring system, including: a host for writing a first predetermined log generated when a transaction is submitted to a first log file, and updating the latest position and latest of the first log file Time stamp; send the first scheduled log, the latest position of the first log file and the latest time stamp to the standby machine; the standby machine is used to receive the first scheduled log of the host, the latest position of the first log file and the latest time stamp, Write the first scheduled log to the synchronization log file, update the latest position and latest timestamp of the first log file, update the latest position and latest timestamp of the synchronization log file; read the synchronization log file, and execute the contents of the synchronization log file, Update the latest position and latest timestamp of the replayed log every time a transaction is executed; calculate the synchronization delay according to the latest position and latest timestamp of the first log file, the latest position and latest timestamp of the synchronization log file, and according to the first log file’s The latest position
- FIG. 1 is a flowchart of a database master-slave replication delay monitoring method according to an embodiment of the present application
- FIG. 2 is a flowchart of a database master-slave replication delay monitoring method according to another embodiment of this application;
- FIG. 3 is a flowchart of a MySQL database master-slave replication delay monitoring method according to Example 1 of the embodiment of the present application;
- FIG. 4 is a flowchart of a method for monitoring the master-standby replication delay of the Mariadb database according to Example 2 of the application;
- FIG. 5 is a flowchart of a method for monitoring the primary and backup replication delay of the PostgreSQL database according to Example 4 of the application;
- FIG. 6 is a schematic diagram of the structural composition of a database primary and backup replication delay monitoring device proposed by another embodiment of the present application.
- FIG. 7 is a schematic structural composition diagram of a database primary and backup replication delay monitoring device according to another embodiment of the present application.
- FIG. 8 is a schematic structural composition diagram of a database primary and backup replication delay monitoring system proposed by another embodiment of the present application.
- an embodiment of the present application proposes a database master-slave replication delay monitoring method, including: Step 100: The host writes a first predetermined log generated when a transaction is submitted to a first log file, and updates the first log file 'S latest location and latest timestamp.
- the host may write the first predetermined log generated when committing the transaction into the first log file through the first thread, and update the latest position and latest timestamp of the first log file; wherein, the first thread includes Application thread.
- the host receives the client request, starts the transaction, executes the transaction, submits the transaction after the execution of the transaction is completed, and generates a first predetermined log when the transaction is submitted.
- the host can receive the client request through the first thread, start the transaction, execute the transaction, submit the transaction after the execution of the transaction is completed, and generate a first predetermined log when submitting the transaction.
- the first predetermined log records the specific operation content of the transaction. For example, which record of which table was deleted, which field of which record of which table was updated, which record was inserted into which table, and so on.
- the first predetermined log includes any one of the following: a first binary log (binlog, binary), and a first log advance (WAL, Write Ahead Log) log.
- updating the latest position and the latest timestamp of the first log file includes: updating the latest position of the first log file to the latest position of the last updated first log file and the length of the first predetermined log And; update the latest timestamp of the first log file to the current system time when writing the first predetermined log to the first log file is completed.
- the latest position and latest timestamp of the first log file are updated in the memory.
- the latest position of the first log file in the memory is updated to the sum of the latest position of the first log file last updated and the length of the first predetermined log; the latest timestamp of the first log file in the memory is updated To write the first predetermined log to the current system time when the first log file is completed.
- the embodiment of the present application updates the latest position and latest timestamp of the first log file in the memory, which does not affect the performance of the database.
- Step 101 The host sends the first predetermined log, the latest position of the first log file and the latest time stamp to the standby machine.
- the host may send the first predetermined log, the latest position of the first log file and the latest timestamp to the standby machine through the second thread; where the second thread includes any one of the following: a replication thread, a dump thread , Wal_send thread.
- the second thread can be woken up by the first thread.
- step 100 and step 101 are implemented by different threads, which improves the implementation efficiency.
- the latest position and the latest timestamp of the first log file when sending the first predetermined log, the latest position and the latest timestamp of the first log file to the standby machine, the latest position and the latest timestamp of the first log file may be included in the first predetermined log Is sent to the backup machine in the header of the network packet; of course, the latest position and the latest timestamp of the first log file can also be sent to the backup machine in other forms.
- the implementation of this application does not limit the specific sending form.
- the specific sending form It is also not used to limit the protection scope of the embodiments of the present application.
- the first predetermined log generated when the transaction is submitted is written into the first log file, and the latest position and latest timestamp of the first log file are updated, and the latest position and latest timestamp of the first log file are combined with the first
- a predetermined log is sent to the standby machine, so that the standby machine obtains accurate synchronization delay and playback delay in real time during synchronization.
- the method further includes: Step 102: The host receives the log synchronization response.
- the host may receive the log synchronization response through the third thread or the second thread; wherein, the third thread includes any one of the following: a response reception (ACK, Acknowledge) thread and a wal_send thread.
- the host after receiving the log synchronization response through the third thread or the second thread, the host notifies the first thread.
- the host transaction submission ends, and the response is returned to the client through the first thread.
- the method before receiving the log-synchronized response, further includes: determining whether the first log file needs to be switched; when it is determined that the first log file does not need to be switched, continuing to receive the log-synchronized response step.
- the method when it is determined that the first log file needs to be switched, before continuing to perform the step of receiving the log synchronized response, the method further includes: updating the latest position and latest timestamp of the first log file Write to the first system table master_log_info to switch the first log file.
- the latest position and the latest time stamp of the first log file are written into the first system table master_log_info, that is, the latest position and the latest time stamp of the first log file are placed on the disk, so that The latest location and latest timestamp of the first log file are permanently saved, so that the latest location and latest timestamp of the first log file will not be lost due to abnormality of the database.
- determining whether to switch the first log file includes: determining whether the length of the first log file is greater than or equal to the first preset threshold; when it is determined that the length of the first log file is greater than or equal to the first preset threshold, determining the need Switch the first log file; when it is determined that the length of the first log file is less than the first preset threshold, it is determined that the first log file does not need to be switched.
- the latest position and the latest time stamp of the first log file are written into the first system table master_log_info, that is, the latest position and the latest time stamp of the first log file are placed on the disk, so that The latest location and latest timestamp of the first log file are permanently saved, so that the latest location and latest timestamp of the first log file will not be lost due to abnormality of the database.
- the host may create the first system table master_log_info when initializing the database.
- an embodiment of the present application proposes a database master-slave replication delay monitoring method, including: Step 200: The standby machine receives the first predetermined log of the host, the latest location and the latest timestamp of the first log file, and the A predetermined log is written to the synchronization log file relaylog, the latest position and latest timestamp of the first log file are updated, and the latest position and latest timestamp of the synchronization log file are updated.
- the standby machine may receive the first scheduled log of the host, the latest position of the first log file and the latest timestamp through the fourth thread, write the first scheduled log to the synchronization log file relaylog, and update the first
- the latest position and latest timestamp of the log file are used to update the latest position and latest timestamp of the synchronization log file; among them, the fourth thread includes any one of the following: a receiving thread and an input/output (IO, Input) output thread.
- the first predetermined log includes any one of the following: a first binary log (binlog, binary), and a first log advance (WAL, Write Ahead Log) log.
- updating the latest position and latest timestamp of the first log file includes: updating the latest position and latest timestamp of the first log file in memory; updating the latest position and latest timestamp of the synchronization log file includes: Update the latest location and latest timestamp of the synchronization log file in memory.
- updating the latest position and the latest timestamp of the first log file in the memory includes: updating the latest position of the first log file in the memory to the latest position of the received first log file, and updating the first log file in the memory The latest timestamp of is updated to the latest timestamp of the first log file received.
- the embodiment of the present application updates the latest position and latest timestamp of the first log file and the latest position and latest timestamp of the synchronization log file in the memory, which does not affect the performance of the database.
- the latest position and latest timestamp of the first log file are included in the network packet header of the first predetermined log, the first predetermined log is received, and the first log is obtained from the network packet header of the first predetermined log The latest location and latest timestamp of the file.
- updating the latest position and the latest timestamp of the synchronization log file includes: updating the latest position of the synchronization log file to the sum of the latest position of the last updated synchronization log file and the length of the first predetermined log received , Update the latest timestamp of the synchronization log file to the generation time of the first predetermined log recorded in the first predetermined log.
- Step 201 The standby machine reads the synchronization log file, executes the contents of the synchronization log file, and updates the latest position and latest time stamp of the replayed log every time a transaction is executed.
- the backup machine can read the synchronization log file through the fifth thread, execute the content of the synchronization log file, and update the latest position and latest timestamp of the replayed log every time a transaction is executed; wherein, the backup machine can pass The fourth thread wakes up the fifth thread.
- the fifth thread includes any one of the following: a playback thread and a worker thread (worker thread).
- updating the latest position and latest timestamp of the replayed log includes: updating the latest position of the replayed log to the sum of the latest position of the last updated replayed log and the length of the transaction executed this time, The latest timestamp of the replayed log is updated to the generation time of the log corresponding to the transaction recorded in the log corresponding to the transaction executed this time.
- the second predetermined log generated when the fifth thread commits the transaction is written into the second log file to determine whether the second log file needs to be switched.
- the second log file write the latest position and latest timestamp of the replayed log to the second system table slave_log_info, switch the second log file, and continue to read the synchronization log file; when it is determined that you do not need to switch the second log file When logging files, continue to read the synchronization log files.
- determining whether to switch the second log file includes: determining whether the length of the second log file is greater than or equal to the third preset threshold; when it is determined that the length of the second log file is greater than or equal to the third preset threshold, determining the need Switch the second log file; when it is determined that the length of the second log file is less than the third preset threshold, it is determined that the second log file does not need to be switched.
- the latest position and latest timestamp of the replayed log are written into the second system table slave_log_info, that is, the latest position and latest timestamp of the replayed log are placed on the disk, so that the The latest location and latest timestamp are permanently saved, so that the latest location and latest timestamp of the replayed log will not be lost due to database anomalies.
- Step 202 The backup machine calculates the synchronization delay according to the latest position and latest timestamp of the first log file, the latest position and latest timestamp of the synchronization log file, and the latest position and latest timestamp of the first log file, and the latest of the replayed log
- the location and latest timestamp calculate the playback delay.
- the standby machine when the standby machine receives the standby machine replication delay query instruction, it continues to execute the calculation of the synchronization delay according to the latest position and latest timestamp of the first log file and the latest position and latest timestamp of the synchronization log file, according to The step of calculating the playback delay of the latest position and latest timestamp of the first log file, the latest position and latest timestamp of the replayed log.
- the synchronization delay includes a synchronization position delay and a synchronization time delay
- calculating the synchronization delay according to the latest position and latest time stamp of the first log file, the latest position and latest time stamp of the synchronization log file includes: The difference between the latest position of the file and the latest position of the synchronization log file is taken as the synchronization position delay, and the difference between the latest time stamp of the synchronization log file and the latest time stamp of the first log file is taken as the synchronization time delay.
- the playback delay includes a playback position delay and a playback time delay
- calculating the playback delay according to the latest position and latest timestamp of the first log file, the latest position and latest timestamp of the played back log includes: converting the first log The difference between the latest position of the file and the latest position of the played back log is taken as the playback position delay, and the difference between the latest time stamp of the played back log and the latest time stamp of the first log file is taken as the playback time delay.
- the embodiment of the present application calculates the synchronization delay and the playback delay based on the latest position and the latest timestamp of the first log file, and accurately obtains the synchronization delay and the playback delay of the standby machine, thereby ensuring the related requirements of system operation and failover.
- the method further includes: returning a log synchronization response to the host.
- the method further includes: determining whether the synchronization log file needs to be switched, and when it is determined that the synchronization log file needs to be switched, the synchronization log file The latest position and latest timestamp are written to the second system table slave_log_info, the synchronization log file is switched, and the log synchronized response is returned to the host; when it is determined that the synchronization log file does not need to be switched, the log synchronized response is returned to the host.
- determining whether to switch the synchronization log file includes: determining whether the length of the synchronization log file is greater than or equal to the second preset threshold; when it is determined that the length of the synchronization log file is greater than or equal to the second preset threshold, it is determined that the synchronization log needs to be switched File; when it is determined that the length of the synchronization log file is less than the second preset threshold, it is determined that the synchronization log file does not need to be switched.
- the latest position and the latest time stamp of the synchronization log file are written into the second system table slave_log_info, that is, the latest position and the latest time stamp of the synchronization log file are placed on the disk, so that the latest synchronization log file
- the location and the latest timestamp are permanently saved, so that the latest location and the latest timestamp of the synchronization log file will not be lost due to the abnormality of the database.
- the standby machine creates the second system table slave_log_info when initializing the database.
- This example introduces the monitoring method for the MySQL database master-slave replication delay. See Figure 3. This method includes the following steps.
- the application thread of the host initializes the database and creates the first system table master_log_info.
- the application thread of the host writes the first binlog generated by the new transaction into the first log file, that is, the first binlog is placed.
- the application thread of the host updates the latest position and latest timestamp of the first log file.
- the application thread of the host wakes up the dump thread, and the replication thread of the host sends the first binlog to the standby machine, and the network packet header of the first binlog includes the latest position and latest timestamp of the first log file.
- the application thread of the host determines whether the first log file needs to be switched. When the first log file needs to be switched, the latest position and latest timestamp of the first log file are written into the first system table master_log_info to switch the first log file. For a log file, continue to perform step (10); when there is no need to switch the first log file, continue to perform step (10).
- the IO thread of the standby machine obtains the first binlog of the host from the network, and the network packet header of the first binlog includes the latest position and latest timestamp of the first log file.
- the IO thread of the standby machine acquires and updates the latest position and latest timestamp of the first log file, obtains the first binlog, writes the first binlog to the synchronization log file relaylog, and updates the latest position and time of the synchronization log file stamp.
- the IO thread of the standby machine determines whether the synchronization log file needs to be switched. When it is determined that the synchronization log file needs to be switched, the latest position and the latest timestamp of the synchronization log file are written to the second system table slave_log_info to switch the synchronization log file. Continue to perform step (14); when it is determined that it is not necessary to switch the synchronization log file, proceed to step (14).
- the IO thread of the backup machine returns a log synchronization response to the ACK thread of the host.
- the host's ACK thread notifies the application thread.
- the host submits a new transaction and returns a response to the client.
- the worker thread of the standby machine reads a new transaction from the synchronous log file, executes the new transaction, plays back the new transaction on the host, and writes the second binlog generated by the new transaction into the second log file, that is, the second binlog was placed.
- the worker thread of the standby machine updates the latest position and latest timestamp of the replayed log.
- the worker thread of the standby machine determines whether the second log file needs to be switched. When it is determined that the second log file needs to be switched, the latest position and latest timestamp of the replayed log are written to the second system table slave_log_info to switch the second Log file, continue to read the synchronization log file; when it is determined that it is not necessary to switch the second log file, continue to read the synchronization log file.
- This example introduces the monitoring method for the replication delay of the Mariadb database.
- the monitoring method for the replication delay of the Mariadb database is the same as the monitoring method for the replication delay of the MySQL database.
- the log format and the implementation of the second thread are different. See Figure 4. The method includes the following steps.
- the application thread of the host initializes the database and creates the first system table master_log_info.
- the application thread of the host writes the first binlog generated by the new transaction into the first log file, that is, the first binlog is placed.
- the application thread of the host updates the latest position and latest timestamp of the first log file.
- the host's application thread wakes up the dump thread.
- the host's dump thread sends the first binlog to the standby machine.
- the network packet header of the first binlog includes the latest location and latest timestamp of the first log file.
- the application thread of the host determines whether the first log file needs to be switched. When the first log file needs to be switched, the latest position and latest timestamp of the first log file are written into the first system table master_log_info to switch the first log file. For a log file, continue to perform step (10); when there is no need to switch the first log file, continue to perform step (10).
- the IO thread of the standby machine obtains the first binlog of the host from the network, and the network packet header of the first binlog includes the latest position and latest timestamp of the first log file.
- the IO thread of the standby machine acquires and updates the latest position and latest timestamp of the first log file, obtains the first binlog, writes the first binlog into the synchronization log file relaylog, and updates the latest position and time of the synchronization log file stamp.
- the IO thread of the standby machine determines whether the synchronization log file needs to be switched. When it is determined that the synchronization log file needs to be switched, the latest position and the latest timestamp of the synchronization log file are written to the second system table slave_log_info to switch the synchronization log file. Continue to perform step (14); when it is determined that it is not necessary to switch the synchronization log file, proceed to step (14).
- the IO thread of the standby machine returns the log synchronization response to the dump thread of the host machine.
- the host submits a new transaction and returns a response to the client.
- the IO thread of the standby machine wakes up the fifth thread (worker thread) to play back the synchronization log file relaylog.
- the worker thread of the standby machine reads a new transaction from the synchronous log file, executes the new transaction, plays back the new transaction on the host, and writes the second binlog generated by the new transaction into the second log file, that is, the second binlog was placed.
- the worker thread of the standby machine updates the latest position and latest timestamp of the replayed log.
- the worker thread of the standby machine determines whether the second log file needs to be switched. When it is determined that the second log file needs to be switched, the latest position and latest timestamp of the replayed log are written to the second system table slave_log_info to switch the second Log file, continue to read the synchronization log file; when it is determined that it is not necessary to switch the second log file, continue to read the synchronization log file.
- This example introduces the Percona database master-slave replication delay monitoring method.
- the Percona database master-slave replication delay monitoring method is completely consistent with the MySQL database master-slave replication delay monitoring method, and will not be repeated here.
- PostgreSQL does not have binlog logs, only log advance (WAL, Write Ahead Log) logs.
- WAL log advance
- WAL Write Ahead Log
- the names of PostgreSQL replication threads, receiving threads, and playback threads are different from MySQL, see figure 5. The method includes the following steps.
- the application thread of the host initializes the database and creates the first system table master_log_info.
- the application thread of the host writes the first WAL log generated by the new transaction into the first log file, that is, the first WAL log is placed on the disk.
- the application thread of the host updates the latest position and latest timestamp of the first log file.
- the application thread of the host wakes up the wal_send thread.
- the host's wal_send thread sends the first WAL log to the standby machine.
- the network packet header of the first WAL log includes the latest position and latest timestamp of the first log file.
- the application thread of the host determines whether the first log file needs to be switched. When the first log file needs to be switched, the latest position and latest timestamp of the first log file are written into the first system table master_log_info to switch the first log file. For a log file, continue to perform step (10); when there is no need to switch the first log file, continue to perform step (10).
- the IO thread of the standby machine obtains the first WAL log of the host from the network, and the network packet header of the first WAL log includes the latest position and latest timestamp of the first log file.
- the IO thread of the standby machine acquires and updates the latest position and timestamp of the first log file, obtains the first WAL log, writes the first WAL log to the synchronization log file WAL log, and updates the latest position of the synchronization log file And the latest timestamp.
- the IO thread of the standby machine determines whether the synchronization log file needs to be switched. When it is determined that the synchronization log file needs to be switched, the latest position and the latest timestamp of the synchronization log file are written to the second system table slave_log_info to switch the synchronization log file. Continue to perform step (14); when it is determined that it is not necessary to switch the synchronization log file, proceed to step (14).
- the host submits a new transaction and returns a response to the client.
- the worker thread of the standby machine reads a new transaction from the synchronization log file, executes the new transaction, plays back the new transaction on the host, and writes the second WAL log generated by the new transaction into the second log file, that is, the first Two WAL logs are placed.
- the worker thread of the standby machine updates the latest position and latest timestamp of the replayed log.
- the worker thread of the standby machine determines whether the second log file needs to be switched. When it is determined that the second log file needs to be switched, the latest position and latest timestamp of the replayed log are written to the second system table slave_log_info to switch the second Log file, continue to read the synchronization log file; when it is determined that it is not necessary to switch the second log file, continue to read the synchronization log file.
- a database master-slave replication delay monitoring device such as a host
- a database master-slave replication delay monitoring device including: a first update module 601, which is used to write a first predetermined log generated when a transaction is submitted to the first In the log file, the latest position and the latest timestamp of the first log file are updated; the communication module 602 is used to send the first predetermined log, the latest position and the latest timestamp of the first log file to the backup machine.
- the first update module 601 may write the first predetermined log generated when committing the transaction into the first log file through the first thread to update the latest position and latest timestamp of the first log file; wherein, The first thread includes an application thread.
- the first update module 601 receives a client request, starts a transaction, executes the transaction, submits the transaction after the execution of the transaction is completed, and generates a first predetermined log when submitting the transaction.
- the first update module 601 can receive the client request through the first thread, start the transaction, execute the transaction, submit the transaction after the execution of the transaction is completed, and generate a first predetermined log when submitting the transaction.
- the first predetermined log records the specific operation content of the transaction. For example, which record of which table was deleted, which field of which record of which table was updated, which record was inserted into which table, and so on.
- the first predetermined log includes any one of the following: a first binary log (binlog, binary), and a first log advance (WAL, Write Ahead Log) log.
- the first update module 601 is specifically configured to update the latest position and the latest timestamp of the first log file in the following manner: update the latest position of the first log file to the last updated first log file The sum of the latest location of and the length of the first scheduled log; update the latest timestamp of the first log file to the current system time when writing the first scheduled log to the first log file is completed.
- the first update module 601 updates the latest position and latest timestamp of the first log file in the memory. Specifically, the latest position of the first log file in the memory is updated to the sum of the latest position of the first log file last updated and the length of the first predetermined log; the latest timestamp of the first log file in the memory is updated To write the first predetermined log to the current system time when the first log file is completed. In the embodiment of the present application, the first update module 601 updates the latest position and latest timestamp of the first log file in the memory, which does not affect the performance of the database.
- the communication module 602 may send the first predetermined log, the latest position of the first log file and the latest timestamp to the standby machine through the second thread; where the second thread includes any one of the following: a replication thread, dump thread, wal_send thread.
- the second thread can be woken up by the first thread.
- the first update module 601 and the communication module 602 are implemented by different threads, which improves the implementation efficiency.
- the communication module 602 is specifically configured to send the first predetermined log, the latest position of the first log file and the latest timestamp to the standby machine in the following manners, including: sending the latest position and the latest of the first log file
- the timestamp is included in the network packet header of the first predetermined log and sent to the backup machine; of course, the communication module 602 can also use other forms to send the latest position and the latest timestamp of the first log file to the backup machine.
- the specific sending form is not limited, nor is the specific sending form used to limit the protection scope of the embodiments of the present application.
- the first predetermined log generated when the transaction is submitted is written into the first log file, and the latest position and latest timestamp of the first log file are updated, and the latest position and latest timestamp of the first log file are combined with the first
- a predetermined log is sent to the standby machine, so that the standby machine obtains accurate synchronization delay and playback delay in real time during synchronization.
- the communication module 602 is further configured to: receive a log synchronization response.
- the communication module 602 may receive the log synchronized response through the third thread or the second thread; where the third thread includes any one of the following: a response reception (ACK, Acknowledge) thread and a wal_send thread.
- the communication module 602 notifies the first thread after receiving the log synchronization response through the third thread or the second thread.
- the host transaction submission ends, and the response is returned to the client through the first thread.
- the first update module 601 is further configured to: determine whether the first log file needs to be switched; when it is determined that the first log file does not need to be switched, continue to perform the step of receiving the log synchronization response.
- the first update module 601 is further configured to: when it is determined that the first log file needs to be switched, write the latest location and latest time stamp of the first log file to the first system table master_log_info , Switch the first log file, and continue to perform the step of receiving and receiving the log synchronized response.
- the first update module 601 is specifically configured to determine whether the first log file needs to be switched in the following manner: determine whether the length of the first log file is greater than or equal to the first preset threshold; when it is determined that the length of the first log file is greater than When it is equal to the first preset threshold, it is determined that the first log file needs to be switched; when it is determined that the length of the first log file is less than the first preset threshold, it is determined that the first log file does not need to be switched.
- the latest position and the latest time stamp of the first log file are written into the first system table master_log_info, that is, the latest position and the latest time stamp of the first log file are placed on the disk, so that The latest location and latest timestamp of the first log file are permanently saved, so that the latest location and latest timestamp of the first log file will not be lost due to abnormality of the database.
- the host may create the first system table master_log_info when initializing the database.
- a database master-slave replication delay monitoring device (such as a standby machine), including: a second update module 701, configured to receive the first predetermined log of the host, the first log file The latest position and latest timestamp, write the first scheduled log to the synchronization log file, update the latest position and latest timestamp of the first log file, update the latest position and latest timestamp of the synchronization log file; the third update module 702, Used to read the synchronization log file, execute the contents of the synchronization log file, update the latest position and latest timestamp of the replayed log every time a transaction is executed; the calculation module 703 is used to calculate the latest position and latest timestamp of the first log file , Sync the latest position and latest timestamp of the log file to calculate the synchronization delay, and calculate the playback delay based on the latest position and latest timestamp of the first log file, the latest position and latest timestamp of the replayed log.
- a second update module 701 configured to receive the first predetermined log of the host,
- the second update module 701 may receive the first predetermined log of the host, the latest position of the first log file and the latest timestamp through the fourth thread, and write the first predetermined log into the synchronization log file relaylog, Update the latest position and latest timestamp of the first log file, and update the latest position and latest timestamp of the synchronization log file; wherein, the fourth thread includes any one of the following: a receiving thread and an input/output (IO, Input) output thread.
- the first predetermined log includes any one of the following: a first binary log (binlog, binary log), and a first log advance (WAL, Write Ahead Log).
- the second update module 701 is specifically configured to update the latest position and latest timestamp of the first log file in the following manner: update the latest position and latest timestamp of the first log file in memory; the second The update module 701 is specifically configured to update the latest position and latest timestamp of the synchronization log file in the following manner: update the latest position and latest timestamp of the synchronization log file in memory.
- the second update module 701 is specifically configured to update the latest position and the latest timestamp of the first log file in the memory in the following manner: update the latest position of the first log file in the memory to the received first log file
- the latest location updates the latest timestamp of the first log file in memory to the latest timestamp of the received first log file.
- the second update module 701 updates the latest position and latest timestamp of the first log file and the latest position and latest timestamp of the synchronization log file in the memory, which does not affect the performance of the database.
- the latest position and the latest timestamp of the first log file are included in the network packet header of the first predetermined log, and the second update module 701 receives the first predetermined log and reads from the network packet header of the first predetermined log To obtain the latest location and latest timestamp of the first log file.
- the second update module 701 is specifically configured to update the latest position and latest timestamp of the synchronization log file in the following manner: update the latest position of the synchronization log file to the latest position of the last updated synchronization log file The sum of the length of the received first predetermined log updates the latest timestamp of the synchronization log file to the generation time of the first predetermined log recorded in the first predetermined log.
- the third update module 702 may read the synchronization log file through the fifth thread, execute the content of the synchronization log file, and update the latest position and latest timestamp of the replayed log every time a transaction is executed; where, The fifth thread wakes up the fifth thread, and the fifth thread includes any one of the following: a playback thread and a worker thread (worker thread).
- the third update module 702 is specifically configured to update the latest position of the replayed log and the latest timestamp in the following manner: update the latest position of the replayed log to the latest position of the last updated replayed log And the length of the transaction executed this time, the latest timestamp of the replayed log is updated to the generation time of the log corresponding to the transaction recorded in the log corresponding to the transaction executed this time.
- the third update module 702 is further used to: during the playback of the synchronization log file, write the second predetermined log generated when the fifth thread commits the transaction into the second log file, and determine whether it is necessary to switch the The second log file, when it is determined that the second log file needs to be switched, write the latest position and latest timestamp of the replayed log to the second system table slave_log_info, switch the second log file, and continue to read the synchronization log file; When it is determined that it is not necessary to switch the second log file, the step of reading the synchronization log file is continued.
- the third update module 702 is specifically used to implement the following method to determine whether the second log file needs to be switched: determine whether the length of the second log file is greater than or equal to the third preset threshold; when it is determined that the length of the second log file is greater than When it is equal to the third preset threshold, it is determined that the second log file needs to be switched; when it is determined that the length of the second log file is less than the third preset threshold, it is determined that the second log file does not need to be switched.
- the latest position and latest timestamp of the replayed log are written into the second system table slave_log_info, that is, the latest position and latest timestamp of the replayed log are placed on the disk, so that the The latest location and latest timestamp are permanently saved, so that the latest location and latest timestamp of the replayed log will not be lost due to database anomalies.
- the calculation module 703 continues to execute the calculation of the synchronization delay according to the latest position and the latest timestamp of the first log file, the latest position and the latest timestamp of the synchronization log file when receiving the standby machine replication delay query instruction, The step of calculating the playback delay according to the latest position and latest timestamp of the first log file, the latest position and latest timestamp of the replayed log.
- the synchronization delay includes a synchronization position delay and a synchronization time delay
- the calculation module 703 is specifically configured to implement the following method according to the latest position and latest timestamp of the first log file and the latest position and latest time of the synchronization log file
- the playback delay includes a playback position delay and a playback time delay
- the calculation module 703 is specifically configured to implement the following method according to the latest position and latest timestamp of the first log file, the latest position and latest time of the played back log Calculate the playback delay: the difference between the latest position of the first log file and the latest position of the replayed log is taken as the playback position delay, and the difference between the latest timestamp of the played back log and the latest timestamp of the first log file is taken as The playback time is delayed.
- the embodiment of the present application calculates the synchronization delay and the playback delay based on the latest position and the latest timestamp of the first log file, and accurately obtains the synchronization delay and the playback delay of the standby machine, thereby ensuring the related requirements of system operation and failover.
- the second update module 701 is further configured to: return a log synchronization response to the host.
- the second update module 701 is further used to determine whether the synchronization log file needs to be switched, and when it is determined that the synchronization log file needs to be switched, write the latest position and latest timestamp of the synchronization log file to the Two system table slave_log_info, switch the synchronization log file, and return the log synchronization response to the host; when it is determined that the synchronization log file does not need to be switched, return the log synchronization response to the host.
- the second update module 701 is specifically configured to determine whether the synchronization log file needs to be switched in the following manner: determine whether the length of the synchronization log file is greater than or equal to the second preset threshold; when it is determined that the length of the synchronization log file is greater than or equal to the second When the second preset threshold is determined, it is determined that the synchronization log file needs to be switched; when it is determined that the length of the synchronization log file is less than the second preset threshold, it is determined that the synchronization log file does not need to be switched.
- the latest position and the latest time stamp of the synchronization log file are written into the second system table slave_log_info, that is, the latest position and the latest time stamp of the synchronization log file are placed on the disk, so that the latest synchronization log file
- the location and the latest timestamp are permanently saved, so that the latest location and the latest timestamp of the synchronization log file will not be lost due to the abnormality of the database.
- the standby machine creates the second system table slave_log_info when initializing the database.
- a database master-slave replication delay monitoring device which includes a processor and a computer-readable storage medium.
- the computer-readable storage medium stores instructions, and when the instructions are executed by the processor At any time, implement any of the above-mentioned database primary and backup replication delay monitoring methods.
- Another embodiment of the present application provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the steps of any one of the above database master-slave replication delay monitoring methods are implemented.
- a database master-slave replication delay monitoring system including: a host 801, which is used to write a first predetermined log generated when a transaction is submitted to a first log file, and update the first The latest position and latest timestamp of the log file; send the first scheduled log and the latest position and latest timestamp of the first log file to the backup machine; the backup machine 802 is used to receive the first scheduled log and the first log file of the host The latest position and latest timestamp of the server, write the first scheduled log to the synchronization log file, update the latest position and latest timestamp of the first log file, update the latest position and latest timestamp of the synchronization log file; read the synchronization log file , Execute the content of the synchronization log file, update the latest position and latest timestamp of the replayed log every time a transaction is executed; calculate synchronization based on the latest position and latest timestamp of the first log file, the latest position and latest timestamp of the synchronization
- the first predetermined log generated when the transaction is submitted is written into the first log file, and the latest position and latest timestamp of the first log file are updated, and the latest position and latest timestamp of the first log file are combined with the first
- a predetermined log is sent to the standby machine, so that the standby machine obtains accurate synchronization delay and playback delay in real time during synchronization.
- the term computer storage medium includes both volatile and nonvolatile implemented in any method or technology for storing information such as computer readable instructions, data structures, program modules, or other data Sex, removable and non-removable media.
- Computer storage media include but are not limited to RAM, ROM, EEPROM, flash memory or other memory technologies, CD-ROM, digital versatile disk (DVD) or other optical disk storage, magnetic cartridges, magnetic tape, magnetic disk storage or other magnetic storage devices, or may Any other medium used to store desired information and accessible by a computer.
- the communication medium generally contains computer readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transmission mechanism, and may include any information delivery medium .
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- Computing Systems (AREA)
- Quality & Reliability (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Mathematical Physics (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
一种数据库主备复制延迟监控方法、装置和系统,所述方法包括:主机通过第一线程将提交事务时产生的第一预定日志写入第一日志文件中,更新第一日志文件的最新位置和最新时间戳(100);主机通过第一线程唤醒第二线程,通过第二线程将第一预定日志、第一日志文件的最新位置和最新时间戳发送给备机(101);主机通过第三线程或第二线程接收到日志已接收到响应,通知第一线程(102)。
Description
交叉引用
本申请引用于2018年12月28日递交的名称为“一种数据库主备复制延迟监控方法、装置和系统”的第201811619133.1号中国专利申请,其通过引用被全部并入本申请。
本申请实施例涉及但不限于数据库领域,尤指一种数据库主备复制延迟监控方法、装置和系统。
数据库在主备复制环境下由主机和备机组成,备机需要同步主机日志、回放主机日志。同步主机日志是指备机的接收线程从网络上接收主机日志并持久化到本地文件中,回放主机日志是指回放线程读取同步日志的内容并在备机上执行日志中记录的操作内容。
由于网络带宽、主备节点距离等原因,备机同步、回放日志会产生延迟。准确地统计同步延迟、回放延迟在实际应用中尤为重要。同步延迟决定了主机发生灾难后丢失数据量的多少,同步延迟越大,主机发生灾难后丢失的数据就越多。实际系统中需要实时监控同步延迟,如果发现同步延迟超过阈值后就要主动告警,执行相应措施来减少同步延迟。回放延迟关系到备机作为读设备时数据的可见性,如果回放延迟过大,用户在备机上会读取不到已经提交的事务。另外,回放延迟还关系到主机发生灾难后故障切换花费的时间。如果回放延迟过大,故障切换的时间就会很长,导致系统长时间不能对外服务。同样地,实际系统中需要实时监控回放延迟,如果发现回放延迟 超过阈值后就要主动告警,执行相应措施减少同步延迟。
业界常见的开源数据库包括MySQL、Percona、Mariadb、PostgreSQL等。这些开源数据库只统计了回放日志的时间延迟,而且该延迟是相对于备机的同步日志而不是主机的最新日志。因此,无法准确获取备机相对于主机的同步延迟、回放延迟。实际生产系统中必须做到精确地统计这些指标,保证系统运行和故障切换的相关要求。
发明内容
本申请实施例提供了一种数据库主备复制延迟监控方法、装置和系统,能够准确获得备机的同步延迟、回放延迟,从而保证系统运行和故障切换的相关要求。
本申请实施例提供了一种数据库主备复制延迟监控方法,包括:将提交事务时产生的第一预定日志写入第一日志文件中,更新第一日志文件的最新位置和最新时间戳;将第一预定日志、第一日志文件的最新位置和最新时间戳发送给备机。
本申请实施例提供了一种数据库主备复制延迟监控方法,包括:接收主机的第一预定日志、第一日志文件的最新位置和最新时间戳,将第一预定日志写入同步日志文件中,更新第一日志文件的最新位置和最新时间戳,更新同步日志文件的最新位置和最新时间戳;读取同步日志文件,执行同步日志文件的内容,每执行完一个事务更新已回放日志的最新位置和最新时间戳;根据第一日志文件的最新位置和最新时间戳、同步日志文件的最新位置和最新时间戳计算同步延迟,根据第一日志文件的最新位置和最新时间戳、已回放日志的最新位置和最新时间戳计算回放延迟。
本申请实施例提供了一种数据库主备复制延迟监控装置,包括:第一更新模块,用于将提交事务时产生的第一预定日志写入第一日志文件中,更新第一日志文件的最新位置和最新时间戳;通信模块,用于将第一预定日志、第一日志文件的最新位置和最新时间戳发送给备机。
本申请实施例提供了一种数据库主备复制延迟监控装置,包括:第二 更新模块,用于接收主机的第一预定日志、第一日志文件的最新位置和最新时间戳,将第一预定日志写入同步日志文件中,更新第一日志文件的最新位置和最新时间戳,更新同步日志文件的最新位置和最新时间戳;第三更新模块,用于读取同步日志文件,执行同步日志文件的内容,每执行完一个事务更新已回放日志的最新位置和最新时间戳;计算模块,用于根据第一日志文件的最新位置和最新时间戳、同步日志文件的最新位置和最新时间戳计算同步延迟,根据第一日志文件的最新位置和最新时间戳、已回放日志的最新位置和最新时间戳计算回放延迟。
本申请实施例提供了一种数据库主备复制延迟监控装置,包括处理器和计算机可读存储介质,所述计算机可读存储介质中存储有指令,当所述指令被所述处理器执行时,实现上述任一种数据库主备复制延迟监控方法。
本申请实施例提供了一种计算机可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现上述任一种数据库主备复制延迟监控方法的步骤。
本申请实施例提供了一种数据库主备复制延迟监控系统,包括:主机,用于将提交事务时产生的第一预定日志写入第一日志文件中,更新第一日志文件的最新位置和最新时间戳;将第一预定日志、第一日志文件的最新位置和最新时间戳发送给备机;备机,用于接收主机的第一预定日志、第一日志文件的最新位置和最新时间戳,将第一预定日志写入同步日志文件中,更新第一日志文件的最新位置和最新时间戳,更新同步日志文件的最新位置和最新时间戳;读取同步日志文件,执行同步日志文件的内容,每执行完一个事务更新已回放日志的最新位置和最新时间戳;根据第一日志文件的最新位置和最新时间戳、同步日志文件的最新位置和最新时间戳计算同步延迟,根据第一日志文件的最新位置和最新时间戳、已回放日志的最新位置和最新时间戳计算回放延迟。
本申请实施例的其它特征和优点将在随后的说明书中阐述,并且,部分地从说明书中变得显而易见,或者通过实施本申请实施例而了解。本申请实施例的目的和其他优点可通过在说明书、权利要求书以及附图中所特别指 出的结构来实现和获得。
附图用来提供对本申请实施例技术方案的进一步理解,并且构成说明书的一部分,与本申请实施例的实施例一起用于解释本申请实施例的技术方案,并不构成对本申请实施例技术方案的限制。
图1为本申请一个实施例提出的数据库主备复制延迟监控方法的流程图;
图2为本申请另一个实施例提出的数据库主备复制延迟监控方法的流程图;
图3为本申请实施例示例1的MySQL数据库主备复制延迟监控方法的流程图;
图4为本申请实施例示例2的Mariadb数据库主备复制延迟监控方法的流程图;
图5为本申请实施例示例4的PostgreSQL数据库主备复制延迟监控方法的流程图;
图6为本申请另一个实施例提出的数据库主备复制延迟监控装置的结构组成示意图;
图7为本申请另一个实施例提出的数据库主备复制延迟监控装置的结构组成示意图;
图8为本申请另一个实施例提出的数据库主备复制延迟监控系统的结构组成示意图。
下文中将结合附图对本申请实施例进行详细说明。需要说明的是,在不冲突的情况下,本申请中的实施例及实施例中的特征可以相互任意组合。
在附图的流程图示出的步骤可以在诸如一组计算机可执行指令的计算 机系统中执行。并且,虽然在流程图中示出了逻辑顺序,但是在某些情况下,可以以不同于此处的顺序执行所示出或描述的步骤。
参见图1,本申请一个实施例提出了一种数据库主备复制延迟监控方法,包括:步骤100、主机将提交事务时产生的第一预定日志写入第一日志文件中,更新第一日志文件的最新位置和最新时间戳。
在本申请实施例中,主机可以通过第一线程将提交事务时产生的第一预定日志写入第一日志文件中,更新第一日志文件的最新位置和最新时间戳;其中,第一线程包括应用线程。
在本申请实施例中,主机接收客户端请求,开启事务,执行事务,执行事务完成后提交事务,在提交事务时产生第一预定日志。
其中,主机可以通过第一线程接收客户端请求,开启事务,执行事务,执行事务完成后提交事务,在提交事务时产生第一预定日志。
在本申请实施例中,第一预定日志记录了事务具体的操作内容。例如,删除了哪张表的哪条记录、更新了哪张表的哪条记录的哪个字段、向哪张表中插入哪条记录等等。
在本申请实施例中,第一预定日志包括以下任意一个:第一二进制日志(binlog,binary log)、第一日志先行(WAL,Write Ahead Log)日志。
在本申请实施例中,更新第一日志文件的最新位置和最新时间戳包括:将第一日志文件的最新位置更新为上一次更新的第一日志文件的最新位置和第一预定日志的长度之和;将第一日志文件的最新时间戳更新为将第一预定日志写入第一日志文件完成时的当前系统时间。
在本申请实施例中,在内存中更新所述第一日志文件的最新位置和最新时间戳。具体的,将内存中的第一日志文件的最新位置更新为上一次更新的第一日志文件的最新位置和第一预定日志的长度之和;将内存中的第一日志文件的最新时间戳更新为将第一预定日志写入第一日志文件完成时的当前系统时间。本申请实施例在内存中更新所述第一日志文件的最新位置和最新时间戳,不会影响数据库的性能。
其中,第一次更新第一日志文件的最新位置时,上一次更新的第一日志文件的最新位置为0。
步骤101、主机将第一预定日志、第一日志文件的最新位置和最新时间戳发送给备机。
在本申请实施例中,主机可以通过第二线程将第一预定日志、第一日志文件的最新位置和最新时间戳发送给备机;其中,第二线程包括以下任意一个:复制线程、dump线程、wal_send线程。
其中,第二线程可以由第一线程唤醒。
本申请实施例中,步骤100和步骤101由不同的线程来实现,提高了实现效率。
在本申请实施例中,在将第一预定日志、第一日志文件的最新位置和最新时间戳发送给备机时,可以将第一日志文件的最新位置和最新时间戳包括在第一预定日志的网络包头部中发送给备机;当然,也可以采用其他的形式将第一日志文件的最新位置和最新时间戳发送给备机,本申请实施对具体的发送形式不作限定,具体的发送形式也不用于限定本申请实施例的保护范围。
本申请实施例将提交事务时产生的第一预定日志写入第一日志文件中,并更新第一日志文件的最新位置和最新时间戳,将第一日志文件的最新位置和最新时间戳连同第一预定日志发送给备机,使得备机在同步时实时获得准确的同步延迟和回放延迟。
在本申请另一个实施例中,该方法还包括:步骤102、主机接收日志已同步响应。
在本申请实施例中,主机可以通过第三线程或第二线程接收日志已同步响应;其中,第三线程包括以下任意一个:响应接收(ACK,Acknowledge)线程、wal_send线程。
在本申请实施例中,主机通过第三线程或第二线程接收日志已同步响应后,通知第一线程。
在本申请实施例中,第一线程接收日志已同步响应时,主机事务提交结束,通过第一线程向客户端返回响应。
在本申请另一个实施例中,接收日志已同步响应之前,该方法还包括:判断是否需要切换第一日志文件;当判断出不需要切换第一日志文件时,继续执行接收日志已同步响应的步骤。
在本申请另一个实施例中,当判断出需要切换第一日志文件时,继续执行接收日志已同步响应的步骤之前,该方法还包括:将所述第一日志文件的最新位置和最新时间戳写入第一系统表master_log_info中,切换所述第一日志文件。本申请实施例在切换第一日志文件时将所述第一日志文件的最新位置和最新时间戳写入第一系统表master_log_info中,即将第一日志文件的最新位置和最新时间戳落盘,使得第一日志文件的最新位置和最新时间戳得到永久性保存,从而第一日志文件的最新位置和最新时间戳不会因为数据库的异常而丢失。
其中,判断是否需要切换第一日志文件包括:判断第一日志文件的长度是否大于或等于第一预设阈值;当判断出第一日志文件的长度大于或等于第一预设阈值时,确定需要切换第一日志文件;当判断出第一日志文件的长度小于第一预设阈值时,确定不需要切换第一日志文件。
本申请实施例在切换第一日志文件时将所述第一日志文件的最新位置和最新时间戳写入第一系统表master_log_info中,即将第一日志文件的最新位置和最新时间戳落盘,使得第一日志文件的最新位置和最新时间戳得到永久性保存,从而第一日志文件的最新位置和最新时间戳不会因为数据库的异常而丢失。
在本申请实施例中,主机可以在初始化数据库时创建第一系统表master_log_info。
参见图2,本申请一个实施例提出了一种数据库主备复制延迟监控方法,包括:步骤200、备机接收主机的第一预定日志、第一日志文件的最新位置和最新时间戳,将第一预定日志写入同步日志文件relaylog中,更新第一日志文件的最新位置和最新时间戳,更新同步日志文件的最新位置和最新时间戳。
在本申请实施例中,备机可以通过第四线程接收主机的第一预定日志、第一日志文件的最新位置和最新时间戳,将第一预定日志写入同步日志文件relaylog中,更新第一日志文件的最新位置和最新时间戳,更新同步日志文件的最新位置和最新时间戳;其中,第四线程包括以下任意一个:接收线程、输入输出(IO,Input Output)线程。
在本申请实施例中,第一预定日志包括以下任意一个:第一二进制日志(binlog,binary log)、第一日志先行(WAL,Write Ahead Log)日志。
在本申请实施例中,更新第一日志文件的最新位置和最新时间戳包括:在内存中更新第一日志文件的最新位置和最新时间戳;更新同步日志文件的最新位置和最新时间戳包括:在内存中更新同步日志文件的最新位置和最新时间戳。
其中,在内存中更新第一日志文件的最新位置和最新时间戳包括:将内存中的第一日志文件的最新位置更新为接收的第一日志文件的最新位置,将内存中的第一日志文件的最新时间戳更新为接收的第一日志文件的最新时间戳。
本申请实施例在内存中更新第一日志文件的最新位置和最新时间戳、同步日志文件的最新位置和最新时间戳,不会影响数据库的性能。
在本申请实施例中,第一日志文件的最新位置和最新时间戳包括在第一预定日志的网络包头部中,接收第一预定日志,从第一预定日志的网络包头部中获取第一日志文件的最新位置和最新时间戳。
在本申请实施例中,更新同步日志文件的最新位置和最新时间戳包括:将同步日志文件的最新位置更新为上一次更新的同步日志文件的最新位置和接收的第一预定日志的长度之和,将同步日志文件的最新时间戳更新为第一预定日志中记录的第一预定日志的生成时间。
其中,第一次更新同步日志文件的最新位置时,上一次更新的同步日志文件的最新位置为0。
步骤201、备机读取同步日志文件,执行同步日志文件的内容,每执行 完一个事务更新已回放日志的最新位置和最新时间戳。
在本申请实施例中,备机可以通过第五线程读取同步日志文件,执行同步日志文件的内容,每执行完一个事务更新已回放日志的最新位置和最新时间戳;其中,备机可以通过第四线程唤醒第五线程,第五线程包括以下任意一个:回放线程、工作线程(worker线程)。
在本申请实施例中,更新已回放日志的最新位置和最新时间戳包括:将已回放日志的最新位置更新为上一次更新的已回放日志的最新位置和本次执行的事务的长度之和,将已回放日志的最新时间戳更新为本次执行的事务对应的日志中记录的该事务对应的日志的生成时间。
在本申请实施例中,备机回放同步日志文件的过程中,将第五线程提交事务时产生的第二预定日志写入第二日志文件中,判断是否需要切换第二日志文件,当判断出需要切换第二日志文件时,将已回放日志的最新位置和最新时间戳写入第二系统表slave_log_info,切换第二日志文件,继续读取同步日志文件的步骤;当判断出不需要切换第二日志文件时,继续读取同步日志文件的步骤。
其中,判断是否需要切换第二日志文件包括:判断第二日志文件的长度是否大于或等于第三预设阈值;当判断出第二日志文件的长度大于或等于第三预设阈值时,确定需要切换第二日志文件;当判断出第二日志文件的长度小于第三预设阈值时,确定不需要切换第二日志文件。
本申请实施例在切换第二日志文件时将已回放日志的最新位置和最新时间戳写入第二系统表slave_log_info中,即将已回放日志的最新位置和最新时间戳落盘,使得已回放日志的最新位置和最新时间戳得到永久性保存,从而已回放日志的最新位置和最新时间戳不会因为数据库的异常而丢失。
步骤202、备机根据第一日志文件的最新位置和最新时间戳、同步日志文件的最新位置和最新时间戳计算同步延迟,根据第一日志文件的最新位置和最新时间戳、已回放日志的最新位置和最新时间戳计算回放延迟。
在本申请实施例中,备机接收备机复制延迟查询指令时,继续执行所 述根据第一日志文件的最新位置和最新时间戳、同步日志文件的最新位置和最新时间戳计算同步延迟,根据第一日志文件的最新位置和最新时间戳、已回放日志的最新位置和最新时间戳计算回放延迟的步骤。
在本申请实施例中,同步延迟包括同步位置延迟和同步时间延迟,根据第一日志文件的最新位置和最新时间戳、同步日志文件的最新位置和最新时间戳计算同步延迟包括:将第一日志文件的最新位置和同步日志文件的最新位置之差作为所述同步位置延迟,将同步日志文件的最新时间戳和第一日志文件的最新时间戳之差作为所述同步时间延迟。
在本申请实施例中,回放延迟包括回放位置延迟和回放时间延迟,根据第一日志文件的最新位置和最新时间戳、已回放日志的最新位置和最新时间戳计算回放延迟包括:将第一日志文件的最新位置和已回放日志的最新位置之差作为所述回放位置延迟,将已回放日志的最新时间戳和第一日志文件的最新时间戳之差作为所述回放时间延迟。
本申请实施例基于第一日志文件的最新位置和最新时间戳计算同步延迟和回放延迟,准确的获得了备机的同步延迟、回放延迟,从而保证了系统运行和故障切换的相关要求。
在本申请另一个实施例中,将第一预定日志写入同步日志文件中后,该方法还包括:向主机返回日志已同步响应。
在本申请另一个实施例中,将第一预定日志写入同步日志文件中后,该方法还包括:判断是否需要切换同步日志文件,当判断出需要切换同步日志文件时,将同步日志文件的最新位置和最新时间戳写入第二系统表slave_log_info,切换同步日志文件,向主机返回日志已同步响应;当判断出不需要切换同步日志文件时,向主机返回日志已同步响应。
其中,判断是否需要切换同步日志文件包括:判断同步日志文件的长度是否大于或等于第二预设阈值;当判断出同步日志文件的长度大于或等于第二预设阈值时,确定需要切换同步日志文件;当判断出同步日志文件的长度小于第二预设阈值时,确定不需要切换同步日志文件。
本申请实施例在切换同步日志文件时将同步日志文件的最新位置和最新时间戳写入第二系统表slave_log_info中,即将同步日志文件的最新位置和最新时间戳落盘,使得同步日志文件的最新位置和最新时间戳得到永久性保存,从而同步日志文件的最新位置和最新时间戳不会因为数据库的异常而丢失。
在本申请实施例中,备机在初始化数据库时创建第二系统表slave_log_info。
下面通过几个示例说明本申请实施例的方法的具体实现过程,所列举的例子仅仅是为了说明本申请实施例的方法的具体实现过程,不用于限定本申请实施例的保护范围。
示例1
本示例介绍MySQL数据库主备复制延迟监控方法,参见图3,该方法包括以下步骤。
(1)主机的应用线程初始化数据库,创建第一系统表master_log_info。
(2)主机的应用线程接收客户端请求。
(3)主机的应用线程开启一个新事务。
(4)主机的应用线程执行上述新事务。
(5)主机的应用线程提交上述新事务,产生第一binlog。
(6)主机的应用线程将新事务产生的第一binlog写入第一日志文件中,即第一binlog落盘。
(7)主机的应用线程更新第一日志文件的最新位置和最新时间戳。
(8)主机的应用线程唤醒dump线程,主机的复制线程向备机发送第一binlog,第一binlog的网络包头部包括第一日志文件的最新位置和最新时间戳。
(9)主机的应用线程判断是否需要切换第一日志文件,当需要切换第一日志文件时,将第一日志文件的最新位置和最新时间戳写入第一系统表 master_log_info中,切换所述第一日志文件,继续执行步骤(10);当不需要切换第一日志文件时,继续执行步骤(10)。
(10)主机的应用线程等待备机收到日志的响应。
(11)备机的IO线程从网络上获取主机的第一binlog,第一binlog的网络包头部包括第一日志文件的最新位置和最新时间戳。
(12)备机的IO线程获取并更新第一日志文件的最新位置和最新时间戳,获取第一binlog,将第一binlog写入同步日志文件relaylog中,更新同步日志文件的最新位置和最新时间戳。
(13)备机的IO线程判断是否需要切换同步日志文件,当判断出需要切换同步日志文件时,将同步日志文件的最新位置和最新时间戳写入第二系统表slave_log_info,切换同步日志文件,继续执行步骤(14);当判断出不需要切换同步日志文件时,继续执行步骤(14)。
(14)备机的IO线程向主机的ACK线程返回日志已同步响应。
(15)主机的ACK线程通知应用线程。
(16)主机新事务提交结束,向客户端返回响应。
(17)备机的IO线程唤醒worker线程回放同步日志文件relaylog。
(18)备机的worker线程从同步日志文件中读取一个新事务,执行新事务,回放完毕主机上的新事务,将新事务产生的第二binlog写入第二日志文件中,即第二binlog落盘。
(19)备机的worker线程更新已回放日志的最新位置和最新时间戳。
(20)备机的worker线程判断是否需要切换第二日志文件,当判断出需要切换第二日志文件时,将已回放日志的最新位置和最新时间戳写入第二系统表slave_log_info,切换第二日志文件,继续读取同步日志文件的步骤;当判断出不需要切换第二日志文件时,继续读取同步日志文件的步骤。
(21)登录备机查询同步日志的位置延迟和时间延迟、回放日志的位置延迟和时间延迟。
(22)主机的应用线程去等待下一个客户端请求。
(23)备机的IO线程去等待下一个binlog网络包。
(24)备机的worker线程去回放relaylog的下一个事务。
示例2
本示例介绍Mariadb数据库主备复制延迟监控方法,Mariadb数据库主备复制延迟监控方法和MySQL数据库主备复制延迟监控方法一致,只是日志格式和第二线程的实现方式有所区别,参见图4,该方法包括以下步骤。
(1)主机的应用线程初始化数据库,创建第一系统表master_log_info。
(2)主机的应用线程接收客户端请求。
(3)主机的应用线程开启一个新事务。
(4)主机的应用线程执行上述新事务。
(5)主机的应用线程提交上述新事务,产生第一binlog。
(6)主机的应用线程将新事务产生的第一binlog写入第一日志文件中,即第一binlog落盘。
(7)主机的应用线程更新第一日志文件的最新位置和最新时间戳。
(8)主机的应用线程唤醒dump线程,主机的dump线程向备机发送第一binlog,第一binlog的网络包头部包括第一日志文件的最新位置和最新时间戳。
(9)主机的应用线程判断是否需要切换第一日志文件,当需要切换第一日志文件时,将第一日志文件的最新位置和最新时间戳写入第一系统表master_log_info中,切换所述第一日志文件,继续执行步骤(10);当不需要切换第一日志文件时,继续执行步骤(10)。
(10)主机的应用线程等待备机收到日志的响应。
(11)备机的IO线程从网络上获取主机的第一binlog,第一binlog的网络包头部包括第一日志文件的最新位置和最新时间戳。
(12)备机的IO线程获取并更新第一日志文件的最新位置和最新时间戳,获取第一binlog,将第一binlog写入同步日志文件relaylog中,更新同步日志文件的最新位置和最新时间戳。
(13)备机的IO线程判断是否需要切换同步日志文件,当判断出需要切换同步日志文件时,将同步日志文件的最新位置和最新时间戳写入第二系统表slave_log_info,切换同步日志文件,继续执行步骤(14);当判断出不需要切换同步日志文件时,继续执行步骤(14)。
(14)备机的IO线程向主机的dump线程返回日志已同步响应。
(15)主机的dump线程通知应用线程。
(16)主机新事务提交结束,向客户端返回响应。
(17)备机的IO线程唤醒第五线程(即worker线程)回放同步日志文件relaylog。
(18)备机的worker线程从同步日志文件中读取一个新事务,执行新事务,回放完毕主机上的新事务,将新事务产生的第二binlog写入第二日志文件中,即第二binlog落盘。
(19)备机的worker线程更新已回放日志的最新位置和最新时间戳。
(20)备机的worker线程判断是否需要切换第二日志文件,当判断出需要切换第二日志文件时,将已回放日志的最新位置和最新时间戳写入第二系统表slave_log_info,切换第二日志文件,继续读取同步日志文件的步骤;当判断出不需要切换第二日志文件时,继续读取同步日志文件的步骤。
(21)登录备机查询同步日志的位置延迟和时间延迟、回放日志的位置延迟和时间延迟。
(22)主机的应用线程去等待下一个客户端请求。
(23)备机的IO线程去等待下一个binlog网络包。
(24)备机的worker线程去回放relaylog的下一个事务。
示例3
本示例介绍Percona数据库主备复制延迟监控方法,Percona数据库主备复制延迟监控方法与MySQL数据库主备复制延迟监控方法的流程完全一致,这里不再赘述。
示例4
本示例介绍PostgreSQL数据库主备复制延迟监控方法,PostgreSQL没有binlog日志,只有日志先行(WAL,Write Ahead Log)日志,另外PostgreSQL的复制线程、接收线程、回放线程的名称与MySQL都不一样,参见图5,该方法包括以下步骤。
(1)主机的应用线程初始化数据库,创建第一系统表master_log_info。
(2)主机的应用线程接收客户端请求。
(3)主机的应用线程开启一个新事务。
(4)主机的应用线程执行上述新事务。
(5)主机的应用线程提交上述新事务,产生第一WAL日志。
(6)主机的应用线程将新事务产生的第一WAL日志写入第一日志文件中,即第一WAL日志落盘。
(7)主机的应用线程更新第一日志文件的最新位置和最新时间戳。
(8)主机的应用线程唤醒wal_send线程,主机的wal_send线程向备机发送第一WAL日志,第一WAL日志的网络包头部包括第一日志文件的最新位置和最新时间戳。
(9)主机的应用线程判断是否需要切换第一日志文件,当需要切换第一日志文件时,将第一日志文件的最新位置和最新时间戳写入第一系统表master_log_info中,切换所述第一日志文件,继续执行步骤(10);当不需要切换第一日志文件时,继续执行步骤(10)。
(10)主机的应用线程等待备机收到日志的响应。
(11)备机的IO线程从网络上获取主机的第一WAL日志,第一WAL日志的网络包头部包括第一日志文件的最新位置和最新时间戳。
(12)备机的IO线程获取并更新第一日志文件的最新位置和最新时间戳,获取第一WAL日志,将第一WAL日志写入同步日志文件WAL日志中,更新同步日志文件的最新位置和最新时间戳。
(13)备机的IO线程判断是否需要切换同步日志文件,当判断出需要切换同步日志文件时,将同步日志文件的最新位置和最新时间戳写入第二系统表slave_log_info,切换同步日志文件,继续执行步骤(14);当判断出不需要切换同步日志文件时,继续执行步骤(14)。
(14)备机的IO线程向主机的wal_send线程返回日志已同步响应。
(15)主机的wal_send线程通知应用线程。
(16)主机新事务提交结束,向客户端返回响应。
(17)备机的IO线程唤醒worker线程回放同步日志文件relaylog。
(18)备机的worker线程从同步日志文件中读取一个新事务,执行新事务,回放完毕主机上的新事务,将新事务产生的第二WAL日志写入第二日志文件中,即第二WAL日志落盘。
(19)备机的worker线程更新已回放日志的最新位置和最新时间戳。
(20)备机的worker线程判断是否需要切换第二日志文件,当判断出需要切换第二日志文件时,将已回放日志的最新位置和最新时间戳写入第二系统表slave_log_info,切换第二日志文件,继续读取同步日志文件的步骤;当判断出不需要切换第二日志文件时,继续读取同步日志文件的步骤。
(21)登录备机查询同步日志的位置延迟和时间延迟、回放日志的位置延迟和时间延迟。
(22)主机的应用线程去等待下一个客户端请求。
(23)备机的IO线程去等待下一个WAL日志网络包。
(24)备机的worker线程去回放relaylog的下一个事务。
参见图6,本申请另一个实施例提出了一种数据库主备复制延迟监控装置(如主机),包括:第一更新模块601,用于将提交事务时产生的第一预定 日志写入第一日志文件中,更新第一日志文件的最新位置和最新时间戳;通信模块602,用于将第一预定日志、第一日志文件的最新位置和最新时间戳发送给备机。
在本申请实施例中,第一更新模块601可以通过第一线程将提交事务时产生的第一预定日志写入第一日志文件中,更新第一日志文件的最新位置和最新时间戳;其中,第一线程包括应用线程。
在本申请实施例中,第一更新模块601接收客户端请求,开启事务,执行事务,执行事务完成后提交事务,在提交事务时产生第一预定日志。
其中,第一更新模块601可以通过第一线程接收客户端请求,开启事务,执行事务,执行事务完成后提交事务,在提交事务时产生第一预定日志。
在本申请实施例中,第一预定日志记录了事务具体的操作内容。例如,删除了哪张表的哪条记录、更新了哪张表的哪条记录的哪个字段、向哪张表中插入哪条记录等等。
在本申请实施例中,第一预定日志包括以下任意一个:第一二进制日志(binlog,binary log)、第一日志先行(WAL,Write Ahead Log)日志。
在本申请实施例中,第一更新模块601具体用于采用以下方式实现更新第一日志文件的最新位置和最新时间戳:将第一日志文件的最新位置更新为上一次更新的第一日志文件的最新位置和第一预定日志的长度之和;将第一日志文件的最新时间戳更新为将第一预定日志写入第一日志文件完成时的当前系统时间。
在本申请实施例中,第一更新模块601在内存中更新所述第一日志文件的最新位置和最新时间戳。具体的,将内存中的第一日志文件的最新位置更新为上一次更新的第一日志文件的最新位置和第一预定日志的长度之和;将内存中的第一日志文件的最新时间戳更新为将第一预定日志写入第一日志文件完成时的当前系统时间。本申请实施例第一更新模块601在内存中更新所述第一日志文件的最新位置和最新时间戳,不会影响数据库的性能。
其中,第一次更新第一日志文件的最新位置时,上一次更新的第一日 志文件的最新位置为0。
在本申请实施例中,通信模块602可以通过第二线程将第一预定日志、第一日志文件的最新位置和最新时间戳发送给备机;其中,第二线程包括以下任意一个:复制线程、dump线程、wal_send线程。
其中,第二线程可以由第一线程唤醒。
本申请实施例中,第一更新模块601和通信模块602通过不同的线程来实现,提高了实现效率。
在本申请实施例中,通信模块602具体用于采用以下方式实现将第一预定日志、第一日志文件的最新位置和最新时间戳发送给备机包括:将第一日志文件的最新位置和最新时间戳包括在第一预定日志的网络包头部中发送给备机;当然,通信模块602也可以采用其他的形式将第一日志文件的最新位置和最新时间戳发送给备机,本申请实施对具体的发送形式不作限定,具体的发送形式也不用于限定本申请实施例的保护范围。
本申请实施例将提交事务时产生的第一预定日志写入第一日志文件中,并更新第一日志文件的最新位置和最新时间戳,将第一日志文件的最新位置和最新时间戳连同第一预定日志发送给备机,使得备机在同步时实时获得准确的同步延迟和回放延迟。
在本申请另一个实施例中,通信模块602还用于:接收日志已同步响应。
在本申请实施例中,通信模块602可以通过第三线程或第二线程接收日志已同步响应;其中,第三线程包括以下任意一个:响应接收(ACK,Acknowledge)线程、wal_send线程。
在本申请实施例中,通信模块602通过第三线程或第二线程接收日志已同步响应后,通知第一线程。
在本申请实施例中,第一线程接收日志已同步响应时,主机事务提交结束,通过第一线程向客户端返回响应。
在本申请另一个实施例中,第一更新模块601还用于:判断是否需要 切换第一日志文件;当判断出不需要切换第一日志文件时,继续执行接接收日志已同步响应的步骤。
在本申请另一个实施例中,第一更新模块601还用于:当判断出需要切换第一日志文件时,将所述第一日志文件的最新位置和最新时间戳写入第一系统表master_log_info中,切换所述第一日志文件,继续执行接接收日志已同步响应的步骤。
其中,第一更新模块601具体用于采用以下方式实现判断是否需要切换第一日志文件:判断第一日志文件的长度是否大于或等于第一预设阈值;当判断出第一日志文件的长度大于或等于第一预设阈值时,确定需要切换第一日志文件;当判断出第一日志文件的长度小于第一预设阈值时,确定不需要切换第一日志文件。
本申请实施例在切换第一日志文件时将所述第一日志文件的最新位置和最新时间戳写入第一系统表master_log_info中,即将第一日志文件的最新位置和最新时间戳落盘,使得第一日志文件的最新位置和最新时间戳得到永久性保存,从而第一日志文件的最新位置和最新时间戳不会因为数据库的异常而丢失。
在本申请实施例中,主机可以在初始化数据库时创建第一系统表master_log_info。
参见图7,本申请另一个实施例提出了一种数据库主备复制延迟监控装置(如备机),包括:第二更新模块701,用于接收主机的第一预定日志、第一日志文件的最新位置和最新时间戳,将第一预定日志写入同步日志文件中,更新第一日志文件的最新位置和最新时间戳,更新同步日志文件的最新位置和最新时间戳;第三更新模块702,用于读取同步日志文件,执行同步日志文件的内容,每执行完一个事务更新已回放日志的最新位置和最新时间戳;计算模块703,用于根据第一日志文件的最新位置和最新时间戳、同步日志文件的最新位置和最新时间戳计算同步延迟,根据第一日志文件的最新位置和最新时间戳、已回放日志的最新位置和最新时间戳计算回放延迟。
在本申请实施例中,第二更新模块701可以通过第四线程接收主机的 第一预定日志、第一日志文件的最新位置和最新时间戳,将第一预定日志写入同步日志文件relaylog中,更新第一日志文件的最新位置和最新时间戳,更新同步日志文件的最新位置和最新时间戳;其中,第四线程包括以下任意一个:接收线程、输入输出(IO,Input Output)线程。
在本申请实施例中,第一预定日志包括以下任意一个:第一二进制日志(binlog,binary log)、第一日志先行(WAL,Write Ahead Log)。
在本申请实施例中,第二更新模块701具体用于采用以下方式实现更新第一日志文件的最新位置和最新时间戳:在内存中更新第一日志文件的最新位置和最新时间戳;第二更新模块701具体用于采用以下方式实现更新同步日志文件的最新位置和最新时间戳:在内存中更新同步日志文件的最新位置和最新时间戳。
其中,第二更新模块701具体用于采用以下方式实现在内存中更新第一日志文件的最新位置和最新时间戳:将内存中的第一日志文件的最新位置更新为接收的第一日志文件的最新位置,将内存中的第一日志文件的最新时间戳更新为接收的第一日志文件的最新时间戳。
本申请实施例第二更新模块701在内存中更新第一日志文件的最新位置和最新时间戳、同步日志文件的最新位置和最新时间戳,不会影响数据库的性能。
在本申请实施例中,第一日志文件的最新位置和最新时间戳包括在第一预定日志的网络包头部中,第二更新模块701接收第一预定日志,从第一预定日志的网络包头部中获取第一日志文件的最新位置和最新时间戳。
在本申请实施例中,第二更新模块701具体用于采用以下方式实现更新同步日志文件的最新位置和最新时间戳:将同步日志文件的最新位置更新为上一次更新的同步日志文件的最新位置和接收的第一预定日志的长度之和,将同步日志文件的最新时间戳更新为第一预定日志中记录的第一预定日志的生成时间。
其中,第一次更新同步日志文件的最新位置时,上一次更新的同步日 志文件的最新位置为0。
在本申请实施例中,第三更新模块702可以通过第五线程读取同步日志文件,执行同步日志文件的内容,每执行完一个事务更新已回放日志的最新位置和最新时间戳;其中,可以通过第四线程唤醒第五线程,第五线程包括以下任意一个:回放线程、工作线程(worker线程)。
在本申请实施例中,第三更新模块702具体用于采用以下方式实现更新已回放日志的最新位置和最新时间戳:将已回放日志的最新位置更新为上一次更新的已回放日志的最新位置和本次执行的事务的长度之和,将已回放日志的最新时间戳更新为本次执行的事务对应的日志中记录的该事务对应的日志的生成时间。
在本申请实施例中,第三更新模块702还用于:回放同步日志文件的过程中,将第五线程提交事务时产生的第二预定日志写入第二日志文件中,判断是否需要切换第二日志文件,当判断出需要切换第二日志文件时,将已回放日志的最新位置和最新时间戳写入第二系统表slave_log_info,切换第二日志文件,继续读取同步日志文件的步骤;当判断出不需要切换第二日志文件时,继续读取同步日志文件的步骤。
其中,第三更新模块702具体用于采用以下方式实现判断是否需要切换第二日志文件:判断第二日志文件的长度是否大于或等于第三预设阈值;当判断出第二日志文件的长度大于或等于第三预设阈值时,确定需要切换第二日志文件;当判断出第二日志文件的长度小于第三预设阈值时,确定不需要切换第二日志文件。
本申请实施例在切换第二日志文件时将已回放日志的最新位置和最新时间戳写入第二系统表slave_log_info中,即将已回放日志的最新位置和最新时间戳落盘,使得已回放日志的最新位置和最新时间戳得到永久性保存,从而已回放日志的最新位置和最新时间戳不会因为数据库的异常而丢失。
在本申请实施例中,计算模块703接收备机复制延迟查询指令时,继续执行所述根据第一日志文件的最新位置和最新时间戳、同步日志文件的最新位置和最新时间戳计算同步延迟,根据第一日志文件的最新位置和最新时 间戳、已回放日志的最新位置和最新时间戳计算回放延迟的步骤。
在本申请实施例中,同步延迟包括同步位置延迟和同步时间延迟,计算模块703具体用于采用以下方式实现根据第一日志文件的最新位置和最新时间戳、同步日志文件的最新位置和最新时间戳计算同步延迟:将第一日志文件的最新位置和同步日志文件的最新位置之差作为所述同步位置延迟,将同步日志文件的最新时间戳和第一日志文件的最新时间戳之差作为所述同步时间延迟。
在本申请实施例中,回放延迟包括回放位置延迟和回放时间延迟,计算模块703具体用于采用以下方式实现根据第一日志文件的最新位置和最新时间戳、已回放日志的最新位置和最新时间戳计算回放延迟:将第一日志文件的最新位置和已回放日志的最新位置之差作为所述回放位置延迟,将已回放日志的最新时间戳和第一日志文件的最新时间戳之差作为所述回放时间延迟。
本申请实施例基于第一日志文件的最新位置和最新时间戳计算同步延迟和回放延迟,准确的获得了备机的同步延迟、回放延迟,从而保证了系统运行和故障切换的相关要求。
在本申请另一个实施例中,第二更新模块701还用于:向主机返回日志已同步响应。
在本申请另一个实施例中,第二更新模块701还用于:判断是否需要切换同步日志文件,当判断出需要切换同步日志文件时,将同步日志文件的最新位置和最新时间戳写入第二系统表slave_log_info,切换同步日志文件,向主机返回日志已同步响应;当判断出不需要切换同步日志文件时,向主机返回日志已同步响应。
其中,第二更新模块701具体用于采用以下方式实现判断是否需要切换同步日志文件:判断同步日志文件的长度是否大于或等于第二预设阈值;当判断出同步日志文件的长度大于或等于第二预设阈值时,确定需要切换同步日志文件;当判断出同步日志文件的长度小于第二预设阈值时,确定不需要切换同步日志文件。
本申请实施例在切换同步日志文件时将同步日志文件的最新位置和最新时间戳写入第二系统表slave_log_info中,即将同步日志文件的最新位置和最新时间戳落盘,使得同步日志文件的最新位置和最新时间戳得到永久性保存,从而同步日志文件的最新位置和最新时间戳不会因为数据库的异常而丢失。
在本申请实施例中,备机在初始化数据库时创建第二系统表slave_log_info。
本申请另一个实施例提出了一种数据库主备复制延迟监控装置,包括处理器和计算机可读存储介质,所述计算机可读存储介质中存储有指令,当所述指令被所述处理器执行时,实现上述任一种数据库主备复制延迟监控方法。
本申请另一个实施例提出了一种计算机可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现上述任一种数据库主备复制延迟监控方法的步骤。
参见图8,本申请另一个实施例提出了一种数据库主备复制延迟监控系统,包括:主机801,用于将提交事务时产生的第一预定日志写入第一日志文件中,更新第一日志文件的最新位置和最新时间戳;将第一预定日志、第一日志文件的最新位置和最新时间戳发送给备机;备机802,用于接收主机的第一预定日志、第一日志文件的最新位置和最新时间戳,将第一预定日志写入同步日志文件中,更新第一日志文件的最新位置和最新时间戳,更新同步日志文件的最新位置和最新时间戳;读取同步日志文件,执行同步日志文件的内容,每执行完一个事务更新已回放日志的最新位置和最新时间戳;根据第一日志文件的最新位置和最新时间戳、同步日志文件的最新位置和最新时间戳计算同步延迟,根据第一日志文件的最新位置和最新时间戳、已回放日志的最新位置和最新时间戳计算回放延迟。本申请实施例将提交事务时产生的第一预定日志写入第一日志文件中,并更新第一日志文件的最新位置和最新时间戳,将第一日志文件的最新位置和最新时间戳连同第一预定日志发送给备机,使得备机在同步时实时获得准确的同步延迟和回放延迟。
上述主机801和备机802的具体实现过程与前述实施例相同,这里不再赘述。
本领域普通技术人员可以理解,上文中所公开方法中的全部或某些步骤、系统、装置中的功能模块/单元可以被实施为软件、固件、硬件及其适当的组合。在硬件实施方式中,在以上描述中提及的功能模块/单元之间的划分不一定对应于物理组件的划分;例如,一个物理组件可以具有多个功能,或者一个功能或步骤可以由若干物理组件合作执行。某些组件或所有组件可以被实施为由处理器,如数字信号处理器或微处理器执行的软件,或者被实施为硬件,或者被实施为集成电路,如专用集成电路。这样的软件可以分布在计算机可读介质上,计算机可读介质可以包括计算机存储介质(或非暂时性介质)和通信介质(或暂时性介质)。如本领域普通技术人员公知的,术语计算机存储介质包括在用于存储信息(诸如计算机可读指令、数据结构、程序模块或其他数据)的任何方法或技术中实施的易失性和非易失性、可移除和不可移除介质。计算机存储介质包括但不限于RAM、ROM、EEPROM、闪存或其他存储器技术、CD-ROM、数字多功能盘(DVD)或其他光盘存储、磁盒、磁带、磁盘存储或其他磁存储装置、或者可以用于存储期望的信息并且可以被计算机访问的任何其他的介质。此外,本领域普通技术人员公知的是,通信介质通常包含计算机可读指令、数据结构、程序模块或者诸如载波或其他传输机制之类的调制数据信号中的其他数据,并且可包括任何信息递送介质。
虽然本申请实施例所揭露的实施方式如上,但所述的内容仅为便于理解本申请实施例而采用的实施方式,并非用以限定本申请实施例。任何本申请实施例所属领域内的技术人员,在不脱离本申请实施例所揭露的精神和范围的前提下,可以在实施的形式及细节上进行任何的修改与变化,但本申请实施例的专利保护范围,仍须以所附的权利要求书所界定的范围为准。
Claims (27)
- 一种数据库主备复制延迟监控方法,包括:将提交事务时产生的第一预定日志写入第一日志文件中,更新第一日志文件的最新位置和最新时间戳;将第一预定日志、第一日志文件的最新位置和最新时间戳发送给备机。
- 根据权利要求1所述的数据库主备复制延迟监控方法,其特征在于,该方法还包括:接收日志已同步响应。
- 根据权利要求2所述的数据库主备复制延迟监控方法,其特征在于,所述接收日志已同步响应之前,该方法还包括:判断是否需要切换第一日志文件;当判断出不需要切换第一日志文件时,继续执行所述接收日志已同步响应的步骤。
- 根据权利要求3所述的数据库主备复制延迟监控方法,其特征在于,当判断出需要切换第一日志文件时,继续执行所述接收日志已同步响应的步骤之前,该方法还包括:将所述第一日志文件的最新位置和最新时间戳写入第一系统表中,切换所述第一日志文件。
- 根据权利要求4所述的数据库主备复制延迟监控方法,其特征在于,所述将提交事务时产生的第一预定日志写入第一日志文件中之前,该方法还包括:在初始化数据库时创建所述第一系统表。
- 根据权利要求1~5任一项所述的数据库主备复制延迟监控方法,其特征在于,其中,所述更新第一日志文件的最新位置和最新时间戳包括:将所述第一日志文件的最新位置更新为上一次更新的第一日志文件的最新位置和所述第一预定日志的长度之和;将所述第一日志文件的最新时间戳更新为将所述第一预定日志写入所述第一日志文件完成时的当前系统时间。
- 根据权利要求1~5任一项所述的数据库主备复制延迟监控方法,其特征在于,其中,所述更新第一日志文件的最新位置和最新时间戳包括:在内存中更新所述第一日志文件的最新位置和最新时间戳。
- 根据权利要求1~5任一项所述的数据库主备复制延迟监控方法,其特征在于,其中,所述将第一预定日志、第一日志文件的最新位置和最新时间戳发送给备机包括:将所述第一日志文件的最新位置和最新时间戳包括在所述第一预定日志的网络包头部中发送给备机。
- 一种数据库主备复制延迟监控方法,包括:接收主机的第一预定日志、第一日志文件的最新位置和最新时间戳,将第一预定日志写入同步日志文件中,更新第一日志文件的最新位置和最新时间戳,更新同步日志文件的最新位置和最新时间戳;读取同步日志文件,执行同步日志文件的内容,每执行完一个事务更新已回放日志的最新位置和最新时间戳;根据第一日志文件的最新位置和最新时间戳、同步日志文件的最新位置和最新时间戳计算同步延迟,根据第一日志文件的最新位置和最新时间戳、已回放日志的最新位置和最新时间戳计算回放延迟。
- 根据权利要求9所述的数据库主备复制延迟监控方法,其特征在于,所述将第一预定日志写入同步日志文件中后,该方法还包括:向主机返回日志已同步响应。
- 根据权利要求9所述的数据库主备复制延迟监控方法,其特征在于,所述将第一预定日志写入同步日志文件中后,该方法还包括:判断是否需要切换所述同步日志文件;当判断出不需要切换所述同步日志文件时,向主机返回日志已同步响应。
- 根据权利要求11所述的数据库主备复制延迟监控方法,其特征在于,当判断出需要切换所述同步日志文件时,向主机返回日志已同步响应之前, 该方法还包括:将所述同步日志文件的最新位置和最新时间戳写入第二系统表,切换所述同步日志文件。
- 根据权利要求12所述的数据库主备复制延迟监控方法,其特征在于,所述接收主机的第一预定日志、第一日志文件的最新位置和最新时间戳之前,该方法还包括:在初始化数据库时创建所述第二系统表。
- 根据权利要求9~13任一项所述的数据库主备复制延迟监控方法,其特征在于,其中,所述更新第一日志文件的最新位置和最新时间戳包括:在内存中更新所述第一日志文件的最新位置和最新时间戳;所述更新同步日志文件的最新位置和最新时间戳包括:在内存中更新所述同步日志文件的最新位置和最新时间戳。
- 根据权利要求14所述的数据库主备复制延迟监控方法,其特征在于,其中,所述在内存中更新第一日志文件的最新位置和最新时间戳包括:将内存中的第一日志文件的最新位置更新为接收的第一日志文件的最新位置,将内存中的第一日志文件的最新时间戳更新为接收的第一日志文件的最新事件戳。
- 根据权利要求9~13任一项所述的数据库主备复制延迟监控方法,其特征在于,其中,所述更新同步日志文件的最新位置和最新时间戳包括:将所述同步日志文件的最新位置更新为上一次更新的同步日志文件的最新位置和接收的第一预定日志的长度之和,将所述同步日志文件的最新时间戳更新为所述第一预定日志中记录的所述第一预定日志的生成时间。
- 根据权利要求9~13任一项所述的数据库主备复制延迟监控方法,其特征在于,其中,所述更新已回放日志的最新位置和最新时间戳包括:将所述已回放日志的最新位置更新为上一次更新的已回放日志的最新位置和本次执行的事务的长度之和,将所述已回放日志的最新时间戳更新为本次执行的事务对应的日志中记录的所述事务对应的日志的生成时间。
- 根据权利要求9~13任一项所述的数据库主备复制延迟监控方法,其特征在于,其中,接收备机复制延迟查询指令时,继续执行所述根据第一日志文件的最新位置和最新时间戳、同步日志文件的最新位置和最新时间戳计算同步延迟,根据第一日志文件的最新位置和最新时间戳、已回放日志的最新位置和最新时间戳计算回放延迟的步骤。
- 根据权利要求9~13任一项所述的数据库主备复制延迟监控方法,其特征在于,其中,所述同步延迟包括同步位置延迟和同步时间延迟,所述根据第一日志文件的最新位置和最新时间戳、同步日志文件的最新位置和最新时间戳计算同步延迟包括:将所述第一日志文件的最新位置和所述同步日志文件的最新位置之差作为所述同步位置延迟,将所述同步日志文件的最新时间戳和所述第一日志文件的最新时间戳之差作为所述同步时间延迟。
- 根据权利要求9~13任一项所述的数据库主备复制延迟监控方法,其特征在于,其中,所述回放延迟包括回放位置延迟和回放时间延迟,所述根据第一日志文件的最新位置和最新时间戳、已回放日志的最新位置和最新时间戳计算回放延迟包括:将所述第一日志文件的最新位置和所述已回放日志的最新位置之差作为所述回放位置延迟,将所述已回放日志的最新时间戳和所述第一日志文件的最新时间戳之差作为所述回放时间延迟。
- 根据权利要求9~13任一项所述的数据库主备复制延迟监控方法,其特征在于,该方法还包括:每执行完一个事务时将提交事务时产生的第二预定日志写入第二日志文件中;判断是否需要切换所述第二日志文件;当判断出不需要切换所述第二日志文件时,继续所述读取同步日志文件的步骤。
- 根据权利要求21所述的数据库主备复制延迟监控方法,其特征在于, 当判断出需要切换所述第二日志文件时,继续所述读取同步日志文件的步骤之前,该方法还包括:将所述已回放日志的最新位置和最新时间戳写入第二系统表,切换所述第二日志文件。
- 一种数据库主备复制延迟监控装置,包括:第一更新模块,用于将提交事务时产生的第一预定日志写入第一日志文件中,更新第一日志文件的最新位置和最新时间戳;通信模块,用于将第一预定日志、第一日志文件的最新位置和最新时间戳发送给备机。
- 一种数据库主备复制延迟监控装置,包括:第二更新模块,用于接收主机的第一预定日志、第一日志文件的最新位置和最新时间戳,将第一预定日志写入同步日志文件中,更新第一日志文件的最新位置和最新时间戳,更新同步日志文件的最新位置和最新时间戳;第三更新模块,用于读取同步日志文件,执行同步日志文件的内容,每执行完一个事务更新已回放日志的最新位置和最新时间戳;计算模块,用于根据第一日志文件的最新位置和最新时间戳、同步日志文件的最新位置和最新时间戳计算同步延迟,根据第一日志文件的最新位置和最新时间戳、已回放日志的最新位置和最新时间戳计算回放延迟。
- 一种数据库主备复制延迟监控装置,包括处理器和计算机可读存储介质,所述计算机可读存储介质中存储有指令,其特征在于,当所述指令被所述处理器执行时,实现如权利要求1~22任一项所述的数据库主备复制延迟监控方法。
- 一种计算机可读存储介质,其上存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现如权利要求1~22任一项所述的数据库主备复制延迟监控方法的步骤。
- 一种数据库主备复制延迟监控系统,包括:主机,用于将提交事务时产生的第一预定日志写入第一日志文件中,更新第一日志文件的最新位置和最新时间戳;将第一预定日志、第一日志文件的最新位置和最新时间戳发送给备机;备机,用于接收主机的第一预定日志、第一日志文件的最新位置和最新时间戳,将第一预定日志写入同步日志文件中,更新第一日志文件的最新位置和最新时间戳,更新同步日志文件的最新位置和最新时间戳;读取同步日志文件,执行同步日志文件的内容,每执行完一个事务更新已回放日志的最新位置和最新时间戳;根据第一日志文件的最新位置和最新时间戳、同步日志文件的最新位置和最新时间戳计算同步延迟,根据第一日志文件的最新位置和最新时间戳、已回放日志的最新位置和最新时间戳计算回放延迟。
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811619133.1 | 2018-12-28 | ||
CN201811619133.1A CN111382024B (zh) | 2018-12-28 | 2018-12-28 | 一种数据库主备复制延迟监控方法、装置和系统 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2020134480A1 true WO2020134480A1 (zh) | 2020-07-02 |
Family
ID=71126957
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2019/113464 WO2020134480A1 (zh) | 2018-12-28 | 2019-10-25 | 一种数据库主备复制延迟监控方法、装置和系统 |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN111382024B (zh) |
WO (1) | WO2020134480A1 (zh) |
Families Citing this family (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112069018B (zh) * | 2020-07-21 | 2024-05-31 | 上海瀚银信息技术有限公司 | 一种数据库高可用方法及系统 |
CN113626517B (zh) * | 2021-06-28 | 2023-08-15 | 苏州浪潮智能科技有限公司 | PostgreSQL数据库流复制异常处理方法及装置 |
CN116775727A (zh) * | 2023-06-20 | 2023-09-19 | 深圳市科力锐科技有限公司 | 数据延迟统计方法、装置、设备及存储介质 |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103970620A (zh) * | 2013-01-24 | 2014-08-06 | 杭州宏杉科技有限公司 | 一种准连续性数据复制方法及装置 |
CN104268274A (zh) * | 2014-10-14 | 2015-01-07 | 华为技术有限公司 | 一种记录数据库日志的方法、装置及系统 |
CN105589797A (zh) * | 2015-09-17 | 2016-05-18 | 中国银联股份有限公司 | 主从数据库间数据同步延时检测的方法 |
CN105912628A (zh) * | 2016-04-07 | 2016-08-31 | 北京奇虎科技有限公司 | 主从数据库的同步方法及装置 |
CN108228397A (zh) * | 2016-12-22 | 2018-06-29 | 深圳市优朋普乐传媒发展有限公司 | 一种集群间跨机房同步的方法和装置 |
Family Cites Families (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101710332A (zh) * | 2009-11-13 | 2010-05-19 | 广州从兴电子开发有限公司 | 一种事务日志通知内存数据库内容变化的方法及系统 |
US9020463B2 (en) * | 2011-12-29 | 2015-04-28 | The Nielsen Company (Us), Llc | Systems, methods, apparatus, and articles of manufacture to measure mobile device usage |
CN103560906B (zh) * | 2013-10-22 | 2017-01-25 | 珠海多玩信息技术有限公司 | 数据复制的方法及装置 |
CN106933703B (zh) * | 2015-12-30 | 2021-04-02 | 阿里巴巴集团控股有限公司 | 一种数据库数据备份的方法、装置及电子设备 |
CN108183957B (zh) * | 2017-12-29 | 2020-12-18 | 北京奇虎科技有限公司 | 主从同步方法及装置 |
-
2018
- 2018-12-28 CN CN201811619133.1A patent/CN111382024B/zh active Active
-
2019
- 2019-10-25 WO PCT/CN2019/113464 patent/WO2020134480A1/zh active Application Filing
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103970620A (zh) * | 2013-01-24 | 2014-08-06 | 杭州宏杉科技有限公司 | 一种准连续性数据复制方法及装置 |
CN104268274A (zh) * | 2014-10-14 | 2015-01-07 | 华为技术有限公司 | 一种记录数据库日志的方法、装置及系统 |
CN105589797A (zh) * | 2015-09-17 | 2016-05-18 | 中国银联股份有限公司 | 主从数据库间数据同步延时检测的方法 |
CN105912628A (zh) * | 2016-04-07 | 2016-08-31 | 北京奇虎科技有限公司 | 主从数据库的同步方法及装置 |
CN108228397A (zh) * | 2016-12-22 | 2018-06-29 | 深圳市优朋普乐传媒发展有限公司 | 一种集群间跨机房同步的方法和装置 |
Also Published As
Publication number | Publication date |
---|---|
CN111382024A (zh) | 2020-07-07 |
CN111382024B (zh) | 2023-07-14 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2019154394A1 (zh) | 分布式数据库集群系统、数据同步方法及存储介质 | |
US9575849B2 (en) | Synchronized backup and recovery of database systems | |
JP6749926B2 (ja) | データを同期する方法、機器、及びシステム | |
WO2020134480A1 (zh) | 一种数据库主备复制延迟监控方法、装置和系统 | |
US9563517B1 (en) | Cloud snapshots | |
JP6039655B2 (ja) | 分散記憶環境における同期複製 | |
US8380885B1 (en) | Handling abort commands in replication | |
US10831741B2 (en) | Log-shipping data replication with early log record fetching | |
WO2019091324A1 (zh) | 数据同步方法、装置以及电子设备 | |
US10331699B2 (en) | Data backup method and apparatus | |
CN104156361B (zh) | 一种实现数据同步的方法及系统 | |
CN110045912A (zh) | 数据处理方法和装置 | |
US20110289056A1 (en) | Method, node and system for controlling version in distributed system | |
WO2022170938A1 (en) | Distributed database remote backup | |
CN106802892B (zh) | 用于主备数据一致性校验的方法和设备 | |
US10592128B1 (en) | Abstraction layer | |
WO2015184925A1 (zh) | 分布式文件系统的数据处理方法及分布式文件系统 | |
WO2022048622A1 (zh) | 数据迁移方法、装置、设备、分布式系统及存储介质 | |
US20110137874A1 (en) | Methods to Minimize Communication in a Cluster Database System | |
US20180121531A1 (en) | Data Updating Method, Device, and Related System | |
CN104794119A (zh) | 用于中间件消息的存储与传输方法及系统 | |
CN115658245B (zh) | 一种基于分布式数据库系统的事务提交系统、方法及装置 | |
WO2023116419A1 (zh) | 数据同步方法、设备及计算机可读存储介质 | |
WO2019109256A1 (zh) | 一种日志管理方法、服务器和数据库系统 | |
WO2021082925A1 (zh) | 一种交易处理的方法及装置 |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 19904303 Country of ref document: EP Kind code of ref document: A1 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
32PN | Ep: public notification in the ep bulletin as address of the adressee cannot be established |
Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 12.11.2021) |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 19904303 Country of ref document: EP Kind code of ref document: A1 |