Data consistency checking and repair methods, devices, equipment, media and products

By using automated data consistency checks and repair methods, global transaction identifiers are compared between the primary and standby databases of MySQL, and repair scripts are generated and executed. This solves the problems of time-consuming and error-prone processes in existing technologies, and achieves fast and accurate data consistency assurance.

CN116737736BActive Publication Date: 2026-05-26INDUSTRIAL AND COMMERCIAL BANK OF CHINA

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
INDUSTRIAL AND COMMERCIAL BANK OF CHINA
Filing Date
2023-06-08
Publication Date
2026-05-26

Smart Images

  • Figure CN116737736B_ABST
    Figure CN116737736B_ABST
Patent Text Reader

Abstract

This disclosure provides a data consistency check and repair method, apparatus, electronic device, medium, and product, relating to the field of computer technology and applicable to the financial technology field. The check method includes: performing a status check on a database to determine the data consistency check type, wherein the check type includes a general consistency check or a strong consistency check; the database includes at least one primary database, and each primary database corresponds to multiple backup databases; in response to the check type being a general consistency check, performing a general consistency comparison between a first global transaction identifier of the primary database and a second global transaction identifier of the backup database to obtain data consistency information, wherein the data consistency information represents whether the data is consistent or inconsistent; in response to the check type being a strong consistency check, performing a strong consistency comparison between the first global transaction identifier of the primary database and the second global transaction identifier of the backup database to obtain the data consistency information.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of computer technology and can be applied to the field of financial technology, and in particular to a data consistency check and repair method, apparatus, equipment, medium and product. Background Technology

[0002] Commercial banks typically use Data Management Platforms (DMPs) to manage and maintain MySQL (Relational Database Management System) databases. Data consistency within the same database group is checked and guaranteed by the DMP platform's high availability components. However, with the further improvement of MySQL database high availability, disaster recovery environments need to be capable of taking over all business operations. Furthermore, disaster recovery databases need to be decoupled and isolated from production environment databases, thus being distributed across different DMPs. Therefore, data consistency comparison and guarantee cannot be achieved solely through the DMP's high availability components, necessitating the research and deployment of alternative methods to ensure data consistency.

[0003] Existing data consistency assurance solutions mainly rely on manual inspection and confirmation. This method is time-consuming, inefficient, prone to omissions, and cumbersome in comparison. In addition, it requires manual execution of commands for repair, and the write commands are complex, error-prone, and difficult to verify. Summary of the Invention

[0004] In view of this, the main objective of this disclosure is to provide a data consistency check and repair method, apparatus, electronic device, medium and product, which aims to at least partially solve the technical problems of existing data consistency check methods, such as being time-consuming, inefficient, prone to omissions, cumbersome comparison, error-prone and difficult to verify.

[0005] To achieve the above objectives, a first aspect of this disclosure provides a data consistency check method, comprising: performing a state check on a database to determine a data consistency check type, wherein the check type includes a general consistency check or a strong consistency check; the database includes at least one primary database, and each primary database corresponds to multiple backup databases; in response to the check type being a general consistency check, performing a general consistency comparison between a first global transaction identifier of the primary database and a second global transaction identifier of the backup database to obtain data consistency information, wherein the data consistency information represents whether the data is consistent or inconsistent; and in response to the check type being a strong consistency check, performing a strong consistency comparison between the first global transaction identifier of the primary database and the second global transaction identifier of the backup database to obtain the data consistency information.

[0006] According to embodiments of this disclosure, the database status check includes: performing status checks on the database's processes and command returns to determine the database's availability; in response to the database being available, checking the database's replication status and replication latency to determine whether the standby database and the primary database have established replication; in response to the standby database establishing replication with the primary database, determining the check type as a general consistency check; and in response to the standby database not establishing replication with the primary database, determining the check type as a strong consistency check.

[0007] According to embodiments of this disclosure, in response to the check type being a general consistency check, performing a general consistency comparison between the global transaction identifier of the primary database and the global transaction identifier of the backup database to obtain data consistency information includes: determining the primary database to be checked from the at least one primary database; comparing multiple second global transaction identifiers of multiple backup databases corresponding to the primary database to be checked; determining that there is data inconsistency between the primary database to be checked and the corresponding multiple backup databases in response to the multiple second global transaction identifiers of the multiple backup databases being inconsistent; detecting the replication status in the primary database to be checked and the corresponding multiple backup databases in response to the multiple second global transaction identifiers of the multiple backup databases being consistent, the first global transaction identifier of the primary database to be checked containing the second global transaction identifier, and the first global transaction identifier of the primary database to be checked remaining unchanged; and determining that the data in the primary database to be checked and the corresponding multiple backup databases are consistent in response to the multiple second global transaction identifiers of the multiple backup databases being consistent, the first global transaction identifier of the primary database to be checked containing the second global transaction identifier, and the first global transaction identifier of the primary database to be checked continuously increasing.

[0008] According to embodiments of this disclosure, in response to the check type being a strong consistency check, performing a strong consistency comparison between the first global transaction identifier of the primary database and the second global transaction identifier of the backup database to obtain the data consistency information includes: determining the primary database to be checked from the at least one primary database; comparing the first global transaction identifier of the primary database to be checked with multiple second global transaction identifiers of multiple backup databases corresponding to the primary database to be checked; in response to the first global transaction identifier of the primary database to be checked being consistent with the multiple second global transaction identifiers of the multiple backup databases corresponding to the primary database to be checked, determining that the data in the primary database to be checked and the corresponding multiple backup databases are consistent; in response to the first global transaction identifier of the primary database to be checked being not completely consistent with the multiple second global transaction identifiers of the multiple backup databases corresponding to the primary database to be checked, determining that there is data inconsistency in the primary database to be checked and the corresponding multiple backup databases.

[0009] According to an embodiment of this disclosure, the method further includes: obtaining a configuration file, wherein the configuration file includes information about a database to be inspected; and performing batch inspections on the database to be inspected based on the configuration file.

[0010] A second aspect of this disclosure provides a data consistency repair method, comprising: obtaining data consistency information of a database, wherein the data consistency information is detected by the aforementioned data consistency check method; generating a repair script for an abnormal global transaction identifier in response to data inconsistency; and executing the repair script to repair the abnormal global transaction identifier.

[0011] According to an embodiment of this disclosure, the repair script for generating an abnormal global transaction identifier in response to data inconsistency includes: obtaining a third global transaction identifier of a third-party database other than the database associated with the data inconsistency in the same group of databases; comparing the third global transaction identifier with a first global transaction identifier or a second global transaction identifier of the database associated with the data inconsistency to determine an abnormal global transaction identifier; and parsing the abnormal global transaction identifier to generate the repair script.

