CN114493873A - Transaction processing method, device, equipment and storage medium - Google Patents

Transaction processing method, device, equipment and storage medium Download PDF

Info

Publication number
CN114493873A
CN114493873A CN202210087003.8A CN202210087003A CN114493873A CN 114493873 A CN114493873 A CN 114493873A CN 202210087003 A CN202210087003 A CN 202210087003A CN 114493873 A CN114493873 A CN 114493873A
Authority
CN
China
Prior art keywords
transaction
processing
fund
distributed
node
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
CN202210087003.8A
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.)
Agricultural Bank of China
Original Assignee
Agricultural Bank of China
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 Agricultural Bank of China filed Critical Agricultural Bank of China
Priority to CN202210087003.8A priority Critical patent/CN114493873A/en
Publication of CN114493873A publication Critical patent/CN114493873A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/04Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/02Banking, e.g. interest calculation or account maintenance

Landscapes

  • Business, Economics & Management (AREA)
  • Accounting & Taxation (AREA)
  • Finance (AREA)
  • Engineering & Computer Science (AREA)
  • Development Economics (AREA)
  • Economics (AREA)
  • Marketing (AREA)
  • Strategic Management (AREA)
  • Technology Law (AREA)
  • Physics & Mathematics (AREA)
  • General Business, Economics & Management (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Financial Or Insurance-Related Operations Such As Payment And Settlement (AREA)

Abstract

The embodiment of the application discloses a transaction processing method, a device, equipment and a storage medium. Wherein, the method comprises the following steps: according to the SAGA distributed transaction mode, carrying out transaction processing on any transaction in a transaction execution sequence corresponding to the distributed transaction; if the processing node of the transaction is a fund transfer node, acquiring fund flow information of the transaction, sending the fund flow information to a fund processing center, and preparing and processing the fund transfer of the transaction by the fund processing center based on a TCC (transmission control center) distributed transaction mode according to the fund flow information; judging whether any processing node of the transaction passes execution, if so, judging whether the transaction is a target transaction of a preset arrangement sequence in a transaction execution sequence; if yes, sending a fund transfer confirmation instruction to the fund processing center, and confirming the fund transfer preparation processing of any transaction in the transaction execution sequence by the fund processing center. The embodiment of the application improves the safety of funds in the transaction processing process.

Description

Transaction processing method, device, equipment and storage medium
Technical Field
The embodiment of the application relates to the technical field of data processing, in particular to a transaction processing method, a transaction processing device, transaction processing equipment and a storage medium.
Background
In the past, most of core bank systems of large banks in China are built on the basis of a host technology and by adopting a centralized architecture. However, with the increasing business transactions, the core bank system changes part of applications from centralized deployment to distributed deployment, and the transactions of the host system of the core bank system are moved down, so that unilateral dependence on the host is reduced, autonomous control is realized, and safety risk and cost are reduced.
In the process of moving down the distributed system for the transaction of the core bank host system, a Smart Alliance Grid Architecture (SAGA) mode with high adaptation degree with the transaction processing logic of the bank host system is usually adopted to process the distributed transaction in the distributed system. However, the SAGA model has difficulty in guaranteeing transaction consistency in a distributed system, and a problem of fund security.
Disclosure of Invention
The embodiment of the application provides a transaction processing method, a transaction processing device, transaction processing equipment and a storage medium, so that the fund security in the transaction processing process is improved.
In a first aspect, an embodiment of the present application provides a transaction processing method, including:
according to the SAGA distributed transaction mode, carrying out transaction processing on any transaction in a transaction execution sequence corresponding to the distributed transaction; wherein the transaction processing comprises at least one processing node;
if the processing node of the transaction is a fund transfer node, acquiring fund flow information of the transaction, and sending the fund flow information to a fund processing center for the fund processing center to prepare and process fund transfer for the transaction based on a TCC (transmission control center) distributed transaction mode according to the fund flow information;
judging whether any processing node of the transaction passes execution, if so, judging whether the transaction is a target transaction of a preset arrangement sequence in a transaction execution sequence;
and if so, sending a fund transfer confirmation instruction to the fund processing center for confirming the fund transfer preparation processing of any transaction in the transaction execution sequence by the fund processing center.
In a second aspect, an embodiment of the present application further provides a transaction processing apparatus, including:
the transaction processing module is used for carrying out transaction processing on any transaction in a transaction execution sequence corresponding to the distributed transaction according to the SAGA distributed transaction mode; wherein the transaction processing comprises at least one processing node;
the fund flow information sending module is used for acquiring the fund flow information of the transaction and sending the fund flow information to a fund processing center if the processing node of the transaction is a fund transfer node, so that the fund processing center can prepare and process fund transfer on the basis of a TCC (transmission control center) distributed transaction mode according to the fund flow information;
the target transaction judging module is used for judging whether any processing node of the transaction passes execution, and if yes, judging whether the transaction is a target transaction of a preset arrangement sequence in a transaction execution sequence;
and the confirmation instruction sending module is used for sending a fund transfer confirmation instruction to the fund processing center if the transaction is a target transaction with a preset arrangement sequence in the transaction execution sequence, so that the fund processing center confirms the fund transfer preparation processing of any transaction in the transaction execution sequence.
In a third aspect, an embodiment of the present application further provides an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, where the processor executes the program to implement the transaction processing method according to any one of the embodiments of the present application.
In a fourth aspect, this application further provides a computer-readable storage medium, on which a computer program is stored, where the program, when executed by a processor, implements the transaction processing method according to any one of the embodiments of the application.
According to the SAGA distributed transaction mode, transaction processing is carried out on the transaction corresponding to the distributed transaction; if the processing node of the transaction is a fund transfer node, the fund processing center performs fund transfer preparation processing on the transaction based on a TCC (Try-Confirm-Cancel) distributed transaction mode according to the fund flow information; if any processing node including the fund processing node passes in any transaction of the distributed transactions, the distributed transaction processing can be determined to be executed, and the fund processing center can confirm the fund transfer preparation processing of any transaction in the transaction execution sequence. According to the scheme, the fund processing is extracted from the transaction processing logic, the nodes related to the fund processing in the transaction processing are processed according to the TCC mode, and other non-fund transactions are processed according to the transaction implementation logic of the SAGA mode, so that the transaction processing in the process that the host system moves down to the distributed system is realized, and the fund security in the transaction processing process is improved.
Drawings
Fig. 1 is a schematic flow chart of a transaction processing method according to an embodiment of the present application;
fig. 2 is a schematic flow chart of a transaction processing method according to a second embodiment of the present application;
fig. 3 is a block diagram of a transaction processing device according to a third embodiment of the present application;
fig. 4 is a schematic structural diagram of an electronic device in a fourth embodiment of the present application.
Detailed Description
The present invention will be described in further detail with reference to the drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not to be construed as limiting the invention. It should be further noted that, for the convenience of description, only some of the structures related to the present invention are shown in the drawings, not all of the structures.
Example one
Fig. 1 is a schematic flow chart of a transaction processing method according to an embodiment of the present application, where the present embodiment is applicable to a case where a host system moves down to a distributed system for transaction processing, and the method may be executed by a transaction processing apparatus, and the apparatus may be implemented in a software and/or hardware manner, as shown in fig. 1, the method specifically includes the following steps:
s110, carrying out transaction processing on any transaction in a transaction execution sequence corresponding to the distributed transaction according to the SAGA distributed transaction mode; wherein the transaction processing includes at least one processing node.
The SAGA distributed transaction mode (hereinafter referred to as SAGA mode) is a distributed transaction implementation mode based on compensation transactions, and in the SAGA mode, a distributed transaction may include a plurality of transactions, where each transaction supports a forward transaction and a reverse compensation transaction. When the distributed transaction in the SAGA mode is executed, forward transactions of all transactions are executed in sequence, and if the forward transactions of all transactions are executed successfully, the distributed transaction is submitted. If the forward transaction execution of any transaction fails, the distributed transaction executes the reverse compensation transaction corresponding to the completed forward transaction, i.e. backs up the successful forward transaction, and returns the distributed transaction to the initial state. The SAGA mode and the transaction processing logic of the host system have high adaptation degree, and the transaction processing of the distributed system moved down by the host system can be realized without greatly improving the SAGA mode.
Generally, a transaction chain of distributed transactions is executed according to a certain service execution sequence, that is, each transaction in the distributed transactions is processed according to a transaction execution sequence, and the transaction execution sequence corresponding to the distributed transactions may be an execution sequence of the service or a transaction execution sequence corresponding to an SAGA mode. For example, the loan transaction execution sequence corresponding to the distributed transaction may be, in turn, verifying the validity of the account number of the client, verifying the password of the account number, the amount of the deducting party and the amount of the transferring party. Any transaction may be any one of transactions a1, a2, …, An in SAGA mode. For example, the transaction may be a loan transaction.
For example, the distributed master control may perform transaction processing on any transaction in the transaction execution sequence corresponding to the distributed transaction according to the SAGA distributed transaction mode. The distributed master control can be used as a distributed system application gateway, is a uniform entrance of a distributed system, and is mainly responsible for providing functions of access control, safety control, public application inspection, distributed transaction global transaction number distribution and the like of application processing or transaction processing, wherein the distributed transaction global transaction number is a distributed ID. Wherein, at least one processing node can be included in the transaction processing process of each transaction. Different transactions can be processed by different server nodes in the distributed system, and the distributed general control initiates and calls each server node. For example, the transaction process may include a funds process or other business process, wherein the funds process may be a money transfer process or other process involving a transfer of funds, and the other business process may be a credit process, a credit review process, or an information registration process, etc.
In an optional embodiment, before performing transaction processing on any transaction in the transaction execution sequence corresponding to the distributed transaction according to the SAGA distributed transaction mode, the method further includes: determining a target verification program corresponding to any transaction from preset candidate verification programs; according to the target verification program, verifying the transaction and judging whether the transaction passes the verification; if yes, carrying out transaction processing on any transaction in the transaction execution sequence corresponding to the distributed transaction according to the SAGA distributed transaction mode.
The candidate verification procedure may be preset by a person of ordinary skill in the art. For example, the verification programs corresponding to different transactions may be stored in advance in the server associated with the processing node corresponding to each transaction. The target verification program may be a verification program corresponding to any transaction, which is deployed in the candidate verification programs of the processing node association servers. The candidate verification program can comprise account password verification, card number existence verification, card number freezing verification, deposit validity verification, transaction channel verification and the like.
Exemplarily, a target verification program corresponding to any transaction is determined from preset candidate verification programs; according to the target verification program, verifying the transaction and judging whether the transaction passes the verification; if yes, carrying out transaction processing on any transaction in a transaction execution sequence corresponding to the distributed transaction according to the SAGA distributed transaction mode; if not, the transaction verification failure reminding information can be sent to related personnel, and the transaction processing is stopped. The transaction failure reminding information may be a reason for reminding the failure of the verification, for example, the transaction failure reminding information may be the failure of the verification of an account number and a password or the absence of a card number, and different transaction failure reminding information may be set by related staff according to different transactions.
In the optional embodiment, before transaction processing is performed on any transaction, any transaction is verified according to a preset target verification program associated with any transaction, whether the transaction passes the verification is judged, and if the transaction passes the verification, subsequent transaction processing is executed, so that the safety of the subsequent transaction processing process is improved, and the economic loss caused by information verification errors or information omission of a transaction party is avoided.
And S120, if the processing node of the transaction is a fund transfer node, acquiring fund flow information of the transaction, sending the fund flow information to a fund processing center, and preparing and processing the fund transfer of the transaction by the fund processing center based on a TCC (transmission control center) distributed transaction mode according to the fund flow information.
Where the funds-transfer node is used to perform funds processing, i.e. any processing in a transaction involving funds, such as deposit or deposit, etc. The funds movement information may include an initiation time, an initiation amount, a remaining amount, and the like. The funds-processing center may be a server node for performing funds processing in a distributed system. For example, confirmation and payout of funds by the funds processing center, etc.
The TCC distributed transaction mode (hereinafter, referred to as TCC mode) is an abbreviation of three operations of Try or prepare operation (Try), Confirm operation (Confirm), and Cancel operation (Cancel), and the TCC mode guarantees atomic commit of distributed transactions, traffic isolation controls concurrent access of distributed transactions, and transactional consistency of distributed transactions by atomicity.
The business implications of the three operations of the TCC mode are: the Try phase is used to complete all service checks and reserve necessary service resources. Wherein the service may be a funds handling service; a Confirm stage: the really executed service logic confirms and submits the service without any service check, and only uses the service resources reserved in the Try stage. The default Confirm stage does not make mistakes, and as long as Try succeeds, Confirm succeeds; a Cancel stage: and when the service execution has errors and needs to be rolled back, executing service cancellation and releasing the reserved service resources.
For example, the acquired fund flow information of the transaction can be sent to the fund processing center by the distributed general control. After the fund processing center acquires the fund flow information, the transaction is prepared based on the TCC distributed transaction mode, namely the transaction is subjected to Try operation.
S130, judging whether any processing node of the transaction passes execution, if so, judging whether the transaction is a target transaction of a preset arrangement sequence in a transaction execution sequence.
Any of the processing nodes may include a funds transfer node and other business processing nodes, among others. For example, the other business processing nodes may be credit processing nodes or information auditing processing nodes, etc. The preset arrangement order may be preset by a related art person, for example, the preset arrangement order may be a position of a last processing node located in the transaction execution order. The target transaction may be the transaction corresponding to the last processing node located in the transaction execution order.
And judging whether all processing nodes of the transaction pass execution, if so, judging whether the transaction is a target transaction arranged at the last position in the transaction execution sequence.
And S140, if so, sending a fund transfer confirmation instruction to the fund processing center, and confirming the fund transfer preparation processing of any transaction in the transaction execution sequence by the fund processing center.
For example, if the transaction is a target transaction in a preset arrangement order in the transaction execution order, for example, the transaction is the last transaction in the transaction execution order, it may be determined that all transactions corresponding to the distributed transactions are executed through. Confirmation instructions for the funds transfer may be sent to the funds processing center via the distributed grandmaster. After receiving the confirmation instruction of the fund transfer, the fund processing center performs confirmation operation on the preparation processing of the fund transfer of any transaction in the transaction execution sequence, namely, the fund processing center performs confirm operation on the fund transfer of any transaction of the Try which is successfully performed according to the TCC mode.
In an alternative embodiment, the distributed transaction corresponds to a unique distributed ID, and the funds movement information includes the distributed ID; the fund processing center comprises fund flow information of a plurality of distributed transactions; correspondingly, sending a confirmation instruction of the fund transfer to the fund processing center, and confirming the fund transfer preparation processing of any transaction in the transaction execution sequence by the fund processing center, wherein the confirmation instruction comprises the following steps: and sending a fund transfer confirmation instruction corresponding to the distributed ID to the fund processing center, determining the target fund flow information by the fund supply processing center according to the distributed ID, and confirming the fund transfer preparation corresponding to the target fund flow information.
Where the distributed id (identity) may represent a unique identification of the distributed transaction in the distributed system. For example, the distributed ID may be generated by a snowflake algorithm, which generates an ID that is a 64bit Long type number, which is an incremental number that may be used for sorting. The snowflake algorithm can basically keep global uniqueness. The target funds movement information may be funds movement information corresponding to each transaction under the distributed ID.
For example, the distributed grandmaster may generate a distributed ID and transmit it to any transaction, i.e. the distributed ID of each transaction in the transaction execution sequence of a distributed transaction is the same; and in the fund processing process of any transaction, when the fund flow information is sent to the fund processing center, the fund flow information comprises the distributed ID of the transaction. When the fund transfer of any transaction is completely prepared (namely all Trys are successful), the distributed master control can initiate a fund transfer confirmation instruction corresponding to each transaction under the distributed ID to the fund processing center through the distributed ID; and after receiving the fund transfer confirmation instruction, the fund processing center determines the fund flow information under the distributed ID as the target fund flow information, and confirms the fund transfer preparation process corresponding to the target fund flow information, namely confirms the successful fund flow of all Try under the distributed ID.
In the optional embodiment, the unique distributed ID corresponding to the distributed transaction is determined, and the confirmation instruction of the fund transfer is initiated to the fund processing center according to the distributed ID, so that the condition that the submission error of the fund transfer action occurs when at least one distributed transaction exists is avoided. The uniqueness and accuracy of the confirmed fund transfer instruction can be ensured by setting the distributed ID.
According to the SAGA distributed transaction mode, transaction processing is carried out on the transaction corresponding to the distributed transaction; if the processing node of the transaction is a fund transfer node, preparing and processing the fund transfer of the transaction by the fund processing center according to the fund flow information and based on a TCC (transmission control center) distributed transaction mode; if any processing node including the fund processing node passes in any transaction, the transaction processing execution pass corresponding to the distributed transaction can be determined, and the fund processing center can confirm the fund transfer preparation processing of any transaction in the transaction execution sequence. According to the scheme, the fund processing is extracted from the transaction processing logic, the nodes related to the fund processing in the transaction processing are processed according to the TCC mode, and other non-fund transactions are processed according to the transaction implementation logic of the SAGA mode, so that the transaction processing in the process that the host system moves down to the distributed system is realized, and the fund security in the transaction processing process is improved. The fund transfer preparation process is confirmed after the transaction process of any transaction is passed, so that the situation that the fund cannot return in the fund transfer process is avoided. Transaction consistency in the transaction processing process is achieved.
Example two
Fig. 2 is a schematic flow chart of a transaction processing method according to a second embodiment of the present application, and the second embodiment of the present application performs optimization and improvement on the basis of the foregoing technical solutions.
Further, after the step of performing transaction processing on any transaction in the transaction execution sequence corresponding to the distributed transaction according to the SAGA distributed transaction mode, the step of adding the step of acquiring the information to be confirmed of the transaction and confirming the information to be confirmed if the processing node of the transaction is the information confirmation node is added. To complete the transaction processing for any transaction.
After the step of judging whether any processing node of the transaction executes the passing, the step of adding is carried out, if any processing node of the transaction does not execute the passing, whether the processing node which does not execute the passing is the fund transfer node is judged; if yes, sending a fund transfer canceling instruction to the fund processing center, and canceling the preparation processing of fund transfer by the fund supply processing center. Correspondingly, after the step of judging whether the processing node which does not pass through the execution is a fund transfer node, the step of adding is that if the processing node which does not pass through the execution is not the fund transfer node, the processing node which passes through the execution in the transaction is determined, and the transaction which passes through the execution is determined according to the execution sequence of the transaction; and according to a preset reverse compensation transaction rule, transaction rollback is carried out on the processing nodes which have passed the execution in the transaction and the transactions which have passed the execution in the transaction execution sequence. "to perfect the way non-funds-transfer nodes are handled.
After the step of judging whether the transaction is the target transaction of the preset arrangement sequence in the transaction execution sequence, the step of adding the step of determining the next transaction of the transaction according to the transaction execution sequence if the transaction is not the target transaction of the preset arrangement sequence in the transaction execution sequence, taking the next transaction as the transaction to be processed, and executing the transaction processing on the transaction to be processed in the transaction execution sequence corresponding to the distributed transaction according to the SAGA distributed transaction mode. "to refine the way non-targeted transactions are processed.
As shown in fig. 2, the method comprises the following specific steps:
s210, carrying out transaction processing on any transaction in a transaction execution sequence corresponding to the distributed transaction according to the SAGA distributed transaction mode; wherein the transaction processing includes at least one processing node.
And S220, if the processing node of the transaction is the information confirmation node, acquiring the information to be confirmed of the transaction, and confirming the information to be confirmed.
The information confirmation node may be a service node other than the money transfer node, and the number of nodes of the information confirmation node may include at least one. For example, the information confirmation node may comprise a processing node for the quota and an information auditing processing node, etc. The information to be confirmed corresponds to each information confirmation node, for example, if the information confirmation node is a credit processing node, the information to be confirmed may be credit information to be confirmed.
And S230, if the processing node of the transaction is a fund transfer node, acquiring fund flow information of the transaction, sending the fund flow information to a fund processing center, and preparing and processing the fund transfer of the transaction by the fund processing center based on a TCC (transmission control center) distributed transaction mode according to the fund flow information.
S240, judging whether any processing node of the transaction passes execution; if so, go to S250A, otherwise, go to S250B.
S250A, judging whether the transaction is the target transaction of the preset arrangement sequence in the transaction execution sequence, if so, executing S260A, and if not, executing S260B.
S250B, judging whether the processing node which is not executed is a fund transfer node, if yes, executing S270A, and if not, executing S270B.
And S260A, sending a fund transfer confirmation instruction to the fund processing center for confirming the fund transfer preparation processing of any transaction in the transaction execution sequence by the fund processing center.
And S260B, determining the next transaction of the transactions according to the transaction execution sequence to be used as a to-be-processed transaction, and executing the transaction processing of the to-be-processed transaction in the transaction execution sequence corresponding to the distributed transaction according to the SAGA distributed transaction mode.
S270A, sending a fund transfer canceling instruction to the fund processing center, and canceling the fund transfer preparation processing by the fund processing center.
For example, a fund transfer cancellation command may be sent by the distributed general control to the fund processing center, and the fund processing center cancels the prepared fund transfer according to the fund transfer cancellation command. That is, the funds processing center can cancel all funds that have been successful for the Try.
S270B, determining the processing nodes which have passed through in the transaction, and determining the transaction which has passed through according to the transaction execution sequence.
And S280, carrying out transaction rollback on the processing nodes which pass through the execution in the transaction and the transactions which pass through the execution in the transaction execution sequence according to a preset reverse compensation transaction rule.
The reverse compensation transaction rule may be preset by a skilled person, for example, the reverse compensation transaction rule may be a reverse transaction in the SAGA mode, that is, a reverse compensation transaction. And returning the executed transaction in the transaction processing nodes and the executed transaction in the transaction execution sequence. For any transaction that fails to execute, the distributed transaction will fall back to execute the reverse compensation transaction of any previously completed transaction, and fall back to the successful transaction, so that the distributed transaction returns to the initial state before transaction processing is not performed.
The embodiment of the application further improves the transaction processing process of any transaction by further taking the processing node of the transaction as the information confirmation node, if any processing node of the transaction does not execute the transaction, and if the transaction is not the target transaction of the preset arrangement sequence in the transaction execution sequence. The fund processing is extracted from the transaction processing logic, the nodes related to the fund processing in the transaction processing are processed according to the TCC mode, and other non-fund transactions are processed according to the transaction implementation logic of the SAGA mode, so that the transaction processing in the process that the host system moves down to the distributed system is realized, and the fund security in the transaction processing process is improved. The embodiment of the application provides a host financial transaction downward-shifting distributed system transformation idea that fund processing which is influenced by subsequent transactions and hinders successful transaction rollback in transaction transformation is extracted from transaction processing logics and uniformly realized, and other transaction realization logics are kept unchanged, so that host downward-shifting distributed transaction realization which is small in transformation amount from host forward and reverse transaction realization logics and can ensure transaction consistency of a distributed system is provided.
In one embodiment, the distributed master generates a global transaction number X (distributed ID), and submits transactions a1, a2, …, An with global transaction numbers not X in sequence according to the execution order of the SAGA mode. A verification routine is performed for each transaction Ai. Transaction processing is performed on Ai, including fund processing to trade Ai, fund processing pipeline to generate Ai, and other non-fund business processing. Wherein, the fund processing mode to Ai is: and sending the fund flow information to a fund processing center, and submitting the try action of the fund flow with the global transaction number X by the fund processing center one by one according to the TCC mode. And if a certain transaction Ai fails to be executed, based on the SAGA mode, backing back the transaction Aj according to the reverse compensation transaction of the executed successful transaction Aj, and informing the fund processing center by the distributed master control to back all fund flow of the successful try corresponding to the global transaction number X. If the transactions A1, A2, … and An of the whole transaction chain are completely executed and the try action with the global transaction number of X fund flow is completely successful, the distributed master control informs the fund processing center to execute all fund processing flows under the global transaction number X to perform confirm action, and the whole transaction chain is successfully submitted.
In a transaction nesting scenario, if a transaction P relates to a distributed transaction, the transaction P includes a service one, a service two, and a service three, wherein the service two includes a service four and a service five, a distributed transaction nesting is generated, and on the premise that the fund processing is stripped from the transaction, the transaction P calls the service one, the service two, and the service three to be an SAGA mode, and the service two calls the service four and the service five to be also an SAGA mode. The distributed master control service II is informed of success only after the service IV and the service V are all successful; and if any of the service four and the service five fails, all the services return back and tell the distributed total control service two that the failure occurs. And if the second service fails, backing back the successfully executed service.
If the service II does not comprise the service IV and the service V, and the service I, the service II, the service III, the service IV and the service V are in parallel relation, the whole transaction chain is changed into the service I, the service II, the service III, the service IV and the service V, the services are still executed in sequence in the SAGA mode, and if a certain service fails to be submitted, the compensation transaction is submitted for the successful service, and all the services are returned.
For fund processing, the whole fund processing flow of the transaction is executed according to a TCC mode, specifically for a certain fund flow, if the try function also relates to a distributed service sub-call, the fund flow try action can be known to be backspacing, the distributed service sub-call related to the try action can be backspacing, otherwise, the backspacing of the whole try action cannot be ensured. For a certain fund flow, its confirm function relates to distributed service sub-call, and the success of the fund flow confirm, the success of the distributed service sub-call, and the asynchronous message informing mode can initiate the distributed service sub-call, as long as the message can be sent to the success.
In the new and old system transaction combination scenario during host system move down, it is necessary to ensure the transaction consistency of the new and old system transactions combined with each other. The host system can be considered as a typical SAGA mode, the newly-realized distributed system can be considered as a system meeting the TCC mode condition, and the mode of combining the TCC mode and the SAGA mode can be used for ensuring the transaction consistency and the fund safety.
In one embodiment, if the service M has moved down and the service N has not moved down, the service M may be a bond service and the service N may be a personal expiration service. The transaction is that user A transfers 1 ten thousand of money to user B through service M, and user B transfers 1 ten thousand yuan of money to user A through service N. The method comprises the following specific steps:
a. submitting a business M to transfer the transaction, and transferring the money of the user A to a fund processing assembly line of the user B; try is run for the funds handling pipeline and the monetary account available for user a is-1 million.
b. A host transaction is performed and funds from user B are transferred to the account of user a for 1 million.
c. And if the host transaction is successful, performing Confirm on the fund processing assembly line of the transfer transaction of the service M.
d. And if the host transaction fails, performing Cancel on the fund transfer transaction processing assembly line of the service M, and recovering the available balance of the money account of the user A deducted by the Try action.
EXAMPLE III
Fig. 3 is a schematic structural diagram of a transaction processing apparatus according to a third embodiment of the present application. The transaction processing device provided by the embodiment of the application can be suitable for the situation that the host system moves down to the distributed system for transaction processing, and can be realized in a software and/or hardware mode. As shown in fig. 3, the apparatus specifically includes: the system comprises a transaction processing module 301, a fund flow information sending module 302, a target transaction judging module 303 and a confirmation instruction sending module 304. Wherein the content of the first and second substances,
the first transaction processing module 301 is configured to perform transaction processing on any transaction in a transaction execution sequence corresponding to a distributed transaction according to an SAGA distributed transaction mode; wherein the transaction processing comprises at least one processing node;
a fund flow information sending module 302, configured to, if the processing node of the transaction is a fund transfer node, obtain fund flow information of the transaction, send the fund flow information to a fund processing center, and enable the fund processing center to perform preparation processing of fund transfer on the transaction based on a TCC distributed transaction mode according to the fund flow information;
a target transaction determining module 303, configured to determine whether any processing node of the transaction passes execution, and if yes, determine whether the transaction is a target transaction in a preset arrangement order in a transaction execution order;
the confirmation instruction sending module 304 is configured to send a confirmation instruction of fund transfer to the fund processing center if the transaction is a target transaction in a preset arrangement order in the transaction execution order, so that the fund processing center confirms the preparation processing of fund transfer of any transaction in the transaction execution order.
According to the SAGA distributed transaction mode, transaction processing is carried out on the transaction corresponding to the distributed transaction; if the processing node of the transaction is a fund transfer node, preparing and processing the fund transfer of the transaction by the fund processing center according to the fund flow information and based on a TCC (transmission control center) distributed transaction mode; if any processing node including the fund processing node passes in any transaction, the transaction processing execution pass corresponding to the distributed transaction can be determined, and the fund processing center can confirm the fund transfer preparation processing of any transaction in the transaction execution sequence. According to the scheme, the fund processing is extracted from the transaction processing logic, the nodes related to the fund processing in the transaction processing are processed according to the TCC mode, and other non-fund transactions are processed according to the transaction implementation logic of the SAGA mode, so that the transaction processing in the process that the host system moves down to the distributed system is realized, and the fund security in the transaction processing process is improved.
Optionally, the apparatus further comprises:
the target verification program determining module is used for determining a target verification program corresponding to any transaction from preset candidate verification programs before transaction processing is carried out on any transaction in a transaction execution sequence corresponding to the distributed transaction according to the SAGA distributed transaction mode;
the transaction checking module is used for checking the transaction according to the target checking program and judging whether the transaction passes the checking;
and the second transaction processing module is used for performing transaction processing on any transaction in the transaction execution sequence corresponding to the distributed transaction according to the SAGA distributed transaction mode if the transaction passes the verification.
Optionally, the distributed transaction corresponds to a unique distributed ID, and the fund flow information includes the distributed ID; the fund processing center comprises fund flow information of a plurality of distributed transactions;
correspondingly, the acknowledgement command sending module 304 includes:
and the confirmation instruction sending unit is used for sending a confirmation instruction of the fund transfer corresponding to the distributed ID to the fund processing center, so that the fund processing center can determine the target fund flow information according to the distributed ID and confirm the preparation processing of the fund transfer corresponding to the target fund flow information.
Optionally, the apparatus further comprises:
and the to-be-confirmed information confirmation module is used for acquiring the to-be-confirmed information of the transaction and confirming the to-be-confirmed information if a processing node of the transaction is an information confirmation node after performing transaction processing on any transaction in a transaction execution sequence corresponding to the distributed transaction according to the SAGA distributed transaction mode.
Optionally, the apparatus further comprises:
the fund transfer node determining module is used for judging whether any processing node of the transaction passes the execution or not, and if any processing node of the transaction does not pass the execution, judging whether the processing node which does not pass the execution is a fund transfer node or not;
and the cancellation instruction sending module is used for sending a fund transfer cancellation instruction to the fund processing center for the fund processing center to cancel the preparation processing of fund transfer if the processing node which does not pass through is the fund transfer node.
Optionally, the apparatus further comprises:
the executed transaction determining module is used for determining the executed processing nodes in the transaction and determining the executed transaction according to the transaction execution sequence if the unexecuted processing nodes are not the fund transfer nodes after judging whether the unexecuted processing nodes are the fund transfer nodes;
and the transaction rollback module is used for performing transaction rollback on the executed processing nodes in the transaction and the executed transactions in the transaction execution sequence according to a preset reverse compensation transaction rule.
Optionally, the apparatus further comprises:
and the third transaction processing module is used for determining the next transaction of the transaction according to the transaction execution sequence after judging whether the transaction is the target transaction of the preset arrangement sequence in the transaction execution sequence, and determining the next transaction of the transaction as a to-be-processed transaction according to the transaction execution sequence, and executing transaction processing on the to-be-processed transaction in the transaction execution sequence corresponding to the distributed transaction according to the SAGA distributed transaction mode.
The transaction processing device can execute the transaction processing method provided by any embodiment of the application, and has the corresponding functional modules and beneficial effects of executing each transaction processing method.
Example four
Fig. 4 is a schematic structural diagram of an electronic device according to a fourth embodiment of the present application. Fig. 4 shows a block diagram of an exemplary electronic device 400 suitable for use in implementing embodiments of the present application. The electronic device 400 shown in fig. 4 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present application.
As shown in fig. 4, electronic device 400 is embodied in the form of a general purpose computing device. The components of electronic device 400 may include, but are not limited to: one or more processors or processing units 401, a system memory 402, and a bus 403 that couples the various system components (including the system memory 402 and the processing unit 401).
Bus 403 represents one or more of any of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, and a processor or local bus using any of a variety of bus architectures. By way of example, such architectures include, but are not limited to, Industry Standard Architecture (ISA) bus, micro-channel architecture (MAC) bus, enhanced ISA bus, Video Electronics Standards Association (VESA) local bus, and Peripheral Component Interconnect (PCI) bus.
Electronic device 400 typically includes a variety of computer system readable media. Such media may be any available media that is accessible by electronic device 400 and includes both volatile and nonvolatile media, removable and non-removable media.
The system memory 402 may include computer system readable media in the form of volatile memory, such as Random Access Memory (RAM)404 and/or cache memory 405. The electronic device 400 may further include other removable/non-removable, volatile/nonvolatile computer system storage media. By way of example only, storage system 406 may be used to read from and write to non-removable, nonvolatile magnetic media (not shown in FIG. 4, and commonly referred to as a "hard drive"). Although not shown in FIG. 4, a magnetic disk drive for reading from and writing to a removable, nonvolatile magnetic disk (e.g., a "floppy disk") and an optical disk drive for reading from or writing to a removable, nonvolatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to the bus 403 by one or more data media interfaces. Memory 402 may include at least one program product having a set (e.g., at least one) of program modules that are configured to carry out the functions of embodiments of the application.
A program/utility 408 having a set (at least one) of program modules 407 may be stored, for example, in memory 402, such program modules 407 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each of which examples or some combination thereof may comprise an implementation of a network environment. Program modules 407 generally perform the functions and/or methods of the embodiments described herein.
The electronic device 400 may also communicate with one or more external devices 409 (e.g., keyboard, pointing device, display 410, etc.), with one or more devices that enable a user to interact with the electronic device 400, and/or with any devices (e.g., network card, modem, etc.) that enable the electronic device 400 to communicate with one or more other computing devices. Such communication may be through input/output (I/O) interface 411. Also, the electronic device 400 may communicate with one or more networks (e.g., a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public network, such as the internet) via the network adapter 412. As shown, the network adapter 412 communicates with the other modules of the electronic device 400 over the bus 403. It should be appreciated that although not shown in FIG. 4, other hardware and/or software modules may be used in conjunction with electronic device 400, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, among others.
The processing unit 401 executes various functional applications and data processing by executing programs stored in the system memory 402, for example, to implement a method of transaction processing provided in an embodiment of the present application.
EXAMPLE five
The fifth embodiment of the present application further provides a storage medium containing computer-executable instructions, where the storage medium stores a computer program, and the computer program, when executed by a processor, implements the transaction processing method provided in the embodiment of the present application, and includes: according to the SAGA distributed transaction mode, carrying out transaction processing on any transaction in a transaction execution sequence corresponding to the distributed transaction; wherein the transaction processing comprises at least one processing node; if the processing node of the transaction is a fund transfer node, acquiring fund flow information of the transaction, and sending the fund flow information to a fund processing center for the fund processing center to prepare and process fund transfer for the transaction based on a TCC (transmission control center) distributed transaction mode according to the fund flow information; judging whether any processing node of the transaction passes execution, if so, judging whether the transaction is a target transaction of a preset arrangement sequence in a transaction execution sequence; and if so, sending a fund transfer confirmation instruction to the fund processing center for confirming the fund transfer preparation processing of any transaction in the transaction execution sequence by the fund processing center.
The computer storage media of the embodiments of the present application may take any combination of one or more computer-readable media. The computer readable medium may be a computer readable signal medium or a computer readable storage medium. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples (a non-exhaustive list) of the computer readable storage medium would include the following: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
A computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Computer program code for carrying out operations for aspects of the present application may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C + +, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present invention and the technical principles employed. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, although the present invention has been described in greater detail by the above embodiments, the present invention is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims (10)

1. A transaction processing method, comprising:
according to the SAGA distributed transaction mode, carrying out transaction processing on any transaction in a transaction execution sequence corresponding to the distributed transaction; wherein the transaction processing comprises at least one processing node;
if the processing node of the transaction is a fund transfer node, acquiring fund flow information of the transaction, and sending the fund flow information to a fund processing center for the fund processing center to prepare and process fund transfer for the transaction based on a TCC (transmission control center) distributed transaction mode according to the fund flow information;
judging whether any processing node of the transaction passes execution, if so, judging whether the transaction is a target transaction of a preset arrangement sequence in a transaction execution sequence;
and if so, sending a fund transfer confirmation instruction to the fund processing center for confirming the fund transfer preparation processing of any transaction in the transaction execution sequence by the fund processing center.
2. The method of claim 1, wherein before performing transaction processing on any transaction in a transaction execution sequence corresponding to the distributed transaction according to the SAGA distributed transaction mode, the method further comprises:
determining a target verification program corresponding to any transaction from preset candidate verification programs;
according to the target verification program, verifying the transaction and judging whether the transaction passes the verification;
if yes, carrying out transaction processing on any transaction in the transaction execution sequence corresponding to the distributed transaction according to the SAGA distributed transaction mode.
3. The method of claim 1, wherein the distributed transaction corresponds to a unique distributed ID, and wherein the funds movement information comprises the distributed ID; the fund processing center comprises fund flow information of a plurality of distributed transactions;
correspondingly, sending a fund transfer confirmation instruction to the fund processing center for confirming the fund transfer preparation processing of any transaction in the transaction execution sequence by the fund processing center comprises the following steps:
and sending a confirmation instruction of the fund transfer corresponding to the distributed ID to the fund processing center, so that the fund processing center determines target fund flow information according to the distributed ID and confirms the preparation processing of the fund transfer corresponding to the target fund flow information.
4. The method of claim 1, wherein after performing transaction processing on any transaction in a transaction execution sequence corresponding to the distributed transaction according to the SAGA distributed transaction mode, the method further comprises:
and if the processing node of the transaction is an information confirmation node, acquiring the information to be confirmed of the transaction, and confirming the information to be confirmed.
5. The method of claim 1, after determining whether any processing node of the transaction performs a pass, further comprising:
if any processing node of the transaction fails to execute, judging whether the processing node which fails to execute is a fund transfer node;
and if so, sending a fund transfer canceling instruction to a fund processing center for the fund processing center to cancel the preparation processing of fund transfer.
6. The method of claim 5, after determining whether the processing node that did not pass is a funds-transfer node, further comprising:
if the processing node which does not execute the passing transaction is not the fund transfer node, determining the processing node which executes the passing transaction in the transaction, and determining the transaction which executes the passing transaction according to the transaction execution sequence;
and according to a preset reverse compensation transaction rule, transaction rollback is carried out on the processing nodes which have passed the execution in the transaction and the transactions which have passed the execution in the transaction execution sequence.
7. The method of claim 1, after determining whether the transaction is a target transaction in a preset arrangement order in a transaction execution order, further comprising:
and if the transaction is not the target transaction of the preset arrangement sequence in the transaction execution sequence, determining the next transaction of the transaction according to the transaction execution sequence to be used as a to-be-processed transaction, and executing the transaction processing of the to-be-processed transaction in the transaction execution sequence corresponding to the distributed transaction according to the SAGA distributed transaction mode.
8. A transaction processing device, comprising:
the transaction processing module is used for carrying out transaction processing on any transaction in a transaction execution sequence corresponding to the distributed transaction according to the SAGA distributed transaction mode; wherein the transaction processing comprises at least one processing node;
the fund flow information sending module is used for acquiring the fund flow information of the transaction and sending the fund flow information to a fund processing center if the processing node of the transaction is a fund transfer node, so that the fund processing center can prepare and process fund transfer on the basis of a TCC (transmission control center) distributed transaction mode according to the fund flow information;
the target transaction judging module is used for judging whether any processing node of the transaction passes execution, and if so, judging whether the transaction is a target transaction of a preset arrangement sequence in a transaction execution sequence;
and the confirmation instruction sending module is used for sending a fund transfer confirmation instruction to the fund processing center if the transaction is a target transaction with a preset arrangement sequence in the transaction execution sequence, so that the fund processing center can confirm the fund transfer preparation processing of any transaction in the transaction execution sequence.
9. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor, when executing the program, implements a transaction processing method as claimed in any one of claims 1 to 7.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out a transaction processing method according to any one of claims 1 to 7.
CN202210087003.8A 2022-01-25 2022-01-25 Transaction processing method, device, equipment and storage medium Pending CN114493873A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210087003.8A CN114493873A (en) 2022-01-25 2022-01-25 Transaction processing method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210087003.8A CN114493873A (en) 2022-01-25 2022-01-25 Transaction processing method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN114493873A true CN114493873A (en) 2022-05-13

Family

ID=81475644

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210087003.8A Pending CN114493873A (en) 2022-01-25 2022-01-25 Transaction processing method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114493873A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117350880A (en) * 2023-12-06 2024-01-05 杭州乒乓智能技术有限公司 Full-link account checking method, device, equipment and medium based on snowflake algorithm

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117350880A (en) * 2023-12-06 2024-01-05 杭州乒乓智能技术有限公司 Full-link account checking method, device, equipment and medium based on snowflake algorithm
CN117350880B (en) * 2023-12-06 2024-02-23 杭州乒乓智能技术有限公司 Full-link account checking method, device, equipment and medium based on snowflake algorithm

Similar Documents

Publication Publication Date Title
US20200334645A1 (en) Resource transfer system
US9756469B2 (en) System with multiple conditional commit databases
CN107403379B (en) Data processing method and device and block chain core distributed system
CN108762895B (en) Method and device for processing distributed transaction
CN112101955B (en) Concurrent payment method, system and device
CN114493873A (en) Transaction processing method, device, equipment and storage medium
CN108009916B (en) Transaction dynamic adjustment-based universal payment accounting method and system
CN110675247A (en) Unknown transaction processing method and system, peripheral system and core bank system
EP4213087A1 (en) Automatic data transfer
CN115456227B (en) Digital currency system for civil aviation event
CN111027951A (en) Cross-domain virtual resource flow control method and device, electronic equipment and storage medium
US20100281490A1 (en) Generating transaction message
US20230394449A1 (en) Method and system for transferring funds between accounts
CN112785285B (en) Multi-bank payment method, system, server and storage medium
US20230351337A1 (en) Generating and securing digital checks using distributed ledger and embedded chip methods
CN116126481B (en) Distributed long transaction processing method and device
CN115249159B (en) Event processing system based on digital currency
CN115239318B (en) Event processing system for civil aviation insurance
US20150254098A1 (en) Transaction processing apparatus and distributed processing system
CN114219642A (en) Quota resource batch processing method, device, equipment and storage medium
CN117348978A (en) Distributed transaction management method and system
CN117635324A (en) Data processing method, device, equipment and medium based on block chain network
CN117422466A (en) Transaction data processing method, device, computer equipment and storage medium
CN113763177A (en) Method and device for controlling concurrent processing of proxy hotspot accounts
CN117011058A (en) Cross-system transaction method, device, equipment and storage medium

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