DDL statement processing

By introducing synchronization points in the target processing phase in the distributed database, we ensure that DDL statements are processed on all physical shards, solve the problem of inconsistent metadata caused by the execution of DDL statements, and achieve consistency of metadata and stability of the database.

WO2025219804A1PCT designated stage Publication Date: 2025-10-23CLOUD INTELLIGENCE ASSETS HOLDING (SINGAPORE) PTE LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
PCT/IB2025/053633
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2024-04-17
Filing Date
2025-04-07
Publication Date
2025-10-23

AI Technical Summary

Technical Problem

In a distributed database, executing DDL statements on different physical shards may cause inconsistent metadata, affecting database usage.

Method used

By introducing synchronization points in the target processing phase in the distributed database system and utilizing the interaction between the control thread and the DDL thread, we ensure that all physical shards complete the corresponding processing behavior in each processing phase before entering the next phase, and set synchronization points to ensure the consistency of metadata.

Benefits of technology

It achieves the consistency of metadata of multiple physical shards in a distributed database, avoids long-term inconsistency problems caused by the failure of some shards to execute, and improves the stability and reliability of the database.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure IB2025053633_23102025_PF_FP_ABST
    Figure IB2025053633_23102025_PF_FP_ABST
Patent Text Reader

Abstract

Provided are a DDL statement processing method and system, a device, and a storage medium, comprising: a computing node sending to a storage node a first indicating signal used for indicating entry into a target processing phase of a DDL statement. By means of a control thread, the storage node sending to at least one DDL thread corresponding to at least one physical sharding a first notification signal corresponding to the first indicating signal, so as to execute a processing behavior corresponding to the target processing phase by means of the at least one DDL thread, and sending a second notification signal to the control thread after executing the processing behavior; and, by means of the control thread, sending to the computing node a second indicating signal indicating that the at least one DDL thread is sending a second notification signal, and the computing node determining an execution state of the DDL statement according to the second indicating signal.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] DDL statement processing technology

[0002]

[0001] The present disclosure relates to the field of computer technology, and in particular to DDL statement processing.

[0003] MySQL is a relational database management system. In a distributed database based on the MySQL Sharding architecture, Sharding (i.e., sharding) technology can be used to split a logical table containing complete data of the distributed database into multiple physical shards corresponding to the logical table, wherein the multiple physical shards are stored in the storage nodes of the distributed database.

[0004] Data Definition Language (DDL) is a type of Structured Query Language (SQL) used to define database objects such as tables, columns, and indexes. DDL statements execute on logical tables. However, due to the sharding mechanism in distributed databases, DDL statements must be executed separately on the different physical shards corresponding to the logical tables. Specifically, DDL statements are used to modify metadata about physical shards, such as adding or removing columns, changing the byte length of a column, or modifying the data format of a column.

[0005]

[0004] In actual applications, when executing a DDL statement in sequence on different physical shards, the statement may be executed successfully on some physical shards but not on other physical shards, resulting in inconsistent metadata corresponding to multiple physical shards, affecting the use of the database.

[0006]

[0005] The embodiments of the present disclosure provide a DDL statement processing method, system, device and storage medium to achieve consistency of physical shard meta information during the execution of DDL statements on different physical shards.

[0007]

[0006] In a first aspect, the embodiments of the present disclosure provide a DDL statement processing method, applied to a storage node in a distributed database system, the storage node executing a control thread and at least one DDL thread corresponding to at least one physical shard stored locally, the method comprising: if a first indication signal indicating entering a target processing stage of a DDL statement is received by the control thread from a computing node, sending a first notification signal corresponding to the first indication signal to the at least one DDL thread respectively by the control thread, the DDL statement being used to modify meta information of the at least one physical shard; performing a processing behavior corresponding to the target processing stage by the at least one DDL thread respectively, and sending a second notification signal indicating reaching a target synchronization point to the control thread after the processing behavior is performed, the target synchronization point corresponding to the target processing stage; sending a second indication signal corresponding to the target synchronization point to the computing node by the control thread, so that the computing node determines an execution state of the DDL statement according to the second indication signal, the second indication signal indicating that the at least one DDL thread all sends the second notification signal.

[0008]

[0007] In a second aspect, the embodiments of the present disclosure provide a DDL statement processing apparatus, applied to a storage node in a distributed database system, the storage node executing a control thread and at least one DDL thread corresponding to at least one physical shard stored locally, the apparatus comprising: a first receiving module, configured to, if a first indication signal indicating entering a target processing stage of a DDL statement is received by the control thread from a computing node, send a first notification signal corresponding to the first indication signal to the at least one DDL thread respectively by the control thread, the DDL statement being used to modify meta information of the at least one physical shard; a first processing module, configured to perform a processing behavior corresponding to the target processing stage by the at least one DDL thread respectively, and send a second notification signal indicating reaching a target synchronization point to the control thread after the processing behavior is performed, the target synchronization point corresponding to the target processing stage; and a first sending module, further configured to send a second indication signal corresponding to the target synchronization point to the computing node by the control thread, so that the computing node determines an execution state of the DDL statement according to the second indication signal, the second indication signal indicating that the at least one DDL thread all sends the second notification signal.

[0009]

[0008] In a third aspect, the embodiments of the present disclosure provide an electronic device, comprising: a memory, a processor, a communication interface; wherein the memory stores executable code, when the executable code is executed by the processor, the processor can at least implement the DDL statement processing method according to the first aspect.

[0010]

[0009] In a fourth aspect, the embodiments of the present disclosure provide a non-transitory machine readable storage medium, the non-transitory machine readable storage medium stores executable code, when the executable code is executed by a processor of an electronic device, the processor can at least implement the DDL statement processing method according to the first aspect.

[0010] In a fifth aspect, the embodiments of the present disclosure provide a DDL statement processing method, applied to a computing node in a distributed database system, the computing node communicates with a storage node in the distributed database system, the storage node executes a control thread and at least one DDL thread corresponding to at least one physical shard stored locally, the method comprises: sending a first indication signal for indicating a target processing stage of a DDL statement to the control thread, so that the control thread sends a first notification signal corresponding to the first indication signal to the at least one DDL thread, so that the at least one DDL thread executes a processing behavior corresponding to the target processing stage, and sends a second notification signal indicating reaching a target synchronization point to the control thread after executing the processing behavior, the target synchronization point corresponds to the target processing stage, and the DDL statement is used to modify the meta information of the at least one physical shard; receiving a second indication signal corresponding to the target synchronization point sent by the control thread, the second indication signal indicates that the at least one DDL thread sends the second notification signal; determining the execution state of the DDL statement according to the second indication signal.

[0011]

[0011] In a sixth aspect, the embodiments of the present disclosure provide a DDL statement processing apparatus, applied to a computing node in a distributed database system, the computing node being in communication with a storage node in the distributed database system, the storage node comprising a control thread and at least one DDL thread corresponding to at least one physical shard stored locally, the apparatus comprising: a second sending module configured to send, to the control thread, a first indication signal indicating that a target processing stage of a DDL statement is entered, so that the control thread sends, to the at least one DDL thread, a first notification signal corresponding to the first indication signal, so that the at least one DDL thread performs a processing action corresponding to the target processing stage, and sends, to the control thread, a second notification signal indicating that a target synchronization point is reached after the processing action is performed, the target synchronization point corresponding to the target processing stage, the DDL statement being used to modify meta information of the at least one physical shard; a second receiving module configured to receive, from the control thread, a second indication signal corresponding to the target synchronization point, the second indication signal indicating that the at least one DDL thread sends the second notification signal; and a second processing module configured to determine an execution state of the DDL statement according to the second indication signal.

[0012]

[0012] In a seventh aspect, the embodiments of the present disclosure provide an electronic device, comprising: a memory, a processor, and a communication interface; wherein the memory stores executable code, and when the executable code is executed by the processor, the processor can at least implement the DDL statement processing method according to the fifth aspect.

[0013]

[0013] In an eighth aspect, the embodiments of the present disclosure provide a non-transitory machine readable storage medium, the non-transitory machine readable storage medium storing executable code, and when the executable code is executed by a processor of an electronic device, the processor can at least implement the DDL statement processing method according to the fifth aspect.

[0014]

[0014] In a ninth aspect, the embodiments of the present disclosure provide a distributed database system, comprising: a computing node and a storage node, wherein the storage node executes a control thread and at least one DDL thread corresponding to at least one physical shard stored locally; the computing node is configured to send a first indication signal to the control thread, the first indication signal being used to indicate that a target processing stage of a DDL statement is entered, the DDL statement being used to modify the meta information of the at least one physical shard; the control thread is configured to send a first notification signal corresponding to the first indication signal to the at least one DDL thread respectively; the at least one DDL thread is configured to execute a processing behavior corresponding to the target processing stage based on the first notification signal, and send a second notification signal indicating that a target synchronization point is reached to the control thread after the processing behavior is executed, the target synchronization point corresponding to the target processing stage; the control thread is further configured to send a second indication signal corresponding to the target synchronization point to the computing node, the second indication signal indicating that the at least one DDL thread all sends the second notification signal; and the computing node is further configured to determine the execution state of the DDL statement according to the second indication signal.

[0015]

[0015] The scheme provided by the embodiments of the present disclosure can be applied to a relational distributed database, which includes but is not limited to a communication-connected computing node and a storage node, wherein the storage node executes a control thread and at least one DDL thread corresponding to at least one physical shard stored locally. In the process of modifying the meta information of the at least one physical shard through a DDL statement, for any processing stage (referred to as a target processing stage) corresponding to the DDL statement, the storage node receives, through the control thread, a first indication signal sent by the computing node for indicating entering the target processing stage of the DDL statement, and sends, through the control thread, a first notification signal corresponding to the first indication signal to the at least one DDL thread respectively, so as to notify the at least one DDL thread to execute a processing behavior corresponding to the target processing stage. The storage node sends, through the at least one DDL thread, a second notification signal indicating reaching a target synchronization point corresponding to the target processing stage to the control thread after the at least one DDL thread executes the processing behavior corresponding to the target processing stage. If the second notification signal is sent by all the at least one DDL thread, the storage node sends, through the control thread, a second indication signal corresponding to the target synchronization point to the computing node, so that the computing node determines the execution state of the DDL statement according to the second indication signal. That is, if the second indication signal is received by the computing node, it indicates that the processing behavior corresponding to the target processing stage is executed by the at least one DDL thread; if the second indication signal is not received by the computing node, it indicates that there is a DDL thread in the at least one DDL thread which does not execute the processing behavior corresponding to the target processing stage. When the target processing stage is the last processing stage corresponding to the DDL statement, if the second indication signal is received by the computing node, it indicates that the meta information of the at least one physical shard is all modified completely, that is, the consistent modification of the meta information of the physical shard is completed. When the second indication signal is not received by the computing node, the at least one DDL thread can be notified to perform a processing such as rollback, that is, to return to the state before the DDL statement is executed, so that the meta information of the at least one physical shard is still in the state before the DDL statement is executed, thereby ensuring the consistency of the meta information of different physical shards.

