DDL consistency checking and repairing method, device and system and medium

By analyzing the DDL changed DDL statements generated by DDL in a distributed database, and performing consistency checksum repair on the data node, the problem that DDL consistency checksum repair in the existing technology is solved, and automated checksum repair is realized, improving efficiency and reliability.

CN119884248APending Publication Date: 2025-04-25JINZHUAN INFORMATION TECHNOLOGY CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411952136.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-27
Publication Date
2025-04-25

AI Technical Summary

Technical Problem

When performing DDL consistency verification and repair in distributed databases, it requires manual processing, which is complex, inefficient, and has the risk of incorrect operation.

Method used

Multiple subtasks are generated by parsing the DDL changed DDL statements, and these subtasks are distributed to each data node of the distributed database for consistency checksum repair. Specific steps include monitoring DDL changes, analyzing DDL statements to generate subtasks, distributing subtasks and collecting DDL information, performing consistency checksum repairs until the verification is passed.

Benefits of technology

The automation of DDL consistency checksum repair is realized, which reduces manual intervention, improves verification efficiency and reliability, and reduces the risk of misoperation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119884248A_ABST
    Figure CN119884248A_ABST
Patent Text Reader

Abstract

The invention discloses a DDL consistency checking and repairing method, device and system and a medium, and the method comprises the steps: analyzing a DDL statement corresponding to a DDL change and generating a plurality of subtasks after the DDL change occurs; distributing the plurality of sub-tasks to each data node of a distributed database, and collecting DDL information on each data node after the DDL is changed through the plurality of sub-tasks; performing consistency verification on the sub-task execution state and the DDL information on each data node to confirm whether a preset verification condition is met; if yes, the consistency verification is passed, and if not, consistency difference information is confirmed, and a corresponding repair statement is generated according to the consistency difference information to repair the data node until the consistency verification is passed. According to the method, automatic consistency verification and restoration are performed on each data node of the distributed database when DDL change occurs, so that the workload of manual verification is reduced, the verification cost is reduced, and the verification efficiency and reliability are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of database technology, and in particular to a DDL consistency check and repair method, device, system and medium. Background Art

[0002] Distributed databases use multiple data storage nodes to achieve horizontal scalability of storage capacity and uniformly distributed storage of massive data. For distributed databases, the atomicity of the data definition language (DDL) in the data storage nodes is very important. However, in the face of a large number of data storage nodes, DDL consistency verification and repair require manual processing one by one. This process is not only complex and inefficient, but also increases the probability of misoperation. Therefore, how to implement DDL change verification while ensuring database security and high efficiency has become an urgent problem to be solved in the current database technology field. Summary of the invention

[0003] In view of the above-mentioned deficiencies in the prior art, the object of the present invention is to provide a DDL consistency check and repair method, device, system and medium that can be applied to financial technology or other related fields, aiming to improve the efficiency and reliability of DDL consistency check and repair.

[0004] The technical solution of the present invention is as follows:

[0005] A DDL consistency check and repair method, comprising:

[0006] When a DDL change occurs, the DDL statement corresponding to the DDL change is parsed and multiple subtasks are generated;

[0007] Distributing the multiple subtasks to each data node of the distributed database, and collecting DDL information after the DDL change on each data node through the multiple subtasks;

[0008] Perform consistency check on the subtask execution status and DDL information on each data node to confirm whether the preset verification conditions are met;

[0009] If the conditions are met, the consistency check passes; if not, the consistency difference information is confirmed, and a corresponding repair statement is generated according to the consistency difference information to repair the data node until the consistency check passes.

[0010] In one embodiment, when a DDL change occurs, the DDL statement corresponding to the DDL change is parsed and multiple subtasks are generated, including:

[0011] Monitor DDL changes that occur within the preset consistency check cycle;

[0012] Obtain all DDL statements corresponding to the DDL changes that occurred during the consistency check cycle;

[0013] All DDL statements are parsed and multiple subtasks corresponding to the operations in the DDL change process are generated.

[0014] In one embodiment, the consistency check period includes a specified time period or a specified change number period.

[0015] In one embodiment, distributing the multiple subtasks to each data node of the distributed database and collecting DDL information after the DDL change on each data node through the multiple subtasks specifically includes:

[0016] The multiple subtasks are distributed to each data node of the distributed database, and the multiple subtasks are executed in parallel on each data node to collect DDL information after the DDL is changed on each data node.

[0017] In one embodiment, the consistency check of the subtask execution status and DDL information on each data node to confirm whether the preset check conditions are met includes:

[0018] Get the execution status of subtasks on each data node;

[0019] Calculate the corresponding DDL checksum value based on the DDL information of each data node;

[0020] Confirm whether all subtasks of all data nodes are executed successfully and the DDL checksum values ​​of all data nodes are consistent.

[0021] In one embodiment, if the consistency difference information is not satisfied, the consistency difference information is confirmed, and a corresponding repair statement is generated according to the consistency difference information to repair the data node until the consistency check passes, including:

[0022] Confirm the data nodes to be repaired that have differences based on the DDL checksum values ​​of each data node;

[0023] Generate a corresponding repair statement according to the DDL information of the data node to be repaired;

[0024] The table structure of the data node to be repaired is completed and repaired by using the repair statement, and the DDL check values ​​of all data nodes are checked for consistency again until the consistency check passes.

[0025] In one embodiment, after generating a corresponding repair statement according to the consistency difference information to repair the data node, the method further includes:

[0026] If the preset number of repairs reaches the preset number and still does not meet the preset verification condition, an exception handling prompt message is output.

[0027] A DDL consistency checking and repairing device, comprising:

[0028] The parsing module is used to parse the DDL statements corresponding to the DDL changes and generate multiple subtasks when a DDL change occurs;

[0029] A collection module, used to distribute the multiple subtasks to each data node of the distributed database, and collect DDL information after the DDL change on each data node through the multiple subtasks;

[0030] The verification module is used to perform consistency verification on the subtask execution status and DDL information on each data node to confirm whether the preset verification conditions are met;

[0031] The repair module is used to pass the consistency check if the conditions are met, and confirm the consistency difference information if the conditions are not met, and generate corresponding repair statements according to the consistency difference information to repair the data nodes until the consistency check passes.

[0032] A DDL consistency check and repair system, the system comprising at least one processor; and

[0033] a memory communicatively connected to the at least one processor; wherein,

[0034] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the above-mentioned DDL consistency checking and repairing method.

[0035] A non-volatile computer-readable storage medium stores computer-executable instructions. When the computer-executable instructions are executed by one or more processors, the one or more processors can execute the above-mentioned DDL consistency check and repair method.

[0036] Beneficial effects: The present invention discloses a DDL consistency check and repair method, device, system and medium. Compared with the prior art, the embodiments of the present invention reduce the workload of manual verification, reduce the verification cost and improve the verification efficiency and reliability by automatically performing consistency verification and repair on each data node of the distributed database when a DDL change occurs. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] The present invention will be further described below with reference to the accompanying drawings and embodiments, in which:

[0038] Figure 1A flow chart of a DDL consistency check and repair method provided by an embodiment of the present invention;

[0039] Figure 2 A schematic diagram of the functional modules of the DDL consistency check and repair device provided in an embodiment of the present invention;

[0040] Figure 3 A schematic diagram of the hardware structure of a DDL consistency check and repair system provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0041] In order to make the purpose, technical solution and effect of the present invention clearer and more specific, the present invention is further described in detail below. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention. The embodiments of the present invention are described below in conjunction with the accompanying drawings.

[0042] The DDL consistency verification and repair method provided in this embodiment can be applied in various distributed database management systems, including but not limited to distributed deployment scenarios such as MySQL, Oracle, and Microsoft SQL Server. It is specifically suitable for consistency verification and repair of changes in various nodes of a distributed database, such as fields, indexes, constraints, etc., after the database DDL is changed. For example, when the business is updated regularly or irregularly, it will involve changes in the business table structure, or DDL operations such as adding new tables. At this time, in order to ensure the consistency of the DDL of all data nodes, the distributed database DDL can be verified by the method provided in this embodiment, and automatically repaired when inconsistencies are found. Figure 1 As shown, the DDL consistency check and repair method provided in this embodiment includes the following steps:

[0043] S101. When a DDL change occurs, a DDL statement corresponding to the DDL change is parsed and a plurality of subtasks are generated.

