Transaction processing method and system
By using a separate metadata cluster to manage metadata in the cloud native database system, the problems of data operation accuracy and transaction processing capabilities after metadata separation of cloud native database system are solved, and efficient scaling and unification of the computing layer are achieved Transaction processing supports multiple transaction isolation levels and optimizes query operations.
Patent Information
- Application Number
- PCT/CN2024/100704
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-12-12
- Filing Date
- 2024-06-21
- Publication Date
- 2025-01-02
AI Technical Summary
After the cloud native database system separates metadata information, how to ensure the correctness of data operations and unified transaction processing capabilities has become a difficult point, especially when the nodes of the computing layer are expanded and scaled, the complexity and efficiency issues are prominent.
A separate metadata cluster is used to manage metadata to realize the decoupling of metadata and computing clusters, making the computing layer simpler and more efficient when expanding nodes, while ensuring that the database system presents unified transaction processing capabilities to the outside world. Specific methods include coordinating points receiving and processing transaction requests, distributing data and metadata operations to the computing cluster and metadata cluster, and coordinating before and after transaction submission to ensure data freshness and consistency.
It realizes the simplicity and efficiency of the expansion and scaling of the computing layer nodes, and ensures the unified transaction processing capability of the database system to the outside, reduces data reading and sending, supports two transaction isolation levels of RC and RR, and optimizes query operations.
Smart Images