[0012] According to an embodiment of this disclosure, executing the repair script to repair the abnormal global transaction identifier includes: executing the repair script in response to the data parsed from the abnormal global transaction identifier including system-side heartbeat information; confirming the validity of the business data in response to the data parsed from the abnormal global transaction identifier including business data; executing the repair script in response to the business data being invalid data; and not executing the repair script in response to the business data being valid data.

[0013] According to embodiments of this disclosure, when performing a strong consistency comparison between the first global transaction identifier of the primary database and the second global transaction identifier of the standby database, the method further includes: in response to the first global transaction identifier of the primary database to be checked and the multiple second global transaction identifiers of the multiple standby databases corresponding to the primary database to be checked not being completely consistent, determining whether the primary database to be checked and the multiple standby databases corresponding to the primary database to be checked meet a general consistency check; in response to the primary database to be checked and the multiple standby databases corresponding to the primary database to be checked meeting the general consistency check, reconstructing the replication relationship between the primary database to be checked and the corresponding multiple standby databases until the first global transaction identifier of the primary database to be checked and the multiple second global transaction identifiers of the multiple standby databases corresponding to the primary database to be checked are completely consistent.

[0014] According to an embodiment of this disclosure, after executing the repair script to repair the abnormal global transaction identifier, the method further includes: performing a data consistency check on the repaired database to obtain a data consistency repair result, the repair result including repair success or repair failure; and generating a processing log based on the repair result.

[0015] According to an embodiment of this disclosure, generating a processing log based on the repair result includes: in response to repair failure, recording an abnormal global transaction identifier and repair script execution exception information; and generating the processing log based on the abnormal global transaction identifier and repair script execution exception information.

[0016] A third aspect of this disclosure provides a data consistency check apparatus, comprising: a check module, configured to perform a status check on a database and determine a data consistency check type, wherein the check type includes a general consistency check or a strong consistency check; the database includes at least one primary database, and each primary database corresponds to multiple backup databases; a first comparison module, configured to, in response to the check type being a general consistency check, perform a general consistency comparison between a first global transaction identifier of the primary database and a second global transaction identifier of the backup database to obtain data consistency information, wherein the data consistency information represents whether the data is consistent or inconsistent; and a second comparison module, configured to, in response to the check type being a strong consistency check, perform a strong consistency comparison between the first global transaction identifier of the primary database and the second global transaction identifier of the backup database to obtain the data consistency information.

[0017] A fourth aspect of this disclosure provides a data consistency repair apparatus, comprising: a data consistency checking apparatus as described above, used to check data consistency information of a database; a generation module, used to generate a repair script for an abnormal global transaction identifier in response to data inconsistency; and an execution module, used to execute the repair script to repair the abnormal global transaction identifier.

[0018] A fifth aspect of this disclosure provides an electronic device, including: one or more processors; and a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors perform the data consistency check and repair method described above.

[0019] A sixth aspect of this disclosure provides a computer-readable storage medium storing executable instructions that, when executed by a processor, cause the processor to perform the data consistency check and repair method described above.

[0020] A seventh aspect of this disclosure provides a computer program product, including a computer program that, when executed by a processor, implements the data consistency check and repair method described above.

[0021] The data consistency checking and repair method, apparatus, electronic device, medium, and product provided according to the embodiments of this disclosure have at least the following beneficial effects:

[0022] Different checking methods are set up to address the inconsistencies in the requirements for comparing global transaction identifiers at different stages. General consistency comparison is applicable to data consistency comparison and rapid repair during daily disaster recovery and production data synchronization. Strong consistency comparison function is used for data consistency comparison and repair during application-level full disaster recovery load switchover drills, thereby solving the problem that data consistency cannot be quickly verified when disaster recovery and production databases are deployed under different DMPs.

[0023] By obtaining a configuration file that provides a list of databases to be inspected, global transaction identifier comparison can be quickly achieved, enabling batch inspection of databases. This solves the problems of existing inspection schemes, such as long processing time, high error rate, inability to perform real-time batch inspection and control, and cumbersome manual steps.

[0024] For abnormal global transaction identifier information, automatic parsing and automatic repair scripts are provided; at the same time, preliminary automatic judgment is performed on abnormal global transaction identifier information. If it is system data, automatic repair can be achieved; if it is application data, the specific structured query language content of the abnormal information can be directly provided, which makes it easy for business personnel to directly judge and execute the data compensation plan; the inspection and processing results of each module are batch statistically analyzed, which makes it easy for operation and maintenance personnel to quickly grasp the overall comparison situation and quickly formulate compensation and processing plans.

[0025] This method and device comprehensively enhance the automation capabilities of batch operations, minimize human operation and intervention, and reduce the cost and risk of manual operation. For content that requires manual intervention for analysis and judgment, it provides complete comparison results, abnormal global transaction identifier parsing information, global transaction identifier repair scripts, automatic processing results, and full logs, providing the necessary data and information foundation for rapid human intervention and decision-making. Attached Figure Description

[0026] To more clearly illustrate the technical solutions in the embodiments of this disclosure or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this disclosure. For those skilled in the art, other drawings can be obtained based on the structures shown in these drawings without creative effort.

[0027] Figure 1 The system architecture 100 of the data consistency check and repair method and apparatus according to an embodiment of the present disclosure is illustrated schematically;

[0028] Figure 2 A flowchart illustrating a data consistency check method according to an embodiment of the present disclosure is shown schematically.

[0029] Figure 3This schematically illustrates a flowchart of a method for performing a status check on a database according to operation S201 of an embodiment of the present disclosure;

[0030] Figure 4 This illustration schematically depicts an embodiment according to the present disclosure. Figure 3 The diagram shows the principle of the database status check method.

[0031] Figure 5 A flowchart illustrating a general conformity check method for operation S202 according to an embodiment of the present disclosure is shown schematically.

[0032] Figure 6 A schematic diagram illustrating the principle of data consistency comparison according to an embodiment of the present disclosure is shown.

[0033] Figure 7 This schematically illustrates a flowchart of a method for a strong consistency check in operation S203 according to an embodiment of the present disclosure;

[0034] Figure 8 A flowchart illustrating a data consistency check method according to another embodiment of this disclosure is shown schematically.

[0035] Figure 9 A flowchart illustrating a data consistency repair method according to an embodiment of the present disclosure is shown schematically.

[0036] Figure 10 A flowchart illustrating the repair script generation method of operation S902 according to an embodiment of the present disclosure is shown in the schematic diagram.

