Method and device for repairing DDL atomicity problem and electronic equipment

By detecting and generating DDL repair instructions in a distributed database, the consistency of all data nodes when performing DDL operations in a distributed database is solved, and the reliability and stability of the system are improved.

CN119149279APending Publication Date: 2024-12-17JINZHUAN INFORMATION TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411122936.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-15
Publication Date
2024-12-17

AI Technical Summary

Technical Problem

When DDL operation in a distributed database, some data nodes succeed and some nodes fail, resulting in inconsistent definition of database objects and a problem of DDL atomicity. The existing technology lacks effective solutions.

Method used

After the distributed database has completed the DDL operation, detect whether there is a DDL atomicity problem, generate DDL repair instructions and send them to each data node, ensure that all nodes execute the repair instructions and return the results until all nodes execute successfully, and complete the repair.

Benefits of technology

It realizes the atomicity of DDL operations in a distributed database, ensures that the database object definition is consistent at all nodes, improves the stability and reliability of the system, reduces manual intervention, and quickly responds to and repairs DDL atomicity problems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119149279A_ABST
    Figure CN119149279A_ABST
Patent Text Reader

Abstract

The invention relates to a DDL atomicity problem repairing method and device and electronic equipment. The method comprises the steps of detecting whether a DDL atomicity problem exists in a distributed database or not after the distributed database executes a DDL operation instruction; under the condition that a DDL atomicity problem exists in a target data node of the distributed database, generating a corresponding DDL repair instruction according to the DDL operation instruction, and sending the DDL repair instruction to a computing node of the distributed database; controlling the computing node to send the DDL repair instruction to each data node of the distributed database, so that each data node executes the DDL repair instruction and returns an execution result; and under the condition that the execution result of the target data node is successful execution, finishing the repair of the DDL atomicity problem. According to the method and the device, the technical problem of DDL atomicity of a distributed database is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of distributed database technology, and in particular to a method, device and electronic device for repairing DDL atomicity problems. Background Art

[0002] In a distributed database, data is stored in multiple data nodes. When business applications perform database operations (DDL (Data Definition Language) / DML (Data Manipulation Language), etc.), the database object definitions on each data node must be consistent to ensure that each database operation is executed normally on all data nodes. In order to maintain consistent database object definitions on all data nodes, when business applications perform DDL operations to add, modify, or delete database object definitions, it is necessary to maintain the same execution results on all data nodes, that is, either all executions are successful and the database object definitions are modified to the target state; or all executions fail and the original definitions of the database objects remain unchanged. If the DDL operations on some data nodes succeed and the DDL operations on some data nodes fail, the database object definitions on each data node will be inconsistent, and the entire distributed database will not be able to perform database operations normally. In a distributed database, DDL operations are either all executed successfully or all executed unsuccessfully on all database nodes, which is called DDL atomicity. However, the prior art lacks a solution that can solve the DDL atomicity problem of distributed databases. Summary of the invention

[0003] The present application provides a method, device and electronic device for repairing DDL atomicity problems, so as to solve the technical problem of DDL atomicity problems occurring in distributed databases.

[0004] In a first aspect, the present application provides a method for repairing DDL atomicity problems, comprising: after a distributed database executes a DDL operation instruction, detecting whether the distributed database has a DDL atomicity problem; in the case that a target data node of the distributed database has the DDL atomicity problem, generating a corresponding DDL repair instruction according to the DDL operation instruction, and sending the DDL repair instruction to a computing node of the distributed database, wherein the target data node is any one or more data nodes of the distributed database; controlling the computing node to send the DDL repair instruction to each data node of the distributed database, so that each of the data nodes executes the DDL repair instruction and returns an execution result; in the case that the execution result of the target data node is successful, completing the repair of the DDL atomicity problem.

[0005] In the second aspect, the present application provides a device for repairing DDL atomicity problems, including: a detection module, which is used to detect whether the distributed database has a DDL atomicity problem after the distributed database executes the DDL operation instruction; a sending module, which is used to generate a corresponding DDL repair instruction according to the DDL operation instruction when the target data node of the distributed database has the DDL atomicity problem, and send the DDL repair instruction to the computing node of the distributed database, wherein the target data node is any one or more data nodes of the distributed database; a first control module, which is used to control the computing node to send the DDL repair instruction to each data node of the distributed database, so that each of the data nodes executes the DDL repair instruction and returns the execution result; a determination module, which is used to complete the repair of the DDL atomicity problem when the execution result of the target data node is successful.

[0006] As an optional example, the detection module includes: a first detection unit, used for the DDL operation instruction to modify the object definition of each of the data nodes to a target state, and to detect whether the object definition of each of the data nodes reaches the target state; a first determination unit, used for determining that the target data node has the DDL atomicity problem when the object definition of the target data node does not reach the target state; and a second determination unit, used for determining that the distributed database does not have the DDL atomicity problem when the object definition of each of the data nodes reaches the target state.

[0007] As an optional example, the sending module includes: a third determining unit, configured to determine the DDL operation instruction as the DDL repair instruction; or to add a repair identifier to the DDL operation instruction to obtain the DDL repair instruction.

