A data synchronization method and device based on timing scheduling

By using a timed data synchronization method and device, the table ID information of newly added tables in DDL is captured and loaded on a timed basis. Combined with parsing archived logs, the problem of DDL operations not being recorded in the database logs is solved, and complete synchronization of DDL operations is achieved.

CN117762888BActive Publication Date: 2026-11-24WUHAN DAMENG DATABASE
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202311826052.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-12-27
Publication Date
2026-11-24
Estimated Expiration
2043-12-27

AI Technical Summary

Technical Problem

In existing technologies, database logs do not record data definition language (DDL) operation information, making DDL operation synchronization difficult.

Method used

A timed data synchronization method is adopted. The table ID information of the newly added table in DDL is captured by the data capture module, and the data loading command is sent by the timed scheduling module to synchronize the newly added table in DDL to the destination. Incremental data synchronization is performed by parsing archived logs.

Benefits of technology

This technology enables the synchronization of existing and incremental data in newly added tables via DDL operations without recording DDL operation information in the database logs, thus meeting the synchronization requirements of DDL operations in existing technologies.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117762888B_ABST
    Figure CN117762888B_ABST
Patent Text Reader

Abstract

This invention relates to a data synchronization method and device based on timed scheduling. The method mainly includes: a source-side data capture module capturing newly added DDL tables and sending the table ID information of the newly added DDL tables to a source-side timed scheduling module; the source-side data capture module receiving data loading commands periodically sent by the timed scheduling module based on the table ID information and executing data loading to synchronize the corresponding newly added DDL tables to the destination; and the source-side data capture module, while parsing archived logs, filtering out log information related to the newly added DDL tables for parsing, and sending the parsed operations to the destination for incremental data synchronization. This invention can complete the synchronization of all newly added DDL tables, thus fulfilling the need and purpose of synchronizing DDL operations in the prior art.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of database technology, and in particular to a data synchronization method and device based on timed scheduling. Background Technology

[0002] Among software-based database data replication technologies, real-time data synchronization technology based on analysis log files is widely used in various scenarios such as emergency disaster recovery, multi-business centers, real-time heterogeneous resource integration, data migration and rolling upgrades, and data warehouse architecture improvement because it has the characteristics of minimal impact on the source database, support for heterogeneous system replication, and read / write capability of the replication system standby machine.

[0003] The main technical principle of real-time data synchronization based on log file analysis is as follows: On the source database, the data synchronization process reads the online or archived log files in real time to obtain the database's INSERT, DELETE, and UPDATE transaction operations. These operations are then converted into messages in a specific internal format and transmitted directly to the target database's data synchronization process via a Transmission Control Protocol (TCP) / Internet Protocol (IP) network. Upon receiving the messages from the source database, the target database's data synchronization process analyzes them and reconstructs the source database's transaction operations into Structured Query Language (SQL) statements. These SQL statements are then executed on the target database using a local database interface, thus achieving data synchronization between the source and target databases.

[0004] For Data Manipulation Language (DML) operations on databases, the database directly records transaction operation information in its log files, such as the operation objects and modified data. Based on this, third-party tools can achieve real-time synchronization of insert, delete, and update operations by reading and parsing incremental log data from the physical log files. However, for Data Definition Language (DDL) operations, not all databases directly record DDL transaction information in their log files. Therefore, how to synchronize DDL operations when relevant information is not recorded in the database logs has become a pressing technical problem in the industry.

[0005] Therefore, how to overcome the shortcomings of existing technologies and solve the technical problem of synchronizing DDL operations when the database logs do not record relevant information is a problem to be solved in this technical field. Summary of the Invention

[0006] To address the shortcomings or improvement needs of existing technologies—specifically, how to synchronize DDL operations when no relevant information is recorded in the database logs—this invention provides a data synchronization method and device based on timed scheduling. It utilizes a timed scheduling module and the data initialization loading function of data synchronization to achieve data synchronization of newly added tables.

[0007] The embodiments of the present invention adopt the following technical solutions:

[0008] In a first aspect, the present invention provides a data synchronization method based on timed scheduling, comprising:

[0009] The data capture module at the source end captures the newly added table in the DDL and sends the table ID information of the newly added table to the timed scheduling module at the source end.