[0037] Figure 11 This illustration schematically shows a flowchart of the execution of a repair script to repair an abnormal global transaction identifier in operation S903 according to an embodiment of the present disclosure;

[0038] Figure 12 This schematically illustrates the principle of executing a repair script to repair an abnormal global transaction identifier according to an embodiment of the present disclosure;

[0039] Figure 13 A flowchart illustrating a data consistency repair method according to another embodiment of this disclosure is shown schematically;

[0040] Figure 14 A flowchart illustrating a data consistency restoration method according to yet another embodiment of this disclosure is shown schematically;

[0041] Figure 15 A block diagram of a data consistency checking apparatus according to an embodiment of the present disclosure is shown schematically;

[0042] Figure 16 A block diagram of a data consistency repair apparatus according to an embodiment of the present disclosure is shown schematically;

[0043] Figure 17 A block diagram of an electronic device suitable for implementing the methods described above, according to embodiments of the present disclosure, is illustrated schematically. Detailed Implementation

[0044] The embodiments of the present disclosure will now be described with reference to the accompanying drawings. However, it should be understood that these descriptions are exemplary only and are not intended to limit the scope of the disclosure. In the following detailed description, numerous specific details are set forth to provide a thorough understanding of the embodiments of the present disclosure for ease of explanation. However, it will be apparent that one or more embodiments may be practiced without these specific details. Furthermore, descriptions of well-known structures and techniques are omitted in the following description to avoid unnecessarily obscuring the concepts of the present disclosure.

[0045] The terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit this disclosure. The terms “comprising,” “including,” etc., as used herein indicate the presence of the stated features, steps, operations, and / or components, but do not exclude the presence or addition of one or more other features, steps, operations, or components.

[0046] All terms used herein (including technical and scientific terms) have the meanings commonly understood by those skilled in the art, unless otherwise defined. It should be noted that the terms used herein are to be interpreted in a manner consistent with the context of this specification, and not in an idealized or overly rigid way.

[0047] When using expressions such as "at least one of A, B, and C," the expression should generally be interpreted in accordance with the meaning commonly understood by a person skilled in the art (e.g., "a system having at least one of A, B, and C" should include, but is not limited to, systems having A alone, having B alone, having C alone, having A and B, having A and C, having B and C, and / or having A, B, and C, etc.). Similarly, when using expressions such as "at least one of A, B, or C," the expression should generally be interpreted in accordance with the meaning commonly understood by a person skilled in the art (e.g., "a system having at least one of A, B, or C" should include, but is not limited to, systems having A alone, having B alone, having C alone, having A and B, having A and C, having B and C, and / or having A, B, and C, etc.).

[0048] The accompanying drawings illustrate several block diagrams and / or flowcharts. It should be understood that some blocks, or combinations thereof, in the block diagrams and / or flowcharts can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data integrity repair apparatus, such that, when executed by the processor, these instructions can create means for implementing the functions / operations described in these block diagrams and / or flowcharts. The technology of this disclosure can be implemented in hardware and / or software (including firmware, microcode, etc.). Alternatively, the technology of this disclosure can take the form of a computer program product stored on a computer-readable storage medium, which is available for use by or in conjunction with an instruction execution system.

[0049] In the technical solutions disclosed herein, the collection, storage, use, processing, transmission, provision, disclosure, and application of information all comply with the provisions of relevant laws and regulations, necessary confidentiality measures have been taken, and they do not violate public order and good morals.

[0050] In the technical solution disclosed herein, if it is necessary to obtain user personal information, the user's authorization or consent is obtained before obtaining or collecting the user's personal information.

[0051] To address the technical problems existing in related technologies, this disclosure provides a data consistency check and repair method. The check method includes: performing a health status check on the database to determine the data consistency check type, wherein the check type includes a general consistency check or a strong consistency check; the database includes at least one primary database, and each primary database corresponds to multiple standby databases. In response to a general consistency check, a general consistency comparison is performed between the first global transaction identifier of the primary database and the second global transaction identifier of the standby databases to obtain data consistency information, wherein the consistency information indicates whether the data is consistent or inconsistent. In response to a strong consistency check, a strong consistency comparison is performed between the first global transaction identifier of the primary database and the second global transaction identifier of the standby databases to obtain data consistency information. The repair method includes: in response to the data consistency information indicating data inconsistency, generating a repair script for an abnormal global transaction identifier; and executing the repair script to repair the abnormal global transaction identifier.

[0052] Figure 1 The system architecture 100 of the data consistency check and repair method and apparatus according to an embodiment of the present disclosure is illustrated schematically. It should be noted that... Figure 1 The examples shown are merely examples of system architectures that can be applied to the embodiments of this disclosure, in order to help those skilled in the art understand the technical content of this disclosure, but do not mean that the embodiments of this disclosure cannot be used in other devices, systems, environments or scenarios.

[0053] like Figure 1As shown, the system architecture 100 according to this embodiment may include a database 101, a network 102, and a data management platform 103. The network 103 is used to provide a communication link between the database 101 and the server 103.

[0054] Database 101 can be, for example, a MySQL database. Network 102 can include various connection types, such as wired, wireless communication links, or fiber optic cables. Wired connections can utilize cables and any of the following interfaces: Fibre Channel, infrared interface, Type-D data interface, serial interface, USB interface, USB Type-C interface, or dock interface. Wireless connections can use wireless communication technologies such as Bluetooth, Wi-Fi, Infrared, and ZigBee. Data management platform 103 manages the MySQL database and provides high availability, daily maintenance, performance monitoring, and emergency response functions for the managed databases, as well as a MySQL ledger export function. Specifically, the data management platform 103 performs a health status check on the database 101 via network 102 to determine the data consistency check type. If the check type is a general consistency check, it performs a general consistency comparison between the first global transaction identifier of the primary database and the second global transaction identifier of the standby database to obtain data consistency information. If the check type is a strong consistency check, it performs a strong consistency comparison between the first global transaction identifier of the primary database and the second global transaction identifier of the standby database to obtain data consistency information. If the data consistency information indicates data inconsistency, it generates a repair script for the abnormal global transaction identifier. The repair script is then executed to repair the abnormal global transaction identifier.

