High-availability online transaction method, device and equipment combining sub-library and dynamic multi-activity switching, and storage medium

By combining the high-availability online trading method of partition database and dynamic multi-active switching, the transaction mode is dynamically switched according to the operating status of the transaction data sub-database, the problem of users being unable to trade when the partition database is down is solved, and the availability and stability of the system are improved.

CN119624641AActive Publication Date: 2025-03-14CHINA MERCHANTS BANK
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202411512472.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-28
Publication Date
2025-03-14
Estimated Expiration
2044-10-28

AI Technical Summary

Technical Problem

In the form of sub-store deployment, when sub-store downtime, users stored in the sub-store cannot conduct transactions.

Method used

Combining the highly available online trading method of partition database and dynamic multi-active switching, the business transaction mode is determined based on the operating status of each transaction data database in response to the transaction request. In the case of a random failure mode, at least one available data sub-store is determined in the multiple transaction data sub-stores, and the transaction request is processed by the transaction application of the available data sub-store.

Benefits of technology

It realizes that transactions can still be carried out when the database is down, improves the availability and stability of the business system, reduces transaction losses, and reduces the complexity of operation and maintenance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119624641A_ABST
    Figure CN119624641A_ABST
Patent Text Reader

Abstract

The invention discloses a high-availability online transaction method, device and equipment combining sub-libraries and dynamic multi-activity switching and a storage medium, and relates to the technical field of computers, and the method comprises the steps: determining a business transaction mode according to the operation state of each transaction data sub-library in response to a transaction request; when the business transaction mode is a fault random mode, determining at least one available data sub-library in a plurality of transaction data sub-libraries; and processing the transaction request according to the transaction application corresponding to the available data sub-library. Through the above mode, when the random mode fails, at least one available data sub-library is determined according to the running state of each transaction data sub-library, the transaction request is processed by using the transaction application of the available data sub-library, flexible switching of the transaction mode is realized through the running state of the sub-library, the availability and stability of the service system are improved, and the user experience is improved. The response speed is accelerated, the transaction loss is reduced, and the complexity of operation and maintenance is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a high-availability online transaction method, device, equipment and storage medium that combines database sharding with dynamic multi-active switching. Background Art

[0002] The business system provides services based on cloud services. Compared with traditional hosts, cloud services have more complex levels and higher failure rates. Application deployment now adopts distributed deployment, with multiple databases, multiple instances, and multiple computer rooms. In order to increase system throughput and ensure high availability, online services use multiple sub-databases and multiple applications to form a cluster, and route to the specified database according to specified factors to provide services. In order to achieve high-availability distributed deployment of large-volume business, data is often horizontally or vertically divided into multiple copies and stored in multiple databases, and corresponding applications are deployed on the corresponding databases. Currently, there are two types of horizontal split database deployment: sub-database and multi-active. In the sub-database deployment form, when a sub-database goes down, users stored in the sub-database cannot conduct transactions. Summary of the invention

[0003] The main purpose of this application is to provide a high-availability online transaction method, device, equipment and storage medium that combines sub-library and dynamic multi-active switching, aiming to solve the technical problem of the prior art that in the form of sub-library deployment, when a sub-library goes down, users stored in the sub-library cannot conduct transactions.

[0004] To achieve the above objectives, the present application proposes a high-availability online transaction method combining database sharding and dynamic multi-active switching, the high-availability online transaction method combining database sharding and dynamic multi-active switching comprising:

[0005] In response to a transaction request, determine the business transaction mode according to the operating status of each transaction data sub-database;

[0006] When the business transaction mode is a random failure mode, determining at least one available data sub-database from a plurality of transaction data sub-databases;

[0007] The transaction request is processed according to the transaction application corresponding to the available data sub-library.

[0008] In one embodiment, the step of determining the business transaction mode according to the operating status of each transaction data sub-database includes:

[0009] When the operation status of a transaction data sub-database is down, the business transaction mode is determined to be a random failure mode;

[0010] When the operation status of each transaction data sub-database is online within the preset historical time period, the business transaction mode is determined to be the sub-database distribution mode;

[0011] When the operation status of each transaction data sub-database is online and the operation status of a transaction data sub-database is down within a preset historical time period, the business transaction mode is determined to be a fault recovery mode.

[0012] In one embodiment, the step of processing the transaction request according to the transaction application corresponding to the available data sub-library includes:

[0013] When there are multiple available data sub-databases, obtain the current carrying capacity of each available data sub-database;

[0014] Determine a target data sub-database from among multiple available data sub-databases according to the current carrying capacity of each available data sub-database;

[0015] The transaction request is sent to the transaction application corresponding to the target data sub-database, so that the transaction application corresponding to the target data sub-database processes the transaction request.

[0016] In one embodiment, when there are multiple available data sub-databases, the step of obtaining the current carrying capacity of each available data sub-database includes:

[0017] When there are multiple available data sub-databases, obtaining a transaction type of the transaction request;

[0018] When the transaction type is a forward transaction, generating an anti-duplicate verification request;

[0019] Sending the anti-duplication check request to the transaction application corresponding to each available data sub-library, so that each available data sub-library feeds back the anti-duplication check result according to the transaction application corresponding to each available data sub-library;

[0020] When the anti-duplication verification results fed back by each available data sub-database are all preset results, the current carrying capacity of each available data sub-database is obtained.

[0021] In one embodiment, after the step of determining the business transaction mode according to the operation status of each transaction data sub-database in response to the transaction request, the step further includes:

[0022] When the business transaction mode is a sub-database distribution mode, obtaining a transaction identification code of the transaction request;

