Transaction processing method and device
By synchronizing and forwarding transaction data in a cross-center transaction processing system, the problem of transaction processing failure in database failure is solved, the system reliability and success rate is improved, and the operating costs are reduced.
Patent Information
- Application Number
- CN202111002345.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-08-30
- Publication Date
- 2025-01-17
- Estimated Expiration
- 2041-08-30
AI Technical Summary
In the interbank transaction transfer system of bank cards, database failure causes transaction processing to fail, and the existing standby database solution increases system complexity and operational costs, and transactions cannot be processed in time during the failure period.
By implementing the synchronization and forwarding mechanism of transaction data in a cross-center transaction processing system, we ensure that when a database in a transaction processing center fails, transactions can be processed in other transaction processing centers, avoiding the waste of resources and switching time of standby databases. The transaction failed.
It can still process transactions in a timely manner when a database fails, improve the success rate of transaction processing and system reliability, and reduce operating costs.
Smart Images

Figure CN113761066B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of database technology, and in particular, to a transaction processing method and device. Background Art
[0002] In the inter-bank transaction transfer system of bank cards, the cross-border transaction limit needs to obtain the accumulated transaction amount from the database connected to each transaction processing center. When a database connected to a transaction processing center fails, it will not only cause the transaction processing center to fail in processing transactions, but also cause other transaction processing centers that rely on the transaction processing center to be unable to process limit-related transactions.
[0003] In response to the above technical issues, the backup database solution can be used to ensure data integrity, that is, a backup database is configured for each transaction processing center, and the database connected to each transaction processing center (i.e., the main database) will synchronize data to the backup database in real time. Therefore, through manual real-time monitoring, when a database connected to a transaction processing center is found to have a fault, the transaction processing center will be manually isolated and offline in a timely manner, and the main and backup databases will be switched after checking the data integrity.
[0004] In the above method, by using a backup database, the system complexity will increase, the redundant data will increase, and double the hardware resources will be required, which will increase the operating cost; and when a database failure occurs, manual operation requires a certain amount of reaction time. The database will be unavailable when the primary and backup databases are switched, and all related transactions occurring during the switching time will fail, reducing the system's transaction processing capabilities.
[0005] Obviously, there is an urgent need for an efficient transaction processing method so that transactions that need to be processed through a cross-center transaction processing system can still be processed in a timely manner when encountering database failures. Summary of the invention
[0006] The present application provides a transaction processing method and device for timely processing transactions that encounter database failures under low-cost conditions.
[0007] In a first aspect, an embodiment of the present application provides a transaction processing method, the method comprising: a first transaction processing center determines that a received forwarded first transaction meets a preset transaction type; the preset transaction type indicates that processing of the transaction to be processed depends on each transaction processing center in a cross-center transaction processing system including the first transaction processing center, and any transaction processing center in the cross-center transaction processing system synchronizes transaction processing data to other transaction processing centers in the cross-center transaction processing system when processing a transaction to be processed that meets the preset transaction type; if the first transaction processing center determines that the number of forwardings of the first transaction does not meet the preset forwarding number, then checking the status tag of a first database connected to the first transaction processing center; if the first transaction processing center determines that the status tag of the first database is abnormal, then forwarding the first transaction in the cross-center transaction processing system.
[0008] In the above scheme, for any pending transaction that needs to be processed through the cross-center transaction processing system, the transaction processing data obtained after a transaction processing center processes the pending transaction can be updated to the database connected to other transaction processing centers in the cross-center transaction processing system. In this way, through this data synchronization mechanism, when any transaction processing center in the cross-center transaction processing system receives a transaction that needs to be processed through the cross-center transaction processing system, it can be forwarded to each transaction processing center in the cross-center transaction processing system continuously to ensure that when a database connected to one of the transaction processing centers fails, the transaction can still be processed in time. This overcomes the resource consumption caused by the use of a backup database in the prior art, and the problem that transactions cannot be processed in time when the primary and backup databases are switched.
[0009] In one possible implementation method, before the first transaction processing center determines that the received forwarded first transaction meets the preset transaction type, the method also includes: the first transaction processing center receives the first transaction; the first transaction processing center determines that the first transaction is not a transaction that the first transaction processing center needs to process.
[0010] In the above scheme, the first transaction processing center receives the first transaction and determines that the first transaction is not the transaction that it needs to process. However, the first transaction is forwarded by other transaction processing centers in the cross-center transaction processing system. Therefore, the first transaction processing center can know that other transaction processing centers have processed it before but failed. Therefore, the first transaction processing center can process the first transaction based on the relevant historical transaction data stored locally, thereby improving the success rate of transaction processing.
[0011] In one possible implementation method, if the first transaction processing center determines that the number of forwarding times for the first transaction does not meet the preset forwarding times, the status tag of the first database connected to the first transaction processing center is checked, including: if the first transaction processing center determines that the value of the transaction forwarding times field in the message corresponding to the first transaction does not meet the preset forwarding times, the status tag of the first database connected to the first transaction processing center is checked; the preset forwarding times is the number of transaction processing centers included in the cross-center transaction processing system.
[0012] In the above scheme, by updating the field value of the transaction forwarding times field in the message corresponding to the transaction during each transaction forwarding process, when the transaction is forwarded to a transaction processing center in the cross-center transaction processing system, the transaction processing center can quickly determine whether the transaction can continue to be forwarded or the transaction processing has failed based on the value of the transaction forwarding times in the message, thereby improving the efficiency of processing pending transactions.
[0013] In one possible implementation method, if the first transaction processing center determines that the status tag of the first database is normal, it determines whether an abnormality occurs in the connection of the first database; if the first transaction processing center determines that an abnormality occurs in the connection of the first database, it updates the status tag of the first database and determines that the first transaction processing has failed.
[0014] In the above scheme, when the first transaction processing center determines that it (referring to the first transaction processing center) needs to process the first transaction based on the fact that the number of forwarding times for the first transaction does not meet the preset number of forwarding times, it can access the first database with a normal status label, rather than directly accessing the first database with an unclear database status, thereby reducing the waste of time and resources caused by the inability to access the database during direct database access; and when accessing the first database with a normal status label, if it is determined that the connection of the first database is abnormal during the database access process, the status label of the first database is automatically updated as abnormal, thereby promptly reminding manual maintenance of the first database to restore the connection of the first database to normal, thereby improving the efficiency of repairing faults during transaction processing, and thereby improving the success rate of transaction processing.
[0015] In one possible implementation method, if the first transaction processing center determines that the received second transaction does not conform to the preset transaction type, it determines a second transaction processing center to process the second transaction; the first transaction processing center forwards the second transaction to the second transaction processing center; and the second transaction processing center is used to update the status tag of the second database and determine that the processing of the second transaction has failed when it is determined that an abnormality occurs in the connection of the second database connected to the second transaction processing center.
[0016] In the above scheme, if the first transaction processing center determines that the received second transaction does not conform to the preset transaction type, it will forward the second transaction to the corresponding transaction processing center, that is, the second transaction processing center (wherein the second transaction processing center may be the same as the first transaction processing center or different from the first transaction processing center); further, if it is determined that an abnormality occurs in the connection of the second database connected to the second transaction processing center when the second transaction processing center processes the second transaction, the status tag of the second database may be updated and it may be directly determined that the second transaction processing has failed. This method can improve the efficiency of repairing database failures during the transaction processing process, thereby improving the success rate of transaction processing.
[0017] In one possible implementation method, if the first transaction processing center determines that the number of forwardings for the first transaction meets the preset number of forwardings, then it determines that the processing of the first transaction has failed.
[0018] In the above scheme, when it is determined that the number of forwarding times for the first transaction meets the preset number of forwarding times, it means that no transaction processing center in the cross-center transaction processing system can process the first transaction. At this time, it can be determined that the first transaction processing has failed. In this method, each transaction processing center in the cross-center transaction processing system attempts to process the first transaction, which increases the probability of the first transaction being successfully processed.
[0019] In one possible implementation method, the transaction processing data includes field values of each preset key field; any transaction processing center in the cross-center transaction processing system synchronizes the transaction processing data to other transaction processing centers in the cross-center transaction processing system when processing a pending transaction that meets the preset transaction type, including: the key data synchronization system monitors database log changes that occur after any transaction processing center in the cross-center transaction processing system processes a pending transaction that meets the preset transaction type; the key data synchronization system synchronizes the field values corresponding to each preset key field involved in the pending transaction indicated by the database log change to the same preset key fields in the database connected to other transaction processing centers in the cross-center transaction processing system.
[0020] In the above scheme, by pre-defining each key field for each transaction that meets the preset transaction type, during data synchronization, only some key data need to be synchronized, rather than all fields of each transaction. In this way, data synchronization can be achieved faster while ensuring data integrity, thereby improving the efficiency of transaction processing.
[0021] In a second aspect, an embodiment of the present application provides a transaction processing device, comprising: a transaction type determination unit, configured to determine that a received forwarded first transaction meets a preset transaction type; the preset transaction type indicates that processing of the transaction to be processed depends on each transaction processing center in a cross-center transaction processing system including the first transaction processing device, and any transaction processing center in the cross-center transaction processing system synchronizes transaction processing data to other transaction processing centers in the cross-center transaction processing system when processing a transaction to be processed that meets the preset transaction type; a status tag checking unit, configured to check a status tag of a first database connected to the first transaction processing device if it is determined that the number of forwardings of the first transaction does not meet the preset number of forwardings; and a transaction forwarding unit, configured to forward the first transaction in the cross-center transaction processing system if it is determined that the status tag of the first database is abnormal.
[0022] In a possible implementation method, the transaction type determination unit is further used to: receive a first transaction; and determine that the first transaction is not a transaction that needs to be processed by the first transaction processing device.
[0023] In one possible implementation method, the status tag checking unit is specifically used to: if it is determined that the value of the transaction forwarding number field in the message corresponding to the first transaction does not meet the preset forwarding number, check the status tag of the first database connected to the first transaction processing device; the preset forwarding number is the number of transaction processing centers included in the cross-center transaction processing system.
[0024] In one possible implementation method, the device also includes an exception determination unit and a processing unit; the exception determination unit is used to: if it is determined that the status tag of the first database is normal, then determine whether an exception occurs in the connection of the first database; the processing unit is used to: if it is determined that the connection of the first database is abnormal, then update the status tag of the first database and determine that the first transaction processing has failed.
[0025] In one possible implementation method, the device also includes a transaction processing center determination unit and a forwarding unit; the transaction processing center determination unit is used to: if it is determined that the received second transaction does not conform to the preset transaction type, then determine a second transaction processing center that processes the second transaction; the forwarding unit is used to: forward the second transaction to the second transaction processing center; the second transaction processing center is used to update the status tag of the second database and determine that the processing of the second transaction has failed when it is determined that an abnormality occurs in the connection of the second database connected to the second transaction processing center.
[0026] In a possible implementation method, the processing unit is further used to: if it is determined that the number of forwarding times for the first transaction meets the preset number of forwarding times, determine that the processing of the first transaction has failed.
[0027] In one possible implementation method, the transaction processing data includes field values of each preset key field; the device also includes a key data synchronization unit; the key data synchronization unit is used to: monitor database log changes that occur after any transaction processing center in the cross-center transaction processing system processes a pending transaction that meets the preset transaction type; synchronize the field values corresponding to each preset key field involved in the pending transaction indicated by the database log change to the same preset key fields in the database connected to other transaction processing centers in the cross-center transaction processing system.
[0028] In a third aspect, an embodiment of the present application provides a computing device, including:
[0029] A memory for storing program instructions;
[0030] The processor is used to call the program instructions stored in the memory and execute any implementation method of the first aspect according to the obtained program.
[0031] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to enable a computer to execute any implementation method of the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0033] Figure 1 A schematic diagram of a system architecture provided for an embodiment of the present application;
[0034] Figure 2 A schematic diagram of a transaction processing method provided in an embodiment of the present application;
[0035] Figure 3 A flowchart of a transaction processing method provided in an embodiment of the present application;
[0036] Figure 4 A schematic diagram of a transaction processing device provided in an embodiment of the present application;
[0037] Figure 5 A computing device is provided in accordance with an embodiment of the present application. DETAILED DESCRIPTION
[0038] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application.
[0039] For transactions that currently need to be processed by transaction processing centers in a cross-center transaction processing system, although the solution of using a standby database to back up the main database can overcome the problem of transactions that cannot be processed, this solution has the problem of a large amount of redundant data during its specific implementation, that is, a high operating cost, and the switching process between the main and standby databases will cause the transactions entered during the switching period to fail because they cannot be processed.
[0040] In view of the above technical problems, the present application embodiment provides a possible system architecture. Figure 1 FIG. 1 is a schematic diagram of a system architecture provided in an embodiment of the present application, referring to Figure 1 , which includes a cross-center transaction processing system 110, a database system 120 and a key data synchronization system 130. Optionally, the cross-center transaction processing system 110 includes at least one transaction processing center, as an example, Figure 1 As shown, the cross-center transaction processing system 110 includes three transaction processing centers, which are respectively transaction processing center 1101, transaction processing center 1102 and transaction processing center 1103; optionally, the database system 120 includes at least one database, as an example, Figure 1 As shown, the database system 120 includes three databases, namely database 1201, database 1202 and database 1203, wherein database 1201 is a database connected to the transaction processing center 1101 in the cross-center transaction processing system 110, database 1202 is a database connected to the transaction processing center 1102 in the cross-center transaction processing system 110, and database 1203 is a database connected to the transaction processing center 1103 in the cross-center transaction processing system 110; the key data synchronization system 130 can be an independent server or a server cluster built up by multiple servers, and this application does not limit this.
[0041] Transactions that can be processed by the cross-center transaction processing system 110 may include the following two types of transactions:
[0042] The first type is ordinary transactions. For example, for a transaction belonging to this type, when the transaction enters the cross-center transaction processing system 110, the cross-center transaction processing system 110 only needs to process it by a fixed transaction processing center in the cross-center transaction processing system 110, that is, the database connected to the fixed transaction processing center has completely stored the historical data of the transaction, and there is no need to use a transaction processing center other than the fixed transaction processing center in the cross-center transaction processing system 110. For example, ordinary transactions may include withdrawal transactions; specifically, there are two users, namely user A and user B. When user A opens an account in a bank and deposits a sum of money into the opened account, the bank enters his information into the database 1201 connected to the transaction processing center 1101 in the cross-center transaction processing system 110. Therefore, when user A withdraws money using the bank card applied for when opening the account, the cross-center transaction processing system 110 can provide user A with withdrawal transaction services by calling the database 1201 connected to the transaction processing center 1101; when user B opens an account in a bank and deposits a sum of money into the opened account, the bank enters his information into the database 1202 connected to the transaction processing center 1102 in the cross-center transaction processing system 110. Therefore, when user B withdraws money using the bank card applied for when opening the account, the cross-center transaction processing system 110 can provide user B with withdrawal transaction services by calling the database 1202 connected to the transaction processing center 1102.
[0043] The second type is special transactions. For example, for a transaction belonging to this type, when the transaction enters the cross-center transaction processing system 110, the cross-center transaction processing system 110 needs to rely on the joint processing of multiple transaction processing centers in the cross-center transaction processing system 110 to process it, that is, the historical data needed for the transaction in the processing process is stored separately in the databases connected to the multiple transaction processing centers in the cross-center transaction processing system 110. For example, special transactions may include cross-border limit transactions; specifically, there is a user C, where user C spends 20,000 yuan on the first day of the cross-border transaction, and the bank records the transaction information of user C's consumption of 20,000 yuan in the database 1201 connected to the transaction processing center 1101 in the cross-center transaction processing system 110; the next day, user C wants to spend 30,000 yuan when conducting a new cross-border transaction, and at the same time, the condition set by the bank for the successful processing of the cross-border limit transaction is that the total amount of cross-border transactions within three days of the first transaction is not allowed to exceed 50,000 yuan. Therefore, before the bank wants to enter the transaction information of user C's consumption of 30,000 yuan in the cross-center transaction processing system 110, it needs to query the transaction information of the consumption of 30,000 yuan in the cross-center transaction processing system 110. The completion of the cross-border limit transaction of user C before the transaction can be checked, so the transaction record of user C spending 20,000 yuan the day before can be queried, so the demand for spending 30,000 yuan proposed by user C this time can be successfully processed. Assume that the bank records the transaction information of user C spending 30,000 yuan in the database 1202 connected to the transaction processing 1102 in the cross-center transaction processing system 110; on the third day, if user C wants to spend 10,000 yuan when conducting a new cross-border transaction, according to the above logic, the bank can query the transaction records of user C spending 30,000 yuan and 20,000 yuan on the day before and the day before yesterday respectively. Since the amount of cross-border consumption of user C in the previous two days reached 50,000 yuan, the bank will reject the demand for spending 10,000 yuan proposed by user C this time. It can be seen from the above that when executing the special type of cross-border limit transaction, it depends on the processing of the transaction by multiple transaction processing centers in the cross-center transaction processing system 110.
[0044] By classifying the transaction types of each transaction that will enter the cross-center transaction processing system 110 as described above, for each transaction that is classified as a special type of transaction, the key fields of each transaction during the processing process can be pre-defined, such as defining fields such as transaction amount as key fields, and defining fields such as transaction serial number as non-key fields. Therefore, when a special type of transaction entering the cross-center transaction processing system 110 is successfully processed by a transaction processing center in the cross-center transaction processing system 110, the transaction processing center can react to the changes made to the database connected to it by updating the log corresponding to the database. In this process, the status of the changes in the log corresponding to the database can be monitored by the key data synchronization system 130. Therefore, the key data synchronization system 130 can read the transaction data of this change, that is, the field values corresponding to the preset key fields, and synchronize the read transaction data to the same key fields in the databases connected to other transaction processing centers in the cross-center transaction processing system 110.
[0045] In this way, it can be ensured that each key data of each special transaction is stored in the database connected to each transaction processing center in the cross-center transaction processing system 110. In this way, when the special transaction enters the cross-center transaction processing system 110, it can be forwarded continuously in each transaction processing center in the cross-center transaction processing system 110 to ensure that when a database connected to one of the transaction processing centers fails, the transaction can still be processed in time. This overcomes the problem of resource consumption caused by using a backup database in the prior art, and the inability to process transactions in time when the primary and backup databases are switched.
[0046] In view of the problems of the prior art and based on the system architecture provided by this application, the embodiment of this application provides a transaction processing method. Figure 2 FIG. 1 is a schematic diagram of a transaction processing method provided in an embodiment of the present application, the method comprising:
[0047] Step 201: The first transaction processing center determines whether the received forwarded first transaction meets the preset transaction type.
[0048] Among them, the preset transaction type indicates that the processing of the pending transaction depends on each transaction processing center in the cross-center transaction processing system including the first transaction processing center. Any transaction processing center in the cross-center transaction processing system synchronizes transaction processing data to other transaction processing centers in the cross-center transaction processing system when processing a pending transaction that meets the preset transaction type.
[0049] In this step, the first transaction processing center is a transaction processing center among the transaction processing centers in the cross-center transaction processing system, which can be used to process ordinary transactions and special transactions, wherein ordinary transactions are transactions that only rely on a fixed transaction processing center in the cross-center transaction processing system for processing, and special transactions are transactions that rely on various transaction processing centers in the cross-center transaction processing system for processing. In the embodiment of the present application, the preset transaction type can be a special transaction. For a special transaction to be processed that enters the cross-center transaction processing system, after a transaction processing center in the cross-center transaction processing system successfully completes the processing of the transaction to be processed, the transaction processing data can be synchronized to other transaction processing centers in the cross-center transaction processing system. The reason why any transaction processing center in the cross-center transaction processing system can process a special type of transaction to be processed is that the historical transaction processing data corresponding to each special type of transaction to be processed is synchronized from the database connected to the transaction processing center currently responsible for processing to the databases connected to other transaction processing centers in the cross-center transaction processing system. That is, for any special type of transaction to be processed that enters the cross-center transaction processing system, all historical records corresponding to the transaction to be processed are stored one by one in the database connected to each transaction processing center in the cross-center transaction processing system.
[0050] Optionally, the transaction processing data includes field values of respective preset key fields; any transaction processing center in the cross-center transaction processing system synchronizes transaction processing data to other transaction processing centers in the cross-center transaction processing system when processing pending transactions that meet the preset transaction type, including: the key data synchronization system monitors database log changes that occur after any transaction processing center in the cross-center transaction processing system processes pending transactions that meet the preset transaction type; the key data synchronization system synchronizes the field values corresponding to respective preset key fields involved in the pending transactions indicated by the database log changes to the same preset key fields in the databases connected to other transaction processing centers in the cross-center transaction processing system.
[0051] For example, during the processing of a special transaction, many fields may be changed, such as transaction serial number, transaction machine number, transaction time, current transaction amount, cumulative transaction amount, etc. Among them, fields such as transaction serial number and transaction machine number are not as important as fields such as transaction time, current transaction amount, and cumulative transaction amount for a transaction to be processed. Therefore, some relatively important fields in the transaction processing process can be selected and used as key fields. After a transaction processing center in the cross-center transaction processing system successfully completes the processing of a special transaction, the field values of each field of the special transaction will be entered into the database connected to the transaction processing center. Once new data is written to the database, the database log will be updated accordingly. At this time, the key data synchronization system for monitoring the database logs connected to each transaction processing center in the cross-center transaction processing system can determine the database log changes of the transaction processing center. In this way, the key data synchronization system can synchronize the values corresponding to each key field involved in the transaction indicated by the database log change to the same key field in the database connected to other transaction processing centers in the cross-center transaction processing system. In this method, according to the actual application requirements of the special type of transaction, several key fields can be determined from all the fields representing the special type of transaction. Therefore, after a transaction processing center in the cross-center transaction processing system successfully completes the processing of the special type of transaction, the key data synchronization system can update the field values of several key fields corresponding to the special type of transaction to the same fields of other transaction processing centers in the cross-center transaction processing system. In this way, the synchronization of key data of the transaction can be achieved with the least amount of data synchronization, thereby ensuring the integrity of the data, improving the efficiency of data synchronization, and indirectly improving the efficiency of transaction processing.
[0052] Step 202: If the first transaction processing center determines that the number of forwarding times for the first transaction does not meet the preset number of forwarding times, the first transaction processing center checks the status tag of the first database connected to the first transaction processing center.
[0053] The preset forwarding times is the number of transaction processing centers included in the cross-center transaction processing system.
[0054] In this step, during the forwarding process of the first transaction that meets the preset transaction type, if the number of forwarding times does not reach the number of transaction processing centers included in the cross-center transaction processing system, it means that the first transaction has not been attempted to be processed by all the transaction processing centers in the cross-center transaction processing system, and thus the first transaction processing center that receives the first transaction may attempt to process it. When the first transaction processing center attempts to process the first transaction, it may first check the status tag of the first database to which it is connected. In this way, it can avoid the problem of wasting network bandwidth and reducing transaction processing efficiency due to the inability to read and write the database normally when the database is hastily accessed without checking the status tag of the first database.
[0055] Step 203: If the first transaction processing center determines that the status tag of the first database is abnormal, the first transaction is forwarded in the cross-center transaction processing system.
[0056] In this step, when the first transaction processing center checks the status tag of the first database to which it is connected, if the status tag of the first database is abnormal, it means that the first database cannot be read and written normally at present. Therefore, in order to ensure the processing efficiency of the first transaction, the first transaction processing center can forward the first transaction in the cross-center transaction processing system, hoping that other qualified transaction processing centers will process the first transaction.
[0057] Optionally, if the first transaction processing center determines that the number of forwardings for the first transaction meets the preset number of forwardings, it determines that the processing of the first transaction has failed.
[0058] For example, in an embodiment of the present application, the forwarding of the first transaction will not be repeated within the cross-center transaction processing system, that is, the first transaction will not be repeatedly forwarded to the same transaction processing center in the embodiment of the present application. Once this happens, it means that no transaction processing center in the cross-center transaction processing system can process the first transaction, so the first transaction is polled back to the transaction processing center that initially forwarded the first transaction. At this time, the processing result of the first transaction can be directly determined as a transaction processing failure.
[0059] In the above scheme, for any pending transaction that needs to be processed through the cross-center transaction processing system, the transaction processing data obtained after a transaction processing center processes the pending transaction can be updated to the database connected to other transaction processing centers in the cross-center transaction processing system. In this way, through this data synchronization mechanism, when any transaction processing center in the cross-center transaction processing system receives a transaction that needs to be processed through the cross-center transaction processing system, it can be forwarded to each transaction processing center in the cross-center transaction processing system continuously to ensure that when a database connected to one of the transaction processing centers fails, the transaction can still be processed in time. This overcomes the resource consumption caused by the use of a backup database in the prior art, and the problem that transactions cannot be processed in time when the primary and backup databases are switched.
[0060] The following will explain the above steps in detail with examples.
[0061] In one implementation of the above step 201, before the first transaction processing center determines that the received forwarded first transaction meets the preset transaction type, the method also includes: the first transaction processing center receives the first transaction; the first transaction processing center determines that the first transaction is not a transaction that needs to be processed by the first transaction processing center.
[0062] For example, suppose there are three transaction processing centers in the cross-center transaction processing system Z, which are transaction processing center 1, transaction processing center 2, and transaction processing center 3. Suppose a transaction Q that enters the cross-center transaction processing system Z enters the transaction processing center 1 through the distribution of the gateway, that is, the transaction processing center 1 receives the transaction Q. At this time, if the transaction processing center 1 determines that the transaction Q is not a transaction that needs to be processed by itself, such as the transaction processing center 1 determines that the transaction processing center 2 in the cross-center transaction processing system Z processes the transaction Q based on the transaction load balancing processing, the transaction processing center 1 can know that when a transaction that should not be processed by itself is forwarded to itself, it means that before the transaction processing center 1 receives the transaction Q, the transaction processing center 2 has tried to process the transaction Q and the processing result is that the transaction processing is unsuccessful, so the transaction Q will be forwarded to itself (referring to the transaction processing center 1), so that the transaction processing center 1 can check the status tag of the database to which it is connected to determine whether it can try to process the transaction Q.
[0063] In one implementation of the above step 202, if the first transaction processing center determines that the number of forwarding times for the first transaction does not meet the preset forwarding times, then the status tag of the first database connected to the first transaction processing center is checked, including: if the first transaction processing center determines that the value of the transaction forwarding times field in the message corresponding to the first transaction does not meet the preset forwarding times, then the status tag of the first database connected to the first transaction processing center is checked.
[0064] Next, in the above-mentioned example of the cross-center transaction processing system Z containing transaction processing center 1, transaction processing center 2 and transaction processing center 3, when transaction processing center 1 receives transaction Q, it reads the value of the forwarding times field in the message corresponding to transaction Q, and compares the read value with the preset forwarding times. If the former is less than the latter, it means that transaction processing center 1 can try to process transaction Q; wherein, in the process of transaction processing center 1 trying to process transaction Q, if transaction processing center 1 checks the status tag of the database to which it is connected and finds that it is abnormal, it means that transaction processing center 1 cannot normally read and write the database to which it is connected. At this time, in order to increase the probability of successful processing of transaction Q, transaction processing center 1 can forward transaction Q in the cross-center transaction processing system. wherein, in the process of transaction processing center 1 forwarding transaction Q, it can modify the value of the forwarding times field in the message corresponding to transaction Q, that is, increase 1 on the basis of the original value, and enter its own identification, that is, transaction processing center 1, in the transaction forwarding center field in the message corresponding to transaction Q, to indicate that the forwarding of transaction Q this time is initiated by itself (referring to transaction processing center 1).
[0065] In one implementation of the above step 203, if the first transaction processing center determines that the status tag of the first database is normal, it determines whether an abnormality occurs in the connection of the first database; if the first transaction processing center determines that an abnormality occurs in the connection of the first database, it updates the status tag of the first database and determines that the first transaction processing has failed.
[0066] Continuing with the above example, when the first transaction processing center checks the status tag of the first database to which it is connected, it may also appear that the status tag of the first database is normal, which means that the first transaction processing center can try to call the first database; further, during the process of the first transaction processing center calling the first database, if it is determined that the connection of the first database is abnormal, that is, the first transaction processing center cannot perform normal read and write operations on the first database, the first transaction processing center can update the status tag of the first database to abnormal, and determine that the first transaction processing has failed. In this way, when the first transaction processing center calls the first database with a normal tag status, if it is determined that normal read and write operations on the first database cannot be achieved, the status tag of the first database can be automatically updated to abnormal, so as to prompt the operation and maintenance personnel to promptly repair the first database so that the first database can be restored to normal, thereby increasing the probability that subsequent transactions entering the cross-center transaction processing system can be successfully processed.
[0067] In one implementation of the above step 201, if the first transaction processing center determines that the received second transaction does not conform to the preset transaction type, it determines a second transaction processing center to process the second transaction; the first transaction processing center forwards the second transaction to the second transaction processing center; and the second transaction processing center is configured to update a status tag of the second database and determine that the processing of the second transaction has failed when it is determined that an abnormality occurs in the connection of the second database connected to the second transaction processing center.
[0068] For example, the first transaction processing center may match the received second transaction with a preset transaction type. If it is determined that the second transaction does not conform to the preset transaction type, it means that the second transaction is a common transaction. At this time, the first transaction processing center may determine a transaction processing center for processing the second transaction, namely, the second transaction processing center. The second transaction processing center may be the same as the first transaction processing center or may be different from the first transaction processing center, depending on the database connected to the transaction processing center where the data for processing the second transaction is located. After the first transaction processing center determines the second transaction processing center, the second transaction may be forwarded to the second transaction processing center. When the second transaction processing center receives the second transaction, it may directly call the second database connected to it. If the second transaction processing center finds that the second database cannot be read and written normally when calling the second database, the second transaction processing center may set the status tag of the second database to abnormal and determine that the second transaction processing fails. In this way, the operation and maintenance personnel may be prompted to repair the second database in time to restore the second database to normal, thereby increasing the probability that subsequent transactions entering the cross-center transaction processing system can be successfully processed.
[0069] like Figure 3 FIG. 1 is a flowchart of a transaction processing method provided in an embodiment of the present application, comprising the following steps:
[0070] Step 301, the transaction processing center determines whether the received transaction meets the preset transaction type. If yes, step 302 is executed; otherwise, step 303 is executed.
[0071] Step 302, determine whether the transaction is to be processed in the transaction processing center. If yes, execute step 304; otherwise, execute step 305.
[0072] Step 303, forward the transaction to the transaction processing center, and execute step 306.
[0073] Step 304, determine whether the number of forwarding times for the transaction meets the preset number of forwarding times. If yes, execute step 307; otherwise, execute step 308.
[0074] Step 305, determine whether the transaction is forwarded from other transaction processing centers. If yes, execute step 304; otherwise, execute step 309.
[0075] Step 306, determine whether the database connection is normal. If so, execute step 310; otherwise, execute step 311.
[0076] Step 307, determine that the transaction processing has failed and end.
[0077] Step 308, check whether the status tag of the database is normal. If yes, execute step 306, otherwise, execute step 309.
[0078] Step 309, forwarding the transaction to other transaction processing centers.
[0079] Step 310, continue with subsequent transaction processing.
[0080] Step 311, determine that the transaction processing fails, and update the status tag of the database to abnormal, and end.
[0081] Based on the same concept, the present application embodiment provides a transaction processing device, such as Figure 4 As shown, the device includes a transaction type determination unit 401, a state tag checking unit 402 and a transaction forwarding unit 403;
[0082] The transaction type determination unit 401 is used to determine whether the received forwarded first transaction meets a preset transaction type; the preset transaction type indicates that the processing of the pending transaction depends on each transaction processing center in the cross-center transaction processing system including the first transaction processing device, and any transaction processing center in the cross-center transaction processing system synchronizes transaction processing data to other transaction processing centers in the cross-center transaction processing system when processing the pending transaction meeting the preset transaction type;
[0083] A status tag checking unit 402, configured to check a status tag of a first database connected to the first transaction processing apparatus if it is determined that the number of forwarding times for the first transaction does not meet a preset number of forwarding times;
[0084] The transaction forwarding unit 403 is configured to forward the first transaction in the cross-center transaction processing system if it is determined that the status tag of the first database is abnormal.
[0085] Furthermore, for the device, the transaction type determination unit 401 is also used to: receive a first transaction; and determine that the first transaction is not a transaction that needs to be processed by the first transaction processing device.
[0086] Furthermore, for the device, the status label checking unit 402 is specifically used to: if it is determined that the value of the transaction forwarding times field in the message corresponding to the first transaction does not meet the preset forwarding times, then check the status label of the first database connected to the first transaction processing device; the preset forwarding times is the number of transaction processing centers included in the cross-center transaction processing system.
[0087] Furthermore, the device also includes an exception determination unit 404 and a processing unit 405; the exception determination unit 404 is used to: if it is determined that the status tag of the first database is normal, then determine whether an exception occurs in the connection of the first database; the processing unit 405 is used to: if it is determined that the connection of the first database is abnormal, then update the status tag of the first database and determine that the first transaction processing has failed.
[0088] Furthermore, the device also includes a transaction processing center determination unit 406; the transaction processing center determination unit 406 is used to: if it is determined that the received second transaction does not conform to the preset transaction type, then determine the second transaction processing center that processes the second transaction; the transaction forwarding unit 403 is used to: forward the second transaction to the second transaction processing center; the second transaction processing center is used to update the status tag of the second database and determine that the second transaction processing fails when it is determined that an abnormality occurs in the connection of the second database connected to the second transaction processing center.
[0089] Further, for the device, the processing unit 405 is also used to: if it is determined that the number of forwarding times for the first transaction meets the preset forwarding number, determine that the first transaction processing fails.
[0090] Furthermore, for the device, the transaction processing data includes field values of each preset key field; the device also includes a key data synchronization unit 407; the key data synchronization unit 407 is used to: monitor the database log changes that occur after any transaction processing center in the cross-center transaction processing system processes a pending transaction that meets the preset transaction type; and synchronize the field values corresponding to each preset key field involved in the pending transaction indicated by the database log changes to the same preset key fields in the database connected to other transaction processing centers in the cross-center transaction processing system.
[0091] The embodiment of the present application also provides a computing device, which may be a desktop computer, a portable computer, a smart phone, a tablet computer, a personal digital assistant (PDA), etc. The computing device may include a central processing unit (CPU), a memory, an input / output device, etc. The input device may include a keyboard, a mouse, a touch screen, etc. The output device may include a display device, such as a liquid crystal display (LCD), a cathode ray tube (CRT), etc.
[0092] The memory may include a read-only memory (ROM) and a random access memory (RAM), and provides the processor with program instructions and data stored in the memory. In the embodiment of the present application, the memory may be used to store program instructions of the transaction processing method;
[0093] The processor is used to call the program instructions stored in the memory and execute the transaction processing method according to the obtained program.
[0094] like Figure 5 FIG. 1 is a schematic diagram of a computing device provided in an embodiment of the present application, wherein the computing device includes:
[0095] Processor 501, memory 502, transceiver 503, bus interface 504; wherein the processor 501, memory 502 and transceiver 503 are connected via a bus 505;
[0096] The processor 501 is used to read the program in the memory 502 and execute the transaction processing method;
[0097] The processor 501 may be a central processing unit (CPU), a network processor (NP), or a combination of a CPU and a NP. It may also be a hardware chip. The hardware chip may be an application-specific integrated circuit (ASIC), a programmable logic device (PLD), or a combination thereof. The PLD may be a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof.
[0098] The memory 502 is used to store one or more executable programs and can store data used by the processor 501 when performing operations.
[0099] Specifically, the program may include program code, and the program code includes computer operation instructions. The memory 502 may include volatile memory, such as random-access memory (RAM); the memory 502 may also include non-volatile memory, such as flash memory, hard disk drive (HDD) or solid-state drive (SSD); the memory 502 may also include a combination of the above-mentioned types of memory.
[0100] The memory 502 stores the following elements, executable modules or data structures, or a subset thereof, or an extended set thereof:
[0101] Operation instructions: include various operation instructions, used to implement various operations.
[0102] Operating system: includes various system programs used to implement various basic businesses and handle hardware-based tasks.
[0103] The bus 505 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 5 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0104] The bus interface 504 may be a wired communication access port, a wireless bus interface or a combination thereof, wherein the wired bus interface may be, for example, an Ethernet interface. The Ethernet interface may be an optical interface, an electrical interface or a combination thereof. The wireless bus interface may be a WLAN interface.
[0105] An embodiment of the present application also provides a computer-readable storage medium, which stores computer-executable instructions, and the computer-executable instructions are used to enable a computer to execute a transaction processing method.
[0106] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0107] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0108] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0109] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0110] Although the preferred embodiments of the present application have been described, those skilled in the art may make other changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present application.
[0111] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims
1. A transaction processing method, characterized in that: include: The first transaction processing center determines that the received forwarded first transaction meets the preset transaction type; The preset transaction type indicates that the processing of the pending transaction depends on each transaction processing center in the cross-center transaction processing system including the first transaction processing center, and any transaction processing center in the cross-center transaction processing system synchronizes transaction processing data to other transaction processing centers in the cross-center transaction processing system when processing a pending transaction that meets the preset transaction type; If the first transaction processing center determines that the forwarding number of the first transaction does not meet the preset forwarding number, the first transaction processing center checks the status tag of the first database connected to the first transaction processing center; the preset forwarding number is the number of transaction processing centers included in the cross-center transaction processing system; If the first transaction processing center determines that the status tag of the first database is abnormal, the first transaction is forwarded in the cross-center transaction processing system, and the first transaction is not repeatedly forwarded to the same transaction processing center.
2. The method according to claim 1, characterized in that Before the first transaction processing center determines that the received forwarded first transaction meets the preset transaction type, the method further includes: The first transaction processing center receives a first transaction; The first transaction processing center determines that the first transaction is not a transaction that needs to be processed by the first transaction processing center.
3. The method according to claim 1, characterized in that If the first transaction processing center determines that the number of forwarding times for the first transaction does not meet the preset number of forwarding times, checking the status tag of the first database connected to the first transaction processing center includes: If the first transaction processing center determines that the value of the transaction forwarding times field in the message corresponding to the first transaction does not meet the preset forwarding times, the first transaction processing center checks the status tag of the first database connected to the first transaction processing center.
4. The method according to claim 1, characterized in that The method further comprises: If the first transaction processing center determines that the status tag of the first database is normal, then determining whether an abnormality occurs in the connection of the first database; If the first transaction processing center determines that an abnormality occurs in the connection of the first database, the first transaction processing center updates the status tag of the first database and determines that the first transaction processing fails.
5. The method according to claim 1, characterized in that The method further comprises: If the first transaction processing center determines that the received second transaction does not conform to the preset transaction type, determining a second transaction processing center to process the second transaction; The first transaction processing center forwards the second transaction to the second transaction processing center; the second transaction processing center is used to update the status tag of the second database and determine that the second transaction processing fails when it is determined that an abnormality occurs in the connection of the second database connected to the second transaction processing center.
6. The method according to claim 1, characterized in that The method further comprises: If the first transaction processing center determines that the number of forwardings for the first transaction meets the preset number of forwardings, it determines that the first transaction processing has failed.
7. The method according to claim 1, characterized in that The transaction processing data includes field values of each preset key field; When any transaction processing center in the cross-center transaction processing system processes a pending transaction that meets the preset transaction type, the transaction processing data is synchronized to other transaction processing centers in the cross-center transaction processing system, including: The key data synchronization system detects a database log change that occurs after any transaction processing center in the cross-center transaction processing system processes a pending transaction that meets the preset transaction type; The key data synchronization system synchronizes the field values corresponding to the preset key fields involved in the pending transaction indicated by the database log change to the same preset key fields in the database connected to other transaction processing centers in the cross-center transaction processing system.
8. A transaction processing device, characterized in that: include: a transaction type determination unit, configured to determine whether the received forwarded first transaction complies with a preset transaction type; The preset transaction type indicates that the processing of the pending transaction depends on each transaction processing center in the cross-center transaction processing system including the first transaction processing device, and any transaction processing center in the cross-center transaction processing system synchronizes transaction processing data to other transaction processing centers in the cross-center transaction processing system when processing a pending transaction that meets the preset transaction type; a status tag checking unit, configured to check a status tag of a first database connected to the first transaction processing apparatus if it is determined that the number of forwarding times for the first transaction does not meet a preset number of forwarding times; the preset number of forwarding times is the number of transaction processing centers included in the cross-center transaction processing system; A transaction forwarding unit is used to forward the first transaction in the cross-center transaction processing system if it is determined that the status tag of the first database is abnormal, and will not repeatedly forward the first transaction to the same transaction processing center.
9. A computer device, characterized in that: include: Memory for storing computer programs; A processor, configured to call a computer program stored in the memory, and execute the method according to any one of claims 1 to 7 according to the obtained program.
10. A computer-readable storage medium, characterized in that: The storage medium stores computer-executable instructions, and the computer-executable instructions are used to enable a computer to execute the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Novel bank card transaction exchange system
CN102890810A
Data processing method and device, computer system and storage medium
CN112966043A