[0055] It should be noted that the data consistency check and repair method provided in this embodiment can be executed by the data management platform 103. Correspondingly, the data consistency check and repair device provided in this embodiment can be located in the data management platform 103. Alternatively, the data consistency check and repair method provided in this embodiment can also be executed by a server or server cluster that is different from the data management platform 103 but capable of communicating with it. Correspondingly, the data consistency check and repair provided in this embodiment can also be located in a server or server cluster that is different from the data management platform 103 but capable of communicating with it. Alternatively, the data consistency check method provided in this embodiment can also be partially executed by the server 104 and partially executed by the storage device 102. Correspondingly, the data consistency check and repair device provided in this embodiment can also be partially located in the data management platform 103 and partially located in the database 101.

[0056] It should be understood that Figure 1The number of databases, networks, and data management platforms shown is merely illustrative. Depending on implementation needs, any number of databases, networks, and data management platforms can be included.

[0057] The data consistency checking and repair method provided in this disclosure can be applied to the fintech field. For example, for banks, a DMP platform is used to manage and maintain MySQL databases. During the data consistency checking and repair process, the replication status and latency are manually checked. Commands are executed on each database instance within the database group to obtain the Global Transaction Identifier (GTID) information of each instance and compared one by one. GTID anomaly information is analyzed and recorded, and abnormal GTIDs are manually repaired on a per-machine basis to ensure data consistency. However, the current scale of MySQL exceeds 18,000 instances. Manually checking the replication status and latency is time-consuming, inefficient, and prone to omissions. Furthermore, GTID comparison is cumbersome: taking a large bank's MySQL architecture as an example, with 4 database instances in the production environment and 2 database instances in the disaster recovery environment, a group of databases may have 6 GTID information entries, making manual comparison cumbersome and error-prone. In addition, manually executing commands to repair GTIDs involves complex command string manipulation, is prone to errors, and is difficult to verify. In this application scenario, the data consistency checking and repair method provided in this disclosure can solve the above-mentioned technical problems.

[0058] It should be understood that the data consistency checking and repair methods provided in this disclosure are not limited to the fintech field, but can also be used in any field other than finance. The above description is merely exemplary, and the data consistency checking and repair methods of this disclosure can be applied to other technical fields involving data consistency checking and repair, such as e-commerce, product recommendation, and logistics.

[0059] The following will be based on Figure 1 The described off-line asset mining scenario, through Figures 2 to 11 The data consistency checking and repair methods of the embodiments of this disclosure are described in detail.

[0060] Figure 2 A flowchart illustrating a data consistency check method according to an embodiment of the present disclosure is shown schematically.

[0061] like Figure 2 As shown, the data consistency check method may include, for example, operations S201 to S203.

[0062] In operation S201, a health status check is performed on the database to determine the type of data consistency check.

[0063] In the embodiments of this disclosure, the check types include general consistency checks or strong consistency checks. The database includes at least one primary database, each primary database corresponding to multiple secondary databases. Each primary database and its corresponding multiple secondary databases can be grouped into the same database group. General consistency checks can be understood as data consistency checks primarily targeting daily data synchronization. This involves obtaining the GTID information of the primary and secondary databases. Except for the GTID information record corresponding to the current primary database, all other GTID information is completely consistent. The range of records in the secondary database corresponding to the current primary database is less than or equal to the range of GTIDs in the primary database (the GTID of the primary database includes the GTID of the secondary database). Strong consistency can be understood as the GTID information in the primary and secondary databases being completely consistent. In this embodiment of the disclosure, GTIDs are represented in the format of "serverID:" sequence number range, and each database server's serverID is unique.

[0064] In operation S202, in response to the check type being general consistency check, a general consistency comparison is performed between the first global transaction identifier of the primary database and the second global transaction identifier of the standby database to obtain data consistency information.

[0065] In embodiments of this disclosure, data consistency information indicates whether the data is consistent or inconsistent.

[0066] In operation S203, in response to the check type being strong consistency check, a strong consistency comparison is performed between the first global transaction identifier of the primary database and the second global transaction identifier of the standby database to obtain data consistency information.

[0067] In the embodiments of this disclosure, during routine data synchronization, data replication delays may occur, and the GTID of the standby database may be lower than that of the current primary database. In this case, strong consistency is not required for GTID comparison. During switchover drills, however, strong consistency is required for GTID comparison because data consistency must be guaranteed.

[0068] According to the data consistency check method provided in the embodiments of this disclosure, different check methods are set for the inconsistency of the requirement to compare global transaction identifiers at different stages. The general consistency comparison can be applied to data consistency comparison and rapid repair during daily disaster recovery and production data synchronization. The strong consistency comparison function is used for data consistency comparison and repair during application-level full disaster recovery load switching drills. It adapts to the two different requirements, thereby solving the problem that data consistency cannot be quickly verified when disaster recovery and production databases are deployed under different DMPs.

[0069] Figure 3 The flowchart illustrating the method for performing a status check on a database according to operation S201 of an embodiment of the present disclosure is shown schematically.

[0070] like Figure 3As shown, the status check of the database in operation S201 may include operations S301 to S304.

[0071] In operation S301, the status of the database process and command returns is checked to determine the database's availability.

[0072] In operation S302, in response to the database being in an available state, the database replication status and replication latency are checked to determine whether replication has been established between the standby and the primary database.

[0073] In operation S303, in response to the establishment of replication between the standby and primary databases, the check type is determined to be a general consistency check.

[0074] In operation S304, in response to the fact that replication has not been established between the standby and the primary database, the check type is determined to be a strong consistency check.

[0075] Figure 4 This illustration schematically depicts an embodiment according to the present disclosure. Figure 3 The diagram shows the principle of the database status check method.

[0076] like Figure 4 As shown, the database status check mainly includes checks on database processes and command returns to ensure the database is normal and available. Under normal circumstances, the standby database synchronizes data from the primary database in real time, and the GTID check is a general check. Assuming the database is healthy, the database replication and latency are checked. If replication is currently established, the data consistency check is considered a general consistency check; if replication is not currently established, it is considered a strong consistency check. After the database status check is completed, the check results and log entries are recorded for subsequent analysis.

[0077] The data consistency check method according to the embodiments of this disclosure can quickly determine the current database data consistency check requirements based on the database replication status and replication latency, thereby improving the efficiency of data consistency check.

[0078] Figure 5 A flowchart illustrating a general conformity check method for operation S202 according to an embodiment of the present disclosure is shown.

[0079] Figure 6 A schematic diagram illustrating a data consistency comparison according to an embodiment of the present disclosure is shown.

[0080] like Figure 5 and Figure 6 As shown, the general consistency check of operation S202 may include, for example, operations S501 to S504.

[0081] In operation S501, the master database to be checked is determined from at least one master database.

[0082] In operation S502, multiple second global transaction identifiers of multiple standby databases corresponding to the primary database to be checked are compared.