Figure CN2024100704_02012025_PF_FP_ABST
Abstract
Description
Transaction processing method and system
[0001] This application claims priority to the Chinese patent application filed with the State Intellectual Property Office of China on June 26, 2023, with application number 202310760061.7 and invention name “A transaction processing method, system and computing device cluster”, the entire contents of which are incorporated by reference into this application.
[0002] This application claims priority to the Chinese patent application filed with the State Intellectual Property Office of China on December 12, 2023, with application number 202311705537.3 and invention name “A Transaction Processing Method and System”, the entire contents of which are incorporated by reference into this application. Technical Field
[0003] The present application relates to the field of cloud computing technology, and in particular to a transaction processing method, system, computing device cluster, computer-readable storage medium, and computer program product. Background Art
[0004] Big data is increasingly being used across enterprises, and databases, as a vehicle for big data storage and analysis, have a vast market. Cloud-native databases, which provide data storage services based on cloud infrastructure, offer higher cost-performance and performance advantages over on-premises databases, and are becoming the preferred choice for major enterprises.
[0005] Cloud-native database systems often use a storage-computing separation architecture, where data metadata is bound to the compute nodes. To improve the elastic scalability of the compute layer, separating the metadata from the data stored on the compute nodes has become a hot topic for cloud vendors. However, separating metadata presents challenges in ensuring the correctness of data operations and presenting a unified transaction processing capability.
[0006] Summary of the Invention
[0007] This application proposes a transaction processing method that uses a separate metadata cluster to manage metadata, decoupling metadata from the computing cluster. This makes node scaling at the computing layer simpler and more efficient, while ensuring that the database system presents a unified transaction processing capability. This application also provides a corresponding system, computing device cluster, computer-readable storage medium, and computer program product.
[0008] In a first aspect, the present application provides a transaction processing method, which is applied to a database system, wherein the database system includes a coordination node, a computing cluster, a metadata cluster, and a storage system. The method includes: the coordination node receives a request to process a transaction; the coordination node responds to a write data operation in the transaction, and distributes first data corresponding to the write data operation to at least one first computing node in the computing cluster; the at least one first computing node writes the first data to the storage system; the at least one first computing node stores metadata of the first data to at least one first metadata node in the metadata cluster; after responding to all operations in the transaction, the database system commits the transaction.
[0009] In one possible implementation, the transaction processing method further includes: the coordination node obtains the metadata of the old data corresponding to the update data operation from the metadata cluster in response to the update data operation in the transaction; the coordination node distributes the metadata of the old data to at least one second computing node of the computing cluster; the at least one second computing node reads the old data from the at least one second computing node or the storage system based on the metadata of the old data; the at least one second computing node updates the old data to the new data corresponding to the update data operation, and writes the new data to the storage system; the at least one second computing node stores the metadata of the new data to at least one second metadata node of the metadata cluster.
[0010] In one possible implementation, the transaction processing method further includes: the coordination node obtains the metadata of the second data corresponding to the query data operation from the metadata cluster in response to the query data operation in the transaction; the coordination node distributes the metadata of the second data to at least one third computing node of the computing cluster; and the at least one third computing node reads the second data from the at least one third computing node or the storage system based on the metadata of the second data.
[0011] In one possible implementation, the transaction processing method further includes: the coordination node obtains metadata of the third data corresponding to the data deletion operation from the metadata cluster in response to the data deletion operation in the transaction; the coordination node distributes the metadata of the third data to at least one fourth computing node of the computing cluster; the at least one fourth computing node deletes the third data from the storage system based on the metadata of the third data; and the at least one fourth computing node notifies the metadata cluster to delete the metadata of the third data.
[0012] In the transaction processing method provided by this application, metadata operations and data operations are unified in one transaction. The transaction is committed after the computing cluster writes data to the storage system and stores the generated metadata in the metadata cluster, ensuring the freshness and consistency of the data.
[0013] In one possible implementation, the database system also includes a global transaction manager, and the transaction processing method further includes: the coordination node obtains a timestamp from the global transaction manager; when responding to each target operation, the coordination node obtains metadata corresponding to the target operation from the metadata cluster according to the timestamp, wherein the target operation is an update data operation, a query data operation, or a delete data operation in the transaction.
[0014] In one possible implementation, the database system also includes a global transaction manager, and the transaction processing method further includes: when responding to each target operation, the coordinating node obtains a timestamp for responding to the target operation from the global transaction manager, wherein the target operation is an update data operation, a query data operation, or a delete data operation in the transaction; and the coordinating node obtains metadata corresponding to the target operation from the metadata cluster based on the timestamp.
[0015] The transaction processing method provided in this application can support both RC and RR transaction isolation levels, and can perform operations such as query optimization and pruning by obtaining metadata from the metadata cluster through the coordination node and distributing it to the computing nodes, thereby reducing data reading and sending.
[0016] In one possible implementation, the database system commits the transaction, including: the coordination node notifies the computing nodes participating in the transaction to commit the transaction; after receiving the notification from the coordination node, the computing nodes participating in the transaction notify the metadata nodes participating in the transaction to commit the transaction; after receiving the message returned by the metadata nodes participating in the transaction indicating that the transaction was successfully submitted, and the computing nodes participating in the transaction successfully submitted the transaction, the computing nodes participating in the transaction return a message to the coordination node indicating that the transaction was successfully submitted; and the coordination node feeds back the successful transaction submission to the user.
[0017] In one possible implementation, the database system commits the transaction, including: the coordination node notifying the computing nodes and metadata nodes involved in the transaction to commit the transaction; after receiving a message from the computing nodes involved in the transaction indicating that the transaction was successfully submitted, and receiving a message from the metadata nodes involved in the transaction indicating that the transaction was successfully submitted, the coordination node feeds back to the user that the transaction was successfully submitted.
[0018] In a second aspect, the present application provides a transaction processing system for implementing the transaction processing method provided by the above-mentioned first aspect or any possible implementation of the first aspect.
[0019] The transaction processing system includes a coordination node, a computing cluster, a metadata cluster and a storage system, wherein the computing cluster includes at least one first computing node; the metadata cluster includes at least one first metadata node; the coordination node is used to receive a request to process a transaction; the coordination node is also used to distribute the first data corresponding to the write data operation to the at least one first computing node in response to the write data operation in the transaction; the at least one first computing node is used to write the first data to the storage system; the at least one first computing node is also used to store the metadata of the first data to the at least one first metadata node; the transaction processing system is used to commit the transaction after responding to all operations in the transaction.
[0020] In one possible implementation, the computing cluster also includes at least one second computing node; the metadata cluster also includes at least one second metadata node; the coordination node is further used to: in response to the update data operation in the transaction, obtain the metadata of the old data corresponding to the update data operation from the metadata cluster; and distribute the metadata of the old data to at least one second computing node of the computing cluster; the at least one second computing node is used to: read the old data from the at least one second computing node or the storage system according to the metadata of the old data; update the old data to the new data corresponding to the update data operation, and write the new data to the storage system; and store the metadata of the new data to the at least one second metadata node.
[0021] In one possible implementation, the computing cluster also includes at least one third computing node; the coordination node is further used to: in response to the query data operation in the transaction, obtain the metadata of the second data corresponding to the query data operation from the metadata cluster; and distribute the metadata of the second data to the at least one third computing node; the at least one third computing node is used to: read the second data from the at least one third computing node or the storage system according to the metadata of the second data.
[0022] In one possible implementation, the computing cluster also includes at least one fourth computing node; the coordination node is further used to: in response to the delete data operation in the transaction, obtain the metadata of the third data corresponding to the delete data operation from the metadata cluster; and distribute the metadata of the third data to the at least one fourth computing node; the at least one fourth computing node is used to: delete the third data from the storage system based on the metadata of the third data; and notify the metadata cluster to delete the metadata of the third data.
[0023] In one possible implementation, the transaction processing system 700 also includes a global transaction manager, and the coordination node is further used to: obtain a timestamp from the global transaction manager; and when responding to each target operation, obtain metadata corresponding to the target operation from the metadata cluster according to the timestamp, wherein the target operation is an update data operation, a query data operation, or a delete data operation in the transaction.
[0024] In one possible implementation, the transaction processing system 700 also includes a global transaction manager, and the coordination node is further used to: when responding to each target operation, obtain a timestamp for responding to the target operation from the global transaction manager, wherein the target operation is an update data operation, a query data operation, or a delete data operation in the transaction; and obtain metadata corresponding to the target operation from the metadata cluster according to the timestamp.
[0025] In one possible implementation, the transaction processing system is used to commit the transaction after responding to all operations in the transaction, specifically including: the coordination node is used to notify the computing nodes participating in the transaction in the computing cluster to commit the transaction; the computing nodes participating in the transaction are used to: after receiving the notification from the coordination node, notify the metadata nodes participating in the transaction to commit the transaction; and after receiving the message of successful submission of the transaction returned by the metadata nodes participating in the transaction and the computing nodes participating in the transaction successfully submitting the transaction, return a message of successful submission of the transaction to the coordination node; the coordination node is also used to feedback the successful submission of the transaction to the user.
[0026] In one possible implementation, the transaction processing system is used to commit the transaction after responding to all operations in the transaction, specifically including: the coordination node is used to: notify the computing nodes and metadata nodes involved in the transaction to commit the transaction; and after receiving a message from the computing nodes involved in the transaction indicating that the transaction was successfully submitted, and receiving a message from the metadata nodes involved in the transaction indicating that the transaction was successfully submitted, feedback to the user that the transaction was successfully submitted.
[0027] In a third aspect, the present application provides a computing device cluster comprising at least one computing device, each computing device comprising a processor and a memory; the processor of the at least one computing device is used to execute instructions stored in the memory of the at least one computing device, so that the computing device cluster performs a transaction processing method corresponding to the above-mentioned first aspect or any possible implementation of the first aspect.
[0028] In a fourth aspect, the present application provides a computer program product comprising instructions, which, when executed by a computing device cluster, enables the computing device cluster to execute a transaction processing method corresponding to the above-mentioned first aspect or any possible implementation of the first aspect.
[0029] In a fifth aspect, the present application provides a computer-readable storage medium comprising computer program instructions. When the computer program instructions are executed by a computing device cluster, the computing device cluster executes a transaction processing method corresponding to the above-mentioned first aspect or any possible implementation of the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] FIG1 is a schematic diagram of the architecture of a database system provided in an embodiment of the present application.
[0031] FIG2 is a schematic diagram of two transaction management methods provided in an embodiment of the present application.
[0032] FIG3 is a flow chart of a transaction processing method provided in an embodiment of the present application.
[0033] FIG4 is a transaction processing scenario provided by an embodiment of the present application.
[0034] FIG5 is a schematic diagram of a flow chart for processing transaction T1 provided in an embodiment of the present application.
[0035] FIG6 is another flowchart of processing transaction T1 provided in an embodiment of the present application.
[0036] FIG7 is a schematic diagram of a transaction processing system provided in an embodiment of the present application.
[0037] FIG8 is a schematic diagram of a computing device provided in an embodiment of the present application.
[0038] FIG9 is a schematic diagram of a computing device cluster provided in an embodiment of the present application.
[0039] FIG10 is a schematic diagram of an implementation method of a computing device cluster provided in an embodiment of the present application. DETAILED DESCRIPTION
[0040] The technical solutions provided by this application will be described in detail below in conjunction with the accompanying drawings. Although certain embodiments of the present application are shown in the accompanying drawings, it should be understood that the present application can be implemented in various forms and should not be construed as being limited to the embodiments described herein. Instead, these embodiments are provided to provide a more thorough and complete understanding of the present application. It should be understood that the drawings and embodiments of the present application are for illustrative purposes only and are not intended to limit the scope of protection of the present application.
[0041] In the description of the embodiments of this application, the term "including" and similar terms should be understood as open inclusion, that is, "including but not limited to." The term "based on" should be understood as "based at least in part on." The term "one embodiment" or "the embodiment" should be understood as "at least one embodiment." The terms "first," "second," etc. can refer to different or the same objects. Other explicit and implicit definitions may also be included below.
[0042] In this application, "at least one" means one or more, and "more" means two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: including the existence of A alone, the existence of A and B at the same time, and the existence of B alone, where A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following items" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b, or c can mean: a, b, c, ab, ac, bc, or abc, where a, b, c can be single or multiple.
[0043] Big data is increasingly being used across enterprises, and databases, as a vehicle for big data storage and analysis, have a vast market. Cloud-native databases, which provide data storage services based on cloud infrastructure, offer higher cost-performance and performance advantages over on-premises databases, and are becoming the preferred choice for major enterprises.
[0044] Currently, most cloud-native database systems use a storage-computing separation architecture, storing data metadata on compute nodes. This ties metadata to the compute nodes, making scaling the compute layer complex and time-consuming. To improve the elastic scalability of the compute layer, separating data metadata from the compute nodes has become a research hotspot for cloud vendors. However, separating metadata presents challenges in ensuring the correctness of data operations and presenting a unified transaction processing capability to the database system.
[0045] To this end, this application provides a transaction processing method that uses a separate metadata cluster to manage metadata, thereby decoupling metadata and computing clusters, making it simpler and more efficient to scale nodes at the computing layer, while ensuring that the database system presents a unified transaction processing capability to the outside world.
[0046] FIG1 shows a schematic diagram of the architecture of a database system provided by the present application, which is used to implement the transaction processing method provided by the present application. The following first introduces the application scenario of the transaction processing method described above with reference to FIG1 .
[0047] The database system shown in FIG1 includes the following modules: a global transaction manager (GTM), a coordination node (CN), a computing cluster, a metadata cluster, and a storage system.
[0048] The Global Transaction Manager (GTM) ensures the ordering of global transactions. During transaction processing, it is responsible for issuing transaction information, including timestamps and sequence numbers. The GTM can be used as a standalone module or as a submodule within a compute cluster or metadata cluster.
[0049] The coordination node CN is used to receive transaction processing requests from users and send them to the computing cluster, and is responsible for coordinating the start and submission of transactions.
[0050] A computing cluster includes multiple data nodes (DNs), each of which has a database instance deployed on it. In the embodiments of the present application, data nodes in a computing cluster are also referred to as computing nodes. The computing cluster is used to process user access, including writing data to and reading data from the storage system, and storing metadata in and reading metadata from the metadata cluster.
[0051] The metadata cluster includes multiple data nodes, and a database instance is deployed on each data node. In the embodiment of the present application, the data nodes in the metadata cluster are also referred to as metadata nodes. The metadata cluster is used to store metadata information, where the metadata information includes the schema information of the table, the status of the transaction, the log, and the description information of the data. The description information of the data includes information such as the size of the database, the maximum value, the minimum value, and the number of data. As an independent system, the metadata cluster can be a cluster mode or a stand-alone mode, an OLTP system, or a KV storage system with transaction capabilities. In addition, the metadata can be stored on the local disk of the metadata cluster, or stored in the storage system together with the data.
[0052] The storage system is used to store data in the database and can be a storage system such as the Object Storage Service (OBS). The storage system can also be used to store metadata written by the metadata cluster.
[0053] In the database system shown in Figure 1, when data access occurs, the computing cluster first obtains metadata information from the metadata cluster, and then reads the required data from the storage system based on the metadata information; when data modification occurs, the computing cluster writes the newly generated data into the storage system and stores the metadata corresponding to the data in the metadata cluster.
[0054] When data modification occurs, in order to ensure the freshness of the data, that is, to enable the data modification to be immediately read by other transactions, the coordination node, the computing cluster and the metadata cluster need to coordinate with each other to manage the transaction. The embodiment of the present application provides two possible transaction management methods shown in Figure 2 for the database system shown in Figure 1: (a) cascade management method and (b) unified management method. Under the cascade management method, when data modification occurs in a transaction, the coordination node is responsible for recording which computing nodes participated in the data modification so that the corresponding computing nodes can be smoothly notified to commit the transaction later; the computing nodes are responsible for recording which metadata nodes participated in the data modification so that the corresponding metadata nodes can be smoothly notified to commit the transaction later. Under the unified management method, when data modification occurs in a transaction, the coordination node is responsible for uniformly recording which computing nodes and metadata nodes participated in the data modification so that the corresponding computing nodes and metadata nodes can be smoothly notified to commit the transaction later.
[0055] FIG3 is a flow chart of the transaction processing method provided by the present application. The transaction processing method is applied to the database system shown in FIG1 and includes the following steps 201 to 205:
[0056] Step 201: The coordinating node receives a request to process a transaction.
[0057] Specifically, a user can issue a "begin" command to the coordinating node to request the processing of a transaction. The coordinating node starts the transaction after receiving the "begin" command.
[0058] Step 202: In response to the write data operation in the transaction, the coordinating node distributes first data corresponding to the write data operation to at least one first computing node in the computing cluster.
[0059] After a transaction is started, the user issues a data operation instruction to the coordinating node to request a specific data operation. For example, the user issues an "insert" statement to the coordinating node to request a data write operation.
[0060] Specifically, after receiving an "insert" statement for writing the first data into the database, the coordination node distributes the first data to at least one first computing node in the computing cluster.
[0061] In one possible embodiment, since data is managed in shards in a distributed system, and multiple computing nodes in a computing cluster are responsible for data of different shards, the coordination node distributes the first data to the computing node corresponding to the data shard to which the first data belongs; when the first data contains data of multiple shards, the coordination node distributes the first data to multiple computing nodes corresponding to the above-mentioned multiple shards.
[0062] In a possible embodiment, the coordination node may distribute the first data to one or more computing nodes with less load pressure in the computing cluster according to the load conditions of the respective computing nodes.
[0063] Step 203: The at least one first computing node writes the first data into the storage system.
[0064] Step 204: The at least one first computing node stores the metadata of the first data to at least one first metadata node of the metadata cluster.
[0065] Specifically, the at least one first computing node sends metadata generated when writing the first data to at least one first metadata node of the metadata cluster for storage. The first metadata node may store the received metadata of the first data in the first metadata node or the storage system.
[0066] In one possible embodiment, metadata is managed by partitions, and multiple metadata nodes in the metadata cluster are responsible for metadata of different partitions, so the at least one first computing node sends the metadata of the first data to the metadata node corresponding to the partition to which the metadata of the first data belongs; when the metadata of the first data contains metadata of multiple partitions, the at least one first computing node sends the metadata of the first data to multiple metadata nodes corresponding to the above-mentioned multiple partitions.
[0067] In a possible embodiment, the computing node may distribute the metadata of the first data to metadata nodes with less load pressure in the metadata cluster according to the load conditions of each metadata node.
[0068] Step 205: After responding to all operations in the transaction, the database system commits the transaction.
[0069] After all operations in the transaction have been responded to, the user can send a "commit" command to the coordinating node to request the database system to commit the transaction.
[0070] In the embodiment of the present application, corresponding to the two transaction management methods described above, there are also two processes for the database system to submit transactions.
[0071] When the database system adopts the cascade management mode shown in FIG2 (a), the process of committing a transaction by the database system includes the following steps 301 to 305:
[0072] Step 301: The coordinating node notifies the global transaction manager to commit the transaction.
[0073] In one possible embodiment, the database system performs two-phase commit on transactions.
[0074] After receiving the "commit" command issued by the user, the coordinating node will first send a "prepare" command to the computing nodes participating in the transaction to notify the computing nodes to prepare before the transaction is committed; at the same time, after receiving the "prepare" command from the coordinating node, the computing node will notify the metadata nodes participating in the transaction to prepare before the transaction is committed; after the computing node receives the preparation success message returned by the metadata node and the computing node itself is also prepared successfully, the computing node returns the preparation success message to the coordinating node.
[0075] After receiving a successful preparation message from a compute node, the coordinator node notifies the global transaction manager to commit the transaction. Specifically, after a transaction is started, the coordinator node requests a transaction sequence number from the global transaction manager. When the transaction needs to be committed, the coordinator node notifies the global transaction manager to mark the transaction corresponding to the sequence number as successfully committed.
[0076] Step 302: The coordinating node notifies the computing nodes participating in the transaction to commit the transaction.
[0077] Step 303: After receiving the notification from the coordination node, the computing node participating in the transaction notifies the metadata nodes participating in the transaction to commit the transaction.
[0078] Step 304: After receiving the message indicating that the transaction was successfully submitted from the metadata node participating in the transaction and the computing node participating in the transaction successfully submitted the transaction, the computing node participating in the transaction returns a message indicating that the transaction was successfully submitted to the coordination node.
[0079] Step 305: The coordination node feeds back to the user that the transaction was submitted successfully.
[0080] When the database system adopts cascade management, during the transaction commit phase, the transaction logic of the coordination node does not need to be aware of the metadata node.
[0081] When the database system adopts the unified management method shown in FIG2( b ), the process of committing a transaction by the database system includes the following steps 311 to 313:
[0082] Step 311: The coordinating node notifies the global transaction manager to commit the transaction.
[0083] In one possible embodiment, the database system performs two-phase commit on transactions.
[0084] After receiving the "commit" command issued by the user, the coordinating node will send a "prepare" command to the computing nodes and metadata nodes participating in the transaction; after receiving the "prepare" command from the coordinating node, the computing nodes and metadata nodes will prepare for transaction submission; after receiving the preparation success message returned by the computing nodes and metadata nodes, the coordinating node will notify the global transaction manager to commit the transaction.
[0085] Specifically, after the transaction is started, the coordinating node will go to the global transaction manager to apply for the transaction sequence number. When the transaction needs to be committed, the coordinating node notifies the global transaction manager to mark the transaction corresponding to the sequence number as successfully committed.
[0086] Step 312: The coordinating node notifies the computing nodes and metadata nodes participating in the transaction to commit the transaction.
[0087] Step 313: After receiving the message of successful transaction submission returned by the computing node participating in the transaction and receiving the message of successful transaction submission returned by the metadata node participating in the transaction, the coordinator node feeds back the successful transaction submission to the user.
[0088] In the transaction processing method provided by this application, metadata operations and data operations are unified in one transaction. The transaction is committed after the computing cluster writes data to the storage system and stores the generated metadata in the metadata cluster, ensuring the freshness and consistency of the data.
[0089] In actual applications, in addition to data write operations, data operations also include data update operations, data query operations, and data delete operations. The following continues with reference to FIG2 to introduce the response process of several other data operations in the transaction processing method provided by this application.
[0090] In a possible embodiment, the transaction processing method further includes the following steps 212 to 216:
[0091] Step 212: In response to the data update operation in the transaction, the coordinating node obtains metadata of old data corresponding to the data update operation from the metadata cluster.
[0092] For example, a user issues an "update" statement to the coordinating node to request an update operation, where the update operation is used to update old data to new data.
[0093] Step 213: The coordination node distributes the metadata of the old data to at least one second computing node in the computing cluster.
[0094] Step 214: The at least one second computing node reads the old data from the at least one second computing node or the storage system according to the metadata of the old data.
[0095] Step 215: The at least one second computing node updates the old data to new data corresponding to the data update operation, and writes the new data into the storage system.
[0096] Step 216: The at least one second computing node stores the metadata of the new data to at least one second metadata node of the metadata cluster.
[0097] In a possible embodiment, the transaction processing method further includes the following steps 222 to 224:
[0098] Step 222: In response to the query data operation in the transaction, the coordinating node obtains metadata of the second data corresponding to the query data operation from the metadata cluster.
[0099] For example, the user sends a "select" statement to the coordination node to request execution of a data query operation. Specifically, after receiving the "select" statement for querying the second data, the coordination node obtains metadata of the second data from the metadata cluster.
[0100] Step 223: The coordination node distributes the metadata of the second data to at least one third computing node in the computing cluster.
[0101] Step 224: The at least one third computing node reads the second data from the at least one third computing node or the storage system according to the metadata of the second data.
[0102] In a possible embodiment, the transaction processing method further includes the following steps 232 to 235:
[0103] Step 232: In response to the delete data operation in the transaction, the coordinating node obtains metadata of the third data corresponding to the delete data operation from the metadata cluster.
[0104] For example, the user sends a "delete" statement to the coordinating node to request to execute a data deletion operation. Specifically, after receiving the "delete" statement for deleting the third data, the coordinating node obtains metadata of the third data from the metadata cluster.
[0105] Step 233: The coordination node distributes the metadata of the third data to at least one fourth computing node in the computing cluster.
[0106] Step 234: The at least one fourth computing node deletes the third data from the storage system according to the metadata of the third data.
[0107] Step 235: The at least one fourth computing node notifies the metadata cluster to delete the metadata of the third data.
[0108] In one possible embodiment, after receiving the notification to delete the metadata of the third data, the metadata cluster physically deletes the metadata of the third data from the storage location; in another possible embodiment, after receiving the notification to delete the metadata of the third data, the metadata cluster marks the metadata of the third data as deleted.
[0109] Currently, database systems have two important transaction isolation levels: Read Committed (RC) and Repeatable Read (RR). At the RC transaction isolation level, a transaction must wait for another transaction to commit before reading data. At the RR isolation level, data read during a transaction is expected to remain unchanged. This means that after a transaction is started, it is not allowed to read data modified by other transactions. The transaction processing method provided in this application supports both RC and RR isolation levels.
[0110] When the RC isolation level needs to be implemented, the coordinating node can obtain the timestamp used to respond to the target operation from the global transaction manager when responding to each target operation, where the target operation is an update data operation, a query data operation, or a delete data operation in the transaction; then, the coordinating node obtains the metadata corresponding to the target operation from the metadata cluster based on the timestamp used to respond to the target operation.
[0111] When implementing the RR isolation level, the coordinating node only needs to obtain a unified timestamp from the global transaction manager within a transaction. Subsequently, when responding to each target operation, the coordinating node retrieves metadata for the data corresponding to the target operation from the metadata cluster based on the unified timestamp. The target operation is an update, query, or delete operation within the transaction. Specifically, the coordinating node can obtain the unified timestamp from the global transaction manager after receiving the first instruction requesting execution of the target operation, or it can obtain the unified timestamp from the global transaction manager after receiving a transaction processing request.
[0112] In a possible embodiment, the timestamp is a read timestamp of a snapshot of a transaction obtained by the coordinating node from the global transaction manager.
[0113] The transaction processing method provided in this application obtains metadata from the metadata cluster by the coordination node and distributes it to the computing nodes, which can perform operations such as query optimization and pruning, thereby reducing data reading and sending.
[0114] Figure 4 illustrates a specific application scenario. In this scenario, a user initiates transaction T1, which contains two statements: a "select" statement and an "update" statement. The "select" statement queries data A when executed, the "update" statement updates data B to data C, the "begin" command initiates the transaction, and the "commit" command requests the transaction to be committed. The following describes the process for processing transaction T1 using the transaction processing method of the present application.
[0115] FIG5 shows a flow chart of a database system processing transaction T1 using the RR isolation level and the cascade management mode. The flow includes the following steps 501 to 526:
[0116] Step 501: The coordinating node receives a “begin” command issued by a user.
[0117] After receiving the "begin" command issued by the user, the coordinating node starts transaction T1.
[0118] Step 502: The coordinating node receives a “select” command issued by the user.
[0119] After the coordinating node starts transaction T1, it first receives the "select" command in transaction T1.
[0120] Step 503: After receiving the “select” command, the coordinating node obtains the timestamp TS1 from the global transaction manager.
[0121] Because executing a "select" command involves reading data, the coordinator node obtains a timestamp after receiving the "select" command. Specifically, the coordinator obtains the timestamp TS1 by accessing the global transaction manager to obtain the transaction snapshot. Timestamp TS1 is the read timestamp of the transaction snapshot.
[0122] Step 504: The coordinating node obtains metadata A0 of data A from the metadata cluster according to timestamp TS1.
[0123] In the example of FIG5 , the coordinating node specifically obtains metadata A0 from metadata node DN4.
[0124] Step 505: The coordination node distributes the metadata A0 to the computing node DN1.
[0125] In the example in Figure 5, the data that the "select" command queries only involves compute node DN1, so the coordinator node distributes metadata A0 to compute node DN1. In another possible scenario, multiple compute nodes in the computing cluster manage data for different shards. The data that the "select" command queries involves both compute nodes DN1 and DN2. In this case, the coordinator node distributes metadata A0 to both compute nodes DN1 and DN2.
[0126] Step 506: Computing node DN1 reads data A according to metadata A0.
[0127] In the example of FIG5 , the computing node DN1 reads data A from the storage system; in another case, the computing node may read data A from the memory of the computing node DN1.
[0128] Step 507: The computing node DN1 returns the execution result of the “select” command to the coordination node.
[0129] Step 508: The coordination node returns the execution result of the "select" command to the user.
[0130] Step 509: The coordination node receives the “update” command sent by the user.
[0131] In a possible embodiment, after the computing node DN1 finds the data A corresponding to the "select" command, it directly returns the data A as the execution result of the "select" command to the coordination node, and then the coordination node returns the data A to the user.
[0132] In another possible embodiment, after computing node DN1 finds data A corresponding to the "select" command, it further processes data A to obtain the final execution result and then returns the result to the coordination node. The further processing performed by DN1 and DN2 on data A includes, but is not limited to, operations such as visualizing the data into charts, categorizing and organizing the data, generating textual responses based on the data statistics, and generating new results based on the data calculations.
[0133] Step 510: The coordinating node obtains metadata B0 of data B from the metadata cluster according to timestamp TS1.
[0134] Since the database system in the example of Figure 5 uses the RR isolation level, after transaction T1 is started, the coordinating node only needs to obtain a timestamp from the global transaction manager once when it receives the first command involving reading data in transaction T1, namely the "select" command.
[0135] In the example of FIG5 , the coordinating node specifically obtains metadata B0 from metadata nodes DN3 and DN4.
[0136] Step 511: The coordination node distributes the metadata B0 to the computing node DN2.
[0137] In the example of FIG5 , the data B corresponding to the “update” command only involves the computing node DN2 , so the coordination node distributes the metadata B0 to the computing node DN2 .
[0138] Step 512: Computing node DN2 reads data B according to metadata B0.
[0139] Step 513: Computing node DN2 updates data B to data C.
[0140] Step 514: Computing node DN2 writes data C into the storage system.
[0141] Step 515: Computing node DN2 stores the metadata of data C to metadata nodes DN3 and DN4.
[0142] Step 516: The computing node DN2 returns the execution result of the “update” command to the coordination node.
[0143] Step 517: The coordination node returns the execution result of the "update" command to the user.
[0144] In a possible embodiment, the execution result of the "update" command may include one or more of the following information: data update success, the number of rows written by the updated data, the storage location of the updated data, and the like.
[0145] Step 518: The coordinating node receives the “commit” command issued by the user.
[0146] Step 519: The coordinating node sends a “prepare” command to the computing node DN2.
[0147] Since transactions use a two-phase commit method, after receiving the "commit" command, the coordinating node will first send a "prepare" command to the computing node DN2 to notify the computing node DN2 to prepare for transaction submission.
[0148] Step 520: Compute node DN2 sends a “prepare” command to metadata nodes DN3 and DN4.
[0149] Step 521: After receiving the message indicating that the “prepare” command has been successfully executed from metadata nodes DN3 and DN4, and computing node DN2 itself has been successfully prepared, computing node DN2 returns the message indicating that the “prepare” command has been successfully executed to the coordination node.
[0150] Step 522: The coordinating node notifies the global transaction manager to commit transaction T1.
[0151] Step 523: The coordinating node sends a “commit” command to the computing node DN2.
[0152] Specifically, the coordinating node notifies the computing node DN2 to commit the transaction T1 by sending a "commit" command to the computing node DN2.
[0153] Step 524: Compute node DN2 sends a “commit” command to metadata nodes DN3 and DN4.
[0154] Under the cascade management mode, the coordinating node is responsible for recording the computing nodes that participate in modifying data in the transaction, so that during the transaction submission phase, the coordinating node notifies the corresponding computing node to commit the transaction; and the computing node is responsible for recording the metadata nodes that it manages in the transaction, so that during the transaction submission phase, the computing node notifies the corresponding metadata node to commit the transaction.
[0155] In the example of Figure 5, when processing transaction T1, compute node DN2 participated in writing data C and stored the metadata of data C on metadata nodes DN3 and DN4. Therefore, during the transaction commit phase, the coordinating node is responsible for notifying compute node DN2 to commit transaction T1, and compute node DN2 is responsible for notifying metadata nodes DN3 and DN4 to commit transaction T1.
[0156] Step 525: After receiving the message indicating that the “commit” command has been successfully executed from metadata nodes DN3 and DN4, and computing node DN2 itself has successfully committed transaction T1, computing node DN2 returns a message indicating that the “commit” command has been successfully executed to the coordination node.
[0157] Step 526: The coordinating node feeds back to the user that transaction T1 has been successfully submitted.
[0158] FIG6 shows a schematic diagram of a process for a database system using the RC isolation level and a unified management method to process transaction T1. The process includes the following steps 601 to 623:
[0159] Step 601: The coordinating node receives a “begin” command issued by a user.
[0160] Step 602: The coordinating node receives a “select” command issued by the user.
[0161] Step 603: After receiving the “select” command, the coordinating node obtains the timestamp TS1 from the global transaction manager.
[0162] Step 604: The coordinating node obtains metadata A0 of data A from the metadata cluster according to timestamp TS1.
[0163] Step 605: The coordination node distributes the metadata A0 to the computing node DN1.
[0164] Step 606: Computing node DN1 reads data A according to metadata A0.
[0165] Step 607: The computing node DN1 returns the execution result of the “select” command to the coordination node.
[0166] Step 608: The coordination node returns the execution result of the "select" command to the user.
[0167] Step 609: The coordination node receives the “update” command sent by the user.
[0168] Step 610: After receiving the "update" command, the coordinating node obtains the timestamp TS2 from the global transaction manager.
[0169] Since the database system in the example of Figure 6 uses the RC isolation level, after transaction T1 is started, the coordinating node needs to obtain a timestamp from the global transaction manager each time it receives a command involving reading data in transaction T1.
[0170] Step 611: The coordinating node obtains metadata B0 of data B from the metadata cluster according to timestamp TS2.
[0171] Step 612: The coordination node distributes the metadata B0 to the computing node DN2.
[0172] Step 613: Computing node DN2 reads data B according to metadata B0.
[0173] Step 614: Computing node DN2 updates data B to data C.
[0174] Step 615: Computing node DN2 writes data C into the storage system.
[0175] Step 616: Computing node DN2 stores the metadata of data C to metadata nodes DN3 and DN4.
[0176] Step 617: The computing node DN2 returns the execution result of the “update” command to the coordination node.
[0177] Step 618: The coordination node returns the execution result of the "update" command to the user.
[0178] Step 619: The coordinating node receives the “commit” command issued by the user.
[0179] Step 620: The coordinating node sends a “prepare” command to the computing node DN2 and metadata nodes DN3 and DN4.
[0180] Step 621: After receiving the successful execution message of the "prepare" command returned by the computing node DN2 and the metadata nodes DN3 and DN4, the coordination node notifies the global transaction manager to commit the transaction T1.
[0181] Step 622: The coordinating node sends a "commit" command to the computing node DN2 and the metadata nodes DN3 and DN4.
[0182] Step 623: After receiving the message indicating that the “commit” command has been successfully executed from the computing node DN2 and the metadata nodes DN3 and DN4, the coordination node feeds back to the user that the transaction T1 has been successfully submitted.
[0183] The present application also provides a transaction processing system 700 shown in FIG7 for implementing the above transaction processing method. The transaction processing system 700 may be the database system shown in FIG1 .
[0184] The transaction processing system 700 includes a coordination node, a computing cluster, a metadata cluster and a storage system, wherein the computing cluster includes at least one first computing node; the metadata cluster includes at least one first metadata node; the coordination node is used to receive a request to process a transaction; the coordination node is also used to distribute the first data corresponding to the write data operation to the at least one first computing node in response to the write data operation in the transaction; the at least one first computing node is used to write the first data to the storage system; the at least one first computing node is also used to store the metadata of the first data to the at least one first metadata node; the transaction processing system is used to commit the transaction after responding to all operations in the transaction.
[0185] In one possible embodiment, the computing cluster also includes at least one second computing node; the metadata cluster also includes at least one second metadata node; the coordination node is further used to: in response to the update data operation in the transaction, obtain the metadata of the old data corresponding to the update data operation from the metadata cluster; and distribute the metadata of the old data to at least one second computing node of the computing cluster; the at least one second computing node is used to: read the old data from the at least one second computing node or the storage system according to the metadata of the old data; update the old data to the new data corresponding to the update data operation, and write the new data to the storage system; and store the metadata of the new data to the at least one second metadata node.
[0186] In one possible embodiment, the computing cluster also includes at least one third computing node; the coordination node is further used to: in response to the query data operation in the transaction, obtain the metadata of the second data corresponding to the query data operation from the metadata cluster; and distribute the metadata of the second data to the at least one third computing node; the at least one third computing node is used to: read the second data from the at least one third computing node or the storage system according to the metadata of the second data.
[0187] In one possible embodiment, the computing cluster also includes at least one fourth computing node; the coordination node is further used to: in response to the data deletion operation in the transaction, obtain the metadata of the third data corresponding to the data deletion operation from the metadata cluster; and distribute the metadata of the third data to the at least one fourth computing node; the at least one fourth computing node is used to: delete the third data from the storage system based on the metadata of the third data; and notify the metadata cluster to delete the metadata of the third data.
[0188] In a possible embodiment, the transaction processing system 700 also includes a global transaction manager, and the coordination node is further used to: obtain a timestamp from the global transaction manager; and when responding to each target operation, obtain metadata corresponding to the target operation from the metadata cluster according to the timestamp, wherein the target operation is an update data operation, a query data operation, or a delete data operation in the transaction.
[0189] In a possible embodiment, the transaction processing system 700 also includes a global transaction manager, and the coordination node is further used to: when responding to each target operation, obtain a timestamp for responding to the target operation from the global transaction manager, wherein the target operation is an update data operation, a query data operation, or a delete data operation in the transaction; and obtain metadata corresponding to the target operation from the metadata cluster according to the timestamp.
[0190] In a possible embodiment, the transaction processing system is configured to commit the transaction after responding to all operations in the transaction, specifically including:
[0191] The coordinating node is used to notify the computing nodes participating in the transaction in the computing cluster to submit the transaction;
[0192] The computing node participating in the transaction is configured to: after receiving a notification from the coordination node, notify the metadata node participating in the transaction to submit the transaction; and after receiving a message from the metadata node participating in the transaction indicating that the transaction was successfully submitted and the computing node participating in the transaction successfully submits the transaction, return a message to the coordination node indicating that the transaction was successfully submitted;
[0193] The coordination node is also used to feedback to the user that the transaction submission is successful.
[0194] In a possible embodiment, the transaction processing system is configured to commit the transaction after responding to all operations in the transaction, specifically including:
[0195] The coordination node is used to: notify the computing nodes and metadata nodes involved in the transaction to submit the transaction; and, after receiving a message from the computing nodes involved in the transaction indicating that the transaction was successfully submitted, and receiving a message from the metadata nodes involved in the transaction indicating that the transaction was successfully submitted, provide feedback to the user on the success of the transaction submission.
[0196] Specifically, the specific implementation of various operations of the transaction processing method executed by the transaction processing system can refer to the description of the relevant content in the above method embodiment, which will not be repeated here.
[0197] In the embodiment of the present application, the coordination node, computing cluster, metadata cluster, and global transaction manager in the transaction processing system 700 can be implemented by software or hardware. The following describes an exemplary implementation of the computing cluster, and the implementation of the coordination node, metadata cluster, and global transaction manager can be used as a reference.
[0198] A computing cluster, as an example of a software functional unit, can include code running on a computing instance. A computing instance can be at least one of a physical host (computing device), a virtual machine, a container, or other computing devices. Furthermore, these computing devices can be one or more. For example, a computing cluster can include code running on multiple hosts, virtual machines, or containers. It should be noted that the multiple hosts, virtual machines, or containers running the code can be distributed in the same AZ or different AZs, with each AZ comprising a data center or multiple geographically close data centers. The multiple hosts, virtual machines, or containers running the code can be distributed in the same region or different regions. Typically, a region can include multiple AZs, and a VPC is set up within a region. Cross-region communication between two VPCs within the same region, as well as between VPCs in different regions, requires a communication gateway within each VPC to interconnect the VPCs.
[0199] Similarly, multiple hosts, virtual machines, or containers running the code can be distributed in the same VPC or in multiple VPCs. Typically, a region can include multiple AZs.
[0200] As an example of a hardware functional unit, a computing cluster may include at least one computing device, such as a server. Alternatively, the computing cluster may be implemented using an ASIC or a PLD. The PLD may be implemented using a CPLD, FPGA, GAL, or any combination thereof.
[0201] The multiple computing devices included in a computing cluster can be distributed in the same AZ or different AZs. The multiple computing devices included in a module can be distributed in the same region or different regions. Similarly, the multiple computing devices included in a module can be distributed in the same VPC or across multiple VPCs. The multiple computing devices can be any combination of servers, ASICs, PLDs, CPLDs, FPGAs, GALs, and other computing devices.
[0202] This application also provides a computing device 800. Figure 8 is a schematic diagram of the structure of computing device 800. Computing device 800 includes a bus 802, a processor 804, a memory 806, and a communication interface 808. Processor 804, memory 806, and communication interface 808 communicate with each other via bus 802. Computing device 800 can be a server or a terminal device. It should be understood that this application does not limit the number of processors and memories in computing device 800.
[0203] Bus 802 may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, among others. Buses may be classified as address buses, data buses, control buses, and the like. For ease of illustration, FIG8 illustrates a single bus line, but this does not imply a single bus or type of bus. Bus 802 may include a path for transmitting information between various components of computing device 800 (e.g., memory 806, processor 804, and communication interface 808).
[0204] The processor 804 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).
[0205] The memory 806 may include volatile memory, such as random access memory (RAM). The memory 806 may also include non-volatile memory, such as read-only memory (ROM), flash memory, hard disk drive (HDD), or solid state drive (SSD).
[0206] Memory 806 stores executable program code, and processor 804 executes the executable program code to implement the functions of the aforementioned coordination node, computing cluster, metadata cluster, and global transaction manager, thereby implementing the transaction processing method. In other words, memory 806 stores instructions for executing the transaction processing method.
[0207] The communication interface 808 uses a transceiver module such as, but not limited to, a network interface card or a transceiver to implement communication between the computing device 800 and other devices or a communication network.
[0208] The present application also provides a computing device cluster, FIG9 is a schematic diagram of the computing device cluster, which can implement the transaction processing method in the above embodiment. As shown in FIG9, the computing device cluster includes at least one computing device 800 as shown in FIG8. The computing device 800 can 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 can also be a terminal device such as a desktop computer, a laptop computer, or a smartphone.
[0209] The memory 806 of one or more computing devices 800 in the computing device cluster may store instructions for executing the transaction processing method. When at least one computing device in the computing device cluster executes the instructions, the computing device cluster may implement the transaction processing method as described in the embodiment.
[0210] In some possible implementations, the memory 806 of one or more computing devices 800 in the computing device cluster may also store partial instructions for executing the transaction processing method. In other words, the combination of one or more computing devices 800 can jointly execute the instructions for executing the transaction processing method.
[0211] It should be noted that the memory 806 in different computing devices 800 in the computing device cluster can store different instructions, each used to execute a portion of the functions of the transaction processing system. In other words, the instructions stored in the memory 806 in different computing devices 800 can implement the functions of the coordination node, computing cluster, metadata cluster, and global transaction manager.
[0212] In some possible implementations, one or more computing devices in a computing device cluster may be connected via a network. The network may be a wide area network or a local area network, etc. FIG10 shows a possible implementation. As shown in FIG10 , two computing devices 800A and 800B are connected via a network. Specifically, the connection to the network is made via a communication interface in each computing device. In this type of possible implementation, the memory 806 in the computing device 800A stores instructions for executing the coordination node and the global transaction manager in the transaction processing system; at the same time, the memory 806 in the computing device 800B stores instructions for executing the functions of the computing cluster and the metadata cluster.
[0213] It should be understood that the functionality of the computing device 800A shown in FIG10 may also be implemented by multiple computing devices 800. Similarly, the functionality of the computing device 800B may also be implemented by multiple computing devices 800.
[0214] The present application also provides a computer program product comprising instructions. The computer program product may be software or a program product comprising instructions that can be run on a computing device or stored in any available medium. When the computer program product is run on at least one computing device, the at least one computing device executes a transaction processing method.
[0215] The present application also provides a computer-readable storage medium. The computer-readable storage medium can be any available medium capable of being stored by a computing device, or a data storage device such as a data center that contains one or more available media. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a magnetic tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive). The computer-readable storage medium includes instructions that instruct a computing device to execute a transaction processing method, or instructs a computing device to execute a transaction processing method.
[0216] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the protection scope of the technical solutions of the various embodiments of the present invention.
Claims
1. A transaction processing method, characterized in that: The method is applied to a database system, the database system includes a coordination node, a computing cluster, a metadata cluster and a storage system, and the method includes: The coordinating node receives a request for processing a transaction; The coordination node distributes, in response to the write data operation in the transaction, first data corresponding to the write data operation to at least one first computing node in the computing cluster; The at least one first computing node writes the first data into the storage system; The at least one first computing node stores the metadata of the first data to at least one first metadata node of the metadata cluster; After responding to all operations in the transaction, the database system commits the transaction.
2. The method according to claim 1, characterized in that The method further comprises: The coordinating node obtains metadata of old data corresponding to the update data operation from the metadata cluster in response to the update data operation in the transaction; The coordination node distributes the metadata of the old data to at least one second computing node of the computing cluster; The at least one second computing node reads the old data from the at least one second computing node or the storage system according to the metadata of the old data; The at least one second computing node updates the old data to new data corresponding to the data update operation, and writes the new data into the storage system; The at least one second computing node stores the metadata of the new data to at least one second metadata node of the metadata cluster.
3. The method according to claim 1 or 2, characterized in that: The method further comprises: The coordination node obtains metadata of second data corresponding to the query data operation from the metadata cluster in response to the query data operation in the transaction; The coordination node distributes the metadata of the second data to at least one third computing node of the computing cluster; The at least one third computing node reads the second data from the at least one third computing node or the storage system according to the metadata of the second data.
4. The method according to any one of claims 1 to 3, characterized in that The method further comprises: In response to the data deletion operation in the transaction, the coordinating node obtains metadata of third data corresponding to the data deletion operation from the metadata cluster; The coordination node distributes the metadata of the third data to at least one fourth computing node of the computing cluster; The at least one fourth computing node deletes the third data from the storage system according to the metadata of the third data; The at least one fourth computing node notifies the metadata cluster to delete the metadata of the third data.
5. The method according to any one of claims 1 to 4, characterized in that The database system further includes a global transaction manager, and the method further includes: The coordinating node obtains a timestamp from the global transaction manager; When responding to each target operation, the coordinating node obtains metadata corresponding to the target operation from the metadata cluster according to the timestamp, wherein the target operation is an update data operation, a query data operation, or a delete data operation in the transaction.
6. The method according to any one of claims 1 to 4, characterized in that The database system further includes a global transaction manager, and the method further includes: When responding to each target operation, the coordinating node obtains a timestamp for responding to the target operation from the global transaction manager, wherein the target operation is an update data operation, a query data operation, or a delete data operation in the transaction; The coordinating node obtains the metadata corresponding to the target operation from the metadata cluster according to the timestamp.
7. The method according to any one of claims 1 to 6, characterized in that The database system submits the transaction, including: The coordinating node notifies the computing nodes participating in the transaction to submit the transaction; After receiving the notification from the coordinating node, the computing node participating in the transaction notifies the metadata nodes participating in the transaction to submit the transaction; After receiving a message indicating that the transaction was successfully submitted, which is returned by the metadata node participating in the transaction, and the computing node participating in the transaction successfully submits the transaction, the computing node participating in the transaction returns a message indicating that the transaction was successfully submitted to the coordination node; The coordination node feeds back to the user that the transaction is successfully submitted.
8. The method according to any one of claims 1 to 6, characterized in that The database system submits the transaction, including: The coordination node notifies the computing nodes and metadata nodes participating in the transaction to submit the transaction; After receiving a message from the computing node participating in the transaction indicating that the transaction was successfully submitted, and after receiving a message from the metadata node participating in the transaction indicating that the transaction was successfully submitted, the coordination node feeds back to the user that the transaction was successfully submitted.
9. A transaction processing system, characterized in that: The transaction processing system includes a coordination node, a computing cluster, a metadata cluster and a storage system, wherein: The computing cluster includes at least one first computing node; The metadata cluster includes at least one first metadata node; The coordinating node is used to receive a request for processing a transaction; The coordinating node is further configured to distribute, in response to a write data operation in the transaction, first data corresponding to the write data operation to the at least one first computing node; The at least one first computing node is used to write the first data into the storage system; The at least one first computing node is further used to store metadata of the first data to the at least one first metadata node; The transaction processing system is used to commit the transaction after responding to all operations in the transaction.
10. The system according to claim 9, characterized in that The computing cluster further includes at least one second computing node; The metadata cluster also includes at least one second metadata node; The coordination node is further configured to: in response to an update data operation in the transaction, obtain metadata of old data corresponding to the update data operation from the metadata cluster; and distribute the metadata of the old data to at least one second computing node in the computing cluster; The at least one second computing node is used to: read the old data from the at least one second computing node or the storage system according to the metadata of the old data; Updating the old data to new data corresponding to the data update operation, and writing the new data into the storage system; And, storing the metadata of the new data in the at least one second metadata node.
11. The system according to claim 9 or 10, characterized in that: The computing cluster further includes at least one third computing node; The coordination node is further configured to: in response to a query data operation in the transaction, obtain metadata of second data corresponding to the query data operation from the metadata cluster; and distribute the metadata of the second data to the at least one third computing node; The at least one third computing node is used to read the second data from the at least one third computing node or the storage system according to metadata of the second data.
12. The system according to any one of claims 9 to 11, characterized in that The computing cluster further includes at least one fourth computing node; The coordination node is further configured to: in response to a delete data operation in the transaction, obtain metadata of third data corresponding to the delete data operation from the metadata cluster; and distribute the metadata of the third data to the at least one fourth computing node; The at least one fourth computing node is used to: delete the third data from the storage system according to the metadata of the third data; And, notifying the metadata cluster to delete the metadata of the third data.
13. The system according to any one of claims 9 to 12, characterized in that The transaction processing system further includes a global transaction manager, and the coordination node is further configured to: Obtaining a timestamp from the global transaction manager; In response to each target operation, metadata corresponding to the target operation is obtained from the metadata cluster according to the timestamp, wherein the target operation is an update data operation, a query data operation, or a delete data operation in the transaction.
14. The system according to any one of claims 9 to 12, characterized in that The transaction processing system further includes a global transaction manager, and the coordination node is further configured to: When responding to each target operation, respectively obtaining a timestamp for responding to the target operation from the global transaction manager, wherein the target operation is an update data operation, a query data operation, or a delete data operation in the transaction; According to the timestamp, metadata corresponding to the target operation is acquired from the metadata cluster.
15. The system according to any one of claims 9 to 14, characterized in that The transaction processing system is used to submit the transaction after responding to all operations in the transaction, specifically including: The coordination node is used to notify the computing nodes participating in the transaction in the computing cluster to submit the transaction; The computing node participating in the transaction is used to: after receiving the notification from the coordination node, notify the metadata node participating in the transaction to submit the transaction; and after receiving the message returned by the metadata node participating in the transaction that the transaction was successfully submitted and the computing node participating in the transaction successfully submitted the transaction, return a message to the coordination node that the transaction was successfully submitted; The coordination node is also used to feedback to the user that the transaction submission is successful.
16. The system according to any one of claims 9 to 14, characterized in that The transaction processing system is used to submit the transaction after responding to all operations in the transaction, specifically including: The coordination node is used to: notify the computing nodes and metadata nodes participating in the transaction to submit the transaction; and, after receiving a message from the computing nodes participating in the transaction indicating that the transaction was successfully submitted and receiving a message from the metadata nodes participating in the transaction indicating that the transaction was successfully submitted, provide feedback to the user on the successful submission of the transaction.
17. A computing device cluster, characterized in that: comprising at least one computing device, each computing device comprising 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, so that the computing device cluster executes the transaction processing method according to any one of claims 1 to 8.
18. A computer program product comprising instructions, characterized in that When the instructions are executed by a computing device cluster, the computing device cluster executes the transaction processing method according to any one of claims 1 to 8.
19. A computer-readable storage medium, characterized in that: The method comprises computer program instructions. When the computer program instructions are executed by a computing device cluster, the computing device cluster executes the transaction processing method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Transaction submission method and apparatus
CN105630695A
Database transaction processing method and device and server
CN111427966A
Data processing method and system
CN112199427A
Atomic processing of compound database transactions that modify a metadata entity
US20180322156A1