WO2017049911A1 - 一种实现分布式事务的方法、装置及数据库服务器 - Google Patents

一种实现分布式事务的方法、装置及数据库服务器 Download PDF

Info

Publication number
WO2017049911A1
WO2017049911A1 PCT/CN2016/081752 CN2016081752W WO2017049911A1 WO 2017049911 A1 WO2017049911 A1 WO 2017049911A1 CN 2016081752 W CN2016081752 W CN 2016081752W WO 2017049911 A1 WO2017049911 A1 WO 2017049911A1
Authority
WO
WIPO (PCT)
Prior art keywords
sql statement
transaction
database server
split
sql
Prior art date
Application number
PCT/CN2016/081752
Other languages
English (en)
French (fr)
Inventor
丁岩
刘志文
Original Assignee
中兴通讯股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 中兴通讯股份有限公司 filed Critical 中兴通讯股份有限公司
Publication of WO2017049911A1 publication Critical patent/WO2017049911A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor

Definitions

  • the present application relates to, but is not limited to, a method, apparatus, and database server for implementing distributed transactions.
  • the distributed transaction process generally includes: sending pre-processing information to all resource managers involved in the transaction, determining a resource manager that can be located and controlled, and performing data update on the resource manager that can locate and control the transaction.
  • Sending pre-processing information can determine the resource manager that can be located and controlled, but when the resource manager performs data update, it needs to submit the transaction to multiple database servers involved in the transaction. When some database servers have network failure or downtime When the situation is equal, the transaction submitted to the part of the database server will fail to submit; that is, the data update involving the part of the database server in the transaction will not be completed.
  • the commit of the transaction is to distribute the entire transaction to all the database servers involved, and the transaction submission failure is not considered, so the transaction is not submitted successfully and the transaction is not performed. Whether the analysis is completed or not, the data update involved in the transaction has an incomplete update problem.
  • the method, the device and the database server for implementing the distributed transaction provided by the embodiment of the invention can avoid the problem that the transaction update is incomplete due to the transaction commit failure.
  • the application provides a method for implementing a distributed transaction, including:
  • the obtained split SQL statements are distributed to the corresponding database server.
  • the transaction SQL statement included in the decomposed distributed transaction includes:
  • the transaction SQL statement is decomposed according to the analysis result into one or more decomposed SQL statements that can be executed on a single database server.
  • the types of the transaction SQL statement include:
  • it also includes:
  • the embodiment of the invention further provides a method for implementing a distributed transaction, comprising:
  • the database server receives the decomposed SQL statement that can be executed by the database server itself;
  • the database server executes the received decomposition SQL statement and feeds back the execution result to the client;
  • the split SQL statement is a statement that can be executed on a single database server by a transaction SQL statement.
  • the method further includes:
  • the database server When receiving the split SQL statement, the database server allocates a global transaction ID generated based on the numbering policy in a preset transaction identifier item;
  • the global transaction ID assigned to the split SQL statement is released, and the execution of the split SQL statement is determined according to the release of the global transaction ID.
  • the method further includes:
  • executing a split SQL statement returns data, and if the returned data does not include the allocated global transaction ID, determining the split SQL Statement execution is complete;
  • the split SQL statement is re-executed until the returned data does not include the allocated global transaction ID, and it is determined that the split SQL statement execution is completed.
  • An embodiment of the present invention further provides an apparatus for implementing a distributed transaction, including: a decomposition unit and a distribution unit; wherein
  • Decomposition unit configured to decompose the transaction structured query language SQL statement from the client, to obtain one or more decomposed SQL statements that can be executed on a single database server;
  • the distribution unit is configured to distribute the obtained decomposition SQL statements to the corresponding database server according to the database server where the data of the table involved in the SQL statement is located.
  • the decomposition unit is specifically configured to:
  • the transaction SQL statement is decomposed according to the analysis result into one or more decomposed SQL statements that can be executed on a single database server.
  • the method further includes determining, configured to determine that the distributed transaction is completed when all of the split SQL statements are executed.
  • the embodiment of the invention further provides a database server for implementing a distributed transaction, comprising a receiving unit and an execution feedback unit; wherein
  • a receiving unit configured to receive a decomposed SQL statement executable by the database server itself
  • the execution feedback unit is configured to execute the received decomposition SQL statement and feedback to determine whether to complete the execution result of the distributed transaction to the client.
  • the execution feedback unit is further configured to:
  • the transaction identifier entry When executing the received split SQL statement, the transaction identifier entry is pre-set in the entry of the table involved in the split SQL statement, and the pre-set transaction is received when the split SQL statement is received.
  • a global transaction ID generated based on the numbering policy is assigned in the identification item;
  • the global transaction ID assigned to the split SQL statement is released, and the execution of the split SQL statement is determined according to the release of the global transaction ID.
  • the execution feedback unit is further configured to:
  • split SQL statement When the split SQL statement is received, executing the split SQL statement returns data, and if the returned data does not include the allocated global transaction ID, determining that the split SQL statement is executed;
  • the split SQL statement is re-executed until the returned data does not include the allocated global transaction ID, and it is determined that the split SQL statement execution is completed.
  • the embodiment of the invention further provides a computer readable storage medium storing computer executable instructions for performing any of the above methods for implementing a distributed transaction.
  • the technical solution provided by the invention decomposes the transaction SQL statement into a decomposed SQL statement that can be executed on a single database server, and executes and feedbacks the execution result of the SQL statement through each database server, thereby realizing the SQL statement for the distributed transaction in each
  • the determination of the data update performed by the database server determines whether the distributed transaction is complete.
  • FIG. 1 is a flowchart of a method for implementing a distributed transaction according to an embodiment of the present invention
  • FIG. 2 is a flowchart of a method for implementing a distributed transaction according to an embodiment of the present invention
  • FIG. 3 is a structural block diagram of an apparatus for implementing a distributed transaction according to an embodiment of the present invention.
  • FIG. 4 is a structural block diagram of a database server implementing distributed transactions according to an embodiment of the present invention.
  • Figure 5 is a block diagram showing the structure of a system according to a first embodiment of the present invention.
  • Figure 6 is a flow chart of a method according to a second embodiment of the present invention.
  • FIG. 7 is a schematic flowchart diagram of a method according to a third embodiment of the present invention.
  • FIG. 8 is a schematic flow chart of a method according to a fourth embodiment of the present invention.
  • FIG. 1 is a flowchart of a method for implementing a distributed transaction according to an embodiment of the present invention. As shown in FIG. 1 , the method includes:
  • Step 100 Decompose a transaction structured query language (SQL) statement from the client to obtain one or more decomposed SQL statements that can be executed on a single database server.
  • SQL transaction structured query language
  • the transaction SQL statement can be carried in the request message.
  • the transaction SQL statement refers to a database execution instruction of a data update or operation involved in a transaction in a distributed transaction
  • one or more decomposed SQL statements that can be executed on a single database server means that the decomposed SQL statements can be completely executed on a database server.
  • the SQL statement that inserts Data 1 and Data 2 into the database requires an insert operation on both databases, the SQL statement is not a SQL statement that can be executed on a single database server; the SQL statement is decomposed into data 1
  • Two split SQL statements inserted into the database and inserting data 2 into the database both decomposed SQL statements can be executed on a single database server.
  • the data manipulation language (DML) is used to analyze the distribution strategy of each type of transaction SQL statement through the data of the involved table, and the transaction SQL statement is decomposed into one or more pieces according to the analysis result.
  • Decomposition SQL statement executed by the database server.
  • determining the type of the transaction SQL statement is a common technical means for those skilled in the art. The specific implementation is not limited to the scope of protection of the embodiments of the present invention, and details are not described herein again.
  • the types of transaction SQL statements include but are not limited to:
  • Extract SELECT
  • insert INSERT
  • update UPDATE
  • delete DELETE
  • schema data definition language DDL
  • Step 101 Distribute the obtained decomposition SQL statements to the corresponding database server according to the database server where the data of the involved table is located.
  • the embodiment of the present invention implements the SQL statement of the distributed transaction in each database server by decomposing the transaction SQL statement into a decomposition SQL statement that can be executed on a single database server, executing and feedbackting the execution result of the SQL statement through each database server.
  • the determination of the performed data update determines whether the distributed transaction is complete.
  • FIG. 2 is a flowchart of a method for implementing a distributed transaction according to the present invention. As shown in FIG. 2, the method includes:
  • Step 200 Each database server receives a split SQL statement that can be executed by the database server itself; here, the split SQL statement is a statement that can be executed on a single database server by the transaction SQL statement.
  • Step 201 Each database server executes the received decomposition SQL statement and feeds back the execution result to the client. Here, based on the execution results of the respective decomposed SQL statements, it can be determined whether or not the distributed transaction is completed.
  • the transaction identifier table item is pre-set in the table item of the table involved in the decomposition of the SQL statement, and when the database server receives the decomposition SQL statement, the global transaction ID card (ID) generated based on the numbering policy is allocated in the preset transaction identifier item;
  • the global transaction ID assigned to the split SQL statement is released, and the execution of the split SQL statement is completed according to the release of the global transaction ID.
  • executing the split SQL statement returns data, if the returned data does not include the allocated global transaction ID, determining that the split SQL statement execution is completed; if the returned data includes the allocated In the global transaction ID, when the split SQL statement is re-executed until the returned data does not include the allocated global transaction ID, it is determined that the split SQL statement execution is completed.
  • FIG. 3 is a structural block diagram of an apparatus for implementing a distributed transaction according to the present invention. As shown in FIG. 3, the method includes: a decomposition unit and a distribution unit;
  • the decomposition unit is configured to decompose the transaction SQL statement from the client to obtain one or more decomposition SQL statements that can be executed on a single database server;
  • the distribution unit is configured to distribute the obtained decomposition SQL statements to the corresponding database server according to the database server where the data of the table involved in the SQL statement is located.
  • the decomposition unit is specifically set to:
  • the DML After determining the type of the transaction SQL statement from the transaction SQL statement included in the request message from the client, the DML is used to analyze the distribution strategy of the data of the involved table according to the data of the involved table, and the transaction SQL statement is decomposed according to the analysis result. Or more than one decomposed SQL statement that can be executed on a single database server.
  • transaction SQL statements include but are not limited to:
  • the apparatus of the present invention further includes a determining unit for determining completion of the distributed transaction when all of the split SQL statements are executed.
  • FIG. 4 is a structural block diagram of a database server for implementing distributed transactions according to the present invention. As shown in FIG. 4, the method includes a receiving unit and an execution feedback unit.
  • the receiving unit is configured to receive the decomposed SQL statement obtained by decomposing the transaction SQL statement and executing itself;
  • the execution feedback unit is configured to execute the received decomposition SQL statement and feedback to determine whether to complete the execution result of the distributed transaction to the client.
  • the execution feedback unit is also set to:
  • the transaction identifier entry When executing the received split SQL statement, the transaction identifier entry is pre-set in the entry of the table involved in the split SQL statement, and when the split SQL statement is received, the global transaction generated based on the numbering policy is assigned in the preset transaction identifier item. ID;
  • the execution feedback unit is also set to:
  • split SQL statement When the split SQL statement is received, executing the split SQL statement returns data, if the returned data does not include the allocated global transaction ID, determining that the split SQL statement execution is completed; if the returned data includes the allocated global transaction When the ID is re-executed, the split SQL statement is executed until the returned data does not include the allocated global transaction ID, and it is determined that the split SQL statement is completed.
  • FIG. 5 is a structural block diagram of a system according to a first embodiment of the present invention. As shown in FIG. 5, a client that sends a request message, a device that implements a distributed transaction, and a plurality of database servers that perform distributed transactions are different in this embodiment.
  • the database server distinguishes by the corresponding number of the suffix;
  • Client set to send a request message containing a transactional SQL statement to a device that implements a distributed transaction
  • a device for implementing a distributed transaction is configured to receive a transaction SQL statement from a client, determine a type of the transaction SQL statement, and perform a data distribution language (DML) based on a data distribution policy of each type of transaction SQL statement through the data of the involved table.
  • DML data distribution language
  • the transaction SQL statement is decomposed into one or more decomposition SQL statements that can be executed on a single database server.
  • one or more decomposed SQL statements that can be executed on a single database server means that the decomposed SQL statements can be fully executed on a database server.
  • the SQL statement that inserts Data 1 and Data 2 into the database requires an insert operation on both databases
  • the SQL statement is not a SQL statement that can be executed on a single database server; the SQL statement is decomposed into data 1 Two exploded SQLs inserted into the database and inserting data 2 into the database Statement, then two decomposed SQL statements can be executed on a single database server.
  • Each database server is configured to perform the decomposition of the SQL statement after receiving the decomposition SQL statement, and according to the database processing traffic, after executing the decomposition of the SQL statement, the device implementing the distributed transaction in this embodiment may perform the commit by issuing Save the changes made by the firm to the database) to the DB1 and DB2 database servers; if the execution is successful, determine that the split SQL statement is completed, and if the split SQL statements of the transaction SQL statement are completed, the distributed transaction is completed.
  • the database server receives the decomposition SQL statement, add the global transaction center (GTM) based on the inserted transaction identifier item.
  • GTM global transaction center
  • the global transaction ID generated by the policy; the global transaction ID can be identified by the gtid, and the decomposition of the SQL statement is determined by the generation and release of the gtid.
  • FIG. 6 is a flowchart of a method according to a second embodiment of the present invention. This embodiment describes a process for parsing a transaction SQL statement by using a database language, as shown in FIG. 6, including:
  • Step 600 Parse a transaction SQL statement of the request message from the client, and obtain a syntax tree of the DDL statement including the distribution policy;
  • Step 601 Convert the obtained DDL statement including the distribution policy into an executable DDL statement executable at the DB server, and persist the distribution policy included in the DDL statement to the data dictionary file;
  • Step 602 Load a distribution policy of all the tables in the database server into the cache, and determine, according to a distribution policy of the persistent DLL statement in the data dictionary file, which database servers are executed by the database server.
  • Step 603 Decompose the transaction SQL statement into one or more decomposed SQL statements that can be executed on a single database server.
  • the foregoing steps may generally perform corresponding processing by calling a corresponding thread; after performing the step process, a person skilled in the art may recover the called thread according to a conventional technical means.
  • FIG. 7 is a schematic flowchart diagram of a method according to a third embodiment of the present invention.
  • a request message sent by a client includes a transaction INSERT statement, and a transaction INSERT statement needs to be served in two databases.
  • the device performs a clear and detailed description of the method of the invention.
  • the global transaction ID is generated and released by the global transaction center (GTM).
  • the specific global transaction ID can be represented by a global transaction number (gtid), as shown in FIG. 7, including:
  • the client sends a request message containing a transaction INSERT statement.
  • the transaction INSERT statement of this embodiment includes: insert into t1(a,b)values(xx, 'xxx'), (yy, 'yyy'); wherein, the t1 table
  • the distribution strategy is to replicate on the database servers of DB1 and DB2, that is, the data of the two database servers is the same).
  • the device implementing the distributed transaction in this embodiment determines the database server that needs to execute the transaction INSERT statement according to the data distribution policy of the transaction INSERT statement involving the t1 table, that is, the database server including DB1 and DB2; the transaction INSERT statement needs to access more in this embodiment.
  • the database server parses the transaction INSERT statement according to the distribution policy of the data of the involved table, and decomposes into two decomposition INSERT statements that can be executed on a single database server; this embodiment decomposes the INSERT statement 1 and the decomposition INSERT statement 2 Make a distinction.
  • the apparatus for implementing the distributed transaction in this embodiment applies the gtid to the GTM (for example, the value of the application gtid is 100), and assigns a pre-set transaction identification table in the entry related to the table.
  • the global transaction ID in the item is the value of the applied gtid; after applying for the gtid, you can add the inserted gtid column (insert into t1(a,b,GTID) values(xx,'xxx',100) in the decomposition INSERT statement. (yy, 'yyy', 100)), the insert statement is sent to the DB1 and DB2 database server respectively;
  • the gtid inserted into the decomposition INSERT statement may be distinguished, for example, a distinction code or a distinguishing identifier is added to distinguish the execution results of the database servers.
  • the device that implements the distributed transaction in this embodiment sends a commit (save the modification made by the transaction to the database) to the DB1 and DB2 database server, if the commit fails on DB1, in DB2. If the execution is successful, the SQL statement with the gtid of 100 in the database operation log on DB2 may be searched according to the gtid and the distinguished code, and then the reverse SQL statement is executed to perform the rollback of the committed transaction until the decomposition of the insert statement is completed.
  • FIG. 8 is a schematic flowchart of a method according to a fourth embodiment of the present invention.
  • a request message is used.
  • the inclusion of the transaction SELECT statement provides a clear and detailed description of the method of the present invention, as shown in FIG. 8, including:
  • Set A represents.
  • the distributed transaction device performs the decomposition SELECT statement to return normally, and determines that the data returned from DB1 and DB2 does not contain the allocated global transaction ID from the GTM query, and the execution of the decomposition SELECT statement succeeds; the determination determines the data returned from DB1 and DB2. Executing the SELECT statement failed to execute without including the allocated global transaction ID queried from the GTM.
  • the execution of the decomposition SELECT statement returns normally, the data returned from DB1 and DB2 contains the allocated global transaction ID from the GTM query, then the execution of the SELECT statement is repeated until the data returned from DB1 and DB2 does not contain the global transaction ID.
  • the returned data is not inserted or updated unfinished data, the data extracted by the transaction SQL statement is the correct data, and the client is fed back to the message that the SELECT is successfully executed.
  • the transaction SQL statement contained in the request message is a SQL A statement
  • the content of the SQL A statement is: insert into tableA...select....from tableB union select....from tableC, the table involved includes tableA, tableB, and tableC.
  • This embodiment assumes that the data of tableA is stored in database server 1 (DB1 for short) and database server 2 (DB2); the data of table B is stored in database server 3 (DB3) and database server 4 (DB4), and the data of table C is stored in the database server. 5 (DB5).
  • SQL A statement needs to access DB1, DB2, DB3, DB4 and DB5 five DB servers, SQL A statement directly access any DB server is wrong;
  • the SQL A statement is split into one or more decomposed SQL statements executed on each database server.
  • each decomposition SQL statement can be executed on a single DB server.
  • the decomposition SQL statement is:
  • the query clause involving the tableB and tableC in the SQL A statement is replaced with the result set of the two child nodes, so that it can be executed on a single DB server.
  • the method, device and database server for implementing a distributed transaction comprise: decomposing a transaction SQL statement from a client, obtaining a decomposition SQL statement executable on a single database server; and a database according to data of the involved table
  • the server distributes the obtained split SQL statements to the corresponding database server.
  • the embodiment of the present invention implements the SQL statement of the distributed transaction in each database server by decomposing the transaction SQL statement into a decomposition SQL statement that can be executed on a single database server, executing and feedbackting the execution result of the SQL statement through each database server.
  • the determination of the performed data update determines whether the distributed transaction is complete.

