A database statement processing method, device, electronic device and storage medium
By judging and forwarding the database schema definition language statement in the non-coordinating node to the coordinating node for parsing and distribution, the problem in the existing technology that the non-coordinating node cannot process the schema definition language statement is solved, and the flexibility and user-friendliness of the database management system are improved. experience.
Patent Information
- Application Number
- CN202010911185.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-09-02
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2040-09-02
AI Technical Summary
When existing database management systems process database schema definition language statements, non-coordinating nodes can only execute data manipulation language statements, causing users to resend statements to the coordinating node, which increases user operations and reduces system flexibility.
When the operation request sent by the client is judged to be a database schema definition language statement in the non-coordinating node, it is sent to the coordinating node for analysis, and subtasks are generated and distributed to the working nodes to avoid returning an unsupported prompt, and directly process and feedback the results.
It improves the flexibility of the database management system, reduces user operations, and avoids the need to repeatedly send database schema definition language statements.
Smart Images

Figure CN112035514B
Abstract
Description
Technical Field
[0001] The present application relates to the field of databases, and in particular to a database statement processing method, device, electronic device and storage medium. Background Art
[0002] With the development of network technology, more and more data is generated in the network. In order to conduct subsequent analysis on the generated data, the data is usually stored in the database, and then the data in the database is added, deleted, modified, and checked. In order to perform the above operations on the database more conveniently, it is necessary to horizontally expand the independent database. For example, Citus, as a horizontal expansion plug-in for relational database management systems, can achieve horizontal expansion of the database. Figure 1 As shown in the figure, it is a system diagram of a relational database management system using the citus plug-in. Figure 1 The system may include a coordination node 110, at least one non-coordination node 120 and a plurality of working nodes 130, wherein the non-coordination node 120 is a working node that locally stores metadata of the coordination node 110.
[0003] However, in the related art, in order to ensure data consistency, only the coordinating node is allowed to execute operations corresponding to database schema definition language statements, and the non-coordinating node can only execute operations corresponding to data manipulation language statements.
[0004] When a non-coordinating node receives a database schema definition language statement sent from a client, it usually returns a message prompting the user that the database schema definition language statement is not supported, so that the user can only resend the database schema definition language statement to the coordinating node. This increases the user's operations and reduces the flexibility of the database management system. Summary of the invention
[0005] The purpose of the embodiments of the present application is to provide a database statement processing method, device, electronic device and storage medium to improve the flexibility of the database management system. The specific technical solution is as follows:
[0006] In a first aspect, an embodiment of the present application provides a database statement processing method, which is applied to a non-coordinating node in a relational database management system, wherein the relational database management system further includes a coordinating node and multiple working nodes, and the method includes:
[0007] Obtaining operation requests sent by clients communicating with non-coordinating nodes;
[0008] When it is determined that the operation request is a database schema definition language statement, the database schema definition language statement is sent to the coordination node so that the coordination node parses the database schema definition language statement, generates multiple first subtasks corresponding to the database schema definition language statement, and sends each first subtask to the corresponding working node.
[0009] Optionally, after obtaining the operation request sent by the client in communication connection with the non-coordinating node, the method further includes:
[0010] When it is determined that the operation request is a data manipulation language statement, the data manipulation language statement is parsed, a plurality of second subtasks corresponding to the data manipulation language statement are generated, and each second subtask is sent to a corresponding working node.
[0011] Optionally, the non-coordinating node stores identification information of the coordinating node, and sending a database schema definition language statement to the coordinating node includes:
[0012] Based on the identification information of the coordinating node, a database schema definition language statement is sent to the coordinating node.
[0013] Optionally, after sending the database schema definition language statement to the coordination node, the method further includes:
[0014] The task processing result returned by the coordination node is obtained and sent to the client, wherein the task processing result is composed of the subtask processing results fed back to the coordination node by each working node.
[0015] Optionally, after sending the database schema definition language statement to the coordination node, the method further includes:
[0016] The identification information of the client is sent to the coordination node, so that after the coordination node obtains the subtask processing results fed back by each working node, it sends the task processing result composed of each subtask processing result to the client.
[0017] In a second aspect, an embodiment of the present application further provides a database statement processing device, which is applied to a non-coordinating node in a relational database management system, wherein the relational database management system further includes a coordinating node and multiple working nodes, and the device includes:
[0018] An operation request acquisition module, used to acquire an operation request sent by a client connected to a non-coordinating node;
[0019] The forwarding module is used to send the database schema definition language statement to the coordination node when it is determined that the operation request is a database schema definition language statement, so that the coordination node parses the database schema definition language statement, generates multiple first subtasks corresponding to the database schema definition language statement, and sends each first subtask to the corresponding working node.
[0020] Optionally, the device further comprises:
[0021] The parsing module is used to parse the data manipulation language statement when determining that the operation request is a data manipulation language statement, generate multiple second subtasks corresponding to the data manipulation language statement, and send each second subtask to a corresponding working node.
[0022] Optionally, the non-coordinating node stores identification information of the coordinating node, and the forwarding module is specifically used to:
[0023] When it is determined that the operation request is a database schema definition language statement, the database schema definition language statement is sent to the coordinating node based on the identification information of the coordinating node.
[0024] Optionally, the device further comprises:
[0025] The result return module is used to obtain the task processing result returned by the coordination node and send the task processing result to the client, wherein the task processing result is composed of the subtask processing results fed back to the coordination node by each working node.
[0026] Optionally, the device further comprises:
[0027] The identification information sending module is used to send the identification information of the client to the coordination node, so that after the coordination node obtains the subtask processing results fed back by each working node, it sends the task processing result composed of each subtask processing result to the client.
[0028] In a third aspect, an embodiment of the present application further provides an electronic device, including a processor and a machine-readable storage medium, wherein the machine-readable storage medium stores machine-executable instructions that can be executed by the processor, and the processor is prompted by the machine-executable instructions to: implement the steps of a database statement processing method provided in the first aspect above.
[0029] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the steps of a database statement processing method provided in the first aspect are implemented.
[0030] In a fifth aspect, an embodiment of the present application further provides a computer program product comprising instructions, which, when executed on a computer, enables the computer to execute the steps of a database statement processing method provided in the first aspect above.
[0031] In a sixth aspect, an embodiment of the present application further provides a computer program, which, when executed on a computer, enables the computer to execute the steps of a database statement processing method provided in the first aspect above.
[0032] A database statement processing method, device, electronic device and storage medium provided in an embodiment of the present application can first judge the operation request after obtaining the operation request sent by the client communicating with the non-coordinating node. When it is judged that the operation request is a database model definition language statement, the database model definition language statement is sent to the coordinating node, and the coordinating node parses the database model definition language statement, generates multiple first subtasks corresponding to the database model definition language statement, and sends each first subtask to the corresponding working node. This can avoid the non-coordinating node returning information prompting the user that the database model definition language statement is not supported, thereby avoiding the user from resending the database model definition language statement to the coordinating node, reducing the user's operations and improving the flexibility of the database management system. Of course, the implementation of any product or method of the present application does not necessarily require all of the above advantages to be achieved at the same time. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0034] Figure 1 A system schematic diagram of a relational database management system in the related art;
[0035] Figure 2 A flowchart of a first implementation of a database statement processing method according to an embodiment of the present application;
[0036] Figure 3 A flowchart of a second implementation of a database statement processing method according to an embodiment of the present application;
[0037] Figure 4 A flowchart of a third implementation of a database statement processing method according to an embodiment of the present application;
[0038] Figure 5A flowchart of a fourth implementation of a database statement processing method according to an embodiment of the present application;
[0039] Figure 6 A schematic diagram of the structure of a database statement processing device according to an embodiment of the present application;
[0040] Figure 7 A schematic diagram of the structure of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0041] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0042] In order to solve the problems existing in the prior art, the embodiments of the present application provide a database statement processing method, device, electronic device and storage medium to reduce user operations and improve the flexibility of the database management system.
[0043] A database statement processing method according to an embodiment of the present application can be applied to Figure 1 In the relational database management system shown in Figure 1 As shown, the relational database management system may include a coordination node 110, at least one non-coordination node 120 and a plurality of working nodes 130. When the non-coordination node 120 obtains an operation request sent by a client that obtains a communication connection, it may determine whether the operation request is a database schema definition language statement or a data manipulation language statement. When the operation request is a database schema definition language statement, the database schema definition language statement may be sent to the coordination node 110. In this way, the coordination node 110 may parse the database schema definition language statement, generate a plurality of first subtasks corresponding to the database schema definition language statement, and send each first subtask to the corresponding working node 130. After receiving the corresponding first subtask, the working node 130 may execute the corresponding first subtask.
[0044] In some examples, the above-mentioned coordination node 110, non-coordination node 120 and working node 130 may be different physical nodes, or different virtual nodes virtualized on the same hardware device by software.
[0045] In some examples, the coordinating node 110 stores metadata related to the shard table, each working node 130 stores a different shard table, and the non-coordinating node 120 is a working node that stores the metadata in the coordinating node 110 .
[0046] Below, we first introduce a database statement processing method in an embodiment of the present application, which can be applied to Figure 1 The non-coordinating nodes in the relational database management system shown in Figure 2 FIG. 1 is a flowchart of a first implementation of a method for processing a database statement according to an embodiment of the present application. The method may include:
[0047] S210, obtaining an operation request sent by a client connected to a non-coordinating node;
[0048] S220, when it is determined that the operation request is a database schema definition language statement, the database schema definition language statement is sent to the coordination node, so that the coordination node parses the database schema definition language statement, generates multiple first subtasks corresponding to the database schema definition language statement, and sends each first subtask to the corresponding working node.
[0049] In some examples, after the metadata of the coordination node is stored in the non-coordinating node, the client can directly send an operation request to the non-coordinating node.
[0050] In some examples, the client may send an operation request related to a database schema definition language statement to the non-coordinating node, or may send an operation request related to a data manipulation language statement. The database schema definition language statement is mainly used to describe the language of real-world entities to be stored in the database. Common database schema definition language statements include: create database statement, create database table statement, modify database table statement, delete database table statement, create query command statement, modify query command statement, delete query command statement, and delete data table content statement.
[0051] The data manipulation language statements are mainly used for basic operations on the database. Users can use data manipulation language statements to perform basic operations on the database. Common data manipulation language statements include: insert operation statements, delete operation statements, modify operation statements, sort operation statements, and search operation statements.
[0052] After receiving the operation request sent by the client, the non-coordinating node may judge the operation request to determine whether the operation request is a database schema definition language statement or a data manipulation language statement.
[0053] When it is determined that the operation request is a database schema definition language statement, in order to avoid the non-coordination node returning information prompting the user that the database schema definition language statement is not supported, the database schema definition language statement can be sent to the coordination node. In this way, after receiving the database schema definition language statement sent by the non-coordination node, the coordination node can parse the database schema definition language statement, and then generate multiple first subtasks corresponding to the database schema definition language statement, and send each first subtask to the corresponding working node. Each working node processes the corresponding first subtask.
[0054] Through a database statement processing method of an embodiment of the present application, after obtaining an operation request sent by a client connected to a non-coordinating node, the operation request can be judged first. When it is judged that the operation request is a database model definition language statement, the database model definition language statement is sent to the coordinating node, and the coordinating node parses the database model definition language statement, generates multiple first subtasks corresponding to the database model definition language statement, and sends each first subtask to the corresponding working node. This can avoid the non-coordinating node returning information prompting the user that the database model definition language statement is not supported, thereby avoiding the user from resending the database model definition language statement to the coordinating node, reducing the user's operations, and improving the flexibility of the database management system.
[0055] exist Figure 2 Based on the database statement processing method shown in FIG. 1 , the present application embodiment also provides a possible implementation method, such as Figure 3 FIG. 1 is a flowchart of a second implementation of a method for processing a database statement in an embodiment of the present application. The method may include:
[0056] S310, obtaining an operation request sent by a client connected to a non-coordinating node;
[0057] S320, determining whether the operation request is a database schema definition language statement or a data manipulation language statement. When the operation request is a database schema definition language statement, execute step S330, and when the operation request is a data manipulation language statement, execute step S340.
[0058] S330, sending a database schema definition language statement to the coordination node, so that the coordination node parses the database schema definition language statement, generates multiple first subtasks corresponding to the database schema definition language statement, and sends each first subtask to a corresponding working node.
[0059] S340, parsing the data manipulation language statement, generating multiple second subtasks corresponding to the data manipulation language statement, and sending each second subtask to a corresponding working node.
[0060] In some examples, the operation request sent by the client to the non-coordinating node may be a database schema definition language statement or a data manipulation language statement. In this regard, the non-coordinating node may judge the operation request, and when it is judged that the operation request is a database schema definition language statement, the database schema definition language statement may be sent to the coordinating node. The coordinating node parses the database schema definition language statement to generate multiple first subtasks corresponding to the database schema definition language statement, and sends each first subtask to the corresponding working node.
[0061] When it is determined that the operation request is a data manipulation language statement, the data manipulation language statement may be directly parsed to generate a plurality of second subtasks corresponding to the data manipulation language statement, and then each second subtask is sent to a corresponding working node.
[0062] In this way, the non-coordinating node can be prevented from sending the received data manipulation language statement to the coordinating node, thereby avoiding an additional increase in the load of the coordinating node.
[0063] In some examples, the above-mentioned non-coordinating node may store identification information of the coordinating node, so that when the non-coordinating node sends a database schema definition language statement to the coordinating node, the database schema definition language statement may be sent to the coordinating node based on the identification information of the coordinating node.
[0064] It can be understood that steps S310 and S330 in the embodiment of the present application are the same as or similar to steps S210 and S220 in the first implementation manner of the embodiment of the present application, and are not described in detail here.
[0065] exist Figure 3 Based on the database statement processing method shown in FIG. 1 , the present application embodiment also provides a possible implementation method, such as Figure 4 FIG. 1 is a flowchart of a third implementation of a method for processing a database statement in an embodiment of the present application. The method may include:
[0066] S410, obtaining an operation request sent by a client connected to a non-coordinating node for communication;
[0067] S420, determining whether the operation request is a database schema definition language statement or a data manipulation language statement. When the operation request is a database schema definition language statement, executing step S430, when the operation request is a data manipulation language statement, executing step S440.
[0068] S430, sending the database schema definition language statement to the coordination node, so that the coordination node parses the database schema definition language statement, generates multiple first subtasks corresponding to the database schema definition language statement, and sends each first subtask to a corresponding working node. Then, step S450 is executed.
[0069] S440, parsing the data manipulation language statement, generating a plurality of second subtasks corresponding to the data manipulation language statement, and sending each second subtask to a corresponding working node.
[0070] S450, obtaining the task processing result returned by the coordination node, and sending the task processing result to the client, wherein the task processing result is composed of subtask processing results fed back to the coordination node by each working node.
[0071] In some examples, after the coordination node sends multiple first subtasks corresponding to the database schema definition language statements to the corresponding working nodes, each working node can execute the corresponding first subtask and then obtain the subtask processing results of the corresponding first subtask.
[0072] Then, each working node may return the processing result of the corresponding first subtask executed by itself to the coordination node, so that the coordination node can obtain the processing results of multiple subtasks.
[0073] After the coordination node obtains multiple subtask processing results, the multiple subtask processing results can be returned to the non-coordination node as the task processing results corresponding to the above database schema definition language statements, and then sent to the client by the non-coordination node.
[0074] In some examples, after obtaining multiple subtask processing results, the above-mentioned coordination node can also merge the multiple subtask processing results into the task processing results corresponding to the above-mentioned database model definition language statement and return them to the non-coordination node, and the non-coordination node returns the task processing results to the client.
[0075] It can be understood that steps S410 to S440 in the embodiment of the present application are the same as or similar to steps S310 to S340 in the second implementation manner of the embodiment of the present application, and are not described in detail here.
[0076] exist Figure 3 Based on the database statement processing method shown in FIG. 1 , the present application embodiment also provides a possible implementation method, such as Figure 5 FIG. 1 is a flowchart of a fourth implementation of a method for processing a database statement in an embodiment of the present application. The method may include:
[0077] S510, obtaining an operation request sent by a client connected to a non-coordinating node;
[0078] S520, determine whether the operation request is a database schema definition language statement or a data manipulation language statement. When the operation request is a database schema definition language statement, execute step S530, and when the operation request is a data manipulation language statement, execute step S540.
[0079] S530, sending the database schema definition language statement to the coordination node, so that the coordination node parses the database schema definition language statement, generates multiple first subtasks corresponding to the database schema definition language statement, and sends each first subtask to the corresponding working node, and executes step S550.
[0080] S540, parsing the data manipulation language statement, generating a plurality of second subtasks corresponding to the data manipulation language statement, and sending each second subtask to a corresponding working node.
[0081] S550, sending the identification information of the client to the coordination node, so that after obtaining the subtask processing results fed back by each working node, the coordination node sends the task processing result composed of each subtask processing result to the client.
[0082] In some examples, in order to enable the coordination node to directly send the multiple subtask processing results to the client after obtaining the multiple subtask processing results, the above-mentioned non-coordination node may also send the identification information of the client to the coordination node after sending the database schema definition language statement to the coordination node. In this way, after obtaining the multiple subtask processing results, the coordination node may directly send the task processing results corresponding to the above-mentioned database schema definition language statement composed of the multiple subtask processing results to the client. Thereby, forwarding of the task processing results through the above-mentioned non-coordination node may be avoided. Thereby, the waiting time for the client to obtain the task processing results may be reduced.
[0083] It can be understood that steps S510 to S540 in the embodiment of the present application are the same as or similar to steps S310 to S340 in the second implementation manner of the embodiment of the present application, and are not described in detail here.
[0084] Corresponding to the above method embodiment, the present application embodiment also provides a database statement processing device, which can be applied to Figure 1 The non-coordinating nodes in the relational database management system shown in Figure 6 FIG. 1 is a schematic diagram of the structure of a database statement processing device according to an embodiment of the present application. The device may include:
[0085] An operation request acquisition module 610 is used to acquire an operation request sent by a client connected to a non-coordinating node for communication;
[0086] The forwarding module 620 is used to send the database schema definition language statement to the coordination node when it is determined that the operation request is a database schema definition language statement, so that the coordination node parses the database schema definition language statement, generates multiple first subtasks corresponding to the database schema definition language statement, and sends each first subtask to the corresponding working node.
[0087] A database statement processing device provided by an embodiment of the present application can first judge the operation request after obtaining the operation request sent by the client communicating with the non-coordinating node. When it is judged that the operation request is a database mode definition language statement, the database mode definition language statement is sent to the coordinating node, and the coordinating node parses the database mode definition language statement, generates multiple first subtasks corresponding to the database mode definition language statement, and sends each first subtask to the corresponding working node. This can avoid the non-coordinating node returning information prompting the user that the database mode definition language statement is not supported, thereby avoiding the user from resending the database mode definition language statement to the coordinating node, reducing the user's operations and improving the flexibility of the database management system.
[0088] In some examples, the apparatus may further include:
[0089] The parsing module is used to parse the data manipulation language statement when determining that the operation request is a data manipulation language statement, generate multiple second subtasks corresponding to the data manipulation language statement, and send each second subtask to a corresponding working node.
[0090] In some examples, the non-coordinating node stores identification information of the coordinating node, and the forwarding module 620 is specifically used to:
[0091] When it is determined that the operation request is a database schema definition language statement, the database schema definition language statement is sent to the coordinating node based on the identification information of the coordinating node.
[0092] In some examples, the apparatus may further include:
[0093] The result return module is used to obtain the task processing result returned by the coordination node and send the task processing result to the client, wherein the task processing result is composed of the subtask processing results fed back to the coordination node by each working node.
[0094] In some examples, the apparatus may further include:
[0095] The identification information sending module is used to send the identification information of the client to the coordination node, so that after the coordination node obtains the subtask processing results fed back by each working node, it sends the task processing result composed of each subtask processing result to the client.
[0096] The present application also provides an electronic device, such as Figure 7 , which is a schematic diagram of a structure of a database statement processing method according to an embodiment of the present application applied to an electronic device. The electronic device may include a processor 701 and a machine-readable storage medium 702. The machine-readable storage medium 702 stores machine-executable instructions that can be executed by the processor 701. The processor 701 is prompted by the machine-executable instructions to implement the steps of a database statement processing method according to any of the above embodiments. For example, the following steps may be implemented:
[0097] Obtaining operation requests sent by clients communicating with non-coordinating nodes;
[0098] When it is determined that the operation request is a database schema definition language statement, the database schema definition language statement is sent to the coordination node so that the coordination node parses the database schema definition language statement, generates multiple first subtasks corresponding to the database schema definition language statement, and sends each first subtask to the corresponding working node.
[0099] The machine-readable storage medium 702 may include a random access memory (RAM) or a non-volatile memory (NVM), such as at least one disk storage. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.
[0100] The above-mentioned processor 701 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0101] An electronic device provided by an embodiment of the present application can first judge the operation request after obtaining an operation request sent by a client connected to a non-coordinating node, and when it is judged that the operation request is a database model definition language statement, send the database model definition language statement to the coordinating node, and the coordinating node parses the database model definition language statement, generates multiple first subtasks corresponding to the database model definition language statement, and sends each first subtask to the corresponding working node. This can avoid the non-coordinating node returning information prompting the user that the database model definition language statement is not supported, thereby avoiding the user from resending the database model definition language statement to the coordinating node, reducing the user's operations and improving the flexibility of the database management system.
[0102] The present application also provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the steps of a database statement processing method shown in any of the above embodiments are implemented. For example, the following steps can be implemented:
[0103] Obtaining operation requests sent by clients communicating with non-coordinating nodes;
[0104] When it is determined that the operation request is a database schema definition language statement, the database schema definition language statement is sent to the coordination node so that the coordination node parses the database schema definition language statement, generates multiple first subtasks corresponding to the database schema definition language statement, and sends each first subtask to the corresponding working node.
[0105] A computer-readable storage medium provided by an embodiment of the present application can first judge the operation request after obtaining an operation request sent by a client connected to a non-coordinating node, and when it is judged that the operation request is a database schema definition language statement, send the database schema definition language statement to the coordinating node, and the coordinating node parses the database schema definition language statement, generates multiple first subtasks corresponding to the database schema definition language statement, and sends each first subtask to the corresponding working node. This can avoid the non-coordinating node returning information prompting the user that the database schema definition language statement is not supported, thereby avoiding the user from resending the database schema definition language statement to the coordinating node, reducing the user's operations, and improving the flexibility of the database management system.
[0106] The embodiment of the present application further provides a computer program product including instructions, which, when executed on a computer, enables the computer to execute the steps of a database statement processing method shown in any of the above embodiments, for example, the following steps may be executed:
[0107] Obtaining operation requests sent by clients communicating with non-coordinating nodes;
[0108] When it is determined that the operation request is a database schema definition language statement, the database schema definition language statement is sent to the coordination node so that the coordination node parses the database schema definition language statement, generates multiple first subtasks corresponding to the database schema definition language statement, and sends each first subtask to the corresponding working node.
[0109] A computer program product including instructions provided by an embodiment of the present application can first judge the operation request after obtaining an operation request sent by a client connected to a non-coordinating node, and when it is judged that the operation request is a database schema definition language statement, send the database schema definition language statement to the coordinating node, and the coordinating node parses the database schema definition language statement, generates multiple first subtasks corresponding to the database schema definition language statement, and sends each first subtask to the corresponding working node. This can avoid the non-coordinating node returning information prompting the user that the database schema definition language statement is not supported, thereby avoiding the user from resending the database schema definition language statement to the coordinating node, reducing the user's operations, and improving the flexibility of the database management system.
[0110] The embodiment of the present application further provides a computer program, which, when executed on a computer, enables the computer to execute the steps of a database statement processing method shown in any of the above embodiments, for example, the following steps may be executed:
[0111] Obtaining operation requests sent by clients communicating with non-coordinating nodes;
[0112] When it is determined that the operation request is a database schema definition language statement, the database schema definition language statement is sent to the coordination node so that the coordination node parses the database schema definition language statement, generates multiple first subtasks corresponding to the database schema definition language statement, and sends each first subtask to the corresponding working node.
[0113] A computer program provided by an embodiment of the present application can first judge the operation request after obtaining the operation request sent by the client connected to the non-coordinating node, and when it is judged that the operation request is a database mode definition language statement, send the database mode definition language statement to the coordinating node, and the coordinating node parses the database mode definition language statement, generates multiple first subtasks corresponding to the database mode definition language statement, and sends each first subtask to the corresponding working node. This can avoid the non-coordinating node returning the information prompting the user that the database mode definition language statement is not supported, and then avoid the user from resending the database mode definition language statement to the coordinating node, reducing the user's operations and improving the flexibility of the database management system.
[0114] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0115] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0116] The above are only preferred embodiments of the present application and are not intended to limit the protection scope of the present application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present application are included in the protection scope of the present application.
Claims
1. A database statement processing method, It is characterized in that A non-coordinating node applied to a relational database management system, the relational database management system further comprising a coordinating node and a plurality of working nodes, the coordinating node storing metadata related to a sharding table, each working node storing a different sharding table, the non-coordinating node being a working node storing metadata in the coordinating node, the method comprising: Obtaining an operation request sent by a client connected to the non-coordinating node for communication; When it is determined that the operation request is a database schema definition language statement, sending the database schema definition language statement to the coordination node, so that the coordination node parses the database schema definition language statement, generates a plurality of first subtasks corresponding to the database schema definition language statement, and sends each of the first subtasks to a corresponding working node; When it is determined that the operation request is a data manipulation language statement, the data manipulation language statement is parsed, a plurality of second subtasks corresponding to the data manipulation language statement are generated, and each of the second subtasks is sent to a corresponding working node.
2. The method according to claim 1, It is characterized in that The identification information of the coordinating node is stored in the non-coordinating node, and the sending of the database schema definition language statement to the coordinating node includes: Based on the identification information of the coordinating node, the database schema definition language statement is sent to the coordinating node.
3. The method according to claim 1, It is characterized in that After sending the database schema definition language statement to the coordination node, the method further includes: The task processing result returned by the coordination node is obtained, and the task processing result is sent to the client, wherein the task processing result is composed of subtask processing results fed back to the coordination node by each of the working nodes.
4. The method according to claim 1, It is characterized in that After sending the database schema definition language statement to the coordination node, the method further includes: The identification information of the client is sent to the coordination node, so that after the coordination node obtains the subtask processing results fed back by each of the working nodes, it sends the task processing result composed of each of the subtask processing results to the client.
5. A database statement processing device, It is characterized in that A non-coordinating node applied to a relational database management system, the relational database management system further comprising a coordinating node and a plurality of working nodes, the coordinating node storing metadata related to a sharding table, each working node storing a different sharding table, the non-coordinating node being a working node storing metadata in the coordinating node, the device comprising: An operation request acquisition module, used to acquire an operation request sent by a client connected to the non-coordinating node for communication; a forwarding module, configured to, when determining that the operation request is a database schema definition language statement, send the database schema definition language statement to the coordination node, so that the coordination node parses the database schema definition language statement, generates a plurality of first subtasks corresponding to the database schema definition language statement, and sends each of the first subtasks to a corresponding working node; The parsing module is used to parse the data manipulation language statement when it is determined that the operation request is a data manipulation language statement, generate multiple second subtasks corresponding to the data manipulation language statement, and send each of the second subtasks to a corresponding working node.
6. The device according to claim 5, It is characterized in that The non-coordinating node stores identification information of the coordinating node, and the forwarding module is specifically used to: When it is determined that the operation request is a database schema definition language statement, the database schema definition language statement is sent to the coordination node based on the identification information of the coordination node.
7. The device according to claim 5, It is characterized in that The device also includes: The result returning module is used to obtain the task processing result returned by the coordinating node and send the task processing result to the client, wherein the task processing result is composed of the subtask processing results fed back by each of the working nodes to the coordinating node.
8. The device according to claim 5, It is characterized in that The device also includes: An identification information sending module is used to send the identification information of the client to the coordination node, so that after the coordination node obtains the subtask processing results fed back by each of the working nodes, it sends the task processing results composed of each of the subtask processing results to the client.
9. An electronic device, It is characterized in that The method comprises a processor and a machine-readable storage medium, wherein the machine-readable storage medium stores machine-executable instructions that can be executed by the processor, and the processor is prompted by the machine-executable instructions to implement the method steps described in any one of claims 1 to 4.
10. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method steps described in any one of claims 1 to 4 are implemented.
