Clearing Method, Device, Database Server and Storage Medium for Transaction Data
Through multiple clearing and batch processing methods, the problem of excessive TPS in transaction databases is solved, the hardware cost and synchronization delay are reduced, and the cleaning efficiency is improved.
Patent Information
- Application Number
- CN202011214451.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-11-04
- Publication Date
- 2025-07-18
- Estimated Expiration
- 2040-11-04
AI Technical Summary
In the prior art, the instantaneous TPS of the transaction database is too high, resulting in high database synchronization delay during the clearing process, affecting stability, and increasing hardware costs.
Multiple clearance installments are used to clear the transaction data in the transaction batch. The transaction data volume is limited during each clearance execution period to avoid centralized processing. The clearance thread is used for batch processing and dormant management, and the clearance is independently marked and completed.
It reduces the synchronization delay of database master and backup, saves hardware costs, improves clearing efficiency, and reduces the problem of excessive TPS.
Smart Images

Figure CN114445220B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a transaction data clearing method, device, database server and storage medium. Background Art
[0002] Clearing is the data preparation stage of clearing, which mainly involves summarizing, organizing and classifying all transaction data of the day according to the member banks' payment on behalf of others, others' payment on behalf of others, credits, debits, number of transactions, amount, net balance, etc.
[0003] At present, there is a technical problem in the clearing process that the database's instantaneous TPS (Transaction Per Second) is too high, which needs to be solved urgently. Summary of the invention
[0004] The embodiments of the present application provide a transaction data clearing method, device, database server and storage medium to avoid the problem of excessive instantaneous TPS of the transaction database.
[0005] The present application embodiment adopts the following technical solutions:
[0006] In a first aspect, an embodiment of the present application provides a method for clearing transaction data, which is executed by a database server, comprising: using multiple clearing periods to clear transaction data in a transaction batch; wherein, in each clearing period, determining the transaction data to be cleared corresponding to the transaction batch in the transaction database; using multiple clearing execution periods within the clearing period, clearing the transaction data to be cleared separately, wherein the amount of transaction data cleared in each clearing execution period is not greater than a first threshold.
[0007] Optionally, determining the transaction data to be cleared corresponding to the transaction batch in the transaction database includes: according to the transaction time conditions corresponding to the transaction batch, querying from the transaction database the transaction data whose transaction time matches the transaction time conditions, is in a final transaction state and has not completed clearing, as the transaction data to be cleared corresponding to the transaction batch.
[0008] Optionally, the transaction data whose transaction time matches the transaction time condition, is in a final transaction state and has not completed clearing is queried from the transaction database as the transaction data to be cleared, including: determining the transaction data in the final transaction state according to the transaction status identifier of the transaction data, and determining the transaction data that has not completed clearing according to the clearing identifier of the transaction data.
[0009] Optionally, using multiple clearing execution periods within the clearing period to perform clearing on the to-be-cleared transaction data respectively includes: within a clearing execution period, clearing the to-be-cleared transaction data item by item, and accumulating the quantity of the cleared transaction data within the current clearing execution period; when the accumulated quantity of transaction data reaches a first threshold, or all the to-be-cleared transaction data has been cleared, terminating the clearing of the current clearing execution period.
[0010] Optionally, the method further includes: within a clearing execution period, determining the clearing identifiers of the transaction data that has been cleared in batches.
[0011] Optionally, determining the clearing identifiers of the transaction data that has been cleared in batches includes: accumulating the quantity of the transaction data that has been cleared but whose clearing identifiers have not been determined, and when the accumulated quantity of transaction data reaches a second threshold, batch-determining the clearing identifiers for the transaction data that has been cleared but whose clearing identifiers have not been determined, and after determining the clearing identifiers, clearing the accumulated quantity of transaction data to zero.
[0012] Optionally, the maximum executable duration of each clearing execution period is the same, and using multiple clearing execution periods within the clearing period to perform clearing on the to-be-cleared transaction data respectively includes: within a clearing execution period, using a clearing thread to perform clearing on the to-be-cleared transaction data, and counting the total clearing duration; if the total duration is less than the maximum executable duration, determining a sleep duration according to the total duration and the maximum execution duration, and making the clearing thread sleep according to the sleep duration.
[0013] Optionally, the total duration of multiple clearing execution periods within a single clearing period is not greater than a third threshold.
[0014] Optionally, the method further includes: receiving a first clearing task corresponding to the transaction batch; the first execution time of the first clearing task is determined according to the start transaction time of the transaction batch and a first delay time; starting the first clearing period of the transaction batch according to the first execution time of the first clearing task, and respectively executing the first clearing task within each clearing period to implement the step of performing clearing using multiple clearing periods.
[0015] Optionally, the method further includes: receiving a second clearing task corresponding to the transaction batch, the execution time of the second clearing task is determined according to the start transaction time of the transaction batch and a second delay time; according to the execution time of the second clearing task, executing the second clearing task to perform clearing on all the to-be-cleared transaction data of the transaction batch.
[0016] In a second aspect, an embodiment of the present application further provides a clearing device for transaction data, which is used to implement the clearing method of transaction data as described in any one of the above.
[0017] In a third aspect, an embodiment of the present application further provides a database server, including: a processor; and a memory arranged to store computer-executable instructions, which when executed cause the processor to execute the transaction data clearing method described in any one of the above.
[0018] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, which stores one or more programs. When the one or more programs are executed by a database server including multiple application programs, the database server is caused to execute the transaction data clearing method described in any one of the above.
[0019] The above at least one technical solution adopted in the embodiment of the present application can achieve the following beneficial effects: The to-be-cleared transaction data within a transaction batch is processed using multiple clearing periods instead of a single clearing period, and the upper limit of the amount of transaction data that can be cleared in each clearing execution period is limited, thereby avoiding an excessive amount of transaction data being cleared during the clearing execution period, and there is no need to separately set up a clearing database outside the transaction database, saving hardware costs, and at the same time reducing the latency of database master-slave synchronization. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] The drawings described herein are used to provide a further understanding of the present application, and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation to the present application. In the drawings:
[0021] Figure 1 A schematic flowchart of a transaction clearing method according to an embodiment of the present application is shown;
[0022] Figure 2 A schematic diagram of clearing TPS for centralized clearing using a single clearing period in the prior art is shown;
[0023] Figure 3 A schematic diagram of clearing TPS for clearing using multiple clearing periods according to an embodiment of the present application is shown;
[0024] Figure 4 A schematic structural diagram of a transaction clearing device according to an embodiment of the present application is shown;
[0025] Figure 5 A schematic structural diagram of a database server in an embodiment of the present application is shown. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0026] To make the objectives, technical solutions and advantages of this application more clear, the following will clearly and completely describe the technical solutions of this application in combination with specific embodiments of this application and the corresponding drawings. Obviously, the described embodiments are only a part rather than all of the embodiments of this application. All other embodiments obtained by those of ordinary skill in the art based on the embodiments in this application without creative efforts shall fall within the scope of protection of this application.
[0027] To solve the problems raised in the background art section, one implementation is to solve it by adding hardware resources. Specifically, in addition to saving transaction data to the transaction database, a separate clearing database is added for storage. In this way, even if the TPS of the clearing database is too high, it will not affect the normal use of the transaction database, which is also an acceptable approach.
[0028] However, this undoubtedly greatly increases the hardware cost. Because to ensure data security, the database usually has a primary and standby architecture, that is, one database has multiple standby databases for synchronous backup, and these standby databases may also be set in different cities to achieve disaster tolerance across different locations.
[0029] Through analysis, it is found that the excessive TPS of the database caused by the clearing of transaction data is mainly because clearing is usually completed within a short period of time to avoid overusing the database. For example, the transaction data from 9:00 to 10:00 (based on the transaction time) is usually cleared within a short period (such as 3 minutes) after 10:20. On the one hand, in business, 9:00 to 10:00 is regarded as a transaction batch, and the transaction data is cleared in units of transaction batches, which is well-organized. On the other hand, due to the characteristics of online transactions, if the transaction is not successful, processes such as reversal need to be carried out, and clearing cannot be carried out immediately after the transaction data is generated.
[0030] In addition, due to the above reasons, it also makes the amount of data synchronized by the database too large, resulting in a relatively high delay in database synchronization during the clearing process and affecting stability.
[0031] In response to this, the technical concept of this application is to avoid processing the clearing of transaction data within a transaction batch using a concentrated time period, but to use multiple time slices to achieve this, thereby dividing the transaction data into small pieces and realizing the peak shaving and valley filling of database utilization. At the same time, since the amount of data to be cleared within each time slice is usually not very large, an upper limit on the amount of transaction data to be cleared can be set to avoid excessive occupation of the transaction database.
[0032] The following will, in combination with the drawings, detail the technical solutions provided by each embodiment of this application.
[0033] Figure 1FIG. 0 shows a schematic flowchart of a transaction clearing method according to an embodiment of the present application. This method can be executed by a database server, which can be the database server of a transaction database. On the other hand, due to the extremely large amount of transaction data, a single transaction database may be difficult to handle high concurrency. Generally, in practice, multiple IDCs (Internet Data Centers) are often utilized, and several transaction databases are deployed in each IDC. The database server that executes the transaction clearing method of the present application can be the database server of the transaction database in an IDC.
[0034] In the embodiment of the present application, the clearing method of transaction data can use multiple clearing periods to clear the transaction data within a transaction batch. The clearing of the transaction data performed within each clearing period can all refer to Figure 1 the process shown to be implemented. Each clearing period can be understood as a time slice, that is, not all the transaction data within a transaction batch is cleared intensively within a relatively short time period.
[0035] The transaction batch can be divided according to the transaction time. For example, the transaction data generated between 8 o'clock and 9 o'clock is batch 09. In other embodiments, the transaction batch can also be divided according to the transaction serial number, etc.
[0036] As Figure 1 shown, the clearing method of the transaction data executed within the clearing period includes:
[0037] Step S110, determining the transaction data to be cleared corresponding to the transaction batch in the transaction database.
[0038] It can be seen here that the technical solution of the present application directly determines the transaction data to be cleared in the transaction database without the need to separately set up a clearing database, thus realizing the reuse of the transaction database, thereby saving hardware costs and operation and maintenance costs.
[0039] Step S120, using multiple clearing execution periods within the clearing period to clear the transaction data to be cleared respectively, where the amount of transaction data cleared within each clearing execution period does not exceed a first threshold.
[0040] Using multiple clearing execution periods in the clearing period to limit the transaction data that can be cleared within each time slice through a preset first threshold avoids overusing the transaction database and can also ensure that all transaction data can be cleared in a timely manner. Also, precisely because of this, the amount of data that needs to be synchronized each time is not much, thus improving the problem of synchronization delay.
[0041] It should be noted that the clearing strategy here can be implemented according to business requirements, such as summarization, classification, etc., as long as the transaction content recorded in the transaction data can support the clearing strategy.
[0042] The duration of the clearing execution period and the clearing period, as well as the first threshold, can be set according to requirements. For example, the clearing execution period is set to 1 second, the clearing period is set to 5 minutes, and the first threshold is set to 5200 pieces.
[0043] It can be seen that Figure 1 For the method shown, the to-be-cleared transaction data within a transaction batch is processed using multiple clearing periods instead of a single clearing period, and the upper limit of the amount of transaction data that can be cleared in each clearing execution period is limited, thereby avoiding an excessive amount of transaction data being cleared during the clearing execution period, and there is no need to separately set up a clearing database outside the transaction database, saving hardware costs, and at the same time reducing the latency of the master-slave synchronization of the database.
[0044] In an embodiment of the present application, in the above method, determining the to-be-cleared transaction data corresponding to the transaction batch in the transaction database includes: querying from the transaction database the transaction data whose transaction time matches the transaction time condition corresponding to the transaction batch, is in the transaction final state, and has not been cleared, as the to-be-cleared transaction data corresponding to the transaction batch.
[0045] After the transaction is officially completed, the transaction data will be in the transaction final state and will not change in terms of the transaction content. At this time, clearing can be performed. And it takes a certain amount of time from the generation of the transaction data to finally reaching the transaction final state. To ensure the correctness of the clearing, the transaction time condition corresponding to the transaction batch can be used for restriction. For example, if the current time is 8:25, only the transaction data of batch 09 before 8:05 is allowed to be cleared.
[0046] In an embodiment of the present application, in the above method, querying from the transaction database the transaction data whose transaction time matches the transaction time condition, is in the transaction final state, and has not been cleared, as the to-be-cleared transaction data includes: determining the transaction data in the transaction final state according to the transaction status identifier of the transaction data, and determining the transaction data that has not been cleared according to the clearing identifier of the transaction data.
[0047] According to the transaction time condition, the clearing identifier, and the transaction status identifier, corresponding database operation statements can be generated to set the data routing, and thus it can be determined which are the transaction data that need to be cleared.
[0048] In an embodiment of the present application, in the above method, using multiple clearing execution periods within the clearing period to separately clear the to-be-cleared transaction data includes: during the clearing execution period, clearing the to-be-cleared transaction data item by item, and accumulating the amount of transaction data that has been cleared within the current clearing execution period; when the accumulated amount of transaction data reaches the first threshold, or all the to-be-cleared transaction data has been cleared, terminating the clearing of the current clearing execution period.
[0049] Specifically, multiple clearing execution periods can share a variable for counting the amount of transaction data that has been cleared within the current clearing execution period. After the clearing of the clearing execution period ends, the value of the variable is reset to zero for the statistics of the next clearing execution period.
[0050] In an embodiment of the present application, the above method further includes: during the clearing execution period, determining the clearing identifiers of the transaction data that has been cleared in batches.
[0051] After the transaction data is cleared, in order to avoid repeated clearing, it is necessary to mark the transaction data that has been cleared, that is, mark it as cleared. In the prior art, marking is often carried out while clearing, which is also one of the reasons for the excessive TPS. Therefore, the present application further proposes to separate marking from clearing and mark the transaction data that has been cleared periodically or in batches. For example, after clearing 100 pieces of transaction data, mark these 100 pieces of transaction data. The clearing and marking of 100 pieces of transaction data are regarded as a database transaction as a whole. After verification, this processing method can reduce the TPS of the database while ensuring the clearing efficiency.
[0052] In some embodiments, if there are multiple transaction databases, it is necessary to summarize the clearing results of these transaction databases. Therefore, the corresponding clearing results can also be reported during marking, so as to summarize the clearing results at the table level into the library level, IDC level, transaction batch level, and so on in sequence.
[0053] Specifically, in an embodiment of the present application, in the above method, determining the clearing identifiers of the transaction data that has been cleared in batches includes: accumulating the amount of transaction data that has been cleared but the clearing identifiers have not been determined. When the accumulated amount of transaction data reaches the second threshold, batch-determine the clearing identifiers for the transaction data that has been cleared but the clearing identifiers have not been determined, and after determining the clearing identifiers, reset the accumulated amount of transaction data to zero.
[0054] In an embodiment of the present application, in the above method, the maximum executable duration of each clearing execution period is the same. Using multiple clearing execution periods within the clearing period to clear the to-be-cleared transaction data respectively includes: during the clearing execution period, using a clearing thread to clear the to-be-cleared transaction data and counting the total clearing duration; if the total duration is less than the maximum executable duration, determine the sleep duration according to the total duration and the maximum execution duration, and make the clearing thread sleep according to the sleep duration.
[0055] The clearing of this application can be executed by using a clearing thread. Specifically, a transaction database can use one clearing thread, and this clearing thread clears transaction data during multiple clearing execution periods within a clearing period. To balance robustness and utilization of computing resources, the following settings can be made, that is, the time required to clear the first threshold number of transaction data is less than the maximum executable duration of the clearing execution period. For example, the maximum executable duration of the clearing execution period is 1 second, and in fact, the time to clear 5,200 transaction data generally does not exceed 500 milliseconds. This can ensure stable clearing even in the case of database fluctuations, etc. However, this may cause waste of computing resources. Therefore, the clearing thread can be made to sleep. The sleep duration can be determined according to the method described above and will not be elaborated here.
[0056] In an embodiment of this application, in the above method, the total duration of multiple clearing execution periods within a single clearing period is not greater than a third threshold.
[0057] For example, the clearing period is 5 minutes, and the total duration of multiple clearing execution periods within the clearing period is limited to 4 minutes. This can avoid the following situation: This clearing period should start at 9:25 and end at 9:30, and the next clearing period starts at 9:30. However, due to some failures, this clearing period starts at 9:25:30. In this way, it can still be ensured that the original goal of this clearing period can be achieved before the next clearing period starts, which has strong robustness. The setting of the third threshold can be determined according to actual requirements.
[0058] In an embodiment of this application, the above method further includes: receiving a first clearing task, where the first clearing task corresponds to a transaction batch; the first execution time of the first clearing task is determined according to the start transaction time of the transaction batch and a first delay time; starting the first clearing period of this transaction batch according to the first execution time of the first clearing task, and respectively executing the first clearing task within each clearing period to implement the step of clearing by using multiple clearing periods.
[0059] Specifically, the clearing server can generate and issue the first clearing task, and the database server is responsible for execution. Taking the case where 8:00 to 9:00 is a transaction batch as an example, if the first delay time is 25 minutes and each clearing period is 5 minutes, then the first clearing period is started at 8:25, and the second clearing period is started at 8:30... In other words, the first clearing task is a timed task and is executed every 5 minutes.
[0060] In scenarios where multiple IDCs are used to deploy transaction databases and multiple transaction databases are deployed in each IDC, the first clearing task can be obtained by splitting the total clearing task one or more times. For example, the total clearing task can be configured or triggered by the operation and maintenance interface of the clearing server. The clearing server determines the transaction databases used for clearing based on the total clearing task, and further splits the total clearing task into sub-clearing tasks at the IDC level accordingly, and distributes them to the corresponding IDCs. The IDCs further split them into the first clearing tasks at the database level. When executing, the method of the foregoing embodiment can be referred to, querying and obtaining the transaction data in the data table, and performing subsequent clearing.
[0061] In some embodiments, the first clearing task is executed within a 5-minute clearing period as follows: Query the transaction data to be cleared. Each transaction database uses a clearing thread to clear the queried transaction data one by one. The clearing of every 100 transaction data is regarded as a database transaction.
[0062] Within 1 second (the maximum executable duration of the clearing execution period), if the cumulative amount of cleared transaction data reaches the clearing TPS (the first threshold), or there is no transaction data to be cleared, the clearing stops. If the amount of unlabeled transaction data reaches the second threshold, the reporting and labeling of the clearing results start, and so on. When the cumulative amount of cleared transaction data reaches the first threshold, the clearing stops. The cleared but unlabeled data can be labeled, and then the execution time is counted, the sleep time is calculated, and the clearing thread enters the sleep state.
[0063] If 4 minutes have been cumulatively executed within the clearing period, then the clearing stops. The already cleared but unlabeled data can continue to be labeled, and then the work within this clearing period ends.
[0064] In an embodiment of the present application, the above method further includes: receiving a second clearing task, where the second clearing task corresponds to a transaction batch, and the execution time of the second clearing task is determined according to the start transaction time of the transaction batch and the second delay time; according to the execution time of the second clearing task, execute the second clearing task to clear all the transaction data that has not been cleared in the transaction batch.
[0065] The main purpose of the second clearing task is to avoid abnormal execution of the first clearing task or excessive transaction data volume. Generally speaking, the transaction data that needs to be cleared by the second clearing task will be very small, and ideally there may be no data that needs to be cleared.
[0066] Figure 2 The figure shows a clearing TPS schematic diagram of centralized clearing using a single clearing period in the prior art. Figure 3Shown is a schematic diagram of a clearing TPS for clearing using multiple clearing periods according to an embodiment of the present application. The dark gray blocks represent the amount of transaction data to be cleared. It can be seen that the first clearing task is executed from 8:25 to 9:20, and the second clearing task is executed from 9:20 to 9:23. The amount of transaction data cleared by the second clearing task is very small compared.
[0067] Since the second clearing task mainly serves as a backup process, a threshold may not be set for TPS control.
[0068] The present application also provides a clearing device for transaction data to implement the clearing method of transaction data as described above.
[0069] Specifically, Figure 4 Shown is a schematic structural diagram of a clearing device for transaction data according to an embodiment of the present application. The clearing device 400 for transaction data can clear the transaction data within a transaction batch using multiple clearing periods. As Figure 4 shown, the clearing device 400 for transaction data includes:
[0070] A determination unit 410, configured to determine the to-be-cleared transaction data corresponding to the transaction batch in the transaction database during each clearing period.
[0071] A clearing execution unit 420, configured to clear the to-be-cleared transaction data respectively during each clearing period by using multiple clearing execution periods within the clearing period, wherein the amount of transaction data cleared within each clearing execution period does not exceed a first threshold.
[0072] In an embodiment of the present application, in the above device, the clearing execution unit 420 is configured to query, from the transaction database, the transaction data that matches the transaction time condition, is in the transaction final state, and has not been cleared, as the to-be-cleared transaction data according to the preset transaction time condition.
[0073] In an embodiment of the present application, in the above device, the clearing execution unit 420 is configured to determine the transaction data in the transaction final state according to the transaction status identifier of the transaction data, and determine the transaction data that has not been cleared according to the clearing identifier of the transaction data.
[0074] In an embodiment of the present application, in the above method, clearing the to-be-cleared transaction data respectively by using multiple clearing execution periods includes: during the clearing execution period, clearing the to-be-cleared transaction data item by item, and accumulating the amount of transaction data that has been cleared within the current clearing execution period; terminating the clearing of the current clearing execution period when the accumulated amount of transaction data reaches the first threshold or all the to-be-cleared transaction data has been cleared.
[0075] In an embodiment of the present application, in the above device, the sorting execution unit 420 is further configured to determine the sorting identifiers of the sorted transaction data in batches during the sorting execution period.
[0076] In an embodiment of the present application, in the above device, the sorting execution unit 420 is configured to accumulate the amount of transaction data that has been sorted but whose sorting identifier has not been determined. When the accumulated amount of transaction data reaches a second threshold, it batch-determines the sorting identifiers for the transaction data that has been sorted but whose sorting identifier has not been determined, and after determining the sorting identifiers, clears the accumulated amount of transaction data to zero.
[0077] In an embodiment of the present application, in the above device, the maximum executable duration of each sorting execution period is the same. The sorting execution unit 420 is configured to sort the to-be-sorted transaction data using a sorting thread during the sorting execution period and count the total sorting duration. If the total duration is less than the maximum executable duration, it determines the sleep duration based on the total duration and the maximum execution duration, and causes the sorting thread to sleep according to the sleep duration.
[0078] In an embodiment of the present application, in the above device, the total duration of multiple sorting execution periods within a single sorting period is not greater than a third threshold.
[0079] In an embodiment of the present application, in the above device, the determination unit 410 is configured to receive a first sorting task, and the first sorting task corresponds to a transaction batch. The first execution time of the first sorting task is determined based on the start transaction time of the transaction batch and a first delay time. It starts the first sorting period of the transaction batch according to the first execution time of the first sorting task, and executes the first sorting task separately within each sorting period to implement the step of sorting using multiple sorting periods.
[0080] In an embodiment of the present application, in the above device, the determination unit 410 is further configured to receive a second sorting task, and the second sorting task corresponds to a transaction batch. The execution time of the second sorting task is determined based on the start transaction time of the transaction batch and a second delay time. The sorting execution unit 420 is further configured to execute the second sorting task according to the execution time of the second sorting task to sort all the unsorted transaction data of the transaction batch.
[0081] It can be understood that the above sorting device for transaction data can implement each step of the transaction data sorting method executed by the database server in the foregoing embodiments. The relevant explanations regarding the transaction data sorting method are applicable to the transaction data sorting device and will not be elaborated here.
[0082] Figure 5 It is a schematic structural diagram of a database server in an embodiment of the present application. Please refer to Figure 5, at the hardware level, the database server includes a processor, and optionally also includes an internal bus, a network interface, and a memory. Among them, the memory may include memory, such as high-speed random access memory (Random-Access Memory, RAM), and may also include non-volatile memory, such as at least one disk memory, etc. Of course, the database server may also include other hardware required for other services.
[0083] The processor, network interface, and memory can be interconnected through an internal bus, and the internal bus can be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus, or an EISA (Extended Industry Standard Architecture) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For the sake of representation, Figure 5 only a bidirectional arrow is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0084] The memory is used to store programs. Specifically, the program can include program code, and the program code includes computer operation instructions. The memory can include memory and non-volatile memory, and provide instructions and data to the processor.
[0085] The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs it, forming a clearing device for transaction data at the logical level. The processor executes the program stored in the memory and is specifically used to perform the following operations:
[0086] Perform clearing using multiple clearing periods;
[0087] In each clearing period, determine the transaction data to be cleared in the transaction database, and use multiple clearing execution periods to clear the transaction data to be cleared respectively. Among them, the amount of transaction data cleared within each clearing execution period does not exceed the first threshold.
[0088] The above is as described in this application Figure 1The method executed by the transaction data sorting device disclosed in the illustrated embodiment can be applied to or implemented by a processor. The processor may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the integrated logic circuit in the hardware of the processor or the instructions in the form of software. The above-mentioned processor may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it may also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. It can implement or execute the various methods, steps, and logic block diagrams disclosed in the embodiments of the present application. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. The steps of the method disclosed in combination with the embodiments of the present application can be directly embodied as being executed and completed by the hardware decoding processor, or executed and completed by the combination of the hardware and software modules in the decoding processor. The software module may be located in a mature storage medium in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory, and the processor reads the information in the memory and combines its hardware to complete the steps of the above method.
[0089] The database server can also execute Figure 1 the method executed by the transaction data sorting device in Figure 1 the illustrated embodiment, and implement the functions of the transaction data sorting device in
[0090] The embodiments of the present application also propose a computer-readable storage medium that stores one or more programs. The one or more programs include instructions that, when executed by a database server including multiple application programs, can enable the database server to execute Figure 1 the method executed by the transaction data sorting device in the illustrated embodiment, and specifically used to execute:
[0091] Perform sorting using multiple sorting periods;
[0092] In each sorting period, determine the transaction data to be sorted in the transaction database, and use multiple sorting execution periods to sort the transaction data to be sorted respectively, where the amount of transaction data sorted within each sorting execution period does not exceed the first threshold.
[0093] Those skilled in the art will understand that the embodiments of the present application can be provided as a method, a system, or a computer program product. Therefore, the present application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk memory, CD-ROM, optical memory, etc.) containing computer-usable program code.
[0094] The present application is described with reference to the flowcharts and / or block diagrams of methods, apparatuses (systems), and computer program products according to the embodiments of the present application. It should be understood that each flow and / or block in the flowchart and / or block diagram, and the combination of flows and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to generate a machine, such that the instructions executed by the processor of the computer or other programmable data processing devices generate means for implementing the functions specified in Figure 1 one or more of the flows Figure 1 or blocks.
[0095] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, such that the instructions stored in the computer-readable memory generate a manufactured article including instruction means that implement the functions specified in Figure 1 one or more of the flows Figure 1 or blocks.
[0096] These computer program instructions can also be loaded onto a computer or other programmable data processing device, such that a series of operation steps are performed on the computer or other programmable device to generate a computer-implemented process, and thus the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in Figure 1 one or more of the flows Figure 1 or blocks.
[0097] In a typical configuration, a computing device includes one or more processors (CPUs), an input / output interface, a network interface, and a memory.
[0098] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0099] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0100] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0101] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0102] The above is only an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.
Claims
1. A method for clearing and separating transaction data, which is executed by a database server, wherein, The method includes clearing the transaction data within a transaction batch by using multiple clearing periods; Among them, in each clearing period, determine the to-be-cleared transaction data corresponding to the transaction batch in the transaction database; use multiple clearing execution periods within the clearing period to clear the to-be-cleared transaction data respectively, where the amount of transaction data cleared within each clearing execution period is not greater than the first threshold; The using multiple clearing execution periods within the clearing period to clear the to-be-cleared transaction data respectively includes: During the clearing execution period, clear the to-be-cleared transaction data one by one, and accumulate the amount of transaction data that has been cleared within this clearing execution period; when the accumulated amount of transaction data reaches the first threshold, or all the to-be-cleared transaction data has been cleared, terminate the clearing of this clearing execution period; The method further includes: During the clearing execution period, determine the clearing identifiers of the transaction data that has been cleared in batches; The determining the clearing identifiers of the transaction data that has been cleared in batches includes: Accumulate the amount of transaction data that has been cleared but the clearing identifier has not been determined. When the accumulated amount of transaction data reaches the second threshold, batch-determine the clearing identifiers for the transaction data that has been cleared but the clearing identifier has not been determined, and after determining the clearing identifiers, clear the accumulated amount of transaction data to zero; The determination of the clearing identifier and the clearing of the to-be-cleared transaction data are independent processes.
2. The method according to claim 1, characterized in that, The determining the to-be-cleared transaction data corresponding to the transaction batch in the transaction database includes: According to the transaction time condition corresponding to the transaction batch, query from the transaction database the transaction data whose transaction time matches the transaction time condition, is in the transaction end state and has not been cleared, as the to-be-cleared transaction data corresponding to the transaction batch.
3. The method according to claim 2, wherein The querying from the transaction database the transaction data whose transaction time matches the transaction time condition, is in the transaction end state and has not been cleared, as the to-be-cleared transaction data includes: Determine the transaction data in the transaction end state according to the transaction status identifier of the transaction data, and determine the transaction data that has not been cleared according to the clearing identifier of the transaction data.
4. The method according to claim 1, wherein The maximum executable duration of each clearing execution period is the same. The using multiple clearing execution periods within the clearing period to clear the to-be-cleared transaction data respectively includes: During the clearing execution period, use a clearing thread to clear the to-be-cleared transaction data, and count the total clearing duration; If the total duration is less than the maximum executable duration, determine the sleep duration according to the total duration and the maximum execution duration, and make the clearing thread sleep according to the sleep duration.
5. The method according to claim 1, characterized in that, The total duration of multiple clearing execution periods within a single clearing period is not greater than the third threshold.
6. The method according to any one of claims 1-5, characterized in that The method further includes: Receive a first clearing task, where the first clearing task corresponds to the transaction batch; the first execution time of the first clearing task is determined according to the start transaction time of the transaction batch and the first delay time; The first clearing period of the transaction batch is started according to the first execution time of the first clearing task, and the first clearing task is executed separately within each clearing period, so as to implement the step of performing clearing by using multiple clearing periods.
7. The method according to any one of claims 1-5, characterized in that, The method further includes: receiving a second clearing task, where the second clearing task corresponds to the transaction batch, and the execution time of the second clearing task is determined according to the start transaction time of the transaction batch and a second delay time; executing the second clearing task according to the execution time of the second clearing task to perform clearing on all the transaction data of the transaction batch that has not been cleared.
8. A clearing device for transaction data, which is applied to a database server, wherein, The device is used to implement the method according to any one of claims 1 to 7.
9. A database server, comprising: a processor; and a memory arranged to store computer-executable instructions, where the executable instructions, when executed, cause the processor to execute the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, where the computer-readable storage medium stores one or more programs, and when the one or more programs are executed by a database server including a plurality of application programs, the database server is caused to execute the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Method for data processing between clearing systems, and data clearing systems
CN107025236A
A network connection platform clearing method and device
CN109726183A