[0008] As an optional example, the above-mentioned determination module includes: a second detection unit, used to detect whether the object definition of each of the above-mentioned data nodes has reached the target state when the execution result of the above-mentioned target data node is successful execution; a fourth determination unit, used to determine that the above-mentioned DDL atomicity problem has been successfully repaired when the object definitions of the above-mentioned target data nodes have reached the above-mentioned target state.

[0009] As an optional example, the above-mentioned device also includes: a second control module, which is used to control the above-mentioned computing node to send the above-mentioned DDL repair instruction to each data node of the above-mentioned distributed database, so that each of the above-mentioned data nodes executes the above-mentioned DDL repair instruction and returns the execution result, and then, if the execution result of the above-mentioned target data node is an execution failure, continue to control the above-mentioned computing node to send the above-mentioned DDL repair instruction to each data node of the above-mentioned distributed database, so that each of the above-mentioned data nodes executes the above-mentioned DDL repair instruction and returns the execution result, until the execution result of the above-mentioned target data node is an execution success.

[0010] As an optional example, the above-mentioned device also includes: an output module, which is used to continue to control the above-mentioned computing node to send the above-mentioned DDL repair instruction to each data node of the above-mentioned distributed database when the execution result of the above-mentioned target data node is execution failure, so that each of the above-mentioned data nodes executes the above-mentioned DDL repair instruction and returns the execution result, and then, when the number of sending times is greater than the target number of times and the execution result of the above-mentioned target data node is unsuccessful execution, output a repair failure report of the above-mentioned target data node, wherein the above-mentioned number of sending times is the number of times the above-mentioned computing node is controlled to send the above-mentioned DDL repair instruction to each data node of the above-mentioned distributed database.

[0011] As an optional example, the above-mentioned device also includes: a third detection unit, which is used to check whether there are any unreleased locks on the above-mentioned computing node after completing the repair of the above-mentioned DDL atomicity problem when the execution result of the above-mentioned target data node is successful execution; a generation unit, which is used to generate a release instruction when there are unreleased locks on the above-mentioned computing node; and a release unit, which is used to send the above-mentioned release instruction to the above-mentioned computing node so that the lock on the above-mentioned computing node is released.

[0012] In a third aspect, the present application provides a storage medium storing a computer program, wherein the computer program executes the above-mentioned method for repairing the DDL atomicity problem when executed by a processor.

[0013] In a fourth aspect, the present application further provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to execute the above-mentioned method for repairing the DDL atomicity problem through the computer program.

[0014] In an embodiment of the present application, after the distributed database executes the DDL operation instruction, it is detected whether the above-mentioned distributed database has a DDL atomicity problem; when the above-mentioned DDL atomicity problem exists in the target data node of the above-mentioned distributed database, a corresponding DDL repair instruction is generated according to the above-mentioned DDL operation instruction, and the above-mentioned DDL repair instruction is sent to the computing node of the above-mentioned distributed database, wherein the above-mentioned target data node is any one or more data nodes of the above-mentioned distributed database; the above-mentioned computing node is controlled to send the above-mentioned DDL repair instruction to each data node of the above-mentioned distributed database, so that each of the above-mentioned data nodes executes the above-mentioned DDL repair instruction and returns Execution result: When the execution result of the above-mentioned target data node is "execution success", the method for repairing the above-mentioned DDL atomicity problem is completed. In the above-mentioned method, by generating a DDL repair instruction and sending the DDL repair instruction to each data node, so that each data node executes the DDL repair instruction and returns the execution result, if the execution result of the data node with the DDL atomicity problem is "execution success", the repair of the DDL atomicity problem is completed, thereby achieving the purpose of effectively detecting and repairing the DDL atomicity problem in the distributed database, ensuring the stability and reliability of the database system, and then solving the technical problem of DDL atomicity problem in the distributed database. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0016] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0017] One or more embodiments are exemplarily described by pictures in the corresponding drawings, and these exemplified descriptions do not constitute limitations on the embodiments. Elements with the same reference numerals in the drawings represent similar elements, and unless otherwise stated, the figures in the drawings do not constitute proportional limitations.

[0018] Figure 1 is a flowchart of an optional method for repairing DDL atomicity problems according to an embodiment of the present application;

[0019] Figure 2 is a distributed database component interaction diagram of an optional method for repairing DDL atomicity problems according to an embodiment of the present application;

[0020] Figure 3 is a repair process flow chart of an optional method for repairing DDL atomicity problems according to an embodiment of the present application;

[0021] Figure 4 is a schematic structural diagram of an optional device for repairing DDL atomicity problems according to an embodiment of the present application;

[0022] Figure 5 is a schematic diagram of an optional electronic device according to an embodiment of the present application. DETAILED DESCRIPTION

[0023] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.