[0010] The source-end data capture module receives data loading commands sent periodically by the timed scheduling module based on table ID information and executes data loading, synchronizing the corresponding DDL-added table to the destination end;

[0011] When parsing archived logs, the data capture module at the source end filters out log information related to newly added tables in DDL, parses it, and sends the parsed operations to the destination end for incremental data synchronization.

[0012] Furthermore, the data capture module at the source end captures the newly added table in the DDL and sends the table ID information of the newly added table to the timed scheduling module at the source end, specifically including:

[0013] When parsing the database logs, the data capture module at the source end captures INSERT operation information of tables that meet the filtering conditions;

[0014] Check if the local dictionary file contains the corresponding information for the table that meets the filtering conditions. If not, record the table that meets the filtering conditions as a new table in the DDL.

[0015] The corresponding table ID information of the newly added table in the DDL is sent to the timed scheduling module.

[0016] Furthermore, the determination of whether the filtering conditions are met includes: determining whether the filtering conditions are met based on the schema name and the table name.

[0017] Furthermore, when determining whether the local dictionary file contains the corresponding information for the table that satisfies the filtering conditions, if so, the process is skipped.

[0018] Furthermore, the timed scheduling module is configured with a scheduling strategy, an effective time, and an end time. The scheduling strategy includes setting a scheduling frequency to set the time interval for sending information to the data capture module. The effective time and end time are used to constrain the scheduling strategy to be effective within a certain time period.

[0019] Furthermore, the timed scheduling module executes normally at the specified timed execution point. If it receives table ID information from the data capture module within the timed period, it integrates and filters the table ID information and sends the corresponding table data loading command to the data capture module.

[0020] Furthermore, the process of integrating and filtering the table ID information specifically includes: determining whether the table ID has been sent before, and discarding it if it has been sent.

[0021] Furthermore, the source-end data capture module receives data loading commands periodically sent by the timed scheduling module based on table ID information and executes data loading to synchronize the corresponding DDL-added table to the destination end, specifically including:

[0022] The source-side data capture module receives the data loading command from the timed scheduling module and determines the new DDL table to be loaded based on the table ID information carried in the data loading command.

[0023] The source-side data capture module queries the data of the newly added DDL table to be loaded on the source side and records the loading LSN at this time.

[0024] The existing data of the DDL-added table to be loaded is sent to the destination database for synchronization, and the data dictionary of the DDL-added table to be loaded is cached in a local file.

[0025] Furthermore, when parsing archived logs, the source-side data capture module filters out log information related to newly added DDL tables for parsing, and sends the parsed operations to the destination for incremental data synchronization. Specifically, this includes:

[0026] The source-side data capture module filters data based on the local data dictionary file, and when reading the archived logs of the source database, it filters out the log information of the corresponding DDL added tables after the LSN is loaded.

[0027] The filtered log information is parsed;

[0028] The parsed operations are sent to the destination database for execution to synchronize the incremental data of the corresponding DDL-added table.

[0029] On the other hand, the present invention provides a data synchronization device based on timed scheduling, specifically comprising at least one processor and a memory, wherein the at least one processor and the memory are connected via a data bus, the memory stores instructions that can be executed by at least one processor, and the instructions, after being executed by the processor, are used to complete the data synchronization method based on timed scheduling in the first aspect.

[0030] Compared with the prior art, the beneficial effects of the present invention are as follows: The present invention provides a data synchronization method and device based on timed scheduling. The data capture module at the source end captures the newly added DDL table and sends the table ID information of the newly added DDL table to the timed scheduling module at the source end. The data capture module receives the data loading command sent by the timed scheduling module based on the table ID information at regular intervals and executes the data loading, synchronizing the corresponding newly added DDL table to the destination end. The existing synchronization of the newly added DDL table is completed through this method. Then, when parsing the archived logs, the data capture module at the source end filters out the log information related to the newly added DDL table for parsing and sends the parsed operations to the destination end for incremental data synchronization. Thus, all synchronization of the newly added DDL table is completed, which also realizes the need and purpose of synchronizing DDL operations in the prior art. Attached Figure Description