Abstract

一种实现分布式事务的方法、装置及数据库服务器,所述方法包括:分解来自客户端的事务SQL语句,获得可在单个数据库服务器上执行的分解SQL语句(100);根据所涉及表的数据所在的数据库服务器,将获得的各个分解SQL语句分发到相应的数据库服务器(101)。通过将事务SQL语句分解为可在单个数据库服务器上执行的分解SQL语句,通过各数据库服务器执行并反馈分解SQL语句的执行结果,实现了对分布式事务的SQL语句在各个数据库服务器执行的数据更新的确定,进而确定了分布式事务是否完成。

Description

一种实现分布式事务的方法、装置及数据库服务器 技术领域
本申请涉及但不限于一种实现分布式事务的方法、装置及数据库服务器。
背景技术
目前,当分布式数据库系统涉及到多个数据库服务器时,针对多个数据库服务器的数据处理一般通过分布式事务实现。分布式事务处理过程一般包括:向事务涉及到的全部资源管理器发送预处理信息,确定能被定位和控制的资源管理器,对能够定位和控制的资源管理器下发事务进行数据更新。
发送预处理信息可以确定能被定位和控制的资源管理器,但资源管理器在执行数据更新时,需要将事务提交到事务涉及的多个数据库服务器,当部分数据库服务器出现网络故障、或宕机等情况时,提交到该部分数据库服务器的事务会提交失败;即事务中涉及该部分数据库服务器的数据更新将无法完成。
相关技术中,当事务涉及多个数据库服务器时,事务的提交是将整个事务分发到涉及到的所有数据库服务器,对于事务提交失败的情况并未考虑,因此,并未进行事务是否提交成功和事务是否完成的分析,导致事务涉及的数据更新存在更新不完全的问题。
发明内容
以下是对本文详细描述的主题的概述。本概述并非是为了限制权利要求的保护范围。
本发明实施例提供的实现分布式事务的方法、装置及数据库服务器,能够避免由于事务提交失败造成的事务更新不完全的问题。
本申请提供一种实现分布式事务的方法,包括:
分解来自客户端的事务结构化查询语言SQL语句,获得一条或一条以上可在单个数据库服务器上执行的分解SQL语句;
根据所涉及表的数据所在的数据库服务器,将获得的各个分解SQL语句分发到相应的数据库服务器。
可选地,所述分解分布式事务包含的事务SQL语句包括:
确定所述事务SQL语句的类型;
基于数据操纵语言DML对确定出的各类型的所述事务SQL语句通过所涉及表的数据的分发策略进行分析;
根据分析结果分解所述事务SQL语句为一条或一条以上可在单个数据库服务器执行的分解SQL语句。
可选地,所述事务SQL语句的类型包括:
提取SELECT、和/或插入INSERT、和/或更新UPDATE、和/或删除DELETE、和/或模式数据定义语言DDL语句。
可选地,还包括:
在所述事务SQL语句分解的所有所述分解SQL语句均执行完成,确定完成分布式事务。
本发明实施例还提供了一种实现分布式事务的方法,包括:
数据库服务器接收可在数据库服务器自身执行的分解SQL语句;
数据库服务器执行接收到的分解SQL语句,并反馈执行结果至客户端;
其中,所述分解SQL语句为事务SQL语句分解的可在单个数据库服务器上执行的语句。
可选地,当所述分解SQL语句为插入和/或更新时,还包括:
在所述分解SQL语句所涉及表的表项中预先设置事务标识表项;
所述数据库服务器接收到所述分解SQL语句时,在预先设置的事务标识项中分配基于编号策略生成的全局事务ID;
所述数据库服务器执行完所述分解SQL语句时,释放分配给分解SQL语句的全局事务ID,并根据全局事务ID的释放确定所述分解SQL语句执行完成。
可选地,当所述分解SQL语句为提取时,还包括:
所述数据库服务器接收到所述分解SQL语句时,执行分解SQL语句返回数据,如果返回的数据不包含分配的所述全局事务ID,确定所述分解SQL 语句执行完成;
如果返回的数据包含分配的所述全局事务ID时,重新执行所述分解SQL语句直至返回的数据中不包含分配的所述全局事务ID时,确定所述分解SQL语句执行完成。
本发明实施例再提供了一种实现分布式事务的装置,包括:分解单元和分发单元;其中,
分解单元,设置为分解来自客户端的事务结构化查询语言SQL语句,获得一条或一条以上可在单个数据库服务器上执行的分解SQL语句;
分发单元,设置为根据SQL语句所涉及表的数据所在的数据库服务器,将获得的各个分解SQL语句分发到相应的数据库服务器。
可选地,其中,所述分解单元具体设置为:
对所述来自客户端的事务结构化查询语言SQL语句确定事务SQL语句的类型后,基于数据操纵语言DML对各类型的所述事务SQL语句通过所涉及表的数据的分发策略进行分析;
根据分析结果分解所述事务SQL语句为一条或一条以上可在单个数据库服务器执行的分解SQL语句。
可选地,还包括确定单元,设置为当所述所有所述分解SQL语句均执行完成时,确定出完成分布式事务。
本发明实施例又提供了一种实现分布式事务的数据库服务器,包括接收单元和执行反馈单元;其中,
接收单元,设置为接收可在数据库服务器自身执行的分解SQL语句;
执行反馈单元,设置为执行接收到的分解SQL语句,并反馈确定是否完成分布式事务的执行结果至客户端。
可选地,当所述分解SQL语句为插入和/或更新时,所述执行反馈单元还设置为:
执行接收到的分解SQL语句时,在所述分解SQL语句所涉及表的表项中预先设置事务标识表项,接收到所述分解SQL语句时,在预先设置的事务 标识项中分配基于编号策略生成的全局事务ID;
执行完所述分解SQL语句时,释放分配给分解SQL语句的全局事务ID,并根据全局事务ID的释放确定所述分解SQL语句执行完成。
可选地,当所述分解SQL语句为提取时,所述执行反馈单元还设置为:
接收到所述分解SQL语句时,执行分解SQL语句返回数据,如果返回的数据不包含分配的所述全局事务ID,确定所述分解SQL语句执行完成;
如果返回的数据包含分配的所述全局事务ID时,重新执行所述分解SQL语句直至返回的数据中不包含分配的所述全局事务ID时,确定所述分解SQL语句执行完成。
本发明实施例再提供了一种计算机可读存储介质,存储有计算机可执行指令,所述计算机可执行指令用于执行上述任一实现分布式事务的方法。
本发明提供的技术方案通过将事务SQL语句分解为可在单个数据库服务器上执行的分解SQL语句,通过各数据库服务器执行并反馈分解SQL语句的执行结果,实现了对分布式事务的SQL语句在各个数据库服务器执行的数据更新的确定,进而确定了分布式事务是否完成。
本发明实施例的其它特征和优点将在随后的说明书中阐述,并且,部分地从说明书中变得显而易见,或者通过实施本发明而了解。本发明的目的和其他优点可通过在说明书、权利要求书以及附图中所特别指出的结构来实现和获得。
在阅读并理解了附图和详细描述后,可以明白其他方面。
附图概述
此处所说明的附图用来提供对本发明实施例的进一步理解,构成本申请的一部分,本发明的示意性实施例及其说明用于解释本发明,并不构成对本发明的不当限定。在附图中:
图1为本发明实施例实现分布式事务的方法的流程图;
图2为本发明实施例实现分布式事务的方法的流程图;
图3为本发明实施例实现分布式事务的装置的结构框图;
图4为本发明实施例实现分布式事务的数据库服务器的结构框图;
图5为本发明第一实施例的系统的结构框图;
图6为本发明第二实施例的方法流程图;
图7为本发明第三实施例的方法的流程示意图;
图8为本发明第四实施例的方法的流程示意图。
本发明的较佳实施方式
为使本发明的目的、技术方案和优点更加清楚明白,下文中将结合附图对本发明的实施例进行详细说明。需要说明的是,在不冲突的情况下,本申请中的实施例及实施例中的特征可以相互任意组合。
图1为本发明实施例实现分布式事务的方法的流程图,如图1所示,包括:
步骤100、分解来自客户端的事务结构化查询语言(SQL)语句,获得一条或一条以上可在单个数据库服务器上执行的分解SQL语句。
其中,事物SQL语句可以携带在请求消息中。
其中,事务SQL语句是指分布式事务中事务涉及的数据更新或操作的数据库执行指令;
其中,一条或一条以上可在单个数据库服务器上执行的分解SQL语句是指,分解获得的SQL语句在一个数据库服务器上可以完全执行。例如,如果将数据1和数据2插入到数据库的SQL语句需要在两个数据库上做插入操作,则该SQL语句不是可在单个数据库服务器上执行的SQL语句;将该SQL语句分解为将数据1插入到数据库和将数据2插入到数据库的两个分解SQL语句,则两个分解的SQL语句都可以在单个数据库服务器上执行。
本步骤中,分解来自客户端的事务SQL语句包括:
确定事务SQL语句的类型后,基于数据操纵语言(DML)对各类型的事务SQL语句通过所涉及表的数据的分发策略进行分析,根据分析结果将事务SQL语句分解为一条或一条以上可在单个数据库服务器执行的分解SQL语句。这里,确定事务SQL语句的类型为本领域技术人员的惯用技术手段, 具体实现并不用于限定本发明实施例的保护范围,在此不再赘述。
本发明实施例中,事务SQL语句的类型包括但不限于:
提取(SELECT)、和/或插入(INSERT)、和/或更新(UPDATE)、和/或删除(DELETE)、和/或模式数据定义语言(DDL)语句。
步骤101、根据所涉及表的数据所在的数据库服务器,将获得的各个分解SQL语句分发到相应的数据库服务器。
本发明实施例还包括:
当由事务SQL语句分解的所有分解SQL语句均执行完成,确定完成分布式事务。
本发明实施例通过将事务SQL语句分解为可在单个数据库服务器上执行的分解SQL语句,通过各数据库服务器执行并反馈分解SQL语句的执行结果,实现了对分布式事务的SQL语句在各个数据库服务器执行的数据更新的确定,进而确定了分布式事务是否完成。
图2为本发明实现分布式事务的方法的流程图,如图2所示,包括:
步骤200、各数据库服务器分别接收可在数据库服务器自身执行的分解SQL语句;这里,分解SQL语句为事务SQL语句分解的可在单个数据库服务器上执行的语句。
步骤201、各数据库服务器执行接收到的分解SQL语句,并反馈执行结果至客户端。这里,根据各个分解SQL语句的执行结果,可以确定是否完成分布式事务。
本发明实施例还包括:
当分解SQL语句为插入和/或更新时,
在分解SQL语句所涉及表的表项中预先设置事务标识表项,数据库服务器接收到分解SQL语句时,在预先设置的事务标识项中分配基于编号策略生成的全局事务身份证(ID);
数据库服务器执行完分解SQL语句时,释放分配给分解SQL语句的全局事务ID,并根据全局事务ID的释放确定分解SQL语句执行完成。
当分解SQL语句为提取时,
数据库服务器接收到所述分解SQL语句时,执行分解SQL语句返回数据,如果返回的数据不包含分配的所述全局事务ID,确定所述分解SQL语句执行完成;如果返回的数据包含分配的所述全局事务ID时,重新执行所述分解SQL语句直至返回的数据中不包含分配的所述全局事务ID时,确定所述分解SQL语句执行完成。
图3为本发明实现分布式事务的装置的结构框图,如图3所示,包括:分解单元和分发单元;其中,
分解单元,设置为分解来自客户端的事务SQL语句,获得一条或一条以上可在单个数据库服务器上执行的分解SQL语句;
分发单元,设置为根据SQL语句所涉及表的数据所在的数据库服务器,将获得的各个分解SQL语句分发到相应的数据库服务器。
分解单元具体设置为:
对来自客户端的请求消息中包含的事务SQL语句确定事务SQL语句的类型后,基于DML对各类型的事务SQL语句通过所涉及表的数据的分发策略进行分析,根据分析结果分解事务SQL语句为一条或一条以上可在单个数据库服务器执行的分解SQL语句。
事务SQL语句的类型包括但不限于:
SELECT、和/或INSERT、和/或UPDATE、和/或DELETE、和/或DDL语句。
本发明装置还包括确定单元,用于当所有分解SQL语句均执行完成时,确定出完成分布式事务。
图4为本发明实现分布式事务的数据库服务器的结构框图,如图4所示,包括接收单元和执行反馈单元;其中,
接收单元,设置为接收分解事务SQL语句获得的可在自身执行的分解SQL语句;
执行反馈单元,设置为执行接收到的分解SQL语句,并反馈确定是否完成分布式事务的执行结果至客户端。
当分解SQL语句为插入和/或更新时,执行反馈单元还设置为:
执行接收到的分解SQL语句时,在分解SQL语句所涉及表的表项中预先设置事务标识表项,接收到分解SQL语句时,在预先设置的事务标识项中分配基于编号策略生成的全局事务ID;
执行完分解SQL语句时,释放分配给分解SQL语句的全局事务ID,并根据全局事务ID的释放确定分解SQL语句执行完成。
当分解SQL语句为提取时,执行反馈单元还设置为:
接收到所述分解SQL语句时,执行分解SQL语句返回数据,如果返回的数据不包含分配的所述全局事务ID,确定所述分解SQL语句执行完成;如果返回的数据包含分配的所述全局事务ID时,重新执行所述分解SQL语句直至返回的数据中不包含分配的所述全局事务ID时,确定所述分解SQL语句执行完成。
以下通过具体实施例对本发明方法进行清楚详细的说明,实施例仅用于陈述本发明,并不用于限定本发明的保护范围。
图5为本发明第一实施例的系统的结构框图,如图5所示,包括发送请求消息的客户端、实现分布式事务的装置,及执行分布式事务的若干数据库服务器,本实施例不同数据库服务器通过尾缀相应的编号进行区分;其中,
客户端,设置为发送包含有事务SQL语句的请求消息到实现分布式事务的装置;
实现分布式事务的装置,设置为接收来自客户端的事务SQL语句后,确定事务SQL语句的类型后,基于数据操纵语言(DML)对各类型的事务SQL语句通过所涉及表的数据的分发策略进行分析,根据分析结果分解将事务SQL语句分解为一条或一条以上可在单个数据库服务器上执行的分解SQL语句。这里,一条或一条以上可在单个数据库服务器上执行的分解SQL语句是指,分解获得的SQL语句在一个数据库服务器上可以完全执行。例如,如果将数据1和数据2插入到数据库的SQL语句需要在两个数据库上做插入操作,则该SQL语句不是可在单个数据库服务器上执行的SQL语句;将该SQL语句分解为将数据1插入到数据库和将数据2插入到数据库的两个分解SQL 语句,则两个分解的SQL语句都可以在单个数据库服务器上执行。
每个数据库服务器,设置为接收到分解SQL语句后,进行分解SQL语句的执行,按照数据库处理流量,在执行完分解SQL语句后,本实施例实现分布式事务的装置可以通过下发执行commit(把事务所做的修改保存到数据库)到DB1和DB2数据库服务器;如果执行成功,确定分解SQL语句完成,如果事务SQL语句的各分解SQL语句均完成,则分布式事务完成。
确定分布式事务是否完成可以通过在事务SQL语句所涉及表的表项中插入事务标识表项,数据库服务器接收到分解SQL语句时,在插入的事务标识项中添加全局事务中心(GTM)基于编号策略生成的全局事务ID;全局事务ID可以通过gtid标识,通过gtid的生成和释放确定分解SQL语句是否完成。
图6为本发明第二实施例的方法流程图,本实施例通过数据库语言,对事务SQL语句进行解析处理流程进行描述,如图6所示,包括:
步骤600、解析来自客户端的请求消息的事务SQL语句,获得包含分发策略的DDL语句的语法树;
步骤601、将获得的包含分发策略的DDL语句转化成可在DB服务器执行的可执行DDL语句,同时将DDL语句包含的分发策略持久化到数据字典文件中;
步骤602、将数据库服务器中所有表的分发策略加载到缓存,并根据数据字典文件中持久化的DLL语句的分发策略,确定事务SQL语句中包含的SQL语句可由哪些数据库服务器单个执行;
步骤603、将事务SQL语句分解为一条或一条以上可在单个数据库服务器上执行的分解SQL语句。
需要说明的是,本实施例上述步骤一般可以通过调用相应的线程进行相应的处理;在执行完步骤流程后,本领域技术人员可以按照惯用的技术手段对调用的线程进行回收。
图7为本发明第三实施例的方法的流程示意图,本实施例以客户端发送请求消息包含事务INSERT语句,事务INSERT语句需要在两个数据库服务 器执行对本发明方法进行清楚详细的说明。本实施例通过全局事务中心(GTM)进行全局事务ID的生成和释放,具体的全局事务ID可以用全局事务编号(gtid)表示,如图7所示,包括:
首先,客户端发送包含事务INSERT语句的请求消息,本实施例事务INSERT语句包含:insert into t1(a,b)values(xx,‘xxx’),(yy,’yyy’);其中,t1表的分发策略是在DB1和DB2的数据库服务器上复制,即两个数据库服务器的数据是一样)。
然后,本实施例实现分布式事务的装置根据事务INSERT语句涉及t1表的数据分发策略确定需要执行事务INSERT语句的数据库服务器,即包含DB1和DB2的数据库服务器;本实施例事务INSERT语句需要访问多个数据库服务器,将事务INSERT语句根据所涉及表的数据的分发策略进行分析后,分解为可在单个数据库服务器上执行的两条分解INSERT语句;本实施例通过分解INSERT语句1和分解INSERT语句2进行区分。
在实现分布式事务的装置分发分解INSERT语句前,本实施例实现分布式事务的装置向GTM申请gtid(例如、申请gtid的值为100),并赋值涉及表的表项中预先设置事务标识表项中全局事务ID为申请的gtid取值;申请获得gtid后,可以在分解INSERT语句中新增插入gtid列(insert into t1(a,b,GTID)values(xx,‘xxx’,100),(yy,’yyy’,100)),将insert语句分别下发到DB1和DB2数据库服务器上执行;
本实施例还可以对插入到分解INSERT语句的gtid进行区分,例如加上区分编码或区分标识,以区分各数据库服务器的执行结果。
各分解SQL语句均执行成功后,本实施例实现分布式事务的装置下发commit(把事务所做的修改保存到数据库)到DB1和DB2数据库服务器执行,假如commit在DB1上执行失败,在DB2上执行成功;则可以根据gtid及区分编码搜索DB2上的数据库操作日志中gtid为100的SQL语句,然后执行反SQL语句进行已提交事务的回滚,直至各分解insert语句均执行完成。
本事务都提交成功后,GTM释放gtid,即gtid=100从活跃gtid列表中删除,最后给客户端回应操作成功的反馈消息。
图8为本发明第四实施例的方法的流程示意图,本实施例以请求消息中 包含事务SELECT语句对本发明方法进行清楚详细的说明,如图8所示,包括:
客户端发送的请求消息中包含的事务SELECT语句;事务SELECT语句为:select a,b from t1 where b>’yyyy’),本实施例实现分布式事务的装置根据事务SELECT表的数据分发策略确定需要执行数据库服务器(DB1和DB2);分布式事务的装置从GTM查询已分配的全局事务ID(假设全局事务ID为:gtids=100、101、105),全局事务ID包含多个gtid,可以用集合A表示。
分布式事务的装置执行分解SELECT语句正常返回,判断确定从DB1和DB2返回的数据不包含从GTM查询的已分配的全局事务ID时,执行分解SELECT语句成功;判断确定从DB1和DB2返回的数据不包含从GTM查询的已分配的全局事务ID,则执行分解SELECT语句失败。
如果执行分解SELECT语句正常返回,从DB1和DB2返回的数据包含从GTM查询的已分配的全局事务ID,则重新进行SELECT语句的执行,直至从DB1和DB2返回的数据不包含全局事务ID时,说明返回的数据不是插入或更新未完成的数据,事务SQL语句提取的数据是正确的数据,向客户端反馈分解SELECT成功执行的消息。
另外,以请求消息包含的事务SQL语句为SQL A语句,SQL A语句包含的内容为:insert into tableA...select....from tableB union select....from tableC,所涉及的表包括tableA、tableB和tableC。本实施例假设tableA的数据存放在数据库服务器1(简称DB1)和数据库服务器2(DB2);tableB的数据存放在数据库服务器3(DB3)和数据库服务器4(DB4),tableC的数据存放在数据库服务器5(DB5)。
SQL A语句需要访问DB1、DB2、DB3、DB4和DB5五个DB服务器,SQL A语句直接访问任何一个DB服务器均不对;
按照本实施例方法,将SQL A语句拆分成一条或一条以上在各个数据库服务器上执行的分解SQL语句。
本实例将事务SQL语句分解为分解SQL语句后,各分解SQL语句都可以在单个DB服务器上执行的,本实施例分解SQL语句为:
SQL 1:select....from tableB;
SQL 2:select....from tableC;
SQL 3:insert into tableA...(tableB union的结果集);根据tableB的数据存放在DB3和DB4上;tableA的数据存放在DB1和DB2;tableC的数据存放在DB5;因此执行各分解SQL语句时,将分解SQL语句分发到相应的数据库服务器执行数据库操作;
将SQL A语句中涉及到tableB和tableC的查询子句换成两个孩子节点的结果集,这样就可以在单DB服务器上执行。
本领域普通技术人员可以理解上述方法中的全部或部分步骤可通过程序来指令相关硬件完成,所述程序可以存储于计算机可读存储介质中,如只读存储器、磁盘或光盘等。可选地,上述实施例的全部或部分步骤也可以使用一个或多个集成电路来实现。相应地,上述实施例中的各模块/单元可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。本申请不限制于任何特定形式的硬件和软件的结合。
以上仅为本发明的优选实施例,并非因此限制本发明的专利范围,凡是利用本发明说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本发明的专利保护范围内。
工业实用性
本发明实施例提出的实现分布式事务的方法、装置及数据库服务器,包括:分解来自客户端的事务SQL语句,获得可在单个数据库服务器上执行的分解SQL语句;根据所涉及表的数据所在的数据库服务器,将获得的各个分解SQL语句分发到相应的数据库服务器。本发明实施例通过将事务SQL语句分解为可在单个数据库服务器上执行的分解SQL语句,通过各数据库服务器执行并反馈分解SQL语句的执行结果,实现了对分布式事务的SQL语句在各个数据库服务器执行的数据更新的确定,进而确定了分布式事务是否完成。

