[go: up one dir, main page]

CN109885382A - Cross-system distributed transaction processing method and system for distributed transaction processing - Google Patents

Cross-system distributed transaction processing method and system for distributed transaction processing Download PDF

Info

Publication number
CN109885382A
CN109885382A CN201910040738.3A CN201910040738A CN109885382A CN 109885382 A CN109885382 A CN 109885382A CN 201910040738 A CN201910040738 A CN 201910040738A CN 109885382 A CN109885382 A CN 109885382A
Authority
CN
China
Prior art keywords
subsystem
message
distributed transaction
transaction
confirmation
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.)
Pending
Application number
CN201910040738.3A
Other languages
Chinese (zh)
Inventor
王冬冬
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
OneConnect Smart Technology Co Ltd
Original Assignee
OneConnect Smart Technology Co Ltd
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 OneConnect Smart Technology Co Ltd filed Critical OneConnect Smart Technology Co Ltd
Priority to CN201910040738.3A priority Critical patent/CN109885382A/en
Publication of CN109885382A publication Critical patent/CN109885382A/en
Pending legal-status Critical Current

Links

Landscapes

  • Hardware Redundancy (AREA)

Abstract

本发明提供了一种跨系统分布式事务处理方法和分布式事务处理的系统。该方法包括:主系统开启分布式事务;主系统向分系统发送尝试执行事务的尝试请求;分系统响应于尝试请求,执行尝试操作;分系统将尝试操作的执行结果反馈至主系统;主系统根据接收到的执行结果向消息服务系统发送消息,其中,当主系统收到的执行结果均为成功时,向消息服务系统发送确定执行事务的确认消息,当主系统接收到任一执行结果为失败时,向消息服务系统发送回滚执行事务的回滚消息;消息服务系统发布接收到的消息;分系统监听消息服务系统发布的消息,当监听到确认消息时,执行确认操作,当监听到回滚消息时,执行回滚操作。通过本发明,能够避免上述中心化单点现象。

The invention provides a cross-system distributed transaction processing method and a distributed transaction processing system. The method includes: the main system starts a distributed transaction; the main system sends an attempt request to try to execute the transaction to the sub-system; the sub-system performs the trial operation in response to the trial request; the sub-system feeds back the execution result of the trial operation to the main system; the main system Send a message to the message service system according to the received execution result. When the execution result received by the main system is all successful, it sends a confirmation message to the message service system to confirm the execution of the transaction. When the main system receives any execution result as failure , send a rollback message to the message service system to roll back the execution transaction; the message service system publishes the received message; the sub-system monitors the message published by the message service system, when the confirmation message is monitored, the confirmation operation is performed, and the rollback is monitored. message, perform a rollback operation. By means of the present invention, the above-mentioned single point of centralization phenomenon can be avoided.

Description