[0044] In this embodiment, when the application executes DDL-related operations, that is, a DDL change occurs in the database, the DDL statements corresponding to the DDL changes to be verified are parsed to understand the specific content of the change, such as adding a new column, modifying the table structure, or creating an index. Specifically, the DDL change and verification can be performed according to preset rules. For example, each time a DDL change occurs, the corresponding DDL statement is obtained to perform subsequent verification, or a period of time or number of DDL changes can be accumulated, and then the corresponding DDL statements are uniformly obtained for verification. This embodiment does not limit this. Based on the parsing process of the DDL statement, multiple subtasks are generated, each subtask corresponds to a specific operation in the DDL change, such as rebuilding an index or modifying a field, etc., and the complex DDL change operation is decomposed into specific manageable and executable subtasks, so that the subsequent DDL consistency verification is more targeted and efficient.

[0045] S102: Distribute the multiple subtasks to each data node of the distributed database, and collect DDL information after the DDL is changed on each data node through the multiple subtasks.

[0046] In this embodiment, the generated subtasks are distributed to each data node of the distributed database, and relevant information after the DDL operation is collected from each data node of the distributed database through multiple subtasks, such as table structure, index, constraints, etc. Specifically, the collected DDL information can be sent or stored in a shared location for subsequent consistency verification, ensuring that the information after the DDL change can be collected and summarized from all data nodes, thereby enhancing the reliability of the DDL consistency verification in the distributed database environment.

[0047] In specific implementation, multiple subtasks are distributed to each data node of the distributed database, and multiple subtasks are executed in parallel on each data node to improve efficiency, that is, each node will process its own subtasks at the same time, rather than waiting for other nodes to complete tasks. When each subtask is executed on the corresponding data node, it will collect DDL information after the DDL change. By executing subtasks in parallel, the total time required to collect DDL information is greatly reduced, and the efficiency of the entire consistency verification process is improved.

[0048] S103, performing consistency check on the subtask execution status and DDL information on each data node to confirm whether the preset verification conditions are met;

[0049] S104. If the conditions are met, the consistency check passes. If the conditions are not met, the consistency difference information is confirmed, and a corresponding repair statement is generated according to the consistency difference information to repair the data node until the consistency check passes.

[0050] In this embodiment, the execution status of the subtasks on each data node and the collected DDL information are checked for consistency. Specifically, it is checked whether the subtasks on each data node are successfully executed and the DDL information of all data nodes is consistent. If so, the consistency check passes, and the result of the successful check is fed back to the user to complete the DDL consistency check; and if there are differences in the DDL consistency check of the data node during the execution of the subtask, the inconsistent consistency difference information is identified, and a repair statement is automatically generated according to the consistency difference information. The DDL structure is repaired by the generated repair statement, and the inconsistent data node is repaired to a state consistent with other nodes. After the repair is completed, the consistency check is performed again until the DDL information of all data nodes is consistent and the check passes. Through continuous verification and repair, it is ensured that the database can be quickly restored to a consistent state after the DDL change, the stability and reliability of the distributed database are improved, the consistency of the database structure after the DDL change is ensured, and the risk of business interruption is reduced.

[0051] In one embodiment, step S101 includes:

[0052] Monitor DDL changes that occur within the preset consistency check cycle;

[0053] Obtain all DDL statements corresponding to the DDL changes that occurred during the consistency check cycle;

[0054] All DDL statements are parsed and multiple subtasks corresponding to the operations in the DDL change process are generated.

[0055] In this embodiment, in order to improve the automation level of DDL consistency verification and repair, a consistency verification cycle can be pre-set, and the consistency verification cycle includes a specified time period or a specified change number period, that is, the consistency verification cycle can be based on time (for example, every 24 hours, every 48 hours, etc.) or based on the number of DDL changes (for example, every 1, 10, 20 DDL changes, etc.), and all DDL change events that occur will be monitored during this cycle, so as to capture the changes in the database structure in time, so as to perform consistency verification regularly. Based on the DDL changes monitored within the cycle, the corresponding DDL statements are obtained, for example, the corresponding DDL statements are extracted from the database change log, that is, the database system usually records the logs of DDL change operations, and these logs record the executed DDL statements and the time of their execution. The DDL statements corresponding to the DDL changes within the cycle can be extracted from these change logs to provide accurate data for consistency verification. The collected DDL statements are further parsed to obtain the change operations represented by each statement, and then multiple subtasks are generated. Each subtask corresponds to a specific operation in the DDL change, such as adding columns, modifying table structures, etc. The subtask will collect data structure information after each DDL change operation (such as rebuilding indexes, modifying fields, etc.) to confirm whether these changes have been correctly applied, thereby ensuring that the changed database structure is consistent on all nodes.

