CN102306197B - Device and method for guaranteeing consistency of data-source-crossing operation results - Google Patents

Device and method for guaranteeing consistency of data-source-crossing operation results Download PDF

Info

Publication number
CN102306197B
CN102306197B CN 201110283994 CN201110283994A CN102306197B CN 102306197 B CN102306197 B CN 102306197B CN 201110283994 CN201110283994 CN 201110283994 CN 201110283994 A CN201110283994 A CN 201110283994A CN 102306197 B CN102306197 B CN 102306197B
Authority
CN
China
Prior art keywords
data source
message
global transaction
local matter
described message
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.)
Active
Application number
CN 201110283994
Other languages
Chinese (zh)
Other versions
CN102306197A (en
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.)
Yonyou Network Technology Co Ltd
Original Assignee
Yonyou Software 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 Yonyou Software Co Ltd filed Critical Yonyou Software Co Ltd
Priority to CN 201110283994 priority Critical patent/CN102306197B/en
Publication of CN102306197A publication Critical patent/CN102306197A/en
Application granted granted Critical
Publication of CN102306197B publication Critical patent/CN102306197B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention provides a method for guaranteeing consistency of data-source-crossing operation results, and the method comprises the following steps: opening a local transaction of a message middleware; when a message from a designated rank of the message middleware is received, establishing a global transaction according to the message; executing the local transaction of a second data source, wherein the message middleware is a first data source; acquiring required transaction data from the second data source according to a transaction processing requirement of the message; when transaction processing is finished, storing a generated processing result into the second data source; and initiating a process for submitting or rolling back the global transaction according to a returned processing result by firstly submitting or rolling back the local transaction of the second data source and then submitting or rolling back the local transaction of the message middleware; and releasing a related resource of the global transaction after the global transaction is submitted or rolled back successfully. The invention also provides a device for guaranteeing consistency of data-source-crossing operation results. Under the mode of a non-XA (auxiliary amplifier) protocol, the consistency of the data-source-crossing operation results can be guaranteed.

Description