[0023] Determining a target data sub-database among a plurality of transaction data sub-databases according to the sub-database distribution rule and the transaction identification code;

[0024] The transaction request is sent to the transaction application corresponding to the target data sub-database, so that the transaction application corresponding to the target data sub-database processes the transaction request.

[0025] In one embodiment, after the step of determining the business transaction mode according to the operation status of each transaction data sub-database in response to the transaction request, the step further includes:

[0026] When the business transaction mode is a fault recovery mode and the transaction request is an associated transaction, broadcasting the transaction request so that each transaction data sub-database feeds back a transaction query result;

[0027] Determine a target data sub-database among multiple transaction data sub-databases according to the transaction query results fed back by each transaction data sub-database;

[0028] The transaction request is sent to the transaction application corresponding to the target data sub-database, so that the transaction application corresponding to the target data sub-database processes the transaction request.

[0029] In one embodiment, before the step of determining the business transaction mode according to the operation status of each transaction data sub-database in response to the transaction request, the step further includes:

[0030] When receiving a transaction request, obtain the operating status of the downstream user database;

[0031] When the operation status of the downstream user database is online, the step of responding to the transaction request and determining the business transaction mode according to the operation status of each transaction data sub-database is executed.

[0032] In addition, to achieve the above purpose, the present application also proposes a high-availability online transaction device combining sub-library and dynamic multi-active switching, the high-availability online transaction device combining sub-library and dynamic multi-active switching includes:

[0033] A processing module, used to respond to a transaction request and determine a business transaction mode according to the operation status of each transaction data sub-database;

[0034] The processing module is further configured to determine at least one available data sub-database from among the multiple transaction data sub-databases when the business transaction mode is a random failure mode;

[0035] The processing module is further used to process the transaction request according to the transaction application corresponding to the available data sub-library.

[0036] In addition, to achieve the above-mentioned objectives, the present application also proposes a high-availability online transaction device that combines database sharding and dynamic multi-active switching. The device includes: a memory, a processor, and a computer program stored on the memory and executable on the processor. The computer program is configured to implement the steps of the high-availability online transaction method that combines database sharding and dynamic multi-active switching as described above.

[0037] In addition, to achieve the above-mentioned purpose, the present application also proposes a storage medium, which is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by the processor, the steps of the high-availability online transaction method combining database sharding and dynamic multi-active switching as described above are implemented.

[0038] In addition, to achieve the above-mentioned purpose, the present application also provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, it implements the steps of the high-availability online transaction method combining database sharding and dynamic multi-active switching as described above.

[0039] The method of the present application includes: in response to a transaction request, determining a business transaction mode according to the operating status of each transaction data sub-library; when the business transaction mode is a fault-random mode, determining at least one available data sub-library from multiple transaction data sub-libraries; and processing the transaction request according to the transaction application corresponding to the available data sub-library. Through the above method, the corresponding transaction mode is selected according to the operating status of each transaction data sub-library, and in the fault-random mode, at least one available data sub-library is determined according to the operating status of each transaction data sub-library, and the transaction request is processed using the transaction application of the available data sub-library, and the flexible switching of the transaction mode is realized through the operating status of the sub-library, thereby improving the availability and stability of the business system, reducing transaction losses while speeding up the response speed, and reducing the complexity of operation and maintenance. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0041] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0042] Figure 1 A flowchart diagram of the first embodiment of the high-availability online transaction method combining database sharding and dynamic multi-active switching provided by the present application;

[0043] Figure 2 A schematic diagram of the system architecture of a high-availability online transaction method combining database sharding and dynamic multi-active switching provided in the first embodiment of the present application;

[0044] Figure 3 A schematic diagram of a sub-library distribution mode architecture of a high-availability online transaction method combining sub-library and dynamic multi-active switching provided in the first embodiment of the present application;

[0045] Figure 4 A schematic diagram of the fault recovery mode architecture of the high-availability online transaction method combining database sharding and dynamic multi-active switching provided in the first embodiment of the present application;

[0046] Figure 5 A flow chart of the second embodiment of the high-availability online transaction method combining database sharding and dynamic multi-active switching provided by the present application;

[0047] Figure 6 A schematic diagram of a fault random mode architecture of a high-availability online transaction method combining database sharding and dynamic multi-active switching provided in the second embodiment of the present application;

[0048] Figure 7 A brief flowchart of a high-availability online transaction method combining database sharding and dynamic multi-active switching provided in Example 2 of the present application;

[0049] Figure 8 This is a schematic diagram of the module structure of a high-availability online transaction device that combines database sharding and dynamic multi-active switching in an embodiment of the present application;

[0050] Fig. 9 This is a schematic diagram of the device structure of the hardware operating environment involved in the high-availability online transaction method that combines sub-library and dynamic multi-active switching in the embodiment of the present application.

[0051] The purpose, features and advantages of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0052] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.

[0053] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.

[0054] The main solution of the embodiment of the present application is: in response to a transaction request, determine the business transaction mode according to the operating status of each transaction data sub-library; when the business transaction mode is a random fault mode, determine at least one available data sub-library among multiple transaction data sub-libraries; and process the transaction request according to the transaction application corresponding to the available data sub-library.