[0056] In one embodiment, step S103 includes:

[0057] Get the execution status of subtasks on each data node;

[0058] Calculate the corresponding DDL checksum value based on the DDL information of each data node;

[0059] Confirm whether all subtasks of all data nodes are executed successfully and the DDL checksum values ​​of all data nodes are consistent.

[0060] In this embodiment, after the subtasks are distributed to each data node and executed, the execution status of the subtasks on each data node is collected and obtained. The execution status includes information such as whether the subtask is successfully completed, whether an error is encountered, whether it is timed out, etc., to ensure a comprehensive understanding of the execution of the subtasks, and timely discover the execution failure, thereby helping to quickly locate the difference node. During the execution process, each subtask collects the data structure information after the DDL change, such as table structure, index, etc., and calculates a DDL check value based on the collected DDL information. Specifically, it can be a hash value or other form of summary value. The DDL check value represents the consistency and integrity of the DDL structure on the node, which is used to compare with the DDL structure of other nodes. By calculating the DDL check value, the DDL structures between different nodes can be quickly compared to see if they are consistent, thereby improving the verification efficiency. After that, the execution status of all subtasks is checked to confirm whether each task is successfully executed without encountering errors or exceptions, and the DDL check values ​​of all data nodes are compared to confirm whether they are completely consistent. In specific implementation, during the execution of subtasks, the consistency of DDL of each node can be verified by constructing a new check table ShowNode. ShowNode is a node or data structure used to store and compare DDL check values. During the execution of subtasks, ShowNode is used to display or compare whether the DDL check values ​​of each data node table are consistent. If all subtasks are successfully executed and the DDL check values ​​are consistent, it means that the DDL changes are correctly applied on all nodes and the consistency check passes; if any subtask fails to execute or the DDL check values ​​are inconsistent, these differences are marked and the subsequent repair process is carried out. Through automated consistency checks, manual intervention is reduced, the risk of data inconsistency caused by human errors is reduced, which helps to quickly discover and solve the problem of inconsistent DDL changes and reduce the risk of business interruption.

[0061] In one embodiment, if the consistency difference information is not satisfied, the consistency difference information is confirmed, and a corresponding repair statement is generated according to the consistency difference information to repair the data node until the consistency check passes, including:

[0062] Confirm the data nodes to be repaired that have differences based on the DDL checksum values ​​of each data node;

[0063] Generate a corresponding repair statement according to the DDL information of the data node to be repaired;

[0064] The table structure of the data node to be repaired is completed and repaired by using the repair statement, and the DDL check values ​​of all data nodes are checked for consistency again until the consistency check passes.

[0065] In this embodiment, after the comparison of the DDL checksum values ​​is completed, it is possible to identify which data nodes have DDL checksum values ​​that are inconsistent with other nodes, that is, there are differences. These nodes with differences are considered to be data nodes to be repaired. For example, if there are 5 nodes in a database cluster, the DDL checksum values ​​of the other 4 nodes are the same, and the checksum value of the 5th node is different, then the 5th node is the data node to be repaired. By quickly identifying differences and accurately locating problem nodes through DDL checksum values, unnecessary repair operations are reduced and repair efficiency is improved.

[0066] For each data node to be repaired, a corresponding repair statement is generated according to its DDL information. Specifically, the repair statement can be automatically generated by the function parse_ddl_fix_retry_hint. The repair statement may include, for example, ALTER TABLE, ADDINDEX or other DDL commands, etc. The generated repair statement is applied to the data node to be repaired, and actual repair operations are performed, such as adding missing indexes, modifying field types, synchronizing data, etc., so as to complete and repair the table structure of the data node to be repaired, and adjust the database structure of the node to be repaired to be consistent with other nodes. After the repair operation is completed, the system will recalculate the DDL checksum values ​​of all data nodes and perform consistency checks. The above process will be repeated, that is, if there are still inconsistent nodes after the repair, the above steps will be executed again, and new repair statements will be generated and applied until the DDL checksum values ​​of all nodes are consistent, indicating that the database structure is completely consistent. Through continuous verification and repair, it is ensured that the distributed database can be quickly restored to a consistent state after the DDL change, reducing manual intervention and improving the stability and reliability of the system.