The conforming apparatus and method of data source operation result are striden in assurance
Technical field
The present invention relates to the simultaneous techniques field, in particular to guaranteeing to stride the conforming apparatus and method of data source operation result.
Background technology
In the distributed production environment of current enterprise-level, the use of a plurality of data sources is keeping high-level efficiency, the high operating result consistency problem that has also brought the global transaction that how to guarantee to stride data source in available.The solution of main flow generally is to utilize independently task manager at present, uses the two stages submission process of XA agreement to guarantee its consistance (the detailed XA standard that sees also the definition of X/OPEN tissue).But the XA agreement has following drawback:
1. the affairs itself of using the XA agreement to realize will be used some keystone resourceses of data source, and this feasible performance to data source has certain influence.
2. according to the XA standard, the XA agreement can require data source to lock the relevant resource of these affairs after submitting to successfully in advance; Finish up to subordinate phase (real submission or rollback), the lock of related resource just can be released.In case unusual in subordinate phase, blocked resource will inaccessible in a very long time before affairs are finished, this is unacceptable at a lot of curstomer`s sites.
This lock be a kind of " hard lock " even---connect break, database instance even entire machine restart this lock and can not discharge, this is inappropriate to some exigent system of data access real-time.
Be not difficult to find out all drawbacks of using the XA agreement to do distributed transaction management from the above description, under some specific situations, may can cause the relevant data inaccessible of time affairs because of the locking to resource, thereby give the client with very poor experience.
Therefore, how guaranteeing to stride the consistance of the distributed global transaction of data source under the situation of not using the XA agreement, is to need the problem that solves.
Summary of the invention
Technical matters to be solved by this invention is, a kind of data synchronization technology is provided, and can guarantee to stride the consistance of the distributed global transaction of data source under the situation of not using the XA agreement.
According to an aspect of the present invention, provide a kind of assurance to stride the conforming device of data source operation result, comprise: message processing unit, the local matter of message-oriented middleware is opened in request, message during reception is lined up from the appointment of described message-oriented middleware, send to create first request of a global transaction and according to described message when receiving the result of returning from Application service element to the global transaction control module, send to described global transaction control module and to initiate to submit to or second request of the process of the described global transaction of rollback and when the order that receives from described global transaction control module, the local matter of submission or the described message-oriented middleware of rollback, the affairs of the local matter of described message-oriented middleware for moving at described message-oriented middleware, described message-oriented middleware is first data source; Described global transaction control module, in described first when request that receives from described message processing unit, create a described global transaction, begin the local matter of second data source and in described second when request that receives from described message processing unit, initiate to submit to the process of described global transaction, submit the local matter of described second data source earlier to, order described message processing unit to submit the local matter of described message-oriented middleware to then, with submission or the rollback process of finishing described global transaction, after described global transaction submission or the rollback success, discharge the related resource of described global transaction, described global transaction is the affairs of striding described first data source and the operation of described second data source, the affairs of the local matter of described second data source for moving in described second data source; Described Application service element, business processing needs according to described message obtain required business datum from described second data source, when described business processing finishes, the result that generates is saved to described second data source, described result is back to described message processing unit.
In technique scheme, preferably, described message processing unit also is used for when receiving described message, asks described global transaction control module to check whether described message is that message and the reception of handling for the first time is sent to described Application service element from the sign of the described global transaction of described global transaction control module and with described sign; Described global transaction control module also is used for when definite described message was handled for the first time, request distributes corresponding sign for the described global transaction of creating, and described sign is sent to described message processing unit, in definite described message when not being for the first time processed, continue to handle described message according to the state of the described global transaction of the correspondence of recovering to come out.
In technique scheme, preferably, described global transaction control module comprises: the status modifier module, before described Application service element is handled described message, the state of described global transaction is set for carrying out business processing status, when carrying out the processing procedure of described message, the state of the local matter of the state of the local matter of described message-oriented middleware and described second data source all is set to carry out business processing status and when initiating to submit the process of described global transaction to, the state of revising described global transaction is for just in submit state, revise the state of local matter of described message-oriented middleware for just in submit state, the state of revising the local matter of described second data source in advance is the submission completion status, when the local matter of the local matter that monitors described second data source and described message-oriented middleware is all submitted to when finishing, the state of revising the local matter of described message-oriented middleware earlier is the submission completion status, revise the state of described global transaction then for submitting completion status to, discharge the related resource of described global transaction.
In technique scheme, preferably, described global transaction control module can also comprise: recover module, before the local matter of submitting described second data source to, as if occurring unusual and restarting, the local matter of the described message-oriented middleware of rollback then, during the appointment that described message is turned back to described message-oriented middleware is lined up, after system is recovered, described Application service element will be handled described message again, before the local matter of submitting described message-oriented middleware to, as if occurring unusual and restarting, the local matter of the described message-oriented middleware of rollback then, during the appointment that described message is turned back to described message-oriented middleware is lined up, after system is recovered, described Application service element will be handled this message again, and owing to finish (the local matter state by fierceness can be inquired about) at second data source processing of this message, so processing finishes the back the described message of deletion and at the state of the local matter of revising described message-oriented middleware for before submitting completion status to, as if occurring unusual and restarting, then in described message-oriented middleware, delete described message.
In technique scheme, preferably, described global transaction control module can also comprise: control module, when the state of the local matter of the state of the local matter of described message-oriented middleware and described second data source all is set to carry out business processing status, permission adds the local matter of other data source in described global transaction, when the state of the local matter of the state of the local matter of described message-oriented middleware and described second data source is all submitted completion status to, do not allow in described global transaction, to add the local matter of described other data source; The status information of the local matter of the status information of the local matter of described message-oriented middleware, described second data source and the status information of described global transaction are kept in described second data source, and described second data source is the database data source.
Pass through technique scheme, can use data manipulation that non-XA protocol mode guarantees to stride data source consistance as a result---utilize the state that is kept at the global transaction in second data source, come two-way DBMS(second data source of checking) and the MOM(message-oriented middleware, first data source) this two classes data source is controlled to guarantee the operating result consistance of affairs business processing by absolute state.
According to another aspect of the invention, also provide a kind of assurance to stride the conforming method of data source operation result, comprise: step 602, open the local matter of message-oriented middleware, when the message that receives in lining up from the appointment of described message-oriented middleware, according to global transaction of described message establishing, begin the local matter of second data source, wherein, described message-oriented middleware is first data source, the affairs of the local matter of described message-oriented middleware for moving at described message-oriented middleware, the affairs of the local matter of described second data source for moving in described second data source, described global transaction are the affairs of striding described first data source and the operation of described second data source; Step 604 is obtained required business datum according to the business processing needs of described message from described second data source, when described business processing finishes, the result that generates is saved to described second data source; Step 606, initiate the process of submission or the described global transaction of rollback according to the described result of returning, the local matter of elder generation's submission or described second data source of rollback, submit to then or the local matter of the described message-oriented middleware of rollback, with submission or the rollback process of finishing described global transaction, after described global transaction submission or the rollback success, discharge the related resource of described global transaction.
In technique scheme, preferably, described step 602 can also comprise: judge whether described message is the message of handling for the first time, if judge described message for handling for the first time, then create described global transaction and request and be described global transaction allocation identification, according to the described message of described identification process, not for the first time processed if judge described message, then the state according to the described global transaction of the correspondence of recovering to come out continues to handle described message.
In technique scheme, preferably, described step 602 can also comprise: before handling described message, the state of described global transaction is set for carrying out business processing status, when carrying out the processing procedure of described message, the state of the local matter of the state of the local matter of described message-oriented middleware and described second data source all is set to carry out business processing status; Described step 606 also comprises: when initiating to submit the process of described global transaction to, the state of revising described global transaction is for just in submit state, revise the state of local matter of described message-oriented middleware for just in submit state, the state of revising the local matter of described second data source in advance is the submission completion status, when the local matter of the local matter that monitors described second data source and described message-oriented middleware is all submitted to when finishing, the state of revising the local matter of described message-oriented middleware earlier is the submission completion status, revise the state of described global transaction then for submitting completion status to, discharge the related resource of described global transaction.
In technique scheme, preferably, described step 606 can also comprise: before the local matter of submitting described second data source to, as if occurring unusual and restarting, the local matter of the local matter of the described message-oriented middleware of rollback and described second data source then, the appointment that described message is got back to described message-oriented middleware is handled described message in lining up again; Before submitting the local matter of described message-oriented middleware to, if occur unusual and restart, the local matter of the described message-oriented middleware of rollback then, the appointment that described message is turned back to described message-oriented middleware is handled described message in lining up again, and processing finishes the described message of back deletion; Before the state of the local matter of revising described message-oriented middleware is the submission completion status, as if occurring unusual and restarting, then in described message-oriented middleware, delete described message.
In technique scheme, preferably, when the state of the local matter of the state of the local matter of described message-oriented middleware and described second data source all is set to carry out business processing status, permission adds the local matter of other data source in described global transaction, when the state of the local matter of the state of the local matter of described message-oriented middleware and described second data source is all submitted completion status to, do not allow in described global transaction, to add the local matter of described other data source, the status information of the local matter of described message-oriented middleware, the status information of the local matter of described second data source and the status information of described global transaction are kept in described second data source, described second data source is database data source (for example, OLTP data source).
Pass through technique scheme, can use data manipulation that non-XA protocol mode guarantees to stride data source consistance as a result---utilize the state that is kept at the global transaction in second data source, come double-core to DBMS(second data source) and the MOM(message-oriented middleware, first data source) this two classes data source is controlled to guarantee the operating result consistance of affairs business processing by absolute state.
Description of drawings
Fig. 1 shows the block diagram that guarantees to stride the conforming system of data source operation result according to an embodiment of the invention;
Fig. 2 shows the sequential chart of multimode cooperation according to an embodiment of the invention;
Fig. 3 shows the state variation synoptic diagram of global transaction according to an embodiment of the invention;
Fig. 4 shows the branch's state variation synoptic diagram in the global transaction according to an embodiment of the invention;
Fig. 5 shows the block diagram that guarantees to stride the conforming device of data source operation result according to an embodiment of the invention; And
Fig. 6 shows the process flow diagram that guarantees to stride the conforming method of data source operation result according to an embodiment of the invention.
Embodiment
In order more to be expressly understood above-mentioned purpose of the present invention, feature and advantage, below in conjunction with the drawings and specific embodiments the present invention is further described in detail.
Set forth a lot of details in the following description so that fully understand the present invention, still, the present invention can also adopt other to be different from other modes described here and implement, and therefore, the present invention is not limited to the restriction of following public specific embodiment.
Being described as follows of the english abbreviation of Chu Xianing hereinafter:
Message-oriented middleware: English name Message Oriented Middleware, be called for short MOM, be a kind of basic software that makes up the high-efficiency reliable data transfer platform.
Data base management system (DBMS): English title Database Management System, be called for short DBMS, also be a kind of basic software, major function is reliable memory and the efficient inquiry service that data are provided to upper layer application.
Affairs: be the set of sequence of operations, these operations will be made as a whole participate in (atomicities of affairs) in the upper layer logic; Final result has only two, or all operations all comes into force, or all failures.
Local matter: refer generally to the affairs moved in the individual data source.
Global transaction: generally be the affairs of striding data source or interdepartmental system.
Task manager: generally be stride data source, transaction management system independently.Its function is to safeguard the global transaction (coordinating the local matter of each data source of these affairs of participation) of striding data source, and guarantees the consistance as a result under its distributed environment.
At first illustrate on the whole according to technical scheme of the present invention in conjunction with the embodiment shown in Fig. 1.
As shown in Figure 1, task manager 102 can provide service as a kind of middleware system to upper layer application (application layer) by the transaction management interface; Encapsulated for example data base management system (DBMS) 104 among the figure of DBMS(downwards, can be for the OLTP data source and as second data source), the MOM(message-oriented middleware 106 among the figure for example, as first data source) and the service (being positioned at the enterprise information system layer) that provides of other EIS, for task manager 102 provides unified interface.
The nucleus module of task manager 102 has following three formations:
Global transaction identity management 1022: this module mainly is responsible for safeguarding the global transaction sign.Be to guarantee uniqueness, among the DBMS, and provide unified calling interface to other modules with global transaction identification information persistence.
Message processing unit 1024: in multilayered model, upper layer application has been evolved to become to serve one by one and be embedded in task manager or other the middleware system and has been moved.Message processing unit 1024 has encapsulated the correlative detail of affairs and JMS Message Processing, according to JMS standard (seeing also the JMS standard in detail), uses as long as realize corresponding message data processing logic, and this has greatly simplified the difficulty of upper layer application.
Global transaction control module 1026: this module mainly is responsible for the management of global transaction, and the interface of issued transaction outwards is provided, as establishment, submission, rollback, overtime monitoring etc.A global transaction will comprise two branches: branch is for the treatment of the operation of MOM, and another branch is for the treatment of the operation of DBMS.Management (comprising the management to global transaction branch) to global transaction realizes by the state-maintenance to global transaction.In fact, the state of global transaction is exactly the state that message is carried out business processing, in order to guarantee the consistance as a result of global operation, the information of global transaction and state also can be persisted in the DBMS system in design, so just the state of operation of global transaction and the affairs of business operation can be bound, thereby guarantee that message is not weighed the processing of not losing.
The process that can see realization by top description is: receive a message and handle this message from MOM, needed other business datums of business processing of corresponding this message data are extracted in DBMS, and the result that will generate after business logic processing is finished stores among the DBMS and goes; If but add reliability requirement---can guarantee also that under abnormal conditions message is not weighed the processing of not losing, this just needs task manager 102 to coordinate the local matter of two data sources by global transaction, guarantees consistance as a result with this.For fear of using the XA agreement to give the influence that brings, will use the 2-way state verification mechanism to control the state of global transaction.How will describe with the sequential chart of a multimode cooperation below realizes using 2-way state to check to control the state of global transaction:
As shown in Figure 2,1, will set up message processing unit 1024 and message-oriented middleware 106, data base management system (DBMS) 104(second data source, for example OLTP data source), the connection of Application service element 108; 2, from data base management system (DBMS), recover global transaction sign operating position; 3, from data base management system (DBMS), recover uncompleted affairs.After all initialization of each module (1,2 and 3) are finished, the message processing unit 1024 that task manager 102 provides will be blocked on the message queue of MOM, wait for that a very new message request arrives, this is the prerequisite (seeing 4 and 5) that triggers a complete issued transaction flow process.
4, the local matter of a message-oriented middleware 106 is opened in message processing unit 1024 requests; 5, from specified queue, receive message according to service needed request message middleware; 6, return to the professional corresponding message of message processing unit; 7, in a single day message processing unit 1024 receives message, and request global transaction control module 1026 checks whether this message has registered corresponding affairs; 8, global transaction control module 1026 checks whether these message have registered corresponding global transaction (processed message); 9, message processing unit 1024 is received to return and is checked the result; 10, if find it is processed affairs, determine to go to finish these affairs according to the state of the affairs of correspondence, if handle this message for the first time, then ask global transaction control module 1026 to create a global transaction; 11, a global transaction sign is given in global transaction control module 1026 request global transaction identity management unit 1022; 12, global transaction identity management unit 1022 distributes a global transaction to identify to global transaction control module 1026; 13, create global transaction, with branch's (two local matters of MOM and DBMS) initialization of this global transaction.14, begin the local matter of second data source (DBMS, data base management system (DBMS)); 15, create business process and finish and call before the business processing flow at this message, with the status modifier of global transaction for carrying out business processing.
16, global transaction control module 1026 is sent to message processing unit 1024 with the sign of the global transaction of establishment; 17, Application service element 108 calls business processing logic and handles the message that receives; 18, Application service element 108 obtains the business datum that business processing needs to second data source when handling; 19, the second data sources are returned the business datum that Application service element 108 needs; 20, the processing messages data; 21, result is back to message processing unit; 22, after message processing unit 1024 receives result, initiate to submit to the flow process of global transaction; 24, with the status modifier of global transaction for just in submit state, and with the status modifier of the local matter of second data source dress for submitting to, the status modifier of the local matter of message-oriented middleware for just in submit state, with these status information persistences in second data source; 25, the local matter of second data source is submitted in 1026 orders of global transaction control module to; 26, global transaction control module 1026 command messages processing units 1024 are submitted the local matter of message-oriented middleware to; 27, after message processing unit 1024 receives instruction, submit the local matter of message-oriented middleware to; 28, message-oriented middleware 106 returns submits to successful information to give message processing unit; 29, the local matter of message processing unit 1024 notice global transaction control modules 1026 message-oriented middlewares 106 has been submitted success to; 30, after global transaction control module 1026 receives notice, revise the local matter state of message-oriented middleware for submitting to; 31, revise the global transaction state for submitting to, and with in these status information persistences and second data source; 32, discharge the related resource of global transaction at last from receiving that message just finished to the global transaction of the whole process of handling to this, finish this processing of request.
In Fig. 2, only provide message data and handled the successfully flow process of back global transaction submission, consider if message data is handled the rollback flow process of failure back global transaction and submitted to flow process very similar, therefore will no longer provide the mutual cooperation sequential chart of global transaction rollback.In addition, what provide in Fig. 2 is normal professional sequential chart, all will carry out rollback in strict accordance with sequential to any unusual/failure in the real implementation procedure and handle, and could guarantee the consistance as a result of its global transaction like this.To explain in detail that below this system is how to guarantee under various abnormal conditions operating result conforming, in sequential chart, can see that 23 ~ 32 are the submission of global transaction or rollback process, next just restart at each step supposing the system, how to be resumed.
(1) system exception and restarting before 25:
Can find the affairs at all operations place of second data source execution are rolled back because of system restart, therefore, will be without any the record of handling the corresponding affairs of this message in second data source; And this message corresponding local matter in message-oriented middleware also falls rollback, and message has been got back in the formation of message-oriented middleware again; System recovers this message of back and will be removed and handle (the same with the process of carrying out handling for the first time) again, so this situation can not cause any result inconsistent.
(2) system exception and restarting before 26 or 27 or 28:
System exception and restarting before message-oriented middleware is submitted local matter to, to cause local matter (local matter of the MOM branch) rollback of message-oriented middleware, during the formulation that message is got back to message-oriented middleware is lined up, flow process when handling this message according to the first time (is obtained global transaction, check that the state of global transaction is to the state of modification global transaction) handle the local matter of this message correspondence again, and the local matter of DBMS branch has been submitted at this moment, therefore the global transaction control module is when initialization, to recover the global transaction of this MOM message correspondence return, the state of its global transaction is for submitting to, the state of MOM branch is for submitting to, and the state of DBMS branch is for submitting to, this expression is at all successfully processing end of the corresponding business processing of this message data, next to do be directly from MOM this message of deletion and the related resource that discharges global transaction just, same this situation can not cause any result inconsistent yet.
(3) system exception and restarting before 29 or 30:
Though the state of the global transaction in DBMS is the same with above-mentioned situation, but in fact the local matter of MOM branch is submitted (processed message does not exist) to, only need to go to delete this message like that by normal process, discharge the corresponding resource of global transaction then, this situation can not cause any result inconsistent yet.
(4) system exception and restarting before 31:
After restarting, the global transaction control module recovers affairs from DBMS after, its global transaction state is for submitting to, and the state of these two branches of DBMS and MOM all is to have submitted to finish, this moment, processing procedure was simpler, only need to revise the global transaction state for submitting the related resource of finishing and discharge global transaction to, it is inconsistent also not have any result in this case.
(5) system exception and restarting before 32:
Unusual and restarting systems take place before this, the global transaction control module recovers affairs from DBMS after, find that the global transaction state has been to submit to finish, only need to discharge the relevant resource of global transaction, it is inconsistent also not have any result in this case.
Though do not use the XA agreement according to technical scheme of the present invention as can be seen from top detailed description, can both guarantee the consistance of local matter on MOM that global transaction is coordinated and these two data sources of DBMS in any situation.
The state variation situation of global transaction is described below in conjunction with Fig. 3.
As shown in Figure 3, step 302, the state of global transaction begins with original state, if initiatively rollback of transaction initiator then enters step 312, is in and carries out branch's rollback state.Step 304, in the business processing stage of each branch (for example local matter of the local matter of message-oriented middleware, second data source), the state of each branch is set to carry out business processing status, the state of global transaction is also for carrying out business processing status, the branch that in global transaction, can add at this moment, other.If it is overtime to carry out business processing, then enter step 312, be in and carry out branch's rollback state.Step 306, the state of revising global transaction after all branch's business processing are finished is the business processing completion status, at this moment can not add other branch in global transaction, if business processing is overtime or failure, then enter step 312, carry out step 314 then, enter branch's rollback completion status.Step 308, receive the submission transaction information from caller after, the state of global transaction can be modified to is submitting transaction status to, and triggers the submission flow process of each branch, each branch's state is for carrying out submit state.Step 310 needs to monitor the state of all branches during this period, all submits to up to each branch and finishes, and is that global transaction is submitted completion status at last with the global transaction status modifier, has so just finished the life cycle of a global transaction.Any active initiation or failure (such as service fail or overtime) can trigger the rollback flow process of global transaction in whole life.
The state variation situation of global transaction branch is described below in conjunction with Fig. 4.
As shown in Figure 4, be the state variation synoptic diagram of a branch (local matter of the local matter of message-oriented middleware or OLTP data source) of global transaction, step 402, the same with global transaction, the state of branch also is to begin with original state.Step 404, its state can be modified to and carry out business processing before calling real business processing flow.Step 404 is finished dealing with until business processing, and the state of branch can be revised accordingly, is revised as the business processing completion status.Ensuing state need be waited for the triggering of global transaction, carries out branch and submits to or the rollback flow process.Judge whether to handle successfully, if processing success or global transaction promoter initiate to submit instruction to, then enter step 408, enter and carry out submit state, enter step 410 then, after submission is finished, branch's state is revised as the submission completion status.If judgment processing failure or global transaction promoter require rollback, then enter step 412, enter branch and carrying out the rollback state, enter step 414 then, enter branch's rollback completion status, after submitting to or rollback finishes, the life cycle of branch finishes.
Fig. 5 shows the block diagram that guarantees to stride the conforming device of data source operation result according to an embodiment of the invention.
As shown in Figure 5, guarantee to stride the conforming device 500 of data source operation result according to an embodiment of the invention, comprise: message processing unit 502, the local matter of message-oriented middleware is opened in request, message during reception is lined up from the appointment of described message-oriented middleware, send first request of creating a global transaction and according to described message when receiving the result of returning from Application service element 506 to global transaction control module 504, send second request of the process of initiating to submit to described global transaction and when the order that receives from described global transaction control module 504 to described global transaction control module 504, submit the local matter of described message-oriented middleware to, the affairs of the local matter of described message-oriented middleware for moving at described message-oriented middleware, described message-oriented middleware is first data source; Described global transaction control module 504, in described first when request that receives from described message processing unit 502, create a described global transaction, begin the local matter of second data source and in described second when request that receives from described message processing unit 502, initiate the process of submission or the described global transaction of rollback, the local matter of elder generation's submission or described second data source of rollback, order the local matter of described message processing unit 502 submissions or the described message-oriented middleware of rollback then, with submission or the rollback process of finishing described global transaction, after described global transaction submission or the rollback success, discharge the related resource of described global transaction, described global transaction is the affairs of striding described first data source and the operation of described second data source, the affairs of the local matter of described second data source for moving in described second data source; Described Application service element 506, business processing needs according to described message obtain required business datum from described second data source, when described business processing finishes, the result that generates is saved to described second data source, described result is back to described message processing unit 502.
In technique scheme, preferably, described message processing unit 502 also is used for when receiving described message, asks described global transaction control module 504 to check whether described message is that message and the reception of handling for the first time is sent to described Application service element 506 from the sign of the described global transaction of described global transaction control module 504 and with described sign; Described global transaction control module 504 also is used for when definite described message was handled for the first time, request distributes corresponding sign for the described global transaction of creating, and described sign is sent to described message processing unit 502, in definite described message when not being for the first time processed, continue to handle described message according to the state of the described global transaction of the correspondence of recovering to come out.
In technique scheme, preferably, described global transaction control module 504 comprises: status modifier module 5042, before described Application service element 506 is handled described message, the state of described global transaction is set for carrying out business processing status, when carrying out the processing procedure of described message, the state of the local matter of the state of the local matter of described message-oriented middleware and described second data source all is set to carry out business processing status and when initiating to submit the process of described global transaction to, the state of revising described global transaction is for just in submit state, revise the state of local matter of described message-oriented middleware for just in submit state, the state of revising the local matter of described second data source in advance is the submission completion status, when the local matter of the local matter that monitors described second data source and described message-oriented middleware is all submitted to when finishing, the state of revising the local matter of described message-oriented middleware earlier is the submission completion status, revise the state of described global transaction then for submitting completion status to, discharge the related resource of described global transaction.
In technique scheme, preferably, described global transaction control module 504 can also comprise: recover module 5044, before the local matter of submitting described second data source to, as if occurring unusual and restarting, the local matter of the described message-oriented middleware of rollback then, during the appointment that described message is turned back to described message-oriented middleware is lined up, after system is recovered, described Application service element 506 will be handled described message again, before the local matter of submitting described message-oriented middleware to, as if occurring unusual and restarting, the local matter of the described message-oriented middleware of rollback then, during the appointment that described message is turned back to described message-oriented middleware is lined up, after system is recovered, described Application service element 506 is handled this message again, and owing to finish (the local matter state by fierceness can be inquired about) at second data source processing of this message, so as long as the state of local matter that finishes the back described message of deletion and revising described message-oriented middleware in processing is for before submitting completion status to, as if occurring unusual and restarting, then in described message-oriented middleware, delete described message.
In technique scheme, preferably, described global transaction control module 504 can also comprise: control module 5046, when the state of the local matter of the state of the local matter of described message-oriented middleware and described second data source all is set to carry out business processing status, permission adds the local matter of other data source in described global transaction, when the state of the local matter of the state of the local matter of described message-oriented middleware and described second data source is all submitted completion status to, do not allow in described global transaction, to add the local matter of described other data source; The status information of the local matter of the status information of the local matter of described message-oriented middleware, described second data source and the status information of described global transaction are kept in described second data source, described second data source is database data source (for example, OLTP data source).
Pass through technique scheme, can use data manipulation that non-XA protocol mode guarantees to stride data source consistance as a result---utilize the state that is kept at the global transaction in second data source, come double-core to DBMS(second data source) and the MOM(message-oriented middleware, first data source) this two classes data source is controlled to guarantee the operating result consistance of affairs business processing by absolute state.
Fig. 6 shows the process flow diagram that guarantees to stride the conforming method of data source operation result according to an embodiment of the invention.
As shown in Figure 6, guarantee to stride the conforming method of data source operation result according to an embodiment of the invention, comprise: step 602, open the local matter of message-oriented middleware, when the message that receives in lining up from the appointment of described message-oriented middleware, according to global transaction of described message establishing, the local matter of order beginning second data source, wherein, described message-oriented middleware is first data source, the affairs of the local matter of described message-oriented middleware for moving at described message-oriented middleware, the affairs of the local matter of described second data source for moving in described second data source, described global transaction are the affairs of striding described first data source and the operation of described second data source; Step 604 is obtained required business datum according to the business processing needs of described message from described second data source, when described business processing finishes, the result that generates is saved to described second data source; Step 606, initiate the process of submission or the described global transaction of rollback according to the described result of returning, the local matter of elder generation's submission or described second data source of rollback, submit to then or the local matter of the described message-oriented middleware of rollback, with submission or the rollback process of finishing described global transaction, after described global transaction submission or the rollback success, discharge the related resource of described global transaction.
In technique scheme, preferably, described step 602 can also comprise: judge whether described message is the message of handling for the first time, if judge described message for handling for the first time, then create described global transaction and request and be described global transaction allocation identification, according to the described message of described identification process, not for the first time processed if judge described message, then the state according to the described global transaction of the correspondence of recovering to come out continues to handle described message.
In technique scheme, preferably, described step 602 can also comprise: before handling described message, the state of described global transaction is set for carrying out business processing status, when carrying out the processing procedure of described message, the state of the local matter of the state of the local matter of described message-oriented middleware and described second data source all is set to carry out business processing status; Described step 606 also comprises: when initiating to submit the process of described global transaction to, the state of revising described global transaction is for just in submit state, revise the state of local matter of described message-oriented middleware for just in submit state, the state of revising the local matter of described second data source in advance is the submission completion status, when the local matter of the local matter that monitors described second data source and described message-oriented middleware is all submitted to when finishing, the state of revising the local matter of described message-oriented middleware earlier is the submission completion status, revise the state of described global transaction then for submitting completion status to, discharge the related resource of described global transaction.
In technique scheme, preferably, described step 606 can also comprise: before the local matter of submitting described second data source to, as if occurring unusual and restarting, the local matter of the local matter of the described message-oriented middleware of rollback and described second data source then, the appointment that described message is got back to described message-oriented middleware is handled described message in lining up again; Before the local matter of submitting described message-oriented middleware to, if occur unusual and restart, the local matter of the described message-oriented middleware of rollback then is during the appointment that described message is turned back to described message-oriented middleware is lined up, again handle described message, processing finishes the described message of back deletion; Before the state of the local matter of revising described message-oriented middleware is the submission completion status, as if occurring unusual and restarting, then in described message-oriented middleware, delete described message.
In technique scheme, preferably, when the state of the local matter of the state of the local matter of described message-oriented middleware and described second data source all is set to carry out business processing status, permission adds the local matter of other data source in described global transaction, when the state of the local matter of the state of the local matter of described message-oriented middleware and described second data source is all submitted completion status to, do not allow in described global transaction, to add the local matter of described other data source, the status information of the local matter of described message-oriented middleware, the status information of the local matter of described second data source and the status information of described global transaction are kept in described second data source, described second data source is database data source (for example, OLTP data source).
Pass through technique scheme, can realize using non-XA protocol mode guarantee to stride data source operating result consistance---it is right to utilize the state that is kept at the global transaction in the DBMS to do double-core, come DBMS and this two classes data source of MOM in the coherent system, control to guarantee the operating result consistance of affairs business processing by absolute state.By this realization mechanism, both avoided adverse effect and the potential risk of using the XA consultation to bring, can guarantee absolute consistent affairs again simultaneously.
The above is the preferred embodiments of the present invention only, is not limited to the present invention, and for a person skilled in the art, the present invention can have various changes and variation.Within the spirit and principles in the present invention all, any modification of doing, be equal to replacement, improvement etc., all should be included within protection scope of the present invention.

Claims (10)

1. the conforming device of data source operation result is striden in an assurance, it is characterized in that, comprising:
Message processing unit, the local matter of message-oriented middleware is opened in request, message during reception is lined up from the appointment of described message-oriented middleware, send to create first request of a global transaction and according to described message when receiving the result of returning from Application service element to the global transaction control module, send to described global transaction control module and to initiate to submit to or second request of the process of the described global transaction of rollback and when the order that receives from described global transaction control module, the local matter of submission or the described message-oriented middleware of rollback, the affairs of the local matter of described message-oriented middleware for moving at described message-oriented middleware, described message-oriented middleware is first data source;
Described global transaction control module, in described first when request that receives from described message processing unit, create a described global transaction, begin the local matter of second data source and in described second when request that receives from described message processing unit, initiate the process of submission or the described global transaction of rollback, the local matter of elder generation's submission or described second data source of rollback, order the local matter of described message processing unit submission or the described message-oriented middleware of rollback then, with submission or the rollback process of finishing described global transaction, after described global transaction is submitted to successfully, discharge the related resource of described global transaction, described global transaction is the affairs of striding described first data source and the operation of described second data source, the affairs of the local matter of described second data source for moving in described second data source;
Described Application service element, business processing needs according to described message obtain required business datum from described second data source, when described business processing finishes, the result that generates is saved to described second data source, described result is back to described message processing unit.
2. the conforming device of data source operation result is striden in assurance according to claim 1, it is characterized in that, described message processing unit also is used for when receiving described message, asks described global transaction control module to check whether described message is that message and the reception of handling for the first time is sent to described Application service element from the sign of the described global transaction of described global transaction control module and with described sign;
Described global transaction control module also is used for when definite described message was handled for the first time, request distributes corresponding sign for the described global transaction of creating, and described sign is sent to described message processing unit, in definite described message when not being for the first time processed, continue to handle described message according to the state of the described global transaction of the correspondence of recovering to come out.
3. the conforming device of data source operation result is striden in assurance according to claim 1, it is characterized in that, described global transaction control module comprises:
The status modifier module, before described Application service element is handled described message, the state of described global transaction is set for carrying out business processing status, when carrying out the processing procedure of described message, the state of the local matter of the state of the local matter of described message-oriented middleware and described second data source all is set to carry out business processing status and when initiating to submit the process of described global transaction to, the state of revising described global transaction is for just in submit state, revise the state of local matter of described message-oriented middleware for just in submit state, the state of revising the local matter of described second data source in advance is the submission completion status, when the local matter of the local matter that monitors described second data source and described message-oriented middleware is all submitted to when finishing, the state of revising the local matter of described message-oriented middleware earlier is the submission completion status, revise the state of described global transaction then for submitting completion status to, discharge the related resource of described global transaction.
4. the conforming device of data source operation result is striden in assurance according to claim 3, it is characterized in that, described global transaction control module also comprises:
Recover module, before the local matter of submitting described second data source to, as if occurring unusual and restarting, the local matter of the described message-oriented middleware of rollback then, during the appointment that described message is turned back to described message-oriented middleware is lined up, described Application service element will be handled described message again, before the local matter of submitting described message-oriented middleware to, as if occurring unusual and restarting, the local matter of the described message-oriented middleware of rollback then, during the appointment that described message is turned back to described message-oriented middleware is lined up, described Application service element will be handled described message again, processing finish the back described message of deletion and at the state of the local matter of revising described message-oriented middleware for before submitting completion status to, if occur unusual and restart, the described message of deletion in described message-oriented middleware then.
5. the conforming device of data source operation result is striden in assurance according to claim 4, it is characterized in that, described global transaction control module also comprises:
Control module, when the state of the local matter of the state of the local matter of described message-oriented middleware and described second data source all is set to carry out business processing status, permission adds the local matter of other data source in described global transaction, when the state of the local matter of the state of the local matter of described message-oriented middleware and described second data source is all submitted completion status to, do not allow in described global transaction, to add the local matter of described other data source;
The status information of the local matter of the status information of the local matter of described message-oriented middleware, described second data source and the status information of described global transaction are kept in described second data source, and described second data source is the database data source.
6. the conforming method of data source operation result is striden in an assurance, it is characterized in that, comprising:
Step 602, open the local matter of message-oriented middleware, when the message that receives in lining up from the appointment of described message-oriented middleware, according to global transaction of described message establishing, begin the local matter of second data source, wherein, described message-oriented middleware is first data source, the affairs of the local matter of described message-oriented middleware for moving at described message-oriented middleware, the affairs of the local matter of described second data source for moving in described second data source, described global transaction are the affairs of striding described first data source and the operation of described second data source;
Step 604 is obtained required business datum according to the business processing needs of described message from described second data source, when described business processing finishes, the result that generates is saved to described second data source;
Step 606, initiate the process of submission or the described global transaction of rollback according to the described result of returning, the local matter of elder generation's submission or described second data source of rollback, submit to then or the local matter of the described message-oriented middleware of rollback, with submission or the rollback process of finishing described global transaction, after described global transaction is submitted to successfully, discharge the related resource of described global transaction.
7. the conforming method of data source operation result is striden in assurance according to claim 6, it is characterized in that, described step 602 also comprises: judge whether described message is the message of handling for the first time, if judge described message for handling for the first time, then create described global transaction and request and be described global transaction allocation identification, according to the described message of described identification process, be not for the first time processed if judge described message, then the state according to the described global transaction of the correspondence of recovering to come out continues to handle described message.
8. the conforming method of data source operation result is striden in assurance according to claim 6, it is characterized in that, described step 602 also comprises: before handling described message, the state of described global transaction is set for carrying out business processing status, when carrying out the processing procedure of described message, the state of the local matter of the state of the local matter of described message-oriented middleware and described second data source all is set to carry out business processing status;
Described step 606 also comprises: when initiating to submit the process of described global transaction to, the state of revising described global transaction is for just in submit state, revise the state of local matter of described message-oriented middleware for just in submit state, the state of revising the local matter of described second data source in advance is the submission completion status, when the local matter of the local matter that monitors described second data source and described message-oriented middleware is all submitted to when finishing, the state of revising the local matter of described message-oriented middleware earlier is the submission completion status, revise the state of described global transaction then for submitting completion status to, discharge the related resource of described global transaction.
9. the conforming method of data source operation result is striden in assurance according to claim 8, it is characterized in that, described step 606 also comprises: before the local matter of submitting described second data source to, as if occurring unusual and restarting, the local matter of the described message-oriented middleware of rollback then, the appointment that described message turns back to described message-oriented middleware is handled described message in lining up again;
Before the local matter of submitting described message-oriented middleware to, if occur unusual and restart, the local matter of the described message-oriented middleware of rollback then is during the appointment that described message is turned back to described message-oriented middleware is lined up, again handle described message, processing finishes the described message of back deletion;
Before the state of the local matter of revising described message-oriented middleware is the submission completion status, as if occurring unusual and restarting, then in described message-oriented middleware, delete described message.
10. the conforming method of data source operation result is striden in assurance according to claim 8, it is characterized in that, when the state of the local matter of the state of the local matter of described message-oriented middleware and described second data source all is set to carry out business processing status, permission adds the local matter of other data source in described global transaction, when the state of the local matter of the state of the local matter of described message-oriented middleware and described second data source is all submitted completion status to, do not allow in described global transaction, to add the local matter of described other data source, the status information of the local matter of described message-oriented middleware, the status information of the local matter of described second data source and the status information of described global transaction are kept in described second data source, and described second data source is the database data source.
CN 201110283994 2011-09-22 2011-09-22 Device and method for guaranteeing consistency of data-source-crossing operation results Active CN102306197B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN 201110283994 CN102306197B (en) 2011-09-22 2011-09-22 Device and method for guaranteeing consistency of data-source-crossing operation results

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN 201110283994 CN102306197B (en) 2011-09-22 2011-09-22 Device and method for guaranteeing consistency of data-source-crossing operation results

Publications (2)

Publication Number Publication Date
CN102306197A CN102306197A (en) 2012-01-04
CN102306197B true CN102306197B (en) 2013-07-03

Family

ID=45380059

Family Applications (1)

Application Number Title Priority Date Filing Date
CN 201110283994 Active CN102306197B (en) 2011-09-22 2011-09-22 Device and method for guaranteeing consistency of data-source-crossing operation results

Country Status (1)

Country Link
CN (1) CN102306197B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106970846A (en) * 2017-03-15 2017-07-21 北京驰波信息工程有限公司 Payment system message is controlled and processing method, device

Families Citing this family (28)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103020147B (en) * 2012-11-22 2015-10-21 用友软件股份有限公司 Data integrated system and data integrating method
CN103019826B (en) * 2012-12-27 2016-08-03 亚信科技(中国)有限公司 A kind of method and apparatus of issued transaction
CN103995868B (en) * 2014-05-20 2017-07-21 科大国创软件股份有限公司 The global transaction manager and transaction methods of Based on Distributed system
CN105447000A (en) * 2014-07-31 2016-03-30 阿里巴巴集团控股有限公司 Transactional message transmission method and device
CN105592117B (en) * 2014-10-23 2019-01-25 阿里巴巴集团控股有限公司 A kind for the treatment of method and apparatus of transaction message
CN105608086B (en) * 2014-11-17 2021-07-27 中兴通讯股份有限公司 Transaction processing method and device for distributed database system
CN105893395B (en) * 2015-01-26 2019-04-02 阿里巴巴集团控股有限公司 The message of distributed transaction returns checking method and its system
CN106033562B (en) * 2015-03-16 2019-12-06 阿里巴巴集团控股有限公司 Transaction processing method, transaction participating node and transaction coordinating node
CN104809022A (en) * 2015-03-25 2015-07-29 百度在线网络技术(北京)有限公司 Synchronizing method, device and system
CN106156119A (en) * 2015-04-07 2016-11-23 阿里巴巴集团控股有限公司 A kind of distributed transaction communication means, system and device
CN106155775B (en) * 2015-04-28 2020-02-21 菜鸟智能物流控股有限公司 Message processing method, device and system
CN107045454B (en) * 2016-02-06 2020-06-26 华为技术有限公司 Cross-process distributed transaction control method and related system
CN107623703B (en) * 2016-07-13 2021-08-17 中兴通讯股份有限公司 Synchronization method, device and system for Global Transaction Identifier (GTID)
CN106775959B (en) * 2016-12-06 2017-12-22 上海壹账通金融科技有限公司 distributed transaction processing method and system
CN107580032B (en) * 2017-08-23 2020-04-24 阿里巴巴集团控股有限公司 Data processing method, device and equipment
CN109426552A (en) * 2017-09-05 2019-03-05 阿里巴巴集团控股有限公司 Transaction methods, device and system and electronic equipment
CN108009027B (en) * 2017-11-23 2019-09-20 北京百度网讯科技有限公司 Implementation method, device, equipment and the storage medium of queue message consistency
CN108279986B (en) * 2017-12-29 2023-10-03 亿阳安全技术有限公司 Distributed transaction processing method and device
CN110502317B (en) * 2018-05-16 2024-03-01 北京京东尚科信息技术有限公司 Transaction management method and device
CN108845867A (en) * 2018-07-16 2018-11-20 郑州云海信息技术有限公司 A kind of distributed transaction management method, apparatus, system and storage medium
CN109491765B (en) * 2018-10-09 2021-07-30 创新先进技术有限公司 Method and device for processing cross-domain service request
CN109408203B (en) * 2018-11-01 2019-10-18 无锡华云数据技术服务有限公司 A kind of implementation method, device, the computing system of queue message consistency
CN110532069B (en) * 2019-08-22 2021-06-29 北京宝兰德软件股份有限公司 Distributed transaction submitting method and device
CN110659300A (en) * 2019-09-05 2020-01-07 达疆网络科技(上海)有限公司 Method for ensuring final consistency of distributed system data
CN111190914A (en) * 2019-12-31 2020-05-22 武汉中海庭数据技术有限公司 Intermediate layer data safe submission method, device and equipment applied to high-precision map and storage medium
CN111639090A (en) * 2020-06-03 2020-09-08 山东汇贸电子口岸有限公司 Data consistency control method and system in data extraction process
CN112069196B (en) * 2020-11-12 2021-03-23 腾讯科技(深圳)有限公司 Database-based data processing method, device, equipment and readable storage medium
CN112765126A (en) * 2020-12-31 2021-05-07 金蝶软件(中国)有限公司 Database transaction management method and device, computer equipment and storage medium

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2004025461A2 (en) * 2002-09-12 2004-03-25 International Business Machines Corporation A data processing system adapted to integrating non-homogeneous processes
CN101046815A (en) * 2007-03-14 2007-10-03 华为技术有限公司 Affairs coordinator, resource using end, service end and distribution affairs process method
US7984020B2 (en) * 2007-12-06 2011-07-19 Sap Ag System and method for business object sync-point and rollback framework
CN101799808A (en) * 2009-02-10 2010-08-11 中国移动通信集团公司 Data processing method and system thereof
CN101673275B (en) * 2009-08-11 2012-07-25 东软集团股份有限公司 Method and device for ensuring consistent affairs inside database
CN102023974B (en) * 2009-09-14 2012-08-22 中国移动通信集团公司 Method, device and system for processing message by message queue

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106970846A (en) * 2017-03-15 2017-07-21 北京驰波信息工程有限公司 Payment system message is controlled and processing method, device
CN106970846B (en) * 2017-03-15 2019-08-16 银清科技(北京)有限公司 The control of payment system message and processing method, device

Also Published As

Publication number Publication date
CN102306197A (en) 2012-01-04

Similar Documents

Publication Publication Date Title
CN102306197B (en) Device and method for guaranteeing consistency of data-source-crossing operation results
US7779298B2 (en) Distributed job manager recovery
CN110941446B (en) Version release method and device based on multi-environment offline task
CN103562904B (en) Backseat playback operation in service
US5893128A (en) Distributed work flow management
CN105354113B (en) A kind of system and method for server, management server
CN104657158B (en) The method and apparatus of business processing in a kind of operation system
CN110942387A (en) Method and system for establishing electric ticket business function based on micro-service
CN110611707B (en) Task scheduling method and device
CN104077362A (en) Online mass data processing system and method
CN111400104B (en) Data synchronization method and device, electronic equipment and storage medium
US5706500A (en) Selective transaction oriented recovery and restart for message-driven business applications
CN110138876A (en) Task deployment method, apparatus, equipment and platform
CN113064744A (en) Task processing method and device, computer readable medium and electronic equipment
CN102317913A (en) Transaction recovery method and apparatus
CN104793981B (en) A kind of online snapshot management method and device of cluster virtual machine
CN111507720B (en) Data snapshot method and device based on block chain and computer readable storage medium
CA2498064C (en) A data processing system adapted to integrating non-homogeneous processes
CN103562853B (en) Method and system for managing examples of program codes
CN114787836A (en) System and method for remotely executing one or more arbitrarily defined workflows
CN103631594A (en) Asynchronous scheduling method and asynchronous scheduling system for general flow
EP4130982A1 (en) Network-based solution module deployment platform
CN113220480B (en) Distributed data task cross-cloud scheduling system and method
CN114138364A (en) Application information loading control system and application information loading method
CN112685142A (en) Distributed data processing system

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
C56 Change in the name or address of the patentee

Owner name: YONYOU NETWORK TECHNOLOGY CO., LTD.

Free format text: FORMER NAME: UFIDA SOFTWARE CO., LTD.

CP03 Change of name, title or address

Address after: 100094 Haidian District North Road, Beijing, No. 68

Patentee after: Yonyou Network Technology Co., Ltd.

Address before: 100094 Beijing city Haidian District North Road No. 68, UFIDA Software Park

Patentee before: UFIDA Software Co., Ltd.