[0016]

[0016] To sum up, in the scheme, the target synchronization point corresponding to the target processing stage is set, and the control thread sends the second indication signal to the computing node after receiving the second notification signal sent by all the DDL threads and indicating reaching the target synchronization point, so that the progress of the DDL statement in the target processing stage is synchronized, and the meta information of the at least one physical shard is ensured to be consistent.

[0017]

[0017] In order to more clearly illustrate the technical solutions in the embodiments of the present disclosure, the following will briefly introduce the drawings needed to be used in the embodiments description. Obviously, the drawings in the following description are some embodiments of the present disclosure, and for those skilled in the art, other drawings can also be obtained from these drawings without any creative effort.

[0018]

[0018] Fig. 1 is a schematic diagram of a distributed database system provided by an embodiment of the present disclosure;

[0019]

[0019] Fig. 2 is an interactive flowchart of a DDL statement processing method provided by an embodiment of the present disclosure;

[0020]

[0020] Fig. 3 is an interactive flowchart of another DDL statement processing method provided by an embodiment of the present disclosure;

[0021]

[0021] Fig. 4 is a schematic diagram of a DDL statement processing process provided by an embodiment of the present disclosure;

[0022]

[0022] Fig. 5 is a schematic diagram of another DDL statement processing process provided by an embodiment of the present disclosure;

[0023]

[0023] Fig. 6 is a flowchart of a DDL statement processing method provided by an embodiment of the present disclosure;

[0024]

[0024] Fig. 7 is a flowchart of another DDL statement processing method provided by an embodiment of the present disclosure;

[0025]

[0025] Fig. 8 is a structural schematic diagram of a DDL statement processing apparatus provided by an embodiment of the present disclosure;

[0026]

[0026] Fig. 9 is a structural schematic diagram of an electronic device corresponding to the DDL statement processing apparatus provided by the embodiment shown in Fig. 8;

[0027]

[0027] Fig. 10 is a structural schematic diagram of another DDL statement processing apparatus provided by an embodiment of the present disclosure;

[0028]

[0028] Fig. 11 is a structural schematic diagram of an electronic device corresponding to the DDL statement processing apparatus provided by the embodiment shown in Fig. 10. DETAILED DESCRIPTION

[0029]

[0029] In order to make the purposes, technical solutions and advantages of the embodiments of the present disclosure clearer, the technical solutions in the embodiments of the present disclosure will be described clearly and completely below with reference to the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are some but not all of the embodiments of the present disclosure. Based on the embodiments in the present disclosure, all other embodiments obtained by a person of ordinary skill in the art without creative work fall within the protection scope of the present disclosure.

[0030]