[0067] In one embodiment, after step S104, the method further includes:

[0068] If the preset number of repairs reaches the preset number and still does not meet the preset verification condition, an exception handling prompt message is output.

[0069] In this embodiment, a repair number threshold is pre-set to limit the number of repair attempts to avoid an infinite loop of repair operations. That is, if after multiple repair attempts, the DDL checksum values ​​of some data nodes may still be inconsistent with other nodes and fail to meet the preset check conditions, when the number of repairs reaches this preset number, the automatic repair process will be stopped and an exception handling prompt message will be output to prompt the database administrator or system administrator to intervene. When the repair attempt is still unsuccessful after multiple attempts, this may indicate that there are more complex problems that require manual intervention, such as data corruption, network problems, or configuration errors. By setting a limit on the number of repairs, the system can be prevented from falling into an infinite loop of repair attempts, avoiding wasting too many resources on unsolvable problems, while ensuring the stability and reliability of the database.

[0070] It should be noted that there is not necessarily a certain order between the above-mentioned steps. A person skilled in the art can understand, based on the description of the embodiments of the present invention, that in different embodiments, the above-mentioned steps may have different execution orders, that is, they may be executed in parallel, may be executed interchangeably, and so on.

[0071] Another embodiment of the present invention provides a DDL consistency check and repair device, such as Figure 2 As shown, the device 1 comprises:

[0072] The parsing module 11 is used to parse the DDL statement corresponding to the DDL change and generate multiple subtasks when a DDL change occurs;

[0073] A collection module 12, configured to distribute the plurality of subtasks to each data node of the distributed database, and collect DDL information after the DDL change on each data node through the plurality of subtasks;

[0074] Verification module 13, used to perform consistency verification on the subtask execution status and DDL information on each data node to confirm whether the preset verification conditions are met;

[0075] The repair module 14 is used to pass the consistency check if the conditions are met, and confirm the consistency difference information if the conditions are not met, and generate corresponding repair statements according to the consistency difference information to repair the data nodes until the consistency check passes.

[0076] The module referred to in the present invention refers to a series of computer program instruction segments that can perform specific functions, which is more suitable for describing the execution process of DDL consistency check and repair than a program. For the specific implementation of each module, please refer to the corresponding method embodiment above, which will not be repeated here.

[0077] Another embodiment of the present invention provides a DDL consistency check and repair system, such as Figure 3 As shown, the system 10 includes:

[0078] One or more processors 110 and memory 120, Figure 3 A processor 110 is used as an example for description. The processor 110 and the memory 120 may be connected via a bus or other means. Figure 3 The example of connecting through bus is taken in the following.

[0079] The processor 110 is used to complete various control logics of the system 10, and it can be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA), a single-chip microcomputer, an ARM (Acorn RISC Machine) or other programmable logic device, a discrete gate or transistor logic, a discrete hardware component, or any combination of these components. In addition, the processor 110 can also be any traditional processor, microprocessor or state machine. The processor 110 can also be implemented as a combination of computing devices, for example, a combination of a DSP and a microprocessor, a plurality of microprocessors, one or more microprocessors combined with a DSP and / or any other such configuration.

[0080] The memory 120 is a non-volatile computer-readable storage medium that can be used to store non-volatile software programs, non-volatile computer executable programs and modules, such as program instructions corresponding to the DDL consistency check and repair method in the embodiment of the present invention. The processor 110 executes various functional applications and data processing of the system 10 by running the non-volatile software programs, instructions and units stored in the memory 120, that is, implements the DDL consistency check and repair method in the above method embodiment.

