CN111522631A - Distributed transaction processing method, device, server and medium - Google Patents
Distributed transaction processing method, device, server and medium Download PDFInfo
- Publication number
- CN111522631A CN111522631A CN202010209587.2A CN202010209587A CN111522631A CN 111522631 A CN111522631 A CN 111522631A CN 202010209587 A CN202010209587 A CN 202010209587A CN 111522631 A CN111522631 A CN 111522631A
- Authority
- CN
- China
- Prior art keywords
- transaction
- log
- service
- current local
- business
- Prior art date
- Legal status (The legal status 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 status listed.)
- Granted
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/466—Transaction processing
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/23—Updating
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/23—Updating
- G06F16/2308—Concurrency control
- G06F16/2336—Pessimistic concurrency control approaches, e.g. locking or multiple versions without time stamps
- G06F16/2343—Locking methods, e.g. distributed locking or locking implementation details
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/24—Querying
- G06F16/242—Query formulation
- G06F16/2433—Query languages
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/24—Querying
- G06F16/245—Query processing
- G06F16/2455—Query execution
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/27—Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Databases & Information Systems (AREA)
- Data Mining & Analysis (AREA)
- Software Systems (AREA)
- Computational Linguistics (AREA)
- Mathematical Physics (AREA)
- Computing Systems (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
本说明书实施例提供了一种分布式事务处理方法、装置、服务器及介质,该方法先根据拦截的业务SQL,从业务数据库中查询待更新业务数据的主键,再执行该业务SQL更新业务数据,在执行成功后根据查询到的主键以及当前本地事务的事务标识符生成行锁,并将该事务标识符保存至业务数据库的对应于当前本地事务的日志中,若在二阶段接收到回滚指令,则根据回滚指令中包含的事务标识符,从业务数据库的日志中查找到上述本地事务的事务更新日志来进行回滚。
The embodiments of this specification provide a distributed transaction processing method, device, server and medium. The method firstly queries the primary key of the service data to be updated from the service database according to the intercepted service SQL, and then executes the service SQL to update the service data. After successful execution, a row lock is generated according to the queried primary key and the transaction identifier of the current local transaction, and the transaction identifier is saved in the log corresponding to the current local transaction in the business database. If a rollback instruction is received in the second stage , then according to the transaction identifier contained in the rollback instruction, the transaction update log of the above-mentioned local transaction is searched from the log of the business database to perform the rollback.
Description
技术领域technical field
本说明书实施例涉及计算机技术领域,尤其涉及一种分布式事务处理方法、装置、服务器及介质。The embodiments of this specification relate to the field of computer technologies, and in particular, to a distributed transaction processing method, apparatus, server, and medium.
背景技术Background technique
分布式事务是指事务的参与者、支持事务的服务器、资源服务器以及事务管理器分别位于不同的分布式系统的不同节点之上。目前分布式事务解决方案主要有对业务无入侵和有入侵的方案。其中,无入侵方案由于具有对业务代码无入侵的优点,被广泛应用,但是对系统性能有着很高的要求。Distributed transaction means that transaction participants, transaction-supporting servers, resource servers, and transaction managers are located on different nodes of different distributed systems. At present, the distributed transaction solutions mainly include non-intrusive and intrusive solutions to the business. Among them, the non-intrusion scheme is widely used because it has the advantage of non-intrusion to business codes, but it has high requirements on system performance.
发明内容SUMMARY OF THE INVENTION
本说明书实施例提供了一种分布式事务处理方法、装置、服务器及介质。The embodiments of this specification provide a distributed transaction processing method, device, server, and medium.
第一方面,本说明书实施例提供了一种分布式事务处理方法,包括:根据拦截的业务SQL,从业务数据库中查询待更新业务数据的主键;通过执行所述业务SQL对所述待更新业务数据进行更新,执行成功后,根据查询到的主键以及当前本地事务的事务标识符,生成针对更新后业务数据的行锁,并将所述事务标识符保存至所述业务数据库的对应于所述当前本地事务的日志中;若接收到回滚指令,则根据所述回滚指令中包含的事务标识符,从所述业务数据库的日志中查询所述当前本地事务的事务更新日志,并根据所述事务更新日志对所述当前本地事务进行回滚。In a first aspect, the embodiments of this specification provide a distributed transaction processing method, including: querying a primary key of service data to be updated from a service database according to intercepted service SQL; executing the service SQL for the service to be updated The data is updated. After the execution is successful, a row lock for the updated business data is generated according to the queried primary key and the transaction identifier of the current local transaction, and the transaction identifier is saved in the business database corresponding to the In the log of the current local transaction; if a rollback instruction is received, the transaction update log of the current local transaction is queried from the log of the business database according to the transaction identifier contained in the rollback instruction, and according to the The transaction update log rolls back the current local transaction.
第二方面,本说明书实施例提供了一种分布式事务处理装置,包括:查询模块,用于根据拦截的业务SQL,从业务数据库中查询待更新业务数据的主键;事务处理模块,用于通过执行所述业务SQL对所述待更新业务数据进行更新,执行成功后,根据查询到的主键以及当前本地事务的事务标识符,生成针对更新后业务数据的行锁,并将所述事务标识符保存至所述业务数据库的对应于所述当前本地事务的日志中;回滚模块,用于若接收到回滚指令,则根据所述回滚指令中包含的事务标识符,从所述业务数据库的日志中查询所述当前本地事务的事务更新日志,并根据所述事务更新日志对所述当前本地事务进行回滚。In a second aspect, the embodiments of this specification provide a distributed transaction processing device, including: a query module for querying the primary key of business data to be updated from a business database according to intercepted business SQL; a transaction processing module for Execute the business SQL to update the business data to be updated. After the execution is successful, a row lock for the updated business data is generated according to the queried primary key and the transaction identifier of the current local transaction, and the transaction identifier is is stored in the log corresponding to the current local transaction of the business database; the rollback module is configured to, if a rollback instruction is received, retrieve data from the business database according to the transaction identifier included in the rollback instruction The transaction update log of the current local transaction is queried in the log of the current local transaction, and the current local transaction is rolled back according to the transaction update log.
第三方面,本说明书实施例提供了一种服务器,包括:存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,所述处理器执行所述程序时实现上述第一方面提供的分布式事务处理方法的步骤。In a third aspect, an embodiment of this specification provides a server, including: a memory, a processor, and a computer program stored in the memory and running on the processor, where the processor implements the first aspect when executing the program Steps of the provided distributed transaction method.
第四方面,本说明书实施例提供了一种计算机可读存储介质,其上存储有计算机程序,该程序被处理器执行时实现上述第一方面提供的分布式事务处理方法的步骤。In a fourth aspect, embodiments of the present specification provide a computer-readable storage medium on which a computer program is stored, and when the program is executed by a processor, implements the steps of the distributed transaction processing method provided in the first aspect.
本说明书一个实施例提供的分布式事务处理方法,先根据拦截的业务SQL,从业务数据库中查询待更新业务数据的主键,再执行该业务SQL更新业务数据,在执行成功后,根据查询到的主键以及当前本地事务的事务标识符生成针对更新后业务数据的行锁,并将该事务标识符保存至上述业务数据库的对应于该本地事务的日志中,如果在二阶段接收到回滚指令,就可以根据回滚指令中包含的事务标识符,从业务数据库的日志中查找到该本地事务的事务更新日志来进行回滚。该处理过程在事务处理的一阶段无需专门查询以及保存更新前后业务数据的数据镜像,减少了事务处理流程的操作步骤,并且利用数据库复制技术,在事务处理的二阶段根据事务更新日志进行本地事务的回滚。这样能够在有效保证分布式事务两阶段正常实现的同时,有效地优化无侵入模式的事务处理流程,有利于减少对系统性能的消耗。并且,由于无需在业务数据库中专门保存数据镜像,使得系统性能消耗和需要更新的数据量无关,能够消除请求更新的数据量对系统性能消耗的影响,有利于进一步减少系统性能消耗。In the distributed transaction processing method provided by an embodiment of this specification, the primary key of the service data to be updated is first queried from the service database according to the intercepted service SQL, and then the service SQL is executed to update the service data. The primary key and the transaction identifier of the current local transaction generate a row lock for the updated business data, and save the transaction identifier in the log corresponding to the local transaction in the above-mentioned business database. If a rollback instruction is received in the second stage, Then, according to the transaction identifier included in the rollback instruction, the transaction update log of the local transaction can be found from the log of the business database to perform rollback. This processing process does not require special query and data mirroring of business data before and after the update in the first stage of transaction processing, which reduces the operation steps of the transaction processing process, and uses database replication technology to perform local transactions according to the transaction update log in the second stage of transaction processing. rollback. In this way, the transaction processing flow of the non-intrusive mode can be effectively optimized while effectively ensuring the normal realization of the two-phase distributed transaction, which is beneficial to reduce the consumption of system performance. In addition, because there is no need to store data mirroring in the business database, the system performance consumption is independent of the amount of data to be updated, the impact of the amount of data requested to be updated on the system performance consumption can be eliminated, and the system performance consumption can be further reduced.
附图说明Description of drawings
图1为本说明书实施例提供的分布式事务处理方法的一种应用场景示意图;FIG. 1 is a schematic diagram of an application scenario of a distributed transaction processing method provided by an embodiment of the present specification;
图2为本说明书实施例第一方面提供的分布式事务处理方法的一种步骤流程图;FIG. 2 is a flow chart of steps of the distributed transaction processing method provided in the first aspect of the embodiment of the present specification;
图3为本说明书实施例第一方面提供的分布式事务处理方法的一种操作流程图;FIG. 3 is an operational flowchart of the distributed transaction processing method provided in the first aspect of the embodiment of the present specification;
图4为本说明书实施例第二方面提供的一种分布式事务处理装置的模块框图;FIG. 4 is a block diagram of a module of a distributed transaction processing apparatus according to the second aspect of the embodiment of the present specification;
图5为本说明书实施例第三方面提供的一种服务器的结构示意图。FIG. 5 is a schematic structural diagram of a server according to a third aspect of an embodiment of the present specification.
具体实施方式Detailed ways
随着业务的发展,业务越来越复杂,很多业务平台对业务进行了服务化拆分,使得一个业务活动通常要调用多个服务、访问多个数据库才能完成。以金融业务场景下的转账场景为例,转账服务要完成以下操作:1、调用交易系统服务创建交易订单;2、调用支付系统记录支付明细;3、调用账务系统执行A扣钱;4、调用账务系统执行B加钱。以上四个操作要跨三个业务系统,访问四个数据库。在这种场景下,可以通过分布式事务中间件解决跨服务、跨数据库的数据一致性问题。With the development of the business, the business becomes more and more complex, and many business platforms have divided the business into services, so that a business activity usually needs to call multiple services and access multiple databases to complete. Taking the transfer scenario in the financial business scenario as an example, the transfer service needs to complete the following operations: 1. Invoke the transaction system service to create a transaction order; 2. Invoke the payment system to record the payment details; 3. Invoke the accounting system to perform A deduction; 4. Call the accounting system to execute B to add money. The above four operations need to access four databases across three business systems. In this scenario, data consistency across services and databases can be resolved through distributed transaction middleware.
分布式事务中间件有无侵入式模式如分布式事务开源产品Seata的AT模式,或DTX(Distributed Transaction-eXtended)的FMT(Framework-managed transaction)模式。AT/FMT模式最大的优势是对应用透明、无侵入,但缺点是性能开销大。本说明书实施例提供了一种无侵入式模式的分布式事务处理方法,能够有效地优化了无侵入模式的事务处理流程,减少系统性能开销。Distributed transaction middleware has no intrusive mode, such as the AT mode of the distributed transaction open source product Seata, or the FMT (Framework-managed transaction) mode of DTX (Distributed Transaction-eXtended). The biggest advantage of AT/FMT mode is that it is transparent and non-invasive to the application, but the disadvantage is that the performance overhead is high. The embodiments of this specification provide a distributed transaction processing method in a non-intrusive mode, which can effectively optimize the transaction processing flow in the non-intrusive mode and reduce system performance overhead.
图1示出了本说明书实施例提供的分布式事务处理方法的一种应用场景的示意图。在图1所示的分布式系统中,包括作为协调方的服务器100,以及作为参与方的服务器101和服务器102。服务器101和服务器102均与服务器100通过网络连接。参与方可以有多个,具体数量根据实际应用场景确定,图1中作为参与方的服务器数量仅为示意,不作限制。当一个事务需要拆分为多个子事务,由多个不同的服务器执行时,该事务可以成为全局事务,对应的各个子事务,可以称为分支事务。负责全局事务的产生,以及分支事务的处理的服务器,可以称为协调方。负责分支事务的处理的服务器,可以作为参与方。FIG. 1 shows a schematic diagram of an application scenario of the distributed transaction processing method provided by the embodiment of this specification. The distributed system shown in FIG. 1 includes a
本说明书实施例提供的分布式事务处理方法可以应用于上述分布式系统中作为参与方的服务器,作为分布式事务中间件,实现对业务无侵入的分布式事务处理流程。The distributed transaction processing method provided by the embodiments of this specification can be applied to the server as a participant in the above-mentioned distributed system, as a distributed transaction middleware, to realize a distributed transaction processing process without business intrusion.
为了更好的理解本说明书实施例提供的技术方案,下面通过附图以及具体实施例对本说明书实施例的技术方案做详细的说明,应当理解本说明书实施例以及实施例中的具体特征是对本说明书实施例技术方案的详细的说明,而不是对本说明书技术方案的限定,在不冲突的情况下,本说明书实施例以及实施例中的技术特征可以相互组合。本说明书实施例中,术语“多个”表示“两个以上”,即包括两个或大于两个的情况。In order to better understand the technical solutions provided by the embodiments of the present specification, the technical solutions of the embodiments of the present specification will be described in detail below with reference to the accompanying drawings and specific embodiments. The detailed description of the technical solutions of the embodiments is not a limitation on the technical solutions of the present specification, and the embodiments of the present specification and the technical features in the embodiments may be combined with each other under the condition of no conflict. In the embodiments of the present specification, the term "plurality" means "two or more", that is, the case of two or more than two is included.
第一方面,图2示出了本说明书实施例提供的一种分布式事务处理方法的流程图,应用于作为事务参与方的服务器。请参阅图2,所述方法可以包括以下步骤S101-步骤S103。In the first aspect, FIG. 2 shows a flowchart of a distributed transaction processing method provided by an embodiment of the present specification, which is applied to a server as a transaction participant. Referring to FIG. 2, the method may include the following steps S101-S103.
步骤S101,根据拦截的业务SQL,从业务数据库中查询待更新业务数据的主键。Step S101, according to the intercepted service SQL, query the primary key of the service data to be updated from the service database.
用户通过用户终端上安装的应用程序即客户端,触发需要多个参与方协调完成的业务操作如,支付操作、转账操作等时,客户端会向其服务器端发送业务处理请求。服务器端接收到业务处理请求后,作为事务发起方即协调方向事务管理器注册全局事务。并且,事务管理器会为该全局事务分配用于唯一标识该全局事务的事务标识符,即txid(transaction id),并发送给应用程序的服务器端保存。When a user triggers a business operation that needs to be coordinated and completed by multiple participants through the application program installed on the user terminal, such as a payment operation, a transfer operation, etc., the client terminal will send a business processing request to its server side. After the server side receives the business processing request, as the transaction initiator, the coordinator registers the global transaction with the transaction manager. In addition, the transaction manager assigns a transaction identifier for uniquely identifying the global transaction, namely txid (transaction id), to the global transaction, and sends it to the server side of the application for storage.
事务发起方开启全局事务后,通过调用参与方执行业务SQL(Structured QueryLanguage),实现用户触发的业务操作。业务SQL即为执行业务操作的SQL语句。全局事务包括多个事务分支,每个事务分支对应于一个参与方,事务发起方会针对每个事务分支生成相应的业务SQL,从而在相应参与方执行该业务SQL,以完成该分支事务。例如,全局事务为A向B转账30元,则包括两个事务分支。其中一个是对A账户扣款30元,该事务分支所执行的业务SQL即为将相应业务数据库中A账户的余额减30,另一个是对B账户增加30元,该分支事务所执行的业务SQL为将相应业务数据库中B账户的余额加30。After the transaction initiator opens the global transaction, it calls the participant to execute the business SQL (Structured QueryLanguage) to realize the business operation triggered by the user. Business SQL is the SQL statement for executing business operations. A global transaction includes multiple transaction branches, each transaction branch corresponds to a participant, and the transaction initiator generates corresponding business SQL for each transaction branch, so as to execute the business SQL on the corresponding participant to complete the branch transaction. For example, the global transaction is that A transfers 30 yuan to B, which includes two transaction branches. One of them is to deduct 30 yuan from account A. The business SQL executed by the transaction branch is to reduce the balance of account A in the corresponding business database by 30. The other is to add 30 yuan to account B. The business executed by the branch office SQL is to add 30 to the balance of account B in the corresponding business database.
本说明书实施例中,在事务执行的一阶段,通过拦截参与方业务SQL的执行,在业务SQL执行之前,先根据所拦截的业务SQL,从业务数据库中查询待更新业务数据的主键,用于根据这些主键生成行锁,保证事务最终提交前这些主键对应的数据被锁住,以免造成脏数据。In the embodiment of this specification, in the first stage of transaction execution, by intercepting the execution of the participant's business SQL, before the business SQL is executed, the primary key of the business data to be updated is queried from the business database according to the intercepted business SQL, for Generate row locks based on these primary keys to ensure that the data corresponding to these primary keys are locked before the transaction is finally committed, so as to avoid dirty data.
具体来讲,如图3所示,可以先解析该业务SQL的语义,然后提取表元数据。解析业务SQL语义的目的是为了便于找到业务要更新的业务数据,而提取表元数据的目的为了找到业务数据库中业务表的主键和唯一性约束键,便于生成行锁。表元数据可以包括表的Schema信息,比如表的主键、唯一键以及列名等。这样就可以通过表的主键列名,生成SQL语句的select部分,并从业务SQL中截取where部分,就可以生成查询主键的SQL语句,从而执行该SQL语句查询到待更新业务数据的主键列表。在查询到待更新的业务数据的主键后,就可以开启参与方的本地事务,执行以下步骤S102,无需查询以及保存更新前业务数据的数据镜像。Specifically, as shown in Figure 3, the semantics of the business SQL can be parsed first, and then the table metadata can be extracted. The purpose of parsing the business SQL semantics is to find the business data to be updated by the business, and the purpose of extracting table metadata is to find the primary key and unique constraint key of the business table in the business database, so as to facilitate the generation of row locks. Table metadata can include schema information of the table, such as the primary key, unique key, and column name of the table. In this way, the select part of the SQL statement can be generated through the primary key column name of the table, and the where part can be intercepted from the business SQL to generate the SQL statement for querying the primary key, so that the SQL statement can be executed to query the primary key list of the business data to be updated. After the primary key of the business data to be updated is queried, the local transaction of the participant can be started, and the following step S102 is performed, without querying and saving the data mirror of the business data before updating.
可以理解的是,参与方管理的业务数据库中存储有业务表,业务表是以二维表形式存储的。业务表中的每一行,即为一条记录,或者称为元组,每一列即为一个字段,或者称为属性。It can be understood that the business database managed by the participant stores business tables, and the business tables are stored in the form of two-dimensional tables. Each row in the business table is a record, or a tuple, and each column is a field, or an attribute.
步骤S102,通过执行所述业务SQL对所述待更新业务数据进行更新,执行成功后,根据查询到的主键以及当前本地事务的事务标识符,生成针对更新后业务数据的行锁,并将所述事务标识符保存至所述业务数据库的对应于所述当前本地事务的日志中。Step S102, the business data to be updated is updated by executing the business SQL. After the execution is successful, a row lock for the updated business data is generated according to the queried primary key and the transaction identifier of the current local transaction, and the The transaction identifier is stored in a log of the business database corresponding to the current local transaction.
如图3所示,在查询到待更新业务数据的主键后,就可以开启本地事务,以便进行数据库操作。通过执行业务SQL,对业务数据库(即图3中的业务DB)中的相应业务数据进行更新。并且,为了保证事务提交前这些主键对应的数据被锁住,以免造成脏数据,在业务SQL执行成功后,需要根据上述步骤S101查询到的主键以及当前本地事务的事务标识符,生成针对更新后业务数据的行锁,并将生成的行锁存储起来。具体实施过程中,可以将生成的行锁发送到事务服务器存储,也可以存储在业务数据库。例如,FMT同库模式是保存在业务数据库,Seata AT模式是保存在事务服务器。As shown in FIG. 3 , after the primary key of the business data to be updated is queried, a local transaction can be opened to perform database operations. By executing the business SQL, the corresponding business data in the business database (ie, the business DB in FIG. 3 ) is updated. In addition, in order to ensure that the data corresponding to these primary keys are locked before the transaction is committed, so as not to cause dirty data, after the business SQL is successfully executed, it is necessary to generate a post-update transaction identifier based on the primary key queried in the above step S101 and the transaction identifier of the current local transaction. The row lock of the business data, and the generated row lock is stored. In the specific implementation process, the generated row lock may be sent to the transaction server for storage, or may be stored in the business database. For example, the FMT same-database mode is stored in the business database, and the Seata AT mode is stored in the transaction server.
此后,就可以提交本地事务,即提交一个本地事务成功执行的确认信息。以便事务发起方根据各个参与方提交的确认信息,触发二阶段的提交/回滚操作。Thereafter, the local transaction can be submitted, that is, a confirmation of the successful execution of the local transaction is submitted. So that the transaction initiator can trigger the two-phase commit/rollback operation according to the confirmation information submitted by each participant.
需要说明的是,在上述步骤S102中,执行完业务SQL后,无需查询以及保存更新后业务数据的数据镜像。It should be noted that, in the above step S102, after the service SQL is executed, there is no need to query and save the data image of the updated service data.
本说明书实施例中,参与方管理的业务数据库均开启了主从复制功能,业务数据库会自动生成本地事务日志,用于记录所有本地事务以及每个本地事务对数据库所做的修改。因此,在每个本地事务执行过程中,业务数据库在执行业务SQL时会自动生成包含业务数据更新前、后数据镜像的本地事务日志,存储在业务数据库所在服务器的文件系统中。当然,业务数据库记录的本地事务日志除了包括业务数据更新前和更新后的数据镜像以外,还包括其他数据,如时间戳等,不同的数据类型记录略有差别。In the embodiments of this specification, the master-slave replication function is enabled for the business databases managed by the participants, and the business databases automatically generate local transaction logs for recording all local transactions and the modifications made to the database by each local transaction. Therefore, during the execution of each local transaction, the business database automatically generates a local transaction log containing data mirroring before and after business data update when executing business SQL, and stores it in the file system of the server where the business database is located. Of course, the local transaction log recorded by the business database includes other data, such as timestamps, in addition to the data mirrors before and after the business data is updated. The records of different data types are slightly different.
业务数据库自动生成的本地事务日志属于流式数据,包含有本地事务的开始和结束标志。通过识别本地事务的开始和结束标志,可以分辨出一个个本地事务,但是本地事务的日志与全局事务的对应关系,是不知道的。因此,为了能够从业务数据库的日志中,查找到所需要的本地事务日志,在生成行锁的同时,需要将当前执行的本地事务的事务标识符保存至业务数据库中对应于该本地事务的日志中。这样,通过在业务数据库的日志中匹配本地事务日志中插入的事务标识符,就可以查找到对应于当前要回滚的本地事务的事务更新日志。The local transaction log automatically generated by the business database belongs to streaming data and contains the start and end marks of the local transaction. By identifying the start and end signs of a local transaction, one can distinguish one local transaction, but the corresponding relationship between the log of the local transaction and the global transaction is unknown. Therefore, in order to find the required local transaction log from the log of the business database, when the row lock is generated, the transaction identifier of the currently executed local transaction needs to be saved to the log corresponding to the local transaction in the business database middle. In this way, by matching the transaction identifier inserted in the local transaction log in the log of the business database, the transaction update log corresponding to the current local transaction to be rolled back can be found.
也就是说,上述步骤S102中,根据查询到的主键以及当前本地事务的事务标识符,生成针对更新后业务数据的行锁的实施过程可以包括:获取当前本地事务的事务标识符;将查询到的主键以及所述事务标识符,插入到业务数据库中预设的行锁记录表中。具体实施过程中,是把更新业务数据所在业务表的表名以及更新业务数据在业务表中的主键信息,与当前本地事务的事务标识符对应记录到行锁记录表中。这样,该业务数据通过行锁的方式被标记,不会被其他分布式事务访问,避免访问数据时出现脏数据,提升分布式事务访问数据的强一致性。可以理解的是,业务表的名称是唯一的,而每个业务表内部的主键值也是唯一的,因此,通过业务表的名称以及更新业务数据在该业务表中的主键信息可以唯一确定一条数据。That is to say, in the above step S102, the implementation process of generating a row lock for the updated business data according to the queried primary key and the transaction identifier of the current local transaction may include: obtaining the transaction identifier of the current local transaction; The primary key and the transaction identifier are inserted into the preset row lock record table in the business database. In the specific implementation process, the table name of the business table where the updated business data is located and the primary key information of the updated business data in the business table are recorded in the row lock record table corresponding to the transaction identifier of the current local transaction. In this way, the business data is marked by row locks and will not be accessed by other distributed transactions, avoiding dirty data when accessing data, and improving the strong consistency of distributed transactions accessing data. It can be understood that the name of the business table is unique, and the primary key value within each business table is also unique. Therefore, a single item can be uniquely determined by the name of the business table and the primary key information of the updated business data in the business table. data.
举例来讲,可以利用日志中的insert语句,insert里插入两个字段,一个是事务标识符,另一个是全局锁的值。其中,全局锁的值即为更新业务数据所在业务表的表名以及更新业务数据在业务表中的主键信息,如可以是由二者构成的字符串。同时,业务数据库的对应于当前本地事务的日志中也会记录这条insert语句,这样就可以将当前本地事务的事务标识符保存至当前本地事务的日志中。For example, you can use the insert statement in the log to insert two fields into the insert, one is the transaction identifier, and the other is the value of the global lock. The value of the global lock is the table name of the business table where the updated business data is located and the primary key information of the updated business data in the business table, such as a string composed of the two. At the same time, the insert statement is also recorded in the log of the business database corresponding to the current local transaction, so that the transaction identifier of the current local transaction can be saved in the log of the current local transaction.
事务发起方在接收到事务管理器分配的全局事务的事务标识符后,可以将事务标识符保存在应用程序所属线程的上下文中。在执行上述步骤S101之前,事务发起方在调用参与方提供的服务以请求参与方执行相应分支事务时,会将事务标识符发送给参与方,可以在参与方的服务入口处拦截事务标识符,并保存在所属线程的上下文中。在需要生成行锁时,就可以从上下文中获取事务标识符,将该事务标识符与上述步骤S101查询到的主键,一起对应插入到业务数据库中预设的行锁记录表中。After receiving the transaction identifier of the global transaction assigned by the transaction manager, the transaction initiator can save the transaction identifier in the context of the thread to which the application belongs. Before performing the above step S101, when invoking the service provided by the participant to request the participant to execute the corresponding branch transaction, the transaction initiator will send the transaction identifier to the participant, and the transaction identifier can be intercepted at the service entry of the participant, and saved in the context of the owning thread. When a row lock needs to be generated, the transaction identifier can be obtained from the context, and the transaction identifier and the primary key queried in the above step S101 are correspondingly inserted into the preset row lock record table in the business database.
参与方提交本地事务后,即完成了一阶段的事务处理。若事务发起方监测到一个以上参与方未按时提交本地事务,即表明一阶段有参与方发生错误,则触发二阶段的回滚操作,发送回滚指令到每个参与方,使得参与方执行以下步骤S103。若事务发起方监测到所有参与方均提交了本地事务,即表明一阶段所有参与方都成功执行,则触发二阶段的提交操作,发送提交指令到每个参与方,使得参与方执行以下步骤S104。After a participant submits a local transaction, one-phase transaction processing is completed. If the transaction initiator detects that more than one participant fails to submit the local transaction on time, it means that there is an error in the first stage of the participant, triggers the rollback operation in the second stage, and sends a rollback instruction to each participant, so that the participant executes the following Step S103. If the transaction initiator detects that all the participants have submitted the local transaction, which means that all the participants in the first stage have successfully executed the transaction, then the second-stage commit operation is triggered, and a commit instruction is sent to each participant, so that the participants perform the following step S104 .
步骤S103,若接收到回滚指令,则根据所述回滚指令中包含的事务标识符,从所述业务数据库的日志中查询所述当前本地事务的事务更新日志,并根据所述事务更新日志对所述当前本地事务进行回滚。Step S103, if a rollback instruction is received, query the transaction update log of the current local transaction from the log of the business database according to the transaction identifier included in the rollback instruction, and update the log according to the transaction The current local transaction is rolled back.
参与方接收到二阶段回滚指令时,需要对上述步骤S102提交的本地事务进行回滚,将步骤S102执行业务SQL更新的业务数据还原到更新前的状态。本说明书实施例中,回滚需要的更新前和更新后的镜像数据是从业务数据库的日志中获取。需要说明的是,对于不同的数据库类型,查询其更新日志的方式不同,具体根据实际数据库类型提交的接口来查询。When the participant receives the two-stage rollback instruction, it needs to roll back the local transaction submitted in the above step S102, and restore the business data updated by the business SQL in the step S102 to the state before the update. In the embodiment of this specification, the mirror data before and after the update required for rollback are obtained from the log of the business database. It should be noted that, for different database types, the method of querying the update log is different, and the query is based on the interface submitted by the actual database type.
事务发起方发送的回滚指令中包含有要回滚的全局事务的事务标识符。上述根据回滚指令中包含的事务标识符,从业务数据库的日志中查询当前本地事务的事务更新日志的过程可以包括:从回滚指令中提取出事务标识符;在业务数据库的日志中,查找包含有该事务标识符的日志,即查找包含有回滚指令中的事务标识符的本地事务日志;将查找到的本地事务日志作为当前本地事务的事务更新日志。The rollback command sent by the transaction initiator contains the transaction identifier of the global transaction to be rolled back. The above process of querying the transaction update log of the current local transaction from the log of the business database according to the transaction identifier contained in the rollback instruction may include: extracting the transaction identifier from the rollback instruction; in the log of the business database, searching for The log containing the transaction identifier is to find the local transaction log containing the transaction identifier in the rollback instruction; the found local transaction log is used as the transaction update log of the current local transaction.
业务数据库的日志中,包含有多个本地事务的日志,即多个本地事务日志,通过本地事务的开始和结束标志区别不同本地事务日志。每个本地事务日志中均保存有该本地事务的事务标识符,即与该本地事务关联的全局事务的事务标识符,因此,可以通过匹配事务标识符,从众多本地事务日志中,过滤出本次要回滚的本地事务的本地事务日志。The logs of the business database include logs of multiple local transactions, that is, multiple local transaction logs, and different local transaction logs are distinguished by the start and end flags of the local transactions. Each local transaction log stores the transaction identifier of the local transaction, that is, the transaction identifier of the global transaction associated with the local transaction. Therefore, by matching the transaction identifier, the local transaction log can be filtered out of the local transaction log. The local transaction log for the local transaction that was minor rolled back.
进一步地,查找到当前本地事务的事务更新日志后,根据所述事务更新日志对所述当前本地事务进行回滚的过程可以包括:从事务更新日志中,提取待更新业务数据在更新前以及更新后的数据镜像;通过更新前以及更新后的数据镜像,对当前本地事务进行回滚。可以理解的是,业务数据库的事务更新日志可以包括时间戳以及业务数据更新前、后的数据镜像等。Further, after finding the transaction update log of the current local transaction, the process of rolling back the current local transaction according to the transaction update log may include: from the transaction update log, extracting the business data to be updated before updating and updating After the data mirroring; through the data mirroring before and after the update, the current local transaction is rolled back. It can be understood that the transaction update log of the business database may include time stamps and data mirroring before and after the business data is updated.
具体实施过程中,首先,需要校验脏写。校验脏写的方式为将从事务更新日志中提取的更新后的镜像数据与业务数据库中该业务数据的当前值进行对比,如果两份数据完全一致则说明没有出现脏写,如果两份数据不一致,则说明出现脏写。如果出现脏写,就需要转人工处理,不能再使用所提取的更新后的镜像数据回滚业务数据。In the specific implementation process, first, the dirty write needs to be verified. The method of verifying dirty writing is to compare the updated mirror data extracted from the transaction update log with the current value of the business data in the business database. If the two pieces of data are completely consistent, it means that there is no dirty writing. Inconsistent, it means that there is dirty writing. If dirty writing occurs, manual processing is required, and the extracted and updated mirror data cannot be used to roll back business data.
然后,还原业务数据。如果未出现脏写,则使用从事务更新日志中提取的更新前的镜像数据回滚业务数据,使业务数据恢复到更新前的值。Then, restore the business data. If no dirty writing occurs, the business data is rolled back using the pre-update mirror data extracted from the transaction update log to restore the business data to the pre-update value.
最后,删除中间数据。业务数据还原之后,便可以将一阶段保存的中间数据全部删掉,完成回滚操作。由于本说明书实施例提供的分布式事务处理方法在一阶段仅保存了行锁,故只需删除行锁。Finally, remove the intermediate data. After the business data is restored, all the intermediate data saved in the first stage can be deleted to complete the rollback operation. Since the distributed transaction processing method provided by the embodiments of this specification only saves row locks in one stage, it is only necessary to delete the row locks.
步骤S104,参与方若接收到提交指令,则删除所生成的行锁。由于业务SQL在一阶段已经提交至业务数据库,故二阶段提交只需删除一阶段保存的中间数据。由于本说明书实施例提供的分布式事务处理方法在一阶段仅保存了行锁,故只需删除行锁。相比于Seata的AT模式或DTX的FMT模式,减少了需要删除的中间数据,有利于减少了事务处理流程的操作步骤,从而减少对系统性能的消耗。Step S104, if the participant receives the commit instruction, it deletes the generated row lock. Since the business SQL has been submitted to the business database in the first stage, the second stage submission only needs to delete the intermediate data saved in the first stage. Since the distributed transaction processing method provided by the embodiments of this specification only saves row locks in one stage, it is only necessary to delete the row locks. Compared with the AT mode of Seata or the FMT mode of DTX, the intermediate data that needs to be deleted is reduced, which is beneficial to reduce the operation steps of the transaction processing process, thereby reducing the consumption of system performance.
本说明书实施例提供的分布式事务处理方法,在分布式事务处理的一阶段无需查询以及保存更新前后业务数据的数据镜像,减少了事务处理流程的操作步骤,并且利用数据库复制技术,在事务处理的二阶段通过事务标识符在业务数据库的日志中查找事务更新日志来进行回滚。相比于Seata的AT模式或DTX的FMT模式,这样能够在保证分布式事务两阶段正常实现的同时,有效地优化无侵入模式的事务处理流程,有利于减少对系统性能的消耗。另外,由于无需在业务数据库的数据文件中专门保存业务数据更新前后的数据镜像,使得系统性能消耗与业务SQL更新的数据量无关,这样就能够消除请求更新的数据量对系统性能消耗的影响,有利于进一步减少系统性能消耗。The distributed transaction processing method provided by the embodiments of this specification does not need to query and save the data mirroring of the business data before and after the update in the first stage of the distributed transaction processing, which reduces the operation steps of the transaction processing process, and uses the database replication technology. The second stage of the rollback is performed by looking up the transaction update log in the log of the business database by the transaction identifier. Compared with Seata's AT mode or DTX's FMT mode, this can effectively optimize the transaction processing flow of non-intrusive mode while ensuring the normal realization of two-phase distributed transactions, which is beneficial to reduce the consumption of system performance. In addition, because there is no need to store the data images before and after the business data update in the data file of the business database, the system performance consumption has nothing to do with the data volume of the business SQL update, which can eliminate the impact of the requested update data volume on the system performance consumption. It is beneficial to further reduce system performance consumption.
第二方面,基于与前述第一方面实施例提供的分布式事务处理方法同样的发明构思,本说明书实施例还提供了一种分布式事务处理装置,运行于作为事务参与方的服务器。如图4所示,该分布式事务处理装置40包括:In the second aspect, based on the same inventive concept as the distributed transaction processing method provided by the embodiments of the first aspect, the embodiments of the present specification further provide a distributed transaction processing apparatus that runs on a server that is a transaction participant. As shown in Figure 4, the distributed transaction processing device 40 includes:
查询模块41,用于根据拦截的业务SQL,从业务数据库中查询待更新业务数据的主键;The query module 41 is used to query the primary key of the service data to be updated from the service database according to the intercepted service SQL;
事务处理模块42,用于通过执行所述业务SQL对所述待更新业务数据进行更新,执行成功后,根据查询到的主键以及当前本地事务的事务标识符,生成针对更新后业务数据的行锁,并将所述事务标识符保存至所述业务数据库的对应于所述当前本地事务的日志中;The transaction processing module 42 is configured to update the business data to be updated by executing the business SQL, and after successful execution, generate a row lock for the updated business data according to the queried primary key and the transaction identifier of the current local transaction , and save the transaction identifier to the log of the business database corresponding to the current local transaction;
回滚模块43,用于若接收到回滚指令,则根据所述回滚指令中包含的事务标识符,从所述业务数据库的日志中查询所述当前本地事务的事务更新日志,并根据所述事务更新日志对所述当前本地事务进行回滚。The rollback module 43 is configured to, if a rollback instruction is received, query the transaction update log of the current local transaction from the log of the business database according to the transaction identifier contained in the rollback instruction, and The transaction update log rolls back the current local transaction.
在一种可选的实施例中,所述回滚模块43包括:日志查询子模块431,用于从业务数据库的日志中,查找包含有所述回滚指令中的事务标识符的本地事务日志;将查找到的本地事务日志作为所述本地事务的事务更新日志。In an optional embodiment, the rollback module 43 includes: a log query submodule 431, configured to search for a local transaction log containing the transaction identifier in the rollback instruction from the log of the business database ; Use the found local transaction log as the transaction update log of the local transaction.
在一种可选的实施例中,所述回滚模块43包括:In an optional embodiment, the rollback module 43 includes:
提取子模块432,用于从所述事务更新日志中,提取所述待更新业务数据在更新前以及更新后的数据镜像;Extraction submodule 432, for extracting the data images of the service data to be updated before and after the update from the transaction update log;
回滚子模块433,用于通过所述更新前以及更新后的数据镜像,对所述当前本地事务进行回滚。The rollback submodule 433 is configured to roll back the current local transaction through the data mirroring before and after the update.
在一种可选的实施例中,所述事务处理模块42用于:获取所述当前本地事务的事务标识符;将所述查询到的主键以及所述事务标识符,插入到所述业务数据库中预设的行锁记录表中。In an optional embodiment, the transaction processing module 42 is configured to: obtain the transaction identifier of the current local transaction; insert the queried primary key and the transaction identifier into the business database In the preset row lock record table.
在一种可选的实施例中,上述分布式事务处理装置40还包括:提交模块44,用于若接收到提交指令,则删除所述行锁。In an optional embodiment, the above-mentioned distributed transaction processing apparatus 40 further includes: a commit module 44, configured to delete the row lock if a commit instruction is received.
需要说明的是,本说明书实施例所提供的分布式事务处理装置40,其中各个模块执行操作的具体方式已经在上述第一方面提供的方法实施例中进行了详细描述,具体实施过程可以参照上述第一方面提供的方法实施例,此处将不做详细阐述说明。It should be noted that, in the distributed transaction processing apparatus 40 provided by the embodiments of this specification, the specific manner in which each module performs operations has been described in detail in the method embodiments provided in the first aspect, and the specific implementation process may refer to the above The method embodiments provided by the first aspect will not be described in detail here.
第三方面,基于与前述实施例提供的分布式事务处理方法同样的发明构思,本说明书实施例还提供了一种服务器。如图5所示,该服务器包括存储器504、一个或多个处理器502及存储在存储器504上并可在处理器502上运行的计算机程序,处理器502执行该程序时实现前文第一方面提供的分布式事务处理方法的任一实施方式的步骤。In the third aspect, based on the same inventive concept as the distributed transaction processing method provided by the foregoing embodiments, an embodiment of the present specification further provides a server. As shown in FIG. 5 , the server includes a
其中,在图5中,总线架构(用总线500来代表),总线500可以包括任意数量的互联的总线和桥,总线500将包括由处理器502代表的一个或多个处理器和存储器504代表的存储器的各种电路链接在一起。总线500还可以将诸如外围设备、稳压器和功率管理电路等之类的各种其他电路链接在一起,这些都是本领域所公知的,因此,本文不再对其进行进一步描述。总线接口505在总线500和接收器501和发送器503之间提供接口。接收器501和发送器503可以是同一个元件,即收发机,提供用于在传输介质上与各种其他装置通信的单元。处理器502负责管理总线500和通常的处理,而存储器504可以被用于存储处理器502在执行操作时所使用的数据。5, the bus architecture (represented by bus 500),
可以理解的是,图5所示的结构仅为示意,本说明书实施例提供的服务器还可包括比图5中所示更多或者更少的组件,或者具有与图5所示不同的配置。图5中所示的各组件可以采用硬件、软件或其组合实现。It can be understood that the structure shown in FIG. 5 is only for illustration, and the server provided in this embodiment of the present specification may further include more or less components than those shown in FIG. 5 , or have different configurations from those shown in FIG. 5 . Each component shown in FIG. 5 can be implemented in hardware, software, or a combination thereof.
第四方面,基于与前述实施例中提供的分布式事务处理方法同样的发明构思,本说明书实施例还提供了一种计算机可读存储介质,其上存储有计算机程序,该程序被处理器执行时实现前文第一方面提供的分布式事务处理方法的任一实施方式的步骤。In the fourth aspect, based on the same inventive concept as the distributed transaction processing method provided in the foregoing embodiments, the embodiments of the present specification further provide a computer-readable storage medium on which a computer program is stored, and the program is executed by a processor When implementing the steps of any implementation manner of the distributed transaction processing method provided in the first aspect above.
上述对本说明书特定实施例进行了描述。其它实施例在所附权利要求书的范围内。在一些情况下,在权利要求书中记载的动作或步骤可以按照不同于实施例中的顺序来执行并且仍然可以实现期望的结果。另外,在附图中描绘的过程不一定要求示出的特定顺序或者连续顺序才能实现期望的结果。在某些实施方式中,多任务处理和并行处理也是可以的或者可能是有利的。The foregoing describes specific embodiments of the present specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims can be performed in an order different from that in the embodiments and still achieve desirable results. Additionally, the processes depicted in the figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
本说明书是参照根据本说明书实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的设备。The specification is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the specification. It will be understood that each flow and/or block in the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to the processor of a general purpose computer, special purpose computer, embedded processor or other programmable data processing device to produce a machine such that the instructions executed by the processor of the computer or other programmable data processing device produce A device that implements the functions specified in a flow or flow of a flowchart and/or a block or blocks of a block diagram.
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令设备的制造品,该指令设备实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。These computer program instructions may also be stored in a computer readable memory capable of directing a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer readable memory result in an article of manufacture comprising the instruction apparatus, the instructions The device implements the functions specified in the flow or flows of the flowcharts and/or the block or blocks of the block diagrams.
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。These computer program instructions can also be loaded on a computer or other programmable data processing device to cause a series of operational steps to be performed on the computer or other programmable device to produce a computer-implemented process such that The instructions provide steps for implementing the functions specified in the flow or blocks of the flowcharts and/or the block or blocks of the block diagrams.
尽管已描述了本说明书的优选实施例,但本领域内的技术人员一旦得知了基本创造性概念,则可对这些实施例作出另外的变更和修改。所以,所附权利要求意欲解释为包括优选实施例以及落入本说明书范围的所有变更和修改。While the preferred embodiments of this specification have been described, additional changes and modifications to these embodiments may occur to those skilled in the art once the basic inventive concepts are known. Therefore, the appended claims are intended to be construed to include the preferred embodiment and all changes and modifications that fall within the scope of this specification.
显然,本领域的技术人员可以对本说明书进行各种改动和变型而不脱离本说明书的精神和范围。这样,倘若本说明书的这些修改和变型属于本说明书权利要求及其等同技术的范围之内,则本说明书也意图包含这些改动和变型在内。Obviously, those skilled in the art can make various changes and modifications to this specification without departing from the spirit and scope of this specification. Thus, provided that these modifications and variations of the present specification fall within the scope of the claims of the present specification and technical equivalents thereof, the present specification is also intended to include these modifications and variations.
Claims (12)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202010209587.2A CN111522631B (en) | 2020-03-23 | 2020-03-23 | Distributed transaction processing method, device, server and medium |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202010209587.2A CN111522631B (en) | 2020-03-23 | 2020-03-23 | Distributed transaction processing method, device, server and medium |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN111522631A true CN111522631A (en) | 2020-08-11 |
| CN111522631B CN111522631B (en) | 2024-02-06 |
Family
ID=71900960
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202010209587.2A Active CN111522631B (en) | 2020-03-23 | 2020-03-23 | Distributed transaction processing method, device, server and medium |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN111522631B (en) |
Cited By (11)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN112182082A (en) * | 2020-09-24 | 2021-01-05 | 广州巨杉软件开发有限公司 | System and method for realizing strong consistency of transactions across different database engines |
| CN112395102A (en) * | 2020-10-15 | 2021-02-23 | 北京仿真中心 | Distributed database middleware solution method |
| CN112764888A (en) * | 2021-01-21 | 2021-05-07 | 中信银行股份有限公司 | Distributed transaction checking and judging method and system based on log analysis |
| CN112995304A (en) * | 2021-02-08 | 2021-06-18 | 中国工商银行股份有限公司 | Method and device for processing routing service node by two-stage distributed transaction |
| CN113010495A (en) * | 2021-03-19 | 2021-06-22 | 北京三快在线科技有限公司 | Database optimization method and device |
| CN113342481A (en) * | 2021-07-07 | 2021-09-03 | 中国工商银行股份有限公司 | Transaction state confirmation method and device |
| CN113760875A (en) * | 2021-01-21 | 2021-12-07 | 北京沃东天骏信息技术有限公司 | Data processing method and device, electronic equipment and storage medium |
| CN113868340A (en) * | 2021-10-18 | 2021-12-31 | 中国工商银行股份有限公司 | Distributed transaction processing method, device and electronic device |
| CN114385320A (en) * | 2020-10-22 | 2022-04-22 | 支付宝(杭州)信息技术有限公司 | Distributed transaction processing method and system |
| CN115905402A (en) * | 2022-09-26 | 2023-04-04 | 北京奥星贝斯科技有限公司 | Method and device for processing transaction logs |
| WO2023134518A1 (en) * | 2022-01-17 | 2023-07-20 | 北京奥星贝斯科技有限公司 | Method and apparatus for querying modified content of transaction in database |
Citations (13)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN102831156A (en) * | 2012-06-29 | 2012-12-19 | 浙江大学 | Distributed transaction processing method on cloud computing platform |
| US20130036136A1 (en) * | 2011-08-01 | 2013-02-07 | International Business Machines Corporation | Transaction processing system, method and program |
| US20130262423A1 (en) * | 2012-03-29 | 2013-10-03 | Goetz Graefe | Controlled lock violation for data transactions |
| US9171019B1 (en) * | 2013-02-19 | 2015-10-27 | Amazon Technologies, Inc. | Distributed lock service with external lock information database |
| CN106033439A (en) * | 2015-03-13 | 2016-10-19 | 阿里巴巴集团控股有限公司 | Method and system for processing distributed transaction |
| CN106033437A (en) * | 2015-03-13 | 2016-10-19 | 阿里巴巴集团控股有限公司 | Method and system for processing distributed transaction |
| WO2016180164A1 (en) * | 2015-09-29 | 2016-11-17 | 中兴通讯股份有限公司 | Method and apparatus for rolling back distributed transaction |
| CN106610876A (en) * | 2015-10-23 | 2017-05-03 | 中兴通讯股份有限公司 | Method and device for recovering data snapshot |
| US9830223B1 (en) * | 2015-01-26 | 2017-11-28 | Intel Corporation | Methods for repairing a corrupted database to a new, correct state |
| US20180137166A1 (en) * | 2016-11-17 | 2018-05-17 | Sap Se | Database Systems Architecture Incorporating Distributed Log |
| CN109783204A (en) * | 2018-12-28 | 2019-05-21 | 咪咕文化科技有限公司 | Distributed transaction processing method, device and storage medium |
| US20190188097A1 (en) * | 2017-12-15 | 2019-06-20 | Vmware, Inc. | Mirrored write ahead logs for data storage system |
| CN110888718A (en) * | 2019-11-27 | 2020-03-17 | 武汉虹旭信息技术有限责任公司 | Method and device for realizing distributed transaction |
-
2020
- 2020-03-23 CN CN202010209587.2A patent/CN111522631B/en active Active
Patent Citations (13)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20130036136A1 (en) * | 2011-08-01 | 2013-02-07 | International Business Machines Corporation | Transaction processing system, method and program |
| US20130262423A1 (en) * | 2012-03-29 | 2013-10-03 | Goetz Graefe | Controlled lock violation for data transactions |
| CN102831156A (en) * | 2012-06-29 | 2012-12-19 | 浙江大学 | Distributed transaction processing method on cloud computing platform |
| US9171019B1 (en) * | 2013-02-19 | 2015-10-27 | Amazon Technologies, Inc. | Distributed lock service with external lock information database |
| US9830223B1 (en) * | 2015-01-26 | 2017-11-28 | Intel Corporation | Methods for repairing a corrupted database to a new, correct state |
| CN106033439A (en) * | 2015-03-13 | 2016-10-19 | 阿里巴巴集团控股有限公司 | Method and system for processing distributed transaction |
| CN106033437A (en) * | 2015-03-13 | 2016-10-19 | 阿里巴巴集团控股有限公司 | Method and system for processing distributed transaction |
| WO2016180164A1 (en) * | 2015-09-29 | 2016-11-17 | 中兴通讯股份有限公司 | Method and apparatus for rolling back distributed transaction |
| CN106610876A (en) * | 2015-10-23 | 2017-05-03 | 中兴通讯股份有限公司 | Method and device for recovering data snapshot |
| US20180137166A1 (en) * | 2016-11-17 | 2018-05-17 | Sap Se | Database Systems Architecture Incorporating Distributed Log |
| US20190188097A1 (en) * | 2017-12-15 | 2019-06-20 | Vmware, Inc. | Mirrored write ahead logs for data storage system |
| CN109783204A (en) * | 2018-12-28 | 2019-05-21 | 咪咕文化科技有限公司 | Distributed transaction processing method, device and storage medium |
| CN110888718A (en) * | 2019-11-27 | 2020-03-17 | 武汉虹旭信息技术有限责任公司 | Method and device for realizing distributed transaction |
Non-Patent Citations (1)
| Title |
|---|
| 张淑玉;: "SQL Server数据库的备份与恢复", 潍坊学院学报, no. 06 * |
Cited By (15)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN112182082A (en) * | 2020-09-24 | 2021-01-05 | 广州巨杉软件开发有限公司 | System and method for realizing strong consistency of transactions across different database engines |
| CN112395102A (en) * | 2020-10-15 | 2021-02-23 | 北京仿真中心 | Distributed database middleware solution method |
| CN114385320B (en) * | 2020-10-22 | 2024-06-25 | 支付宝(杭州)信息技术有限公司 | A distributed transaction processing method and system |
| CN114385320A (en) * | 2020-10-22 | 2022-04-22 | 支付宝(杭州)信息技术有限公司 | Distributed transaction processing method and system |
| CN113760875A (en) * | 2021-01-21 | 2021-12-07 | 北京沃东天骏信息技术有限公司 | Data processing method and device, electronic equipment and storage medium |
| CN112764888A (en) * | 2021-01-21 | 2021-05-07 | 中信银行股份有限公司 | Distributed transaction checking and judging method and system based on log analysis |
| CN112995304A (en) * | 2021-02-08 | 2021-06-18 | 中国工商银行股份有限公司 | Method and device for processing routing service node by two-stage distributed transaction |
| CN112995304B (en) * | 2021-02-08 | 2022-09-23 | 中国工商银行股份有限公司 | Method and device for processing routing service node by two-stage distributed transaction |
| CN113010495A (en) * | 2021-03-19 | 2021-06-22 | 北京三快在线科技有限公司 | Database optimization method and device |
| CN113342481A (en) * | 2021-07-07 | 2021-09-03 | 中国工商银行股份有限公司 | Transaction state confirmation method and device |
| CN113342481B (en) * | 2021-07-07 | 2024-03-26 | 中国工商银行股份有限公司 | Transaction state confirmation method and device |
| CN113868340A (en) * | 2021-10-18 | 2021-12-31 | 中国工商银行股份有限公司 | Distributed transaction processing method, device and electronic device |
| WO2023134518A1 (en) * | 2022-01-17 | 2023-07-20 | 北京奥星贝斯科技有限公司 | Method and apparatus for querying modified content of transaction in database |
| CN115905402A (en) * | 2022-09-26 | 2023-04-04 | 北京奥星贝斯科技有限公司 | Method and device for processing transaction logs |
| CN115905402B (en) * | 2022-09-26 | 2023-07-18 | 北京奥星贝斯科技有限公司 | Method and device for processing transaction logs |
Also Published As
| Publication number | Publication date |
|---|---|
| CN111522631B (en) | 2024-02-06 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN111522631B (en) | Distributed transaction processing method, device, server and medium | |
| US12174854B2 (en) | Versioned hierarchical data structures in a distributed data store | |
| CN111259083A (en) | Distributed transaction processing method and device | |
| US7552149B2 (en) | Querying past versions of data in a distributed database | |
| US5920857A (en) | Efficient optimistic concurrency control and lazy queries for B-trees and other database structures | |
| US10025710B2 (en) | Pattern for integrating primary and secondary data stores in a sharded data domain | |
| US8732143B2 (en) | Reducing locking during database transactions | |
| US20050108276A1 (en) | Methods and system for dynamic database content persistence and information management | |
| US20090012932A1 (en) | Method and System For Data Storage And Management | |
| US7478112B2 (en) | Method and apparatus for initializing data propagation execution for large database replication | |
| WO2021184761A1 (en) | Data access method and apparatus, and data storage method and device | |
| JP2001051879A (en) | Method and system for improved access to nonrelational database | |
| CN106557514A (en) | A kind of distributed transaction rollback method and device | |
| CN103827865A (en) | Improving database caching utilizing asynchronous log-based replication | |
| US11973724B2 (en) | Chatbot framework supporting relational database schema | |
| CN106354732B (en) | A kind of off-line data version conflict solution for supporting concurrently to cooperate with | |
| WO2023124242A1 (en) | Transaction execution method and apparatus, device, and storage medium | |
| US20190354600A1 (en) | Transport handling of foreign key checks | |
| US11106673B2 (en) | Query plan sharing | |
| US8799329B2 (en) | Asynchronously flattening graphs in relational stores | |
| US20230014029A1 (en) | Local indexing for metadata repository objects | |
| US10503752B2 (en) | Delta replication | |
| CN112463447B (en) | An Optimal Method for Realizing Physical Backup Based on Distributed Database | |
| CN102193981B (en) | Method for realizing transaction expiration mechanism in online transaction of graphic database | |
| US20180173805A1 (en) | Application programming interface for detection and extraction of data changes |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| GR01 | Patent grant | ||
| GR01 | Patent grant | ||
| CP03 | Change of name, title or address |
Address after: 310000 Zhejiang Province, Hangzhou City, Xihu District, Xixi Road 543-569 (continuous odd numbers) Building 1, Building 2, 5th Floor, Room 518 Patentee after: Alipay (Hangzhou) Digital Service Technology Co.,Ltd. Country or region after: China Address before: 310000 801-11 section B, 8th floor, 556 Xixi Road, Xihu District, Hangzhou City, Zhejiang Province Patentee before: Alipay (Hangzhou) Information Technology Co., Ltd. Country or region before: China |
|
| CP03 | Change of name, title or address |