[0083] In operation S503, in response to inconsistencies in the second global transaction identifiers of multiple standby databases, it is determined that there are data inconsistencies in the primary database to be checked and the corresponding multiple standby databases.

[0084] In operation S504, in response to the consistency of multiple second global transaction identifiers of multiple standby databases, the inclusion of the second global transaction identifier in the first global transaction identifier of the primary database to be checked, and the unchanged first global transaction identifier of the primary database to be checked, the replication status in the primary database to be checked and the corresponding multiple standby databases is detected.

[0085] In operation S505, in response to the consistency of multiple second global transaction identifiers of multiple standby databases, the inclusion of the second global transaction identifier in the first global transaction identifier of the primary database to be checked, and the continuous increment of the first global transaction identifier of the primary database to be checked, it is determined that the data in the primary database to be checked and the corresponding multiple standby databases are consistent.

[0086] In the embodiments of this disclosure, there may be one or more master databases to be detected. The specific number of master databases to be detected can be determined according to the actual application requirements, and this disclosure does not impose any restrictions. When there are multiple master databases to be checked, parallel processing can be used to perform status checks, data consistency comparisons, and data repairs.

[0087] In the embodiments of this disclosure, information about the corresponding master database to be tested can be obtained based on database information. The GTID set of the database group to which the master database to be tested belongs can also be obtained. By obtaining the universally unique identifier (UUID) of the master database to be tested, GTID information records belonging to the master database to be tested in the GTID set can be identified, and the GTID information of other databases in the same group can be compared with the GTID information corresponding to the current master database. If the GTID information of other databases in the group is consistent except for the GTID of the master database to be tested, and the record corresponding to the GTID of the current master database is less than or equal to the record in the current master database and the record continues to grow, then the general consistency comparison is considered successful, and the data in the group of databases is consistent. If the GTID information of other databases in the group is consistent except for the GTID of the master database to be tested, and the record corresponding to the GTID of the current master database is less than or equal to the record in the current master database and the record continues to grow without change, then the replication status is checked. If the replication status is abnormal, replication is rebuilt to ensure data synchronization. If the GTID information of other databases in the group is inconsistent except for the GTID of the master database to be tested, then it indicates that data inconsistency has occurred in the group of databases.

[0088] Figure 7A flowchart illustrating a method for a strong consistency check in operation S203 according to an embodiment of the present disclosure is shown.

[0089] like Figure 6 and Figure 7 As shown, the strong consistency check of operation S203 may include operations S701 to S704.

[0090] In operation S701, the master database to be checked is determined from at least one master database.

[0091] In operation S702, the first global transaction identifier of the primary database to be checked is compared with the multiple second global transaction identifiers of the multiple standby databases corresponding to the primary database to be checked.

[0092] In operation S703, in response to the first global transaction identifier of the primary database to be checked and the multiple second global transaction identifiers of the multiple standby databases corresponding to the primary database to be checked being consistent, it is determined that the data in the primary database to be checked and the multiple standby databases are consistent.

[0093] In operation S704, in response to the fact that the first global transaction identifier of the primary database to be checked and the multiple second global transaction identifiers of the multiple standby databases corresponding to the primary database to be checked are not completely consistent, it is determined that there is data inconsistency between the primary database to be checked and the multiple standby databases corresponding to it.

[0094] In the embodiments of this disclosure, there can be one or more master databases to be detected. The specific number of master databases to be detected can be determined according to the actual application requirements, and this disclosure does not impose any restrictions. When there are multiple master databases to be checked, parallel processing can be used to perform status checks, data consistency comparisons, and data repairs. By comparing the GTID information of the master databases in the same group with the GTID information corresponding to the current master database, if the GTID information is completely consistent, the data in the group of databases is considered consistent. If the GTID information is not completely consistent, it is considered that there is a data inconsistency in the group of databases. Further determination can be made as to whether the group of databases meets the general consistency check.

[0095] The data consistency check method according to the embodiments of this disclosure can better adapt to different needs by setting specific check methods for general consistency checks and strong consistency checks.

[0096] Figure 8 A flowchart illustrating a data consistency check method according to another embodiment of the present disclosure is shown schematically.

[0097] like Figure 8 As shown, the data consistency check method may also include operations S801 to S802.

[0098] During operation S801, a configuration file is obtained, which includes information about the database to be checked.

[0099] When operating S802, perform batch checks on the database to be checked according to the configuration file.

[0100] In the embodiments of this disclosure, when data consistency checks are required, batch data consistency checks can be performed by directly obtaining the configuration file. In other words, by obtaining the configuration file that provides a list of databases to be checked, global transaction identifier comparison can be quickly achieved, and batch database checks can be realized. This solves the problems of existing check schemes, such as long processing time, easy errors, inability to perform real-time batch checks and control, and cumbersome manual steps.

[0101] Figure 9 A flowchart illustrating a data consistency repair method according to an embodiment of the present disclosure is shown.

[0102] like Figure 9 As shown, the data consistency repair method may include, for example, operations S901 to S903.

[0103] When operating S901, obtain data consistency information from the database.

[0104] In operation S902, in response to data inconsistency, a repair script for the abnormal global transaction identifier is generated.

[0105] When operating S903, execute a repair script to fix the abnormal global transaction identifier.

[0106] In embodiments of this disclosure, data consistency information is provided by the aforementioned Figures 2-7 The data consistency check method shown is used to obtain the data; details will not be elaborated further.

[0107] According to the data consistency repair method of this disclosure, an execution script for repairing GTIDs is automatically generated based on the data consistency comparison results, which can achieve rapid batch repair of data inconsistencies.

[0108] Figure 10 A flowchart illustrating the repair script generation method of operation S902 according to an embodiment of the present disclosure is shown.

[0109] like Figure 10 As shown, the repair script generation method flow may include operations S1001 to S1003.

[0110] In operation S1001, obtain the third global transaction identifier of a third-party database outside the database associated with inconsistent data in the same group of databases.

[0111] In operation S1002, the third global transaction identifier is compared with the first or second global transaction identifier of the database associated with the data inconsistency to determine the abnormal global transaction identifier.

[0112] In operation S1003, the abnormal global transaction identifier is parsed to generate a repair script.

[0113] For example, if the primary database to be tested is A, and the corresponding standby databases are B and C, and the GTID of standby database B is inconsistent with the GTID of standby database C, then the GTID of standby database D is obtained and compared with the GTIDs of standby databases B and C to confirm the information and range of abnormal GTIDs. Similarly, if the GTID of the primary database to be tested is inconsistent with the GTID of standby database B, then the GTID of standby database D is obtained and compared with the GTIDs of the primary database A and standby database B to confirm the information and range of abnormal GTIDs. While retaining the information and range of abnormal GTIDs, the system automatically parses the information of abnormal GTIDs and generates a repair script to fix them.