[0055] At present, the deployment forms of horizontal split database include sub-database and multi-active database. Sub-database means that the user's data is distributed in multiple different databases. When the user needs to perform a transaction, the transaction system will route the transaction to the specified sub-database; multi-active means that the basic data that the online easy-to-depend on is stored synchronously in each database. The data is stateless. When the user performs a transaction, the transaction system will route the transaction to any database. The sub-database deployment form has the following advantages: when a single sub-database goes down, it only affects the users in this sub-database, and does not affect the users of other sub-databases. The routing rules applied are simple, and it is relatively simple to prevent duplicate transactions and find the original transaction; the multi-active deployment form has the following advantages: the user's transactions can be stored in any database. When a database goes down, the downed database can be directly removed, and other databases can still provide complete services. In addition to the above advantages, the current sub-database deployment form also has the following disadvantages: when a sub-database goes down, users stored in this sub-database cannot conduct transactions and can only wait for this sub-database to return to normal; the current multi-active deployment form also has the following disadvantages: the underlying data must be stateless data. If there is a scenario with unique data such as user balance, it cannot be synchronized between multiple databases, and this scenario cannot be used; in addition, if there are related transactions such as transaction status query, cancellation, refund, etc., it will be difficult to find the original transaction and it is necessary to traverse each database.

[0056] The present application provides a solution, which selects a corresponding transaction mode according to the operating status of each transaction data sub-library, and in a random failure mode, determines at least one available data sub-library according to the operating status of each transaction data sub-library, and uses the transaction application of the available data sub-library to process transaction requests, and realizes flexible switching of transaction modes through the operating status of the sub-library, thereby improving the availability and stability of the business system, accelerating the response speed, reducing transaction losses, and reducing the complexity of operation and maintenance.

[0057] It should be noted that the execution subject of this embodiment can be a computing service device with data processing, network communication and program running functions, such as a tablet computer, a personal computer, a mobile phone, etc., or a high-availability online trading device that combines sub-library and dynamic multi-active switching and can realize the above functions. The following takes the high-availability online trading device that combines sub-library and dynamic multi-active switching as the execution subject as an example to illustrate this embodiment and the following embodiments.

[0058] Based on this, the embodiment of the present application provides a high-availability online transaction method combining sub-library and dynamic multi-active switching, referring to Figure 1 , Figure 1 This is a flow chart of the first embodiment of the high-availability online transaction method combining database sharding and dynamic multi-active switching of the present application.

[0059] In this embodiment, the method includes steps S10 to S30:

[0060] Step S10, in response to the transaction request, determining the business transaction mode according to the operating status of each transaction data sub-database.

[0061] It should be noted that the business system architecture involved in this embodiment is as follows Figure 2 As shown, it includes multiple transaction data sub-libraries 01-04, transaction applications 01-04 corresponding to each transaction data sub-library, and a microservice center. Each transaction data sub-library in this embodiment stores the basic data required to complete the transaction, such as card BIN data, transaction country currency mapping relationship, transaction risk control rules, and error code mapping rules. The basic data does not need to be updated frequently, and does not store customer information. There is no need for an efficient synchronization mechanism to ensure that each sub-library is completely consistent; the microservice center is used to provide the address of the transaction application, the survival status of the transaction application, and the survival status of each transaction data sub-library; the code deployed by the transaction application corresponding to each transaction data sub-library is consistent, and each transaction application is multi-instance deployed. There is no state between each application instance, and deployment instances can be added, and instances can be automatically replaced. In this embodiment, the upstream system will initiate a forward transaction, and may also initiate related transactions such as inquiries or reversals. The business system needs to have anti-duplicate capabilities for forward transactions, and related transactions need to return to the original transaction data sub-library for processing. The business system of this embodiment is not responsible for controlling limits, balances, and other constraints that need to be controlled together with historical transactions or other transactions.

[0062] In this embodiment, under normal circumstances, all transaction data sub-databases and transaction applications work normally, and the business system can work efficiently. Under abnormal circumstances, there is no need to wait for the data sub-database to recover, and it is possible to switch to other sub-databases to continue providing services, which can reduce transaction losses and improve the availability of the system in an unstable database environment.

[0063] It can be understood that the high-availability online transaction device combining sub-databases and dynamic multi-active switching in this embodiment is equipped with a business system. When the business system receives a transaction request initiated by the transaction initiator, it will obtain the operating status of each transaction data sub-database. In this embodiment, the operating status of each transaction data sub-database refers to the survival status of each transaction data sub-database. The operating status includes two states: downtime state and online state. In the downtime state, the transaction data sub-database is unavailable; in the online state, the transaction data sub-database can operate normally.

[0064] In the specific implementation, the business transaction mode of this embodiment includes a sub-database distribution mode, a random fault mode, and a fault recovery mode. In different business transaction modes, different methods are used to process transaction requests. The business transaction mode is determined based on the operating status of each transaction data sub-database in the business system.

[0065] In a feasible implementation, determining the business transaction mode according to the operation status of each transaction data sub-database in step S10 may include steps A11 to A13:

[0066] Step A11, when the operation status of the transaction data sub-database is down, determine the business transaction mode as a random fault mode.

[0067] It should be noted that when there is a transaction data sub-database whose operating status is down and there is a transaction data sub-database whose operating status is online, it means that the business system can still operate normally. At this time, the business transaction mode is determined to be a random failure mode.

[0068] Step A12: when the operation status of each transaction data sub-database is online within the preset historical time period, the business transaction mode is determined to be the sub-database distribution mode.

[0069] It should be noted that the preset historical time period refers to the time period of the preset time interval from the current moment. In this embodiment, the preset time interval T1 can be set to the maximum time interval between the associated transaction and the original forward transaction, or it can be set to other time according to demand. For example, if the preset time interval T1 is 10 minutes and the current moment is 10:00:00, then the preset historical time period is 09:50:00 to 10:00:00.