[0031] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the embodiments of the present invention will be briefly described below. Obviously, the drawings described below are merely some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without any creative effort.

[0032] Figure 1 Here is a flowchart of a data synchronization method based on timed scheduling provided in Embodiment 1 of the present invention;

[0033] Figure 2 This is an extended flowchart of step 100 provided in Embodiment 1 of the present invention;

[0034] Figure 3 This is an extended flowchart of step 200 provided in Embodiment 1 of the present invention;

[0035] Figure 4 This is a detailed flowchart of step 300 provided in Embodiment 1 of the present invention;

[0036] Figure 5 This is a schematic diagram of a data synchronization device structure based on timed scheduling provided in Embodiment 3 of the present invention. Detailed Implementation

[0037] The present invention will now be described in detail with reference to specific embodiments. These embodiments will help those skilled in the art to further understand the present invention, but do not limit the invention in any way. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the present invention. These all fall within the scope of protection of the present invention.

[0038] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0039] It should be noted that, unless otherwise specified, the various features in the embodiments of this invention can be combined with each other, all of which are within the protection scope of this application. Furthermore, although functional modules are divided in the device schematic diagram and a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed differently from the module division in the device or the order shown in the flowchart.

[0040] Unless otherwise defined, all technical and scientific terms used in this specification have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains. The terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the invention. Furthermore, the technical features involved in the various embodiments of the invention described below can be combined with each other as long as they do not conflict with each other.

[0041] The present invention will now be described in detail with reference to the accompanying drawings and embodiments.

[0042] Example 1:

[0043] This embodiment requires deploying synchronization systems on both the source and destination databases. The source database synchronization system reads logs from the source database, while the destination database synchronization system applies the synchronization operations sent from the source database to the destination database. Simultaneously, a timed scheduling module needs to be deployed on the source database, with its scheduling policy, effective time, and end time set. A data capture module also needs to be deployed on the source database to acquire data and interact with other modules and systems.

[0044] like Figure 1 As shown in the figure, this embodiment of the invention provides a data synchronization method based on timed scheduling, and the specific steps are as follows.

[0045] Step 100: The source-side data capture module captures the newly added DDL table and sends the table ID information of the newly added DDL table to the source-side timed scheduling module. This step uses the source-side data capture module to capture the newly added DDL table and send the table ID information of the newly added DDL table to the timed scheduling module, so that the timed scheduling module will send a data loading command based on the table ID information after a preset time period.

[0046] Step 200: The source-side data capture module receives and executes data loading commands periodically sent by the timed scheduling module based on table ID information, synchronizing the corresponding DDL-added tables to the destination. In this step, the timed scheduling module periodically sends data loading commands to the data capture module based on table ID information. The data capture module executes data loading according to the data loading commands, synchronizing the corresponding DDL-added tables to the destination. This step synchronizes the existing data of the DDL-added tables.

[0047] Step 300: When parsing archived logs, the source-side data capture module filters out log information related to DDL-added tables for parsing and sends the parsed operations to the destination for incremental data synchronization. In this step, the data capture module also filters out subsequent operations related to DDL-added tables and sends them to the destination for synchronization. This step synchronizes the incremental data of the DDL-added tables.

[0048] Based on the above steps, the embodiments of the present invention can complete the synchronization of all newly added tables in DDL, that is, realize the need and purpose of synchronizing DDL operations in the prior art.

[0049] refer to Figure 2 As shown, in a specific embodiment of this preferred embodiment, the data capture module at the source end in step 100 captures the newly added DDL table and sends the table ID information of the newly added DDL table to the timed scheduling module at the source end, specifically includes the following steps.

[0050] Step 101: When parsing the database logs, the source-side data capture module captures INSERT operation information for tables that meet the filtering conditions. In a specific embodiment of this preferred example, the determination of whether a table meets the filtering conditions includes: judging whether the filtering conditions are met based on the schema name and table ID. The data capture module can configure detailed filtering conditions in the configuration file, configured as schema name.table name. The data capture module can parse the schema name and table name of the operation from the source-side database archive logs, and determine whether the filtering conditions are met based on these schema name and table name.