The system of cross-system distributed transaction processing method and distributing real time system
Technical field
The present invention relates to distributed transaction processing field more particularly to a kind of cross-system distributed transaction processing methods With the system and computer equipment and computer readable storage medium of distributing real time system.
Background technique
Cross-system distributing real time system is to solve asking using fractionation bring cross-system business operation atomicity Topic, such as: mall system is related to marketing system, integral payment system and cashier system etc. can make simultaneously when buying commodity Use the payment of certificate, integral, electronic account, it is therefore desirable to pass through cross-system distributing real time system, it is ensured that the purchase of user Multiple payment process that movement is related to are bought all to execute in an affairs.
In cross-system distributed transaction processing method, it will usually using the scheme of TCC, wherein TCC includes three dynamic Make, is try (attempting operation), confirm (confirmation operation), cancel (rolling back action), the cross-system point of the prior art respectively Cloth issued transaction scheme can have an affairs coordinator, to control the process of entire TCC, related to distributed transaction Interface can all rely on this affairs coordinator, once affairs coordinator goes wrong, will lead to entire service exception, there are centers Change single-point phenomenon.
Therefore it provides a kind of system of cross-system distributed transaction processing method and distributing real time system, to avoid upper Centralization single-point phenomenon is stated, is this field technical issues that need to address.
Summary of the invention
The object of the present invention is to provide the system of a kind of cross-system distributed transaction processing method and distributing real time system, And computer equipment and computer readable storage medium, for solving the above problem of the existing technology.
To achieve the goals above, the present invention provides a kind of cross-system distributed transaction processing methods.
The cross-system distributed transaction processing method includes: that main system opens distributed transaction, wherein distributed transaction packet Several subtransactions are included, each subtransaction is handled by a subsystem;Main system sends the trial for attempting to execute affairs to subsystem Request;Subsystem executes in response to attempting to request and attempts operation;The implementing result for attempting operation is fed back to principal series by subsystem System;Main system sends message to message service system according to the implementing result received, wherein when the execution knot that main system receives When fruit is successfully, is sent to message service system and determine the confirmation message for executing affairs, when main system receives any execution When as a result to fail, the rollback message that rollback executes affairs is sent to message service system;Message service system publication receives Message;The message of subsystem monitoring information service system publication executes confirmation operation, works as prison when listening to confirmation message When hearing rollback message, rolling back action is executed.
To achieve the goals above, the present invention provides a kind of systems of distributing real time system.
The system of the distributing real time system includes main system, subsystem and message service system, wherein main system is used for Distributed transaction is opened, the trial request for attempting to execute affairs is sent to subsystem, wherein distributed transaction includes several sub- things Business, each subtransaction are handled by a subsystem;Subsystem is used to execute in response to attempting to request and attempt operation, and will attempt The implementing result of operation feeds back to main system;Main system is also used to be sent according to the implementing result received to message service system Message, wherein when the implementing result that main system receives is successfully, is sent to message service system and determine execution affairs really Recognize message, when main system receives any implementing result to fail, sends rollback to message service system and execute returning for affairs Roll message;Message service system is for issuing the message received;Subsystem is also used to disappearing for monitoring information service system publication Breath executes confirmation operation when listening to confirmation message, when listening to rollback message, executes rolling back action.
To achieve the goals above, the present invention provides a kind of computer equipments.
The computer equipment include memory, processor and storage on a memory and the meter that can run on a processor Calculation machine program, processor realize the step of any one cross-system distributed transaction processing method provided by the invention when executing program Suddenly.
To achieve the goals above, the present invention provides a kind of computer readable storage mediums.
The computer readable storage medium is stored thereon with computer program, this hair is realized when program is executed by processor The step of any one cross-system distributed transaction processing method of bright offer.
Compared with prior art, at using cross-system distributed transaction processing method provided by the invention and distributed transaction System, computer equipment and the storage medium of reason, at least the following technical effects are achieved:
Confirmation message, the confirmation message that subsystem is issued by monitoring information service system are issued by message service system The each subtransaction of distributed transaction is uniformly processed, when executing the implementing result for attempting operation in any subsystem to fail, lead to Message service system publication rollback message is crossed, the confirmation rollback message that subsystem is issued by monitoring information service system is unified back It rolls, to the consistency of distributed transaction between the different subsystems of entirety guarantee, also, message service system only carries out news release, It is more stable and reliable in cross-system distributing real time system compared to affairs coordinator, it avoids going out using affairs coordinator The problem of existing centralization single-point.
Detailed description of the invention
Fig. 1 is the step flow chart for the cross-system distributed transaction processing method that the embodiment of the present invention one provides;
Fig. 2 is the flow diagram for the cross-system distributed transaction processing method that the embodiment of the present invention one provides;
Fig. 3 is the step flow chart of cross-system distributed transaction processing method provided by Embodiment 2 of the present invention;
Fig. 4 is the step flow chart for the cross-system distributed transaction processing method that the embodiment of the present invention three provides;
Fig. 5 is the block diagram for the distributing real time system system that the embodiment of the present invention six provides;
Fig. 6 is the schematic diagram for the computer equipment that the embodiment of the present invention seven provides.
Specific embodiment
In order to make the objectives, technical solutions, and advantages of the present invention clearer, with reference to the accompanying drawings and embodiments, right The present invention is further elaborated.It should be appreciated that described herein, specific examples are only used to explain the present invention, not For limiting the present invention.Based on the embodiments of the present invention, those of ordinary skill in the art are not before making creative work Every other embodiment obtained is put, shall fall within the protection scope of the present invention.
Embodiment one
The embodiment of the present invention one provides a kind of cross-system distributed transaction processing method, which is related to principal series The execution of affairs itself is completed in interaction between system, message service system and several subsystems by main system and several subsystems, Message service system is used to for the message of main system being broadcast to each subsystem, and each subsystem carries out the monitoring of message.
Specifically, main system is the entrance that distributed transaction is opened, and each subsystem executes the subtransaction in distributed transaction, Message service system is responsible for issuing confirmation message and rollback message that main system is sent, each subsystem monitoring information service system hair The message of cloth executes corresponding movement according to the message listened to.For example, main system is store service system, subsystem is related to Order placement service system, inventory service system etc., store service system occur primary transaction, order placement service system increase are needed to order Single, inventory service system reduces inventory.
Fig. 1 is the step flow chart for the cross-system distributed transaction processing method that the embodiment of the present invention one provides, and Fig. 2 is this The flow diagram for the cross-system distributed transaction processing method that inventive embodiments one provide provides interdepartmental about the embodiment System distributed transaction processing method, specifically includes the following steps:
Step S101: main system opens distributed transaction.
Wherein, the entrance that main system is opened as affairs opens distributed transaction, and a distributed transaction includes several sons Affairs, each subtransaction are handled by a subsystem, for example, when store service system is traded, based on the service system of store System, it includes the distributed transaction for increasing order and reducing two subtransactions of inventory that main system, which is opened,.
Step S102: main system sends the trial request for attempting to execute affairs to subsystem.
After main system opens distributed transaction, is sent to the subsystem of each processing subtransaction attempt to execute affairs first Attempt request, wherein attempting request may include the information such as the Transaction Identifier of subtransaction, for example, store service system is respectively to ordering Single service system and inventory service system, which are sent, attempts request, and the trial request sent to order placement service system includes that mark " increases Additional order is single " Transaction Identifier of this subtransaction, the trial request sent to inventory service system include mark " reducing inventory " this The Transaction Identifier of one subtransaction.
Step S103: subsystem executes in response to attempting to request and attempts operation.
Wherein, it attempts operation (try) namely attempts to execute subtransaction, including completing all business needed for executing subtransaction It checks, and reserves necessary service resources.Each subsystem carries out after receiving trial request for itself subtransaction Attempt operation.
Step S104: the implementing result for attempting operation is fed back to main system by subsystem.
Wherein, implementing result includes successfully and failing, and when implementing result is successfully, illustrates that subsystem executes and attempts operation When, it can complete to operate according to scheduled requirement, it, can not when illustrating that operation is attempted in subsystem execution when implementing result is failure It completes to operate according to scheduled requirement, scheduled require to include executes the time, logic etc. is executed, for example, inventory service system is held When trial of going operates, if inventory has been 0, when executing the trial operation of " reducing inventory ", library can be made by continuing reduction inventory It saves as and negative occurs, be unsatisfactory for executing logic, implementing result is failure.
Attempting operation is not real " dress rehearsal " and " preview " for executing subtransaction, being equivalent to subtransaction is executed, not Really the data in database are modified, no matter each subsystem has what kind of to execute knot after executing trial operation Implementing result can be fed back to main system by fruit.
Step S105: main system sends message to message service system according to the implementing result received.
Wherein, when the implementing result that main system receives is successfully, that is, each subsystem can attempted to operate Middle successful execution subtransaction, each subtransaction for illustrating that distributed transaction includes can be executed normally, can guarantee affairs Consistency determines the confirmation message for executing affairs at this point, sending to message service system, so that each subsystem executes confirmation behaviour Make (confirm), really completes the execution of all subtransactions.
When main system receives any implementing result as failure, illustrate exist not in subtransaction that distributed transaction includes The subtransaction that can normally execute sends rollback to message service system and executes returning for affairs to guarantee the consistency of affairs Message is rolled, so that subsystem executes rolling back action (cancel), will attempt to operate to carry out rollback, all subsystems return to initial shape State.
Step S106: message service system issues the message received.
Message service system is different from affairs coordinator in the prior art, does not do the coordination and management of affairs, only does Affairs coordinator is compared in the publication of message, more stable and reliable in cross-system distributing real time system.Message service system Only as the publisher of message, the message sent to main system is issued, either confirmation message or rollback message, message Service system can be issued as news release side.
Step S107: the message of subsystem monitoring information service system publication executes confirmation when listening to confirmation message Operation executes rolling back action when listening to rollback message.
Each subsystem can integrated message monitor end, by message monitor end monitoring information service system publication message, In, when carrying out news release, can give out information message service system queue, which is made of multiple message, each Message may each comprise the Transaction Identifier of a subtransaction, and subsystem is by the Transaction Identifier in monitoring information, to determine whether to It performs corresponding processing, when certain subsystem listens to the subtransaction that the Transaction Identifier that some message includes is subsystem processing When Transaction Identifier, which needs to handle this message, specifically, when this message is to confirmation message, executes Confirmation operation when this message is rollback message, executes rolling back action.That is, subsystem described in the step listens to really Recognize message, refers to that subsystem listens to the affairs for the subtransaction that the Transaction Identifier that some confirmation message includes is subsystem processing It identifies, subsystem described in the step listens to rollback message, refers to that subsystem listens to the thing that some rollback message includes Business is identified as the Transaction Identifier of the subtransaction of subsystem processing.
Subsystem is given out information by monitoring information service system, and Lai Jinhang confirmation operation or rolling back action can guarantee Distributed transaction is uniformly processed in each subsystem, avoids occurring handling inconsistent situation between different subsystems.
The cross-system distributed transaction processing method provided using the embodiment is disappeared by message service system publication confirmation The each subtransaction of distributed transaction is uniformly processed by the confirmation message that monitoring information service system is issued in breath, subsystem, It is to issue rollback message, subsystem by message service system when failing that any subsystem, which executes and attempts the implementing result of operation, The confirmation rollback message issued by monitoring information service system unifies rollback, integrally to distributed thing between the different subsystems of guarantee The consistency of business, also, message service system only carries out news release, affairs coordinator is compared, in cross-system distributed transaction It is more stable and reliable in processing, avoid the problem that centralization single-point occur using affairs coordinator.
Embodiment two
Second embodiment of the present invention provides a kind of cross-system distributed transactions preferred on the basis of the above embodiment 1 Processing method, relevant portion can refer to above-described embodiment, it should be strongly noted that in this embodiment, main system is corresponding It is provided with the first transaction table in database, decibel is provided with the second transaction table in the corresponding database of each subsystem.First things The record of several distributed transactions is set in table, the record of every distributed transaction include the Transaction Identifier of distributed transaction with And transaction status;The record of several subtransactions is set in the second things table, and the record of every subtransaction includes the thing of subtransaction Business mark and transaction status, the Transaction Identifier of distributed transaction may include the Transaction Identifier of all subtransactions, wherein affairs State include: affairs start, attempt to complete, in rollback, rollback is completed, confirmation neutralizes confirmation and completes.On this basis, Fig. 3 is The step flow chart of cross-system distributed transaction processing method provided by Embodiment 2 of the present invention, as shown in figure 3, the embodiment has Body comprises the following steps that
Step S201: main system is inserted into distributed transaction in the first transaction table.
The note of a new distributed transaction is written when opening distributed transaction in main system first in the first transaction table Record, and set affairs for the transaction status in the record of the new distributed transaction of this and start.
Step S202: main system sends the trial request for attempting to execute affairs to subsystem.
Step S203: subsystem executes in response to attempting to request and attempts operation.
Step S204: subtransaction is inserted into the second transaction table.
The record of a new subtransaction is written after executing trial operation in subsystem in the second transaction table, and will Transaction status in the record of the new subtransaction of this is set as attempting to complete.
Step S205: the implementing result for attempting operation is fed back to main system by subsystem.
Step S206: main system receives the implementing result that each subsystem is sent.
Step S207: the status modifier of distributed transaction in the first transaction table is to attempt to complete by main system.
Step S208: main system sends message to message service system.
Step S209: main system modifies the information in the first transaction table.
Wherein, after main system sends confirmation message to message service system, main system modifies the information in the first transaction table, It is specifically that confirmation is completed by the status modifier of distributed transaction in the first transaction table, main system is sent back to message service system After rolling message, main system modifies the information in the first transaction table, is specifically rollback completion by the status modifier of distributed transaction.
Step S210: message service system issues the message received.
Step S211: the message of subsystem monitoring information service system publication.
Step S212a: for subsystem after listening to confirmation message, the status modifier by subtransaction in the second transaction table is true In recognizing.
Step S213a: subsystem executes confirmation operation.
Step S214a: the status modifier of subtransaction in the second transaction table is that confirmation is completed by subsystem.
Step S212b: the status modifier of subtransaction in the second transaction table is back by subsystem after listening to rollback message In rolling.
Step S213b: subsystem executes rolling back action.
Step S214b: the status modifier of subtransaction in the second transaction table is rollback completion by subsystem.
The cross-system distributed transaction processing method provided using the embodiment, is avoiding occurring using affairs coordinator On the basis of the problem of centralization single-point, main system safeguards the first transaction table, and subsystem safeguards the second things table, in each movement When node is completed, modify the transaction status of respective transaction in the first things table and the second transaction table, can from the first transaction table and The progress of main system and subsystem during distributing real time system is got in second things table.
Embodiment three
The embodiment of the present invention three provides a kind of cross-system distributed transaction preferred on the basis of above-described embodiment two Processing method, relevant portion can refer to above-described embodiment, it should be strongly noted that in this embodiment, cross-system is distributed Transaction methods further relate to scheduler task system, which passes through the thing in the first transaction table and the second things table Business state is scheduled the execution of affairs, wherein completes about between main system, subsystem and message service system three The part of cross-system distributing real time system can refer to the associated description of above-described embodiment two, and details are not described herein again, in this implementation In example, the process that scheduler task system is scheduled the execution of affairs is stressed, Fig. 4 is provided by Embodiment 2 of the present invention The step flow chart of cross-system distributed transaction processing method, on the basis of above-described embodiment two, as shown in figure 4, the implementation Example three include thes steps that as follows:
Step S215: the state of distributed transaction and the second transaction table neutron in the first transaction table of scheduler task system queries The state of affairs.
It wherein, can be according to the affairs of subtransaction in the Transaction Identifier of distributed transaction in the first transaction table and the second transaction table Mark is inquired, for example, the Transaction Identifier of distributed transaction is ABC, corresponding second transaction table neutron in the first transaction table The Transaction Identifier of affairs is A, B or C.
Step S216: when the state of distributed transaction in the first transaction table is confirmation completion, subtransaction in the second transaction table State be attempt complete when, scheduler task system to subsystem send execute confirmation operation order.When in the first transaction table The state of distributed transaction is rollback completion, and the state of subtransaction is scheduler task system when attempting to complete in the second transaction table The order for executing rolling back action is sent to subsystem.
Namely main system has sent confirmation message to message service system, but subsystem is not carried out confirmation behaviour Make, at this point, scheduler task system sends the order for executing confirmation operation to subsystem;Main system is sent out to message service system Rollback message is sent, but subsystem is not carried out rolling back action, at this point, scheduler task system is sent to subsystem executes rollback The order of operation.
Step S217: subsystem executes confirmation operation, receives and execute back when receiving the order for executing confirmation operation When rolling the order of operation, rolling back action is executed.
Wherein, the order for the execution confirmation operation that subsystem is sent in response scheduling task system, after executing confirmation operation, It is that confirmation is completed by the status modifier of subtransaction in the second transaction table;Subsystem is returned in the execution that response scheduling task system is sent The order of operation is rolled, is rollback completion by the status modifier of subtransaction in the second transaction table after executing rolling back action.
The cross-system distributed transaction processing method supplied using the embodiment, is being avoided using affairs coordinator and in occurring The problem of heart single-point, and main system and subsystem are got in distributed transaction from the first transaction table and the second things table On the basis of progress in treatment process, by message service system by main system and subsystem operate inconsistent subtransaction into Row scheduling executes, and specifically, when the message transmitted by message service system executes failure, is repeated by scheduler task system It executes, namely subsystem is not executed normally by scheduler task system confirmation operation or rolling back action retransmission life It enables, ensure that the reliability during cross-system distributing real time system.
Example IV
The embodiment of the present invention four provides a kind of cross-system distributed transaction preferred on the basis of above-described embodiment three Processing method, wherein identical part can refer to the associated description of above-described embodiment two and embodiment three, and details are not described herein again, In the example IV, the record of every distributed transaction further includes the number of retries of subtransaction in the second transaction table, wherein Scheduler task system can repeatedly inquire the state of subtransaction in the state of distributed transaction and the second transaction table in the first transaction table, And corresponding order is sent according to the difference whereabouts subsystem checked and accepted, subsystem often receives the primary life for executing confirmation operation It enables or often receives the primary order for executing rolling back action, corresponding subtransaction number of retries adds 1 in the second transaction table.
In above-mentioned steps S217, after subsystem receives the order for executing confirmation operation, before executing confirmation operation, or Person before executing rolling back action, modifies after subsystem receives the order for executing rolling back action and reads the second transaction table neutron thing It is engaged in corresponding number of retries, wherein the initial value of the corresponding number of retries of subtransaction is 0 in the second transaction table.Subsystem executes When confirmation operation, first according to the corresponding number of retries of subtransaction read in the second transaction table, then according to the ladder time Interval executes confirmation operation;It is first corresponding according to the subtransaction read in the second transaction table when subsystem executes rolling back action Number of retries, according to ladder time interval execute rolling back action.For example, the interval of ladder time interval is 10*2n, unit is Second, n is number of retries, when retrying for the first time, it is spaced 20 seconds execution confirmation operations or rolling back action, when retrying for the second time, It is spaced 40 seconds execution confirmation operations or rolling back action.
The cross-system distributed transaction processing method provided using the embodiment is passing through scheduler task system to subsystem The confirmation operation or rolling back action not executed normally, which retransmit, orders, during guarantee cross-system distributing real time system While reliability, ladder time interval is calculated according to number of retries, is adjusted according to ladder time interval and is executed operation Time, the number retried is more, and the time that interval executes operation is longer, avoids not having in a short time the reason of cannot normally executing There is change and causes to repeat the order wasting of resources.
Embodiment five
It is distributed that the embodiment of the present invention five provides one kind preferred cross-system on the basis of above-described embodiment two to four Transaction methods, wherein identical part can refer to the associated description of above-described embodiment two to example IV, no longer superfluous herein It states, in the embodiment five, is additionally provided with preposition table and main table in the corresponding database of subsystem, wherein preposition table and main table Identical before carrying out distributing real time system, service inquiry operation all carries out on main table, realizes data strong consistency, business DML operation (data manipulation language) is operated on preposition table first, complete to all preposition table handlings Finish, then is synchronized on each autonomous table simultaneously.Specifically:
In step S203, it includes: that subsystem operates data in preposition table that subsystem, which executes the step of attempting operation, packet How the increase, deletion and modification for including data, specifically modify data, related with the content of subtransaction.
In step S213a, subsystem execute confirmation operation the step of include: that subsystem keeps main table synchronous with preposition table;Step In rapid S213b, the step of subsystem executes rolling back action, which includes: subsystem, restores preposition table to executing before attempting operation State, such as UNDO operation is done on preposition table.
Further, operation, confirmation operation and rolling back action can will be attempted and is encapsulated as interface, subsystem is above-mentioned in execution When each operation, by calling corresponding interface to complete operation.
It is possible to further identify the interface for executing trial and operating in such a way that addition is explained, execute confirmation operation Interface and the interface for executing rolling back action.
Specifically: subsystem operate the step of data in preposition table include: subsystem call execute attempt operation connect Mouthful, by executing the data in the preposition table of interface operation for attempting operation;The step packet that subsystem keeps main table synchronous with preposition table Include: subsystem calls the interface for executing confirmation operation, and the interface by executing confirmation operation keeps main table synchronous with preposition table;Divide and is The step of preposition table is restored the state to before executing trial operation of uniting includes: that subsystem calls connecing for execution rolling back action Mouthful, the interface by executing rolling back action restores preposition table to the state executed before attempting operation.
In step S202, when main system sends the trial request for attempting to execute affairs to subsystem, attempting request includes Allocating time and time-out time;
Subsystem is after executing trial operation, before implementing result is fed back to main system, calculates current time and adjusts The difference of the allocating time of the interface of operation is attempted with execution, and judges whether the difference is greater than or equal to time-out time, wherein When difference is greater than or equal to time-out time, the implementing result of operation is attempted for failure, when subsystem can not be according to normally patrolling When collecting the data in the preposition table of operation, the implementing result of operation is attempted for failure, when subsystem can be according to normal logic operation When data and above-mentioned difference in preposition table are less than time-out time, the implementing result for attempting operation is successfully.
Embodiment six
The embodiment of the present invention six provides a kind of system of distributing real time system, which corresponds to above-mentioned cross-system distribution Formula transaction methods, corresponding technical characteristic and technical effect can be referred to mutually, the system packet of the distributing real time system Include main system 10, subsystem 20 and message service system 30.
Main system 10 sends the trial request for attempting to execute affairs to subsystem 20 for opening distributed transaction, wherein Distributed transaction includes several subtransactions, and each subtransaction is handled by a subsystem 20.Subsystem 20 is used in response to attempting Request executes and attempts operation, and the implementing result for attempting operation is fed back to main system 10.Main system 10 is also used to according to reception The implementing result arrived sends message to message service system 30, wherein when the implementing result that main system 10 receives is successfully, It is sent to message service system 30 and determines the confirmation message for executing affairs, when main system 10 receives any implementing result as failure When, the rollback message that rollback executes affairs is sent to message service system 30.Message service system 30 is used to issue to receive Message.Subsystem 20 is also used to the message of the publication of monitoring information service system 30, when listening to confirmation message, executes confirmation behaviour Make, when listening to rollback message, executes rolling back action.
Optionally, the first transaction table is provided in the corresponding database of main system 10, in the corresponding database of subsystem 20 It is provided with the second transaction table;The step of unlatching distributed transaction of main system 10 includes: that main system 10 is inserted into the first transaction table Distributed transaction, and the state that distributed transaction is arranged starts for affairs.Main system 10 is after receiving implementing result, to disappearing Before ceasing the transmission message of service system 30, it is also used to complete the status modifier of distributed transaction for trial;Main system 10 is also used It is that confirmation is completed by the status modifier of distributed transaction after Yu Xiang message service system 30 sends confirmation message;Main system 10 It is rollback completion by the status modifier of distributed transaction after being also used to send rollback message to message service system 30;Subsystem 20 are also used to after executing trial operation, and the state that subtransaction is inserted into the second transaction table, and subtransaction is arranged is to have attempted At;Subsystem 20 is also used to after listening to confirmation message, is confirmation by the status modifier of subtransaction before executing confirmation operation In;Subsystem 20 is also used to after executing confirmation operation, is that confirmation is completed by the status modifier of subtransaction;Subsystem 20 is also used to It is in rollback by the status modifier of subtransaction before executing rolling back action after listening to rollback message;Subsystem 20 is also used to It is rollback completion by the status modifier of subtransaction after executing rolling back action.
Optionally, the system of the distributing real time system further includes scheduler task system, and the scheduler task system is for looking into The state for asking subtransaction in the state of distributed transaction and the second transaction table in the first transaction table, when distributed in the first transaction table The state of affairs is that confirmation is completed, and the state of subtransaction is when attempting to complete in the second transaction table, and scheduler task system is to point being System 20 sends the order for executing confirmation operation;When the state of distributed transaction in the first transaction table is rollback completion, the second affairs The state of subtransaction is when attempting to complete in table, and scheduler task system sends the order for executing rolling back action to subsystem 20;Point When system 20 is also used to receive the order for executing confirmation operation, confirmation operation is executed, receives the order for executing rolling back action When, execute rolling back action.
Optionally, subsystem 20 is also used to after receiving the order for executing confirmation operation, before executing confirmation operation, or Person after receiving the order for executing rolling back action, before executing rolling back action, modifies and reads subtransaction in the second transaction table corresponding to Number of retries, wherein subsystem 20, which often receives the primary order for executing confirmation operation or often receives, primary executes rollback The order of operation, the corresponding number of retries of subtransaction adds 1 in the second transaction table;The step of execution confirmation operation of subsystem 20, wraps Include: subsystem 20 is held according to the corresponding number of retries of the subtransaction read in the second transaction table according to ladder time interval Row confirmation operation;The step of execution rolling back action of subsystem 20 includes: that subsystem 20 is read according in the second transaction table The corresponding number of retries of subtransaction executes rolling back action according to ladder time interval.
Optionally, preposition table and main table are additionally provided in the corresponding database of subsystem 20, wherein preposition table and main table exist It is identical before carrying out distributing real time system;The step of operation is attempted in the execution of subsystem 20 includes: that subsystem 20 operates preposition table In data;The step of execution confirmation operation of subsystem 20 includes: that subsystem 20 keeps main table synchronous with preposition table;Subsystem 20 is held The step of row rolling back action includes: that subsystem 20 restores preposition table to the state executed before attempting operation.
Optionally, subsystem 20 operate the step of data in preposition table include: subsystem 20 call execute attempt operation Interface, pass through execute attempt operation the preposition table of interface operation in data;When attempting to request to include allocating time and is overtime Between;Subsystem 20 is also used to after executing trial operation, before implementing result is fed back to main system 10, calculates current time Whether it is greater than or equal to time-out time with the difference of allocating time, when difference is greater than or equal to time-out time, attempts operation Implementing result is failure.
Optionally, when subsystem 20 can be less than time-out time according to the data in the preposition table of predetermined logic operations and difference When, the implementing result for attempting operation is successfully;When subsystem 20 can not be according to data in the preposition table of predetermined logic operations, The implementing result for attempting operation is failure.
Optionally, the step that subsystem 20 keeps main table synchronous with preposition table includes: that subsystem 20 calls execution confirmation operation Interface, by execute confirmation operation interface keep main table synchronous with preposition table;Preposition table is restored to execution to taste by subsystem 20 The step of state before examination operation includes: that subsystem 20 calls the interface for executing rolling back action, passes through and executes rolling back action Interface restores preposition table to the state executed before attempting operation.
Optionally, addition explain by way of identify execute attempt operation interface, execute confirmation operation interface and Execute the interface of rolling back action.
Embodiment seven
The embodiment of the present invention seven also provides a kind of computer equipment, can such as execute the smart phone of program, tablet computer, Laptop, desktop computer, rack-mount server, blade server, tower server or Cabinet-type server (including Server cluster composed by independent server or multiple servers) etc..The computer equipment 02 of the present embodiment is at least wrapped It includes but is not limited to: memory 021, the processor 022 of connection can be in communication with each other by system bus, as shown in Figure 6.It may be noted that , Fig. 6 illustrates only the computer equipment 02 with component 021-022, it should be understood that being not required for implementing all The component shown, the implementation that can be substituted is more or less component.
In the present embodiment, memory 021 (i.e. readable storage medium storing program for executing) includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory etc.), random access storage device (RAM), static random-access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read only memory (PROM), magnetic storage, magnetic Disk, CD etc..In some embodiments, memory 021 can be the internal storage unit of computer equipment 02, such as the calculating The hard disk or memory of machine equipment 02.In further embodiments, memory 021 is also possible to the external storage of computer equipment 02 The plug-in type hard disk being equipped in equipment, such as the computer equipment 02, intelligent memory card (Smart Media Card, SMC), peace Digital (Secure Digital, SD) card, flash card (Flash Card) etc..Certainly, memory 21 can also both include meter The internal storage unit for calculating machine equipment 02 also includes its External memory equipment.In the present embodiment, memory 021 is commonly used in storage It is installed on the operating system and types of applications software of computer equipment 02, such as the distributing real time system of above-described embodiment is The program code etc. of system.In addition, memory 021 can be also used for temporarily storing all kinds of numbers that has exported or will export According to.
Processor 022 can be in some embodiments central processing unit (Central Processing Unit, CPU), Controller, microcontroller, microprocessor or other data processing chips.The processor 022 is commonly used in control computer equipment 02 overall operation.In the present embodiment, program code or processing number of the processor 022 for being stored in run memory 021 According to, such as the system etc. of operation distributing real time system.
Embodiment eight
The embodiment of the present invention eight also provides a kind of computer readable storage medium, such as flash memory, hard disk, multimedia card, card-type It is memory (for example, SD or DX memory etc.), random access storage device (RAM), static random-access memory (SRAM), read-only Memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read only memory (PROM), magnetic storage Device, disk, CD, server, App are stored thereon with computer program using store etc., real when program is executed by processor Existing corresponding function.The system that the computer readable storage medium of the present embodiment is used for distributed storage issued transaction, by processor The cross-system distributed transaction processing method of above-described embodiment is realized when execution.
The serial number of the above embodiments of the invention is only for description, does not represent the advantages or disadvantages of the embodiments.
Through the above description of the embodiments, those skilled in the art can be understood that above-described embodiment side Method can be realized by means of software and necessary general hardware platform, naturally it is also possible to by hardware, but in many cases The former is more preferably embodiment.
The above is only a preferred embodiment of the present invention, is not intended to limit the scope of the invention, all to utilize this hair Equivalent structure or equivalent flow shift made by bright specification and accompanying drawing content is applied directly or indirectly in other relevant skills Art field, is included within the scope of the present invention.