Claims (14)

  1. 一种实现分布式事务的方法,包括:
    分解来自客户端的事务结构化查询语言SQL语句,获得一条或一条以上可在单个数据库服务器上执行的分解SQL语句;
    根据所涉及表的数据所在的数据库服务器,将获得的各个分解SQL语句分发到相应的数据库服务器。
  2. 根据权利要求1所述的方法,其中,所述分解分布式事务包含的事务SQL语句包括:
    确定所述事务SQL语句的类型;
    基于数据操纵语言DML对确定出的各类型的所述事务SQL语句通过所涉及表的数据的分发策略进行分析;
    根据分析结果分解所述事务SQL语句为一条或一条以上可在单个数据库服务器执行的分解SQL语句。
  3. 根据权利要求2所述的方法,其中,所述事务SQL语句的类型包括:
    提取SELECT、和/或插入INSERT、和/或更新UPDATE、和/或删除DELETE、和/或模式数据定义语言DDL语句。
  4. 根据权利要求1所述的方法,还包括:
    在所述事务SQL语句分解的所有所述分解SQL语句均执行完成,确定完成分布式事务。
  5. 一种实现分布式事务的方法,包括:
    数据库服务器接收可在数据库服务器自身执行的分解SQL语句;
    数据库服务器执行接收到的分解SQL语句,并反馈执行结果至客户端;
    其中,所述分解SQL语句为事务SQL语句分解的可在单个数据库服务器上执行的语句。
  6. 根据权利要求5所述的方法,当所述分解SQL语句为插入和/或更新时,还包括:
    在所述分解SQL语句所涉及表的表项中预先设置事务标识表项;
    所述数据库服务器接收到所述分解SQL语句时,在预先设置的事务标识项中分配基于编号策略生成的全局事务ID;
    所述数据库服务器执行完所述分解SQL语句时,释放分配给分解SQL语句的全局事务ID,并根据全局事务ID的释放确定所述分解SQL语句执行完成。
  7. 根据权利要求5所述的方法,当所述分解SQL语句为提取时,还包括:
    所述数据库服务器接收到所述分解SQL语句时,执行分解SQL语句返回数据,如果返回的数据不包含分配的所述全局事务ID,确定所述分解SQL语句执行完成;
    如果返回的数据包含分配的所述全局事务ID时,重新执行所述分解SQL语句直至返回的数据中不包含分配的所述全局事务ID时,确定所述分解SQL语句执行完成。
  8. 一种实现分布式事务的装置,包括:分解单元和分发单元;其中,
    分解单元,设置为分解来自客户端的事务结构化查询语言SQL语句,获得一条或一条以上可在单个数据库服务器上执行的分解SQL语句;
    分发单元,设置为根据SQL语句所涉及表的数据所在的数据库服务器,将获得的各个分解SQL语句分发到相应的数据库服务器。
  9. 根据权利要求8所述的装置,其中,所述分解单元具体设置为:
    对所述来自客户端的事务结构化查询语言SQL语句确定事务SQL语句的类型后,基于数据操纵语言DML对各类型的所述事务SQL语句通过所涉及表的数据的分发策略进行分析;
    根据分析结果分解所述事务SQL语句为一条或一条以上可在单个数据库服务器执行的分解SQL语句。
  10. 根据权利要求8所述的装置,还包括确定单元,设置为当所述所有所述分解SQL语句均执行完成时,确定出完成分布式事务。
  11. 一种实现分布式事务的数据库服务器,包括接收单元和执行反馈单元;其中,
    接收单元,设置为接收可在数据库服务器自身执行的分解SQL语句;
    执行反馈单元,设置为执行接收到的分解SQL语句,并反馈确定是否完成分布式事务的执行结果至客户端。
  12. 根据权利要求11所述的数据库服务器,当所述分解SQL语句为插入和/或更新时,所述执行反馈单元还设置为:
    执行接收到的分解SQL语句时,在所述分解SQL语句所涉及表的表项中预先设置事务标识表项,接收到所述分解SQL语句时,在预先设置的事务标识项中分配基于编号策略生成的全局事务ID;
    执行完所述分解SQL语句时,释放分配给分解SQL语句的全局事务ID,并根据全局事务ID的释放确定所述分解SQL语句执行完成。
  13. 根据权利要求11所述的数据库服务器,当所述分解SQL语句为提取时,所述执行反馈单元还设置为:
    接收到所述分解SQL语句时,执行分解SQL语句返回数据,如果返回的数据不包含分配的所述全局事务ID,确定所述分解SQL语句执行完成;
    如果返回的数据包含分配的所述全局事务ID时,重新执行所述分解SQL语句直至返回的数据中不包含分配的所述全局事务ID时,确定所述分解SQL语句执行完成。
  14. 一种计算机可读存储介质,存储有计算机可执行指令,所述计算机可执行指令用于执行权1~权7任一项的实现分布式事务的方法。