[0051] Step 102: Determine if the local dictionary file contains the corresponding information for the table that meets the filtering conditions. If not, record the table that meets the filtering conditions as a newly added DDL table. The data capture module saves a dictionary file of the table information being synchronized locally. If this table meets the filtering conditions and its dictionary file is not saved locally, it proves that this table is a newly added DDL table in the source database after synchronization started. Alternatively, in a specific embodiment of this preferred embodiment, when determining if the local dictionary file contains the corresponding information for the table that meets the filtering conditions, skip this step if it does. If the local file contains a record, it proves that it is not a newly added DDL table or a newly added DDL table that has already been loaded and added to the synchronization process, and can be skipped.

[0052] Step 103: Send the corresponding table ID information of the newly added DDL table to the timed scheduling module. Based on the operations in steps 101-103, the source data capture module captures the INSERT operation information of tables that meet the filtering conditions. If the local dictionary file does not record the information of this table, it records this table as a newly added DDL table and sends the corresponding information of this table to the timed scheduling module.

[0053] In one specific embodiment of this preferred embodiment, the timed scheduling module is configured with a scheduling strategy, an effective time, and an end time. The scheduling strategy includes setting a scheduling frequency, used to set the time interval for sending information to the data acquisition module, i.e., setting how often to send information to the data acquisition module. The effective time and end time are used to constrain the scheduling strategy to be effective within a certain time period.

[0054] In one specific embodiment of this preferred embodiment, the timed scheduling module executes normally at the specified time point. If it receives table ID information from the data capture module within the timed period, it integrates and filters the table ID information and sends a data loading command for the corresponding table to the data capture module. In one specific embodiment of this preferred embodiment, the integration and filtering of table ID information specifically includes: determining whether the table ID has been sent before; if so, discarding it. The timed scheduling module records the table IDs sent within a certain period, integrates them (determining whether the table ID has been sent before; if so, discarding it), and periodically sends the integrated table IDs to the data capture module.

[0055] refer to Figure 3 As shown, in a specific embodiment of this preferred embodiment, the data capture module at the source end in step 200 receives the data loading command sent by the timed scheduling module based on the table ID information and executes the data loading to synchronize the corresponding DDL new table to the destination end. This specifically includes the following steps.

[0056] Step 201: The data capture module at the source end receives the data loading command sent by the timed scheduling module, and determines the new DDL table to be loaded based on the table ID information carried in the data loading command.

[0057] Step 202: The source-side data capture module queries the data of the newly added DDL table to be loaded on the source side and records the loading LSN at this time.

[0058] Step 203: Send the existing data of the DDL new table to be loaded to the destination database for synchronization, and cache the data dictionary of the DDL new table to be loaded in a local file.

[0059] Based on the operations in steps 201-203, the source-end data capture module receives the data loading command sent by the timed scheduling module; the source-end data capture module queries the data in the loading table (the DDL new table to be loaded) on the source end, and records the loading LSN at this time. The existing data in the table will be sent to the destination-end data receiving program and written to the target-end database. At the same time, the data dictionary of this table will be cached in a local file.

[0060] refer to Figure 4 As shown, in a specific embodiment of this preferred embodiment, the data capture module at the source end in step 300 filters out log information related to the newly added table in DDL when parsing the archived logs, and sends the parsed operations to the destination end for incremental data synchronization. Specifically, this includes the following steps.

[0061] Step 301: The source data capture module filters the data based on the local data dictionary file, and when reading the archived logs of the source database, it filters out the log information of the corresponding DDL added tables after the LSN is loaded.

[0062] Step 302: Parse the filtered log information.

[0063] Step 303: Send the parsed operations to the destination database for execution to complete the synchronization of incremental data in the corresponding DDL-added table.

[0064] Based on steps 301-303, the source-side data capture module filters and synchronizes data according to the local data dictionary file. When reading the source-side database archive logs, it synchronizes operations related to this table after the LSN is loaded. Incremental data for this table is sent to the execution-side data receiving system for execution in the destination database according to the operation order. After all the above steps, the DDL addition of a table completes all the steps for joining the synchronization.

[0065] All the steps in the above embodiments can be explained as follows:

