Account routing determination method and device
By determining the target account based on transaction information and account weight in a distributed account system, we can achieve uniform distribution of transactions and consistent storage of data, solving the problems of low transaction efficiency and data inconsistency and reducing the transaction failure rate.
Patent Information
- Application Number
- CN201910590169.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-07-02
- Publication Date
- 2025-09-12
- Estimated Expiration
- 2039-07-02
AI Technical Summary
In a distributed account system, transactions cannot be evenly distributed across accounts, which affects transaction processing efficiency and causes data consistency issues.
By obtaining reference data information in the transaction information and combining it with the weight of each account in the current distributed system, the target account is determined, and the transaction information is stored according to the database identifier and data table identifier of the target account to achieve uniform distribution of transactions and consistency of data.
It improves transaction processing efficiency, ensures that transaction information is stored in the same database, guarantees data consistency, and reduces the weight of abnormal accounts in abnormal situations to prevent database avalanche.
Smart Images

Figure CN110471915B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing technology, and in particular to a method and device for determining an account routing. Background Art
[0002] The distributed account system is a distributed system involving accounts. For real-time deduction transactions, deducting account balances is one of its core functions.
[0003] Figure 1 It is an exemplary distributed account system. Figure 1 The distributed account system shown is vertically divided into Level 1, Level 2, and Level 3, and horizontally divided into Account Domain 1, Account Domain 2, ..., Account Domain 6, etc. Each account domain includes the "centralized platform reserve fund master account" at the first level, the "IDC (Internet Data Center) reserve fund master account" at the second level, and "sub-accounts" at the third level.
[0004] Taking the reserve fund system as an example, the entire system uses a distributed account system. Each IDC has several accounts distributed across different databases. However, when operating accounts, some accounts are frequently used to process related transactions, while others are used less frequently. Transactions cannot be evenly distributed across accounts concurrently, affecting transaction processing efficiency. Summary of the Invention
[0005] The present invention aims to solve one of the technical problems in the related art at least to a certain extent.
[0006] To this end, a first object of the present invention is to provide an account routing determination method.
[0007] A second objective of the present invention is to provide an account routing determination device.
[0008] A third object of the present invention is to provide a computer device.
[0009] A fourth object of the present invention is to provide a computer-readable storage medium.
[0010] To achieve the above objectives, a first embodiment of the present invention provides an account routing determination method, comprising:
[0011] Obtain reference data information in transaction information;
[0012] Determine the target account based on the reference data information and the weights of each account stored in the current distributed system;
[0013] Determine the database number corresponding to the transaction information according to the database identifier currently corresponding to the target account;
[0014] Determining a data table identifier corresponding to the transaction information based on the reference data information;
[0015] The transaction information is stored according to the database number and the data table identifier.
[0016] In one possible implementation, the reference data information includes a transaction serial number and an institution number, and determining the target account based on the reference data information and the weights of each account currently stored in the distributed system includes:
[0017] Determining a first value based on the transaction serial number, the institution number, and the weights of each account currently stored in the distributed system;
[0018] Determining a weight interval corresponding to each account based on the weight of each account stored in the current distributed system;
[0019] The first value is compared with the weight intervals corresponding to the respective accounts to determine the target weight interval to which the first value belongs, and the target account is determined based on the accounts corresponding to the target weight interval.
[0020] In one possible implementation, determining the first value based on the transaction serial number, the institution number, and the weights of each account currently stored in the distributed system includes:
[0021] Add the institution number after the transaction serial number;
[0022] Performing a hash operation on the concatenated transaction serial numbers to obtain a second value;
[0023] Add the weights of each account stored in the current distributed system to obtain a third value;
[0024] Perform a modulo operation on the second value and the third value to obtain the first value.
[0025] In a possible implementation, the reference data information includes a transaction serial number, and determining a data table identifier corresponding to the transaction information based on the reference data information includes:
[0026] Obtain the total number of data tables in the database corresponding to the database number;
[0027] Performing a hash operation on the transaction serial number to obtain a fourth value;
[0028] Perform a modulo operation on the fourth value and the total number of the data table to obtain the data table identifier corresponding to the transaction information.
[0029] In a possible implementation, the method further includes:
[0030] If the transaction result of the transaction information is learned to be a failure, the weight of the target account is reduced.
[0031] In a possible implementation, the method further includes:
[0032] Check whether the weight of each account stored in the current distributed system is less than the preset weight threshold;
[0033] If it is known that there is an abnormal account with a weight smaller than the weight threshold, the abnormal account will be deleted.
[0034] The account routing determination method provided by an embodiment of the present invention obtains reference data information from transaction information; determines a target account based on the reference data information and the weights of each account currently stored in the distributed system; determines the database number corresponding to the transaction information based on the database identifier currently corresponding to the target account; determines the data table identifier corresponding to the transaction information based on the reference data information; and stores the transaction information based on the database number and the data table identifier. Thus, the target account is determined based on the reference data information in the transaction information and the weights of each account currently stored in the distributed system, enabling transactions to be distributed as evenly as possible among the various accounts, thereby improving transaction processing efficiency. Simultaneously, the transaction information and the target account are stored in the same database, ensuring data consistency.
[0035] To achieve the above-mentioned objectives, a second embodiment of the present invention provides an account routing determination device, comprising:
[0036] An acquisition module is used to obtain reference data information in transaction information;
[0037] A first determination module is configured to determine a target account based on the reference data information and the weights of each account stored in the current distributed system;
[0038] A second determining module is configured to determine a database number corresponding to the transaction information based on a database identifier currently corresponding to the target account;
[0039] a third determining module, configured to determine a data table identifier corresponding to the transaction information based on the reference data information;
[0040] A storage module is used to store the transaction information according to the database number and the data table identifier.
[0041] In a possible implementation, the reference data information includes a transaction serial number and an institution number, and the first determining module includes:
[0042] A first determining unit is configured to determine a first value based on the transaction serial number, the institution number, and the weights of each account currently stored in the distributed system;
[0043] A second determining unit, configured to determine a weight interval corresponding to each account according to the weight of each account stored in the current distributed system;
[0044] The third determining unit is configured to compare the first value with the weight intervals corresponding to the respective accounts, determine a target weight interval to which the first value belongs, and determine the target account based on the account corresponding to the target weight interval.
[0045] In a possible implementation manner, the first determining unit is specifically configured to:
[0046] Add the institution number after the transaction serial number;
[0047] Performing a hash operation on the concatenated transaction serial numbers to obtain a second value;
[0048] Add the weights of each account stored in the current distributed system to obtain a third value;
[0049] Perform a modulo operation on the second value and the third value to obtain the first value.
[0050] In a possible implementation, the reference data information includes a transaction serial number, and the third determining module is specifically configured to:
[0051] Obtain the total number of data tables in the database corresponding to the database number;
[0052] Performing a hash operation on the transaction serial number to obtain a fourth value;
[0053] Perform a modulo operation on the fourth value and the total number of the data table to obtain the data table identifier corresponding to the transaction information.
[0054] In a possible implementation, the apparatus further includes:
[0055] The adjustment module is configured to reduce the weight of the target account if a transaction result of the transaction information is learned to be a failure.
[0056] In a possible implementation, the apparatus further includes:
[0057] A detection module is used to detect whether the weight of each account stored in the current distributed system is less than a preset weight threshold;
[0058] The deletion module is used to delete the abnormal account if it is known that there is an abnormal account with a weight less than the weight threshold.
[0059] The account routing determination device provided in an embodiment of the present invention obtains reference data information from transaction information; determines a target account based on the reference data information and the weights of each account currently stored in the distributed system; determines the database number corresponding to the transaction information based on the database identifier currently corresponding to the target account; determines the data table identifier corresponding to the transaction information based on the reference data information; and stores the transaction information based on the database number and the data table identifier. Thus, the target account is determined based on the reference data information in the transaction information and the weights of each account currently stored in the distributed system, enabling transactions to be distributed as evenly as possible among the various accounts, thereby improving transaction processing efficiency. At the same time, the transaction information and the target account are stored in the same database, ensuring data consistency.
[0060] To achieve the above-mentioned objectives, a third embodiment of the present invention provides a computer device, comprising:
[0061] A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the account routing determination method as described above when executing the program.
[0062] To achieve the above objectives, a fourth embodiment of the present invention provides a computer-readable storage medium, which, when executed by a processor, implements the account routing determination method described above.
[0063] Additional aspects and advantages of the present invention will be set forth in part in the description which follows and, in part, will be obvious from the description which follows, or may be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0064] The above and / or additional aspects and advantages of the present invention will become apparent and readily understood from the following description of the embodiments in conjunction with the accompanying drawings, in which:
[0065] Figure 1 It is an exemplary distributed account system;
[0066] Figure 2 A flowchart of a method for determining an account routing according to an embodiment of the present invention;
[0067] Figure 3 A flowchart of another method for determining an account routing according to an embodiment of the present invention;
[0068] Figure 4A schematic diagram of the structure of an account routing determination device provided by an embodiment of the present invention;
[0069] Figure 5 A schematic structural diagram of another account routing determination device provided by an embodiment of the present invention;
[0070] Figure 6 A schematic structural diagram of a computer device provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0071] The following describes embodiments of the present invention in detail, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present invention, and are not to be construed as limiting the present invention.
[0072] The following describes an account routing determination method and apparatus according to an embodiment of the present invention with reference to the accompanying drawings.
[0073] Figure 2 A flowchart of an account routing determination method provided by an embodiment of the present invention. Figure 2 As shown, the account routing determination method includes the following steps:
[0074] Step 101: Obtain reference data information in transaction information.
[0075] Specifically, transaction information records various information during the transaction process. For example, in the case of real-time debit transactions, the transaction serial number, institution number, debit amount, etc. are recorded, but this is not limited to this.
[0076] The reference data information in the transaction information includes the transaction serial number and the institution number, but is not limited thereto.
[0077] Step 102: Determine the target account based on the reference data information and the weights of each account stored in the current distributed system.
[0078] Specifically, the current distributed system stores the weight of each account. The greater the weight, the greater the probability that the corresponding account will be selected as the target account; conversely, the smaller the account weight, the smaller the probability that the corresponding account will be selected as the target account.
[0079] Specifically, the reference data information includes the transaction serial number and the institution number. The specific implementation method of step 102 is:
[0080] Step 1021: Determine a first value based on the transaction serial number, the institution number, and the weights of each account stored in the current distributed system.
[0081] Among them, the institution number is used to uniquely identify the third-party payment institution.
[0082] Specifically, the institution number is spliced after the transaction serial number; a hash operation is performed on the spliced transaction serial number to obtain a second value; the weights of each account stored in the current distributed system are added to obtain a third value; and a modulo operation is performed on the second value and the third value to obtain the first value.
[0083] For example, the second value is M, the third value is T, and the remainder of M%T is the first value.
[0084] Step 1022: Determine a weight range corresponding to each account based on the weight of each account stored in the current distributed system.
[0085] Specifically, first, a large data interval is established, where the lower limit value of the large data interval is 0, and the upper limit value is a third value obtained by adding the weights of each account stored in the current distributed system.
[0086] Secondly, sort the accounts stored in the current distributed system, and divide the big data interval according to the sorted order and the weight of each account to obtain the weight interval of each account.
[0087] It can be understood that the difference between the upper limit and the lower limit of the weight range of each account is equal to the weight of each account.
[0088] For example, the sorted accounts are account 1 (weight is 100), account 2 (weight is 100), account 3 (weight is 100), account 4 (weight is 100), account 5 (weight is 100), etc.
[0089] The established big data interval is [0,500], where 500 is the sum of the weights of the above five accounts.
[0090] According to the sorted order, the weight interval corresponding to account 1 is [0,100], the weight interval corresponding to account 2 is (100,200], the weight interval corresponding to account 3 is (200,300], the weight interval corresponding to account 4 is (300,400], and the weight interval corresponding to account 5 is (400,500].
[0091] Step 1023: Compare the first value with the weight intervals corresponding to the respective accounts to determine the target weight interval to which the first value belongs, and determine the target account based on the account corresponding to the target weight interval.
[0092] Specifically, the weight intervals correspond one-to-one to the accounts, and each account has its corresponding weight interval. Therefore, by comparing the first value with the weight intervals corresponding to each account, the target weight interval to which the first value belongs is determined, and the account corresponding to the target weight interval is determined as the target account.
[0093] Step 103: Determine the database number corresponding to the transaction information according to the database identifier currently corresponding to the target account.
[0094] To facilitate understanding, the composition of the account data structure is explained here.
[0095] The data structure of an account varies depending on the application scenario. For example, the account length is 16 digits in total, and the meanings of the digits from left to right are as follows:
[0096] Digits 1-2: Account type identifier, used to distinguish different types of accounts, such as the centralized platform reserve fund main account 00, the data center reserve fund main account 10, the deposit sub-account 21, and the withdrawal sub-account 22;
[0097] 3rd and 4th digits: Data center identifier, indicating the data center where the account is located;
[0098] 5th-6th digits: Database ID, indicating the database where the account is located;
[0099] 7th-8th digits: Data table identifier, indicating the data table where the account is located;
[0100] 9th-10th: Reserved position
[0101] No. 11-16: Sequence number of reserve account
[0102] In this embodiment, in order to ensure data consistency, when updating accounts and inserting transaction records, it is necessary to ensure that the accounts and transaction records are in the same database.
[0103] Specifically, the database identifier is extracted from the target account, and the database number storing the transaction information is determined based on the extracted database identifier. For example, if the database where the target account is located is database 1, then the database storing the transaction information is also database 1, thereby ensuring data consistency.
[0104] Step 104: Determine a data table identifier corresponding to the transaction information based on the reference data information.
[0105] Specifically, after determining the database storing the transaction information, a data table storing the transaction information is determined.
[0106] As an example, the reference data information includes a transaction serial number, and the specific implementation method of step 104 is: obtain the total number of data tables in the database corresponding to the database number; perform a hash operation on the transaction serial number to obtain a fourth value; perform a modulo operation on the fourth value and the total number of data tables to obtain the data table identifier corresponding to the transaction information.
[0107] For example, the transaction serial number is 201904130**88, and the database number storing the transaction information is 00 (the database identifier extracted from the target account). The total number of data tables in database number 00 is N, where N is a positive integer. A hash operation is performed on the transaction serial number 201904130**88 to obtain the fourth value Q. The remainder of N%Q is the data table identifier corresponding to the transaction information.
[0108] Step 105: Store the transaction information according to the database number and the data table identifier.
[0109] Specifically, the transaction information can be stored in the same database as the target account according to the database number and data table identifier, thereby ensuring data consistency.
[0110] As an example, after obtaining the database number and table identifier, the transaction serial number is updated by appending the database number and table identifier in sequence to the end of the transaction serial number to form an updated transaction serial number. When storing transaction information, the database number and table identifier are extracted from the updated transaction serial number and the transaction information is stored based on the database number and table identifier.
[0111] For example, the transaction serial number is 201904130**88, the obtained database number is 00, the data table identifier is 00, the updated transaction serial number is 201904130**880000, and the transaction information is stored according to the last four digits of the updated transaction serial number.
[0112] The account routing determination method provided by an embodiment of the present invention obtains reference data information from transaction information; determines a target account based on the reference data information and the weights of each account currently stored in the distributed system; determines the database number corresponding to the transaction information based on the database identifier currently corresponding to the target account; determines the data table identifier corresponding to the transaction information based on the reference data information; and stores the transaction information based on the database number and the data table identifier. Thus, the target account is determined based on the reference data information in the transaction information and the weights of each account currently stored in the distributed system, enabling transactions to be distributed as evenly as possible among the various accounts, thereby improving transaction processing efficiency. Simultaneously, the transaction information and the target account are stored in the same database, ensuring data consistency.
[0113] Figure 3 A flowchart of another method for determining an account routing is provided in an embodiment of the present invention. Figure 3 As shown, in Figure 2 Based on the embodiment shown, after step 105, the account routing determination method further includes the following steps:
[0114] Step 106: If the transaction result of the transaction information is known to be a failure, the weight of the target account is reduced.
[0115] Specifically, in real-world situations, transactions may fail. If a transaction fails through a target account, it indicates an abnormality with the target account. In this case, the weight of the abnormal target account needs to be reduced. For example, in a real-time deduction transaction, if the target account fails to deduct the account balance, the weight of the target account is reduced.
[0116] In practice, transaction failures can lead to avalanche scenarios. For example, because deducting account balances involves database transactions, there are certain exception scenarios. When an application starts a transaction to update an account balance but hasn't committed it, the application server experiences a network outage or CPU or other issues. As a result, the database doesn't receive the end-of-transaction instruction. Other transactions updating the account wait until the transaction is released, creating an avalanche effect that can overwhelm the database hosting the account and impact other transactions. Therefore, account routing needs to account for these exceptions to prevent further impact.
[0117] Furthermore, after step 106, the account routing determination method further includes the following steps:
[0118] Step 107: Check whether the weight of each account stored in the current distributed system is less than a preset weight threshold;
[0119] Step 108: If it is known that there is an abnormal account with a weight smaller than the weight threshold, the abnormal account is deleted.
[0120] Specifically, the preset weight threshold is set according to the actual situation, and the preset weight threshold is, for example, 0. When the weight of the target account drops to 0, the weight of the target account is no longer stored in the current distributed system, realizing the function of deleting the abnormal account. In this way, it can deal with the abnormal situation that causes an account to be unusable. Subsequent transactions will no longer use this account, thus preventing transaction failures caused by avalanches as much as possible.
[0121] The account routing determination method provided by the embodiments of the present invention reduces the weight of the abnormal target account if a transaction fails through the target account, indicating an abnormality in the target account. Furthermore, the method determines whether each account is an abnormal account based on the weights of each account stored in the current distributed system and deletes the abnormal account from the current distributed system. This minimizes the possibility that abnormal account failures could cause a complete database crash, thereby reducing the transaction failure rate.
[0122] Figure 4 This is a schematic diagram of the structure of an account routing determination device provided by an embodiment of the present invention. Figure 4 As shown, the account route determination device includes: an acquisition module 11 , a first determination module 12 , a second determination module 13 , a third determination module 14 , and a storage module 15 .
[0123] An acquisition module 11 is used to acquire reference data information in transaction information;
[0124] A first determination module 12 is configured to determine a target account based on the reference data information and the weights of each account stored in the current distributed system;
[0125] A second determining module 13 is configured to determine a database number corresponding to the transaction information based on a database identifier currently corresponding to the target account;
[0126] A third determining module 14 is configured to determine a data table identifier corresponding to the transaction information based on the reference data information;
[0127] The storage module 15 is configured to store the transaction information according to the database number and the data table identifier.
[0128] In a possible implementation, the reference data information includes a transaction serial number and an institution number, and the first determining module 12 includes:
[0129] A first determining unit is configured to determine a first value based on the transaction serial number, the institution number, and the weights of each account currently stored in the distributed system;
[0130] A second determining unit, configured to determine a weight interval corresponding to each account according to the weight of each account stored in the current distributed system;
[0131] The third determining unit is configured to compare the first value with the weight intervals corresponding to the respective accounts, determine a target weight interval to which the first value belongs, and determine the target account based on the account corresponding to the target weight interval.
[0132] In a possible implementation manner, the first determining unit is specifically configured to:
[0133] Add the institution number after the transaction serial number;
[0134] Performing a hash operation on the concatenated transaction serial numbers to obtain a second value;
[0135] Add the weights of each account stored in the current distributed system to obtain a third value;
[0136] Perform a modulo operation on the second value and the third value to obtain the first value.
[0137] In a possible implementation, the reference data information includes a transaction serial number, and the third determining module 14 is specifically configured to:
[0138] Obtain the total number of data tables in the database corresponding to the database number;
[0139] Performing a hash operation on the transaction serial number to obtain a fourth value;
[0140] Perform a modulo operation on the fourth value and the total number of the data table to obtain the data table identifier corresponding to the transaction information.
[0141] It should be noted that the above explanation of the embodiment of the account routing determination method is also applicable to the account routing determination device of this embodiment. The implementation principles are similar and will not be repeated here.
[0142] The account routing determination device provided in an embodiment of the present invention obtains reference data information from transaction information; determines a target account based on the reference data information and the weights of each account currently stored in the distributed system; determines the database number corresponding to the transaction information based on the database identifier currently corresponding to the target account; determines the data table identifier corresponding to the transaction information based on the reference data information; and stores the transaction information based on the database number and the data table identifier. Thus, the target account is determined based on the reference data information in the transaction information and the weights of each account currently stored in the distributed system, enabling transactions to be distributed as evenly as possible among the various accounts, thereby improving transaction processing efficiency. At the same time, the transaction information and the target account are stored in the same database, ensuring data consistency.
[0143] Figure 5 This is a structural diagram of another account routing determination device provided by an embodiment of the present invention. Figure 5 As shown, in Figure 4 Based on the embodiment shown, the account routing determination device further includes: an adjustment module 16 .
[0144] The adjustment module 16 is configured to reduce the weight of the target account if the transaction result of the transaction information is found to be a failure.
[0145] In a possible implementation, the apparatus further includes:
[0146] A detection module is used to detect whether the weight of each account stored in the current distributed system is less than a preset weight threshold;
[0147] The deletion module is used to delete the abnormal account if it is known that there is an abnormal account with a weight less than the weight threshold.
[0148] It should be noted that the above explanation of the embodiment of the account routing determination method is also applicable to the account routing determination device of this embodiment. The implementation principles are similar and will not be repeated here.
[0149] The account routing determination device provided by the embodiments of the present invention reduces the weight of the abnormal target account if a transaction fails through the target account, indicating an abnormality in the target account. Furthermore, the device determines whether each account is an abnormal account based on the weights of each account stored in the current distributed system and deletes the abnormal account from the current distributed system. This minimizes the possibility that abnormal account failures could cause a complete database crash, thereby reducing the transaction failure rate.
[0150] Figure 6 This is a schematic diagram of the structure of a computer device provided in an embodiment of the present invention. The computer device includes:
[0151] A memory 1001 , a processor 1002 , and a computer program stored in the memory 1001 and executable on the processor 1002 .
[0152] When the processor 1002 executes the program, the account routing determination method provided in the above embodiment is implemented.
[0153] Furthermore, the computer device further comprises:
[0154] The communication interface 1003 is used for communication between the memory 1001 and the processor 1002 .
[0155] The memory 1001 is used to store computer programs that can be run on the processor 1002 .
[0156] The memory 1001 may include a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.
[0157] The processor 1002 is configured to implement the account routing determination method described in the above embodiment when executing the program.
[0158] If the memory 1001, the processor 1002, and the communication interface 1003 are implemented independently, the communication interface 1003, the memory 1001, and the processor 1002 can be connected to each other via a bus and communicate with each other. The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 6 Only one thick line is used in the diagram, but this does not mean that there is only one bus or one type of bus.
[0159] Optionally, in a specific implementation, if the memory 1001, the processor 1002 and the communication interface 1003 are integrated on a chip, the memory 1001, the processor 1002 and the communication interface 1003 can communicate with each other through an internal interface.
[0160] The processor 1002 may be a central processing unit (CPU), an application specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present invention.
[0161] The present invention also provides a computer-readable storage medium having a computer program stored thereon, which implements the account routing determination method described above when the program is executed by a processor.
[0162] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art can combine and combine different embodiments or examples described in this specification and features of different embodiments or examples without contradiction.
[0163] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of the technical features being referred to. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of such features. Throughout the description of this application, "plurality" means at least two, for example, two, three, etc., unless otherwise specifically defined.
[0164] Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, segment or portion of code comprising one or more executable instructions for implementing the steps of a custom logical function or process, and the scope of the preferred embodiments of the present application includes alternative implementations in which functions may be performed out of the order shown or discussed, including performing functions in a substantially simultaneous manner or in the reverse order depending on the functions involved, which should be understood by those skilled in the art to which the embodiments of the present application belong.
[0165] The logic and / or steps represented in the flowcharts or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing the logical functions, and can be embodied in any computer-readable medium for use by, or in conjunction with, an instruction execution system, apparatus, or device (e.g., a computer-based system, a system including a processor, or other system that can fetch and execute instructions from an instruction execution system, apparatus, or device). For purposes of this specification, a "computer-readable medium" can be any device that can contain, store, communicate, propagate, or transport a program for use by, or in conjunction with, an instruction execution system, apparatus, or device. More specific examples (a non-exhaustive list) of computer-readable media include the following: an electrical connection with one or more wires (electronic devices), a portable computer disk cartridge (magnetic device), random access memory (RAM), read-only memory (ROM), erasable and programmable read-only memory (EPROM or flash memory), fiber optic devices, and a portable compact disc read-only memory (CDROM). Furthermore, the computer-readable medium may even be paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium and then editing, interpreting or processing it in another suitable manner if necessary, and then storing it in a computer memory.
[0166] It should be understood that various parts of the present application can be implemented using hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented using software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented using hardware, as in another embodiment, any one of the following technologies known in the art or a combination thereof can be used to implement: a discrete logic circuit having a logic gate circuit for implementing a logic function on a data signal, an application-specific integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0167] Those skilled in the art will understand that all or part of the steps in the method of the above embodiment can be completed by instructing related hardware through a program, and the program can be stored in a computer-readable storage medium. When the program is executed, it includes one or a combination of the steps of the method embodiment.
[0168] In addition, the functional units in the various embodiments of the present application may be integrated into a processing module, or each unit may exist physically separately, or two or more units may be integrated into a module. The above-mentioned integrated module may be implemented in the form of hardware or in the form of a software functional module. If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it may also be stored in a computer-readable storage medium.
[0169] The storage medium mentioned above may be a read-only memory, a magnetic disk, or an optical disk, etc. Although the embodiments of the present application have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present application. Persons skilled in the art may make changes, modifications, substitutions, and variations to the above embodiments within the scope of the present application.
Claims
1. A method for determining an account routing, characterized in that: The following steps are involved: Obtain reference data information in the transaction information, wherein the reference data information includes a transaction serial number and an institution number; Determining a target account based on the reference data information and the weights of each account stored in the current distributed system includes: determining a first value based on the transaction serial number, the institution number, and the weights of each account stored in the current distributed system; determining a weight interval corresponding to each account based on the weights of each account stored in the current distributed system; comparing the first value with the weight interval corresponding to each account to determine a target weight interval to which the first value belongs, determining the target account based on the account corresponding to the target weight interval, and processing the transaction through the target account, wherein the weights of each account represent the probability of each account being selected as the target account, processing the transaction includes processing real-time deduction transactions, the distributed system is a distributed account system, and the distributed account system includes a centralized platform reserve fund main account, a data center reserve fund main account, a deposit sub-account, and a withdrawal sub-account; Determine the database number corresponding to the transaction information according to the database identifier currently corresponding to the target account; Determining a data table identifier corresponding to the transaction information based on the reference data information; The transaction information is stored according to the database number and the data table identifier, so that the transaction information and the target account are corresponding to each other in the same database.
2. The method according to claim 1, wherein The determining of the first value according to the transaction serial number, the institution number, and the weights of each account stored in the current distributed system includes: Add the institution number after the transaction serial number; Performing a hash operation on the concatenated transaction serial numbers to obtain a second value; Add the weights of each account stored in the current distributed system to obtain a third value; Perform a modulo operation on the second value and the third value to obtain the first value.
3. The method according to claim 1, wherein The determining, based on the reference data information, a data table identifier corresponding to the transaction information includes: Obtain the total number of data tables in the database corresponding to the database number; Performing a hash operation on the transaction serial number to obtain a fourth value; Perform a modulo operation on the fourth value and the total number of the data table to obtain the data table identifier corresponding to the transaction information.
4. The method according to claim 1, wherein Also includes: If the transaction result of the transaction information is learned to be a failure, the weight of the target account is reduced.
5. The method according to claim 4, wherein Also includes: Check whether the weight of each account stored in the current distributed system is less than the preset weight threshold; If it is known that there is an abnormal account with a weight smaller than the weight threshold, the abnormal account will be deleted.
6. An account routing determination device, characterized in that: include: An acquisition module is used to obtain reference data information in the transaction information, wherein the reference data information includes a transaction serial number and an institution number; A first determination module is configured to determine a target account based on the reference data information and the weights of each account stored in the current distributed system, so as to process the transaction through the target account, wherein the weights of each account represent the probability of each account being selected as the target account, the processing of the transaction includes processing real-time deduction transactions, and the distributed system is a distributed account system, which includes a centralized platform reserve fund master account, a data center reserve fund master account, a deposit sub-account, and a withdrawal sub-account; A second determining module is configured to determine a database number corresponding to the transaction information based on a database identifier currently corresponding to the target account; a third determining module, configured to determine a data table identifier corresponding to the transaction information based on the reference data information; a storage module, configured to store the transaction information according to the database number and the data table identifier, so that the transaction information and the target account are stored in the same database in correspondence; The first determining module includes: A first determining unit is configured to determine a first value based on the transaction serial number, the institution number, and the weights of each account currently stored in the distributed system; A second determining unit, configured to determine a weight interval corresponding to each account according to the weight of each account stored in the current distributed system; The third determining unit is configured to compare the first value with the weight intervals corresponding to the respective accounts, determine a target weight interval to which the first value belongs, and determine the target account based on the account corresponding to the target weight interval.
7. The device according to claim 6, characterized in that The first determining unit is specifically configured to: Add the institution number after the transaction serial number; Performing a hash operation on the concatenated transaction serial numbers to obtain a second value; Add the weights of each account stored in the current distributed system to obtain a third value; Perform a modulo operation on the second value and the third value to obtain the first value.
8. The device according to claim 6, wherein The third determining module is specifically configured to: Obtain the total number of data tables in the database corresponding to the database number; Performing a hash operation on the transaction serial number to obtain a fourth value; Perform a modulo operation on the fourth value and the total number of the data table to obtain the data table identifier corresponding to the transaction information.
9. The device according to claim 6, wherein Also includes: The adjustment module is configured to reduce the weight of the target account if a transaction result of the transaction information is learned to be a failure.
10. The device according to claim 9, wherein Also includes: A detection module is used to detect whether the weight of each account stored in the current distributed system is less than a preset weight threshold; The deletion module is used to delete the abnormal account if it is known that there is an abnormal account with a weight less than the weight threshold.
11. A computer device, characterized in that: include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the account routing determination method according to any one of claims 1 to 5 is implemented.
12. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the account routing determination method according to any one of claims 1 to 5 is implemented.
Citation Information
Patent Citations
Data storage method and system
CN106775470A
High-performance global load balance distributed database data routing method
CN103905530A
File access information record method, system and distributed cluster system
CN107301249A
Method and device for storing and inquiring order information
CN107967284A