[0070] It can be understood that at the current moment, the operation status of each transaction data sub-database is online and there is no transaction data sub-database in a downtime state in the preset historical time period, which means that the operation status of each transaction data sub-database is online in the preset historical time period, and the business transaction mode is determined to be the sub-database distribution mode. In this embodiment, when there is no transaction data sub-database downtime or there was a transaction data sub-database downtime before but the fault recovery time has reached the preset time interval, the business transaction mode is determined to be the sub-database distribution mode.

[0071] Step A13, when the operation status of each transaction data sub-database is online and the operation status of a transaction data sub-database is down within a preset historical time period, the business transaction mode is determined to be a fault recovery mode.

[0072] It should be noted that at the current moment, the operating status of each transaction data sub-database is online, but within the preset historical time period, the operating status of a transaction data sub-database is down, which means that after a transaction data sub-database goes down, the fault recovery time has not reached the preset time interval. At this time, the business transaction mode is determined to be fault recovery mode.

[0073] In a feasible implementation manner, after step S10, steps B11 to B13 may also be included:

[0074] Step B11, when the business transaction mode is the sub-database distribution mode, obtain the transaction identification code of the transaction request.

[0075] Step B12, determining a target data sub-database among multiple transaction data sub-databases according to the sub-database distribution rule and the transaction identification code.

[0076] Step B13: sending the transaction request to the transaction application corresponding to the target data sub-database, so that the transaction application corresponding to the target data sub-database processes the transaction request.

[0077] It should be noted that in the sub-library distribution mode, all transaction applications corresponding to all transaction data sub-libraries are alive. At this time, the transaction identification code of the transaction request is obtained. In this embodiment, the transaction identification code can be a unique key value of the transaction request or other parameters, which is not limited in this embodiment.

[0078] It can be understood that the sub-library distribution rule is used to determine the transaction data sub-library corresponding to the transaction request. In this embodiment, the sub-library distribution rule can be set as the remainder n after the transaction identification code of the transaction request is divided by the number of transaction data sub-libraries + constant a = the number of the transaction data sub-library (i.e., transaction application). In this embodiment, the constant a can be set according to business needs, and this embodiment does not limit this. In this embodiment, the constant a is set to 1.

[0079] In a specific implementation, a target data sub-database is determined from multiple transaction data sub-databases according to the sub-database distribution rules and the transaction identification code, and a transaction request is sent to a transaction application corresponding to the target data sub-database, and the transaction request is processed by the transaction application corresponding to the target data sub-database. Figure 3 As shown, when the transaction identification code of transaction request A is 1, according to the sub-database distribution rules, the transaction application code corresponding to the target data sub-database corresponding to transaction request A is 2. At this time, transaction request A is sent to transaction application 02, and the associated transactions of transaction request A are also sent to transaction application 02 corresponding to transaction request A.

[0080] In a feasible implementation manner, after step S10, steps C11 to C13 may also be included:

[0081] Step C11, when the business transaction mode is the fault recovery mode and the transaction request is an associated transaction, broadcast the transaction request so that each transaction data sub-database feeds back the transaction query result.

[0082] Step C12: determining a target data sub-database from among the multiple transaction data sub-databases based on the transaction query results fed back by each transaction data sub-database.

[0083] Step C13: sending the transaction request to the transaction application corresponding to the target data sub-database, so that the transaction application corresponding to the target data sub-database processes the transaction request.

[0084] It should be noted that when the business transaction mode is the fault recovery mode, it means that the transaction data sub-database that was originally down has been restored, and the recovery time has reached the preset time interval, and the transaction applications corresponding to each transaction data sub-database are all in an available state. At this time, the transaction type of the transaction request is determined. In this embodiment, the transaction type includes but is not limited to associated transactions and forward transactions; associated transactions include but are not limited to query transactions and reversal transactions.

[0085] It is understandable that if the transaction request is a related transaction in the fault recovery mode, since the system has just recovered, the forward transactions of the related transactions are randomly distributed in the previous stage. At this time, the related transactions need to be broadcast to all transaction data sub-databases, such as Figure 4 As shown, each transaction data sub-database will return the corresponding transaction query result. If the forward transaction of the associated transaction is carried out in the transaction data sub-database, the transaction query result returned by the transaction data sub-database is that the forward transaction is found; otherwise, the transaction query result returned by the transaction data sub-database is that the forward transaction cannot be found.

[0086] In the specific implementation, the transaction query results fed back by each transaction data sub-database can be used to determine the transaction data sub-database that processes the forward transaction of the related transaction, and the transaction data sub-database is used as the target data sub-database, and the related transaction is sent to the transaction application corresponding to the target data sub-database, and the transaction request is processed by the transaction application corresponding to the target data sub-database.

[0087] It should be noted that when the business transaction mode is fault recovery mode and the transaction request is a forward transaction, the business system needs to query the transaction in all sub-databases before the transaction to prevent duplication.

[0088] In a feasible implementation manner, before step S10, steps D11 to D12 may also be included:

[0089] Step D11, when receiving a transaction request, obtaining the operation status of the downstream user database.

[0090] Step D12, when the operation status of the downstream user database is online, execute the step of responding to the transaction request and determining the business transaction mode according to the operation status of each transaction data sub-database.

[0091] It should be noted that the downstream user database refers to a database that stores relevant customer information such as user balances. When the business system receives a transaction request, it obtains the operating status of the downstream user database. When the operating status of the downstream user database is online, it indicates that the business system, as a transaction relay station, can normally execute user-initiated transactions. At this time, it responds to the transaction request initiated by the transaction initiator and executes the steps of determining the business transaction mode according to the operating status of each transaction data sub-database.