[0081] The memory 120 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and an application required by at least one function; the data storage area may store data created according to the use of the system 10, etc. In addition, the memory 120 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some embodiments, the memory 120 may optionally include a memory remotely arranged relative to the processor 110, and these remote memories may be connected to the system 10 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0082] One or more units are stored in the memory 120, and when executed by one or more processors 110, the following steps are implemented:

[0083] When a DDL change occurs, the DDL statement corresponding to the DDL change is parsed and multiple subtasks are generated;

[0084] Distributing the multiple subtasks to each data node of the distributed database, and collecting DDL information after the DDL change on each data node through the multiple subtasks;

[0085] Perform consistency check on the subtask execution status and DDL information on each data node to confirm whether the preset verification conditions are met;

[0086] If the conditions are met, the consistency check passes; if not, the consistency difference information is confirmed, and a corresponding repair statement is generated according to the consistency difference information to repair the data node until the consistency check passes.

[0087] In one embodiment, when a DDL change occurs, the DDL statement corresponding to the DDL change is parsed and multiple subtasks are generated, including:

[0088] Monitor DDL changes that occur within the preset consistency check cycle;

[0089] Obtain all DDL statements corresponding to the DDL changes that occurred during the consistency check cycle;

[0090] All DDL statements are parsed and multiple subtasks corresponding to the operations in the DDL change process are generated.

[0091] In one embodiment, the consistency check period includes a specified time period or a specified change number period.

[0092] In one embodiment, distributing the multiple subtasks to each data node of the distributed database and collecting DDL information after the DDL change on each data node through the multiple subtasks specifically includes:

[0093] The multiple subtasks are distributed to each data node of the distributed database, and the multiple subtasks are executed in parallel on each data node to collect DDL information after the DDL is changed on each data node.

[0094] In one embodiment, the consistency check of the subtask execution status and DDL information on each data node to confirm whether the preset check conditions are met includes:

[0095] Get the execution status of subtasks on each data node;

[0096] Calculate the corresponding DDL checksum value based on the DDL information of each data node;

[0097] Confirm whether all subtasks of all data nodes are executed successfully and the DDL checksum values ​​of all data nodes are consistent.

[0098] In one embodiment, if the consistency difference information is not satisfied, the consistency difference information is confirmed, and a corresponding repair statement is generated according to the consistency difference information to repair the data node until the consistency check passes, including:

[0099] Confirm the data nodes to be repaired that have differences based on the DDL checksum values ​​of each data node;

[0100] Generate a corresponding repair statement according to the DDL information of the data node to be repaired;

[0101] The table structure of the data node to be repaired is completed and repaired by using the repair statement, and the DDL check values ​​of all data nodes are checked for consistency again until the consistency check passes.

[0102] In one embodiment, after generating a corresponding repair statement according to the consistency difference information to repair the data node, the method further includes:

[0103] If the preset number of repairs reaches the preset number and still does not meet the preset verification condition, an exception handling prompt message is output.

[0104] An embodiment of the present invention provides a non-volatile computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are executed by one or more processors, for example, to execute the above-described Figure 1 The method comprises steps S101 to S104.

[0105] As an example, non-volatile storage media can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) as external cache memory. By way of illustration and not limitation, RAM can be obtained in many forms such as synchronous RAM (SRAM), dynamic RAM, (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), Synchlink DRAM (SLDRAM), and direct Rambus RAM (DRRAM). The disclosed memory components or memories of the operating environment described herein are intended to include one or more of these and / or any other suitable types of memory.

[0106] In summary, the present invention discloses a DDL consistency check and repair method, device, system and medium. The method parses the DDL statement corresponding to the DDL change and generates multiple subtasks when a DDL change occurs; distributes the multiple subtasks to each data node of the distributed database, and collects the DDL information after the DDL change on each data node through the multiple subtasks; performs consistency check on the subtask execution status and DDL information on each data node to confirm whether the preset check conditions are met; if satisfied, the consistency check passes, if not satisfied, confirm the consistency difference information, and generate corresponding repair statements according to the consistency difference information to repair the data node until the consistency check passes. By automatically performing consistency check and repair on each data node of the distributed database when a DDL change occurs, the workload of manual check is reduced, the check cost is reduced, and the check efficiency and reliability are improved.

[0107] Of course, those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing related hardware (such as a processor, a controller, etc.) through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium, and the computer program can include the processes of the above-mentioned method embodiments when executed. The storage medium can be a memory, a disk, a floppy disk, a flash memory, an optical storage device, etc.