[0024] The disclosure below provides many different embodiments or examples to realize the different structures of the present application. In order to simplify the disclosure of the present application, the parts and settings of specific examples are described below. Of course, they are only examples, and the purpose is not to limit the present application. In addition, the present application can repeat reference numbers and / or letters in different examples. This repetition is for the purpose of simplification and clarity, and does not itself indicate the relationship between the various embodiments and / or settings discussed.

[0025] According to a first aspect of an embodiment of the present application, a method for repairing a DDL atomicity problem is provided. Optionally, as follows Figure 1 As shown, the above method includes:

[0026] S102, after the distributed database executes the DDL operation instruction, detecting whether the distributed database has a DDL atomicity problem;

[0027] S104, when there is a DDL atomicity problem in the target data node of the distributed database, generating a corresponding DDL repair instruction according to the DDL operation instruction, and sending the DDL repair instruction to the computing node of the distributed database, wherein the target data node is any one or more data nodes of the distributed database;

[0028] S106, controlling the computing node to send the DDL repair instruction to each data node of the distributed database, so that each data node executes the DDL repair instruction and returns the execution result;

[0029] S108, when the execution result of the target data node is successful, the DDL atomicity problem is repaired.

[0030] Optionally, in a distributed database system, DDL (Data Definition Language) operations (such as creating a table, modifying a table structure, etc.) need to be executed on multiple data nodes to ensure the structural consistency of the database. However, due to the complexity of the distributed system, some nodes may successfully execute DDL operations while other nodes fail, which leads to the DDL atomicity problem. In order to solve this problem, in this embodiment, a DDL repair instruction is generated and sent to each data node so that each data node executes the DDL repair instruction and returns an execution result. If the execution result of the data node with the DDL atomicity problem is "execution successful", the repair of the DDL atomicity problem is completed. Thereby, the purpose of effectively detecting and repairing the DDL atomicity problem in the distributed database is achieved, and the stability and reliability of the database system are ensured, thereby solving the technical problem of the DDL atomicity problem in the distributed database.

[0031] Optionally, in this embodiment, after the distributed database executes the DDL operation instruction, it is necessary to detect whether each data node has successfully executed the DDL operation. If there are one or more nodes that have not been successfully executed, it means that there is a DDL atomicity problem. If a DDL atomicity problem is detected, a corresponding DDL repair instruction is generated according to the original DDL operation instruction. These repair instructions are intended to re-execute the failed DDL operation to ensure that the structure of all data nodes is consistent. The generated DDL repair instruction is sent to the computing node of the distributed database, and the computing node is responsible for coordinating and managing various operations in the distributed database. The computing node sends the DDL repair instruction to each data node to ensure that all data nodes execute the same DDL repair instruction. Each data node executes the received DDL repair instruction and returns the execution result to the computing node. If the execution result of the data node with the DDL atomicity problem is "execution successful", it means that the DDL atomicity problem has been successfully repaired. At this point, the structure of the distributed database has been consistent on all nodes.

[0032] Optionally, this embodiment ensures the consistency of all data nodes of the distributed database when executing DDL operations, avoiding structural inconsistency problems. Automatic detection and repair of DDL atomicity problems improves the reliability of the distributed database system and reduces the necessity of manual intervention. Rapid response and repair of possible DDL atomicity problems enhance the overall stability of the database system and ensure the normal operation of the business.

[0033] As an optional example, the DDL operation instruction is to modify the object definition of each data node to a target state. After the distributed database executes the DDL operation instruction, detecting whether there is a DDL atomicity problem in the distributed database includes:

[0034] Check whether the object definition of each data node has reached the target state;

[0035] When the object definition of the target data node does not reach the target state, it is determined that there is a DDL atomicity problem in the target data node;

[0036] When the object definition of each data node reaches the target state, it is determined that there is no DDL atomicity problem in the distributed database.

[0037] Optionally, in this embodiment, when performing a DDL operation in a distributed database, the goal is to ensure that the object definitions of all data nodes reach the expected target state. However, due to the complexity of the distributed system, some nodes may fail to successfully complete the DDL operation, thereby causing the DDL atomicity problem. In order to ensure that the distributed database has a DDL atomicity problem after executing the DDL operation instruction, the distributed database needs to detect whether the distributed database has a DDL atomicity problem after executing the DDL operation instruction. Specifically, check whether the object definition of each data node has reached the expected target state, and verify whether the structure of all nodes is consistent with the expected DDL instruction. If the object definition of one or some data nodes does not reach the target state, it can be determined that these target data nodes have DDL atomicity problems, indicating that these nodes failed to successfully complete the operation when performing the DDL operation. If the object definition of each data node has reached the target state, it can be determined that the distributed database does not have a DDL atomicity problem, and at this time, the structure of all nodes is consistent with the expected DDL instruction.

[0038] Optionally, this embodiment can ensure the consistency of the distributed database when executing DDL operations by detecting whether the object definition of each data node has reached the target state, avoiding structural inconsistency problems caused by failure of certain node operations. Automatic detection and determination of DDL atomicity problems improves the reliability of the system. When problems are found, timely measures can be taken to repair them, reducing potential data inconsistency risks.