PCT/CN2016/081752 2015-09-21 2016-05-11 一种实现分布式事务的方法、装置及数据库服务器 WO2017049911A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201510605556.8 2015-09-21
CN201510605556.8A CN106547781B (zh) 2015-09-21 2015-09-21 一种实现分布式事务的方法、装置及数据库服务器

Publications (1)

Publication Number Publication Date
WO2017049911A1 true WO2017049911A1 (zh) 2017-03-30

Family

ID=58364317

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/081752 WO2017049911A1 (zh) 2015-09-21 2016-05-11 一种实现分布式事务的方法、装置及数据库服务器

Country Status (2)

Country Link
CN (1) CN106547781B (zh)
WO (1) WO2017049911A1 (zh)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108197277A (zh) * 2018-01-09 2018-06-22 福建星瑞格软件有限公司 一种统一的数据库管理查询方法以及装置
CN109918177A (zh) * 2019-02-19 2019-06-21 阿里巴巴集团控股有限公司 分布式事务处理方法、装置及设备
CN111427963A (zh) * 2020-04-15 2020-07-17 赞同科技股份有限公司 分布式数据库的数据访问方法及系统
CN111433764A (zh) * 2017-12-06 2020-07-17 华为技术有限公司 全局一致分片式oltp系统的高吞吐量分布式事务管理及其实现方法
CN114519582A (zh) * 2022-02-21 2022-05-20 中国邮政储蓄银行股份有限公司 服务的预热方法、预热装置和服务系统

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108551478B (zh) 2018-03-29 2020-12-18 中国银联股份有限公司 一种事务处理方法、服务器及事务处理系统
CN112115012A (zh) * 2019-06-19 2020-12-22 中兴通讯股份有限公司 分布式数据库的事务监控方法及装置、系统、存储介质
CN112148725B (zh) * 2019-06-26 2022-12-06 金篆信科有限责任公司 一种实现全局唯一索引的方法及装置
CN112988883B (zh) * 2019-12-16 2023-03-10 金篆信科有限责任公司 数据库的数据同步方法、装置以及存储介质
CN114143320A (zh) * 2021-09-01 2022-03-04 浪潮云信息技术股份公司 一种基于分布式数据库的数据网关方法及系统
CN114064810B (zh) * 2022-01-17 2022-05-03 北京奥星贝斯科技有限公司 处理事务的方法和装置

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1482425A2 (en) * 2003-05-27 2004-12-01 Cognos Incorporated System and method of query transformation
CN1556482A (zh) * 2003-12-31 2004-12-22 中兴通讯股份有限公司 一种用于实现数据库多表查询的数据处理方法
CN102163195A (zh) * 2010-02-22 2011-08-24 北京东方通科技股份有限公司 一种基于分布式、异构数据库统一视图的查询优化方法
CN102521254A (zh) * 2011-11-17 2012-06-27 广东电网公司电力科学研究院 异构数据库的统一访问方法
CN103942234A (zh) * 2013-01-21 2014-07-23 中国电信股份有限公司 对多个异构数据库操作的方法、中间件装置及系统

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2013019892A1 (en) * 2011-08-01 2013-02-07 Tagged, Inc. Generalized reconciliation in a distributed database
CN104793988B (zh) * 2014-01-20 2019-01-22 阿里巴巴集团控股有限公司 跨数据库分布式事务的实现方法和装置
CN104462497B (zh) * 2014-12-19 2018-07-10 深圳中兴网信科技有限公司 基于关系型数据库的跨库事务处理方法和系统

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1482425A2 (en) * 2003-05-27 2004-12-01 Cognos Incorporated System and method of query transformation
CN1556482A (zh) * 2003-12-31 2004-12-22 中兴通讯股份有限公司 一种用于实现数据库多表查询的数据处理方法
CN102163195A (zh) * 2010-02-22 2011-08-24 北京东方通科技股份有限公司 一种基于分布式、异构数据库统一视图的查询优化方法
CN102521254A (zh) * 2011-11-17 2012-06-27 广东电网公司电力科学研究院 异构数据库的统一访问方法
CN103942234A (zh) * 2013-01-21 2014-07-23 中国电信股份有限公司 对多个异构数据库操作的方法、中间件装置及系统

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111433764A (zh) * 2017-12-06 2020-07-17 华为技术有限公司 全局一致分片式oltp系统的高吞吐量分布式事务管理及其实现方法
CN111433764B (zh) * 2017-12-06 2023-10-13 华为技术有限公司 全局一致分片式oltp系统的高吞吐量分布式事务管理及其实现方法
CN108197277A (zh) * 2018-01-09 2018-06-22 福建星瑞格软件有限公司 一种统一的数据库管理查询方法以及装置
CN109918177A (zh) * 2019-02-19 2019-06-21 阿里巴巴集团控股有限公司 分布式事务处理方法、装置及设备
CN109918177B (zh) * 2019-02-19 2023-08-04 创新先进技术有限公司 分布式事务处理方法、装置及设备
CN111427963A (zh) * 2020-04-15 2020-07-17 赞同科技股份有限公司 分布式数据库的数据访问方法及系统
CN114519582A (zh) * 2022-02-21 2022-05-20 中国邮政储蓄银行股份有限公司 服务的预热方法、预热装置和服务系统