[0092] Step S20, when the business transaction mode is a random failure mode, determining at least one available data sub-database from a plurality of transaction data sub-databases.

[0093] It should be noted that when the business transaction mode is the random failure mode, it means that at least one transaction data sub-database is in a downtime state. At this time, the transaction data sub-database in the online state is used as the available data sub-database.

[0094] Step S30: Processing the transaction request according to the transaction application corresponding to the available data sub-database.

[0095] It should be noted that the transaction request is processed through the transaction application corresponding to the available data sub-database in the business system to ensure the normal progress of the transaction.

[0096] The method of this embodiment includes: in response to a transaction request, determining a business transaction mode according to the operating status of each transaction data sub-database; when the business transaction mode is a fault-random mode, determining at least one available data sub-database from multiple transaction data sub-databases; and processing the transaction request according to the transaction application corresponding to the available data sub-database. In the above manner, the corresponding transaction mode is selected according to the operating status of each transaction data sub-database, and in the fault-random mode, at least one available data sub-database is determined according to the operating status of each transaction data sub-database, and the transaction request is processed using the transaction application of the available data sub-database, and the flexible switching of the transaction mode is realized through the operating status of the sub-database, thereby improving the availability and stability of the business system, reducing transaction losses while speeding up the response speed, and reducing the complexity of operation and maintenance.

[0097] Based on the first embodiment of the present application, in the second embodiment of the present application, the same or similar contents as those in the above-mentioned embodiment 1 can be referred to the above introduction, and will not be repeated in the following. Figure 5 In the high-availability online transaction method combining database sharding and dynamic multi-active switching, step S30 also includes steps S31 to S33:

[0098] Step S31, when there are multiple available data sub-databases, obtain the current carrying capacity of each available data sub-database.

[0099] It should be noted that when there are multiple available data sub-databases in the business system, in order to ensure uniformity of traffic distribution and avoid too much pressure on one application and database, the current carrying capacity of each available data sub-database is obtained. In this embodiment, the current carrying capacity is used to reflect the number of transaction requests being processed by the transaction data sub-database.

[0100] In a feasible implementation manner, step S31 may further include steps E11 to E14:

[0101] Step E11, when there are multiple available data sub-databases, obtain the transaction type of the transaction request.

[0102] Step E12: when the transaction type is a forward transaction, generate an anti-duplicate verification request.

[0103] Step E13, sending the anti-duplication check request to the transaction application corresponding to each available data sub-library, so that each available data sub-library feeds back the anti-duplication check result according to the transaction application corresponding to each available data sub-library.

[0104] Step E14, when the anti-duplication verification results fed back by each available data sub-database are all preset results, the current carrying capacity of each available data sub-database is obtained.

[0105] It should be noted that when there are multiple available data sub-databases and the transaction request is a forward transaction, an anti-duplicate check is required. At this time, an anti-duplicate check request is generated based on the transaction request, and the anti-duplicate check request is sent to the transaction application corresponding to each available data sub-database, so that each available data sub-database feeds back an anti-duplicate check result according to the transaction application corresponding to each available data sub-database. In this embodiment, the anti-duplicate check result includes two results: the transaction is queried and the transaction cannot be queried.

[0106] It can be understood that when the anti-duplication check results fed back by each available data sub-library are all that the transaction cannot be queried, it means that the anti-duplication check results fed back by each available data sub-library are all preset results. At this time, it means that the anti-duplication check has passed, and the current carrying capacity of each available data sub-library is obtained. Based on the current carrying capacity of each available data sub-library, a sub-library is randomly selected for transaction.

[0107] In the specific implementation, when the transaction request is an associated transaction, it is necessary to broadcast the associated transaction to each available data sub-library, and select a sub-library from multiple available data sub-libraries for transaction based on the query results returned by each available data sub-library. Specifically: if there is an available data sub-library that returns a query result indicating that the transaction was queried, then the available data sub-library will be used for the transaction; if there is no available data sub-library that returns a query result indicating that the transaction was queried, then a sub-library will be randomly selected for transaction based on the current carrying capacity of each available data sub-library.

[0108] It should be noted that for in-transit transactions, the reversal and query requests that originally occurred on the transaction application corresponding to the downed transaction data sub-database will respond abnormally because there is no corresponding original transaction in the transaction application corresponding to the available data sub-database, and the transaction will be lost. If the in-transit transaction on the faulty application is replayed, the system will not be able to perform anti-duplicate processing, and the upstream system needs to use other means to implement anti-duplicate processing, sacrificing the reliability of the system's anti-duplicate in exchange for system stability.

[0109] Step S32: determining a target data sub-library from among multiple available data sub-libraries according to the current carrying capacity of each available data sub-library.

[0110] Step S33: sending the transaction request to the transaction application corresponding to the target data sub-database, so that the transaction application corresponding to the target data sub-database processes the transaction request.

[0111] It should be noted that, based on the current carrying capacity of each available data sub-database, the available data sub-database with the lowest current carrying capacity is selected as the target data sub-database from among multiple available data sub-databases. A transaction request is sent to the transaction application corresponding to the target data sub-database, and the transaction request is processed by the transaction application corresponding to the target data sub-database.

[0112] It is understandable that if Figure 6 As shown in the figure, when the hardware of transaction data sub-database 01 fails, transaction application 01 is unavailable, and only three applications 02 to 04 are available. At this time, since the transaction application can be stateless, the four sub-databases contain the basic data required to complete the transaction. Customers can conduct transactions in any application and sub-database, so the transaction requests are directly distributed randomly, and the uniformity of traffic distribution is guaranteed during the distribution to avoid too much pressure on one application and database.