Claims (10)

1. a kind of cross-system distributed transaction processing method characterized by comprising
Main system opens distributed transaction, wherein the distributed transaction includes several subtransactions, and each subtransaction is by one A subsystem processing;
The main system sends the trial request for attempting to execute affairs to the subsystem;
The subsystem is requested in response to the trial, is executed and is attempted operation;
The implementing result for attempting operation is fed back to the main system by the subsystem;
The main system sends message to message service system according to the implementing result received, wherein when the principal series When the implementing result received of uniting is successfully, Xiang Suoshu message service system sends the confirmation message for determining and executing affairs, When the main system receives any implementing result to fail, Xiang Suoshu message service system sends rollback and executes affairs Rollback message;
The message service system issues the message received;
The message that the subsystem monitors the message service system publication executes confirmation when listening to the confirmation message Operation executes rolling back action when listening to the rollback message.
2. cross-system distributed transaction processing method according to claim 1, which is characterized in that
It is provided with the first transaction table in the corresponding database of the main system, is provided in the corresponding database of the subsystem Two transaction tables;
The step of main system unlatching distributed transaction includes: that the main system is inserted into described point in first transaction table Cloth affairs, and the state that the distributed transaction is arranged starts for affairs;
The cross-system distributed transaction processing method further include: the main system after receiving the implementing result, to It is to attempt to complete by the status modifier of the distributed transaction before the message service system sends the message;The master It is to have confirmed by the status modifier of the distributed transaction after system sends the confirmation message to the message service system At;After the main system sends the rollback message to the message service system, by the status modifier of the distributed transaction For rollback completion;The subsystem is inserted into the subtransaction after executing the trial operation in second transaction table, and The state of the subtransaction is set for trial completion;The subsystem is after listening to the confirmation message, described in execution It is in confirmation by the status modifier of the subtransaction before confirmation operation;The subsystem is after executing the confirmation operation, by institute The status modifier of subtransaction is stated as confirmation completion;The subsystem executes described return after listening to the rollback message It is in rollback by the status modifier of the subtransaction before rolling operation;The subsystem, will be described after executing the rolling back action The status modifier of subtransaction is rollback completion.
3. cross-system distributed transaction processing method according to claim 2, which is characterized in that the cross-system is distributed Transaction methods further include:
Institute in the state of distributed transaction described in first transaction table described in scheduler task system queries and second transaction table State the state of subtransaction;
The state of the distributed transaction described in first transaction table is that confirmation is completed, sub- thing described in second transaction table The state of business is when attempting to complete, and the scheduler task system sends the order for executing confirmation operation to the subsystem;
The state of the distributed transaction described in first transaction table is rollback completion, sub- thing described in second transaction table The state of business is when attempting to complete, and the scheduler task system sends the order for executing rolling back action to the subsystem;
When the subsystem receives the order for executing confirmation operation, confirmation operation is executed, the execution rollback is received When the order of operation, rolling back action is executed.
4. cross-system distributed transaction processing method according to claim 3, which is characterized in that
The cross-system distributed transaction processing method further include: the subsystem receives the order for executing confirmation operation Afterwards, before executing confirmation operation, alternatively, executing rolling back action after the subsystem receives the order for executing rolling back action Before, it modifies and reads the corresponding number of retries of subtransaction described in second transaction table, wherein the subsystem often receives The primary order for executing confirmation operation often receives the primary order for executing rolling back action, second transaction table Described in the corresponding number of retries of subtransaction add 1;
The step of subsystem execution confirmation operation includes: that the subsystem is read according in second transaction table The corresponding number of retries of the subtransaction arrived executes the confirmation operation according to ladder time interval;The subsystem executes The step of rolling back action includes: that the subsystem is corresponding according to the subtransaction read in second transaction table Number of retries, execute the rolling back action according to ladder time interval.
5. cross-system distributed transaction processing method according to claim 2, which is characterized in that
Preposition table and main table are additionally provided in the corresponding database of the subsystem, wherein the preposition table and the main table exist It is identical before carrying out the distributing real time system;
It includes: that the subsystem operates data in the preposition table that the subsystem, which executes the step of attempting operation,;
The step of subsystem execution confirmation operation includes: that the subsystem keeps the main table synchronous with the preposition table;
The subsystem executes the step of rolling back action, and to include: the subsystem restore the preposition table to executing the trial State before operation.
6. cross-system distributed transaction processing method according to claim 5, which is characterized in that
It includes: that the subsystem is called to execute and attempts connecing for operation that the subsystem, which operates the step of data in the preposition table, Mouthful, the data attempted in preposition table described in the interface operation of operation are executed by described;
The trial request includes allocating time and time-out time;
The cross-system distributed transaction processing method further include: the subsystem is after executing the trial operation, by institute It states implementing result to feed back to before the main system, calculates current time and whether the difference of the allocating time is greater than or equal to The time-out time, when the difference is greater than or equal to the time-out time, the implementing result for attempting operation is failure.
7. cross-system distributed transaction processing method according to claim 6, which is characterized in that when the subsystem can When being less than the time-out time according to the data in preposition table described in predetermined logic operations and the difference, the trial operation Implementing result is successfully;It is described to taste when the subsystem can not be according to data in preposition table described in predetermined logic operations The implementing result of examination operation is failure.
8. a kind of system of distributing real time system, which is characterized in that including main system, subsystem and message service system, In,
The main system sends the trial request for attempting to execute affairs for opening distributed transaction, Xiang Suoshu subsystem, wherein The distributed transaction includes several subtransactions, and each subtransaction is handled by a subsystem;
Implementing result of the subsystem for executing and attempting operation, and the trial is operated in response to trial request Feed back to the main system;
The main system is also used to send message to the message service system according to the implementing result received, wherein When the implementing result that the main system receives is successfully, Xiang Suoshu message service system, which is sent, determines execution affairs Confirmation message, when the main system receives any implementing result to fail, Xiang Suoshu message service system is sent back Rolling executes the rollback message of affairs;
The message service system is for issuing the message received;
The message that the subsystem is also used to monitor the message service system publication is held when listening to the confirmation message Row confirmation operation executes rolling back action when listening to the rollback message.
9. a kind of computer equipment, can run on a memory and on a processor including memory, processor and storage The step of computer program, the processor realizes any one of claim 1 to 7 the method when executing described program.
10. a kind of computer readable storage medium, is stored thereon with computer program, it is characterised in that: described program is processed The step of any one of claim 1 to 7 the method is realized when device executes.
CN201910040738.3A 2019-01-16 2019-01-16 Cross-system distributed transaction processing method and system for distributed transaction processing Pending CN109885382A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910040738.3A CN109885382A (en) 2019-01-16 2019-01-16 Cross-system distributed transaction processing method and system for distributed transaction processing

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910040738.3A CN109885382A (en) 2019-01-16 2019-01-16 Cross-system distributed transaction processing method and system for distributed transaction processing