[0039] As an optional example, generating a corresponding DDL repair instruction according to the DDL operation instruction includes:

[0040] Determine the DDL operation instruction as a DDL repair instruction; or

[0041] Add a repair identifier to the DDL operation instruction to obtain the DDL repair instruction.

[0042] Optionally, in this embodiment, the DDL repair instruction corresponds to the DDL operation instruction one by one, and the DDL repair instruction can be consistent with the DDL operation instruction in syntax, or can be distinguished from the DDL operation instruction by special syntax or special identifiers. For example, if the DDL operation instruction is "create tab ledatabase1.t1(co l 1i nt)", the corresponding DDL repair instruction can be "create tab ledatabase1.t1(co l 1i nt)" or " / *repai r_dd l* / create tab ledatabase1.t1(co l 1i nt)".

[0043] As an optional example, when the execution result of the target data node is successful, repairing the DDL atomicity problem includes:

[0044] When the execution result of the target data node is successful, check whether the object definition of each data node has reached the target state;

[0045] When the object definitions of the target data nodes have reached the target state, it is determined that the DDL atomicity problem has been successfully repaired.

[0046] Optionally, in this embodiment, a DDL repair instruction is sent to each data node so that each data node executes the DDL repair instruction and returns the execution result. If the execution result of the data node with the DDL atomicity problem is "execution successful", the distributed database is checked again to see if there is a DDL atomicity problem. Specifically, check whether the object definition of each data node has reached the expected target state, and verify whether the structure of all nodes is consistent with what the DDL instruction expects. If the object definition of one or some data nodes has not reached the target state, it can be determined that these target data nodes still have DDL atomicity problems, indicating that these nodes failed to successfully complete the operation when executing the DDL repair instruction. If the object definition of each data node has reached the target state, it can be determined that the distributed database no longer has a DDL atomicity problem. At this time, the structure of all nodes is consistent with what the DDL instruction expects.

[0047] Optionally, in this embodiment, when a DDL repair instruction is executed or repeatedly executed, all data nodes will execute the DDL repair instruction. A data node that has successfully executed a DDL operation instruction or a DDL repair instruction may fail to execute the DDL repair instruction again. After receiving a response message to the DDL repair instruction, the computing node distinguishes whether it is a real execution failure or a failure caused by the database object having reached the target state. If it is the latter, the failure response of the DDL repair instruction is automatically ignored.

[0048] As an optional example, after the control computing node sends the DDL repair instruction to each data node of the distributed database so that each data node executes the DDL repair instruction and returns the execution result, the method further includes:

[0049] When the execution result of the target data node is execution failure, the computing node continues to be controlled to send the DDL repair instruction to each data node of the distributed database, so that each data node executes the DDL repair instruction and returns the execution result until the execution result of the target data node is execution success.

[0050] Optionally, in this embodiment, if the distributed database still has a DDL atomicity problem after executing the DDL repair instruction once, the control computing node continuously sends the DDL repair instruction to each data node until the execution results of all data nodes with the DDL atomicity problem are successful and the object definition of each data node reaches the target state. By repeatedly sending the DDL repair instruction, it is ensured that the object definition of all data nodes eventually reaches the expected target state, the DDL atomicity problem is solved, and the consistency of the database is guaranteed.

[0051] As an optional example, when the execution result of the target data node is an execution failure, the computing node is continuously controlled to send the DDL repair instruction to each data node of the distributed database so that each data node executes the DDL repair instruction and returns the execution result, and the method further includes:

[0052] When the number of sending times is greater than the target number of times and the execution result of the target data node is unsuccessful, a repair failure report of the target data node is output, where the number of sending times is the number of times the control computing node sends the DDL repair instruction to each data node of the distributed database.

[0053] Optionally, in this embodiment, if the DDL atomicity problem still exists in the distributed database after the number of repairs exceeds a certain number, a repair failure report of the data node with the DDL atomicity problem is output, and the report includes the specific data node with the problem and detailed information of the repair failure. By generating a detailed repair failure report, manual intervention and problem solving are assisted to ensure the consistency, reliability and stability of the system.

[0054] As an optional example, when the execution result of the target data node is successful, after the DDL atomicity problem is repaired, the method further includes:

[0055] Check whether there are any unreleased locks on the computing nodes;

[0056] In the case where there is an unreleased lock on the computing node, a release instruction is generated;

[0057] A release instruction is sent to the computing node so that the lock on the computing node is released.

[0058] Optionally, in this embodiment, in a distributed database system, when performing a DDL operation, in addition to checking the consistency of the database object definition, other attributes that may need to be repaired should also be considered. For example, due to the successful execution of the DDL operation on some data nodes and the failure of the execution on other nodes, unreleased locks or inconsistent associated database objects may be left behind. In this case, these remaining problems need to be repaired together when performing DDL repair. When it is checked that due to the successful execution of the DDL operation on some data nodes and the failure of other nodes, there are unreleased locks, or other associated database objects are not consistent, corresponding DDL repair instructions are generated, and these repair instructions include not only releasing locks, but also repairing the consistency of associated database objects. The generated DDL repair instructions are sent to each data node of the distributed database by the control computing node. After each data node receives the DDL repair instruction, it performs the corresponding repair operation and returns the execution result to the control computing node. The control computing node checks the execution result returned by each data node to determine which nodes have successfully executed the repair instruction and which nodes have failed to execute. If some nodes fail to execute, the DDL repair instructions continue to be sent to these nodes, and the repair operation is repeated until all nodes are successfully executed or the maximum number of repairs is reached. If there are still data nodes with other unrepaired attribute problems after the preset maximum number of repairs, a repair failure report is generated, which includes the specific data nodes with problems and their detailed information.