[0113] This embodiment obtains the current carrying capacity of each available data sub-library when there are multiple available data sub-libraries; determines the target data sub-library from the multiple available data sub-libraries according to the current carrying capacity of each available data sub-library; and sends the transaction request to the transaction application corresponding to the target data sub-library so that the transaction application corresponding to the target data sub-library processes the transaction request. In this way, transaction losses are avoided and customer experience and transaction success rate are guaranteed.

[0114] For example, to help understand the implementation process of the high-availability online transaction method combining database sharding and dynamic multi-active switching obtained by combining this embodiment with the above-mentioned embodiment 1, please refer to Figure 7 , Figure 7 A brief flow chart of a high-availability online transaction method combining database sharding and dynamic multi-active switching is provided, specifically:

[0115] The method of this embodiment maintains the status of the downstream system in the transaction initiator application, and starts a daemon thread in the background to continuously detect the survival status of the downstream transaction application. Under normal circumstances when all sub-databases are online, the sub-database distribution mode is used; in the case of a single sub-database or multiple sub-database failure, the fault random mode is used; within T1 (the maximum time interval between the query or reversal transaction and the original transaction) after the single sub-database or multiple sub-database failure is recovered, the fault recovery mode is used; if all databases are available after T1 time, then restore to the sub-database distribution mode. Through the above method, the following advantages can be achieved: 1. Using the form of sub-database deployment, when the database is normal, it can be directly routed to the corresponding sub-database, and anti-duplicate and finding the original transaction do not require multi-sub-database search, no redundant call links are required, the application link is simple, and system resources are saved. 2. Eliminate single points. When some databases are down, they are automatically switched to multiple active. Although there will be short-term transaction abnormalities, it will not affect the normal development of subsequent transactions. Although in multi-active mode, both anti-duplicate and related transactions require simultaneous query of multiple sub-databases, resulting in greater call redundancy, this method can improve system availability, optimize customer experience in unstable cloud service conditions, avoid transaction losses as much as possible, and ensure transaction success rates. 3. The system automatically downgrades and upgrades to speed up response, eliminate the need for manual operations, and reduce transaction losses. 4. After fault recovery, transition through the fault recovery mode and then return to the sub-database distribution mode. Applications can switch automatically and make their own decisions without the need for on-duty supervision, reducing operation and maintenance pressure. 5. When all database sub-databases are normal, use the sub-database mode, and the transaction volume of each application and database sub-database is balanced, and the load is within an acceptable range.

[0116] It should be noted that the above examples are only used to understand the present application and do not constitute a limitation on the high-availability online transaction method of the present application that combines database sharding with dynamic multi-active switching. More simple transformations based on this technical concept are all within the scope of protection of the present application.

[0117] This application also provides a high-availability online transaction device that combines sub-databases with dynamic multi-active switching. Please refer to Figure 8 The high-availability online transaction device combining sub-library and dynamic multi-active switching includes:

[0118] The processing module 10 is used to respond to the transaction request and determine the business transaction mode according to the operation status of each transaction data sub-database.

[0119] The processing module 10 is further configured to determine at least one available data sub-library from among multiple transaction data sub-libraries when the business transaction mode is a random failure mode.

[0120] The processing module 10 is further configured to process the transaction request according to the transaction application corresponding to the available data sub-database.

[0121] Optionally, the processing module 10 is further used for:

[0122] When the operating status of a transaction data sub-database is down, the business transaction mode is determined to be a random fault mode; when the operating status of each transaction data sub-database is online within a preset historical time period, the business transaction mode is determined to be a sub-database distribution mode; when the operating status of each transaction data sub-database is online and the operating status of a transaction data sub-database is down within a preset historical time period, the business transaction mode is determined to be a fault recovery mode.

[0123] Optionally, the processing module 10 is further used for:

[0124] When there are multiple available data sub-libraries, obtain the current carrying capacity of each available data sub-library; determine the target data sub-library among the multiple available data sub-libraries according to the current carrying capacity of each available data sub-library; send the transaction request to the transaction application corresponding to the target data sub-library, so that the transaction application corresponding to the target data sub-library processes the transaction request.

[0125] Optionally, the processing module 10 is further used for:

[0126] When there are multiple available data sub-libraries, obtain the transaction type of the transaction request; when the transaction type is a forward transaction, generate an anti-duplication check request; send the anti-duplication check request to the transaction application corresponding to each available data sub-library, so that each available data sub-library can feedback the anti-duplication check result according to the transaction application corresponding to each available data sub-library; when the anti-duplication check results fed back by each available data sub-library are all preset results, obtain the current carrying capacity of each available data sub-library.

[0127] Optionally, the processing module 10 is further used for:

[0128] When the business transaction mode is the sub-database distribution mode, obtain the transaction identification code of the transaction request; determine the target data sub-database among multiple transaction data sub-databases according to the sub-database distribution rules and the transaction identification code; send the transaction request to the transaction application corresponding to the target data sub-database, so that the transaction application corresponding to the target data sub-database processes the transaction request.

[0129] Optionally, the processing module 10 is further used for:

[0130] When the business transaction mode is a fault recovery mode and the transaction request is an associated transaction, the transaction request is broadcasted so that each transaction data sub-database feeds back a transaction query result; a target data sub-database is determined among multiple transaction data sub-databases based on the transaction query results fed back by each transaction data sub-database; and the transaction request is sent to a transaction application corresponding to the target data sub-database so that the transaction application corresponding to the target data sub-database processes the transaction request.

[0131] Optionally, the processing module 10 is further used for:

[0132] When a transaction request is received, the operating status of the downstream user database is obtained; when the operating status of the downstream user database is online, the step of responding to the transaction request and determining the business transaction mode according to the operating status of each transaction data sub-database is executed.

[0133] The high-availability online trading device combining sub-libraries and dynamic multi-active switching provided by the present application adopts the high-availability online trading method combining sub-libraries and dynamic multi-active switching in the above-mentioned embodiment, which can solve the technical problem of the prior art that when a sub-library goes down under the form of sub-library deployment, the users stored in the sub-library cannot conduct transactions. Compared with the prior art, the beneficial effects of the high-availability online trading device combining sub-libraries and dynamic multi-active switching provided by the present application are the same as the beneficial effects of the high-availability online trading method combining sub-libraries and dynamic multi-active switching provided by the above-mentioned embodiment, and the other technical features of the high-availability online trading device combining sub-libraries and dynamic multi-active switching are the same as the features disclosed in the above-mentioned embodiment method, which will not be repeated here.

[0134] The present application provides a high-availability online transaction device that combines database sharding with dynamic multi-active switching. The high-availability online transaction device that combines database sharding with dynamic multi-active switching includes: at least one processor; and a memory that is communicatively connected to the at least one processor; wherein the memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the high-availability online transaction method that combines database sharding with dynamic multi-active switching in the above-mentioned embodiment one.

[0135] Reference below Fig. 9, which shows a schematic diagram of the structure of a high-availability online trading device that combines sub-library and dynamic multi-active switching and is suitable for implementing the embodiment of the present application. The high-availability online trading device that combines sub-library and dynamic multi-active switching in the embodiment of the present application may include but is not limited to mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions), PMPs (Portable Media Players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Fig. 9 The high-availability online transaction device combined with sub-library and dynamic multi-active switching shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0136] like Fig. 9 As shown, a high-availability online trading device combining sub-library and dynamic multi-active switching may include a processing device 1001 (e.g., a central processing unit, a graphics processing unit, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM: Read Only Memory) 1002 or a program loaded from a storage device 1003 to a random access memory (RAM: Random Access Memory) 1004. Various programs and data required for the operation of a high-availability online trading device combining sub-library and dynamic multi-active switching are also stored in RAM1004. The processing device 1001, ROM1002, and RAM1004 are connected to each other via a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Typically, the following systems can be connected to the I / O interface 1006: input devices 1007 including, for example, a touch screen, a touchpad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; output devices 1008 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; storage devices 1003 including, for example, a magnetic tape, a hard disk, etc.; and communication devices 1009. The communication device 1009 can allow the high-availability online trading device in combination with sub-library and dynamic multi-active switching to communicate wirelessly or wired with other devices to exchange data. Although the figure shows a high-availability online trading device in combination with sub-library and dynamic multi-active switching with various systems, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems may be implemented or have instead.

[0137] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.

[0138] The high-availability online trading device combining sub-libraries and dynamic multi-active switching provided by the present application adopts the high-availability online trading method combining sub-libraries and dynamic multi-active switching in the above embodiment, which can solve the technical problem of the prior art that when a sub-library goes down under the form of sub-library deployment, the users stored in the sub-library cannot conduct transactions. Compared with the prior art, the beneficial effects of the high-availability online trading device combining sub-libraries and dynamic multi-active switching provided by the present application are the same as the beneficial effects of the high-availability online trading method combining sub-libraries and dynamic multi-active switching provided by the above embodiment, and the other technical features of the high-availability online trading device combining sub-libraries and dynamic multi-active switching are the same as the features disclosed in the method of the previous embodiment, which will not be repeated here.

[0139] It should be understood that the various parts disclosed in this application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.

[0140] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

[0141] The present application provides a computer-readable storage medium having computer-readable program instructions (i.e., computer programs) stored thereon, and the computer-readable program instructions are used to execute the high-availability online transaction method combining database sharding and dynamic multi-active switching in the above-mentioned embodiment.

[0142] The computer-readable storage medium provided in the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, systems or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, 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 disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination of the above.

[0143] The above-mentioned computer-readable storage medium can be included in a high-availability online trading device that combines database sharding and dynamic multi-active switching; or it can exist independently without being assembled into a high-availability online trading device that combines database sharding and dynamic multi-active switching.

[0144] The above-mentioned computer-readable storage medium carries one or more programs. When the above-mentioned one or more programs are executed by a high-availability online transaction device that combines sub-databases with dynamic multi-active switching, the high-availability online transaction device that combines sub-databases with dynamic multi-active switching: responds to a transaction request, determines a business transaction mode according to the operating status of each transaction data sub-database; when the business transaction mode is a random failure mode, determines at least one available data sub-database among multiple transaction data sub-databases; and processes the transaction request according to the transaction application corresponding to the available data sub-database.

[0145] Computer program code for performing the operations of the present application may be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, C++, and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a 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 may be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0146] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0147] The modules involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the module does not constitute a limitation on the unit itself in some cases.

[0148] The readable storage medium provided by the present application is a computer-readable storage medium, which stores computer-readable program instructions (i.e., computer programs) for executing the above-mentioned high-availability online transaction method combining sub-libraries and dynamic multi-active switching, and can solve the technical problem of the prior art that when a sub-library goes down under the sub-library deployment form, the users stored in the sub-library cannot conduct transactions. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided by the present application are the same as the beneficial effects of the high-availability online transaction method combining sub-libraries and dynamic multi-active switching provided by the above-mentioned embodiment, and will not be repeated here.