Publications (1)

Publication Number Publication Date
CN109885382A true CN109885382A (en) 2019-06-14

Family

ID=66926165

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910040738.3A Pending CN109885382A (en) 2019-01-16 2019-01-16 Cross-system distributed transaction processing method and system for distributed transaction processing

Country Status (1)

Country Link
CN (1) CN109885382A (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111580939A (en) * 2020-04-01 2020-08-25 微梦创科网络科技(中国)有限公司 Method and device for hierarchical asynchronous transaction processing
CN111679930A (en) * 2020-06-08 2020-09-18 中国银行股份有限公司 Single-point rollback method and system for CICS online transaction
CN112148436A (en) * 2020-09-23 2020-12-29 厦门市易联众易惠科技有限公司 Decentralized TCC transaction management method, device, equipment and system
CN112799827A (en) * 2019-11-14 2021-05-14 广州凡科互联网科技股份有限公司 An Assurance Method for Cross-Service Database Transactions
CN113051044A (en) * 2021-04-20 2021-06-29 中国工商银行股份有限公司 Distributed transaction processing method and device based on non-service architecture
CN114168358A (en) * 2021-10-22 2022-03-11 济南浪潮数据技术有限公司 Message processing method and device, distributed transaction processing system and computer equipment
CN114579259A (en) * 2020-11-30 2022-06-03 腾讯科技(深圳)有限公司 Method, device, device and medium for processing sub-logic tasks

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO1998039868A2 (en) * 1997-03-03 1998-09-11 Mylex Corporation Reliable event delivery system
US6529932B1 (en) * 1998-04-01 2003-03-04 Microsoft Corporation Method and system for distributed transaction processing with asynchronous message delivery
CN105893395A (en) * 2015-01-26 2016-08-24 阿里巴巴集团控股有限公司 Message re-checking method and system of distributed transaction
CN106775959A (en) * 2016-12-06 2017-05-31 上海亿账通互联网科技有限公司 Distributed transaction processing method and system
CN107332906A (en) * 2017-06-30 2017-11-07 郑州云海信息技术有限公司 Distributed system office management method and device
CN107766080A (en) * 2016-08-23 2018-03-06 阿里巴巴集团控股有限公司 transaction message processing method, device, equipment and system
CN108491252A (en) * 2018-03-13 2018-09-04 万惠投资管理有限公司 distributed transaction processing method and distributed system

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO1998039868A2 (en) * 1997-03-03 1998-09-11 Mylex Corporation Reliable event delivery system
US6529932B1 (en) * 1998-04-01 2003-03-04 Microsoft Corporation Method and system for distributed transaction processing with asynchronous message delivery
CN105893395A (en) * 2015-01-26 2016-08-24 阿里巴巴集团控股有限公司 Message re-checking method and system of distributed transaction
CN107766080A (en) * 2016-08-23 2018-03-06 阿里巴巴集团控股有限公司 transaction message processing method, device, equipment and system
CN106775959A (en) * 2016-12-06 2017-05-31 上海亿账通互联网科技有限公司 Distributed transaction processing method and system
WO2018103318A1 (en) * 2016-12-06 2018-06-14 上海壹账通金融科技有限公司 Distributed transaction handling method and system
CN107332906A (en) * 2017-06-30 2017-11-07 郑州云海信息技术有限公司 Distributed system office management method and device
CN108491252A (en) * 2018-03-13 2018-09-04 万惠投资管理有限公司 distributed transaction processing method and distributed system

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
王成良;李立新;叶剑;秦小龙;: "一种基于JMS的分布式异步事务处理模型设计", 信息工程大学学报, no. 02, 15 April 2010 (2010-04-15) *
陈卫峰, 陈志强, 张丽, 高文焕: "基于CORBA的集装箱检查系统运行检查分系统的设计", 计算机工程, no. 04, 20 April 2001 (2001-04-20) *

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112799827A (en) * 2019-11-14 2021-05-14 广州凡科互联网科技股份有限公司 An Assurance Method for Cross-Service Database Transactions
CN111580939A (en) * 2020-04-01 2020-08-25 微梦创科网络科技(中国)有限公司 Method and device for hierarchical asynchronous transaction processing
CN111580939B (en) * 2020-04-01 2023-09-01 微梦创科网络科技(中国)有限公司 Method and device for hierarchical and asynchronous transaction processing
CN111679930A (en) * 2020-06-08 2020-09-18 中国银行股份有限公司 Single-point rollback method and system for CICS online transaction
CN111679930B (en) * 2020-06-08 2023-06-20 中国银行股份有限公司 Single-point rollback method and system for CICS online transaction
CN112148436A (en) * 2020-09-23 2020-12-29 厦门市易联众易惠科技有限公司 Decentralized TCC transaction management method, device, equipment and system
CN112148436B (en) * 2020-09-23 2023-06-20 厦门市易联众易惠科技有限公司 Decentralized TCC transaction management method, device, equipment and system
CN114579259A (en) * 2020-11-30 2022-06-03 腾讯科技(深圳)有限公司 Method, device, device and medium for processing sub-logic tasks
CN114579259B (en) * 2020-11-30 2025-03-28 腾讯科技(深圳)有限公司 Sub-logical task processing method, device, equipment and medium
CN113051044A (en) * 2021-04-20 2021-06-29 中国工商银行股份有限公司 Distributed transaction processing method and device based on non-service architecture
CN114168358A (en) * 2021-10-22 2022-03-11 济南浪潮数据技术有限公司 Message processing method and device, distributed transaction processing system and computer equipment

Similar Documents

Publication Publication Date Title
CN109885382A (en) Cross-system distributed transaction processing method and system for distributed transaction processing
CN111752957B (en) Sale locking method and system based on caching
CN106775959B (en) distributed transaction processing method and system
CN114625533B (en) Distributed task scheduling method, device, electronic device and storage medium
CN110708196B (en) Data processing method and device
CN111667334B (en) Review failed order processing method, device, computer equipment and storage medium
CN113760500B (en) Business processing method, device, server and medium
CN111274052A (en) Data distribution method, server, and computer-readable storage medium
CN105700937A (en) Multi-thread task processing method and device
CN107038182A (en) Divide the completeness inspection method and device of table data
CN113179301A (en) File downloading method and device, storage medium and electronic device
CN108845866A (en) The method and apparatus for handling distributed transaction
CN110955523A (en) A business processing method and device
CN108446171A (en) Electronic device, distributed system execute method for allocating tasks and storage medium
US11243979B1 (en) Asynchronous propagation of database events
CN113177052A (en) Method and device for processing service data consistency of distributed system
CN112445860A (en) Method and device for processing distributed transaction
CN112632093A (en) Work order processing method, device, system, storage medium and program product
CN113760522A (en) Task processing method and device
CN120256032A (en) Transaction execution method, device, electronic device and storage medium
CN111049938A (en) Message notification method and device, electronic equipment and readable storage medium
CN117114613A (en) A process engine, method, equipment and program product for business process control
CN116662445A (en) Data synchronization method, device, equipment and medium
JP4571090B2 (en) Scheduler program, server system, scheduler device
CN114691394A (en) E-commerce data processing method, device and system

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
WD01 Invention patent application deemed withdrawn after publication
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20190614