Data synchronization method and apparatus, computer device, and storage medium
By comparing the application business tables and transaction log reconciliation tables of the platform and host databases, and combining them with a compensation mechanism, the problem of data inconsistency between the host database and the platform database was resolved, achieving real-time and accurate data synchronization and ensuring the normal operation of transactions.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- INDUSTRIAL AND COMMERCIAL BANK OF CHINA
- Filing Date
- 2023-03-21
- Publication Date
- 2026-06-09
AI Technical Summary
When writing to both the host database and the platform database, only one write operation has a chance of success, which can cause transactions to fail. Therefore, a data synchronization method is urgently needed to ensure data consistency.
By obtaining the application business tables and transaction log reconciliation tables from the platform and host database, log comparison and data comparison are performed. Based on the comparison results and the preset compensation mechanism, data compensation processing is carried out on the database to ensure data consistency.
It enables real-time monitoring and correction of data inconsistencies during dynamic dual-write data processing, improving the immediacy and accuracy of data synchronization and ensuring the normal operation of transactions.
Smart Images

Figure CN116303788B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of cloud computing technology, and in particular to a data synchronization method, apparatus, computer equipment, storage medium, and computer program product. Background Technology
[0002] With the transformation of information technology (IT) architecture, data such as mainframe databases is gradually migrating to open-source databases on various platforms. Data replication tools have enabled data synchronization between mainframe and platform databases, driving the development of a dual-core architecture. Currently, most transaction data is written to both the mainframe and platform databases. Maintaining data consistency between the mainframe and platform databases is crucial for ensuring the smooth operation of transactions.
[0003] However, dual-write operations to both the host database and the platform database result in only one write succeeding, causing transactions to malfunction. Therefore, a data synchronization method is urgently needed. Summary of the Invention
[0004] Therefore, it is necessary to provide a data synchronization method, apparatus, computer equipment, computer-readable storage medium, and computer program product that can ensure data consistency between the host database and the platform database, in order to address the above-mentioned technical problems.
[0005] Firstly, this application provides a data synchronization method. The method includes:
[0006] Obtain the first application business table and the first transaction log reconciliation table from the platform database, and the second application business table and the second transaction log reconciliation table from the host database; the first application business table and the second application business table are used to record transaction-related business data; the first transaction log reconciliation table and the second transaction log reconciliation table are used to record the transaction status of each transaction;
[0007] The log data in the first transaction log reconciliation table and the second transaction log reconciliation table are compared to obtain the log comparison result. The business data in the first application business table and the second application business table are compared according to the preset comparison rules to obtain the data comparison result.
[0008] Based on the log comparison results, the data comparison results, and the preset data compensation mechanism, data compensation processing is performed on the platform database or the host database.
[0009] In one embodiment, the data compensation process for the platform database or the host database based on the log comparison result, the data comparison result, and a preset data compensation mechanism includes:
[0010] The monitoring results are determined based on the log comparison results and the data comparison results; the monitoring results indicate whether the platform database and the host database are consistent.
[0011] If the monitoring results indicate that the data in the platform database and the host database are inconsistent, a reference application business table and an application business table to be corrected shall be determined based on the monitoring results and a preset data compensation mechanism.
[0012] Update the application business table to be corrected based on the transaction data in the reference application business table.
[0013] In one embodiment, determining the monitoring result based on the log comparison result and the data comparison result includes:
[0014] If the log comparison result indicates that there are records in both the first transaction log reconciliation table and the second transaction log reconciliation table, and the data comparison result indicates that the business data in the first application business table and the second application business table are consistent, then the monitoring result is determined to be that the data in the platform database and the host database are consistent.
[0015] If the log comparison result indicates that there is a missing transaction log in the transaction log reconciliation table, or if the data comparison result indicates that the business data in the first application business table and the second application business table are inconsistent, then the monitoring result is determined to be that the data in the platform database and the host database are inconsistent.
[0016] In one embodiment, determining the reference application service table and the application service table to be corrected based on the monitoring results and a preset data compensation mechanism includes:
[0017] If the monitoring results indicate that there is a transaction log reconciliation table with missing logs, then the application business table corresponding to the transaction log reconciliation table with missing logs shall be used as the application business table to be corrected, and the application business table corresponding to the transaction log reconciliation table with existing log records shall be used as the reference application business table.
[0018] If the monitoring result indicates that the business data is inconsistent and the transaction status corresponding to the inconsistent business data in the first transaction log reconciliation table is successful, then the second application business table will be used as the application business table to be corrected and the first application business table will be used as the reference application business table.
[0019] If the monitoring results indicate that the business data is inconsistent and the transaction status corresponding to the inconsistent business data in the first transaction log reconciliation table is unsuccessful, then the first application business table will be used as the application business table to be corrected, and the second application business table will be used as the reference application business table.
[0020] In one embodiment, both the first application business table and the second application business table include the data change amount of the application business table; the step of comparing the business data in the first application business table and the second application business table according to a preset comparison rule to obtain the data comparison result includes:
[0021] According to a preset time interval, the first data change amount in the first application business table, the second data change amount in the second application business table, and the acquisition time are obtained; the acquisition time is the time when the data change amounts in the first application business table and the second application business table are obtained.
[0022] The data change comparison result is determined based on the first data change and the second data change corresponding to each acquisition time.
[0023] If the data change comparison result indicates that the data change amounts of the first application business table and the second application business table are consistent, then the business data in the first application business table and the second application business table are compared to obtain the data comparison result.
[0024] In one embodiment, determining the data change comparison result based on the first data change and the second data change corresponding to each acquisition time includes:
[0025] For each acquisition time, the first data change and the second data change corresponding to the acquisition time are compared to obtain the first initial comparison result;
[0026] Based on the acquisition time, multiple comparison time groups are determined; each comparison time group includes a first comparison time and a second comparison time.
[0027] For each comparison time group, calculate the first difference between the first data change corresponding to the first comparison time in the comparison time group and the first data change corresponding to the second comparison time in the comparison time group, and calculate the second difference between the second data change corresponding to the first comparison time in the comparison time group and the second data change corresponding to the second comparison time in the comparison time group.
[0028] The second initial comparison result is determined based on the first difference and the second difference corresponding to each comparison time group;
[0029] Based on the first initial comparison result and the second initial comparison result, the data change comparison result is determined.
[0030] In one embodiment, when the monitoring results indicate inconsistent data, the method further includes:
[0031] Determine the target data type for inconsistent business data;
[0032] In the preset mapping relationship between data types and alarm levels, query the target alarm level corresponding to the target data type, and output the alarm information corresponding to the target alarm level.
[0033] Secondly, this application also provides a data synchronization device. The device includes:
[0034] The acquisition module is used to acquire the first application business table and the first transaction log reconciliation table of the platform database, and the second application business table and the second transaction log reconciliation table of the host database; the first application business table and the second application business table are used to record transaction-related business data; the first transaction log reconciliation table and the second transaction log reconciliation table are used to record the transaction status of each transaction;
[0035] The comparison module is used to compare the log data in the first transaction log reconciliation table and the second transaction log reconciliation table to obtain the log comparison result, and to compare the business data in the first application business table and the second application business table according to the preset comparison rules to obtain the data comparison result.
[0036] The compensation module is used to perform data compensation processing on the platform database or the host database based on the log comparison results, the data comparison results, and the preset data compensation mechanism.
[0037] In one embodiment, the compensation module is specifically used for:
[0038] The monitoring results are determined based on the log comparison results and the data comparison results; the monitoring results indicate whether the platform database and the host database are consistent.
[0039] If the monitoring results indicate that the data in the platform database and the host database are inconsistent, a reference application business table and an application business table to be corrected shall be determined based on the monitoring results and a preset data compensation mechanism.
[0040] Update the application business table to be corrected based on the transaction data in the reference application business table.
[0041] In one embodiment, the compensation module is specifically used for:
[0042] If the log comparison result indicates that there are records in both the first transaction log reconciliation table and the second transaction log reconciliation table, and the data comparison result indicates that the business data in the first application business table and the second application business table are consistent, then the monitoring result is determined to be that the data in the platform database and the host database are consistent.
[0043] If the log comparison result indicates that there is a missing transaction log in the transaction log reconciliation table, or if the data comparison result indicates that the business data in the first application business table and the second application business table are inconsistent, then the monitoring result is determined to be that the data in the platform database and the host database are inconsistent.
[0044] In one embodiment, the compensation module is specifically used for:
[0045] If the monitoring results indicate that there is a transaction log reconciliation table with missing logs, then the application business table corresponding to the transaction log reconciliation table with missing logs shall be used as the application business table to be corrected, and the application business table corresponding to the transaction log reconciliation table with existing log records shall be used as the reference application business table.
[0046] If the monitoring result indicates that the business data is inconsistent and the transaction status corresponding to the inconsistent business data in the first transaction log reconciliation table is successful, then the second application business table will be used as the application business table to be corrected and the first application business table will be used as the reference application business table.
[0047] If the monitoring results indicate that the business data is inconsistent and the transaction status corresponding to the inconsistent business data in the first transaction log reconciliation table is unsuccessful, then the first application business table will be used as the application business table to be corrected, and the second application business table will be used as the reference application business table.
[0048] In one embodiment, both the first application business table and the second application business table include data changes in the application business table; the comparison module is specifically used for:
[0049] According to a preset time interval, the first data change amount in the first application business table, the second data change amount in the second application business table, and the acquisition time are obtained; the acquisition time is the time when the data change amounts in the first application business table and the second application business table are obtained.
[0050] The data change comparison result is determined based on the first data change and the second data change corresponding to each acquisition time.
[0051] If the data change comparison result indicates that the data change amounts of the first application business table and the second application business table are consistent, then the business data in the first application business table and the second application business table are compared to obtain the data comparison result.
[0052] In one embodiment, the comparison module is specifically used for:
[0053] For each acquisition time, the first data change and the second data change corresponding to the acquisition time are compared to obtain the first initial comparison result;
[0054] Based on the acquisition time, multiple comparison time groups are determined; each comparison time group includes a first comparison time and a second comparison time.
[0055] For each comparison time group, calculate the first difference between the first data change corresponding to the first comparison time in the comparison time group and the first data change corresponding to the second comparison time in the comparison time group, and calculate the second difference between the second data change corresponding to the first comparison time in the comparison time group and the second data change corresponding to the second comparison time in the comparison time group.
[0056] The second initial comparison result is determined based on the first difference and the second difference corresponding to each comparison time group;
[0057] Based on the first initial comparison result and the second initial comparison result, the data change comparison result is determined.
[0058] In one embodiment, when the monitoring results indicate inconsistent data, the device further includes:
[0059] The determination module is used to determine the target data type of inconsistent business data;
[0060] The query module is used to query the target alarm level corresponding to the target data type in a preset mapping relationship between data types and alarm levels, and output the alarm information corresponding to the target alarm level.
[0061] Thirdly, this application also provides a computer device. The computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the steps described in the first aspect.
[0062] Fourthly, this application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program thereon, which, when executed by a processor, performs the steps described in the first aspect.
[0063] Fifthly, this application also provides a computer program product. The computer program product includes a computer program that, when executed by a processor, implements the steps described in the first aspect.
[0064] The aforementioned data synchronization method, apparatus, computer equipment, storage medium, and computer program product acquire a first application business table and a first transaction log reconciliation table in the platform database, and a second application business table and a second transaction log reconciliation table in the host database. The first application business table and the second application business table are used to record transaction-related business data. The first transaction log reconciliation table and the second transaction log reconciliation table are used to record the transaction status of each transaction. The log data in the first transaction log reconciliation table and the second transaction log reconciliation table are compared to obtain a log comparison result. Based on a preset comparison rule, the business data in the first application business table and the second application business table are compared to obtain a data comparison result. Based on the log comparison result, the data comparison result, and a preset data compensation mechanism, data compensation processing is performed on the platform database or the host database. In this way, not only are the transaction log reconciliation tables in the platform database and the host database used to record the transaction status of each transaction compared, but also the application business tables in the platform database and the host database used to record transaction-related business data are compared. Based on the two comparison results, a data compensation strategy is determined. For one of the data write failures during the dual data write process between the platform database and the host database, data compensation processing is performed. This ensures data consistency between the host database and the platform database during the dynamic dual data write process between the platform database and the host database, ensuring the normal operation of transactions. Attached Figure Description
[0065] Figure 1 This is a flowchart illustrating a data synchronization method in one embodiment;
[0066] Figure 2 This is a flowchart illustrating the data compensation processing steps in one embodiment;
[0067] Figure 3 This is a flowchart illustrating the steps for determining monitoring results in one embodiment;
[0068] Figure 4 This is a flowchart illustrating the steps of determining the reference application service table and the application service table to be modified in one embodiment.
[0069] Figure 5 This is a flowchart illustrating the steps for determining data comparison results in one embodiment;
[0070] Figure 6 This is a flowchart illustrating the steps for determining the comparison results of data changes in one embodiment.
[0071] Figure 7 This is a flowchart illustrating the data synchronization method in another embodiment;
[0072] Figure 8This is a structural block diagram of a data synchronization device in one embodiment;
[0073] Figure 9 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation
[0074] 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.
[0075] In one embodiment, such as Figure 1 As shown, a data synchronization method is provided. This embodiment illustrates the application of this method to a terminal. It is understood that this method can also be applied to a server, and to a system including both a terminal and a server, and is implemented through interaction between the terminal and the server. This method can be applied to distributed systems. Distributed systems can be implemented through cloud computing platforms. For example, distributed systems can be implemented through Platform as a Service (PaaS). The terminal can be, but is not limited to, various personal computers, laptops, smartphones, tablets, IoT devices, and portable wearable devices. IoT devices can include smart speakers, smart TVs, smart air conditioners, smart in-vehicle devices, etc. Portable wearable devices can include smartwatches, smart bracelets, head-mounted devices, etc. The server can be implemented using a standalone server or a server cluster composed of multiple servers. In this embodiment, the method includes the following steps:
[0076] Step 101: Obtain the first application business table and the first transaction log reconciliation table from the platform database, and the second application business table and the second transaction log reconciliation table from the host database.
[0077] The first application business table and the second application business table are used to record transaction-related business data. The first transaction log reconciliation table and the second transaction log reconciliation table are used to record the transaction status of each transaction.
[0078] In this embodiment, the terminal obtains the first application business table and the first transaction log reconciliation table from the platform database, and the second application business table and the second channel log reconciliation table from the host database. Specifically, the terminal collects the first application business table and the first transaction log reconciliation table from the platform database. Simultaneously, the terminal collects the second application business table and the second channel log reconciliation table from the host database.
[0079] The platform database is the database of the platform. It can be a distributed system, implemented through a cloud computing platform. For example, a distributed system can be implemented using Platform as a Service (PaaS). The host database is the database of the host machine. The host machine can be a mainframe, comprising multiple servers. For example, transaction-related business data can include account balances and transaction records. The first application business table of the platform database includes the first application business sub-tables corresponding to each database cluster of the platform. The first transaction log reconciliation table of the platform database includes the first transaction log reconciliation sub-tables corresponding to each database cluster of the platform. The first transaction log reconciliation table is also known as the first channel log reconciliation table, and the second transaction log reconciliation table is also known as the second channel log reconciliation table.
[0080] In one example, the terminal collects the first application business sub-table and the first transaction log reconciliation sub-table corresponding to each database cluster of the platform. Then, the terminal merges the first application business sub-tables corresponding to each database cluster into the first application business table of the platform database. At the same time, the terminal merges the first transaction log reconciliation sub-tables corresponding to each database cluster into the first transaction log reconciliation table of the platform database.
[0081] Step 102: Compare the log data in the first transaction log reconciliation table and the second transaction log reconciliation table to obtain the log comparison result. Then, according to the preset comparison rules, compare the business data in the first application business table and the second application business table to obtain the data comparison result.
[0082] In this embodiment, the terminal compares log data in the first transaction log reconciliation table and the second transaction log reconciliation table to obtain a log comparison result. Then, the terminal compares business data in the first application business table and the second application business table according to preset comparison rules to obtain a data comparison result. The log data represents the transaction status of each transaction. The log comparison result indicates whether the log data in the first transaction log reconciliation table and the second transaction log reconciliation table are consistent. The data comparison result indicates whether the business data in the first application business table and the second application business table are consistent.
[0083] In one example, the terminal converts the first application business table and the first transaction log reconciliation table in the platform database, as well as the second application business table and the second transaction log reconciliation table in the host database, into file formats respectively. Then, the terminal compares the log data in the file-formatted first transaction log reconciliation table and the file-formatted second transaction log reconciliation table to obtain a log comparison result. Next, the terminal compares the business data in the file-formatted first application business table and the file-formatted second application business table according to preset comparison rules to obtain a data comparison result. The file format can be either a spreadsheet (EXCEL) format or a text format.
[0084] Step 103: Perform data compensation processing on the platform database or host database based on the log comparison results, data comparison results, and the preset data compensation mechanism.
[0085] In this embodiment, the terminal determines whether the platform database and the host database are consistent based on log comparison results and data comparison results. If the platform database and the host database are inconsistent, the terminal determines the database to be corrected based on the log comparison results and data comparison results. Then, the terminal performs data compensation processing on the database to be corrected based on a preset data compensation mechanism. The database to be corrected is the database that needs data correction, which can be one of the databases that failed to write data during the dual-write process between the platform database and the host database.
[0086] In one embodiment, the terminal determines the monitoring result based on log comparison results and data comparison results. The monitoring result includes seven flag bits, the meaning of which is shown in Table 1. Then, the terminal queries the target data compensation strategy corresponding to the target flag bit included in the monitoring result from a preset mapping relationship between flag bits and data compensation strategies. Finally, the terminal performs data compensation processing on the platform database or host database according to the target data compensation strategy. The mapping relationship between flag bits and data compensation strategies is shown in Table 2.
[0087] Table 1. Meaning of Flags
[0088]
[0089]
[0090] Table 2. Mapping Relationship between Flag Bits and Data Compensation Strategies
[0091] Flag Data compensation strategy s0001 Restore the records from the platform application business table to the host table. s0002 Replenish the records from the host application business table to the platform table. s0003 Based on the host, the records of the host application business table are added back to the platform table. s0004 No adjustment required s0005 No adjustment required s0006 Based on the platform, the records from the platform application business table are added back to the host table. s0007 No adjustment required s0008 Based on the host, the records of the host application business table are added back to the platform table. s0009 No adjustment required
[0092] The aforementioned data synchronization method not only compares the transaction log reconciliation tables in the platform database and the host database that record the transaction status of each transaction, but also compares the application business tables in the platform database and the host database that record transaction-related business data. Based on the two comparison results, a data compensation strategy is determined. For one of the data write failures during the dual-write process between the platform database and the host database, data compensation processing is performed. This ensures data consistency between the host database and the platform database during the dynamic dual-write process between the platform database and the host database, thus ensuring the normal operation of transactions.
[0093] In one embodiment, such as Figure 2As shown, the specific process of performing data compensation processing on the platform database or host database based on log comparison results, data comparison results, and a preset data compensation mechanism includes the following steps:
[0094] Step 201: Determine the monitoring results based on the log comparison results and the data comparison results.
[0095] The monitoring results indicate whether the platform database and the host database are consistent.
[0096] In this embodiment, the terminal determines the monitoring result based on the log comparison result and the data comparison result. The monitoring result may include a monitoring identifier and a monitoring type identifier. The monitoring identifier indicates whether the platform database and the host database are consistent. The monitoring type identifier indicates the monitoring type. The monitoring type is the type of inconsistency between the platform database and the host database. The monitoring type may include a first monitoring type, a second monitoring type, and a third monitoring type. The first monitoring type is a transaction log reconciliation table with a missing log entry. The second monitoring type is a transaction with inconsistent business data, where the inconsistent business data in the first transaction log reconciliation table corresponds to a successful transaction. The third monitoring type is a transaction with inconsistent business data, where the inconsistent business data in the first transaction log reconciliation table corresponds to a unsuccessful transaction.
[0097] In one example, if the log comparison result indicates that the log data in the first transaction log reconciliation table and the second transaction log reconciliation table are inconsistent, the terminal determines the monitoring identifier as an identifier indicating whether the platform database and the host database have inconsistent data. Simultaneously, the terminal determines the monitoring type identifier as an identifier indicating that the monitoring type is the first monitoring type. If the log comparison result indicates that the log data in the first transaction log reconciliation table and the second transaction log reconciliation table are consistent, and the data comparison result indicates that the business data in the first application business table and the second application business table are consistent, the terminal determines the monitoring identifier as an identifier indicating whether the platform database and the host database have consistent data. Simultaneously, the terminal determines the monitoring type identifier as an empty identifier. If the log comparison result indicates that the log data in the first transaction log reconciliation table and the second transaction log reconciliation table are consistent, and the data comparison result indicates that the business data in the first application business table and the second application business table are inconsistent, the terminal determines the monitoring identifier as an identifier indicating that the platform database and the host database have inconsistent data. Then, based on the transaction status corresponding to the inconsistent business data in the first transaction log reconciliation table of the platform database, the terminal determines the monitoring type identifier. Finally, the terminal combines the monitoring identifier and the monitoring type identifier to form the monitoring result.
[0098] Step 202: If the monitoring results indicate that the data in the platform database and the host database are inconsistent, determine the reference application business table and the application business table to be corrected based on the monitoring results and the preset data compensation mechanism.
[0099] In this embodiment, when monitoring results indicate inconsistency between the platform database and the host database, the terminal determines a reference application service table and a table to be corrected based on the monitoring results and a preset data compensation mechanism. The table to be corrected is the application service table that requires data correction. This table can be the application service table of the database to be corrected, or it can be the application service table of the database that failed to write during the dual-write process between the platform database and the host database—that is, one of the application service tables of the platform database and the host database. The reference application service table is the application service table that needs to be referenced when performing data correction or data compensation. The data compensation mechanism represents the rules for compensating the database that failed to write during the dual-write process between the platform database and the host database.
[0100] In one example, when the monitoring results indicate that the platform database and the host database are inconsistent, the terminal determines the reference application business table and the application business table to be corrected based on the log comparison results, the first transaction log reconciliation table, and the preset data compensation mechanism.
[0101] Step 203: Update the application business table to be corrected based on the transaction data in the reference application business table.
[0102] In this embodiment of the application, the terminal updates the application service table to be corrected based on the transaction data in the reference application service table.
[0103] In the aforementioned data synchronization method, monitoring results are determined based on log comparison and data comparison results. When the monitoring results indicate inconsistency between the platform database and the host database, a reference application business table and a table to be corrected are identified based on the monitoring results and a pre-set data compensation mechanism. The table to be corrected is then updated based on the transaction data in the reference application business table. This allows for real-time monitoring of data consistency between the platform and host databases during dynamic dual-write operations, promptly detecting write failures in one database and improving the timeliness of data monitoring during dynamic dual-write operations. Furthermore, in cases of data inconsistency, identifying the reference and corrected application business tables determines the target and basis for data compensation, covering erroneous data with accurate data, and achieving real-time data correction for databases with write errors during dual-write operations. This improves the timeliness and accuracy of data synchronization during dynamic dual-write operations between the platform and host databases, further ensuring data consistency between the host and platform databases and guaranteeing normal transaction operation.
[0104] In one embodiment, such as Figure 3As shown, the specific process of determining the monitoring results based on log comparison results and data comparison results includes the following steps:
[0105] Step 301: If the log comparison result indicates that there are records in both the first transaction log reconciliation table and the second transaction log reconciliation table, and the data comparison result indicates that the business data in the first application business table and the second application business table are consistent, then the monitoring result is determined to be that the platform database and the host database data are consistent.
[0106] In this embodiment of the application, if the log comparison result indicates that there are records in both the first transaction log reconciliation table and the second transaction log reconciliation table, and the data comparison result indicates that the business data in the first application business table and the second application business table are consistent, then the terminal determines that the monitoring result is that the data in the platform database and the host database are consistent.
[0107] Step 302: If the log comparison result indicates that there is a missing transaction log in the transaction log reconciliation table, or the data comparison result indicates that the business data in the first application business table and the second application business table are inconsistent, then the monitoring result is determined to be that the platform database and the host database are inconsistent.
[0108] In this embodiment of the application, if the log comparison result indicates that there is a missing transaction log in the transaction log reconciliation table, or the data comparison result indicates that the business data in the first application business table and the second application business table are inconsistent, then the terminal determines that the monitoring result is that the platform database and the host database are inconsistent.
[0109] In the aforementioned data synchronization method, if the log comparison result indicates that transaction logs exist in both the first and second transaction log reconciliation tables, and the data comparison result indicates that the business data in the first and second application business tables is consistent, then the monitoring result is determined to be that the platform database and the host database are consistent. If the log comparison result indicates that some transaction logs are missing in the transaction log reconciliation table, or the data comparison result indicates that the business data in the first and second application business tables is inconsistent, then the monitoring result is determined to be that the platform database and the host database are inconsistent. Thus, during the dynamic dual-write process between the platform database and the host database, only when the log comparison result indicates that transaction logs exist in both the first and second transaction log reconciliation tables, and the data comparison result indicates that the business data in the first and second application business tables is consistent, is the platform database and the host database considered consistent. This further improves the accuracy of data monitoring and the timeliness of data synchronization during the dynamic dual-write process between the platform database and the host database, further ensures the data consistency between the host database and the platform database, and further ensures the normal operation of transactions.
[0110] In one embodiment, such as Figure 4As shown, the specific process of determining the reference application business table and the application business table to be corrected based on the monitoring results and the preset data compensation mechanism includes the following steps:
[0111] Step 401: If the monitoring results indicate that there is a transaction log reconciliation table with missing logs, then the application business table corresponding to the transaction log reconciliation table with missing logs is taken as the application business table to be corrected, and the application business table corresponding to the transaction log reconciliation table with existing log records is taken as the reference application business table.
[0112] In this embodiment, if the monitoring results indicate the existence of a transaction log reconciliation table with missing logs, the terminal will use the application business table corresponding to the transaction log reconciliation table with missing logs as the application business table to be corrected. Simultaneously, the terminal will use the application business table corresponding to the transaction log reconciliation table with existing log records as the reference application business table.
[0113] Step 402: If the monitoring results indicate that the business data is inconsistent and the transaction status corresponding to the inconsistent business data in the first transaction log reconciliation table is successful, then the second application business table is used as the application business table to be corrected, and the first application business table is used as the reference application business table.
[0114] In this embodiment, if the monitoring result indicates that the business data is inconsistent, and the transaction status corresponding to the inconsistent business data in the first transaction log reconciliation table is successful, then the terminal uses the second application business table as the application business table to be corrected. Simultaneously, the terminal uses the first application business table as the reference application business table.
[0115] Step 403: If the monitoring results indicate that the business data is inconsistent and the transaction status corresponding to the inconsistent business data in the first transaction log reconciliation table is unsuccessful, then the first application business table is designated as the application business table to be corrected, and the second application business table is designated as the reference application business table.
[0116] In this embodiment, if the monitoring result indicates that the business data is inconsistent and the transaction status corresponding to the inconsistent business data in the first transaction log reconciliation table is unsuccessful, the terminal will use the first application business table as the application business table to be corrected. Simultaneously, the terminal will use the second application business table as the reference application business table.
[0117] In the above data synchronization method, if the monitoring result indicates that there is a transaction log reconciliation table with missing logs, then the application business table corresponding to the transaction log reconciliation table with missing logs is designated as the application business table to be corrected, and the application business table corresponding to the transaction log reconciliation table with existing log records is designated as the reference application business table. If the monitoring result indicates that the business data is inconsistent, and the transaction status corresponding to the inconsistent business data in the first transaction log reconciliation table is successful, then the second application business table is designated as the application business table to be corrected, and the first application business table is designated as the reference application business table. If the monitoring result indicates that the business data is inconsistent, and the transaction status corresponding to the inconsistent business data in the first transaction log reconciliation table is unsuccessful, then the first application business table is designated as the application business table to be corrected, and the second application business table is designated as the reference application business table. In this way, during the dynamic dual-write process between the platform database and the host database, the application business tables in the database with missing logs are designated as application business tables to be corrected, while the application business tables in the database with complete logs are designated as reference application business tables. Furthermore, when business data is inconsistent, the application business tables in the platform database are only designated as reference application business tables if the transaction status in the platform database is successful; otherwise, the application business tables in the host database are designated as reference application business tables. This approach not only considers the actual situation of dual-write but also aligns with the more stable characteristics of the host database compared to the platform database. This further improves the accuracy of data synchronization during dynamic dual-write between the platform database and the host database, further ensures data consistency between the host database and the platform database, and further guarantees the normal operation of transactions.
[0118] In one embodiment, both the first application business table and the second application business table include the data changes in the application business table. For example... Figure 5 As shown, the specific process of comparing business data in the first application business table and the second application business table according to preset comparison rules to obtain data comparison results includes the following steps:
[0119] Step 501: According to a preset time interval, obtain the first data change amount in the first application business table, the second data change amount in the second application business table, and the acquisition time.
[0120] The acquisition time refers to the time when the data changes in the first application business table and the second application business table are acquired.
[0121] In this embodiment, the terminal acquires the first data change amount in the first application business table and the second data change amount in the second application business table at preset time intervals. Simultaneously, the terminal records the acquisition time of the first and second data change amounts. The time interval can be one hour. Both the first and second data change amounts can include a first type of change amount and a second type of change amount. The first type of change amount includes the number of insertions, deletions, and updates in the application business table. The second type of change amount includes the total number of records in the application business table.
[0122] Step 502: Determine the data change comparison result based on the first data change and the second data change corresponding to each acquisition time.
[0123] In this embodiment, the terminal determines the data change comparison result based on the first and second data change amounts corresponding to each acquisition time. The data change comparison result indicates whether the data change amounts in the first and second application business tables are consistent. It is understood that the terminal can compare the first and second types of change amounts separately during the specific process of comparing data change amounts. Specifically, in comparing the first type of change amounts, the terminal can either compare the insertion, deletion, and update amounts of the application business table separately, or calculate the sum of the insertion, deletion, and update amounts of the application business table and compare the resulting sum.
[0124] In one example, for each acquisition time, the terminal compares the first data change and the second data change corresponding to that acquisition time to obtain the data change quantum result for that acquisition time. Then, based on the data change quantum results corresponding to each acquisition time, the terminal determines the data change comparison result. Specifically, the terminal can construct the data change comparison result from the data change quantum results corresponding to each acquisition time.
[0125] Step 503: If the data change comparison result indicates that the data change of the first application business table and the second application business table are consistent, then compare the business data in the first application business table and the second application business table to obtain the data comparison result.
[0126] In this embodiment of the application, if the data change comparison result indicates that the data change of the first application business table and the second application business table are consistent, the terminal compares the business data in the first application business table and the second application business table to obtain the data comparison result.
[0127] In the aforementioned data synchronization method, the first data change amount in the first application business table, the second data change amount in the second application business table, and the acquisition time are obtained at preset time intervals. Based on the first and second data change amounts corresponding to each acquisition time, a data change comparison result is determined. If the data change comparison result indicates that the data change amounts in the first and second application business tables are consistent, the business data in the first and second application business tables are compared to obtain the data comparison result. In this way, by periodically acquiring the data change amounts and corresponding acquisition times of the platform database and the host database, first comparing the data change amounts in the application business tables, and then comparing the specific content of the application business tables when the data change amounts are consistent, by prioritizing the comparison of data change amounts with lower computational complexity, obvious data inconsistencies between the platform database and the host database can be quickly identified. This further improves the timeliness of data monitoring for dynamic dual-write operations between the platform database and the host database, further ensures data consistency between the host database and the platform database, and further ensures the normal operation of transactions.
[0128] In one embodiment, such as Figure 6 As shown, the specific process of determining the data change comparison result based on the first and second data changes corresponding to each acquisition time includes the following steps:
[0129] Step 601: For each acquisition time, compare the first data change and the second data change corresponding to that acquisition time to obtain the first initial comparison result.
[0130] In this embodiment, for each acquisition time, the terminal compares the first data change and the second data change corresponding to that acquisition time to obtain a first initial comparison result for that acquisition time. Then, the terminal combines the first initial comparison results for each acquisition time to form a first initial comparison result. The first initial comparison result indicates whether the first data change and the second data change are consistent for any given acquisition time.
[0131] Step 602: Based on each acquisition time, determine multiple comparison time groups.
[0132] The comparison time group includes the first comparison time and the second comparison time.
[0133] In this embodiment, the terminal determines multiple comparison time groups based on each acquisition time. Specifically, the terminal determines multiple first comparison times within each acquisition time. For each first comparison time, the terminal determines multiple second comparison times corresponding to the first comparison time within each acquisition time. Within the same comparison time group, the first comparison time and the second comparison time are different.
[0134] Step 603: For each comparison time group, calculate the first difference between the first data change corresponding to the first comparison time in the comparison time group and the first data change corresponding to the second comparison time in the comparison time group, and calculate the second difference between the second data change corresponding to the first comparison time in the comparison time group and the second data change corresponding to the second comparison time in the comparison time group.
[0135] In this embodiment, for each comparison time group, the terminal calculates a first difference between the first data change corresponding to the first comparison time in the comparison time group and the first data change corresponding to the second comparison time in the comparison time group. Then, the terminal calculates a second difference between the second data change corresponding to the first comparison time in the comparison time group and the second data change corresponding to the second comparison time in the comparison time group.
[0136] Step 604: Determine the second initial alignment result based on the first difference and the second difference corresponding to each alignment time group.
[0137] In this embodiment, the terminal determines a second initial comparison result based on the first difference and the second difference corresponding to each comparison time group. The second initial comparison result indicates whether the increment of the first data change and the increment of the second data change are consistent within any given comparison time group.
[0138] Specifically, for each alignment time group, the terminal compares the first difference and the second difference corresponding to that alignment time group to obtain the second initial alignment sub-result for that alignment time group. Then, based on the second initial alignment sub-result for each alignment time group, the terminal determines the second initial alignment result.
[0139] In one example, the terminal uses the second initial alignment sub-results corresponding to each alignment time group to form the second initial alignment result.
[0140] In one example, if the second initial comparison results for each comparison time group all indicate that the first difference and the second difference are equal, then the terminal determines that the second initial comparison result is that the increment of the first data change and the increment of the second data change are consistent within any comparison time group. If the second initial comparison results for any comparison time group all indicate that the first difference and the second difference are not equal, then the terminal determines that the second initial comparison result is that the increment of the first data change and the increment of the second data change are not consistent within any comparison time group.
[0141] Step 605: Determine the data change comparison result based on the first initial comparison result and the second initial comparison result.
[0142] In this embodiment of the application, the terminal determines the data change comparison result based on the first initial comparison result and the second initial comparison result.
[0143] In one example, the terminal combines the first initial comparison result and the second initial comparison result to form the data change comparison result.
[0144] In one example, if the first initial comparison result indicates that the first data change and the second data change are consistent at any given time, and the second initial comparison result indicates that the increment of the first data change and the increment of the second data change are consistent within any given comparison time group, then the terminal determines that the data change comparison result is consistent between the first application business table and the second application business table. If the first initial comparison result indicates that the first data change and the second data change are not consistent at any given time, or the second initial comparison result indicates that the increment of the first data change and the increment of the second data change are not consistent within any given comparison time group, then the terminal determines that the data change comparison result is inconsistent between the first application business table and the second application business table.
[0145] In the above data synchronization method, for each acquisition time, the first data change and the second data change corresponding to that acquisition time are compared to obtain a first initial comparison result; based on each acquisition time, multiple comparison time groups are determined; for each comparison time group, a first difference is calculated between the first data change corresponding to the first comparison time in that comparison time group and the first data change corresponding to the second comparison time in that comparison time group, and a second difference is calculated between the second data change corresponding to the first comparison time in that comparison time group and the second data change corresponding to the second comparison time in that comparison time group; based on the first difference and the second difference corresponding to each comparison time group, a second initial comparison result is determined; based on the first initial comparison result and the second initial comparison result, a data change comparison result is determined. In this way, not only is the first and second data changes compared at any given time consistent, but the increments of the first and second data changes within any given comparison time group are also compared. By comprehensively comparing the data changes at specific time points and the increments of data changes over time periods, the accuracy of data change comparison in data monitoring is further improved. This further enhances the accuracy and timeliness of data monitoring for dynamic dual-write operations between the platform database and the host database, further ensures data consistency between the host database and the platform database, and further guarantees the normal operation of transactions.
[0146] In one embodiment, such as Figure 7 As shown, when monitoring results indicate data inconsistency, the data synchronization method also includes the following steps:
[0147] Step 701: Determine the target data type of the inconsistent business data.
[0148] In this embodiment, the terminal determines the target data type of the inconsistent business data. The target data type is the data type of the inconsistent business data. The data type may include a first data type and a second data type. The first data type may be a type of data related to the transaction itself. The second data type may be a type of data not related to the transaction itself. For example, the first data type may be an amount, and the second data type may be a user's occupation.
[0149] Step 702: In the preset mapping relationship between data types and alarm levels, query the target alarm level corresponding to the target data type, and output the alarm information corresponding to the target alarm level.
[0150] In this embodiment, within a preset mapping relationship between data types and alarm levels, the terminal queries the target alarm level corresponding to the target data type. Then, based on the inconsistent business data and alarm level, the terminal generates alarm information corresponding to the target alarm level. Finally, the terminal outputs the alarm information corresponding to the target alarm level. Here, the alarm level indicates the importance of the alarm information.
[0151] In one example, the terminal can output alarm information corresponding to the target alarm level through output methods such as display interface, email, and / or SMS notification.
[0152] In one example, the system queries the target output method corresponding to the target alarm level from a preset mapping relationship between alarm levels and output methods. Then, the terminal outputs the alarm information corresponding to the target alarm level using the target output method. For example, the target data type is a first data type, and the target output method is SMS notification. The target data type is a second data type, and the target output method is email sending.
[0153] In the aforementioned data synchronization method, the target data type of inconsistent business data is determined. Within a pre-defined mapping relationship between data types and alert levels, the target alert level corresponding to the target data type is queried, and the corresponding alert information is output. Thus, based on the target data type of the inconsistent business data, the target alert level for the inconsistent business data is determined, and the corresponding alert information is output. Different alert methods are used for write error data of varying importance, further improving the accuracy of data monitoring for dynamic dual-write operations between the platform database and the host database, further ensuring data consistency between the host database and the platform database, and further ensuring the normal operation of transactions.
[0154] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.
[0155] Based on the same inventive concept, this application also provides a data synchronization device for implementing the data synchronization method described above. The solution provided by this device is similar to the implementation described in the above method; therefore, the specific limitations in one or more data synchronization device embodiments provided below can be found in the limitations of the data synchronization method described above, and will not be repeated here.
[0156] In one embodiment, such as Figure 8 As shown, a data synchronization device 800 is provided, including: an acquisition module 810, a comparison module 820, and a compensation module 830, wherein:
[0157] The acquisition module 810 is used to acquire the first application business table and the first transaction log reconciliation table of the platform database, and the second application business table and the second transaction log reconciliation table of the host database; the first application business table and the second application business table are used to record business data related to transactions; the first transaction log reconciliation table and the second transaction log reconciliation table are used to record the transaction status of each transaction;
[0158] The comparison module 820 is used to compare the log data in the first transaction log reconciliation table and the second transaction log reconciliation table to obtain the log comparison result, and to compare the business data in the first application business table and the second application business table according to the preset comparison rules to obtain the data comparison result.
[0159] The compensation module 830 is used to perform data compensation processing on the platform database or the host database based on the log comparison results, the data comparison results and the preset data compensation mechanism.
[0160] Optionally, the compensation module 830 is specifically used for:
[0161] The monitoring results are determined based on the log comparison results and the data comparison results; the monitoring results indicate whether the platform database and the host database are consistent.
[0162] If the monitoring results indicate that the data in the platform database and the host database are inconsistent, a reference application business table and an application business table to be corrected shall be determined based on the monitoring results and a preset data compensation mechanism.
[0163] Update the application business table to be corrected based on the transaction data in the reference application business table.
[0164] Optionally, the compensation module 830 is specifically used for:
[0165] If the log comparison result indicates that there are records in both the first transaction log reconciliation table and the second transaction log reconciliation table, and the data comparison result indicates that the business data in the first application business table and the second application business table are consistent, then the monitoring result is determined to be that the data in the platform database and the host database are consistent.
[0166] If the log comparison result indicates that there is a missing transaction log in the transaction log reconciliation table, or if the data comparison result indicates that the business data in the first application business table and the second application business table are inconsistent, then the monitoring result is determined to be that the data in the platform database and the host database are inconsistent.
[0167] Optionally, the compensation module 830 is specifically used for:
[0168] If the monitoring results indicate that there is a transaction log reconciliation table with missing logs, then the application business table corresponding to the transaction log reconciliation table with missing logs shall be used as the application business table to be corrected, and the application business table corresponding to the transaction log reconciliation table with existing log records shall be used as the reference application business table.
[0169] If the monitoring result indicates that the business data is inconsistent and the transaction status corresponding to the inconsistent business data in the first transaction log reconciliation table is successful, then the second application business table will be used as the application business table to be corrected and the first application business table will be used as the reference application business table.
[0170] If the monitoring results indicate that the business data is inconsistent and the transaction status corresponding to the inconsistent business data in the first transaction log reconciliation table is unsuccessful, then the first application business table will be used as the application business table to be corrected, and the second application business table will be used as the reference application business table.
[0171] Optionally, both the first application business table and the second application business table include the data change amount of the application business table; the comparison module 820 is specifically used for:
[0172] According to a preset time interval, the first data change amount in the first application business table, the second data change amount in the second application business table, and the acquisition time are obtained; the acquisition time is the time when the data change amounts in the first application business table and the second application business table are obtained.
[0173] The data change comparison result is determined based on the first data change and the second data change corresponding to each acquisition time.
[0174] If the data change comparison result indicates that the data change amounts of the first application business table and the second application business table are consistent, then the business data in the first application business table and the second application business table are compared to obtain the data comparison result.
[0175] Optionally, the comparison module 820 is specifically used for:
[0176] For each acquisition time, the first data change and the second data change corresponding to the acquisition time are compared to obtain the first initial comparison result;
[0177] Based on the acquisition time, multiple comparison time groups are determined; each comparison time group includes a first comparison time and a second comparison time.
[0178] For each comparison time group, calculate the first difference between the first data change corresponding to the first comparison time in the comparison time group and the first data change corresponding to the second comparison time in the comparison time group, and calculate the second difference between the second data change corresponding to the first comparison time in the comparison time group and the second data change corresponding to the second comparison time in the comparison time group.
[0179] The second initial comparison result is determined based on the first difference and the second difference corresponding to each comparison time group;
[0180] Based on the first initial comparison result and the second initial comparison result, the data change comparison result is determined.
[0181] Optionally, in cases where the monitoring results indicate inconsistent data, the device 800 further includes:
[0182] The determination module is used to determine the target data type of inconsistent business data;
[0183] The query module is used to query the target alarm level corresponding to the target data type in a preset mapping relationship between data types and alarm levels, and output the alarm information corresponding to the target alarm level.
[0184] Each module in the aforementioned data synchronization device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the corresponding operations of each module.
[0185] In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 9 As shown, the computer device includes a processor, memory, input / output interfaces, a communication interface, a display unit, and an input device. The processor, memory, and input / output interfaces are connected via a system bus, and the communication interface, display unit, and input device are also connected to the system bus via the input / output interfaces. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The input / output interfaces are used for exchanging information between the processor and external devices. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, NFC (Near Field Communication), or other technologies. When the computer program is executed by the processor, it implements a data synchronization method. The display unit is used to form a visually visible image and can be a display screen, a projection device, or a virtual reality imaging device. The display screen can be an LCD screen or an e-ink screen. The input device of the computer device can be a touch layer covering the display screen, or buttons, trackballs, or touchpads set on the casing of the computer device, or external keyboards, touchpads, or mice, etc.
[0186] Those skilled in the art will understand that Figure 9 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0187] In one embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above-described method embodiments.
[0188] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the steps in the above method embodiments.
[0189] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above method embodiments.
[0190] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data shall comply with the relevant laws, regulations and standards of the relevant countries and regions.
[0191] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.
[0192] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0193] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A data synchronization method, characterized in that, The method includes: Obtain the first application business table and the first transaction log reconciliation table from the platform database, and the second application business table and the second transaction log reconciliation table from the host database; the first application business table and the second application business table are used to record transaction-related business data; the first transaction log reconciliation table and the second transaction log reconciliation table are used to record the transaction status of each transaction; The log data in the first transaction log reconciliation table and the second transaction log reconciliation table are compared to obtain the log comparison result. The business data in the first application business table and the second application business table are compared according to the preset comparison rules to obtain the data comparison result. Based on the log comparison results, the data comparison results, and the preset data compensation mechanism, data compensation processing is performed on the platform database or the host database; The step of performing data compensation processing on the platform database or the host database based on the log comparison results, the data comparison results, and the preset data compensation mechanism includes: The monitoring results are determined based on the log comparison results and the data comparison results; the monitoring results indicate whether the platform database and the host database are consistent. If the monitoring results indicate that the data in the platform database and the host database are inconsistent, a reference application business table and an application business table to be corrected shall be determined based on the monitoring results and a preset data compensation mechanism. Update the application business table to be corrected based on the transaction data in the reference application business table; The step of determining the reference application service table and the application service table to be corrected based on the monitoring results and the preset data compensation mechanism includes: If the monitoring results indicate that there is a transaction log reconciliation table with missing logs, then the application business table corresponding to the transaction log reconciliation table with missing logs shall be used as the application business table to be corrected, and the application business table corresponding to the transaction log reconciliation table with existing log records shall be used as the reference application business table. If the monitoring result indicates that the business data is inconsistent and the transaction status corresponding to the inconsistent business data in the first transaction log reconciliation table is successful, then the second application business table will be used as the application business table to be corrected and the first application business table will be used as the reference application business table. If the monitoring results indicate that the business data is inconsistent and the transaction status corresponding to the inconsistent business data in the first transaction log reconciliation table is unsuccessful, then the first application business table will be used as the application business table to be corrected, and the second application business table will be used as the reference application business table.
2. The method according to claim 1, characterized in that, The step of determining the monitoring results based on the log comparison results and the data comparison results includes: If the log comparison result indicates that there are records in both the first transaction log reconciliation table and the second transaction log reconciliation table, and the data comparison result indicates that the business data in the first application business table and the second application business table are consistent, then the monitoring result is determined to be that the data in the platform database and the host database are consistent. If the log comparison result indicates that there is a missing transaction log in the transaction log reconciliation table, or if the data comparison result indicates that the business data in the first application business table and the second application business table are inconsistent, then the monitoring result is determined to be that the data in the platform database and the host database are inconsistent.
3. The method according to claim 1, characterized in that, Both the first application business table and the second application business table include the data change amount of the application business table; the step of comparing the business data in the first application business table and the second application business table according to the preset comparison rules to obtain the data comparison result includes: According to a preset time interval, the first data change amount in the first application business table, the second data change amount in the second application business table, and the acquisition time are obtained; the acquisition time is the time when the data change amounts in the first application business table and the second application business table are obtained. The data change comparison result is determined based on the first data change and the second data change corresponding to each acquisition time. If the data change comparison result indicates that the data change amounts of the first application business table and the second application business table are consistent, then the business data in the first application business table and the second application business table are compared to obtain the data comparison result.
4. The method according to claim 3, characterized in that, The step of determining the data change comparison result based on the first data change and the second data change corresponding to each acquisition time includes: For each acquisition time, the first data change and the second data change corresponding to the acquisition time are compared to obtain the first initial comparison result; Based on the acquisition time, multiple comparison time groups are determined; each comparison time group includes a first comparison time and a second comparison time. For each comparison time group, calculate the first difference between the first data change corresponding to the first comparison time in the comparison time group and the first data change corresponding to the second comparison time in the comparison time group, and calculate the second difference between the second data change corresponding to the first comparison time in the comparison time group and the second data change corresponding to the second comparison time in the comparison time group. The second initial comparison result is determined based on the first difference and the second difference corresponding to each comparison time group; Based on the first initial comparison result and the second initial comparison result, the data change comparison result is determined.
5. The method according to claim 1, characterized in that, In cases where the monitoring results indicate inconsistent data, the method further includes: Determine the target data type for inconsistent business data; In the preset mapping relationship between data types and alarm levels, query the target alarm level corresponding to the target data type, and output the alarm information corresponding to the target alarm level.
6. A data synchronization device, characterized in that, The device includes: The acquisition module is used to acquire the first application business table and the first transaction log reconciliation table of the platform database, and the second application business table and the second transaction log reconciliation table of the host database; the first application business table and the second application business table are used to record transaction-related business data; the first transaction log reconciliation table and the second transaction log reconciliation table are used to record the transaction status of each transaction; The comparison module is used to compare the log data in the first transaction log reconciliation table and the second transaction log reconciliation table to obtain the log comparison result, and to compare the business data in the first application business table and the second application business table according to the preset comparison rules to obtain the data comparison result. The compensation module is used to perform data compensation processing on the platform database or the host database based on the log comparison results, the data comparison results and the preset data compensation mechanism. The compensation module is specifically used to determine the monitoring result based on the log comparison result and the data comparison result; the monitoring result indicates whether the platform database and the host database are consistent. If the monitoring results indicate that the data in the platform database and the host database are inconsistent, a reference application business table and an application business table to be corrected shall be determined based on the monitoring results and a preset data compensation mechanism. Update the application business table to be corrected based on the transaction data in the reference application business table; The compensation module is specifically used to, if the monitoring result indicates that there is a transaction log reconciliation table with missing logs, use the application business table corresponding to the transaction log reconciliation table with missing logs as the application business table to be corrected, and use the application business table corresponding to the transaction log reconciliation table with existing log records as the reference application business table. If the monitoring result indicates that the business data is inconsistent and the transaction status corresponding to the inconsistent business data in the first transaction log reconciliation table is successful, then the second application business table will be used as the application business table to be corrected and the first application business table will be used as the reference application business table. If the monitoring results indicate that the business data is inconsistent and the transaction status corresponding to the inconsistent business data in the first transaction log reconciliation table is unsuccessful, then the first application business table will be used as the application business table to be corrected, and the second application business table will be used as the reference application business table.
7. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 5.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 5.
9. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 5.