[0108] It should be understood that the application of the present invention is not limited to the above examples. For ordinary technicians in this field, improvements or changes can be made based on the above description. All these improvements and changes should fall within the scope of protection of the claims attached to the present invention.

Claims

1. A DDL consistency check and repair method, characterized in that: include: When a DDL change occurs, the DDL statement corresponding to the DDL change is parsed and multiple subtasks are generated; Distributing the multiple subtasks to each data node of the distributed database, and collecting DDL information after the DDL change on each data node through the multiple subtasks; Perform consistency check on the subtask execution status and DDL information on each data node to confirm whether the preset verification conditions are met; If the conditions are met, the consistency check passes; if not, the consistency difference information is confirmed, and a corresponding repair statement is generated according to the consistency difference information to repair the data node until the consistency check passes.

2. The DDL consistency check and repair method according to claim 1, characterized in that: When a DDL change occurs, the DDL statement corresponding to the DDL change is parsed and multiple subtasks are generated, including: Monitor DDL changes that occur within the preset consistency check cycle; Obtain all DDL statements corresponding to the DDL changes that occurred during the consistency check cycle; All DDL statements are parsed and multiple subtasks corresponding to the operations in the DDL change process are generated.

3. The DDL consistency check and repair method according to claim 2, characterized in that: The consistency check period includes a specified time period or a specified change number period.

4. The DDL consistency check and repair method according to claim 1, characterized in that: The distributing the multiple subtasks to each data node of the distributed database and collecting DDL information after the DDL change on each data node through the multiple subtasks specifically includes: The multiple subtasks are distributed to each data node of the distributed database, and the multiple subtasks are executed in parallel on each data node to collect DDL information after the DDL is changed on each data node.

5. The DDL consistency check and repair method according to claim 1, characterized in that: The consistency check of the subtask execution status and DDL information on each data node to confirm whether the preset check conditions are met includes: Get the execution status of subtasks on each data node; Calculate the corresponding DDL checksum value based on the DDL information of each data node; Confirm whether all subtasks of all data nodes are executed successfully and the DDL checksum values ​​of all data nodes are consistent.

6. The DDL consistency check and repair method according to claim 5, characterized in that: If the consistency difference information is not satisfied, the consistency difference information is confirmed, and a corresponding repair statement is generated according to the consistency difference information to repair the data node until the consistency check passes, including: Confirm the data nodes to be repaired that have differences based on the DDL checksum values ​​of each data node; Generate a corresponding repair statement according to the DDL information of the data node to be repaired; The table structure of the data node to be repaired is completed and repaired by using the repair statement, and the DDL check values ​​of all data nodes are checked for consistency again until the consistency check passes.

7. The DDL consistency check and repair method according to claim 1, characterized in that: After the corresponding repair statement is generated according to the consistency difference information to repair the data node, the method further includes: If the preset number of repairs reaches the preset number and still does not meet the preset verification condition, an exception handling prompt message is output.

8. A DDL consistency check and repair device, characterized in that: include: The parsing module is used to parse the DDL statements corresponding to the DDL changes and generate multiple subtasks when a DDL change occurs; A collection module, used to distribute the multiple subtasks to each data node of the distributed database, and collect DDL information after the DDL change on each data node through the multiple subtasks; The verification module is used to perform consistency verification on the subtask execution status and DDL information on each data node to confirm whether the preset verification conditions are met; The repair module is used to pass the consistency check if the conditions are met, and confirm the consistency difference information if the conditions are not met, and generate corresponding repair statements according to the consistency difference information to repair the data nodes until the consistency check passes.

9. A DDL consistency check and repair system, characterized in that: The system includes at least one processor; and, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the DDL consistency checking and repairing method according to any one of claims 1 to 7.

10. A non-volatile computer-readable storage medium, characterized in that: The non-volatile computer-readable storage medium stores computer-executable instructions, which, when executed by one or more processors, enable the one or more processors to execute the DDL consistency checking and repairing method according to any one of claims 1 to 7.

Citation Information

Cited By

  • Distributed metadata automatic restoration method and device, equipment, medium and product

    CN121412203A