Communication method, distributed database middleware, and computing device cluster
By using the PBE protocol to communicate with database nodes through distributed database middleware, the problem of low efficiency in processing batch data by database nodes is solved, and efficient data processing is achieved.
Patent Information
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- HUAWEI CLOUD COMPUTING TECHNOLOGIES CO LTD
- Filing Date
- 2025-06-30
- Publication Date
- 2026-06-04
AI Technical Summary
In database systems, the low communication efficiency between distributed database middleware and database nodes results in low efficiency when database nodes process batches of data.
By using the Parse-Binde-Execute (PBE) protocol through a distributed database middleware, the client's access request is obtained, the target node is determined, and the corresponding operation request is sent to realize the data processing of the target node.
It improves the efficiency of database nodes in processing batch data, reduces the number of PBE message encapsulations, and enhances communication efficiency.
Smart Images

Figure CN2025105362_04062026_PF_FP_ABST
Abstract
Description
A communication method, a distributed database middleware, and a computing device cluster
[0001] This application claims priority to Chinese Patent Application No. 202411750016.4, filed on November 29, 2024, entitled "A Communication Method, Distributed Database Middleware and Computing Device Cluster", the entire contents of which are incorporated herein by reference. Technical Field
[0002] This application relates to the field of database technology, and in particular to a communication method, distributed database middleware, and computing device cluster. Background Technology
[0003] In database systems, clients typically request to perform the same operations multiple times on tables stored in the database, such as inserting or updating batches of data. In batch data scenarios, the distributed database middleware in the database system sends multiple messages to the database nodes based on the client's request. These messages encapsulate Structured Query Language (SQL) statements with the same structure but different parameters. For the database nodes, they need to execute the complete processing flow for each SQL statement encapsulated in each message, resulting in low efficiency when processing batch data. Summary of the Invention
[0004] This application provides a communication method, a distributed database middleware, and a computing device cluster. When the client communicates with the database node through the distributed database middleware, it can solve the problem of low efficiency when the database node processes batch data.
[0005] Firstly, this application provides a communication method. This method is applied to a distributed database middleware and includes: obtaining an access request from a client, the access request indicating a processing operation on batch data of a data table, wherein the data table belongs to a database system, and the database system includes multiple database nodes; determining at least one target node among the multiple database nodes related to the batch data, and determining data corresponding to each target node in the batch data; and sending an operation request corresponding to each target node to each target node based on a prepare-bind-execute (PBE) protocol, wherein the operation request corresponding to the target node indicates that the processing operation is performed on the data corresponding to the target node.
[0006] In the above scheme, the data corresponding to each target node refers to a group of data belonging to the same target node in the batch data. The distributed database middleware groups the batch data requested by the client to obtain the data corresponding to each target node related to the batch data. This allows the distributed database middleware to communicate with each target node through the PBE protocol, thus solving the problem of low efficiency in batch data processing by target nodes.
[0007] In one possible implementation, obtaining the access request from the client includes: receiving a first message sent by the client based on the PBE protocol, the first message including a first P message and a first B message; wherein the first P message includes the format of a Structured Query Language (SQL) statement, the SQL statement instructing the processing operation on the data table, and the first B message includes the batch data. In the above scheme, the distributed database middleware can communicate with the client through the PBE protocol. The client's access request may include P messages, B messages, and E messages sent by the client. In this way, the distributed database middleware can obtain the batch data requested by the client through the P messages and B messages sent by the client. In a specific implementation, the batch data may include one or more rows of data from a data table. Each row of data includes data values of multiple parameters.
[0008] In one possible implementation, sending the operation request corresponding to each target node based on the Parse-Binding-Execute (PBE) protocol includes: sending a second message based on the PBE protocol to each target node, the second message including a second P message, a second B message, and a second E message; wherein the second P message includes the format of a Structured Query Language (SQL) statement, the SQL statement instructing the processing operation to be performed on the data table, and for any target node, the second B message includes the data corresponding to that target node.
[0009] In one possible implementation, the data table contains multiple shards, which belong to the multiple database nodes. When the first P message only includes the value of the shard key of the data table, sending the operation request corresponding to each target node based on the Parse-Binde-Execute (PBE) protocol includes sending the first B message to each target node.
[0010] In one possible implementation, the data table comprises multiple shards belonging to the multiple database nodes, and the first P message includes a placeholder for the shard key of the data table.
[0011] In one possible implementation, sending the operation request corresponding to each target node based on the Parse-Binde-Execute (PBE) protocol includes: for any target node, sending a PBE message encapsulating the data corresponding to that target node to that target node through the socket object of that target node. The PBE message includes P messages based on the P protocol, B messages based on the B protocol, and E messages based on the E protocol.
[0012] In one possible implementation, the method further includes: sending configuration information to each target node, the configuration information being used to instruct each target node to parse the messages sent by the database middleware based on the PBE protocol.
[0013] Secondly, this application also provides a distributed database middleware. This distributed database middleware is used to: obtain access requests from clients, the access requests indicating processing operations on batch data of a data table, wherein the data table belongs to a database system, and the database system includes multiple database nodes; determine at least one target node among the multiple database nodes related to the batch data, and determine data corresponding to each target node in the batch data; and send an operation request corresponding to each target node to each target node based on the Parse-Binde-Execute (PBE) protocol, wherein the operation request corresponding to the target node indicates that the processing operation is performed on the data corresponding to the target node.
[0014] In one possible implementation, the distributed database middleware is used to obtain access requests from clients, including: the distributed database middleware is used to receive a first message sent by the client based on the PBE protocol, the first message including a first P message and a first B message; wherein, the first P message includes the format of a Structured Query Language (SQL) statement, the SQL statement instructing the processing operation to be performed on the data table, and the first B message includes the batch data.
[0015] In one possible implementation, the distributed database middleware is used to send an operation request corresponding to each target node to each target node based on the Parse-Binde-Execute (PBE) protocol, including: the distributed database middleware is used to send a second message based on the PBE protocol to each target node, the second message including a second P message and a second B message; wherein, the second P message includes the format of a Structured Query Language (SQL) statement, the SQL statement instructing the processing operation to be performed on the data table, and for any target node, the second B message includes the data corresponding to that target node.
[0016] In one possible implementation, the data table comprises multiple shards, each belonging to one of the multiple database nodes. When the first P message only includes the value of the shard key of the data table, the distributed database middleware is used to send an operation request corresponding to each target node to each target node based on the Parse-Binde-Execute (PBE) protocol. This includes: the distributed database middleware sending the first B message to each target node.
[0017] In one possible implementation, the data table comprises multiple shards belonging to the multiple database nodes, and the first P message includes a placeholder for the shard key of the data table.
[0018] In one possible implementation, the distributed database middleware is used to send operation requests corresponding to each target node to each target node based on the Parse-Binde-Execute (PBE) protocol. This includes: for any target node, the distributed database middleware uses the socket object of that target node to send a PBE message encapsulating data corresponding to that target node. Here, a PBE message refers to a message generated based on the PBE protocol, namely a P message, B message, and E message.
[0019] In the above scheme, the distributed database middleware sends PBE messages through the socket object of the target node, which can reduce the number of PBE message encapsulations and improve communication efficiency.
[0020] In one possible implementation, the distributed database middleware is further configured to: send configuration information to each target node, the configuration information being used to instruct each target node to parse the message sent by the database middleware based on the PBE protocol.
[0021] In the above scheme, the distributed database middleware sends the configuration information to the target node, which enables the target node to parse the messages from the distributed database middleware based on the PBE protocol.
[0022] Thirdly, this application also provides a communication device. The communication device includes: an acquisition module, a processing module, and a transmission module.
[0023] The acquisition module is used to acquire access requests from clients. These access requests are used to instruct the processing of batch data in a data table. The data table belongs to a database system, which includes multiple database nodes.
[0024] The processing module is used to determine at least one target node among the plurality of database nodes that is related to the batch data, and to determine the data corresponding to each target node in the batch data.
[0025] The sending module is used to send an operation request corresponding to each target node to each target node based on the parsing-binding-execution PBE protocol. The operation request corresponding to the target node is used to instruct the processing operation to be performed on the data corresponding to the target node.
[0026] In one possible implementation, the acquisition module is used to acquire an access request from a client, including: receiving a first message sent by the client based on the PBE protocol, the first message including a first P message and a first B message; wherein the first P message includes the format of a Structured Query Language (SQL) statement, the SQL statement instructing the processing operation to be performed on the data table, and the first B message includes the batch data.
[0027] In one possible implementation, the sending module sends an operation request corresponding to each target node to each target node based on the Parse-Binde-Execute (PBE) protocol, including: sending a second message based on the PBE protocol to each target node, the second message including a second P message and a second B message; wherein the second P message includes the format of a Structured Query Language (SQL) statement, the SQL statement instructing the processing operation to be performed on the data table, and for any target node, the second B message includes the data corresponding to that target node.
[0028] In one possible implementation, the data table contains multiple shards, which belong to the multiple database nodes. When the first P message only includes the value of the shard key of the data table, the sending module sends an operation request corresponding to each target node to each target node based on the parsing-binding-execution PBE protocol, including sending the first B message to each target node.
[0029] In one possible implementation, the data table comprises multiple shards belonging to the multiple database nodes, and the first P message includes a placeholder for the shard key of the data table.
[0030] In one possible implementation, the sending module sends an operation request corresponding to each target node to each target node based on the Parse-Binde-Execute (PBE) protocol, including: for any target node, sending a PBE message encapsulating the data corresponding to the target node to the target node through the socket object of the target node.
[0031] In one possible implementation, the sending module is further configured to: send configuration information to each target node, the configuration information being used to instruct each target node to parse the message sent by the database middleware based on the PBE protocol.
[0032] Fourthly, this application also provides a computing device cluster. The computing device cluster includes at least one computing device, each computing device including a processor and a memory; the processor of the at least one computing device is configured to execute instructions stored in the memory of the at least one computing device, causing the computing device cluster to perform the method provided by the first aspect or any possible implementation thereof.
[0033] Fifthly, this application also provides a computer program product, a computer program product containing instructions, characterized in that, when the instructions are run by a computing device cluster, the computing device cluster performs the method provided by the first aspect or any possible implementation thereof.
[0034] In a sixth aspect, this application also provides a computer-readable storage medium including computer program instructions that, when executed by a cluster of computing devices, perform the method provided by the first aspect or any possible implementation thereof.
[0035] Any of the distributed database middleware, computing device clusters, computer storage media, or computer program products provided above are used to execute the methods provided above. Therefore, the beneficial effects they can achieve can be referred to the beneficial effects of the corresponding solutions in the corresponding methods provided above, and will not be repeated here. Attached Figure Description
[0036] Figure 1 is a schematic diagram of the structure of a distributed database system provided in an embodiment of this application;
[0037] Figure 2 is a schematic diagram of how a distributed database middleware in a distributed database system shards a data table, according to an embodiment of this application.
[0038] Figure 3 is a flowchart of a communication method for a distributed database middleware provided in an embodiment of this application;
[0039] Figure 4 is a schematic diagram of the execution process of each module in the distributed database middleware provided in the embodiments of this application;
[0040] Figures 5a and 5b are schematic diagrams of P and B messages sent by the distributed database middleware processing client provided in the embodiments of this application;
[0041] Figures 6a to 6c are schematic diagrams of the distributed database middleware provided in the embodiments of this application performing routing calculations and grouping of batch data;
[0042] Figure 7 is a schematic diagram of the distributed database middleware provided in this application obtaining a socket object from a connection object established with a database node;
[0043] Figure 8 is a schematic diagram of the structure of a communication device provided in an embodiment of this application;
[0044] Figure 9 is a schematic diagram of the structure of a computing device provided in an embodiment of this application;
[0045] Figures 10 and 11 are schematic diagrams of the structure of a computing device cluster provided in an embodiment of this application. Detailed Implementation
[0046] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions in the embodiments of this application will be described below with reference to the accompanying drawings.
[0047] In the description of the embodiments of this application, the words "exemplary," "for example," or "for instance" are used to indicate examples, illustrations, or explanations. Any embodiment or design described as "exemplary," "for example," or "for instance" in the embodiments of this application should not be construed as being more preferred or advantageous than other embodiments or designs. Specifically, the use of the words "exemplary," "for example," or "for instance" is intended to present the relevant concepts in a specific manner.
[0048] In the description of the embodiments in this application, the term "and / or" is merely a description of the association relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, B existing alone, and A and B existing simultaneously. Furthermore, unless otherwise stated, the term "multiple" means two or more. For example, multiple systems refer to two or more systems, and multiple screen terminals refer to two or more screen terminals.
[0049] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. The terms "comprising," "including," "having," and their variations all mean "including but not limited to," unless otherwise specifically emphasized.
[0050] Before introducing the embodiments of this application, the technical terms involved in the embodiments of this application will be introduced below.
[0051] The Prepare-Bind-Execute (PBE) protocol is a communication protocol in database systems. Specifically, the PBE protocol includes three protocols: the Parse protocol (P protocol), the Bind protocol (B protocol), and the Execute protocol (E protocol). The PBE protocol provides optimization strategies for scenarios where database nodes execute multiple identical Structured Query Language (SQL) statements, improving the efficiency of database nodes in processing batch data. For example, clients and database nodes can communicate via the PBE protocol. Specifically, the client can first send an SQL statement encapsulated with parameter placeholders to the database node via a P message, then send a batch of bound data to the database node via a B message, and finally send an E message to the database node, instructing the database node to execute the SQL statement. Compared to the client sending multiple SQL statements, by communicating with the database node via the PBE protocol, the database node only needs to execute the complete processing flow of a single SQL statement, which not only improves the efficiency of database nodes when processing batch data but also saves database node resources. It should be noted that the P message mentioned above is generated based on the P protocol, the B message is generated based on the B protocol, and the E message is generated based on the E protocol. Since the PBE protocol is a combined communication protocol, in this application, the P message is also referred to as the P message based on the PBE protocol, and the B message and E message are similar.
[0052] A distributed database (or simply database) consists of multiple database nodes. A database node is a data node within the database, and it is a compute node where a database instance is deployed. This compute node can be a cluster of compute devices, each containing at least one compute device. The compute device can be a physical server, a virtual machine (VM), or a container.
[0053] Distributed database middleware (DDM) focuses on solving the problem of distributed database scaling, overcoming the capacity and performance bottlenecks of traditional databases and enabling high-concurrency access to massive amounts of data. A distributed database middleware can contain at least one middleware node, which is a compute node with deployed compute instances. This compute node can be a cluster of compute devices, including at least one compute device. The compute device can be a physical server, a virtual machine (VM), or a container. When a database system includes distributed database middleware, the database system adopts a storage-compute separation architecture. Specifically, distributed database middleware can provide capabilities such as database sharding, read-write separation, and elastic scaling, making the database system stable, reliable, highly scalable, and continuously maintainable. The database stores multiple tables, each recording multiple rows of data related to business operations. The table sharding capability of distributed database middleware allows it to use sharding technology to store tables within the database, thereby optimizing database performance, such as improving load balancing and query efficiency. Specifically, distributed database middleware can divide a data table into multiple shards based on its sharding key, and store these shards across multiple database nodes. A shard refers to a portion of the data in a data table. A database table can contain multiple shards, each with a different sharding key value. Furthermore, the multiple shards of each data table are stored across multiple database nodes.
[0054] Figure 1 is a schematic diagram of a database system provided in an embodiment of this application. Clients need to communicate with the database through a distributed database middleware. That is, the database system may include a distributed database middleware and multiple database nodes. For example, as shown in Figure 1, the database system may include a distributed database middleware and database nodes 1-3. In Figure 1, different clients can communicate with the database nodes through the distributed database middleware, thereby balancing the load of the database system and improving query efficiency. To improve the performance of the database system, the distributed database middleware uses sharding technology to shard and store the various data tables in the database system. Specifically, the database system can pre-divide the data table into multiple shards based on the data value of the sharding key, and these shards are distributed and stored across multiple database nodes in the database system. Since the data table is divided according to the data value of its sharding key, the sharding key data values contained in each shard of the data table are also different. For example, as shown in Figure 3, the data table tbl1 can include shard 1, shard 2 and shard 3. Shard 1 can be stored in node1 shown in Figure 1, shard 2 can be stored in node2 shown in Figure 1, and shard 3 can be stored in node3 shown in Figure 1. The shard key data values of the data table tbl1 contained in shard 1, shard 2 and shard 3 are different.
[0055] In related technologies, when a database system includes distributed database middleware, the client communicates with the middleware via the PBE protocol. However, the backend communication of the middleware does not support the PBE protocol. In other words, the middleware cannot communicate with the database nodes via the PBE protocol. In this situation, the middleware typically generates multiple SQL statements based on the P and B messages sent by the client, and then sends these SQL statements to the database nodes via multiple simple query (Q) messages. This means the database nodes still need to perform repetitive processing on multiple SQL statements, resulting in low efficiency in processing batches of data.
[0056] To address this issue, this application provides a communication method that solves the problem of low communication efficiency between distributed database middleware and the database. In the communication method provided in this application, the distributed database middleware receives an access request from a client, which instructs the processing of batch data from a data table belonging to a database, which includes multiple database nodes. The method identifies at least one target node among the multiple database nodes related to the batch data, and determines the data corresponding to each target node within the batch data. Based on the Parse-Binde-Execute (PBE) protocol, the method sends an operation request corresponding to each target node to each target node, where the operation request for each target node instructs the processing of the data corresponding to that target node. The data corresponding to each target node refers to a group of data belonging to the same target node within the batch data. By grouping the batch data requested by the client, the distributed database middleware obtains the data corresponding to each target node related to the batch data, enabling the distributed database middleware to communicate with each target node via the PBE protocol, thus solving the problem of low efficiency in processing batch data by the target nodes.
[0057] The communication method provided in the embodiments of this application will be described in detail below with reference to Figure 3.
[0058] Figure 3 is a flowchart of a communication method provided in an embodiment of this application. As shown in Figure 3, the method may include steps S301-S304 as follows. The method can be executed by the distributed database middleware shown in Figure 1. The distributed database middleware may include the parsing module, analysis module, routing module, and node connection module shown in Figure 4. The distributed database middleware can send P2, B2, and E2 messages to the database node based on the P1 message (i.e., the first P message), B1 message (i.e., the first B message), and E1 message (i.e., the first E message) from the client through the functional modules shown in Figure 4. In this way, when the database node processes batch data, it only needs to execute the SQL statement processing flow once, which can improve the efficiency of the database node in processing batch data. The following describes the steps shown in Figure 3 using the distributed database middleware containing the functional modules shown in Figure 4.
[0059] S301, Get access request from client.
[0060] In this embodiment, the client's access request is used to instruct processing operations on batch data in a data table belonging to the database shown in Figure 1. The batch data includes one or more rows of data in the data table. Each row of data includes the value of the sharding key and the values of multiple target parameters.
[0061] In this embodiment, the client and the distributed database middleware can communicate via the PBE protocol. The distributed database middleware can obtain batch data based on the P1 and B1 messages from the client, and this process is described below.
[0062] Specifically, when a client communicates with a distributed database middleware via the PBE protocol, the client's database driver can create a connection object with the distributed database middleware. Taking a JDBC driver as an example, the client's JDBC driver can send a Uniform Resource Locator (URL) to the distributed database middleware, and the JDBC driver creates a connection with the distributed database middleware through the URL information. The URL information can include a query mode value (e.g., preferQueryMode), which indicates that the distributed database middleware parses messages from the client via the PBE protocol.
[0063] Then, the client's database driver can send P1 and B1 messages based on the PBE protocol to the distributed database middleware through the connection object, according to the user's actual needs. In the specific implementation, the client can call the PrepareStatement interface of the connection object to send SQL statement 1 to the JDBC driver. The JDBC driver, based on the P protocol, encapsulates SQL statement 1 into a P1 message and sends it to the distributed database middleware. The P1 message includes the format of a Structured Query Language (SQL) statement. As shown in Figure 4, the parsing module of the distributed database middleware receives the P1 message, parses it according to the P protocol, and obtains the encapsulated SQL statement 1. SQL statement 1 can be used to instruct on processing operations on the data table. The processing operations requested by the SQL statement can include, but are not limited to, insert (insert into), update (update), or delete (delete) operations.
[0064] The distributed database middleware receives P1 messages sent by clients and parses them based on the P protocol in the PBE protocol. After obtaining the SQL statement carried in the P1 message, as shown in Figure 4, the parsing module of the distributed database middleware can parse SQL statement 1 to obtain the information encapsulated in SQL statement 1. The information encapsulated in SQL statement 1 may include the identifier of the data table and information about multiple parameters in the data table for which the requested operation is requested. The information for each parameter includes the parameter identifier and a placeholder. Among these multiple parameters, there are shard keys and multiple target parameters. It should be noted that this embodiment of the application does not specifically limit the number of shard keys and target parameters encapsulated in SQL statement 1. The process of obtaining information about multiple parameters will be described below with reference to Figures 5a and 5b.
[0065] In the first scenario, the shard key information encapsulated in SQL statement 1 includes the shard key identifier and its data value. In this case, the user requests to operate on a row of data in the table. For example, as shown in Figure 5a, taking an insert request as an example, the format of SQL statement 1 could include "insert into tbl1(id, name, age) values(15, ?, ?)". After parsing SQL statement 1, the parsing module can obtain the table identifier (tbl1), the parameter set (including id, name, age), and the value set (15, ?, ?). The parameter set includes identifiers for multiple parameters, and the value set includes the data values or placeholders (?) for each parameter. Here, "id" represents the row identifier, "name" represents the name, and "age" represents the age. The parameter "id" is the shard key of table tbl1, and "15" is the data value of "id". In other words, SQL statement 1 encapsulates the data value ("15") of the shard key (id) of table tbl1 and the placeholders for the target parameters (name, age).
[0066] In the second scenario, the shard key information encapsulated in SQL statement 1 includes the shard key identifier and placeholders. In this case, the user requests to operate on multiple rows of data in the table. For example, as shown in Figure 5b, taking an insert request as an example, the format of SQL statement 1 could include "insert into tbl1(id, name, age) values(?, ?, ?)". After parsing SQL statement 1, the parsing module can obtain the identifier of the encapsulated table (tbl1), the identifiers of multiple parameters (id, name, age), and the data values or placeholders (?, ?, ?) for each parameter. That is, SQL statement 1 encapsulates the shard key (id) of table tbl1 and placeholders for the target parameters (name, age).
[0067] After parsing SQL statement 1, the parsing module in the distributed database middleware can send response message 1 to the client through the database driver of the distributed database middleware. This response message 1 indicates whether parsing the P1 message was successful or failed. If response message 1 indicates successful parsing of the P1 message, the client can send a B1 message containing bound data to the distributed database middleware through the database driver.
[0068] After receiving the B1 message from the client, as shown in Figure 4, the parsing module of the distributed database middleware can parse the B1 message according to the B protocol to obtain the encapsulated binding data. In the specific implementation, the client can send the binding data to the JDBC driver through the PrepareStatement interface. The JDBC driver encapsulates the binding data into a B1 message based on the B protocol and sends the B1 message to the distributed database middleware.
[0069] In the first scenario described above, the parsing module can obtain data values for multiple target parameters by parsing the B1 message. For example, as shown in Figure 6a, the parsing module can obtain the data value "john" for the target parameter name and the data value "10" for the target parameter age by parsing the B1 message.
[0070] In the second scenario described above, the parsing module can parse the B1 message to obtain multiple data values for the sharding key and multiple data values for the target parameters. For example, as shown in Figure 6b, the parsing module can parse the B1 message to obtain multiple data values for the sharding key "id" ("1, 2, 3, 4"), the data values for the target parameter name ("John, Jean, Tom, Alice"), and the data values for the target parameter age ("10, 11, 10, 12"). S302, the distributed database middleware determines at least one target node among multiple database nodes related to the batch data, and determines the data corresponding to each target node in the batch data.
[0071] In this embodiment, the distributed database middleware can determine at least one target node associated with the batch data based on the shard key data value included in the batch data. The at least one target node associated with the batch data refers to the database node responsible for processing the batch data. In a specific implementation, the database node processing the batch data can also be a storage node storing the shard containing the batch data.
[0072] Specifically, the analysis module of the distributed database middleware can obtain one or more data values of the sharding key from the batch data, as shown in Figure 4. It then sends the table identifier and one or more data values of the sharding key to the routing module for routing calculation to determine at least one target node related to the batch data. As shown in Figure 4, the routing module can input the table identifier and one or more data values of the sharding key into the sharding algorithm, which will then obtain the identifier of a target node corresponding to each of the one or more data values of the sharding key.
[0073] For example, in the case shown in Figure 5a, the data value of the sharding key "id" in data table tbl1 is "15". As shown in Figure 6a, the routing module can calculate the target node node3 based on data table tbl1 and the data value "15" for the sharding key "id" using a sharding algorithm. That is, the batch data including the data value "15" for the sharding key "id", the data value "john" for the target parameter name, and the data value "10" for the target parameter age belong to the target node node3.
[0074] For example, in the case shown in Figure 5b, the data values of the sharding key "id" in data table tbl1 include "1, 2, 3, 4". As shown in Figure 6b, the routing module can calculate the target nodes corresponding to each data value of the sharding key "id" based on data table tbl1 and the data values "1, 2, 3, 4" of the sharding key "id" using a sharding algorithm. Specifically, the target node corresponding to the data value "1" of the sharding key "id" is node1, the target node corresponding to the data value "2" is node2, the target node corresponding to the data value "3" is node1, and the target node corresponding to the data value "4" is node3. The target nodes corresponding to the data values of the sharding key "id" indicate that the row of data containing the data value of the sharding key "id" is stored in the corresponding target node. Specifically, the row containing the data value "1" of the shard key "id" and the row containing the data value "3" of "id" are both stored in the target node node1, the row containing the data value "2" of the shard key "id" is stored in the target node node2, and the row containing the data value "3" of the shard key "id" is stored in the target node node3.
[0075] In this embodiment, after identifying at least one target node related to the batch data, the distributed database middleware groups the batch data and determines the data corresponding to each target node within the batch data. Here, the data corresponding to each target node refers to a group of data belonging to the same target node within the batch data. As shown in Figure 4, after the routing module of the distributed database middleware obtains the identifiers of one or more target nodes, the analysis module determines the data corresponding to the target nodes based on the target nodes related to the batch data.
[0076] Specifically, the analysis module can group batch data according to the correspondence between the data value of the sharding key and the identifier of the target node, and obtain the data corresponding to each target node.
[0077] Once the routing module obtains the identifier of a target node, the analysis module can group the batch data into a single data group. In other words, the batch data belongs to the same target node, and thus the batch data is the data corresponding to that single target node.
[0078] In the case shown in Figure 6a, for example, the routing module obtains that the target node corresponding to the data value "15" of the shard key id is node3, and the analysis module can determine that the batch data (including the data value "15" of the shard key id and the binding data shown in Figure 5a) is the data corresponding to the target node node3.
[0079] In the case shown in Figure 6c, for example, the routing module obtains that the target node corresponding to the data value "1,2,3,4" of the shard key id is node1. The analysis module can determine that the batch data (including the binding data shown in Figure 5b) is the data corresponding to the target node node1.
[0080] When the routing module obtains the identifiers of multiple target nodes, the analysis module can group the batch data into multiple data groups. In other words, the batch data belongs to multiple target nodes, and the batch data includes data corresponding to each target node. The data corresponding to each target node includes the data value of the sharding key corresponding to the target node and the data values of multiple target parameters.
[0081] In the case shown in Figure 6b, for example, the routing module obtains the target node corresponding to the data value "1,3" of the shard key ID as node1, the target node corresponding to the data value "2" of the shard key ID as node2, and the target node corresponding to the data value "4" of the shard key ID as node3. The analysis module groups the bound data shown in Figure 6b, and the grouping results include the data corresponding to node1, the data corresponding to node2, and the data corresponding to node3. As shown in Figure 6b, the data corresponding to node1 includes the data values "1" and "3" of the row identifier ID, the data values "John" and "10" of the parameter name corresponding to the data value "1" of the row identifier ID, and the data values "Tom" and "10" of the parameter name corresponding to the data value "3" of the row identifier ID. The data corresponding to node2 includes the data value "2" of the row identifier ID, the data value "Jean" of the parameter name corresponding to the data value "2" of the row identifier ID, and the data value "11" of the parameter age. The data corresponding to node3 includes the data value "4" of the row identifier id, the data value "Alice" of the parameter name corresponding to the data value "4" of the row identifier id, and the data value "12" of the parameter age.
[0082] In other embodiments, if the parsing module obtains the data value of the sharding key from SQL statement 1, and the batch data belongs to the same target node, the analysis module may not group the batch data.
[0083] In other embodiments, if the routing module obtains the identifier of a target node, and the batch data belongs to the same target node, the analysis module may not group the batch data.
[0084] S303, the distributed database middleware sends operation requests corresponding to each target node to each target node based on the parsing-binding-execution PBE protocol. The operation requests corresponding to the target node are used to instruct on the processing operations to be performed on the data corresponding to the target node.
[0085] Prior to this step, the distributed database middleware can send configuration information to each target node. This configuration information instructs each target node to parse the messages sent by the distributed database middleware based on the PBE protocol. Specifically, taking a JDBC driver as an example, the JDBC driver of the distributed database middleware can send URL information to each target node, establishing a connection with each target node through this URL information. The URL information can include a query mode value (e.g., preferQueryMode), which indicates that the target node parses the messages from the distributed database middleware using the PBE protocol.
[0086] In this step, the distributed database middleware analysis module generates a second message (including P2, B2, and E2 messages) for each target node based on the data corresponding to each target node, and sends the corresponding second message to each target node.
[0087] Specifically, the analysis module can send a P2 message corresponding to each target node to each target node. As shown in Figure 4, the analysis module can generate an SQL statement 2 corresponding to the target node based on the target node's identifier and SQL statement 1, encapsulate the SQL statement 2 corresponding to the target node into a P2 message corresponding to the target node based on the P protocol, and send the P2 message corresponding to the target node to the target node through the node connection module. The SQL statement 2 indicates the processing operation performed on the data table. The analysis module's generation of the SQL statement 2 corresponding to the target node based on the target node's identifier and SQL statement 1 can include: combining the data table identifier and the target node identifier and replacing the data table identifier in SQL statement 1 to obtain the SQL statement 2 corresponding to the target node. For example, the SQL statement 2 encapsulated in the P2 message corresponding to each target node is different.
[0088] Taking the scenarios shown in Figures 6a and 6c as examples, each target node includes one target node. In the scenario shown in Figure 6a, the target node is node3 obtained by the routing module. Therefore, the SQL statement 2 encapsulated in the P2 packet corresponding to node3 includes the identifier of node3. That is, the format of SQL statement 2 can include "insert into tbl1_node3(id, name, age) values(15, ?, ?)". In the scenario shown in Figure 6c, the target node is node1 obtained by the routing module. Therefore, the SQL statement 2 encapsulated in the P2 packet corresponding to node1 includes the identifier of node1. That is, the format of SQL statement 2 can include "insert into tbl1_node1(id, name, age) values(?, ?, ?)".
[0089] Taking the scenario shown in Figure 6b as an example, each target node consists of multiple target nodes. In the scenario shown in Figure 6b, the target nodes are nodes 1 to 3 obtained by the routing module. Therefore, taking the P2 packet corresponding to node 1 as an example, the SQL statement 2 encapsulated in the P2 packet corresponding to node 1 includes the identifier of node 1, that is, the format of SQL statement 2 can include "insert into tbl1_node1(id, name, age) values(?, ?, ?)". Taking the P2 packet corresponding to node 2 as an example, the SQL statement 2 encapsulated in the P2 packet corresponding to node 1 includes the identifier of node 1, that is, the format of SQL statement 2 can include "insert into tbl1_node2(id, name, age) values(?, ?, ?)".
[0090] Specifically, after sending the P2 message, the analysis module can send a B message to each target node.
[0091] When the P1 message only includes the sharding key value of the data table, each target node is considered a single target node, and the batch data belongs to that single target node. The analysis module can directly send the B1 message to that target node. Taking the scenarios shown in Figures 6a and 6c as examples, the batch data belongs to one target node, meaning the binding data carried by the B1 message belongs to one target node. In the scenario shown in Figure 6a, the analysis module can directly send the B1 message to node3, thereby sending the binding data shown in Figure 5a to node3. In the scenario shown in Figure 6c, the analysis module sends the B1 message to node1, thereby sending the binding data shown in Figure 5b to node3.
[0092] When the P1 message includes a placeholder for the sharding key of the data table, the data encapsulated in the B2 message for each target node is different, therefore the B2 message for each target node is also different. For any given target node, the B2 message includes the data corresponding to that target node.
[0093] Taking the situation shown in Figure 6b as an example, the batch data belongs to different target nodes, meaning that the binding data carried by the B1 message belongs to multiple target nodes. In the case shown in Figure 6b, the binding data encapsulated in the B2 message corresponding to node1 includes the data values "1" and "3" for the row identifier id, the data values "John" for the parameter name and "10" for the parameter age corresponding to the row identifier id value "1", and the data values "Tom" for the parameter name and "10" for the parameter age corresponding to the row identifier id value "3". The data encapsulated in the B2 message corresponding to node2 includes the data value "2" for the row identifier id, the data value "Jean" for the parameter name corresponding to the row identifier id value "2", and the data value "11" for the parameter age corresponding to the parameter age.
[0094] In this embodiment, after parsing the B1 message, the parsing module can send response message 2 to the client through the database driver of the distributed database middleware. Response message 2 indicates whether parsing the B1 message was successful or failed. If response message 2 indicates successful parsing of the B1 message, the client can send an E1 message containing bound data to the distributed database middleware through the database driver. After receiving the E1 message from the client, as shown in Figure 4, the parsing module of the distributed database middleware can parse the E1 message according to the E protocol to obtain the encapsulated execution information. In a specific implementation, the client can send bound data to the JDBC driver through the PrepareStatement interface. The JDBC driver encapsulates the bound data into an E1 message based on the E protocol and sends the E1 message to the distributed database middleware. The execution information encapsulated in the E1 message may include a prepare statement identifier, which is used to look up the corresponding SQL statement 2 and its corresponding execution plan in the session-level cache of the database server.
[0095] Specifically, after sending the B2 message, the analysis module can also send E2 messages to one or more target nodes based on the E1 messages from the client. The analysis module can encapsulate the execution information encapsulated in the E1 message from the client into an E2 message corresponding to the target node, and then send the target node's corresponding E2 message to the target node through the node connection module.
[0096] The method embodiment shown in Figure 3 above, where the distributed database middleware groups the batch data requested by the client to obtain the data corresponding to each target node related to the batch data, and communicates with each target node through the PBE protocol, can solve the problem of low efficiency in batch data processing by database nodes due to the distributed database middleware's lack of support for communication with backend database nodes via the PBE protocol. After the distributed database middleware supports communication with backend database nodes via the PBE protocol, the performance of batch data processing by database nodes can be improved.
[0097] In the specific implementation, the node connection module can call the database driver of the distributed database middleware and send the corresponding P2, B2 and E2 messages to each target node through the communication interface of the database driver.
[0098] Because the communication interface of the database driver needs to parse and repackage P2, B2, and E2 messages, it reduces the forwarding efficiency of the distributed database middleware, thus affecting the performance of the database system. Therefore, this embodiment pre-encapsulates the target interface in the connection objects created between the database driver of the distributed database middleware and each target node. In this way, the node connection module can use the target interface in the connection objects created between the distributed database middleware and the target node to send P2, B2, and E2 messages to the target node according to the target node's socket object. Since the driver of the distributed database middleware no longer performs secondary packaging of PBE messages, the efficiency of message forwarding by the distributed database middleware can be improved.
[0099] In this embodiment, the socket object of the target node can be obtained from the query execution object encapsulated in the connection object created between the distributed database middleware and the target node. As shown in Figure 7, taking GaussDB database as an example, after the database driver of GaussDB database creates a Connection object, it is converted into a PGConnection object. Then, the QueryExecutor object is obtained through the getQueryExecutor interface in the PGConnection object, the PG Stream object is obtained from the QueryExecutor object, and the Socket object of the target node is obtained from the pgStream object. Finally, the target interface is obtained based on the encapsulation of the Socket object of the target node.
[0100] When a database system employs distributed transaction management, the distributed database middleware can complete the data commit process through a two-phase commit. Specifically, after sending an E2 message to the target node, the distributed database middleware can also send update information to the target node based on the response message 3 from the target node, instructing the target node to update the shards of the stored data tables, thereby completing the data commit process.
[0101] Based on the method shown in Figure 3, this application also provides a communication device 800.
[0102] Figure 8 is a schematic diagram of the structure of a communication device 800 provided in an embodiment of this application. As shown in Figure 8, the communication device 800 includes: an acquisition module 801, a processing module 802, and a transmission module 803.
[0103] The acquisition module 801 is used to acquire access requests from clients. The access requests are used to instruct batch data processing operations on a data table. The data table belongs to a database system, which includes multiple database nodes.
[0104] The processing module 802 is used to determine at least one target node among the plurality of database nodes that is related to the batch data, and to determine the data corresponding to each target node in the batch data.
[0105] The sending module 803 is used to send an operation request corresponding to each target node to each target node based on the parsing-binding-execution PBE protocol. The operation request corresponding to the target node is used to instruct the processing operation to be performed on the data corresponding to the target node.
[0106] In one possible implementation, the acquisition module 801 is used to acquire an access request from a client, including: receiving a first message sent by the client based on the PBE protocol, the first message including a first P message and a first B message; wherein the first P message includes the format of a Structured Query Language (SQL) statement, the SQL statement instructing the processing operation to be performed on the data table, and the first B message includes the batch data.
[0107] In one possible implementation, the sending module 803 sends an operation request corresponding to each target node to each target node based on the Parse-Binde-Execute (PBE) protocol, including: sending a second message based on the PBE protocol to each target node, the second message including a second P message and a second B message; wherein the second P message includes the format of a Structured Query Language (SQL) statement, the SQL statement instructing the processing operation to be performed on the data table, and for any target node, the second B message includes the data corresponding to that target node.
[0108] In one possible implementation, the data table contains multiple shards, which belong to the multiple database nodes. When the first P message only includes the value of the shard key of the data table, the sending module 803 sends an operation request corresponding to each target node to each target node based on the parsing-binding-execution PBE protocol, including sending the first B message to each target node.
[0109] In one possible implementation, the data table comprises multiple shards belonging to the multiple database nodes, and the first P message includes a placeholder for the shard key of the data table.
[0110] In one possible implementation, the sending module 803 sends an operation request corresponding to each target node to each target node based on the Parse-Binde-Execute (PBE) protocol, including: for any target node, sending a PBE message encapsulating the data corresponding to that target node to that target node through the socket object of that target node. The PBE message includes P messages based on the P protocol, B messages based on the B protocol, and E messages based on the E protocol.
[0111] In one possible implementation, the sending module 803 is further configured to: send configuration information to each target node, the configuration information being used to instruct each target node to parse the message sent by the database middleware based on the PBE protocol.
[0112] The acquisition module 801, processing module 802, and sending module 803 can all be implemented in software or in hardware. For example, the implementation of the acquisition module 801 will be described below. Similarly, the implementation of the processing module 802 and the sending module 803 can refer to the implementation of the acquisition module 801.
[0113] As an example of a software functional unit, module 801 may include code running on a computing instance. The computing instance may include at least one of a physical host (computing device), a virtual machine, or a container. Further, the aforementioned computing instance may be one or more. For example, module 801 may include code running on multiple hosts / virtual machines / containers. It should be noted that the multiple hosts / virtual machines / containers used to run the code may be distributed within the same region or in different regions. Further, the multiple hosts / virtual machines / containers used to run the code may be distributed within the same availability zone (AZ) or in different AZs, each AZ including one or more geographically proximate data centers. Typically, a region may include multiple AZs.
[0114] Similarly, multiple hosts / virtual machines / containers used to run this code can be distributed within the same Virtual Private Cloud (VPC) or across multiple VPCs. Typically, a VPC is set up within a region. Communication between two VPCs within the same region, as well as between VPCs in different regions, requires a communication gateway to be set up within each VPC to enable interconnection between VPCs.
[0115] As an example of a hardware functional unit, the acquisition module 801 may include at least one computing device, such as a server. Alternatively, the acquisition module 801 may also be a device implemented using an application-specific integrated circuit (ASIC) or a programmable logic device (PLD). The PLD may be implemented using a complex programmable logical device (CPLD), a field-programmable gate array (FPGA), generic array logic (GAL), or any combination thereof.
[0116] The multiple computing devices included in the acquisition module 801 can be distributed in the same region or in different regions. Similarly, the multiple computing devices included in the acquisition module 801 can be distributed in the same Availability Zone (AZ) or in different AZs. Likewise, the multiple computing devices included in the acquisition module 801 can be distributed in the same Virtual Private Cloud (VPC) or in multiple VPCs. These multiple computing devices can be any combination of computing devices such as servers, ASICs, PLDs, CPLDs, FPGAs, and GALs.
[0117] It should be noted that in other embodiments, the acquisition module 801 can be used to execute any step in the communication method shown in FIG3, the processing module 802 can be used to execute any step in the communication method shown in FIG3, and the sending module 803 can be used to execute any step in the communication method shown in FIG3. The steps implemented by the acquisition module 801, the processing module 802, and the sending module 803 can be specified as needed. By implementing different steps in the communication method shown in FIG3 through the acquisition module 801, the processing module 802, and the sending module 803 respectively, all functions of the communication device 800 can be realized.
[0118] In other embodiments, the steps implemented by the acquisition module 801, processing module 802, and sending module 803 can also be implemented by modules with other names. For example, the acquisition module 801 can be implemented by the parsing module shown in FIG4, the processing module 802 can be implemented by the analysis module and routing module shown in FIG4, and the sending module 803 can be implemented by the node connection module shown in FIG4.
[0119] This application also provides a computing device 900. As shown in FIG9, the computing device 900 includes: a bus 901, a processor 902, a memory 903, and a communication interface 904. The processor 902, the memory 903, and the communication interface 904 communicate with each other via the bus 901. The computing device 900 may be a server or a terminal device. It should be understood that this application does not limit the number of processors and memories in the computing device 900.
[0120] Bus 901 can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc. For ease of illustration, only one line is used in Figure 9, but this does not imply that there is only one bus or one type of bus. Bus 902 can include pathways for transmitting information between various components of computing device 900 (e.g., memory 903, processor 902, communication interface 904).
[0121] The format of processor 902 may include any one or more processors such as a central processing unit (CPU), a graphics processing unit (GPU), a microprocessor (MP), or a digital signal processor (DSP).
[0122] The memory 903 may include volatile memory, such as random access memory (RAM). The processor 902 may also include non-volatile memory, such as read-only memory (ROM), flash memory, hard disk drive (HDD), or solid state drive (SSD).
[0123] The memory 903 stores executable program code, and the processor 902 executes this executable program code to implement the functions of the aforementioned acquisition module 801, processing module 802, and sending module 803, thereby realizing the communication method shown in FIG3. That is, the memory 903 stores instructions for executing the communication method shown in FIG3.
[0124] Alternatively, the memory 903 stores executable code, which the processor 902 executes to implement the functions of the aforementioned communication devices, thereby realizing the communication method shown in FIG3. That is, the memory 903 stores instructions for executing the communication method shown in FIG3.
[0125] The communication interface 904 uses transceiver modules such as, but not limited to, network interface cards and transceivers to enable communication between the computing device 900 and other devices or communication networks.
[0126] This application also provides a computing device cluster. The computing device cluster may include the distributed database middleware shown in Figure 1. When the computing device cluster is the distributed database middleware shown in Figure 1, the computing device cluster can be used to execute the method steps shown in Figure 3.
[0127] As shown in Figure 10, the computing device cluster includes at least one computing device 900. The memory 903 of one or more computing devices 900 in the computing device cluster may store the same instructions for executing the communication method shown in Figure 3. The computing device may be a server, such as a central server, an edge server, or a local server in a local data center. In some embodiments, the computing device may also be a terminal device such as a desktop computer, a laptop computer, or a smartphone.
[0128] In some possible implementations, the memory 903 of one or more computing devices 900 in the computing device cluster may also store partial instructions for executing the communication method shown in FIG3. In other words, a combination of one or more computing devices 900 can jointly execute the communication method shown in FIG3.
[0129] It should be noted that the memories 903 in different computing devices 900 within the computing device cluster can store different instructions, each used to execute a portion of the functions of the communication device 800. That is, the instructions stored in the memories 903 of different computing devices 900 can implement the functions of one or more modules among the acquisition module 801, processing module 802, and sending module 803.
[0130] In some possible implementations, one or more computing devices in a computing device cluster can be connected via a network. This network can be a wide area network (WAN) or a local area network (LAN), etc. Figure 11 illustrates one possible implementation. As shown in Figure 11, two computing devices 900A and 1000B are connected via a network. Specifically, they are connected to the network through communication interfaces in each computing device. In this type of possible implementation, the memory 903 in computing device 900A stores instructions for executing the functions of the acquisition module 801. Simultaneously, the memory 903 in computing device 900B stores instructions for executing the functions of the processing module 802 and the sending module 803.
[0131] It should be understood that the functions of computing device 900A shown in Figure 11 can also be performed by multiple computing devices 900. Similarly, the functions of computing device 900B can also be performed by multiple computing devices 900.
[0132] In some possible implementations, the memory 903 of one or more computing devices 900 in the computing device cluster may also store partial instructions for executing the communication method shown in FIG3. In other words, a combination of one or more computing devices 900 can jointly execute the instructions for executing the communication method shown in FIG3.
[0133] This application also provides a computer program product containing instructions. The computer program product may be a software or program product containing instructions, capable of running on a computing device or stored on any available medium. When the computer program product is run on at least one computing device, it causes the at least one computing device to perform the communication method shown in FIG3.
[0134] This application also provides a computer-readable storage medium. The computer-readable storage medium can be any available medium that a computing device can store, or a data storage device such as a data center containing one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid-state drive). The computer-readable storage medium includes instructions that instruct the computing device to execute the communication method shown in FIG3.
[0135] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the protection scope of the technical solutions of the embodiments of the present invention.
Claims
1. A communication method, characterized in that, Applied to distributed database middleware, the method includes: Obtain an access request from a client, the access request being used to instruct a batch processing operation on data in a data table, wherein the data table belongs to a database system, and the database system includes multiple database nodes; Identify at least one target node among the plurality of database nodes that is related to the batch data, and determine the data corresponding to each target node in the batch data; Based on the Parse-Binding-Execute (PBE) protocol, an operation request corresponding to each target node is sent to each target node, wherein the operation request corresponding to the target node is used to instruct the processing operation to be performed on the data corresponding to the target node.
2. The method according to claim 1, characterized in that, The process of obtaining access requests from clients includes: Receive a first message sent by the client based on the PBE protocol, the first message including a first P message and a first B message; The first P message includes the format of a Structured Query Language (SQL) statement, which instructs the processing operation to be performed on the data table, and the first B message includes the batch data.
3. The method according to claim 1 or 2, characterized in that, The step of sending the operation request corresponding to each target node to each target node based on the parsing-binding-execution PBE protocol includes: Send a second message based on the PBE protocol to each of the target nodes. The second message includes a second P message and a second B message. The second P message includes the format of a Structured Query Language (SQL) statement, which instructs the processing operation to be performed on the data table. For any target node, the second B message includes the data corresponding to that target node.
4. The method according to claim 2, characterized in that, The data table contains multiple shards, and each shard belongs to one of the multiple database nodes. When the first P message only includes the value of the shard key of the data table, sending the corresponding operation request to each target node based on the Parse-Binde-Execute (PBE) protocol includes: The first B message is sent to each of the target nodes.
5. The method according to claim 2, characterized in that, The data table contains multiple shards, and the shards belong to the multiple database nodes. The first P message includes a placeholder for the shard key of the data table.
6. The method according to any one of claims 1-5, characterized in that, The step of sending the operation request corresponding to each target node to each target node based on the parsing-binding-execution PBE protocol includes: For any target node, a PBE message containing the data corresponding to the target node is sent to the target node through the socket object of the target node.
7. The method according to any one of claims 1-6, characterized in that, The method further includes: Configuration information is sent to each target node, the configuration information being used to instruct each target node to parse the messages sent by the database middleware based on the PBE protocol.
8. A distributed database middleware, characterized in that, The distributed database middleware is used for: Obtain an access request from a client, the access request being used to instruct a batch processing operation on data in a data table, wherein the data table belongs to a database system, and the database system includes multiple database nodes; Identify at least one target node among the plurality of database nodes that is related to the batch data, and determine the data corresponding to each target node in the batch data; Based on the Parse-Binding-Execute (PBE) protocol, an operation request corresponding to each target node is sent to each target node, wherein the operation request corresponding to the target node is used to instruct the processing operation to be performed on the data corresponding to the target node.
9. The distributed database middleware according to claim 8, characterized in that, The distributed database middleware is used to obtain access requests from clients, including: The distributed database middleware is used to receive a first message sent by the client based on the PBE protocol. The first message includes a first P message and a first B message. The first P message includes the format of a Structured Query Language (SQL) statement, which instructs the processing operation to be performed on the data table. The first B message includes the batch data.
10. The distributed database middleware according to claim 8 or 9, characterized in that, The distributed database middleware is used to send operation requests corresponding to each target node to each target node based on the Parse-Binde-Execute (PBE) protocol, including: The distributed database middleware is used to send a second message based on the PBE protocol to each target node. The second message includes a second P message and a second B message. The second P message includes the format of a Structured Query Language (SQL) statement, which instructs the processing operation to be performed on the data table. For any target node, the second B message includes the data corresponding to that target node.
11. The distributed database middleware according to claim 9, characterized in that, The data table contains multiple shards, and the shards belong to the multiple database nodes. When the first P message only includes the value of the shard key of the data table, the distributed database middleware is used to send the operation request corresponding to each target node to each target node based on the parsing-binding-execution PBE protocol, including: the distributed database middleware is used to send the first B message to each target node.
12. The distributed database middleware according to claim 9, characterized in that, The data table contains multiple shards, and the shards belong to the multiple database nodes. The first P message includes a placeholder for the shard key of the data table.
13. The distributed database middleware according to any one of claims 8-12, characterized in that, The distributed database middleware is used to send operation requests corresponding to each target node to each target node based on the parsing-binding-execution PBE protocol, including: for any target node, the distributed database middleware is used to send a PBE message encapsulating the data corresponding to the target node to the target node through the socket object of the target node.
14. The distributed database middleware according to any one of claims 8-13, characterized in that, The distributed database middleware is also used to: send configuration information to each target node, the configuration information being used to instruct each target node to parse the message sent by the database middleware based on the PBE protocol.
15. A computing device cluster, characterized in that, It includes at least one computing device, each computing device including a processor and memory; The processor of the at least one computing device is configured to execute instructions stored in the memory of the at least one computing device to cause the cluster of computing devices to perform the method as described in any one of claims 1-7.
16. A computer program product containing instructions, characterized in that, When the instruction is executed by the computing device cluster, the computing device cluster causes the computing device cluster to perform the method as described in any one of claims 1-7.
17. A computer-readable storage medium, characterized in that, Includes computer program instructions, which, when executed by a cluster of computing devices, perform the method as described in any one of claims 1-7.