[0066] First, when parsing the database logs, the source-side data capture module captures INSERT operations on tables that meet the filtering conditions. If the local dictionary file does not record information about this table, it records it as a DDL-added table and sends the corresponding table ID information to the scheduled module. The scheduled module deployed at the source end will periodically execute data loading commands and send instructions to the source-side data capture module.

[0067] Secondly, when the source-side data capture module executes the load command, it queries the source-side database, locks the newly created table on the source side, records the LSN at this time, and saves the dictionary of this table.

[0068] Next, the source-side data capture module first queries the table structure, packages the information into a specific message format, and transmits the message over the network to the corresponding destination receiving program. The destination program then parses the message, executes the data entry, and successfully synchronizes the DDL statements. The specific message format is an internal program feature where information is written into a message packet for easier sending and parsing. This packet contains a message header and a message body. The message header stores common information such as LSN, op_id, trxid, schema name, and table name, while the message body contains unique information for each message.

[0069] Next, the source-side data capture module queries the existing data in this table, packages the information into a specific message format, and transmits the message over the network to the corresponding destination receiving program. The destination program then parses the message, executes the data entry, and the existing data synchronization is successful. It should be noted that the previous section described synchronizing DDL statements to the destination, while this section describes retrieving the existing data from this table and synchronizing it to the destination.

[0070] Finally, when parsing archived logs, the source data capture module filters the logs based on the saved dictionary information, selects valid log information for parsing, discards archived log information before loading LSN, and sends the operations parsed from archived log information after loading LSN to the execution end for execution, thus successfully synchronizing incremental data.

[0071] In summary, this embodiment provides a data synchronization method based on timed scheduling. The source-side data capture module captures newly added DDL tables and sends the table ID information of the newly added DDL tables to the source-side timed scheduling module. The data capture module receives data loading commands sent periodically by the timed scheduling module based on the table ID information and executes data loading, synchronizing the corresponding newly added DDL tables to the destination end. This method completes the existing synchronization of newly added DDL tables. Then, when parsing archived logs, the source-side data capture module filters out log information related to newly added DDL tables for parsing and sends the parsed operations to the destination end for incremental data synchronization. Thus, all synchronization of newly added DDL tables is completed, which fulfills the requirement and purpose of synchronizing DDL operations in the prior art.

[0072] It should also be noted that during the above synchronization process, when the source-side data capture module queries the data of the newly added DDL table to be loaded on the source side and records the loading LSN at that time, a table locking operation is required. However, the table locking operation may fail during busy periods, or the unlocking time may vary significantly, which is not conducive to the increasingly demanding synchronization requirements. Therefore, this embodiment also provides an improved method for timed synchronization of the source-side database without locking. After each generation of synchronization data, the source-side database compares the LSN at the start of generation with the LSN after generation to see if they have changed. If they have not changed, the synchronization data is sent directly to the target database; if they have changed, the synchronization data is regenerated. In the above implementation, the source-side database sets the corresponding synchronization timing to a period with a low regeneration frequency based on the frequency of regeneration, thereby fully utilizing the advantages of the lockless method. For example, if the source database experiences frequent regenerations during midday and infrequent regenerations in the afternoon, it indicates more frequent database modifications during midday and less frequent modifications in the afternoon. Therefore, the synchronization timing can be set for the afternoon to fully leverage the advantages of the lock-free synchronization method. Furthermore, the source database can adjust the synchronization interval to obtain the percentage of regeneration occurrences within a given period. The synchronization interval with the lowest percentage can then be determined. For instance, if synchronization occurs every first interval (50% regeneration), every second interval (30% regeneration), and every third interval (10% regeneration), the third interval is the synchronization interval with the lowest percentage. This method improves the synchronization success rate and more fully utilizes the advantages of the lock-free method.

[0073] Example 2:

[0074] Based on the data synchronization method based on timed scheduling provided in Embodiment 1, this Embodiment 2 will provide a more detailed description of the present invention through a specific application scenario.

[0075] Examples of the above solutions are as follows:

[0076] The following operations were performed on the source database, and the corresponding LSNs are shown in the table below:

[0077] Operation number operate LSN op1 CREATE TABLE SYSDBA.T1(ID INT,DATA1 VARCHAR(10)) 1001 op2 COMMIT 1002 op3 INSERT INTO SYSDBA.T1 VALUES(1,'AAA'); 1003 op4 COMMIT 1004 op5 INSERT INTO SYSDBA.T1 VALUES(2,'BBB'); 1005 op6 COMMIT 1006

[0078] The complete data synchronization process is as follows:

[0079] 1. When operating op3, the source log parsing system parses the insert operation of table T1. Table T1 meets the mapping configuration and the data dictionary of this table is not cached locally (first check if the filtering rules are met, if not, discard it, if it is met, search in the local dictionary file to see if the data dictionary of this table is cached. If the local data dictionary of this table is not found, the condition is met). The source queries the table ID information of this table and sends it to the corresponding timed scheduling module.

[0080] 2. When the timed scheduling module starts on a timed basis, if it receives table ID information from the source data capture module in the previous timed period, it will integrate the table information to generate a data loading command and periodically send this loading command to the source data capture module.

[0081] 3. When the source data capture module receives the loading command sent by the timed scheduling system at the op5 operation time, the source data capture module will execute the loading command, lock the T1 table and record the LSN value (1005) at this time.

[0082] 4. The source data capture module will query the source database for the data present in T1 through the database interface and send it to the target data receiving service.

[0083] 5. After receiving the data, the target end's data receiving service will execute on the target end's database through the database interface. Existing data before LSN(1005) will be synchronized through data loading.

[0084] 6. When the data capture module at the source end loads data, it also records the dictionary cache of table T1. By reading and parsing the log information of the source database, the log information that matches the dictionary of table T1 will be filtered out and synchronized.

[0085] 7. Operations filtered from the logs that are before the LSN(1005) value will be filtered out and discarded, while operations that are after the LSN(1005) value will be sent to the destination for synchronization.

[0086] 8. Incremental data after operation op5 will be synchronized by parsing archived logs. At this point, table T1 will be added to the normal synchronization process.

[0087] In summary, this embodiment provides a data synchronization method based on timed scheduling. The source-side data capture module captures newly added DDL tables and sends the table ID information of the newly added DDL tables to the source-side timed scheduling module. The data capture module receives data loading commands sent periodically by the timed scheduling module based on the table ID information and executes data loading, synchronizing the corresponding newly added DDL tables to the destination end. This method completes the existing synchronization of newly added DDL tables. Then, when parsing archived logs, the source-side data capture module filters out log information related to newly added DDL tables for parsing and sends the parsed operations to the destination end for incremental data synchronization. Thus, all synchronization of newly added DDL tables is completed, which fulfills the requirement and purpose of synchronizing DDL operations in the prior art.

[0088] Example 3:

[0089] Based on the timed scheduling-based data synchronization method provided in Embodiments 1 and 2 above, the present invention also provides a timed scheduling-based data synchronization device that can be used to implement the above method, such as... Figure 5 The diagram shown is a schematic representation of the device architecture according to an embodiment of the present invention. The data synchronization device based on timed scheduling in this embodiment includes one or more processors 21 and a memory 22. Figure 5 Take a processor 21 as an example.

[0090] Processor 21 and memory 22 can be connected via a bus or other means. Figure 5 Taking the example of a connection between China and Israel via a bus.

[0091] The memory 22, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer-executable programs, and modules, such as the time-scheduling-based data synchronization method and system in Embodiments 1 and 2. The processor 21 executes various functional applications and data processing of the time-scheduling-based data synchronization device by running the non-volatile software programs, instructions, and modules stored in the memory 22, thereby implementing the time-scheduling-based data synchronization method of Embodiments 1 and 2.

[0092] Memory 22 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other non-volatile solid-state storage device. In some embodiments, memory 22 may optionally include memory remotely located relative to processor 21, which can be connected to processor 21 via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.

[0093] The program instructions / modules are stored in memory 22. When executed by one or more processors 21, they perform the timed scheduling-based data synchronization methods described in Embodiments 1 and 2 above, for example, executing the methods described above. Figures 1 to 4 The steps shown.

[0094] The above-described product can perform the methods provided in the embodiments of this application, and has the corresponding functional modules and beneficial effects for performing the methods. Technical details not described in detail in this embodiment can be found in the methods provided in the embodiments of this application.