[0059] Optionally, this embodiment ensures the overall consistency of the distributed database system when executing DDL operations by checking and repairing object definitions and other attributes that need to be repaired, thereby avoiding missing issues that may affect system stability.

[0060] In conjunction with an example, the present application relates to a method for repairing a DDL atomicity problem, such as Figure 2 The distributed database component interaction diagram shown and Figure 3 The repair process flow chart shown in the figure, the specific repair method is as follows:

[0061] Step 1: After the distributed database executes the DDL operation instruction, the business application checks whether there is a DDL atomicity problem in the distributed database. If so, execute step 2; if not, execute step 7;

[0062] Step 2: The business application generates a corresponding DDL repair instruction according to the DDL operation instruction, and sends the DDL repair instruction to the computing node of the distributed database;

[0063] Step 3: The computing node sends the DDL repair instruction to each data node of the distributed database;

[0064] Step 4: Each data node executes the DDL repair instruction and returns the execution result to the computing node;

[0065] Step 5: The computing node returns the execution result of each data node to the business application;

[0066] Step 6: The business application determines whether the DDL atomicity problem has been repaired based on the execution result. If the repair is not completed, repeat steps 2 to 5. If the repair is completed, execute step 7.

[0067] Step 7: Complete the repair of the DDL atomicity problem of the distributed database.

[0068] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described order of actions, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present application.

[0069] According to another aspect of the embodiment of the present application, a device for repairing DDL atomicity problems is also provided. Figure 4 As shown, including:

[0070] A detection module 402 is used to detect whether there is a DDL atomicity problem in the distributed database after the distributed database executes the DDL operation instruction;

[0071] The sending module 404 is used to generate a corresponding DDL repair instruction according to the DDL operation instruction when there is a DDL atomicity problem in the target data node of the distributed database, and send the DDL repair instruction to the computing node of the distributed database, wherein the target data node is any one or more data nodes of the distributed database;

[0072] A first control module 406 is used to control the computing node to send the DDL repair instruction to each data node of the distributed database, so that each data node executes the DDL repair instruction and returns the execution result;

[0073] The determination module 408 is used to complete the repair of the DDL atomicity problem when the execution result of the target data node is successful.

[0074] Optionally, in a distributed database system, DDL (Data Definition Language) operations (such as creating a table, modifying a table structure, etc.) need to be performed on multiple data nodes to ensure the structural consistency of the database. However, due to the complexity of the distributed system, some nodes may successfully perform DDL operations while other nodes fail, which leads to the DDL atomicity problem. In order to solve this problem, in this embodiment, by generating a DDL repair instruction and sending the DDL repair instruction to each data node, so that each data node executes the DDL repair instruction and returns an execution result, if the execution result of the data node with the DDL atomicity problem is "execution successful", the repair of the DDL atomicity problem is completed. Thereby achieving the purpose of effectively detecting and repairing the DDL atomicity problem in the distributed database, ensuring the stability and reliability of the database system, and then solving the technical problem of the DDL atomicity problem in the distributed database.

[0075] Optionally, in this embodiment, after the distributed database executes the DDL operation instruction, it is necessary to detect whether each data node has successfully executed the DDL operation. If there are one or more nodes that have not been successfully executed, it means that there is a DDL atomicity problem. If a DDL atomicity problem is detected, a corresponding DDL repair instruction is generated according to the original DDL operation instruction. These repair instructions are intended to re-execute the failed DDL operation to ensure that the structure of all data nodes is consistent. The generated DDL repair instruction is sent to the computing node of the distributed database, and the computing node is responsible for coordinating and managing various operations in the distributed database. The computing node sends the DDL repair instruction to each data node to ensure that all data nodes execute the same DDL repair instruction. Each data node executes the received DDL repair instruction and returns the execution result to the computing node. If the execution result of the data node with the DDL atomicity problem is "execution successful", it means that the DDL atomicity problem has been successfully repaired. At this point, the structure of the distributed database has been consistent on all nodes.

[0076] Optionally, this embodiment ensures the consistency of all data nodes of the distributed database when executing DDL operations, avoiding structural inconsistency problems. Automatic detection and repair of DDL atomicity problems improves the reliability of the distributed database system and reduces the necessity of manual intervention. Rapid response and repair of possible DDL atomicity problems enhance the overall stability of the database system and ensure the normal operation of the business.

[0077] As an optional example, the detection module includes:

[0078] A first detection unit, for a DDL operation instruction to modify the object definition of each data node to a target state, and detecting whether the object definition of each data node reaches the target state;

[0079] A first determining unit, configured to determine that a DDL atomicity problem exists in the target data node when the object definition of the target data node does not reach a target state;

[0080] The second determining unit is used to determine that the distributed database does not have the DDL atomicity problem when the object definition of each data node reaches the target state.

[0081] Optionally, in this embodiment, when performing a DDL operation in a distributed database, the goal is to ensure that the object definitions of all data nodes reach the expected target state. However, due to the complexity of the distributed system, some nodes may fail to successfully complete the DDL operation, thereby causing the DDL atomicity problem. In order to ensure that the distributed database has a DDL atomicity problem after executing the DDL operation instruction, the distributed database needs to detect whether the distributed database has a DDL atomicity problem after executing the DDL operation instruction. Specifically, check whether the object definition of each data node has reached the expected target state, and verify whether the structure of all nodes is consistent with the expected DDL instruction. If the object definition of one or some data nodes does not reach the target state, it can be determined that these target data nodes have DDL atomicity problems, indicating that these nodes failed to successfully complete the operation when performing the DDL operation. If the object definition of each data node has reached the target state, it can be determined that the distributed database does not have a DDL atomicity problem, and at this time, the structure of all nodes is consistent with the expected DDL instruction.

[0082] Optionally, this embodiment can ensure the consistency of the distributed database when executing DDL operations by detecting whether the object definition of each data node has reached the target state, avoiding structural inconsistency problems caused by failure of certain node operations. Automatic detection and determination of DDL atomicity problems improves the reliability of the system. When problems are found, timely measures can be taken to repair them, reducing potential data inconsistency risks.

[0083] As an optional example, the sending module includes:

[0084] A third determining unit is configured to determine the DDL operation instruction as a DDL repair instruction; or

[0085] Add a repair identifier to the DDL operation instruction to obtain the DDL repair instruction.

[0086] Optionally, in this embodiment, the DDL repair instruction corresponds to the DDL operation instruction one by one, and the DDL repair instruction can be consistent with the DDL operation instruction in syntax, or can be distinguished from the DDL operation instruction by special syntax or special identifiers. For example, if the DDL operation instruction is "create tab ledatabase1.t1(co l 1i nt)", the corresponding DDL repair instruction can be "create tab ledatabase1.t1(co l 1i nt)" or " / *repai r_dd l* / create tab ledatabase1.t1(co l 1i nt)".

[0087] As an optional example, the determination module includes:

[0088] A second detection unit is used to detect whether the object definition of each data node reaches the target state when the execution result of the target data node is successful;

[0089] The fourth determining unit is used to determine that the DDL atomicity problem has been successfully repaired when the object definitions of the target data nodes have reached the target state.

[0090] Optionally, in this embodiment, a DDL repair instruction is sent to each data node so that each data node executes the DDL repair instruction and returns the execution result. If the execution result of the data node with the DDL atomicity problem is "execution successful", the distributed database is checked again to see if there is a DDL atomicity problem. Specifically, check whether the object definition of each data node has reached the expected target state, and verify whether the structure of all nodes is consistent with what the DDL instruction expects. If the object definition of one or some data nodes has not reached the target state, it can be determined that these target data nodes still have DDL atomicity problems, indicating that these nodes failed to successfully complete the operation when executing the DDL repair instruction. If the object definition of each data node has reached the target state, it can be determined that the distributed database no longer has a DDL atomicity problem. At this time, the structure of all nodes is consistent with what the DDL instruction expects.

[0091] Optionally, in this embodiment, when a DDL repair instruction is executed or repeatedly executed, all data nodes will execute the DDL repair instruction. A data node that has successfully executed a DDL operation instruction or a DDL repair instruction may fail to execute the DDL repair instruction again. After receiving a response message to the DDL repair instruction, the computing node distinguishes whether it is a real execution failure or a failure caused by the database object having reached the target state. If it is the latter, the failure response of the DDL repair instruction is automatically ignored.

[0092] As an optional example, the above device further includes:

[0093] The second control module is used to control the computing node to send the DDL repair instruction to each data node of the distributed database so that each data node executes the DDL repair instruction and returns the execution result. If the execution result of the target data node is an execution failure, continue to control the computing node to send the DDL repair instruction to each data node of the distributed database so that each data node executes the DDL repair instruction and returns the execution result until the execution result of the target data node is an execution success.

[0094] Optionally, in this embodiment, if the distributed database still has a DDL atomicity problem after executing the DDL repair instruction once, the control computing node continuously sends the DDL repair instruction to each data node until the execution results of all data nodes with the DDL atomicity problem are successful and the object definition of each data node reaches the target state. By repeatedly sending the DDL repair instruction, it is ensured that the object definition of all data nodes eventually reaches the expected target state, the DDL atomicity problem is solved, and the consistency of the database is guaranteed.

[0095] As an optional example, the above device further includes:

[0096] An output module is used to, when the execution result of the target data node is an execution failure, continue to control the computing node to send the DDL repair instruction to each data node of the distributed database, so that each data node executes the DDL repair instruction and returns the execution result. When the number of sending times is greater than the target number of times and the execution result of the target data node is an unsuccessful execution, output a repair failure report of the target data node, wherein the number of sending times is the number of times the computing node is controlled to send the DDL repair instruction to each data node of the distributed database.

[0097] Optionally, in this embodiment, if the DDL atomicity problem still exists in the distributed database after the number of repairs exceeds a certain number, a repair failure report of the data node with the DDL atomicity problem is output, and the report includes the specific data node with the problem and detailed information of the repair failure. By generating a detailed repair failure report, manual intervention and problem solving are assisted to ensure the consistency, reliability and stability of the system.

[0098] As an optional example, the above device further includes:

[0099] A third detection unit is used to check whether there is an unreleased lock on the computing node after the DDL atomicity problem is repaired when the execution result of the target data node is successful;

[0100] A generation unit, used for generating a release instruction when there is an unreleased lock on the computing node;

[0101] The release unit is used to send a release instruction to the computing node so that the lock on the computing node is released.

[0102] Optionally, in this embodiment, in a distributed database system, when performing a DDL operation, in addition to checking the consistency of the database object definition, other attributes that may need to be repaired should also be considered. For example, due to the successful execution of the DDL operation on some data nodes and the failure of the execution on other nodes, unreleased locks or inconsistent associated database objects may be left behind. In this case, these remaining problems need to be repaired together when performing DDL repair. When it is checked that due to the successful execution of the DDL operation on some data nodes and the failure of other nodes, there are unreleased locks, or other associated database objects are not consistent, corresponding DDL repair instructions are generated, and these repair instructions include not only releasing locks, but also repairing the consistency of associated database objects. The generated DDL repair instructions are sent to each data node of the distributed database by the control computing node. After each data node receives the DDL repair instruction, it performs the corresponding repair operation and returns the execution result to the control computing node. The control computing node checks the execution result returned by each data node to determine which nodes have successfully executed the repair instruction and which nodes have failed to execute. If some nodes fail to execute, the DDL repair instructions continue to be sent to these nodes, and the repair operation is repeated until all nodes are successfully executed or the maximum number of repairs is reached. If there are still data nodes with other unrepaired attribute problems after the preset maximum number of repairs, a repair failure report is generated, which includes the specific data nodes with problems and their detailed information.

[0103] Optionally, this embodiment ensures the overall consistency of the distributed database system when executing DDL operations by checking and repairing object definitions and other attributes that need to be repaired, thereby avoiding missing issues that may affect system stability.

[0104] For other examples of this embodiment, please refer to the above examples and will not be repeated here.

[0105] Figure 5 is a schematic diagram of an optional electronic device according to an embodiment of the present application, such as Figure 5 As shown, it includes a processor 502, a communication interface 504, a memory 506 and a communication bus 508, wherein the processor 502, the communication interface 504 and the memory 506 communicate with each other through the communication bus 508, wherein,

[0106] Memory 506, used for storing computer programs;

[0107] The processor 502 is used to execute the computer program stored in the memory 506 to implement the following steps:

[0108] After the distributed database executes the DDL operation instruction, check whether there is a DDL atomicity problem in the distributed database;

[0109] In the case where a DDL atomicity problem exists in a target data node of a distributed database, a corresponding DDL repair instruction is generated according to the DDL operation instruction, and the DDL repair instruction is sent to a computing node of the distributed database, wherein the target data node is any one or more data nodes of the distributed database;

[0110] Control the computing node to send the DDL repair instruction to each data node of the distributed database, so that each data node executes the DDL repair instruction and returns the execution result;

[0111] When the execution result of the target data node is successful, the DDL atomicity problem is repaired.

[0112] Optionally, in this embodiment, the communication bus may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 5 The communication interface is used for communication between the above electronic device and other devices.

[0113] The memory may include RAM, or may include non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.

[0114] As an example, the memory 505 may include, but is not limited to, the detection module 502, the sending module 504, the first control module 506, and the determination module 508 in the DDL atomicity problem processing device. In addition, it may also include, but is not limited to, other module units in the DDL atomicity problem repair device, which will not be repeated in this example.

[0115] The above-mentioned processor can be a general-purpose processor, which can include but not be limited to: CPU (Central Processing Unit), NP (Network Processor), etc.; it can also be DSP (Digital Signal Processing), ASIC (Application Specific Integrated Circuit), FPGA (Field-Programmable Gate Array) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

[0116] Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments, and this embodiment will not be described in detail here.

[0117] It can be understood by those skilled in the art that Figure 5 The structure shown is for illustration only. The device for implementing the above-mentioned method for repairing the DDL atomicity problem may be a terminal device, which may be a smart phone (such as an Android phone, an iOS phone, etc.), a tablet computer, a PDA, a mobile Internet device (Mobile Internet Devices, MID), a PAD, and other terminal devices. Figure 5 The structure of the electronic device is not limited. For example, the electronic device may also include Figure 5 More or fewer components (such as network interfaces, display devices, etc.) shown in, or having Figure 5 Different configurations shown.