[0114] According to the data consistency repair method provided in the embodiments of this disclosure, automatic parsing and automatic repair scripts are provided for abnormal global transaction identifier information, which can realize rapid batch repair of GTID information corresponding to data inconsistency.

[0115] Figure 11 The flowchart illustrating the execution of the repair script to repair the abnormal global transaction identifier in operation S903 according to an embodiment of the present disclosure is shown.

[0116] Figure 12 The diagram illustrates the principle of executing a repair script to repair an abnormal global transaction identifier according to an embodiment of the present disclosure.

[0117] like Figure 11 and Figure 12 As shown, the global transaction identifier for executing the repair script to recover from the exception can include operations S1101 to S1104.

[0118] In operation S1101, in response to the abnormal global transaction identifier parsing data including system-side heartbeat information, a repair script is executed.

[0119] In operation S1102, in response to the exception, the data obtained by parsing the global transaction identifier includes business data, and the validity of the business data is confirmed.

[0120] In operation S1103, in response to invalid business data, a repair script was executed.

[0121] In operation S1104, since the business data is valid, the repair script is not executed.

[0122] According to the data consistency repair method of this disclosure, a preliminary automatic judgment is made on abnormal GTID information. If it is system data, automatic repair can be achieved; if it is application data, the specific structured query language content of the abnormal information can be directly provided, which makes it convenient for business personnel to directly judge and execute the data compensation scheme.

[0123] Figure 13 A flowchart illustrating a data consistency repair method according to another embodiment of this disclosure is shown schematically.

[0124] like Figure 13 As shown, the data consistency repair method may include, for example, operations S1301 to S1302.

[0125] In operation S1301, in response to the fact that the first global transaction identifier of the primary database to be checked and the multiple second global transaction identifiers of the multiple standby databases corresponding to the primary database to be checked are not completely consistent, it is determined whether the primary database to be checked and the multiple standby databases corresponding to the primary database to be checked meet the general consistency check.

[0126] In operation S1302, in response to the primary database to be checked and the multiple standby databases corresponding to the primary database to be checked meeting the general consistency check, the replication relationship between the primary database to be checked and the multiple standby databases corresponding to the primary database to be checked is rebuilt until the first global transaction identifier of the primary database to be checked and the multiple second global transaction identifiers of the multiple standby databases corresponding to the primary database to be checked are completely consistent.

[0127] According to the data consistency repair method of this disclosure, when the strong consistency comparison fails, a general consistency comparison can be further combined. If the general consistency comparison is met, the replication relationship to the master database is automatically rebuilt and the data is tracked until the GTID is completely consistent. Then the replication is automatically disconnected to further ensure data consistency.

[0128] Figure 14 A flowchart illustrating a data consistency repair method according to yet another embodiment of the present disclosure is shown.

[0129] like Figure 12 and Figure 14 As shown, the data consistency repair method may include, for example, operations S1401 to S1402.

[0130] In operation S1401, a data consistency check is performed on the repaired database to obtain the data consistency repair result, which includes whether the repair was successful or failed.

[0131] In operation S1402, a processing log is generated based on the repair results.

[0132] For example, after executing the GTID repair script, the consistency of GTIDs is checked again. If the data is consistent, the repair is successful and the repair result is recorded; if the GTIDs are still inconsistent after the repair, GTID exception information and script execution exception information are recorded. After achieving this data consistency, the results of the batch repair are statistically analyzed and a processing log is generated.

[0133] According to the data consistency repair method of this disclosure, for content that requires manual intervention for analysis and judgment, it provides complete comparison results, abnormal GTID parsing information, GTID repair scripts, automatic processing results and full logs, providing the necessary data and information foundation for rapid manual intervention and decision-making.

[0134] In summary, the data consistency check and repair method provided in this disclosure adapts to two different needs, allowing users to flexibly choose whether to perform a strong consistency comparison.

[0135] based on Figures 2-8 The data consistency check method and Figures 9-14 The data consistency repair method shown in this disclosure also provides a data consistency checking device and a repair device, which will be based on the following. Figure 1 The described scene, through Figures 11-14 The data consistency repair apparatus according to embodiments of this disclosure will be described.

[0136] Figure 15 A block diagram of a data consistency checking apparatus according to an embodiment of the present disclosure is shown schematically.

[0137] like Figure 15 As shown, the data consistency checking device 1500 may include a checking module 1510, a first comparison module 1520 and a second comparison module 1530.

[0138] The inspection module 1510 is used to perform status checks on the database and determine the type of data consistency check, wherein the type of check includes general consistency check or strong consistency check; the database includes at least one primary database, and each primary database corresponds to multiple backup databases.

[0139] The first comparison module 1520 is used to perform a general consistency comparison between the first global transaction identifier of the primary database and the second global transaction identifier of the standby database in response to a check type of general consistency check, so as to obtain data consistency information, wherein the data consistency information indicates whether the data is consistent or inconsistent.

[0140] The second comparison module 1530 is used to perform a strong consistency comparison between the first global transaction identifier of the primary database and the second global transaction identifier of the standby database in response to a check type of strong consistency check, so as to obtain data consistency information.

[0141] Figure 16 A block diagram of a data consistency repair apparatus according to an embodiment of the present disclosure is shown schematically.

[0142] like Figure 16 As shown, the data consistency repair device 1600 may include a data consistency check device 1500, a generation module 1610, and an execution module 1620.

[0143] The data consistency checker 1500 is used to check the data consistency information of the database.

[0144] Module 1610 is used to generate a repair script for an abnormal global transaction identifier in response to data inconsistency.

[0145] Execution module 1620 is used to execute a repair script to repair the abnormal global transaction identifier.

[0146] Any one or more of the modules, submodules, units, and subunits according to embodiments of the present disclosure, or at least part of the functions of any one or more of them, can be implemented in one module. Any one or more of the modules, submodules, units, and subunits according to embodiments of the present disclosure can be implemented by dividing them into multiple modules. Any one or more of the modules, submodules, units, and subunits according to embodiments of the present disclosure can be at least partially implemented as hardware circuitry, such as Field Programmable Gate Arrays (FPGAs), Programmable Logic Arrays (PLAs), Systems-on-Chip, Systems-on-Substrate, Systems-on-Package, Application-Specific Integrated Circuits (ASICs), or implemented in hardware or firmware by any other reasonable means of integrating or packaging circuitry, or implemented in software, hardware, or firmware, or in any suitable combination of any of these three implementation methods. Alternatively, one or more of the modules, submodules, units, and subunits according to embodiments of the present disclosure can be at least partially implemented as computer program modules, which, when run, can perform corresponding functions.