[0149] The present application also provides a computer program product, including a computer program, which, when executed by a processor, implements the steps of the high-availability online transaction method combining database sharding and dynamic multi-active switching as described above.

[0150] The computer program product provided by the present application can solve the technical problem of the prior art that when a sub-library is down, users stored in the sub-library cannot conduct transactions. Compared with the prior art, the beneficial effects of the computer program product provided by the present application are the same as the beneficial effects of the high-availability online transaction method combining sub-library and dynamic multi-active switching provided by the above embodiment, which will not be elaborated here.

[0151] The above descriptions are only some embodiments of the present application, and are not intended to limit the patent scope of the present application. All equivalent structural changes made using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect applications in other related technical fields are included in the patent protection scope of the present application.

Claims

1. A high-availability online transaction method combining database sharding and dynamic multi-active switching, characterized in that: The high-availability online transaction method combining database sharding and dynamic multi-active switching includes: In response to a transaction request, determine the business transaction mode according to the operating status of each transaction data sub-database; When the business transaction mode is a random failure mode, determining at least one available data sub-database from a plurality of transaction data sub-databases; The transaction request is processed according to the transaction application corresponding to the available data sub-database.

2. The method according to claim 1, characterized in that The step of determining the business transaction mode according to the operating status of each transaction data sub-database includes: When the operation status of a transaction data sub-database is down, the business transaction mode is determined to be a random failure mode; When the operation status of each transaction data sub-database is online within the preset historical time period, the business transaction mode is determined to be the sub-database distribution mode; When the operation status of each transaction data sub-database is online and the operation status of a transaction data sub-database is down within a preset historical time period, the business transaction mode is determined to be a fault recovery mode.

3. The method according to claim 1, characterized in that The step of processing the transaction request according to the transaction application corresponding to the available data sub-library comprises: When there are multiple available data sub-databases, obtain the current carrying capacity of each available data sub-database; Determine a target data sub-database from among multiple available data sub-databases according to the current carrying capacity of each available data sub-database; The transaction request is sent to the transaction application corresponding to the target data sub-database, so that the transaction application corresponding to the target data sub-database processes the transaction request.

4. The method according to claim 3, characterized in that When there are multiple available data sub-databases, the step of obtaining the current carrying capacity of each available data sub-database includes: When there are multiple available data sub-databases, obtaining a transaction type of the transaction request; When the transaction type is a forward transaction, generating an anti-duplicate verification request; Sending the anti-duplication check request to the transaction application corresponding to each available data sub-library, so that each available data sub-library feeds back the anti-duplication check result according to the transaction application corresponding to each available data sub-library; When the anti-duplication verification results fed back by each available data sub-database are all preset results, the current carrying capacity of each available data sub-database is obtained.

5. The method according to any one of claims 1 to 4, characterized in that After the step of determining the business transaction mode according to the operation status of each transaction data sub-database in response to the transaction request, the method further includes: When the business transaction mode is a sub-database distribution mode, obtaining a transaction identification code of the transaction request; Determining a target data sub-database among a plurality of transaction data sub-databases according to the sub-database distribution rule and the transaction identification code; The transaction request is sent to the transaction application corresponding to the target data sub-database, so that the transaction application corresponding to the target data sub-database processes the transaction request.

6. The method according to any one of claims 1 to 4, characterized in that After the step of determining the business transaction mode according to the operation status of each transaction data sub-database in response to the transaction request, the method further includes: When the business transaction mode is a fault recovery mode and the transaction request is an associated transaction, broadcasting the transaction request so that each transaction data sub-database feeds back a transaction query result; Determine a target data sub-database among multiple transaction data sub-databases according to the transaction query results fed back by each transaction data sub-database; The transaction request is sent to the transaction application corresponding to the target data sub-database, so that the transaction application corresponding to the target data sub-database processes the transaction request.

7. The method according to any one of claims 1 to 4, characterized in that Before the step of determining the business transaction mode according to the operation status of each transaction data sub-database in response to the transaction request, the method further includes: When receiving a transaction request, obtain the operating status of the downstream user database; When the operation status of the downstream user database is online, the step of responding to the transaction request and determining the business transaction mode according to the operation status of each transaction data sub-database is executed.

8. A high-availability online trading device combining database sharding and dynamic multi-active switching, characterized in that: The high-availability online transaction device combining database division and dynamic multi-active switching includes: A processing module, for responding to a transaction request and determining a business transaction mode according to the operation status of each transaction data sub-database; The processing module is further configured to determine at least one available data sub-database from among the multiple transaction data sub-databases when the business transaction mode is a random failure mode; The processing module is further used to process the transaction request according to the transaction application corresponding to the available data sub-library.

9. A high-availability online trading device combining sub-database and dynamic multi-active switching, characterized in that: The high-availability online transaction device combining database sharding and dynamic multi-active switching comprises: a memory, a processor, and a high-availability online transaction program combining database sharding and dynamic multi-active switching stored in the memory and executable on the processor. The high-availability online transaction program combining database sharding and dynamic multi-active switching is configured with a high-availability online transaction method combining database sharding and dynamic multi-active switching as described in any one of claims 1 to 7.

10. A storage medium, characterized in that: The storage medium stores a high-availability online transaction program that combines database sharding with dynamic multi-active switching. When the high-availability online transaction program that combines database sharding with dynamic multi-active switching is executed by the processor, it implements the high-availability online transaction method that combines database sharding with dynamic multi-active switching as described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Library division method and system based on front-end system

    CN111930745A

  • Cluster database sub-database management method and device, computer terminal and storage medium

    CN115544163A

  • Multi-sub-library flow switching method, device and equipment and storage medium

    CN117349070A