[0095] It should be noted that the device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.

[0096] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented using software and a general-purpose hardware platform, or of course, using hardware. Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. The storage medium can be a magnetic disk, optical disk, read-only memory (ROM), or random access memory (RAM), etc.

[0097] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; under the concept of the present invention, the technical features of the above embodiments or different embodiments can also be combined, the steps can be implemented in any order, and there are many other variations of different aspects of the present invention as described above. For the sake of brevity, they are not provided in detail; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.

Claims

1. A data synchronization method based on timed scheduling, characterized in that, include: The data capture module at the source end captures the newly added table in the DDL and sends the table ID information of the newly added table to the timed scheduling module at the source end. The timed scheduling module is configured with a scheduling strategy, an effective time, and an end time. The scheduling strategy includes setting a scheduling frequency to set the time interval for sending information to the data capture module. The effective time and end time are used to constrain the scheduling strategy to take effect within a certain time period. If table ID information sent by the data capture module is received within the timed period, the table ID information is integrated and filtered, and a data loading command for the corresponding table is sent to the data capture module. The source-end data capture module receives the data loading command sent by the timed scheduling module based on the table ID information and executes the data loading. When the loading LSN is recorded, the table is locked and the corresponding DDL new table is synchronized to the destination end. When parsing archived logs, the data capture module at the source end filters out log information related to newly added tables in DDL, parses it, and sends the parsed operations to the destination end for incremental data synchronization.

2. The data synchronization method based on timed scheduling according to claim 1, characterized in that, The data capture module at the source end captures the newly added table in the DDL and sends the table ID information of the newly added table to the timed scheduling module at the source end, specifically including: When parsing the database logs, the data capture module at the source end captures INSERT operation information of tables that meet the filtering conditions; Check if the local dictionary file contains the corresponding information for the table that meets the filtering conditions. If not, record the table that meets the filtering conditions as a new table in the DDL. The corresponding table ID information of the newly added table in the DDL is sent to the timed scheduling module.

3. The data synchronization method based on timed scheduling according to claim 2, characterized in that, The determination of whether the filtering conditions are met includes: judging whether the filtering conditions are met based on the schema name and table name.

4. The data synchronization method based on timed scheduling according to claim 2, characterized in that, If the local dictionary file contains the corresponding information for the table that meets the filtering conditions, then skip the step.

5. The data synchronization method based on timed scheduling according to claim 1, characterized in that, The process of integrating and filtering table ID information specifically includes: determining whether the table ID has been sent before, and discarding it if it has been sent.

6. The data synchronization method based on timed scheduling according to claim 1, characterized in that, The source-end data capture module receives data loading commands sent periodically by the timed scheduling module based on table ID information and executes data loading, synchronizing the corresponding DDL-added table to the destination end, specifically including: The source-side data capture module receives the data loading command from the timed scheduling module and determines the new DDL table to be loaded based on the table ID information carried in the data loading command. The source-side data capture module queries the data of the newly added DDL table to be loaded on the source side and records the loading LSN at this time. The existing data of the DDL-added table to be loaded is sent to the destination database for synchronization, and the data dictionary of the DDL-added table to be loaded is cached in a local file.

7. The data synchronization method based on timed scheduling according to claim 6, characterized in that, When parsing archived logs, the data capture module at the source end filters out log information related to newly added tables in DDL operations, and sends the parsed operations to the destination end for incremental data synchronization. Specifically, this includes: The source-side data capture module filters data based on the local data dictionary file, and when reading the archived logs of the source database, it filters out the log information of the corresponding DDL added tables after the LSN is loaded. The filtered log information is parsed; The parsed operations are sent to the destination database for execution to synchronize the incremental data of the corresponding DDL-added table.

8. A data synchronization device based on timed scheduling, characterized in that: It includes at least one processor and a memory, which are connected via a data bus. The memory stores instructions that can be executed by the at least one processor. After being executed by the processor, the instructions are used to perform the data synchronization method based on timed scheduling as described in any one of claims 1-7.

Citation Information

Patent Citations

  • Real-time synchronization method and device for querying table building data

    CN116910150A