[0147] For example, any and more of the inspection module 1510, the first comparison module 1520, the second comparison module 1530, the generation module 1610, and the execution module 1620 can be combined into one module / unit / subunit, or any one of these modules / units / subunits can be split into multiple modules / units / subunits. Alternatively, at least some of the functionality of one or more of these modules / units / subunits can be combined with at least some of the functionality of other modules / units / subunits and implemented in one module / unit / subunit. According to embodiments of this disclosure, at least one of the inspection module 1510, the first comparison module 1520, the second comparison module 1530, the generation module 1610, and the execution module 1620 can be at least partially implemented as hardware circuitry, such as a field-programmable gate array (FPGA), a programmable logic array (PLA), a system-on-a-chip, a system-on-a-substrate, a system-on-package, an application-specific integrated circuit (ASIC), or any other reasonable means of integrating or packaging the circuitry, or implemented in software, hardware, or firmware, or in any suitable combination of any of these three implementation methods. Alternatively, at least one of the inspection module 1510, the first comparison module 1520, the second comparison module 1530, the generation module 1610, and the execution module 1620 can be at least partially implemented as a computer program module, which, when run, can perform corresponding functions.

[0148] It should be noted that the data consistency checking device and data consistency repair device in the embodiments of this disclosure correspond to the data consistency checking method and data consistency repair method in the embodiments of this disclosure, and their specific implementation details and the resulting technical effects are the same, which will not be repeated here.

[0149] Figure 17 A block diagram of an electronic device suitable for implementing the methods described above, according to embodiments of the present disclosure, is illustrated schematically. Figure 17 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of the embodiments disclosed herein.

[0150] like Figure 17As shown, an electronic device 1700 according to an embodiment of the present disclosure includes a processor 1701, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1702 or a program loaded from a storage portion 1708 into a random access memory (RAM) 1703. The processor 1701 may include, for example, a general-purpose microprocessor (e.g., a CPU), an instruction set processor and / or an associated chipset and / or a special-purpose microprocessor (e.g., an application-specific integrated circuit (ASIC)), etc. The processor 1701 may also include onboard memory for caching purposes. The processor 1701 may include a single processing unit or multiple processing units for performing different actions of the method flow according to an embodiment of the present disclosure.

[0151] RAM 1703 stores various programs and data required for the operation of electronic device 1700. Processor 1701, ROM 1702, and RAM 1703 are interconnected via bus 1704. Processor 1701 performs various operations of the method flow according to embodiments of the present disclosure by executing programs in ROM 1702 and / or RAM 1703. It should be noted that the programs may also be stored in one or more memories other than ROM 1702 and RAM 1703. Processor 1701 may also perform various operations of the method flow according to embodiments of the present disclosure by executing programs stored in said one or more memories.

[0152] According to embodiments of this disclosure, the electronic device 1700 may further include an input / output (I / O) interface 1705, which is also connected to a bus 1704. The electronic device 1700 may also include one or more of the following components connected to the I / O interface 1705: an input section 1706 including a keyboard, mouse, etc.; an output section 1707 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 1708 including a hard disk, etc.; and a communication section 1709 including a network interface card such as a LAN card, modem, etc. The communication section 1709 performs communication processing via a network such as the Internet. A drive 1710 is also connected to the I / O interface 1705 as needed. A removable medium 1711, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on the drive 1710 as needed so that computer programs read from it can be installed into the storage section 1708 as needed.

[0153] According to embodiments of this disclosure, the method flow according to embodiments of this disclosure can be implemented as a computer software program. For example, embodiments of this disclosure include a computer program product comprising a computer program carried on a computer-readable storage medium, the computer program containing program code for performing the methods shown in the flowchart. In such embodiments, the computer program can be downloaded and installed from a network via communication section 1709, and / or installed from removable medium 1711. When the computer program is executed by processor 1701, it performs the functions defined in the system of embodiments of this disclosure. According to embodiments of this disclosure, the systems, devices, apparatuses, modules, units, etc., described above can be implemented by computer program modules.

[0154] This disclosure also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiments; or it may exist independently and not assembled into the device / apparatus / system. The computer-readable storage medium carries one or more programs that, when executed, implement the method according to the embodiments of this disclosure.

[0155] According to embodiments of this disclosure, the computer-readable storage medium can be a non-volatile computer-readable storage medium. Examples include, but are not limited to: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this disclosure, the computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.

[0156] For example, according to embodiments of this disclosure, a computer-readable storage medium may include one or more memories other than ROM 1702 and / or RAM 1703 described above.

[0157] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions. Those skilled in the art will understand that the features recited in the various embodiments and / or claims of this disclosure can be combined and / or combined in various ways, even if such combinations or combinations are not expressly described in this disclosure. In particular, the features described in the various embodiments and / or claims of this disclosure may be combined and / or combined in various ways without departing from the spirit and teachings of this disclosure. All such combinations and / or combinations fall within the scope of this disclosure.

Claims

1. A data consistency check method, comprising: The database undergoes a status check to determine the type of data consistency check, which includes a general consistency check or a strong consistency check. The database includes at least one primary database, and each primary database corresponds to multiple standby databases. The general consistency check is a data consistency check during data synchronization between the primary and standby databases. The strong consistency check is a consistency check of the global transaction identifiers between the primary and standby databases. In response to the check type being a general consistency check, a primary database to be checked is determined from the at least one primary database, and multiple second global transaction identifiers of multiple standby databases corresponding to the primary database to be checked are compared; in response to the multiple second global transaction identifiers of the multiple standby databases being inconsistent, it is determined that there is data inconsistency between the primary database to be checked and the corresponding multiple standby databases; in response to the multiple second global transaction identifiers of the multiple standby databases being consistent, and the first global transaction identifier of the primary database to be checked containing the second global transaction identifier and the first global transaction identifier of the primary database to be checked remaining unchanged, the replication status in the primary database to be checked and the corresponding multiple standby databases is detected; in response to the multiple second global transaction identifiers of the multiple standby databases being consistent, and the first global transaction identifier of the primary database to be checked containing the second global transaction identifier and the first global transaction identifier of the primary database to be checked continuously increasing, it is determined that the data in the primary database to be checked and the corresponding multiple standby databases are consistent. In response to the check type being a strong consistency check, the first global transaction identifier of the primary database to be checked is compared with the multiple second global transaction identifiers of the multiple backup databases corresponding to the primary database to be checked; in response to the first global transaction identifier of the primary database to be checked being consistent with the multiple second global transaction identifiers of the multiple backup databases corresponding to the primary database to be checked being consistent, it is determined that the data in the primary database to be checked and the multiple backup databases are consistent; in response to the first global transaction identifier of the primary database to be checked being not completely consistent with the multiple second global transaction identifiers of the multiple backup databases corresponding to the primary database to be checked being inconsistent, it is determined that there is data inconsistency in the primary database to be checked and the multiple backup databases.