[0118] A person of ordinary skill in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing the hardware related to the terminal device through a program, and the program can be stored in a computer-readable storage medium, which can include: a flash drive, ROM, RAM, a magnetic disk or an optical disk, etc.

[0119] According to another aspect of an embodiment of the present application, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program executes the steps in the above-mentioned method for repairing the DDL atomicity problem when executed by a processor.

[0120] Optionally, in this embodiment, a person of ordinary skill in the art may understand that all or part of the steps in the various methods of the above embodiments may be completed by instructing hardware related to the terminal device through a program, and the program may be stored in a computer-readable storage medium, and the storage medium may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, etc.

[0121] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.

[0122] If the integrated units in the above embodiments are implemented in the form of software functional units and sold or used as independent products, they can be stored in the above computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling one or more computer devices (which may be personal computers, servers, or network devices, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application.

[0123] In the above embodiments of the present application, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.

[0124] In the several embodiments provided in the present application, it should be understood that the disclosed client can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.

[0125] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0126] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0127] The above is only a preferred implementation of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.

Claims

1. A method to repair the DDL atomicity problem. It is characterized in that include: After the distributed database executes the DDL operation instruction, detecting whether the distributed database has a DDL atomicity problem; In the case where the DDL atomicity problem exists in the target data node of the distributed database, generating a corresponding DDL repair instruction according to the DDL operation instruction, and sending the DDL repair instruction to the computing node of the distributed database, wherein the target data node is any one or more data nodes of the distributed database; Control the computing node to send the DDL repair instruction to each data node of the distributed database, so that each data node executes the DDL repair instruction and returns an execution result; When the execution result of the target data node is successful, the repair of the DDL atomicity problem is completed.

2. The method according to claim 1, It is characterized in that The DDL operation instruction is to modify the object definition of each data node to a target state. After the distributed database executes the DDL operation instruction, detecting whether the distributed database has a DDL atomicity problem includes: Detecting whether the object definition of each data node has reached the target state; When the object definition of the target data node does not reach the target state, determining that the target data node has the DDL atomicity problem; When the object definition of each data node reaches the target state, it is determined that the distributed database does not have the DDL atomicity problem.

3. The method according to claim 1, It is characterized in that Generating a corresponding DDL repair instruction according to the DDL operation instruction includes: Determine the DDL operation instruction as the DDL repair instruction; or A repair identifier is added to the DDL operation instruction to obtain the DDL repair instruction.

4. The method according to claim 1, It is characterized in that When the execution result of the target data node is successful, completing the repair of the DDL atomicity problem includes: When the execution result of the target data node is successful, detecting whether the object definition of each data node has reached the target state; When the object definitions of the target data nodes all reach the target state, it is determined that the DDL atomicity problem has been successfully repaired.

5. The method according to claim 1, It is characterized in that After controlling the computing node to send the DDL repair instruction to each data node of the distributed database so that each data node executes the DDL repair instruction and returns an execution result, the method further includes: When the execution result of the target data node is execution failure, continue to control the computing node to send the DDL repair instruction to each data node of the distributed database, so that each data node executes the DDL repair instruction and returns the execution result, until the execution result of the target data node is execution success.

6. The method according to claim 5, It is characterized in that When the execution result of the target data node is an execution failure, the method further includes: continuing to control the computing node to send the DDL repair instruction to each data node of the distributed database so that each data node executes the DDL repair instruction and returns the execution result. When the number of sending times is greater than the target number of times and the execution result of the target data node is unsuccessful, a repair failure report of the target data node is output, wherein the number of sending times is the number of times the computing node is controlled to send the DDL repair instruction to each data node of the distributed database.

7. The method according to claim 1, It is characterized in that When the execution result of the target data node is successful, after the DDL atomicity problem is repaired, the method further includes: Checking whether there is an unreleased lock on the computing node; If there is an unreleased lock on the computing node, generating a release instruction; The release instruction is sent to the computing node, so that the lock on the computing node is released.

8. A device for repairing DDL atomicity problems. It is characterized in that include: A detection module, used for detecting whether there is a DDL atomicity problem in the distributed database after the distributed database executes the DDL operation instruction; A sending module, configured to generate a corresponding DDL repair instruction according to the DDL operation instruction when the DDL atomicity problem exists in the target data node of the distributed database, and send the DDL repair instruction to the computing node of the distributed database, wherein the target data node is any one or more data nodes of the distributed database; A first control module, used to control the computing node to send the DDL repair instruction to each data node of the distributed database, so that each data node executes the DDL repair instruction and returns an execution result; The determination module is used to complete the repair of the DDL atomicity problem when the execution result of the target data node is successful.

9. A computer-readable storage medium storing a computer program. It is characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is executed.

10. An electronic device comprising a memory and a processor, It is characterized in that A computer program is stored in the memory, and the processor is configured to execute the method according to any one of claims 1 to 7 through the computer program.