[0030] It should be noted that the user information (including but not limited to user equipment information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in the embodiments of the present disclosure are all information and data authorized by the user or authorized by all parties, and the collection, use and processing of the related data need to comply with the relevant laws, regulations and standards of the country and region, and provide corresponding operation portal for the user to choose authorization or refusal.

[0031]

[0031] In addition, the sequence of steps in each method embodiment described below is only an example, not a strict limitation.

[0032]

[0032] The following first describes several concepts involved in the embodiments of the present disclosure.

[0033]

[0033] MySQL is a relational database management system.

[0034]

[0034] Physical shards, also known as physical tables, are used to store data in the database locally on the storage node. Specifically, in a distributed database based on the MySQL Sharding architecture, the Sharding (i.e., sharding) technology can be used to split the logical table containing the complete data of the distributed database (for example: vertical split, horizontal split, etc.), to obtain multiple physical shards corresponding to the logical table.

[0035] The multiple physical shards are stored in the storage node of the distributed database, and the data stored in all the physical shards collectively represents the complete data of the database contained in the logical table.

[0036]

[0035] Logical meta information, i.e., meta information corresponding to the logical table, records the storage locations of the multiple physical shards corresponding to the logical table, the data format and column index information of the data stored in each physical shard, etc.

[0037]

[0036] Meta information of the physical shard, used to record data format and column index information of the data stored in the physical shard.

[0037] DDL statement, a kind of SQL statement, used to define database objects such as table, column, index, etc. In the present scheme, the DDL statement is used to modify the meta information of the physical shard, such as adding or reducing a column field, modifying the byte length of a column field, or modifying the data format of a column field, etc.

[0038]

[0038] Data Manipulation Language (DML), a kind of SQL, DML statement is used to add, delete, update and query data in the database.

[0039]

[0039] Meta data lock (MDL), including MDL read lock and MDL write lock, used to protect the structure of database objects such as table and index. Among them, MDL read locks do not mutually exclusive; MDL write locks and MDL read locks are mutually exclusive, that is, exclusive.

[0040]

[0040] Data dictionary lock, that is, the meta data lock in the storage engine layer of the MySQL logical system architecture (including: MySQL service layer and storage engine layer)

[0041]

[0041] DDL thread, that is, the thread for executing DDL statement on the storage node.

[0042]

[0042] Control thread, that is, the thread for detecting the execution state of DDL statement on the storage node, and sending a notification signal to the DDL thread, the notification signal is used to notify the DDL thread to execute the processing behavior associated with the DDL statement.

[0043]

[0043] In practical application, the operation (execution) object of DDL statement is logical table, but due to the sharding mechanism in distributed database, DDL statement needs to be executed on different physical shards corresponding to the logical table respectively, and after the DDL statement is executed on all physical shards, the meta information of the logical table, that is, the logical meta information, is updated.

[0044]

[0044] However, in the process of sequentially executing a certain DDL statement, different physical shards may execute successfully on some physical shards (i.e., the meta information of the physical shards is modified successfully) but fail to execute on other physical shards (i.e., the meta information of the physical shards is not modified successfully), resulting in inconsistent meta information of multiple physical shards, and because the execution on some physical shards fails, the logical meta information cannot be updated, and the logical meta information is inconsistent with the meta information of the physical shards that have successfully modified the meta information for a long time, affecting the use of the database.

[0045]

[0045] To solve the at least one technical problem described above, the embodiments of the present disclosure provide a DDL statement processing scheme. Based on the scheme provided by the embodiments of the present disclosure, the execution progress of DDL statements of multiple physical shards can be synchronized, and the consistency of the meta information of multiple physical shards can be achieved, effectively solving the problem of inconsistent meta information of multiple physical shards and long-term inconsistency between the logical meta information and the meta information of the physical shards caused by the failure of executing DDL statements on some physical shards.

[0046]

[0046] The scheme provided by the embodiments of the present disclosure can be applied to a relational distributed database. FIG. 1 is a schematic diagram of a distributed database system provided by an embodiment of the present disclosure. As shown in FIG. 1, the distributed database system includes a computing node and a storage node, which are communicatively connected.

[0047]

[0047] The computing node serves as an entrance of the distributed database system and can be used to receive a DDL statement issued by a client and trigger the storage node to execute the DDL statement on a corresponding physical shard. The storage node executes a control thread and at least one DDL thread corresponding to at least one locally stored physical shard, for example, DDL thread 1 corresponding to physical shard 1, DDL thread 2 corresponding to physical shard 2, and the like in FIG. 1.

[0048]

[0048] The number of computing nodes and storage nodes is related to the actual configuration of the distributed database. As shown in FIG. 1, the distributed database system can include n computing nodes (for example, computing node 1-computing node 2-computing node n) and m storage nodes (storage node 1, storage node 2, and storage node m), where n and m are integers greater than 1, and n and m can be equal or not equal. In actual applications, the DDL statement processing processes of any communicatively connected computing node and storage node are the same.

[0049]

[0049] The working process of the storage node and the computing node in the DDL statement processing scheme provided by the embodiment of the present disclosure is exemplarily described below in combination with FIG. 2.

[0050]

[0050] FIG. 2 is an interaction flowchart of a DDL statement processing method provided by an embodiment of the present disclosure. As shown in FIG. 2, the method can include the following steps.

[0051]

[0051] 201. The computing node sends a first indication signal to the control thread of the storage node, the first indication signal being used to indicate that the target processing phase of the DDL statement is entered, and the DDL statement being used to modify the meta information of at least one physical shard stored locally by the storage node.

[0052]

[0052] 202. If the first indication signal is received by the control thread of the storage node, the control thread sends a first notification signal corresponding to the first indication signal to at least one DDL thread corresponding to at least one physical shard, respectively.

[0053]

[0053] 203. The storage node performs a processing behavior corresponding to the target processing phase through at least one DDL thread, respectively.

[0054] 204. After the processing behavior is performed, at least one DDL thread of the storage node sends a second notification signal indicating that the target synchronization point is reached to the control thread, respectively, the target synchronization point corresponding to the target processing phase.

[0054]

[0055] 205. The storage node sends a second indication signal corresponding to the target synchronization point to the computing node through the control thread, the second indication signal indicating that the second notification signal is sent by at least one DDL thread.

[0055]

[0056] 206. The computing node receives the second indication signal, and determines the execution state of the DDL statement according to the second indication signal.

[0056]

[0057] In actual application, for any DDL statement issued by the client, the execution flow thereof can be divided into three processing phases, which are, in sequence, an initial processing phase, a preparation processing phase and a submission processing phase. Each processing phase needs to complete different processing behaviors, for example, the initial processing phase needs to complete the acquisition of MDL read lock, the copying of the inventory data and the incremental data in the physical shard; the preparation processing phase needs to complete the upgrade of the MDL read lock to MDL write lock, and the data consistency check; and the submission processing phase needs to complete the acquisition of data dictionary lock, and the switching of the new and old physical shards.

[0057]

[0058] In the process of executing the DDL statement on the multiple physical shards, if any processing stage of the DDL statement fails, the execution of the DDL statement fails, and the meta information of the multiple physical shards is inconsistent. In the embodiment, the synchronization points are introduced in the three processing stages of the DDL statement, and the processing logic is added, so as to synchronize the execution progress of the DDL statement of the multiple physical shards, and ensure the consistency of the meta information of the multiple physical shards.

[0058]

[0059] First, the setting of the synchronization point and the implementation process of the synchronization of the execution progress of the DDL statement of the multiple physical shards are described in the dimension of the processing stage. The specific processing behaviors corresponding to the three processing stages will be described in subsequent embodiments.

[0059]

[0060] It should be noted that in the embodiment, for convenience of description, the initial processing stage, the preparation processing stage and the commit processing stage are collectively referred to as the target processing stage in the embodiment shown in FIG. 2, that is, the target processing stage actually represents any one of the initial processing stage, the preparation processing stage and the commit processing stage.

[0060]

[0061] It can be understood that when the target processing stage represents different processing stages of the DDL statement, the first indication signal, the second indication signal, the first notification signal, the second notification signal and the target synchronization point corresponding to the target processing stage directly or indirectly in the embodiment shown in FIG. 2 all correspond to different meanings.

[0061]

[0062] The DDL statement processing method provided in the embodiment shown in FIG. 2 will be described in detail by substituting the target processing stage into the specific DDL statement processing stage.

[0062]

[0063] First, the client sends the DDL statement to the computing node, wherein the DDL statement is used to modify the meta information of at least one physical shard stored locally by the storage node, and the format of the DDL statement is "alter table info", wherein info represents a specific operation behavior, for example: alter table tl add column t2 int, which means adding a column named t2 to the physical shard tl, and the data type of the column is integer.

[0063]

[0064] After the computing node receives the DDL statement, the computing node notifies the storage node in communication connection with the computing node to start the corresponding control thread, and informs the storage node that at least one physical shard needs to execute the DDL statement, so that the storage node starts at least one DDL thread for the at least one physical shard.

[0064]

[0065] Then, the computing node sends a first indication signal to the control thread of the storage node, the first indication signal being used to indicate that the initial processing stage of the DDL statement is entered.

[0065]

[0066] If the first indication signal sent by the computing node is received by the control thread of the storage node, the control thread sends a first notification signal corresponding to the first indication signal to at least one DDL thread.

[0066]

[0067] In an optional embodiment, the first notification signal is preset with a processing stage flag, and the processing stage flag can be set as a target processing stage, so as to be used to notify the DDL thread that the current processing stage of the DDL statement is the target processing stage.

[0067]

[0068] Optionally, the processing stage indicated by the processing stage flag preset in the first notification signal when the processing stage flag is set as different fields can be preconfigured, for example, the processing stage flag is set as "start", indicating that the current processing stage of the DDL statement is the initial processing stage; the processing stage flag is set as "prepare", indicating that the current processing stage of the DDL statement is the preparation processing stage; and the processing stage flag is set as "commit", indicating that the current processing stage of the DDL statement is the commit processing stage. Thus, when the control thread sends the first notification signal to the DDL thread, the processing stage flag preset in the first notification signal can be set as a field used to indicate the target processing stage based on the preconfigured information.

[0068]

[0069] When the target processing stage is the initial processing stage, the processing stage flag preset in the first notification signal is set as the initial processing stage, and specifically, the processing stage flag preset in the first notification signal can be set as "start".

[0069]

[0070] After receiving the first notification signal sent by the control thread, at least one DDL thread in the storage node executes a processing behavior corresponding to the initial processing stage. After each DDL thread executes the processing behavior of the initial processing stage of the DDL statement, the DDL thread sends a second notification signal indicating that a first synchronization point is reached to the control thread. The first synchronization point corresponds to the initial processing stage, that is, the first synchronization point is a synchronization point set for the initial processing stage, and is used to confirm whether the processing behavior of the initial processing stage is completed by at least one DDL thread.

[0070]

[0071] The control thread in the storage node sends a second indication signal corresponding to the first synchronization point to the computing node after receiving the second notification signal sent by the at least one DDL thread.

[0071]

[0072] It can be understood that if the DDL thread in the at least one DDL thread does not complete the processing behavior of the initial processing stage of the DDL statement, the DDL thread will not send the second notification signal to the control thread, and the control thread will not send the second indication signal to the computing node.

[0072]

[0073] If the computing node receives the second indication signal sent by the control thread of the storage node, it indicates that the at least one DDL thread has completed the processing behavior corresponding to the initial processing stage of the DDL statement, and can enter the preparation processing stage of the DDL statement.

[0073]

[0074] It can be seen that by setting the first synchronization point corresponding to the initial processing stage, and causing the control thread to send the second indication signal to the computing node after receiving the second notification signal sent by all DDL threads indicating the arrival of the first synchronization point, the progress of the DDL statement in the initial processing stage can be synchronized, and it is ensured that the at least one DDL thread completes the processing behavior of the initial processing stage of the DDL statement before entering the next processing stage of the DDL statement, i.e., the preparation processing stage.

[0074]

[0075] Then, the computing node sends a first indication signal to the control thread of the storage node for indicating entering the preparation processing stage of the DDL statement.

[0075]

[0076] If the storage node receives the first indication signal sent by the computing node for indicating entering the preparation processing stage of the DDL statement through the control thread, the control thread sends a first notification signal corresponding to the first indication signal to the at least one DDL thread.

[0076]

[0077] When the target processing stage is the preparation processing stage, the processing stage flag bit preset in the first notification signal is set to the preparation processing stage, and specifically, the processing stage flag bit preset in the first notification signal can be set to "prepare".

[0077]

[0078] The at least one DDL thread in the storage node executes the processing behavior corresponding to the preparation processing stage after receiving the first notification signal sent by the control thread. Each DDL thread sends a second notification signal indicating reaching a second synchronization point to the control thread after executing the processing behavior of the preparation processing stage of the DDL statement. The second synchronization point corresponds to the preparation processing stage, i.e., the synchronization point set for the preparation processing stage is used to confirm whether the at least one DDL thread has completed the processing behavior of the preparation processing stage.

[0078]

[0079] The control thread in the storage node sends a second indication signal corresponding to the second synchronization point to the computing node after receiving the second notification signal sent by the at least one DDL thread. The second indication signal indicates that the at least one DDL thread has sent the second notification signal, i.e., all DDL threads have completed the processing behavior of the preparation processing stage of the DDL statement.

[0079]

[0080] It can be understood that if there is a DDL thread in the at least one DDL thread that has not completed the processing behavior of the preparation processing stage of the DDL statement, the DDL thread will not send the second notification signal to the control thread, and the control thread will not send the second indication signal to the computing node.

[0080]

[0081] If the computing node receives the second indication signal sent by the control thread of the storage node, it indicates that the at least one DDL thread has completed the processing behavior corresponding to the preparation processing stage of the DDL statement, and can enter the commit processing stage of the DDL statement.

[0081]

[0082] It can be seen that by setting the second synchronization point corresponding to the preparation processing stage, and making the control thread send the second indication signal to the computing node after receiving the second notification signal sent by all DDL threads indicating reaching the second synchronization point, the progress of the DDL statement in the preparation processing stage can be synchronized, and it is ensured that the at least one DDL thread has completed the processing behavior of the preparation processing stage of the DDL statement before entering the next processing stage of the DDL statement, i.e., the commit processing stage.

[0082]

[0083] Finally, the computing node sends a first indication signal to the control thread of the storage node to indicate entering the commit processing stage of the DDL statement.

[0083]

[0084] The storage node sends, through the control thread, a first notification signal corresponding to the first indication signal to at least one DDL thread, if the storage node receives the first indication signal sent by the computing node and indicating that the DDL statement enters the commit processing stage.

[0084]

[0085] When the target processing stage is the commit processing stage, a processing stage flag bit preset in the first notification signal is set as the commit processing stage. Specifically, the processing stage flag bit preset in the first notification signal can be set as "commit".

[0085]

[0086] The at least one DDL thread in the storage node executes a processing behavior corresponding to the commit processing stage after receiving the first notification signal sent by the control thread. Each DDL thread sends a second notification signal indicating reaching a third synchronization point to the control thread after executing the processing behavior of the commit processing stage of the DDL statement. The third synchronization point corresponds to the commit processing stage, that is, the third synchronization point is a synchronization point set for the commit processing stage, and is used to confirm whether the at least one DDL thread has completed the processing behavior of the commit processing stage.

[0086]

[0087] The control thread in the storage node sends a second indication signal corresponding to the third synchronization point to the computing node after receiving the second notification signal sent by the at least one DDL thread. The second indication signal indicates that the at least one DDL thread has sent the second notification signal, that is, all the DDL threads have completed the processing behavior of the commit processing stage of the DDL statement.

[0087]

[0088] It can be understood that, if there is a DDL thread in the at least one DDL thread that has not completed the processing behavior of the commit processing stage of the DDL statement, the DDL thread will not send the second notification signal to the control thread, and the control thread will not send the second indication signal to the computing node.

[0088]

[0089] The computing node indicates that the at least one DDL thread has completed the processing behavior corresponding to the commit processing stage of the DDL statement, that is, the execution of the DDL statement is completed, and the meta information of the at least one physical shard has been modified, if the computing node receives the second indication signal sent by the control thread of the storage node.

[0089]

[0090] It can be seen that by setting the third synchronization point corresponding to the commit processing stage, and causing the control thread to send the second indication signal to the computing node after receiving the second notification signal sent by all the DDL threads indicating reaching the third synchronization point, the progress of the DDL statement in the commit processing stage can be synchronized, and the processing behavior of the at least one DDL thread in the commit processing stage of the DDL statement is ensured to be completed, i.e., the meta information of the multiple physical shards is modified and completed.

[0090]

[0091] In the above DDL statement processing process, the control thread in the storage node will confirm whether the at least one DDL thread has completed the processing behavior of the DDL statement in the corresponding processing stage at the first synchronization point corresponding to the initial processing stage, the second synchronization point corresponding to the preparation processing stage, and the third synchronization point corresponding to the commit processing stage. When the at least one DDL thread has completed the processing behavior of the DDL statement in the corresponding processing stage, the second indication signal is sent to the computing node; when there is a DDL thread that has not completed the processing behavior of the DDL statement in the corresponding processing stage in the at least one DDL thread, the second indication signal is not sent to the computing node.

[0091]

[0092] In an optional embodiment, if the computing node does not receive the second indication signal sent by the control thread within a preset waiting time, i.e., the computing node times out without receiving the second indication signal, it is determined that the DDL statement execution fails, and a rollback instruction is sent to the at least one DDL thread in the storage node. If the storage node receives the rollback instruction sent by the computing node through the at least one DDL thread, rollback processing is performed, i.e., all completed processing behaviors corresponding to the DDL statement are deleted, and the state before executing the DDL statement is returned. For example, if the storage node receives the rollback instruction sent by the computing node through the at least one DDL thread at the first synchronization point, the at least one DDL thread deletes the processing behavior performed in the initial processing stage of the DDL statement; if the storage node receives the rollback instruction sent by the computing node through the at least one DDL thread at the second synchronization point, the at least one DDL thread deletes the processing behavior performed in the initial processing stage and the preparation processing stage of the DDL statement.

[0092]

[0093] In another optional embodiment, when the computing node determines that the at least one DDL thread executes abnormally, a rollback instruction can also be sent to the at least one DDL thread in the storage node, so that the storage node performs rollback processing after receiving the rollback instruction sent by the computing node through the at least one DDL thread.

[0093]

[0094] In summary, in the process of modifying the meta information of at least one physical shard stored locally by the storage node of the distributed database through the DDL statement, for any one of the initial processing stage, the preparation processing stage and the commit processing stage (referred to as the target processing stage) corresponding to the DDL statement, the storage node receives the first indication signal sent by the computing node for indicating entering the target processing stage of the DDL statement through the control thread, and sends the first notification signal corresponding to the first indication signal to the at least one DDL thread through the control thread, so as to notify the at least one DDL thread to execute the processing behavior corresponding to the target processing stage. After the at least one DDL thread executes the processing behavior corresponding to the target processing stage, the storage node sends the second notification signal indicating reaching the target synchronization point corresponding to the target processing stage to the control thread. If the second notification signal is sent by all the at least one DDL thread, the storage node sends the second indication signal corresponding to the target synchronization point to the computing node through the control thread, so that the computing node determines the execution state of the DDL statement according to the second indication signal. That is, if the computing node receives the second indication signal, it means that the at least one DDL thread has executed the processing behavior corresponding to the target processing stage, and when the target processing stage is the last processing stage corresponding to the DDL statement, it means that the meta information of the at least one physical shard has been modified completely, that is, the consistent modification of the meta information of the physical shard is completed. If the computing node does not receive the second indication signal, it means that there is a DDL thread in the at least one DDL thread that has not executed the processing behavior corresponding to the target processing stage, at which time the at least one DDL thread can be notified to perform rollback processing, that is, return to the state before executing the DDL statement, so that the meta information of the at least one physical shard is still in the state before executing the DDL statement, ensuring the consistency of the meta information of the physical shard. In addition, by setting the corresponding synchronization points in different processing stages of the DDL statement, when the DDL statement cannot be executed normally in the corresponding processing stage, processing such as consistent rollback can be performed in time, thereby improving the modification efficiency of the meta information of the at least one physical shard.

[0094]

[0095] The DDL statement processing method provided by the embodiment of the disclosure is described above from the dimension of the processing stage. The DDL statement processing method provided by the embodiment of the disclosure is further described below in combination with the specific processing behavior corresponding to each of the initial processing stage, the preparation processing stage and the commit processing stage.

[0095]

[0096] FIG. 3 is an interaction flowchart of another DDL statement processing method provided by an embodiment of the present disclosure. As shown in FIG. 3, the DDL statement processing includes three processing stages, namely, an initial processing stage, a preparation processing stage, and a commit processing stage. Each processing stage performs corresponding interaction with a computing node and a storage node to complete corresponding processing behaviors.

[0096]

[0097] The processing procedure corresponding to each processing stage will be described in the following order.

[0097]

[0098] In the initial processing stage, the DDL statement processing method can include the following steps.

[0098]

[0099] 301. The computing node sends, to a control thread of the storage node, a first indication signal indicating that the initial processing stage of the DDL statement is entered, the DDL statement being used to modify the meta information of at least one physical shard stored locally by the storage node.

[0099]

[0100] 302. If the first indication signal is received by the control thread of the storage node, the control thread sends, to at least one DDL thread corresponding to at least one physical shard, a first notification signal corresponding to the first indication signal, respectively, wherein a preset processing stage flag bit in the first notification signal is set to the initial processing stage.

[0100]

[0101] The specific procedures of steps 301 and 302 can refer to the foregoing embodiments, and will not be described herein.

[0101]

[0102] 303. The computing node sends the DDL statement to a target thread, the target DDL thread being any one of the at least one DDL thread, and the computing node sequentially sends the DDL statement to the at least one DDL thread.

[0102]

[0103] 304. The storage node performs, in response to receiving the DDL statement by the target DDL thread, an initialization behavior and a data copy behavior corresponding to the initial processing stage by the target DDL thread.

[0103]

[0104] 305. The target DDL thread of the storage node sends, to the control thread, a second notification signal indicating that a first synchronization point is reached after performing the data copy behavior, the first synchronization point corresponding to the initial processing stage.

[0104]

[0105] In this embodiment, in general, the processing behaviors corresponding to the initial processing stage include: an initialization behavior and a data copy behavior. The computing node causes at least one DDL thread of the storage node to perform the initialization behavior and the data copy behavior corresponding to the initial processing stage by sending a DDL statement to the at least one DDL thread.

[0105]

[0106] In a specific implementation process, the computing node in the storage node sends the DDL statement to the at least one DDL thread in sequence. For example, it is assumed that the meta information of the first physical shard and the second physical shard in the storage node needs to be modified, where the first physical shard corresponds to the first DDL thread, and the second physical shard corresponds to the second DDL thread. At this time, the number of DDL threads is more than one. The computing node sends the DDL statement to one of the first DDL thread and the second DDL thread first, for example, sends the DDL statement to the first DDL thread first, so that the storage node performs the initialization behavior and the data copy behavior corresponding to the initial processing stage through the first DDL thread in response to receiving the DDL statement through the first DDL thread; after the first DDL thread performs the data copy behavior, in addition to sending a second notification signal indicating that the first synchronization point is reached to the control thread, the first DDL thread also sends the second notification signal indicating that the first synchronization point is reached to the computing node; after the computing node receives the second notification signal sent by the storage node through the first DDL thread, the computing node sends the DDL statement to the second DDL thread, so that the storage node performs the initialization behavior and the data copy behavior corresponding to the initial processing stage through the second DDL thread in response to receiving the DDL statement through the second DDL thread.

[0106]

[0107] It can be understood that when the number of DDL threads is more than one, except for the last DDL thread, the other DDL threads need to send a second notification signal indicating that the first synchronization point is reached to the computing node after performing the data copy behavior, so that the computing node sends the DDL statement to the next DDL thread adjacent to the current DDL thread. Alternatively, when there are multiple DDL threads, the computing node can determine the order in which the multiple DDL threads receive the DDL statement in advance.

[0107]

[0108] After the storage node receives the DDL statement sent by the computing node through any one of the at least one DDL thread (referred to as a target DDL thread), the storage node specifically performs the initialization behavior and the data copying behavior corresponding to the initial processing stage through the target DDL thread in the following manner: the target DDL thread acquires an MDL read lock; the target DDL thread copies the inventory data in the target physical shard to a target file, acquires log files of record incremental data update information generated after the inventory data starts to be copied, and replays the log files on the target file after the inventory data copying is completed; when the amount of data remaining in the log files that has not been replayed does not exceed a set threshold, the target DDL thread sends a second notification signal indicating that the first synchronization point is reached to the control thread.

[0108]

[0109] The target physical shard is a physical shard corresponding to the target DDL thread in the at least one physical shard.

[0110] For ease of understanding, the acquisition mechanism of the metadata lock DML is first described.

[0109]

[0111] The metadata lock DML includes an MDL read lock and an MDL write lock. The MDL read locks do not mutually exclude each other, the MDL write locks mutually exclude each other, and the MDL write locks and the MDL read locks mutually exclude each other, that is, they have exclusivity.

[0110]

[0112] Specifically, for the same physical shard, a thread used to execute DML statements can simultaneously acquire an MDL read lock for each DML statement when executing multiple DML statements, that is, the data in the physical shard can be simultaneously added, deleted, updated, or queried through the DML statements. When executing multiple DDL statements, the DDL thread can only acquire an MDL write lock for one DDL statement at a time, and after acquiring the MDL write lock for the DDL statement, neither the thread used to execute the DML statement nor the DDL thread can acquire the MDL write lock and the MDL read lock for other DML statements or DDL statements. That is, at the same time, only one DDL statement is allowed to modify the meta information of the physical shard, and during the execution of the DDL statement to modify the meta information of the physical shard, no addition, deletion, update, or query operation can be performed on the data in the physical shard.

[0111]

[0113] Based on the above MDL read lock and MDL write lock acquisition mechanism, in the initialization phase, the target DDL thread acquires the MDL read lock first. If the target DDL cannot acquire the MDL read lock, it indicates that there is currently another DDL statement modifying the metadata of the target physical shard, and it needs to continue waiting until the MDL read lock is acquired, or it confirms the DDL statement execution failure when waiting for timeout; if the target DDL can acquire the MDL read lock, it indicates that there is currently no other DDL statement modifying the metadata of the target physical shard, and the received DDL statement sent by the computing node can be executed.

[0112]

[0114] When the MDL read lock is acquired through the target DDL thread, it is considered that the initialization behavior is completed. Then, the data copying behavior is performed. The data copying includes copying the existing data in the target physical shard and copying the incremental data in the target shard.

[0113]

[0115] In the online DDL (i.e., online DDL) mechanism provided by MySQL, when a DDL statement is executed on the target physical shard, a corresponding flag bit is added in the target physical shard to identify that the target physical shard is modifying the metadata through the DDL statement. When the target physical shard is operated, if the flag bit is checked, the operation on the target physical shard is written as incremental data to the online log (i.e., online log), for example: when the data in the target physical shard is added, deleted, or operated through the DML statement, if the flag bit is checked, the operation on the target physical shard through the DML statement is written to the online log, so that the incremental data is generated. Then, the incremental data can be copied by replaying the online log.

[0114]

[0116] In this embodiment, the target DDL thread copies the existing data in the target physical shard to the target file, and acquires the log file (i.e., online log) of the record incremental data update information generated after the existing data starts to be copied. Thus, after the existing data is copied, the log file can be replayed on the target file to complete the copying of the incremental data. The target file can be understood as a temporary file.

[0115]

[0117] Optionally, a threshold value can be defined, and when the amount of data remaining in the log file and not replayed does not exceed the threshold value, the target DDL thread sends a second notification signal indicating that the first synchronization point is reached to the control thread.

[0116]

[0118] Optionally, after the storage node sends the second notification signal indicating reaching the first synchronization point to the control thread via the target DDL thread, the target DDL thread enters a sleep state.

[0117]

[0119] As described above, in the initial processing stage, the computing node sends the DDL statement to the at least one DDL thread in sequence. Therefore, when the number of the at least one DDL thread is multiple, the multiple DDL threads send the second notification signal at different times after performing the processing behavior corresponding to the initial processing stage. In the embodiment, in order to determine whether the multiple DDL threads can all complete the processing behavior corresponding to the initial processing stage, the DDL thread that has sent the second notification signal enters a sleep state, thereby waiting for the result of the processing behavior corresponding to the initial processing stage performed by the other DDL threads.

[0118]

[0120] It can be understood that, after the target DDL thread enters the sleep state, new operation information can still be continuously written in the log file of the target DDL thread corresponding to the record increment data update information, thereby causing the amount of data remaining in the log file and not played back to increase.

[0119]

[0121] In an optional embodiment, in response to a notification event that the amount of data remaining in the log file and not played back increases to exceed a set threshold, the target DDL thread continues to play back the log file on the target file, so as to cause the amount of data remaining in the log file and not played back to decrease to not exceed the set threshold. That is, when the amount of data remaining in the log file and not played back increases to exceed the set threshold, the target DDL thread in the sleep state is woken up, so as to cause the target DDL thread to continue to play back the log file on the target file.

[0120]

[0122] 306. The storage node sends, via the control thread, a second indication signal corresponding to the first synchronization point to the computing node, the second indication signal indicating that the at least one DDL thread all sends the second notification signal.

[0121]

[0123] 307. The computing node receives the second indication signal corresponding to the first synchronization point, and determines the execution state of the DDL statement according to the second indication signal.

[0122]

[0124] If the computing node receives the second indication signal sent by the control thread of the storage node, it indicates that the at least one DDL thread has all completed the processing behavior corresponding to the initial processing stage of the DDL statement, and can enter the preparation processing stage of the DDL statement.

[0123]

[0125] In the preparation processing stage, as shown in FIG. 3, the DDL statement processing method can include the following steps.

[0124]

[0126] 308. The computing node sends a first indication signal to the storage node, indicating that the DDL statement enters the preparation processing stage.

[0125]

[0127] 309. If the storage node receives the first indication signal through the control thread, the control thread sends a first notification signal corresponding to the first indication signal to at least one DDL thread corresponding to at least one physical shard, respectively, wherein a preset processing stage flag bit in the first notification signal is set to the preparation processing stage.

[0126]

[0128] The first notification signal can be used to wake up the DDL thread in the initial processing stage.

[0127]

[0129] 3010. The storage node upgrades the MDL read lock to the MDL write lock through the target DDL thread, and performs data consistency verification after replaying the remaining unplayed data in the log file in the target file.

[0128]

[0130] The data consistency verification is used to ensure that the data in the physical shard has consistency before and after the metadata of the physical shard is modified by the DDL statement. For example, before the metadata of the physical shard is modified, each piece of data in a certain column of the physical shard is constrained to be non-repetitive, and after the metadata of the physical shard is modified, there should be no duplicate data in each piece of data in the column, thereby ensuring the consistency of the data.

[0129]

[0131] In an optional embodiment, the data consistency verification can be performed according to the following manner: first, a preset verification flag field in the target physical shard is determined, the initial state value of the verification flag field is a first value, wherein the first value indicates that each piece of data corresponding to the verification flag field in the target physical shard is non-repetitive. Then, a target state value of the verification flag field in the target file is determined. Finally, according to the first value and the target state value, it is determined whether the data consistency verification is successful. If the target state value is a second value, it is determined that the data consistency verification is unsuccessful, and the second value is different from the first value; if the target state value is the first value, it is determined that the data consistency verification is successful.

[0130]

[0132] The target state value of the verification flag field in the target file is automatically updated in the process of replaying the log file on the target file.

[0131]

[0133] 3011> After the data consistency check succeeds, the storage node sends a second notification signal indicating reaching the second synchronization point to the control thread through the target DDL thread, and the second synchronization point corresponds to the preparation processing stage.

[0132]

[0134] Similarly to the initial processing stage, after the storage node sends the second notification signal indicating reaching the second synchronization point to the control thread through the target DDL thread, the target DDL thread enters a sleep state.

[0133]

[0135] 3012> The storage node sends a second indication signal corresponding to the second synchronization point to the computing node through the control thread, and the second indication signal indicates that at least one DDL thread sends the second notification signal.

[0134]

[0136] 3013> The computing node receives the second indication signal corresponding to the second synchronization point, and determines the execution state of the DDL statement according to the second indication signal.

[0135]

[0137] If the computing node receives the second indication signal sent by the control thread of the storage node, it indicates that the at least one DDL thread has completed the processing behavior corresponding to the preparation processing stage of the DDL statement, and can enter the commit processing stage of the DDL statement.

[0136]

[0138] In the commit processing stage, as shown in FIG. 3, the DDL statement processing method can include the following steps.

[0137]

[0139] 3014> The computing node sends a first indication signal to the storage node to indicate entering the commit processing stage of the DDL statement.

[0138]

[0140] 3015> If the storage node receives the first indication signal through the control thread, the control thread sends a first notification signal corresponding to the first indication signal to at least one DDL thread corresponding to at least one physical shard, respectively, wherein a preset processing stage flag bit in the first notification signal is set to the commit processing stage.

[0139]

[0141] The first notification signal can be used to wake up the DDL thread in the sleep state in the preparation processing stage.

[0140]

[0142] 3016> After the storage node acquires the data dictionary lock through the target DDL thread, the target physical shard is deleted, and the target file is set as a new target physical shard.

[0141]

[0143] The data dictionary lock is a metadata lock in the storage engine layer of a MySQL logical system architecture (including a MySQL service layer and a storage engine layer).

[0142]

[0144] The target physical shard is deleted and the target file is set as a new target physical shard, that is, a new and old physical shard switching is performed. Specifically, the target physical shard (hereinafter referred to as an old target physical shard) can be deleted first, and then the target file is named as the name of the deleted target physical shard, thereby serving as a new target physical shard. The difference between the old target physical shard and the new target physical shard is that the new physical shard updates the data corresponding to the old target physical shard by replaying the log file recording the incremental data update information on the target file, so that the old target physical shard and the new target physical shard correspond to different meta information.

[0143]

[0145] 3017. After the storage node sets the target file as the new target physical shard, the target DDL thread sends a second notification signal indicating reaching a third synchronization point to the control thread, and the third synchronization point corresponds to the commit processing stage.

[0144]

[0146] In addition, after the target file is set as the new target physical shard, the MDL write lock is also released.

[0145]

[0147] 3018. The storage node sends a second indication signal corresponding to the third synchronization point to the computing node through the control thread, and the second indication signal indicates that the at least one DDL thread sends the second notification signal.

[0146]

[0148] 3019. The computing node receives the second indication signal corresponding to the third synchronization point, and determines the execution state of the DDL statement according to the second indication signal.

[0147]

[0149] If the computing node receives the second indication signal sent by the control thread of the storage node, it indicates that the at least one DDL thread has completed the processing behavior corresponding to the commit processing stage of the DDL statement, that is, the DDL statement execution is completed, the meta information of the at least one physical shard is modified, and the meta information of the at least one physical shard in the storage node is consistent, so that the logical meta information can be further modified.

[0148]

[0150] The initial processing stage, the preparation processing stage and the commit processing stage of the DDL statement, and the processing behavior corresponding to each processing stage in the DDL statement processing method provided by the embodiments of the present disclosure are described above.

[0149]

[0151] For the convenience of understanding, the DDL statement processing method provided by the embodiments of the present disclosure is described below by way of example.

[0150]

[0152] FIG. 4 is a schematic diagram of a DDL statement processing process provided by an embodiment of the present disclosure. As shown in FIG. 4, it is assumed that the meta information of a physical shard 1 and the meta information of a physical shard 2 of a storage node are to be modified, wherein the physical shard 1 corresponds to a DDL thread 1, the physical shard 2 corresponds to a DDL thread 2, and the computing node sends the DDL statement to the DDL thread 1 first and then to the DDL thread 2 when sending the DDL statement; a processing stage flag bit preset in a first notification signal is SO, when SO=start, it indicates that the current processing stage of the DDL statement is the initial processing stage, when SO=prepare, it indicates that the current processing stage of the DDL statement is the preparation processing stage; when SO=commit, it indicates that the current processing stage of the DDL statement is the commit processing stage. The specific DDL statement processing process is as follows.

[0151]

[0153] 1. Initial processing stage

[0152]

[0154] After the computing node receives the DDL statement sent by the client, the computing node sends a first indication signal for indicating entering the initial processing stage of the DDL statement to the control thread of the storage node. If the storage node receives the first indication signal for indicating entering the initial processing stage of the DDL statement through the control thread, the storage node sends a first notification signal corresponding to the first indication signal to the DDL thread 1 and the DDL thread 2 through the control thread respectively, and the SO=start in the notification signal.

[0153]

[0155] Then, the computing node sends the DDL statement to the DDL thread 1, so that the storage node performs the initialization behavior and the data copying behavior corresponding to the initial processing stage through the DDL thread 1 in response to receiving the DDL statement through the DDL thread 1, that is, the storage node acquires the MDL read lock through the DDL thread 1, copies the inventory data in the physical shard 1 to a target file, acquires a log file of record increment data update information generated after the inventory data is copied, and plays back the log file on the target file after the inventory data is copied. When the amount of data remaining in the log file and not played back does not exceed a set threshold, the storage node sends a second notification signal indicating reaching a first synchronization point to the control thread and the computing node through the DDL thread 1, and the DDL thread 1 can enter a sleep state.

[0154]

[0156] The computing node sends a DDL statement to the DDL thread 2 after receiving the second notification signal sent by the storage node through the DDL thread 1, so that the storage node performs the initialization behavior and the data copy behavior corresponding to the initial processing phase through the DDL thread 2 in response to receiving the DDL statement through the DDL thread 2, that is, the storage node acquires an MDL read lock through the DDL thread 2, copies the inventory data in the physical shard 2 to the target file, acquires a log file of record incremental data update information generated after the inventory data starts to be copied, and replays the log file on the target file after the inventory data is copied. When the amount of data remaining in the log file that has not been replayed does not exceed the set threshold, the storage node sends a second notification signal indicating that the first synchronization point is reached to the control thread through the DDL thread 2, and the DDL thread 2 can enter a sleep state.

[0155]

[0157] Subsequently, the storage node sends a second indication signal corresponding to the first synchronization point to the computing node through the control thread, so that the computing node determines the execution state of the DDL statement according to the second indication signal. Wherein, the second indication signal indicates that the DDL thread 1 and the DDL thread 2 both send the second notification signal.

[0156]

[0158] In addition, in the initial processing phase, as shown in FIG. 4, before receiving the first indication signal sent by the computing node to indicate entering the preparation processing phase of the DDL statement, in response to a notification event that the amount of data remaining in the log file that has not been replayed rises to exceed the set threshold, either of the DDL thread 1 and the DDL thread 2 will continue to replay the log file on the target file, so that the amount of data remaining in the log file that has not been replayed falls to not more than the set threshold. For example: if the amount of data remaining in the log file corresponding to the physical shard 1 rises to exceed the set threshold during the process of the storage node performing the initialization behavior and the data copy behavior corresponding to the initial processing phase through the DDL thread 2, the target DDL thread that is in a sleep state is awakened, so that the DDL thread 1 continues to replay the log file on the target file corresponding to the physical shard 1.

[0157]

[0159] 2. Preparation processing phase.

[0158]

[0160] If the computing node receives the second indication signal corresponding to the first synchronization point sent by the control thread in the initial processing phase, it means that the DDL thread 1 and the DDL thread 2 have both completed the processing behavior corresponding to the initial processing phase of the DDL statement, and can enter the preparation processing phase of the DDL statement.

[0159]

[0161] The computing node sends a first indication signal to the control thread of the storage node, indicating that the DDL statement enters the preparation processing stage. If the storage node receives the first indication signal indicating that the DDL statement enters the preparation processing stage through the control thread, the storage node sends a first notification signal corresponding to the first indication signal to the DDL thread 1 and the DDL thread 2 through the control thread, respectively, to wake up the DDL thread 1 and the DDL thread 2 in the sleep state, wherein SO = prepare in the first notification signal.

[0160]

[0162] Then, the storage node upgrades the MDL read lock to the MDL write lock through the DDL thread 1, replays the remaining amount of data in the log file that has not been replayed in the target file corresponding to the physical shard 1, and performs data consistency verification. After the data consistency verification succeeds, the storage node sends a second notification signal indicating that the second synchronization point is reached to the control thread through the DDL thread 1, and the DDL thread 1 can enter the sleep state.

[0161]

[0163] Similarly to the DDL thread 1, the storage node upgrades the MDL read lock to the MDL write lock through the DDL thread 2, replays the remaining amount of data in the log file that has not been replayed in the target file corresponding to the physical shard 2, and performs data consistency verification. After the data consistency verification succeeds, the storage node sends a second notification signal indicating that the second synchronization point is reached to the control thread through the DDL thread 2, and the DDL thread 2 can enter the sleep state.

[0162]

[0164] Then, the storage node sends a second indication signal corresponding to the second synchronization point to the computing node through the control thread, so that the computing node determines the execution state of the DDL statement according to the second indication signal. The second indication signal indicates that the DDL thread 1 and the DDL thread 2 both send the second notification signal.

[0163]

[0165] 3. Submission processing stage.

[0164]

[0166] If the computing node receives the second indication signal corresponding to the first synchronization point sent by the control thread in the preparation processing stage, it means that the DDL thread 1 and the DDL thread 2 have both completed the processing behavior corresponding to the preparation processing stage of the DDL statement, and can enter the submission processing stage of the DDL statement.

[0165]

[0167] The computing node sends a first indication signal to the control thread of the storage node, indicating that the DDL statement enters the commit processing phase. If the storage node receives the first indication signal indicating that the DDL statement enters the commit processing phase through the control thread, the storage node sends a first notification signal corresponding to the first indication signal to the DDL thread 1 and the DDL thread 2 through the control thread, to wake up the DDL thread 1 and the DDL thread 2 in the sleep state. In the first notification signal, S0 = commit.

[0166]

[0168] After the storage node acquires the data dictionary lock through the DDL thread 1, the storage node deletes the physical shard 1, sets the target file as the new physical shard 1, and sends a second notification signal indicating that the third synchronization point is reached to the control thread through the DDL thread 1. The DDL thread 1 can enter the sleep state,

[0167]

[0169] Similarly to the DDL thread 1, after the storage node acquires the data dictionary lock through the DDL thread 2, the storage node deletes the physical shard 2, sets the target file as the new physical shard 2, and sends a second notification signal indicating that the third synchronization point is reached to the control thread through the DDL thread 2. The DDL thread 2 can enter the sleep state.

[0168]

[0170] After that, the storage node sends a second indication signal corresponding to the second synchronization point to the computing node through the control thread, so that the computing node determines the execution state of the DDL statement according to the second indication signal. In the second indication signal, it is indicated that the DDL thread 1 and the DDL thread 2 both send the second notification signal.

[0169]

[0171] If the computing node receives the second indication signal sent by the control thread of the storage node, it means that the DDL thread 1 and the DDL thread 2 have both completed the processing behavior corresponding to the commit processing phase of the DDL statement, that is, the meta information of the physical shard 1 and the meta information of the physical shard 2 have both been modified, and the logical meta information can be further modified.

[0170]

[0172] In the above scheme, any processing stage corresponding to the DDL statement is provided with a corresponding synchronization point, so that the storage node can send a second notification signal to the control thread in the storage node when reaching the synchronization point corresponding to the current processing stage in the process of executing the processing behavior corresponding to each processing stage by the at least one DDL thread, so that the control thread can obtain the execution of the at least one DDL thread in the current processing stage, for example, that the at least one DDL thread has completed the processing behavior of the current processing stage and sent a second control signal. Further, the control thread sends a second instruction signal to the computing node according to the received second notification signal, so that the computing node determines the execution state of the at least one DDL in the current processing stage according to the second instruction signal, so as to determine whether the at least one DDL thread is to continue to execute the processing behavior of the next processing stage or to uniformly perform rollback processing, thereby ensuring that the execution of the plurality of DDL threads on the DDL statement is synchronized in the processing stage, and there is no case that the meta information of some physical shards has been modified and the meta information of some physical shards has not been modified, which can effectively ensure that the meta information of each physical shard is consistent in the process of modifying the meta information of at least one physical shard, that is, the meta information of each physical shard is either modified or not modified.

[0171]

[0173] In actual application, generally, if the processing behavior of the preparation processing stage of the DDL statement can be completed, the processing behavior of the subsequent submission processing stage can also be completed with high probability.

[0172]

[0174] Therefore, in an optional embodiment, the third synchronization point corresponding to the submission processing stage can be selected not to be set.

[0173]

[0175] FIG. 5 is a schematic diagram of another DDL statement processing process provided by an embodiment of the present disclosure, as shown in FIG. 5, in the submission processing stage, after completing the processing behavior of the submission processing stage of the DDL statement, the DDL thread 1 can directly notify the computing node that the execution of the DDL statement has been completed, that is, the modification of the meta information of the physical shard 1 has been completed; after completing the processing behavior of the submission processing stage of the DDL statement, the DDL thread 2 can also directly notify the computing node that the execution of the DDL statement has been completed, that is, the modification of the meta information of the physical shard 2 has been completed. After receiving the notification sent by the DDL thread 1 and the DDL thread 2, the computing node determines that the meta information of all physical shards has been modified and completed, and can further instruct to modify the logical meta information.

[0174]

[0176] In this embodiment, by reducing the third synchronization point corresponding to the submission processing stage, the operation steps of the computing node and the storage node in executing the DDL statement processing can be simplified, and the modification efficiency of the physical shard meta information can be improved.

[0175]

[0177] It can be understood that in the distributed database, multiple storage nodes may need to modify the local stored physical shard meta information at the same time, and the control threads of the multiple storage nodes are connected with the same computing node, so that the storage nodes can send the second indication signal to the computing node through the control thread, so that the computing node determines the execution state of the DDL thread in the storage node according to the second indication signal, and ensures the consistency of the meta information of the physical shards corresponding to the multiple storage nodes.

[0176]

[0178] In actual application, some storage nodes may be down after entering the initial processing stage, the preparation processing stage or the submission processing stage of the DDL statement, while other storage nodes are normal.

[0177]

[0179] For the situation that the storage nodes are down in the initial processing stage or the preparation processing stage, the computing node can send a rollback notification to the storage nodes that are not down, so that the storage nodes that are not down perform rollback processing through the DDL thread, so that the meta information of the physical shards in the storage nodes that are not down is consistent with the meta information of the physical shards in the storage nodes that are down, and the meta information of the physical shards in the storage nodes that are not down is the meta information before the DDL statement is executed.

[0178]

[0180] For the situation that the storage nodes are down in the submission processing stage, since the storage nodes that are down or not down have all received the first indication signal sent by the computing node for indicating that the submission processing stage of the DDL statement is entered, the storage nodes that are not down can continue to perform the processing behavior of the submission processing stage through the DDL thread, and feed back the processing result of the submission processing stage to the computing node after the processing is completed. For example, the second indication signal corresponding to the third synchronization point can be sent to the computing node through the control thread, so that the computing node determines the execution state of the DDL statement according to the second indication signal, or directly notifies the computing node that the execution of the DDL statement is completed through the control thread. The computing node can re-send the DDL statement to the storage nodes that are down after they are restarted, so that the storage nodes that are down execute the DDL statement through the DDL thread. Finally, the computing node modifies the logical meta information after receiving the second indication signal corresponding to the third synchronization point sent by the storage nodes that are down through the control thread or the notification that the execution of the DDL statement is completed.

[0179]

[0181] As an optional implementation, if the computing node determines that the storage node is down after receiving the second indication signal corresponding to the second synchronization point sent by the control thread of the storage node, the DDL statement is re-sent to the storage node after the storage node is restarted; thereafter, if the storage node receives the DDL statement re-sent by the computing node, the DDL statement is executed based on the standard DDL statement execution process.

[0180]

[0182] In the standard DDL statement execution process, the synchronization point provided by the embodiments of the present disclosure is not included.

[0181]

[0183] Specifically, after the down storage node receives the DDL statement re-sent by the computing node through the target DDL thread, firstly, the MDL read lock is acquired through the target DDL thread, and the inventory data in the target physical shard is copied to the target file through the target DDL thread, the log file for acquiring the record increment data update information generated after the inventory data starts to be copied is acquired, and the log file is played back on the target file after the inventory data is copied, that is, the processing behavior corresponding to the initial processing phase is completed. The target DDL thread is any one of at least one DDL thread corresponding to at least one physical shard stored locally by the storage node. Then, the storage node upgrades the MDL read lock to the MDL write lock through the target DDL thread, and after playing back the remaining data in the log file in the target file, the data consistency check is performed, that is, the processing behavior corresponding to the preparation processing phase is completed. Finally, the storage node acquires the data dictionary lock through the target DDL thread, deletes the target physical shard, and sets the target file as a new target physical shard, that is, the processing behavior corresponding to the commit processing phase is completed.

[0182]

[0184] This scheme is a compensation strategy for realizing the consistency of the physical shard meta information. In order to ensure that the meta information of the physical shard is as consistent as possible, for the case that the down storage node restarts in the commit processing phase, after receiving the DDL statement re-sent by the computing node, the DDL statement is executed based on the standard DDL statement execution process. The computing node does not determine the execution state of the DDL statement in each processing phase, so as to accelerate the execution efficiency of the DDL statement, complete the modification of the physical shard meta information in the storage node that restarts after being down as soon as possible, and ensure the modification efficiency of the logical meta information.

[0183]

[0185] FIG. 6 is a flowchart of a DDL statement processing method provided by the embodiments of the present disclosure, as shown in FIG. 6, which can include the following steps

[0184]

[0186] 601. If the storage node receives, through the included control thread, a first indication signal sent by the computing node and indicating entering a target processing stage of a DDL statement, the storage node sends, through the control thread, a first notification signal corresponding to the first indication signal to at least one DDL thread included by the storage node, the DDL statement being used to modify the meta information of at least one physical shard stored locally, and the at least one DDL thread corresponding to the at least one physical shard.

[0185]

[0187] 602. The storage node executes, through the at least one DDL thread, a processing behavior corresponding to the target processing stage, and sends, to the control thread after executing the processing behavior, a second notification signal indicating reaching a target synchronization point, the target synchronization point corresponding to the target processing stage.

[0186]

[0188] 603. The storage node sends, to the computing node through the control thread, a second indication signal corresponding to the target synchronization point, so that the computing node determines the execution state of the DDL statement according to the second indication signal, the second indication signal indicating that the at least one DDL thread all sends the second notification signal.

[0187]

[0189] The embodiment introduces a DDL statement processing process of a storage node in a distributed database system, and the detailed execution process can refer to the related description in the foregoing embodiments, which will not be described here.

[0188]

[0190] FIG. 7 is a flowchart of another DDL statement processing method provided by the embodiment of the disclosure, as shown in FIG. 7, which can include the following steps.

[0189]

[0191] 701. The computing node sends, to a control thread included by a storage node, a first indication signal indicating entering a target processing stage of a DDL statement, so that the control thread sends, to at least one DDL thread included by the storage node, a first notification signal corresponding to the first indication signal, and the at least one DDL thread executes a processing behavior corresponding to the target processing stage, and sends, to the control thread after executing the processing behavior, a second notification signal indicating reaching a target synchronization point, the target synchronization point corresponding to the target processing stage, the DDL statement being used to modify the meta information of at least one physical shard stored locally, and the at least one DDL thread corresponding to the at least one physical shard.

[0190]

[0192] 702. The computing node receives, from the control thread, a second indication signal corresponding to the target synchronization point, the second indication signal indicating that the at least one DDL thread all sends the second notification signal.

[0191]

[0193] 703、 The computing node determines the execution state of the DDL statement according to the second indication signal.

[0192]

[0194] The embodiment introduces the DDL statement processing procedure of the computing node in the distributed database system, and the detailed execution procedure can refer to the related description in the foregoing embodiments, which will not be described here.

[0193]

[0195] The DDL statement processing apparatus of one or more embodiments of the present disclosure will be described in detail below. Those skilled in the art can understand that these apparatuses can be configured by using commercially available hardware components through the steps taught by the present solution.

[0194]

[0196] FIG. 8 is a structural schematic diagram of a DDL statement processing apparatus provided by an embodiment of the present disclosure. The DDL statement processing apparatus is located in a storage node in a distributed database system, wherein a control thread and at least one DDL thread corresponding to at least one physical shard stored locally are executed in the storage node. As shown in FIG. 8, the apparatus includes a first receiving module 11, a first processing module 12, and a first sending module 13.

[0195]

[0197] The first receiving module 11 is configured to, if a first indication signal indicating that a target processing stage of a DDL statement is entered is received by the control thread from a computing node, send a first notification signal corresponding to the first indication signal to the at least one DDL thread through the control thread respectively, and the DDL statement is used to modify the meta information of the at least one physical shard.

[0198] The first processing module 12 is configured to execute a processing behavior corresponding to the target processing stage through the at least one DDL thread respectively, and send a second notification signal indicating that a target synchronization point is reached to the control thread after the processing behavior is executed, and the target synchronization point corresponds to the target processing stage.

[0196]

[0199] The first sending module 13 is further configured to send a second indication signal corresponding to the target synchronization point to the computing node through the control thread, so that the computing node determines the execution state of the DDL statement according to the second indication signal, and the second indication signal indicates that the at least one DDL thread all sends the second notification signal.

[0197]

[0200] Optionally, the target processing stage comprises an initial processing stage; a processing stage flag preset in the first notification signal is set as the initial processing stage. The first processing module 12 is specifically configured to: in response to receiving the DDL statement sent by the computing node through a target DDL thread, performing an initialization behavior and a data copy behavior corresponding to the initial processing stage through the target DDL thread, sending a second notification signal indicating reaching a first synchronization point to the control thread after performing the data copy behavior, the first synchronization point corresponding to the initial processing stage; wherein the target DDL thread is any one of the at least one DDL thread, and the computing node sequentially sends the DDL statement to the at least one DDL thread in sequence.

[0198]

[0201] Optionally, the first processing module 12 is further configured to: acquire an MDL read lock through the target DDL thread; copy inventory data in a target physical shard to a target file through the target DDL thread, acquire a log file generated by updating record increment data since starting the copying of the inventory data, and replay the log file on the target file after the inventory data is copied; when an amount of data remaining in the log file and not replayed does not exceed a set threshold, send a second notification signal indicating reaching a first synchronization point to the control thread through the target DDL thread, the target physical shard corresponding to the target DDL thread,

[0199]

[0202] Optionally, the first processing module 12 is further configured to: in response to a notification event that the amount of data remaining in the log file and not replayed exceeds the set threshold, continue replaying the log file on the target file through the target DDL thread, so that the amount of data remaining in the log file and not replayed falls to not more than the set threshold.

[0200]

[0203] Optionally, the target processing stage comprises a preparation processing stage; a processing stage flag preset in the first notification signal is set as the preparation processing stage. The first processing module 12 is further configured to: upgrade the MDL read lock to an MDL write lock through the target DDL thread, after replaying the amount of data remaining in the log file and not replayed in the target file, perform data consistency verification; after the data consistency verification succeeds, send a second notification signal indicating reaching a second synchronization point to the control thread through the target DDL thread, the second synchronization point corresponding to the preparation processing stage.

[0201]

[0204] Optionally, the first processing module 12 is further configured to: determine a preset check flag field in the target physical shard, wherein an initial state value corresponding to the check flag field is a first numerical value, and the first numerical value indicates that each piece of data corresponding to the check flag field in the target physical shard is not duplicated; determine a target state value corresponding to the check flag field in the target file; if the target state value is a second numerical value, determine that the data consistency check is unsuccessful; and if the target state value is the first numerical value, determine that the data consistency check is successful.

[0202]

[0205] Optionally, the first receiving module 11 is further configured to: if the DDL statement re-sent by the computing node is received, execute the DDL statement based on a standard DDL statement execution flow; and wherein, after receiving a second indication signal corresponding to the second synchronization point sent by the control thread, if it is determined that the storage node is down, the computing node re-sends the DDL statement to the storage node after the storage node is restarted.

[0203]

[0206] Optionally, the target processing stage includes a commit processing stage, and a processing stage flag bit preset in the first notification signal is set to the commit processing stage. The first processing module 12 is further configured to: after acquiring a data dictionary lock by the target DDL thread, delete the target physical shard, and set the target file as a new target physical shard; and after setting the target file as the new target physical shard, send a second notification signal indicating that a third synchronization point is reached to the control thread by the target DDL thread, wherein the third synchronization point corresponds to the commit processing stage.

[0204]

[0207] Optionally, the first receiving module 11 is further configured to: if a rollback instruction sent by the computing node is received by the at least one DDL thread, perform rollback processing, wherein the rollback instruction is sent by the computing node when it is determined that the at least one DDL thread executes abnormally or when the second indication signal is not received within a timeout period.

[0205]

[0208] The apparatus shown in FIG. 8 can perform the steps performed by the storage node in the distributed database system in the foregoing embodiments. For details of the execution process and technical effects, refer to the descriptions in the foregoing embodiments, which will not be repeated here.

[0206]

[0209] In one possible design, the structure of the DDL statement processing apparatus shown in FIG. 8 can be implemented as an electronic device, as shown in FIG. 9, which can include a first memory 21, a first processor 22, and a first communication interface 23. The first memory 21 stores executable code, which, when executed by the first processor 22, causes the first processor 22 to implement at least the DDL statement processing method performed by the storage node in the distributed database system according to any of the preceding embodiments.

[0207]

[0210] FIG. 10 is a structure diagram of another DDL statement processing apparatus according to an embodiment of the present disclosure, which is located in a compute node in a distributed database system. The compute node communicates with a storage node in the distributed database system, and the storage node executes a control thread and at least one DDL thread corresponding to at least one physical shard stored locally. As shown in FIG. 10, the apparatus includes a second sending module 31, a second receiving module 32, and a second processing module 33.

[0208]

[0211] The second sending module 31 is configured to send, to the control thread, a first indication signal indicating a target processing stage of a DDL statement, so that the control thread sends, to the at least one DDL thread, a first notification signal corresponding to the first indication signal, so that the at least one DDL thread performs a processing behavior corresponding to the target processing stage, and sends, to the control thread after performing the processing behavior, a second notification signal indicating a target synchronization point, where the target synchronization point corresponds to the target processing stage, and the DDL statement is used to modify meta information of the at least one physical shard.

[0209]

[0212] The second receiving module 32 is configured to receive, from the control thread, a second indication signal corresponding to the target synchronization point, where the second indication signal indicates that the at least one DDL thread has sent the second notification signal.

[0210]

[0213] The second processing module 33 is configured to determine an execution state of the DDL statement according to the second indication signal.

[0211]

[0214] The apparatus shown in FIG. 10 can perform the steps performed by the compute node in the distributed database system according to any of the preceding embodiments. For details of the execution process and technical effects, refer to the descriptions in the preceding embodiments, which are not described here again.

[0212]

[0215] In a possible design, the structure of the data identification apparatus shown in FIG. 10 can be implemented as an electronic device, as shown in FIG. 11, which can include a second memory 41, a second processor 42, and a second communication interface 43. The second memory 41 stores executable code, and when the executable code is executed by the second processor 42, the second processor 42 can at least implement the DDL statement processing method performed by the computing node in the distributed database system in the foregoing embodiment.

[0213]

[0216] In addition, the disclosure provides a non-transitory machine readable storage medium, which stores executable code, and when the executable code is executed by a processor of an electronic device, the processor can at least implement the DDL statement processing method provided in the foregoing embodiment.

[0214]

[0217] The disclosure provides a computer program product, which includes a computer program, and when the computer program is executed by a processor of an electronic device, the processor executes the data processing method provided in the foregoing embodiment.

[0215]

[0218] The apparatus embodiments described above are merely illustrative, and the units described as separate components can or can not be physically separated. Part or all of the modules can be selected to achieve the purpose of the embodiment according to actual needs. Those skilled in the art can understand and implement it without creative labor.

[0216]

[0219] From the above description of the embodiments, those skilled in the art can clearly understand that the embodiments can be implemented by means of a general hardware platform, and of course can also be implemented by means of a combination of hardware and software. Based on such understanding, the above technical solutions can be embodied in the form of a computer program product, and the disclosure can be implemented in the form of a computer program product including one or more computer usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer usable program code.

[0217]

[0220] Finally, it should be noted that: the above examples are only used to illustrate the technical solutions of the present disclosure, but not to limit them; although the present disclosure has been described in detail with reference to the foregoing examples, those skilled in the art should understand that: it can still modify the technical solutions recorded in the foregoing examples, or make equivalent replacement for part of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present disclosure.

Claims

CLAIM 1. A method for processing a DDL statement, applied to a storage node in a distributed database system, the storage node executing a control thread and at least one DDL thread corresponding to at least one physical shard stored locally, the method comprising: If a first indication signal indicating entering a target processing stage of a DDL statement is received by the control thread from the computing node, the control thread sends a first notification signal corresponding to the first indication signal to the at least one DDL thread, respectively, the DDL statement being used to modify the metadata of the at least one physical shard; The at least one DDL thread performs a processing behavior corresponding to the target processing stage, respectively, and sends a second notification signal indicating reaching a target synchronization point to the control thread after performing the processing behavior, the target synchronization point corresponding to the target processing stage; and the control thread sends a second indication signal corresponding to the target synchronization point to the computing node, so that the computing node determines the execution state of the DDL statement according to the second indication signal, the second indication signal indicating that the at least one DDL thread has sent the second notification signal.

2. The method of claim 1, wherein, The target processing stage includes an initial processing stage; a processing stage flag in the first notification signal is set to the initial processing stage; and the at least one DDL thread performing a processing behavior corresponding to the target processing stage, respectively, and sending a second notification signal indicating reaching a target synchronization point to the control thread after performing the processing behavior, includes: in response to receiving the DDL statement from the computing node by a target DDL thread, the target DDL thread performs an initialization behavior and a data copy behavior corresponding to the initial processing stage, and sends a second notification signal indicating reaching a first synchronization point to the control thread after performing the data copy behavior, the first synchronization point corresponding to the initial processing stage; and the target DDL thread is any one of the at least one DDL thread, and the computing node sequentially sends the DDL statement to the at least one DDL thread.

3. The method according to claim 2, wherein, The target DDL thread performs an initialization behavior and a data copy behavior corresponding to the initial processing stage, and sends a second notification signal indicating reaching a first synchronization point to the control thread after performing the data copy behavior, includes: the target DDL thread acquires an MDL read lock; the target DDL thread copies inventory data in a target physical shard to a target file, acquires a log file of record incremental data update information generated since the inventory data is copied, and plays back the log file on the target file after the inventory data is copied; and when the amount of data remaining in the log file that has not been played back does not exceed a set threshold, the target DDL thread sends a second notification signal indicating reaching the first synchronization point to the control thread, the target physical shard corresponding to the target DDL thread.

4. The method according to claim 3, wherein, The target DDL thread enters a sleep state after sending the second notification signal indicating reaching the first synchronization point to the control thread; the method further comprises: in response to a notification event that the amount of remaining unplayed data in the log file rises to exceed the set threshold, continuing, by the target DDL thread, to play back the log file on the target file, so as to reduce the amount of remaining unplayed data in the log file to not more than the set threshold.

5. The method according to claim 3, wherein, The target processing stage comprises a preparation processing stage; a processing stage flag preset in the first notification signal is set to the preparation processing stage; the respective execution of the processing behavior corresponding to the target processing stage by the at least one DDL thread, and the sending of the second notification signal indicating reaching the target synchronization point to the control thread after the execution of the processing behavior, comprise: upgrading, by the target DDL thread, the MDL read lock to an MDL write lock, and performing data consistency verification after playing back the amount of remaining unplayed data in the log file in the target file; after the data consistency verification succeeds, sending, by the target DDL thread, the second notification signal indicating reaching the second synchronization point to the control thread, the second synchronization point corresponding to the preparation processing stage.

6. The method according to claim 5, wherein, The data consistency verification comprises: determining a preset verification flag field in the target physical shard, an initial state value corresponding to the verification flag field being a first numerical value, the first numerical value indicating that each piece of data corresponding to the verification flag field in the target physical shard is not repeated; determining a target state value corresponding to the verification flag field in the target file; if the target state value is a second numerical value, determining that the data consistency verification fails; if the target state value is the first numerical value, determining that the data consistency verification succeeds.

7. The method of claim 5, further comprising: If the DDL statement is received again by the computing node, the DDL statement is executed based on the standard DDL statement execution flow; wherein, after receiving the second indication signal corresponding to the second synchronization point sent by the control thread, if it is determined that the storage node is down, the computing node re-sends the DDL statement to the storage node after the storage node is restarted.

8. The method according to claim 5, wherein, The target processing stage includes a commit processing stage; a processing stage flag in the first notification signal is set to the commit processing stage; the target processing stage corresponding processing behavior is executed by the at least one DDL thread respectively, and a second notification signal indicating reaching a target synchronization point is sent to the control thread after the processing behavior is executed, including: after the target DDL thread acquires a data dictionary lock, the target physical shard is deleted, and the target file is set as a new target physical shard; after the target file is set as a new target physical shard, the target DDL thread sends a second notification signal indicating reaching a third synchronization point to the control thread, and the third synchronization point corresponds to the commit processing stage.

9. The method of any one of claims 1-8, further comprising: If the rollback instruction sent by the computing node is received by the at least one DDL thread, rollback processing is executed, wherein the rollback instruction is sent by the computing node when timeout is not received or it is determined that the at least one DDL thread executes abnormally.

10. A method for processing a DDL statement, applied to a compute node in a distributed database system, the compute node being in communication with a storage node in the distributed database system, the storage node executing a control thread and at least one DDL thread corresponding to at least one physical shard stored locally, the method comprising: The first indication signal indicating entering the target processing stage of the DDL statement is sent to the control thread, so that the control thread sends the first notification signal corresponding to the first indication signal to the at least one DDL thread, and the at least one DDL thread executes the processing behavior corresponding to the target processing stage, and sends the second notification signal indicating reaching the target synchronization point to the control thread after the processing behavior is executed, and the target synchronization point corresponds to the target processing stage, and the DDL statement is used for modifying the meta information of the at least one physical shard; the second indication signal corresponding to the target synchronization point is received from the control thread, and the second indication signal indicates that the at least one DDL thread all sends the second notification signal; and the execution state of the DDL statement is determined according to the second indication signal.

11. A distributed database system comprising: The computing node and the storage node, wherein the storage node executes a control thread and at least one DDL thread corresponding to at least one physical shard stored locally; the computing node is configured to send a first indication signal to the control thread, the first indication signal indicating a target processing stage of a DDL statement, the DDL statement being used to modify the meta information of the at least one physical shard; the control thread is configured to send a first notification signal corresponding to the first indication signal to the at least one DDL thread respectively; the at least one DDL thread is configured to execute a processing behavior corresponding to the target processing stage based on the first notification signal, and send a second notification signal indicating reaching a target synchronization point to the control thread after executing the processing behavior, the target synchronization point corresponding to the target processing stage; the control thread is further configured to send a second indication signal corresponding to the target synchronization point to the computing node, the second indication signal indicating that the at least one DDL thread all sends the second notification signal; and the computing node is further configured to determine the execution state of the DDL statement according to the second indication signal.

12. An electronic device, comprising: A memory, a processor, and a communication interface; wherein the memory stores executable code, and when the executable code is executed by the processor, the processor executes the DDL statement processing method in any one of claims 1 to 9.

13. A non-transitory machine-readable storage medium, wherein, The non-transitory machine-readable storage medium stores executable code, and when the executable code is executed by the processor of the electronic device, the processor executes the DDL statement processing method in any one of claims 1 to 9, or executes the DDL statement processing method in claim 10. 19 14. A computer program product, comprising: A computer program, wherein when the computer program is executed by the processor of the electronic device, the processor executes the DDL statement processing method in any one of claims 1 to 9, or executes the DDL statement processing method in claim 10.

Citation Information

Patent Citations

  • Data processing method, distributed database system, electronic equipment and storage medium

    CN113656384A

  • Distributed transaction processing method, system and device

    CN114816682A

  • Data processing method and device, electronic equipment and storage medium

    CN115114260A

  • Method and device for realizing data definition operation atomicity of distributed database

    CN117435600A

  • DDL processing method, device and system for distributed database and medium

    CN117687831A