2. The data consistency check method of claim 1, wherein, The database status check includes: The availability status of the database is determined by performing status checks on the processes and command returns of the database. In response to the database being in an available state, the replication status and replication latency of the database are checked to determine whether the standby database and the primary database have established replication; In response to the establishment of replication between the standby database and the primary database, the check type is determined to be a general consistency check; In response to the fact that replication has not been established between the standby database and the primary database, the check type is determined to be a strong consistency check.

3. The data consistency check method according to claim 1 or 2, wherein, The method further includes: Obtain the configuration file, wherein the configuration file includes information about the database to be inspected; The database to be checked is checked in batches according to the configuration file.

4. A data consistency repair method, comprising: Obtain data consistency information from the database, wherein the data consistency information is obtained by the data consistency check method according to any one of claims 1-3; In response to data inconsistency, generate a repair script for an abnormal global transaction identifier; Execute the repair script to repair the abnormal global transaction identifier.

5. The data consistency repair method of claim 4, wherein, The remediation scripts that generate abnormal global transaction identifiers in response to data inconsistency include: Retrieve the third global transaction identifier of a third-party database outside the database group that is inconsistent with the data; The third global transaction identifier is compared with the first or second global transaction identifier of the database that is inconsistent with the data to determine the abnormal global transaction identifier. The abnormal global transaction identifier is parsed to generate the repair script.

6. The data consistency repair method of claim 5, wherein, The execution of the repair script to repair the abnormal global transaction identifier includes: In response to the data obtained from parsing the abnormal global transaction identifier, which includes system-side heartbeat information, the repair script is executed. In response to the abnormal global transaction identifier parsing, the data obtained includes business data, and the validity of the business data is confirmed; In response to the business data being invalid, the repair script is executed; Since the business data is valid, the repair script is not executed.

7. The data consistency repair method of claim 4, wherein, When performing a strong consistency comparison between the first global transaction identifier of the primary database and the second global transaction identifier of the standby database, the method further includes: In response to the fact that the first global transaction identifier of the primary database to be checked and the multiple second global transaction identifiers of the multiple backup databases corresponding to the primary database to be checked are not completely consistent, it is determined whether the primary database to be checked and the multiple backup databases corresponding to the primary database to be checked meet the general consistency check. In response to the fact that the primary database to be checked and the multiple standby databases corresponding to the primary database to be checked meet the general consistency check, the replication relationship between the primary database to be checked and the multiple standby databases corresponding to the primary database to be checked is rebuilt until the first global transaction identifier of the primary database to be checked and the multiple second global transaction identifiers of the multiple standby databases corresponding to the primary database to be checked are completely consistent.

8. The data consistency repair method of claim 4, wherein, After executing the repair script to repair the abnormal global transaction identifier, the method further includes: Perform a data consistency check on the repaired database to obtain the data consistency repair result, which includes whether the repair was successful or failed. A processing log is generated based on the repair results.

9. The data consistency repair method of claim 8, wherein, The step of generating a processing log based on the repair result includes: In response to repair failure, log the abnormal global transaction identifier and repair script execution exception information; The processing log is generated based on the abnormal global transaction identifier and the abnormal information of the repair script execution.

10. A data consistency check device, comprising: The inspection module is used to perform status checks on the database and determine the type of data consistency check. The inspection type includes general consistency check or strong consistency check. The database includes at least one primary database, and each primary database corresponds to multiple standby databases. The general consistency check is a data consistency check during data synchronization between the primary database and the standby databases. The strong consistency check is a consistency check of the global transaction identifiers between the primary database and the standby databases. The first comparison module is configured to, in response to the check type being a general consistency check, determine the primary database to be checked from the at least one primary database, and compare multiple second global transaction identifiers of multiple standby databases corresponding to the primary database to be checked; in response to the multiple second global transaction identifiers of the multiple standby databases being inconsistent, determine that there is data inconsistency between the primary database to be checked and the corresponding multiple standby databases; in response to the multiple second global transaction identifiers of the multiple standby databases being consistent and the first global transaction identifier of the primary database to be checked containing the second global transaction identifier and the first global transaction identifier of the primary database to be checked remaining unchanged, detect the replication status in the primary database to be checked and the corresponding multiple standby databases; in response to the multiple second global transaction identifiers of the multiple standby databases being consistent and the first global transaction identifier of the primary database to be checked containing the second global transaction identifier and the first global transaction identifier of the primary database to be checked continuously increasing, determine that the data in the primary database to be checked and the corresponding multiple standby databases are consistent. The second comparison module is used to compare the first global transaction identifier of the primary database to be checked with the multiple second global transaction identifiers of the multiple backup databases corresponding to the primary database to be checked, in response to the check type being a strong consistency check; if the first global transaction identifier of the primary database to be checked and the multiple second global transaction identifiers of the multiple backup databases corresponding to the primary database to be checked are consistent, it is determined that the data in the primary database to be checked and the multiple backup databases are consistent; if the first global transaction identifier of the primary database to be checked and the multiple second global transaction identifiers of the multiple backup databases corresponding to the primary database to be checked are not completely consistent, it is determined that there is data inconsistency in the primary database to be checked and the multiple backup databases.

11. A data consistency repair device, comprising: The data consistency checking device as described in claim 10 is used to check the data consistency information of the database; The generation module is used to generate a repair script for abnormal global transaction identifiers in response to data inconsistency. An execution module is used to execute the repair script to repair the abnormal global transaction identifier.

12. An electronic device, comprising: One or more processors; Storage device for storing one or more programs. Wherein, when the one or more programs are executed by the one or more processors, the one or more processors perform the method according to any one of claims 1 to 9.

13. A computer-readable storage medium storing executable instructions that, when executed by a processor, cause the processor to perform the method according to any one of claims 1 to 9.

14. A computer program product comprising a computer program that, when executed by a processor, implements the method according to any one of claims 1 to 9.