Also Published As

Publication number Publication date
CN106547781B (zh) 2021-06-11
CN106547781A (zh) 2017-03-29

Similar Documents

Publication Publication Date Title
WO2017049911A1 (zh) 一种实现分布式事务的方法、装置及数据库服务器
US11281669B2 (en) Parallel processing database system
US10678808B2 (en) Eager replication of uncommitted transactions
CN105608086B (zh) 分布式数据库系统的事务处理方法及装置
EP3120261B1 (en) Dependency-aware transaction batching for data replication
US8639677B2 (en) Database replication techniques for maintaining original linear request order for asynchronous transactional events
US9589041B2 (en) Client and server integration for replicating data
US9336262B2 (en) Accelerated transactions with precommit-time early lock release
US7822710B1 (en) System and method for data collection
US20180173745A1 (en) Systems and methods to achieve sequential consistency in replicated states without compromising performance in geo-distributed, replicated services
US20130086018A1 (en) Transaction processing system, method, and program
US20120284228A1 (en) User-Defined Parallelization in Transactional Replication of In-Memory Database
US9286346B2 (en) Replication-only triggers
CA2556979A1 (en) Ultra-shared-nothing parallel database
US20180150540A1 (en) Synchronization Mechanism for Serialized Data Log Replay in Database Systems
US20020188624A1 (en) Active control protocol for peer-to-peer database replication
US20140279987A1 (en) Workflow design for long-running distributed operations using no sql databases
US20080201290A1 (en) Computer-implemented methods, systems, and computer program products for enhanced batch mode processing of a relational database
CN108090056B (zh) 数据查询方法、装置及系统
US11176115B2 (en) Dependency locking
US11423003B2 (en) Optimistic concurrency control for database transactions
US11106653B2 (en) Optimization of exclusive access database consistent change locks
US10678812B2 (en) Asynchronous database transaction handling
US10810188B2 (en) Load committed isolation processing
US10963426B1 (en) Method of providing access controls and permissions over relational data stored in a hadoop file system

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 16847793

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 16847793

Country of ref document: EP

Kind code of ref document: A1